| | |
| | | @PostMapping("/submit") |
| | | public R submit(@RequestBody Gun gun) { |
| | | boolean status = false; |
| | | //脱敏处理 |
| | | Gun gun1 = gun; |
| | | gun1.setCardNumber("***"); |
| | | gun1.setIssueTime(null); |
| | | gun1.setValidTime(null); |
| | | if (null!=gun1.getIssueUnit() && !gun1.getIssueUnit().equals("")){ |
| | | gun1.setIssueUnit("***"); |
| | | } |
| | | if (null!=gun1.getGunMode() && !gun1.getGunMode().equals("")){ |
| | | gun1.setGunMode("***"); |
| | | } |
| | | if (null!=gun1.getPersonInCharge() && !gun1.getPersonInCharge().equals("")){ |
| | | gun1.setPersonInCharge("***"); |
| | | } |
| | | if (null!=gun1.getCardNo() && !gun1.getCardNo().equals("")){ |
| | | gun1.setCardNo("***"); |
| | | } |
| | | gun1.setValidTime(null); |
| | | if (null == gun.getId()) { |
| | | //新增 |
| | | status = gunService.save(gun); |
| | | status = gunService.save(gun1); |
| | | if (status) { |
| | | //数据同步 |
| | | String s1 = |
| | | "insert into sys_gun(id,issue_unit,card_number,gun_mode," + |
| | | "dept_id,person_in_charge,issue_time,valid_time,jurisdiction,card_no) " + |
| | | "values(" + "'" + gun.getId() + "'" + "," + |
| | | "values(" + "'" + gun1.getId() + "'" + "," + |
| | | "'" + gun.getIssueUnit() + "'" + "," + |
| | | "'" + gun.getCardNumber() + "'" + "," + |
| | | "'" + gun.getGunMode() + "'" + "," + |
| | |
| | | "'" + new SimpleDateFormat("yyyy-MM-dd").format(gun.getValidTime()) + "'" + "," + |
| | | "'" + gun.getCardNo() + "'" + "," + |
| | | "'" + gun.getJurisdiction() + "'" + ")"; |
| | | //FtpUtil.sqlFileUpload(s1); |
| | | myAsyncService.FTP(s1); |
| | | } |
| | | } else { |
| | | //修改 |
| | | status = gunService.updateById(gun); |
| | | status = gunService.updateById(gun1); |
| | | if (status) { |
| | | //内网同步 |
| | | String s1 = |
| | |
| | | ",jurisdiction = " + "'" + gun.getJurisdiction() + "'" + |
| | | ",card_no = " + "'" + gun.getCardNo() + "'" + |
| | | " " + "where id = " + "'" + gun.getId() + "'"; |
| | | //FtpUtil.sqlFileUpload(s1); |
| | | myAsyncService.FTP(s1); |
| | | } |
| | | } |