Browse Source

Merge remote-tracking branch 'remotes/origin/dev' into dev_shibei_match

dev_shibei_match
jianjun 4 years ago
parent
commit
6cd21244d6
  1. 10
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenCentralZoneDataFormDTO.java
  2. 4
      epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml
  3. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  4. 17
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java
  5. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenDifficultyDataDao.java
  6. 156
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectMainAndPeriodDTO.java
  7. 48
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/impl/BizDataStatsServiceImpl.java
  8. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java
  9. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java
  10. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenGrassrootsGovernDataAbsorptionService.java
  11. 285
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java
  12. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenDifficultyDataService.java
  13. 22
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenDifficultyDataServiceImpl.java
  14. 76
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml
  15. 10
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenDifficultyDataDao.xml
  16. 6
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddSocietyOrgFormDTO.java
  17. 15
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java
  18. 24
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ExportCommunitySelfOrganizationExcel.java
  19. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ImportCommunitySelfOrganizationSon.java
  20. 3
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyListResultDTO.java
  21. 1
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentListResultDTO.java
  22. 1
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridBaseInfoResultDTO.java
  23. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
  24. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java
  25. 1
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java
  26. 221
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
  27. 16
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  28. 11
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml
  29. 11
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml

10
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;
}

4
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

5
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));

17
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<FactOriginProject
/**
* desc: 获取难点堵点项目数据
*
* @param customerId
* @param dateId
* @return java.util.List<com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity>
* @param param
* @param param
* @return java.util.List<com.epmet.entity.evaluationindex.extract.FactOriginProjectMainAndPeriodDTO>
* @author LiuJanJun
* @date 2021/4/12 1:35 下午
*/
List<FactOriginProjectMainDailyEntity> getProjectForDiff(@Param("customerId") String customerId, @Param("dateId") String dateId);
List<FactOriginProjectMainAndPeriodDTO> getProjectForDiff(@Param("param") ScreenCentralZoneDataFormDTO param, @Param("offset") int offset, @Param("pageSize") int pageSize);
/**
* desc: 获取难点堵点项目数据耗时
@ -420,7 +418,7 @@ public interface FactOriginProjectMainDailyDao extends BaseDao<FactOriginProject
* @author LiuJanJun
* @date 2021/4/12 1:35 下午
*/
List<FactOriginProjectOrgPeriodDailyEntity> getProjectPeriodForDiff(@Param("customerId") String customerId, @Param("dateId") String dateId);
List<FactOriginProjectOrgPeriodDailyEntity> getProjectPeriodForDiff(@Param("customerId") String customerId, @Param("projectId") String projectId);
List<ScreenProjectDataDTO> selectResponseCount(@Param("customerId") String customerId);
@ -551,4 +549,5 @@ public interface FactOriginProjectMainDailyDao extends BaseDao<FactOriginProject
* @date 2021/7/5 14:49
*/
List<OrgStatisticsResultDTO> getMemberProjectCount(@Param("customerId") String customerId, @Param("dateId") String dateId);
}

11
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<ScreenDifficultyDataEnt
**/
void batchInsertDifficultyData(@Param("list") List<DifficultyDataDetailFormDTO> list, @Param("customerId")String customerId);
/**
* @Description 根据customerId查询是否有难点赌点的数据
* @param customerId
@ -92,12 +91,4 @@ public interface ScreenDifficultyDataDao extends BaseDao<ScreenDifficultyDataEnt
int insertBatchImg(@Param("list") List<ScreenDifficultyImgDataEntity> list);
/**
* @Description 根据客户Id查出全部的难点赌点的项目Id和网格Id因为需要比对全部的信息然后删除因为删除网格而导致的垃圾数据
* @param customerId
* @return java.util.List<com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity>
* @author wangc
* @date 2020.11.17 09:33
*/
List<ScreenDifficultyDataEntity> selectAllDifficultyByCustomerId(@Param("customerId")String customerId);
}

156
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<FactOriginProjectOrgPeriodDailyEntity> periodList;
}

48
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<String> 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<CustomerGridStaffDTO> 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<CustomerGridStaffDTO> 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<CustomerGridStaffDTO> allGridMembers) {
log.info("initStaffPatrolTodayData param:{}",JSON.toJSONString(formDTO));
log.info("initStaffPatrolTodayData param:{}", JSON.toJSONString(formDTO));
List<StatsStaffPatrolRecordDailyDTO> 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<String> 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);
}
});
}
}
}

