Browse Source

Merge remote-tracking branch 'origin/dev_screen_data_2.0' into dev_screen_data_2.0

dev_shibei_match
wangchao 5 years ago
parent
commit
b458bfdfa0
  1. 21
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/TransferRightRatioResultDTO.java
  2. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  3. 33
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java
  4. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java
  5. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.java
  6. 43
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalGridIndexServiceImpl.java
  7. 50
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollDistrictDepartmentServiceImpl.java
  8. 36
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java
  9. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java
  10. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectOrgPeriodDailyService.java
  11. 47
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java
  12. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java
  13. 14
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectOrgPeriodDailyServiceImpl.java
  14. 26
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/OrgRankExtractServiceImpl.java
  15. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyService.java
  16. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexGovrnAblityDeptMonthlyServiceImpl.java
  17. 41
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java
  18. 102
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml
  19. 11
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml
  20. 19
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml
  21. 1
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml

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

13
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;

33
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<FactOriginProjectL
*/
List<NotReturnProjectResultDTO> selectNotReturnProject(@Param("customerId") String customerId,@Param("monthId") String monthId,@Param("actionCode") String actionCode,@Param("orgType") String orgType);
List<TransferRightRatioResultDTO> selectNotReturn(@Param("customerId")String customerId,@Param("monthId")String monthId);
/**
* @Description 查询项目评价信息
* @param customerId
@ -204,4 +206,35 @@ public interface FactOriginProjectLogDailyDao extends BaseDao<FactOriginProjectL
*/
List<OrgStatisticsResultDTO> 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<com.epmet.dto.extract.result.OrgStatisticsResultDTO>
*/
List<OrgStatisticsResultDTO> 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<com.epmet.dto.extract.result.OrgStatisticsResultDTO>
*/
List<OrgStatisticsResultDTO> 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<com.epmet.dto.extract.result.OrgStatisticsResultDTO>
*/
List<OrgStatisticsResultDTO> selectGridClosed(@Param("customerId") String customerId, @Param("monthId") String monthId);
}

3
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<FactOriginProject
*/
List<GridProjectClosedTotalResultDTO> selectGridClosedProject(@Param("customerId") String customerId,@Param("monthId") String monthId,@Param("status") String status);
List<TransferRightRatioResultDTO> selectTransferRightRatio(@Param("customerId")String customerId, @Param("monthId")String monthId);
/**
* 根据日期删除数据
* @author zhaoqifeng

10
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<FactOriginPr
* @date 2020.09.21 02:13
**/
List<OrgResponseTimeResultDTO> 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<com.epmet.dto.extract.result.OrgStatisticsResultDTO>
*/
List<OrgStatisticsResultDTO> selectDeptHandle(@Param("customerId") String customerId, @Param("monthId") String monthId);
}

43
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<GridProjectClosedTotalResultDTO> gridProjectClosedTotalList = projectMainService.selectGridClosedProject(customerId, monthId, ExtractConstant.CLOSE);
List<GridProjectClosedTotalResultDTO> gridProjectClosedTotalList = projectMainService.selectGridClosedProject(customerId, monthId, ExtractConstant.CLOSED);
//网格吹哨部门准确率 【没被退回的项目数/项目总数 】
List<NotReturnProjectResultDTO> 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<TransferRightRatioResultDTO> transferRightRatioResultDTOS = projectMainService.selectTransferRightRatio(customerId, monthId);
List<TransferRightRatioResultDTO> 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<String, List<TransferRightRatioResultDTO>> groupByGridProject = transferRightRatioResultDTOS.stream().collect(Collectors.groupingBy(TransferRightRatioResultDTO::getGridId));
Map<String,BigDecimal> notReturnMap = new HashMap<>(16);
groupByGridProject.forEach((grid,project) -> {
AtomicReference<Integer> 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<ProjectEvaluateResultDTO> 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);
}
});
}

50
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<OrgStatisticsResultDTO > 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<OrgStatisticsResultDTO > 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<OrgStatisticsResultDTO > 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);
}
}
}

36
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<FactOrigin
*/
List<NotReturnProjectResultDTO> selectNotReturnProject(String customerId,String monthId,String actionCode,String orgType);
List<TransferRightRatioResultDTO> selectNotReturn(String customerId,String monthId);
/**
* @Description 查询项目评价信息
* @param customerId
@ -239,4 +238,33 @@ public interface FactOriginProjectLogDailyService extends BaseService<FactOrigin
*/
List<OrgStatisticsResultDTO> getOrgSatisfaction(String customerId, String monthId, String level);
/**
* 获取部门办结项目数
* @author zhaoqifeng
* @date 2020/10/16 17:08
* @param customerId
* @param monthId
* @return java.util.List<com.epmet.dto.extract.result.OrgStatisticsResultDTO>
*/
List<OrgStatisticsResultDTO> getDeptClosedProject(String customerId, String monthId);
/**
* 部门办结项目满意度
* @author zhaoqifeng
* @date 2020/10/16 17:50
* @param customerId
* @param monthId
* @return java.util.List<com.epmet.dto.extract.result.OrgStatisticsResultDTO>
*/
List<OrgStatisticsResultDTO> getDeptSatisfaction(String customerId, String monthId);
/**
* 网格结案率统计
* @author zhaoqifeng
* @date 2020/10/19 11:58
* @param customerId
* @param monthId
* @return java.util.List<com.epmet.dto.extract.result.OrgStatisticsResultDTO>
*/
List<OrgStatisticsResultDTO> getGridClosed(String customerId, String monthId);
}

