| | |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.FTP.FtpUtil; |
| | |
| | | import org.springblade.modules.equipage.excel.GunImporter; |
| | | import org.springblade.modules.equipage.service.GunService; |
| | | import org.springblade.modules.equipage.vo.GunVo; |
| | | import org.springblade.modules.member.entity.Member; |
| | | import org.springblade.modules.system.service.MyAsyncService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * @author zhongrj |
| | |
| | | @PostMapping("/submit") |
| | | public R submit(@RequestBody Gun gun) { |
| | | boolean status = false; |
| | | //脱敏处理 |
| | | Gun gun1 = Objects.requireNonNull(BeanUtil.copy(gun, Gun.class)); |
| | | 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); |
| | | } |
| | | } |
| | |
| | | list.forEach(id -> { |
| | | //内网同步 |
| | | String s1 = "delete from sys_gun where id = " + "'" + id + "'"; |
| | | //FtpUtil.sqlFileUpload(s1); |
| | | myAsyncService.FTP(s1); |
| | | }); |
| | | return R.status(gunService.removeByIds(Func.toLongList(ids))); |