9
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<FactOrigi
* desc: 条件获取项目数据
*
* @param param
* @param offset
* @param pageSize
* @return java.util.List<com.epmet.dto.extract.FactOriginProjectMainDailyEntity>
* @author LiuJanJun
* @date 2021/4/12 11:07 上午
*/
List<FactOriginProjectMainDailyEntity> getProjectForDiff(ScreenCentralZoneDataFormDTO param);
List<FactOriginProjectMainAndPeriodDTO> getProjectAndPeriodForDiff(ScreenCentralZoneDataFormDTO param, int offset, int pageSize);
/**
* desc: 根据项目数据 获取相关连的项目耗时

9
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<FactO
}
@Override
public List<FactOriginProjectMainDailyEntity> getProjectForDiff(ScreenCentralZoneDataFormDTO param) {
return baseDao.getProjectForDiff(param.getCustomerId(),param.getDateId());
public List<FactOriginProjectMainAndPeriodDTO> getProjectAndPeriodForDiff(ScreenCentralZoneDataFormDTO param, int offset, int pageSize) {
return baseDao.getProjectForDiff(param,offset,pageSize);
}
@Override

9
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: 新的难点堵点抽取
*

285
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<ScreenDifficultyDataEntity> difficulties = factOriginProjectMainDailyService.getDifficultyBaseInfo(param.getCustomerId(), projectService.getOvertimeProjectByParameter(param.getCustomerId()));
if (CollectionUtils.isEmpty(difficulties)) {
return;
}
//2.查询出客户下网格的相关信息
List<GridInfoDTO> gridList = customerGridService.queryGridInfoList(param.getCustomerId());
Map<String, GridInfoDTO> gridMap = gridList.stream().collect(Collectors.toMap(GridInfoDTO::getGridId, a -> a, (o, n) -> o));
//剔除垃圾数据(本次需要更新的数据集)
//for(Iterator<ScreenDifficultyDataEntity> 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<String> projectIds = difficulties.stream().map(ScreenDifficultyDataEntity::getEventId).distinct().collect(Collectors.toList());
//最近一次操作
Map<String, ProjectLatestOperationResultDTO> latestOperationMap = projectProcessService.getLatestOperation(projectIds, param.getCustomerId());
//图片
List<ProjectSourceMapFormDTO> 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<String, List<ScreenDifficultyImgDataEntity>> imgMap = topicService.getTopicImgs(projectSourceMap);
Map<String, String> contentMap = topicService.getTopicContent(projectSourceMap);
difficulties.forEach(diff -> {
List<ScreenDifficultyImgDataEntity> 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<DimAgencyEntity> agencyList = dimAgencyService.getAgencyListByCustomerId(param.getCustomerId());
Map<String, DimAgencyEntity> agencyMap = agencyList.stream().collect(Collectors.toMap(DimAgencyEntity::getId, o -> o, (o1, o2) -> o1));
//获取grid维度
List<GridInfoDTO> gridList = customerGridService.queryGridInfoList(param.getCustomerId());
Map<String, GridInfoDTO> gridMap = gridList.stream().collect(Collectors.toMap(GridInfoDTO::getGridId, o -> o, (o1, o2) -> o1));
//获取客户下所有项目分类
List<IssueProjectCategoryDictEntity> categoryList = issueProjectCategoryDictService.getAllByCId(param.getCustomerId());
//项目分类数据 todo 暂时查询所有
List<ProjectCategoryDTO> projectCategoryData = projectService.getProjectCategoryData(param.getCustomerId(), null);
//key projectId:categoryCode Set
Map<String, Set<String>> projectCategoryMap = projectCategoryData.stream()
.collect(Collectors.groupingBy(ProjectCategoryDTO::getProjectId, Collectors.mapping(ProjectCategoryDTO::getCategoryCode, Collectors.toSet())));
//获取业务库项目标题
List<ProjectDTO> 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<String, ProjectDTO> bizProjectInfoMap = bizProjectInfoList.stream().collect(Collectors.toMap(ProjectDTO::getId, o -> o, (o1, o2) -> o1));
int pageNo = NumConstant.ONE;
int pageSize = NumConstant.ONE_THOUSAND;
List<FactOriginProjectMainAndPeriodDTO> 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<ScreenDifficultyImgDataEntity> 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<FactOriginProjectOrgPeriodDailyEntity> projectPeriodList = difficultyBaseList.stream()
.filter(o->o.getPeriodList() != null)
.flatMap(o->o.getPeriodList().stream())
.collect(Collectors.toList());
//处理部门数去重(只要流转到就算)
Map<String, Set<String>> orgCountMap = new HashMap<>();
//被处理次数
Map<String, Integer> handleCountMap = new HashMap<>();
Set<String> valideProjectIdSet = fillAnyCountAndValidProject(param, projectPeriodList, orgCountMap, handleCountMap);
List<ScreenDifficultyDataEntity> diffList = new ArrayList<>();
List<ScreenDifficultyImgDataEntity> 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<String> 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<FactOriginProjectMainDailyEntity> difficultyBaseList = factOriginProjectMainDailyService.getProjectForDiff(param);
if (CollectionUtils.isEmpty(difficultyBaseList)) {
log.warn("difficultyDataExtract customerId:{} have any project", param.getCustomerId());
return false;
}
//获取业务库项目标题
List<ProjectDTO> bizProjectInfoList = projectService.getProjectInfo(param.getCustomerId(), null, null);
if (CollectionUtils.isEmpty(bizProjectInfoList)) {
log.warn("difficultyDataExtract customerId:{} have any project", param.getCustomerId());
return false;
}
Map<String, ProjectDTO> bizProjectInfoMap = bizProjectInfoList.stream().collect(Collectors.toMap(ProjectDTO::getId, o -> o, (o1, o2) -> o1));
//获取agency维度
List<DimAgencyEntity> agencyList = dimAgencyService.getAgencyListByCustomerId(param.getCustomerId());
Map<String, DimAgencyEntity> agencyMap = agencyList.stream().collect(Collectors.toMap(DimAgencyEntity::getId, o -> o, (o1, o2) -> o1));
//获取grid维度
List<GridInfoDTO> gridList = customerGridService.queryGridInfoList(param.getCustomerId());
Map<String, GridInfoDTO> gridMap = gridList.stream().collect(Collectors.toMap(GridInfoDTO::getGridId, o -> o, (o1, o2) -> o1));
//获取客户下所有项目分类
List<IssueProjectCategoryDictEntity> categoryList = issueProjectCategoryDictService.getAllByCId(param.getCustomerId());
//项目分类数据 todo 暂时查询所有
List<ProjectCategoryDTO> projectCategoryData = projectService.getProjectCategoryData(param.getCustomerId(), null);
//key projectId:categoryCode Set
Map<String, Set<String>> projectCategoryMap = projectCategoryData.stream()
.collect(Collectors.groupingBy(ProjectCategoryDTO::getProjectId, Collectors.mapping(ProjectCategoryDTO::getCategoryCode, Collectors.toSet())));
//2.获取项目的所有节点耗时数据
List<FactOriginProjectOrgPeriodDailyEntity> projectPeriodList = factOriginProjectMainDailyService.getProjectPeriod(param);
//处理部门数去重(只要流转到就算)
Map<String, Set<String>> orgCountMap = new HashMap<>();
//被处理次数
Map<String, Integer> handleCountMap = new HashMap<>();
Set<String> valideProjectIdSet = fillAnyCountAndValidProject(param, projectPeriodList, orgCountMap, handleCountMap);
List<ScreenDifficultyDataEntity> diffList = new ArrayList<>();
List<ScreenDifficultyImgDataEntity> 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<String> 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<TopicAttachmentDTO> 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<TopicAttachmentDTO> 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<ScreenDifficultyDataEntity> 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<String, DimAgencyEntity> agencyMap,
private ScreenDifficultyDataEntity buildBaseDiffEntity(FactOriginProjectMainAndPeriodDTO project, Map<String, DimAgencyEntity> agencyMap,
Map<String, GridInfoDTO> gridMap, Map<String, ProjectDTO> bizProjectInfoMap) {
ProjectDTO projectDTO = bizProjectInfoMap.get(project.getId());
ScreenDifficultyDataEntity diff = new ScreenDifficultyDataEntity();

13
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<ScreenDifficult
/**
* @Description 查询数据库中是否有该客户下的难点赌点信息
* @param customerId
* @return com.epmet.dto.screen.result.DifficultyIfExistedResultDTO
* @return com.epmet.dto.screen.result.DifficultyIfExistedResultDTO
* @author wangc
* @date 2020.09.28 10:53
*/
@ -50,13 +50,4 @@ public interface ScreenDifficultyDataService extends BaseService<ScreenDifficult
* @date 2020.09.28 11:04
*/
void dataClean(String customerId,List<ScreenDifficultyDataEntity> difficulties, List<ScreenDifficultyImgDataEntity> imgs);
/**
* @Description 根据客户Id查出全部的难点赌点的项目Id和网格Id因为需要比对全部的信息然后删除因为删除网格而导致的垃圾数据
* @param customerId
* @return java.util.List<com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity>
* @author wangc
* @date 2020.11.17 09:31
*/
List<ScreenDifficultyDataEntity> getAllDifficultyByCustomerId(String customerId);
}
}

