Browse Source

Merge remote-tracking branch 'remotes/origin/dev_screen_data' into dev_temp

dev_shibei_match
jianjun 5 years ago
parent
commit
2461dac20b
  1. 1
      epmet-gateway/src/main/resources/bootstrap.yml
  2. 12
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/GridProjectCountRankResultDTO.java
  3. 14
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/GridProjectCountResultDTO.java
  4. 9
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/ProjectAvgClosedTimeResultDTO.java
  5. 10
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/ProjectCategoryAnalysisResultDTO.java
  6. 23
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/ProjectSatisfaction.java
  7. 17
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/ProjectSummaryResultDTO.java
  8. 19
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/test/TestController.java
  9. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java
  10. 67
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java
  11. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java
  12. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcProjectCategoryGridDailyDao.java
  13. 10
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcProjectSummaryGridDailyDao.java
  14. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java
  15. 15
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java
  16. 10
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java
  17. 43
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java
  18. 10
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml
  19. 8
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataYearlyDao.xml
  20. 15
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcProjectCategoryGridDailyDao.xml
  21. 50
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcProjectSummaryGridDailyDao.xml
  22. 2
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcTopicTrendGridMonthlyDao.xml
  23. 32
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcVolunteerSummaryDailyDao.xml
  24. 2
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/IndexCalConstant.java
  25. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java
  26. 77
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/eum/IndexCodeEnum.java
  27. 55
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java
  28. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java
  29. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java
  30. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java
  31. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java
  32. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java
  33. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java
  34. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/IndexInputVO.java
  35. 28
      epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java

1
epmet-gateway/src/main/resources/bootstrap.yml

@ -442,6 +442,7 @@ epmet:
urlWhiteList:
- /data/report/test/test
- /data/report/screen/**
- /data/report/screenkc/**
- /epmetuser/customerstaff/customerlist
swaggerUrls:

12
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/GridProjectCountRankResultDTO.java

@ -0,0 +1,12 @@
package com.epmet.dto.result.project;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class GridProjectCountRankResultDTO {
private List<String> gridNameDataList = new ArrayList<>();
private List<Integer> projectCountDataList = new ArrayList<>();
}

14
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/GridProjectCountResultDTO.java

@ -0,0 +1,14 @@
package com.epmet.dto.result.project;
import lombok.Data;
import java.util.List;
@Data
public class GridProjectCountResultDTO {
private String gridId;
private String gridName;
private Integer projectCount;
}

9
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/ProjectAvgClosedTimeResultDTO.java

@ -0,0 +1,9 @@
package com.epmet.dto.result.project;
import lombok.Data;
@Data
public class ProjectAvgClosedTimeResultDTO {
private String gridName;
private Integer avgClosedCaseTime;
}

10
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/ProjectCategoryAnalysisResultDTO.java

@ -0,0 +1,10 @@
package com.epmet.dto.result.project;
import lombok.Data;
@Data
public class ProjectCategoryAnalysisResultDTO {
private String categoryId;
private String categoryName;
private Integer projectCount;
}

23
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/ProjectSatisfaction.java

@ -0,0 +1,23 @@
package com.epmet.dto.result.project;
import lombok.Data;
import java.util.List;
@Data
public class ProjectSatisfaction {
private List<String> xAxis;
private List<Integer> greatSatisDataList;
private List<Integer> goodStatisDataList;
private List<Integer> disStatisDataList;
private String monthId;
private String monthName;
// 满意
private Integer goodSatis;
// 非常满意
private Integer greatSatis;
// 不满意
private Integer disSatis;
}

17
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/ProjectSummaryResultDTO.java

@ -0,0 +1,17 @@
package com.epmet.dto.result.project;
import lombok.Data;
@Data
public class ProjectSummaryResultDTO {
private String dateId;
private Integer projectCount;
private Integer processingCount;
private Integer closedCount;
private Integer moveCount;
private Integer closedCaseCount;
private Integer projectViewCount;
private Integer voteCount;
}

19
epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/test/TestController.java

@ -1,19 +0,0 @@
package com.epmet.controller.test;
import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth;
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.commons.tools.utils.Result;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("test")
public class TestController {
@ExternalAppRequestAuth
@RequestMapping("/test")
public Result test(ExternalAppRequestParam externalAppRequestParam, String ext) {
return new Result().ok("调用成功,客户信息:"+externalAppRequestParam);
}
}

2
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java

@ -67,8 +67,8 @@ public class IndexController {
}
/**
* @Description 4下级部门指数排行
* @param subAgencyIndexRankFormDTO
* @Description 4下级组织/部门指数排行 (不包含部门的数据)
* @author zxc
* @date 2020/8/20 10:02 上午
*/

67
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java

@ -6,6 +6,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.evaluationindex.screen.KcScreenService;
import com.epmet.dto.result.issue.IssueGridTotalRankDTO;
import com.epmet.dto.result.project.*;
import com.epmet.evaluationindex.screen.dto.form.GroupTopicShiftIssueRatioRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.GroupUserCountRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.HeartVolunteerrankFormDTO;
@ -219,5 +220,71 @@ public class KcScreenController {
return new Result<List<GroupTopicShiftIssueRatioRankResultDTO>>().ok(kcScreenService.groupTopicShiftIssueRatioRank(formDTO));
}
/**
* 项目各类总数汇总
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("project/summary")
public Result<ProjectSummaryResultDTO> getProjectSummary(ExternalAppRequestParam externalAppRequestParam){
//String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933";
String customerId = externalAppRequestParam.getCustomerId();
return new Result<ProjectSummaryResultDTO>().ok(kcScreenService.getProjectSummary(customerId));
}
/**
* 项目分析-网格下项目数量排名
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("project/gridcountrank")
public Result<GridProjectCountRankResultDTO> getProjectGridCountRank(ExternalAppRequestParam externalAppRequestParam){
//String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933";
String customerId = externalAppRequestParam.getCustomerId();
return new Result<GridProjectCountRankResultDTO>().ok(kcScreenService.getGridProjectCountRank(customerId));
}
/**
* 项目分析-项目类别
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("project/categoryanalysis")
public Result<List<ProjectCategoryAnalysisResultDTO>> getProjectCategoryAnalysis(ExternalAppRequestParam externalAppRequestParam){
//String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933";
String customerId = externalAppRequestParam.getCustomerId();
return new Result<List<ProjectCategoryAnalysisResultDTO>>().ok(kcScreenService.getProjectCategoryAnalysis(customerId));
}
/**
* 网格项目平均结案时间
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("project/avgclosedtimeanalysis")
public Result<List<ProjectAvgClosedTimeResultDTO>> getGridProjectAvgClosedTimeAnalysis(ExternalAppRequestParam externalAppRequestParam){
//String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933";
String customerId = externalAppRequestParam.getCustomerId();
return new Result<List<ProjectAvgClosedTimeResultDTO>>().ok(kcScreenService.getGridProjectAvgClosedTimeAnalysis(customerId));
}
/**
* 项目分析-居民满意度
* @param externalAppRequestParam
* @return
*/
//@ExternalAppRequestAuth
@PostMapping("project/statis")
public Result<ProjectSatisfaction> getProjectSatisfactionAnalyze(ExternalAppRequestParam externalAppRequestParam){
String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933";
//String customerId = externalAppRequestParam.getCustomerId();
return new Result<ProjectSatisfaction>().ok(kcScreenService.getProjectSatisfactionAnalyze(customerId));
}
}

