diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenCentralZoneDataFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenCentralZoneDataFormDTO.java index 5a5d0af839..21c1a0f414 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenCentralZoneDataFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenCentralZoneDataFormDTO.java @@ -29,4 +29,14 @@ public class ScreenCentralZoneDataFormDTO implements Serializable { private String endDate; private String projectId; + + /** + * 首次的话 全量拉取 + */ + private Boolean isFirst; + + /** + * 时间间隔天数 14 就是查询14天内的数据 + */ + private String internalDay; } diff --git a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml index 3cd9ff7c01..91bf6acfca 100644 --- a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml +++ b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml @@ -9,10 +9,10 @@ services: volumes: - "/opt/epmet-cloud-logs/prod:/logs" environment: - RUN_INSTRUCT: "java -Xms256m -Xmx1524m -jar ./data-stats.jar" + RUN_INSTRUCT: "java -Xms256m -Xmx3000m -jar ./data-stats.jar" restart: "unless-stopped" deploy: resources: limits: cpus: '0.1' - memory: 1600M + memory: 3200M diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index 2ba667217c..97453a2f06 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -997,11 +997,6 @@ public class DemoController { @Autowired private ScreenGrassrootsGovernDataAbsorptionService ndddYhjfService; - @PostMapping("diffOld") - public Result diff(@RequestBody ScreenCentralZoneDataFormDTO param){ - ndddYhjfService.difficultyDataHub(param); - return new Result(); - } @PostMapping("testDiffNew") public Result testDiff(@RequestBody ScreenCentralZoneDataFormDTO param){ return new Result().ok(ndddYhjfService.difficultyDataExtract(param)); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java index dad541fcfb..7d1c6903ab 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java @@ -26,10 +26,8 @@ import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO; import com.epmet.dto.pingyin.result.*; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; -import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity; -import com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity; -import com.epmet.entity.evaluationindex.extract.GovernGridTotalCommonDTO; -import com.epmet.entity.evaluationindex.extract.GovernProjectInfoDTO; +import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; +import com.epmet.entity.evaluationindex.extract.*; import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -403,13 +401,13 @@ public interface FactOriginProjectMainDailyDao extends BaseDao + * @param param + * @param param + * @return java.util.List * @author LiuJanJun * @date 2021/4/12 1:35 下午 */ - List getProjectForDiff(@Param("customerId") String customerId, @Param("dateId") String dateId); + List getProjectForDiff(@Param("param") ScreenCentralZoneDataFormDTO param, @Param("offset") int offset, @Param("pageSize") int pageSize); /** * desc: 获取难点堵点项目数据耗时 @@ -420,7 +418,7 @@ public interface FactOriginProjectMainDailyDao extends BaseDao getProjectPeriodForDiff(@Param("customerId") String customerId, @Param("dateId") String dateId); + List getProjectPeriodForDiff(@Param("customerId") String customerId, @Param("projectId") String projectId); List selectResponseCount(@Param("customerId") String customerId); @@ -551,4 +549,5 @@ public interface FactOriginProjectMainDailyDao extends BaseDao getMemberProjectCount(@Param("customerId") String customerId, @Param("dateId") String dateId); + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenDifficultyDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenDifficultyDataDao.java index 3d90291cba..fb35330b9c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenDifficultyDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenDifficultyDataDao.java @@ -19,7 +19,6 @@ package com.epmet.dao.evaluationindex.screen; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.screencoll.form.DifficultyDataDetailFormDTO; -import com.epmet.dto.screencoll.form.DifficultyDataFormDTO; import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity; import com.epmet.entity.evaluationindex.screen.ScreenDifficultyImgDataEntity; import org.apache.ibatis.annotations.Mapper; @@ -56,7 +55,7 @@ public interface ScreenDifficultyDataDao extends BaseDao list, @Param("customerId")String customerId); - + /** * @Description 根据customerId查询是否有难点赌点的数据 * @param customerId @@ -92,12 +91,4 @@ public interface ScreenDifficultyDataDao extends BaseDao list); - /** - * @Description 根据客户Id查出全部的难点赌点的项目Id和网格Id,因为需要比对全部的信息然后删除因为删除网格而导致的垃圾数据 - * @param customerId - * @return java.util.List - * @author wangc - * @date 2020.11.17 09:33 - */ - List selectAllDifficultyByCustomerId(@Param("customerId")String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectMainAndPeriodDTO.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectMainAndPeriodDTO.java new file mode 100644 index 0000000000..191d6a93b7 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectMainAndPeriodDTO.java @@ -0,0 +1,156 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.evaluationindex.extract; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; + +import java.util.List; + +/** + * 项目主表_日统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-09-16 + */ +@Data +public class FactOriginProjectMainAndPeriodDTO extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 项目的发布日期yyyyMMdd + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月份ID + */ + private String monthId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 年度ID + */ + private String yearId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 转议题用户ID + */ + private String issueCreatorId; + + /** + * 转为项目的议题ID + */ + private String issueId; + + /** + * 转为议题的话题ID + */ + private String topicId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 上级ID + */ + private String pid; + + /** + * 所有上级Id集合 (项目来源) + * */ + private String pids; + + /** + * 组织ID(网格所属组织ID) + */ + private String agencyId; + + /** + * 来源:议题issue + */ + private String origin; + + /** + * 来源ID + */ + private String originId; + + /** + * 状态 + */ + private String projectStatus; + + /** + * resolved unresolved + * */ + private String isResolved; + + /** + * 创建话题用户的ID + */ + private String topicCreatorId; + + /** + * 是否是党员 1:是 + */ + private String isParty; + + /** + * 是否超期 1:是 + */ + private String isOverdue; + + /** + * 是否满意 1:是 + */ + private Integer isSatisfied; + + /** + * 办结组织Ids(:隔开,有可能是社区id可能是网格id,无需区分级别,在统计时模糊查询) + */ + private String finishOrgIds; + + /** + * 项目创建人(议题转项目或立项人) + */ + private String projectCreator; + + /** + * 项目处理时间节点 + */ + private List periodList; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/impl/BizDataStatsServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/impl/BizDataStatsServiceImpl.java index 54b7245e0f..15d3ba8b06 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/impl/BizDataStatsServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/impl/BizDataStatsServiceImpl.java @@ -78,7 +78,7 @@ public class BizDataStatsServiceImpl implements BizDataStatsService { List customerIdList = null; do { customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); - if (!CollectionUtils.isEmpty(customerIdList)){ + if (!CollectionUtils.isEmpty(customerIdList)) { customerIds.addAll(customerIdList); } } while (!CollectionUtil.isEmpty(customerIdList) && customerIdList.size() == pageSize); @@ -99,8 +99,8 @@ public class BizDataStatsServiceImpl implements BizDataStatsService { //校正参数里的前一天日期的数据 //获取所有网格员 List allGridMembers = getAllGridMembers(formDTO); - if (CollectionUtils.isEmpty(allGridMembers)){ - log.warn("executeStaffPatrolStats have any gridMembers,param:{}",JSON.toJSONString(formDTO)); + if (CollectionUtils.isEmpty(allGridMembers)) { + log.warn("executeStaffPatrolStats have any gridMembers,param:{}", JSON.toJSONString(formDTO)); return; } String yesterdayStr = getYesterdayString(formDTO); @@ -110,12 +110,12 @@ public class BizDataStatsServiceImpl implements BizDataStatsService { //初始化参数里日期的数据 如果当前时间在1分钟内 则初始化 String todayDateDimId = DimIdGenerator.getDateDimId(new Date()); - if (todayDateDimId.equals(formDTO.getDateId())){ + if (todayDateDimId.equals(formDTO.getDateId())) { //如果当前时间-1分钟还等于今天 则进行初始化操作 否则执行数据纠正 String dateDimId = DimIdGenerator.getDateDimId(new Date(System.currentTimeMillis() - 1 * 60 * 1000)); - if (!dateDimId.equals(todayDateDimId)){ + if (!dateDimId.equals(todayDateDimId)) { initStaffPatrolTodayData(formDTO, allGridMembers); - }else{ + } else { reloadStaffPatrolStatsData(formDTO, allGridMembers); } } @@ -123,7 +123,7 @@ public class BizDataStatsServiceImpl implements BizDataStatsService { } private void reloadStaffPatrolStatsData(StaffPatrolStatsFormDTO formDTO, List allGridMembers) { - log.info("reloadStaffPatrolStatsData param:{}",JSON.toJSONString(formDTO)); + log.info("reloadStaffPatrolStatsData param:{}", JSON.toJSONString(formDTO)); //获取昨日的巡查统计记录 //遍历网格员重新初始化数据 @@ -216,7 +216,7 @@ public class BizDataStatsServiceImpl implements BizDataStatsService { } private void initStaffPatrolTodayData(StaffPatrolStatsFormDTO formDTO, List allGridMembers) { - log.info("initStaffPatrolTodayData param:{}",JSON.toJSONString(formDTO)); + log.info("initStaffPatrolTodayData param:{}", JSON.toJSONString(formDTO)); List insertList = buildInitPatrolStatsData(formDTO, allGridMembers); Integer effectRow = statsStaffPatrolService.delAndInsertBatch(formDTO, insertList); log.debug("initStaffPatrolStats insert rows:{}", effectRow); @@ -302,24 +302,24 @@ public class BizDataStatsServiceImpl implements BizDataStatsService { daysBetween = DateUtils.getDaysBetween(param.getStartDate(), param.getEndDate()); } List finalDaysBetween = daysBetween; - threadPool.submit(() -> { - if (!isRange) { - try { - //初始化form里的今天的数据 并纠正昨日的数据 + + if (!isRange) { + try { + //初始化form里的今天的数据 并纠正昨日的数据 + this.executeStaffPatrolStats(formDTO); + } catch (Exception e) { + log.error("【网格员巡查数据统计】发生异常,参数:" + JSON.toJSONString(formDTO), e); + } + } else { + try { + for (String dateDimId : finalDaysBetween) { + formDTO.setDateId(dateDimId); this.executeStaffPatrolStats(formDTO); - } catch (Exception e) { - log.error("【网格员巡查数据统计】发生异常,参数:" + JSON.toJSONString(formDTO), e); - } - } else { - try { - for (String dateDimId : finalDaysBetween) { - formDTO.setDateId(dateDimId); - this.executeStaffPatrolStats(formDTO); - } - } catch (Exception e) { - log.error("【网格员巡查数据统计】发生异常,参数:" + JSON.toJSONString(param), e); } + } catch (Exception e) { + log.error("【网格员巡查数据统计】发生异常,参数:" + JSON.toJSONString(param), e); } - }); + } + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java index 515befcf9d..6e1268f727 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java @@ -27,10 +27,7 @@ import com.epmet.dto.pingyin.result.*; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; -import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity; -import com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity; -import com.epmet.entity.evaluationindex.extract.GovernGridTotalCommonDTO; -import com.epmet.entity.evaluationindex.extract.GovernProjectInfoDTO; +import com.epmet.entity.evaluationindex.extract.*; import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity; import java.util.List; @@ -377,11 +374,13 @@ public interface FactOriginProjectMainDailyService extends BaseService * @author LiuJanJun * @date 2021/4/12 11:07 上午 */ - List getProjectForDiff(ScreenCentralZoneDataFormDTO param); + List getProjectAndPeriodForDiff(ScreenCentralZoneDataFormDTO param, int offset, int pageSize); /** * desc: 根据项目数据 获取相关连的项目耗时 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java index 1f1fcfe88a..a307aaf171 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java @@ -36,10 +36,7 @@ import com.epmet.dto.result.CostDayResultDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; -import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity; -import com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity; -import com.epmet.entity.evaluationindex.extract.GovernGridTotalCommonDTO; -import com.epmet.entity.evaluationindex.extract.GovernProjectInfoDTO; +import com.epmet.entity.evaluationindex.extract.*; import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectMainDailyService; @@ -527,8 +524,8 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl getProjectForDiff(ScreenCentralZoneDataFormDTO param) { - return baseDao.getProjectForDiff(param.getCustomerId(),param.getDateId()); + public List getProjectAndPeriodForDiff(ScreenCentralZoneDataFormDTO param, int offset, int pageSize) { + return baseDao.getProjectForDiff(param,offset,pageSize); } @Override diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenGrassrootsGovernDataAbsorptionService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenGrassrootsGovernDataAbsorptionService.java index 817d714096..570756ad25 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenGrassrootsGovernDataAbsorptionService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenGrassrootsGovernDataAbsorptionService.java @@ -18,15 +18,6 @@ public interface ScreenGrassrootsGovernDataAbsorptionService { **/ void userScoreDataHub(ScreenCentralZoneDataFormDTO param); - /** - * @Description 难点赌点数据中转站 - * @param param - * @return - * @author wangc - * @date 2020.09.25 10:00 - **/ - void difficultyDataHub(ScreenCentralZoneDataFormDTO param); - /** * desc: 新的难点堵点抽取 * diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java index ada550886f..6bacc7a64c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java @@ -8,12 +8,10 @@ import com.epmet.constant.ProjectConstant; import com.epmet.dto.ProjectCategoryDTO; import com.epmet.dto.ProjectDTO; import com.epmet.dto.org.GridInfoDTO; -import com.epmet.dto.project.result.ProjectLatestOperationResultDTO; -import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; import com.epmet.dto.topic.TopicAttachmentDTO; import com.epmet.dto.topic.result.ResiTopicAndImgResultDTO; -import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity; +import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainAndPeriodDTO; import com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity; import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity; import com.epmet.entity.evaluationindex.screen.ScreenDifficultyImgDataEntity; @@ -155,187 +153,122 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr screenPartyUserRankDataService.dataClean(registeredUsers, param.getCustomerId()); } - /** - * @param param - * @return - * @Description 难点赌点数据中转站 - * @author wangc - * @date 2020.09.25 10:00 - **/ @Override - public void difficultyDataHub(ScreenCentralZoneDataFormDTO param) { - //查询数据 - List difficulties = factOriginProjectMainDailyService.getDifficultyBaseInfo(param.getCustomerId(), projectService.getOvertimeProjectByParameter(param.getCustomerId())); - if (CollectionUtils.isEmpty(difficulties)) { - return; - } - - //2.查询出客户下网格的相关信息 - List gridList = customerGridService.queryGridInfoList(param.getCustomerId()); - Map gridMap = gridList.stream().collect(Collectors.toMap(GridInfoDTO::getGridId, a -> a, (o, n) -> o)); - - //剔除垃圾数据(本次需要更新的数据集) - //for(Iterator iter = difficulties.iterator(); iter.hasNext();){ - // ScreenDifficultyDataEntity pointer = iter.next(); - // if(null == gridMap.get(pointer.getOrgId())){ - // iter.remove(); - // } - //} - difficulties.removeIf(diff -> null == gridMap.get(diff.getOrgId())); - - List projectIds = difficulties.stream().map(ScreenDifficultyDataEntity::getEventId).distinct().collect(Collectors.toList()); - //最近一次操作 - Map latestOperationMap = projectProcessService.getLatestOperation(projectIds, param.getCustomerId()); - //图片 - List projectSourceMap = difficulties.stream().map(diff -> { - ProjectSourceMapFormDTO map = new ProjectSourceMapFormDTO(); - map.setProjectId(diff.getEventId()); - map.setSourceId(diff.getEventImgUrl()); - return map; - }).collect(Collectors.toList()); - //factOriginProjectMainDailyService.getNewProject(param.getCustomerId(),projectIds); - - Map> imgMap = topicService.getTopicImgs(projectSourceMap); - - Map contentMap = topicService.getTopicContent(projectSourceMap); - - difficulties.forEach(diff -> { - - List figureList = CollectionUtils.isEmpty(imgMap) ? null : imgMap.get(diff.getEventId()); - diff.setEventImgUrl(CollectionUtils.isEmpty(figureList) ? "" : figureList.get(NumConstant.ZERO).getEventImgUrl()); - - - if (!CollectionUtils.isEmpty(contentMap)) { - diff.setEventContent(contentMap.get(diff.getEventId())); + public boolean difficultyDataExtract(ScreenCentralZoneDataFormDTO param) { + try { + //默认查询10天内的数据 + param.setInternalDay(DateUtils.getBeforeNDay(NumConstant.TEN)); + //获取agency维度 + List agencyList = dimAgencyService.getAgencyListByCustomerId(param.getCustomerId()); + Map agencyMap = agencyList.stream().collect(Collectors.toMap(DimAgencyEntity::getId, o -> o, (o1, o2) -> o1)); + //获取grid维度 + List gridList = customerGridService.queryGridInfoList(param.getCustomerId()); + Map gridMap = gridList.stream().collect(Collectors.toMap(GridInfoDTO::getGridId, o -> o, (o1, o2) -> o1)); + + //获取客户下所有项目分类 + List categoryList = issueProjectCategoryDictService.getAllByCId(param.getCustomerId()); + + //项目分类数据 todo 暂时查询所有 + List projectCategoryData = projectService.getProjectCategoryData(param.getCustomerId(), null); + //key projectId:categoryCode Set + Map> projectCategoryMap = projectCategoryData.stream() + .collect(Collectors.groupingBy(ProjectCategoryDTO::getProjectId, Collectors.mapping(ProjectCategoryDTO::getCategoryCode, Collectors.toSet()))); + + //获取业务库项目标题 + List bizProjectInfoList = projectService.getProjectInfo(param.getCustomerId(), null, null); + if (CollectionUtils.isEmpty(bizProjectInfoList)) { + log.warn("difficultyDataExtract customerId:{} have any project", param.getCustomerId()); + return false; } - if (!CollectionUtils.isEmpty(latestOperationMap)) { - ProjectLatestOperationResultDTO oper = latestOperationMap.get(diff.getEventId()); - if (null != oper) { - diff.setLatestOperateDesc(oper.getOperationName()); - diff.setEventTitle(oper.getTitle()); - diff.setEventCostTime(oper.getCostTime()); + Map bizProjectInfoMap = bizProjectInfoList.stream().collect(Collectors.toMap(ProjectDTO::getId, o -> o, (o1, o2) -> o1)); + + int pageNo = NumConstant.ONE; + int pageSize = NumConstant.ONE_THOUSAND; + List difficultyBaseList; + do { + //1.根据客户Id 获取所有项目数据 + int offset = (pageNo++ - NumConstant.ONE) * pageSize; + difficultyBaseList = factOriginProjectMainDailyService.getProjectAndPeriodForDiff(param, offset,pageSize); + if (CollectionUtils.isEmpty(difficultyBaseList)) { + log.warn("difficultyDataExtract customerId:{} have any project", param.getCustomerId()); + return false; } - } - - diff.setDataEndTime(DateUtils.getBeforeNDay(NumConstant.ONE)); - }); - List imgList = new LinkedList<>(); - imgMap.values().forEach(imgList::addAll); - - //立案后会有 一个process 如果没有则说明是垃圾数据 如果有其他方式立项的项目则需要考虑下兼容 - difficulties.removeIf(diff -> StringUtils.isBlank(diff.getLatestOperateDesc())); - screenDifficultyDataService.dataClean(param.getCustomerId(), difficulties, imgList); - log.info("【大屏数据抽取-难点赌点执行完毕】 客户Id{} 难点赌点数据{}", param.getCustomerId(), JSON.toJSONString(difficulties)); - difficulties.removeIf( diff -> StringUtils.isBlank(diff.getLatestOperateDesc())); - imgList.forEach(item -> { - item.setCustomerId(param.getCustomerId()); - }); - screenDifficultyDataService.dataClean(param.getCustomerId(),difficulties,imgList); - log.info("【大屏数据抽取-难点赌点执行完毕】 客户Id{} 难点赌点数据{}",param.getCustomerId(),JSON.toJSONString(difficulties)); - } + //2.获取项目的所有节点耗时数据 + List projectPeriodList = difficultyBaseList.stream() + .filter(o->o.getPeriodList() != null) + .flatMap(o->o.getPeriodList().stream()) + .collect(Collectors.toList()); + //处理部门数去重(只要流转到就算) + Map> orgCountMap = new HashMap<>(); + //被处理次数 + Map handleCountMap = new HashMap<>(); + Set valideProjectIdSet = fillAnyCountAndValidProject(param, projectPeriodList, orgCountMap, handleCountMap); + + List diffList = new ArrayList<>(); + List imgDataEntities = new ArrayList<>(); + for (FactOriginProjectMainAndPeriodDTO project : difficultyBaseList) { + if (agencyMap.get(project.getAgencyId()) == null || bizProjectInfoMap.get(project.getId()) == null) { + log.warn("未获取到相关的项目信息或者项目的所属组织信息,agencyId:{},projectId:{}",project.getAgencyId(),project.getId()); + continue; + } + //判断是否符合难点堵点条件 + if (!valideProjectIdSet.contains(project.getId())) { + continue; + } + ScreenDifficultyDataEntity diffEntity = buildBaseDiffEntity(project, agencyMap, gridMap, bizProjectInfoMap); + Set regCount = orgCountMap.get(project.getId()); + if (regCount != null) { + diffEntity.setEventReOrg(regCount.size()); + } else { + diffEntity.setEventReOrg(0); + } + Integer handleOrgCount = handleCountMap.get(project.getId()); + if (handleOrgCount != null) { + diffEntity.setEventHandledCount(handleOrgCount); + } else { + diffEntity.setEventHandledCount(0); + } - @Override - public boolean difficultyDataExtract(ScreenCentralZoneDataFormDTO param) { - //1.根据客户Id 获取所有项目数据 - List difficultyBaseList = factOriginProjectMainDailyService.getProjectForDiff(param); - if (CollectionUtils.isEmpty(difficultyBaseList)) { - log.warn("difficultyDataExtract customerId:{} have any project", param.getCustomerId()); - return false; - } - //获取业务库项目标题 - List bizProjectInfoList = projectService.getProjectInfo(param.getCustomerId(), null, null); - if (CollectionUtils.isEmpty(bizProjectInfoList)) { - log.warn("difficultyDataExtract customerId:{} have any project", param.getCustomerId()); - return false; - } - Map bizProjectInfoMap = bizProjectInfoList.stream().collect(Collectors.toMap(ProjectDTO::getId, o -> o, (o1, o2) -> o1)); - //获取agency维度 - List agencyList = dimAgencyService.getAgencyListByCustomerId(param.getCustomerId()); - Map agencyMap = agencyList.stream().collect(Collectors.toMap(DimAgencyEntity::getId, o -> o, (o1, o2) -> o1)); - //获取grid维度 - List gridList = customerGridService.queryGridInfoList(param.getCustomerId()); - Map gridMap = gridList.stream().collect(Collectors.toMap(GridInfoDTO::getGridId, o -> o, (o1, o2) -> o1)); - - //获取客户下所有项目分类 - List categoryList = issueProjectCategoryDictService.getAllByCId(param.getCustomerId()); - - //项目分类数据 todo 暂时查询所有 - List projectCategoryData = projectService.getProjectCategoryData(param.getCustomerId(), null); - //key projectId:categoryCode Set - Map> projectCategoryMap = projectCategoryData.stream() - .collect(Collectors.groupingBy(ProjectCategoryDTO::getProjectId, Collectors.mapping(ProjectCategoryDTO::getCategoryCode, Collectors.toSet()))); - - //2.获取项目的所有节点耗时数据 - List projectPeriodList = factOriginProjectMainDailyService.getProjectPeriod(param); - //处理部门数去重(只要流转到就算) - Map> orgCountMap = new HashMap<>(); - //被处理次数 - Map handleCountMap = new HashMap<>(); - Set valideProjectIdSet = fillAnyCountAndValidProject(param, projectPeriodList, orgCountMap, handleCountMap); - - List diffList = new ArrayList<>(); - List imgDataEntities = new ArrayList<>(); - for (FactOriginProjectMainDailyEntity project : difficultyBaseList) { - if (agencyMap.get(project.getAgencyId()) == null || bizProjectInfoMap.get(project.getId()) == null) { - log.warn("未获取到相关的项目信息或者项目的所属组织信息,agencyId:{},projectId:{}",project.getAgencyId(),project.getId()); - continue; - } - //判断是否符合难点堵点条件 - if (!valideProjectIdSet.contains(project.getId())) { - continue; - } - ScreenDifficultyDataEntity diffEntity = buildBaseDiffEntity(project, agencyMap, gridMap, bizProjectInfoMap); - Set regCount = orgCountMap.get(project.getId()); - if (regCount != null) { - diffEntity.setEventReOrg(regCount.size()); - } else { - diffEntity.setEventReOrg(0); - } - Integer handleOrgCount = handleCountMap.get(project.getId()); - if (handleOrgCount != null) { - diffEntity.setEventHandledCount(handleOrgCount); - } else { - diffEntity.setEventHandledCount(0); - } + diffEntity.setDataEndTime(StringUtils.isBlank(param.getDateId())?DateUtils.getBeforeNDay(NumConstant.ONE):param.getDateId()); + setCategoryInfo(diffEntity, project.getId(), categoryList, projectCategoryMap); + + + if (StringUtils.isNotBlank(project.getTopicId())) { + //获取图片及话题内容 + ResiTopicAndImgResultDTO topicInfo = topicService.getTopicAndImgs(project.getTopicId(), "image"); + if (topicInfo != null) { + List topicImgList = topicInfo.getTopicImgList(); + if (!CollectionUtils.isEmpty(topicImgList)){ + diffEntity.setEventImgUrl(topicImgList.get(NumConstant.ZERO).getAttachmentUrl()); + topicImgList.forEach(img -> { + ScreenDifficultyImgDataEntity imgData = new ScreenDifficultyImgDataEntity(); + imgData.setEventId(project.getId()); + imgData.setEventImgUrl(img.getAttachmentUrl()); + imgData.setSort(img.getSort()); + imgDataEntities.add(imgData); + imgData.setCustomerId(param.getCustomerId()); + }); + } + diffEntity.setEventContent(topicInfo.getTopicContent()); + + log.info("projectId:{} imgs:{}", project.getId(), imgDataEntities.stream().filter(o -> o.getEventId().equals(project.getId())).count()); + } - diffEntity.setDataEndTime(StringUtils.isBlank(param.getDateId())?DateUtils.getBeforeNDay(NumConstant.ONE):param.getDateId()); - setCategoryInfo(diffEntity, project.getId(), categoryList, projectCategoryMap); - - - if (StringUtils.isNotBlank(project.getTopicId())) { - //获取图片及话题内容 - ResiTopicAndImgResultDTO topicInfo = topicService.getTopicAndImgs(project.getTopicId(), "image"); - if (topicInfo != null) { - List topicImgList = topicInfo.getTopicImgList(); - if (!CollectionUtils.isEmpty(topicImgList)){ - diffEntity.setEventImgUrl(topicImgList.get(NumConstant.ZERO).getAttachmentUrl()); - topicImgList.forEach(img -> { - ScreenDifficultyImgDataEntity imgData = new ScreenDifficultyImgDataEntity(); - imgData.setEventId(project.getId()); - imgData.setEventImgUrl(img.getAttachmentUrl()); - imgData.setSort(img.getSort()); - imgDataEntities.add(imgData); - imgData.setCustomerId(param.getCustomerId()); - }); } - diffEntity.setEventContent(topicInfo.getTopicContent()); - - log.info("projectId:{} imgs:{}", project.getId(), imgDataEntities.stream().filter(o -> o.getEventId().equals(project.getId())).count()); + diffList.add(diffEntity); } - - } - diffList.add(diffEntity); + log.info("========:" + JSON.toJSONString(diffList)); + log.info("========:" + JSON.toJSONString(imgDataEntities)); + screenDifficultyDataService.dataClean(param.getCustomerId(),diffList,imgDataEntities); + log.info("difficultyDataExtract excute pageNo:{}",pageNo); + } while (!CollectionUtils.isEmpty(difficultyBaseList)&&difficultyBaseList.size()==pageSize); + + //3.获取项目的最后操作记录 + return true; + } finally { + log.info("【大屏数据抽取-难点赌点执行完毕】 客户Id{}", param.getCustomerId()); } - List collect = diffList.stream().filter(o -> o.getEventCostTime() < 5 * 24 * 60).collect(Collectors.toList()); - log.info("========:" + JSON.toJSONString(collect)); - log.info("========:" + JSON.toJSONString(diffList)); - log.info("========:" + JSON.toJSONString(imgDataEntities)); - - screenDifficultyDataService.dataClean(param.getCustomerId(),diffList,imgDataEntities); - log.info("【大屏数据抽取-难点赌点执行完毕】 客户Id{} 难点赌点数据{}", param.getCustomerId(), JSON.toJSONString(diffList)); - //3.获取项目的最后操作记录 - return true; } /** @@ -422,7 +355,7 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr * @param bizProjectInfoMap * @return */ - private ScreenDifficultyDataEntity buildBaseDiffEntity(FactOriginProjectMainDailyEntity project, Map agencyMap, + private ScreenDifficultyDataEntity buildBaseDiffEntity(FactOriginProjectMainAndPeriodDTO project, Map agencyMap, Map gridMap, Map bizProjectInfoMap) { ProjectDTO projectDTO = bizProjectInfoMap.get(project.getId()); ScreenDifficultyDataEntity diff = new ScreenDifficultyDataEntity(); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenDifficultyDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenDifficultyDataService.java index 235dfe856a..99a01fd41c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenDifficultyDataService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenDifficultyDataService.java @@ -34,7 +34,7 @@ public interface ScreenDifficultyDataService extends BaseService difficulties, List imgs); - - /** - * @Description 根据客户Id查出全部的难点赌点的项目Id和网格Id,因为需要比对全部的信息然后删除因为删除网格而导致的垃圾数据 - * @param customerId - * @return java.util.List - * @author wangc - * @date 2020.11.17 09:31 - */ - List getAllDifficultyByCustomerId(String customerId); -} \ No newline at end of file +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenDifficultyDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenDifficultyDataServiceImpl.java index f8f1d50d8b..da173709af 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenDifficultyDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenDifficultyDataServiceImpl.java @@ -21,7 +21,6 @@ package com.epmet.service.evaluationindex.screen.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; -import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.evaluationindex.screen.ScreenDifficultyDataDao; import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity; @@ -56,30 +55,15 @@ public class ScreenDifficultyDataServiceImpl extends BaseServiceImpl difficulties, List imgs) { - List orient = baseDao.selectAllDifficultyByCustomerId(customerId); - if(!CollectionUtils.isEmpty(orient)){ - baseDao.deleteBatchDifficultyImg(orient.stream().map(ScreenDifficultyDataEntity::getEventId).distinct().collect(Collectors.toList())); - } - baseDao.deleteBatchDifficulty(customerId,null); - + List projectId = difficulties.stream().map(ScreenDifficultyDataEntity::getEventId).distinct().collect(Collectors.toList()); + baseDao.deleteBatchDifficultyImg(projectId); + baseDao.deleteBatchDifficulty(customerId,projectId); if (!CollectionUtils.isEmpty(difficulties)) { baseDao.insertBatch(difficulties); } if (!CollectionUtils.isEmpty(imgs)) { baseDao.insertBatchImg(imgs); } - //baseDao.updateTime(customerId, DateUtils.getBeforeNDay(NumConstant.ONE)); } - /** - * @Description 根据客户Id查出全部的难点赌点的项目Id和网格Id,因为需要比对全部的信息然后删除因为删除网格而导致的垃圾数据 - * @param customerId - * @return java.util.List - * @author wangc - * @date 2020.11.17 09:31 - */ - @Override - public List getAllDifficultyByCustomerId(String customerId) { - return baseDao.selectAllDifficultyByCustomerId(customerId); - } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml index d35a30cb00..a6ba0e7a8b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml @@ -3,32 +3,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - SELECT - id, date_id, customer_id, issue_id, topic_id, grid_id, pid, pids, agency_id, project_status, is_resolved, - topic_creator_id, is_party, is_overdue, finish_org_ids - FROM fact_origin_project_main_daily + m.id, m.date_id dateId, m.customer_id, m.issue_id, m.topic_id, m.grid_id, + m.pid, m.pids, m.agency_id, m.project_status, m.is_resolved, + m.topic_creator_id, m.is_party, m.is_overdue, m.finish_org_ids + + , IFNULL(b.DATE_ID, DATE_FORMAT( now(), '%Y%m%d' )) as updateDate + + FROM fact_origin_project_main_daily m + + LEFT JOIN fact_origin_project_log_daily b ON m.ID = b.PROJECT_ID AND b.ACTION_CODE = 'close' + WHERE - CUSTOMER_ID = #{customerId} - - AND DATE_ID = #{dateId,jdbcType=VARCHAR} + m.CUSTOMER_ID = #{param.customerId} + AND m.DEL_FLAG = '0' + + HAVING updateDate>= #{param.internalDay} + LIMIT #{offset} ,#{pageSize} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenDifficultyDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenDifficultyDataDao.xml index 9860bee6f3..8cae5260d0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenDifficultyDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenDifficultyDataDao.xml @@ -221,14 +221,4 @@ - diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddSocietyOrgFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddSocietyOrgFormDTO.java index a1a12c71e6..1217c647c5 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddSocietyOrgFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddSocietyOrgFormDTO.java @@ -17,11 +17,13 @@ package com.epmet.dto.form; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import org.hibernate.validator.constraints.Length; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import java.io.Serializable; import java.util.Date; @@ -73,11 +75,13 @@ public class AddSocietyOrgFormDTO implements Serializable { /** * 起始服务时间 */ + @NotNull(message = "起始服务时间不能为空", groups = { AddSocietyOrgFormDTO.Add.class }) @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date serviceStartTime; /** * 终止服务时间 */ + @NotNull(message = "终止服务时间不能为空", groups = { AddSocietyOrgFormDTO.Add.class }) @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date serviceEndTime; /** @@ -100,6 +104,6 @@ public class AddSocietyOrgFormDTO implements Serializable { //token中userId private String staffId; - public interface Add {} + public interface Add extends CustomerClientShowGroup {} } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java index d9019b6c5b..5dc6a27d04 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java @@ -17,11 +17,16 @@ package com.epmet.controller; +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +import cn.hutool.poi.excel.ExcelUtil; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; @@ -36,7 +41,9 @@ import com.epmet.dto.result.CommunitySelfOrganizationListResultDTO; import com.epmet.dto.result.demand.OptionDTO; import com.epmet.excel.ExportCommunitySelfOrganizationExcel; import com.epmet.excel.IcCommunitySelfOrganizationExcel; +import com.epmet.excel.ImportCommunitySelfOrganizationSon; import com.epmet.service.IcCommunitySelfOrganizationService; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.io.FilenameUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -113,7 +120,13 @@ public class IcCommunitySelfOrganizationController { @PostMapping("exportcommunityselforganization") public void exportCommunitySelfOrganization(HttpServletResponse response,@LoginUser TokenDto tokenDto,@RequestBody CommunitySelfOrganizationListFormDTO formDTO) throws Exception { CommunitySelfOrganizationListResultDTO resultDTO = icCommunitySelfOrganizationService.communitySelfOrganizationList(tokenDto, formDTO); - ExcelUtils.exportExcelToTarget(response, null, resultDTO.getList(), ExportCommunitySelfOrganizationExcel.class); + List r = ConvertUtils.sourceToTarget(resultDTO.getList(), ExportCommunitySelfOrganizationExcel.class); + r.forEach(c -> { + if (CollectionUtils.isNotEmpty(c.getOrganizationPersonnel())){ + c.setOrganizationPersonnel(ConvertUtils.sourceToTarget(c.getOrganizationPersonnel(), ImportCommunitySelfOrganizationSon.class)); + } + }); + ExcelUtils.exportExcelToTarget(response, null, r, ExportCommunitySelfOrganizationExcel.class); } /** diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ExportCommunitySelfOrganizationExcel.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ExportCommunitySelfOrganizationExcel.java index d8020a3345..1822610552 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ExportCommunitySelfOrganizationExcel.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ExportCommunitySelfOrganizationExcel.java @@ -1,31 +1,37 @@ package com.epmet.excel; -import cn.afterturn.easypoi.excel.annotation.CellStyler; import cn.afterturn.easypoi.excel.annotation.Excel; +import cn.afterturn.easypoi.excel.annotation.ExcelCollection; +import com.epmet.dto.IcCommunitySelfOrganizationPersonnelDTO; import lombok.Data; +import java.util.List; + @Data public class ExportCommunitySelfOrganizationExcel { - @Excel(name = "排序") - private Integer sort; +// @Excel(name = "排序") +// private Integer sort; - @Excel(name = "组织名称", width = 40) + @Excel(name = "组织名称", width = 40, needMerge = true) private String organizationName; - @Excel(name = "组织人数", width = 20) + @Excel(name = "组织人数", width = 20, needMerge = true) private Integer organizationPersonCount; - @Excel(name = "负责人姓名", width = 20) + @Excel(name = "负责人", width = 20, needMerge = true) private String principalName; - @Excel(name = "负责人电话", width = 20) + @Excel(name = "联系电话", width = 20, needMerge = true) private String principalPhone; - @Excel(name = "服务事项", width = 60) + @Excel(name = "服务事项", width = 60, needMerge = true) private String serviceItem; - @Excel(name = "社区自组织创建时间", width = 20) + @Excel(name = "创建时间", width = 20, needMerge = true) private String organizationCreatedTime; + @ExcelCollection(name = "组织成员") + private List organizationPersonnel; + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ImportCommunitySelfOrganizationSon.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ImportCommunitySelfOrganizationSon.java index 7fb44af70e..89fb1fc458 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ImportCommunitySelfOrganizationSon.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ImportCommunitySelfOrganizationSon.java @@ -14,7 +14,7 @@ public class ImportCommunitySelfOrganizationSon { @Excel(name = "姓名") private String personName; - @Excel(name = "电话") + @Excel(name = "电话", width = 20) private String personPhone; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyListResultDTO.java index 499219f9eb..52f09a0a48 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyListResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyListResultDTO.java @@ -58,5 +58,6 @@ public class AgencyListResultDTO implements Serializable { * 联系电话 */ private String mobile = ""; - + private String areaCode; + private String parentAreaCode; } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentListResultDTO.java index 8e3b3ce418..9b2cf82cc3 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentListResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentListResultDTO.java @@ -58,4 +58,5 @@ public class DepartmentListResultDTO implements Serializable { * 联系电话 */ private String mobile = ""; + private String areaCode; } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridBaseInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridBaseInfoResultDTO.java index 4bc56543a1..62a52464dc 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridBaseInfoResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridBaseInfoResultDTO.java @@ -49,4 +49,5 @@ public class GridBaseInfoResultDTO implements Serializable { * 联系电话 */ private String mobile = ""; + private String areaCode; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java index b1087949c0..fafb2d474d 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java @@ -305,8 +305,6 @@ public interface CustomerAgencyDao extends BaseDao { **/ OrgMobileResultDTO getAgencyMobile(@Param("gridId") String gridId); - int updateSubAgencyAreaCode(@Param("customerId") String customerId, @Param("originalParentAreaCode")String originalParentAreaCode,@Param("operateUserId") String operateUserId); - int updateSubAgencyAreaCodeById(@Param("customerId")String customerId, @Param("agencyId")String agencyId, @Param("operateUserId") String operateUserId); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java index 802b67efd3..4d3d2668e8 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java @@ -105,8 +105,4 @@ public interface CustomerDepartmentDao extends BaseDao int updateSubDeptAreaCode(@Param("customerId") String customerId, @Param("areaCode")String areaCode, @Param("operateUserId") String operateUserId); - - int updateDeptAreaCode(@Param("agencyId")String agencyId, - @Param("areaCode")String areaCode, - @Param("operateUserId") String operateUserId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java index f8772354e0..7ae8f23367 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java @@ -356,5 +356,4 @@ public interface CustomerGridDao extends BaseDao { @Param("agencyId")String agencyId, @Param("operateUserId") String operateUserId); - int updateGridAreaCode(@Param("agencyId")String agencyId, @Param("areaCode")String areaCode,@Param("operateUserId") String operateUserId); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java index cd345bdcbe..ac4e5a87ae 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java @@ -19,6 +19,7 @@ package com.epmet.service.impl; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; @@ -42,6 +43,7 @@ import com.epmet.dto.GovStaffRoleDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.CustomerAgencyEntity; +import com.epmet.entity.CustomerDepartmentEntity; import com.epmet.entity.CustomerGridEntity; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.feign.EpmetMessageOpenFeignClient; @@ -62,6 +64,7 @@ import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; +import java.util.Date; import java.util.List; /** @@ -155,57 +158,28 @@ public class AgencyServiceImpl implements AgencyService { originalEntity.setCode(formDTO.getCode()); originalEntity.setContacts(formDTO.getContacts()); originalEntity.setMobile(formDTO.getMobile()); - if (StringUtils.isNotBlank(originalEntity.getAreaCode()) - && originalEntity.getAreaCode().contains("UD") - && StringUtils.isNotBlank(formDTO.getAreaCode()) - && "other".equals(formDTO.getAreaCode())) { - throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "自定义编码不允许修改", "自定义组织区划代码不允许修改"); - } - if (StringUtils.isNotBlank(formDTO.getAreaCode()) && !formDTO.getAreaCode().equals(originalEntity.getAreaCode())) { - CustomerAgencyEntity parent = customerAgencyDao.selectById(originalEntity.getPid()); - //如果修改了areaCode。 - if(StringUtils.isNotBlank(originalEntity.getAreaCode())){ - //如果原来这个组织有area_code再去更新,没有其实应该按照pids去更新。 - // customerAgencyDao.updateSubAgencyAreaCode(originalEntity.getCustomerId(), originalEntity.getAreaCode(), formDTO.getUserId()); - customerAgencyDao.updateSubAgencyAreaCodeById(originalEntity.getCustomerId(), originalEntity.getId(), formDTO.getUserId()); - //网格的 - customerGridDao.updateSubGridAreaCode(originalEntity.getCustomerId(), originalEntity.getId(), formDTO.getUserId()); - //部门的 - customerDepartmentDao.updateSubDeptAreaCode(originalEntity.getCustomerId(), originalEntity.getAreaCode(), formDTO.getUserId()); - } - //判断areaCodeSwitch:open: 选择地区编码必填;closed: 无需选择地区编码 - if (CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN.equals(formDTO.getAreaCodeSwitch())) { - //校验areaCode是否被使用过 - if (!"other".equals(formDTO.getAreaCode())) { - List agencyIds = customerAgencyDao.selectAgencyIdsByAreaCode(formDTO.getAreaCode(),formDTO.getAgencyId()); - if (CollectionUtils.isNotEmpty(agencyIds)) { - //已经被占用,提示 - throw new RenException(EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getCode(), EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getMsg()); - } - originalEntity.setAreaCode(formDTO.getAreaCode()); - originalEntity.setParentAreaCode(parent.getAreaCode()); - }else{ - //如果选择的是other,需要自定义一个编码 - AddAreaCodeFormDTO addAreaCodeFormDTO = new AddAreaCodeFormDTO(); - addAreaCodeFormDTO.setCurrentAreaLevel(formDTO.getLevel()); - addAreaCodeFormDTO.setParentAreaCode(parent.getAreaCode()); - addAreaCodeFormDTO.setName(formDTO.getAgencyName()); - Result addAreaCodeResult = epmetCommonServiceOpenFeignClient.addAreaCode(addAreaCodeFormDTO); - if (!addAreaCodeResult.success() || StringUtils.isBlank(addAreaCodeResult.getData())) { - if (addAreaCodeResult.getCode() > 8000) { - throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "自定义area_code异常" + addAreaCodeResult.getMsg()); - } else { - throw new RenException("自定义area_code异常" + addAreaCodeResult.getInternalMsg()); - } - } - originalEntity.setAreaCode(addAreaCodeResult.getData()); + //当前客户开启了area_code_switch参数:open: 选择地区编码必填;closed: 无需选择地区编码 + if (CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN.equals(formDTO.getAreaCodeSwitch())) { + CustomerAgencyEntity parent = customerAgencyDao.selectById(originalEntity.getPid()); + if (null != parent) { + //开关开启后,areaCode必填 + String originalAreaCode = originalEntity.getAreaCode(); + checkEditAgencyFormDTO(formDTO, originalEntity); + // 1、之前当前组织没有编码,本次修改设置了编码 + // 2、之前已经有编码,本次修改为了其他编码 + if (StringUtils.isNotBlank(formDTO.getAreaCode()) && !formDTO.getAreaCode().equals(originalAreaCode)) { + String newAreaCode = getAgencyNewAreaCode(formDTO, parent); + originalEntity.setAreaCode(newAreaCode); originalEntity.setParentAreaCode(parent.getAreaCode()); + formDTO.setAreaCode(newAreaCode); + } + //什么时候要全部置为空呢?原来没有现在有 || 原来与现在不一致 + if ((StringUtils.isBlank(originalAreaCode) && StringUtils.isNotBlank(formDTO.getAreaCode())) + || (!formDTO.getAreaCode().equals(originalAreaCode))) { + updateSubOrg(originalEntity.getCustomerId(), formDTO, originalAreaCode); } } - //更新直属部门和直属网格的areaCode - customerGridDao.updateGridAreaCode(originalEntity.getId(),formDTO.getAreaCode(),formDTO.getUserId()); - customerDepartmentDao.updateDeptAreaCode(originalEntity.getId(),formDTO.getAreaCode(),formDTO.getUserId()); } //1:更新当前组织信息 @@ -252,6 +226,107 @@ public class AgencyServiceImpl implements AgencyService { return result; } + /** + * 所有下家组织、网格、部门的area_code,parent_area_code置为空 + * 直属组织parent_area_code、直属网格+直属部门的area_code更新为最新值 + * @param customerId + * @param formDTO + * @param originalAreaCode + */ + private void updateSubOrg(String customerId, EditAgencyFormDTO formDTO,String originalAreaCode) { + //如果原来这个组织有area_code再去更新,没有其实应该按照pids去更新。 + customerAgencyDao.updateSubAgencyAreaCodeById(customerId, formDTO.getAgencyId(), formDTO.getUserId()); + //网格的 + customerGridDao.updateSubGridAreaCode(customerId, formDTO.getAgencyId(), formDTO.getUserId()); + //部门的 + customerDepartmentDao.updateSubDeptAreaCode(customerId, originalAreaCode, formDTO.getUserId()); + + //1、更新直属网格的areaCode + LambdaUpdateWrapper updateGridWrapper = new LambdaUpdateWrapper<>(); + updateGridWrapper.eq(CustomerGridEntity::getPid,formDTO.getAgencyId()) + .set(CustomerGridEntity::getAreaCode, formDTO.getAreaCode()) + .set(CustomerGridEntity::getUpdatedBy,formDTO.getUserId()) + .set(CustomerGridEntity::getUpdatedTime,new Date()); + int subGridRows=customerGridDao.update(null,updateGridWrapper); + log.info(String.format("更新了%s个直属网格的area_code",subGridRows)); + + // 2、更新直属部门的area_code + LambdaUpdateWrapper updateDeptWrapper = new LambdaUpdateWrapper<>(); + updateDeptWrapper.eq(CustomerDepartmentEntity::getAgencyId,formDTO.getAgencyId()) + .set(CustomerDepartmentEntity::getAreaCode, formDTO.getAreaCode()) + .set(CustomerDepartmentEntity::getUpdatedBy,formDTO.getUserId()) + .set(CustomerDepartmentEntity::getUpdatedTime,new Date()); + int gridRows=customerDepartmentDao.update(null,updateDeptWrapper); + log.info(String.format("更新了%s个直属部门的area_code",gridRows)); + + // 3、更新下级组织的parent_area_code + LambdaUpdateWrapper updateAgencyWrapper = new LambdaUpdateWrapper<>(); + updateAgencyWrapper.eq(CustomerAgencyEntity::getPid,formDTO.getAgencyId()) + .set(CustomerAgencyEntity::getParentAreaCode, formDTO.getAreaCode()) + .set(CustomerAgencyEntity::getUpdatedBy,formDTO.getUserId()) + .set(CustomerAgencyEntity::getUpdatedTime,new Date()); + Integer rows = customerAgencyDao.update(null, updateAgencyWrapper); + log.info(String.format("更新了%s个下级组织的parent_area_code",rows)); + } + + /** + * + * @param formDTO 编辑组织入参 + * @param parent 当前编辑组织的上级组织 + * @return 返回组织区划编码 + */ + private String getAgencyNewAreaCode(EditAgencyFormDTO formDTO, CustomerAgencyEntity parent) { + String newAreaCode=""; + if (!"other".equals(formDTO.getAreaCode())) { + //校验除了当前组织外,areaCode是否被使用过 + List agencyIds = customerAgencyDao.selectAgencyIdsByAreaCode(formDTO.getAreaCode(), formDTO.getAgencyId()); + if (CollectionUtils.isNotEmpty(agencyIds)) { + //已经被占用,提示 + throw new RenException(EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getCode(), EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getMsg()); + } + newAreaCode=formDTO.getAreaCode(); + } else { + //如果选择的是other,需要自定义一个编码 + AddAreaCodeFormDTO addAreaCodeFormDTO = new AddAreaCodeFormDTO(); + addAreaCodeFormDTO.setCurrentAreaLevel(formDTO.getLevel()); + addAreaCodeFormDTO.setParentAreaCode(parent.getAreaCode()); + addAreaCodeFormDTO.setName(formDTO.getAgencyName()); + Result addAreaCodeResult = epmetCommonServiceOpenFeignClient.addAreaCode(addAreaCodeFormDTO); + if (!addAreaCodeResult.success() || StringUtils.isBlank(addAreaCodeResult.getData())) { + if (addAreaCodeResult.getCode() > 8000) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "自定义area_code异常" + addAreaCodeResult.getInternalMsg(), addAreaCodeResult.getMsg()); + } else { + throw new RenException("自定义area_code异常" + addAreaCodeResult.getInternalMsg()); + } + } + newAreaCode=addAreaCodeResult.getData(); + } + return newAreaCode; + } + + /** + * 如果当前客户开启了areaCode,校验参数逼单 + * @param formDTO + */ + private void checkEditAgencyFormDTO(EditAgencyFormDTO formDTO,CustomerAgencyEntity originalEntity) { + //根组织不允许修改 + if (StringUtils.isNotBlank(originalEntity.getPid()) && !NumConstant.ZERO_STR.equals(originalEntity.getPid())) { + if (StringUtils.isBlank(formDTO.getAreaCode())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "area_code_switch is open areaCode不能为空", "组织区划不能为空"); + } + if (StringUtils.isBlank(formDTO.getParentAreaCode())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "area_code_switch is open parentAreaCode不能为空", "请先设置上级组织的组织区划"); + } + //如果当前组织已经使用了自定义编码,不允许在选择其他。 + if (StringUtils.isNotBlank(originalEntity.getAreaCode()) + && originalEntity.getAreaCode().contains("UD") + && StringUtils.isNotBlank(formDTO.getAreaCode()) + && "other".equals(formDTO.getAreaCode())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "自定义编码不允许修改", "自定义组织区划代码不允许修改"); + } + } + } + /** * @param formDTO * @return @@ -314,27 +389,6 @@ public class AgencyServiceImpl implements AgencyService { agencysResultDTO.setCode(entity.getCode()); agencysResultDTO.setContacts(entity.getContacts()); agencysResultDTO.setMobile(entity.getMobile()); - //2021.5.26 sun 添加当前组织对应客户的根组织级别返参 start - if (null != entity) { - if (null == entity.getPids() || "".equals(entity.getPids())) { - agencysResultDTO.setRootlevel(entity.getLevel()); - } else { - String id = Arrays.asList(entity.getPids().split(":")).get(0); - CustomerAgencyEntity rootEntity = customerAgencyDao.selectById(id); - if (null != rootEntity) { - agencysResultDTO.setRootlevel(rootEntity.getLevel()); - } - } - } - //2021.5.26 sun 添加当前组织对应客户的根组织级别返参 end - //2:查询本机关的所有上级机关,按自上而下层级顺序 - if (null == entity.getPids()) { - agencysResultDTO.setParentList(parentList); - return new Result().ok(agencysResultDTO); - } - List listStr = Arrays.asList(entity.getPids().split(":")); - parentList = customerAgencyDao.selectPAgencyById(listStr); - agencysResultDTO.setParentList(parentList); agencysResultDTO.setAreaCodeSwitch(customerOrgParameterService.getAreaCodeSwitch(entity.getCustomerId())); agencysResultDTO.setAreaName(StrConstant.EPMETY_STR); agencysResultDTO.setAreaCode(StringUtils.isNotBlank(entity.getAreaCode())?entity.getAreaCode():StrConstant.EPMETY_STR); @@ -360,13 +414,30 @@ public class AgencyServiceImpl implements AgencyService { agencysResultDTO.setAreaName(StrConstant.EPMETY_STR); } } + //2021.5.26 sun 添加当前组织对应客户的根组织级别返参 start + if (null != entity) { + if (null == entity.getPids() || "".equals(entity.getPids())) { + agencysResultDTO.setRootlevel(entity.getLevel()); + } else { + String id = Arrays.asList(entity.getPids().split(":")).get(0); + CustomerAgencyEntity rootEntity = customerAgencyDao.selectById(id); + if (null != rootEntity) { + agencysResultDTO.setRootlevel(rootEntity.getLevel()); + } + } + } + //2021.5.26 sun 添加当前组织对应客户的根组织级别返参 end + //2:查询本机关的所有上级机关,按自上而下层级顺序 + if (StringUtils.isBlank(entity.getPids())) { + agencysResultDTO.setParentList(parentList); + return new Result().ok(agencysResultDTO); + } + List listStr = Arrays.asList(entity.getPids().split(":")); + parentList = customerAgencyDao.selectPAgencyById(listStr); + agencysResultDTO.setParentList(parentList); return new Result().ok(agencysResultDTO); } - public static void main(String[] args) { - String m="1234"; - System.out.println(m.equals("1234") ? "yes" : "no"); - } /** * @param formDTO * @return @@ -546,7 +617,11 @@ public class AgencyServiceImpl implements AgencyService { addAreaCodeFormDTO.setName(formDTO.getAgencyName()); Result addAreaCodeResult = epmetCommonServiceOpenFeignClient.addAreaCode(addAreaCodeFormDTO); if (!addAreaCodeResult.success() || StringUtils.isBlank(addAreaCodeResult.getData())) { - throw new RenException("自定义area_code异常" + addAreaCodeResult.getInternalMsg()); + if (addAreaCodeResult.getCode() > 8000) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "自定义area_code异常" + addAreaCodeResult.getInternalMsg(), addAreaCodeResult.getMsg()); + } else { + throw new RenException("自定义area_code异常" + addAreaCodeResult.getInternalMsg()); + } } insertEntity.setAreaCode(addAreaCodeResult.getData()); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml index 1b5e5c9d89..2cd7210dc5 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml @@ -131,7 +131,9 @@ total_user AS 'totalUser', IFNULL(code,'')AS 'code', IFNULL(contacts,'')AS 'contacts', - IFNULL(mobile,'')AS 'mobile' + IFNULL(mobile,'')AS 'mobile', + IFNULL(AREA_CODE,'') AS areaCode, + IFNULL(PARENT_AREA_CODE,'') parentAreaCode FROM customer_agency WHERE del_flag = '0' AND pid = #{pId} @@ -731,18 +733,6 @@ AND cg.id = #{gridId} - - UPDATE customer_agency - SET AREA_CODE = '', - PARENT_AREA_CODE = '', - UPDATED_BY=#{operateUserId}, - UPDATED_TIME = NOW() - WHERE - DEL_FLAG = '0' - AND CUSTOMER_ID = #{customerId} - AND PARENT_AREA_CODE LIKE concat( #{originalParentAreaCode}, '%' ) - - UPDATE customer_agency SET AREA_CODE = '', diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml index 6eef0b4cc2..3e1e4f50c2 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml @@ -26,7 +26,8 @@ total_user AS 'totalUser', IFNULL(code,'')AS 'code', IFNULL(contacts,'')AS 'contacts', - IFNULL(mobile,'')AS 'mobile' + IFNULL(mobile,'')AS 'mobile', + IFNULL(AREA_CODE,'')AS areaCode FROM customer_department WHERE del_flag = '0' AND agency_id = #{agencyId} @@ -97,12 +98,4 @@ AND AREA_CODE LIKE concat(#{areaCode}, '%' ) - - update customer_department - SET AREA_CODE = #{areaCode}, - UPDATED_BY=#{operateUserId}, - UPDATED_TIME = NOW() - where del_flag='0' - and agency_id=#{agencyId} - \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml index c809cc8bfe..701573e942 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml @@ -291,7 +291,8 @@ IFNULL(code,'')AS 'code', IFNULL(grid_type,'')AS 'gridType', IFNULL(contacts,'')AS 'contacts', - IFNULL(mobile,'')AS 'mobile' + IFNULL(mobile,'')AS 'mobile', + IFNULL(AREA_CODE,'') as areaCode FROM CUSTOMER_GRID @@ -764,12 +765,4 @@ AND pids LIKE concat('%',#{agencyId}, '%' ) - - update customer_grid - SET AREA_CODE = #{areaCode}, - UPDATED_BY=#{operateUserId}, - UPDATED_TIME = NOW() - where del_flag='0' - and pid=#{agencyId} -