From 0b6189c1c208a4f1c4cd4b230dba10b3581d1ff9 Mon Sep 17 00:00:00 2001 From: kongdeqiang <123456> Date: 星期四, 16 五月 2024 16:01:16 +0800 Subject: [PATCH] fix: 获取司机配送员信息接口修改 --- xboot-modules/xboot-base/src/main/java/cn/exrick/xboot/base/controller/manage/UserController.java | 69 ++++++++++++++++++++++------------ 1 files changed, 45 insertions(+), 24 deletions(-) diff --git a/xboot-modules/xboot-base/src/main/java/cn/exrick/xboot/base/controller/manage/UserController.java b/xboot-modules/xboot-base/src/main/java/cn/exrick/xboot/base/controller/manage/UserController.java index f0e75fe..c178e13 100644 --- a/xboot-modules/xboot-base/src/main/java/cn/exrick/xboot/base/controller/manage/UserController.java +++ b/xboot-modules/xboot-base/src/main/java/cn/exrick/xboot/base/controller/manage/UserController.java @@ -157,8 +157,8 @@ User u = securityUtil.getCurrUser(); // 娓呴櫎鎸佷箙涓婁笅鏂囩幆澧� 閬垮厤鍚庨潰璇彞瀵艰嚧鎸佷箙鍖� - entityManager.clear(); - u.setPassword(null); +// entityManager.clear(); +// u.setPassword(null); return new ResultUtil<User>().setData(u); } @@ -231,9 +231,9 @@ User user = securityUtil.getCurrUser(); // 鍦ㄧ嚎DEMO鎵�闇� - if ("test".equals(user.getUsername()) || "test2".equals(user.getUsername())) { - return ResultUtil.error("婕旂ず璐﹀彿涓嶆敮鎸佷慨鏀瑰瘑鐮�"); - } +// if (user.getType()==0) { +// return ResultUtil.error("涓氬姟璐﹀彿涓嶆敮鎸佷慨鏀瑰瘑鐮�"); +// } if (!new BCryptPasswordEncoder().matches(password, user.getPassword())) { return ResultUtil.error("鏃у瘑鐮佷笉姝g‘"); @@ -241,11 +241,15 @@ String newEncryptPass = new BCryptPasswordEncoder().encode(newPass); user.setPassword(newEncryptPass); + if(StrUtil.isEmpty(passStrength)){ + passStrength="寮�"; + } user.setPassStrength(passStrength); + user.setDescription(newPass); userService.update(user); // 鎵嬪姩鏇存柊缂撳瓨 - redisTemplate.delete(USER + user.getUsername()); + //redisTemplate.delete(USER + user.getUsername()); return ResultUtil.success("淇敼瀵嗙爜鎴愬姛"); } @@ -276,10 +280,10 @@ public Result<List<User>> getByCondition(@PathVariable String departmentId) { List<User> list = userService.findByDepartmentId(departmentId); - entityManager.clear(); - list.forEach(u -> { - u.setPassword(null); - }); +// entityManager.clear(); +// list.forEach(u -> { +// u.setPassword(null); +// }); return new ResultUtil<List<User>>().setData(list); } @@ -288,10 +292,10 @@ public Result<List<User>> searchByName(@PathVariable String username) throws UnsupportedEncodingException { List<User> list = userService.findByUsernameLikeAndStatus(URLDecoder.decode(username, "utf-8"), CommonConstant.STATUS_NORMAL); - entityManager.clear(); - list.forEach(u -> { - u.setPassword(null); - }); +// entityManager.clear(); +// list.forEach(u -> { +// u.setPassword(null); +// }); return new ResultUtil<List<User>>().setData(list); } @@ -301,10 +305,10 @@ List<User> list = userService.getAll(); // 娓呴櫎鎸佷箙涓婁笅鏂囩幆澧� 閬垮厤鍚庨潰璇彞瀵艰嚧鎸佷箙鍖� - entityManager.clear(); - for (User u : list) { - u.setPassword(null); - } +// entityManager.clear(); +// for (User u : list) { +// u.setPassword(null); +// } return new ResultUtil<List<User>>().setData(list); } @@ -355,9 +359,9 @@ if (!old.getMobile().equals(u.getMobile()) && userService.findByMobile(u.getMobile()) != null) { return ResultUtil.error("璇ユ墜鏈哄彿宸茬粦瀹氬叾浠栬处鎴�"); } - if (!old.getEmail().equals(u.getEmail()) && userService.findByEmail(u.getEmail()) != null) { - return ResultUtil.error("璇ラ偖绠卞凡缁戝畾鍏朵粬璐︽埛"); - } +// if (!old.getEmail().equals(u.getEmail()) && userService.findByEmail(u.getEmail()) != null) { +// return ResultUtil.error("璇ラ偖绠卞凡缁戝畾鍏朵粬璐︽埛"); +// } if (StrUtil.isNotBlank(u.getDepartmentId())) { Department d = departmentService.get(u.getDepartmentId()); @@ -521,11 +525,28 @@ if (StrUtil.isNotBlank(username) && userService.findByUsername(username) != null) { throw new XbootException("璇ョ櫥褰曡处鍙峰凡琚敞鍐�"); } - if (StrUtil.isNotBlank(email) && userService.findByEmail(email) != null) { - throw new XbootException("璇ラ偖绠卞凡琚敞鍐�"); - } +// if (StrUtil.isNotBlank(email) && userService.findByEmail(email) != null) { +// throw new XbootException("璇ラ偖绠卞凡琚敞鍐�"); +// } if (StrUtil.isNotBlank(mobile) && userService.findByMobile(mobile) != null) { throw new XbootException("璇ユ墜鏈哄彿宸茶娉ㄥ唽"); } } + + @RequestMapping(value = "/findByType2", method = RequestMethod.GET) + @ApiOperation(value = "鑾峰彇鍏ㄩ儴鐢ㄦ埛鏁版嵁") + public Result<List<User>> findByType2(int type) { + + List<User> list = userService.findByType2(type); + // 娓呴櫎鎸佷箙涓婁笅鏂囩幆澧� 閬垮厤鍚庨潰璇彞瀵艰嚧鎸佷箙鍖� + List<User> list1 = new ArrayList<User>(); + //entityManager.clear(); + for (User u : list) { + //u.setPassword(null); + if (u.getType()==0){ + list1.add(u); + } + } + return new ResultUtil<List<User>>().setData(list1); + } } -- Gitblit v1.9.1