| | |
| | | |
| | | private Long communityId; |
| | | |
| | | private Long userId; |
| | | |
| | | private static int headSize = 0; |
| | | |
| | | private Map<Integer, String> headData; |
| | | |
| | | private String userName; |
| | | // FTP 登录密码 |
| | | private String password; |
| | | // FTP 服务器地址IP地址 |
| | | private String host; |
| | | // FTP 端口 |
| | | private int port; |
| | | private String excelUrl; |
| | | |
| | | private StringRedisTemplate stringRedisTemplate; |
| | | |
| | | public static String loadUrl; |
| | | |
| | | public ComMngPopulationCorrectExcelListen(CommunityService communityService, Long communityId, String userName, String password, String host, int port, String excelUrl, StringRedisTemplate stringRedisTemplate) { |
| | | public ComMngPopulationCorrectExcelListen(CommunityService communityService, Long communityId, Long userId, StringRedisTemplate stringRedisTemplate) { |
| | | this.communityService = communityService; |
| | | this.communityId = communityId; |
| | | this.userName = userName; |
| | | this.password = password; |
| | | this.host = host; |
| | | this.port = port; |
| | | this.excelUrl = excelUrl; |
| | | this.userId = userId; |
| | | this.stringRedisTemplate = stringRedisTemplate; |
| | | } |
| | | |
| | |
| | | //根据list中的IdCard城市来去重 |
| | | List<ComMngPopulationCorrectExcelVO> newVoList = voList.stream().filter(ListUtils.distinctByKey(ComMngPopulationCorrectExcelVO::getDistinctPass)).collect(Collectors.toList()); |
| | | log.info("开始进入业务层处理逻辑"); |
| | | R r = communityService.listSavePopulationCorrectExcelVO(newVoList, communityId); |
| | | R r = communityService.listSavePopulationCorrectExcelVO(newVoList, communityId, userId); |
| | | log.info("业务层处理逻辑完成"); |
| | | if (!R.isOk(r)) { |
| | | log.info("业务层处理成功"); |
| | |
| | | vo.setPubishmentChange(map.get(45)); |
| | | vo.setRemark(map.get(46)); |
| | | } |
| | | |
| | | private R mistakeExportPopulation(List<ComMngPopulationMistakeExcelVO> vo) { |
| | | //生成动态模板excel通过ftp工具上传到主节点,然后返回模板下载地址 |
| | | String ftpUrl = "/mnt/data/web/excel/"; |
| | | String name = "实有人口错误数据.xlsx"; |
| | | try { |
| | | SFTPUtil sftp = new SFTPUtil(userName, password, host, port); |
| | | sftp.login(); |
| | | boolean existDir = sftp.isExistDir(ftpUrl + name); |
| | | if (!existDir) { |
| | | String property = System.getProperty("user.dir"); |
| | | String fileName = property + File.separator + name; |
| | | // 这里 需要指定写用哪个class去写 |
| | | ExcelWriter excelWriter = null; |
| | | InputStream inputStream = null; |
| | | try { |
| | | excelWriter = EasyExcel.write(fileName, ComMngPopulationMistakeExcelVO.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build(); |
| | | WriteSheet writeSheet = EasyExcel.writerSheet("实有人口错误数据").build(); |
| | | excelWriter.write(vo, writeSheet); |
| | | excelWriter.finish(); |
| | | File file = new File(fileName); |
| | | inputStream = new FileInputStream(file); |
| | | sftp.uploadMore(ftpUrl, name, inputStream); |
| | | sftp.logout(); |
| | | inputStream.close(); |
| | | String absolutePath = file.getAbsolutePath(); |
| | | boolean delete = file.delete(); |
| | | log.info("删除excel【{}】结果【{}】", absolutePath, delete); |
| | | } finally { |
| | | // 千万别忘记finish 会帮忙关闭流 |
| | | if (inputStream != null) { |
| | | inputStream.close(); |
| | | } |
| | | if (excelWriter != null) { |
| | | excelWriter.finish(); |
| | | } |
| | | } |
| | | } |
| | | return R.ok(excelUrl + name); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("文件传输失败【{}】", e.getMessage()); |
| | | return R.fail(); |
| | | } |
| | | } |
| | | |
| | | private String convertMarriage(String ma) { |
| | | |
| | |
| | | |
| | | private Long communityId; |
| | | |
| | | private Long userId; |
| | | |
| | | private static int headSize = 0; |
| | | |
| | | private Map<Integer, String> headData; |
| | | |
| | | private String userName; |
| | | // FTP 登录密码 |
| | | private String password; |
| | | // FTP 服务器地址IP地址 |
| | | private String host; |
| | | // FTP 端口 |
| | | private int port; |
| | | private String excelUrl; |
| | | |
| | | private StringRedisTemplate stringRedisTemplate; |
| | | |
| | | public static String loadUrl; |
| | | |
| | | public ComMngPopulationCultExcelListen(CommunityService communityService, Long communityId, String userName, String password, String host, int port, String excelUrl, StringRedisTemplate stringRedisTemplate) { |
| | | public ComMngPopulationCultExcelListen(CommunityService communityService, Long communityId, Long userId, StringRedisTemplate stringRedisTemplate) { |
| | | this.communityService = communityService; |
| | | this.communityId = communityId; |
| | | this.userName = userName; |
| | | this.password = password; |
| | | this.host = host; |
| | | this.port = port; |
| | | this.excelUrl = excelUrl; |
| | | this.userId = userId; |
| | | this.stringRedisTemplate = stringRedisTemplate; |
| | | } |
| | | |
| | |
| | | //根据list中的IdCard城市来去重 |
| | | List<ComMngPopulationCultExcelVO> newVoList = voList.stream().filter(ListUtils.distinctByKey(ComMngPopulationCultExcelVO::getDistinctPass)).collect(Collectors.toList()); |
| | | log.info("开始进入业务层处理逻辑"); |
| | | R r = communityService.listSavePopulationCultExcelVO(newVoList, communityId); |
| | | R r = communityService.listSavePopulationCultExcelVO(newVoList, communityId, userId); |
| | | log.info("业务层处理逻辑完成"); |
| | | if (!R.isOk(r)) { |
| | | log.info("业务层处理成功"); |
| | |
| | | |
| | | private Long communityId; |
| | | |
| | | private Long userId; |
| | | |
| | | private static int headSize = 0; |
| | | |
| | | private Map<Integer, String> headData; |
| | | |
| | | private String userName; |
| | | // FTP 登录密码 |
| | | private String password; |
| | | // FTP 服务器地址IP地址 |
| | | private String host; |
| | | // FTP 端口 |
| | | private int port; |
| | | private String excelUrl; |
| | | |
| | | private StringRedisTemplate stringRedisTemplate; |
| | | |
| | | public static String loadUrl; |
| | | |
| | | public ComMngPopulationDisabilityExcelListen(CommunityService communityService, Long communityId, String userName, String password, String host, int port, String excelUrl, StringRedisTemplate stringRedisTemplate) { |
| | | public ComMngPopulationDisabilityExcelListen(CommunityService communityService, Long communityId, Long userId, StringRedisTemplate stringRedisTemplate) { |
| | | this.communityService = communityService; |
| | | this.communityId = communityId; |
| | | this.userName = userName; |
| | | this.password = password; |
| | | this.host = host; |
| | | this.port = port; |
| | | this.excelUrl = excelUrl; |
| | | this.userId = userId; |
| | | this.stringRedisTemplate = stringRedisTemplate; |
| | | } |
| | | |
| | |
| | | //根据list中的IdCard城市来去重 |
| | | List<ComMngPopulationDisabilityExcelVO> newVoList = voList.stream().filter(ListUtils.distinctByKey(ComMngPopulationDisabilityExcelVO::getDistinctPass)).collect(Collectors.toList()); |
| | | log.info("开始进入业务层处理逻辑"); |
| | | R r = communityService.listSavePopulationDisabilityExcelVO(newVoList, communityId); |
| | | R r = communityService.listSavePopulationDisabilityExcelVO(newVoList, communityId, userId); |
| | | log.info("业务层处理逻辑完成"); |
| | | if (!R.isOk(r)) { |
| | | log.info("业务层处理成功"); |
| | |
| | | |
| | | private Long communityId; |
| | | |
| | | private Long userId; |
| | | |
| | | private static int headSize = 0; |
| | | |
| | | private Map<Integer, String> headData; |
| | | |
| | | private String userName; |
| | | // FTP 登录密码 |
| | | private String password; |
| | | // FTP 服务器地址IP地址 |
| | | private String host; |
| | | // FTP 端口 |
| | | private int port; |
| | | private String excelUrl; |
| | | |
| | | private StringRedisTemplate stringRedisTemplate; |
| | | |
| | | public static String loadUrl; |
| | | |
| | | public ComMngPopulationDrugExcelListen(CommunityService communityService, Long communityId, String userName, String password, String host, int port, String excelUrl, StringRedisTemplate stringRedisTemplate) { |
| | | public ComMngPopulationDrugExcelListen(CommunityService communityService, Long communityId, Long userId , StringRedisTemplate stringRedisTemplate) { |
| | | this.communityService = communityService; |
| | | this.communityId = communityId; |
| | | this.userName = userName; |
| | | this.password = password; |
| | | this.host = host; |
| | | this.port = port; |
| | | this.excelUrl = excelUrl; |
| | | this.userId = userId; |
| | | this.stringRedisTemplate = stringRedisTemplate; |
| | | } |
| | | |
| | |
| | | //根据list中的IdCard城市来去重 |
| | | List<ComMngPopulationDrugExcelVO> newVoList = voList.stream().filter(ListUtils.distinctByKey(ComMngPopulationDrugExcelVO::getDistinctPass)).collect(Collectors.toList()); |
| | | log.info("开始进入业务层处理逻辑"); |
| | | R r = communityService.listSavePopulationDrugExcelVO(newVoList, communityId); |
| | | R r = communityService.listSavePopulationDrugExcelVO(newVoList, communityId, userId); |
| | | log.info("业务层处理逻辑完成"); |
| | | if (!R.isOk(r)) { |
| | | log.info("业务层处理成功"); |
| | |
| | | vo.setCrimeSutiation(map.get(26)); |
| | | vo.setRemark(map.get(27)); |
| | | } |
| | | |
| | | private R mistakeExportPopulation(List<ComMngPopulationMistakeExcelVO> vo) { |
| | | //生成动态模板excel通过ftp工具上传到主节点,然后返回模板下载地址 |
| | | String ftpUrl = "/mnt/data/web/excel/"; |
| | | String name = "实有人口错误数据.xlsx"; |
| | | try { |
| | | SFTPUtil sftp = new SFTPUtil(userName, password, host, port); |
| | | sftp.login(); |
| | | boolean existDir = sftp.isExistDir(ftpUrl + name); |
| | | if (!existDir) { |
| | | String property = System.getProperty("user.dir"); |
| | | String fileName = property + File.separator + name; |
| | | // 这里 需要指定写用哪个class去写 |
| | | ExcelWriter excelWriter = null; |
| | | InputStream inputStream = null; |
| | | try { |
| | | excelWriter = EasyExcel.write(fileName, ComMngPopulationMistakeExcelVO.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build(); |
| | | WriteSheet writeSheet = EasyExcel.writerSheet("实有人口错误数据").build(); |
| | | excelWriter.write(vo, writeSheet); |
| | | excelWriter.finish(); |
| | | File file = new File(fileName); |
| | | inputStream = new FileInputStream(file); |
| | | sftp.uploadMore(ftpUrl, name, inputStream); |
| | | sftp.logout(); |
| | | inputStream.close(); |
| | | String absolutePath = file.getAbsolutePath(); |
| | | boolean delete = file.delete(); |
| | | log.info("删除excel【{}】结果【{}】", absolutePath, delete); |
| | | } finally { |
| | | // 千万别忘记finish 会帮忙关闭流 |
| | | if (inputStream != null) { |
| | | inputStream.close(); |
| | | } |
| | | if (excelWriter != null) { |
| | | excelWriter.finish(); |
| | | } |
| | | } |
| | | } |
| | | return R.ok(excelUrl + name); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("文件传输失败【{}】", e.getMessage()); |
| | | return R.fail(); |
| | | } |
| | | } |
| | | |
| | | private String convertMarriage(String ma) { |
| | | |
| | |
| | | |
| | | private Long communityId; |
| | | |
| | | private Long userId; |
| | | |
| | | private static int headSize = 0; |
| | | |
| | | private Map<Integer, String> headData; |
| | | |
| | | private String userName; |
| | | // FTP 登录密码 |
| | | private String password; |
| | | // FTP 服务器地址IP地址 |
| | | private String host; |
| | | // FTP 端口 |
| | | private int port; |
| | | private String excelUrl; |
| | | |
| | | private StringRedisTemplate stringRedisTemplate; |
| | | |
| | | public static String loadUrl; |
| | | |
| | | public ComMngPopulationKeyExcelListen(CommunityService communityService, Long communityId, String userName, String password, String host, int port, String excelUrl, StringRedisTemplate stringRedisTemplate) { |
| | | public ComMngPopulationKeyExcelListen(CommunityService communityService, Long communityId, Long userId, StringRedisTemplate stringRedisTemplate) { |
| | | this.communityService = communityService; |
| | | this.communityId = communityId; |
| | | this.userName = userName; |
| | | this.password = password; |
| | | this.host = host; |
| | | this.port = port; |
| | | this.excelUrl = excelUrl; |
| | | this.userId = userId; |
| | | this.stringRedisTemplate = stringRedisTemplate; |
| | | } |
| | | |
| | |
| | | //根据list中的IdCard城市来去重 |
| | | List<ComMngPopulationKeyExcelVO> newVoList = voList.stream().filter(ListUtils.distinctByKey(ComMngPopulationKeyExcelVO::getDistinctPass)).collect(Collectors.toList()); |
| | | log.info("开始进入业务层处理逻辑"); |
| | | R r = communityService.listSavePopulationKeyExcelVO(newVoList, communityId); |
| | | R r = communityService.listSavePopulationKeyExcelVO(newVoList, communityId, userId); |
| | | log.info("业务层处理逻辑完成"); |
| | | if (!R.isOk(r)) { |
| | | log.info("业务层处理成功"); |
| | |
| | | vo.setCensusRegister(map.get(16)); |
| | | vo.setRemark(map.get(17)); |
| | | } |
| | | |
| | | private R mistakeExportPopulation(List<ComMngPopulationMistakeExcelVO> vo) { |
| | | //生成动态模板excel通过ftp工具上传到主节点,然后返回模板下载地址 |
| | | String ftpUrl = "/mnt/data/web/excel/"; |
| | | String name = "实有人口错误数据.xlsx"; |
| | | try { |
| | | SFTPUtil sftp = new SFTPUtil(userName, password, host, port); |
| | | sftp.login(); |
| | | boolean existDir = sftp.isExistDir(ftpUrl + name); |
| | | if (!existDir) { |
| | | String property = System.getProperty("user.dir"); |
| | | String fileName = property + File.separator + name; |
| | | // 这里 需要指定写用哪个class去写 |
| | | ExcelWriter excelWriter = null; |
| | | InputStream inputStream = null; |
| | | try { |
| | | excelWriter = EasyExcel.write(fileName, ComMngPopulationMistakeExcelVO.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build(); |
| | | WriteSheet writeSheet = EasyExcel.writerSheet("实有人口错误数据").build(); |
| | | excelWriter.write(vo, writeSheet); |
| | | excelWriter.finish(); |
| | | File file = new File(fileName); |
| | | inputStream = new FileInputStream(file); |
| | | sftp.uploadMore(ftpUrl, name, inputStream); |
| | | sftp.logout(); |
| | | inputStream.close(); |
| | | String absolutePath = file.getAbsolutePath(); |
| | | boolean delete = file.delete(); |
| | | log.info("删除excel【{}】结果【{}】", absolutePath, delete); |
| | | } finally { |
| | | // 千万别忘记finish 会帮忙关闭流 |
| | | if (inputStream != null) { |
| | | inputStream.close(); |
| | | } |
| | | if (excelWriter != null) { |
| | | excelWriter.finish(); |
| | | } |
| | | } |
| | | } |
| | | return R.ok(excelUrl + name); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("文件传输失败【{}】", e.getMessage()); |
| | | return R.fail(); |
| | | } |
| | | } |
| | | |
| | | private String convertMarriage(String ma) { |
| | | |
| | |
| | | |
| | | private Long communityId; |
| | | |
| | | private Long userId; |
| | | |
| | | private static int headSize = 0; |
| | | |
| | | private Map<Integer, String> headData; |
| | | |
| | | private String userName; |
| | | // FTP 登录密码 |
| | | private String password; |
| | | // FTP 服务器地址IP地址 |
| | | private String host; |
| | | // FTP 端口 |
| | | private int port; |
| | | private String excelUrl; |
| | | |
| | | private StringRedisTemplate stringRedisTemplate; |
| | | |
| | | public static String loadUrl; |
| | | |
| | | public ComMngPopulationLowSecurityExcelListen(CommunityService communityService, Long communityId, String userName, String password, String host, int port, String excelUrl, StringRedisTemplate stringRedisTemplate) { |
| | | public ComMngPopulationLowSecurityExcelListen(CommunityService communityService, Long communityId, Long userId, StringRedisTemplate stringRedisTemplate) { |
| | | this.communityService = communityService; |
| | | this.communityId = communityId; |
| | | this.userName = userName; |
| | | this.password = password; |
| | | this.host = host; |
| | | this.port = port; |
| | | this.excelUrl = excelUrl; |
| | | this.userId = userId; |
| | | this.stringRedisTemplate = stringRedisTemplate; |
| | | } |
| | | |
| | |
| | | //根据list中的IdCard城市来去重 |
| | | List<ComMngPopulationLowSecurityExcelVO> newVoList = voList.stream().filter(ListUtils.distinctByKey(ComMngPopulationLowSecurityExcelVO::getDistinctPass)).collect(Collectors.toList()); |
| | | log.info("开始进入业务层处理逻辑"); |
| | | R r = communityService.listSavePopulationLowSecurityExcelVO(newVoList, communityId); |
| | | R r = communityService.listSavePopulationLowSecurityExcelVO(newVoList, communityId, userId); |
| | | log.info("业务层处理逻辑完成"); |
| | | if (!R.isOk(r)) { |
| | | log.info("业务层处理成功"); |
| | |
| | | |
| | | private Long communityId; |
| | | |
| | | private Long userId; |
| | | |
| | | private static int headSize = 0; |
| | | |
| | | private Map<Integer, String> headData; |
| | | |
| | | private String userName; |
| | | // FTP 登录密码 |
| | | private String password; |
| | | // FTP 服务器地址IP地址 |
| | | private String host; |
| | | // FTP 端口 |
| | | private int port; |
| | | private String excelUrl; |
| | | |
| | | private StringRedisTemplate stringRedisTemplate; |
| | | |
| | | public static String loadUrl; |
| | | |
| | | public ComMngPopulationMajorExcelListen(CommunityService communityService, Long communityId, String userName, String password, String host, int port, String excelUrl, StringRedisTemplate stringRedisTemplate) { |
| | | public ComMngPopulationMajorExcelListen(CommunityService communityService, Long communityId, Long userId, StringRedisTemplate stringRedisTemplate) { |
| | | this.communityService = communityService; |
| | | this.communityId = communityId; |
| | | this.userName = userName; |
| | | this.password = password; |
| | | this.host = host; |
| | | this.port = port; |
| | | this.excelUrl = excelUrl; |
| | | this.userId = userId; |
| | | this.stringRedisTemplate = stringRedisTemplate; |
| | | } |
| | | |
| | |
| | | //根据list中的IdCard城市来去重 |
| | | List<ComMngPopulationMajorExcelVO> newVoList = voList.stream().filter(ListUtils.distinctByKey(ComMngPopulationMajorExcelVO::getDistinctPass)).collect(Collectors.toList()); |
| | | log.info("开始进入业务层处理逻辑"); |
| | | R r = communityService.listSavePopulationMajorExcelVO(newVoList, communityId); |
| | | R r = communityService.listSavePopulationMajorExcelVO(newVoList, communityId,userId); |
| | | log.info("业务层处理逻辑完成"); |
| | | if (!R.isOk(r)) { |
| | | log.info("业务层处理成功"); |
| | |
| | | |
| | | private Long communityId; |
| | | |
| | | private Long userId; |
| | | |
| | | private static int headSize = 0; |
| | | |
| | | private Map<Integer, String> headData; |
| | | |
| | | private String userName; |
| | | // FTP 登录密码 |
| | | private String password; |
| | | // FTP 服务器地址IP地址 |
| | | private String host; |
| | | // FTP 端口 |
| | | private int port; |
| | | private String excelUrl; |
| | | |
| | | private StringRedisTemplate stringRedisTemplate; |
| | | |
| | | public static String loadUrl; |
| | | |
| | | public ComMngPopulationRehabilitationExcelListen(CommunityService communityService, Long communityId, String userName, String password, String host, int port, String excelUrl, StringRedisTemplate stringRedisTemplate) { |
| | | public ComMngPopulationRehabilitationExcelListen(CommunityService communityService, Long communityId, Long userId, StringRedisTemplate stringRedisTemplate) { |
| | | this.communityService = communityService; |
| | | this.communityId = communityId; |
| | | this.userName = userName; |
| | | this.password = password; |
| | | this.host = host; |
| | | this.port = port; |
| | | this.excelUrl = excelUrl; |
| | | this.userId = userId; |
| | | this.stringRedisTemplate = stringRedisTemplate; |
| | | } |
| | | |
| | |
| | | //根据list中的IdCard城市来去重 |
| | | List<ComMngPopulationRehabilitationExcelVO> newVoList = voList.stream().filter(ListUtils.distinctByKey(ComMngPopulationRehabilitationExcelVO::getDistinctPass)).collect(Collectors.toList()); |
| | | log.info("开始进入业务层处理逻辑"); |
| | | R r = communityService.listSavePopulationRehabilitationExcelVO(newVoList, communityId); |
| | | R r = communityService.listSavePopulationRehabilitationExcelVO(newVoList, communityId, userId); |
| | | log.info("业务层处理逻辑完成"); |
| | | if (!R.isOk(r)) { |
| | | log.info("业务层处理成功"); |
| | |
| | | vo.setHelpSituation(map.get(37)); |
| | | vo.setRemark(map.get(38)); |
| | | } |
| | | |
| | | private R mistakeExportPopulation(List<ComMngPopulationMistakeExcelVO> vo) { |
| | | //生成动态模板excel通过ftp工具上传到主节点,然后返回模板下载地址 |
| | | String ftpUrl = "/mnt/data/web/excel/"; |
| | | String name = "实有人口错误数据.xlsx"; |
| | | try { |
| | | SFTPUtil sftp = new SFTPUtil(userName, password, host, port); |
| | | sftp.login(); |
| | | boolean existDir = sftp.isExistDir(ftpUrl + name); |
| | | if (!existDir) { |
| | | String property = System.getProperty("user.dir"); |
| | | String fileName = property + File.separator + name; |
| | | // 这里 需要指定写用哪个class去写 |
| | | ExcelWriter excelWriter = null; |
| | | InputStream inputStream = null; |
| | | try { |
| | | excelWriter = EasyExcel.write(fileName, ComMngPopulationMistakeExcelVO.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build(); |
| | | WriteSheet writeSheet = EasyExcel.writerSheet("实有人口错误数据").build(); |
| | | excelWriter.write(vo, writeSheet); |
| | | excelWriter.finish(); |
| | | File file = new File(fileName); |
| | | inputStream = new FileInputStream(file); |
| | | sftp.uploadMore(ftpUrl, name, inputStream); |
| | | sftp.logout(); |
| | | inputStream.close(); |
| | | String absolutePath = file.getAbsolutePath(); |
| | | boolean delete = file.delete(); |
| | | log.info("删除excel【{}】结果【{}】", absolutePath, delete); |
| | | } finally { |
| | | // 千万别忘记finish 会帮忙关闭流 |
| | | if (inputStream != null) { |
| | | inputStream.close(); |
| | | } |
| | | if (excelWriter != null) { |
| | | excelWriter.finish(); |
| | | } |
| | | } |
| | | } |
| | | return R.ok(excelUrl + name); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("文件传输失败【{}】", e.getMessage()); |
| | | return R.fail(); |
| | | } |
| | | } |
| | | |
| | | private String convertMarriage(String ma) { |
| | | |
| | |
| | | |
| | | private Long communityId; |
| | | |
| | | private Long userId; |
| | | |
| | | private static int headSize = 0; |
| | | |
| | | private Map<Integer, String> headData; |
| | | |
| | | private String userName; |
| | | // FTP 登录密码 |
| | | private String password; |
| | | // FTP 服务器地址IP地址 |
| | | private String host; |
| | | // FTP 端口 |
| | | private int port; |
| | | private String excelUrl; |
| | | |
| | | private StringRedisTemplate stringRedisTemplate; |
| | | |
| | | public static String loadUrl; |
| | | |
| | | public ComMngPopulationSentenceExcelListen(CommunityService communityService, Long communityId, String userName, String password, String host, int port, String excelUrl, StringRedisTemplate stringRedisTemplate) { |
| | | public ComMngPopulationSentenceExcelListen(CommunityService communityService, Long communityId, Long userId, StringRedisTemplate stringRedisTemplate) { |
| | | this.communityService = communityService; |
| | | this.communityId = communityId; |
| | | this.userName = userName; |
| | | this.password = password; |
| | | this.host = host; |
| | | this.port = port; |
| | | this.excelUrl = excelUrl; |
| | | this.userId = userId; |
| | | this.stringRedisTemplate = stringRedisTemplate; |
| | | } |
| | | |
| | |
| | | //根据list中的IdCard城市来去重 |
| | | List<ComMngPopulationSentenceExcelVO> newVoList = voList.stream().filter(ListUtils.distinctByKey(ComMngPopulationSentenceExcelVO::getDistinctPass)).collect(Collectors.toList()); |
| | | log.info("开始进入业务层处理逻辑"); |
| | | R r = communityService.listSavePopulationSentenceExcelVO(newVoList, communityId); |
| | | R r = communityService.listSavePopulationSentenceExcelVO(newVoList, communityId, userId); |
| | | log.info("业务层处理逻辑完成"); |
| | | if (!R.isOk(r)) { |
| | | log.info("业务层处理成功"); |
| | |
| | | |
| | | private Long communityId; |
| | | |
| | | private Long userId; |
| | | |
| | | private static int headSize = 0; |
| | | |
| | | private Map<Integer, String> headData; |
| | | |
| | | private String userName; |
| | | // FTP 登录密码 |
| | | private String password; |
| | | // FTP 服务器地址IP地址 |
| | | private String host; |
| | | // FTP 端口 |
| | | private int port; |
| | | private String excelUrl; |
| | | |
| | | private StringRedisTemplate stringRedisTemplate; |
| | | |
| | | public static String loadUrl; |
| | | |
| | | public ComMngPopulationServeExcelListen(CommunityService communityService, Long communityId, String userName, String password, String host, int port, String excelUrl,StringRedisTemplate stringRedisTemplate) { |
| | | public ComMngPopulationServeExcelListen(CommunityService communityService, Long communityId, Long userId, StringRedisTemplate stringRedisTemplate) { |
| | | this.communityService = communityService; |
| | | this.communityId = communityId; |
| | | this.userName = userName; |
| | | this.password = password; |
| | | this.host = host; |
| | | this.port = port; |
| | | this.excelUrl = excelUrl; |
| | | this.userId = userId; |
| | | this.stringRedisTemplate = stringRedisTemplate; |
| | | } |
| | | |
| | |
| | | //根据list中的IdCard城市来去重 |
| | | List<ComMngPopulationServeExcelVO> newVoList = voList.stream().filter(ListUtils.distinctByKey(ComMngPopulationServeExcelVO::getDistinctPass)).collect(Collectors.toList()); |
| | | log.info("开始进入业务层处理逻辑"); |
| | | R r = communityService.listSavePopulationServeExcelVO(newVoList, communityId); |
| | | R r = communityService.listSavePopulationServeExcelVO(newVoList, communityId, userId); |
| | | log.info("业务层处理逻辑完成"); |
| | | if (!R.isOk(r)) { |
| | | log.info("业务层处理成功"); |
| | |
| | | vo.setIdCardBack(map.get(38)); |
| | | vo.setHouseHold(map.get(39)); |
| | | vo.setDeath(map.get(40)); |
| | | } |
| | | |
| | | private R mistakeExportPopulation(List<ComMngPopulationMistakeExcelVO> vo) { |
| | | //生成动态模板excel通过ftp工具上传到主节点,然后返回模板下载地址 |
| | | String ftpUrl = "/mnt/data/web/excel/"; |
| | | String name = "实有人口错误数据.xlsx"; |
| | | try { |
| | | SFTPUtil sftp = new SFTPUtil(userName, password, host, port); |
| | | sftp.login(); |
| | | boolean existDir = sftp.isExistDir(ftpUrl + name); |
| | | if (!existDir) { |
| | | String property = System.getProperty("user.dir"); |
| | | String fileName = property + File.separator + name; |
| | | // 这里 需要指定写用哪个class去写 |
| | | ExcelWriter excelWriter = null; |
| | | InputStream inputStream = null; |
| | | try { |
| | | excelWriter = EasyExcel.write(fileName, ComMngPopulationMistakeExcelVO.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build(); |
| | | WriteSheet writeSheet = EasyExcel.writerSheet("实有人口错误数据").build(); |
| | | excelWriter.write(vo, writeSheet); |
| | | excelWriter.finish(); |
| | | File file = new File(fileName); |
| | | inputStream = new FileInputStream(file); |
| | | sftp.uploadMore(ftpUrl, name, inputStream); |
| | | sftp.logout(); |
| | | inputStream.close(); |
| | | String absolutePath = file.getAbsolutePath(); |
| | | boolean delete = file.delete(); |
| | | log.info("删除excel【{}】结果【{}】", absolutePath, delete); |
| | | } finally { |
| | | // 千万别忘记finish 会帮忙关闭流 |
| | | if (inputStream != null) { |
| | | inputStream.close(); |
| | | } |
| | | if (excelWriter != null) { |
| | | excelWriter.finish(); |
| | | } |
| | | } |
| | | } |
| | | return R.ok(excelUrl + name); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("文件传输失败【{}】", e.getMessage()); |
| | | return R.fail(); |
| | | } |
| | | } |
| | | |
| | | private String convertMarriage(String ma) { |
| | |
| | | |
| | | private Long communityId; |
| | | |
| | | private Long userId; |
| | | |
| | | private static int headSize = 0; |
| | | |
| | | private Map<Integer, String> headData; |
| | | |
| | | private String userName; |
| | | // FTP 登录密码 |
| | | private String password; |
| | | // FTP 服务器地址IP地址 |
| | | private String host; |
| | | // FTP 端口 |
| | | private int port; |
| | | private String excelUrl; |
| | | |
| | | private StringRedisTemplate stringRedisTemplate; |
| | | |
| | | public static String loadUrl; |
| | | |
| | | public ComMngPopulationVeteransExcelListen(CommunityService communityService, Long communityId, String userName, String password, String host, int port, String excelUrl, StringRedisTemplate stringRedisTemplate) { |
| | | public ComMngPopulationVeteransExcelListen(CommunityService communityService, Long communityId, Long userId , StringRedisTemplate stringRedisTemplate) { |
| | | this.communityService = communityService; |
| | | this.communityId = communityId; |
| | | this.userName = userName; |
| | | this.password = password; |
| | | this.host = host; |
| | | this.port = port; |
| | | this.excelUrl = excelUrl; |
| | | this.userId = userId; |
| | | this.stringRedisTemplate = stringRedisTemplate; |
| | | } |
| | | |
| | |
| | | //根据list中的IdCard城市来去重 |
| | | List<ComMngPopulationVeteransExcelVO> newVoList = voList.stream().filter(ListUtils.distinctByKey(ComMngPopulationVeteransExcelVO::getDistinctPass)).collect(Collectors.toList()); |
| | | log.info("开始进入业务层处理逻辑"); |
| | | R r = communityService.listSavePopulationVeteransExcelVO(newVoList, communityId); |
| | | R r = communityService.listSavePopulationVeteransExcelVO(newVoList, communityId, userId); |
| | | log.info("业务层处理逻辑完成"); |
| | | if (!R.isOk(r)) { |
| | | log.info("业务层处理成功"); |
| | |
| | | * @return 导入结果 |
| | | */ |
| | | @PostMapping("/common/data/population/import") |
| | | R listSavePopulationServeExcelVO(@RequestBody List<ComMngPopulationServeExcelVO> list, @RequestParam(value = "communityId") Long communityId); |
| | | R listSavePopulationServeExcelVO(@RequestBody List<ComMngPopulationServeExcelVO> list, @RequestParam(value = "communityId") Long communityId, @RequestParam(value = "userId") Long userId); |
| | | |
| | | /** |
| | | * 批量导入吸毒人员 |
| | |
| | | * @return 导入结果 |
| | | */ |
| | | @PostMapping("/common/data/population/importDrug") |
| | | R listSavePopulationDrugExcelVO(@RequestBody List<ComMngPopulationDrugExcelVO> list, @RequestParam(value = "communityId") Long communityId); |
| | | R listSavePopulationDrugExcelVO(@RequestBody List<ComMngPopulationDrugExcelVO> list, @RequestParam(value = "communityId") Long communityId, @RequestParam(value = "userId") Long userId); |
| | | |
| | | /** |
| | | * 批量导入社区矫正人员 |
| | |
| | | * @return 导入结果 |
| | | */ |
| | | @PostMapping("/common/data/population/importCorrect") |
| | | R listSavePopulationCorrectExcelVO(@RequestBody List<ComMngPopulationCorrectExcelVO> list, @RequestParam(value = "communityId") Long communityId); |
| | | R listSavePopulationCorrectExcelVO(@RequestBody List<ComMngPopulationCorrectExcelVO> list, @RequestParam(value = "communityId") Long communityId, @RequestParam(value = "userId") Long userId); |
| | | |
| | | /** |
| | | * 批量导入重精人员 |
| | |
| | | * @return 导入结果 |
| | | */ |
| | | @PostMapping("/common/data/population/importMajor") |
| | | R listSavePopulationMajorExcelVO(@RequestBody List<ComMngPopulationMajorExcelVO> list, @RequestParam(value = "communityId") Long communityId); |
| | | R listSavePopulationMajorExcelVO(@RequestBody List<ComMngPopulationMajorExcelVO> list, @RequestParam(value = "communityId") Long communityId, @RequestParam(value = "userId") Long userId); |
| | | |
| | | /** |
| | | * 批量导入邪教人员 |
| | |
| | | * @return 导入结果 |
| | | */ |
| | | @PostMapping("/common/data/population/importCult") |
| | | R listSavePopulationCultExcelVO(@RequestBody List<ComMngPopulationCultExcelVO> list, @RequestParam(value = "communityId") Long communityId); |
| | | R listSavePopulationCultExcelVO(@RequestBody List<ComMngPopulationCultExcelVO> list, @RequestParam(value = "communityId") Long communityId, @RequestParam(value = "userId") Long userId); |
| | | |
| | | /** |
| | | * 批量导入刑释人员 |
| | |
| | | * @return 导入结果 |
| | | */ |
| | | @PostMapping("/common/data/population/importRehabilitation") |
| | | R listSavePopulationRehabilitationExcelVO(@RequestBody List<ComMngPopulationRehabilitationExcelVO> list, @RequestParam(value = "communityId") Long communityId); |
| | | R listSavePopulationRehabilitationExcelVO(@RequestBody List<ComMngPopulationRehabilitationExcelVO> list, @RequestParam(value = "communityId") Long communityId, @RequestParam(value = "userId") Long userId); |
| | | |
| | | /** |
| | | * 批量导入重点上访人员 |
| | |
| | | * @return 导入结果 |
| | | */ |
| | | @PostMapping("/common/data/population/importKey") |
| | | R listSavePopulationKeyExcelVO(@RequestBody List<ComMngPopulationKeyExcelVO> list, @RequestParam(value = "communityId") Long communityId); |
| | | R listSavePopulationKeyExcelVO(@RequestBody List<ComMngPopulationKeyExcelVO> list, @RequestParam(value = "communityId") Long communityId, @RequestParam(value = "userId") Long userId); |
| | | |
| | | /** |
| | | * 批量导入服刑人员 |
| | |
| | | * @return 导入结果 |
| | | */ |
| | | @PostMapping("/common/data/population/importSentence") |
| | | R listSavePopulationSentenceExcelVO(@RequestBody List<ComMngPopulationSentenceExcelVO> list, @RequestParam(value = "communityId") Long communityId); |
| | | R listSavePopulationSentenceExcelVO(@RequestBody List<ComMngPopulationSentenceExcelVO> list, @RequestParam(value = "communityId") Long communityId, @RequestParam(value = "userId") Long userId); |
| | | |
| | | /** |
| | | * 批量导入退役军人 |
| | |
| | | * @return 导入结果 |
| | | */ |
| | | @PostMapping("/common/data/population/importVeterans") |
| | | R listSavePopulationVeteransExcelVO(@RequestBody List<ComMngPopulationVeteransExcelVO> list, @RequestParam(value = "communityId") Long communityId); |
| | | R listSavePopulationVeteransExcelVO(@RequestBody List<ComMngPopulationVeteransExcelVO> list, @RequestParam(value = "communityId") Long communityId, @RequestParam(value = "userId") Long userId); |
| | | |
| | | /** |
| | | * 批量导入残疾人 |
| | |
| | | * @return 导入结果 |
| | | */ |
| | | @PostMapping("/common/data/population/importDisability") |
| | | R listSavePopulationDisabilityExcelVO(@RequestBody List<ComMngPopulationDisabilityExcelVO> list, @RequestParam(value = "communityId") Long communityId); |
| | | R listSavePopulationDisabilityExcelVO(@RequestBody List<ComMngPopulationDisabilityExcelVO> list, @RequestParam(value = "communityId") Long communityId, @RequestParam(value = "userId") Long userId); |
| | | |
| | | /** |
| | | * 批量导入低保户 |
| | |
| | | * @return 导入结果 |
| | | */ |
| | | @PostMapping("/common/data/population/importLowSecurity") |
| | | R listSavePopulationLowSecurityExcelVO(@RequestBody List<ComMngPopulationLowSecurityExcelVO> list, @RequestParam(value = "communityId") Long communityId); |
| | | R listSavePopulationLowSecurityExcelVO(@RequestBody List<ComMngPopulationLowSecurityExcelVO> list, @RequestParam(value = "communityId") Long communityId, @RequestParam(value = "userId") Long userId); |
| | | |
| | | /** |
| | | * 确认导入实有人口(有则更新,无则新建) |
| | |
| | | InputStream inputStream = null; |
| | | try { |
| | | inputStream = file.getInputStream(); |
| | | ComMngPopulationServeExcelListen comMngPopulationServeExcelListen = new ComMngPopulationServeExcelListen(communityService, this.getCommunityId(),userName,password,host,port,excelUrl,stringRedisTemplate); |
| | | ComMngPopulationServeExcelListen comMngPopulationServeExcelListen = new ComMngPopulationServeExcelListen(communityService, this.getCommunityId(),this.getLoginUserInfo().getUserId(),stringRedisTemplate); |
| | | EasyExcel.read(inputStream, null, comMngPopulationServeExcelListen).sheet().doRead(); |
| | | } catch (IOException e) { |
| | | log.error("导入模板失败【{}】", e.getMessage()); |
| | |
| | | InputStream inputStream = null; |
| | | try { |
| | | inputStream = file.getInputStream(); |
| | | ComMngPopulationDrugExcelListen comMngPopulationDrugExcelListen = new ComMngPopulationDrugExcelListen(communityService, this.getCommunityId(),userName,password,host,port,excelUrl,stringRedisTemplate); |
| | | ComMngPopulationDrugExcelListen comMngPopulationDrugExcelListen = new ComMngPopulationDrugExcelListen(communityService, this.getCommunityId(),this.getLoginUserInfo().getUserId(),stringRedisTemplate); |
| | | EasyExcel.read(inputStream, null, comMngPopulationDrugExcelListen).sheet().doRead(); |
| | | } catch (IOException e) { |
| | | log.error("导入模板失败【{}】", e.getMessage()); |
| | |
| | | InputStream inputStream = null; |
| | | try { |
| | | inputStream = file.getInputStream(); |
| | | ComMngPopulationCorrectExcelListen comMngPopulationCorrectExcelListen = new ComMngPopulationCorrectExcelListen(communityService, this.getCommunityId(),userName,password,host,port,excelUrl,stringRedisTemplate); |
| | | ComMngPopulationCorrectExcelListen comMngPopulationCorrectExcelListen = new ComMngPopulationCorrectExcelListen(communityService, this.getCommunityId(),this.getLoginUserInfo().getUserId(),stringRedisTemplate); |
| | | EasyExcel.read(inputStream, null, comMngPopulationCorrectExcelListen).sheet().doRead(); |
| | | } catch (IOException e) { |
| | | log.error("导入模板失败【{}】", e.getMessage()); |
| | |
| | | InputStream inputStream = null; |
| | | try { |
| | | inputStream = file.getInputStream(); |
| | | ComMngPopulationMajorExcelListen comMngPopulationMajorExcelListen = new ComMngPopulationMajorExcelListen(communityService, this.getCommunityId(),userName,password,host,port,excelUrl,stringRedisTemplate); |
| | | ComMngPopulationMajorExcelListen comMngPopulationMajorExcelListen = new ComMngPopulationMajorExcelListen(communityService, this.getCommunityId(),this.getLoginUserInfo().getUserId(),stringRedisTemplate); |
| | | EasyExcel.read(inputStream, null, comMngPopulationMajorExcelListen).sheet().doRead(); |
| | | } catch (IOException e) { |
| | | log.error("导入模板失败【{}】", e.getMessage()); |
| | |
| | | InputStream inputStream = null; |
| | | try { |
| | | inputStream = file.getInputStream(); |
| | | ComMngPopulationCultExcelListen comMngPopulationCultExcelListen = new ComMngPopulationCultExcelListen(communityService, this.getCommunityId(),userName,password,host,port,excelUrl,stringRedisTemplate); |
| | | ComMngPopulationCultExcelListen comMngPopulationCultExcelListen = new ComMngPopulationCultExcelListen(communityService, this.getCommunityId(),this.getLoginUserInfo().getUserId(),stringRedisTemplate); |
| | | EasyExcel.read(inputStream, null, comMngPopulationCultExcelListen).sheet().doRead(); |
| | | } catch (IOException e) { |
| | | log.error("导入模板失败【{}】", e.getMessage()); |
| | |
| | | InputStream inputStream = null; |
| | | try { |
| | | inputStream = file.getInputStream(); |
| | | ComMngPopulationRehabilitationExcelListen comMngPopulationRehabilitationExcelListen = new ComMngPopulationRehabilitationExcelListen(communityService, this.getCommunityId(),userName,password,host,port,excelUrl,stringRedisTemplate); |
| | | ComMngPopulationRehabilitationExcelListen comMngPopulationRehabilitationExcelListen = new ComMngPopulationRehabilitationExcelListen(communityService, this.getCommunityId(),this.getLoginUserInfo().getUserId(),stringRedisTemplate); |
| | | EasyExcel.read(inputStream, null, comMngPopulationRehabilitationExcelListen).sheet().doRead(); |
| | | } catch (IOException e) { |
| | | log.error("导入模板失败【{}】", e.getMessage()); |
| | |
| | | InputStream inputStream = null; |
| | | try { |
| | | inputStream = file.getInputStream(); |
| | | ComMngPopulationKeyExcelListen mngPopulationKeyExcelListen = new ComMngPopulationKeyExcelListen(communityService, this.getCommunityId(),userName,password,host,port,excelUrl,stringRedisTemplate); |
| | | ComMngPopulationKeyExcelListen mngPopulationKeyExcelListen = new ComMngPopulationKeyExcelListen(communityService, this.getCommunityId(),this.getLoginUserInfo().getUserId(),stringRedisTemplate); |
| | | EasyExcel.read(inputStream, null, mngPopulationKeyExcelListen).sheet().doRead(); |
| | | } catch (IOException e) { |
| | | log.error("导入模板失败【{}】", e.getMessage()); |
| | |
| | | InputStream inputStream = null; |
| | | try { |
| | | inputStream = file.getInputStream(); |
| | | ComMngPopulationSentenceExcelListen comMngPopulationSentenceExcelListen = new ComMngPopulationSentenceExcelListen(communityService, this.getCommunityId(),userName,password,host,port,excelUrl,stringRedisTemplate); |
| | | ComMngPopulationSentenceExcelListen comMngPopulationSentenceExcelListen = new ComMngPopulationSentenceExcelListen(communityService, this.getCommunityId(),this.getLoginUserInfo().getUserId(),stringRedisTemplate); |
| | | EasyExcel.read(inputStream, null, comMngPopulationSentenceExcelListen).sheet().doRead(); |
| | | } catch (IOException e) { |
| | | log.error("导入模板失败【{}】", e.getMessage()); |
| | |
| | | InputStream inputStream = null; |
| | | try { |
| | | inputStream = file.getInputStream(); |
| | | ComMngPopulationVeteransExcelListen comMngPopulationVeteransExcelListen = new ComMngPopulationVeteransExcelListen(communityService, this.getCommunityId(),userName,password,host,port,excelUrl,stringRedisTemplate); |
| | | ComMngPopulationVeteransExcelListen comMngPopulationVeteransExcelListen = new ComMngPopulationVeteransExcelListen(communityService, this.getCommunityId(),this.getLoginUserInfo().getUserId(),stringRedisTemplate); |
| | | EasyExcel.read(inputStream, null, comMngPopulationVeteransExcelListen).sheet().doRead(); |
| | | } catch (IOException e) { |
| | | log.error("导入模板失败【{}】", e.getMessage()); |
| | |
| | | InputStream inputStream = null; |
| | | try { |
| | | inputStream = file.getInputStream(); |
| | | ComMngPopulationDisabilityExcelListen mngPopulationDisabilityExcelListen = new ComMngPopulationDisabilityExcelListen(communityService, this.getCommunityId(),userName,password,host,port,excelUrl,stringRedisTemplate); |
| | | ComMngPopulationDisabilityExcelListen mngPopulationDisabilityExcelListen = new ComMngPopulationDisabilityExcelListen(communityService, this.getCommunityId(),this.getLoginUserInfo().getUserId(),stringRedisTemplate); |
| | | EasyExcel.read(inputStream, null, mngPopulationDisabilityExcelListen).sheet().doRead(); |
| | | } catch (IOException e) { |
| | | log.error("导入模板失败【{}】", e.getMessage()); |
| | |
| | | InputStream inputStream = null; |
| | | try { |
| | | inputStream = file.getInputStream(); |
| | | ComMngPopulationLowSecurityExcelListen mngPopulationDisabilityExcelListen = new ComMngPopulationLowSecurityExcelListen(communityService, this.getCommunityId(),userName,password,host,port,excelUrl,stringRedisTemplate); |
| | | ComMngPopulationLowSecurityExcelListen mngPopulationDisabilityExcelListen = new ComMngPopulationLowSecurityExcelListen(communityService, this.getCommunityId(),this.getLoginUserInfo().getUserId(),stringRedisTemplate); |
| | | EasyExcel.read(inputStream, null, mngPopulationDisabilityExcelListen).sheet().doRead(); |
| | | } catch (IOException e) { |
| | | log.error("导入模板失败【{}】", e.getMessage()); |
| | |
| | | try { |
| | | Long communityId = Long.valueOf(request.getParameter("communityId")); |
| | | inputStream = file.getInputStream(); |
| | | ComMngPopulationServeExcelListen comMngPopulationServeExcelListen = new ComMngPopulationServeExcelListen(communityService, communityId,userName,password,host,port,excelUrl,stringRedisTemplate); |
| | | ComMngPopulationServeExcelListen comMngPopulationServeExcelListen = new ComMngPopulationServeExcelListen(communityService, communityId,this.getLoginUserInfo().getUserId(),stringRedisTemplate); |
| | | EasyExcel.read(inputStream, null, comMngPopulationServeExcelListen).sheet().doRead(); |
| | | } catch (IOException e) { |
| | | log.error("导入模板失败【{}】", e.getMessage()); |
| | |
| | | */ |
| | | @PostMapping("/population/import") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R listSavePopulationExcelVO(@RequestBody List<ComMngPopulationServeExcelVO> list, @RequestParam(value = "communityId") Long communityId){ |
| | | return comMngPopulationService.listSavePopulation(list, communityId); |
| | | public R listSavePopulationExcelVO(@RequestBody List<ComMngPopulationServeExcelVO> list, @RequestParam(value = "communityId") Long communityId, @RequestParam(value = "userId") Long userId){ |
| | | return comMngPopulationService.listSavePopulation(list, communityId, userId); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("population/importDrug") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R listSavePopulationDrugExcelVO(@RequestBody List<ComMngPopulationDrugExcelVO> list, @RequestParam(value = "communityId") Long communityId){ |
| | | return comMngPopulationService.listSaveDrugPopulation(list, communityId); |
| | | public R listSavePopulationDrugExcelVO(@RequestBody List<ComMngPopulationDrugExcelVO> list, @RequestParam(value = "communityId") Long communityId, @RequestParam(value = "userId") Long userId){ |
| | | return comMngPopulationService.listSaveDrugPopulation(list, communityId, userId); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("population/importCorrect") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R listSavePopulationCorrectExcelVO(@RequestBody List<ComMngPopulationCorrectExcelVO> list, @RequestParam(value = "communityId") Long communityId){ |
| | | return comMngPopulationService.listSaveCorrectPopulation(list, communityId); |
| | | public R listSavePopulationCorrectExcelVO(@RequestBody List<ComMngPopulationCorrectExcelVO> list, @RequestParam(value = "communityId") Long communityId, @RequestParam(value = "userId") Long userId){ |
| | | return comMngPopulationService.listSaveCorrectPopulation(list, communityId, userId); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @PostMapping("population/importMajor") |
| | | public R listSavePopulationMajorExcelVO(@RequestBody List<ComMngPopulationMajorExcelVO> list, @RequestParam(value = "communityId") Long communityId){ |
| | | return comMngPopulationService.listSaveMajorPopulation(list, communityId); |
| | | public R listSavePopulationMajorExcelVO(@RequestBody List<ComMngPopulationMajorExcelVO> list, @RequestParam(value = "communityId") Long communityId, @RequestParam(value = "userId") Long userId){ |
| | | return comMngPopulationService.listSaveMajorPopulation(list, communityId, userId); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("population/importCult") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R listSavePopulationCultExcelVO(@RequestBody List<ComMngPopulationCultExcelVO> list, @RequestParam(value = "communityId") Long communityId){ |
| | | return comMngPopulationService.listSaveCultPopulation(list, communityId); |
| | | public R listSavePopulationCultExcelVO(@RequestBody List<ComMngPopulationCultExcelVO> list, @RequestParam(value = "communityId") Long communityId, @RequestParam(value = "userId") Long userId){ |
| | | return comMngPopulationService.listSaveCultPopulation(list, communityId, userId); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("population/importRehabilitation") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R listSavePopulationRehabilitationExcelVO(@RequestBody List<ComMngPopulationRehabilitationExcelVO> list, @RequestParam(value = "communityId") Long communityId){ |
| | | return comMngPopulationService.listSaveRehabilitationPopulation(list, communityId); |
| | | public R listSavePopulationRehabilitationExcelVO(@RequestBody List<ComMngPopulationRehabilitationExcelVO> list, @RequestParam(value = "communityId") Long communityId, @RequestParam(value = "userId") Long userId){ |
| | | return comMngPopulationService.listSaveRehabilitationPopulation(list, communityId, userId); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @PostMapping("population/importKey") |
| | | public R listSavePopulationKeyExcelVO(@RequestBody List<ComMngPopulationKeyExcelVO> list, @RequestParam(value = "communityId") Long communityId){ |
| | | return comMngPopulationService.listSaveKeyPopulation(list, communityId); |
| | | public R listSavePopulationKeyExcelVO(@RequestBody List<ComMngPopulationKeyExcelVO> list, @RequestParam(value = "communityId") Long communityId, @RequestParam(value = "userId") Long userId){ |
| | | return comMngPopulationService.listSaveKeyPopulation(list, communityId, userId); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @PostMapping("population/importSentence") |
| | | public R listSavePopulationSentenceExcelVO(@RequestBody List<ComMngPopulationSentenceExcelVO> list, @RequestParam(value = "communityId") Long communityId){ |
| | | return comMngPopulationService.listSaveSentencePopulation(list, communityId); |
| | | public R listSavePopulationSentenceExcelVO(@RequestBody List<ComMngPopulationSentenceExcelVO> list, @RequestParam(value = "communityId") Long communityId, @RequestParam(value = "userId") Long userId){ |
| | | return comMngPopulationService.listSaveSentencePopulation(list, communityId, userId); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @PostMapping("population/importVeterans") |
| | | public R listSavePopulationVeteransExcelVO(@RequestBody List<ComMngPopulationVeteransExcelVO> list, @RequestParam(value = "communityId") Long communityId){ |
| | | return comMngPopulationService.listSaveVeteransPopulation(list, communityId); |
| | | public R listSavePopulationVeteransExcelVO(@RequestBody List<ComMngPopulationVeteransExcelVO> list, @RequestParam(value = "communityId") Long communityId, @RequestParam(value = "userId") Long userId){ |
| | | return comMngPopulationService.listSaveVeteransPopulation(list, communityId, userId); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @PostMapping("population/importDisability") |
| | | public R listSavePopulationDisabilityExcelVO(@RequestBody List<ComMngPopulationDisabilityExcelVO> list, @RequestParam(value = "communityId") Long communityId){ |
| | | return comMngPopulationService.listSaveDisabilityPopulation(list, communityId); |
| | | public R listSavePopulationDisabilityExcelVO(@RequestBody List<ComMngPopulationDisabilityExcelVO> list, @RequestParam(value = "communityId") Long communityId, @RequestParam(value = "userId") Long userId){ |
| | | return comMngPopulationService.listSaveDisabilityPopulation(list, communityId, userId); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @PostMapping("/population/importLowSecurity") |
| | | public R listSavePopulationLowSecurityExcelVO(@RequestBody List<ComMngPopulationLowSecurityExcelVO> list, @RequestParam(value = "communityId") Long communityId) { |
| | | return comMngPopulationService.listSaveLowSecurityPopulation(list, communityId); |
| | | public R listSavePopulationLowSecurityExcelVO(@RequestBody List<ComMngPopulationLowSecurityExcelVO> list, @RequestParam(value = "communityId") Long communityId, @RequestParam(value = "userId") Long userId) { |
| | | return comMngPopulationService.listSaveLowSecurityPopulation(list, communityId, userId); |
| | | } |
| | | |
| | | /** |
New file |
| | |
| | | package com.panzhihua.service_community.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.panzhihua.service_community.model.dos.ComMngPopulationCommunityTagsDO; |
| | | import com.panzhihua.service_community.model.dos.ComMngPopulationDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @auther txb |
| | | * @create 2021-08-19 14:55:29 |
| | | * @describe 基础数据》人口社区特殊群体关系表mapper类 |
| | | */ |
| | | @Mapper |
| | | public interface ComMngPopulationCommunityTagsDAO extends BaseMapper<ComMngPopulationCommunityTagsDO> { |
| | | |
| | | void updateAll(@Param("populationCommunityTagsList") List<ComMngPopulationCommunityTagsDO> populationCommunityTagsList); |
| | | |
| | | } |
| | |
| | | "cmp.remark, " + |
| | | "cmp.native_place, " + |
| | | "cmp.nation, " + |
| | | "cmp.label, " + |
| | | "cmpct.label, " + |
| | | "cmp.marriage, " + |
| | | "cmp.culture_level, " + |
| | | "cmp.profession, " + |
| | |
| | | "cmp.is_rent " + |
| | | "FROM " + |
| | | "com_mng_population AS cmp " + |
| | | " LEFT JOIN com_mng_population_community_tags AS cmpct ON cmp.id = cmpct.population_id " + |
| | | "<where>" + |
| | | "<if test='comMngPopulationVO.name != null and comMngPopulationVO.name != ""'>" + |
| | | "AND cmp.`name` LIKE concat(#{comMngPopulationVO.name},'%') " + |
| | | " </if> " + |
| | | "<if test='comMngPopulationVO.label != null and comMngPopulationVO.label != ""'>" + |
| | | "AND cmp.label LIKE concat('%',#{comMngPopulationVO.label},'%') " + |
| | | "AND cmpct.label LIKE concat('%',#{comMngPopulationVO.label},'%') " + |
| | | " </if> " + |
| | | "<if test='comMngPopulationVO.actId != null'>" + |
| | | " and cmp.act_id = #{comMngPopulationVO.actId} " + |
New file |
| | |
| | | package com.panzhihua.service_community.model.dos; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | |
| | | /** |
| | | * @auther txb |
| | | * @create 2021-08-19 14:55:29 |
| | | * @describe 基础数据》人口社区特殊群体关系表实体类 |
| | | */ |
| | | |
| | | @Data |
| | | @TableName("com_mng_population_community_tags") |
| | | public class ComMngPopulationCommunityTagsDO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键id |
| | | */ |
| | | @TableId(type = IdType.INPUT) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 人口id |
| | | */ |
| | | private Long populationId; |
| | | |
| | | /** |
| | | * 社区id |
| | | */ |
| | | private Long communityId; |
| | | |
| | | /** |
| | | * 标签集合(多个标签以,隔开) |
| | | */ |
| | | private String label; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Date createAt; |
| | | |
| | | /** |
| | | * 创建用户 |
| | | */ |
| | | private Long createBy; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @TableField(fill = FieldFill.UPDATE) |
| | | private Date updateAt; |
| | | |
| | | /** |
| | | * 修改用户 |
| | | */ |
| | | private Long updateBy; |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "ComMngPopulationCommunityTagsDO{" + |
| | | "id=" + id + |
| | | ", populationId=" + populationId + |
| | | ", communityId=" + communityId + |
| | | ", label=" + label + |
| | | ", createAt=" + createAt + |
| | | ", createBy=" + createBy + |
| | | ", updateAt=" + updateAt + |
| | | ", updateBy=" + updateBy + |
| | | "}"; |
| | | } |
| | | } |
| | |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Date createAt; |
| | | |
| | | /** |
| | | * 创建用戶 |
| | | */ |
| | | private Long createBy; |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | |
| | | private Date updateAt; |
| | | |
| | | /** |
| | | * 修改用戶 |
| | | */ |
| | | private Long updateBy; |
| | | |
| | | /** |
| | | * 小区名字 |
| | | */ |
| | | @TableField(exist = false) |
New file |
| | |
| | | package com.panzhihua.service_community.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.panzhihua.service_community.model.dos.ComMngPopulationCommunityTagsDO; |
| | | |
| | | /** |
| | | * @auther txb |
| | | * @create 2021-08-19 14:55:29 |
| | | * @describe 基础数据》人口社区特殊群体关系表服务类 |
| | | */ |
| | | public interface ComMngPopulationCommunityTagsService extends IService<ComMngPopulationCommunityTagsDO> { |
| | | |
| | | } |
| | |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | R listSavePopulation(List<ComMngPopulationServeExcelVO> list, Long communityId); |
| | | R listSavePopulation(List<ComMngPopulationServeExcelVO> list, Long communityId, Long userId); |
| | | |
| | | /** |
| | | * 导入吸毒人员 |
| | |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | R listSaveDrugPopulation(List<ComMngPopulationDrugExcelVO> list, Long communityId); |
| | | R listSaveDrugPopulation(List<ComMngPopulationDrugExcelVO> list, Long communityId, Long userId); |
| | | |
| | | /** |
| | | * 批量导入社区矫正人员 |
| | |
| | | * @param communityId 社区id |
| | | * @return 导入结果 |
| | | */ |
| | | R listSaveCorrectPopulation(List<ComMngPopulationCorrectExcelVO> list, Long communityId); |
| | | R listSaveCorrectPopulation(List<ComMngPopulationCorrectExcelVO> list, Long communityId, Long userId); |
| | | |
| | | /** |
| | | * 批量导入重精人员 |
| | |
| | | * @param communityId 社区id |
| | | * @return 导入结果 |
| | | */ |
| | | R listSaveMajorPopulation(List<ComMngPopulationMajorExcelVO> list, Long communityId); |
| | | R listSaveMajorPopulation(List<ComMngPopulationMajorExcelVO> list, Long communityId, Long userId); |
| | | |
| | | /** |
| | | * 批量导入邪教人员 |
| | |
| | | * @param communityId 社区id |
| | | * @return 导入结果 |
| | | */ |
| | | R listSaveCultPopulation(List<ComMngPopulationCultExcelVO> list, Long communityId); |
| | | R listSaveCultPopulation(List<ComMngPopulationCultExcelVO> list, Long communityId, Long userId); |
| | | |
| | | /** |
| | | * 批量导入刑释人员 |
| | |
| | | * @param communityId 社区id |
| | | * @return 导入结果 |
| | | */ |
| | | R listSaveRehabilitationPopulation(List<ComMngPopulationRehabilitationExcelVO> list, Long communityId); |
| | | R listSaveRehabilitationPopulation(List<ComMngPopulationRehabilitationExcelVO> list, Long communityId, Long userId); |
| | | |
| | | /** |
| | | * 批量导入重点上访人员 |
| | |
| | | * @param communityId 社区id |
| | | * @return 导入结果 |
| | | */ |
| | | R listSaveKeyPopulation(List<ComMngPopulationKeyExcelVO> list, Long communityId); |
| | | R listSaveKeyPopulation(List<ComMngPopulationKeyExcelVO> list, Long communityId, Long userId); |
| | | |
| | | /** |
| | | * 批量导入服刑人员 |
| | |
| | | * @param communityId 社区id |
| | | * @return 导入结果 |
| | | */ |
| | | R listSaveSentencePopulation(List<ComMngPopulationSentenceExcelVO> list, Long communityId); |
| | | R listSaveSentencePopulation(List<ComMngPopulationSentenceExcelVO> list, Long communityId, Long userId); |
| | | |
| | | /** |
| | | * 批量导入退役军人 |
| | |
| | | * @param communityId 社区id |
| | | * @return 导入结果 |
| | | */ |
| | | R listSaveVeteransPopulation(List<ComMngPopulationVeteransExcelVO> list, Long communityId); |
| | | R listSaveVeteransPopulation(List<ComMngPopulationVeteransExcelVO> list, Long communityId, Long userId); |
| | | |
| | | /** |
| | | * 批量导入残疾人 |
| | |
| | | * @param communityId 社区id |
| | | * @return 导入结果 |
| | | */ |
| | | R listSaveDisabilityPopulation(List<ComMngPopulationDisabilityExcelVO> list, Long communityId); |
| | | R listSaveDisabilityPopulation(List<ComMngPopulationDisabilityExcelVO> list, Long communityId, Long userId); |
| | | |
| | | /** |
| | | * 批量导入低保户 |
| | |
| | | * @param communityId 社区id |
| | | * @return 导入结果 |
| | | */ |
| | | R listSaveLowSecurityPopulation(List<ComMngPopulationLowSecurityExcelVO> list, Long communityId); |
| | | R listSaveLowSecurityPopulation(List<ComMngPopulationLowSecurityExcelVO> list, Long communityId, Long userId); |
| | | /** |
| | | * 确认导入实有人口(有则更新,无则新建) |
| | | * |
New file |
| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.panzhihua.service_community.dao.ComMngPopulationCommunityTagsDAO; |
| | | import com.panzhihua.service_community.model.dos.ComMngPopulationCommunityTagsDO; |
| | | import com.panzhihua.service_community.service.ComMngPopulationCommunityTagsService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @auther txb |
| | | * @create 2021-08-19 14:55:29 |
| | | * @describe 基础数据》人口社区特殊群体关系表服务实现类 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class ComMngPopulationCommunityTagsServiceImpl extends ServiceImpl<ComMngPopulationCommunityTagsDAO, ComMngPopulationCommunityTagsDO> implements ComMngPopulationCommunityTagsService { |
| | | |
| | | } |
| | |
| | | @Resource |
| | | private ComMngPopulationHouseUserDAO comMngPopulationHouseUserDAO; |
| | | @Resource |
| | | private ComMngPopulationCommunityTagsDAO comMngPopulationCommunityTagsDAO; |
| | | @Resource |
| | | private ComMngPopulationCommunityTagsService comMngPopulationCommunityTagsService; |
| | | @Resource |
| | | private ComMngPopulationDAO comMngPopulationDAO; |
| | | @Resource |
| | | private ComMngPopulationHouseUserService comMngPopulationHouseUserService; |
| | |
| | | //设置年龄 |
| | | if (StringUtils.isNotEmpty(comMngPopulationVO.getBirthday())) { |
| | | comMngPopulationVO.setAge(AgeUtils.getAgeFromBirthTimes(comMngPopulationVO.getBirthday())); |
| | | } |
| | | //设置特殊群体标签 |
| | | ComMngPopulationCommunityTagsDO comMngPopulationCommunityTagsDO = comMngPopulationCommunityTagsDAO.selectOne(new QueryWrapper<ComMngPopulationCommunityTagsDO>(). |
| | | lambda().eq(ComMngPopulationCommunityTagsDO::getPopulationId, populationId)); |
| | | if (null != comMngPopulationCommunityTagsDO) { |
| | | comMngPopulationVO.setLabel(comMngPopulationCommunityTagsDO.getLabel()); |
| | | } |
| | | |
| | | //查询当前用户电子档信息 |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R listSavePopulation(List<ComMngPopulationServeExcelVO> list, Long communityId){ |
| | | public R listSavePopulation(List<ComMngPopulationServeExcelVO> list, Long communityId, Long userId){ |
| | | //需要新增的房屋集合 |
| | | List<ComMngPopulationHouseDO> houseList = new ArrayList<>(); |
| | | //需要新增的人口集合 |
| | |
| | | List<ComMngPopulationDO> updateList = new ArrayList<>(); |
| | | //需要新增的人口与房屋关系集合 |
| | | List<ComMngPopulationHouseUserDO> houseUserList = new ArrayList<>(); |
| | | //需要新增的人口与社区关系集合 |
| | | List<ComMngPopulationCommunityTagsDO> savePopulationCommunityList = new ArrayList<>(); |
| | | //需要新增的人口与社区关系集合 |
| | | List<ComMngPopulationCommunityTagsDO> updatePopulationCommunityList = new ArrayList<>(); |
| | | |
| | | log.info("开始处理导入数据"); |
| | | List<ComMngPopulationMistakeExcelVO> mistakes = new ArrayList<>(); |
| | |
| | | log.error("未查询到社区信息"); |
| | | return R.fail("未查询到社区信息"); |
| | | } |
| | | log.info("开始查询社区信息数据完成"); |
| | | log.info("查询社区信息数据完成"); |
| | | |
| | | //查询当前社区标签列表 |
| | | List<String> labelList = new ArrayList<>(); |
| | |
| | | houseUserMap.put(key,houseUser); |
| | | }); |
| | | |
| | | List<ComMngPopulationCommunityTagsDO> populationCommunityLists = comMngPopulationCommunityTagsDAO.selectList(null); |
| | | HashMap<String,Object> populationCommunityMap = new HashMap<>(); |
| | | populationCommunityLists.forEach(populationCommunity -> { |
| | | String key = populationCommunity.getPopulationId() + populationCommunity.getCommunityId() + ""; |
| | | populationCommunityMap.put(key,populationCommunity); |
| | | }); |
| | | |
| | | for (ComMngPopulationServeExcelVO vo : list) { |
| | | if (vo.getDoorNo().contains("号")) { |
| | |
| | | address.append(vo.getHouseNo()).append("号"); |
| | | } |
| | | vo.setAddress(address.toString()); |
| | | log.info("开始查询小区街路巷是否存在完成"); |
| | | log.info("查询小区街路巷是否存在完成"); |
| | | |
| | | log.info("开始查询房屋是否存在"); |
| | | //先判断房屋是否存在 |
| | |
| | | populationHouseDO = (ComMngPopulationHouseDO)houseMap.get(houseKey); |
| | | } |
| | | vo.setHouseId(populationHouseDO.getId()); |
| | | log.info("开始查询房屋是否存在完成"); |
| | | log.info("查询房屋是否存在完成"); |
| | | |
| | | if (StringUtils.isEmpty(vo.getName()) && StringUtils.isEmpty(vo.getCardNo())) { |
| | | //空户处理完房屋信息,直接返回 |
| | |
| | | if(!isOnly(populationKey,populationMap)){ |
| | | //存在实有人口信息,则更新 |
| | | populationDO = (ComMngPopulationDO)populationMap.get(populationKey); |
| | | ComMngPopulationDO updatePopulationDO = updatePopulationDO(vo,populationDO,labelList); |
| | | ComMngPopulationDO updatePopulationDO = updatePopulationDO(vo,populationDO,userId); |
| | | updateList.add(updatePopulationDO); |
| | | |
| | | ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO(); |
| | | BeanUtils.copyProperties(vo,mistake); |
| | | setMistake(mistake, vo); |
| | | mistake.setMistake("该实有人口已存在,执行更新,社区id::"+ populationDO.getActId()); |
| | | mistakes.add(mistake); |
| | | }else{ |
| | | //不存在实有人口,则新增 |
| | | populationDO = savePopulationDO(vo, populationActVO, comMngVillageDO,labelList); |
| | | populationDO = savePopulationDO(vo, populationActVO, comMngVillageDO, userId); |
| | | saveList.add(populationDO); |
| | | } |
| | | log.info("开始查询实有人口是否已存在完成"); |
| | | log.info("查询实有人口是否已存在完成"); |
| | | |
| | | log.info("开始查询实有人口房屋居住信息"); |
| | | //处理实有人口房屋居住信息 |
| | |
| | | houseUserList.add(populationHouseUserDO); |
| | | } |
| | | } |
| | | log.info("开始查询实有人口房屋居住信息完成"); |
| | | log.info("查询实有人口房屋居住信息完成"); |
| | | |
| | | log.info("开始查询实有人口存在社区信息"); |
| | | //处理实有人口与社区关系以及对应特殊群体标签 |
| | | String populationCommunityKey = populationDO.getId() + populationActVO.getCommunityId() + ""; |
| | | if (populationDO != null) { |
| | | ComMngPopulationCommunityTagsDO cpopulationCommunityTagsDO = null; |
| | | if(isOnly(populationCommunityKey,populationCommunityMap)){ |
| | | //实有人口不存在于当前社区 |
| | | cpopulationCommunityTagsDO = new ComMngPopulationCommunityTagsDO(); |
| | | cpopulationCommunityTagsDO.setId(Snowflake.getId()); |
| | | cpopulationCommunityTagsDO.setPopulationId(populationDO.getId()); |
| | | cpopulationCommunityTagsDO.setCommunityId(communityId); |
| | | List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); |
| | | //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 |
| | | Iterator<String> iterator = userTag.iterator(); |
| | | while (iterator.hasNext()) { |
| | | String s = iterator.next(); |
| | | if (!labelList.contains(s)) |
| | | iterator.remove(); |
| | | } |
| | | populationDO.setLabel(Joiner.on(",").join(userTag)); |
| | | populationDO.setCreateBy(userId); |
| | | savePopulationCommunityList.add(cpopulationCommunityTagsDO); |
| | | } |
| | | }else { |
| | | //实有人口存在于当前社区,则更新 |
| | | ComMngPopulationCommunityTagsDO comMngPopulationCommunityTagsDO = (ComMngPopulationCommunityTagsDO)populationCommunityMap.get(populationCommunityKey); |
| | | List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); |
| | | //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 |
| | | Iterator<String> iterator = userTag.iterator(); |
| | | while (iterator.hasNext()) { |
| | | String s = iterator.next(); |
| | | if (!labelList.contains(s)) |
| | | iterator.remove(); |
| | | } |
| | | comMngPopulationCommunityTagsDO.setLabel(Joiner.on(",").join(userTag)); |
| | | comMngPopulationCommunityTagsDO.setUpdateBy(userId); |
| | | updatePopulationCommunityList.add(comMngPopulationCommunityTagsDO); |
| | | |
| | | ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO(); |
| | | BeanUtils.copyProperties(vo,mistake); |
| | | setMistake(mistake, vo); |
| | | mistake.setMistake("该实有人口已存在于该社区,执行更新"); |
| | | mistakes.add(mistake); |
| | | } |
| | | log.info("查询实有人口存在社区信息完成"); |
| | | } |
| | | }catch (Exception e){ |
| | | log.info("出现错误,错误原因:" + e.getMessage()); |
| | |
| | | if(!houseList.isEmpty()){ |
| | | log.info("执行数据库导入房屋"); |
| | | comMngPopulationHouseDAO.insertAll(houseList); |
| | | log.info("执行数据库导入房屋完成"); |
| | | log.info("数据库导入房屋完成"); |
| | | } |
| | | if(!saveList.isEmpty()){ |
| | | log.info("执行数据库导入人口"); |
| | | this.baseMapper.insertAll(saveList); |
| | | log.info("执行数据库导入人口完成"); |
| | | log.info("数据库导入人口完成"); |
| | | } |
| | | if(!updateList.isEmpty()){ |
| | | log.info("执行数据库更新人口"); |
| | | this.baseMapper.updateAll(updateList); |
| | | // this.updateBatchById(updateList); |
| | | log.info("执行数据库更新人口完成"); |
| | | log.info("数据库更新人口完成"); |
| | | } |
| | | if(!houseUserList.isEmpty()){ |
| | | log.info("执行数据库导入人口房屋关系"); |
| | | comMngPopulationHouseUserService.saveBatch(houseUserList); |
| | | log.info("执行数据库导入人口房屋关系完成"); |
| | | log.info("数据库导入人口房屋关系完成"); |
| | | } |
| | | if(!savePopulationCommunityList.isEmpty()){ |
| | | log.info("执行数据库导入人口社区关系"); |
| | | comMngPopulationCommunityTagsService.saveBatch(savePopulationCommunityList); |
| | | log.info("数据库导入人口社区关系完成"); |
| | | } |
| | | if(!updatePopulationCommunityList.isEmpty()){ |
| | | log.info("执行数据库更新人口社区关系"); |
| | | comMngPopulationCommunityTagsService.updateBatchById(updatePopulationCommunityList); |
| | | log.info("数据库更新人口社区关系完成"); |
| | | } |
| | | log.info("执行数据库导入完成"); |
| | | |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R listSaveDrugPopulation(List<ComMngPopulationDrugExcelVO> list, Long communityId) { |
| | | public R listSaveDrugPopulation(List<ComMngPopulationDrugExcelVO> list, Long communityId, Long userId) { |
| | | //需要新增的房屋集合 |
| | | List<ComMngPopulationHouseDO> houseList = new ArrayList<>(); |
| | | //需要新增的人口集合 |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R listSaveCorrectPopulation(List<ComMngPopulationCorrectExcelVO> list, Long communityId) { |
| | | public R listSaveCorrectPopulation(List<ComMngPopulationCorrectExcelVO> list, Long communityId, Long userId) { |
| | | //需要新增的房屋集合 |
| | | List<ComMngPopulationHouseDO> houseList = new ArrayList<>(); |
| | | //需要新增的人口集合 |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R listSaveMajorPopulation(List<ComMngPopulationMajorExcelVO> list, Long communityId) { |
| | | public R listSaveMajorPopulation(List<ComMngPopulationMajorExcelVO> list, Long communityId, Long userId) { |
| | | //需要新增的房屋集合 |
| | | List<ComMngPopulationHouseDO> houseList = new ArrayList<>(); |
| | | //需要新增的人口集合 |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R listSaveCultPopulation(List<ComMngPopulationCultExcelVO> list, Long communityId) { |
| | | public R listSaveCultPopulation(List<ComMngPopulationCultExcelVO> list, Long communityId, Long userId) { |
| | | //需要新增的房屋集合 |
| | | List<ComMngPopulationHouseDO> houseList = new ArrayList<>(); |
| | | //需要新增的人口集合 |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R listSaveRehabilitationPopulation(List<ComMngPopulationRehabilitationExcelVO> list, Long communityId) { |
| | | public R listSaveRehabilitationPopulation(List<ComMngPopulationRehabilitationExcelVO> list, Long communityId, Long userId) { |
| | | //需要新增的房屋集合 |
| | | List<ComMngPopulationHouseDO> houseList = new ArrayList<>(); |
| | | //需要新增的人口集合 |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R listSaveKeyPopulation(List<ComMngPopulationKeyExcelVO> list, Long communityId) { |
| | | public R listSaveKeyPopulation(List<ComMngPopulationKeyExcelVO> list, Long communityId, Long userId) { |
| | | //需要新增的房屋集合 |
| | | List<ComMngPopulationHouseDO> houseList = new ArrayList<>(); |
| | | //需要新增的人口集合 |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R listSaveSentencePopulation(List<ComMngPopulationSentenceExcelVO> list, Long communityId) { |
| | | public R listSaveSentencePopulation(List<ComMngPopulationSentenceExcelVO> list, Long communityId, Long userId) { |
| | | //需要新增的房屋集合 |
| | | List<ComMngPopulationHouseDO> houseList = new ArrayList<>(); |
| | | //需要新增的人口集合 |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R listSaveVeteransPopulation(List<ComMngPopulationVeteransExcelVO> list, Long communityId) { |
| | | public R listSaveVeteransPopulation(List<ComMngPopulationVeteransExcelVO> list, Long communityId, Long userId) { |
| | | //需要新增的房屋集合 |
| | | List<ComMngPopulationHouseDO> houseList = new ArrayList<>(); |
| | | //需要新增的人口集合 |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R listSaveDisabilityPopulation(List<ComMngPopulationDisabilityExcelVO> list, Long communityId) { |
| | | public R listSaveDisabilityPopulation(List<ComMngPopulationDisabilityExcelVO> list, Long communityId, Long userId) { |
| | | //需要新增的房屋集合 |
| | | List<ComMngPopulationHouseDO> houseList = new ArrayList<>(); |
| | | //需要新增的人口集合 |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R listSaveLowSecurityPopulation(List<ComMngPopulationLowSecurityExcelVO> list, Long communityId) { |
| | | public R listSaveLowSecurityPopulation(List<ComMngPopulationLowSecurityExcelVO> list, Long communityId, Long userId) { |
| | | //需要新增的房屋集合 |
| | | List<ComMngPopulationHouseDO> houseList = new ArrayList<>(); |
| | | //需要新增的人口集合 |
| | |
| | | } |
| | | |
| | | |
| | | private ComMngPopulationDO updatePopulationDO(ComMngPopulationServeExcelVO vo, ComMngPopulationDO populationDO,List<String> labelList){ |
| | | private ComMngPopulationDO updatePopulationDO(ComMngPopulationServeExcelVO vo, ComMngPopulationDO populationDO, Long userId){ |
| | | BeanUtils.copyProperties(vo, populationDO); |
| | | List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); |
| | | //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 |
| | | Iterator<String> iterator = userTag.iterator(); |
| | | while (iterator.hasNext()) { |
| | | String s = iterator.next(); |
| | | if (!labelList.contains(s)) |
| | | iterator.remove(); |
| | | } |
| | | // List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); |
| | | // //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 |
| | | // Iterator<String> iterator = userTag.iterator(); |
| | | // while (iterator.hasNext()) { |
| | | // String s = iterator.next(); |
| | | // if (!labelList.contains(s)) |
| | | // iterator.remove(); |
| | | // } |
| | | String cardNoAES = populationDO.getCardNo(); |
| | | try { |
| | | cardNoAES = AESUtil.encrypt128(vo.getCardNo(), aesKey); |
| | | }catch (Exception e){ |
| | | log.error("身份证加密失败"); |
| | | } |
| | | populationDO.setLabel(Joiner.on(",").join(userTag)); |
| | | // populationDO.setLabel(Joiner.on(",").join(userTag)); |
| | | populationDO.setCardNo(cardNoAES); |
| | | populationDO.setUpdateBy(userId); |
| | | return populationDO; |
| | | } |
| | | |
| | |
| | | return populationDO; |
| | | } |
| | | |
| | | private ComMngPopulationDO savePopulationDO(ComMngPopulationServeExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,List<String> labelList) { |
| | | private ComMngPopulationDO savePopulationDO(ComMngPopulationServeExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO, Long userId) { |
| | | ComMngPopulationDO populationDO = new ComMngPopulationDO(); |
| | | BeanUtils.copyProperties(vo, populationDO); |
| | | populationDO.setId(Snowflake.getId()); |
| | | List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); |
| | | |
| | | //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 |
| | | Iterator<String> iterator = userTag.iterator(); |
| | | while (iterator.hasNext()) { |
| | | String s = iterator.next(); |
| | | if (!labelList.contains(s)) |
| | | iterator.remove(); |
| | | } |
| | | // List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); |
| | | // |
| | | // //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 |
| | | // Iterator<String> iterator = userTag.iterator(); |
| | | // while (iterator.hasNext()) { |
| | | // String s = iterator.next(); |
| | | // if (!labelList.contains(s)) |
| | | // iterator.remove(); |
| | | // } |
| | | populationDO.setVillageId(comMngVillageDO.getVillageId()); |
| | | populationDO.setActId(comActDO.getCommunityId()); |
| | | populationDO.setStreetId(comActDO.getStreetId()); |
| | | populationDO.setLabel(Joiner.on(",").join(userTag)); |
| | | // populationDO.setLabel(Joiner.on(",").join(userTag)); |
| | | populationDO.setVillageName(comMngVillageDO.getGroupAt()); |
| | | populationDO.setCardNoStr(vo.getCardNo()); |
| | | populationDO.setUpdateAt(new Date()); |
| | |
| | | log.error("身份证加密失败"); |
| | | } |
| | | populationDO.setCardNo(cardNoAES); |
| | | populationDO.setCreateBy(userId); |
| | | //新增的时候默认绑定房屋id |
| | | // if ((vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())) || |
| | | // (vo.getIsResidence() != null && vo.getIsResidence().intValue() == 1)) { |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.panzhihua.service_community.dao.ComMngPopulationCommunityTagsDAO"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComMngPopulationCommunityTagsDO"> |
| | | <id column="id" property="id" /> |
| | | <result column="population_id" property="populationId" /> |
| | | <result column="community_id" property="communityId" /> |
| | | <result column="label" property="label" /> |
| | | <result column="create_at" property="createAt" /> |
| | | <result column="create_by" property="createBy" /> |
| | | <result column="update_at" property="updateAt" /> |
| | | <result column="update_by" property="updateBy" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, population_id, community_id, label, create_at, create_by, update_at, update_by |
| | | </sql> |
| | | |
| | | </mapper> |