| | |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.common.config.FtpConfig; |
| | | import org.springblade.common.utils.DesensitizedUtil; |
| | | import org.springblade.core.cache.utils.CacheUtil; |
| | | import org.springblade.core.excel.util.ExcelUtil; |
| | | import org.springblade.core.http.util.HttpUtil; |
| | |
| | | //获取user |
| | | User user = JSON.parseObject(JSON.toJSONString(userMap.get("user")), User.class); |
| | | |
| | | //数据脱敏处理 |
| | | user.setAccount(user.getRealName().substring(0,1)+user.getCardid().substring(user.getCardid().length()-4)); |
| | | user.setCardid(DesensitizedUtil.desensitizedIdNumber(user.getCardid())); |
| | | user.setPhone(DesensitizedUtil.desensitizedPhoneNumber(user.getPhone())); |
| | | user.setName(DesensitizedUtil.desensitizedName(user.getName())); |
| | | user.setRealName(DesensitizedUtil.desensitizedName(user.getRealName())); |
| | | |
| | | |
| | | Integer userCount = userService.selectCount(user.getAccount()); |
| | | if (userCount > 0 && Func.isEmpty(user.getId())) { |
| | | throw new ServiceException(StringUtil.format("当前用户 [{}] 已存在!", user.getAccount())); |
| | |
| | | @PostMapping("/securitySaves") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R securitySaves(@RequestBody User user) { |
| | | Integer userCount = userService.selectCount(user.getAccount()); |
| | | //判断用户是否存在 |
| | | if (userCount > 0) { |
| | | throw new ServiceException(StringUtil.format("当前用户 [{}] 已存在!", user.getAccount())); |
| | | } |
| | | // Integer userCount = userService.selectCount(user.getAccount()); |
| | | // //判断用户是否存在 |
| | | // if (userCount > 0) { |
| | | // throw new ServiceException(StringUtil.format("当前用户 [{}] 已存在!", user.getAccount())); |
| | | // } |
| | | user.setRoleId("1495714343888039937"); |
| | | user.setDeptId("1424615972718895106"); |
| | | user.setStype("1"); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 保安员新增(数据同步调用) |
| | | * 保安员修改(数据同步调用) |
| | | */ |
| | | @PostMapping("/updateBySecurtiy") |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | User user1 = new User(); |
| | | user1.setIsDeleted(0); |
| | | user1.setStatus(1); |
| | | user1.setCardid(user.getCardid()); |
| | | // user1.setCardid(user.getCardid()); |
| | | user1.setSecurityId(user.getSecurityId()); |
| | | User one = userService.getOne(Condition.getQueryWrapper(user1)); |
| | | boolean status = false; |
| | | if (null!=one){ |
| | |
| | | User user1 = new User(); |
| | | user1.setIsDeleted(0); |
| | | user1.setStatus(1); |
| | | user1.setCardid(user.getOldCardid()); |
| | | user1.setSecurityId(user.getSecurityId()); |
| | | // user1.setCardid(user.getOldCardid()); |
| | | User one = userService.getOne(Condition.getQueryWrapper(user1)); |
| | | boolean status = false; |
| | | if (null!=one){ |
| | | //修改 |
| | | one.setAccount(user.getCardid()); |
| | | one.setCardid(user.getCardid()); |
| | | one.setPassword(user.getPassword()); |
| | | one.setAvatar(user.getAvatar()); |
| | | one.setPhone(user.getPhone()); |
| | | one.setRealName(user.getRealName()); |
| | | if (null!= one.getAccount()) { |
| | | one.setAccount(user.getAccount()); |
| | | } |
| | | if (null!= one.getCardid()) { |
| | | one.setCardid(user.getCardid()); |
| | | } |
| | | if (null!= one.getPassword()) { |
| | | one.setPassword(user.getPassword()); |
| | | } |
| | | if (null!= one.getAvatar()) { |
| | | one.setAvatar(user.getAvatar()); |
| | | } |
| | | if (null!= one.getPhone()) { |
| | | one.setPhone(user.getPhone()); |
| | | } |
| | | if (null!= one.getRealName()) { |
| | | one.setRealName(user.getRealName()); |
| | | } |
| | | one.setUpdateTime(new Date()); |
| | | //用户修改 |
| | | status = userService.updateById(one); |
| | |
| | | User user1 = new User(); |
| | | user1.setIsDeleted(0); |
| | | user1.setStatus(1); |
| | | user1.setCardid(user.getCardid()); |
| | | user1.setSecurityId(user.getSecurityId()); |
| | | // user1.setCardid(user.getCardid()); |
| | | User one = userService.getOne(Condition.getQueryWrapper(user1)); |
| | | boolean status = false; |
| | | if (null!=one){ |
| | |
| | | public R firstLogin(String id) { |
| | | return R.status(userService.firstLogin(id)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 清除无效编号 |
| | | */ |
| | | @GetMapping("/clearPaper") |
| | | public void clearPaper() { |
| | | //修改符合条件的用户信息 |
| | | String s0 ="update blade_user set securitynumber = '',hold = '2' where securitynumber like concat('%','赣洪2022','%') and right(securitynumber,5) >2000"; |
| | | FtpUtil.sqlFileClear(s0); |
| | | |
| | | //修改符合条件的编号信息 |
| | | String s1 ="delete from sys_security_paper where number like concat('%','赣洪2022','%') and right(number,5) >2000"; |
| | | FtpUtil.sqlFileClear(s1); |
| | | |
| | | //修改两个用户的编号 |
| | | String s2 ="update blade_user set securitynumber = '',hold = '2' where id=1498127507772190722"; |
| | | FtpUtil.sqlFileClear(s2); |
| | | |
| | | String s3 ="update blade_user set securitynumber = '',hold = '2' where id=1502082757986168834"; |
| | | FtpUtil.sqlFileClear(s3); |
| | | } |
| | | } |
| | | |