2
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java

@ -54,8 +54,8 @@ public interface ScreenIndexDataMonthlyDao{
List<MonthBarchartResult> selectMonthBarchart(@Param("agencyId")String agencyId);
/**
* @Description 4下级部门指数排行
* @param subAgencyIndexRankFormDTO
* @Description 4下级组织/部门指数排行 (不包含部门的数据)
* @author zxc
* @date 2020/8/20 10:04 上午
*/

4
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcProjectCategoryGridDailyDao.java

@ -17,8 +17,11 @@
package com.epmet.datareport.dao.evaluationindex.screenkc;
import com.epmet.dto.result.project.ProjectCategoryAnalysisResultDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* KC-项目按分类统计上报总数(先根据customerId+dateId删除)
*
@ -28,4 +31,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ScreenKcProjectCategoryGridDailyDao {
List<ProjectCategoryAnalysisResultDTO> listProjectCountGroupByCategory(String customerId);
}

10
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcProjectSummaryGridDailyDao.java

@ -17,8 +17,13 @@
package com.epmet.datareport.dao.evaluationindex.screenkc;
import com.epmet.dto.result.project.GridProjectCountResultDTO;
import com.epmet.dto.result.project.ProjectAvgClosedTimeResultDTO;
import com.epmet.dto.result.project.ProjectSummaryResultDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* KC-项目分析(各类总数先根据customerId+dateId删除后插入)
*
@ -28,4 +33,9 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ScreenKcProjectSummaryGridDailyDao {
List<GridProjectCountResultDTO> getGridProjectCountRank(String customerId);
ProjectSummaryResultDTO getProjectSummary(String customerId);
List<ProjectAvgClosedTimeResultDTO> getGridProjectAvgClosedTimeAnalysis(String customerId);
}

2
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java

@ -38,8 +38,8 @@ public interface IndexService {
MonthBarchartResultDTO monthBarchart(MonthBarchartFormDTO monthBarchartFormDTO);
/**
* @Description 4下级部门指数排行
* @param subAgencyIndexRankFormDTO
* @Description 4下级组织/部门指数排行 (不包含部门的数据)
* @author zxc
* @date 2020/8/20 10:04 上午
*/

15
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java

@ -2,6 +2,7 @@ package com.epmet.datareport.service.evaluationindex.screen;
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.dto.result.issue.*;
import com.epmet.dto.result.project.*;
import com.epmet.evaluationindex.screen.dto.form.GroupTopicShiftIssueRatioRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.GroupUserCountRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.HeartVolunteerrankFormDTO;
@ -98,4 +99,18 @@ public interface KcScreenService {
* @author sun
*/
List<GroupTopicShiftIssueRatioRankResultDTO> groupTopicShiftIssueRatioRank(GroupTopicShiftIssueRatioRankFormDTO formDTO);
/**
* 项目各类总数
* @param customerId
* @return
*/
ProjectSummaryResultDTO getProjectSummary(String customerId);
GridProjectCountRankResultDTO getGridProjectCountRank(String customerId);
List<ProjectCategoryAnalysisResultDTO> getProjectCategoryAnalysis(String customerId);
List<ProjectAvgClosedTimeResultDTO> getGridProjectAvgClosedTimeAnalysis(String customerId);
ProjectSatisfaction getProjectSatisfactionAnalyze(String customerId);
}

10
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java

@ -57,7 +57,7 @@ public class IndexServiceImpl implements IndexService {
yearAverageIndexResultDTO.setPartyDevAbility(getRound(yearAverageIndexResultDTO.getPartyDevAbility()));
yearAverageIndexResultDTO.setGovernAbility(getRound(yearAverageIndexResultDTO.getGovernAbility()));
yearAverageIndexResultDTO.setServiceAbility(getRound(yearAverageIndexResultDTO.getServiceAbility()));
yearAverageIndexResultDTO.setYearAverageIndex(getRound(yearAverageIndexResultDTO.getYearAverageIndex()));
yearAverageIndexResultDTO.setYearAverageIndex(yearAverageIndexResultDTO.getPartyDevAbility() + yearAverageIndexResultDTO.getGovernAbility() + yearAverageIndexResultDTO.getServiceAbility());
return yearAverageIndexResultDTO;
}
@ -126,7 +126,7 @@ public class IndexServiceImpl implements IndexService {
barchart.setPartyDevAbility(getRound(barchart.getPartyDevAbility()));
barchart.setGovernAbility(getRound(barchart.getGovernAbility()));
barchart.setServiceAbility(getRound(barchart.getServiceAbility()));
barchart.setIndexTotal(getRound(barchart.getIndexTotal()));
barchart.setIndexTotal(barchart.getPartyDevAbility() + barchart.getGovernAbility() + barchart.getServiceAbility());
});
List<MonthBarchartResult> collect = monthBarchartResults.stream().sorted(Comparator.comparing(MonthBarchartResult::getMonthId)).collect(Collectors.toList());
//升序 当前月份在队尾
@ -179,8 +179,8 @@ public class IndexServiceImpl implements IndexService {
}
/**
* @Description 4下级部门指数排行
* @param subAgencyIndexRankFormDTO
* @Description 4下级组织/部门指数排行 (不包含部门的数据)
* @author zxc
* @date 2020/8/20 10:04 上午
*/
@ -199,7 +199,7 @@ public class IndexServiceImpl implements IndexService {
indexRank.setPartyDevAbility(getRound(indexRank.getPartyDevAbility()));
indexRank.setGovernAbility(getRound(indexRank.getGovernAbility()));
indexRank.setServiceAbility(getRound(indexRank.getServiceAbility()));
indexRank.setTotalIndex(getRound(indexRank.getTotalIndex()));
indexRank.setTotalIndex(indexRank.getPartyDevAbility() + indexRank.getGovernAbility() + indexRank.getServiceAbility());
});
return subAgencyIndexRankResultDTOS;
}
@ -218,7 +218,7 @@ public class IndexServiceImpl implements IndexService {
rank.setPartyDevAbility(getRound(rank.getPartyDevAbility()));
rank.setGovernAbility(getRound(rank.getGovernAbility()));
rank.setServiceAbility(getRound(rank.getServiceAbility()));
rank.setTotalIndex(getRound(rank.getTotalIndex()));
rank.setTotalIndex(rank.getPartyDevAbility() + rank.getGovernAbility() + rank.getServiceAbility());
});
}
return subAgencyIndexRankResultDTOS;

