diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/PageFormDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/PageFormDTO.java index fe22284567..723f5d062c 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/PageFormDTO.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/PageFormDTO.java @@ -33,7 +33,7 @@ public class PageFormDTO implements Serializable { */ private Integer offset; - private boolean isPage = true; + private Boolean isPage = true; public Integer getOffset() { return (pageNo-1)*pageSize; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/ChannelEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/ChannelEnum.java index 389338f717..c1305d0e5a 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/ChannelEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/ChannelEnum.java @@ -1,6 +1,6 @@ package com.epmet.commons.tools.enums; -import com.epmet.commons.tools.exception.EpmetErrorCode; +import java.util.Objects; /** * @author Administrator @@ -22,11 +22,11 @@ public enum ChannelEnum { public static String getName(String code) { ChannelEnum[] houseTypeEnums = values(); for (ChannelEnum houseTypeEnum : houseTypeEnums) { - if (houseTypeEnum.getCode() == code) { + if (Objects.equals(houseTypeEnum.getCode(), code)) { return houseTypeEnum.getName(); } } - return EpmetErrorCode.SERVER_ERROR.getMsg(); + return null; } public static String getCode(String name) { 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 4614beb5ba..e0623c7648 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 @@ -251,6 +251,7 @@ public enum EpmetErrorCode { ORG_EDIT_FAILED(8920,"编辑失败"), ORG_DEL_FAILED(8921,"删除失败"), NEIGHBORHOOD_DEL_FAILED(8922,""), + IC_NAT_IDCARD_NATTIME(8923,"已存在相同记录"), //通用错误码 start diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java index f956423f3a..a28a038f7b 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java @@ -60,7 +60,7 @@ public class DateUtils { public static final String DATE_PATTERN_YYYY_MM = "yyyy-MM"; public static final String WEEK_TYPE_ENGLISH = "english"; public static final String WEEK_TYPE_CHINESE = "chinese"; - + public static final String DATE_PATTERN_MMDD = "MMdd"; /** * 日期格式化 日期格式为:yyyy-MM-dd * @param date 日期 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 90b840f4f7..9bc34d0a39 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 @@ -132,14 +132,20 @@ public class ExcelUtils { return response.getOutputStream(); } + /** + * desc:easypoi导出多个sheet + * @param fileName + * @param list + * @param response + * @throws Exception + */ public static void exportMultiSheetExcel(String fileName, List list, HttpServletResponse response) throws Exception { List> excel = new ArrayList<>(); for(ExportMultiView view :list){ Map sheet = new HashMap<>(); sheet.put("title",view.getExportParams()); sheet.put("entity",view.getCls()); - List dataList = view.getDataList(); - sheet.put("data", dataList); + sheet.put("data", view.getDataList()); excel.add(sheet); } Workbook workbook = ExcelExportUtil.exportExcel(excel, ExcelType.XSSF); 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/excel/ExportMultiView.java index 815585a1e3..ff69b2c4b0 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/excel/ExportMultiView.java @@ -16,8 +16,17 @@ import java.util.List; @Data @AllArgsConstructor public class ExportMultiView { + /** + * 导出的参数 比如设置表头 + */ private ExportParams exportParams; + /** + * 要导出的数据列 + */ private List dataList; + /** + * excel对应的类 + */ private Class cls; } diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenAgencyOrGridListDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenAgencyOrGridListDTO.java index 87e494d0b9..76adaddc40 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenAgencyOrGridListDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenAgencyOrGridListDTO.java @@ -3,6 +3,7 @@ package com.epmet.dataaggre.dto.evaluationindex; import lombok.Data; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; /** @@ -19,7 +20,7 @@ public class ScreenAgencyOrGridListDTO implements Serializable { /** * 所有下级网格列表 */ - private List allGridList; + private List allGridList = new ArrayList<>(); @Data public static class AgencyGrid { diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/result/CategoryProjectResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/result/CategoryProjectResultDTO.java index 5386febe19..8dc9102b84 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/result/CategoryProjectResultDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/result/CategoryProjectResultDTO.java @@ -54,6 +54,8 @@ public class CategoryProjectResultDTO implements Serializable { //二级分类code @JsonIgnore private String categoryCode; + + private String topicId; } } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govissue/IssueDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govissue/IssueDao.java index 17d16fd72d..39b9184284 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govissue/IssueDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govissue/IssueDao.java @@ -39,15 +39,15 @@ import java.util.List; public interface IssueDao extends BaseDao { /** - * @Description 查询议题【表决中、已关闭】 + * @Description 查询议题【表决中、已关闭】 * @Param gridIds * @author zxc * @date 2020/12/25 下午2:19 */ - List issueStatusClosedOrVoting(@Param("gridIds") List gridIds, @Param("issueStatus")String issueStatus); + List issueStatusClosedOrVoting(@Param("gridIds") List gridIds, @Param("issueStatus") String issueStatus); /** - * @Description 查询已转项目议题 + * @Description 查询已转项目议题 * @Param gridIds * @author zxc * @date 2020/12/25 下午5:27 @@ -72,7 +72,7 @@ public interface IssueDao extends BaseDao { **/ List selectClosedListGov(ClosedIssueListFormDTO fromDTO); - Integer selectIssueCount(@Param("gridIds") List gridIds,@Param("issueType")String issueType); + Integer selectIssueCount(@Param("gridIds") List gridIds, @Param("issueType") String issueType); List selectShiftProjectIssueList(@Param("customerId") String customerId, @Param("gridId") String gridId); @@ -81,4 +81,12 @@ public interface IssueDao extends BaseDao { * @author sun **/ List getCategoryList(@Param("customerId") String customerId, @Param("level") String level, @Param("isDisable") String isDisable); -} \ No newline at end of file + + /** + * desc:根据议题id获取对应的话题id + * + * @param ids + * @return + */ + List selectIssueTopicIdType(@Param("ids") List ids); +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/excel/CustomerDataManageExcel.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/excel/CustomerDataManageExcel.java index 024562fdf4..80cbe66693 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/excel/CustomerDataManageExcel.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/excel/CustomerDataManageExcel.java @@ -11,7 +11,7 @@ import lombok.Data; @Data public class CustomerDataManageExcel { - @Excel(name = "组织",width = 20) + @Excel(name = "组织",width = 25) private String orgName; @Excel(name = "用户数",width = 10) @@ -35,7 +35,7 @@ public class CustomerDataManageExcel { @Excel(name = "项目数",width = 10) private Integer projectCount; - @Excel(name = "结案项目数",width = 10) + @Excel(name = "结案项目数",width = 12) private Integer closedProjectCount; @Excel(name = "巡查人数",width = 10) 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 afa93f3853..e55db49a65 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 @@ -1887,20 +1887,16 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve String fileName = excelName(formDTO); ExportParams exportParams = new ExportParams(fileName,fileName); - //exportParams.setAutoSize(true); List exportList = new ArrayList<>(); List excelList = ConvertUtils.sourceToTarget(result, CustomerDataManageExcel.class); exportList.add(new ExportMultiView(exportParams,excelList,CustomerDataManageExcel.class)); - if (formDTO.isExport()){ + if (CollectionUtils.isNotEmpty(operateExport.getAllGridList())){ List gridResult = operateExport.getAllGridList(); setTotal(gridResult); ExportParams exportParams2 = new ExportParams(fileName,"网格数据"); - //exportParams2.setAutoSize(true); List excelList2 = ConvertUtils.sourceToTarget(gridResult, CustomerDataManageExcel.class); exportList.add(new ExportMultiView(exportParams2,excelList2,CustomerDataManageExcel.class)); } - //ExcelUtils.exportExcelToTargetDisposeAll(response,fileName,result, CustomerDataManageExcel.class); - ExcelUtils.exportMultiSheetExcel(fileName, exportList, response); } @@ -2008,7 +2004,8 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve //获取组织级别数据 CustomerDataManageResultDTO resultDTO = getDataManageResultDTO(formDTO, startTimeForm, agencyGrid.getAgencyGridList(),agencyGrid.getLevel()); resultDTO.setTotal(idList.size()); - if (formDTO.isExport()){ + //网格List不为空则 查询网格数据 (仅限查询组织id为街道级别时) + if (CollectionUtils.isNotEmpty(agencyGrid.getAllGridList())){ formDTO.setDataType(OrgTypeEnum.GRID.getCode()); idList = agencyGrid.getAllGridList().stream().map(ScreenAgencyOrGridListDTO.AgencyGrid::getOrgId).collect(Collectors.toList()); formDTO.setIdList(idList); diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/EvaluationIndexServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/EvaluationIndexServiceImpl.java index 66f964c3d9..7fa4518b2d 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/EvaluationIndexServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/EvaluationIndexServiceImpl.java @@ -1,7 +1,6 @@ package com.epmet.dataaggre.service.evaluationindex.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; -import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.enums.OrgLevelEnum; import com.epmet.commons.tools.exception.RenException; import com.epmet.dataaggre.constant.DataSourceConstant; @@ -187,9 +186,9 @@ public class EvaluationIndexServiceImpl implements EvaluationIndexService { //2.根据组织级别判断查询直属组织或网格列表 List agencyList = new ArrayList<>(); List gridList = new ArrayList<>(); - List finalAgencyGridList = agencyGridList; - if (isGetSubAllGrid && OrgLevelEnum.STREET.getCode().equals(dto.getLevel())){ - gridList = evaluationIndexDao.getSubAllGridByAgencyPath(dto.getPids().concat(StrConstant.COLON).concat(dto.getAgencyId())); + //孔村和组织级别为街道的查询下级所有网格 + if (isGetSubAllGrid && (OrgLevelEnum.STREET.getCode().equals(dto.getLevel()) || "1234085031077498881".equals(agencyId))){ + gridList = evaluationIndexDao.getSubAllGridByAgencyPath(dto.getAgencyId()); List allGridList = new ArrayList<>(); gridList.forEach(gr->{ ScreenAgencyOrGridListDTO.AgencyGrid org = new ScreenAgencyOrGridListDTO.AgencyGrid(); @@ -203,7 +202,7 @@ public class EvaluationIndexServiceImpl implements EvaluationIndexService { //2-1.直属下级组织列表 //2.判断客户是否存在子客户 List list = customerRelation.haveSubCustomer(dto.getCustomerId()); - if (!CollectionUtils.isNotEmpty(list)) { + if (CollectionUtils.isEmpty(list)) { agencyList = evaluationIndexDao.getSubAgencyListByAgency(agencyId, null, null); } else { list.add(dto.getCustomerId()); @@ -213,7 +212,7 @@ public class EvaluationIndexServiceImpl implements EvaluationIndexService { ScreenAgencyOrGridListDTO.AgencyGrid org = new ScreenAgencyOrGridListDTO.AgencyGrid(); org.setOrgId(gr.getAgencyId()); org.setOrgName(gr.getAgencyName()); - finalAgencyGridList.add(org); + agencyGridList.add(org); }); } else { //2-2.直属下级网格列表 @@ -222,7 +221,7 @@ public class EvaluationIndexServiceImpl implements EvaluationIndexService { ScreenAgencyOrGridListDTO.AgencyGrid org = new ScreenAgencyOrGridListDTO.AgencyGrid(); org.setOrgId(gr.getGridId()); org.setOrgName(gr.getGridName()); - finalAgencyGridList.add(org); + agencyGridList.add(org); }); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/GovIssueService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/GovIssueService.java index 3e87ea18d3..93001af72b 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/GovIssueService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/GovIssueService.java @@ -52,4 +52,11 @@ public interface GovIssueService { * @author sun **/ List categoryList(String customerId, String level, String isDisable); + + /** + * desc:根据id 获取议题的话题的话题Id + * @param collect + * @return + */ + List selectIssueTopicIdType(List collect); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/impl/GovIssueServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/impl/GovIssueServiceImpl.java index 5556d2d3f0..761adb17b2 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/impl/GovIssueServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/impl/GovIssueServiceImpl.java @@ -333,4 +333,13 @@ public class GovIssueServiceImpl implements GovIssueService { return issueDao.getCategoryList(customerId, level, isDisable); } + @Override + public List selectIssueTopicIdType(List ids) { + List dtoList = issueDao.selectIssueTopicIdType(ids); + if (CollectionUtils.isEmpty(dtoList)){ + return new ArrayList<>(); + } + return dtoList; + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java index 8619a74875..ed8b7928dc 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java @@ -14,6 +14,7 @@ import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; @@ -24,7 +25,6 @@ import com.epmet.dataaggre.dto.datastats.result.FactAgencyProjectResultDTO; import com.epmet.dataaggre.dto.govissue.IssueProjectCategoryDictDTO; import com.epmet.dataaggre.dto.govissue.result.IssueInfoDTO; import com.epmet.dataaggre.dto.govissue.result.IssueListResultDTO; -import com.epmet.dataaggre.dto.govorg.result.GridsInfoListResultDTO; import com.epmet.dataaggre.dto.govproject.ProjectDTO; import com.epmet.dataaggre.dto.govproject.ProjectRelatedPersonnelDTO; import com.epmet.dataaggre.dto.govproject.ResiEventDTO; @@ -81,6 +81,8 @@ public class GovProjectServiceImpl implements GovProjectService { private EvaluationIndexService evaluationIndexService; @Autowired private EpmetUserService epmetUserService; + @Autowired + private LoginUserUtil loginUserUtil; /** * @Description 查询项目信息 @@ -416,13 +418,13 @@ public class GovProjectServiceImpl implements GovProjectService { formDTO.setToDateId(DateUtils.dateOrmonthId(formDTO.getDateId(), "date", 1)); //1.查询客户下分类信息 List categoryList = govIssueService.categoryList(formDTO.getCustomerId(), null, null); - List categoreCodeList = categoryList.stream().filter(ca -> ca.getParentCategoryCode().equals(formDTO.getCategoryCode())).map(m -> m.getCategoryCode()).collect(Collectors.toList()); + List categoreCodeList = categoryList.stream().filter(ca -> ca.getParentCategoryCode().equals(formDTO.getCategoryCode())).map(IssueProjectCategoryDictDTO::getCategoryCode).collect(Collectors.toList()); formDTO.setCategoreCodeList(categoreCodeList); //2.查询组织及下级截止某一天的某个一级分类下的项目列表 PageInfo result = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()).doSelectPageInfo(() -> projectDao.categoryProjectList(formDTO)); - if (org.springframework.util.CollectionUtils.isEmpty(result.getList())) { + if (CollectionUtils.isEmpty(result.getList())) { return resultDTO; } resultDTO.setTotal((int) result.getTotal()); @@ -432,7 +434,7 @@ public class GovProjectServiceImpl implements GovProjectService { List list = projectDao.getCategoryList(projectIds); //4.查询来源事件的项目上报的组织信息 - List eventIds = result.getList().stream().filter(re -> "resi_event".equals(re.getOrigin())).map(m -> m.getOriginId()).collect(Collectors.toList()); + List eventIds = result.getList().stream().filter(re -> "resi_event".equals(re.getOrigin())).map(CategoryProjectResultDTO.Project::getOriginId).collect(Collectors.toList()); List eventOrgList = projectDao.getEventOrgList(eventIds); Map eventMap = eventOrgList.stream().collect(Collectors.toMap(ResiEventReportOrgDTO::getResiEventId, Function.identity())); @@ -440,11 +442,19 @@ public class GovProjectServiceImpl implements GovProjectService { List eventUser = projectDao.getEventList(projectIds); List topicUser = projectDao.getTopicUser(projectIds); + //市北客户查询 下议题区分下来源 设置topicId + Map issueTopicSourceMap = new HashMap<>(); + if (CustomerIdConstant.SHI_BEI_CUSTOMER_ID.equals(loginUserUtil.getLoginUserCustomerId())){ + issueTopicSourceMap = govIssueService.selectIssueTopicIdType(result.getList().stream() + .filter(re -> "issue".equals(re.getOrigin())) + .map(CategoryProjectResultDTO.Project::getOriginId) + .collect(Collectors.toList())).stream().collect(Collectors.toMap(IssueInfoDTO::getIssueId,IssueInfoDTO::getTopicId)); + } + //5.封装数据 //组织或网格id->组织或网格名称 Map map = new HashMap<>(); - result.getList().forEach(re -> { - //所属组织 + for (CategoryProjectResultDTO.Project re : result.getList()) {//所属组织 if ("issue".equals(re.getOrigin())) { if (map.containsKey(re.getGridId())) { re.setOrgName(map.get(re.getGridId())); @@ -455,6 +465,9 @@ public class GovProjectServiceImpl implements GovProjectService { map.put(re.getGridId(), gridInfo.getGridName()); } } + //市北议题来源的设置话题Id + re.setTopicId(issueTopicSourceMap.get(re.getOriginId())); + } else if ("agency".equals(re.getOrigin())) { if (map.containsKey(re.getAgencyId())) { re.setOrgName(map.get(re.getAgencyId())); @@ -519,7 +532,7 @@ public class GovProjectServiceImpl implements GovProjectService { re.setUserId(to.getUserId()); } }); - }); + } resultDTO.setList(result.getList()); return resultDTO; diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml index d6bd5022b9..70c5f2d7d6 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml @@ -165,6 +165,11 @@ AND parent_area_code = #{areaCode} + + + AND PIDS like concat(#{agencyId},'%') + AND LEVEL = 'community' + AND pid = #{agencyId} @@ -227,7 +232,7 @@ screen_customer_grid WHERE del_flag = '0' - AND all_parent_ids LIKE concat(#{fullAgencyPath},'%') + AND all_parent_ids LIKE concat('%',#{fullAgencyPath},'%') order by parentAgencyId,gridName diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueDao.xml index 90ecda4b20..495473205c 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueDao.xml @@ -139,5 +139,20 @@ ORDER BY category_code + - \ No newline at end of file + diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java index 0c27cbc878..cf4e4359c4 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java @@ -561,6 +561,8 @@ public class AgencyServiceImpl implements AgencyService { return nodes.get(0); } + + private void convertOrgTreeNode(List nodeList, ScreenCustomerAgencyDTO currentAgency) { OrgTreeNode orgTreeNode = ConvertUtils.sourceToTarget(currentAgency, OrgTreeNode.class); orgTreeNode.setOrgId(currentAgency.getAgencyId()); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java index 0752b72424..3bc6b5969d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java @@ -137,11 +137,14 @@ public class DataReportingServiceImpl implements DataReportingService { public List getEventInfo(EventInfoFormDTO formDTO) { List list; //根据入参,获取项目 + long start = System.currentTimeMillis(); List projectList = screenProjectDataService.getProjectList(formDTO.getCustomerId(), formDTO.getProjectId(), formDTO.getPageNo(), formDTO.getPageSize()); + log.error("事件上报-查询项目列表耗时:{}ms",System.currentTimeMillis()-start); //项目列表为空,返回空数组 if(CollectionUtils.isEmpty(projectList)) { return Collections.emptyList(); } + start = System.currentTimeMillis(); Map epmetCodeMap = new HashMap<>(); Result parentCustomer = operCrmOpenFeignClient.getExternalAndParentCustomerId(formDTO.getCustomerId()); if (StringUtils.isNotBlank(parentCustomer.getData())) { @@ -194,6 +197,7 @@ public class DataReportingServiceImpl implements DataReportingService { return dto; }).collect(Collectors.toList()); } + log.error("事件上报-组装数据耗时:{}ms",System.currentTimeMillis()-start); return list.stream().collect(collectingAndThen(toCollection(() -> new TreeSet<>(Comparator.comparing(EventInfoResultDTO::getId))), ArrayList::new)); } 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 8e7ef7eedb..e15f7f5057 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 @@ -15,10 +15,17 @@ public interface ImportTaskConstants { String BIZ_TYPE_COMMUNITY_SELF_ORG = "community_self_org"; String BIZ_TYPE_PARTY_UNIT = "party_unit"; String BIZ_TYPE_PARTY_ACTIVITY = "party_activity"; + String BIZ_TYPE_ATTENTION_NAT = "attention_nat"; + String BIZ_TYPE_ATTENTION_VACCINATION = "attention_vaccination"; + String BIZ_TYPE_ATTENTION_TRIP_REPORT = "attention_vaccination"; /** * 核酸检测 */ String BIZ_TYPE_IC_NAT = "ic_nat"; + /** + * 行程上报 + */ + String BIZ_TYPE_IC_TRIP_REPORT = "ic_trip_report"; /** * 处理状态:处理中 diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/AreaCodeFormDTO.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/AreaCodeFormDTO.java new file mode 100644 index 0000000000..bc88cf3a28 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/AreaCodeFormDTO.java @@ -0,0 +1,9 @@ +package com.epmet.dto.form; + +import lombok.Data; + +@Data +public class AreaCodeFormDTO { + private String parentAreaCode; + private String parentLevel; +} diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/AreaCodeResultDTO.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/AreaCodeResultDTO.java new file mode 100644 index 0000000000..7b09f4f020 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/AreaCodeResultDTO.java @@ -0,0 +1,11 @@ +package com.epmet.dto.result; + +import lombok.Data; + +@Data +public class AreaCodeResultDTO { + private String areaCode; + private String parentCode; + private String areaName; + private String level; +} diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/AreaCodeController.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/AreaCodeController.java index df821f7410..7bf4e537f8 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/AreaCodeController.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/AreaCodeController.java @@ -28,7 +28,9 @@ import com.epmet.dto.AreaCodeDTO; import com.epmet.dto.form.AddAreaCodeDictFormDTO; import com.epmet.dto.form.AddAreaCodeFormDTO; import com.epmet.dto.form.AreaCodeDictFormDTO; +import com.epmet.dto.form.AreaCodeFormDTO; import com.epmet.dto.result.AreaCodeDictResultDTO; +import com.epmet.dto.result.AreaCodeResultDTO; import com.epmet.service.AreaCodeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -121,4 +123,14 @@ public class AreaCodeController { ValidatorUtils.validateEntity(formDTO); return new Result().ok(areaCodeService.addAreaCode(formDTO)); } + + /** + * 行政地区编码逐级查询 + * @param formDTO + * @return + */ + @PostMapping(value = "nextarea") + public Result> nextArea(@RequestBody AreaCodeFormDTO formDTO){ + return new Result>().ok(areaCodeService.nextArea(formDTO)); + } } \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/AreaCodeDao.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/AreaCodeDao.java index 54b89ee82f..bfe5c8139e 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/AreaCodeDao.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/AreaCodeDao.java @@ -19,8 +19,10 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.AreaCodeDTO; +import com.epmet.dto.result.AreaCodeResultDTO; import com.epmet.entity.AreaCodeEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -40,4 +42,14 @@ public interface AreaCodeDao extends BaseDao { AreaCodeDTO selectByCityCode(String cityCode); AreaCodeDTO selectMaxCounty(String cityCode); + + List selectProvince(); + + List selectCity(@Param("pCode")String pCode); + + List selectDistrict(@Param("pCode")String pCode); + + List selectStreet(@Param("pCode")String pCode); + + List selectCommunity(@Param("pCode")String pCode); } \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/AreaCodeService.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/AreaCodeService.java index 99c25ab2f2..e452332fea 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/AreaCodeService.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/AreaCodeService.java @@ -23,7 +23,9 @@ import com.epmet.dto.AreaCodeDTO; import com.epmet.dto.form.AddAreaCodeDictFormDTO; import com.epmet.dto.form.AddAreaCodeFormDTO; import com.epmet.dto.form.AreaCodeDictFormDTO; +import com.epmet.dto.form.AreaCodeFormDTO; import com.epmet.dto.result.AreaCodeDictResultDTO; +import com.epmet.dto.result.AreaCodeResultDTO; import com.epmet.entity.AreaCodeEntity; import java.util.List; @@ -123,4 +125,6 @@ public interface AreaCodeService extends BaseService { * @Date 2021/4/13 14:40 **/ String addAreaCode(AddAreaCodeFormDTO formDTO); + + List nextArea(AreaCodeFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java index 0de5ddac2b..f300c4bb4e 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java @@ -38,7 +38,9 @@ import com.epmet.dto.AreaCodeDTO; import com.epmet.dto.form.AddAreaCodeDictFormDTO; import com.epmet.dto.form.AddAreaCodeFormDTO; import com.epmet.dto.form.AreaCodeDictFormDTO; +import com.epmet.dto.form.AreaCodeFormDTO; import com.epmet.dto.result.AreaCodeDictResultDTO; +import com.epmet.dto.result.AreaCodeResultDTO; import com.epmet.entity.AreaCodeEntity; import com.epmet.redis.AreaCodeRedis; import com.epmet.service.AreaCodeChildService; @@ -688,6 +690,35 @@ public class AreaCodeServiceImpl extends BaseServiceImpl nextArea(AreaCodeFormDTO formDTO) { + if(StringUtils.isBlank(formDTO.getParentAreaCode())&&StringUtils.isBlank(formDTO.getParentLevel())){ + return baseDao.selectProvince(); + } + List list=new ArrayList<>(); + switch (formDTO.getParentLevel()) { + case AreaCodeConstant.PROVINCE: + list = baseDao.selectCity(formDTO.getParentAreaCode()); + break; + case AreaCodeConstant.CITY: + list = baseDao.selectDistrict(formDTO.getParentAreaCode()); + break; + case AreaCodeConstant.DISTRICT: + list = baseDao.selectStreet(formDTO.getParentAreaCode()); + break; + case AreaCodeConstant.STREET: + list = baseDao.selectCommunity(formDTO.getParentAreaCode()); + break; + case AreaCodeConstant.COMMUNITY: + log.info("社区无下级"); + list=null; + break; + default: + log.warn("parentLevel错误:"+formDTO.getParentLevel()); + } + return list; + } + private String addDistrictAreaCode(String cityCode, String countyName) { AreaCodeDTO city = baseDao.selectByCityCode(cityCode); diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ImportTaskServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ImportTaskServiceImpl.java index cb28fecad8..795f553af5 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ImportTaskServiceImpl.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ImportTaskServiceImpl.java @@ -98,7 +98,7 @@ public class ImportTaskServiceImpl implements ImportTaskService { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(ImportTaskEntity::getOperatorId,param.getOperatorId()) .orderByDesc(ImportTaskEntity::getStartTime); - Page page = PageHelper.startPage(param.getPageNo(), param.getPageSize(), param.isPage()).doSelectPage(() -> { + Page page = PageHelper.startPage(param.getPageNo(), param.getPageSize(), param.getIsPage()).doSelectPage(() -> { importRecordDao.selectList(queryWrapper); }); List list = new ArrayList<>(); diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/AreaCodeDao.xml b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/AreaCodeDao.xml index 9eaffba75a..eca90f2415 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/AreaCodeDao.xml +++ b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/AreaCodeDao.xml @@ -27,4 +27,85 @@ order by ac.COUNTY_CODE desc limit 1 + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddPlacePatrolRecordFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddPlacePatrolRecordFormDTO.java index cb8b6b2724..4a861062c2 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddPlacePatrolRecordFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddPlacePatrolRecordFormDTO.java @@ -122,6 +122,9 @@ public class AddPlacePatrolRecordFormDTO implements Serializable { //token中userId private String staffId; - public interface Add {} + @NotBlank(message = "placePatrolRecordId不能为空", groups = {Update.class}) + private String placePatrolRecordId; + public interface Add {} + public interface Update {} } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseInfoDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseInfoDTO.java index 3a3ca19096..ae5a6d07ba 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseInfoDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseInfoDTO.java @@ -78,4 +78,17 @@ public class HouseInfoDTO implements Serializable { private String allName; private String customerId; + + /** + * 小区所在的组织id + */ + private String agencyId; + /** + * eg:市北区-阜新路街道-南宁社区 + */ + private String agencyPathName; + /** + * 组织的area_code + */ + private String areaCode; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java index ab86eb425b..9aac6abbd4 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java @@ -291,4 +291,16 @@ public class HouseController implements ResultDataResolver { return new Result(); } + /** + * 获取房屋信息 + * @param houseId + * @return + */ + @PostMapping("gethouseinfo/{houseId}") + public Result getHouseInfo(@LoginUser TokenDto tokenDto,@PathVariable("houseId") String houseId){ + if(StringUtils.isBlank(houseId)){ + return new Result<>(); + } + return new Result().ok(houseService.getHouseInfoDTO(tokenDto.getCustomerId(),houseId)); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlacePatrolRecordController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlacePatrolRecordController.java index 0d2c02a3d6..bd232e2ca7 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlacePatrolRecordController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlacePatrolRecordController.java @@ -60,6 +60,19 @@ public class IcPlacePatrolRecordController { return new Result(); } + /** + * @Author sun + * @Description 新增场所巡查记录 + **/ + @PostMapping("update") + public Result update(@LoginUser TokenDto tokenDto, @RequestBody AddPlacePatrolRecordFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, AddPlacePatrolRecordFormDTO.Add.class,AddPlacePatrolRecordFormDTO.Update.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); + placePatrolRecordService.update(formDTO); + return new Result(); + } + /** * @Author sun * @Description 删除场所巡查记录 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 31640c8206..4cd6ae33d6 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 @@ -139,10 +139,11 @@ public class ImportHouseInfoListener extends AnalysisEventListener result = null; List list = null; - if (params.isPage()){ + if (params.getIsPage()){ Page objects = PageHelper.startPage(params.getPageNo(), params.getPageSize()).doSelectPage(() -> { baseDao.selectList(wrapper); }); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolRecordServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolRecordServiceImpl.java index 5535988941..5ca0e8f74f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolRecordServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolRecordServiceImpl.java @@ -17,7 +17,6 @@ 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.dto.result.CustomerStaffInfoCacheResult; @@ -28,24 +27,17 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.IcPlacePatrolRecordDao; import com.epmet.dao.IcPlacePatrolTeamStaffDao; -import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.IcPlacePatrolTeamStaffDTO; import com.epmet.dto.form.AddPlacePatrolRecordFormDTO; import com.epmet.dto.form.GetListPlacePatrolRecordFormDTO; -import com.epmet.dto.form.GetListPlacePatrolTeamFormDTO; -import com.epmet.dto.result.*; -import com.epmet.entity.IcHouseEntity; +import com.epmet.dto.result.GetListPlacePatrolRecordResultDTO; +import com.epmet.dto.result.PlacePatrolRecordDetailResultDTO; import com.epmet.entity.IcPlacePatrolRecordEntity; -import com.epmet.entity.IcPlacePatrolTeamEntity; -import com.epmet.entity.IcPlacePatrolTeamStaffEntity; import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.service.IcPlacePatrolRecordService; import com.epmet.service.IcPlacePatrolReviewRecordService; -import com.epmet.service.IcPlacePatrolTeamService; -import com.epmet.service.IcPlacePatrolTeamStaffService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; -import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -90,6 +82,23 @@ public class IcPlacePatrolRecordServiceImpl extends BaseServiceImpl idCards; /** - * 关注类型,核酸检测:2,疫苗接种:1 + * 关注类型,核酸检测:2,疫苗接种:1,行程上报:0 */ @NotNull(message = "attentionType不能为空",groups = CancelAttentionPackageForm.class) private Integer attentionType ; 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 d848f1e545..83d22c6a13 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 @@ -56,6 +56,16 @@ public class EpidemicPreventionFormDTO extends PageFormDTO implements Serializab * 身份证 */ private String idCard; + + /** + * 开始日期 + */ + private String startDate; + + /** + * 结束日期 + */ + private String endDate; /** * 疫苗接种次数 */ @@ -64,4 +74,9 @@ public class EpidemicPreventionFormDTO extends PageFormDTO implements Serializab * 核酸检测次数 */ private Integer natCount; + + /** + * 关注类型,核酸检测:2,疫苗接种:1 + */ + private Integer attentionType; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java index 0088bb3183..d9a7f4d565 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java @@ -9,7 +9,9 @@ import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import java.io.Serializable; +import java.util.ArrayList; import java.util.Date; +import java.util.List; /** * 行程上报居民端入参 @@ -22,6 +24,19 @@ public class IcTripReportFormDTO implements Serializable { public interface ResiUserRequired extends CustomerClientShowGroup { } + public interface PcAddOrUpdateInternalGroup { + } + public interface PcAddRequired extends CustomerClientShowGroup { + } + public interface IcResiInternalGroup { + } + + public interface PcUpdateRequired extends CustomerClientShowGroup { + } + + @NotBlank(message = "主键不能为空", groups = {PcUpdateRequired.class}) + private String id; + /** * 客户Id */ @@ -30,37 +45,48 @@ public class IcTripReportFormDTO implements Serializable { /** * 姓名 */ - @NotBlank(message = "姓名不能为空", groups = {ResiUserRequired.class}) + @NotBlank(message = "姓名不能为空", groups = {ResiUserRequired.class,PcAddRequired.class,PcUpdateRequired.class}) private String name; /** * 手机号 */ - @NotBlank(message = "手机号不能为空", groups = {ResiUserRequired.class}) + @NotBlank(message = "手机号不能为空", groups = {ResiUserRequired.class,PcAddRequired.class,PcUpdateRequired.class}) private String mobile; /** * 身份证号 */ - @NotBlank(message = "身份证号不能为空", groups = {ResiUserRequired.class}) + @NotBlank(message = "身份证号不能为空", groups = {ResiUserRequired.class,PcAddRequired.class,PcUpdateRequired.class}) private String idCard; + /** + * 是否添加到核算检测关注名单,true加入;默认false不加入 + */ + @NotNull(message = "是否添加到核算检测关注名单", groups = {PcAddRequired.class,PcUpdateRequired.class}) + private Boolean heSuanCheck; /** * 现居地编码 */ @NotBlank(message = "现居地编码不能为空", groups = {ResiUserRequired.class}) private String presentAddressCode; + /** + * 现居地编码路径:"presentAddressPathCode":"37,3702,370203,370203026,370203026002" + */ + @NotBlank(message = "现居地编码路径不能为空", groups = {ResiUserRequired.class}) + private String presentAddressPathCode; + /** * 现居地名称eg:山东省青岛市黄岛区玫瑰山路社区 */ - @NotBlank(message = "现居地名称不能为空", groups = {ResiUserRequired.class}) + @NotBlank(message = "现居地名称不能为空", groups = {ResiUserRequired.class,PcAddRequired.class,PcUpdateRequired.class}) private String presentAddress; /** * 详细地址 */ - @NotBlank(message = "详细地址不能为空", groups = {ResiUserRequired.class}) + @NotBlank(message = "详细地址不能为空", groups = {ResiUserRequired.class,PcAddRequired.class,PcUpdateRequired.class}) private String detailAddress; /** @@ -69,10 +95,16 @@ public class IcTripReportFormDTO implements Serializable { @NotBlank(message = "来自地区编码不能为空", groups = {ResiUserRequired.class}) private String sourceAddressCode; + /** + * 来源地编码路径: "sourceAddressPathCode": "37,3702,370203,370203026,370203026002" + */ + @NotBlank(message = "来自地编码路径不能为空", groups = {ResiUserRequired.class}) + private String sourceAddressPathCode; + /** * 来源地区地址 */ - @NotBlank(message = "来自地区名称不能为空", groups = {ResiUserRequired.class}) + @NotBlank(message = "来自地区名称不能为空", groups = {ResiUserRequired.class,PcAddRequired.class,PcUpdateRequired.class}) private String sourceAddress; /** @@ -80,7 +112,7 @@ public class IcTripReportFormDTO implements Serializable { */ @DateTimeFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd") - @NotNull(message = "来到本地时间不能为空", groups = {ResiUserRequired.class}) + @NotNull(message = "来到本地时间不能为空", groups = {ResiUserRequired.class,PcAddRequired.class,PcUpdateRequired.class}) private Date arriveDate; /** @@ -93,23 +125,56 @@ public class IcTripReportFormDTO implements Serializable { /** * 备注信息 */ - @Length(max = 500, message = "备注最多可输入500字", groups = {ResiUserRequired.class}) + @Length(max = 500, message = "备注最多可输入500字", groups = {ResiUserRequired.class,PcAddRequired.class,PcUpdateRequired.class}) private String remark; - @NotBlank(message = "网格不能为空", groups = {ResiUserInternalGroup.class}) + /** + * userType=icresi时,必填,取值居民所属的网格ID; + * 居民端小程序上报前端赋值当前用户所在的网格id + */ + @NotBlank(message = "网格不能为空", groups = {ResiUserInternalGroup.class,IcResiInternalGroup.class}) private String gridId; - //后端自己赋值 /** * 用户id + * 居民端上报时后端自己赋值 + * pc录入如果是从居民信息选择,此列有值 */ + @NotBlank(message = "userId不能为空", groups = {IcResiInternalGroup.class}) private String userId; /** - * 居民端小程序的人:resi;数字社区的居民:icresi;未关联上的:other + * 居民端小程序的人:resi;数字社区的居民:icresi;单独录入:input; 导入:import + * 居民端上报是后端赋值;导入后端赋值 + * pc录入是前端赋值 */ + @NotBlank(message = "数字社区的居民:icresi;其他:other", groups = {PcAddOrUpdateInternalGroup.class}) private String userType; + /** + * userType=icresi时,必填。 + * 居民所属的组织id + */ + @NotBlank(message = "agencyId不能为空", groups = {IcResiInternalGroup.class}) + private String agencyId; + + /** + * pc录入时用 + */ + private String currentStaffId; + + /** + * pc录入时用 + * 通知渠道 0小程序通知,1短信通知 + */ + private List channel = new ArrayList<>(); + /** + * pc录入时用 + * 通知内容 + */ + private String content = ""; + + } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/MyNatListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/MyNatListFormDTO.java index e9620dc5d2..0272a30799 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/MyNatListFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/MyNatListFormDTO.java @@ -14,8 +14,6 @@ import javax.validation.constraints.NotBlank; public class MyNatListFormDTO extends PageFormDTO { private static final long serialVersionUID = 9156247659994638103L; - public interface MyNat extends CustomerClientShowGroup { - } public interface Detail extends CustomerClientShowGroup { } public interface Del extends CustomerClientShowGroup { @@ -26,7 +24,6 @@ public class MyNatListFormDTO extends PageFormDTO { /** * 身份证号 */ - @NotBlank(message = "身份证号不能为空", groups = MyNat.class) private String idCard; /** * 当前组织:current 根组织:all @@ -41,6 +38,10 @@ public class MyNatListFormDTO extends PageFormDTO { * 手机号 */ private String mobile; + /** + * 是否客户下居民(0:否 1:是) + */ + private String isResiUser; /** * 检测开始时间yyyy-MM-dd HH:mm */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageFollowUpFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageFollowUpFormDTO.java new file mode 100644 index 0000000000..ab4a416d9e --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageFollowUpFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + + +@Data +public class PageFollowUpFormDTO extends PageFormDTO { + + /** + * 身份证号 + */ + @NotBlank(message = "身份证号不能为空", groups = {AddUserShowGroup.class}) + private String idCard; + + @NotBlank(message = "身份证号不能为空", groups = {AddUserShowGroup.class}) + private String name; + + /** + * 0行程上报,1疫苗接种,2核酸检测 + */ + @NotBlank(message = "origin不能为空:0行程上报,1疫苗接种,2核酸检测", groups = {AddUserInternalGroup.class}) + private String origin; + + private String customerId; +} 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 b5c4aa2462..af23243c03 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 @@ -28,7 +28,10 @@ public class PageTripReportFormDTO extends PageFormDTO implements Serializable { * 来源地区编码 */ private String sourceAddressCode; - + /** + * 来源地区名称 + */ + private String sourceAddress; /** * 来到本地时间 */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ResiCollectFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ResiCollectFormDTO.java index fdd712970f..9778cb6a17 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ResiCollectFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ResiCollectFormDTO.java @@ -52,24 +52,32 @@ public class ResiCollectFormDTO implements Serializable { */ @NotBlank(message = "小区不能为空", groups = InternalShowGroup.class) private String villageId; + @NotBlank(message = "小区名不能为空", groups = InternalShowGroup.class) + private String villageName; /** * 所属楼宇Id */ @NotBlank(message = "楼栋不能为空", groups = InternalShowGroup.class) private String buildId; + @NotBlank(message = "楼栋名不能为空",groups = InternalShowGroup.class) + private String buildName; /** * 单元id */ @NotBlank(message = "单元不能为空", groups = InternalShowGroup.class) private String unitId; + @NotBlank(message = "单元名不能为空",groups = InternalShowGroup.class) + private String unitName; /** * 所属家庭Id */ @NotBlank(message = "家庭不能为空", groups = InternalShowGroup.class) private String homeId; + @NotBlank(message = "家庭名不能为空",groups = InternalShowGroup.class) + private String homeName; /** * 详细地址 @@ -102,4 +110,5 @@ public class ResiCollectFormDTO implements Serializable { @NotBlank(message = "userId不能为空", groups = AddUserInternalGroup.class) private String userId; + } 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 0d038cf71a..bd24801531 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 @@ -18,6 +18,7 @@ import java.util.List; public class SendNoticeFormDTO implements Serializable { private static final long serialVersionUID = 4800907725063604885L; private String customerId; + private String staffId; /** * 用户列表 */ @@ -41,7 +42,6 @@ public class SendNoticeFormDTO implements Serializable { /** * 组织名 */ - @NotNull(message = "组织名不能为空", groups = DefaultGroup.class) private String orgName; @NoArgsConstructor diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinationListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinationListFormDTO.java index ec8d2a3932..fc69f5da84 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinationListFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinationListFormDTO.java @@ -20,7 +20,7 @@ public class VaccinationListFormDTO extends PageFormDTO implements Serializable public interface VaccinationListForm{} /** - * 关注类型,核酸检测:2,疫苗接种:1 + * 关注类型,核酸检测:2,疫苗接种:1,行程上报:0 */ @NotNull(message = "attentionType不能为空",groups = VaccinationListForm.class) private Integer attentionType; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/DemandUserResDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/DemandUserResDTO.java index 19b5c8c792..73b7d77ca6 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/DemandUserResDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/DemandUserResDTO.java @@ -13,4 +13,5 @@ public class DemandUserResDTO implements Serializable { private String gridId; private String idCard; private String agencyId; + private String houseId; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestCollectResDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestCollectResDTO.java index f7d698badd..70247e24cd 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestCollectResDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestCollectResDTO.java @@ -59,6 +59,11 @@ public class LatestCollectResDTO implements Serializable { */ private Integer totalResi; + private String villageName; + private String buildName; + private String unitName; + private String homeName; + @Valid private List memberList; @@ -78,5 +83,9 @@ public class LatestCollectResDTO implements Serializable { this.houseHolderName=""; this.totalResi=0; this.memberList=new ArrayList<>(); + this.villageName=""; + this.buildName=""; + this.unitName=""; + this.homeName=""; } } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatListCommonExcelResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatListCommonExcelResultDTO.java new file mode 100644 index 0000000000..15452546c4 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatListCommonExcelResultDTO.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 NatListCommonExcelResultDTO extends NatListResultDTO{ + 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/NatListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatListResultDTO.java index a65563bb5b..cbeb66e482 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatListResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatListResultDTO.java @@ -35,6 +35,7 @@ public class NatListResultDTO implements Serializable { */ @ExcelIgnore private String userId; + /** * 居民端小程序的人:resi;数字社区的居民:icresi;未关联上的:other */ @@ -45,21 +46,21 @@ public class NatListResultDTO implements Serializable { * 姓名 */ @ColumnWidth(20) - @ExcelProperty("姓名") + @ExcelProperty(value = "姓名",order = 1) private String name; /** * 手机号 */ @ColumnWidth(20) - @ExcelProperty("手机号") + @ExcelProperty(value = "手机号",order = 2) private String mobile; /** * 身份证号 */ @ColumnWidth(25) - @ExcelProperty("身份证号") + @ExcelProperty(value = "身份证号",order = 3) private String idCard; /** @@ -67,21 +68,27 @@ public class NatListResultDTO implements Serializable { */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") @ColumnWidth(25) - @ExcelProperty("检测时间") + @ExcelProperty(value = "检测时间",order = 4) private Date natTime; /** * 检测结果 */ @ColumnWidth(20) - @ExcelProperty("检测结果") + @ExcelProperty(value = "检测结果",order = 5) private String natResult; + /** + * 是否客户下居民(0:否 1:是) + */ + @ExcelIgnore + private String isResiUser; + /** * 检测地点 */ @ColumnWidth(30) - @ExcelProperty("检测地点") + @ExcelProperty(value = "检测地点",order = 7) private String natAddress; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/enums/AttentionTypeEnum.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/enums/AttentionTypeEnum.java new file mode 100644 index 0000000000..3e40404466 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/enums/AttentionTypeEnum.java @@ -0,0 +1,46 @@ +package com.epmet.enums; + +import com.epmet.commons.tools.constant.NumConstant; +import lombok.Data; +import org.apache.commons.lang3.StringUtils; + +/** + * @Author zxc + * @DateTime 2022/3/29 16:17 + * @DESC + */ +public enum AttentionTypeEnum { + + XCSB(0,"行程上报"), + YMJZ(1,"疫苗接种"), + NAT(2,"核酸检测") + ; + + private Integer key; + private String value; + + AttentionTypeEnum(Integer key, String value) { + this.key = key; + this.value = value; + } + + public static Integer getKeyByValue(String value){ + if (StringUtils.isBlank(value)){ + return NumConstant.ZERO; + } + for (AttentionTypeEnum a : AttentionTypeEnum.values()) { + if (a.getValue().equals(value)){ + return a.getKey(); + } + } + return NumConstant.ZERO; + } + + public Integer getKey() { + return key; + } + + public String getValue() { + return value; + } +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/enums/ChannelEnum.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/enums/ChannelEnum.java new file mode 100644 index 0000000000..d0df62c66f --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/enums/ChannelEnum.java @@ -0,0 +1,44 @@ +package com.epmet.enums; + +import com.epmet.commons.tools.constant.NumConstant; +import org.apache.commons.lang3.StringUtils; + +/** + * @Author zxc + * @DateTime 2022/3/29 16:35 + * @DESC + */ +public enum ChannelEnum { + + MINI("0","小程序"), + MSG("1","短信") + ; + + private String key; + private String value; + + ChannelEnum(String key, String value) { + this.key = key; + this.value = value; + } + + public static String getKeyByValue(String value){ + if (StringUtils.isBlank(value)){ + return NumConstant.ONE_STR; + } + for (ChannelEnum a : ChannelEnum.values()) { + if (a.getValue().equals(value)){ + return a.getKey(); + } + } + return NumConstant.ONE_STR; + } + + public String getKey() { + return key; + } + + public String getValue() { + return value; + } +} 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 7ed8b936e2..de3612756d 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 @@ -64,6 +64,13 @@ public class IcEpidemicPreventionController{ return new Result>().ok(result); } + @PostMapping("user-list") + public Result> userList(@LoginUser TokenDto tokenDto, @RequestBody EpidemicPreventionFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + PageData result = icResiUserService.userList(formDTO); + return new Result>().ok(result); + } + /** * 居民防疫信息详情 * @Param formDTO @@ -72,13 +79,15 @@ public class IcEpidemicPreventionController{ * @Date 2022/3/29 16:13 */ @PostMapping("detail") - public Result detail(@RequestBody EpidemicPreventionFormDTO formDTO) { + public Result detail(@LoginUser TokenDto tokenDto, @RequestBody EpidemicPreventionFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); EpidemicPreventionResultDTO result = icResiUserService.getEpidemicPreventionDetail(formDTO); return new Result().ok(result); } @PostMapping("info") - public Result info(@RequestBody EpidemicPreventionFormDTO formDTO) { + public Result info(@LoginUser TokenDto tokenDto, @RequestBody EpidemicPreventionFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); EpidemicPreventionInfoDTO result = icResiUserService.getEpidemicPreventionInfo(formDTO); return new Result().ok(result); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicSpecialAttentionController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicSpecialAttentionController.java index 8035d509b3..b2d1ea6249 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicSpecialAttentionController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicSpecialAttentionController.java @@ -1,26 +1,38 @@ package com.epmet.controller; +import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.dto.form.PageFormDTO; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ExcelPoiUtils; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.constants.ImportTaskConstants; import com.epmet.dto.IcEpidemicSpecialAttentionDTO; import com.epmet.dto.form.*; +import com.epmet.dto.result.ImportTaskCommonResultDTO; import com.epmet.excel.NatExportExcel; -import com.epmet.excel.UserResiRegisterVisitExcel; +import com.epmet.excel.NatImportExcel; import com.epmet.excel.VaccinationExportExcel; +import com.epmet.excel.VaccinationImportExcel; +import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.service.IcEpidemicSpecialAttentionService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.FilenameUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; /** @@ -31,10 +43,13 @@ import javax.servlet.http.HttpServletResponse; */ @RestController @RequestMapping("icEpidemicSpecialAttention") +@Slf4j public class IcEpidemicSpecialAttentionController { @Autowired private IcEpidemicSpecialAttentionService icEpidemicSpecialAttentionService; + @Autowired + private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; /** * Desc: 【疫苗接种关注名单,疫苗接种关注名单】列表 @@ -75,9 +90,9 @@ public class IcEpidemicSpecialAttentionController { */ @PostMapping("vaccination-update") @NoRepeatSubmit - public Result vaccinationUpdate(@RequestBody IcEpidemicSpecialAttentionDTO formDTO){ + public Result vaccinationUpdate(@RequestBody IcEpidemicSpecialAttentionDTO formDTO,@LoginUser TokenDto tokenDto){ ValidatorUtils.validateEntity(formDTO, IcEpidemicSpecialAttentionDTO.IcEpidemicSpecialAttentionUpdate.class); - icEpidemicSpecialAttentionService.vaccinationUpdate(formDTO); + icEpidemicSpecialAttentionService.vaccinationUpdate(formDTO,tokenDto); return new Result(); } @@ -102,8 +117,42 @@ public class IcEpidemicSpecialAttentionController { * @date 2022/3/28 13:40 */ @PostMapping("vaccination-import") - public Result vaccinationImport(@LoginUser TokenDto tokenDTO, @RequestParam("file") MultipartFile file,@RequestParam("attentionType")Integer attentionType){ - + public Result vaccinationImport(@LoginUser TokenDto tokenDto, @RequestParam("file") MultipartFile file,@RequestParam("attentionType")Integer attentionType){ + if (file.isEmpty()) { + throw new EpmetException("请上传文件"); + } + // 校验文件类型 + String extension = FilenameUtils.getExtension(file.getOriginalFilename()); + if (!"xls".equals(extension) && !"xlsx".equals(extension)) { + throw new EpmetException("文件类型不匹配"); + } + // 关注类型,核酸检测:2,疫苗接种:1,行程上报:0 + ImportTaskCommonFormDTO importTaskForm = new ImportTaskCommonFormDTO(); + importTaskForm.setOriginFileName(file.getOriginalFilename()); + importTaskForm.setOperatorId(tokenDto.getUserId()); + if (attentionType.equals(NumConstant.ONE)){ + importTaskForm.setBizType(ImportTaskConstants.BIZ_TYPE_ATTENTION_VACCINATION); + }else if (attentionType.equals(NumConstant.TWO)){ + importTaskForm.setBizType(ImportTaskConstants.BIZ_TYPE_ATTENTION_NAT); + }else if (attentionType.equals(NumConstant.ZERO)){ + importTaskForm.setBizType(ImportTaskConstants.BIZ_TYPE_ATTENTION_TRIP_REPORT); + } + Result result = commonServiceOpenFeignClient.createImportTask(importTaskForm); + if (!result.success()) { + throw new EpmetException(9999,"存在进行中的导入"); + } + InputStream inputStream = null; + try { + inputStream = file.getInputStream(); + }catch (Exception e){ + ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO(); + input.setOperatorId(tokenDto.getUserId()); + input.setTaskId(result.getData().getTaskId()); + input.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL); + commonServiceOpenFeignClient.finishImportTask(input); + log.error("读取文件失败"); + } + icEpidemicSpecialAttentionService.importFile(tokenDto,inputStream,attentionType,result.getData().getTaskId()); return new Result(); } @@ -120,9 +169,9 @@ public class IcEpidemicSpecialAttentionController { ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class); formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setUserId(tokenDto.getUserId()); - formDTO.setPage(false); + formDTO.setIsPage(false); PageData pageData = icEpidemicSpecialAttentionService.vaccinationList(formDTO); - // 关注类型,核酸检测:2,疫苗接种:1 + // 关注类型,核酸检测:2,疫苗接种:1,行程上报:0 if (formDTO.getAttentionType().equals(NumConstant.ONE)){ ExcelUtils.exportExcelToTarget(response, null, pageData.getList(), VaccinationExportExcel.class); }else { @@ -131,4 +180,22 @@ public class IcEpidemicSpecialAttentionController { } + @PostMapping("export-template") + public void exportTemplate(HttpServletResponse response, @RequestBody VaccinationListFormDTO formDTO) throws Exception { + TemplateExportParams templatePath = new TemplateExportParams(); + String fileName = ""; + Map map = new HashMap<>(); + // 关注类型,核酸检测:2,疫苗接种:1,行程上报:0 + if (formDTO.getAttentionType().equals(NumConstant.ONE)){ + templatePath.setTemplateUrl("excel/attention_vaccination_template.xlsx"); + fileName = "疫苗接种关注名单导入模板"; + map.put("maplist",new ArrayList()); + }else if (formDTO.getAttentionType().equals(NumConstant.TWO)){ + templatePath.setTemplateUrl("excel/attention_nat_template.xlsx"); + fileName = "核酸检测关注名单导入模板"; + map.put("maplist",new ArrayList()); + } + ExcelPoiUtils.exportExcel(templatePath ,map,fileName,response); + } + } 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 2e717fbe8d..7b0b375207 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 @@ -1,19 +1,31 @@ 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.NumConstant; +import com.epmet.commons.tools.dto.form.PageFormDTO; import com.epmet.commons.tools.page.PageData; +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.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.IcFollowUpRecordDTO; +import com.epmet.dto.form.PageFollowUpFormDTO; import com.epmet.service.IcFollowUpRecordService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import java.util.Map; +import javax.servlet.http.HttpServletResponse; +import java.util.Date; /** @@ -22,6 +34,7 @@ import java.util.Map; * @author generator generator@elink-cn.com * @since v1.0.0 2022-03-25 */ +@Slf4j @RestController @RequestMapping("followup") public class IcFollowUpRecordController { @@ -29,9 +42,16 @@ public class IcFollowUpRecordController { @Autowired private IcFollowUpRecordService icFollowUpRecordService; - @RequestMapping("page") - public Result> page(@RequestParam Map params){ - PageData page = icFollowUpRecordService.page(params); + /** + * 随访记录-列表 + * @param formDTO + * @return + */ + @PostMapping("page") + public Result> page(@LoginUser TokenDto tokenDto, @RequestBody PageFollowUpFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserShowGroup.class,PageFormDTO.AddUserInternalGroup.class); + PageData page = icFollowUpRecordService.page(formDTO); return new Result>().ok(page); } @@ -41,11 +61,17 @@ public class IcFollowUpRecordController { return new Result().ok(data); } + /** + * 随访记录-新增 + * @param dto + * @return + */ @NoRepeatSubmit @PostMapping("save") - public Result save(@RequestBody IcFollowUpRecordDTO dto){ - //效验数据 - ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + public Result save(@LoginUser TokenDto tokenDto, @RequestBody IcFollowUpRecordDTO dto){ + dto.setCustomerId(tokenDto.getCustomerId()); + dto.setCreatedBy(tokenDto.getUserId()); + ValidatorUtils.validateEntity(dto, IcFollowUpRecordDTO.AddUserRequired.class,IcFollowUpRecordDTO.AddInternalGroup.class); icFollowUpRecordService.save(dto); return new Result(); } @@ -67,6 +93,57 @@ public class IcFollowUpRecordController { return new Result(); } + /** + * 随访记录-导出 + * 目前是导出个人 + * @param tokenDto + * @param formDTO + * @param response + */ + @NoRepeatSubmit + @PostMapping("export") + public void export(@LoginUser TokenDto tokenDto, @RequestBody PageFollowUpFormDTO formDTO, HttpServletResponse response) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + //formDTO.setCustomerId("45687aa479955f9d06204d415238f7cc"); + formDTO.setIsPage(false); + ExcelWriter excelWriter = null; + formDTO.setPageSize(NumConstant.TEN_THOUSAND); + int pageNo = formDTO.getPageNo(); + try { + //导出文件名:张三随访记录0330 + 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(); + PageData data = null; + do { + data = icFollowUpRecordService.page(formDTO); + data.getList().forEach(o->{ + //0行程上报,1疫苗接种,2核酸检测 + switch(o.getOrigin()){ + case NumConstant.ZERO_STR: + o.setOrigin("行程上报"); + break; + case NumConstant.ONE_STR: + o.setOrigin("疫苗接种"); + break; + case NumConstant.TWO_STR: + o.setOrigin("核酸检测"); + break; + } + }); + formDTO.setPageNo(++pageNo); + 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/IcNatController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java index 95814147cb..22e99e4e9e 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 @@ -14,10 +14,7 @@ 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.EpmetRequestHolder; -import com.epmet.commons.tools.utils.ExcelUtils; -import com.epmet.commons.tools.utils.FileUtils; -import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.*; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.constants.ImportTaskConstants; import com.epmet.dto.IcNatDTO; @@ -26,6 +23,7 @@ import com.epmet.dto.form.ImportTaskCommonFormDTO; import com.epmet.dto.form.MyNatListFormDTO; import com.epmet.dto.result.ImportTaskCommonResultDTO; import com.epmet.dto.result.MyNatListResultDTO; +import com.epmet.dto.result.NatListCommonExcelResultDTO; import com.epmet.dto.result.NatListResultDTO; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.service.IcNatService; @@ -75,6 +73,7 @@ public class IcNatController implements ResultDataResolver { public Result add(@LoginUser TokenDto tokenDto, @RequestBody AddIcNatFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, AddIcNatFormDTO.Nat.class); formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); icNucleinService.add(formDTO); return new Result(); } @@ -86,8 +85,8 @@ public class IcNatController implements ResultDataResolver { @NoRepeatSubmit @PostMapping("mynatlist") public Result> myNatList(@LoginUser TokenDto tokenDto, @RequestBody MyNatListFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO, MyNatListFormDTO.MyNat.class); formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); return new Result>().ok(icNucleinService.myNatList(formDTO)); } @@ -121,7 +120,9 @@ public class IcNatController implements ResultDataResolver { @NoRepeatSubmit @PostMapping("edit") public Result edit(@LoginUser TokenDto tokenDto, @RequestBody AddIcNatFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, AddIcNatFormDTO.Edit.class); formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); icNucleinService.edit(formDTO); return new Result(); } @@ -152,6 +153,20 @@ public class IcNatController implements ResultDataResolver { return new Result(); } + /** + * @Author sun + * @Description 【核酸】核酸检测信息取消同步 + **/ + @NoRepeatSubmit + @PostMapping("cancelsynchro") + public Result cancelSynchro(@LoginUser TokenDto tokenDto, @RequestBody MyNatListFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, MyNatListFormDTO.Synchro.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + icNucleinService.cancelSynchro(formDTO); + return new Result<>(); + } + /** * 导入excel * @return @@ -243,7 +258,7 @@ public class IcNatController implements ResultDataResolver { //formDTO.setCustomerId("45687aa479955f9d06204d415238f7cc"); //formDTO.setUserId("73ae6280e46a6653a5605d51d5462725"); - formDTO.setPage(false); + formDTO.setIsPage(false); ExcelWriter excelWriter = null; formDTO.setPageSize(NumConstant.TEN_THOUSAND); @@ -251,15 +266,28 @@ public class IcNatController implements ResultDataResolver { try { // 这里 需要指定写用哪个class去写 String fileName = "核酸检测信息.xlsx"; - excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response),NatListResultDTO.class).build(); + if ("all".equals(formDTO.getOrgType())) { + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), NatListResultDTO.class).build(); + }else { + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), NatListCommonExcelResultDTO.class).build(); + } + WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").build(); PageData data = null; do { data = icNucleinService.natList(formDTO); - data.getList().forEach(o->o.setNatResult(NumConstant.ONE_STR.equals(o.getNatResult())?"阳性":"阴性")); + data.getList().forEach(o-> { + o.setNatResult(NumConstant.ONE_STR.equals(o.getNatResult()) ? "阳性" : "阴性"); + o.setIsResiUser(NumConstant.ONE_STR.equals(o.getNatResult()) ? "是" : "否"); + }); formDTO.setPageNo(++pageNo); - excelWriter.write(data.getList(), writeSheet); - } while (CollectionUtils.isNotEmpty(data.getList()) && data.getList().size()==formDTO.getPageSize()); + if ("current".equals(formDTO.getOrgType())) { + List list = ConvertUtils.sourceToTarget(data.getList(), NatListResultDTO.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); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatRelationController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatRelationController.java new file mode 100644 index 0000000000..9fb17bbd23 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatRelationController.java @@ -0,0 +1,24 @@ +package com.epmet.controller; + +import com.epmet.service.IcNatRelationService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + + +/** + * 核酸记录关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-03-31 + */ +@RestController +@RequestMapping("icNatRelation") +public class IcNatRelationController { + + @Autowired + private IcNatRelationService icNatRelationService; + + + +} 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 eb40b5fe23..b0b8a31553 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 @@ -74,6 +74,7 @@ public class IcNoticeController { public Result sendNotice(@LoginUser TokenDto tokenDto, @RequestBody SendNoticeFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, DefaultGroup.class); formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); icNoticeService.sendNotice(formDTO); return new Result(); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java index ccf831e0aa..c25f04bc2b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java @@ -92,7 +92,7 @@ public class IcResiCollectController { //tokenDto.setCustomerId("45687aa479955f9d06204d415238f7cc"); formDTO.setUserId(tokenDto.getUserId()); formDTO.setCustomerId(tokenDto.getCustomerId()); - formDTO.setPage(false); + formDTO.setIsPage(false); PageData collectList = icResiCollectService.getCollectList(formDTO); List list =new ArrayList<>(); 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 45fe80dc05..e50ed23b70 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 @@ -1,40 +1,68 @@ 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.dto.form.PageFormDTO; +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.Result; -import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.utils.*; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.commons.tools.validator.group.AddGroup; -import com.epmet.commons.tools.validator.group.DefaultGroup; -import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.constant.IcResiUserConstant; +import com.epmet.constants.ImportTaskConstants; import com.epmet.dto.IcTripReportRecordDTO; import com.epmet.dto.form.IcTripReportFormDTO; +import com.epmet.dto.form.ImportTaskCommonFormDTO; import com.epmet.dto.form.MyReportedTripFormDTO; import com.epmet.dto.form.PageTripReportFormDTO; +import com.epmet.dto.result.ImportTaskCommonResultDTO; +import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.service.IcTripReportRecordService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.ArrayUtils; 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.Date; import java.util.List; +import java.util.UUID; /** * 行程上报信息 * * @author generator generator@elink-cn.com - * @since v1.0.0 2022-03-25 + * @since v10.0 2022-03-25 */ +@Slf4j @RestController @RequestMapping("tripreport") -public class IcTripReportRecordController { +public class IcTripReportRecordController implements ResultDataResolver { @Autowired private IcTripReportRecordService icTripReportRecordService; + @Autowired + private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; /** * pc: 行程上报-列表 @@ -42,7 +70,7 @@ public class IcTripReportRecordController { * @param formDTO * @return */ - @RequestMapping("page") + @PostMapping("page") public Result> page(@LoginUser TokenDto tokenDto,@RequestBody PageTripReportFormDTO formDTO){ formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setUserId(tokenDto.getUserId()); @@ -51,40 +79,53 @@ public class IcTripReportRecordController { return new Result>().ok(page); } - @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) - public Result get(@PathVariable("id") String id){ - IcTripReportRecordDTO data = icTripReportRecordService.get(id); - return new Result().ok(data); - } - /** * pc: 行程上报-新增 - * @param dto + * @param formDTO * @return */ @NoRepeatSubmit @PostMapping("save") - public Result save(@RequestBody IcTripReportRecordDTO dto){ - //效验数据 - ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); - icTripReportRecordService.save(dto); - return new Result(); + public Result save(@LoginUser TokenDto tokenDto,@RequestBody IcTripReportFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setCurrentStaffId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO,IcTripReportFormDTO.PcAddRequired.class,IcTripReportFormDTO.PcAddOrUpdateInternalGroup.class); + if(IcResiUserConstant.USER_TYPE_IC_RESI.equals(formDTO.getUserType())){ + ValidatorUtils.validateEntity(formDTO,IcTripReportFormDTO.IcResiInternalGroup.class); + } + String id=icTripReportRecordService.save(formDTO); + return new Result().ok(id); } + /** + * pc: 行程上报-修改 + * @param formDTO + * @return + */ @NoRepeatSubmit @PostMapping("update") - public Result update(@RequestBody IcTripReportRecordDTO dto){ - //效验数据 - ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); - icTripReportRecordService.update(dto); - return new Result(); + public Result update(@LoginUser TokenDto tokenDto,@RequestBody IcTripReportFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setCurrentStaffId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO,IcTripReportFormDTO.PcUpdateRequired.class,IcTripReportFormDTO.PcAddOrUpdateInternalGroup.class); + if(IcResiUserConstant.USER_TYPE_IC_RESI.equals(formDTO.getUserType())){ + ValidatorUtils.validateEntity(formDTO,IcTripReportFormDTO.IcResiInternalGroup.class); + } + return new Result().ok(icTripReportRecordService.update(formDTO)); } + /** + * pc:行程上报-删除 + * + * @param ids + * @return + */ @PostMapping("delete") - public Result delete(@RequestBody String[] ids){ - //效验数据 - AssertUtils.isArrayEmpty(ids, "id"); - icTripReportRecordService.delete(ids); + public Result delete(@LoginUser TokenDto tokenDto, @RequestBody String[] ids) { + if (ArrayUtils.isEmpty(ids)) { + return new Result(); + } + icTripReportRecordService.delete(tokenDto.getCustomerId(),tokenDto.getUserId(),ids); return new Result(); } @@ -116,4 +157,121 @@ public class IcTripReportRecordController { return new Result>().ok(icTripReportRecordService.resiList(formDTO)); } + /** + * pc:行程上报-下载模板 + * @param response + * @throws IOException + */ + @RequestMapping(value = "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.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"); + + InputStream is = this.getClass().getClassLoader().getResourceAsStream("excel/trip_report_import_template.xlsx"); + try { + ServletOutputStream os = response.getOutputStream(); + IOUtils.copy(is, os); + } finally { + if (is != null) { + is.close(); + } + } + } + + /** + * pc:行程上报-导出 + * @param tokenDto + * @param formDTO + * @param response + */ + @NoRepeatSubmit + @PostMapping("export") + public void export(@LoginUser TokenDto tokenDto, @RequestBody PageTripReportFormDTO formDTO, HttpServletResponse response) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + // formDTO.setCustomerId("45687aa479955f9d06204d415238f7cc"); + // formDTO.setUserId("35005df15fb0f7c791344f0b424870b7"); + formDTO.setIsPage(false); + ExcelWriter excelWriter = null; + formDTO.setPageSize(NumConstant.TEN_THOUSAND); + int pageNo = formDTO.getPageNo(); + try { + // 这里 需要指定写用哪个class去写 + 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(); + PageData data = null; + do { + data = icTripReportRecordService.page(formDTO); + formDTO.setPageNo(++pageNo); + 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(); + } + } + } + + + /** + * 导入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_trip_preport", "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) { + e.printStackTrace(); + } 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_TRIP_REPORT); + importTaskForm.setOriginFileName(originalFilename); + + ImportTaskCommonResultDTO rstData = getResultDataOrThrowsException(commonServiceOpenFeignClient.createImportTask(importTaskForm), + ServiceConstant.EPMET_COMMON_SERVICE, + EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), + "excel行程上报导入错误", + "行程上报导入失败"); + + // 3.执行导入 + icTripReportRecordService.execAsyncExcelImport(fileSavePath, rstData.getTaskId()); + return new Result(); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/PatrolRoutineWorkController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/PatrolRoutineWorkController.java index 41f14362ee..f018a32789 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/PatrolRoutineWorkController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/PatrolRoutineWorkController.java @@ -43,7 +43,7 @@ public class PatrolRoutineWorkController { @NoRepeatSubmit @PostMapping("selectList") public Result> gridUserWork(@RequestBody PatrolQueryFormDTO formDTO){ - formDTO.setPage(false); + formDTO.setIsPage(false); Page data = gridUserWorkService.listPage(formDTO); return new Result().ok(data.getResult()); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcEpidemicSpecialAttentionDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcEpidemicSpecialAttentionDao.java index 6115d34c1b..ba1564855e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcEpidemicSpecialAttentionDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcEpidemicSpecialAttentionDao.java @@ -8,7 +8,6 @@ import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; -import java.util.Set; /** * 疫情特别关注 @@ -60,5 +59,5 @@ public interface IcEpidemicSpecialAttentionDao extends BaseDao getIdCardList(@Param("customerId") String customerId,@Param("idCardSet") Set idCardSet, @Param("attentionType") Integer attentionType); + List getIdCardList(@Param("customerId") String customerId,@Param("idCardSet") List idCardSet, @Param("attentionType") Integer attentionType); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java index 4ac7359f2e..adaa191b1a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java @@ -1,6 +1,7 @@ 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.result.MyNatListResultDTO; import com.epmet.dto.result.NatListResultDTO; @@ -27,13 +28,31 @@ public interface IcNatDao extends BaseDao { /** * @Author sun - * @Description 【核酸】核酸检测信息列表 + * @Description 【核酸】本辖区核酸检测信息列表 **/ List getNatList(MyNatListFormDTO formDTO); /** * @Author sun - * @Description 删除/取消同步操作--物理删除业务数据 + * @Description 【核酸】客户下核酸检测信息列表 + **/ + List getCustomerNatList(MyNatListFormDTO formDTO); + + /** + * @Author sun + * @Description 删除操作--物理删除业务数据 **/ int delById(@Param("icNatId") String icNatId); + + /** + * 插入或者更新 + * @param e + */ + void insertOrUpdate(IcNatEntity 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); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatRelationDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatRelationDao.java new file mode 100644 index 0000000000..0b37f87121 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatRelationDao.java @@ -0,0 +1,22 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.IcNatRelationEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 核酸记录关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-03-31 + */ +@Mapper +public interface IcNatRelationDao extends BaseDao { + + /** + * @Author sun + * @Description 关系数据删除--物理删除 + **/ + int delRelation(@Param("icNatId") 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/dao/IcResiUserDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java index c0888018a2..ae90cdf0d9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java @@ -281,4 +281,7 @@ public interface IcResiUserDao extends BaseDao { */ List getEpidemicPreventionList(EpidemicPreventionFormDTO formDTO); + List natList(EpidemicPreventionFormDTO formDTO); + List vaccineList(EpidemicPreventionFormDTO formDTO); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcTripReportRecordDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcTripReportRecordDao.java index e310dbc208..6d98de7a80 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcTripReportRecordDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcTripReportRecordDao.java @@ -33,4 +33,13 @@ public interface IcTripReportRecordDao extends BaseDao * @return */ List pageList(PageTripReportFormDTO formDTO); + + /** + * pc:行程上报-删除 + * @param userId + * @param agencyId + * @param ids + * @return + */ + int batchDel(@Param("userId")String userId,@Param("agencyId")String agencyId, @Param("ids")String[] ids); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcEpidemicSpecialAttentionEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcEpidemicSpecialAttentionEntity.java index 3ade140ffa..52e6ff132f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcEpidemicSpecialAttentionEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcEpidemicSpecialAttentionEntity.java @@ -47,7 +47,7 @@ public class IcEpidemicSpecialAttentionEntity extends BaseEpmetEntity { private Integer isAttention; /** - * 关注类型,核酸检测:2,疫苗接种:1 + * 关注类型,核酸检测:2,疫苗接种:1,行程上报:0 */ private Integer attentionType; diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcFollowUpRecordEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcFollowUpRecordEntity.java index 4d9e6de99e..8f976d02b2 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcFollowUpRecordEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcFollowUpRecordEntity.java @@ -56,4 +56,8 @@ public class IcFollowUpRecordEntity extends BaseEpmetEntity { */ private String content; + /** + * 工作人员所属组织id + */ + private String agencyId; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java index 1fee4076a4..7744ce67c6 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java @@ -29,15 +29,10 @@ public class IcNatEntity extends BaseEpmetEntity { @TableField(fill = FieldFill.INSERT) private String customerId; - /** - * 居民端上报时存储用户所在网格的组织id.居民信息的人存储居民所在组织id.单个新增或者导入的存储登录用户所属的组织id - */ - private String agencyId; - - /** - * 组织pids - */ - private String pids; + /** + * 是否客户下居民(0:否 1:是) + */ + private String isResiUser; /** * 居民端小程序的用户id、数字社区的icResiUserId、其他情况无值 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatRelationEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatRelationEntity.java new file mode 100644 index 0000000000..7da911ee59 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatRelationEntity.java @@ -0,0 +1,52 @@ +package com.epmet.entity; + +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-03-31 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_nat_relation") +public class IcNatRelationEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 居民端上报时存储用户所在网格的组织id.居民信息的人存储居民所在组织id.单个新增或者导入的存储登录用户所属的组织id + */ + private String agencyId; + + /** + * 组织pids,包含当前agencyId值 + */ + private String pids; + + /** + * 核酸记录表Id(ic_nat.id) + */ + private String icNatId; + + /** + * 关系数据的绑定途径【居民端录入:resi; + 数字社区录入:icresi; + 导入的:import; + 同步的:synchro】 + */ + private String userType; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiCollectEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiCollectEntity.java index 1123bca8b8..8b6a20d87b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiCollectEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiCollectEntity.java @@ -82,5 +82,8 @@ public class IcResiCollectEntity extends BaseEpmetEntity { * 居住成员人数 */ private Integer totalResi; - + private String villageName; + private String buildName; + private String unitName; + private String homeName; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcTripReportRecordEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcTripReportRecordEntity.java index a74f25b6f4..f14eb97013 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcTripReportRecordEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcTripReportRecordEntity.java @@ -62,7 +62,7 @@ public class IcTripReportRecordEntity extends BaseEpmetEntity { private String userId; /** - * 居民端小程序的人:resi;数字社区的居民:icresi;未关联上的:other + * 居民端小程序的人:resi;数字社区的居民:icresi;单独录入:input; 导入:import */ private String userType; @@ -71,6 +71,11 @@ public class IcTripReportRecordEntity extends BaseEpmetEntity { */ private String presentAddressCode; + /** + * 现居地编码路径:"presentAddressPathCode":"37,3702,370203,370203026,370203026002" + */ + private String presentAddressPathCode; + /** * 现居地名称eg:山东省青岛市黄岛区玫瑰山路社区 */ @@ -86,6 +91,11 @@ public class IcTripReportRecordEntity extends BaseEpmetEntity { */ private String sourceAddressCode; + /** + * 来源地编码路径: "sourceAddressPathCode": "37,3702,370203,370203026,370203026002" + */ + private String sourceAddressPathCode; + /** * 来源地区地址 */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ImportEpidemicSpecialAttention.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ImportEpidemicSpecialAttention.java new file mode 100644 index 0000000000..2f690d2d7c --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ImportEpidemicSpecialAttention.java @@ -0,0 +1,66 @@ +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import cn.afterturn.easypoi.excel.annotation.ExcelIgnore; +import com.epmet.commons.tools.utils.ExcelVerifyInfo; +import lombok.Data; + +import java.util.List; + +/** + * @Author zxc + * @DateTime 2022/3/29 15:47 + * @DESC + */ +@Data +public class ImportEpidemicSpecialAttention extends ExcelVerifyInfo { + + /** + * 姓名 + */ + @Excel(name = "姓名") + private String name; + + /** + * 手机号 + */ + @Excel(name = "手机号") + private String mobile; + + /** + * 身份证号 + */ + @Excel(name = "身份证号") + private String idCard; + + /** + * 原因 + */ + @Excel(name = "关注原因") + private String reason; + + /** + * 备注 + */ + @Excel(name = "备注") + private String remark; + + @ExcelIgnore + private Integer attentionType; + + @Excel(name = "通知内容") + private String content; + + @Excel(name = "通知渠道") + private String channelString; + + @ExcelIgnore + private List channel; + + @ExcelIgnore + private Boolean addStatus = false; + + @ExcelIgnore + private Integer num; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/NatImportExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/NatImportExcel.java new file mode 100644 index 0000000000..e332fe88df --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/NatImportExcel.java @@ -0,0 +1,30 @@ +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import com.epmet.commons.tools.utils.ExcelVerifyInfo; +import lombok.Data; + +/** + * @Author zxc + * @DateTime 2022/3/29 10:24 + * @DESC + */ +@Data +public class NatImportExcel extends ExcelVerifyInfo { + + @Excel(name = "姓名") + private String name; + + @Excel(name = "电话") + private String mobile; + + @Excel(name = "身份证") + private String idCard; + + @Excel(name = "备注") + private String remark; + + @Excel(name = "关注原因") + private String reason; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/VaccinationImportExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/VaccinationImportExcel.java new file mode 100644 index 0000000000..b7349e4d03 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/VaccinationImportExcel.java @@ -0,0 +1,27 @@ +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import com.epmet.commons.tools.utils.ExcelVerifyInfo; +import lombok.Data; + +/** + * @Author zxc + * @DateTime 2022/3/29 10:24 + * @DESC + */ +@Data +public class VaccinationImportExcel extends ExcelVerifyInfo { + + @Excel(name = "姓名") + private String name; + + @Excel(name = "电话") + private String mobile; + + @Excel(name = "身份证") + private String idCard; + + @Excel(name = "备注") + private String remark; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcTripReportExcelData.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcTripReportExcelData.java new file mode 100644 index 0000000000..f6f2a86e42 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcTripReportExcelData.java @@ -0,0 +1,75 @@ +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.util.Date; + + +/** + * 行程上报excel数据 + */ +@Data +public class IcTripReportExcelData { + @NotBlank(message = "姓名为必填项") + @ExcelProperty("姓名") + private String name; + + @NotBlank(message = "身份证号为必填项") + @ExcelProperty("身份证号") + private String idCard; + + @NotBlank(message = "手机号为必填项") + @ExcelProperty("手机号") + private String mobile; + + @NotBlank(message = "现居地为必填项") + @ExcelProperty("现居地(格式:省-市-区-街道-社区)") + private String presentAddress; + + @NotBlank(message = "详细地址为必填项") + @ExcelProperty("详细地址") + private String detailAddress; + + @NotBlank(message = "来自地区为必填项") + @ExcelProperty("来自地区(格式:省-市-区-街道-社区)") + private String sourceAddress; + + @NotNull(message = "来到本地时间为必填项") + @ExcelProperty("来到本地时间(格式:2022-01-01)") + private Date arriveDate; + + @ExcelProperty("离开本地时间(格式:2022-01-01)") + private Date leaveDate; + + /** + * 备注信息 + */ + @Length(max = 500,message = "备注不能超过500字") + @ExcelProperty("备注(500字以内)") + private String remark; + + @Data + public static class ErrorRow { + + @ExcelProperty("姓名") + @ColumnWidth(20) + private String name; + + @ColumnWidth(20) + @ExcelProperty("身份证号") + private String idCard; + + @ExcelProperty("手机号") + @ColumnWidth(20) + private String mobile; + + @ColumnWidth(60) + @ExcelProperty("错误信息") + private String errorInfo; + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/error/EpidemicSpecialAttentionErrorModel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/error/EpidemicSpecialAttentionErrorModel.java new file mode 100644 index 0000000000..ef007cfa4c --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/error/EpidemicSpecialAttentionErrorModel.java @@ -0,0 +1,29 @@ +package com.epmet.excel.error; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +/** + * @Author zxc + * @DateTime 2022/3/29 16:57 + * @DESC + */ +@Data +public class EpidemicSpecialAttentionErrorModel { + + @Excel(name = "行号",width = 10) + private Integer num; + + @Excel(name = "姓名",width = 20) + private String name; + + @Excel(name = "电话",width = 20) + private String mobile; + + @Excel(name = "身份证",width = 30) + private String idCard; + + @Excel(name = "错误信息", width = 200) + private String errorMsg; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatExcelImportListener.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatExcelImportListener.java index f6c83e9440..dccc8d106a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatExcelImportListener.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatExcelImportListener.java @@ -60,17 +60,18 @@ public class IcNatExcelImportListener implements ReadListener { + + + /** + * 最大条数阈值 + */ + public static final int MAX_THRESHOLD = 2; + /** + * 当前操作用户 + */ + private CustomerStaffInfoCacheResult staffInfo; + private String customerId; + + /** + * 数据 + */ + private List datas = new ArrayList<>(); + + /** + * 错误项列表 + */ + private List errorRows = new ArrayList<>(); + + private IcTripReportRecordServiceImpl tripReportRecordService; + + public IcTripReportExcelImportListener(String customerId,CustomerStaffInfoCacheResult staffInfo, IcTripReportRecordServiceImpl tripReportRecordService) { + this.customerId=customerId; + this.staffInfo = staffInfo; + this.tripReportRecordService = tripReportRecordService; + } + + @Override + public void invoke(IcTripReportExcelData data, AnalysisContext context) { + + try { + // 先校验数据 + ValidatorUtils.validateEntity(data); + + IcTripReportRecordEntity tripReportRecordEntity = ConvertUtils.sourceToTarget(data, IcTripReportRecordEntity.class); + tripReportRecordEntity.setCustomerId(customerId); + tripReportRecordEntity.setAgencyId(staffInfo.getAgencyId()); + tripReportRecordEntity.setPids(staffInfo.getAgencyPIds()); + tripReportRecordEntity.setUserType(IcResiUserConstant.USER_TYPE_IMPORT); + datas.add(tripReportRecordEntity); + + 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)); + } + + IcTripReportExcelData.ErrorRow errorRow = new IcTripReportExcelData.ErrorRow(); + 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) { + tripReportRecordService.batchPersist(datas); + } + } finally { + datas.clear(); + } + } + + /** + * 获取错误行 + * @return + */ + public List getErrorRows() { + return errorRows; + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcEpidemicSpecialAttentionService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcEpidemicSpecialAttentionService.java index 8883fa0f28..8a6eb03f04 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcEpidemicSpecialAttentionService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcEpidemicSpecialAttentionService.java @@ -2,15 +2,16 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.IcEpidemicSpecialAttentionDTO; import com.epmet.dto.form.CancelAttentionPackageFormDTO; import com.epmet.dto.form.VaccinationAddFormDTO; import com.epmet.dto.form.VaccinationListFormDTO; import com.epmet.entity.IcEpidemicSpecialAttentionEntity; +import java.io.InputStream; import java.util.List; import java.util.Map; -import java.util.Set; /** * 疫情特别关注 @@ -103,7 +104,7 @@ public interface IcEpidemicSpecialAttentionService extends BaseService getHeSuanIdCardList(String customerId,Set idCardSet); + List getHeSuanIdCardList(String customerId,List idCardSet); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcFollowUpRecordService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcFollowUpRecordService.java index 7183ae1e4d..7bdc1a1da5 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcFollowUpRecordService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcFollowUpRecordService.java @@ -3,6 +3,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.IcFollowUpRecordDTO; +import com.epmet.dto.form.PageFollowUpFormDTO; import com.epmet.entity.IcFollowUpRecordEntity; import java.util.List; @@ -17,14 +18,14 @@ import java.util.Map; public interface IcFollowUpRecordService extends BaseService { /** - * 默认分页 + * 随访记录-列表 * - * @param params + * @param formDTO * @return PageData * @author generator * @date 2022-03-25 */ - PageData page(Map params); + PageData page(PageFollowUpFormDTO formDTO); /** * 默认查询 @@ -47,7 +48,7 @@ public interface IcFollowUpRecordService extends BaseService { + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNatService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNatService.java index 4956c96493..450bee8592 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNatService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNatService.java @@ -64,6 +64,12 @@ public interface IcNatService extends BaseService { **/ void synchro(MyNatListFormDTO formDTO); + /** + * @Author sun + * @Description 【核酸】核酸检测信息取消同步 + **/ + void cancelSynchro(MyNatListFormDTO formDTO); + /** * 执行Excel导入 * @param filePath @@ -77,5 +83,5 @@ public interface IcNatService extends BaseService { * @Author zhaoqifeng * @Date 2022/3/29 16:29 */ - List getNatList(String idCard); + List getNatList(String customerId, String idCard); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNoticeService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNoticeService.java index 13529cadbf..3f72855558 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNoticeService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNoticeService.java @@ -10,7 +10,6 @@ import com.epmet.entity.IcNoticeEntity; import java.util.Date; import java.util.List; import java.util.Map; -import java.util.Set; /** * 防疫通知 @@ -104,5 +103,5 @@ public interface IcNoticeService extends BaseService { * @param idCardSet * @return */ - Map getUserLatestNoticeTime(String customerId,Set idCardSet); + Map getUserLatestNoticeTime(String customerId,List idCardSet); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java index ef3c99338a..fd3e49415d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java @@ -226,6 +226,7 @@ public interface IcResiUserService extends BaseService { * @Date 2022/3/29 14:27 */ PageData epidemicPreventionList(EpidemicPreventionFormDTO formDTO); + PageData userList(EpidemicPreventionFormDTO formDTO); /** * 居民防疫信息详情 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 index 44207d875f..c1b2ea0655 100644 --- 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 @@ -3,6 +3,7 @@ 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; @@ -75,4 +76,14 @@ public interface IcResiVaccineService extends BaseService { * @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 001b3d65e4..66ec0d9f9e 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 @@ -6,8 +6,10 @@ import com.epmet.dto.IcTripReportRecordDTO; import com.epmet.dto.form.IcTripReportFormDTO; import com.epmet.dto.form.MyReportedTripFormDTO; import com.epmet.dto.form.PageTripReportFormDTO; +import com.epmet.dto.result.TripListDTO; import com.epmet.entity.IcTripReportRecordEntity; +import java.nio.file.Path; import java.util.List; import java.util.Map; @@ -40,24 +42,14 @@ public interface IcTripReportRecordService extends BaseService list(Map params); /** - * 单条查询 - * - * @param id - * @return IcTripReportRecordDTO - * @author generator - * @date 2022-03-25 - */ - IcTripReportRecordDTO get(String id); - - /** - * 默认保存 + * pc: 行程上报-新增 * * @param dto * @return void * @author generator * @date 2022-03-25 */ - void save(IcTripReportRecordDTO dto); + String save(IcTripReportFormDTO dto); /** * 默认更新 @@ -67,17 +59,17 @@ public interface IcTripReportRecordService extends BaseService resiList(MyReportedTripFormDTO formDTO); + + /** + * 获取居民行程信息 + * + * @Param idCard + * @Return {@link List< TripListDTO>} + * @Author zhaoqifeng + * @Date 2022/3/30 10:31 + */ + List tripList(String customerId, String idCard); + + /** + * 执行Excel导入 + * @param filePath + */ + void execAsyncExcelImport(Path filePath, String importTaskId); } \ No newline at end of file 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 2362052dc1..bd9faff62b 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 @@ -1,5 +1,7 @@ package com.epmet.service.impl; +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -8,26 +10,48 @@ import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.page.PageData; 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.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.ExcelPoiUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.constants.ImportTaskConstants; import com.epmet.dao.IcEpidemicSpecialAttentionDao; import com.epmet.dto.IcEpidemicSpecialAttentionDTO; -import com.epmet.dto.form.CancelAttentionPackageFormDTO; -import com.epmet.dto.form.VaccinationAddFormDTO; -import com.epmet.dto.form.VaccinationListFormDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.dto.result.VaccinationListResultDTO; import com.epmet.entity.IcEpidemicSpecialAttentionEntity; +import com.epmet.enums.ChannelEnum; +import com.epmet.excel.ImportEpidemicSpecialAttention; +import com.epmet.excel.error.EpidemicSpecialAttentionErrorModel; +import com.epmet.feign.EpmetCommonServiceOpenFeignClient; +import com.epmet.feign.OssFeignClient; import com.epmet.service.IcEpidemicSpecialAttentionService; +import com.epmet.service.IcNoticeService; 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.commons.lang3.StringUtils; +import org.apache.http.entity.ContentType; +import org.apache.poi.ss.usermodel.Workbook; +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.InputStream; +import java.io.OutputStream; import java.util.*; import java.util.stream.Collectors; @@ -38,8 +62,16 @@ import java.util.stream.Collectors; * @since v1.0.0 2022-03-28 */ @Service +@Slf4j public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl implements IcEpidemicSpecialAttentionService { + @Autowired + private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; + @Autowired + private OssFeignClient ossFeignClient; + @Autowired + private IcNoticeService noticeService; + @Override public PageData page(Map params) { IPage page = baseDao.selectPage( @@ -106,9 +138,9 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.vaccinationList(formDTO)); result.setList(pageInfo.getList()); result.setTotal(Integer.valueOf(String.valueOf(pageInfo.getTotal()))); @@ -118,7 +150,7 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.natList(formDTO)); result.setList(pageInfo.getList()); result.setTotal(Integer.valueOf(String.valueOf(pageInfo.getTotal()))); @@ -175,7 +207,19 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl needSedNotice = formDTO.getList().stream().filter(l -> CollectionUtils.isNotEmpty(l.getChannel())).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(needSedNotice)) { + SendNoticeFormDTO dto = new SendNoticeFormDTO(); + List userListBeans = ConvertUtils.sourceToTarget(needSedNotice, SendNoticeFormDTO.UserListBean.class); + dto.setCustomerId(formDTO.getCustomerId()); + dto.setUserList(userListBeans); + dto.setChannel(needSedNotice.get(NumConstant.ZERO).getChannel()); + dto.setOrigin(needSedNotice.get(NumConstant.ZERO).getAttentionType().toString()); + dto.setContent(needSedNotice.get(NumConstant.ZERO).getContent()); + dto.setStaffId(formDTO.getUserId()); + noticeService.sendNotice(dto); + } } /** @@ -188,7 +232,7 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl w = new LambdaQueryWrapper<>(); IcEpidemicSpecialAttentionEntity e = new IcEpidemicSpecialAttentionEntity(); w.eq(IcEpidemicSpecialAttentionEntity::getIdCard,formDTO.getIdCard()) @@ -197,7 +241,17 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl errorInfo = new ArrayList<>(); + + try { + List list = ExcelPoiUtils.importExcel(inputStream, 0,1,ImportEpidemicSpecialAttention.class); + if (CollectionUtils.isEmpty(list)){ + closeTask(taskId,tokenDto.getUserId(), ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL,""); + return; + } + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); + if (null == staffInfo){ + throw new EpmetException("未查询到工作人员信息"+tokenDto.getUserId()); + } + AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(staffInfo.getAgencyId()); + if (null == agencyInfo){ + throw new EpmetException("未查询到组织信息"+staffInfo.getAgencyId()); + } + for (int i = 0; i < list.size(); i++) { + list.get(i).setNum(i+1); + list.get(i).setAttentionType(attentionType); +// list.get(i).setChannel(getChannel(list.get(i).getChannelString())); + if (StringUtils.isBlank(list.get(i).getName()) && !list.get(i).getAddStatus()){ + errorInfo.add(getErrorInfo(list.get(i), "姓名不能为空",i+1)); + list.get(i).setAddStatus(true); + continue; + } + if (StringUtils.isBlank(list.get(i).getIdCard()) && !list.get(i).getAddStatus()){ + errorInfo.add(getErrorInfo(list.get(i), "身份证号不能为空",i+1)); + list.get(i).setAddStatus(true); + continue; + } + if (StringUtils.isBlank(list.get(i).getMobile()) && !list.get(i).getAddStatus()){ + errorInfo.add(getErrorInfo(list.get(i), "电话不能为空",i+1)); + list.get(i).setAddStatus(true); + continue; + } + } + if (list.size() > errorInfo.size()){ + Map groupByIdCard = list.stream().collect(Collectors.groupingBy(ImportEpidemicSpecialAttention::getIdCard, Collectors.counting())); + groupByIdCard.forEach((idCard,count) -> { + if (Integer.valueOf(count.toString()).compareTo(1) != 0){ + for (ImportEpidemicSpecialAttention i : list) { + if (idCard.equals(i.getIdCard()) && !i.getAddStatus()){ + errorInfo.add(getErrorInfo(i,"数据重复",i.getNum())); + i.setAddStatus(true); + } + } + } + }); + List idCards = list.stream().map(m -> m.getIdCard()).collect(Collectors.toList()); + List existList = baseDao.getExistList(attentionType, idCards); + if (CollectionUtils.isNotEmpty(existList)){ + for (String s : existList) { + for (int i = NumConstant.ZERO; i < list.size(); i++) { + if (s.equals(list.get(i).getIdCard()) && !list.get(i).getAddStatus()){ + errorInfo.add(getErrorInfo(list.get(i),"数据已存在",list.get(i).getNum())); + list.get(i).setAddStatus(true); + continue; + } + } + } + } + } + Map> groupByStatus = list.stream().collect(Collectors.groupingBy(ImportEpidemicSpecialAttention::getAddStatus)); + List needInsert = groupByStatus.get(false); + if (CollectionUtils.isNotEmpty(needInsert)){ + List entities = ConvertUtils.sourceToTarget(needInsert, IcEpidemicSpecialAttentionEntity.class); + entities.forEach(e -> { + e.setIsAttention(NumConstant.ONE); + e.setOrgId(agencyInfo.getId()); + e.setPid(agencyInfo.getPid()); + e.setPids(agencyInfo.getPids()); + e.setCustomerId(tokenDto.getCustomerId()); + }); + insertBatch(entities); + // send msg 产品说导入不用发通知 + /*List needSendList = needInsert.stream().filter(l -> CollectionUtils.isNotEmpty(l.getChannel())).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(needSendList)) { + SendNoticeFormDTO dto = new SendNoticeFormDTO(); + List userListBeans = ConvertUtils.sourceToTarget(needSendList, SendNoticeFormDTO.UserListBean.class); + dto.setCustomerId(tokenDto.getCustomerId()); + dto.setUserList(userListBeans); + dto.setChannel(needSendList.get(NumConstant.ZERO).getChannel()); + dto.setOrigin(needSendList.get(NumConstant.ZERO).getAttentionType().toString()); + dto.setContent(needSendList.get(NumConstant.ZERO).getContent()); + dto.setStaffId(tokenDto.getUserId()); + noticeService.sendNotice(dto); + }*/ + } + if (CollectionUtils.isNotEmpty(errorInfo)){ + String url = importOssUpload(errorInfo, EpidemicSpecialAttentionErrorModel.class); + closeTask(taskId,tokenDto.getUserId(),ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL,url); + }else { + closeTask(taskId,tokenDto.getUserId(),ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS,""); + } + }catch (Exception e){ + log.error(e.getMessage()); + closeTask(taskId,tokenDto.getUserId(),ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL,""); + } + } + + public List getChannel(String channelString){ + List result = new ArrayList<>(); + if (StringUtils.isBlank(channelString)){ + return result; + } + String[] split = channelString.split(","); + for (String s : split) { + result.add(ChannelEnum.getKeyByValue(s)); + } + return result; + } + + /** + * Desc: 关闭任务 + * @param taskId + * @param userId + * @param status + * @param url + * @author zxc + * @date 2022/3/30 09:05 + */ + public void closeTask(String taskId,String userId,String status,String url){ + ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO(); + input.setOperatorId(userId); + input.setTaskId(taskId); + input.setProcessStatus(status); + input.setResultDescFilePath(url); + commonServiceOpenFeignClient.finishImportTask(input); + } + + /** + * Desc: 构造错误信息 + * @param dto + * @param info + * @param num + * @author zxc + * @date 2022/3/29 17:17 + */ + public EpidemicSpecialAttentionErrorModel getErrorInfo(ImportEpidemicSpecialAttention dto,String info,Integer num){ + EpidemicSpecialAttentionErrorModel result = ConvertUtils.sourceToTarget(dto, EpidemicSpecialAttentionErrorModel.class); + result.setErrorMsg(info); + result.setNum(num); + return result; + } + /** * 传入身份证集合,返回已经关注的身份证号列表 * @@ -221,12 +432,58 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl getHeSuanIdCardList(String customerId,Set idCardSet) { + public List getHeSuanIdCardList(String customerId,List idCardSet) { if(CollectionUtils.isEmpty(idCardSet)){ return new ArrayList<>(); } - //关注类型,核酸检测:2,疫苗接种:1 + //关注类型,核酸检测:2,疫苗接种:1,行程上报:0 return baseDao.getIdCardList(customerId,idCardSet,NumConstant.TWO); } + /** + * Desc: 文件上传并返回url + * @param errorRows + * @param tClass + * @author zxc + * @date 2022/3/30 09:16 + */ + public String importOssUpload(Collection errorRows, Class tClass) throws IOException { + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("导入失败的数据列表","导入失败的数据列表"), + tClass, errorRows); + + // 文件名 + String resultDescFileName = UUID.randomUUID().toString().concat(".xls"); + + FileItemFactory factory = new DiskFileItemFactory(16, null); + FileItem fileItem = factory.createItem("file", ContentType.APPLICATION_OCTET_STREAM.toString(), true, resultDescFileName); + OutputStream os = fileItem.getOutputStream(); + Result uploadResult = null; + try { + workbook.write(os); + uploadResult = ossFeignClient.uploadImportTaskDescFile(new CommonsMultipartFile(fileItem)); + } catch (Exception e) { + String errormsg = ExceptionUtils.getErrorStackTrace(e); + log.error("上传错误描述文件:{}", errormsg); + } finally { + try { + os.close(); + } catch (IOException e) { + String errormsg = ExceptionUtils.getErrorStackTrace(e); + log.error("上传错误描述文件关闭输出流:{}", errormsg); + } + try { + fileItem.delete(); + } catch (Exception e) { + String errormsg = ExceptionUtils.getErrorStackTrace(e); + log.error("上传错误描述文件删除临时文件:{}", errormsg); + } + } + + if (uploadResult == null || !uploadResult.success()) { + log.error("调用OSS上传结果描述文件失败"); + return null; + } + return uploadResult.getData().getUrl(); + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcFollowUpRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcFollowUpRecordServiceImpl.java index 40d380278a..1e3c46f9f1 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcFollowUpRecordServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcFollowUpRecordServiceImpl.java @@ -1,15 +1,22 @@ 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.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.IcFollowUpRecordDao; import com.epmet.dto.IcFollowUpRecordDTO; +import com.epmet.dto.form.PageFollowUpFormDTO; import com.epmet.entity.IcFollowUpRecordEntity; import com.epmet.service.IcFollowUpRecordService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -28,13 +35,23 @@ import java.util.Map; public class IcFollowUpRecordServiceImpl extends BaseServiceImpl implements IcFollowUpRecordService { + /** + * 随访记录-列表 + * @param formDTO + * @return + */ @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, IcFollowUpRecordDTO.class); + public PageData page(PageFollowUpFormDTO formDTO) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(formDTO.getIdCard()),IcFollowUpRecordEntity::getIdCard,formDTO.getIdCard()) + .eq(StringUtils.isNotBlank(formDTO.getName()),IcFollowUpRecordEntity::getName,formDTO.getName()) + .eq(IcFollowUpRecordEntity::getOrigin,formDTO.getOrigin()) + .eq(IcFollowUpRecordEntity::getCustomerId,formDTO.getCustomerId()) + .orderByDesc(IcFollowUpRecordEntity::getVisitTime); + PageInfo data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()) + .doSelectPageInfo(() -> baseDao.selectList(wrapper)); + List list=ConvertUtils.sourceToTarget(data.getList(),IcFollowUpRecordDTO.class); + return new PageData(list,data.getTotal()); } @Override @@ -62,7 +79,12 @@ public class IcFollowUpRecordServiceImpl extends BaseServiceImpl implements IcNatRelationService { + + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java index a7ef5cf7f4..a71f480f26 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java @@ -2,6 +2,8 @@ package com.epmet.service.impl; import com.alibaba.excel.EasyExcel; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +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; @@ -19,11 +21,14 @@ import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.utils.*; import com.epmet.constants.ImportTaskConstants; import com.epmet.dao.IcNatDao; +import com.epmet.dao.IcNatRelationDao; +import com.epmet.dao.UserBaseInfoDao; import com.epmet.dto.IcNatDTO; import com.epmet.dto.IcNoticeDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.IcNatEntity; +import com.epmet.entity.IcNatRelationEntity; import com.epmet.excel.data.IcNatImportExcelData; import com.epmet.excel.handler.IcNatExcelImportListener; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; @@ -67,15 +72,16 @@ public class IcNatServiceImpl extends BaseServiceImpl imp @Autowired private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; - @Autowired private EpmetUserOpenFeignClient epmetUserOpenFeignClient; - @Autowired private IcNoticeService icNoticeService; - @Autowired private OssFeignClient ossFeignClient; + @Autowired + private UserBaseInfoDao userBaseInfoDao; + @Autowired + private IcNatRelationDao icNatRelationDao; /** * @Author sun @@ -84,15 +90,27 @@ public class IcNatServiceImpl extends BaseServiceImpl imp @Override @Transactional(rollbackFor = Exception.class) public void add(AddIcNatFormDTO formDTO) { + //0.先根据身份证号和检查时间以及检测结果校验数据是否存在 + IcNatDTO icNatDTO = baseDao.getNatDTO(formDTO.getCustomerId(), null, formDTO.getIdCard(), DateUtils.format(formDTO.getNatTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE), formDTO.getNatResult()); + if (null != icNatDTO) { + throw new RenException(EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getCode(), EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getMsg()); + } //1.获取所填居民所属组织缓存信息 AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(formDTO.getAgencyId()); if (null == agencyInfo) { throw new RenException(String.format("获取组织缓存信息失败%s", formDTO.getAgencyId())); } - //2.新增核酸记录表数据 + //2.新增核酸基础信息数据 IcNatEntity entity = ConvertUtils.sourceToTarget(formDTO, IcNatEntity.class); - entity.setPids(agencyInfo.getPids()); + if (StringUtils.isNotBlank(formDTO.getUserId())) { + entity.setIsResiUser("1"); + } insert(entity); + //3.核酸记录关系表新增与组织的关系数据 + IcNatRelationEntity relationEntity = ConvertUtils.sourceToTarget(formDTO, IcNatRelationEntity.class); + relationEntity.setIcNatId(entity.getId()); + relationEntity.setPids(StringUtils.isNotBlank(agencyInfo.getPids()) ? agencyInfo.getPids() + ":" + formDTO.getAgencyId() : formDTO.getAgencyId()); + icNatRelationDao.insert(relationEntity); //3.新增通知表信息 if (formDTO.getChannel().size() > NumConstant.ZERO) { @@ -104,7 +122,7 @@ public class IcNatServiceImpl extends BaseServiceImpl imp dto.setChannel(formDTO.getChannel()); dto.setOrigin("2"); dto.setContent(formDTO.getContent()); - dto.setOrgName(agencyInfo.getOrganizationName()); + dto.setStaffId(formDTO.getStaffId()); icNoticeService.sendNotice(dto); } @@ -116,32 +134,44 @@ public class IcNatServiceImpl extends BaseServiceImpl imp **/ @Override public List myNatList(MyNatListFormDTO formDTO) { - //1.根据身份证号查询该人员所有核酸记录(居民端录入、数字平台录入、数字平台导入) + //1.根据token信息查询居民身份证号 + UserBaseInfoResultDTO dto = userBaseInfoDao.selectListByUserIdList(formDTO.getUserId()); + if (null != dto) { + formDTO.setIdCard(dto.getIdNum()); + } + //2.查询当前人员创建的或该身份证号录入的核算检测数据(居民端录入、数字平台录入、数字平台导入、数字平台同步的) List resultList = baseDao.getMyNatList(formDTO); return resultList; } /** * @Author sun - * @Description 【核酸】核酸检测信息列表 + * @Description 【核酸】本组织及下级核酸检测信息列表 * * @return*/ @Override public PageData natList(MyNatListFormDTO formDTO) { - //1.根据orgType值判断是查询当前组织下还是整个客户下数据 + //1.根据是查询客户数据还是本辖区数据走不同逻辑 if ("current".equals(formDTO.getOrgType())) { - //获取工作人员缓存信息 + //本辖区数据 + //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.getNatList(formDTO)); + return new PageData(data.getList(), data.getTotal()); + } else if ("all".equals(formDTO.getOrgType())) { + //客户下数据 + PageInfo data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()) + .doSelectPageInfo(() -> baseDao.getCustomerNatList(formDTO)); + return new PageData(data.getList(), data.getTotal()); } - //2.按条件查询业务数据 - PageInfo data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.isPage()) - .doSelectPageInfo(() -> baseDao.getNatList(formDTO)); - return new PageData(data.getList(),data.getTotal()); + return new PageData(new ArrayList(), 0); } /** @@ -175,22 +205,22 @@ public class IcNatServiceImpl extends BaseServiceImpl imp @Override @Transactional(rollbackFor = Exception.class) public void edit(AddIcNatFormDTO formDTO) { - //1.更新核酸记录表数据 + //0.先根据身份证号和检测时间以及检测结果校验除当前数据是否还存在相同数据 + IcNatDTO icNatDTO = baseDao.getNatDTO(formDTO.getCustomerId(), formDTO.getIcNatId(), formDTO.getIdCard(), DateUtils.format(formDTO.getNatTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE), formDTO.getNatResult()); + if (null != icNatDTO) { + throw new RenException(EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getCode(), EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getMsg()); + } + //1.更新核酸记录基础信息表数据 IcNatEntity entity = ConvertUtils.sourceToTarget(formDTO, IcNatEntity.class); entity.setId(formDTO.getIcNatId()); if (!updateById(entity)) { log.error(String.format("数据修改失败,核酸记录Id->%s", formDTO.getIcNatId())); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "核酸记录修改失败"); } + //修改只涉及到基础信息的修改 不会修改关系数据 关系表不涉及更新 //3.新增通知表信息 if (CollectionUtils.isNotEmpty(formDTO.getChannel())) { - IcNatEntity icNatEntity = baseDao.selectById(formDTO.getIcNatId()); - //1.获取所填居民所属组织缓存信息 - AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(icNatEntity.getAgencyId()); - if (null == agencyInfo) { - throw new RenException(String.format("获取组织缓存信息失败%s", icNatEntity.getAgencyId())); - } SendNoticeFormDTO dto = new SendNoticeFormDTO(); List userList = new ArrayList<>(); userList.add(ConvertUtils.sourceToTarget(formDTO, SendNoticeFormDTO.UserListBean.class)); @@ -199,7 +229,7 @@ public class IcNatServiceImpl extends BaseServiceImpl imp dto.setChannel(formDTO.getChannel()); dto.setOrigin("2"); dto.setContent(formDTO.getContent()); - dto.setOrgName(agencyInfo.getOrganizationName()); + dto.setStaffId(formDTO.getStaffId()); icNoticeService.sendNotice(dto); } } @@ -211,11 +241,13 @@ public class IcNatServiceImpl extends BaseServiceImpl imp @Override @Transactional(rollbackFor = Exception.class) public void del(MyNatListFormDTO formDTO) { - //1.物理删除业务数据 + //1.确定删除则需要删除基础数据以及所有可能存在的关系数据,物理删除业务数据 if (baseDao.delById(formDTO.getIcNatId()) < NumConstant.ONE) { - log.error(String.format("数据删除/取消同步失败,核酸记录Id->%s", formDTO.getIcNatId())); - throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "数据操作失败"); + log.error(String.format("数据删除失败,核酸记录Id->%s", formDTO.getIcNatId())); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "数据删除失败"); } + //关系数据删除 + icNatRelationDao.delRelation(formDTO.getIcNatId(), null); } /** @@ -225,25 +257,46 @@ public class IcNatServiceImpl extends BaseServiceImpl imp @Override @Transactional(rollbackFor = Exception.class) public void synchro(MyNatListFormDTO formDTO) { + //1.检验核酸基础信息是否存在 + IcNatEntity entity = baseDao.selectById(formDTO.getIcNatId()); + if (null == entity) { + log.error(String.format("核酸记录数据不存在同步失败,核酸记录Id->%s", formDTO.getIcNatId())); + 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.不管是否已存在关系数据都是先删后增 + icNatRelationDao.delRelation(formDTO.getIcNatId(), staffInfo.getAgencyId()); + //3.新增关系数据 + IcNatRelationEntity relationEntity = new IcNatRelationEntity(); + relationEntity.setCustomerId(formDTO.getCustomerId()); + relationEntity.setIcNatId(formDTO.getIcNatId()); + relationEntity.setAgencyId(staffInfo.getAgencyId()); + relationEntity.setPids(StringUtils.isNotBlank(staffInfo.getAgencyPIds())?staffInfo.getAgencyPIds()+":"+formDTO.getAgencyId():staffInfo.getAgencyId()); + relationEntity.setUserType("synchro"); + icNatRelationDao.insert(relationEntity); + } + + /** + * @Author sun + * @Description 【核酸】核酸检测信息取消同步 + **/ + @Override + @Transactional(rollbackFor = Exception.class) + public void cancelSynchro(MyNatListFormDTO formDTO) { //1.获取工作人员缓存数据 CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); if (null == staffInfo) { throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); } - //1.根据核酸记录Id查询业务数据并进行必要校验 - IcNatEntity entity = baseDao.selectById(formDTO.getIcNatId()); - if (null == entity || staffInfo.getAgencyId().equals(entity.getAgencyId()) - || (!"import".equals(entity.getUserType()) && !"synchro".equals(entity.getUserType()))) { - log.error(String.format("数据同步失败,核酸记录Id->%s", formDTO.getIcNatId())); - throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "数据同步失败,不是导入数据或非本组织数据"); + //1.物理删除关系数据 + if (icNatRelationDao.delRelation(formDTO.getIcNatId(), staffInfo.getAgencyId()) < NumConstant.ONE) { + log.error(String.format("数据取消同步失败,核酸记录Id->%s", formDTO.getIcNatId())); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "取消同步操作失败"); } - - //3.待同步组织新增业务数据 - entity.setId(""); - entity.setAgencyId(staffInfo.getAgencyId()); - entity.setPids(staffInfo.getAgencyPIds()); - entity.setUserType("synchro"); - insert(entity); } @Async @@ -340,8 +393,9 @@ public class IcNatServiceImpl extends BaseServiceImpl imp * @Date 2022/3/29 16:29 */ @Override - public List getNatList(String idCard) { + public List getNatList(String customerId, String idCard) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(IcNatEntity::getCustomerId, customerId); wrapper.eq(IcNatEntity::getIdCard, idCard); wrapper.orderByDesc(IcNatEntity::getNatTime); List list = baseDao.selectList(wrapper); @@ -372,6 +426,13 @@ public class IcNatServiceImpl extends BaseServiceImpl imp * @param entities */ public void batchPersist(List entities) { - insertBatch(entities); + //insertBatch(entities); + String currentUserId = EpmetRequestHolder.getHeader(AppClientConstant.USER_ID); + entities.forEach(e -> { + String id = IdWorker.getIdStr(e); + e.setId(id); + e.setUpdatedBy(currentUserId); + baseDao.insertOrUpdate(e); + }); } } 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 9b3698798d..c306bec8aa 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 @@ -5,14 +5,17 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.*; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.enums.ChannelEnum; import com.epmet.commons.tools.page.PageData; +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.SmsTemplateConstant; import com.epmet.constant.UserMessageTypeConstant; import com.epmet.dao.IcNoticeDao; import com.epmet.dto.IcNoticeDTO; +import com.epmet.dto.UserBaseInfoDTO; import com.epmet.dto.form.IcNoticeFormDTO; import com.epmet.dto.form.ProjectSendMsgFormDTO; import com.epmet.dto.form.SendNoticeFormDTO; @@ -20,6 +23,7 @@ import com.epmet.dto.form.UserMessageFormDTO; import com.epmet.entity.IcNoticeEntity; import com.epmet.feign.MessageFeignClient; import com.epmet.service.IcNoticeService; +import com.epmet.service.UserBaseInfoService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import lombok.extern.slf4j.Slf4j; @@ -44,6 +48,8 @@ public class IcNoticeServiceImpl extends BaseServiceImpl page(IcNoticeFormDTO formDTO) { @@ -123,8 +129,14 @@ public class IcNoticeServiceImpl extends BaseServiceImpl entityList = formDTO.getUserList().stream().map(item -> { IcNoticeEntity entity = new IcNoticeEntity(); entity.setCustomerId(formDTO.getCustomerId()); @@ -134,7 +146,7 @@ public class IcNoticeServiceImpl extends BaseServiceImpl smsList = new ArrayList<>(); entityList.forEach(item -> { - if (StringUtils.isNotBlank(item.getUserId())) { - UserMessageFormDTO messageFormDTO = new UserMessageFormDTO(); - messageFormDTO.setCustomerId(item.getCustomerId()); - messageFormDTO.setApp(AppClientConstant.APP_GOV); - messageFormDTO.setGridId(StrConstant.STAR); - messageFormDTO.setUserId(item.getUserId()); - messageFormDTO.setTitle("您有一条通知消息!"); - messageFormDTO.setMessageContent(item.getContent()); - messageFormDTO.setReadFlag(Constant.UNREAD); - messageFormDTO.setMessageType(UserMessageTypeConstant.ANTIEPIDEMIC); - messageFormDTO.setTargetId(item.getId()); - msgList.add(messageFormDTO); + if (StringUtils.isNotBlank(item.getIdCard())) { + //根据身份证获取居民ID + List userList = userBaseInfoService.getCommonIdNumUser(item.getCustomerId(), item.getIdCard()); + if (CollectionUtils.isNotEmpty(userList)) { + userList.forEach(user -> { + UserMessageFormDTO messageFormDTO = new UserMessageFormDTO(); + messageFormDTO.setCustomerId(item.getCustomerId()); + messageFormDTO.setApp(AppClientConstant.APP_GOV); + messageFormDTO.setGridId(StrConstant.STAR); + messageFormDTO.setUserId(user.getUserId()); + messageFormDTO.setTitle("您有一条通知消息!"); + messageFormDTO.setMessageContent(item.getContent()); + messageFormDTO.setReadFlag(Constant.UNREAD); + messageFormDTO.setMessageType(UserMessageTypeConstant.ANTIEPIDEMIC); + messageFormDTO.setTargetId(item.getId()); + msgList.add(messageFormDTO); + }); + } } //TODO 短信消息 if (StringUtils.isNotBlank(item.getMobile())) { @@ -207,7 +225,7 @@ public class IcNoticeServiceImpl extends BaseServiceImpl getUserLatestNoticeTime(String customerId,Set idCardSet) { + public Map getUserLatestNoticeTime(String customerId,List idCardSet) { Map map=new HashMap<>(); for(String idCard:idCardSet) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); 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 c73a39d794..b0befce180 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 @@ -102,7 +102,7 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl pageList = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.getCollectList(formDTO)); result.setList(pageList.getList()); result.setTotal(Integer.parseInt(String.valueOf(pageList.getTotal()))); @@ -170,6 +170,7 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl getWrapper(Map params){ String id = (String)params.get(FieldConstant.ID_HUMP); @@ -1267,13 +1271,26 @@ public class IcResiUserServiceImpl extends BaseServiceImpl(list, pageInfo.getTotal()); } + @Override + public PageData userList(EpidemicPreventionFormDTO formDTO) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); + List list = new ArrayList<>(); + if (formDTO.getAttentionType().equals(NumConstant.TWO)){ + list = baseDao.natList(formDTO); + }else if (formDTO.getAttentionType().equals(NumConstant.ONE)){ + list = baseDao.vaccineList(formDTO); + } + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal()); + } + /** * 居民防疫信息详情 * @@ -1300,12 +1317,12 @@ public class IcResiUserServiceImpl extends BaseServiceImpl houseIds = new HashSet<>(); houseIds.add(result.getHomeId()); - Result> houseInfoRes=govOrgOpenFeignClient.queryListHouseInfo(new HashSet<>(houseIds),formDTO.getCustomerId()); + Result> houseInfoRes = govOrgOpenFeignClient.queryListHouseInfo(houseIds, formDTO.getCustomerId()); List houseInfoDTOList = houseInfoRes.success() && !CollectionUtils.isEmpty(houseInfoRes.getData()) ? houseInfoRes.getData() : new ArrayList<>(); Map houseInfoMap = houseInfoDTOList.stream().collect(Collectors.toMap(HouseInfoDTO::getHomeId, Function.identity())); if (houseInfoMap.containsKey(result.getHomeId()) && null != houseInfoMap.get(result.getHomeId())) { HouseInfoDTO houseInfoDTO = houseInfoMap.get(result.getHomeId()); - result.setHomeId(houseInfoDTO.getAllName()); + result.setHouseName(houseInfoDTO.getAllName()); } } return result; @@ -1326,10 +1343,14 @@ public class IcResiUserServiceImpl extends BaseServiceImpl natList = icNatService.getNatList(icResiUser.getIdCard()); + List natList = icNatService.getNatList(formDTO.getCustomerId(), icResiUser.getIdCard()); result.setNatList(natList); - //TODO 疫苗接种 - //TODO 行程信息 + //疫苗接种 + List vaccineList = icResiVaccineService.getVaccineList(formDTO.getCustomerId(), icResiUser.getIdCard()); + result.setVaccineList(vaccineList); + //行程信息 + List tripList = icTripReportRecordService.tripList(formDTO.getCustomerId(), icResiUser.getIdCard()); + result.setTripList(tripList); } return result; } 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 index c8c586137a..2f5f0b0928 100644 --- 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 @@ -1,23 +1,28 @@ 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.constant.FieldConstant; +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.beans.factory.annotation.Autowired; 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; /** * 居民疫苗情况 @@ -80,4 +85,32 @@ public class IcResiVaccineServiceImpl extends BaseServiceImpl} + * @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 19f57c0a73..9fc799e122 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 @@ -1,36 +1,62 @@ package com.epmet.service.impl; +import com.alibaba.excel.EasyExcel; +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; 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.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.ConvertUtils; +import com.epmet.commons.tools.utils.*; +import com.epmet.constant.IcResiUserConstant; +import com.epmet.constants.ImportTaskConstants; import com.epmet.dao.IcTripReportRecordDao; import com.epmet.dao.UserBaseInfoDao; +import com.epmet.dto.IcEpidemicSpecialAttentionDTO; import com.epmet.dto.IcTripReportRecordDTO; -import com.epmet.dto.form.IcTripReportFormDTO; -import com.epmet.dto.form.MyReportedTripFormDTO; -import com.epmet.dto.form.PageTripReportFormDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.TripListDTO; +import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.entity.IcTripReportRecordEntity; +import com.epmet.excel.data.IcTripReportExcelData; +import com.epmet.excel.handler.IcTripReportExcelImportListener; +import com.epmet.feign.EpmetCommonServiceOpenFeignClient; +import com.epmet.feign.OssFeignClient; import com.epmet.service.IcEpidemicSpecialAttentionService; import com.epmet.service.IcNoticeService; import com.epmet.service.IcTripReportRecordService; 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.collections4.ListUtils; import org.apache.commons.collections4.MapUtils; +import org.apache.commons.fileupload.FileItem; +import org.apache.commons.fileupload.FileItemFactory; +import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.lang3.StringUtils; +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; @@ -40,8 +66,9 @@ import java.util.stream.Collectors; * @author generator generator@elink-cn.com * @since v1.0.0 2022-03-25 */ +@Slf4j @Service -public class IcTripReportRecordServiceImpl extends BaseServiceImpl implements IcTripReportRecordService { +public class IcTripReportRecordServiceImpl extends BaseServiceImpl implements IcTripReportRecordService, ResultDataResolver { @Autowired private UserBaseInfoDao userBaseInfoDao; //关注 @@ -50,6 +77,11 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl page(PageTripReportFormDTO formDTO) { //1.获取工作人员缓存信息 - CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); - if (null == staffInfo) { - throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询工作人员缓存信息异常", EpmetErrorCode.SERVER_ERROR.getMsg()); - } + CustomerStaffInfoCacheResult staffInfo=queryCurrentStaff(formDTO.getCustomerId(),formDTO.getUserId()); formDTO.setAgencyId(staffInfo.getAgencyId()); //2.按条件查询业务数据 - PageInfo data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.isPage()) + PageInfo data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()) .doSelectPageInfo(() -> baseDao.pageList(formDTO)); List list = data.getList(); //3.查询最近一次通知时间、核算检测关注名单 if (CollectionUtils.isNotEmpty(list)) { - Set idCardSet = list.stream().map(m -> m.getIdCard()).collect(Collectors.toSet()); - Map latestNotice = icNoticeService.getUserLatestNoticeTime(formDTO.getCustomerId(),idCardSet); - List gzIdCardList = epidemicSpecialAttentionService.getHeSuanIdCardList(formDTO.getCustomerId(),idCardSet); + Map latestNotice = new HashMap<>(); + List gzIdCardList = new ArrayList<>(); + List idCardList = list.stream().map(m -> m.getIdCard()).distinct().collect(Collectors.toList()); + //如果不分页可能会有很多个身份证号 + List> partionList = ListUtils.partition(idCardList, NumConstant.ONE_HUNDRED); + partionList.forEach(l -> { + Map map = icNoticeService.getUserLatestNoticeTime(formDTO.getCustomerId(), l); + List gzIdCards = epidemicSpecialAttentionService.getHeSuanIdCardList(formDTO.getCustomerId(), l); + latestNotice.putAll(map); + gzIdCardList.addAll(gzIdCards); + }); for (IcTripReportRecordDTO dto : list) { //默认未加入 dto.setHeSuanCheck(false); + dto.setHeSuanCheckDesc("未加入"); if (CollectionUtils.isNotEmpty(gzIdCardList) && gzIdCardList.contains(dto.getIdCard())) { dto.setHeSuanCheck(true); + dto.setHeSuanCheckDesc("已加入"); } if (MapUtils.isNotEmpty(latestNotice) && latestNotice.containsKey(dto.getIdCard())) { dto.setLatestNoticeTime(latestNotice.get(dto.getIdCard())); @@ -86,6 +125,14 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl list(Map params) { List entityList = baseDao.selectList(getWrapper(params)); @@ -102,31 +149,118 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl NumConstant.ZERO && StringUtils.isNotBlank(formDTO.getContent())) { + sendNotice(formDTO,agencyInfoCache.getOrganizationName()); + } + return entity.getId(); + } + + /** + * 行程上报-发送通知 + * @param formDTO + */ + private void sendNotice(IcTripReportFormDTO formDTO,String agencyName) { + SendNoticeFormDTO dto = new SendNoticeFormDTO(); + List userList = new ArrayList<>(); + //注意这里的userId是指的pc平台的居民 + userList.add(ConvertUtils.sourceToTarget(formDTO, SendNoticeFormDTO.UserListBean.class)); + dto.setCustomerId(formDTO.getCustomerId()); + dto.setUserList(userList); + dto.setChannel(formDTO.getChannel()); + //通知来源 0 行程上报,1 疫苗接种,2 核酸检测 + dto.setOrigin(NumConstant.ZERO_STR); + dto.setContent(formDTO.getContent()); + dto.setOrgName(agencyName); + dto.setStaffId(formDTO.getCurrentStaffId()); + icNoticeService.sendNotice(dto); + } + + /** + * 行程上报-加入核算检测关注 + * @param formDTO + */ + private void vaccinationAdd(IcTripReportFormDTO formDTO) { + VaccinationAddFormDTO vaccinationAddFormDTO=new VaccinationAddFormDTO(); + vaccinationAddFormDTO.setCustomerId(formDTO.getCustomerId()); + vaccinationAddFormDTO.setUserId(formDTO.getCurrentStaffId()); + List list =new ArrayList<>(); + IcEpidemicSpecialAttentionDTO dto=new IcEpidemicSpecialAttentionDTO(); + dto.setName(formDTO.getName()); + dto.setIdCard(formDTO.getIdCard()); + dto.setMobile(formDTO.getMobile()); + //避免再发通知,赋值个空集合吧 + dto.setChannel(Collections.emptyList()); + //关注类型,核酸检测:2,疫苗接种:1;行程上报:0 + dto.setAttentionType(NumConstant.TWO); + list.add(dto); + vaccinationAddFormDTO.setList(list); + epidemicSpecialAttentionService.vaccinationAdd( vaccinationAddFormDTO); } @Override @Transactional(rollbackFor = Exception.class) - public void update(IcTripReportRecordDTO dto) { - IcTripReportRecordEntity entity = ConvertUtils.sourceToTarget(dto, IcTripReportRecordEntity.class); + public String update(IcTripReportFormDTO formDTO) { + IcTripReportRecordEntity origin=baseDao.selectById(formDTO.getId()); + if(null==origin){ + log.warn("ic_trip_report_record记录不存在id:",formDTO.getId()); + return formDTO.getId(); + } + //如果是单个录入的,默认数据属于当前用户所属组织id + if(IcResiUserConstant.USER_TYPE_INPUT.equals(formDTO.getUserType())){ + //获取当前登录用户所属组织id + CustomerStaffInfoCacheResult staffInfo= queryCurrentStaff(formDTO.getCustomerId(),formDTO.getCurrentStaffId()); + formDTO.setAgencyId(staffInfo.getAgencyId()); + } + IcTripReportRecordEntity entity = ConvertUtils.sourceToTarget(formDTO, IcTripReportRecordEntity.class); + AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(entity.getAgencyId()); + if (null == agencyInfoCache) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询组织信息异常", EpmetErrorCode.SERVER_ERROR.getMsg()); + } + entity.setPids(agencyInfoCache.getPids()); + //1.修改行程记录表 updateById(entity); + if(formDTO.getHeSuanCheck()){ + // 2.加入核算检测关注名单,如果之前关注了,会在通知的service层移除 + vaccinationAdd(formDTO); + } + //3.新增通知表信息 + if (formDTO.getChannel().size() > NumConstant.ZERO && StringUtils.isNotBlank(formDTO.getContent())) { + sendNotice(formDTO,agencyInfoCache.getOrganizationName()); + } + return entity.getId(); } @Override @Transactional(rollbackFor = Exception.class) - public void delete(String[] ids) { - // 逻辑删除(@TableLogic 注解) - baseDao.deleteBatchIds(Arrays.asList(ids)); + public void delete(String customerId, String userId, String[] ids) { + CustomerStaffInfoCacheResult staffInfo=queryCurrentStaff(customerId,userId); + baseDao.batchDel(userId,staffInfo.getAgencyId(),ids); } /** @@ -169,5 +303,127 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl} + * @Author zhaoqifeng + * @Date 2022/3/30 10:31 + */ + @Override + public List tripList(String customerId, String idCard) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(IcTripReportRecordEntity::getCustomerId, customerId); + wrapper.eq(IcTripReportRecordEntity::getIdCard, idCard); + wrapper.orderByDesc(IcTripReportRecordEntity::getArriveDate); + List list = baseDao.selectList(wrapper); + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyList(); + } + return list.stream().map(item -> { + TripListDTO dto = new TripListDTO(); + dto.setArrivalTime(DateUtils.format(item.getArriveDate(), DateUtils.DATE_PATTERN)); + dto.setFromRegion(item.getSourceAddress()); + dto.setLeaveTime(DateUtils.format(item.getLeaveDate(), DateUtils.DATE_PATTERN)); + dto.setRemark(item.getRemark()); + return dto; + }).collect(Collectors.toList()); + } + + @Async + @Override + public void execAsyncExcelImport(Path filePath, String importTaskId) { + String userId = null; + String customerId=null; + try { + userId = EpmetRequestHolder.getHeader(AppClientConstant.USER_ID); + customerId = EpmetRequestHolder.getHeader(AppClientConstant.CUSTOMER_ID); + //获取当前登录用户所属组织id + CustomerStaffInfoCacheResult staffInfo= queryCurrentStaff(customerId,userId); + + IcTripReportExcelImportListener listener = new IcTripReportExcelImportListener(customerId,staffInfo, this); + + EasyExcel.read(filePath.toFile(), IcTripReportExcelData.class, listener).headRowNumber(2).sheet(0).doRead(); + + Path errorDescFile = null; + String errorDesFileUrl = null; + List 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); + } + } + + ImportTaskCommonFormDTO importFinishTaskForm = new ImportTaskCommonFormDTO(); + importFinishTaskForm.setTaskId(importTaskId); + importFinishTaskForm.setProcessStatus(errorRows.size() <= 0 ? ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS : ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL); + 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) { + String currentUserId = EpmetRequestHolder.getHeader(AppClientConstant.USER_ID); + entities.forEach(e -> { + String id = IdWorker.getIdStr(e); + e.setId(id); + e.setUpdatedBy(currentUserId); + baseDao.insert(e); + }); + } } \ No newline at end of file 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 7964281361..fe6deee8e8 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 @@ -172,7 +172,7 @@ public class PatrolRoutineWorkServiceImpl extends BaseServiceImpl listPage(PatrolQueryFormDTO formDTO) { - return PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.isPage()) + return PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()) .doSelectPage(() -> baseDao.selectList(formDTO)); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java index 8a1648fdb4..aca5ac654b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java @@ -172,7 +172,23 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { //根据buildingID,tableName he columnName获取名字 //限制条数 一栋楼内最多显示1000 即可 - PageHelper.startPage(NumConstant.ONE,NumConstant.ONE_THOUSAND,false).doSelectPage(()->{ + for (String s : buildingIdList) { + PageHelper.startPage(NumConstant.ONE,NumConstant.ONE_HUNDRED,false).doSelectPage(()->{ + List dtos = icStatsResiWarnDao.userWarnListDTO(customerId, Arrays.asList(s), icResiCategoryWarnConfigDTO.getTableName(), icResiCategoryWarnConfigDTO.getColumnName()); + if (!CollectionUtils.isEmpty(dtos)){ + Map> groupByBuild = dtos.stream().collect(Collectors.groupingBy(UserWarnNameListResultDTO::getBuildingId)); + result.forEach(item->{ + item.setConfigId(configId); + groupByBuild.forEach((k,v) -> { + if (item.getBuildingId().equals(k)){ + item.setUserList(v); + } + }); + }); + } + }); + } + /*PageHelper.startPage(NumConstant.ONE,NumConstant.ONE_THOUSAND,false).doSelectPage(()->{ List dtos = icStatsResiWarnDao.userWarnListDTO(customerId, buildingIdList, icResiCategoryWarnConfigDTO.getTableName(), icResiCategoryWarnConfigDTO.getColumnName()); if (!CollectionUtils.isEmpty(dtos)){ Map> groupByBuild = dtos.stream().collect(Collectors.groupingBy(UserWarnNameListResultDTO::getBuildingId)); @@ -185,7 +201,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { }); }); } - }); + });*/ return mapResult; } diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.28__nat_add_uniquekey.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.28__nat_add_uniquekey.sql new file mode 100644 index 0000000000..76b6b17b34 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.28__nat_add_uniquekey.sql @@ -0,0 +1 @@ +alter table ic_nat add unique index unq_nat(ID_CARD, NAT_TIME) \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.29__modify_trip_report.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.29__modify_trip_report.sql new file mode 100644 index 0000000000..d28bc06972 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.29__modify_trip_report.sql @@ -0,0 +1,2 @@ +alter table ic_trip_report_record MODIFY COLUMN PIDS VARCHAR(255) COMMENT 'agency_id的所有上级'; +alter table ic_trip_report_record MODIFY COLUMN USER_TYPE VARCHAR(32) NOT NULL COMMENT '居民端小程序的人:resi;数字社区的居民:icresi;单独录入:input; 导入:import'; \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.30__add_vaccine.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.30__add_vaccine.sql new file mode 100644 index 0000000000..a41ed606c6 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.30__add_vaccine.sql @@ -0,0 +1,21 @@ +CREATE TABLE `ic_resi_vaccine` ( + `ID` varchar(64) NOT NULL COMMENT '唯一标识', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id customer.id', + `NAME` varchar(64) NOT NULL COMMENT '姓名', + `MOBILE` varchar(11) NOT NULL COMMENT '手机号', + `ID_CARD` varchar(18) NOT NULL COMMENT '身份证号', + `INOCULATE_TIME` datetime NOT NULL COMMENT '接种时间', + `INOCULATE_ADDRESS` varchar(32) NOT NULL DEFAULT '' COMMENT '接种地点', + `MANUFACTURER` varchar(32) NOT NULL DEFAULT '' COMMENT '疫苗厂家', + `FIELD1` varchar(32) DEFAULT NULL COMMENT '预留字段1', + `FIELD2` varchar(255) DEFAULT NULL COMMENT '预留字段2', + `FIELD3` varchar(255) DEFAULT NULL COMMENT '预留字段3', + `REMAEK` varchar(255) DEFAULT NULL COMMENT '备注', + `DEL_FLAG` int(11) 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`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='居民疫苗情况'; \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.31__modifty_trip_reportv2.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.31__modifty_trip_reportv2.sql new file mode 100644 index 0000000000..a7e6ad6382 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.31__modifty_trip_reportv2.sql @@ -0,0 +1,2 @@ +alter table ic_trip_report_record MODIFY COLUMN PRESENT_ADDRESS_CODE VARCHAR(32) COMMENT '现居地编码'; +alter table ic_trip_report_record MODIFY COLUMN SOURCE_ADDRESS_CODE VARCHAR(32) COMMENT '来源地区编码'; \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.32__update_ic_nat.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.32__update_ic_nat.sql new file mode 100644 index 0000000000..30d6bd9ac1 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.32__update_ic_nat.sql @@ -0,0 +1,3 @@ + ALTER TABLE `ic_nat` + DROP INDEX `unq_nat` , + ADD UNIQUE INDEX `unq_nat` (`ID_CARD`, `NAT_TIME`, `AGENCY_ID`) USING BTREE ; \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.33__modify_trip_reportv3.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.33__modify_trip_reportv3.sql new file mode 100644 index 0000000000..927c2f9a35 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.33__modify_trip_reportv3.sql @@ -0,0 +1,2 @@ +alter table ic_trip_report_record add column PRESENT_ADDRESS_PATH_CODE VARCHAR(255) COMMENT '现居地编码全路径' AFTER PRESENT_ADDRESS_CODE; +alter table ic_trip_report_record add column SOURCE_ADDRESS_PATH_CODE VARCHAR(255) COMMENT '来源地区编码全路径' AFTER SOURCE_ADDRESS_CODE; \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.34__modify_collect.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.34__modify_collect.sql new file mode 100644 index 0000000000..a958e05946 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.34__modify_collect.sql @@ -0,0 +1,4 @@ +alter TABLE ic_resi_collect add COLUMN `VILLAGE_NAME` varchar(64) DEFAULT NULL COMMENT '所属小区名称' AFTER VILLAGE_ID; +alter TABLE ic_resi_collect add COLUMN `BUILD_NAME` varchar(64) DEFAULT NULL COMMENT '所属楼宇名称' AFTER BUILD_ID; +alter TABLE ic_resi_collect add COLUMN `UNIT_NAME` varchar(64) DEFAULT NULL COMMENT '单元名' AFTER UNIT_ID; +alter TABLE ic_resi_collect add COLUMN `HOME_NAME` varchar(64) DEFAULT NULL COMMENT '房间名' AFTER HOME_ID; \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.35__new_ic_nat.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.35__new_ic_nat.sql new file mode 100644 index 0000000000..8001d9769d --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.35__new_ic_nat.sql @@ -0,0 +1,46 @@ +-- ---------------------------- +-- Table structure for ic_nat +-- ---------------------------- +DROP TABLE IF EXISTS `ic_nat`; +CREATE TABLE `ic_nat` ( + `ID` varchar(64) NOT NULL COMMENT 'ID', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id', + `IS_RESI_USER` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否客户下居民(0:否 1:是)', + `USER_ID` varchar(64) DEFAULT NULL COMMENT '居民端小程序的用户id、数字社区的icResiUserId、其他情况无值', + `USER_TYPE` varchar(32) NOT NULL COMMENT '数据来源【居民端小程序的人:resi;\r\n数字社区的居民:icresi;\r\n导入的:import;\r\n同步的:synchro】', + `NAME` varchar(64) NOT NULL COMMENT '人员姓名', + `MOBILE` varchar(11) NOT NULL COMMENT '手机号', + `ID_CARD` varchar(18) NOT NULL COMMENT '身份证号', + `NAT_TIME` datetime NOT NULL COMMENT '检测时间,精确到分钟', + `NAT_RESULT` varchar(1) DEFAULT NULL COMMENT '检测结果(0:阴性 1:阳性)', + `NAT_ADDRESS` varchar(128) DEFAULT NULL COMMENT '检测地点', + `FILE_NAME` varchar(255) DEFAULT NULL COMMENT '文件名', + `ATTACHMENT_TYPE` varchar(64) NOT NULL COMMENT '附件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc))', + `ATTACHMENT_URL` varchar(255) NOT NULL COMMENT '附件地址', + `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='核酸记录基础信息表'; + +-- ---------------------------- +-- Table structure for ic_nat_relation +-- ---------------------------- +CREATE TABLE `ic_nat_relation` ( + `ID` varchar(64) NOT NULL COMMENT 'ID', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id', + `AGENCY_ID` varchar(64) NOT NULL COMMENT '居民端上报时存储用户所在网格的组织id.居民信息的人存储居民所在组织id.单个新增或者导入的存储登录用户所属的组织id', + `PIDS` varchar(255) NOT NULL COMMENT '组织pids,包含当前agencyId值', + `IC_NAT_ID` varchar(64) NOT NULL COMMENT '核酸记录表Id(ic_nat.id)', + `USER_TYPE` varchar(32) NOT NULL COMMENT '关系数据的绑定途径【居民端录入:resi;\r\n数字社区录入:icresi;\r\n导入的:import;\r\n同步的:synchro】', + `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='核酸记录关系表'; \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/attention_nat_template.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/attention_nat_template.xlsx new file mode 100644 index 0000000000..1ef3866f47 Binary files /dev/null and b/epmet-user/epmet-user-server/src/main/resources/excel/attention_nat_template.xlsx differ diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/attention_vaccination_template.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/attention_vaccination_template.xlsx new file mode 100644 index 0000000000..b186c33b7a Binary files /dev/null and b/epmet-user/epmet-user-server/src/main/resources/excel/attention_vaccination_template.xlsx differ diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/ic_nat.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/ic_nat.xlsx index 4d7df5944a..d74d726f95 100644 Binary files a/epmet-user/epmet-user-server/src/main/resources/excel/ic_nat.xlsx and b/epmet-user/epmet-user-server/src/main/resources/excel/ic_nat.xlsx differ diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/trip_report_import_template.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/trip_report_import_template.xlsx new file mode 100644 index 0000000000..e360db9aad Binary files /dev/null and b/epmet-user/epmet-user-server/src/main/resources/excel/trip_report_import_template.xlsx differ diff --git a/epmet-user/epmet-user-server/src/main/resources/logback-spring.xml b/epmet-user/epmet-user-server/src/main/resources/logback-spring.xml index 6b7089434f..c2a982739d 100644 --- a/epmet-user/epmet-user-server/src/main/resources/logback-spring.xml +++ b/epmet-user/epmet-user-server/src/main/resources/logback-spring.xml @@ -142,7 +142,6 @@ - diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcEpidemicSpecialAttentionDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcEpidemicSpecialAttentionDao.xml index 67f80a3905..1510da99b8 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcEpidemicSpecialAttentionDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcEpidemicSpecialAttentionDao.xml @@ -7,7 +7,8 @@ UPDATE ic_epidemic_special_attention SET UPDATED_TIME = NOW(), - IS_ATTENTION = 0 + IS_ATTENTION = 0, + del_flag = 1 WHERE del_flag = 0 AND attention_type = #{attentionType} AND id_card IN ( @@ -24,21 +25,21 @@ a.MOBILE, a.ID_CARD, a.REMARK, - IFNULL((SELECT DATE_FORMAT(CREATED_TIME,'%Y-%m-%d %H:%i:%s') FROM ic_notice WHERE DEL_FLAG = '0' AND ORIGIN = '1' AND ID_CARD = #{idCard} ORDER BY CREATED_TIME LIMIT 1),'') AS lastInformTime, - COUNT(v.ID) AS vaccinationCount + IFNULL((SELECT DATE_FORMAT(CREATED_TIME,'%Y-%m-%d %H:%i:%s') FROM ic_notice WHERE DEL_FLAG = '0' AND ORIGIN = #{attentionType} AND ID_CARD = a.ID_CARD ORDER BY CREATED_TIME DESC LIMIT 1),'') AS lastInformTime, + IFNULL(v.vaccinationCount,0) AS vaccinationCount FROM ic_epidemic_special_attention a - LEFT JOIN ic_resi_vaccine v ON (v.ID_CARD = a.ID_CARD AND v.DEL_FLAG = '0') + LEFT JOIN (SELECT id_card ,count(1) AS vaccinationCount FROM ic_resi_vaccine WHERE DEL_FLAG = 0 GROUP BY ID_CARD) v ON (v.ID_CARD = a.ID_CARD) WHERE a.DEL_FLAG = 0 AND a.ORG_ID = #{orgId} AND ATTENTION_TYPE = #{attentionType} - AND a.`NAME` = #{name} + AND a.`NAME` LIKE CONCAT('%',#{name},'%') - AND a.MOBILE = #{mobile} + AND a.MOBILE LIKE CONCAT('%',#{mobile},'%') - AND a.ID_CARD = #{idCard} + AND a.ID_CARD LIKE CONCAT('%',#{idCard},'%') HAVING vaccinationCount = #{vaccinationCount} @@ -54,19 +55,19 @@ a.ID_CARD, a.REMARK, a.REASON, - IFNULL((SELECT DATE_FORMAT(CREATED_TIME,'%Y-%m-%d %H:%i:%s') FROM ic_notice WHERE DEL_FLAG = '0' AND ORIGIN = '1' AND ID_CARD = #{idCard} ORDER BY CREATED_TIME LIMIT 1),'') AS lastInformTime + IFNULL((SELECT DATE_FORMAT(CREATED_TIME,'%Y-%m-%d %H:%i:%s') FROM ic_notice WHERE DEL_FLAG = '0' AND ORIGIN = #{attentionType} AND ID_CARD = a.ID_CARD ORDER BY CREATED_TIME DESC LIMIT 1),'') AS lastInformTime FROM ic_epidemic_special_attention a WHERE a.DEL_FLAG = 0 AND a.ORG_ID = #{orgId} AND ATTENTION_TYPE = #{attentionType} - AND a.`NAME` = #{name} + AND a.`NAME` LIKE CONCAT('%',#{name},'%') - AND a.MOBILE = #{mobile} + AND a.MOBILE LIKE CONCAT('%',#{mobile},'%') - AND a.ID_CARD = #{idCard} + AND a.ID_CARD LIKE CONCAT('%',#{idCard},'%') AND a.REASON LIKE CONCAT('%',#{reason},'%') 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 1f325c92e3..66a10d467d 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 @@ -21,15 +21,62 @@ WHERE del_flag = '0' AND customer_id = #{customerId} - AND id_card = #{idCard} + AND ( + CREATED_BY = #{userId} + + OR id_card = #{idCard} + + ) ORDER BY nat_time DESC + + + + 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() + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatRelationDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatRelationDao.xml new file mode 100644 index 0000000000..1857d13df7 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatRelationDao.xml @@ -0,0 +1,16 @@ + + + + + + + DELETE + FROM ic_nat_relation + WHERE + ic_nat_id = #{icNatId} + + AND AGENCY_ID = #{agencyId} + + + + \ 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 2b040cd4cd..03e32c884a 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 @@ -302,7 +302,8 @@ concat(ir.`NAME`,'(',ir.MOBILE,')')as label, ir.grid_id as gridId, ir.ID_CARD as idCard, - ir.AGENCY_ID as agencyId + ir.AGENCY_ID as agencyId, + ir.HOME_ID as houseId FROM ic_resi_user ir WHERE @@ -655,8 +656,28 @@ IFNULL( c.count, 0 ) AS natCount FROM ic_resi_user a - LEFT JOIN ( SELECT ID_CARD, count( id ) AS count 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 FROM ic_nat WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} GROUP BY ID_CARD ) c ON a.ID_CARD = c.ID_CARD + LEFT JOIN ( + SELECT ID_CARD, count( id ) AS count + FROM ic_resi_vaccine + WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} + + AND DATE_FORMAT(INOCULATE_TIME,"%Y-%m-%d") > #{startDate} + + + AND DATE_FORMAT(INOCULATE_TIME,"%Y-%m-%d") < #{endDate} + + GROUP BY ID_CARD ) b ON a.ID_CARD = b.ID_CARD + LEFT JOIN ( + SELECT ID_CARD, count( id ) AS count + FROM ic_nat + WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} + + AND DATE_FORMAT(NAT_TIME,"%Y-%m-%d") > #{startDate} + + + AND DATE_FORMAT(NAT_TIME,"%Y-%m-%d") < #{endDate} + + GROUP BY ID_CARD ) c ON a.ID_CARD = c.ID_CARD WHERE a.DEL_FLAG = '0' @@ -672,7 +693,7 @@ AND GRID_ID = #{gridId} - AND NEIGHBOR_HOOD_ID = #{neighborId} + AND VILLAGE_ID = #{neighborId} AND BUILD_ID = #{buildingId} @@ -690,7 +711,7 @@ AND MOBILE LIKE concat( '%', #{mobile}, '%' ) - AND ID_CARD LIKE concat( '%', #{idCard}, '%' ) + AND a.ID_CARD LIKE concat( '%', #{idCard}, '%' ) ) t WHERE @@ -703,4 +724,77 @@ ORDER BY `NAME` + + + 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 d3a626aed8..f667e9826d 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 @@ -47,13 +47,27 @@ AND SOURCE_ADDRESS_CODE like concat(#{sourceAddressCode},'%') - - AND ARRIVE_DATE = ]]> #{startTime} + + AND SOURCE_ADDRESS like concat('%',#{sourceAddress},'%') - - AND ARRIVE_DATE #{endTime} + + AND ARRIVE_DATE = ]]> #{startDate} + + + AND ARRIVE_DATE #{endDate} ORDER BY r.CREATED_TIME DESC + + + update ic_trip_report_record set del_flag='1',UPDATED_BY=#{userId},UPDATED_TIME=NOW() + WHERE USER_TYPE !='resi' + AND AGENCY_ID=#{agencyId} + AND ( + + id=#{id} + + ) + \ No newline at end of file