diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolDailySumResult.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolDailySumResult.java index 5400a1247f..c7fbe6b7ef 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolDailySumResult.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolDailySumResult.java @@ -15,7 +15,7 @@ import java.io.Serializable; public class PatrolDailySumResult implements Serializable { private static final long serialVersionUID = 310405655189243944L; - private String fullAgencyId; + private String orgId; private Integer patrolTotal; private Integer totalTime; } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StatsStaffPatrolRecordDailyDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StatsStaffPatrolRecordDailyDao.java index 11ed072080..8be4c4c34e 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StatsStaffPatrolRecordDailyDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StatsStaffPatrolRecordDailyDao.java @@ -39,12 +39,12 @@ public interface StatsStaffPatrolRecordDailyDao extends BaseDao getPatrolSumList(@Param("agencyFullIdList") List agencyFullIdList, @Param("startDateId") String startDateId, @Param("endDateId") String endDateId); + List getPatrolSumList(@Param("orgIdList") List orgIdList, @Param("startDateId") String startDateId, @Param("endDateId") String endDateId); /** * @Description 直属组织或网格下巡查数据 diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java index bc27897beb..8f35934227 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java @@ -1,55 +1,54 @@ package com.epmet.dataaggre.service.datastats.impl; import com.alibaba.fastjson.JSON; - import com.epmet.commons.dynamic.datasource.annotation.DataSource; - import com.epmet.commons.tools.constant.NumConstant; - import com.epmet.commons.tools.constant.StrConstant; - import com.epmet.commons.tools.enums.OrgLevelEnum; - import com.epmet.commons.tools.exception.RenException; - import com.epmet.commons.tools.utils.ConvertUtils; - import com.epmet.commons.tools.utils.DateUtils; - import com.epmet.commons.tools.utils.ExcelUtils; - import com.epmet.dataaggre.constant.DataSourceConstant; - import com.epmet.dataaggre.constant.OrgConstant; - import com.epmet.dataaggre.dao.datastats.DataStatsDao; - import com.epmet.dataaggre.dao.datastats.FactGridMemberStatisticsDailyDao; - import com.epmet.dataaggre.dto.datastats.FactGroupActDailyDTO; - import com.epmet.dataaggre.dto.datastats.form.*; - import com.epmet.dataaggre.dto.datastats.result.*; - import com.epmet.dataaggre.dto.epmetuser.form.GridMemberPatrolListFormDTO; - import com.epmet.dataaggre.dto.epmetuser.result.GridMemberPatrolListResultDTO; - import com.epmet.dataaggre.dto.epmetuser.result.PatrolDailySumResult; - import com.epmet.dataaggre.dto.evaluationindex.ScreenAgencyOrGridListDTO; - import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO; - import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO; - import com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO; - import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; - import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO; - import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO; - import com.epmet.dataaggre.entity.datastats.DimAgencyEntity; - import com.epmet.dataaggre.entity.datastats.FactAgencyGovernDailyEntity; - import com.epmet.dataaggre.excel.CustomerDataManageExcel; - import com.epmet.dataaggre.service.datastats.DataStatsService; - import com.epmet.dataaggre.service.epmetuser.StatsStaffPatrolRecordDailyService; - import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService; - import com.epmet.dataaggre.service.opercrm.CustomerRelation; - import com.github.pagehelper.PageHelper; - import lombok.extern.slf4j.Slf4j; - import org.apache.commons.collections4.CollectionUtils; - import org.apache.commons.lang3.StringUtils; - import org.springframework.beans.factory.annotation.Autowired; - import org.springframework.stereotype.Service; - - import javax.servlet.http.HttpServletResponse; - import java.math.BigDecimal; - import java.math.RoundingMode; - import java.text.NumberFormat; - import java.text.ParseException; - import java.text.SimpleDateFormat; - import java.util.*; - import java.util.concurrent.atomic.AtomicInteger; - import java.util.concurrent.atomic.AtomicReference; - import java.util.stream.Collectors; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.enums.OrgLevelEnum; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.dataaggre.constant.DataSourceConstant; +import com.epmet.dataaggre.constant.OrgConstant; +import com.epmet.dataaggre.dao.datastats.DataStatsDao; +import com.epmet.dataaggre.dao.datastats.FactGridMemberStatisticsDailyDao; +import com.epmet.dataaggre.dto.datastats.FactGroupActDailyDTO; +import com.epmet.dataaggre.dto.datastats.form.*; +import com.epmet.dataaggre.dto.datastats.result.*; +import com.epmet.dataaggre.dto.epmetuser.form.GridMemberPatrolListFormDTO; +import com.epmet.dataaggre.dto.epmetuser.result.GridMemberPatrolListResultDTO; +import com.epmet.dataaggre.dto.epmetuser.result.PatrolDailySumResult; +import com.epmet.dataaggre.dto.evaluationindex.ScreenAgencyOrGridListDTO; +import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO; +import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO; +import com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO; +import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; +import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO; +import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO; +import com.epmet.dataaggre.entity.datastats.DimAgencyEntity; +import com.epmet.dataaggre.entity.datastats.FactAgencyGovernDailyEntity; +import com.epmet.dataaggre.excel.CustomerDataManageExcel; +import com.epmet.dataaggre.service.datastats.DataStatsService; +import com.epmet.dataaggre.service.epmetuser.StatsStaffPatrolRecordDailyService; +import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService; +import com.epmet.dataaggre.service.opercrm.CustomerRelation; +import com.github.pagehelper.PageHelper; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletResponse; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.text.NumberFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; /** * @Author sun @@ -1556,7 +1555,7 @@ public class DataStatsServiceImpl implements DataStatsService { Map closeProjectEndMap = toProjectEnd.stream().collect(Collectors.toMap(SubGridProjectResultDTO::getGridId, SubGridProjectResultDTO::getClosedProjectTotal, (o1, o2) -> o1)); //巡查次数和时间 List patrolList = statsStaffPatrolRecordDailyService.getPatrolSumList(gridIdList,formDTO.getStartDateId(),formDTO.getEndDateId()); - Map patrolListMap = patrolList.stream().collect(Collectors.toMap(PatrolDailySumResult::getFullAgencyId, o -> o, (o1, o2) -> o1)); + Map patrolListMap = patrolList.stream().collect(Collectors.toMap(PatrolDailySumResult::getOrgId, o -> o, (o1, o2) -> o1)); subAgencyList.forEach(agency->{ String gridId = agency.getGridId(); @@ -1567,7 +1566,7 @@ public class DataStatsServiceImpl implements DataStatsService { resultDTO.setIssueToProjectTotal(getTotal(toProjectStartMap,toProjectEndMap,gridId)); resultDTO.setClosedProjectTotal(getTotal(closeProjectStartMap,closeProjectEndMap,gridId)); - PatrolDailySumResult patrolRecordDTO = patrolListMap.get(agency.getAllParentIds()); + PatrolDailySumResult patrolRecordDTO = patrolListMap.get(gridId); setPatrolAttr(resultDTO, patrolRecordDTO); result.add(resultDTO); }); @@ -1595,9 +1594,9 @@ public class DataStatsServiceImpl implements DataStatsService { Map closeProjectStartMap = toProjectStart.stream().collect(Collectors.toMap(SubAgencyProjectResultDTO::getAgencyId, SubAgencyProjectResultDTO::getClosedProjectTotal, (o1, o2) -> o1)); Map closeProjectEndMap = toProjectEnd.stream().collect(Collectors.toMap(SubAgencyProjectResultDTO::getAgencyId, SubAgencyProjectResultDTO::getClosedProjectTotal, (o1, o2) -> o1)); //巡查次数和时间 - List agencyFullIds = subAgencyList.stream().map(o -> o.getPids().concat(StrConstant.COLON).concat(o.getAgencyId())).collect(Collectors.toList()); - List patrolList = statsStaffPatrolRecordDailyService.getPatrolSumList(agencyFullIds,formDTO.getStartDateId(),formDTO.getEndDateId()); - Map patrolListMap = patrolList.stream().collect(Collectors.toMap(PatrolDailySumResult::getFullAgencyId, o -> o, (o1, o2) -> o1)); + List agencyIdList = subAgencyList.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList()); + List patrolList = statsStaffPatrolRecordDailyService.getPatrolSumList(agencyIdList,formDTO.getStartDateId(),formDTO.getEndDateId()); + Map patrolListMap = patrolList.stream().collect(Collectors.toMap(PatrolDailySumResult::getOrgId, o -> o, (o1, o2) -> o1)); subAgencyList.forEach(agency->{ String agencyId = agency.getAgencyId(); @@ -1607,8 +1606,7 @@ public class DataStatsServiceImpl implements DataStatsService { resultDTO.setTopicToIssueTotal(getTotal(toIssueStartMap,toIssueEndMap,agencyId)); resultDTO.setIssueToProjectTotal(getTotal(toProjectStartMap,toProjectEndMap,agencyId)); resultDTO.setClosedProjectTotal(getTotal(closeProjectStartMap,closeProjectEndMap,agencyId)); - String fullAgencyId = agency.getPids().concat(StrConstant.COLON).concat(agencyId); - PatrolDailySumResult patrolRecordDTO = patrolListMap.get(fullAgencyId); + PatrolDailySumResult patrolRecordDTO = patrolListMap.get(agencyId); setPatrolAttr(resultDTO,patrolRecordDTO); result.add(resultDTO); }); diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StatsStaffPatrolRecordDailyService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StatsStaffPatrolRecordDailyService.java index ce49c18f73..70afc1e944 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StatsStaffPatrolRecordDailyService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StatsStaffPatrolRecordDailyService.java @@ -35,12 +35,12 @@ public interface StatsStaffPatrolRecordDailyService extends BaseService getPatrolSumList(List agencyList, String startDateId, String endDateId); + List getPatrolSumList(List orgIdList, String startDateId, String endDateId); /** * @Description 直属组织或网格下巡查数据 diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StatsStaffPatrolRecordDailyServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StatsStaffPatrolRecordDailyServiceImpl.java index d24dcbe10c..ccfe71e399 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StatsStaffPatrolRecordDailyServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StatsStaffPatrolRecordDailyServiceImpl.java @@ -28,14 +28,14 @@ public class StatsStaffPatrolRecordDailyServiceImpl extends BaseServiceImpl getPatrolSumList(List agencyFullIdList, String startDateId, String endDateId) { - return baseDao.getPatrolSumList(agencyFullIdList,startDateId,endDateId); + public List getPatrolSumList(List orgIdList, String startDateId, String endDateId) { + return baseDao.getPatrolSumList(orgIdList,startDateId,endDateId); } /** diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StatsStaffPatrolRecordDailyDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StatsStaffPatrolRecordDailyDao.xml index 217417dd29..e77b01af94 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StatsStaffPatrolRecordDailyDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StatsStaffPatrolRecordDailyDao.xml @@ -2,17 +2,17 @@ diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/GridIssueCountResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/GridIssueCountResultDTO.java index 207cd8e8df..eb2b9d269a 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/GridIssueCountResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/GridIssueCountResultDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.extract.form; import lombok.Data; import java.io.Serializable; +import java.math.BigDecimal; /** * @Author zxc @@ -27,4 +28,9 @@ public class GridIssueCountResultDTO implements Serializable { * 网格ID */ private String gridId; + + /** + * 网格议题转项目率 + */ + private BigDecimal issueToProjectRatio; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java index 42e671c2b7..b993336497 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java @@ -67,13 +67,13 @@ public interface FactOriginIssueMainDailyDao extends BaseDao selectIssueTotal(@Param("customerId") String customerId,@Param("monthId") String monthId); /** - * @Description 查询俩月的网格议题总数 + * @Description 查询议题转项目总数 * @param customerId * @param monthId * @author zxc * @date 2020/9/18 10:20 上午 */ - List selectIssueTotalTwoMonthPlus(@Param("customerId")String customerId,@Param("monthId") String monthId,@Param("minusMonthId") String minusMonthId); + List selectIssueTotalShiftProject(@Param("customerId")String customerId, @Param("monthId") String monthId); /** * @Description 网格总项目数 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalGridIndexServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalGridIndexServiceImpl.java index 4a9fbb143e..c372f5bdbc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalGridIndexServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalGridIndexServiceImpl.java @@ -113,9 +113,9 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { // 网格的发文数量 List publishCountList = articlePublishedGridDailyService.selectArticlePublishCount(customerId, monthId); // 网格议题转项目率 - List gridIssueTotalList = issueExtractService.selectIssueTotalTwoMonth(customerId, monthId, DateUtils.minusMonthId(monthId)); - List gridProjectTotalList = issueExtractService.selectGridProjectCount(customerId, monthId, ExtractConstant.SHIFT_PROJECT); - List gridIssueShiftProjectRatio = getGridIssueShiftProjectRatio(gridIssueTotalList, gridProjectTotalList); + List gridIssueTotalShiftProjectList = issueExtractService.selectIssueTotalShiftProject(customerId, monthId); + List gridIssueTotalList = issueExtractService.selectIssueTotal(customerId, monthId); + List gridIssueShiftProjectRatio = getGridIssueShiftProjectRatio(gridIssueTotalShiftProjectList, gridIssueTotalList); // 建群党员数 List partyCreateGroupCountList = groupExtractService.selectPartyCreateGroupCount(customerId, monthId); //结合目前产品,数据来源:话题评论、议题表决 @@ -313,9 +313,10 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { List gridProjectTotalList = issueExtractService.selectGridProjectCount(customerId, monthId, ExtractConstant.SHIFT_PROJECT); log.info("网格总项目数{}", JSON.toJSONString(gridProjectTotalList)); //网格议题转项目率 - List gridIssueCountList = issueExtractService.selectIssueTotalTwoMonth(customerId, monthId, DateUtils.minusMonthId(monthId)); + List gridIssueCountList = issueExtractService.selectIssueTotalShiftProject(customerId, monthId); log.info("网格近两个月的议题{}", JSON.toJSONString(gridIssueCountList)); - List gridIssueShiftProjectRatio = getGridIssueShiftProjectRatio(gridIssueCountList, gridProjectTotalList); + + List gridIssueShiftProjectRatio = getGridIssueShiftProjectRatio(gridIssueCountList, gridIssueTotalList); log.info("网格议题转项目率{}", JSON.toJSONString(gridIssueShiftProjectRatio)); //网格自治项目数 从议题创建到项目关闭,包括处理人,自始至终没有出过议题所属网格 List projectAutoNoMyList = projectLogService.selectProjectAutoNoMy(customerId, monthId); @@ -391,15 +392,23 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { } }); } - // 2. 网格总项目数,网格议题转项目率 + // 2.网格议题转项目率 if (!CollectionUtils.isEmpty(gridIssueShiftProjectRatio)){ gridIssueShiftProjectRatio.forEach(projectTotal -> { if (r.getGridId().equals(projectTotal.getGridId())){ - r.setProjectTotal(projectTotal.getProjectTotal()); r.setIssueToProjectRatio(projectTotal.getIssueToProjectRatio()); } }); } + // 网格总项目数 + if (!CollectionUtils.isEmpty(gridProjectTotalList)){ + gridProjectTotalList.forEach(projectTotal -> { + if (r.getGridId().equals(projectTotal.getGridId())) { + r.setProjectTotal(projectTotal.getProjectTotal()); + } + }); + } + // 3. 网格办结项目数 if (!CollectionUtils.isEmpty(gridProjectClosedTotalList)){ gridProjectClosedTotalList.forEach(closed -> { @@ -539,22 +548,22 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { /** * @Description - * @param gridIssueTotalList - * @param gridProjectTotalList + * @param gridIssueTotalList 网格下已转项目的议题 + * @param gridIssueAllTotalList 网格下所有议题 * @author zxc * @date 2020/9/19 2:53 下午 */ - public List getGridIssueShiftProjectRatio(List gridIssueTotalList,List gridProjectTotalList){ - if (!CollectionUtils.isEmpty(gridIssueTotalList) && !CollectionUtils.isEmpty(gridProjectTotalList)) { - gridProjectTotalList.forEach(project -> { + public List getGridIssueShiftProjectRatio(List gridIssueTotalList,List gridIssueAllTotalList){ + if (!CollectionUtils.isEmpty(gridIssueTotalList) && !CollectionUtils.isEmpty(gridIssueAllTotalList)) { + gridIssueAllTotalList.forEach(allIssue -> { gridIssueTotalList.forEach(issue -> { - if (project.getGridId().equals(issue.getGridId())) { - project.setIssueToProjectRatio(getRound(new BigDecimal(project.getProjectTotal()).divide(new BigDecimal(issue.getIssueTotal()),NumConstant.EIGHT,BigDecimal.ROUND_HALF_UP).multiply(NumConstant.ONE_HUNDRED_DECIMAL))); + if (allIssue.getGridId().equals(issue.getGridId())) { + allIssue.setIssueToProjectRatio(getRound(new BigDecimal(allIssue.getIssueTotal()).divide(new BigDecimal(issue.getIssueTotal()),NumConstant.EIGHT,BigDecimal.ROUND_HALF_UP).multiply(NumConstant.ONE_HUNDRED_DECIMAL))); } }); }); } - return gridProjectTotalList; + return gridIssueAllTotalList; } /** diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/IssueExtractService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/IssueExtractService.java index 2ee29acd93..85caea8cc5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/IssueExtractService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/IssueExtractService.java @@ -47,7 +47,7 @@ public interface IssueExtractService { * @author zxc * @date 2020/9/18 10:20 上午 */ - List selectIssueTotalTwoMonth(String customerId, String monthId, String minusMonthId); + List selectIssueTotalShiftProject(String customerId, String monthId); /** * @Description 网格总项目数 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java index b7b4532f4f..e8730541d8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java @@ -268,8 +268,8 @@ public class IssueExtractServiceImpl implements IssueExtractService { * @date 2020/9/18 10:20 上午 */ @Override - public List selectIssueTotalTwoMonth(String customerId, String monthId, String minusMonthId) { - return issueMainDailyDao.selectIssueTotalTwoMonthPlus(customerId, monthId, minusMonthId); + public List selectIssueTotalShiftProject(String customerId, String monthId) { + return issueMainDailyDao.selectIssueTotalShiftProject(customerId, monthId); } /** diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml index 9c42712164..6ee2643f68 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml @@ -164,18 +164,17 @@ )t - - SELECT - COUNT( ID ) AS issueTotal, - GRID_ID - FROM - fact_origin_issue_main_daily - WHERE - DEL_FLAG = 0 - AND CUSTOMER_ID = #{customerId} - AND (MONTH_ID = #{monthId} OR MONTH_ID = #{minusMonthId}) - GROUP BY GRID_ID + GRID_ID, + COUNT(ISSUE_ID) AS issueTotal + FROM fact_origin_issue_log_daily + WHERE DEL_FLAG = '0' + AND MONTH_ID = #{monthId} + AND CUSTOMER_ID = #{customerId} + AND ACTION_CODE = 'shift_project' + GROUP BY GRID_ID diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml index 0790001c64..063ec1acc8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml @@ -53,7 +53,7 @@ f.ORG_ID AS "agencyId", SUM( TIMESTAMPDIFF( MINUTE, ( DATE_FORMAT( f.INFORMED_DATE, '%Y-%m-%d %H:%i' )), ( DATE_FORMAT( f.PERIOD_TILL_REPLY_FIRSTLY, '%Y-%m-%d %H:%i' )) ) ) AS "sum", - COUNT( f.ID ) AS "count" + COUNT(DISTINCT f.PROJECT_ID) AS "count" FROM fact_origin_project_org_period_daily f INNER JOIN dim_agency da ON f.ORG_ID = da.ID @@ -128,7 +128,7 @@ fp.ORG_ID, SUM( TIMESTAMPDIFF( MINUTE, ( DATE_FORMAT( fp.INFORMED_DATE, '%Y-%m-%d %H:%i' )), ( DATE_FORMAT( fp.PERIOD_TILL_REPLY_FIRSTLY, '%Y-%m-%d %H:%i' )) ) ) AS "sum", - COUNT( fp.ID ) AS "count" + COUNT( DISTINCT fp.PROJECT_ID ) AS "count" FROM fact_origin_project_org_period_daily fp INNER JOIN fact_origin_project_main_daily fm ON fp.PROJECT_ID = fm.ID diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index b850b196a1..ca52276790 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java @@ -940,6 +940,18 @@ public class IssueServiceImpl extends BaseServiceImpl imp */ @Override public void shiftProjectV2(ShiftProjectFormDTO formDTO) { + //1:查询议题数据 + IssueEntity entity = baseDao.selectById(formDTO.getIssueId()); + if (null == entity) { + throw new RenException(IssueConstant.SELECT_EXCEPTION); + } + if (IssueConstant.ISSUE_SHIFT_PROJECT.equals(entity.getIssueStatus())) { + throw new RenException(IssueConstant.ISSUE_SHIFT_PROJECT_EXCEPTION); + } + if (!IssueConstant.ISSUE_VOTING.equals(entity.getIssueStatus())) { + throw new RenException(IssueConstant.ISSUE_VOTING_EXCEPTION); + } + formDTO.setIssueDTO(ConvertUtils.sourceToTarget(entity, IssueDTO.class)); //获取议题分类 List categoryList = issueCategoryService.getCategoryByIssue(formDTO.getIssueId()); @@ -965,18 +977,6 @@ public class IssueServiceImpl extends BaseServiceImpl imp } //因需要保证议题表中的转项目时间与创建项目时间一致 因此先新增项目数据再更新议题数据 - //1:查询议题数据 - IssueEntity entity = baseDao.selectById(formDTO.getIssueId()); - if (null == entity) { - throw new RenException(IssueConstant.SELECT_EXCEPTION); - } - if (IssueConstant.ISSUE_SHIFT_PROJECT.equals(entity.getIssueStatus())) { - throw new RenException(IssueConstant.ISSUE_SHIFT_PROJECT_EXCEPTION); - } - if (!IssueConstant.ISSUE_VOTING.equals(entity.getIssueStatus())) { - throw new RenException(IssueConstant.ISSUE_VOTING_EXCEPTION); - } - formDTO.setIssueDTO(ConvertUtils.sourceToTarget(entity, IssueDTO.class)); //2:调用resi-group查询话题创建人数据(目前议题来源只有来自话题),为了到项目服务初始数据以及发送消息使用 Result resultTopicDTO = resiGroupFeignClient.getTopicById(entity.getSourceId());