43
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java

@ -8,6 +8,7 @@ import com.epmet.datareport.dao.evaluationindex.screenkc.*;
import com.epmet.datareport.service.evaluationindex.screen.KcScreenService;
import com.epmet.datareport.utils.DateUtils;
import com.epmet.dto.result.issue.*;
import com.epmet.dto.result.project.*;
import com.epmet.evaluationindex.screen.dto.form.GroupTopicShiftIssueRatioRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.GroupUserCountRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.HeartVolunteerrankFormDTO;
@ -15,8 +16,6 @@ import com.epmet.evaluationindex.screen.dto.result.*;
import com.epmet.evaluationindex.screen.dto.result.HomepageSummaryResultDTO;
import com.epmet.dto.result.issue.KcIssueSummary;
import com.epmet.dto.result.issue.KcPartiTrendResultDTO;
import com.epmet.evaluationindex.screen.dto.form.HeartVolunteerrankFormDTO;
import com.epmet.evaluationindex.screen.dto.result.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -63,6 +62,15 @@ public class KcScreenServiceImpl implements KcScreenService {
@Autowired
private ScreenKcGroupDetailGridDailyDao screenKcGroupDetailGridDailyDao;
@Autowired
private ScreenKcProjectSummaryGridDailyDao screenKcProjectSummaryGridDailyDao;
@Autowired
private ScreenKcProjectCategoryGridDailyDao screenKcProjectCategoryGridDailyDao;
@Autowired
private ScreenKcProjectSummaryGridDailyDao projectSummaryGridDailyDao;
/**
* @param externalAppRequestParam
* @Description 首页-平台各类总数
@ -284,4 +292,35 @@ public class KcScreenServiceImpl implements KcScreenService {
return list;
}
@Override
public ProjectSummaryResultDTO getProjectSummary(String customerId) {
return projectSummaryGridDailyDao.getProjectSummary(customerId);
}
@Override
public GridProjectCountRankResultDTO getGridProjectCountRank(String customerId) {
List<GridProjectCountResultDTO> gridCounts = screenKcProjectSummaryGridDailyDao.getGridProjectCountRank(customerId);
GridProjectCountRankResultDTO rankResult = new GridProjectCountRankResultDTO();
gridCounts.stream().forEach(gc -> {
rankResult.getGridNameDataList().add(gc.getGridName());
rankResult.getProjectCountDataList().add(gc.getProjectCount());
});
return rankResult;
}
@Override
public List<ProjectCategoryAnalysisResultDTO> getProjectCategoryAnalysis(String customerId) {
return screenKcProjectCategoryGridDailyDao.listProjectCountGroupByCategory(customerId);
}
@Override
public List<ProjectAvgClosedTimeResultDTO> getGridProjectAvgClosedTimeAnalysis(String customerId) {
return screenKcProjectSummaryGridDailyDao.getGridProjectAvgClosedTimeAnalysis(customerId);
}
@Override
public ProjectSatisfaction getProjectSatisfactionAnalyze(String customerId) {
return null;
}
}

10
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml

@ -32,8 +32,7 @@
month_id AS monthId,
service_ablity * SERVICE_ABLITY_WEIGHT AS serviceAbility,
party_dev_ablity * PARTY_DEV_WEIGHT AS partyDevAbility,
govern_ablity * GOVERN_ABLITY_WEIGHT AS governAbility,
(service_ablity * SERVICE_ABLITY_WEIGHT + party_dev_ablity * PARTY_DEV_WEIGHT + govern_ablity * GOVERN_ABLITY_WEIGHT) AS indexTotal
govern_ablity * GOVERN_ABLITY_WEIGHT AS governAbility
FROM
screen_index_data_monthly
WHERE
@ -43,11 +42,10 @@
LIMIT 12
</select>
<!-- 下级部门指数排行 -->
<!-- 下级组织/部门指数排行 (不包含部门的数据) -->
<select id="selectSubAgencyIndexRank" parameterType="com.epmet.evaluationindex.screen.dto.form.SubAgencyIndexRankFormDTO" resultType="com.epmet.evaluationindex.screen.dto.result.SubAgencyIndexRankResultDTO">
SELECT
org_name AS NAME,
index_total AS totalIndex,
govern_ablity AS governAbility,
party_dev_ablity AS partyDevAbility,
service_ablity AS serviceAbility
@ -57,6 +55,7 @@
del_flag = '0'
AND parent_id = #{agencyId}
AND year_id = #{yearId}
AND ORG_TYPE != 'department'
ORDER BY index_total DESC
LIMIT #{topNum}
</select>
@ -68,8 +67,7 @@
org_name AS `NAME`,
service_ablity * SERVICE_ABLITY_WEIGHT AS serviceAbility,
party_dev_ablity * PARTY_DEV_WEIGHT AS partyDevAbility,
govern_ablity * GOVERN_ABLITY_WEIGHT AS governAbility,
(service_ablity * SERVICE_ABLITY_WEIGHT + party_dev_ablity * PARTY_DEV_WEIGHT + govern_ablity * GOVERN_ABLITY_WEIGHT) AS totalIndex,
govern_ablity * GOVERN_ABLITY_WEIGHT AS governAbility
ORG_ID orgId
FROM
screen_index_data_monthly

8
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataYearlyDao.xml

@ -6,7 +6,6 @@
<!-- 1、年度平均指数 -->
<select id="selectYearAverageIndex" resultType="com.epmet.evaluationindex.screen.dto.result.YearAverageIndexResultDTO">
SELECT
index_total AS yearAverageIndex,
service_ablity AS serviceAbility,
party_dev_ablity AS partyDevAbility,
govern_ablity AS governAbility
@ -24,10 +23,9 @@
resultType="com.epmet.evaluationindex.screen.dto.result.AnNingSubAgencyIndexRankResultDTO">
SELECT
org_name AS `NAME`,
ROUND(index_total, 1) AS totalIndex,
ROUND(govern_ablity, 1) AS governAbility,
ROUND(party_dev_ablity, 1) AS partyDevAbility,
ROUND(service_ablity, 1) AS serviceAbility,
govern_ablity AS governAbility,
party_dev_ablity AS partyDevAbility,
service_ablity AS serviceAbility,
ORG_ID orgId
FROM
screen_index_data_yearly

15
epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcProjectCategoryGridDailyDao.xml

@ -4,4 +4,19 @@
<mapper namespace="com.epmet.datareport.dao.evaluationindex.screenkc.ScreenKcProjectCategoryGridDailyDao">
<select id="listProjectCountGroupByCategory"
resultType="com.epmet.dto.result.project.ProjectCategoryAnalysisResultDTO">
select CATEGORY_ID categoryId,
CATEGORY_NAME categoryName,
sum(pcd.PROJECT_COUNT) projectCount
from screen_kc_project_category_grid_daily pcd
inner join (
select t.CUSTOMER_ID, max(DATE_ID) MAX_DATE_ID
from screen_kc_project_category_grid_daily t
where CUSTOMER_ID = #{customerId}
) latest on (pcd.CUSTOMER_ID = latest.CUSTOMER_ID and pcd.DATE_ID = latest.MAX_DATE_ID)
where pcd.DEL_FLAG = 0
group by CATEGORY_ID
order by projectCount desc;
</select>
</mapper>

50
epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcProjectSummaryGridDailyDao.xml

@ -3,4 +3,54 @@
<mapper namespace="com.epmet.datareport.dao.evaluationindex.screenkc.ScreenKcProjectSummaryGridDailyDao">
<!--项目各类总数-->
<select id="getProjectSummary" resultType="com.epmet.dto.result.project.ProjectSummaryResultDTO">
select SUM(PROJECT_COUNT) projectCount,
SUM(PROCESSING_COUNT) processingCount,
SUM(CLOSED_COUNT) closedCount,
SUM(MOVE_COUNT) moveCount,
SUM(CLOSED_CASE_COUNT) closedCaseCount,
SUM(PROJECT_VIEW_COUNT) projectViewCount,
SUM(VOTE_COUNT) voteCount,
DATE_ID dateId
from screen_kc_project_summary_grid_daily psd
inner join (
select CUSTOMER_ID, max(DATE_ID) MAX_DATE_ID
from screen_kc_project_summary_grid_daily
where CUSTOMER_ID = #{customerId}
) latest on (psd.CUSTOMER_ID = latest.CUSTOMER_ID and psd.DATE_ID = latest.MAX_DATE_ID)
where DEL_FLAG = 0
</select>
<!--网格议题数量排名-->
<select id="getGridProjectCountRank" resultType="com.epmet.dto.result.project.GridProjectCountResultDTO">
select
psd.GRID_ID gridId,
psd.GRID_NAME gridName,
psd.PROJECT_COUNT projectCount
from screen_kc_project_summary_grid_daily psd
inner join (
select CUSTOMER_ID, max(DATE_ID) MAX_DATE_ID
from screen_kc_project_summary_grid_daily
where CUSTOMER_ID = #{customerId}
) latest on (psd.CUSTOMER_ID = latest.CUSTOMER_ID and psd.DATE_ID = latest.MAX_DATE_ID)
where DEL_FLAG = 0
order by psd.PROJECT_COUNT desc
</select>
<!--网格的项目平均结案时间分析-->
<select id="getGridProjectAvgClosedTimeAnalysis"
resultType="com.epmet.dto.result.project.ProjectAvgClosedTimeResultDTO">
select pcd.GRID_ID gridId,
pcd.GRID_NAME gridName,
pcd.AVG_CLOSED_CASE_TIME avgClosedCaseTime
from screen_kc_project_summary_grid_daily pcd
inner join (
select t.CUSTOMER_ID, max(DATE_ID) MAX_DATE_ID
from screen_kc_project_summary_grid_daily t
where CUSTOMER_ID = #{customerId}
) latest on (pcd.CUSTOMER_ID = latest.CUSTOMER_ID and pcd.DATE_ID = latest.MAX_DATE_ID)
where pcd.DEL_FLAG = 0
order by avgClosedCaseTime asc
</select>
</mapper>

2
epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcTopicTrendGridMonthlyDao.xml

@ -16,7 +16,7 @@
del_flag = '0'
and customer_id = #{customerId}
and month_id = monthId
)
) "topicCount"
FROM
screen_kc_topic_trend_grid_monthly
WHERE

32
epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcVolunteerSummaryDailyDao.xml

@ -5,21 +5,31 @@
<select id="selectVolunteerSummaryDaily" resultType="com.epmet.evaluationindex.screen.dto.result.AgeDistributionResultDTO">
SELECT
age_level_1 AS "ageLevel1",
age_level_2 AS "ageLevel2",
age_level_3 AS "ageLevel3",
age_level_4 AS "ageLevel4",
age_level_5 AS "ageLevel5",
age_level_6 AS "ageLevel6",
male_count AS "maleCount",
female_count AS "femaleCount"
SUM(age_level_1) AS "ageLevel1",
SUM(age_level_2) AS "ageLevel2",
SUM(age_level_3) AS "ageLevel3",
SUM(age_level_4) AS "ageLevel4",
SUM(age_level_5) AS "ageLevel5",
SUM(age_level_6) AS "ageLevel6",
SUM(male_count) AS "maleCount",
SUM(female_count) AS "femaleCount"
FROM
screen_kc_volunteer_summary_daily
WHERE
del_flag = '0'
AND customer_id = #{customerId}
ORDER BY
date_id DESC, created_time DESC
LIMIT 1
AND date_id = (
select
date_id
from
screen_kc_volunteer_summary_daily
where
del_flag = '0'
and customer_id = #{customerId}
order by
date_id desc,
created_time desc
limit 1
)
</select>
</mapper>

2
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/IndexCalConstant.java

@ -19,7 +19,7 @@ public interface IndexCalConstant {
/**
* 分批计算一次计算 10条
*/
Integer PAGE_SIZE = 800;
Integer PAGE_SIZE = 900;
String GRID_ID="GRID_ID";

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java

@ -175,7 +175,7 @@ public class IndexCalculateController {
* @param form
* @return
*/
@ExternalAppRequestAuth
//@ExternalAppRequestAuth
@PostMapping("stopcalculate")
public Result stopcalculate(@RequestBody CalculateCommonFormDTO form) {
ValidatorUtils.validateEntity(form);

77
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/eum/IndexCodeEnum.java

@ -1,7 +1,5 @@
package com.epmet.eum;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
/**
* 需要计算指标code枚举类
*
@ -9,43 +7,58 @@ import com.epmet.dto.indexcal.CalculateCommonFormDTO;
* @date 2020-08-26 11:14
**/
public enum IndexCodeEnum {
DANG_YUAN_XIANG_GUAN("dangyuanxiangguan", "党员相关", 1),
WANG_GE_XIANG_GUAN("wanggexiangguan", "网格相关", 1),
SHE_QU_XIANG_GUAN("shequxiangguan", "社区相关", 1),
JIE_DAO_XIANG_GUAN("jiedaoxiangguan", "街道相关", 1),
QU_ZHI_BU_MEN("quzhibumen", "区直部门", 1),
QUAN_QU_XIANG_GUAN("quanquxiangguan", "全区相关", 1),
DANG_YUAN_XIANG_GUAN("dangyuanxiangguan", "党员相关", 1, false),
WANG_GE_XIANG_GUAN("wanggexiangguan", "网格相关", 1, false),
SHE_QU_XIANG_GUAN("shequxiangguan", "社区相关", 1, false),
JIE_DAO_XIANG_GUAN("jiedaoxiangguan", "街道相关", 1, false),
QU_ZHI_BU_MEN("quzhibumen", "区直部门", 1, false),
QUAN_QU_XIANG_GUAN("quanquxiangguan", "全区相关", 1, false),
DANG_JIAN_NENG_LI("dangjiannengli", "党建能力", 2, false),
ZHI_LI_NENG_LI("zhilinengli", "治理能力", 2, false),
FU_WU_NENG_LI("fuwunengli", "服务能力", 2, false),
DANG_JIAN_NENG_LI("dangjiannengli", "党建能力", 2),
ZHI_LI_NENG_LI("zhilinengli", "治理能力", 2),
FU_WU_NENG_LI("fuwunengli", "服务能力", 2),
CAN_YU_YI_SHI("canyuyishi", "参与议事", 4, false),
DANG_WU_HUO_DONG("dangwuhuodong", "党务活动", 4, false),
LIAN_XI_QUN_ZHONG("lianxiqunzhong", "联系群众", 4, false),
CAN_YU_YI_SHI("canyuyishi", "参与议事", 4),
DANG_WU_HUO_DONG("dangwuhuodong", "党务活动", 4),
LIAN_XI_QUN_ZHONG("lianxiqunzhong", "联系群众", 4),
ZUZHINEIDANGYDLXQZNLKPFPJZ("zuzhineidangydlxqznlkpfpjz","组织内党员的联系群众能力考评分(平均值)",5),
ZUZHINEIDANGYDSYYSNLKPFPJZ("zuzhineidangydcyysnlkpfpjz","组织内党员的参与议事能力考评分(平均值)",5),
XIA_SHU_SUO_YOU_WGDDJNLPJZ("xiashusuoyouwgddjnlpjz","下属所有网格的党建能力(平均值)",5),
SHE_QU_XIA_SHU_SYWGZLNLHZPJZ("shequxiashusywgzlnlhzpjz","社区下属所有网格治理能力汇总(平均值)",5),
SHE_QU_XIA_JI_SYWGFWNLDFPJZ("shequxiajisywgfwnldfpjz","社区下级所有网格服务能力得分(平均值) ",5),
JIE_DAO_XIA_SHU_SYSQDJNLHZPJZ("jiedaoxiashusysqdjnlhzpjz","街道下属所有社区党建能力汇总(平均值)",5),
JIE_DAO_XIA_SHU_SYSQZLNLHZ("jiedaoxiashusysqzlnlhz","街道下属所有社区治理能力汇总 (平均值) ",5),
JIE_DAO_XIA_SHU_SQFWNLDFPYZ("jiedaoxiashusqfwnldfpjz","街道下属社区服务能力得分 (平均值) ",5),
QU_XIA_SHU_JIE_DFWNLHZPJZ("quxiashujiedfwnlhzpjz","区下属街道服务能力汇总(平均值)",5),
QU_XIA_JI_JIE_DDJNLHZPJZ("quxiajijieddjnlhzpjz","区下级街道党建能力汇总(平均值)",5),
SUO_YOU_JIE_DAO_ZLNLPJZ("suoyoujiedaozlnlpjz","所有街道治理能力(平均值)",5),
SUO_YOU_ZHI_SHU_BMZLNLPJZ("suoyouzhishubmzlnlpjz","所有直属部门治理能力(平均值)",5),
ZUZHINEIDANGYDLXQZNLKPFPJZ("zuzhineidangydlxqznlkpfpjz", "组织内党员的联系群众能力考评分(平均值)", 5, true),
ZUZHINEIDANGYDSYYSNLKPFPJZ("zuzhineidangydcyysnlkpfpjz", "组织内党员的参与议事能力考评分(平均值)", 5, true),
XIA_SHU_SUO_YOU_WGDDJNLPJZ("xiashusuoyouwgddjnlpjz", "下属所有网格的党建能力(平均值)", 5, true),
SHE_QU_XIA_SHU_SYWGZLNLHZPJZ("shequxiashusywgzlnlhzpjz", "社区下属所有网格治理能力汇总(平均值)", 5, true),
SHE_QU_XIA_JI_SYWGFWNLDFPJZ("shequxiajisywgfwnldfpjz", "社区下级所有网格服务能力得分(平均值) ", 5, true),
JIE_DAO_XIA_SHU_SYSQDJNLHZPJZ("jiedaoxiashusysqdjnlhzpjz", "街道下属所有社区党建能力汇总(平均值)", 5, true),
JIE_DAO_XIA_SHU_SYSQZLNLHZ("jiedaoxiashusysqzlnlhz", "街道下属所有社区治理能力汇总 (平均值) ", 5, true),
JIE_DAO_XIA_SHU_SQFWNLDFPYZ("jiedaoxiashusqfwnldfpjz", "街道下属社区服务能力得分 (平均值) ", 5, true),
QU_XIA_SHU_JIE_DFWNLHZPJZ("quxiashujiedfwnlhzpjz", "区下属街道服务能力汇总(平均值)", 5, true),
QU_XIA_JI_JIE_DDJNLHZPJZ("quxiajijieddjnlhzpjz", "区下级街道党建能力汇总(平均值)", 5, true),
SUO_YOU_JIE_DAO_ZLNLPJZ("suoyoujiedaozlnlpjz", "所有街道治理能力(平均值)", 5, true),
SUO_YOU_ZHI_SHU_BMZLNLPJZ("suoyouzhishubmzlnlpjz", "所有直属部门治理能力(平均值)", 5, true),
;
/**
* code
*/
private String code;
/**
* name
*/
private String name;
/**
* 等级
*/
private Integer level;
/**
* 是否是平均值
*/
private Boolean isAvgIndex;
IndexCodeEnum(String code, String name, Integer level) {
IndexCodeEnum(String code, String name, Integer level, Boolean isAvgIndex) {
this.code = code;
this.name = name;
this.level = level;
this.isAvgIndex = isAvgIndex;
}
public static IndexCodeEnum getEnum(String code) {
@ -58,6 +71,16 @@ public enum IndexCodeEnum {
return null;
}
public static boolean isAvgIndex(String code) {
IndexCodeEnum[] values = IndexCodeEnum.values();
for (IndexCodeEnum value : values) {
if (code != null && value.getCode().equals(code)) {
return value.isAvgIndex;
}
}
return false;
}
public String getCode() {
return code;

55
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java

@ -41,6 +41,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@Slf4j
@ -77,33 +78,23 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
log.warn("cpcIndexCalculate customerId:{} have not any indexGroupDetail", formDTO.getCustomerId());
throw new RenException("客户【党员相关】指标权重信息不存在");
}
Map<String, CpcScoreEntity> cpcScoreTotalMap = new HashMap<>();
Map<String, IndexGroupDetailEntity> indexWeightMap = parentIndexDetails.stream().collect(Collectors.toMap(IndexGroupDetailEntity::getIndexCode, o -> o));
int pageNo = NumConstant.ONE;
int pageSize = IndexCalConstant.PAGE_SIZE;
List<CpcScoreEntity> list = null;
Map<String, CpcScoreEntity> preLastCpcScoreTotalMap = new HashMap<>();
//当前最后一条记录
//CpcScoreEntity currentLastCpcScore = null;
//当前第一条记录
//CpcScoreEntity currentFirstCpcScore = null;
Map<String, CpcScoreEntity> cpcScoreTotalMap = new HashMap<>();
Map<String, AtomicInteger> userTotalCount = new HashMap<>();
//删除总分 然后插入
cpcScoreDao.deleteByMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode(), IndexCalConstant.DELETE_SIZE, NumConstant.ONE_STR);
do {
List<CpcScoreEntity> result = new ArrayList<>();
//获取数据
list = cpcScoreDao.getPartScore(formDTO.getCustomerId(), formDTO.getMonthId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode(), (pageNo - NumConstant.ONE) * pageSize, pageSize);
pageNo++;
if (CollectionUtils.isEmpty(list)) {
log.warn("calculateTotalScore cpcScoreDao.getPartScore return empty,customerId:{},monthId:{}", formDTO.getCustomerId(), formDTO.getMonthId());
} else {
//获取最后一条
//currentLastCpcScore = list.get(list.size() - 1);
//获取第一条
//currentFirstCpcScore = list.get(0);
/*if (preLastCpcScoreTotalMap.containsKey(currentFirstCpcScore.getUserId())) {
cpcScoreTotalMap.putAll(preLastCpcScoreTotalMap);
preLastCpcScoreTotalMap.clear();
preLastCpcScoreTotalMap.put(currentLastCpcScore.getUserId(), null);
}*/
Map<String, List<CpcScoreEntity>> userGroupMap = list.stream().collect(Collectors.groupingBy(CpcScoreEntity::getUserId));
userGroupMap.forEach((userId, partScoreList) -> {
CpcScoreEntity totalEntity = null;
@ -121,28 +112,27 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
totalEntity.setAllParentIndexCode(NumConstant.ZERO_STR);
totalEntity.setWeight(new BigDecimal(NumConstant.ONE_NEG));
cpcScoreTotalMap.put(userId, totalEntity);
/* if (preLastCpcScoreTotalMap.containsKey(part.getUserId())) {
preLastCpcScoreTotalMap.put(part.getUserId(), part);
} else {
}*/
}
//自建群活跃度——议题转项目率 有阈值 >60%按60%算
BigDecimal total = part.getScore().multiply(indexGroupDetailEntity.getWeight());
AtomicInteger atomicInteger = userTotalCount.get(part.getUserId());
if (atomicInteger == null) {
atomicInteger = new AtomicInteger(0);
userTotalCount.put(part.getUserId(), atomicInteger);
}
int totalCount = atomicInteger.addAndGet(1);
//todo 次代码限制了 党员的 4级指标的个数 看看是否还有更好的方式
if (totalCount == 3) {
result.add(totalEntity);
}
log.info("userId:{},分数:{},权重:{},total:{}", userId, part.getScore(), indexGroupDetailEntity.getWeight(), total);
totalEntity.setScore(totalEntity.getScore().add(total));
}
});
}
//没查询到数据 就把上次的放进去
if (list == null || list.size() < pageSize || !CollectionUtils.isEmpty(preLastCpcScoreTotalMap)) {
cpcScoreTotalMap.putAll(preLastCpcScoreTotalMap);
}
//删除总分 然后插入
cpcScoreDao.deleteByMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode(), IndexCalConstant.DELETE_SIZE, NumConstant.ONE_STR);
insertCpcScoreBatch(formDTO, cpcScoreTotalMap.values().stream().collect(Collectors.toList()), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode());
} while (!CollectionUtils.isEmpty(list));
insertCpcScoreBatch(formDTO, result, IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode());
} while (!CollectionUtils.isEmpty(list) && list.size() == pageSize);
}
@ -180,7 +170,7 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
*/
public void insertCpcScoreBatch(CalculateCommonFormDTO formDTO, List<CpcScoreEntity> values, String indexCode) {
if (CollectionUtils.isEmpty(values)) {
log.error("insertCpcScoreBatch要插入的数据为空,param:{},indexCode:{}", JSON.toJSONString(formDTO), indexCode);
log.warn("insertCpcScoreBatch要插入的数据为空,param:{},indexCode:{}", JSON.toJSONString(formDTO), indexCode);
return;
}
List<List<CpcScoreEntity>> partition = ListUtils.partition(values, IndexCalConstant.INSERT_SIZE);
@ -338,7 +328,7 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
*/
public void insertCpcSubScoreBatch(CalculateCommonFormDTO formDTO, List<CpcSubScoreEntity> subList, String parentIndexCode) {
if (CollectionUtils.isEmpty(subList)) {
log.error("insertCpcScoreBatch要插入的数据为空,param:{},indexCode:{}", JSON.toJSONString(formDTO), parentIndexCode);
log.warn("insertCpcScoreBatch要插入的数据为空,param:{},indexCode:{}", JSON.toJSONString(formDTO), parentIndexCode);
return;
}
List<List<CpcSubScoreEntity>> partition = ListUtils.partition(subList, IndexCalConstant.INSERT_SIZE);
@ -385,7 +375,8 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
ScoreConstants.MAX_SCORE,
Correlation.getCorrelation(index.getCorrelation())
);
IndexInputVO indexInputVO = new IndexInputVO(index.getIndexCode(), index.getAllParentIndexCode(), new ArrayList<>(), index.getThreshold(), index.getWeight(), scoreCalculator);
IndexInputVO indexInputVO = new IndexInputVO(index.getIndexCode(), index.getAllParentIndexCode(), new ArrayList<>(), index.getThreshold(), index.getWeight(), IndexCodeEnum.isAvgIndex(index.getIndexCode()), scoreCalculator);
map.put(index.getIndexCode(), indexInputVO);
}
return map;