3
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<FactOrigi
*/
List<GridProjectClosedTotalResultDTO> selectGridClosedProject(String customerId,String monthId,String status);
List<TransferRightRatioResultDTO> selectTransferRightRatio(String customerId,String monthId);
/**
* 项目超期数
* @author zhaoqifeng

10
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<Fact
* @return java.util.List<com.epmet.dto.extract.result.OrgStatisticsResultDTO>
*/
List<OrgStatisticsResultDTO> 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<com.epmet.dto.extract.result.OrgStatisticsResultDTO>
*/
List<OrgStatisticsResultDTO> getDeptHandle(String customerId, String monthId);
}

47
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<FactOr
return baseDao.selectNotReturnProject(customerId, monthId, actionCode, orgType);
}
@Override
public List<TransferRightRatioResultDTO> selectNotReturn(String customerId,String monthId){
return baseDao.selectNotReturn(customerId,monthId);
}
/**
* @Description 查询项目评价信息
* @param customerId
@ -295,5 +300,47 @@ public class FactOriginProjectLogDailyServiceImpl extends BaseServiceImpl<FactOr
return baseDao.selectOrgSatisfaction(customerId, monthId, level);
}
/**
* 获取部门办结项目数
*
* @param customerId
* @param monthId
* @return java.util.List<com.epmet.dto.extract.result.OrgStatisticsResultDTO>
* @author zhaoqifeng
* @date 2020/10/16 17:08
*/
@Override
public List<OrgStatisticsResultDTO> getDeptClosedProject(String customerId, String monthId) {
return baseDao.selectDeptClosedProject(customerId, monthId);
}
/**
* 部门办结项目满意度
*
* @param customerId
* @param monthId
* @return java.util.List<com.epmet.dto.extract.result.OrgStatisticsResultDTO>
* @author zhaoqifeng
* @date 2020/10/16 17:50
*/
@Override
public List<OrgStatisticsResultDTO> getDeptSatisfaction(String customerId, String monthId) {
return baseDao.selectDeptSatisfaction(customerId, monthId);
}
/**
* 网格结案率统计
*
* @param customerId
* @param monthId
* @return java.util.List<com.epmet.dto.extract.result.OrgStatisticsResultDTO>
* @author zhaoqifeng
* @date 2020/10/19 11:58
*/
@Override
public List<OrgStatisticsResultDTO> getGridClosed(String customerId, String monthId) {
return baseDao.selectGridClosed(customerId, monthId);
}
}

6
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<FactO
return baseDao.selectGridClosedProject(customerId, monthId,status);
}
@Override
public List<TransferRightRatioResultDTO> selectTransferRightRatio(String customerId, String monthId){
return baseDao.selectTransferRightRatio(customerId,monthId);
}
@Override
public void deleteByDate(String customerId, String date) {
baseDao.deleteByDate(customerId, date);

14
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<OrgStatisticsResultDTO> getResponsiveness(String customerId, String monthId, String level, String orgType) {
return baseDao.selectResponsiveness(customerId, monthId, level, orgType);
}
/**
* 部门处理效率统计
*
* @param customerId
* @param monthId
* @return java.util.List<com.epmet.dto.extract.result.OrgStatisticsResultDTO>
* @author zhaoqifeng
* @date 2020/10/19 9:38
*/
@Override
public List<OrgStatisticsResultDTO> getDeptHandle(String customerId, String monthId) {
return baseDao.selectDeptHandle(customerId, monthId);
}
}

26
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<FactIndexGovrnAblityGridMonthlyEntity> 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<FactIndexGovrnAblityGridMonthlyEntity> 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<OrgStatisticsResultDTO> 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));
}
}));
}
//满意率 满意和非常满意占比

11
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<Fact
* @return void
*/
void deleteByCustomer(String customerId, String monthId);
/**
* 批量插入
* @author zhaoqifeng
* @date 2020/9/21 17:08
* @param list
* @return void
*/
void saveList(List<FactIndexGovrnAblityDeptMonthlyEntity> list);
}

15
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<FactIndexGovrnAblityDeptMonthlyEntity> list) {
insertBatch(list);
}
}

41
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<IndexInputVO> 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<String, CalculateResult> scoreTotalOfSampleId = sc2.getScoreTotalOfSampleId(indexInputVOS);
System.out.println(JSON.toJSONString(scoreTotalOfSampleId));
}
}

