| | |
| | | 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.common.utils.*; |
| | | import org.springblade.core.cache.utils.CacheUtil; |
| | | import org.springblade.core.excel.util.ExcelUtil; |
| | | import org.springblade.core.launch.constant.AppConstant; |
| | |
| | | boolean status = userService.updateById(user); |
| | | //qfqk 数据推送 |
| | | if (status) { |
| | | myAsyncService.updateUserByQfqk(user); |
| | | User user2 = new User(); |
| | | user2.setId(user.getId()); |
| | | //删除 |
| | | myAsyncService.deleteUserByQfqk(user2); |
| | | //内网更新 |
| | | String s1 = |
| | | "update blade_user set status = " + "'" + user.getStatus() + "'" |
| | |
| | | } |
| | | |
| | | /** |
| | | * 修改保安员信息 |
| | | */ |
| | | @PostMapping("/updateSecurityInfo") |
| | | public R updateSecurityInfo(@RequestBody User user) throws Exception { |
| | | User user1 = userService.getById(user.getId()); |
| | | user.setId(user1.getId()); |
| | | user.setUpdateTime(new Date()); |
| | | user.setPassword(user1.getPassword()); |
| | | //创建更新的字符串 |
| | | StringBuilder builder = new StringBuilder(); |
| | | builder.append("update blade-user set update_time = "+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user.getUpdateTime())); |
| | | |
| | | //姓名 |
| | | if (null != user.getRealName() && !user.getRealName().equals("")) { |
| | | builder.append(",set real_name = "+user.getRealName()); |
| | | } |
| | | |
| | | int state = 1; |
| | | //身份证号码 |
| | | if (null != user.getCardid() && !user.getCardid().equals("")) { |
| | | //身份证号校验 |
| | | //去除所有空格 |
| | | String cardid = user.getCardid().replaceAll(" ", ""); |
| | | //校验 |
| | | boolean b = IdCardNoUtil.checkIdCardNo(cardid); |
| | | if(b){ |
| | | user.setCardid(cardid); |
| | | //账号,密码也修改 |
| | | user.setAccount(user1.getRealName().substring(0,1)+cardid.substring(cardid.length()-4)); |
| | | //获取默认密码配置 |
| | | user.setPassword(user.getCardid().substring(user.getCardid().length() - 6)); |
| | | //加密 |
| | | if (Func.isNotEmpty(user.getPassword())) { |
| | | user.setPassword(DigestUtil.encrypt(user.getPassword())); |
| | | } |
| | | state = 2; |
| | | builder.append(",set account = "+user.getAccount()+",set cardid = "+user.getCardid()+",set password = "+user.getPassword()); |
| | | }else { |
| | | throw new ServiceException("导入失败!身份证号码[ "+user.getCardid()+" ]不正确,请核对!"); |
| | | } |
| | | } |
| | | //手机号 |
| | | if (null != user.getPhone() && !user.getPhone().equals("")) { |
| | | builder.append(",set phone = "+user.getPhone()); |
| | | } |
| | | //指纹url 处理 |
| | | String url = ""; |
| | | if (null != user.getFingerprint() && !user.getFingerprint().equals("")) { |
| | | if (user.getFingerprint().length() > 100) { |
| | | //指纹图片上传并返回url |
| | | String s = uploadBase64String(user); |
| | | String[] split = s.split(","); |
| | | user.setFingerprint(split[0]); |
| | | //内网指纹图片url |
| | | url = split[1]; |
| | | builder.append(",set fingerprint = "+url); |
| | | } |
| | | } |
| | | //头像 |
| | | if (null != user.getAvatar() && !user.getAvatar().equals("")) { |
| | | String avatar = FtpConfig.ip +"/"+ user.getAvatar().substring(26); |
| | | System.out.println("头像上传 url = " + avatar); |
| | | builder.append(",set fingerprint = "+avatar); |
| | | } |
| | | |
| | | //名族 |
| | | if (null != user.getNation() && !user.getNation().equals("")) { |
| | | builder.append(",set nation = "+user.getNation()); |
| | | } |
| | | //学历 |
| | | if (null != user.getEducation() && !user.getEducation().equals("")) { |
| | | builder.append(",set education = "+user.getEducation()); |
| | | } |
| | | //政治面貌 |
| | | if (null != user.getPoliticaloutlook() && !user.getPoliticaloutlook().equals("")) { |
| | | builder.append(",set politicaloutlook = "+user.getPoliticaloutlook()); |
| | | } |
| | | //健康状态 |
| | | if (null != user.getHealstats() && !user.getHealstats().equals("")) { |
| | | builder.append(",set healstats = "+user.getHealstats()); |
| | | } |
| | | //身高 |
| | | if (null != user.getHeight() && !user.getHeight().equals("")) { |
| | | builder.append(",set height = "+user.getHeight()); |
| | | } |
| | | //联系地址 |
| | | if (null != user.getAddress() && !user.getAddress().equals("")) { |
| | | builder.append(",set address = "+user.getAddress()); |
| | | } |
| | | //身份证地址 |
| | | if (null != user.getRegistered() && !user.getRegistered().equals("")) { |
| | | builder.append(",set registered = "+user.getRegistered()); |
| | | } |
| | | |
| | | //修改 |
| | | // boolean status = userService.updateById(user); |
| | | boolean status = userService.update(user, Wrappers.<User>update().lambda().in(User::getId,user.getId())); |
| | | |
| | | 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); |
| | | } |
| | | } |
| | | //拼接最终的sql |
| | | String sql = builder.append(" where id = " + user.getId()).toString(); |
| | | myAsyncService.FTP(sql); |
| | | //返回 |
| | | return R.data(200,null,"修改成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 账号修改 |
| | | * @param user |
| | | * @return |
| | |
| | | } |
| | | //如果不重复,则进行修改操作 |
| | | //更新用户账户信息 |
| | | status = userService.updateById(user); |
| | | status = userService.update(user, Wrappers.<User>update().lambda().in(User::getId,user.getId())); |
| | | // status = userService.updateById(user); |
| | | if (status){ |
| | | System.out.println("user = " + user); |
| | | User user2 = userService.getById(user.getId()); |
| | | UserDTO userDTO = new UserDTO(); |
| | | userDTO.setAccount(user.getAccount()); |
| | | userDTO.setPassword(user.getPassword()); |
| | | userDTO.setSecurityId(user.getId().toString()); |
| | | userDTO.setPhone(user.getPhone()); |
| | | userDTO.setAvatar(user.getAvatar()); |
| | | userDTO.setPassword(user2.getPassword()); |
| | | userDTO.setSecurityId(user2.getId().toString()); |
| | | userDTO.setRealName(user1.getRealName()); |
| | | userDTO.setPhone(user2.getPhone()); |
| | | userDTO.setCardid(user2.getCardid()); |
| | | userDTO.setSex(user1.getSex()); |
| | | //异步修改群防群控 |
| | | myAsyncService.updateUserByAccount(userDTO); |
| | | } |
| | |
| | | minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucket).build()); |
| | | minioClient.setBucketPolicy(SetBucketPolicyArgs.builder().bucket(bucket).build()); |
| | | } |
| | | String newName = "upload/picture/" + UUID.randomUUID().toString().replaceAll("-", "") + ".jpg"; |
| | | String newName = "upload/picture/f" + UUID.randomUUID().toString().replaceAll("-", "") + ".jpg"; |
| | | InputStream in = new ByteArrayInputStream(b); |
| | | String[] split = newName.split("/"); |
| | | //创建头部信息 |
| | |
| | | .headers(headers) |
| | | .build()); |
| | | InputStream inputStream = new ByteArrayInputStream(b); |
| | | FtpUtil.uploadFile(FtpConfig.ftpHost, ftpPort, FtpConfig.ftpUserName, ftpPassword, ftpPath, "/", "f"+split[2], inputStream); |
| | | FtpUtil.uploadFile(FtpConfig.ftpHost, ftpPort, FtpConfig.ftpUserName, ftpPassword, ftpPath, "/", split[2], inputStream); |
| | | in.close(); |
| | | //外围url |
| | | String urls = "http://61.131.136.25:2081/zhba/" + newName; |
| | |
| | | User user = userService.getById(id); |
| | | User user1 = new User(); |
| | | user1.setId(user.getId()); |
| | | user1.setCardid(user.getCardid()); |
| | | // user1.setCardid(user.getCardid()); |
| | | user1.setIsDeleted(1); |
| | | //qfqk 同步 |
| | | myAsyncService.deleteUserByQfqk(user1); |
| | |
| | | "values(" + "'" + experience.getId() + "'" + "," + |
| | | "'" + experience.getName() + "'" + "," + |
| | | "'" + experience.getPost() + "'" + "," + |
| | | "," + "'" + new SimpleDateFormat("yyyy-MM-dd").format(experience.getEntrytime()) + "'" + |
| | | "'" + new SimpleDateFormat("yyyy-MM-dd").format(experience.getEntrytime()) + "'" + |
| | | "," + "'" + experience.getCardid() + "'" + |
| | | "," + "'" + experience.getCompanyname() + "'" + |
| | | "," + "'" + experience.getSecurityid() + "'" |
| | |
| | | User user1 = Objects.requireNonNull(BeanUtil.copy(user,User.class)); |
| | | //头像 |
| | | if (null != user.getAvatar() && !user.getAvatar().equals("")) { |
| | | user1.setAvatar(FtpConfig.ip + user.getAvatar().substring(26)); |
| | | user1.setAvatar(FtpConfig.ip +"/"+ user.getAvatar().substring(26)); |
| | | } |
| | | //指纹 |
| | | String url = ""; |
| | |
| | | |
| | | //内网同步 |
| | | String s = "insert into sys_experience(id,name,entryTime,departureTime,leaving,cardId,companyname,securityId) " + |
| | | "values(" + "'" + experience.getId() + "'" + "," + |
| | | "'" + experience.getName() + "'" + "," + |
| | | "values(" + "'" + experience.getId() + "'" + |
| | | "," + "'" + experience.getName() + "'" + |
| | | "," + "'" + new SimpleDateFormat("yyyy-MM-dd").format(experience.getEntrytime()) + "'" + |
| | | "," + "'" + new SimpleDateFormat("yyyy-MM-dd").format(experience.getDeparturetime()) + "'" + |
| | | "," + "'" + experience.getLeaving() + "'" + |
| | |
| | | */ |
| | | @GetMapping("export-security-info") |
| | | public void exportSecurityInfo(HttpServletResponse response, UserVO user) throws IOException { |
| | | List<SecurityExcel> list = userService.exportSecurityInfo(user); |
| | | List<ExportSecurityExcel> list = userService.exportSecurityInfo(user); |
| | | String fileName = null; |
| | | try { |
| | | response.setContentType("application/vnd.ms-excel"); |
| | |
| | | fileName = URLEncoder.encode("保安员数据导出" + DateUtil.time(), Charsets.UTF_8.name()); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
| | | //修改单元格格式为文本格式 |
| | | EasyExcel.write(response.getOutputStream(), SecurityExcel.class).sheet("保安员数据表").registerWriteHandler(new RowWriteHandler()).doWrite(list); |
| | | EasyExcel.write(response.getOutputStream(), ExportSecurityExcel.class).sheet("保安员数据表").registerWriteHandler(new RowWriteHandler()).doWrite(list); |
| | | } catch (Throwable var6) { |
| | | throw var6; |
| | | } |