1
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java

@ -375,6 +375,7 @@ public class DeptScoreServiceImpl extends BaseServiceImpl<DeptScoreDao, DeptScor
index.getThreshold(),
// new BigDecimal("-1"), //FOR TEST
index.getWeight(),
IndexCodeEnum.isAvgIndex(index.getIndexCode()),
scoreCalculator);
map.put(index.getIndexCode(), indexInputVO1);
}

1
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java

@ -494,6 +494,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
index.getThreshold(),
// new BigDecimal("-1"),//FOR TEST
index.getWeight(),
IndexCodeEnum.isAvgIndex(index.getIndexCode()),
scoreCalculator);
map.put(index.getIndexCode(), indexInputVO1);
}

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java

@ -129,7 +129,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
index1SampleValues.add(s);
});
BigDecimalScoreCalculator sc = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation()));
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), IndexCodeEnum.isAvgIndex(detail.getIndexCode()), sc);
indexInputVOS.add(index1VO);
});
}
@ -155,7 +155,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
SampleValue s = new SampleValue((String) c.get(IndexCalConstant.AGENCY_ID), new BigDecimal(String.valueOf(c.get(fieldNameByIndexCode))));
index1SampleValues.add(s);
});
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), IndexCodeEnum.isAvgIndex(detail.getIndexCode()), sc1);
indexInputVOS.add(index1VO);
});
}
@ -202,7 +202,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
index1SampleValues.add(s);
});
BigDecimalScoreCalculator sc = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation()));
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), IndexCodeEnum.isAvgIndex(detail.getIndexCode()), sc);
indexInputVOS.add(index1VO);
});
}
@ -228,7 +228,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
SampleValue s = new SampleValue((String) c.get(IndexCalConstant.AGENCY_ID), new BigDecimal(String.valueOf(c.get(fieldNameByIndexCode))));
index1SampleValues.add(s);
});
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), IndexCodeEnum.isAvgIndex(detail.getIndexCode()), sc1);
indexInputVOS.add(index1VO);
});
}
@ -275,7 +275,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
SampleValue s = new SampleValue(c.getAgencyId(), c.getScore());
index1SampleValues.add(s);
});
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), IndexCodeEnum.isAvgIndex(detail.getIndexCode()), sc1);
indexInputVOS.add(index1VO);
});
}
@ -300,7 +300,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
SampleValue s = new SampleValue((String) c.get(IndexCalConstant.AGENCY_ID), new BigDecimal(String.valueOf(c.get(fieldNameByIndexCode))));
index1SampleValues.add(s);
});
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), IndexCodeEnum.isAvgIndex(detail.getIndexCode()), sc1);
indexInputVOS.add(index1VO);
});
}

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java

