| | |
| | | import org.springblade.modules.system.excel.*; |
| | | import org.springblade.modules.system.node.TreeNode; |
| | | import org.springblade.modules.system.service.*; |
| | | import org.springblade.modules.system.vo.UserInfoDetail; |
| | | import org.springblade.modules.system.vo.UserVO; |
| | | import org.springblade.modules.system.wrapper.UserWrapper; |
| | | import org.springblade.modules.training.entity.TrainingRegistration; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 微信注册 |
| | | * @param user |
| | | * @return |
| | | */ |
| | | @PostMapping("/wxRegister") |
| | | public R wxRegister(User user){ |
| | | //密码加密 |
| | | if (Func.isNotEmpty(user.getPassword())) { |
| | | user.setPassword(DigestUtil.encrypt(user.getPassword())); |
| | | } |
| | | |
| | | Boolean result = userService.wxRegister(user); |
| | | return R.status(result); |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @PostMapping("/update") |
| | |
| | | return R.data(200,null,"修改成功!"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 离职 |
| | | */ |
| | | @PostMapping("/userLeave") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "修改", notes = "传入User") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R userLeave(@Valid @RequestBody Map<String, Object> userMap) throws Exception { |
| | | //获取user |
| | | User user = JSON.parseObject(JSON.toJSONString(userMap), User.class); |
| | | //分配保安角色 |
| | | CacheUtil.clear(USER_CACHE); |
| | | // 指纹设置 |
| | | fingerprintSet(user); |
| | | //如果是离职 |
| | | boolean b = leaveHandle(user); |
| | | return R.status(b); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 离职处理 |
| | | * @param user |
| | |
| | | dispatcher1.setStatus(1); |
| | | dispatcher1.setUpdateTime(new Date()); |
| | | boolean b = dispatcherService.updateById(dispatcher1); |
| | | if (b) { |
| | | String s1 = |
| | | "update sys_dispatcher set status = " + "'" + dispatcher1.getStatus() + "'" |
| | | + ",update_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(dispatcher1.getUpdateTime()) + "'" |
| | | + " " + "where id = " + "'" + dispatcher1.getId() + "'"; |
| | | myAsyncService.dataSync(s1); |
| | | } |
| | | // if (b) { |
| | | // String s1 = |
| | | // "update sys_dispatcher set status = " + "'" + dispatcher1.getStatus() + "'" |
| | | // + ",update_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(dispatcher1.getUpdateTime()) + "'" |
| | | // + " " + "where id = " + "'" + dispatcher1.getId() + "'"; |
| | | // myAsyncService.dataSync(s1); |
| | | // } |
| | | }); |
| | | } |
| | | |
| | |
| | | experience1.setDeparturetime(new Date()); |
| | | //更新从业记录信息 |
| | | experienceService.updateById(experience1); |
| | | //数据同步 |
| | | String s1 = |
| | | "update sys_experience set departureTime = " + "'" + new SimpleDateFormat("yyyy-MM-dd").format(experience1.getDeparturetime()) + "'" |
| | | + " " + "where id = " + "'" + experience1.getId() + "'"; |
| | | //FtpUtil.sqlFileUpload(s1); |
| | | myAsyncService.dataSync(s1); |
| | | // //数据同步 |
| | | // String s1 = |
| | | // "update sys_experience set departureTime = " + "'" + new SimpleDateFormat("yyyy-MM-dd").format(experience1.getDeparturetime()) + "'" |
| | | // + " " + "where id = " + "'" + experience1.getId() + "'"; |
| | | // //FtpUtil.sqlFileUpload(s1); |
| | | // myAsyncService.dataSync(s1); |
| | | } else { |
| | | //新增 |
| | | if (null != user.getRtime()) { |
| | | experience.setEntrytime(user.getRtime()); |
| | | } else { |
| | | experience.setEntrytime(new Date()); |
| | | } |
| | | experience.setDeparturetime(new Date()); |
| | | experience.setName(user.getRealName()); |
| | | if (null != user.getReasonForLeav() && !user.getReasonForLeav().equals("")) { |
| | |
| | | experience.setSecurityid(user.getId().toString()); |
| | | //新增 |
| | | boolean save = experienceService.save(experience); |
| | | if (save) { |
| | | //内网同步 |
| | | String s = "insert into sys_experience(id,name,entryTime,departureTime,leaving,cardId,companyname,securityId) " + |
| | | "values(" + "'" + experience.getId() + "'" + |
| | | "," + "'" + experience.getName() + "'" + |
| | | "," + "'" + new SimpleDateFormat("yyyy-MM-dd").format(experience.getEntrytime()) + "'" + |
| | | "," + "'" + new SimpleDateFormat("yyyy-MM-dd").format(experience.getDeparturetime()) + "'" + |
| | | "," + "'" + experience.getLeaving() + "'" + |
| | | "," + "'" + experience.getCardid() + "'" + |
| | | "," + "'" + experience.getCompanyname() + "'" + |
| | | "," + "'" + experience.getSecurityid() + "'" |
| | | + ")"; |
| | | myAsyncService.dataSync(s); |
| | | } |
| | | } |
| | | |
| | | boolean status = userService.updateById(user); |
| | | //qfqk 数据推送 |
| | | if (status) { |
| | | // myAsyncService.updateUserByQfqk(user); |
| | | //内网更新 |
| | | String s1 = |
| | | "update blade_user set status = " + "'" + user.getStatus() + "'" |
| | | + ",update_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "'" |
| | | + " " + "where id = " + "'" + user.getId() + "'"; |
| | | myAsyncService.dataSync(s1); |
| | | } |
| | | return true; |
| | | } |
| | | } |
| | |
| | | signInRecordsService.updateById(inRecordsServiceOne); |
| | | } |
| | | } |
| | | |
| | | //内网同步 |
| | | String s1 = |
| | | "update blade_user set account = " + "'" + user.getCardid() + "'" |
| | | + ",real_name = " + "'" + user.getRealName() + "'" |
| | | + ",avatar = " + "'" + user.getAvatar() + "'" |
| | | + ",sex = " + "'" + user.getSex() + "'" |
| | | + ",cardid = " + "'" + user.getCardid() + "'" |
| | | + ",nation = " + "'" + user.getNation() + "'" |
| | | + ",fingerprint = " + "'" + url + "'" |
| | | + ",my_picture = " + "'" + user.getMyPicture() + "'" |
| | | + ",address = " + "'" + user.getAddress() + "'" |
| | | + ",registered = " + "'" + user.getRegistered() + "'" |
| | | + ",securitynumber = " + "'" + user.getSecuritynumber() + "'" |
| | | + ",update_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user.getUpdateTime()) + "'" |
| | | + ",hold = " + "'" + user.getHold() + "'" |
| | | + ",cell = " + "'" + user.getCell() + "'" |
| | | + " " + "where id = " + "'" + user.getId() + "'"; |
| | | //FtpUtil.sqlFileUpload(s1); |
| | | myAsyncService.dataSync(s1); |
| | | return R.success("修改成功"); |
| | | } |
| | | |
| | |
| | | return R.success("操作成功"); |
| | | } |
| | | |
| | | // /** |
| | | // * 导出用户 |
| | | // */ |
| | | // @GetMapping("export-user") |
| | | // @ApiOperationSupport(order = 13) |
| | | // @ApiOperation(value = "导出用户", notes = "传入user") |
| | | // public void exportUser(@ApiIgnore @RequestParam Map<String, Object> user, BladeUser bladeUser, HttpServletResponse response) { |
| | | /** |
| | | * 导出用户 |
| | | */ |
| | | @GetMapping("export-user") |
| | | @ApiOperationSupport(order = 13) |
| | | @ApiOperation(value = "导出用户", notes = "传入user") |
| | | public void exportUser(@ApiIgnore @RequestParam Map<String, Object> user, BladeUser bladeUser, HttpServletResponse response) { |
| | | // QueryWrapper<User> queryWrapper = Condition.getQueryWrapper(user, User.class); |
| | | // if (!AuthUtil.isAdministrator()) { |
| | | // queryWrapper.lambda().eq(User::getTenantId, bladeUser.getTenantId()); |
| | | // } |
| | | // queryWrapper.lambda().eq(User::getIsDeleted, BladeConstant.DB_NOT_DELETED); |
| | | // List<UserExcel> list = userService.exportUser(queryWrapper); |
| | | // ExcelUtil.export(response, "用户数据" + DateUtil.time(), "用户数据表", list, UserExcel.class); |
| | | // } |
| | | List<UserExcel> list = userService.exportUser(user); |
| | | ExcelUtil.export(response, "用户数据" + DateUtil.time(), "用户数据表", list, UserExcel.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | securityExcel.setSex("男"); |
| | | securityExcel.setCardid("360XXX19XXXXXX****"); |
| | | securityExcel.setNation("汉"); |
| | | securityExcel.setRegistered("山西省晋城市******"); |
| | | securityExcel.setPermanentResidenceAddress("山西省晋城市******"); |
| | | securityExcel.setEducation("本科"); |
| | | securityExcel.setPoliticaloutlook("群众"); |
| | | securityExcel.setUnitName("晋城市***公司"); |
| | | securityExcel.setAddress("山西省晋城市******"); |
| | | securityExcel.setDwellAddress("山西省晋城市******"); |
| | | securityExcel.setAcceptanceTime("2023/12/01"); |
| | | list.add(securityExcel); |
| | | |
| | | SecurityExcel securityExcel1 = new SecurityExcel(); |
| | |
| | | securityExcel1.setSex("女"); |
| | | securityExcel1.setCardid("360XXX19XXXXXX****"); |
| | | securityExcel1.setNation("汉"); |
| | | securityExcel1.setRegistered("山西省晋城市******"); |
| | | securityExcel1.setPermanentResidenceAddress("山西省晋城市******"); |
| | | securityExcel1.setEducation("本科"); |
| | | securityExcel1.setPoliticaloutlook("党员"); |
| | | securityExcel1.setUnitName("晋城市***公司"); |
| | | securityExcel1.setAddress("山西省晋城市******"); |
| | | securityExcel1.setDwellAddress("山西省晋城市******"); |
| | | securityExcel1.setAcceptanceTime("2023/12/01"); |
| | | list.add(securityExcel1); |
| | | String fileName = null; |
| | | try { |
| | |
| | | public void experienceSave(User user) { |
| | | //从业记录新增 |
| | | Experience experience = new Experience(); |
| | | |
| | | String rtime; |
| | | String paperTime; |
| | | if (user.getRtime() == null) { |
| | | rtime = null; |
| | | } else { |
| | | rtime = new SimpleDateFormat("yyyy-MM-dd").format(user.getRtime()); |
| | | experience.setEntrytime(user.getRtime()); |
| | | } |
| | | Dept dept = iDeptService.getById(user.getDeptId()); |
| | | experience.setCardid(user.getCardid()); |
| | | experience.setSecurityid(user.getId().toString()); |
| | |
| | | //FtpUtil.sqlFileUpload(s1); |
| | | myAsyncService.dataSync(s1); |
| | | } else { |
| | | //新增 |
| | | if (null != user.getRtime()) { |
| | | experience.setEntrytime(user.getRtime()); |
| | | } else { |
| | | experience.setEntrytime(new Date()); |
| | | } |
| | | experience.setDeparturetime(new Date()); |
| | | experience.setName(user.getRealName()); |
| | | if (null != user.getReasonForLeav() && !user.getReasonForLeav().equals("")) { |
| | |
| | | public R getNotUpdatePwdInfo() { |
| | | return R.data(userService.getNotUpdatePwdInfo()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 数据处理 |
| | | * @return |
| | | */ |
| | | @GetMapping("/dataHandler") |
| | | public R dataHandler() { |
| | | return R.data(userService.dataHandler()); |
| | | } |
| | | |
| | | |
| | | //获取用户表和用户详情表的信息 |
| | | @GetMapping("/getUserInfoDetail") |
| | | public R getUserInfoDetail(String id){ |
| | | UserInfoDetail userInfoDetail = userService.getUserInfoDetail(id); |
| | | return R.data(userInfoDetail); |
| | | } |
| | | |
| | | @PostMapping("/batchAudit") |
| | | public R batchAudit(String ids,String auditStatus){ |
| | | boolean result = userService.batchAudit(ids,auditStatus); |
| | | return R.status(result); |
| | | } |
| | | |
| | | /** |
| | | * 导入保安员制证时间 |
| | | */ |
| | | @PostMapping("import-security-paperTime") |
| | | @ApiOperationSupport(order = 12) |
| | | @ApiOperation(value = "导入用户", notes = "传入excel") |
| | | public R importSecurityPaperTime(MultipartFile file, Integer isCovered, String deptId) { |
| | | UserCertificateExcelImporter userCertificateExcelImporter = new UserCertificateExcelImporter(userService, false, deptId); |
| | | ExcelUtil.save(file, userCertificateExcelImporter, UserCertificateExcel.class); |
| | | return R.success("操作成功"); |
| | | } |
| | | |
| | | /** |
| | | * 保安员制证时间导出模板 |
| | | */ |
| | | @GetMapping("export-template-security-paperTime") |
| | | @ApiOperationSupport(order = 14) |
| | | @ApiOperation(value = "导出模板") |
| | | public void exportPaperTimeExcelTemplate(HttpServletResponse response) throws IOException { |
| | | List<UserCertificateExcel> list = new ArrayList<>(); |
| | | UserCertificateExcel userCertificateExcel = new UserCertificateExcel(); |
| | | userCertificateExcel.setRealName("张三"); |
| | | userCertificateExcel.setCardid("360XXX19XXXXXX****"); |
| | | userCertificateExcel.setPaperTime("2023-12-26"); |
| | | |
| | | list.add(userCertificateExcel); |
| | | |
| | | String fileName = null; |
| | | try { |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding(org.apache.commons.codec.Charsets.UTF_8.name()); |
| | | fileName = URLEncoder.encode("发证时间导入数据模板" + DateUtil.time(), Charsets.UTF_8.name()); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
| | | //修改单元格格式为文本格式 |
| | | EasyExcel.write(response.getOutputStream(), UserCertificateExcel.class).sheet("发证时间导入数据表").registerWriteHandler(new RowWriteHandler()).doWrite(list); |
| | | } catch (Throwable var6) { |
| | | throw var6; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |