| | |
| | | import io.swagger.annotations.ApiParam; |
| | | import com.alibaba.fastjson.JSON; |
| | | import lombok.AllArgsConstructor; |
| | | import net.sf.json.JSONObject; |
| | | import org.apache.commons.codec.Charsets; |
| | | import org.springblade.common.cache.DictCache; |
| | | import org.springblade.common.config.FtpConfig; |
| | |
| | | import org.springblade.common.excel.CustomCellWriteHeightConfig; |
| | | import org.springblade.common.excel.CustomCellWriteWeightConfig; |
| | | import org.springblade.common.excel.RowWriteHandler; |
| | | import org.springblade.common.utils.HttpClientUtils; |
| | | import org.springblade.common.utils.HttpReqUtil; |
| | | import org.springblade.common.utils.ImageUtils; |
| | | import org.springblade.common.utils.arg; |
| | | import org.springblade.core.cache.utils.CacheUtil; |
| | |
| | | import org.springblade.modules.securitypaper.service.SecurityPaperService; |
| | | import org.springblade.modules.signinrecords.entity.SignInRecords; |
| | | import org.springblade.modules.signinrecords.service.SignInRecordsService; |
| | | import org.springblade.modules.system.dto.UserDTO; |
| | | import org.springblade.modules.system.entity.Dept; |
| | | import org.springblade.modules.system.entity.Role; |
| | | import org.springblade.modules.system.entity.User; |
| | |
| | | import org.springblade.modules.system.service.IDeptService; |
| | | import org.springblade.modules.system.service.IRoleService; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springblade.modules.system.service.MyAsyncService; |
| | | import org.springblade.modules.system.vo.DeptVO; |
| | | import org.springblade.modules.system.vo.UserVO; |
| | | import org.springblade.modules.system.wrapper.UserWrapper; |
| | | import org.springblade.modules.training.entity.TrainingRegistration; |
| | | import org.springblade.modules.training.service.TrainingRegistrationService; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | |
| | | |
| | | private final SecurityPaperService securityPaperService; |
| | | |
| | | private final MyAsyncService myAsyncService; |
| | | |
| | | /** |
| | | * 查询单条 |
| | |
| | | FtpUtil.sqlFileUpload(s); |
| | | } |
| | | |
| | | userService.updateById(user); |
| | | boolean status = userService.updateById(user); |
| | | //qfqk 数据推送 |
| | | if (status){ |
| | | myAsyncService.updateUserByQfqk(user); |
| | | } |
| | | |
| | | //内网更新 |
| | | String s1 = |
| | | "update blade_user set status = " + "'" + user.getStatus() + "'" |
| | |
| | | } |
| | | } |
| | | |
| | | int state = 0; |
| | | //如果是异常标记 |
| | | if (null!=user.getExaminationType() && !user.getExaminationType().equals("")){ |
| | | if (user.getExaminationType().equals("1")) { |
| | | //吊销保安证 |
| | | user.setHold("3"); |
| | | state = 1; |
| | | } |
| | | } |
| | | |
| | | user.setPassword(user1.getPassword()); |
| | | user.setUpdateTime(new Date()); |
| | | userService.updateById(user); |
| | | |
| | | //如果身份证号修改 |
| | | if (!user.getCardid().equals(user1.getCardid())){ |
| | | //账号,密码也修改 |
| | | user.setAccount(user.getCardid()); |
| | | //获取默认密码配置 |
| | | user.setPassword(user.getCardid().substring(user.getCardid().length() - 6)); |
| | | //加密 |
| | | if (Func.isNotEmpty(user.getPassword())) { |
| | | user.setPassword(DigestUtil.encrypt(user.getPassword())); |
| | | } |
| | | state = 2; |
| | | } |
| | | |
| | | //修改 |
| | | boolean status = userService.updateById(user); |
| | | |
| | | if (status) { |
| | | if (state == 2) { |
| | | UserDTO userDTO = new UserDTO(); |
| | | userDTO.setAccount(user.getAccount()); |
| | | userDTO.setCardid(user.getCardid()); |
| | | userDTO.setOldCardid(user1.getCardid()); |
| | | userDTO.setPassword(user.getPassword()); |
| | | userDTO.setRealName(user.getRealName()); |
| | | userDTO.setPhone(user.getPhone()); |
| | | userDTO.setSex(user.getSex()); |
| | | userDTO.setAvatar(user.getAvatar()); |
| | | //推送qfqk |
| | | myAsyncService.updateUserByAccount(userDTO); |
| | | } else { |
| | | myAsyncService.updateUserByQfqk(user); |
| | | } |
| | | } |
| | | |
| | | |
| | | String rtime; |
| | | if (user.getRtime() == null) { |
| | | String s1 = |
| | |
| | | AccreditationRecords accreditationRecords1 = collect.get(0); |
| | | //修改为已制证状态 |
| | | accreditationRecords1.setStatus(2); |
| | | //记录打印时间 |
| | | accreditationRecords1.setPaperTime(new Date()); |
| | | //更新 |
| | | accreditationRecordsService.updateById(accreditationRecords1); |
| | | //同步 |
| | |
| | | CacheUtil.clear(USER_CACHE); |
| | | List<String> list = Arrays.asList(ids.split(",")); |
| | | list.forEach(id -> { |
| | | User user = userService.getById(id); |
| | | User user1 = new User(); |
| | | user1.setId(user.getId()); |
| | | user1.setCardid(user.getCardid()); |
| | | user1.setIsDeleted(1); |
| | | //qfqk 同步 |
| | | myAsyncService.deleteUserByQfqk(user1); |
| | | //内网同步 |
| | | String s1 = "update blade_user set is_deleted = 1 where id = " + "'" + id + "'"; |
| | | FtpUtil.sqlFileUpload(s1); |
| | |
| | | securityExcel.setCardid("360XXX19XXXXXX****"); |
| | | securityExcel.setNation("汉"); |
| | | securityExcel.setRegistered("江西省南昌市******"); |
| | | securityExcel.setHold("是"); |
| | | // securityExcel.setHold("是"); |
| | | securityExcel.setSecuritynumber("赣洪202100001"); |
| | | list.add(securityExcel); |
| | | |
| | |
| | | securityExcel1.setCardid("360XXX19XXXXXX****"); |
| | | securityExcel1.setNation("汉"); |
| | | securityExcel1.setRegistered("江西省南昌市******"); |
| | | securityExcel1.setHold("否"); |
| | | // securityExcel1.setHold("否"); |
| | | securityExcel1.setSecuritynumber(""); |
| | | list.add(securityExcel1); |
| | | String fileName = null; |
| | |
| | | securityExcel.setCardid("360XXX19XXXXXX****"); |
| | | securityExcel.setNation("汉"); |
| | | securityExcel.setRegistered("江西省南昌市******"); |
| | | securityExcel.setHold("是"); |
| | | // securityExcel.setHold("是"); |
| | | securityExcel.setSecuritynumber("赣洪202100001"); |
| | | list.add(securityExcel); |
| | | |
| | |
| | | securityExcel1.setCardid("360XXX19XXXXXX****"); |
| | | securityExcel1.setNation("汉"); |
| | | securityExcel1.setRegistered("江西省南昌市******"); |
| | | securityExcel1.setHold("否"); |
| | | // securityExcel1.setHold("否"); |
| | | securityExcel1.setSecuritynumber(""); |
| | | list.add(securityExcel1); |
| | | String fileName = null; |
| | |
| | | user.setAvatar(FtpConfig.ip + user.getAvatar().substring(26)); |
| | | } |
| | | |
| | | //数据推送 |
| | | //1.群访群控数据推送(异步) |
| | | if (status) { |
| | | myAsyncService.qfqkUserSave(user); |
| | | } |
| | | |
| | | |
| | | //2.内网数据推送 |
| | | String s = "insert into blade_user(" + |
| | | "id,tenant_id,account,password,name,real_name,avatar,email,phone,sex," + |
| | | "role_id,dept_id,cardid,nativePlace,nation,fingerprint,education," + |
| | |
| | | // ExcelUtil.export(response, "保安员导入数据模板", "保安员数据表", list, UserExcel.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 保安员账号校验 |
| | | * @param user |
| | | * @return |
| | | */ |
| | | @GetMapping("/checkAccount") |
| | | public void checkAccount(User user) { |
| | | //根据身份证号查询用户 |
| | | User user1 = new User(); |
| | | user1.setAccount(user.getCardid()); |
| | | user1.setIsDeleted(0); |
| | | user1.setStatus(1); |
| | | User user2 = userService.getOne(Condition.getQueryWrapper(user1)); |
| | | if (null!=user2){ |
| | | //判断是单位否一致 |
| | | if (null!=user.getDeptId() && !user.getDeptId().equals("")) { |
| | | if (!user2.getDeptId().equals(user.getDeptId())) { |
| | | throw new ServiceException(StringUtil.format("当前用户 [{}] 已在其他单位录入!", user.getCardid())); |
| | | } else { |
| | | throw new ServiceException(StringUtil.format("当前用户 [{}] 已存在!", user.getCardid())); |
| | | } |
| | | }else { |
| | | //没有传 deptId 的情况 |
| | | throw new ServiceException(StringUtil.format("当前用户 [{}] 已存在!", user.getCardid())); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 年龄分布查询 |
| | | * @param user |
| | | * @return |
| | | */ |
| | | @PostMapping("/getAgeStatistics") |
| | | public R getAgeStatistics(UserVO user){ |
| | | return R.data(userService.getAgeStatistics(user)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询登录密码还是 123456 的单位信息 |
| | | * @return |
| | | */ |
| | | @GetMapping("/getNotUpdatePwdInfo") |
| | | public R getNotUpdatePwdInfo(){ |
| | | return R.data(userService.getNotUpdatePwdInfo()); |
| | | } |
| | | } |