22
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<ScreenDiffi
@Override
@Transactional(rollbackFor = Exception.class)
public void dataClean(String customerId, List<ScreenDifficultyDataEntity> difficulties, List<ScreenDifficultyImgDataEntity> imgs) {
List<ScreenDifficultyDataEntity> orient = baseDao.selectAllDifficultyByCustomerId(customerId);
if(!CollectionUtils.isEmpty(orient)){
baseDao.deleteBatchDifficultyImg(orient.stream().map(ScreenDifficultyDataEntity::getEventId).distinct().collect(Collectors.toList()));
}
baseDao.deleteBatchDifficulty(customerId,null);
List<String> 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<com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity>
* @author wangc
* @date 2020.11.17 09:31
*/
@Override
public List<ScreenDifficultyDataEntity> getAllDifficultyByCustomerId(String customerId) {
return baseDao.selectAllDifficultyByCustomerId(customerId);
}
}

76
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml

@ -3,32 +3,7 @@
<mapper namespace="com.epmet.dao.evaluationindex.extract.FactOriginProjectMainDailyDao">
<resultMap type="com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity" id="factOriginProjectMainDailyMap">
<result property="id" column="ID"/>
<result property="dateId" column="DATE_ID"/>
<result property="weekId" column="WEEK_ID"/>
<result property="monthId" column="MONTH_ID"/>
<result property="quarterId" column="QUARTER_ID"/>
<result property="yearId" column="YEAR_ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="issueCreatorId" column="ISSUE_CREATOR_ID"/>
<result property="issueId" column="ISSUE_ID"/>
<result property="topicId" column="TOPIC_ID"/>
<result property="gridId" column="GRID_ID"/>
<result property="pid" column="PID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="projectStatus" column="PROJECT_STATUS"/>
<result property="topicCreatorId" column="TOPIC_CREATOR_ID"/>
<result property="isParty" column="IS_PARTY"/>
<result property="isOverdue" column="IS_OVERDUE"/>
<result property="finishOrgIds" column="FINISH_ORG_IDS"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="getProjectByCustomer" resultType="com.epmet.dto.extract.FactOriginProjectMainDailyDTO">
SELECT
ID,
@ -663,23 +638,56 @@
</otherwise>
</choose>
</select>
<resultMap type="com.epmet.entity.evaluationindex.extract.FactOriginProjectMainAndPeriodDTO" id="factOriginProjectMainPeriodMap">
<result property="id" column="ID"/>
<result property="dateId" column="DATE_ID"/>
<result property="weekId" column="WEEK_ID"/>
<result property="monthId" column="MONTH_ID"/>
<result property="quarterId" column="QUARTER_ID"/>
<result property="yearId" column="YEAR_ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="issueCreatorId" column="ISSUE_CREATOR_ID"/>
<result property="issueId" column="ISSUE_ID"/>
<result property="topicId" column="TOPIC_ID"/>
<result property="gridId" column="GRID_ID"/>
<result property="pid" column="PID"/>
<result property="pids" column="PIDS"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="projectStatus" column="PROJECT_STATUS"/>
<result property="topicCreatorId" column="TOPIC_CREATOR_ID"/>
<result property="isParty" column="IS_PARTY"/>
<result property="isOverdue" column="IS_OVERDUE"/>
<result property="finishOrgIds" column="FINISH_ORG_IDS"/>
<collection property="periodList" ofType="com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity"
select="getProjectPeriodForDiff" column="id"/>
</resultMap>
<!--获取难点堵点项目数据-->
<select id="getProjectForDiff" resultType="com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity">
<select id="getProjectForDiff" resultMap = "factOriginProjectMainPeriodMap">
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
<if test="param.isFirst == null or !param.isFirst">
, IFNULL(b.DATE_ID, DATE_FORMAT( now(), '%Y%m%d' )) as updateDate
</if>
FROM fact_origin_project_main_daily m
<if test="param.isFirst == null or !param.isFirst">
LEFT JOIN fact_origin_project_log_daily b ON m.ID = b.PROJECT_ID AND b.ACTION_CODE = 'close'
</if>
WHERE
CUSTOMER_ID = #{customerId}
<if test="dateId != null and dateId != ''">
AND DATE_ID = #{dateId,jdbcType=VARCHAR}
m.CUSTOMER_ID = #{param.customerId}
AND m.DEL_FLAG = '0'
<if test="param.isFirst == null or !param.isFirst">
HAVING updateDate>= #{param.internalDay}
</if>
LIMIT #{offset} ,#{pageSize}
</select>
<select id="getProjectPeriodForDiff" resultType="com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity">
SELECT
t.ID, t.CUSTOMER_ID, t.PROJECT_ID, t.ORG_ID, t.ORG_TYPE, t.PID,t. PIDS, t.INFORMED_DATE, t.HANDLED_DATE, t.TOTAL_PERIOD, t.PERIOD_TILL_REPLY_FIRSTLY, t.OPERATION, t.IS_RESOLVED
FROM fact_origin_project_org_period_daily t
WHERE CUSTOMER_ID = #{customerId}
WHERE PROJECT_ID = #{projectId}
</select>
<!-- 组织查询项目总数 -->

