| | |
| | | import org.springblade.core.tool.support.Kv; |
| | | import org.springblade.core.tool.utils.*; |
| | | import org.springblade.modules.FTP.FtpUtil; |
| | | import org.springblade.modules.accreditation.entity.AccreditationRecords; |
| | | import org.springblade.modules.accreditation.service.AccreditationRecordsService; |
| | | import org.springblade.modules.dispatcher.entity.Dispatcher; |
| | | import org.springblade.modules.dispatcher.service.IDispatcherService; |
| | | import org.springblade.modules.exam.excel.ExportExamScoreExcel; |
| | |
| | | import org.springblade.modules.experience.service.IExperienceService; |
| | | import org.springblade.modules.jurisdiction.entity.Jurisdiction; |
| | | import org.springblade.modules.jurisdiction.service.JurisdictionService; |
| | | import org.springblade.modules.securitypaper.entity.SecurityPaper; |
| | | 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.entity.Dept; |
| | |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static org.springblade.common.config.FtpConfig.*; |
| | | import static org.springblade.core.cache.constant.CacheConstant.SYS_CACHE; |
| | |
| | | |
| | | |
| | | private final TrainingRegistrationService trainingRegistrationService; |
| | | |
| | | private final AccreditationRecordsService accreditationRecordsService; |
| | | |
| | | |
| | | private final SecurityPaperService securityPaperService; |
| | | |
| | | /** |
| | | * 查询单条 |
| | |
| | | url = split[1]; |
| | | } |
| | | } |
| | | |
| | | //判断是否持证 |
| | | // if (user.getHold().equals("1") && null!=user.getSecuritynumber() && !user.getSecuritynumber().equals("")){ |
| | | // //持证,校验保安证编号是否合法 |
| | | // SecurityPaper securityPaper = new SecurityPaper(); |
| | | // securityPaper.setIdCardNo(user.getCardid()); |
| | | // List<SecurityPaper> securityPaperList = securityPaperService.list(Condition.getQueryWrapper(securityPaper)); |
| | | // if (securityPaperList.size()>0){ |
| | | // boolean status = false; |
| | | // //遍历 |
| | | // for (SecurityPaper paper : securityPaperList) { |
| | | // if (paper.getNumber().equals(user.getSecuritynumber())){ |
| | | // status = true; |
| | | // } |
| | | // } |
| | | // if (!status){ |
| | | // throw new ServiceException("保安证编号不匹配,请核实!"); |
| | | // } |
| | | // }else { |
| | | // throw new ServiceException("保安证编号不匹配,请核实!"); |
| | | // } |
| | | // } |
| | | |
| | | //如果是离职 |
| | | if (null!=user.getStatus()){ |
| | |
| | | } else { |
| | | paperTime = new SimpleDateFormat("yyyy-MM-dd").format(user.getPaperTime()); |
| | | } |
| | | //更新制证记录制证状态 |
| | | AccreditationRecords accreditationRecords = new AccreditationRecords(); |
| | | accreditationRecords.setUserId(user.getId()); |
| | | //审核通过的 |
| | | accreditationRecords.setAuditStatus(2); |
| | | //未制证的记录 |
| | | accreditationRecords.setStatus(1); |
| | | //查询 |
| | | List<AccreditationRecords> list = accreditationRecordsService.list(Condition.getQueryWrapper(accreditationRecords)); |
| | | if (list.size()>0) { |
| | | //排序 |
| | | List<AccreditationRecords> collect = list.stream().sorted(Comparator.comparing(AccreditationRecords::getId).reversed()).collect(Collectors.toList()); |
| | | //取出第一个 |
| | | AccreditationRecords accreditationRecords1 = collect.get(0); |
| | | //修改为已制证状态 |
| | | accreditationRecords1.setStatus(2); |
| | | //更新 |
| | | accreditationRecordsService.updateById(accreditationRecords1); |
| | | //同步 |
| | | String s1 = |
| | | "update blade_user set paper_time = " + "'" + paperTime + "'" |
| | | + ",user_type = " + "'" + user.getUserType() + "'" |
| | | + ",update_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user.getUpdateTime()) + "'" |
| | | + " " + "where id = " + "'" + user.getId() + "';" + |
| | | "update sys_accreditation_records set status = " + "'" + accreditationRecords1.getStatus() + "'" + |
| | | " " + "where id = " + "'" + accreditationRecords1.getId() + "'"; |
| | | FtpUtil.sqlFileUpload(s1); |
| | | //返回 |
| | | return R.success("修改成功"); |
| | | } |
| | | |
| | | String s1 = |
| | | "update blade_user set paper_time = " + "'" + paperTime + "'" |
| | | + ",user_type = " + "'" + user.getUserType() + "'" |
| | |
| | | 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.setExaminationType("0"); |
| | | user.setAccount(user.getCardid()); |
| | | |
| | | // Integer userCount = userService.selectCount(user.getAccount()); |
| | | User user1 = new User(); |
| | | user1.setIsDeleted(0); |
| | | user1.setStatus(1); |
| | |
| | | } |
| | | } |
| | | |
| | | //判断是否持证 |
| | | // if (user.getHold().equals("1")){ |
| | | // //持证,校验保安证编号是否合法 |
| | | // SecurityPaper securityPaper = new SecurityPaper(); |
| | | // securityPaper.setIdCardNo(user.getCardid()); |
| | | // List<SecurityPaper> securityPaperList = securityPaperService.list(Condition.getQueryWrapper(securityPaper)); |
| | | // if (securityPaperList.size()>0){ |
| | | // boolean status = false; |
| | | // //遍历 |
| | | // for (SecurityPaper paper : securityPaperList) { |
| | | // if (paper.getNumber().equals(user.getSecuritynumber())){ |
| | | // status = true; |
| | | // } |
| | | // } |
| | | // if (!status){ |
| | | // throw new ServiceException("保安证编号不匹配,请核实!"); |
| | | // } |
| | | // }else { |
| | | // throw new ServiceException("保安证编号不匹配,请核实!"); |
| | | // } |
| | | // } |
| | | |
| | | String url = ""; |
| | | if (null!=user.getFingerprint() && !user.getFingerprint().equals("")) { |
| | | if (user.getFingerprint().length()>100) { |
| | |
| | | url = split[1]; |
| | | } |
| | | } |
| | | // } |
| | | //未持证 |
| | | // if (user.getHold().equals("2")){ |
| | | // //分配未持证保安角色 |
| | | // Role role = new Role(); |
| | | // role.setRoleAlias("未持证保安"); |
| | | // Role oneRole = roleService.getOne(Condition.getQueryWrapper(role)); |
| | | // user.setRoleId(oneRole.getId().toString()); |
| | | // } |
| | | // } |
| | | |
| | | //密码加密 |
| | | if (Func.isNotEmpty(user.getCardid())) { |
| | | // user.setPassword(DigestUtil.encrypt(user.getPassword())); |
| | |
| | | // 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)); |
| | | } |
| | | |
| | | |
| | | } |