diff --git a/epmet-admin/epmet-admin-server/deploy/docker-compose-prod.yml b/epmet-admin/epmet-admin-server/deploy/docker-compose-prod.yml index 550b4369e3..62a9e89b35 100644 --- a/epmet-admin/epmet-admin-server/deploy/docker-compose-prod.yml +++ b/epmet-admin/epmet-admin-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-admin-server: container_name: epmet-admin-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-admin-server:0.3.32 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-admin-server:version_placeholder ports: - "8082:8082" network_mode: host # 使用现有网络 diff --git a/epmet-auth/deploy/docker-compose-prod.yml b/epmet-auth/deploy/docker-compose-prod.yml index 6b9592dfa9..b7776bbaaf 100644 --- a/epmet-auth/deploy/docker-compose-prod.yml +++ b/epmet-auth/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-auth:0.3.98 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-auth:version_placeholder ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-commons/epmet-commons-extapp-auth/pom.xml b/epmet-commons/epmet-commons-extapp-auth/pom.xml index 8ff0d46ada..bf2e9a71c7 100644 --- a/epmet-commons/epmet-commons-extapp-auth/pom.xml +++ b/epmet-commons/epmet-commons-extapp-auth/pom.xml @@ -18,7 +18,7 @@ 1.3.3 2.6 4.6.1 - 4.4.0 + 4.3.0 2.9.9 1.2.79 2.8.6 diff --git a/epmet-commons/epmet-commons-tools/pom.xml b/epmet-commons/epmet-commons-tools/pom.xml index e516c5fba7..867fcf47c7 100644 --- a/epmet-commons/epmet-commons-tools/pom.xml +++ b/epmet-commons/epmet-commons-tools/pom.xml @@ -18,7 +18,7 @@ 1.3.3 2.6 4.6.1 - 4.4.0 + 4.3.0 2.9.9 1.2.79 2.8.6 diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/AsyncConfig.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/AsyncConfig.java index 83c4758a63..ab8efec85e 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/AsyncConfig.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/AsyncConfig.java @@ -1,5 +1,6 @@ package com.epmet.commons.tools.config; +import com.alibaba.ttl.TtlRunnable; import com.alibaba.ttl.threadpool.TtlExecutors; import org.slf4j.MDC; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -64,8 +65,9 @@ public class AsyncConfig { executor.setKeepAliveSeconds(keepAliveSeconds); // 设置装饰器,使用MDC将runnable进行装饰,实现日志上下文传递到子线程 executor.setTaskDecorator((Runnable r) -> { + // 1.mdc包装,日志追踪 Map copyOfContextMap = MDC.getCopyOfContextMap(); - return () -> { + Runnable rr = () -> { try { if (copyOfContextMap != null && copyOfContextMap.size() > 0) { MDC.setContextMap(copyOfContextMap); @@ -75,6 +77,9 @@ public class AsyncConfig { MDC.clear(); } }; + + // 2.ttl包装,异步线程上下文透传 + return TtlRunnable.get(rr); }); executor.initialize(); return executor; @@ -83,7 +88,7 @@ public class AsyncConfig { @Bean public ExecutorService executorService() { ThreadPoolTaskExecutor executor = (ThreadPoolTaskExecutor) executor(); - return TtlExecutors.getTtlExecutorService(executor.getThreadPoolExecutor()); + return executor.getThreadPoolExecutor(); } /** 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 a059504d2e..3b1ed3c0c4 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 @@ -253,6 +253,7 @@ public enum EpmetErrorCode { NEIGHBORHOOD_DEL_FAILED(8922,""), IC_NAT_IDCARD_NATTIME(8923,"已存在相同记录"), IC_NAT(8924,"平台已存在记录,请去修改原有记录"), + RESI_IC_NAT(8925,"已存在记录,请联系社区工作人员修改"), //通用错误码 start diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index 04db67cfed..05e5c200a4 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -10,6 +10,8 @@ package com.epmet.commons.tools.redis; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.utils.DateUtils; import org.apache.commons.lang3.StringUtils; @@ -763,4 +765,16 @@ public class RedisKeys { public static String getNextAreaCodeKey(String areaCode) { return rootPrefix.concat("areaCode:parentCode:").concat(areaCode); } + + /** + * desc:获取分布式锁key + * @param methodName + * @return + */ + public static String getLockByMethodName(String methodName) { + if (StringUtils.isBlank(methodName)){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"参数错误"); + } + return rootPrefix.concat("lock:").concat(methodName); + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelUtils.java index 9bc34d0a39..bd5c5597c0 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelUtils.java @@ -11,12 +11,13 @@ package com.epmet.commons.tools.utils; import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; -import com.epmet.commons.tools.utils.excel.ExportMultiView; +import com.epmet.commons.tools.utils.poi.excel.EasyPoiExcelExportStylerImpl; +import com.epmet.commons.tools.utils.poi.excel.ExportMultiView; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.springframework.beans.BeanUtils; -import org.springframework.util.CollectionUtils; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; @@ -30,6 +31,7 @@ import java.util.*; * @author Mark sunlightcs@gmail.com * @since 1.0.0 */ +@Slf4j public class ExcelUtils { /** @@ -47,15 +49,16 @@ public class ExcelUtils { fileName = DateUtils.format(new Date()); } - Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), pojoClass, list); + ExportParams exportParams = new ExportParams(); + //设置导出的样式 + exportParams.setStyle(EasyPoiExcelExportStylerImpl.class); + //设置sheet名称 + exportParams.setSheetName("Sheet1"); + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, pojoClass, list); Sheet sheet1 = workbook.getSheetAt(0); sheet1.setDefaultColumnWidth(50*256); - sheet1.setDefaultRowHeight((short)(2*256)); - response.setCharacterEncoding("UTF-8"); - response.setHeader("content-Type", "application/vnd.ms-excel"); - response.setHeader("Content-Disposition", - "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8") + ".xls"); - ServletOutputStream out = response.getOutputStream(); + //sheet1.setDefaultRowHeight((short)(2*256)); + ServletOutputStream out = ExcelUtils.getOutputStreamForExcel(fileName,response); workbook.write(out); out.flush(); out.close(); @@ -81,47 +84,9 @@ public class ExcelUtils { exportExcel(response, fileName, targetList, targetClass); } - public static void exportExcelToTargetDisposeAll(HttpServletResponse response, String fileName, Collection sourceList, - Class targetClass) throws Exception { - if (!CollectionUtils.isEmpty(sourceList)){ - List targetList = new ArrayList<>(sourceList.size()); - for(Object source : sourceList){ - Object target = targetClass.newInstance(); - BeanUtils.copyProperties(source, target); - targetList.add(target); - } - exportExcelDispose(response, fileName, targetList, targetClass); - }else { - exportExcelDispose(response, fileName, new ArrayList<>(), targetClass); - } - - - } - - public static void exportExcelDispose(HttpServletResponse response, String fileName, Collection list, - Class pojoClass) throws IOException { - if(StringUtils.isBlank(fileName)){ - //当前日期 - fileName = DateUtils.format(new Date()); - } - ExportParams params = new ExportParams(fileName,fileName); - Workbook workbook = ExcelExportUtil.exportExcel(params, pojoClass, list); - Sheet sheet1 = workbook.getSheetAt(0); - sheet1.setDefaultColumnWidth(50*256); - sheet1.setDefaultRowHeight((short)(2*256)); - response.setCharacterEncoding("UTF-8"); - response.setHeader("content-Type", "application/vnd.ms-excel"); - fileName = fileName + ".xls"; - response.setHeader("Content-Disposition", - "attachment;filename=" +fileName); - ServletOutputStream out = response.getOutputStream(); - workbook.write(out); - out.flush(); - out.close(); - } - public static ServletOutputStream getOutputStreamForExcel(String fileName, HttpServletResponse response) throws Exception { + public static ServletOutputStream getOutputStreamForExcel(String fileName, HttpServletResponse response) throws IOException { fileName = URLEncoder.encode(fileName, "UTF-8"); - if (!fileName.endsWith(".xls") ||!fileName.endsWith(".xlsx")){ + if (!fileName.endsWith(".xls") && !fileName.endsWith(".xlsx")){ fileName = fileName + ".xlsx"; } response.setContentType("application/vnd.ms-excel"); diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/EasyPoiExcelExportStylerImpl.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/EasyPoiExcelExportStylerImpl.java new file mode 100644 index 0000000000..b1a5606c2e --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/EasyPoiExcelExportStylerImpl.java @@ -0,0 +1,93 @@ +package com.epmet.commons.tools.utils.poi.excel; + + +import cn.afterturn.easypoi.excel.export.styler.AbstractExcelExportStyler; +import cn.afterturn.easypoi.excel.export.styler.IExcelExportStyler; +import org.apache.poi.ss.usermodel.*; + + +/** + * desc:easypoi自定义表头颜色 + * + * @author: LiuJanJun + * @date: 2022/4/8 4:39 下午 + * @version: 1.0 + */ +public class EasyPoiExcelExportStylerImpl extends AbstractExcelExportStyler + implements IExcelExportStyler { + public EasyPoiExcelExportStylerImpl(Workbook workbook) { + super.createStyles(workbook); + } + + @Override + public CellStyle getTitleStyle(short color) { + CellStyle titleStyle = workbook.createCellStyle(); + Font font = this.workbook.createFont(); + // 字体加粗 + font.setBold(true); + font.setFontHeightInPoints((short) 12); + titleStyle.setFont(font); + //居中 + titleStyle.setAlignment(HorizontalAlignment.CENTER); + //垂直居中 + titleStyle.setVerticalAlignment(VerticalAlignment.CENTER); + //设置颜色 + titleStyle.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex()); + titleStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); + titleStyle.setBorderRight(BorderStyle.THIN); + titleStyle.setBorderLeft(BorderStyle.THIN); + titleStyle.setBorderBottom(BorderStyle.THIN); + titleStyle.setBorderTop(BorderStyle.THIN); + titleStyle.setWrapText(true); + return titleStyle; + } + + @Override + public CellStyle getHeaderStyle(short color) { + CellStyle titleStyle = workbook.createCellStyle(); + Font font = workbook.createFont(); + font.setFontHeightInPoints((short) 12); + titleStyle.setFont(font); + titleStyle.setAlignment(HorizontalAlignment.CENTER); + titleStyle.setVerticalAlignment(VerticalAlignment.CENTER); + return null; + } + + /** + * desc:隔行样式 + * @param workbook + * @param isWarp + * @return + */ + @Override + public CellStyle stringNoneStyle(Workbook workbook, boolean isWarp) { + CellStyle style = workbook.createCellStyle(); + //style.setAlignment(HorizontalAlignment.CENTER); + style.setVerticalAlignment(VerticalAlignment.CENTER); + style.setDataFormat(STRING_FORMAT); + if (isWarp) { + style.setWrapText(true); + } + + return style; + } + + /** + * desc:隔行样式 + * @param workbook + * @param isWarp + * @return + */ + @Override + public CellStyle stringSeptailStyle(Workbook workbook, boolean isWarp) { + CellStyle style = workbook.createCellStyle(); + //style.setAlignment(HorizontalAlignment.CENTER); + style.setVerticalAlignment(VerticalAlignment.CENTER); + style.setDataFormat(STRING_FORMAT); + if (isWarp) { + style.setWrapText(true); + } + return style; + } + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/excel/ExportMultiView.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/ExportMultiView.java similarity index 91% rename from epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/excel/ExportMultiView.java rename to epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/ExportMultiView.java index ff69b2c4b0..6169e83075 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/excel/ExportMultiView.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/ExportMultiView.java @@ -1,4 +1,4 @@ -package com.epmet.commons.tools.utils.excel; +package com.epmet.commons.tools.utils.poi.excel; import cn.afterturn.easypoi.excel.entity.ExportParams; import lombok.AllArgsConstructor; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/FreezeAndFilter.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/FreezeAndFilter.java new file mode 100644 index 0000000000..6b5d5e55c5 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/FreezeAndFilter.java @@ -0,0 +1,46 @@ +package com.epmet.commons.tools.utils.poi.excel; + +/** + * desc:easyExcel 冻结标题 + * + * @author: LiuJanJun + * @date: 2022/4/11 10:27 上午 + * @version: 1.0 + */ + +import com.alibaba.excel.write.handler.SheetWriteHandler; +import com.alibaba.excel.write.metadata.holder.WriteSheetHolder; +import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.util.CellRangeAddress; + + +public class FreezeAndFilter implements SheetWriteHandler { + + public int colSplit = 0, rowSplit = 1, leftmostColumn = 0, topRow = 1; + public String autoFilterRange = "1:1"; + private boolean isFilter; + + public FreezeAndFilter() { + + } + public FreezeAndFilter(boolean isFilter) { + this.isFilter = isFilter; + } + + @Override + public void beforeSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) { + + } + + @Override + public void afterSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) { + Sheet sheet = writeSheetHolder.getSheet(); + sheet.createFreezePane(colSplit, rowSplit, leftmostColumn, topRow); + //不让他筛选 + if (isFilter){ + sheet.setAutoFilter(CellRangeAddress.valueOf(autoFilterRange)); + } + } +} + diff --git a/epmet-gateway/deploy/docker-compose-prod.yml b/epmet-gateway/deploy/docker-compose-prod.yml index 4edd602d7a..49094f4521 100644 --- a/epmet-gateway/deploy/docker-compose-prod.yml +++ b/epmet-gateway/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-gateway-server: container_name: epmet-gateway-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-gateway:0.3.71 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-gateway:version_placeholder ports: - "8080:8080" network_mode: host # 使用现有网络 diff --git a/epmet-module/data-aggregator/data-aggregator-server/deploy/docker-compose-prod.yml b/epmet-module/data-aggregator/data-aggregator-server/deploy/docker-compose-prod.yml index 4060745034..3576fadb73 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/deploy/docker-compose-prod.yml +++ b/epmet-module/data-aggregator/data-aggregator-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: data-aggregator-server: container_name: data-aggregator-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/data-aggregator-server:0.3.92 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/data-aggregator-server:version_placeholder ports: - "8114:8114" network_mode: host # 使用现有网络 diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java index e55db49a65..cd77750bee 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java @@ -11,7 +11,7 @@ import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.ExcelUtils; -import com.epmet.commons.tools.utils.excel.ExportMultiView; +import com.epmet.commons.tools.utils.poi.excel.ExportMultiView; import com.epmet.dataaggre.constant.DataSourceConstant; import com.epmet.dataaggre.constant.OrgConstant; import com.epmet.dataaggre.dao.datastats.DataStatsDao; diff --git a/epmet-module/data-report/data-report-server/deploy/docker-compose-prod.yml b/epmet-module/data-report/data-report-server/deploy/docker-compose-prod.yml index 7e1e17409e..42714f4238 100644 --- a/epmet-module/data-report/data-report-server/deploy/docker-compose-prod.yml +++ b/epmet-module/data-report/data-report-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: data-report-server: container_name: data-report-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/data-report-server:0.3.210 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/data-report-server:version_placeholder ports: - "8108:8108" network_mode: host # 使用现有网络 diff --git a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml index a54a0348a6..78a46c8117 100644 --- a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml +++ b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: data-statistical-server: container_name: data-statistical-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/data-statistical-server:0.3.345 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/data-statistical-server:version_placeholder ports: - "8108:8108" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-activiti/epmet-activiti-server/deploy/docker-compose-prod.yml b/epmet-module/epmet-activiti/epmet-activiti-server/deploy/docker-compose-prod.yml index c6d7c0d65c..12ab635118 100644 --- a/epmet-module/epmet-activiti/epmet-activiti-server/deploy/docker-compose-prod.yml +++ b/epmet-module/epmet-activiti/epmet-activiti-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-activiti-server: container_name: epmet-activiti-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-activiti-server:0.3.1 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-activiti-server:version_placeholder ports: - "8086:8086" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java index e15f7f5057..e6e567c43b 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java @@ -22,6 +22,10 @@ public interface ImportTaskConstants { * 核酸检测 */ String BIZ_TYPE_IC_NAT = "ic_nat"; + /** + * 疫苗接种 + */ + String BIZ_TYPE_IC_VACCINE = "ic_vaccine"; /** * 行程上报 */ diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java index 7dc71f336e..4214e77cf8 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java @@ -22,7 +22,7 @@ import java.util.Map; * @date 2020/6/4 10:28 */ @FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallbackFactory = EpmetCommonServiceOpenFeignClientFallbackFactory.class) - //@FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallbackFactory = EpmetCommonServiceOpenFeignClientFallbackFactory.class, url = "http://192.168.1.132:8103") + //@FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallbackFactory = EpmetCommonServiceOpenFeignClientFallbackFactory.class, url = "http://localhost:8103") public interface EpmetCommonServiceOpenFeignClient { /** * @param formDTO @@ -131,7 +131,7 @@ public interface EpmetCommonServiceOpenFeignClient { * @param input * @return */ - @RequestMapping("/commonservice/import-task/create") + @PostMapping("/commonservice/import-task/create") Result createImportTask(@RequestBody ImportTaskCommonFormDTO input); /** diff --git a/epmet-module/epmet-common-service/common-service-server/deploy/docker-compose-prod.yml b/epmet-module/epmet-common-service/common-service-server/deploy/docker-compose-prod.yml index 97adff5e39..ab8df1446d 100644 --- a/epmet-module/epmet-common-service/common-service-server/deploy/docker-compose-prod.yml +++ b/epmet-module/epmet-common-service/common-service-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: common-service-server: container_name: common-service-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/common-service-server:0.3.42 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/common-service-server:version_placeholder ports: - "8103:8103" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ImportTaskController.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ImportTaskController.java index 8af4083542..8b03c4465b 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ImportTaskController.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ImportTaskController.java @@ -39,7 +39,7 @@ public class ImportTaskController { * @param input * @return */ - @RequestMapping("create") + @PostMapping("create") public Result createTask(@RequestBody ImportTaskCommonFormDTO input) { ValidatorUtils.validateEntity(input, ImportTaskCommonFormDTO.Create.class); String operatorId = input.getOperatorId(); diff --git a/epmet-module/epmet-ext/epmet-ext-server/deploy/docker-compose-prod.yml b/epmet-module/epmet-ext/epmet-ext-server/deploy/docker-compose-prod.yml index caa3059dad..9c95c05818 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/deploy/docker-compose-prod.yml +++ b/epmet-module/epmet-ext/epmet-ext-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-ext-server: container_name: epmet-ext-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-ext-server:0.0.20 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-ext-server:version_placeholder ports: - "8113:8113" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-heart/epmet-heart-server/deploy/docker-compose-prod.yml b/epmet-module/epmet-heart/epmet-heart-server/deploy/docker-compose-prod.yml index d1ccbc081a..40df63bc4c 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/deploy/docker-compose-prod.yml +++ b/epmet-module/epmet-heart/epmet-heart-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-heart-server: container_name: epmet-heart-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-heart-server:0.0.72 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-heart-server:version_placeholder ports: - "8111:8111" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-prod.yml b/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-prod.yml index b1813f2660..6bffd4ae87 100644 --- a/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-prod.yml +++ b/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-job-server: container_name: epmet-job-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-job-server:0.3.47 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-job-server:version_placeholder ports: - "8084:8084" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-prod.yml b/epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-prod.yml index 01efd03422..121ed15355 100644 --- a/epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-prod.yml +++ b/epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-message-server: container_name: epmet-message-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-message-server:0.3.57 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-message-server:version_placeholder ports: - "8085:8085" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-prod.yml b/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-prod.yml index c839bb22b4..4f1e024566 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-prod.yml +++ b/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-oss-server: container_name: epmet-oss-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-oss-server:0.3.40 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-oss-server:version_placeholder ports: - "8083:8083" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-prod.yml b/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-prod.yml index d4ea51ca74..de8dc52452 100644 --- a/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-prod.yml +++ b/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-point-server: container_name: epmet-point-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-point-server:0.0.63 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-point-server:version_placeholder ports: - "8112:8112" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/BackDoorController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/BackDoorController.java index 047ae55ce6..f5f762838b 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/BackDoorController.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/BackDoorController.java @@ -44,7 +44,8 @@ public class BackDoorController { * @param customerId * @return */ - @GetMapping(value = "initpointrule") + //@GetMapping(value = "initpointrule") + @RequestMapping(value = "initpointrule", method = {RequestMethod.POST, RequestMethod.GET}) public Result initPointRule(@RequestParam(required = false) String customerId) { InitPointRuleResultDTO resultDTO = pointRuleService.initPointRule(customerId); return new Result().ok(resultDTO); diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-prod.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-prod.yml index 7a2eb84297..04d9efb87a 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-prod.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-third-server:0.0.183 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-third-server:version_placeholder ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-access/gov-access-server/deploy/docker-compose-prod.yml b/epmet-module/gov-access/gov-access-server/deploy/docker-compose-prod.yml index 9d6e4d7ae6..208783e787 100644 --- a/epmet-module/gov-access/gov-access-server/deploy/docker-compose-prod.yml +++ b/epmet-module/gov-access/gov-access-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-access-server: container_name: gov-access-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-access-server:0.3.61 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-access-server:version_placeholder ports: - "8099:8099" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-grid/gov-grid-server/deploy/docker-compose-prod.yml b/epmet-module/gov-grid/gov-grid-server/deploy/docker-compose-prod.yml index 8401604cf7..b47e7b1ed2 100644 --- a/epmet-module/gov-grid/gov-grid-server/deploy/docker-compose-prod.yml +++ b/epmet-module/gov-grid/gov-grid-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-grid-server: container_name: gov-grid-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-grid-server:0.3.49 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-grid-server:version_placeholder ports: - "8097:8097" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-prod.yml b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-prod.yml index 8105b3917f..b11be53989 100644 --- a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-prod.yml +++ b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-issue-server: container_name: gov-issue-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-issue-server:0.3.100 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-issue-server:version_placeholder ports: - "8101:8101" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-prod.yml b/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-prod.yml index 9e3c87d67b..c1883ae965 100644 --- a/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-prod.yml +++ b/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-mine-server: container_name: gov-mine-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-mine-server:0.3.47 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-mine-server:version_placeholder ports: - "8098:8098" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-prod.yml b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-prod.yml index 25ea20b467..c0ee252ff0 100644 --- a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-prod.yml +++ b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-org-server: container_name: gov-org-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-org-server:0.3.156 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-org-server:version_placeholder ports: - "8092:8092" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java index 394448e623..fca09fe069 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java @@ -29,7 +29,6 @@ import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.constant.ImportErrorMsgConstants; import com.epmet.constants.ImportTaskConstants; import com.epmet.dao.IcBuildingUnitDao; import com.epmet.dto.BuildingTreeLevelDTO; @@ -42,8 +41,6 @@ import com.epmet.entity.IcBuildingUnitEntity; import com.epmet.excel.IcBuildingExcel; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.service.BuildingService; -import com.epmet.service.IcBuildingService; -import com.epmet.service.NeighborHoodService; import com.epmet.util.ExcelPoiUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -118,7 +115,7 @@ public class BuildingController { @PostMapping("treelist") public Result treeList(@LoginUser TokenDto tokenDTO){ - List buildingTreeLevelDTOS =buildingService.treeList(tokenDTO.getUserId()); + List buildingTreeLevelDTOS =buildingService.treeList(tokenDTO.getCustomerId(), tokenDTO.getUserId()); return new Result().ok(buildingTreeLevelDTOS); } /** diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java index c9144ef5ff..d3bd8dc768 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java @@ -228,6 +228,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener treeList(String customerId); + List treeList(String customerId, String staffId); List importExcel(String customerId, List list, String staffId, List numList); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java index 28baadf38f..04670fde28 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java @@ -13,45 +13,37 @@ 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; -import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; 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.constant.ImportErrorMsgConstants; import com.epmet.constants.ImportTaskConstants; import com.epmet.dao.*; import com.epmet.dto.BuildingTreeLevelDTO; -import com.epmet.dto.CustomerStaffAgencyDTO; import com.epmet.dto.IcBuildingDTO; import com.epmet.dto.form.IcBulidingFormDTO; import com.epmet.dto.form.ImportInfoFormDTO; import com.epmet.dto.form.ImportTaskCommonFormDTO; import com.epmet.dto.form.ListIcNeighborHoodFormDTO; -import com.epmet.dto.result.*; +import com.epmet.dto.result.BuildingResultDTO; +import com.epmet.dto.result.BuildingResultPagedDTO; +import com.epmet.dto.result.IcNeighborHoodResultDTO; +import com.epmet.dto.result.ImportTaskCommonResultDTO; import com.epmet.entity.*; import com.epmet.enums.BuildingTypeEnums; import com.epmet.excel.IcBuildingExcel; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.model.BuildingInfoModel; -import com.epmet.model.HouseInfoModel; import com.epmet.model.ImportBuildingInfoListener; import com.epmet.redis.IcHouseRedis; import com.epmet.service.*; -import com.epmet.service.BuildingService; -import com.epmet.service.IcBuildingService; -import com.epmet.service.IcBuildingUnitService; -import com.epmet.service.IcHouseService; import com.epmet.util.ExcelPoiUtils; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Async; -import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; -import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; @@ -128,8 +120,8 @@ public class BuildingServiceImpl implements BuildingService { } @Override - public List treeList(String staffId) { - CustomerStaffAgencyDTO agency = customerStaffAgencyDao.selectLatestCustomerByStaff(staffId); + public List treeList(String customerId, String staffId) { + CustomerStaffInfoCacheResult agency = CustomerStaffRedis.getStaffInfo(customerId, staffId); if(null == agency || StringUtils.isBlank(agency.getAgencyId())){ log.error("com.epmet.service.impl.BuildingServiceImpl.treeList,没有找到工作人员所属的机关信息,用户Id:{}",staffId); return new ArrayList<>(); @@ -163,7 +155,7 @@ public class BuildingServiceImpl implements BuildingService { //2.获取组织所在网格 - List agencyIdList = customerAgencyList.stream().map(a->a.getId()).collect(Collectors.toList()); + List agencyIdList = customerAgencyList.stream().map(BaseEpmetEntity::getId).collect(Collectors.toList()); // agencyIdList.add(customerAgency.getId()); List customerGridList = customerGridDao.selectList(new QueryWrapper().lambda().in(CustomerGridEntity::getPid, agencyIdList)); @@ -222,8 +214,12 @@ public class BuildingServiceImpl implements BuildingService { agencyList.addAll(neighbourHoodList); return covertToTree(customerAgency,agencyList); } + //获取楼里已经有多少个房屋 + LambdaQueryWrapper icHouseEntityWrapper = new QueryWrapper().lambda() + .in(IcHouseEntity::getNeighborHoodId, neighborHoodIdList); + List buildingHouseCount = icHouseDao.selectList(icHouseEntityWrapper); + Map buildingHouseCountMap = buildingHouseCount.stream().collect(Collectors.groupingBy(IcHouseEntity::getBuildingId, Collectors.counting())); //组合封装 - List buildingList = icBuildingList.stream().map(item -> { BuildingTreeLevelDTO buildingTreeLevelDTO = new BuildingTreeLevelDTO(); buildingTreeLevelDTO.setId(item.getId()); @@ -246,9 +242,10 @@ public class BuildingServiceImpl implements BuildingService { //02.11 之前录入的户数概念改为总户数,无需计算直接用就可以了 Integer total = null == item.getTotalHouseNum() ? NumConstant.ZERO : item.getTotalHouseNum(); //已经添加了多少户 - LambdaQueryWrapper icHouseEntityWrapper = new QueryWrapper().lambda() - .in(IcHouseEntity::getBuildingId, item.getId()); - int count= icHouseDao.selectCount(icHouseEntityWrapper); +// LambdaQueryWrapper icHouseEntityWrapper = new QueryWrapper().lambda() +// .in(IcHouseEntity::getBuildingId, item.getId()); +// int count= icHouseDao.selectCount(icHouseEntityWrapper); + int count = buildingHouseCountMap.getOrDefault(item.getId(), NumConstant.ZERO_L).intValue(); if(NumConstant.ZERO==total){ buildingTreeLevelDTO.setShowNum(String.format("%s/%s",count,count)); }else{ diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml b/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml index c3883055da..5a6a066a1b 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml @@ -79,6 +79,13 @@ spring: namespace: @nacos.config.namespace@ group: @nacos.config.group@ file-extension: yaml + + servlet: +# 上传文件限制 + multipart: + max-file-size: 100MB + max-request-size: 100MB + management: endpoints: web: diff --git a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-prod.yml b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-prod.yml index fb855657d2..75a8f44f2e 100644 --- a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-prod.yml +++ b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-project-server: container_name: gov-project-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-project-server:0.3.96 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-project-server:version_placeholder ports: - "8102:8102" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-prod.yml b/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-prod.yml index d5a6908cd6..dc5e5818f0 100644 --- a/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-prod.yml +++ b/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-voice-server: container_name: gov-voice-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-voice-server:0.3.78 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-voice-server:version_placeholder ports: - "8105:8105" network_mode: host # 使用现有网络 diff --git a/epmet-module/open-data-worker/open-data-worker-server/deploy/docker-compose-prod.yml b/epmet-module/open-data-worker/open-data-worker-server/deploy/docker-compose-prod.yml index bc90323bc3..ab0a79aa2e 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/deploy/docker-compose-prod.yml +++ b/epmet-module/open-data-worker/open-data-worker-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-voice-server: container_name: open-data-worker-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/open-data-worker-server:0.3.22 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/open-data-worker-server:version_placeholder ports: - "8117:8117" network_mode: host # 使用现有网络 diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/OpenDataApplication.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/OpenDataApplication.java index 532877cf4b..c786abb9ba 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/OpenDataApplication.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/OpenDataApplication.java @@ -5,7 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.openfeign.EnableFeignClients; -import org.springframework.context.annotation.ComponentScan; +import org.springframework.scheduling.annotation.EnableScheduling; /** * @Description OpenData服务启动类 @@ -14,6 +14,7 @@ import org.springframework.context.annotation.ComponentScan; * @author wxz * @date 2021.10.13 15:16:05 */ +@EnableScheduling @SpringBootApplication @EnableDiscoveryClient @EnableFeignClients diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GriderOnlineNumDao.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GriderOnlineNumDao.java new file mode 100644 index 0000000000..9f4080c054 --- /dev/null +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GriderOnlineNumDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.opendata.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.opendata.entity.GriderOnlineNumEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 在线网格员人数 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-14 + */ +@Mapper +public interface GriderOnlineNumDao extends BaseDao { + +} diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/GriderOnlineNumEntity.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/GriderOnlineNumEntity.java new file mode 100644 index 0000000000..ca707865cf --- /dev/null +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/GriderOnlineNumEntity.java @@ -0,0 +1,61 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.opendata.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 用户巡查主记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-14 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("grider_online_num") +public class GriderOnlineNumEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + private String qxGridId; + + /** + * 推送时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date pushTime; + + /** + * 在线数 + */ + private Integer onlineNum; + + + +} diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/GriderOnlineNumService.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/GriderOnlineNumService.java new file mode 100644 index 0000000000..55112c1d8d --- /dev/null +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/GriderOnlineNumService.java @@ -0,0 +1,38 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.opendata.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.opendata.entity.GriderOnlineNumEntity; + +/** + * 用户巡查主记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-14 + */ +public interface GriderOnlineNumService extends BaseService { + + /** + * desc:插入巡查中的网格员数据 + * @return boolean + */ + Boolean insertData(String agencyId); + + +} diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GriderOnlineNumServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GriderOnlineNumServiceImpl.java new file mode 100644 index 0000000000..b024c1436e --- /dev/null +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GriderOnlineNumServiceImpl.java @@ -0,0 +1,69 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.opendata.service.impl; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.PatrolCountFormDTO; +import com.epmet.dto.result.PatrolCountResultDTO; +import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.opendata.dao.GriderOnlineNumDao; +import com.epmet.opendata.entity.GriderOnlineNumEntity; +import com.epmet.opendata.service.GriderOnlineNumService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; + + +/** + * 用户巡查主记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-14 + */ +@Slf4j +@Service +public class GriderOnlineNumServiceImpl extends BaseServiceImpl implements GriderOnlineNumService { +@Autowired +private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + @Override + public Boolean insertData(String agencyId) { + PatrolCountFormDTO param = new PatrolCountFormDTO(); + param.setAgencyId(agencyId); + Result patrolCountResult = epmetUserOpenFeignClient.patrolCount(param); + + log.debug("insertData patrolCountResult return:{}", JSON.toJSONString(patrolCountResult)); + if (patrolCountResult == null || !patrolCountResult.success()) { + log.warn("insertData patrolCount fail,return null"); + return false; + } + PatrolCountResultDTO data = patrolCountResult.getData(); + int count = data.getPatrollingCount() == null ? NumConstant.ZERO : data.getPatrollingCount(); + GriderOnlineNumEntity entity = new GriderOnlineNumEntity(); + entity.setCustomerId(StrConstant.PY_CUSTOMER); + entity.setPushTime(new Date()); + entity.setOnlineNum(count); + baseDao.insert(entity); + return true; + } +} diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/task/ExtractBizDataToOpenData.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/task/ExtractBizDataToOpenData.java new file mode 100644 index 0000000000..ebcd5aa27d --- /dev/null +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/task/ExtractBizDataToOpenData.java @@ -0,0 +1,71 @@ +package com.epmet.opendata.task; + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.distributedlock.DistributedLock; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.opendata.service.GriderOnlineNumService; +import lombok.extern.slf4j.Slf4j; +import org.redisson.api.RLock; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.util.Date; + +/** + * desc: + * + * @author: LiuJanJun + * @date: 2022/4/12 4:21 下午 + * @version: 1.0 + */ +@Slf4j +@Component +public class ExtractBizDataToOpenData { + + @Autowired + private DistributedLock distributedLock; + + @Autowired + private GriderOnlineNumService griderOnlineNumService; + + @Scheduled(cron = "0 30 */2 * * *") + //@Scheduled(cron = "0/15 * * * * *") + public void extractGridMemberPatrollingCount() { + String currentTime = DateUtils.format(new Date(), DateUtils.DATE_TIME_PATTERN); + log.info("extractGridMemberPatrollingCount start,date:{}", currentTime); + RLock rLock = null; + try { + rLock = distributedLock.tryLock(RedisKeys.getLockByMethodName("extractGridMemberPatrollingCount")); + if (rLock == null || !rLock.isLocked()) { + log.warn("tryLock method extractGridMemberPatrollingCount fail"); + return; + } + boolean patrolCountResult; + int retryTime = NumConstant.THREE; + do { + //StrConstant.PY_ROOT_AGENCY + patrolCountResult = griderOnlineNumService.insertData(StrConstant.PY_ROOT_AGENCY); + if (!patrolCountResult) { + break; + } + //如果 重试次数为1了 就让歇个 5分钟 + if (retryTime == 1) { + Thread.sleep(NumConstant.FIVE * NumConstant.SIXTY * NumConstant.ONE_THOUSAND); + } + } while (retryTime-- > 0); + if (!patrolCountResult) { + log.error("插入网格员在线人数失败,请检查原因,时间:{}", currentTime); + } + + } catch (Exception e) { + log.warn("tryLock method extractGridMemberPatrollingCount fail"); + } finally { + distributedLock.unLock(rLock); + } + log.info("extractGridMemberPatrollingCount end"); + } + +} diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/db/migration/V0.0.1__add_grider_online_num.sql b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/db/migration/V0.0.1__add_grider_online_num.sql new file mode 100644 index 0000000000..d4fd9ca93f --- /dev/null +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/db/migration/V0.0.1__add_grider_online_num.sql @@ -0,0 +1,13 @@ +CREATE TABLE `grider_online_num` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id', + `ONLINE_NUM` int(11) NOT NULL COMMENT '在线人数', + `PUSH_TIME` datetime NOT NULL COMMENT '推送时间', + `DEL_FLAG` bigint(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0.未删除 1.已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='网格员在线人数'; diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GriderOnlineNumDao.xml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GriderOnlineNumDao.xml new file mode 100644 index 0000000000..27c636d525 --- /dev/null +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GriderOnlineNumDao.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/epmet-module/oper-access/oper-access-server/deploy/docker-compose-prod.yml b/epmet-module/oper-access/oper-access-server/deploy/docker-compose-prod.yml index 2d0c1631c4..eb87408016 100644 --- a/epmet-module/oper-access/oper-access-server/deploy/docker-compose-prod.yml +++ b/epmet-module/oper-access/oper-access-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: oper-access-server: container_name: oper-access-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/oper-access-server:0.3.24 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/oper-access-server:version_placeholder ports: - "8093:8093" network_mode: host # 使用现有网络 diff --git a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-prod.yml b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-prod.yml index 9cc48783a1..cb05ebd8f2 100644 --- a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-prod.yml +++ b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: oper-crm-server: container_name: oper-crm-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/oper-crm-server:0.3.87 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/oper-crm-server:version_placeholder ports: - "8090:8090" network_mode: host # 使用现有网络 diff --git a/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-prod.yml b/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-prod.yml index 88f8deb3ed..11022f5b5b 100644 --- a/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-prod.yml +++ b/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: oper-customize-server: container_name: oper-customize-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/oper-customize-server:0.3.66 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/oper-customize-server:version_placeholder ports: - "8089:8089" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-group/resi-group-server/deploy/docker-compose-prod.yml b/epmet-module/resi-group/resi-group-server/deploy/docker-compose-prod.yml index 354d8b1daa..c2d1f70171 100644 --- a/epmet-module/resi-group/resi-group-server/deploy/docker-compose-prod.yml +++ b/epmet-module/resi-group/resi-group-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-group-server: container_name: resi-group-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/resi-group-server:0.3.130 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/resi-group-server:version_placeholder ports: - "8095:8095" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-prod.yml b/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-prod.yml index 0405bc5164..5cad88228d 100644 --- a/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-prod.yml +++ b/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-guide-server: container_name: resi-guide-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/resi-guide-server:0.3.34 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/resi-guide-server:version_placeholder ports: - "8091:8091" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-hall/resi-hall-server/deploy/docker-compose-prod.yml b/epmet-module/resi-hall/resi-hall-server/deploy/docker-compose-prod.yml index 6ae227458d..11b8c09a2f 100644 --- a/epmet-module/resi-hall/resi-hall-server/deploy/docker-compose-prod.yml +++ b/epmet-module/resi-hall/resi-hall-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-hall-server: container_name: resi-hall-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/resi-hall-server:0.3.36 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/resi-hall-server:version_placeholder ports: - "8100:8100" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-home/resi-home-server/deploy/docker-compose-prod.yml b/epmet-module/resi-home/resi-home-server/deploy/docker-compose-prod.yml index 9a31b60a8d..d93cc35e88 100644 --- a/epmet-module/resi-home/resi-home-server/deploy/docker-compose-prod.yml +++ b/epmet-module/resi-home/resi-home-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-home-server: container_name: resi-home-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/resi-home-server:0.3.23 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/resi-home-server:version_placeholder ports: - "8104:8104" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-prod.yml b/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-prod.yml index 98ef0ddad1..fb4fb7fd26 100644 --- a/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-prod.yml +++ b/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-mine-server: container_name: resi-mine-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/resi-mine-server:0.3.54 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/resi-mine-server:version_placeholder ports: - "8094:8094" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-partymember/resi-partymember-server/deploy/docker-compose-prod.yml b/epmet-module/resi-partymember/resi-partymember-server/deploy/docker-compose-prod.yml index 253215b123..593f8d4709 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/deploy/docker-compose-prod.yml +++ b/epmet-module/resi-partymember/resi-partymember-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-partymember-server: container_name: resi-partymember-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/resi-partymember-server:0.3.83 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/resi-partymember-server:version_placeholder ports: - "8096:8096" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-voice/resi-voice-server/deploy/docker-compose-prod.yml b/epmet-module/resi-voice/resi-voice-server/deploy/docker-compose-prod.yml index ed0013dad4..3375e0d198 100644 --- a/epmet-module/resi-voice/resi-voice-server/deploy/docker-compose-prod.yml +++ b/epmet-module/resi-voice/resi-voice-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-voice-server: container_name: resi-voice-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/resi-voice-server:0.3.12 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/resi-voice-server:version_placeholder ports: - "8106:8106" network_mode: host # 使用现有网络 diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml index 3254a018e6..2be1100292 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-openapi-scan:0.3.32 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-openapi-scan:version_placeholder ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcEpidemicSpecialAttentionDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcEpidemicSpecialAttentionDTO.java index 8234693f38..21499eef9a 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcEpidemicSpecialAttentionDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcEpidemicSpecialAttentionDTO.java @@ -4,8 +4,11 @@ import java.io.Serializable; import java.util.Date; import java.util.List; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; +import org.hibernate.validator.constraints.Length; +import javax.validation.constraints.Max; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; @@ -21,8 +24,8 @@ public class IcEpidemicSpecialAttentionDTO implements Serializable { private static final long serialVersionUID = 1L; - public interface IcEpidemicSpecialAttentionUpdate{} - public interface IcEpidemicSpecialAttentionAdd{} + public interface IcEpidemicSpecialAttentionUpdate extends CustomerClientShowGroup {} + public interface IcEpidemicSpecialAttentionAdd extends CustomerClientShowGroup {} /** * ID @@ -81,12 +84,14 @@ public class IcEpidemicSpecialAttentionDTO implements Serializable { /** * 原因 */ - private String reason; + @Length(max = 500,message = "原因限制500字以内",groups = {IcEpidemicSpecialAttentionAdd.class,IcEpidemicSpecialAttentionUpdate.class}) + private String reason; /** * 备注 */ - private String remark; + @Length(max = 500,message = "备注限制500字以内",groups = {IcEpidemicSpecialAttentionAdd.class,IcEpidemicSpecialAttentionUpdate.class}) + private String remark; /** * @@ -126,6 +131,7 @@ public class IcEpidemicSpecialAttentionDTO implements Serializable { /** * 通知内容 */ + @Length(max = 500,message = "通知内容限制500字以内",groups = {IcEpidemicSpecialAttentionAdd.class,IcEpidemicSpecialAttentionUpdate.class}) private String content; } \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java index 47d23549da..19c09dc284 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java @@ -212,7 +212,7 @@ public class IcTripReportRecordDTO implements Serializable { @ExcelIgnore private Boolean heSuanCheck; - @ColumnWidth(20) + @ColumnWidth(25) @ExcelProperty("核算检测关注名单") private String heSuanCheckDesc; -} \ No newline at end of file +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcVaccineDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcVaccineDTO.java new file mode 100644 index 0000000000..73a5d69fe0 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcVaccineDTO.java @@ -0,0 +1,119 @@ +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 疫苗接种记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-06 + */ +@Data +public class IcVaccineDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 客户Id customer.id + */ + private String customerId; + + /** + * 姓名 + */ + private String name; + + /** + * 手机号 + */ + private String mobile; + + /** + * 身份证号 + */ + private String idCard; + + /** + * 是否客户下居民(0:否 1:是) + */ + private String isResiUser; + + /** + * 数据来源【导入的:import;】 + */ + private String userType; + + /** + * 接种时间 + */ + private Date inoculateTime; + + /** + * 接种地点 + */ + private String inoculateAddress; + + /** + * 疫苗厂家 + */ + private String manufacturer; + + /** + * 预留字段1 + */ + private String field1; + + /** + * 预留字段2 + */ + private String field2; + + /** + * 预留字段3 + */ + private String field3; + + /** + * 备注 + */ + private String remaek; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcVaccineRelationDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcVaccineRelationDTO.java new file mode 100644 index 0000000000..3dfbaf85cd --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcVaccineRelationDTO.java @@ -0,0 +1,82 @@ +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 疫苗接种记录关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-06 + */ +@Data +public class IcVaccineRelationDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 客户Id + */ + private String customerId; + + /** + * 居民端上报时存储用户所在网格的组织id.居民信息的人存储居民所在组织id.单个新增或者导入的存储登录用户所属的组织id + */ + private String agencyId; + + /** + * 组织pids,包含当前agencyId值 + */ + private String pids; + + /** + * 疫苗记录表Id(ic_vaccine.id) + */ + private String icVaccineId; + + /** + * 关系数据的绑定途径【 +数字社区录入:icresi; +导入的:import; +同步的:synchro】 + */ + private String userType; + + /** + * 删除标识 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcNatFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcNatFormDTO.java index 9472ea4314..258f28c66b 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcNatFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcNatFormDTO.java @@ -100,6 +100,7 @@ public class AddIcNatFormDTO implements Serializable { //token中信息 private String customerId; private String staffId; + private String client; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EpidemicPreventionFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EpidemicPreventionFormDTO.java index 83d22c6a13..345d7496b0 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EpidemicPreventionFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EpidemicPreventionFormDTO.java @@ -28,6 +28,7 @@ public class EpidemicPreventionFormDTO extends PageFormDTO implements Serializab * 网格ID */ private String gridId; + private String staffId; /** * 小区ID */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiCollectMemFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiCollectMemFormDTO.java index a3fca9b02b..95ae25cd79 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiCollectMemFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiCollectMemFormDTO.java @@ -2,7 +2,6 @@ package com.epmet.dto.form; import lombok.Data; -import javax.validation.constraints.NotBlank; import java.io.Serializable; /** @@ -18,13 +17,13 @@ public class IcResiCollectMemFormDTO implements Serializable { /** * 居住成员1姓名 */ - @NotBlank(message = "姓名不能为空", groups = {ResiCollectFormDTO.InternalShowGroup.class, IcResiCollectFormDTO.ExternalShowGroup.class}) + // @NotBlank(message = "姓名不能为空", groups = {ResiCollectFormDTO.InternalShowGroup.class, IcResiCollectFormDTO.ExternalShowGroup.class}) private String name; /** * 居住成员1身份证号 */ - @NotBlank(message = "身份证号不能为空", groups = {ResiCollectFormDTO.InternalShowGroup.class, IcResiCollectFormDTO.ExternalShowGroup.class}) + // @NotBlank(message = "身份证号不能为空", groups = {ResiCollectFormDTO.InternalShowGroup.class, IcResiCollectFormDTO.ExternalShowGroup.class}) private String idNum; /** diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageTripReportFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageTripReportFormDTO.java index af23243c03..80ecb83186 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageTripReportFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageTripReportFormDTO.java @@ -1,7 +1,9 @@ package com.epmet.dto.form; import com.epmet.commons.tools.dto.form.PageFormDTO; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.util.Date; @@ -32,11 +34,13 @@ public class PageTripReportFormDTO extends PageFormDTO implements Serializable { * 来源地区名称 */ private String sourceAddress; + /** * 来到本地时间 */ - private Date startDate; - private Date endDate; + private String startDate; + + private String endDate; /** * token里设置 diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeFormDTO.java index bd24801531..7aadaf3fcb 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeFormDTO.java @@ -1,10 +1,12 @@ package com.epmet.dto.form; -import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; import lombok.NoArgsConstructor; -import javax.validation.constraints.NotNull; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; import java.io.Serializable; import java.util.List; @@ -22,22 +24,22 @@ public class SendNoticeFormDTO implements Serializable { /** * 用户列表 */ - @NotNull(message = "用户列表不能为空", groups = DefaultGroup.class) + @NotEmpty(message = "用户列表不能为空", groups = CustomerClientShowGroup.class) private List userList; /** * 通知渠道通知渠道 0小程序通知,1短信通知 */ - @NotNull(message = "通知渠道不能为空", groups = DefaultGroup.class) + @NotEmpty(message = "请选择通知渠道", groups = CustomerClientShowGroup.class) private List channel; /** * 通知来源 0 行程上报,1 疫苗接种,2 核酸检测 */ - @NotNull(message = "通知来源不能为空", groups = DefaultGroup.class) + @NotEmpty(message = "通知来源不能为空", groups = CustomerClientShowGroup.class) private String origin; /** * 通知内容 */ - @NotNull(message = "通知内容不能为空", groups = DefaultGroup.class) + @Size(min = 1, max = 500, message = "通知内容不超过500字", groups = CustomerClientShowGroup.class) private String content; /** * 组织名 diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccineListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccineListFormDTO.java new file mode 100644 index 0000000000..213c8fb9de --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccineListFormDTO.java @@ -0,0 +1,67 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @Description 疫苗接种信息查询 + * @Author sun + */ +@Data +public class VaccineListFormDTO extends PageFormDTO { + + private static final long serialVersionUID = -6809065476616323072L; + + public interface Detail extends CustomerClientShowGroup { + } + public interface Del extends CustomerClientShowGroup { + } + public interface Synchro extends CustomerClientShowGroup { + } + + /** + * 身份证号 + */ + private String idCard; + /** + * 当前组织:current 根组织:all + */ + private String searchType; + private String agencyId; + /** + * 姓名 + */ + private String name; + /** + * 手机号 + */ + private String mobile; + /** + * 是否客户下居民(0:否 1:是) + */ + private String isResiUser; + /** + * 检测开始时间yyyy-MM-dd HH:mm + */ + private String startTime; + /** + * 检测结束时间yyyy-MM-dd HH:mm间yy-mm-dd + */ + private String endTime; + + /** + * 核酸记录Id + */ + @NotBlank(message = "疫苗接种记录Id不能为空", groups = { Detail.class, Del.class, Synchro.class}) + private String icVaccineId; + + /** + * token里设置 + */ + private String customerId; + private String userId; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcVaccineListCommonExcelResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcVaccineListCommonExcelResultDTO.java new file mode 100644 index 0000000000..4c301085d9 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcVaccineListCommonExcelResultDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.result; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.annotation.write.style.HeadStyle; +import com.alibaba.excel.enums.poi.FillPatternTypeEnum; +import lombok.Data; + +/** + * @Description 疫苗接种-全局导出 + * @Author sun + */ +@HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 44) +@Data +public class IcVaccineListCommonExcelResultDTO extends IcVaccineListResultDTO{ + private static final long serialVersionUID = 1L; + + /** + * 是否客户下居民(0:否 1:是) + */ + @ColumnWidth(20) + @ExcelProperty(value = "本辖区居民",order = 6) + private String isResiUser; + + + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcVaccineListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcVaccineListResultDTO.java new file mode 100644 index 0000000000..87480268cf --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcVaccineListResultDTO.java @@ -0,0 +1,89 @@ +package com.epmet.dto.result; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.annotation.write.style.HeadStyle; +import com.alibaba.excel.enums.poi.FillPatternTypeEnum; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Description 核酸检测-我的上报记录 + * @Author sun + */ +@HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 44) +@Data +public class IcVaccineListResultDTO implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 组织Id + */ + @ExcelIgnore + private String agencyId; + @ExcelIgnore + private String vaccineId; + @ExcelIgnore + private String userId; + + /** + * 居民端小程序的人:resi;数字社区的居民:icresi;未关联上的:other + */ + @ExcelIgnore + private String userType; + + /** + * 姓名 + */ + @ColumnWidth(20) + @ExcelProperty(value = "姓名",order = 1) + private String name; + + /** + * 手机号 + */ + @ColumnWidth(20) + @ExcelProperty(value = "手机号",order = 2) + private String mobile; + + /** + * 身份证号 + */ + @ColumnWidth(25) + @ExcelProperty(value = "身份证号",order = 3) + private String idCard; + + /** + * 检测时间,yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + @ColumnWidth(25) + @ExcelProperty(value = "接种时间",order = 4) + private Date inoculateTime; + + /** + * 检测结果 + */ + @ColumnWidth(20) + @ExcelProperty(value = "接种地点",order = 5) + private String inoculateAddress; + + /** + * 是否客户下居民(0:否 1:是) + */ + @ExcelIgnore + private String isResiUser; + + /** + * 检测地点 + */ + @ColumnWidth(30) + @ExcelProperty(value = "疫苗厂家",order = 7) + private String manufacturer; + + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/MyNatListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/MyNatListResultDTO.java index feb97d97f5..355d52d213 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/MyNatListResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/MyNatListResultDTO.java @@ -67,4 +67,10 @@ public class MyNatListResultDTO implements Serializable { */ private String attachmentUrl; + /** + * 检测时间,yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date reportTime; + } diff --git a/epmet-user/epmet-user-server/deploy/docker-compose-prod.yml b/epmet-user/epmet-user-server/deploy/docker-compose-prod.yml index 1fbe59593f..3e494ca6df 100644 --- a/epmet-user/epmet-user-server/deploy/docker-compose-prod.yml +++ b/epmet-user/epmet-user-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-user-server: container_name: epmet-user-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-user-server:0.3.218 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-user-server:version_placeholder ports: - "8087:8087" network_mode: host # 不会创建新的网络 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicPreventionController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicPreventionController.java index de3612756d..c490634108 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicPreventionController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicPreventionController.java @@ -60,6 +60,7 @@ public class IcEpidemicPreventionController{ @PostMapping("page") public Result> search(@LoginUser TokenDto tokenDto, @RequestBody EpidemicPreventionFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); PageData result = icResiUserService.epidemicPreventionList(formDTO); return new Result>().ok(result); } @@ -67,6 +68,7 @@ public class IcEpidemicPreventionController{ @PostMapping("user-list") public Result> userList(@LoginUser TokenDto tokenDto, @RequestBody EpidemicPreventionFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); PageData result = icResiUserService.userList(formDTO); return new Result>().ok(result); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcFollowUpRecordController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcFollowUpRecordController.java index 7b0b375207..b3ed2ab6d8 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcFollowUpRecordController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcFollowUpRecordController.java @@ -12,6 +12,7 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.poi.excel.FreezeAndFilter; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.DefaultGroup; @@ -115,7 +116,7 @@ public class IcFollowUpRecordController { String today= DateUtils.format(new Date(),DateUtils.DATE_PATTERN_MMDD); String fileName = formDTO.getName().concat("随访记录").concat(today).concat(".xlsx"); excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcFollowUpRecordDTO.class).build(); - WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").build(); + WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); PageData data = null; do { data = icFollowUpRecordService.page(formDTO); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java index 22610aa6b8..17502c65e0 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java @@ -15,6 +15,7 @@ import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.*; +import com.epmet.commons.tools.utils.poi.excel.FreezeAndFilter; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.constants.ImportTaskConstants; import com.epmet.dto.IcNatDTO; @@ -89,6 +90,7 @@ public class IcNatController implements ResultDataResolver { ValidatorUtils.validateEntity(formDTO, AddIcNatFormDTO.Nat.class); formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setStaffId(tokenDto.getUserId()); + formDTO.setClient(tokenDto.getClient()); icNucleinService.add(formDTO); return new Result(); } @@ -246,7 +248,7 @@ public class IcNatController implements ResultDataResolver { response.addHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, "Content-Disposition"); //response.setHeader(HttpHeaders.CONTENT_TYPE, "application/vnd.ms-excel"); response.setHeader(HttpHeaders.CONTENT_TYPE, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("社区自组织导入模板", "UTF-8") + ".xlsx"); + response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("核酸检测导入模板", "UTF-8") + ".xlsx"); InputStream is = this.getClass().getClassLoader().getResourceAsStream("excel/ic_nat.xlsx"); try { @@ -287,7 +289,7 @@ public class IcNatController implements ResultDataResolver { excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), NatListCommonExcelResultDTO.class).build(); } - WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").build(); + WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); PageData data = null; do { data = icNucleinService.natList(formDTO); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNoticeController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNoticeController.java index b0b8a31553..ab0529b158 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNoticeController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNoticeController.java @@ -8,6 +8,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.IcNoticeDTO; @@ -72,7 +73,7 @@ public class IcNoticeController { @PostMapping("sendNotice") public Result sendNotice(@LoginUser TokenDto tokenDto, @RequestBody SendNoticeFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO, DefaultGroup.class); + ValidatorUtils.validateEntity(formDTO, CustomerClientShowGroup.class); formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setStaffId(tokenDto.getUserId()); icNoticeService.sendNotice(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 fbc82de26d..f054e77608 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 @@ -63,6 +63,7 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.poifs.filesystem.OfficeXmlFileException; import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; @@ -71,6 +72,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.File; @@ -82,7 +84,6 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.*; -import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutorService; import java.util.stream.Collectors; @@ -135,7 +136,7 @@ public class IcResiUserController implements ResultDataResolver { * 模板枚举 */ public enum IcUserTemplateEnums { - IC_RESI_IMPORT_TEMPLATE("excel/ic_resi_info_import_cid_for_easy_excel.xls", "居民信息导入模板.xls"), + IC_RESI_IMPORT_TEMPLATE("excel/ic_resi_import_template.xls", "居民信息导入模板.xls"), IC_RESI_EXPORT_TEMPLATE("excel/ic_resi_info_cid_for_easy_excel.xlsx", "居民信息导出模板.xlsx"); private String pathInApp; @@ -157,18 +158,13 @@ public class IcResiUserController implements ResultDataResolver { { // 初始化上传目录 - String home = System.getProperty("user.home"); - Path importDir = Paths.get(home, "epmet_files", "ic_user_import"); - if (Files.notExists(importDir)) { - try { - Files.createDirectories(importDir); - } catch (IOException e) { - log.error("创建数字赋能平台上传目录失败"); - } + try { + IC_RESI_UPLOAD_DIR = com.epmet.commons.tools.utils.FileUtils.getAndCreateDirUnderEpmetFilesDir("ic_user_import"); + } catch (IOException e) { + log.error("初始化居民信息上传目录失败:{}", ExceptionUtils.getErrorStackTrace(e)); } - IC_RESI_UPLOAD_DIR = importDir; - Path exportDir = Paths.get(home, "epmet_files", "ic_user_export"); + Path exportDir = Paths.get(System.getProperty("user.home"), "epmet_files", "ic_user_export"); if (Files.notExists(exportDir)) { try { Files.createDirectories(exportDir); @@ -469,20 +465,32 @@ public class IcResiUserController implements ResultDataResolver { // 三.异步执行导入 executorService.execute(() -> { - + boolean isAllSuccess = false; try { List formItemList = icResiUserService.listFormItems(customerId,IcFormCodeEnum.RESI_BASE_INFO.getCode()); - icResiUserImportService.importIcResiInfoFromExcel(importTaskId, formItemList, importTempFileSavePath.toString(), response, IC_RESI_UPLOAD_DIR); + isAllSuccess = icResiUserImportService.importIcResiInfoFromExcel(importTaskId, formItemList, importTempFileSavePath.toString(), response, IC_RESI_UPLOAD_DIR); } catch (Throwable e) { String errorMsg = ExceptionUtils.getThrowableErrorStackTrace(e); log.error("【导入居民信息失败】导入失败:{}", errorMsg); + String resultDesc; + if (e instanceof OfficeXmlFileException) { + resultDesc = "文件格式异常,请确保使用下载的模板文件"; + } else { + resultDesc = "系统异常,请查看系统日志"; + } + // 要将导入任务状态设置为结束但不成功。不报错即成功,没有返回值 - icResiUserImportService.finishImportTask(importTaskId, operatorId, ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL, "系统异常,请查看系统日志", null); + icResiUserImportService.finishImportTask(importTaskId, operatorId, ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL, resultDesc, null); } finally { try { + // 都导入成功了没问题,才删除 if (importTempFileSavePath != null){ - Files.delete(importTempFileSavePath); + if (isAllSuccess) { + Files.delete(importTempFileSavePath); + } else { + log.error("【导入居民信息】未完全成功,上传文件:{}", importTempFileSavePath); + } } } catch (IOException e) { log.error("【导入居民信息失败】清理上传的文件失败:{}", ExceptionUtils.getErrorStackTrace(e)); @@ -578,28 +586,30 @@ public class IcResiUserController implements ResultDataResolver { /** * 下载ic居民信息导入excel模板 - * @param loginUserInfo * @return */ @PostMapping("import/download-template") - public ResponseEntity downloadIcResiDownloadTemplate(@LoginUser TokenDto loginUserInfo) { - String customerId = loginUserInfo.getCustomerId(); - + public void downloadIcResiDownloadTemplate(HttpServletResponse response) { + InputStream is = null; + ServletOutputStream os = null; try { - File icResiImportTemplateFile = getIcResiTemplateFile(customerId, IcUserTemplateEnums.IC_RESI_IMPORT_TEMPLATE); + os = response.getOutputStream(); - HttpHeaders headers = new HttpHeaders(); - headers.add("Access-Control-Expose-Headers", "Content-Disposition"); - headers.add("content-Type", "application/vnd.ms-excel"); - headers.add("Content-Disposition", "attachment;fileName=" + URLEncoder.encode(IcUserTemplateEnums.IC_RESI_IMPORT_TEMPLATE.getTemplateName(), "UTF-8")); + is = this.getClass().getClassLoader().getResourceAsStream(IcUserTemplateEnums.IC_RESI_IMPORT_TEMPLATE.getPathInApp()); - return new ResponseEntity<>(FileUtil.readBytes(icResiImportTemplateFile), headers, HttpStatus.OK); + response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); + response.setHeader("content-Type", "application/vnd.ms-excel"); + response.setHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode(IcUserTemplateEnums.IC_RESI_IMPORT_TEMPLATE.getTemplateName(), "UTF-8")); + + IOUtils.copy(is, os); } catch (Exception e) { String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); - log.error("下载IC居民信息导入模板失败:{}", errorStackTrace); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "下载IC居民信息导入模板失败"); + } finally { + org.apache.poi.util.IOUtils.closeQuietly(is); + org.apache.poi.util.IOUtils.closeQuietly(os); } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java index 663b425f4e..9bae2a9826 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java @@ -16,6 +16,7 @@ import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.*; +import com.epmet.commons.tools.utils.poi.excel.FreezeAndFilter; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.constant.IcResiUserConstant; import com.epmet.constants.ImportTaskConstants; @@ -203,7 +204,7 @@ public class IcTripReportRecordController implements ResultDataResolver { String today= DateUtils.format(new Date(),DateUtils.DATE_PATTERN_MMDD); String fileName = "行程上报信息".concat(today); excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcTripReportRecordDTO.class).build(); - WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").build(); + WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); PageData data = null; do { data = icTripReportRecordService.page(formDTO); @@ -227,7 +228,7 @@ public class IcTripReportRecordController implements ResultDataResolver { * @return */ @PostMapping("import") - public Result importExcel(MultipartFile file) { + public Result importExcel(@LoginUser TokenDto tokenDto, MultipartFile file) { String userId = EpmetRequestHolder.getHeader(AppClientConstant.USER_ID); // 1.暂存文件 @@ -271,7 +272,7 @@ public class IcTripReportRecordController implements ResultDataResolver { "行程上报导入失败"); // 3.执行导入 - icTripReportRecordService.execAsyncExcelImport(fileSavePath, rstData.getTaskId()); + icTripReportRecordService.execAsyncExcelImport(fileSavePath, rstData.getTaskId(),tokenDto.getCustomerId(),tokenDto.getUserId()); return new Result(); } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccineController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccineController.java new file mode 100644 index 0000000000..297c30ae15 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccineController.java @@ -0,0 +1,230 @@ +package com.epmet.controller; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.write.metadata.WriteSheet; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.constant.AppClientConstant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.feign.ResultDataResolver; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.*; +import com.epmet.commons.tools.utils.poi.excel.FreezeAndFilter; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.constants.ImportTaskConstants; +import com.epmet.dto.form.ImportTaskCommonFormDTO; +import com.epmet.dto.form.VaccineListFormDTO; +import com.epmet.dto.result.IcVaccineListCommonExcelResultDTO; +import com.epmet.dto.result.IcVaccineListResultDTO; +import com.epmet.dto.result.ImportTaskCommonResultDTO; +import com.epmet.feign.EpmetCommonServiceOpenFeignClient; +import com.epmet.service.IcVaccineService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.io.IOUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpHeaders; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URLEncoder; +import java.nio.file.Path; +import java.util.List; +import java.util.UUID; + + +/** + * 疫苗接种记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-06 + */ +@Slf4j +@RestController +@RequestMapping("icVaccine") +public class IcVaccineController implements ResultDataResolver { + + @Autowired + private IcVaccineService icVaccineService; + + @Autowired + private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; + + /** + * @Author sun + * @Description 【疫苗】疫苗接种信息列表 + **/ + @NoRepeatSubmit + @PostMapping("vaccine-list") + public Result> vaccineList(@LoginUser TokenDto tokenDto, @RequestBody VaccineListFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + return new Result>().ok(icVaccineService.icVaccineList(formDTO)); + } + + /** + * @Author zxc + * @Description 【疫苗】疫苗接种信息同步 + **/ + @NoRepeatSubmit + @PostMapping("synchro") + public Result synchro(@LoginUser TokenDto tokenDto, @RequestBody VaccineListFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, VaccineListFormDTO.Synchro.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + icVaccineService.synchro(formDTO); + return new Result(); + } + + /** + * @Author zxc + * @Description 【疫苗】疫苗接种信息取消同步 + **/ + @NoRepeatSubmit + @PostMapping("cancelsynchro") + public Result cancelSynchro(@LoginUser TokenDto tokenDto, @RequestBody VaccineListFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, VaccineListFormDTO.Synchro.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + icVaccineService.cancelSynchro(formDTO); + return new Result<>(); + } + + /** + * 导入excel + * @return + */ + @PostMapping("import") + public Result importExcel(MultipartFile file) { + String userId = EpmetRequestHolder.getHeader(AppClientConstant.USER_ID); + + // 1.暂存文件 + String originalFilename = file.getOriginalFilename(); + String extName = originalFilename.substring(originalFilename.lastIndexOf(".")); + + Path fileSavePath; + try { + Path importPath = FileUtils.getAndCreateDirUnderEpmetFilesDir("ic_vaccine", "import"); + fileSavePath = importPath.resolve(UUID.randomUUID().toString().concat(extName)); + } catch (IOException e) { + String errorMsg = ExceptionUtils.getErrorStackTrace(e); + log.error("【疫苗接种导入】创建临时存储文件失败:{}", errorMsg); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "文件上传失败", "文件上传失败"); + } + + InputStream is = null; + FileOutputStream os = null; + + try { + is = file.getInputStream(); + os = new FileOutputStream(fileSavePath.toString()); + IOUtils.copy(is, os); + } catch (Exception e) { + log.error("importExcel exception", e); + } finally { + org.apache.poi.util.IOUtils.closeQuietly(is); + org.apache.poi.util.IOUtils.closeQuietly(os); + } + + // 2.生成导入任务记录 + ImportTaskCommonFormDTO importTaskForm = new ImportTaskCommonFormDTO(); + importTaskForm.setOperatorId(userId); + importTaskForm.setBizType(ImportTaskConstants.BIZ_TYPE_IC_VACCINE); + importTaskForm.setOriginFileName(originalFilename); + + ImportTaskCommonResultDTO rstData = getResultDataOrThrowsException(commonServiceOpenFeignClient.createImportTask(importTaskForm), + ServiceConstant.EPMET_COMMON_SERVICE, + EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), + "excel导入疫苗接种信息错误", + "导入居民疫苗接种信息失败"); + + // 3.执行导入 + icVaccineService.execAsyncExcelImport(fileSavePath, rstData.getTaskId()); + + return new Result(); + } + + /** + * @Author zxc + * @Description 【疫苗】疫苗接种信息下载模板 + **/ + @RequestMapping(value = "import-template-download", method = {RequestMethod.GET, RequestMethod.POST}) + public void downloadTemplate(HttpServletResponse response) throws IOException { + response.setCharacterEncoding("UTF-8"); + response.addHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, "Content-Disposition"); + response.setHeader(HttpHeaders.CONTENT_TYPE, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("疫苗接种导入模板", "UTF-8") + ".xlsx"); + + InputStream is = this.getClass().getClassLoader().getResourceAsStream("excel/ic_vaccine.xlsx"); + try { + ServletOutputStream os = response.getOutputStream(); + IOUtils.copy(is, os); + } finally { + if (is != null) { + is.close(); + } + } + + } + + /** + * @Author sun + * @Description 【疫苗】疫苗接种信息列表 + **/ + @NoRepeatSubmit + @PostMapping("export") + public void export(@LoginUser TokenDto tokenDto, @RequestBody VaccineListFormDTO formDTO, HttpServletResponse response) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + formDTO.setIsPage(false); + ExcelWriter excelWriter = null; + formDTO.setPageSize(NumConstant.TEN_THOUSAND); + int pageNo = formDTO.getPageNo(); + try { + // 这里 需要指定写用哪个class去写 + String fileName = "疫苗接种信息.xlsx"; + if ("all".equals(formDTO.getSearchType())) { + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcVaccineListResultDTO.class).build(); + }else { + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcVaccineListCommonExcelResultDTO.class).build(); + } + + WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); + PageData data = null; + do { + data = icVaccineService.icVaccineList(formDTO); + data.getList().forEach(o-> { + o.setIsResiUser(NumConstant.ONE_STR.equals(o.getIsResiUser()) ? "是" : "否"); + }); + formDTO.setPageNo(++pageNo); + if ("current".equals(formDTO.getSearchType())) { + List list = ConvertUtils.sourceToTarget(data.getList(), IcVaccineListResultDTO.class); + excelWriter.write(list, writeSheet); + }else{ + excelWriter.write(data.getList(), writeSheet); + } + } while (CollectionUtils.isNotEmpty(data.getList()) && data.getList().size() == formDTO.getPageSize()); + + }catch (Exception e){ + log.error("export exception", e); + }finally { + // 千万别忘记finish 会帮忙关闭流 + if (excelWriter != null) { + excelWriter.finish(); + } + } + } + + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiVaccineController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccineRelationController.java similarity index 57% rename from epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiVaccineController.java rename to epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccineRelationController.java index 722c2966eb..b24494d2c9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiVaccineController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccineRelationController.java @@ -8,55 +8,54 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; -import com.epmet.dto.IcResiVaccineDTO; -import com.epmet.service.IcResiVaccineService; +import com.epmet.dto.IcVaccineRelationDTO; +import com.epmet.service.IcVaccineRelationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import java.util.List; import java.util.Map; /** - * 居民疫苗情况 + * 疫苗接种记录关系表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2022-03-28 + * @since v1.0.0 2022-04-06 */ @RestController -@RequestMapping("icResiVaccine") -public class IcResiVaccineController { +@RequestMapping("icVaccineRelation") +public class IcVaccineRelationController { @Autowired - private IcResiVaccineService icResiVaccineService; + private IcVaccineRelationService icVaccineRelationService; @RequestMapping("page") - public Result> page(@RequestParam Map params){ - PageData page = icResiVaccineService.page(params); - return new Result>().ok(page); + public Result> page(@RequestParam Map params){ + PageData page = icVaccineRelationService.page(params); + return new Result>().ok(page); } @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) - public Result get(@PathVariable("id") String id){ - IcResiVaccineDTO data = icResiVaccineService.get(id); - return new Result().ok(data); + public Result get(@PathVariable("id") String id){ + IcVaccineRelationDTO data = icVaccineRelationService.get(id); + return new Result().ok(data); } @NoRepeatSubmit @PostMapping("save") - public Result save(@RequestBody IcResiVaccineDTO dto){ + public Result save(@RequestBody IcVaccineRelationDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); - icResiVaccineService.save(dto); + icVaccineRelationService.save(dto); return new Result(); } @NoRepeatSubmit @PostMapping("update") - public Result update(@RequestBody IcResiVaccineDTO dto){ + public Result update(@RequestBody IcVaccineRelationDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); - icResiVaccineService.update(dto); + icVaccineRelationService.update(dto); return new Result(); } @@ -64,7 +63,7 @@ public class IcResiVaccineController { public Result delete(@RequestBody String[] ids){ //效验数据 AssertUtils.isArrayEmpty(ids, "id"); - icResiVaccineService.delete(ids); + icVaccineRelationService.delete(ids); return new Result(); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiCollectDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiCollectDao.java index 2602b5858a..547ef63ca8 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiCollectDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiCollectDao.java @@ -40,5 +40,5 @@ public interface IcResiCollectDao extends BaseDao { * @param userId * @return */ - String selectLastSubmitId(@Param("customerId") String customerId, @Param("userId") String userId); + List selectLastSubmitId(@Param("customerId") String customerId, @Param("userId") String userId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiVaccineDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiVaccineDao.java deleted file mode 100644 index 4679c59587..0000000000 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiVaccineDao.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.epmet.dao; - -import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.entity.IcResiVaccineEntity; -import org.apache.ibatis.annotations.Mapper; - -/** - * 居民疫苗情况 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2022-03-28 - */ -@Mapper -public interface IcResiVaccineDao extends BaseDao { - -} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineDao.java new file mode 100644 index 0000000000..3868760fab --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineDao.java @@ -0,0 +1,71 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.IcNatDTO; +import com.epmet.dto.form.MyNatListFormDTO; +import com.epmet.dto.form.VaccineListFormDTO; +import com.epmet.dto.result.IcVaccineListResultDTO; +import com.epmet.dto.result.MyNatListResultDTO; +import com.epmet.dto.result.NatListResultDTO; +import com.epmet.entity.IcVaccineEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 疫苗接种记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-06 + */ +@Mapper +public interface IcVaccineDao extends BaseDao { + /** + * @Author sun + * @Description 核酸检测-按条件查询核酸记录 + **/ + List getMyNatList(MyNatListFormDTO formDTO); + + /** + * @Author sun + * @Description 【核酸】本辖区核酸检测信息列表 + * + * @param formDTO*/ + List getIcVaccineList(VaccineListFormDTO formDTO); + + /** + * @Author sun + * @Description 【核酸】客户下核酸检测信息列表 + * + * @param formDTO*/ + List getCustomerIcVaccineList(VaccineListFormDTO formDTO); + + /** + * @Author sun + * @Description 删除操作--物理删除业务数据 + **/ + int delById(@Param("icNatId") String icNatId); + + /** + * 插入或者更新 + * + * @param e + */ + void insertOrUpdate(IcVaccineEntity e); + + /** + * @Author sun + * @Description 按条件查询业务数据 + **/ + IcNatDTO getNatDTO(@Param("customerId") String customerId, @Param("icNatId") String icNatId, @Param("idCard") String idCard, @Param("natTime") String natTime, @Param("natResult") String natResult); + + /** + * desc:根据客户id 更新是否居民状态 + * + * @param customerId + * @param icResiUserId 如果为空则更新全部 + * @return + */ + int updateIsResiFlag(@Param("customerId") String customerId, @Param("icResiUserId") String icResiUserId); +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineRelationDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineRelationDao.java new file mode 100644 index 0000000000..60d80b3f61 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineRelationDao.java @@ -0,0 +1,17 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.IcVaccineRelationEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 疫苗接种记录关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-06 + */ +@Mapper +public interface IcVaccineRelationDao extends BaseDao { + int delRelation(@Param("icVaccineId") String icNatId, @Param("agencyId") String agencyId); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiVaccineEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcVaccineEntity.java similarity index 68% rename from epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiVaccineEntity.java rename to epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcVaccineEntity.java index f26abbe525..9bef5581d7 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiVaccineEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcVaccineEntity.java @@ -1,5 +1,7 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -9,21 +11,22 @@ import lombok.EqualsAndHashCode; import java.util.Date; /** - * 居民疫苗情况 + * 疫苗接种记录 * * @author generator generator@elink-cn.com - * @since v1.0.0 2022-03-28 + * @since v1.0.0 2022-04-06 */ @Data @EqualsAndHashCode(callSuper=false) -@TableName("ic_resi_vaccine") -public class IcResiVaccineEntity extends BaseEpmetEntity { +@TableName("ic_vaccine") +public class IcVaccineEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; /** * 客户Id customer.id */ + @TableField(fill = FieldFill.INSERT_UPDATE) private String customerId; /** @@ -41,6 +44,16 @@ public class IcResiVaccineEntity extends BaseEpmetEntity { */ private String idCard; + /** + * 是否客户下居民(0:否 1:是) + */ + private String isResiUser; + + /** + * 数据来源【导入的:import;】 + */ + private String userType; + /** * 接种时间 */ @@ -74,6 +87,6 @@ public class IcResiVaccineEntity extends BaseEpmetEntity { /** * 备注 */ - private String remaek; + private String remark; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcVaccineRelationEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcVaccineRelationEntity.java new file mode 100644 index 0000000000..0c1b6c88ac --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcVaccineRelationEntity.java @@ -0,0 +1,55 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 疫苗接种记录关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-06 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_vaccine_relation") +public class IcVaccineRelationEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + + /** + * 居民端上报时存储用户所在网格的组织id.居民信息的人存储居民所在组织id.单个新增或者导入的存储登录用户所属的组织id + */ + private String agencyId; + + /** + * 组织pids,包含当前agencyId值 + */ + private String pids; + + /** + * 疫苗记录表Id(ic_vaccine.id) + */ + private String icVaccineId; + + /** + * 关系数据的绑定途径【 +数字社区录入:icresi; +导入的:import; +同步的:synchro】 + */ + private String userType; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatImportExcelData.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatImportExcelData.java index 385d02b171..052b0cb1eb 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatImportExcelData.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatImportExcelData.java @@ -21,6 +21,7 @@ public class IcNatImportExcelData { @NotBlank(message = "手机号为必填项") @ExcelProperty("手机号") + @Length(max = 15, message = "手机号长度不正确,应小于15位") private String mobile; @NotBlank(message = "身份证号为必填项") diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcVaccineImportExcelData.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcVaccineImportExcelData.java new file mode 100644 index 0000000000..60a83b2582 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcVaccineImportExcelData.java @@ -0,0 +1,65 @@ +package com.epmet.excel.data; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +/** + * 疫苗接种信息导入excel数据 + */ +@Data +public class IcVaccineImportExcelData implements Serializable { + + private static final long serialVersionUID = -700535059296633797L; + @NotBlank(message = "姓名为必填项") + @ExcelProperty("姓名") + private String name; + + @NotBlank(message = "手机号为必填项") + @ExcelProperty("手机号") + @Length(max = 15, message = "手机号长度不正确") + private String mobile; + + @NotBlank(message = "身份证号为必填项") + @ExcelProperty("身份证号") + @Length(max = 18, message = "身份证号长度不正确") + private String idCard; + + @NotNull(message = "接种时间为必填项") + @ExcelProperty("接种时间") + private Date inoculateTime; + + @NotBlank(message = "接种地点为必填项") + @ExcelProperty("接种地点") + private String inoculateAddress; + + @NotBlank(message = "疫苗厂家为必填项") + @ExcelProperty("疫苗厂家") + private String manufacturer; + + @Data + public static class RowRemarkMessage { + + @ExcelProperty("姓名") + @ColumnWidth(20) + private String name; + + @ExcelProperty("手机号") + @ColumnWidth(20) + private String mobile; + + @ColumnWidth(20) + @ExcelProperty("身份证号") + private String idCard; + + @ColumnWidth(60) + @ExcelProperty("错误信息") + private String errorInfo; + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcVaccineExcelImportListener.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcVaccineExcelImportListener.java new file mode 100644 index 0000000000..e12d4549a9 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcVaccineExcelImportListener.java @@ -0,0 +1,136 @@ +package com.epmet.excel.handler; + +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.read.listener.ReadListener; +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.exception.ValidateException; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.entity.IcVaccineEntity; +import com.epmet.excel.data.IcNatImportExcelData; +import com.epmet.excel.data.IcVaccineImportExcelData; +import com.epmet.service.impl.IcNatServiceImpl; +import com.epmet.service.impl.IcVaccineServiceImpl; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + * 核酸检测excel导入监听器 + */ +@Data +@Slf4j +public class IcVaccineExcelImportListener implements ReadListener { + + /** + * 最大条数阈值 + */ + public static final int MAX_THRESHOLD = 200; + + private String currentUserId; + /** + * 当前组织ID + */ + private String currentAgencyId; + + private String currentAgencyPids; + + /** + * 数据 + */ + private List datas = new ArrayList<>(); + + /** + * 错误项列表 + */ + private List errorRows = new ArrayList<>(); + /** + * 其他被标记出来的列表列表 + */ + private List otherRows = new ArrayList<>(); + + private IcVaccineServiceImpl icVaccineService; + + public IcVaccineExcelImportListener(String currentUserId, String currentAgencyId, String currentAgencyPids, IcVaccineServiceImpl icVaccineService) { + this.currentUserId = currentUserId; + this.currentAgencyId = currentAgencyId; + this.currentAgencyPids = currentAgencyPids; + this.icVaccineService = icVaccineService; + } + + @Override + public void invoke(IcVaccineImportExcelData data, AnalysisContext context) { + + try { + // 先校验数据 + ValidatorUtils.validateEntity(data); + + // 取出前后空格 + if (StringUtils.isNotBlank(data.getName())) { + data.setName(data.getName().trim()); + } + if (StringUtils.isNotBlank(data.getMobile())) { + data.setMobile(data.getMobile().trim()); + } + if (StringUtils.isNotBlank(data.getInoculateAddress())) { + data.setInoculateAddress(data.getInoculateAddress().trim()); + } + if (StringUtils.isNotBlank(data.getIdCard())) { + data.setIdCard(data.getIdCard().trim()); + } + + IcVaccineEntity icVaccineEntity = ConvertUtils.sourceToTarget(data, IcVaccineEntity.class); + icVaccineEntity.setUserType("import"); + datas.add(icVaccineEntity); + + if (datas.size() == MAX_THRESHOLD) { + execPersist(); + } + } catch (Exception e) { + String errorMsg = null; + if (e instanceof ValidateException) { + errorMsg = ((ValidateException) e).getMsg(); + } else { + errorMsg = "未知错误"; + log.error("【疫苗接种信息导入】出错:{}", ExceptionUtils.getErrorStackTrace(e)); + } + + IcVaccineImportExcelData.RowRemarkMessage errorRow = new IcVaccineImportExcelData.RowRemarkMessage(); + errorRow.setName(data.getName()); + errorRow.setMobile(data.getMobile()); + errorRow.setIdCard(data.getIdCard()); + errorRow.setErrorInfo(errorMsg); + errorRows.add(errorRow); + } + } + + @Override + public void doAfterAllAnalysed(AnalysisContext context) { + // 最后几条达不到阈值,这里必须再调用一次 + execPersist(); + } + + /** + * 执行持久化 + */ + private void execPersist() { + try { + if (datas != null && datas.size() > 0) { + icVaccineService.batchPersist(datas, this); + } + } finally { + datas.clear(); + } + } + + /** + * 获取错误行 + * @return + */ + public List getErrorRows() { + return errorRows; + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserImportService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserImportService.java index 05fb431c32..f3451f3e13 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserImportService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserImportService.java @@ -13,7 +13,7 @@ import java.util.List; */ public interface IcResiUserImportService { - void importIcResiInfoFromExcel(String importTaskId, List formItemList, String excelPathName, HttpServletResponse response, Path importTempPath); + boolean importIcResiInfoFromExcel(String importTaskId, List formItemList, String excelPathName, HttpServletResponse response, Path importTempPath); /** * 创建导入任务 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiVaccineService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiVaccineService.java deleted file mode 100644 index c1b2ea0655..0000000000 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiVaccineService.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.epmet.service; - -import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.commons.tools.page.PageData; -import com.epmet.dto.IcResiVaccineDTO; -import com.epmet.dto.result.VaccineListDTO; -import com.epmet.entity.IcResiVaccineEntity; - -import java.util.List; -import java.util.Map; - -/** - * 居民疫苗情况 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2022-03-28 - */ -public interface IcResiVaccineService extends BaseService { - - /** - * 默认分页 - * - * @param params - * @return PageData - * @author generator - * @date 2022-03-28 - */ - PageData page(Map params); - - /** - * 默认查询 - * - * @param params - * @return java.util.List - * @author generator - * @date 2022-03-28 - */ - List list(Map params); - - /** - * 单条查询 - * - * @param id - * @return IcResiVaccineDTO - * @author generator - * @date 2022-03-28 - */ - IcResiVaccineDTO get(String id); - - /** - * 默认保存 - * - * @param dto - * @return void - * @author generator - * @date 2022-03-28 - */ - void save(IcResiVaccineDTO dto); - - /** - * 默认更新 - * - * @param dto - * @return void - * @author generator - * @date 2022-03-28 - */ - void update(IcResiVaccineDTO dto); - - /** - * 批量删除 - * - * @param ids - * @return void - * @author generator - * @date 2022-03-28 - */ - void delete(String[] ids); - - /** - * 获取居民疫苗接种信息 - * - * @Param idCard - * @Return {@link List< VaccineListDTO>} - * @Author zhaoqifeng - * @Date 2022/3/30 10:24 - */ - List getVaccineList(String customerId, String idCard); -} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java index 66ec0d9f9e..ffd9f3db8d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java @@ -99,5 +99,5 @@ public interface IcTripReportRecordService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-04-06 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-04-06 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return IcVaccineRelationDTO + * @author generator + * @date 2022-04-06 + */ + IcVaccineRelationDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-04-06 + */ + void save(IcVaccineRelationDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-04-06 + */ + void update(IcVaccineRelationDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-04-06 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcVaccineService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcVaccineService.java new file mode 100644 index 0000000000..b84626a8c8 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcVaccineService.java @@ -0,0 +1,56 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.form.VaccineListFormDTO; +import com.epmet.dto.result.IcVaccineListResultDTO; +import com.epmet.dto.result.VaccineListDTO; +import com.epmet.entity.IcVaccineEntity; + +import java.nio.file.Path; +import java.util.List; + +/** + * 疫苗接种记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-06 + */ +public interface IcVaccineService extends BaseService { + + /** + * @Author sun + * @Description 【核酸】核酸检测信息列表 + * + * @param formDTO + * @return*/ + PageData icVaccineList(VaccineListFormDTO formDTO); + + /** + * @Author zxc + * @Description 【核酸】核酸检测信息同步 + **/ + void synchro(VaccineListFormDTO formDTO); + + /** + * @Author zxc + * @Description 【核酸】核酸检测信息取消同步 + **/ + void cancelSynchro(VaccineListFormDTO formDTO); + + /** + * 执行Excel导入 + * @param filePath + */ + void execAsyncExcelImport(Path filePath, String importTaskId); + + /** + * 获取居民疫苗接种信息 + * + * @Param idCard + * @Return {@link List } + * @Author zhaoqifeng + * @Date 2022/3/30 10:24 + */ + List getVaccineList(String customerId, String idCard); +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcEpidemicSpecialAttentionServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcEpidemicSpecialAttentionServiceImpl.java index bd9faff62b..f27bc46842 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcEpidemicSpecialAttentionServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcEpidemicSpecialAttentionServiceImpl.java @@ -334,7 +334,8 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl imp private IcNatRelationDao icNatRelationDao; @Autowired private IcResiUserDao icResiUserDao; - @Autowired - private UserService userService; + //@Autowired + //private UserService userService; /** * @Author sun @@ -101,6 +101,9 @@ public class IcNatServiceImpl extends BaseServiceImpl imp if (null != icNatDTO && icNatDTO.getNatResult().equals(formDTO.getNatResult())) { throw new RenException(EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getCode(), EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getMsg()); } else if (null != icNatDTO && !icNatDTO.getNatResult().equals(formDTO.getNatResult())) { + if ("wxmp".equals(formDTO.getClient())) { + throw new RenException(EpmetErrorCode.RESI_IC_NAT.getCode(), EpmetErrorCode.RESI_IC_NAT.getMsg()); + } throw new RenException(EpmetErrorCode.IC_NAT.getCode(), EpmetErrorCode.IC_NAT.getMsg()); } //1.获取所填居民所属组织缓存信息 @@ -317,7 +320,7 @@ public class IcNatServiceImpl extends BaseServiceImpl imp String app = EpmetRequestHolder.getHeader(AppClientConstant.APP); String client = EpmetRequestHolder.getHeader(AppClientConstant.CLIENT); - LoginUserDetailsResultDTO loginUserDetails = userService.getLoginUserDetails(app, client, userId); + LoginUserDetailsResultDTO loginUserDetails = SpringContextUtils.getBean(UserService.class).getLoginUserDetails(app, client, userId); String agencyId = loginUserDetails.getAgencyId(); @@ -488,6 +491,9 @@ public class IcNatServiceImpl extends BaseServiceImpl imp String natResult = e.getNatResult(); String natAddress = e.getNatAddress(); + // 居民信息 + IcResiUserEntity resi = getResi(customerId, idCard, null); + //1.先看客户下有没有这个人 IcNatEntity resiNat = getResiNat(customerId, idCard, natTime); if (resiNat != null && !"import".equals(resiNat.getUserType())) { @@ -547,7 +553,6 @@ public class IcNatServiceImpl extends BaseServiceImpl imp resiNat.setUpdatedBy(currentUserId); resiNat.setUpdatedTime(new Date()); - IcResiUserEntity resi = getResi(customerId, idCard, null); resiNat.setIsResiUser(resi != null ? "1" : "0"); resiNat.setUserId(resi != null ? resi.getId() : ""); @@ -555,15 +560,14 @@ public class IcNatServiceImpl extends BaseServiceImpl imp } // 还要创建关系。只有本辖区及下级居民,才建立关系 - if (getResi(customerId, idCard, String.join(":", Arrays.asList(agencyPids, agencyId))) != null) { - createNatRelation(resiNat.getId(), listener.getCurrentAgencyId(), listener.getCurrentAgencyPids()); + if (resi != null) { + createNatRelation(resiNat.getId(), resi.getAgencyId(), resi.getPids()); } return; } // 执行新增操作 - IcResiUserEntity resi = getResi(customerId, idCard, null); e.setIsResiUser(resi != null ? "1" : "0"); e.setUserId(resi != null ? resi.getId() : ""); e.setUserType("import"); @@ -571,8 +575,8 @@ public class IcNatServiceImpl extends BaseServiceImpl imp baseDao.insert(e); // 还要创建关系。只有本辖区及下级居民,才建立关系 - if (getResi(customerId, idCard, String.join(":", Arrays.asList(agencyPids, agencyId))) != null) { - createNatRelation(e.getId(), listener.getCurrentAgencyId(), listener.getCurrentAgencyPids()); + if (resi != null) { + createNatRelation(e.getId(), resi.getAgencyId(), resi.getPids()); } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNoticeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNoticeServiceImpl.java index c306bec8aa..28fd02753b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNoticeServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNoticeServiceImpl.java @@ -137,7 +137,10 @@ public class IcNoticeServiceImpl extends BaseServiceImpl entityList = formDTO.getUserList().stream().map(item -> { + List userBeanList = formDTO.getUserList().stream().collect(Collectors.collectingAndThen( + Collectors.toCollection(() -> new TreeSet<>( + Comparator.comparing( SendNoticeFormDTO.UserListBean::getIdCard))), ArrayList::new)); + List entityList = userBeanList.stream().map(item -> { IcNoticeEntity entity = new IcNoticeEntity(); entity.setCustomerId(formDTO.getCustomerId()); entity.setChannel(channel); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java index b0befce180..fe75c7acbb 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java @@ -2,6 +2,7 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +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; @@ -25,6 +26,7 @@ import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.service.IcResiCollectService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -144,6 +146,7 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl resiCoolectIds = baseDao.selectLastSubmitId(formDTO.getCustomerId(), formDTO.getUserId()); + String latestResiCollectId = CollectionUtils.isNotEmpty(resiCoolectIds) ? resiCoolectIds.get(NumConstant.ZERO) : StrConstant.EPMETY_STR; if (StringUtils.isNotBlank(latestResiCollectId)) { resDTO.setResiCollectId(latestResiCollectId); //之前提交过 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 313c18c16d..722fb93cd2 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 @@ -13,7 +13,6 @@ import com.epmet.bean.ResiImportChangedData; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.constant.StrConstant; -import com.epmet.commons.tools.constant.ThreadLocalConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.exception.EpmetErrorCode; @@ -24,7 +23,6 @@ import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; -import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.EpmetRequestHolder; import com.epmet.commons.tools.utils.Result; @@ -211,9 +209,11 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res * @param formItemList item列表 * @param excelPathName excel缓存路径 * @param response 响应对象 + * @return */ @Override - public void importIcResiInfoFromExcel(String importTaskId, List formItemList, String excelPathName, HttpServletResponse response, Path importTempPath) { + public boolean importIcResiInfoFromExcel(String importTaskId, List formItemList, String excelPathName, HttpServletResponse response, Path importTempPath) { + boolean isAllSuccess = false; String app = EpmetRequestHolder.getHeader(AppClientConstant.APP); String client = EpmetRequestHolder.getHeader(AppClientConstant.CLIENT); @@ -276,6 +276,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res } finishImportTask(importTaskId, loginUserId, ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL,null, resultDescFilePath); } else { + isAllSuccess = true; finishImportTask(importTaskId, loginUserId, ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS,null, null); } @@ -298,6 +299,8 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res resiCategoryColumnNameAndLabel.remove(); itemIdAndOptionsCache.invalidateAll(); } + + return isAllSuccess; } /** @@ -424,6 +427,9 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res String idCard = columnAndValues.get("ID_CARD"); + // 执行指定的检查 + specifiedCheck(columnAndValues); + Map existingResiMap = icResiUserDao.selectResiInfoMap(idCard, null); if (existingResiMap == null) { @@ -526,6 +532,41 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res } } + /** + * 执行指定的检查 + * @param columnAndValues + */ + private void specifiedCheck(LinkedHashMap columnAndValues) { + String idCard = columnAndValues.get("ID_CARD"); + String mobile = columnAndValues.get("MOBILE"); + String name = columnAndValues.get("NAME"); + + List errors = new ArrayList<>(); + + if (StringUtils.isBlank(idCard)) { + log.debug("【居民信息导入】specifiedCheck身份证号为空的:{},{}", mobile, name); + + String errorMsg = "身份证号不能为空"; + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg); + } + + if (idCard.length() > 18) { + // 身份证号超长了哦,不可以的 + errors.add("身份证号过长"); + } + + if (StringUtils.isNotBlank(mobile) && mobile.length() > 15) { + // 手机号超长也是不可以的 + errors.add("手机号过长"); + } + + if (errors.size() > 0) { + // 有错误 + String errorMsg = String.join(";", errors); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg); + } + } + /** * 持久化IC居民附加信息 * @param headerColumnWrapper 数据库列包装信息 @@ -540,9 +581,6 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res LinkedHashMap columnAndValues = new LinkedHashMap<>(); - String loginUserApp = EpmetRequestHolder.getHeader(AppClientConstant.APP); - String loginUserClient = EpmetRequestHolder.getHeader(AppClientConstant.CLIENT); - String loginUserId = EpmetRequestHolder.getHeader(AppClientConstant.USER_ID.toLowerCase()); String loginUserCustomerId = EpmetRequestHolder.getHeader(AppClientConstant.CUSTOMER_ID.toLowerCase()); // 遍历每一行,将行内容转化为 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 97a491eb25..7e376b57ec 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 @@ -43,6 +43,7 @@ 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.Result; +import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.constant.IcPlatformConstant; import com.epmet.constant.IcResiUserConstant; import com.epmet.constant.UserConstant; @@ -119,10 +120,10 @@ public class IcResiUserServiceImpl extends BaseServiceImpl epidemicPreventionList(EpidemicPreventionFormDTO formDTO) { + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); + if (null != staffInfo) { + formDTO.setAgencyId(staffInfo.getAgencyId()); + } PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); List list = baseDao.getEpidemicPreventionList(formDTO); PageInfo pageInfo = new PageInfo<>(list); @@ -1282,6 +1287,10 @@ public class IcResiUserServiceImpl extends BaseServiceImpl userList(EpidemicPreventionFormDTO formDTO) { + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); + if (null != staffInfo) { + formDTO.setAgencyId(staffInfo.getAgencyId()); + } PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); List list = new ArrayList<>(); if (formDTO.getAttentionType().equals(NumConstant.TWO)){ @@ -1345,10 +1354,10 @@ public class IcResiUserServiceImpl extends BaseServiceImpl natList = icNatService.getNatList(formDTO.getCustomerId(), icResiUser.getIdCard()); + List natList = SpringContextUtils.getBean(IcNatService.class).getNatList(formDTO.getCustomerId(), icResiUser.getIdCard()); result.setNatList(natList); //疫苗接种 - List vaccineList = icResiVaccineService.getVaccineList(formDTO.getCustomerId(), icResiUser.getIdCard()); + List vaccineList = SpringContextUtils.getBean(IcVaccineService.class).getVaccineList(formDTO.getCustomerId(), icResiUser.getIdCard()); result.setVaccineList(vaccineList); //行程信息 List tripList = icTripReportRecordService.tripList(formDTO.getCustomerId(), icResiUser.getIdCard()); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiVaccineServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiVaccineServiceImpl.java deleted file mode 100644 index 2f5f0b0928..0000000000 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiVaccineServiceImpl.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.epmet.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -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.page.PageData; -import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.utils.DateUtils; -import com.epmet.dao.IcResiVaccineDao; -import com.epmet.dto.IcResiVaccineDTO; -import com.epmet.dto.result.VaccineListDTO; -import com.epmet.entity.IcResiVaccineEntity; -import com.epmet.service.IcResiVaccineService; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * 居民疫苗情况 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2022-03-28 - */ -@Service -public class IcResiVaccineServiceImpl extends BaseServiceImpl implements IcResiVaccineService { - - @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, IcResiVaccineDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, IcResiVaccineDTO.class); - } - - private QueryWrapper getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); - - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); - - return wrapper; - } - - @Override - public IcResiVaccineDTO get(String id) { - IcResiVaccineEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, IcResiVaccineDTO.class); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void save(IcResiVaccineDTO dto) { - IcResiVaccineEntity entity = ConvertUtils.sourceToTarget(dto, IcResiVaccineEntity.class); - insert(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(IcResiVaccineDTO dto) { - IcResiVaccineEntity entity = ConvertUtils.sourceToTarget(dto, IcResiVaccineEntity.class); - updateById(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void delete(String[] ids) { - // 逻辑删除(@TableLogic 注解) - baseDao.deleteBatchIds(Arrays.asList(ids)); - } - - /** - * 获取居民疫苗接种信息 - * - * @param idCard - * @Param idCard - * @Return {@link List< VaccineListDTO >} - * @Author zhaoqifeng - * @Date 2022/3/30 10:24 - */ - @Override - public List getVaccineList(String customerId, String idCard) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(IcResiVaccineEntity::getCustomerId, customerId); - wrapper.eq(IcResiVaccineEntity::getIdCard, idCard); - wrapper.orderByDesc(IcResiVaccineEntity::getInoculateTime); - List list = baseDao.selectList(wrapper); - if (CollectionUtils.isEmpty(list)) { - return Collections.emptyList(); - } - return list.stream().map(item -> { - VaccineListDTO dto = new VaccineListDTO(); - dto.setAddress(item.getInoculateAddress()); - dto.setManufactor(item.getManufacturer()); - dto.setVaccinateTime(DateUtils.format(item.getInoculateTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE)); - return dto; - }).collect(Collectors.toList()); - } - -} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java index 2aaf0c8fad..3766ee7baa 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java @@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; @@ -18,7 +17,10 @@ import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.redis.common.bean.GridInfoCache; -import com.epmet.commons.tools.utils.*; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.FileUtils; +import com.epmet.commons.tools.utils.Result; import com.epmet.constant.IcResiUserConstant; import com.epmet.constants.ImportTaskConstants; import com.epmet.dao.IcTripReportRecordDao; @@ -334,12 +336,8 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl errorRows = listener.getErrorRows(); - // 生成并上传错误文件 - try { - // 文件生成 - Path errorDescDir = FileUtils.getAndCreateDirUnderEpmetFilesDir("ic_trip_preport", "import", "error_des"); - String fileName = UUID.randomUUID().toString().concat(".xlsx"); - errorDescFile = errorDescDir.resolve(fileName); - - FileItemFactory factory = new DiskFileItemFactory(16, errorDescDir.toFile()); - FileItem fileItem = factory.createItem("file", ContentType.APPLICATION_OCTET_STREAM.toString(), true, fileName); - OutputStream os = fileItem.getOutputStream(); - - EasyExcel.write(os, IcTripReportExcelData.ErrorRow.class).sheet("导入失败列表").doWrite(errorRows); - - // 文件上传oss - Result errorDesFileUploadResult = ossFeignClient.uploadImportTaskDescFile(new CommonsMultipartFile(fileItem)); - if (errorDesFileUploadResult.success()) { - errorDesFileUrl = errorDesFileUploadResult.getData().getUrl(); - } - } finally { - if (Files.exists(errorDescFile)) { - Files.delete(errorDescFile); + boolean failed = errorRows.size() > 0; + if (failed) { + // 生成并上传错误文件 + try { + // 文件生成 + Path errorDescDir = FileUtils.getAndCreateDirUnderEpmetFilesDir("ic_trip_preport", "import", "error_des"); + String fileName = UUID.randomUUID().toString().concat(".xlsx"); + errorDescFile = errorDescDir.resolve(fileName); + + FileItemFactory factory = new DiskFileItemFactory(16, errorDescDir.toFile()); + FileItem fileItem = factory.createItem("file", ContentType.APPLICATION_OCTET_STREAM.toString(), true, fileName); + OutputStream os = fileItem.getOutputStream(); + + EasyExcel.write(os, IcTripReportExcelData.ErrorRow.class).sheet("导入失败列表").doWrite(errorRows); + + // 文件上传oss + Result errorDesFileUploadResult = ossFeignClient.uploadImportTaskDescFile(new CommonsMultipartFile(fileItem)); + if (errorDesFileUploadResult.success()) { + errorDesFileUrl = errorDesFileUploadResult.getData().getUrl(); + } + } finally { + if (Files.exists(errorDescFile)) { + Files.delete(errorDescFile); + } } } ImportTaskCommonFormDTO importFinishTaskForm = new ImportTaskCommonFormDTO(); importFinishTaskForm.setTaskId(importTaskId); - importFinishTaskForm.setProcessStatus(errorRows.size() <= 0 ? ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS : ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL); + importFinishTaskForm.setProcessStatus(failed ? ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL : ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS); importFinishTaskForm.setOperatorId(userId); importFinishTaskForm.setResultDesc(""); importFinishTaskForm.setResultDescFilePath(errorDesFileUrl); @@ -418,11 +419,9 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl entities) { - String currentUserId = EpmetRequestHolder.getHeader(AppClientConstant.USER_ID); entities.forEach(e -> { String id = IdWorker.getIdStr(e); e.setId(id); - e.setUpdatedBy(currentUserId); baseDao.insert(e); }); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineRelationServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineRelationServiceImpl.java new file mode 100644 index 0000000000..6920ddf8d5 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineRelationServiceImpl.java @@ -0,0 +1,82 @@ +package com.epmet.service.impl; + +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.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.IcVaccineRelationDao; +import com.epmet.dto.IcVaccineRelationDTO; +import com.epmet.entity.IcVaccineRelationEntity; +import com.epmet.service.IcVaccineRelationService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 疫苗接种记录关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-06 + */ +@Service +public class IcVaccineRelationServiceImpl extends BaseServiceImpl implements IcVaccineRelationService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, IcVaccineRelationDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, IcVaccineRelationDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public IcVaccineRelationDTO get(String id) { + IcVaccineRelationEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, IcVaccineRelationDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IcVaccineRelationDTO dto) { + IcVaccineRelationEntity entity = ConvertUtils.sourceToTarget(dto, IcVaccineRelationEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(IcVaccineRelationDTO dto) { + IcVaccineRelationEntity entity = ConvertUtils.sourceToTarget(dto, IcVaccineRelationEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineServiceImpl.java new file mode 100644 index 0000000000..ec33974bf8 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineServiceImpl.java @@ -0,0 +1,466 @@ +package com.epmet.service.impl; + +import com.alibaba.excel.EasyExcel; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.AppClientConstant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.feign.ResultDataResolver; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.EpmetRequestHolder; +import com.epmet.commons.tools.utils.FileUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.constants.ImportTaskConstants; +import com.epmet.dao.IcResiUserDao; +import com.epmet.dao.IcVaccineDao; +import com.epmet.dao.IcVaccineRelationDao; +import com.epmet.dto.form.ImportTaskCommonFormDTO; +import com.epmet.dto.form.VaccineListFormDTO; +import com.epmet.dto.result.IcVaccineListResultDTO; +import com.epmet.dto.result.LoginUserDetailsResultDTO; +import com.epmet.dto.result.UploadImgResultDTO; +import com.epmet.dto.result.VaccineListDTO; +import com.epmet.entity.IcResiUserEntity; +import com.epmet.entity.IcVaccineEntity; +import com.epmet.entity.IcVaccineRelationEntity; +import com.epmet.excel.data.IcNatImportExcelData; +import com.epmet.excel.data.IcVaccineImportExcelData; +import com.epmet.excel.handler.IcVaccineExcelImportListener; +import com.epmet.feign.EpmetCommonServiceOpenFeignClient; +import com.epmet.feign.OssFeignClient; +import com.epmet.service.IcVaccineService; +import com.epmet.service.UserService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.fileupload.FileItem; +import org.apache.commons.fileupload.FileItemFactory; +import org.apache.commons.fileupload.disk.DiskFileItemFactory; +import org.apache.http.entity.ContentType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.commons.CommonsMultipartFile; + +import java.io.IOException; +import java.io.OutputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 疫苗接种记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-06 + */ +@Slf4j +@Service +public class IcVaccineServiceImpl extends BaseServiceImpl implements IcVaccineService, ResultDataResolver { + + @Autowired + private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; + @Autowired + private OssFeignClient ossFeignClient; + @Autowired + private IcVaccineRelationDao icVaccineRelationDao; + @Autowired + private IcResiUserDao icResiUserDao; + @Autowired + private UserService userService; + + /** + * @Author sun + * @Description 【疫苗】本组织及下级疫苗接种信息列表 + * + * @param formDTO + * @return*/ + @Override + public PageData icVaccineList(VaccineListFormDTO formDTO) { + //1.根据是查询客户数据还是本辖区数据走不同逻辑 + if ("current".equals(formDTO.getSearchType())) { + //本辖区数据 + //2.获取工作人员缓存信息 + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); + if (null == staffInfo) { + throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); + } + formDTO.setAgencyId(staffInfo.getAgencyId()); + //3.按条件查询业务数据 + PageInfo data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()) + .doSelectPageInfo(() -> baseDao.getIcVaccineList(formDTO)); + return new PageData(data.getList(), data.getTotal()); + } else if ("all".equals(formDTO.getSearchType())) { + //客户下数据 + PageInfo data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()) + .doSelectPageInfo(() -> baseDao.getCustomerIcVaccineList(formDTO)); + return new PageData(data.getList(), data.getTotal()); + } + + return new PageData(new ArrayList(), 0); + } + + /** + * @Author zxc + * @Description 【疫苗】疫苗接种信息同步 + **/ + @Override + @Transactional(rollbackFor = Exception.class) + public void synchro(VaccineListFormDTO formDTO) { + //1.检验疫苗基础信息是否存在 + IcVaccineEntity entity = baseDao.selectById(formDTO.getIcVaccineId()); + if (null == entity) { + log.error(String.format("疫苗记录数据不存在同步失败,疫苗记录Id->%s", formDTO.getIcVaccineId())); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "数据同步失败,疫苗记录数据不存在"); + } + //获取工作人员缓存数据 + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); + if (null == staffInfo) { + throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); + } + //2.不管是否已存在关系数据都是先删后增 + icVaccineRelationDao.delRelation(formDTO.getIcVaccineId(), staffInfo.getAgencyId()); + //3.新增关系数据 + IcVaccineRelationEntity icVaccineRelationEntity = new IcVaccineRelationEntity(); + icVaccineRelationEntity.setCustomerId(formDTO.getCustomerId()); + icVaccineRelationEntity.setIcVaccineId(formDTO.getIcVaccineId()); + icVaccineRelationEntity.setAgencyId(staffInfo.getAgencyId()); + icVaccineRelationEntity.setPids(com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(staffInfo.getAgencyPIds())?staffInfo.getAgencyPIds()+":"+staffInfo.getAgencyId():staffInfo.getAgencyId()); + icVaccineRelationEntity.setUserType("synchro"); + icVaccineRelationDao.insert(icVaccineRelationEntity); + } + + /** + * @Author zxc + * @Description 【疫苗】疫苗接种信息取消同步 + * + * @param formDTO*/ + @Override + @Transactional(rollbackFor = Exception.class) + public void cancelSynchro(VaccineListFormDTO formDTO) { + //1.获取工作人员缓存数据 + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); + if (null == staffInfo) { + throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); + } + //1.物理删除关系数据 + if (icVaccineRelationDao.delRelation(formDTO.getIcVaccineId(), staffInfo.getAgencyId()) < NumConstant.ONE) { + log.error(String.format("数据取消同步失败,疫苗记录Id->%s", formDTO.getAgencyId())); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "取消同步操作失败"); + } + } + + @Async + @Override + public void execAsyncExcelImport(Path filePath, String importTaskId) { + String userId = null; + try { + userId = EpmetRequestHolder.getHeader(AppClientConstant.USER_ID); + String app = EpmetRequestHolder.getHeader(AppClientConstant.APP); + String client = EpmetRequestHolder.getHeader(AppClientConstant.CLIENT); + + LoginUserDetailsResultDTO loginUserDetails = userService.getLoginUserDetails(app, client, userId); + + String agencyId = loginUserDetails.getAgencyId(); + + IcVaccineExcelImportListener listener = new IcVaccineExcelImportListener(userId, agencyId, loginUserDetails.getOrgIdPath().replace(":".concat(agencyId), ""), this); + + EasyExcel.read(filePath.toFile(), IcVaccineImportExcelData.class, listener).headRowNumber(2).sheet(0).doRead(); + + Path errorDescFile = null; + String errorDesFileUrl = null; + + List errorRows = listener.getErrorRows(); + List otherRows = listener.getOtherRows(); + + boolean failed = errorRows.size() > 0; + + // 合并到一起写入 + errorRows.addAll(otherRows); + + // 生成并上传描述文件 + if (errorRows.size() > 0) { + try { + // 文件生成 + Path errorDescDir = FileUtils.getAndCreateDirUnderEpmetFilesDir("ic_vaccine", "import", "error_des"); + String fileName = UUID.randomUUID().toString().concat(".xlsx"); + errorDescFile = errorDescDir.resolve(fileName); + + FileItemFactory factory = new DiskFileItemFactory(16, errorDescDir.toFile()); + FileItem fileItem = factory.createItem("file", ContentType.APPLICATION_OCTET_STREAM.toString(), true, fileName); + OutputStream os = fileItem.getOutputStream(); + + EasyExcel.write(os, IcNatImportExcelData.RowRemarkMessage.class).sheet("信息列表").doWrite(errorRows); + // 文件上传oss + Result errorDesFileUploadResult = ossFeignClient.uploadImportTaskDescFile(new CommonsMultipartFile(fileItem)); + if (errorDesFileUploadResult.success()) { + errorDesFileUrl = errorDesFileUploadResult.getData().getUrl(); + } + + } finally { + if (Files.exists(errorDescFile)) { + Files.delete(errorDescFile); + } + } + } + + ImportTaskCommonFormDTO importFinishTaskForm = new ImportTaskCommonFormDTO(); + importFinishTaskForm.setTaskId(importTaskId); + importFinishTaskForm.setProcessStatus(failed ? ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL : ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS); + importFinishTaskForm.setOperatorId(userId); + importFinishTaskForm.setResultDesc(""); + importFinishTaskForm.setResultDescFilePath(errorDesFileUrl); + + Result result = commonServiceOpenFeignClient.finishImportTask(importFinishTaskForm); + if (!result.success()) { + log.error("【疫苗接种导入】finishImportTask失败"); + } + } catch (Exception e) { + String errorMsg = ExceptionUtils.getErrorStackTrace(e); + log.error("【疫苗接种导入】出错:{}", errorMsg); + + ImportTaskCommonFormDTO importFinishTaskForm = new ImportTaskCommonFormDTO(); + importFinishTaskForm.setTaskId(importTaskId); + importFinishTaskForm.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL); + importFinishTaskForm.setOperatorId(userId); + importFinishTaskForm.setResultDesc("导入失败"); + + Result result = commonServiceOpenFeignClient.finishImportTask(importFinishTaskForm); + if (!result.success()) { + log.error("【疫苗接种导入】导入记录状态修改为'完成'失败"); + } + } finally { + // 删除临时文件 + if (Files.exists(filePath)) { + try { + Files.delete(filePath); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + } + + /** + * 批量持久化 + * @param entities + */ + public void batchPersist(List entities, IcVaccineExcelImportListener listener) { + String customerId = EpmetRequestHolder.getHeader(AppClientConstant.CUSTOMER_ID); + String currentUserId = EpmetRequestHolder.getHeader(AppClientConstant.USER_ID); + + entities.forEach(e -> { + try { + persisVaccine(e, customerId, currentUserId, listener); + } catch (Exception exception) { + String errorMsg = ExceptionUtils.getErrorStackTrace(exception); + log.error(errorMsg); + + IcVaccineImportExcelData.RowRemarkMessage errorRow = new IcVaccineImportExcelData.RowRemarkMessage(); + errorRow.setName(e.getName()); + errorRow.setMobile(e.getMobile()); + errorRow.setIdCard(e.getIdCard()); + errorRow.setErrorInfo("未知系统错误"); + listener.getErrorRows().add(errorRow); + } + }); + } + + /** + * 单条持久化 + * @param e + * @param customerId + * @param currentUserId + * @param listener + */ + @Transactional(rollbackFor = Exception.class) + public void persisVaccine(IcVaccineEntity e, String customerId, String currentUserId, IcVaccineExcelImportListener listener) { + List otherRows = listener.getOtherRows(); + String agencyPids = listener.getCurrentAgencyPids(); + String agencyId = listener.getCurrentAgencyId(); + + String idCard = e.getIdCard(); + String name = e.getName(); + String mobile = e.getMobile(); + String manufacturer = e.getManufacturer(); + Date inoculateTime = e.getInoculateTime(); + String inoculateAddress = e.getInoculateAddress(); + + // 居民信息 + IcResiUserEntity resi = getResi(customerId, idCard, null); + + //1.先看客户下有没有这个人 + IcVaccineEntity resiVaccine = getResiVaccine(customerId, idCard, inoculateTime); + if (resiVaccine != null && !"import".equals(resiVaccine.getUserType())) { + // 有这个人,并且不是导入的 + String message = "已存在该次疫苗接种录入记录,请到系统中修改"; + + IcVaccineImportExcelData.RowRemarkMessage errorRow = new IcVaccineImportExcelData.RowRemarkMessage(); + errorRow.setName(name); + errorRow.setMobile(mobile); + errorRow.setIdCard(idCard); + errorRow.setErrorInfo(message); + otherRows.add(errorRow); + return; + } + + if (resiVaccine != null) { + boolean needUpdate = false; + + // 有这个人,也是导入的,那就要更新le + Boolean isNameChanged = false; + if (!name.equals(resiVaccine.getName())) { + isNameChanged = true; + resiVaccine.setName(name); + needUpdate = true; + } + + if (!inoculateAddress.equals(resiVaccine.getInoculateAddress())) { + resiVaccine.setInoculateAddress(inoculateAddress); + needUpdate = true; + } + + if (!manufacturer.equals(resiVaccine.getManufacturer())) { + resiVaccine.setManufacturer(manufacturer); + needUpdate = true; + } + + if (!mobile.equals(resiVaccine.getMobile())) { + resiVaccine.setMobile(mobile); + needUpdate = true; + } + + if (isNameChanged) { + String message = "平台存在相同记录身份证号与姓名不一致,已更新最新姓名"; + IcVaccineImportExcelData.RowRemarkMessage errorRow = new IcVaccineImportExcelData.RowRemarkMessage(); + errorRow.setName(name); + errorRow.setMobile(mobile); + errorRow.setIdCard(idCard); + errorRow.setErrorInfo(message); + otherRows.add(errorRow); + } + + if (needUpdate) { + resiVaccine.setUpdatedBy(currentUserId); + resiVaccine.setUpdatedTime(new Date()); + + resiVaccine.setIsResiUser(resi != null ? "1" : "0"); + + baseDao.updateById(resiVaccine); + } + + // 建立关系 + if (resi != null) { + createVaccineRelation(resiVaccine.getId(), resi.getAgencyId(), resi.getPids()); + } + + return; + } + + // 执行新增操作 + e.setIsResiUser(resi != null ? "1" : "0"); + e.setUserType("import"); + + baseDao.insert(e); + + // 只要是居民,就创建上关系 + if (resi != null) { + createVaccineRelation(e.getId(), resi.getAgencyId(), resi.getPids()); + } + } + + /** + * 是否是指定条件下的居民; + * 0:否 + * 1:是 + * @param customerId + * @param idCard + * @return + */ + public IcResiUserEntity getResi(String customerId, String idCard, String pids) { + LambdaQueryWrapper query = new LambdaQueryWrapper(); + query.eq(IcResiUserEntity::getCustomerId, customerId); + query.eq(IcResiUserEntity::getIdCard, idCard); + if (StringUtils.isNotBlank(pids)) { + query.likeRight(IcResiUserEntity::getPids, pids); + } + return icResiUserDao.selectOne(query); + } + + /** + * + * @param customerId + * @param idCard + * @return + */ + public IcVaccineEntity getResiVaccine(String customerId, String idCard, Date natTime) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(IcVaccineEntity::getCustomerId, customerId); + query.eq(IcVaccineEntity::getIdCard, idCard); + query.eq(IcVaccineEntity::getInoculateTime, natTime); + return baseDao.selectOne(query); + } + + /** + * 创建关系 + * @param vaccineId + * @param currentUserAgencyId + */ + private void createVaccineRelation(String vaccineId, String currentUserAgencyId, String agencyPids) { + + // 没有关系创建关系,有关系就跳过 + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(IcVaccineRelationEntity::getIcVaccineId, vaccineId); + query.eq(IcVaccineRelationEntity::getAgencyId, currentUserAgencyId); + if (icVaccineRelationDao.selectCount(query) > 0) { + return; + } + + IcVaccineRelationEntity relation = new IcVaccineRelationEntity(); + relation.setAgencyId(currentUserAgencyId); + relation.setPids(String.join(":", Arrays.asList(agencyPids, currentUserAgencyId))); + relation.setIcVaccineId(vaccineId); + relation.setUserType("import"); + icVaccineRelationDao.insert(relation); + } + + /** + * 获取居民疫苗接种信息 + * + * @param idCard + * @Param idCard + * @Return {@link List< VaccineListDTO >} + * @Author zhaoqifeng + * @Date 2022/3/30 10:24 + */ + @Override + public List getVaccineList(String customerId, String idCard) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(IcVaccineEntity::getCustomerId, customerId); + wrapper.eq(IcVaccineEntity::getIdCard, idCard); + wrapper.orderByDesc(IcVaccineEntity::getInoculateTime); + List list = baseDao.selectList(wrapper); + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyList(); + } + return list.stream().map(item -> { + VaccineListDTO dto = new VaccineListDTO(); + dto.setAddress(item.getInoculateAddress()); + dto.setManufactor(item.getManufacturer()); + dto.setVaccinateTime(DateUtils.format(item.getInoculateTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE)); + return dto; + }).collect(Collectors.toList()); + } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/PatrolRoutineWorkServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/PatrolRoutineWorkServiceImpl.java index 78d860fe7e..c3ba03acb8 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/PatrolRoutineWorkServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/PatrolRoutineWorkServiceImpl.java @@ -42,6 +42,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.YuShanSysApiService; +import com.epmet.commons.tools.utils.poi.excel.FreezeAndFilter; import com.epmet.constant.SystemMessageType; import com.epmet.dao.PatrolRoutineWorkDao; import com.epmet.dao.StatsStaffPatrolRecordDailyDao; @@ -224,7 +225,7 @@ public class PatrolRoutineWorkServiceImpl extends BaseServiceImpl ) - \ No newline at end of file + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml index 8392bf5856..5c4ad0b6e7 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml @@ -15,7 +15,8 @@ nat_result natResult, nat_address natAddress, file_name fileName, - attachment_url attachmentUrl + attachment_url attachmentUrl, + created_time reportTime FROM ic_nat WHERE diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiCollectDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiCollectDao.xml index 98725fa04e..777622c9f5 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiCollectDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiCollectDao.xml @@ -84,6 +84,5 @@ AND ( m.CREATED_BY = #{userId} OR m.UPDATED_BY = #{userId} ) ORDER BY m.UPDATED_TIME DESC - LIMIT 1 \ No newline at end of file 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 b3fef04dbc..d5fb91de45 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 @@ -658,7 +658,7 @@ ic_resi_user a LEFT JOIN ( SELECT ID_CARD, count( id ) AS count - FROM ic_resi_vaccine + FROM ic_vaccine WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} AND DATE_FORMAT(INOCULATE_TIME,"%Y-%m-%d") > #{startDate} @@ -680,6 +680,7 @@ GROUP BY ID_CARD ) c ON a.ID_CARD = c.ID_CARD WHERE a.DEL_FLAG = '0' + AND a.`STATUS` = '0' AND a.CUSTOMER_ID = #{customerId} @@ -738,6 +739,7 @@ FROM ic_resi_user a LEFT JOIN ( SELECT ID_CARD, count( id ) AS count,created_time FROM ic_nat WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} GROUP BY ID_CARD ) c ON a.ID_CARD = c.ID_CARD WHERE a.DEL_FLAG = '0' + and a.status = 0 AND a.CUSTOMER_ID = #{customerId} @@ -773,8 +775,9 @@ b.created_time, IFNULL( b.count, 0 ) AS vaccineCount FROM ic_resi_user a - LEFT JOIN ( SELECT ID_CARD, count( id ) AS count,created_time FROM ic_resi_vaccine WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} GROUP BY ID_CARD ) b ON a.ID_CARD = b.ID_CARD + LEFT JOIN ( SELECT ID_CARD, count( id ) AS count,created_time FROM ic_vaccine WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} GROUP BY ID_CARD ) b ON a.ID_CARD = b.ID_CARD WHERE a.DEL_FLAG = '0' + and a.status = 0 AND a.CUSTOMER_ID = #{customerId} diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiVaccineDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiVaccineDao.xml deleted file mode 100644 index a330bccba9..0000000000 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiVaccineDao.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml index f667e9826d..0ccd2c31d8 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml @@ -57,7 +57,7 @@ AND ARRIVE_DATE #{endDate} ORDER BY - r.CREATED_TIME DESC + r.ARRIVE_DATE DESC diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineDao.xml new file mode 100644 index 0000000000..9eb104ad06 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineDao.xml @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + DELETE FROM ic_nat WHERE id = #{icNatId} + + + + INSERT INTO epmet_user.ic_nat + (ID, CUSTOMER_ID, AGENCY_ID, PIDS, USER_ID, + USER_TYPE, NAME, MOBILE, ID_CARD, NAT_TIME, NAT_RESULT, NAT_ADDRESS, FILE_NAME, ATTACHMENT_TYPE, ATTACHMENT_URL, + DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME) + VALUES (#{id}, #{customerId}, #{agencyId}, #{pids}, #{userId}, + #{userType}, #{name}, #{mobile}, #{idCard}, #{natTime}, + #{natResult}, #{natAddress}, #{fileName}, #{attachmentType}, #{attachmentUrl}, + #{delFlag}, #{revision}, #{createdBy}, #{createdTime}, #{updatedBy}, + #{updatedTime}) + ON DUPLICATE KEY update + NAME=#{name}, + MOBILE=#{mobile}, + NAT_ADDRESS=#{natAddress}, + NAT_RESULT=#{natResult}, + UPDATED_BY=#{updatedBy}, + UPDATED_TIME=NOW() + + + UPDATE ic_nat m, + ( + SELECT if(DEL_FLAG,0,1) resiFlag, ID_CARD FROM ic_resi_user + WHERE + 1=1 + + AND ID = #{icResiUserId} + + AND CUSTOMER_ID = #{customerId} + AND DEL_FLAG = '0' + ) t + SET m.IS_RESI_USER = t.resiFlag + WHERE + m.ID_CARD = t.ID_CARD + AND m.DEL_FLAG = '0' + + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineRelationDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineRelationDao.xml new file mode 100644 index 0000000000..011c1c7de1 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineRelationDao.xml @@ -0,0 +1,16 @@ + + + + + + + DELETE + FROM ic_vaccine_relation + WHERE + ic_vaccine_id = #{icVaccineId} + + AND AGENCY_ID = #{agencyId} + + + + \ No newline at end of file