diff --git a/epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/EpmetAdminOpenFeignClient.java b/epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/EpmetAdminOpenFeignClient.java index e28914d26f..bb8d12f49c 100644 --- a/epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/EpmetAdminOpenFeignClient.java +++ b/epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/EpmetAdminOpenFeignClient.java @@ -82,6 +82,6 @@ public interface EpmetAdminOpenFeignClient { * @Author zhaoqifeng * @Date 2021/11/19 17:36 */ - @PostMapping("/sys/dict/data/dictMap/{dictType}") + @PostMapping("/sys/dict/data/dictmap/{dictType}") Result> dictMap(@PathVariable("dictType") String dictType); } diff --git a/epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/fallback/EpmetAdminOpenFeignClientFallback.java b/epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/fallback/EpmetAdminOpenFeignClientFallback.java index fec84ab1fd..139514d1f5 100644 --- a/epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/fallback/EpmetAdminOpenFeignClientFallback.java +++ b/epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/fallback/EpmetAdminOpenFeignClientFallback.java @@ -14,36 +14,36 @@ import java.util.Map; public class EpmetAdminOpenFeignClientFallback implements EpmetAdminOpenFeignClient { @Override public Result> list() { - return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "list", null); + return ModuleUtils.feignConError(ServiceConstant.EPMET_ADMIN_SERVER, "list", null); } @Override public Result> getEducationOption() { - return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getEducationOption", null); + return ModuleUtils.feignConError(ServiceConstant.EPMET_ADMIN_SERVER, "getEducationOption", null); } @Override public Result> getHouseOption() { - return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getHouseOption", null); + return ModuleUtils.feignConError(ServiceConstant.EPMET_ADMIN_SERVER, "getHouseOption", null); } @Override public Result> getNationOption() { - return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getNationOption", null); + return ModuleUtils.feignConError(ServiceConstant.EPMET_ADMIN_SERVER, "getNationOption", null); } @Override public Result> getNineSmallPlacesOption() { - return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getNineSmallPlacesOption", null); + return ModuleUtils.feignConError(ServiceConstant.EPMET_ADMIN_SERVER, "getNineSmallPlacesOption", null); } @Override public Result> getRelationshipOption() { - return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getRelationshipOption", null); + return ModuleUtils.feignConError(ServiceConstant.EPMET_ADMIN_SERVER, "getRelationshipOption", null); } @Override public Result> dictMap(String dictType) { - return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "dictMap", dictType); + return ModuleUtils.feignConError(ServiceConstant.EPMET_ADMIN_SERVER, "dictMap", dictType); } } diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictDataController.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictDataController.java index 1424f480ed..aff54e6e09 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictDataController.java +++ b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictDataController.java @@ -157,7 +157,7 @@ public class SysDictDataController { * @Author zhaoqifeng * @Date 2021/11/19 17:36 */ - @PostMapping("dictMap/{dictType}") + @PostMapping("dictmap/{dictType}") public Result> dictMap(@PathVariable("dictType") String dictType) { return new Result>().ok(sysDictDataService.dictMap(dictType)); } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionResultDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionResultDTO.java index 158b59fb55..9ffd3efccb 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionResultDTO.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionResultDTO.java @@ -15,6 +15,7 @@ public class OptionResultDTO implements Serializable { private static final long serialVersionUID = 8618231166600518980L; private String label; private String value; + private String pValue; private String sysDictDataId; private List children; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index c65750548c..a63db7b080 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -155,6 +155,10 @@ public enum EpmetErrorCode { APPOINTMENT_ERROR(8528, "%s尚有未履行的预约存在,请确认后操作"), + EXISTS_SAME_PHONE_ERROR(8529, "%s存在重复"), + + COMMUNITY_SELF_ORGANIZATION_LIST_REPART_ERROR(8530, "%s社区自组织名称已存在"), + // 该错误不会提示给前端,只是后端传输错误信息用。 ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤SQL所需参数"), OPER_ADD_CUSTOMER_ROOT_AGENCY_ERROR(8702, "添加客户根级组织失败"), diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelPoiUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelPoiUtils.java new file mode 100644 index 0000000000..3ea8472867 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelPoiUtils.java @@ -0,0 +1,276 @@ +package com.epmet.commons.tools.utils; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.ImportParams; +import cn.afterturn.easypoi.excel.entity.TemplateExportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URLEncoder; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; + +public class ExcelPoiUtils { + /** + * excel 导出 + * + * @param list 数据列表 + * @param fileName 导出时的excel名称 + * @param response + */ + public static void exportExcel(List> list, String fileName, HttpServletResponse response) throws IOException { + defaultExport(list, fileName, response); + } + + /** + * 默认的 excel 导出 + * + * @param list 数据列表 + * @param fileName 导出时的excel名称 + * @param response + */ + private static void defaultExport(List> list, String fileName, HttpServletResponse response) throws IOException { + //把数据添加到excel表格中 + Workbook workbook = ExcelExportUtil.exportExcel(list, ExcelType.HSSF); + downLoadExcel(fileName, response, workbook); + } + + /** + * excel 导出 + * + * @param list 数据列表 + * @param pojoClass pojo类型 + * @param fileName 导出时的excel名称 + * @param response + * @param exportParams 导出参数(标题、sheet名称、是否创建表头,表格类型) + */ + private static void defaultExport(List list, Class pojoClass, String fileName, HttpServletResponse response, ExportParams exportParams) throws IOException { + //把数据添加到excel表格中 + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, pojoClass, list); + downLoadExcel(fileName, response, workbook); + } + + /** + * excel 导出 + * + * @param list 数据列表 + * @param pojoClass pojo类型 + * @param fileName 导出时的excel名称 + * @param exportParams 导出参数(标题、sheet名称、是否创建表头,表格类型) + * @param response + */ + public static void exportExcel(List list, Class pojoClass, String fileName, ExportParams exportParams, HttpServletResponse response) throws IOException { + defaultExport(list, pojoClass, fileName, response, exportParams); + } + + /** + * excel 导出 + * + * @param list 数据列表 + * @param title 表格内数据标题 + * @param sheetName sheet名称 + * @param pojoClass pojo类型 + * @param fileName 导出时的excel名称 + * @param response + */ + public static void exportExcel(List list, String title, String sheetName, Class pojoClass, String fileName, HttpServletResponse response) throws IOException { + defaultExport(list, pojoClass, fileName, response, new ExportParams(title, sheetName, ExcelType.XSSF)); + } + + + + /** + * excel 导出 + * + * @param list 数据列表 + * @param title 表格内数据标题 + * @param sheetName sheet名称 + * @param pojoClass pojo类型 + * @param fileName 导出时的excel名称 + * @param isCreateHeader 是否创建表头 + * @param response + */ + public static void exportExcel(List list, String title, String sheetName, Class pojoClass, String fileName, boolean isCreateHeader, HttpServletResponse response) throws IOException { + ExportParams exportParams = new ExportParams(title, sheetName, ExcelType.XSSF); + exportParams.setCreateHeadRows(isCreateHeader); + defaultExport(list, pojoClass, fileName, response, exportParams); + } + /** + * 根据模板生成excel后导出 + * @param templatePath 模板路径 + * @param map 数据集合 + * @param fileName 文件名 + * @param response + * @throws IOException + */ + public static void exportExcel(TemplateExportParams templatePath, Map map, String fileName, HttpServletResponse response) throws IOException { + Workbook workbook = ExcelExportUtil.exportExcel(templatePath, map); + downLoadExcel(fileName, response, workbook); + } + + + /** + * excel下载 + * + * @param fileName 下载时的文件名称 + * @param response + * @param workbook excel数据 + */ + private static void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) throws IOException { + try { + response.setCharacterEncoding("UTF-8"); + response.setHeader("content-Type", "application/vnd.ms-excel"); + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName + ".xlsx", "UTF-8")); + workbook.write(response.getOutputStream()); + } catch (Exception e) { + throw new IOException(e.getMessage()); + } + } + + + + /** + * excel 导入 + * + * @param file excel文件 + * @param pojoClass pojo类型 + * @param + * @return + */ + public static List importExcel(MultipartFile file, Class pojoClass) throws IOException { + return importExcel(file, 1, 1, pojoClass); + } + + /** + * excel 导入 + * + * @param filePath excel文件路径 + * @param titleRows 表格内数据标题行 + * @param headerRows 表头行 + * @param pojoClass pojo类型 + * @param + * @return + */ + public static List importExcel(String filePath, Integer titleRows, Integer headerRows, Class pojoClass) throws IOException { + if (StringUtils.isBlank(filePath)) { + return null; + } + ImportParams params = new ImportParams(); + params.setTitleRows(titleRows); + params.setHeadRows(headerRows); + params.setNeedSave(true); + params.setSaveUrl("/tmp/excel/"); + try { + return ExcelImportUtil.importExcel(new File(filePath), pojoClass, params); + } catch (NoSuchElementException e) { + throw new IOException("模板不能为空"); + } catch (Exception e) { + throw new IOException(e.getMessage()); + } + } + + + /** + * excel 导入 + * + * @param file 上传的文件 + * @param titleRows 表格内数据标题行 + * @param headerRows 表头行 + * @param pojoClass pojo类型 + * @param + * @return + */ + public static List importExcel(MultipartFile file, Integer titleRows, Integer headerRows, Class pojoClass) throws IOException { + if (file == null) { + return null; + } + try { + return importExcel(file.getInputStream(), titleRows, headerRows, pojoClass); + } catch (Exception e) { + throw new IOException(e.getMessage()); + } + } + + /** + * excel 导入 + * + * @param inputStream 文件输入流 + * @param titleRows 表格内数据标题行 + * @param headerRows 表头行 + * @param pojoClass pojo类型 + * @param + * @return + */ + public static List importExcel(InputStream inputStream, Integer titleRows, Integer headerRows, Class pojoClass) throws IOException { + if (inputStream == null) { + return null; + } + ImportParams params = new ImportParams(); + params.setTitleRows(titleRows); + params.setHeadRows(headerRows); + params.setSaveUrl("/tmp/excel/"); + params.setNeedSave(true); + try { + return ExcelImportUtil.importExcel(inputStream, pojoClass, params); + } catch (NoSuchElementException e) { + throw new IOException("excel文件不能为空"); + } catch (Exception e) { + throw new IOException(e.getMessage()); + } + } + /** + * excel 导入,有错误信息 + * + * @param file 上传的文件 + * @param pojoClass pojo类型 + * @param + * @return + */ + public static ExcelImportResult importExcelMore(MultipartFile file,Integer titleRows, Integer headerRows, Class pojoClass) throws IOException { + if (file == null) { + return null; + } + try { + return importExcelMore(file.getInputStream(), titleRows, headerRows, pojoClass); + } catch (Exception e) { + throw new IOException(e.getMessage()); + } + } + + /** + * excel 导入 + * + * @param inputStream 文件输入流 + * @param pojoClass pojo类型 + * @param + * @return + */ + private static ExcelImportResult importExcelMore(InputStream inputStream,Integer titleRows, Integer headerRows, Class pojoClass) throws IOException { + if (inputStream == null) { + return null; + } + ImportParams params = new ImportParams(); + params.setTitleRows(titleRows);//表格内数据标题行 + params.setHeadRows(headerRows);//表头行 + params.setSaveUrl("/tmp/excel/"); + params.setNeedSave(true); + params.setNeedVerify(true); + try { + return ExcelImportUtil.importExcelMore(inputStream, pojoClass, params); + } catch (NoSuchElementException e) { + throw new IOException("excel文件不能为空"); + } catch (Exception e) { + throw new IOException(e.getMessage()); + } + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelVerifyInfo.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelVerifyInfo.java new file mode 100644 index 0000000000..a00bb8bbf4 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelVerifyInfo.java @@ -0,0 +1,31 @@ +package com.epmet.commons.tools.utils; + +import cn.afterturn.easypoi.handler.inter.IExcelDataModel; +import cn.afterturn.easypoi.handler.inter.IExcelModel; + +public class ExcelVerifyInfo implements IExcelModel, IExcelDataModel { + + private String errorMsg; + + private int rowNum; + + @Override + public Integer getRowNum() { + return rowNum; + } + + @Override + public void setRowNum(Integer rowNum) { + this.rowNum = rowNum; + } + + @Override + public String getErrorMsg() { + return errorMsg; + } + + @Override + public void setErrorMsg(String errorMsg) { + this.errorMsg = errorMsg; + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java index 3b03d3768d..d2f8f87352 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java @@ -177,143 +177,155 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { threadPool.submit(() -> { //党员基本情况screen_cpc_base_data try { - partyBaseInfoService.statsPartyMemberBaseInfoToScreen(customerId, dateId); - } catch (Exception e) { - log.error("党员基本情况抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } - //先锋模范screen_pioneer_data - if (isLast) { try { - pioneerDataExtractService.extractGridPioneerData(customerId, dateId); + partyBaseInfoService.statsPartyMemberBaseInfoToScreen(customerId, dateId); } catch (Exception e) { - log.error("先锋模范【网格】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + log.error("党员基本情况抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); } - try { - pioneerDataExtractService.extractCommunityPioneerData(customerId, dateId); - } catch (Exception e) { - log.error("先锋模范【社区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } - try { - pioneerDataExtractService.extractExceptCommunityPioneerData(customerId, dateId); - } catch (Exception e) { - log.error("先锋模范【extractExceptCommunityPioneerData】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + //先锋模范screen_pioneer_data + if (isLast) { + try { + pioneerDataExtractService.extractGridPioneerData(customerId, dateId); + } catch (Exception e) { + log.error("先锋模范【网格】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try { + pioneerDataExtractService.extractCommunityPioneerData(customerId, dateId); + } catch (Exception e) { + log.error("先锋模范【社区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try { + pioneerDataExtractService.extractExceptCommunityPioneerData(customerId, dateId); + } catch (Exception e) { + log.error("先锋模范【extractExceptCommunityPioneerData】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } } + } finally { + latch.countDown(); + log.info("extractDaily 1 thread run end ========= dateId:{},customerId:{}", dateId, customerId); } - latch.countDown(); - log.info("extractDaily 1 thread run end ========= dateId:{},customerId:{}", dateId, customerId); }); threadPool.submit(() -> { //公众参与排行(注册人数、参与人数、话题数、议题数、项目数)screen_public_party_total_data try { - publicPartiTotalDataExtractService.extractPublicPartiTotalData(customerId, dateId); - } catch (Exception e) { - log.error("公众参与排行抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } - if (isLast) { - //基层治理- 难点赌点 screen_difficulty_data | screen_difficulty_img_data try { - ScreenCentralZoneDataFormDTO param2 = new ScreenCentralZoneDataFormDTO(); - param2.setCustomerId(customerId); - param2.setDateId(null); - log.info("【难点赌点数据上报开始------】 当前客户Id{}", param2.getCustomerId()); - //screenGrassrootsGovernDataAbsorptionService.difficultyDataHub(param); - - screenGrassrootsGovernDataAbsorptionService.difficultyDataExtract(param2); - log.info("【难点赌点数据上报结束------】 当前客户Id{}", param2.getCustomerId()); + publicPartiTotalDataExtractService.extractPublicPartiTotalData(customerId, dateId); } catch (Exception e) { - log.error("基层治理-难点赌点抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + log.error("公众参与排行抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + if (isLast) { + //基层治理- 难点赌点 screen_difficulty_data | screen_difficulty_img_data + try { + ScreenCentralZoneDataFormDTO param2 = new ScreenCentralZoneDataFormDTO(); + param2.setCustomerId(customerId); + param2.setDateId(null); + log.info("【难点赌点数据上报开始------】 当前客户Id{}", param2.getCustomerId()); + //screenGrassrootsGovernDataAbsorptionService.difficultyDataHub(param); + + screenGrassrootsGovernDataAbsorptionService.difficultyDataExtract(param2); + log.info("【难点赌点数据上报结束------】 当前客户Id{}", param2.getCustomerId()); + } catch (Exception e) { + log.error("基层治理-难点赌点抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } } + } finally { + latch.countDown(); + log.info("extractDaily 2 thread run end ========= dateId:{},customerId:{}", dateId, customerId); } - latch.countDown(); - log.info("extractDaily 2 thread run end ========= dateId:{},customerId:{}", dateId, customerId); }); threadPool.submit(() -> { - ScreenCentralZoneDataFormDTO param = new ScreenCentralZoneDataFormDTO(); - param.setCustomerId(customerId); - param.setDateId(dateId); - //中央区 screen_user_total_data try { - screenCentralZoneDataAbsorptionService.centralZoneDataHub(param); - } catch (Exception e) { - log.error("中央区抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } + ScreenCentralZoneDataFormDTO param = new ScreenCentralZoneDataFormDTO(); + param.setCustomerId(customerId); + param.setDateId(dateId); + //中央区 screen_user_total_data + try { + screenCentralZoneDataAbsorptionService.centralZoneDataHub(param); + } catch (Exception e) { + log.error("中央区抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } - try { - // 项目(事件)分析按网格_按天统计 - screenProjectGridDailyService.extractionProjectGridDaily(customerId, dateId); - } catch (Exception e) { - log.error("项目(事件)分析按网格_按天统计失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } - try { - // 项目(事件)分析按组织_按天统计 - screenProjectOrgDailyService.extractionProjectOrgDaily(customerId, dateId); - } catch (Exception e) { - log.error("项目(事件)分析按组织_按天统计失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } + try { + // 项目(事件)分析按网格_按天统计 + screenProjectGridDailyService.extractionProjectGridDaily(customerId, dateId); + } catch (Exception e) { + log.error("项目(事件)分析按网格_按天统计失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try { + // 项目(事件)分析按组织_按天统计 + screenProjectOrgDailyService.extractionProjectOrgDaily(customerId, dateId); + } catch (Exception e) { + log.error("项目(事件)分析按组织_按天统计失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } - //按天统计:网格内各个分类下的项目总数 - try { - screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId, dateId); - } catch (Exception e) { - log.error("按天统计:网格内各个分类下的项目总数,customerId为:" + customerId + "dateId为:" + dateId, e); - } + //按天统计:网格内各个分类下的项目总数 + try { + screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId, dateId); + } catch (Exception e) { + log.error("按天统计:网格内各个分类下的项目总数,customerId为:" + customerId + "dateId为:" + dateId, e); + } - // 按天统计:组织内各个分类下的项目总数 - try { - screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId, dateId); - } catch (Exception e) { - log.error("按天统计:组织内各个分类下的项目总数,customerId为:" + customerId + "dateId为:" + dateId, e); + // 按天统计:组织内各个分类下的项目总数 + try { + screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId, dateId); + } catch (Exception e) { + log.error("按天统计:组织内各个分类下的项目总数,customerId为:" + customerId + "dateId为:" + dateId, e); + } + } finally { + latch.countDown(); + log.info("extractDaily 3 thread run end ========= dateId:{},customerId:{}", dateId, customerId); } - latch.countDown(); - log.info("extractDaily 3 thread run end ========= dateId:{},customerId:{}", dateId, customerId); }); threadPool.submit(() -> { //治理能力排行screen_govern_rank_data try { - governRankDataExtractService.extractGridDataDaily(customerId, dateId); - } catch (Exception e) { - log.error("治理能力排行【网格】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } - try { - governRankDataExtractService.extractCommunityDataDaily(customerId, dateId); - } catch (Exception e) { - log.error("治理能力排行【社区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } - try { - governRankDataExtractService.extractStreetDataDaily(customerId, dateId); - } catch (Exception e) { - log.error("治理能力排行【街道】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } - try { - governRankDataExtractService.extractDistrictDataDaily(customerId, dateId); - } catch (Exception e) { - log.error("治理能力排行【全区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } + try { + governRankDataExtractService.extractGridDataDaily(customerId, dateId); + } catch (Exception e) { + log.error("治理能力排行【网格】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try { + governRankDataExtractService.extractCommunityDataDaily(customerId, dateId); + } catch (Exception e) { + log.error("治理能力排行【社区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try { + governRankDataExtractService.extractStreetDataDaily(customerId, dateId); + } catch (Exception e) { + log.error("治理能力排行【街道】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try { + governRankDataExtractService.extractDistrictDataDaily(customerId, dateId); + } catch (Exception e) { + log.error("治理能力排行【全区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } - try { - ExtractFactGridGovernDailyFromDTO extractFactGridGovernDailyFromDTO = new ExtractFactGridGovernDailyFromDTO(); - extractFactGridGovernDailyFromDTO.setCustomerId(customerId); - extractFactGridGovernDailyFromDTO.setDateId(dateId); - factGridGovernDailyService.extractFactGridGovernDaily(extractFactGridGovernDailyFromDTO); - } catch (Exception e) { - log.error("治理指数-网格fact_grid_govern_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } + try { + ExtractFactGridGovernDailyFromDTO extractFactGridGovernDailyFromDTO = new ExtractFactGridGovernDailyFromDTO(); + extractFactGridGovernDailyFromDTO.setCustomerId(customerId); + extractFactGridGovernDailyFromDTO.setDateId(dateId); + factGridGovernDailyService.extractFactGridGovernDaily(extractFactGridGovernDailyFromDTO); + } catch (Exception e) { + log.error("治理指数-网格fact_grid_govern_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } - try { - factAgencyGovernDailyService.extractFactAgencyGovernDaily(customerId, dateId); - } catch (Exception e) { - log.error("治理指数-组织fact_agency_govern_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } + try { + factAgencyGovernDailyService.extractFactAgencyGovernDaily(customerId, dateId); + } catch (Exception e) { + log.error("治理指数-组织fact_agency_govern_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } - try { - factGridMemberStatisticsDailyService.extractGridMemberStatisticsDaily(customerId, dateId); - } catch (Exception e) { - log.error("网格员数据统计fact_grid_member_statistics_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); + try { + factGridMemberStatisticsDailyService.extractGridMemberStatisticsDaily(customerId, dateId); + } catch (Exception e) { + log.error("网格员数据统计fact_grid_member_statistics_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + extractPartData(customerId, dateId); + } finally { + latch.countDown(); + log.info("extractDaily 4 thread run end ========= dateId:{},customerId:{}", dateId, customerId); } - extractPartData(customerId, dateId); - latch.countDown(); - log.info("extractDaily 4 thread run end ========= dateId:{},customerId:{}", dateId, customerId); }); try { latch.await(); @@ -346,7 +358,7 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { //dateId不为空,只计算当天存在评价记录的项目,更新项目对应的得分。 screenProjectSettleService.updateProjectSatisfactionScore(customerId,dateId,null); }catch(Exception e){ - log.error("群众不满得分更新失败"); + log.error("群众不满得分更新失败,msg:{}", e); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java index fcdcf05349..e2597eae16 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java @@ -352,7 +352,7 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImplbaseReportDao.insertBatchAgencyRegUser(part); + .forEach(part->baseReportDao.insertBatchAgencyRegUser(part)); } } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyUnitDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyUnitDTO.java index 7fdc5d38a4..1782ddf316 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyUnitDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyUnitDTO.java @@ -17,8 +17,10 @@ package com.epmet.dto; +import com.epmet.commons.tools.validator.group.AddGroup; import lombok.Data; +import javax.validation.constraints.NotBlank; import java.io.Serializable; import java.util.Date; import java.util.List; @@ -58,11 +60,13 @@ public class IcPartyUnitDTO implements Serializable { /** * 单位名称 */ + @NotBlank(message = "单位名称不能为空",groups = AddGroup.class) private String unitName; /** * 分类 楼宇党建 两新组织 区域单位党建 机关直属部门 其他 */ + @NotBlank(message = "分类不能为空",groups = AddGroup.class) private String type; /** @@ -75,11 +79,13 @@ public class IcPartyUnitDTO implements Serializable { /** * 联系人 */ + @NotBlank(message = "联系人不能为空",groups = AddGroup.class) private String contact; /** * 联系电话 */ + @NotBlank(message = "联系电话不能为空",groups = AddGroup.class) private String contactMobile; /** @@ -95,11 +101,13 @@ public class IcPartyUnitDTO implements Serializable { /** * 中心位置经度 */ + @NotBlank(message = "经度不能为空",groups = AddGroup.class) private String longitude; /** * 中心位置纬度 */ + @NotBlank(message = "纬度不能为空",groups = AddGroup.class) private String latitude; /** diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddCommunitySelfOrganizationFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddCommunitySelfOrganizationFormDTO.java index a0c1cb762d..302f3d08a4 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddCommunitySelfOrganizationFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddCommunitySelfOrganizationFormDTO.java @@ -54,18 +54,16 @@ public class AddCommunitySelfOrganizationFormDTO implements Serializable { /** * 社区自组织创建时间 */ - private Date organizationCreatedTime; + private String organizationCreatedTime; /** * 经度 */ - @NotBlank(message = "longitude不能为空",groups = AddCommunitySelfOrganizationForm.class) private String longitude; /** * 纬度 */ - @NotBlank(message = "latitude不能为空",groups = AddCommunitySelfOrganizationForm.class) private String latitude; /** diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/EditCommunitySelfOrganizationFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/EditCommunitySelfOrganizationFormDTO.java index 588843ba92..cade96113f 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/EditCommunitySelfOrganizationFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/EditCommunitySelfOrganizationFormDTO.java @@ -61,13 +61,11 @@ public class EditCommunitySelfOrganizationFormDTO implements Serializable { /** * 经度 */ - @NotBlank(message = "longitude不能为空",groups = EditCommunitySelfOrganizationForm.class) private String longitude; /** * 纬度 */ - @NotBlank(message = "latitude不能为空",groups = EditCommunitySelfOrganizationForm.class) private String latitude; /** diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/GetListSocietyOrgFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/GetListSocietyOrgFormDTO.java index 48272aa6a6..c04a76dc77 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/GetListSocietyOrgFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/GetListSocietyOrgFormDTO.java @@ -21,7 +21,6 @@ import lombok.Data; import javax.validation.constraints.Min; import java.io.Serializable; -import java.util.Date; /** @@ -39,15 +38,21 @@ public class GetListSocietyOrgFormDTO implements Serializable { //负责人电话 private String mobile; //起始服务时间 - private Date serviceStartTime; + private String serviceStartTime; //终止服务时间 - private Date serviceEndTime; + private String serviceEndTime; //页码 @Min(1) - private Integer pageNo; + private Integer pageNo = 1; //每页多少条 private Integer pageSize = 20; + //是否分页(是:true 否:false) + private Boolean isPage = true; //token中客户Id private String customerId; + //token中userId + private String staffId; + //token中userId所属组织的pid + private String pids; } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/FinishStaffFromDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/FinishStaffFromDTO.java index 8213529326..06ca8a93fc 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/FinishStaffFromDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/FinishStaffFromDTO.java @@ -21,8 +21,8 @@ public class FinishStaffFromDTO implements Serializable { @NotBlank(message = "需求id不能为空", groups = AddUserInternalGroup.class) private String demandRecId; - @NotBlank(message = "服务方不能为空", groups = AddUserShowGroup.class) - private String serverId; + @NotBlank(message = "服务id不能为空", groups = AddUserShowGroup.class) + private String serviceId; @NotNull(message = "实际服务开始不能为空", groups = AddUserShowGroup.class) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/ServiceQueryFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/ServiceQueryFormDTO.java index 142b081d80..74d3ca3c7f 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/ServiceQueryFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/ServiceQueryFormDTO.java @@ -39,6 +39,4 @@ public class ServiceQueryFormDTO implements Serializable { @NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class) private String customerId; - private String demandRecId; - } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/UserDemandPageFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/UserDemandPageFormDTO.java index 265a88b5f1..a574bb3100 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/UserDemandPageFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/UserDemandPageFormDTO.java @@ -2,10 +2,8 @@ package com.epmet.dto.form.demand; import com.epmet.commons.tools.dto.form.PageFormDTO; import lombok.Data; -import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; -import java.util.Date; @Data public class UserDemandPageFormDTO extends PageFormDTO implements Serializable { @@ -42,14 +40,12 @@ public class UserDemandPageFormDTO extends PageFormDTO implements Serializable { /** * 上报时间开始 */ - @DateTimeFormat(pattern = "yyyy-MM-dd") - private Date reportStartDate; + private String reportStartTime; /** * 上报时间截止 */ - @DateTimeFormat(pattern = "yyyy-MM-dd") - private Date reportEndDate; + private String reportEndTime; /** * 待处理:pending;已取消canceled;已派单:assigned;已接单:have_order;已完成:finished @@ -72,12 +68,10 @@ public class UserDemandPageFormDTO extends PageFormDTO implements Serializable { /** * 希望服务时间开始 */ - @DateTimeFormat(pattern = "yyyy-MM-dd") - private Date wantServiceStartDate; + private String wantServiceStartTime; /** * 希望截止 */ - @DateTimeFormat(pattern = "yyyy-MM-dd") - private Date wantServiceEndDate; + private String wantServiceEndTime; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/SocietyOrgListResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/SocietyOrgListResultDTO.java index 277238e78d..1650882b84 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/SocietyOrgListResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/SocietyOrgListResultDTO.java @@ -31,6 +31,8 @@ public class SocietyOrgListResultDTO implements Serializable { //所属组织Id private String agencyId; + //所属组织名称 + private String agencyName; //社会组织Id private String societyId; //社会组织名称 diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandRecResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandRecResultDTO.java index fd606dc31f..d1eac19bff 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandRecResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandRecResultDTO.java @@ -1,7 +1,6 @@ package com.epmet.dto.result.demand; import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -14,12 +13,14 @@ public class DemandRecResultDTO implements Serializable { private static final long serialVersionUID = 1140730681599839420L; private String demandRecId; - @JsonIgnore + //@JsonIgnore private String gridId; private String gridName; + private String agencyId; - @JsonIgnore + //@JsonIgnore private String categoryCode; + private String parentCode; private String categoryName; @@ -30,15 +31,16 @@ public class DemandRecResultDTO implements Serializable { private String content; private String reportUserName; - @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private String reportUserMobile; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date reportTime; private String demandUserId; private String demandUser; private String demandUserName; private String demandUserMobile; - @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") - private String wantServiceTime; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date wantServiceTime; /** * 待处理:pending;已取消canceled;已派单:assigned;已接单:have_order;已完成:finished @@ -55,6 +57,7 @@ public class DemandRecResultDTO implements Serializable { /** * 取消时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date cancelTime; /** @@ -97,13 +100,13 @@ public class DemandRecResultDTO implements Serializable { /** * 实际服务开始时间 */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date serviceStartTime; /** * 实际服务结束时间 */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date serviceEndTime; /** diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java index 0a52e569ff..7578334f2c 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java @@ -18,6 +18,7 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ExcelUtils; @@ -28,17 +29,17 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.IcCommunitySelfOrganizationDTO; -import com.epmet.dto.form.AddCommunitySelfOrganizationFormDTO; -import com.epmet.dto.form.CommunitySelfOrganizationListFormDTO; -import com.epmet.dto.form.DelCommunitySelfOrganizationFormDTO; -import com.epmet.dto.form.EditCommunitySelfOrganizationFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.form.demand.ServiceQueryFormDTO; import com.epmet.dto.result.CommunitySelfOrganizationListResultDTO; import com.epmet.dto.result.demand.OptionDTO; +import com.epmet.excel.ExportCommunitySelfOrganizationExcel; import com.epmet.excel.IcCommunitySelfOrganizationExcel; import com.epmet.service.IcCommunitySelfOrganizationService; +import org.apache.commons.io.FilenameUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import java.util.List; @@ -100,6 +101,43 @@ public class IcCommunitySelfOrganizationController { ExcelUtils.exportExcelToTarget(response, null, list, IcCommunitySelfOrganizationExcel.class); } + /** + * @Description 导出 社区自组织查询列表 + * @param response + * @param tokenDto + * @param formDTO + * @author zxc + * @date 2021/11/24 10:59 上午 + */ + @PostMapping("exportcommunityselforganization") + public void exportCommunitySelfOrganization(HttpServletResponse response,@LoginUser TokenDto tokenDto,@RequestBody CommunitySelfOrganizationListFormDTO formDTO) throws Exception { + CommunitySelfOrganizationListResultDTO resultDTO = icCommunitySelfOrganizationService.communitySelfOrganizationList(tokenDto, formDTO); + ExcelUtils.exportExcelToTarget(response, null, resultDTO.getList(), ExportCommunitySelfOrganizationExcel.class); + } + + /** + * @Description 导入 + * @param tokenDto + * @param response + * @param file + * @author zxc + * @date 2021/11/25 9:03 上午 + */ + @PostMapping("importcommunityselforganization") + public Result importCommunitySelfOrganization(@LoginUser TokenDto tokenDto, HttpServletResponse response, @RequestPart("file") MultipartFile file) throws Exception { + if (file.isEmpty()) { + throw new RenException("请上传文件"); + } + + // 校验文件类型 + String extension = FilenameUtils.getExtension(file.getOriginalFilename()); + if (!"xls".equals(extension) && !"xlsx".equals(extension)) { + throw new RenException("文件类型不匹配"); + } + icCommunitySelfOrganizationService.importCommunitySelfOrganization(tokenDto, response, file); + return new Result(); + } + /** * @Description 添加社区自组织 * @param tokenDto diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyActivityController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyActivityController.java index 05c8e2d10a..9da287e05d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyActivityController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyActivityController.java @@ -17,7 +17,9 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -62,10 +64,10 @@ public class IcPartyActivityController { } @PostMapping("save") - public Result save(@RequestBody IcPartyActivityDTO dto){ + public Result save(@LoginUser TokenDto tokenDto, @RequestBody IcPartyActivityDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); - icPartyActivityService.save(dto); + icPartyActivityService.save(tokenDto, dto); return new Result(); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java index 1daacc73c7..f0b03fa8d9 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java @@ -69,10 +69,11 @@ public class IcPartyUnitController { } @PostMapping("save") - public Result save(@RequestBody IcPartyUnitDTO dto){ + public Result save(@LoginUser TokenDto tokenDto, @RequestBody IcPartyUnitDTO dto){ //效验数据 + dto.setCustomerId(tokenDto.getCustomerId()); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); - icPartyUnitService.save(dto); + icPartyUnitService.save(tokenDto, dto); return new Result(); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcSocietyOrgController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcSocietyOrgController.java index 0b97210715..786fc77928 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcSocietyOrgController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcSocietyOrgController.java @@ -17,24 +17,37 @@ package com.epmet.controller; +import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ExcelPoiUtils; +import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.AddSocietyOrgFormDTO; import com.epmet.dto.form.EditSocietyOrgFormDTO; +import com.epmet.dto.form.GetListPlaceOrgFormDTO; import com.epmet.dto.form.GetListSocietyOrgFormDTO; import com.epmet.dto.form.demand.ServiceQueryFormDTO; +import com.epmet.dto.result.GetListPlaceOrgResultDTO; import com.epmet.dto.result.GetListSocietyOrgResultDTO; import com.epmet.dto.result.demand.OptionDTO; +import com.epmet.excel.IcSocietyOrgExcel; import com.epmet.service.IcSocietyOrgService; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; +import java.util.stream.Collectors; /** @@ -43,6 +56,7 @@ import java.util.List; * @author generator generator@elink-cn.com * @since v1.0.0 2021-11-18 */ +@Slf4j @RestController @RequestMapping("societyorg") public class IcSocietyOrgController { @@ -92,6 +106,7 @@ public class IcSocietyOrgController { @PostMapping("getlist") public Result getList(@LoginUser TokenDto tokenDto, @RequestBody GetListSocietyOrgFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); return new Result().ok(societyOrgService.getList(formDTO)); } @@ -108,4 +123,50 @@ public class IcSocietyOrgController { ValidatorUtils.validateEntity(formDTO,ServiceQueryFormDTO.AddUserInternalGroup.class,ServiceQueryFormDTO.SocietyOrgInternalGroup.class); return new Result>().ok(societyOrgService.queryServiceList(formDTO)); } + + /** + * @Author sun + * @Description 九小场所下组织列表导出 + **/ + @PostMapping("export") + public void export(@LoginUser TokenDto tokenDto, @RequestBody GetListSocietyOrgFormDTO formDTO, HttpServletResponse response) throws Exception { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); + formDTO.setIsPage(false); + GetListSocietyOrgResultDTO list = societyOrgService.getList(formDTO); + ExcelUtils.exportExcelToTarget(response, null, list.getList(), IcSocietyOrgExcel.class); + } + + /** + * @Author sun + * @Description 九小场所下组织列表导入 + **/ + @PostMapping("import") + public Result importExcel(@LoginUser TokenDto tokenDTO, @RequestParam("file") MultipartFile file) throws IOException, ParseException { + + ExcelImportResult importResult = ExcelPoiUtils.importExcelMore(file, 0, 1, IcSocietyOrgExcel.class); + List failList = importResult.getFailList(); + + //存放错误数据行号 + List numList = new ArrayList<>(); + if (!CollectionUtils.isEmpty(failList)) { + for (IcSocietyOrgExcel entity : failList) { + log.warn("第{}行,{}", entity.getRowNum(), entity.getErrorMsg());//打印失败的行 和失败的信息 + numList.add(entity.getRowNum()); + } + //return new Result().error(8001,failList.get(0).getErrorMsg()); + } + List result = importResult.getList(); + + List resultList = societyOrgService.importExcel(tokenDTO.getCustomerId(), result, tokenDTO.getUserId(), numList); + String str = String.format("共%s条,成功导入%s条。", numList.size() + result.size(), numList.size() + result.size() - resultList.size()); + if (resultList.size() > NumConstant.ZERO) { + Collections.sort(resultList); + String subList = resultList.stream().map(String::valueOf).collect(Collectors.joining("、")); + log.warn(str + "第" + subList + "行未成功!"); + return new Result().error(9999, str + "第" + subList + "行未成功!"); + } + return new Result().ok(str); + } + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcCommunitySelfOrganizationDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcCommunitySelfOrganizationDao.java index 3fee0e0a71..efc9881b2a 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcCommunitySelfOrganizationDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcCommunitySelfOrganizationDao.java @@ -55,4 +55,13 @@ public interface IcCommunitySelfOrganizationDao extends BaseDao selectListByAgencyId(@Param("customerId") String customerId, @Param("agencyIds") List agencyIds, @Param("orgName") String orgName); + + /** + * @Description 根据名字查询存在的自组织 + * @param names + * @author zxc + * @date 2021/11/25 9:07 上午 + */ + List selectOrgByOrgName(@Param("names")List names, @Param("customerId") String customerId); + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcSocietyOrgDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcSocietyOrgDao.java index 2a435d7d9f..60f62e3a8d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcSocietyOrgDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcSocietyOrgDao.java @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.IcSocietyOrgDTO; import com.epmet.dto.form.GetListSocietyOrgFormDTO; import com.epmet.dto.result.GetListSocietyOrgResultDTO; import com.epmet.dto.result.SocietyOrgListResultDTO; @@ -53,4 +54,10 @@ public interface IcSocietyOrgDao extends BaseDao { @Param("societyName")String societyName, @Param("customerId")String customerId, @Param("queryPurpose")String queryPurpose); + + /** + * @Author sun + * @Description 查询当前组织下的社会组织数据 + **/ + List getByAgencyId(@Param("agencyId") String agencyId); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ExportCommunitySelfOrganizationExcel.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ExportCommunitySelfOrganizationExcel.java new file mode 100644 index 0000000000..d8020a3345 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ExportCommunitySelfOrganizationExcel.java @@ -0,0 +1,31 @@ +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.CellStyler; +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +@Data +public class ExportCommunitySelfOrganizationExcel { + + @Excel(name = "排序") + private Integer sort; + + @Excel(name = "组织名称", width = 40) + private String organizationName; + + @Excel(name = "组织人数", width = 20) + private Integer organizationPersonCount; + + @Excel(name = "负责人姓名", width = 20) + private String principalName; + + @Excel(name = "负责人电话", width = 20) + private String principalPhone; + + @Excel(name = "服务事项", width = 60) + private String serviceItem; + + @Excel(name = "社区自组织创建时间", width = 20) + private String organizationCreatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/IcSocietyOrgExcel.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/IcSocietyOrgExcel.java index 5f3d464dfb..35fff240d9 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/IcSocietyOrgExcel.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/IcSocietyOrgExcel.java @@ -18,8 +18,13 @@ package com.epmet.excel; import cn.afterturn.easypoi.excel.annotation.Excel; +import com.epmet.commons.tools.utils.ExcelVerifyInfo; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; +import org.hibernate.validator.constraints.Length; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; import java.util.Date; /** @@ -29,40 +34,42 @@ import java.util.Date; * @since v1.0.0 2021-11-18 */ @Data -public class IcSocietyOrgExcel { +public class IcSocietyOrgExcel extends ExcelVerifyInfo implements Serializable { - @Excel(name = "唯一标识") - private String id; - - @Excel(name = "客户Id") - private String customerId; - - @Excel(name = "组织Id") - private String agencyId; - - @Excel(name = "agency_id的所有上级") - private String pids; + @Excel(name = "组织名称") + @NotBlank(message = "不能为空") + private String agencyName; @Excel(name = "社会组织名称") + @NotBlank(message = "不能为空") + @Length(max=50,message = "不能超过50个字") private String societyName; @Excel(name = "服务事项") + @NotBlank(message = "不能为空") + @Length(max=1000,message = "不能超过1000个字") private String serviceMatters; @Excel(name = "负责人") + @NotBlank(message = "不能为空") + @Length(max=20,message = "不能超过20个字") private String personInCharge; @Excel(name = "负责人电话") + @NotBlank(message = "不能为空") + @Length(max=11,message = "不能超过11个字") private String mobile; @Excel(name = "起始服务时间") - private Date serviceStartTime; + @NotBlank(message = "不能为空") + private String serviceStartTime; @Excel(name = "终止服务时间") - private Date serviceEndTime; + @NotBlank(message = "不能为空") + private String serviceEndTime; - @Excel(name = "绑定管理员[组织下录入的工作人员]") - private String adminStaffId; + @Excel(name = "管理员姓名") + private String adminStaffName; @Excel(name = "地址") private String address; @@ -73,26 +80,4 @@ public class IcSocietyOrgExcel { @Excel(name = "维度") private String latitude; - @Excel(name = "备注") - private String remarks; - - @Excel(name = "删除标识:0.未删除 1.已删除") - private Integer delFlag; - - @Excel(name = "乐观锁") - private Integer revision; - - @Excel(name = "创建人") - private String createdBy; - - @Excel(name = "创建时间") - private Date createdTime; - - @Excel(name = "更新人") - private String updatedBy; - - @Excel(name = "更新时间") - private Date updatedTime; - - } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ImportCommunitySelfOrganization.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ImportCommunitySelfOrganization.java new file mode 100644 index 0000000000..2a9995be2a --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ImportCommunitySelfOrganization.java @@ -0,0 +1,40 @@ +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import cn.afterturn.easypoi.excel.annotation.ExcelCollection; +import com.epmet.commons.tools.utils.ExcelVerifyInfo; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2021/11/24 4:34 下午 + * @DESC + */ +@Data +public class ImportCommunitySelfOrganization extends ExcelVerifyInfo { + + @Excel(name = "组织名称", needMerge = true) + private String organizationName; + + @Excel(name = "组织人数", needMerge = true) + private Integer organizationPersonCount; + + @Excel(name = "服务事项", needMerge = true) + private String serviceItem; + + @Excel(name = "负责人", needMerge = true) + private String principalName; + + @Excel(name = "联系电话", needMerge = true) + private String principalPhone; + + @Excel(name = "创建时间", needMerge = true) + private Date organizationCreatedTime; + + @ExcelCollection(name = "组织成员") + private List persons; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ImportCommunitySelfOrganizationSon.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ImportCommunitySelfOrganizationSon.java new file mode 100644 index 0000000000..7fb44af70e --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ImportCommunitySelfOrganizationSon.java @@ -0,0 +1,20 @@ +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +/** + * @Author zxc + * @DateTime 2021/11/24 4:46 下午 + * @DESC + */ +@Data +public class ImportCommunitySelfOrganizationSon { + + @Excel(name = "姓名") + private String personName; + + @Excel(name = "电话") + private String personPhone; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcCommunitySelfOrganizationService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcCommunitySelfOrganizationService.java index d9b536b625..4445d2f82b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcCommunitySelfOrganizationService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcCommunitySelfOrganizationService.java @@ -29,7 +29,10 @@ import com.epmet.dto.form.demand.ServiceQueryFormDTO; import com.epmet.dto.result.CommunitySelfOrganizationListResultDTO; import com.epmet.dto.result.demand.OptionDTO; import com.epmet.entity.IcCommunitySelfOrganizationEntity; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.util.List; import java.util.Map; @@ -145,4 +148,14 @@ public interface IcCommunitySelfOrganizationService extends BaseService queryServiceList(ServiceQueryFormDTO formDTO); + + /** + * @Description 导入 + * @param tokenDto + * @param response + * @param file + * @author zxc + * @date 2021/11/25 9:03 上午 + */ + void importCommunitySelfOrganization(TokenDto tokenDto, HttpServletResponse response, MultipartFile file) throws IOException; } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyActivityService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyActivityService.java index 322201808e..7133dfd1d4 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyActivityService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyActivityService.java @@ -19,6 +19,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.IcPartyActivityDTO; import com.epmet.dto.form.PartyActivityFormDTO; import com.epmet.entity.IcPartyActivityEntity; @@ -71,7 +72,7 @@ public interface IcPartyActivityService extends BaseService { * @author generator * @date 2021-11-19 */ - void save(IcPartyUnitDTO dto); + void save(TokenDto tokenDto, IcPartyUnitDTO dto); /** diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcSocietyOrgService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcSocietyOrgService.java index f61eec5b94..f2646de029 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcSocietyOrgService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcSocietyOrgService.java @@ -25,7 +25,9 @@ import com.epmet.dto.form.demand.ServiceQueryFormDTO; import com.epmet.dto.result.GetListSocietyOrgResultDTO; import com.epmet.dto.result.demand.OptionDTO; import com.epmet.entity.IcSocietyOrgEntity; +import com.epmet.excel.IcSocietyOrgExcel; +import java.text.ParseException; import java.util.List; /** @@ -66,4 +68,11 @@ public interface IcSocietyOrgService extends BaseService { * @return */ List queryServiceList(ServiceQueryFormDTO formDTO); + + /** + * @Author sun + * @Description 九小场所下组织列表导入 + **/ + List importExcel(String customerId, List list, String staffId, List numList) throws ParseException; + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcCommunitySelfOrganizationServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcCommunitySelfOrganizationServiceImpl.java index 402d184668..267ef87956 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcCommunitySelfOrganizationServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcCommunitySelfOrganizationServiceImpl.java @@ -1,5 +1,6 @@ package com.epmet.service.impl; +import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -18,6 +19,7 @@ import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.ExcelPoiUtils; import com.epmet.constant.IcCommunitySelfOrganizationConstant; import com.epmet.dao.IcCommunitySelfOrganizationDao; import com.epmet.dto.IcCommunitySelfOrganizationDTO; @@ -31,6 +33,7 @@ import com.epmet.dto.result.CommunitySelfOrganizationListResultDTO; import com.epmet.dto.result.demand.OptionDTO; import com.epmet.entity.IcCommunitySelfOrganizationEntity; import com.epmet.entity.IcCommunitySelfOrganizationPersonnelEntity; +import com.epmet.excel.ImportCommunitySelfOrganization; import com.epmet.service.IcCommunitySelfOrganizationPersonnelService; import com.epmet.service.IcCommunitySelfOrganizationService; import com.epmet.service.IcUserDemandRecService; @@ -41,8 +44,13 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.util.*; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; import static com.epmet.commons.tools.utils.DateUtils.DATE_PATTERN; @@ -119,6 +127,7 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl persons = ConvertUtils.sourceToTarget(formDTO.getOrganizationPersonnel(), IcCommunitySelfOrganizationPersonnelEntity.class); + Map> groupPhone = persons.stream().collect(Collectors.groupingBy(IcCommunitySelfOrganizationPersonnelEntity::getPersonPhone)); + List phones = new ArrayList<>(); + groupPhone.forEach((k,v) -> { + if (v.size() > NumConstant.ONE){ + phones.add(k); + } + }); + if (CollectionUtils.isNotEmpty(phones)){ + StringBuffer sb = new StringBuffer(); + phones.forEach(p -> { + sb.append(p).append(","); + }); + String copywriter = sb.toString().substring(NumConstant.ZERO, sb.length() - NumConstant.ONE); + EpmetErrorCode.EXISTS_SAME_PHONE_ERROR.setMsg(String.format(EpmetErrorCode.EXISTS_SAME_PHONE_ERROR.getMsg(),copywriter)); + throw new RenException(EpmetErrorCode.EXISTS_SAME_PHONE_ERROR.getCode()); + } persons.forEach(p -> { p.setCustomerId(customerId); p.setOrgId(orgEntity.getId()); @@ -170,6 +196,7 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl l = new LambdaQueryWrapper<>(); @@ -188,6 +215,22 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl persons = ConvertUtils.sourceToTarget(formDTO.getOrganizationPersonnel(), IcCommunitySelfOrganizationPersonnelEntity.class); + Map> groupPhone = persons.stream().collect(Collectors.groupingBy(IcCommunitySelfOrganizationPersonnelEntity::getPersonPhone)); + List phones = new ArrayList<>(); + groupPhone.forEach((k,v) -> { + if (v.size() > NumConstant.ONE){ + phones.add(k); + } + }); + if (CollectionUtils.isNotEmpty(phones)){ + StringBuffer sb = new StringBuffer(); + phones.forEach(p -> { + sb.append(p).append(","); + }); + String copywriter = sb.toString().substring(NumConstant.ZERO, sb.length() - NumConstant.ONE); + EpmetErrorCode.EXISTS_SAME_PHONE_ERROR.setMsg(String.format(EpmetErrorCode.EXISTS_SAME_PHONE_ERROR.getMsg(),copywriter)); + throw new RenException(EpmetErrorCode.EXISTS_SAME_PHONE_ERROR.getCode()); + } persons.forEach(p -> { p.setOrgId(formDTO.getOrgId()); p.setCustomerId(tokenDto.getCustomerId()); @@ -213,14 +256,26 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl objectPageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()).doSelectPageInfo(() -> baseDao.selectCommunitySelfOrganizationList(formDTO)); - result.setTotal(Integer.valueOf(String.valueOf(objectPageInfo.getTotal()))); - if (CollectionUtils.isNotEmpty(objectPageInfo.getList())){ - objectPageInfo.getList().forEach(l -> { - l.setSort(i[NumConstant.ZERO]); - i[NumConstant.ZERO]++; + if (formDTO.getIsPage()){ + PageInfo objectPageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.selectCommunitySelfOrganizationList(formDTO)); + result.setTotal(Integer.valueOf(String.valueOf(objectPageInfo.getTotal()))); + if (CollectionUtils.isNotEmpty(objectPageInfo.getList())){ + objectPageInfo.getList().forEach(l -> { + l.setSort(i[NumConstant.ZERO]); + i[NumConstant.ZERO]++; + }); + result.setList(objectPageInfo.getList()); + } + return result; + } + List resultDTOs = baseDao.selectCommunitySelfOrganizationList(formDTO); + if (CollectionUtils.isNotEmpty(resultDTOs)){ + result.setTotal(resultDTOs.size()); + AtomicReference sort = new AtomicReference<>(NumConstant.ONE); + resultDTOs.forEach(r -> { + r.setSort(sort.getAndSet(sort.get() + NumConstant.ONE)); }); - result.setList(objectPageInfo.getList()); + result.setList(resultDTOs); } return result; } @@ -232,6 +287,7 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl testExcelImportResult = ExcelPoiUtils.importExcelMore(file, 0, 2, ImportCommunitySelfOrganization.class); + List list = testExcelImportResult.getList(); + if (CollectionUtils.isNotEmpty(list)){ + String customerId = tokenDto.getCustomerId(); + List existsNames = baseDao.selectOrgByOrgName(list.stream().map(m -> m.getOrganizationName()).collect(Collectors.toList()), customerId); + Map> groupByName = list.stream().collect(Collectors.groupingBy(ImportCommunitySelfOrganization::getOrganizationName)); + groupByName.forEach((k,v) -> { + if (v.size() > NumConstant.ONE){ + existsNames.add(k); + } + }); + List repeatName = existsNames.stream().distinct().collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(repeatName)){ + StringBuffer sb = new StringBuffer(); + repeatName.forEach(p -> { + sb.append(p).append(","); + }); + String copywriter = sb.toString().substring(NumConstant.ZERO, sb.length() - NumConstant.ONE); + EpmetErrorCode.COMMUNITY_SELF_ORGANIZATION_LIST_REPART_ERROR.setMsg(String.format(EpmetErrorCode.COMMUNITY_SELF_ORGANIZATION_LIST_REPART_ERROR.getMsg(),copywriter)); + throw new RenException(EpmetErrorCode.COMMUNITY_SELF_ORGANIZATION_LIST_REPART_ERROR.getCode()); + } + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, tokenDto.getUserId()); + if (null == staffInfo){ + throw new RenException(String.format("查询人员{%s}信息失败",tokenDto.getUserId())); + } + AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(staffInfo.getAgencyId()); + if (null == agencyInfo){ + throw new RenException(String.format("查询组织信息失败%s",staffInfo.getAgencyId())); + } + list.forEach(l -> { + IcCommunitySelfOrganizationEntity e = ConvertUtils.sourceToTarget(l, IcCommunitySelfOrganizationEntity.class); + e.setCustomerId(customerId); + e.setOrgId(staffInfo.getAgencyId()); + e.setOrgType(IcCommunitySelfOrganizationConstant.ORG_TYPE_AGENCY); + e.setPid(agencyInfo.getPid()); + e.setPids(agencyInfo.getPids()); + e.setOrganizationCreatedTime(l.getOrganizationCreatedTime()); + baseDao.insert(e); + if (CollectionUtils.isNotEmpty(l.getPersons())){ + List persons = ConvertUtils.sourceToTarget(l.getPersons(), IcCommunitySelfOrganizationPersonnelEntity.class); + Map> groupByPhone = persons.stream().collect(Collectors.groupingBy(IcCommunitySelfOrganizationPersonnelEntity::getPersonPhone)); + List phones = new ArrayList<>(); + groupByPhone.forEach((k,v) -> { + if (v.size() > NumConstant.ONE){ + phones.add(k); + } + }); + if (CollectionUtils.isNotEmpty(phones)){ + StringBuffer sb = new StringBuffer(); + phones.forEach(p -> { + sb.append(p).append(","); + }); + String copywriter = sb.toString().substring(NumConstant.ZERO, sb.length() - NumConstant.ONE); + EpmetErrorCode.EXISTS_SAME_PHONE_ERROR.setMsg(String.format(EpmetErrorCode.EXISTS_SAME_PHONE_ERROR.getMsg(),copywriter)); + throw new RenException(EpmetErrorCode.EXISTS_SAME_PHONE_ERROR.getCode()); + } + persons.forEach(p -> { + p.setCustomerId(customerId); + p.setOrgId(e.getId()); + }); + personnelService.insertBatch(persons); + } + }); + } + } + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java index 2d3c6c81b2..c4121d354a 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java @@ -21,9 +21,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.redis.common.CustomerOrgRedis; -import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.IcPartyActivityDao; import com.epmet.dto.IcPartyActivityDTO; @@ -123,10 +124,12 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl queryServiceList(ServiceQueryFormDTO formDTO) { - List resultList=new ArrayList<>(); - IcUserDemandRecDTO icUserDemandRecDTO=icUserDemandRecService.get(formDTO.getDemandRecId()); - if(null==icUserDemandRecDTO|| org.springframework.util.StringUtils.isEmpty(icUserDemandRecDTO.getGridPids())){ - return resultList; + List resultList = new ArrayList<>(); + CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); + if (null == staffInfoCacheResult || StringUtils.isBlank(staffInfoCacheResult.getAgencyId())) { + throw new RenException("工作人员所属组织信息查询异常"); } - List agencyIds=new ArrayList<>(); - if(icUserDemandRecDTO.getGridPids().contains(StrConstant.COLON)){ - agencyIds.addAll(Arrays.asList(icUserDemandRecDTO.getGridPids().split(StrConstant.COLON))); - }else{ - agencyIds.add(icUserDemandRecDTO.getGridPids()); + List agencyIds = new ArrayList<>(); + if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) { + if (staffInfoCacheResult.getAgencyPIds().contains(StrConstant.COLON)) { + agencyIds.addAll(Arrays.asList(staffInfoCacheResult.getAgencyPIds().split(StrConstant.COLON))); + }else{ + //当前用户属于第二级组织的人,不会有: + agencyIds.add(staffInfoCacheResult.getAgencyPIds()); + } } + agencyIds.add(staffInfoCacheResult.getAgencyId()); resultList=baseDao.selectListByAgencyId(agencyIds,formDTO.getServiceName(),formDTO.getCustomerId()); return resultList; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java index 2376a88150..e9fc54a6f1 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java @@ -26,17 +26,16 @@ import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.IcSocietyOrgDao; -import com.epmet.dto.form.AddSocietyOrgFormDTO; -import com.epmet.dto.form.EditSocietyOrgFormDTO; -import com.epmet.dto.form.GetListSocietyOrgFormDTO; -import com.epmet.dto.form.UserIdsFormDTO; +import com.epmet.dto.CustomerStaffDTO; +import com.epmet.dto.IcSocietyOrgDTO; +import com.epmet.dto.form.*; import com.epmet.dto.form.demand.ServiceQueryFormDTO; -import com.epmet.dto.result.GetListSocietyOrgResultDTO; -import com.epmet.dto.result.SocietyOrgListResultDTO; -import com.epmet.dto.result.StaffSinGridResultDTO; +import com.epmet.dto.result.*; import com.epmet.dto.result.demand.OptionDTO; import com.epmet.entity.IcSocietyOrgEntity; +import com.epmet.excel.IcSocietyOrgExcel; import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.service.IcSocietyOrgService; import com.epmet.service.IcUserDemandRecService; import com.github.pagehelper.PageHelper; @@ -49,9 +48,9 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; import java.util.stream.Collectors; /** @@ -67,6 +66,8 @@ public class IcSocietyOrgServiceImpl extends BaseServiceImpl result = - PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.getList(formDTO)); + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()).doSelectPageInfo(() -> baseDao.getList(formDTO)); if (CollectionUtils.isEmpty(result.getList())) { return resultDTO; } resultDTO.setTotal((int) result.getTotal()); + //2.查询被绑定管理员信息 UserIdsFormDTO dto = new UserIdsFormDTO(); List staffIdList = result.getList().stream().map(SocietyOrgListResultDTO::getAdminStaffId).collect(Collectors.toList()); @@ -132,8 +136,20 @@ public class IcSocietyOrgServiceImpl extends BaseServiceImpl listResult.getData().stream().filter(u -> r.getAdminStaffId().equals(u.getStaffId())).forEach(u -> r.setAdminStaffName(u.getStaffName()))); - resultDTO.setList(result.getList()); + //3.查询被绑定管理员信息 + OrgInfoFormDTO org = new OrgInfoFormDTO(); + List orgIds = result.getList().stream().map(SocietyOrgListResultDTO::getAgencyId).collect(Collectors.toList()); + orgIds = orgIds.stream().distinct().collect(Collectors.toList()); + org.setOrgIds(orgIds); + org.setOrgType("agency"); + Result> orgResult = govOrgOpenFeignClient.selectOrgInfo(org); + if (!orgResult.success()) { + throw new RenException("获取组织基础信息失败......"); + } + result.getList().forEach(r -> orgResult.getData().stream().filter(u -> r.getAgencyId().equals(u.getOrgId())).forEach(u -> r.setAgencyName(u.getOrgName()))); + + resultDTO.setList(result.getList()); return resultDTO; } @@ -154,6 +170,9 @@ public class IcSocietyOrgServiceImpl extends BaseServiceImpl importExcel(String customerId, List list, String staffId, List numList) throws ParseException { + CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(customerId, staffId); + //查询当前组织下的社会组织数据 + List societyOrgList = baseDao.getByAgencyId(staffInfoCache.getAgencyId()); + //1.数据校验 只允许导入当前组织下社会组织且是当前组织下不存在的社会组织 + //组织名称不一样的数据舍弃 + Iterator iterator = list.iterator(); + while (iterator.hasNext()) { + IcSocietyOrgExcel obj = iterator.next(); + if (!obj.getAgencyName().trim().equals(staffInfoCache.getAgencyName())) { + numList.add(obj.getRowNum()); + log.warn(String.format("不是当前组织下可导入的数据,组织名称->%s,行号->%s", obj.getAgencyName(), obj.getRowNum())); + iterator.remove(); + continue; + } + societyOrgList.forEach(org -> { + if (obj.getSocietyName().equals(org.getSocietyName())) { + numList.add(obj.getRowNum()); + log.warn(String.format("当前组织下的社会组织已存在,社会组织名称->%s,行号->%s", obj.getSocietyName(), obj.getRowNum())); + iterator.remove(); + } + }); + + } + if (CollectionUtils.isEmpty(list)) { + return numList; + } + + //2.查询绑定的管理员信息 + Set staffNames = list.stream().map(item -> item.getAdminStaffName().trim()).collect(Collectors.toSet()); + GetByRealNamesFormDTO dto = new GetByRealNamesFormDTO(); + dto.setCustomerId(customerId); + dto.setRealNames(staffNames); + Result> staffResult = epmetUserOpenFeignClient.getByRealNames(dto); + if (!staffResult.success()) { + throw new RenException("获取工作人员基础信息失败......"); + } + if (null == staffResult.getData()) { + Iterator iter = list.iterator(); + while (iter.hasNext()) { + IcSocietyOrgExcel obj = iter.next(); + numList.add(obj.getRowNum()); + iterator.remove(); + } + return numList; + } + Map map = staffResult.getData().stream().collect(Collectors.toMap(CustomerStaffDTO::getRealName, CustomerStaffDTO::getUserId)); + + //3.遍历封装有效数据 + List houseEntityList = new ArrayList<>(); + Iterator iterator1 = list.iterator(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + while (iterator1.hasNext()) { + IcSocietyOrgExcel icHouseExcel = iterator1.next(); + IcSocietyOrgEntity entity = new IcSocietyOrgEntity(); + entity.setCustomerId(customerId); + entity.setAgencyId(staffInfoCache.getAgencyId()); + entity.setPids(staffInfoCache.getAgencyPIds()); + entity.setSocietyName(icHouseExcel.getSocietyName()); + entity.setServiceMatters(icHouseExcel.getServiceMatters()); + entity.setPersonInCharge(icHouseExcel.getPersonInCharge()); + entity.setMobile(icHouseExcel.getMobile()); + entity.setServiceStartTime(sdf.parse(icHouseExcel.getServiceStartTime())); + entity.setServiceEndTime(sdf.parse(icHouseExcel.getServiceEndTime())); + entity.setAdminStaffId(map.containsKey(icHouseExcel.getAdminStaffName().trim()) ? map.get(icHouseExcel.getAdminStaffName().trim()) : ""); + if ("".equals(entity.getAdminStaffId())) { + numList.add(icHouseExcel.getRowNum()); + log.warn(String.format("绑定的管理员不存在,管理员名称->%s,行号->%s", icHouseExcel.getAdminStaffName(), icHouseExcel.getRowNum())); + iterator1.remove(); + continue; + } + entity.setAddress(icHouseExcel.getAddress()); + entity.setLongitude(icHouseExcel.getLongitude()); + entity.setLatitude(icHouseExcel.getLatitude()); + houseEntityList.add(entity); + } + + //3.批量保存数据 + insertBatch(houseEntityList); + + return numList; + } + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java index 6b2e6de95d..677fcb64b1 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java @@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.exception.EpmetErrorCode; @@ -205,12 +206,11 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl pageInfo= PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.pageSelect(formDTO)); @@ -417,7 +417,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl - AND DATE_FORMAT(so.ORGANIZATION_CREATED_TIME,'%Y%m%d') = ]]> #{startTime} + AND so.ORGANIZATION_CREATED_TIME = ]]> #{startTime} - AND DATE_FORMAT(so.ORGANIZATION_CREATED_TIME,'%Y%m%d') #{endTime} + AND so.ORGANIZATION_CREATED_TIME #{endTime} ORDER BY so.ORGANIZATION_CREATED_TIME DESC @@ -85,4 +84,17 @@ + + + \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml index f0917a69af..6b49401adf 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml @@ -23,6 +23,7 @@ + @@ -31,7 +32,8 @@ SELECT CUSTOMER_ID AS customerId, CATEGORY_CODE AS "value", - CATEGORY_NAME AS "label" + CATEGORY_NAME AS "label", + PARENT_CODE as pValue FROM ic_resi_demand_dict WHERE @@ -45,7 +47,8 @@ SELECT CUSTOMER_ID AS customerId, CATEGORY_CODE AS "value", - CATEGORY_NAME AS "label" + CATEGORY_NAME AS "label", + PARENT_CODE as pValue FROM ic_resi_demand_dict WHERE @@ -202,13 +205,16 @@ SELECT d.CATEGORY_CODE, d.PARENT_CODE, - concat( p.CATEGORY_NAME, '-', d.CATEGORY_NAME ) AS CATEGORY_NAME + ( + case when d.level='1' then d.category_name + when d.level='2' then concat( p.CATEGORY_NAME, '-', d.CATEGORY_NAME ) + end + )AS CATEGORY_NAME FROM ic_resi_demand_dict d LEFT JOIN ic_resi_demand_dict p ON ( d.PARENT_CODE = p.CATEGORY_CODE AND p.CUSTOMER_ID = #{customerId} ) WHERE d.DEL_FLAG = '0' - AND d.`LEVEL` = '2' AND d.CUSTOMER_ID = #{customerId} and d.category_code in diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcSocietyOrgDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcSocietyOrgDao.xml index a4685af4ce..56daf5dc2b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcSocietyOrgDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcSocietyOrgDao.xml @@ -24,6 +24,9 @@ AND customer_id = #{customerId} + + AND pids LIKE CONCAT('%', #{pids}, '%') + AND society_name LIKE CONCAT('%', #{societyName}, '%') @@ -45,8 +48,8 @@ + + + \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml index 7fd7542258..72ac018284 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml @@ -39,11 +39,14 @@ SELECT r.ID as demandRecId, r.GRID_ID as gridId, + r.agency_id as agencyId, r.CATEGORY_CODE as categoryCode, + r.PARENT_CODE as parentCode, r.CONTENT, r.REPORT_TYPE as reportType, r.REPORT_TIME as reportTime, r.REPORT_USER_NAME as reportUserName, + r.REPORT_USER_MOBILE as reportUserMobile, r.`STATUS` as status, r.DEMAND_USER_ID as demandUserId, r.DEMAND_USER_NAME as demandUserName, @@ -90,11 +93,11 @@ and r.DEMAND_USER_NAME like concat('%',#{demandUserName},'%') - - AND DATE_FORMAT(r.REPORT_TIME,'%Y-%m-%d') = ]]> #{reportStartDate} + + AND DATE_FORMAT(r.REPORT_TIME,'%Y-%m-%d') = ]]> #{reportStartTime} - - AND DATE_FORMAT(r.REPORT_TIME,'%Y-%m-%d') #{reportEndDate} + + AND DATE_FORMAT(r.REPORT_TIME,'%Y-%m-%d') #{reportEndTime} and r.STATUS=#{status} @@ -105,11 +108,11 @@ and s.SERVER_ID=#{serverId} - - AND DATE_FORMAT(r.WANT_SERVICE_TIME,'%Y-%m-%d') = ]]> #{wantServiceStartDate} + + AND DATE_FORMAT(r.WANT_SERVICE_TIME,'%Y-%m-%d') = ]]> #{wantServiceStartTime} - - AND DATE_FORMAT(r.WANT_SERVICE_TIME,'%Y-%m-%d') #{wantServiceEndDate} + + AND DATE_FORMAT(r.WANT_SERVICE_TIME,'%Y-%m-%d') #{wantServiceEndTime} order by r.WANT_SERVICE_TIME desc,r.CREATED_TIME asc diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlaceOrgFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlaceOrgFormDTO.java index c45a197ab8..4725a8b32d 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlaceOrgFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlaceOrgFormDTO.java @@ -45,12 +45,16 @@ public class GetListPlaceOrgFormDTO implements Serializable { private Boolean isPage = true; //页码 @Min(1) - private Integer pageNo; + private Integer pageNo = 1; //每页多少条 private Integer pageSize = 20; //token中客户Id private String customerId; //场所Id private String placeOrgId; + //token中userId + private String staffId; + //token中userId所属组织的pid + private String pids; } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlacePatrolRecordFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlacePatrolRecordFormDTO.java index b839d432b6..f176bca7ba 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlacePatrolRecordFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlacePatrolRecordFormDTO.java @@ -43,12 +43,16 @@ public class GetListPlacePatrolRecordFormDTO implements Serializable { private String finalResult; //页码 @Min(1) - private Integer pageNo; + private Integer pageNo = 1; //每页多少条 private Integer pageSize = 20; //token中客户Id private String customerId; //巡查记录Id private String placePatrolRecordId; + //token中userId + private String staffId; + //token中userId所属组织的pid + private String pids; } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlacePatrolReviewRecordFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlacePatrolReviewRecordFormDTO.java index 225962bb89..a4f0eeae0a 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlacePatrolReviewRecordFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlacePatrolReviewRecordFormDTO.java @@ -38,7 +38,7 @@ public class GetListPlacePatrolReviewRecordFormDTO implements Serializable { private String placePatrolReviewRecordId; //页码 @Min(1) - private Integer pageNo; + private Integer pageNo = 1; //每页多少条 private Integer pageSize = 20; //token中客户Id diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlacePatrolTeamFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlacePatrolTeamFormDTO.java index 4b01a8b484..381a085107 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlacePatrolTeamFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlacePatrolTeamFormDTO.java @@ -43,12 +43,16 @@ public class GetListPlacePatrolTeamFormDTO implements Serializable { private Boolean isPage = true; //页码 @Min(1) - private Integer pageNo; + private Integer pageNo = 1; //每页多少条 private Integer pageSize = 20; //token中客户Id private String customerId; //场所Id private String teamId; + //token中userId + private String staffId; + //token中userId所属组织的pid + private String pids; } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlaceOrgResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlaceOrgResultDTO.java index 2111d8ef30..ffa2b18b74 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlaceOrgResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlaceOrgResultDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.result; import lombok.Data; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; /** @@ -12,8 +13,8 @@ import java.util.List; @Data public class GetListPlaceOrgResultDTO implements Serializable { //集合总条数 - private Integer total; + private Integer total = 0; //社会组织信息 - private List list; + private List list = new ArrayList<>(); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlacePatrolRecordResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlacePatrolRecordResultDTO.java index 0ef22dfa52..1531ab2901 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlacePatrolRecordResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlacePatrolRecordResultDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.result; import lombok.Data; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; /** @@ -12,8 +13,8 @@ import java.util.List; @Data public class GetListPlacePatrolRecordResultDTO implements Serializable { //集合总条数 - private Integer total; + private Integer total = 0; //社会组织信息 - private List list; + private List list = new ArrayList<>(); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlacePatrolReviewRecordResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlacePatrolReviewRecordResultDTO.java index 9caca08bd1..08b9fe2461 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlacePatrolReviewRecordResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlacePatrolReviewRecordResultDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.result; import lombok.Data; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; /** @@ -12,8 +13,8 @@ import java.util.List; @Data public class GetListPlacePatrolReviewRecordResultDTO implements Serializable { //集合总条数 - private Integer total; + private Integer total = 0; //社会组织信息 - private List list; + private List list = new ArrayList<>(); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlacePatrolTeamResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlacePatrolTeamResultDTO.java index b2ce9018f6..e7dac5b53d 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlacePatrolTeamResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlacePatrolTeamResultDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.result; import lombok.Data; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; /** @@ -12,8 +13,8 @@ import java.util.List; @Data public class GetListPlacePatrolTeamResultDTO implements Serializable { //集合总条数 - private Integer total; + private Integer total = 0; //社会组织信息 - private List list; + private List list = new ArrayList<>(); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PlaceOrgDetailResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PlaceOrgDetailResultDTO.java index 211c74097f..866f1cc981 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PlaceOrgDetailResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PlaceOrgDetailResultDTO.java @@ -27,6 +27,8 @@ public class PlaceOrgDetailResultDTO implements Serializable { private String ninePlaceName; //场所规模【 0:10人以下 1:10-20人 2:21-40人 3:41-100人 4:100人以上】 private String scale; + //场所规模名称【 0:10人以下 1:10-20人 2:21-40人 3:41-100人 4:100人以上】 + private String scaleName; //负责人 private String personInCharge; //联系电话 diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PlacePatrolTeamDetailResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PlacePatrolTeamDetailResultDTO.java index 6869a2fb75..57ef081c5e 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PlacePatrolTeamDetailResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PlacePatrolTeamDetailResultDTO.java @@ -4,6 +4,7 @@ import com.epmet.dto.IcPlacePatrolTeamStaffDTO; import lombok.Data; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; /** @@ -33,6 +34,6 @@ public class PlacePatrolTeamDetailResultDTO implements Serializable { //创建时间 private String time; //分队成员信息 - private List memberList; + private List memberList = new ArrayList<>(); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlaceOrgController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlaceOrgController.java index 238b6ed595..2d152c21c6 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlaceOrgController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlaceOrgController.java @@ -99,6 +99,7 @@ public class IcPlaceOrgController { @PostMapping("getlist") public Result getList(@LoginUser TokenDto tokenDto, @RequestBody GetListPlaceOrgFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); return new Result().ok(placeOrgService.getList(formDTO)); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlacePatrolRecordController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlacePatrolRecordController.java index 9ef1e21e5d..0d2c02a3d6 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlacePatrolRecordController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlacePatrolRecordController.java @@ -88,6 +88,7 @@ public class IcPlacePatrolRecordController { @PostMapping("getlist") public Result getList(@LoginUser TokenDto tokenDto, @RequestBody GetListPlacePatrolRecordFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); return new Result().ok(placePatrolRecordService.getList(formDTO)); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlacePatrolTeamController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlacePatrolTeamController.java index 815505c2e9..23013c9f02 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlacePatrolTeamController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlacePatrolTeamController.java @@ -101,6 +101,7 @@ public class IcPlacePatrolTeamController { @PostMapping("getlist") public Result getList(@LoginUser TokenDto tokenDto, @RequestBody GetListPlacePatrolTeamFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); return new Result().ok(placePatrolTeamService.getList(formDTO)); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlaceOrgServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlaceOrgServiceImpl.java index f3dbe0bf65..1a0e071404 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlaceOrgServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlaceOrgServiceImpl.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.OptionResultDTO; +import com.epmet.commons.tools.enums.DictTypeEnum; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.utils.ConvertUtils; @@ -44,6 +45,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.util.List; +import java.util.Map; /** * 九小场所下组织管理 @@ -114,6 +116,7 @@ public class IcPlaceOrgServiceImpl extends BaseServiceImpl> result1 = epmetAdminOpenFeignClient.getNineSmallPlacesOption(); if (!result1.success()) { @@ -124,6 +127,11 @@ public class IcPlaceOrgServiceImpl extends BaseServiceImpl> unitTypeMap = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.SCALE.getCode()); + resultDTO.setScaleName(unitTypeMap.getData().get(resultDTO.getScale())); + return resultDTO; } @@ -134,6 +142,8 @@ public class IcPlaceOrgServiceImpl extends BaseServiceImpl result = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()).doSelectPageInfo(() -> baseDao.getList(formDTO)); @@ -141,14 +151,21 @@ public class IcPlaceOrgServiceImpl extends BaseServiceImpl> result1 = epmetAdminOpenFeignClient.getNineSmallPlacesOption(); if (!result1.success()) { throw new RenException("获取九小场所基本信息失败......"); } result.getList().forEach(r -> result1.getData().stream().filter(u -> r.getNinePlaceVal().equals(u.getValue())).forEach(u -> r.setNinePlaceName(u.getLabel()))); - resultDTO.setList(result.getList()); + //3.人员规模字典表赋值 + Result> unitTypeMap = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.SCALE.getCode()); + result.getList().forEach(item -> { + item.setScaleName(unitTypeMap.getData().get(item.getScale())); + }); + + resultDTO.setList(result.getList()); return resultDTO; } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolRecordServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolRecordServiceImpl.java index 7cbc07b966..2b205e9ae6 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolRecordServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolRecordServiceImpl.java @@ -159,6 +159,8 @@ public class IcPlacePatrolRecordServiceImpl extends BaseServiceImpl result = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.getList(formDTO)); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolTeamServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolTeamServiceImpl.java index c3e5ff7fa5..c16b575230 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolTeamServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolTeamServiceImpl.java @@ -48,7 +48,9 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; /** @@ -74,6 +76,14 @@ public class IcPlacePatrolTeamServiceImpl extends BaseServiceImpl map = new HashMap<>(); + formDTO.getMemberList().forEach(m -> { + if(map.containsKey(m.getMobile())){ + throw new RenException(String.format("新增巡查人员管理失败,分队下人员手机号重复,重复手机号->%s", m.getMobile())); + } + map.put(m.getMobile(),m.getName()); + }); //1.分队主表新增数据 IcPlacePatrolTeamEntity entity = ConvertUtils.sourceToTarget(formDTO, IcPlacePatrolTeamEntity.class); CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); @@ -101,6 +111,14 @@ public class IcPlacePatrolTeamServiceImpl extends BaseServiceImpl map = new HashMap<>(); + formDTO.getMemberList().forEach(m -> { + if(map.containsKey(m.getMobile())){ + throw new RenException(String.format("修改巡查人员管理失败,分队下人员手机号重复,重复手机号->%s", m.getMobile())); + } + map.put(m.getMobile(),m.getName()); + }); //1.修改分队主表信息 IcPlacePatrolTeamEntity entity = baseDao.selectById(formDTO.getTeamId()); if (null == entity) { @@ -176,7 +194,7 @@ public class IcPlacePatrolTeamServiceImpl extends BaseServiceImpl { if (str.equals(r.getId())) { - gridNames.append("".equals(gridNames) ? r.getGridName() : "," + r.getGridName()); + gridNames.append("".equals(gridNames.toString().trim()) ? r.getGridName() : "," + r.getGridName()); } }); } @@ -186,7 +204,7 @@ public class IcPlacePatrolTeamServiceImpl extends BaseServiceImpl { if (str.equals(r.getValue())) { - ninePlaceNames.append("".equals(ninePlaceNames) ? r.getLabel() : "," + r.getLabel()); + ninePlaceNames.append("".equals(ninePlaceNames.toString().trim()) ? r.getLabel() : "," + r.getLabel()); } }); } @@ -202,6 +220,8 @@ public class IcPlacePatrolTeamServiceImpl extends BaseServiceImpl result = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()).doSelectPageInfo(() -> baseDao.getList(formDTO)); @@ -232,7 +252,7 @@ public class IcPlacePatrolTeamServiceImpl extends BaseServiceImpl { if (str.equals(r.getId())) { - gridNames.append("".equals(gridNames) ? r.getGridName() : "," + r.getGridName()); + gridNames.append("".equals(gridNames.toString().trim()) ? r.getGridName() : "," + r.getGridName()); } }); } @@ -241,7 +261,7 @@ public class IcPlacePatrolTeamServiceImpl extends BaseServiceImpl { if (str.equals(r.getValue())) { - ninePlaceNames.append("".equals(ninePlaceNames) ? r.getLabel() : "," + r.getLabel()); + ninePlaceNames.append("".equals(ninePlaceNames.toString().trim()) ? r.getLabel() : "," + r.getLabel()); } }); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlaceOrgDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlaceOrgDao.xml index 27514baefe..600a80ee7f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlaceOrgDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlaceOrgDao.xml @@ -25,6 +25,9 @@ AND a.customer_id = #{customerId} + + AND a.pids LIKE CONCAT('%', #{pids}, '%') + AND a.grid_id = #{gridId} diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlacePatrolRecordDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlacePatrolRecordDao.xml index 597a62e186..d0c33f3471 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlacePatrolRecordDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlacePatrolRecordDao.xml @@ -34,6 +34,9 @@ AND a.customer_id = #{customerId} + + AND a.pids LIKE CONCAT('%', #{pids}, '%') + AND a.grid_id = #{gridId} diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlacePatrolTeamDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlacePatrolTeamDao.xml index a218d4f050..3475fce30b 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlacePatrolTeamDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlacePatrolTeamDao.xml @@ -27,6 +27,9 @@ AND customer_id = #{customerId} + + AND pids LIKE CONCAT('%', #{pids}, '%') + AND grid_ids LIKE CONCAT('%', #{gridId}, '%') diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/IcPartymemberStyleController.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/IcPartymemberStyleController.java index 4e11bc658d..a5fea4b9da 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/IcPartymemberStyleController.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/IcPartymemberStyleController.java @@ -17,8 +17,10 @@ package com.epmet.modules.partymember.controller; +import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -64,10 +66,10 @@ public class IcPartymemberStyleController { } @PostMapping("save") - public Result save(@RequestBody IcPartymemberStyleDTO dto){ + public Result save(@LoginUser TokenDto tokenDto, @RequestBody IcPartymemberStyleDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); - icPartymemberStyleService.save(dto); + icPartymemberStyleService.save(tokenDto, dto); return new Result(); } diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/IcPartymemberStyleService.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/IcPartymemberStyleService.java index ca58a11dc8..bc52136543 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/IcPartymemberStyleService.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/IcPartymemberStyleService.java @@ -19,6 +19,7 @@ package com.epmet.modules.partymember.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.modules.partymember.entity.IcPartymemberStyleEntity; import com.epmet.resi.partymember.dto.partymember.IcPartymemberStyleDTO; import com.epmet.resi.partymember.dto.partymember.form.PartyMemberStyleFormDTO; @@ -72,7 +73,7 @@ public interface IcPartymemberStyleService extends BaseService list = dto.getImageList().stream().map(item -> { IcPartymemberStyleImageEntity e = new IcPartymemberStyleImageEntity(); + e.setCustomerId(tokenDto.getCustomerId()); e.setStyleId(entity.getId()); e.setImageUrl(item); e.setSort(i.getAndIncrement()); + e.setRevision(NumConstant.ZERO); + e.setDelFlag(NumConstant.ZERO_STR); + e.setCreatedBy(tokenDto.getUserId()); + e.setUpdatedBy(tokenDto.getUserId()); + e.setCreatedTime(new Date()); + e.setUpdatedTime(new Date()); return e; }).collect(Collectors.toList()); icPartymemberStyleImageService.insertBatch(list); diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GetByRealNamesFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GetByRealNamesFormDTO.java new file mode 100644 index 0000000000..80719e6737 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GetByRealNamesFormDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.form; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Set; + +/** + * @Author sun + * @Description 根据工作人员姓名批量查询基础信息数据 + **/ +@NoArgsConstructor +@Data +public class GetByRealNamesFormDTO implements Serializable { + + private static final long serialVersionUID = -5220529162950147825L; + /** + * 客户Id + */ + private String customerId; + /** + * 工作人员姓名集合 + */ + private Set realNames; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index 278d0be422..54dc76299e 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -653,4 +653,11 @@ public interface EpmetUserOpenFeignClient { @PostMapping("/epmetuser/icresiuser/categorycount") Result>> getHomeUserCategoryCount(@RequestBody IcResiUserDTO formDTO); + + /** + * @Author sun + * @Description 根据工作人员姓名批量查询基础信息数据 + **/ + @PostMapping(value = "epmetuser/customerstaff/getbyrealnames") + Result> getByRealNames(@RequestBody GetByRealNamesFormDTO formDTO); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index ccc971de19..68424b651f 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -474,4 +474,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result>> getHomeUserCategoryCount(IcResiUserDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getHomeUserCategoryCount", formDTO); } + + @Override + public Result> getByRealNames(GetByRealNamesFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getByRealNames", formDTO); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java index 7aae42adea..256bbf7810 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java @@ -446,5 +446,14 @@ public class CustomerStaffController { return new Result(); } + /** + * @Author sun + * @Description 根据工作人员姓名批量查询基础信息数据 + **/ + @PostMapping(value = "getbyrealnames") + public Result> getByRealNames(@RequestBody GetByRealNamesFormDTO formDTO) { + return new Result>().ok(customerStaffService.getByRealNames(formDTO)); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index 1887feab08..f5720acd39 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -138,6 +138,7 @@ public class IcResiUserController { IC_RESI_DOWNLOAD_DIR = exportDir; } + @NoRepeatSubmit @PostMapping("delete") public Result delete(@LoginUser TokenDto tokenDto, @RequestBody DelIcResiUserFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); @@ -159,6 +160,7 @@ public class IcResiUserController { * @Author sun * @Description 党建互联平台--保存居民信息 **/ + @NoRepeatSubmit @PostMapping("add") public Result add(@LoginUser TokenDto tokenDto, @RequestBody List formDTO) { String resiUserId = icResiUserService.add(tokenDto, formDTO); @@ -177,6 +179,7 @@ public class IcResiUserController { * @Author sun * @Description 党建互联平台--修改居民信息 **/ + @NoRepeatSubmit @PostMapping("edit") public Result edit(@LoginUser TokenDto tokenDto, @RequestBody List formDTO) { String resiUserId = icResiUserService.edit(tokenDto, formDTO); @@ -238,8 +241,10 @@ public class IcResiUserController { * @return void * @author LiuJanJun * @date 2021/11/19 4:24 下午 - * @remark:分页批量导出 + * @remark:分页批量导出 oss目录在 各个环境对应的前缀文件夹/file-template/resi-template/客户ID.xlsx, + * 如果某个客户需要更新模版 则替换掉上面的模版文件;然后 更新缓存里的值或者删除也行 再导出就会下载新的模版了 */ + @NoRepeatSubmit @RequestMapping(value = "/exportExcel") public void exportExcelByEasyExcel(@RequestHeader String customerId,@LoginUser TokenDto tokenDto, @RequestBody IcResiUserPageFormDTO pageFormDTO, HttpServletResponse response) throws Exception { //tokenDto.setUserId("9e37adcce6472152e6508a19d3683e02"); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java index 97e4bf7424..d0ce82f757 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java @@ -215,4 +215,10 @@ public interface CustomerStaffDao extends BaseDao { List listDTOS(@Param("customerId") String customerId, @Param("realName") String realName, @Param("mobile") String mobile, @Param("userIds") List userIds); List selectStaffRoles(@Param("userId") String userId,@Param("customerId") String customerId); + + /** + * @Author sun + * @Description 根据工作人员姓名批量查询基础信息数据 + **/ + List getByRealNames(GetByRealNamesFormDTO formDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java index 186928372a..dfc0cdae15 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.form.ResiUserQueryValueDTO; import com.epmet.dto.result.DemandUserResDTO; import com.epmet.dto.result.IcFormResColumnDTO; @@ -146,6 +147,11 @@ public interface IcResiUserDao extends BaseDao { Map selectPersonType(@Param("columns")List columns,@Param("customerId")String customerId, @Param("tableName")String tableName,@Param("userId")String userId); + /** + * @Author sun + * @Description 查询居民信息 + **/ + IcResiUserDTO getResiUser(IcResiUserDTO dto); /** * * @param agencyId @@ -156,4 +162,4 @@ public interface IcResiUserDao extends BaseDao { List selectDemandUsers(@Param("agencyId") String agencyId, @Param("gridId")String gridId, @Param("name")String name); -} \ No newline at end of file +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java index bd4e8aae97..08916bfcc8 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java @@ -335,4 +335,10 @@ public interface CustomerStaffService extends BaseService { * @author sun */ void enableStaff(EnableStaffFormDTO fromDTO); + + /** + * @Author sun + * @Description 根据工作人员姓名批量查询基础信息数据 + **/ + List getByRealNames(GetByRealNamesFormDTO formDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index 8c880d86cd..03914fcd93 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -784,4 +784,13 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl getByRealNames(GetByRealNamesFormDTO formDTO) { + return baseDao.getByRealNames(formDTO); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java index f36d746475..9b50c237dd 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java @@ -29,6 +29,8 @@ import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.service.IcResiUserImportService; +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; @@ -59,6 +61,15 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res public static final ThreadLocal>> errorRows = new ThreadLocal<>(); public static final ThreadLocal>> skipedRows = new ThreadLocal<>(); + /** + * key: itemId + * value: + * key: option的中文 + * value: options的英文key,也可能是数据id + */ + Cache> itemIdAndOptionsCache = CacheBuilder.newBuilder().maximumSize(500).build(); + + @Autowired private LoginUserUtil loginUserUtil; @@ -212,6 +223,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res } finally { skipedRows.remove(); errorRows.remove(); + itemIdAndOptionsCache.invalidateAll(); } } @@ -562,10 +574,13 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res String colValue = options.get(cellContent); columnWrapper.setColValue(colValue); } else { - // remote类型 - - Map options = listRemoteOptions(headerColumnWrapper, columnWrapper.getOptionSourceValue(), currUserAgencyId, "saveorupdate"); - String colValue = options.get(cellContent); + // remote类型。优先从缓存取 + Map optionsOfItem = itemIdAndOptionsCache.getIfPresent(columnWrapperEntry.getKey()); + if (optionsOfItem == null || optionsOfItem.size() == 0) { + optionsOfItem = listRemoteOptions(headerColumnWrapper, columnWrapper.getOptionSourceValue(), currUserAgencyId, "saveorupdate"); + itemIdAndOptionsCache.put(columnWrapperEntry.getKey(), optionsOfItem); + } + String colValue = optionsOfItem.get(cellContent); columnWrapper.setColValue(colValue); } } else if ("checkbox".equals(columnWrapper.getItemType())) { diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index e03b401dd9..a7d89cc2d5 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -49,10 +49,7 @@ import com.epmet.constant.IcResiUserConstant; import com.epmet.constant.SystemMessageType; import com.epmet.constant.UserConstant; import com.epmet.dao.IcResiUserDao; -import com.epmet.dto.CustomerAgencyDTO; -import com.epmet.dto.IcHouseDTO; -import com.epmet.dto.IcNeighborHoodDTO; -import com.epmet.dto.IcResiCategoryStatsConfigDTO; +import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO; import com.epmet.dto.result.*; @@ -169,6 +166,17 @@ public class IcResiUserServiceImpl extends BaseServiceImpl result = govOrgOpenFeignClient.getAgencyById(agencyId); @@ -216,6 +224,17 @@ public class IcResiUserServiceImpl extends BaseServiceImpl + + + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml index 311a451e20..2278cf515a 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml @@ -271,6 +271,19 @@ AND IC_RESI_USER = #{userId} +