@ -127,7 +127,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
index1SampleValues.add(s);
});
BigDecimalScoreCalculator sc = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation()));
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), IndexCodeEnum.isAvgIndex(detail.getIndexCode()), sc);
indexInputVOS.add(index1VO);
});
}
@ -153,7 +153,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
SampleValue s = new SampleValue((String) c.get(IndexCalConstant.AGENCY_ID), new BigDecimal(String.valueOf(c.get(fieldNameByIndexCode))));
index1SampleValues.add(s);
});
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), IndexCodeEnum.isAvgIndex(detail.getIndexCode()), sc1);
indexInputVOS.add(index1VO);
});
}
@ -200,7 +200,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
index1SampleValues.add(s);
});
BigDecimalScoreCalculator sc = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation()));
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), IndexCodeEnum.isAvgIndex(detail.getIndexCode()), sc);
indexInputVOS.add(index1VO);
});
}
@ -219,7 +219,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
index1SampleValues.add(s);
});
BigDecimalScoreCalculator sc = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation()));
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), IndexCodeEnum.isAvgIndex(detail.getIndexCode()), sc);
indexInputVOS.add(index1VO);
});
}
@ -268,7 +268,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
SampleValue s = new SampleValue(c.getParentId(), c.getScore());
index1SampleValues.add(s);
});
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), IndexCodeEnum.isAvgIndex(detail.getIndexCode()), sc1);
indexInputVOS.add(index1VO);
});
}

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java