102
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
</select>
<select id="selectDeptClosedProject" resultType="com.epmet.dto.extract.result.OrgStatisticsResultDTO">
SELECT
a.ORG_ID,
a.count AS "sum",
IFNULL(b.count,0) AS "count"
FROM
(SELECT
ORG_ID,
COUNT( ID ) AS "count"
FROM
fact_origin_project_log_daily
WHERE
ORG_TYPE = 'department'
AND IS_ACTIVE = '0'
AND CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}
GROUP BY
ORG_ID) a
LEFT JOIN
(SELECT
ORG_ID,
COUNT( ID ) AS "count"
FROM
fact_origin_project_log_daily
WHERE
ORG_TYPE = 'department'
AND ACTION_CODE = 'close'
AND CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}
GROUP BY
ORG_ID) b ON a.ORG_ID = b.ORG_ID
</select>
<select id="selectDeptSatisfaction" resultType="com.epmet.dto.extract.result.OrgStatisticsResultDTO">
SELECT
ORG_ID,
COUNT( a.PROJECT_ID ) AS "count",
SUM( IFNULL( b.score, 80 ) ) AS "ratio"
FROM
(SELECT
ORG_ID,
PROJECT_ID
FROM
fact_origin_project_log_daily
WHERE
ORG_TYPE = 'department'
AND ACTION_CODE = 'close'
AND CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}) a
LEFT JOIN
(SELECT
PROJECT_ID,
AVG( CASE ACTION_CODE WHEN 'bad' THEN 60 WHEN 'perfect' THEN 100 ELSE 80 END ) AS score
FROM
fact_origin_project_log_daily
WHERE
( ACTION_CODE = 'bad' OR ACTION_CODE = 'good' OR ACTION_CODE = 'perfect' )
AND CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}
GROUP BY
PROJECT_ID) b ON a.PROJECT_ID = b.PROJECT_ID
GROUP BY ORG_ID
</select>
<select id="selectGridClosed" resultType="com.epmet.dto.extract.result.OrgStatisticsResultDTO">
SELECT
a.ORG_ID,
a.count AS "sum",
IFNULL(b.count,0)AS "count"
FROM
(SELECT ORG_ID,
COUNT(DISTINCT PROJECT_ID) AS "count"
FROM fact_origin_project_log_daily
WHERE( ACTION_CODE = 'created' OR ACTION_CODE = 'transfer')
AND IS_ACTIVE = 0
AND ORG_TYPE = 'grid'
AND CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}
GROUP BY ORG_ID) a
LEFT JOIN
(SELECT fl.ORG_ID,
COUNT(DISTINCT fl.PROJECT_ID) AS "count"
FROM fact_origin_project_log_daily fl
INNER JOIN fact_origin_project_main_daily fm ON fl.PROJECT_ID = fm.ID AND fm.PROJECT_STATUS = 'closed'
WHERE( fl.ACTION_CODE = 'created' OR fl.ACTION_CODE = 'transfer')
AND fl.IS_ACTIVE = 0
AND fl.ORG_TYPE = 'grid'
AND fl.CUSTOMER_ID = #{customerId}
AND fl.MONTH_ID = #{monthId}
GROUP BY fl.ORG_ID) b ON a.ORG_ID = b.ORG_ID
</select>
<select id="selectNotReturn" resultType="com.epmet.dto.extract.result.TransferRightRatioResultDTO">
SELECT
DISTINCT(PROJECT_ID) AS projectId
FROM
fact_origin_project_log_daily
WHERE
ORG_TYPE = 'grid'
AND ACTION_CODE != 'return'
AND CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}
</select>
</mapper>

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

@ -427,4 +427,15 @@
</foreach>
</if>
</select>
<select id="selectTransferRightRatio" resultType="com.epmet.dto.extract.result.TransferRightRatioResultDTO">
SELECT
ID as projectId,
GRID_ID
FROM
fact_origin_project_main_daily
WHERE
CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}
</select>
</mapper>

19
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
<if test='"dept" != orgType'>
AND da.`LEVEL` = #{level}
</if>
WHERE
f.ORG_TYPE = #{orgType}
AND DATE_FORMAT(INFORMED_DATE, '%Y%m') = #{monthId}
@ -180,4 +182,21 @@
GROUP BY ORG_ID
</select>
<select id="selectDeptHandle" resultType="com.epmet.dto.extract.result.OrgStatisticsResultDTO">
SELECT
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"
FROM
fact_origin_project_org_period_daily fp
INNER JOIN fact_origin_project_main_daily fm ON fp.PROJECT_ID = fm.ID
AND fm.PROJECT_STATUS = 'closed'
WHERE
fp.ORG_TYPE = 'dept'
AND fp.CUSTOMER_ID = #{customerId}
AND fm.MONTH_ID = #{monthId}
GROUP BY
fp.ORG_ID
</select>
</mapper>

1
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}
</select>

Loading…
Cancel
Save