he2802 há 2 anos atrás
pai
commit
f9a27eebe1

+ 8 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/user/UserController.java

@@ -7,9 +7,11 @@ import com.zhongzheng.common.core.controller.BaseController;
 import com.zhongzheng.common.core.domain.AjaxResult;
 import com.zhongzheng.common.core.page.TableDataInfo;
 import com.zhongzheng.common.enums.BusinessType;
+import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.common.utils.poi.ExcelUtil;
 import com.zhongzheng.modules.alisms.service.IAliSmsService;
 import com.zhongzheng.modules.user.bo.*;
+import com.zhongzheng.modules.user.entity.ClientLoginUser;
 import com.zhongzheng.modules.user.service.IUserService;
 import com.zhongzheng.modules.user.vo.UserIdCardBatchVo;
 import com.zhongzheng.modules.user.vo.UserStatstVo;
@@ -201,4 +203,10 @@ public class UserController extends BaseController {
     {
         return AjaxResult.success(iUserService.batchUserId(list));
     }
+
+    @ApiOperation("修改客户端用户密码")
+    @PostMapping("/updatePwd")
+    public AjaxResult<Void> updatePwd(@RequestBody UserAppUpdatePwdBo bo) {
+        return toAjax(iUserService.updatePwdByClient(bo)? 1 : 0);
+    }
 }

+ 10 - 0
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/ToolsUtils.java

@@ -348,6 +348,16 @@ public class ToolsUtils {
         return result;
     }
 
+    public static boolean verifEasyPwd(String passWord) {
+        if(Validator.isEmpty(passWord)){
+            return false;
+        }
+        if(passWord.length()<6||passWord.length()>18){
+            return false;
+        }
+        return true;
+    }
+
     public static boolean verifPwd(String passWord) {
         if(Validator.isEmpty(passWord)){
             return false;

+ 20 - 0
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserServiceImpl.java

@@ -887,6 +887,26 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         return true;
     }
 
+    @Override
+    public Boolean updatePwdByClient(UserAppUpdatePwdBo bo) {
+        User user = getOne(new LambdaQueryWrapper<User>().eq(User::getUserId, bo.getUserId()));
+        if(Validator.isEmpty(user)){
+            throw new BaseException("用户信息错误");
+        }
+        if (Validator.isEmpty(bo.getNewPwd()))
+        {
+            throw new BaseException("新密码格式错误");
+        }
+        if(!ToolsUtils.verifEasyPwd(bo.getNewPwd())){
+            throw new CustomException("密码应由6-18位组成");
+        }
+        user.setPassword(SecurityUtils.encryptPassword(bo.getNewPwd()));
+        user.setPwdTime(DateUtils.getNowTime());
+        user.setUpdateTime(DateUtils.getNowTime());
+        updateById(user);
+        return true;
+    }
+
     @Override
     public List<UserIdCardBatchVo> batchUserId(List<UserIdCardAddBo> list) {
         List<UserIdCardBatchVo> list1 = new ArrayList<>();

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserService.java

@@ -111,6 +111,8 @@ public interface IUserService extends IService<User> {
 
 	Boolean updatePwd(UserAppUpdatePwdBo bo);
 
+	Boolean updatePwdByClient(UserAppUpdatePwdBo bo);
+
 	List<UserIdCardBatchVo> batchUserId(List<UserIdCardAddBo> list);
 
 	boolean editShareActivityCode(UserEditBo bo);