10
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenDifficultyDataDao.xml

@ -221,14 +221,4 @@
</foreach>
</insert>
<select id="selectAllDifficultyByCustomerId" resultType="com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity">
SELECT
org_id,
event_id
FROM
screen_difficulty_data
WHERE
del_flag = '0'
AND customer_id = #{customerId}
</select>
</mapper>

6
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 {}
}

15
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<ExportCommunitySelfOrganizationExcel> 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);
}
/**

24
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<ImportCommunitySelfOrganizationSon> organizationPersonnel;
}

2
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;
}

3
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;
}

1
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;
}

1
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;
}

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java

@ -305,8 +305,6 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
**/
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);
}

4
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java

@ -105,8 +105,4 @@ public interface CustomerDepartmentDao extends BaseDao<CustomerDepartmentEntity>
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);
}

1
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java

@ -356,5 +356,4 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
@Param("agencyId")String agencyId,
@Param("operateUserId") String operateUserId);
int updateGridAreaCode(@Param("agencyId")String agencyId, @Param("areaCode")String areaCode,@Param("operateUserId") String operateUserId);
}

221
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<String> 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<String> 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_codeparent_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<CustomerGridEntity> 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<CustomerDepartmentEntity> 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<CustomerAgencyEntity> 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<String> 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<String> 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<AgencysResultDTO>().ok(agencysResultDTO);
}
List<String> 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<AgencysResultDTO>().ok(agencysResultDTO);
}
List<String> listStr = Arrays.asList(entity.getPids().split(":"));
parentList = customerAgencyDao.selectPAgencyById(listStr);
agencysResultDTO.setParentList(parentList);
return new Result<AgencysResultDTO>().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<String> 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());
}

16
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}
</select>
<update id="updateSubAgencyAreaCode" parameterType="map">
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>
<update id="updateSubAgencyAreaCodeById" parameterType="map">
UPDATE customer_agency
SET AREA_CODE = '',

11
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>
<update id="updateDeptAreaCode" parameterType="map">
update customer_department
SET AREA_CODE = #{areaCode},
UPDATED_BY=#{operateUserId},
UPDATED_TIME = NOW()
where del_flag='0'
and agency_id=#{agencyId}
</update>
</mapper>

11
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
<where>
@ -764,12 +765,4 @@
AND pids LIKE concat('%',#{agencyId}, '%' )
</update>
<update id="updateGridAreaCode" parameterType="map">
update customer_grid
SET AREA_CODE = #{areaCode},
UPDATED_BY=#{operateUserId},
UPDATED_TIME = NOW()
where del_flag='0'
and pid=#{agencyId}
</update>
</mapper>

Loading…
Cancel
Save