diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/TransferRightRatioResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/TransferRightRatioResultDTO.java new file mode 100644 index 0000000000..e284689538 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/TransferRightRatioResultDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.extract.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/10/19 2:00 下午 + */ +@Data +public class TransferRightRatioResultDTO implements Serializable { + + private String projectId; + + private String gridId; + + private Boolean status; + + private Integer notReturnProject; +} 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 beb1a475ed..a7d6eda645 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 @@ -33,10 +33,7 @@ import com.epmet.entity.stats.DimCustomerEntity; import com.epmet.entity.stats.DimDateEntity; import com.epmet.entity.stats.DimMonthEntity; import com.epmet.service.StatsDemoService; -import com.epmet.service.evaluationindex.extract.dataToIndex.CalCpcIndexService; -import com.epmet.service.evaluationindex.extract.dataToIndex.CalGridIndexService; -import com.epmet.service.evaluationindex.extract.dataToIndex.IndexCollCommunityService; -import com.epmet.service.evaluationindex.extract.dataToIndex.IndexCollStreetService; +import com.epmet.service.evaluationindex.extract.dataToIndex.*; import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectLogDailyService; import com.epmet.service.evaluationindex.extract.todata.FactOriginTopicMainDailyService; import com.epmet.service.evaluationindex.extract.toscreen.*; @@ -99,6 +96,8 @@ public class DemoController { @Autowired private IndexCollStreetService indexCollStreetService; @Autowired + private IndexCollDistrictDepartmentService indexCollDistrictDepartmentService; + @Autowired private GovernRankDataExtractService governRankDataExtractService; @Autowired private OrgRankExtractService orgRankExtractService; @@ -629,6 +628,12 @@ public class DemoController { return new Result(); } + @PostMapping("indexCollDept") + public Result indexCollDept(@RequestBody CustomerIdAndDateIdFormDTO formDTO){ + indexCollDistrictDepartmentService.saveDepartmentAbility(formDTO.getCustomerId(), formDTO.getDateId()); + return new Result(); + } + @Autowired private PartyBaseInfoService partyBaseInfoService; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java index 500fd52d48..f53ef5b882 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java @@ -55,6 +55,8 @@ public interface FactOriginProjectLogDailyDao extends BaseDao selectNotReturnProject(@Param("customerId") String customerId,@Param("monthId") String monthId,@Param("actionCode") String actionCode,@Param("orgType") String orgType); + List selectNotReturn(@Param("customerId")String customerId,@Param("monthId")String monthId); + /** * @Description 查询项目评价信息 * @param customerId @@ -204,4 +206,35 @@ public interface FactOriginProjectLogDailyDao extends BaseDao selectOrgSatisfaction(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("level")String level); + + /** + * 获取部门办结项目数 + * @author zhaoqifeng + * @date 2020/10/16 17:09 + * @param customerId + * @param monthId + * @return java.util.List + */ + List selectDeptClosedProject(@Param("customerId") String customerId, @Param("monthId") String monthId); + + + /** + * 部门办结项目满意度 + * @author zhaoqifeng + * @date 2020/9/20 16:44 + * @param customerId + * @param monthId + * @return java.util.List + */ + List selectDeptSatisfaction(@Param("customerId") String customerId, @Param("monthId") String monthId); + + /** + * 网格结案率统计 + * @author zhaoqifeng + * @date 2020/9/20 16:44 + * @param customerId + * @param monthId + * @return java.util.List + */ + List selectGridClosed(@Param("customerId") String customerId, @Param("monthId") String monthId); } 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 bc982b3c82..062c651aaf 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 @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.extract.FactOriginProjectMainDailyDTO; import com.epmet.dto.extract.result.GridProjectClosedTotalResultDTO; import com.epmet.dto.extract.result.OrgStatisticsResultDTO; +import com.epmet.dto.extract.result.TransferRightRatioResultDTO; import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO; import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity; @@ -77,6 +78,8 @@ public interface FactOriginProjectMainDailyDao extends BaseDao selectGridClosedProject(@Param("customerId") String customerId,@Param("monthId") String monthId,@Param("status") String status); + List selectTransferRightRatio(@Param("customerId")String customerId, @Param("monthId")String monthId); + /** * 根据日期删除数据 * @author zhaoqifeng diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.java index fe6fda13b8..0007237a2f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.java @@ -102,4 +102,14 @@ public interface FactOriginProjectOrgPeriodDailyDao extends BaseDao selectAgencyResponseCoefficient(@Param("customerId") String customerId,@Param("dimId") String dimId, @Param("dateType") String dateType); + + /** + * 部门处理效率统计 + * @author zhaoqifeng + * @date 2020/10/19 9:31 + * @param customerId + * @param monthId + * @return java.util.List + */ + List selectDeptHandle(@Param("customerId") String customerId, @Param("monthId") String monthId); } \ No newline at end of file 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 6cce879f26..22dfccc44e 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 @@ -29,10 +29,7 @@ import org.springframework.util.CollectionUtils; import java.math.BigDecimal; import java.text.NumberFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; @@ -275,18 +272,32 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { }); } //网格办结项目数 - List gridProjectClosedTotalList = projectMainService.selectGridClosedProject(customerId, monthId, ExtractConstant.CLOSE); + List gridProjectClosedTotalList = projectMainService.selectGridClosedProject(customerId, monthId, ExtractConstant.CLOSED); //网格吹哨部门准确率 【没被退回的项目数/项目总数 】 - List notReturnProjectList = projectLogService.selectNotReturnProject(customerId, monthId, ExtractConstant.RETURN_ACTION_CODE, ExtractConstant.GRID_ORG_TYPE); - if (!CollectionUtils.isEmpty(gridIssueShiftProjectRatio) && !CollectionUtils.isEmpty(notReturnProjectList)){ - notReturnProjectList.forEach(not -> { - gridIssueShiftProjectRatio.forEach(total -> { - if (not.getGridId().equals(total.getGridId())){ - not.setTransferRightRatio(getRound(new BigDecimal(not.getNotReturnProject()/total.getProjectTotal()).multiply(NumConstant.ONE_HUNDRED_DECIMAL))); - } + List transferRightRatioResultDTOS = projectMainService.selectTransferRightRatio(customerId, monthId); + List transferRightRatioResultDTOS1 = projectLogService.selectNotReturn(customerId, monthId); + if (!CollectionUtils.isEmpty(transferRightRatioResultDTOS1)){ + transferRightRatioResultDTOS.forEach(r -> { + transferRightRatioResultDTOS1.forEach(t -> { + r.setStatus(r.getProjectId().equals(t.getProjectId()) ? true : false); }); }); + }else { + transferRightRatioResultDTOS.forEach(r -> { + r.setStatus(false); + }); } + Map> groupByGridProject = transferRightRatioResultDTOS.stream().collect(Collectors.groupingBy(TransferRightRatioResultDTO::getGridId)); + Map notReturnMap = new HashMap<>(16); + groupByGridProject.forEach((grid,project) -> { + AtomicReference count = new AtomicReference<>(NumConstant.ZERO); + project.forEach(p -> { + if (p.getStatus().equals(false)){ + count.getAndSet(count.get() + NumConstant.ONE); + } + }); + notReturnMap.put(grid,getRound(new BigDecimal(count.get()/project.size()).multiply(NumConstant.ONE_HUNDRED_DECIMAL))); + }); //网格内解决的项目的满意度 //项目评价(分值定义下非常满意100,满意80,不满意(一般)60)的人数的平均分(每个项目的参加人数的分数和/评论人数=一个项目的平均分)+其他项目得分/已关闭项目总数 List projectEvaluateList = projectLogService.selectProjectEvaluate(customerId, monthId); @@ -355,10 +366,10 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { }); } // 4. 网格吹哨部门准确率 - if (!CollectionUtils.isEmpty(notReturnProjectList)) { - notReturnProjectList.forEach(not -> { - if (r.getGridId().equals(not.getGridId())) { - r.setTransferRightRatio(not.getTransferRightRatio()); + if(notReturnMap != null){ + notReturnMap.forEach((grid,transferRightRatio) -> { + if (r.getGridId().equals(grid)){ + r.setTransferRightRatio(transferRightRatio); } }); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollDistrictDepartmentServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollDistrictDepartmentServiceImpl.java index 0a47c6d86a..328a7c694a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollDistrictDepartmentServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollDistrictDepartmentServiceImpl.java @@ -9,13 +9,11 @@ import com.epmet.dto.stats.DimDepartmentDTO; import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyEntity; import com.epmet.service.evaluationindex.extract.dataToIndex.IndexCollDistrictDepartmentService; import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectLogDailyService; -import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectMainDailyService; import com.epmet.service.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyService; -import com.epmet.service.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyService; import com.epmet.service.stats.DimDepartmentService; -import com.epmet.service.stats.FactArticlePublishedDepartmentDailyService; import com.epmet.util.DimIdGenerator; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -41,12 +39,6 @@ public class IndexCollDistrictDepartmentServiceImpl implements IndexCollDistrict private FactOriginProjectLogDailyService factOriginProjectLogDailyService; @Autowired private FactOriginProjectOrgPeriodDailyDao factOriginProjectOrgPeriodDailyDao; - @Autowired - private FactOriginProjectMainDailyService factOriginProjectMainDailyService; - @Autowired - private FactArticlePublishedDepartmentDailyService factArticlePublishedDepartmentDailyService; - @Autowired - private FactIndexPartyAblityOrgMonthlyService factIndexPartyAblityOrgMonthlyService; @Override public void saveDepartmentAbility(String customerId, String dateId) { @@ -97,10 +89,46 @@ public class IndexCollDistrictDepartmentServiceImpl implements IndexCollDistrict })); } - //TODO 区直部门办结项目满意度 暂时无法统计 + //办结项目数 办结率 + List closedList = factOriginProjectLogDailyService.getDeptClosedProject(customerId, dimId.getMonthId()); + if (CollectionUtils.isNotEmpty(closedList)) { + list.forEach(entity -> closedList.stream().filter(dto -> dto.getOrgId().equals(entity.getDeptId())).forEach(item -> { + entity.setClosedProjectCount(item.getCount()); + if (item.getSum() != NumConstant.ZERO) { + BigDecimal count = new BigDecimal(item.getCount()); + BigDecimal sum = new BigDecimal(item.getSum()); + entity.setClosedProjectRatio(count.divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + } + })); + } + + //部门办结项目满意度 + List satisfactions = factOriginProjectLogDailyService.getDeptSatisfaction(customerId, dimId.getMonthId()); + if (CollectionUtils.isNotEmpty(satisfactions)) { + list.forEach(entity -> satisfactions.stream().filter(dto -> dto.getOrgId().equals(entity.getDeptId())).forEach(item -> { + if (item.getCount() != NumConstant.ZERO) { + BigDecimal count = new BigDecimal(item.getCount()); + entity.setClosedProjectRatio(item.getRatio().divide(count, NumConstant.SIX, RoundingMode.HALF_UP)); + } + })); + } + + //部门办结项目的处理效率 + List handle = factOriginProjectOrgPeriodDailyDao.selectDeptHandle(customerId, dimId.getMonthId()); + if (CollectionUtils.isNotEmpty(handle)) { + list.forEach(entity -> handle.stream().filter(dto -> dto.getOrgId().equals(entity.getDeptId())).forEach(item -> { + if (item.getCount() != NumConstant.ZERO) { + BigDecimal count = new BigDecimal(item.getCount()); + BigDecimal sum = new BigDecimal(item.getSum()); + BigDecimal one = new BigDecimal(NumConstant.ONE); + entity.setClosedProjectRatio(one.divide(sum.divide(count), NumConstant.SIX, RoundingMode.HALF_UP)); + } + })); + } + factIndexGovrnAblityDeptMonthlyService.deleteByCustomer(customerId, dimId.getMonthId()); - factIndexGovrnAblityDeptMonthlyService.insertBatch(list); + factIndexGovrnAblityDeptMonthlyService.saveList(list); } } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java index dbedbb762d..d473e0aabe 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java @@ -20,10 +20,7 @@ package com.epmet.service.evaluationindex.extract.todata; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.extract.FactOriginProjectLogDailyDTO; -import com.epmet.dto.extract.result.OrgStatisticsResultDTO; -import com.epmet.dto.extract.result.AutoNoMyResultDTO; -import com.epmet.dto.extract.result.NotReturnProjectResultDTO; -import com.epmet.dto.extract.result.ProjectEvaluateResultDTO; +import com.epmet.dto.extract.result.*; import com.epmet.entity.evaluationindex.extract.FactOriginProjectLogDailyEntity; import java.math.BigDecimal; @@ -118,6 +115,8 @@ public interface FactOriginProjectLogDailyService extends BaseService selectNotReturnProject(String customerId,String monthId,String actionCode,String orgType); + List selectNotReturn(String customerId,String monthId); + /** * @Description 查询项目评价信息 * @param customerId @@ -239,4 +238,33 @@ public interface FactOriginProjectLogDailyService extends BaseService getOrgSatisfaction(String customerId, String monthId, String level); + /** + * 获取部门办结项目数 + * @author zhaoqifeng + * @date 2020/10/16 17:08 + * @param customerId + * @param monthId + * @return java.util.List + */ + List getDeptClosedProject(String customerId, String monthId); + + /** + * 部门办结项目满意度 + * @author zhaoqifeng + * @date 2020/10/16 17:50 + * @param customerId + * @param monthId + * @return java.util.List + */ + List getDeptSatisfaction(String customerId, String monthId); + + /** + * 网格结案率统计 + * @author zhaoqifeng + * @date 2020/10/19 11:58 + * @param customerId + * @param monthId + * @return java.util.List + */ + List getGridClosed(String customerId, String monthId); } \ No newline at end of file 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 956cd4a029..8f1c0631f7 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 @@ -22,6 +22,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.dto.extract.FactOriginProjectMainDailyDTO; import com.epmet.dto.extract.result.GridProjectClosedTotalResultDTO; import com.epmet.dto.extract.result.OrgStatisticsResultDTO; +import com.epmet.dto.extract.result.TransferRightRatioResultDTO; import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO; import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity; @@ -126,6 +127,8 @@ public interface FactOriginProjectMainDailyService extends BaseService selectGridClosedProject(String customerId,String monthId,String status); + List selectTransferRightRatio(String customerId,String monthId); + /** * 项目超期数 * @author zhaoqifeng diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectOrgPeriodDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectOrgPeriodDailyService.java index 2186274fe5..5820d9c2cf 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectOrgPeriodDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectOrgPeriodDailyService.java @@ -23,4 +23,14 @@ public interface FactOriginProjectOrgPeriodDailyService extends BaseService */ List getResponsiveness(String customerId, String monthId, String level, String orgType); + + /** + * 部门处理效率统计 + * @author zhaoqifeng + * @date 2020/10/19 9:38 + * @param customerId + * @param monthId + * @return java.util.List + */ + List getDeptHandle(String customerId, String monthId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java index d7c6a7e7de..ec1429618d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java @@ -126,6 +126,11 @@ public class FactOriginProjectLogDailyServiceImpl extends BaseServiceImpl selectNotReturn(String customerId,String monthId){ + return baseDao.selectNotReturn(customerId,monthId); + } + /** * @Description 查询项目评价信息 * @param customerId @@ -295,5 +300,47 @@ public class FactOriginProjectLogDailyServiceImpl extends BaseServiceImpl + * @author zhaoqifeng + * @date 2020/10/16 17:08 + */ + @Override + public List getDeptClosedProject(String customerId, String monthId) { + return baseDao.selectDeptClosedProject(customerId, monthId); + } + + /** + * 部门办结项目满意度 + * + * @param customerId + * @param monthId + * @return java.util.List + * @author zhaoqifeng + * @date 2020/10/16 17:50 + */ + @Override + public List getDeptSatisfaction(String customerId, String monthId) { + return baseDao.selectDeptSatisfaction(customerId, monthId); + } + + /** + * 网格结案率统计 + * + * @param customerId + * @param monthId + * @return java.util.List + * @author zhaoqifeng + * @date 2020/10/19 11:58 + */ + @Override + public List getGridClosed(String customerId, String monthId) { + return baseDao.selectGridClosed(customerId, monthId); + } + } \ No newline at end of file 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 4571862990..5ce0490463 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 @@ -30,6 +30,7 @@ import com.epmet.dao.evaluationindex.extract.FactOriginProjectMainDailyDao; import com.epmet.dto.extract.FactOriginProjectMainDailyDTO; import com.epmet.dto.extract.result.GridProjectClosedTotalResultDTO; import com.epmet.dto.extract.result.OrgStatisticsResultDTO; +import com.epmet.dto.extract.result.TransferRightRatioResultDTO; import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO; import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity; @@ -134,6 +135,11 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl selectTransferRightRatio(String customerId, String monthId){ + return baseDao.selectTransferRightRatio(customerId,monthId); + } + @Override public void deleteByDate(String customerId, String date) { baseDao.deleteByDate(customerId, date); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectOrgPeriodDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectOrgPeriodDailyServiceImpl.java index 2631b4ad50..df9d46479d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectOrgPeriodDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectOrgPeriodDailyServiceImpl.java @@ -23,4 +23,18 @@ public class FactOriginProjectOrgPeriodDailyServiceImpl extends BaseServiceImpl< public List getResponsiveness(String customerId, String monthId, String level, String orgType) { return baseDao.selectResponsiveness(customerId, monthId, level, orgType); } + + /** + * 部门处理效率统计 + * + * @param customerId + * @param monthId + * @return java.util.List + * @author zhaoqifeng + * @date 2020/10/19 9:38 + */ + @Override + public List getDeptHandle(String customerId, String monthId) { + return baseDao.selectDeptHandle(customerId, monthId); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/OrgRankExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/OrgRankExtractServiceImpl.java index 6c3a254c9d..4e7ecc27aa 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/OrgRankExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/OrgRankExtractServiceImpl.java @@ -101,15 +101,25 @@ public class OrgRankExtractServiceImpl implements OrgRankExtractService { )); } //结案率 结案数/项目数 - List abilityList = factIndexGovrnAblityGridMonthlyService.getGridByCustomer(customerId, monthId); - if (CollectionUtils.isNotEmpty(abilityList)) { - list.forEach(entity -> abilityList.stream().filter(item -> item.getGridId().equals(entity.getOrgId())).forEach(dto -> { - if (dto.getProjectTotal() != NumConstant.ZERO) { - BigDecimal total = new BigDecimal(dto.getProjectTotal()); - BigDecimal closed = new BigDecimal(dto.getResolveProjectCount()); - entity.setCloseProjectRatio(closed.multiply(hundred).divide(total, NumConstant.SIX, RoundingMode.HALF_UP)); +// List abilityList = factIndexGovrnAblityGridMonthlyService.getGridByCustomer(customerId, monthId); +// if (CollectionUtils.isNotEmpty(abilityList)) { +// list.forEach(entity -> abilityList.stream().filter(item -> item.getGridId().equals(entity.getOrgId())).forEach(dto -> { +// if (dto.getProjectTotal() != NumConstant.ZERO) { +// BigDecimal total = new BigDecimal(dto.getProjectTotal()); +// BigDecimal closed = new BigDecimal(dto.getResolveProjectCount()); +// entity.setCloseProjectRatio(closed.multiply(hundred).divide(total, NumConstant.SIX, RoundingMode.HALF_UP)); +// } +// +// })); +// } + List closed = factOriginProjectLogDailyService.getGridClosed(customerId, monthId); + if (CollectionUtils.isNotEmpty(closed)) { + list.forEach(entity -> closed.stream().filter(item -> item.getOrgId().equals(entity.getOrgId())).forEach(dto -> { + if (dto.getSum() != NumConstant.ZERO) { + BigDecimal sum = new BigDecimal(dto.getSum()); + BigDecimal count = new BigDecimal(dto.getCount()); + entity.setCloseProjectRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); } - })); } //满意率 满意和非常满意占比 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyService.java index bf8254d738..d2d25c7a6f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyService.java @@ -3,6 +3,8 @@ package com.epmet.service.evaluationindex.indexcoll; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyEntity; +import java.util.List; + /** * @author zhaoqifeng * @dscription @@ -18,4 +20,13 @@ public interface FactIndexGovrnAblityDeptMonthlyService extends BaseService list); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexGovrnAblityDeptMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexGovrnAblityDeptMonthlyServiceImpl.java index a8df14af94..896ca7c334 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexGovrnAblityDeptMonthlyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexGovrnAblityDeptMonthlyServiceImpl.java @@ -8,6 +8,8 @@ import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthl import com.epmet.service.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyService; import org.springframework.stereotype.Service; +import java.util.List; + /** * @author zhaoqifeng * @dscription @@ -21,4 +23,17 @@ public class FactIndexGovrnAblityDeptMonthlyServiceImpl extends BaseServiceImpl< public void deleteByCustomer(String customerId, String monthId) { baseDao.deleteFactIndexGovrnAblityDeptMonthly(customerId, monthId); } + + /** + * 批量插入 + * + * @param list + * @return void + * @author zhaoqifeng + * @date 2020/9/21 17:08 + */ + @Override + public void saveList(List list) { + insertBatch(list); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java index ec62793b66..cfa2dc941f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java @@ -1,7 +1,10 @@ package com.epmet.support.normalizing.batch; +import com.alibaba.fastjson.JSON; +import com.epmet.support.normalizing.BigDecimalScoreCalculator; import com.epmet.support.normalizing.Correlation; import com.epmet.support.normalizing.ScoreCalculator; +import com.epmet.support.normalizing.ScoreConstants; import java.math.BigDecimal; import java.math.RoundingMode; @@ -59,30 +62,28 @@ public class BatchScoreCalculator { String sampleId = vo.getSampleId(); //归一后的值 BigDecimal normalizeValue;// = scoreCalculator.normalize(getFinalSampleValue(vo.getSampleValue(), threshold)); - //如果不需要归一 则 直接value*权重 - if (idx.isScore()) { - normalizeValue = getFinalSampleValue(vo.getSampleValue(), threshold); - } else { - normalizeValue = scoreCalculator.normalize(getFinalSampleValue(vo.getSampleValue(), threshold)); - } - //反正切函数 [-pi/2,pi/2] - BigDecimal maxValue = idx.getScoreCalculator().getMaxValue(); - BigDecimal minValue = idx.getScoreCalculator().getMinValue(); + BigDecimal minScoreValue = idx.getScoreCalculator().getMinScore(); - if (maxValue.compareTo(minValue) == 0) { + BigDecimal maxScoreValue = idx.getScoreCalculator().getMaxScore(); + if (idx.getScoreCalculator().getMaxValue().compareTo(idx.getScoreCalculator().getMinValue()) == 0) { //*((max-min)/ (Math.PI/2))+min //Math.atan(new Double(vo.getSampleValue().toString()))* normalizeValue = new BigDecimal(Math.atan(new Double(getFinalSampleValue(vo.getSampleValue(), threshold).toString()))) .multiply( - (maxValue.subtract(minValue).divide(new BigDecimal(Math.PI / 2), 10, RoundingMode.UNNECESSARY))) + (maxScoreValue.subtract(minScoreValue).divide(new BigDecimal(Math.PI / 2), 10, RoundingMode.HALF_UP))) .add(minScoreValue).setScale(6, RoundingMode.HALF_UP); // if (scoreCalculator.getCorrelation().getCode().equals(Correlation.NEGATIVE)) { - normalizeValue = maxValue.subtract(normalizeValue); + normalizeValue = maxScoreValue.subtract(normalizeValue); + } + }else { + //如果不需要归一 则 直接value*权重 + if (idx.isScore()) { + normalizeValue = getFinalSampleValue(vo.getSampleValue(), threshold); + } else { + normalizeValue = scoreCalculator.normalize(getFinalSampleValue(vo.getSampleValue(), threshold)); } - } - BigDecimal score = normalizeValue.multiply(weight).setScale(6, RoundingMode.HALF_UP); CalculateResult result = scoreCountOfSamples.get(sampleId); @@ -120,4 +121,16 @@ public class BatchScoreCalculator { ? bdRealValue : threshold; } + + public static void main(String[] args) { + List indexInputVOS = new ArrayList<>(); + String jsonStr = "{\"allParentIndexCode\":\"quanquxiangguan:zhilinengli\",\"indexId\":\"suoyoujiedaozlnlpjz\",\"indexValueVOs\":[{\"sampleId\":\"7b6f9a9f9f38d5f9fa7ce94a93d6eb28\",\"sampleValue\":69.830369}],\"score\":true,\"scoreCalculator\":{\"coefficient\":0,\"correlation\":\"POSITIVE\",\"maxScore\":100,\"maxValue\":69.830369,\"minScore\":60,\"minValue\":69.830369},\"threshold\":-1.0000,\"weight\":0.8000}"; + IndexInputVO vo = JSON.parseObject(jsonStr, IndexInputVO.class); + BigDecimalScoreCalculator sc = new BigDecimalScoreCalculator(new BigDecimal("69.830369"), new BigDecimal("69.830369"), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(Correlation.POSITIVE.getCode())); + vo.setScoreCalculator(sc); + indexInputVOS.add(vo); + BatchScoreCalculator sc2 = new BatchScoreCalculator(); + HashMap scoreTotalOfSampleId = sc2.getScoreTotalOfSampleId(indexInputVOS); + System.out.println(JSON.toJSONString(scoreTotalOfSampleId)); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml index 86551a98e2..2db8a97d58 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml @@ -125,7 +125,6 @@ FROM fact_origin_project_log_daily fopld INNER JOIN dim_agency da ON fopld.AGENCY_ID = da.ID - AND da.`LEVEL` = #{level} WHERE fopld.IS_ACTIVE = 0 AND fopld.ACTION_CODE = 'transfer' @@ -425,4 +424,105 @@ GROUP BY AGENCY_ID + + + + + \ No newline at end of file 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 2b64effbfd..ec08e185d4 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 @@ -427,4 +427,15 @@ + + \ No newline at end of file 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 24f25703bb..d0b868f62f 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 @@ -54,7 +54,9 @@ FROM fact_origin_project_org_period_daily f INNER JOIN dim_agency da ON f.ORG_ID = da.ID + AND da.`LEVEL` = #{level} + WHERE f.ORG_TYPE = #{orgType} AND DATE_FORMAT(INFORMED_DATE, '%Y%m') = #{monthId} @@ -180,4 +182,21 @@ GROUP BY ORG_ID + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml index fdfc9a5c31..7b20671a99 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml @@ -60,7 +60,6 @@ FROM dim_department dd INNER JOIN dim_agency da ON dd.AGENCY_ID = da.ID - AND da.`LEVEL` = 'district' WHERE dd.CUSTOMER_ID = #{customerId}