@ -131,7 +131,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
index1SampleValues.add(s);
});
BigDecimalScoreCalculator sc = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation()));
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), IndexCodeEnum.isAvgIndex(detail.getIndexCode()), sc);
indexInputVOS.add(index1VO);
});
}
@ -156,7 +156,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
SampleValue s = new SampleValue((String) c.get(IndexCalConstant.AGENCY_ID), new BigDecimal(String.valueOf(c.get(fieldName))));
index1SampleValues.add(s);
});
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), IndexCodeEnum.isAvgIndex(detail.getIndexCode()), sc1);
indexInputVOS.add(index1VO);
});
}
@ -203,7 +203,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
index1SampleValues.add(s);
});
BigDecimalScoreCalculator sc = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation()));
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), IndexCodeEnum.isAvgIndex(detail.getIndexCode()), sc);
indexInputVOS.add(index1VO);
});
}
@ -229,7 +229,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
SampleValue s = new SampleValue((String) c.get(IndexCalConstant.AGENCY_ID), new BigDecimal(String.valueOf(c.get(fieldNameByIndexCode))));
index1SampleValues.add(s);
});
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), IndexCodeEnum.isAvgIndex(detail.getIndexCode()), sc1);
indexInputVOS.add(index1VO);
});
}
@ -276,7 +276,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
SampleValue s = new SampleValue(c.getAgencyId(), c.getScore());
index1SampleValues.add(s);
});
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), IndexCodeEnum.isAvgIndex(detail.getIndexCode()), sc1);
indexInputVOS.add(index1VO);
});
}
@ -301,7 +301,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
SampleValue s = new SampleValue((String) c.get(IndexCalConstant.AGENCY_ID), new BigDecimal(String.valueOf(c.get(fieldNameByIndexCode))));
index1SampleValues.add(s);
});
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), IndexCodeEnum.isAvgIndex(detail.getIndexCode()), sc1);
indexInputVOS.add(index1VO);
});
}

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java

@ -57,7 +57,13 @@ public class BatchScoreCalculator {
for (SampleValue vo : indexValueVOs) {
String sampleId = vo.getSampleId();
//归一后的值
BigDecimal normalizeValue = scoreCalculator.normalize(getFinalSampleValue(vo.getSampleValue(), threshold));
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));
}
BigDecimal score = normalizeValue.multiply(weight).setScale(6, RoundingMode.HALF_UP);
CalculateResult result = scoreCountOfSamples.get(sampleId);

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/IndexInputVO.java

@ -39,5 +39,10 @@ public class IndexInputVO<T extends Number> implements Serializable {
*/
private BigDecimal weight;
/**
* 是否是分数 如果是分数 直接不用计算 乘以权重即可
*/
private boolean isScore;
private ScoreCalculator<T> scoreCalculator;
}

28
epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java

@ -76,8 +76,8 @@ public class DemoScoreCal {
List<SampleValue<Integer>> index2SampleValues = Arrays.asList(new SampleValue<>("id1", 1), new SampleValue<>("id2", 8), new SampleValue<>("id3", 3));
// 每个指标的信息,包括样本列表,权重,指标标记
IndexInputVO<Integer> index1VO = new IndexInputVO<>("aaa", "a:bbb2", index1SampleValues, new BigDecimal(10), new BigDecimal(1), sc1);
IndexInputVO<Integer> index2VO = new IndexInputVO<>("bbb", "a:bbb2", index2SampleValues, new BigDecimal(10), new BigDecimal(1), sc2);
IndexInputVO<Integer> index1VO = new IndexInputVO<>("aaa", "a:bbb2", index1SampleValues, new BigDecimal(10), new BigDecimal(1), false, sc1);
IndexInputVO<Integer> index2VO = new IndexInputVO<>("bbb", "a:bbb2", index2SampleValues, new BigDecimal(10), new BigDecimal(1), false, sc2);
List<IndexInputVO> indexInputVOS = Arrays.asList(index1VO, index2VO);
@ -102,8 +102,8 @@ public class DemoScoreCal {
List<SampleValue> index2SampleValues = Arrays.asList(new SampleValue<>("id1", new BigDecimal(1)), new SampleValue<>("id2", new BigDecimal(8)), new SampleValue<>("id3", new BigDecimal(3)));
// 每个指标的信息,包括样本列表,权重,指标标记
IndexInputVO index1VO = new IndexInputVO("aaa", "a:aaa", index1SampleValues, new BigDecimal(6), new BigDecimal(1), sc1);
IndexInputVO index2VO = new IndexInputVO("bbb", "b:bbb", index2SampleValues, new BigDecimal(6), new BigDecimal(1), sc2);
IndexInputVO index1VO = new IndexInputVO("aaa", "a:aaa", index1SampleValues, new BigDecimal(6), new BigDecimal(1), false, sc1);
IndexInputVO index2VO = new IndexInputVO("bbb", "b:bbb", index2SampleValues, new BigDecimal(6), new BigDecimal(1), false, sc2);
List<IndexInputVO> indexInputVOS = Arrays.asList(index1VO, index2VO);
@ -161,10 +161,10 @@ public class DemoScoreCal {
// 每个指标的信息,包括样本列表,权重,指标标记
IndexInputVO index1VO = new IndexInputVO("aaa1", "a:bbb2", index1SampleValues, new BigDecimal(-1), new BigDecimal(0.2), sc1);
IndexInputVO index2VO = new IndexInputVO("aaa2", "a:bbb2", index1SampleValues2, new BigDecimal(-1), new BigDecimal(0.15), sc2);
IndexInputVO index3VO = new IndexInputVO("aaa3", "a:bbb2", index1SampleValues3, new BigDecimal(-1), new BigDecimal(0.15), sc3);
IndexInputVO index4VO = new IndexInputVO("aaa4", "a:bbb2", index1SampleValues4, new BigDecimal(-1), new BigDecimal(0.5), sc4);
IndexInputVO index1VO = new IndexInputVO("aaa1", "a:bbb2", index1SampleValues, new BigDecimal(-1), new BigDecimal(0.2), false, sc1);
IndexInputVO index2VO = new IndexInputVO("aaa2", "a:bbb2", index1SampleValues2, new BigDecimal(-1), new BigDecimal(0.15), false, sc2);
IndexInputVO index3VO = new IndexInputVO("aaa3", "a:bbb2", index1SampleValues3, new BigDecimal(-1), new BigDecimal(0.15), false, sc3);
IndexInputVO index4VO = new IndexInputVO("aaa4", "a:bbb2", index1SampleValues4, new BigDecimal(-1), new BigDecimal(0.5), false, sc4);
List<IndexInputVO> indexInputVOS = Arrays.asList(index1VO, index2VO, index3VO, index4VO);
@ -234,10 +234,10 @@ public class DemoScoreCal {
// 每个指标的信息,包括样本列表,权重,指标标记
IndexInputVO index1VO = new IndexInputVO("aaa1", "a:bbb2", index1SampleValues, new BigDecimal(-1), new BigDecimal(0.3), sc1);
IndexInputVO index2VO = new IndexInputVO("aaa2", "a:bbb2", index1SampleValues2, new BigDecimal(-1), new BigDecimal(0.2), sc2);
IndexInputVO index3VO = new IndexInputVO("aaa3", "a:bbb2", index1SampleValues3, new BigDecimal(-1), new BigDecimal(0.2), sc3);
IndexInputVO index4VO = new IndexInputVO("aaa4", "a:bbb2", index1SampleValues4, new BigDecimal(0.6), new BigDecimal(0.3), sc4);
IndexInputVO index1VO = new IndexInputVO("aaa1", "a:bbb1", index1SampleValues, new BigDecimal(-1), new BigDecimal("0.3"), false, sc1);
IndexInputVO index2VO = new IndexInputVO("aaa2", "a:bbb2", index1SampleValues2, new BigDecimal(-1), new BigDecimal("0.2"), false, sc2);
IndexInputVO index3VO = new IndexInputVO("aaa3", "a:bbb3", index1SampleValues3, new BigDecimal(-1), new BigDecimal("0.2"), false, sc3);
IndexInputVO index4VO = new IndexInputVO("aaa4", "a:bbb4", index1SampleValues4, new BigDecimal(0.6), new BigDecimal("0.3"), false, sc4);
List<IndexInputVO> indexInputVOS = Arrays.asList(index1VO, index2VO, index3VO, index4VO);
@ -250,7 +250,9 @@ public class DemoScoreCal {
System.err.println("----------------11111111----------------");
result2.forEach((key, value) -> {
System.out.println(key.concat("的得分为:").concat(value.toString()));
System.out.println(key.concat("的总得分为:") + value.getTotalScore());
//System.out.println(JSON.toJSONString(indexInputVOS));
value.getDetails().forEach(o -> System.out.println(JSON.toJSONString(o)));
});
System.err.println("-----------------2222222222---------------");
}

Loading…
Cancel
Save