Browse Source

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

dev
jianjun 5 years ago
parent
commit
5ea0bb4317
  1. 2
      epmet-gateway/src/main/resources/bootstrap.yml
  2. 9
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/PageFormDTO.java
  3. 34
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/issue/KcPartiTrendResultDTO.java
  4. 23
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/ProjectSatisfaction.java
  5. 87
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/ProjectSatisfactionResultDTO.java
  6. 13
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/UserSummaryResultDTO.java
  7. 20
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserPointRankResultDTO.java
  8. 29
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserPortrayalResultDTO.java
  9. 19
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserRankResultDTO.java
  10. 63
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserTrendResultDTO.java
  11. 12
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcCategoryNewsCountResultDTO.java
  12. 26
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcCategoryNewsRankResultDTO.java
  13. 12
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcNewsHotRankResultDTO.java
  14. 37
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcNewsPartiTrendResultDTO.java
  15. 14
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcNewsSummaryResultDTO.java
  16. 138
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java
  17. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPartyUserRankDataDao.java
  18. 6
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcNewsCategoryAnalysisDao.java
  19. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcNewsRankDao.java
  20. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcNewsSummaryDailyDao.java
  21. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcNewsTrendMonthlyDao.java
  22. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcProjectSatisGridMonthlyDao.java
  23. 12
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcUserSummaryDailyDao.java
  24. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcUserTrendGridMonthlyDao.java
  25. 23
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java
  26. 144
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java
  27. 9
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml
  28. 2
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcIssueSummaryGridDailyDao.xml
  29. 30
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsCategoryAnalysisDao.xml
  30. 16
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsRankDao.xml
  31. 18
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsSummaryDailyDao.xml
  32. 11
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsTrendMonthlyDao.xml
  33. 17
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcProjectSatisGridMonthlyDao.xml
  34. 1
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcProjectSummaryGridDailyDao.xml
  35. 56
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcUserSummaryDailyDao.xml
  36. 13
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcUserTrendGridMonthlyDao.xml
  37. 51
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java
  38. 35
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  39. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java
  40. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java
  41. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java
  42. 5
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml
  43. 28
      epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java
  44. 17
      epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/MathUtilTest.java

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

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

9
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/PageFormDTO.java

@ -0,0 +1,9 @@
package com.epmet.dto;
import lombok.Data;
@Data
public class PageFormDTO {
private Integer pageNo = 1;
private Integer pageSize = 10;
}

34
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/issue/KcPartiTrendResultDTO.java

@ -1,11 +1,9 @@
package com.epmet.dto.result.issue;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class KcPartiTrendResultDTO {
private String monthId;
@ -13,4 +11,36 @@ public class KcPartiTrendResultDTO {
private List<String> xAxis = new ArrayList<>();
private List<Integer> reportCountDataList = new ArrayList<>();
public String getMonthId() {
return monthId;
}
public void setMonthId(String monthId) {
this.monthId = monthId;
}
public Integer getReportCount() {
return reportCount;
}
public void setReportCount(Integer reportCount) {
this.reportCount = reportCount;
}
public List<String> getxAxis() {
return xAxis;
}
public void setxAxis(List<String> xAxis) {
this.xAxis = xAxis;
}
public List<Integer> getReportCountDataList() {
return reportCountDataList;
}
public void setReportCountDataList(List<Integer> reportCountDataList) {
this.reportCountDataList = reportCountDataList;
}
}

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

@ -1,23 +0,0 @@
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;
}

87
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/ProjectSatisfactionResultDTO.java

@ -0,0 +1,87 @@
package com.epmet.dto.result.project;
import java.util.ArrayList;
import java.util.List;
/**
* xAxis 被lombok生成后是XAxis与nei不符所以使用手动生成getter/setter方法
*/
public class ProjectSatisfactionResultDTO {
private List<String> xAxis = new ArrayList<>();
private List<Integer> greatSatisDataList = new ArrayList<>();
private List<Integer> goodSatisDataList = new ArrayList<>();
private List<Integer> disSatisDataList = new ArrayList<>();
private String monthId;
// 满意
private Integer goodSatis;
// 非常满意
private Integer greatSatis;
// 不满意
private Integer disSatis;
public List<String> getxAxis() {
return xAxis;
}
public void setxAxis(List<String> xAxis) {
this.xAxis = xAxis;
}
public List<Integer> getGreatSatisDataList() {
return greatSatisDataList;
}
public void setGreatSatisDataList(List<Integer> greatSatisDataList) {
this.greatSatisDataList = greatSatisDataList;
}
public List<Integer> getGoodSatisDataList() {
return goodSatisDataList;
}
public void setGoodSatisDataList(List<Integer> goodSatisDataList) {
this.goodSatisDataList = goodSatisDataList;
}
public List<Integer> getDisSatisDataList() {
return disSatisDataList;
}
public void setDisSatisDataList(List<Integer> disSatisDataList) {
this.disSatisDataList = disSatisDataList;
}
public String getMonthId() {
return monthId;
}
public void setMonthId(String monthId) {
this.monthId = monthId;
}
public Integer getGoodSatis() {
return goodSatis;
}
public void setGoodSatis(Integer goodSatis) {
this.goodSatis = goodSatis;
}
public Integer getGreatSatis() {
return greatSatis;
}
public void setGreatSatis(Integer greatSatis) {
this.greatSatis = greatSatis;
}
public Integer getDisSatis() {
return disSatis;
}
public void setDisSatis(Integer disSatis) {
this.disSatis = disSatis;
}
}

13
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/UserSummaryResultDTO.java

@ -0,0 +1,13 @@
package com.epmet.dto.result.project;
import lombok.Data;
@Data
public class UserSummaryResultDTO {
private String dateId;
private Integer vistorCount;
private Integer regUserCount;
private Integer partyUserCount;
}

20
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserPointRankResultDTO.java

@ -0,0 +1,20 @@
package com.epmet.dto.result.user;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class KcUserPointRankResultDTO {
private List<String> userNameDataList = new ArrayList<>();
private List<Integer> pointsDataList = new ArrayList<>();
@Data
public static class KcUserPoint {
private String userId;
private String userName;
private Integer pointTotal;
}
}

29
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserPortrayalResultDTO.java

@ -0,0 +1,29 @@
package com.epmet.dto.result.user;
import lombok.Data;
@Data
public class KcUserPortrayalResultDTO {
// 年龄分布
private AgeDistribution ageDistribution;
// 性别分布
private GenderDistribution genderDistribution;
@Data
public static class AgeDistribution {
private Integer ageLevel1;
private Integer ageLevel2;
private Integer ageLevel3;
private Integer ageLevel4;
private Integer ageLevel5;
private Integer ageLevel6;
}
@Data
public static class GenderDistribution {
private Integer malePartyUserCount;
private Integer femalePartyUserCount;
}
}

19
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserRankResultDTO.java

@ -0,0 +1,19 @@
package com.epmet.dto.result.user;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class KcUserRankResultDTO {
// 网格名称
private String gridName;
// 浏览用户数
private Integer viewUserCount;
private List<String> gridNameDataList = new ArrayList<>();
private List<Integer> totalUserDataList = new ArrayList<>();
}

63
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserTrendResultDTO.java

@ -0,0 +1,63 @@
package com.epmet.dto.result.user;
import java.util.ArrayList;
import java.util.List;
public class KcUserTrendResultDTO {
private String monthId;
private Integer regUserCount;
private Integer partyUserCount;
private List<String> xAxis = new ArrayList<>();
private List<Integer> userDataList = new ArrayList<>();
private List<Integer> partyUserDataList = new ArrayList<>();
public String getMonthId() {
return monthId;
}
public void setMonthId(String monthId) {
this.monthId = monthId;
}
public Integer getRegUserCount() {
return regUserCount;
}
public void setRegUserCount(Integer regUserCount) {
this.regUserCount = regUserCount;
}
public Integer getPartyUserCount() {
return partyUserCount;
}
public void setPartyUserCount(Integer partyUserCount) {
this.partyUserCount = partyUserCount;
}
public List<String> getxAxis() {
return xAxis;
}
public void setxAxis(List<String> xAxis) {
this.xAxis = xAxis;
}
public List<Integer> getUserDataList() {
return userDataList;
}
public void setUserDataList(List<Integer> userDataList) {
this.userDataList = userDataList;
}
public List<Integer> getPartyUserDataList() {
return partyUserDataList;
}
public void setPartyUserDataList(List<Integer> partyUserDataList) {
this.partyUserDataList = partyUserDataList;
}
}

12
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcCategoryNewsCountResultDTO.java

@ -0,0 +1,12 @@
package com.epmet.dto.result.user;
import lombok.Data;
@Data
public class ScreenKcCategoryNewsCountResultDTO {
private String categoryName;
private Integer newsCount;
private Integer partiCount;
}

26
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcCategoryNewsRankResultDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto.result.user;
import java.util.ArrayList;
import java.util.List;
public class ScreenKcCategoryNewsRankResultDTO {
private List<String> xAxis = new ArrayList<>();
private List<Integer> partiCountDataList = new ArrayList<>();
public List<String> getxAxis() {
return xAxis;
}
public void setxAxis(List<String> xAxis) {
this.xAxis = xAxis;
}
public List<Integer> getPartiCountDataList() {
return partiCountDataList;
}
public void setPartiCountDataList(List<Integer> partiCountDataList) {
this.partiCountDataList = partiCountDataList;
}
}

12
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcNewsHotRankResultDTO.java

@ -0,0 +1,12 @@
package com.epmet.dto.result.user;
import lombok.Data;
@Data
public class ScreenKcNewsHotRankResultDTO {
private String newsId;
private String newsTitle;
private Integer hotCount;
}

37
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcNewsPartiTrendResultDTO.java

@ -0,0 +1,37 @@
package com.epmet.dto.result.user;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
public class ScreenKcNewsPartiTrendResultDTO {
private List<String> xAxis = new ArrayList<>();
private List<Integer> partiCountDataList = new ArrayList<>();
@Data
public static class ScreenKcNewsPartyCount {
private String monthId;
private Integer partiCount;
}
public List<String> getxAxis() {
return xAxis;
}
public void setxAxis(List<String> xAxis) {
this.xAxis = xAxis;
}
public List<Integer> getPartiCountDataList() {
return partiCountDataList;
}
public void setPartiCountDataList(List<Integer> partiCountDataList) {
this.partiCountDataList = partiCountDataList;
}
}

14
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcNewsSummaryResultDTO.java

@ -0,0 +1,14 @@
package com.epmet.dto.result.user;
import lombok.Data;
@Data
public class ScreenKcNewsSummaryResultDTO {
private String dateId;
private Integer newsCount;
private Integer readCount;
private Integer likeCount;
private Integer commentCount;
}

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

@ -5,8 +5,9 @@ import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
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.PageFormDTO;
import com.epmet.dto.result.project.*;
import com.epmet.dto.result.user.*;
import com.epmet.evaluationindex.screen.dto.form.GroupTopicShiftIssueRatioRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.GroupUserCountRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.HeartVolunteerrankFormDTO;
@ -97,7 +98,7 @@ public class KcScreenController {
}
/**
* 按照议题数排名
* 按照议题数排名
* @param externalAppRequestParam
* @return
*/
@ -123,7 +124,7 @@ public class KcScreenController {
}
/**
* 议题分析-审核效率
* 议题分析-议题效率
* @param externalAppRequestParam
* @return
*/
@ -277,14 +278,135 @@ public class KcScreenController {
* @param externalAppRequestParam
* @return
*/
//@ExternalAppRequestAuth
@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));
public Result<ProjectSatisfactionResultDTO> getProjectSatisfactionAnalyze(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
return new Result<ProjectSatisfactionResultDTO>().ok(kcScreenService.getProjectSatisfactionAnalyze(customerId));
}
/**
* 用户-summary
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("user/summary")
public Result<UserSummaryResultDTO> getUserSummary(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
//String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933";
return new Result<UserSummaryResultDTO>().ok(kcScreenService.getUserSummary(customerId));
}
/**
* 用户量趋势
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("user/trend")
public Result<KcUserTrendResultDTO> getUserTrend(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
return new Result<KcUserTrendResultDTO>().ok(kcScreenService.getUserTrend(customerId));
}
/**
* 网格用户数量排名
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("user/griduserrank")
public Result<KcUserRankResultDTO> getUserRank(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
return new Result<KcUserRankResultDTO>().ok(kcScreenService.getUserRank(customerId));
}
/**
* 用户画像
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("user/userportrayal")
public Result<KcUserPortrayalResultDTO> getUserPortrayal(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
return new Result<KcUserPortrayalResultDTO>().ok(kcScreenService.getUserPortrayal(customerId));
}
/**
* 用户积分排名
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("user/pointsrank")
public Result<KcUserPointRankResultDTO> getUserPointsRank(ExternalAppRequestParam externalAppRequestParam,
@RequestBody PageFormDTO form) {
String customerId = externalAppRequestParam.getCustomerId();
return new Result<KcUserPointRankResultDTO>().ok(kcScreenService.getUserPointsRank(customerId, form.getPageNo(), form.getPageSize()));
}
/**
* 党建声音-各类总数
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("news/summary")
public Result<ScreenKcNewsSummaryResultDTO> getNewsSummary(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
return new Result<ScreenKcNewsSummaryResultDTO>().ok(kcScreenService.getNewsSummary(customerId));
}
/**
* 新闻阅读参与趋势
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("news/partitrend")
public Result<ScreenKcNewsPartiTrendResultDTO> getNewsPartiTrend(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
return new Result<ScreenKcNewsPartiTrendResultDTO>().ok(kcScreenService.getNewsPartiTrend(customerId));
}
/**
* 党建声音-分类的news数量
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("news/category")
public Result<List<ScreenKcCategoryNewsCountResultDTO>> getNewsCountGroupByCategory(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
return new Result<List<ScreenKcCategoryNewsCountResultDTO>>().ok(kcScreenService.getNewsCountOfCategory(customerId));
}
/**
* 党建声音-分类的用户参与数排行
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("news/userparticategoryrank")
public Result<ScreenKcCategoryNewsRankResultDTO> getNewsPartiCategoryRank(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
return new Result<ScreenKcCategoryNewsRankResultDTO>().ok(kcScreenService.getNewsPartiCategoryRank(customerId));
}
/**
* 党建声音-热点新闻排行
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("news/hotrank")
public Result<List<ScreenKcNewsHotRankResultDTO>> listNewsHotRank(ExternalAppRequestParam externalAppRequestParam,
@RequestBody PageFormDTO form){
String customerId = externalAppRequestParam.getCustomerId();
return new Result<List<ScreenKcNewsHotRankResultDTO>>().ok(kcScreenService.getNewsHotRank(customerId, form.getPageNo(), form.getPageSize()));
}
}

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

@ -17,6 +17,7 @@
package com.epmet.datareport.dao.evaluationindex.screen;
import com.epmet.dto.result.user.KcUserPointRankResultDTO;
import com.epmet.evaluationindex.screen.dto.result.PartyUserPointResultDTO;
import com.epmet.evaluationindex.screen.dto.result.UserPointResultDTO;
import org.apache.ibatis.annotations.Mapper;
@ -51,4 +52,5 @@ public interface ScreenPartyUserRankDataDao{
**/
List<PartyUserPointResultDTO> selectPartymemberPointOrder(@Param("agencyId")String agencyId);
List<KcUserPointRankResultDTO.KcUserPoint> listUserPoints(String customerId);
}

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

@ -17,8 +17,11 @@
package com.epmet.datareport.dao.evaluationindex.screenkc;
import com.epmet.dto.result.user.ScreenKcCategoryNewsCountResultDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* KC-新闻-按类别统计(先根据customerId+dateId删除)
*
@ -28,4 +31,7 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ScreenKcNewsCategoryAnalysisDao {
List<ScreenKcCategoryNewsCountResultDTO> getNewsCountOfCategory(String customerId);
List<ScreenKcCategoryNewsCountResultDTO> listNewsPartiCategoryRank(String customerId);
}

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

@ -17,8 +17,11 @@
package com.epmet.datareport.dao.evaluationindex.screenkc;
import com.epmet.dto.result.user.ScreenKcNewsHotRankResultDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* KC-热点新闻排行-(先根据customerId删除)
*
@ -28,4 +31,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ScreenKcNewsRankDao {
List<ScreenKcNewsHotRankResultDTO> getNewsHotRank(String customerId);
}

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

@ -17,6 +17,7 @@
package com.epmet.datareport.dao.evaluationindex.screenkc;
import com.epmet.dto.result.user.ScreenKcNewsSummaryResultDTO;
import org.apache.ibatis.annotations.Mapper;
/**
@ -28,4 +29,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ScreenKcNewsSummaryDailyDao {
ScreenKcNewsSummaryResultDTO getNewsSummary(String customerId);
}

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

@ -17,8 +17,11 @@
package com.epmet.datareport.dao.evaluationindex.screenkc;
import com.epmet.dto.result.user.ScreenKcNewsPartiTrendResultDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* KC-新闻参与趋势-(先根据customerId+monthId删除)
*
@ -28,4 +31,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ScreenKcNewsTrendMonthlyDao {
List<ScreenKcNewsPartiTrendResultDTO.ScreenKcNewsPartyCount> getNewsPartiTrend(String customerId);
}

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

@ -17,8 +17,11 @@
package com.epmet.datareport.dao.evaluationindex.screenkc;
import com.epmet.dto.result.project.ProjectSatisfactionResultDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* KC-项目满意度分析(customerId+monthId先删除记录再插入)
*
@ -28,4 +31,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ScreenKcProjectSatisGridMonthlyDao {
List<ProjectSatisfactionResultDTO> getProjectSatisfactionAnalyze(String customerId);
}

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

@ -17,8 +17,13 @@
package com.epmet.datareport.dao.evaluationindex.screenkc;
import com.epmet.dto.result.project.UserSummaryResultDTO;
import com.epmet.dto.result.user.KcUserPortrayalResultDTO;
import com.epmet.dto.result.user.KcUserRankResultDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* KC-用户分析(先根据customerId+dateId删除后插入)
*
@ -28,4 +33,11 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ScreenKcUserSummaryDailyDao {
UserSummaryResultDTO getUserSummary(String customerId);
List<KcUserRankResultDTO> getUserRank(String customerId);
KcUserPortrayalResultDTO.AgeDistribution getAgeDistribution(String customerId);
KcUserPortrayalResultDTO.GenderDistribution getGenderDistribution(String customerId);
}

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

@ -17,8 +17,11 @@
package com.epmet.datareport.dao.evaluationindex.screenkc;
import com.epmet.dto.result.user.KcUserTrendResultDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* KC-用户趋势分析(根据monthId+customerId先删后增)
*
@ -28,4 +31,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ScreenKcUserTrendGridMonthlyDao {
List<KcUserTrendResultDTO> getUserTrend(String customerId);
}

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

@ -3,6 +3,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.dto.result.user.*;
import com.epmet.evaluationindex.screen.dto.form.GroupTopicShiftIssueRatioRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.GroupUserCountRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.HeartVolunteerrankFormDTO;
@ -112,5 +113,25 @@ public interface KcScreenService {
List<ProjectAvgClosedTimeResultDTO> getGridProjectAvgClosedTimeAnalysis(String customerId);
ProjectSatisfaction getProjectSatisfactionAnalyze(String customerId);
ProjectSatisfactionResultDTO getProjectSatisfactionAnalyze(String customerId);
UserSummaryResultDTO getUserSummary(String customerId);
KcUserTrendResultDTO getUserTrend(String customerId);
KcUserRankResultDTO getUserRank(String customerId);
KcUserPortrayalResultDTO getUserPortrayal(String customerId);
KcUserPointRankResultDTO getUserPointsRank(String customerId, Integer pageNo, Integer pageSize);
ScreenKcNewsSummaryResultDTO getNewsSummary(String customerId);
ScreenKcNewsPartiTrendResultDTO getNewsPartiTrend(String customerId);
List<ScreenKcCategoryNewsCountResultDTO> getNewsCountOfCategory(String customerId);
ScreenKcCategoryNewsRankResultDTO getNewsPartiCategoryRank(String customerId);
List<ScreenKcNewsHotRankResultDTO> getNewsHotRank(String customerId, Integer pageNo, Integer pageSize);
}

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

@ -4,11 +4,13 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenPartyUserRankDataDao;
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.dto.result.user.*;
import com.epmet.evaluationindex.screen.dto.form.GroupTopicShiftIssueRatioRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.GroupUserCountRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.HeartVolunteerrankFormDTO;
@ -16,6 +18,7 @@ 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.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -71,6 +74,30 @@ public class KcScreenServiceImpl implements KcScreenService {
@Autowired
private ScreenKcProjectSummaryGridDailyDao projectSummaryGridDailyDao;
@Autowired
private ScreenKcProjectSatisGridMonthlyDao projectSatisGridMonthlyDao;
@Autowired
private ScreenKcUserSummaryDailyDao kcUserSummaryDailyDao;
@Autowired
private ScreenKcUserTrendGridMonthlyDao userTrendGridMonthlyDao;
@Autowired
private ScreenPartyUserRankDataDao partyUserRankDataDao;
@Autowired
private ScreenKcNewsSummaryDailyDao screenKcNewsSummaryDailyDao;
@Autowired
private ScreenKcNewsTrendMonthlyDao screenKcNewsTrendMonthlyDao;
@Autowired
private ScreenKcNewsCategoryAnalysisDao screenKcNewsCategoryAnalysisDao;
@Autowired
private ScreenKcNewsRankDao screenKcNewsRankDao;
/**
* @param externalAppRequestParam
* @Description 首页-平台各类总数
@ -162,7 +189,7 @@ public class KcScreenServiceImpl implements KcScreenService {
KcPartiTrendResultDTO result = new KcPartiTrendResultDTO();
trend.stream().forEach(t -> {
String month = t.getMonthId().substring(4);
result.getXAxis().add(new Integer(month).toString().concat("月"));
result.getxAxis().add(new Integer(month).toString().concat("月"));
result.getReportCountDataList().add(t.getReportCount());
});
return result;
@ -319,8 +346,119 @@ public class KcScreenServiceImpl implements KcScreenService {
}
@Override
public ProjectSatisfaction getProjectSatisfactionAnalyze(String customerId) {
public ProjectSatisfactionResultDTO getProjectSatisfactionAnalyze(String customerId) {
List<ProjectSatisfactionResultDTO> pss = projectSatisGridMonthlyDao.getProjectSatisfactionAnalyze(customerId);
ProjectSatisfactionResultDTO resultDTO = new ProjectSatisfactionResultDTO();
pss.stream().forEach(ps -> {
String monthNo = ps.getMonthId().substring(4);
resultDTO.getxAxis().add(new Integer(monthNo).toString().concat("月"));
resultDTO.getGreatSatisDataList().add(ps.getGreatSatis());
resultDTO.getGoodSatisDataList().add(ps.getGoodSatis());
resultDTO.getDisSatisDataList().add(ps.getDisSatis());
});
return resultDTO;
}
@Override
public UserSummaryResultDTO getUserSummary(String customerId) {
return kcUserSummaryDailyDao.getUserSummary(customerId);
}
@Override
public KcUserTrendResultDTO getUserTrend(String customerId) {
List<KcUserTrendResultDTO> userSomeNums = userTrendGridMonthlyDao.getUserTrend(customerId);
KcUserTrendResultDTO trend = new KcUserTrendResultDTO();
userSomeNums.stream().forEach(usm -> {
String monthStr = usm.getMonthId().substring(4);
trend.getxAxis().add(new Integer(monthStr).toString().concat("月"));
trend.getUserDataList().add(usm.getRegUserCount());
trend.getPartyUserDataList().add(usm.getPartyUserCount());
});
return trend;
}
@Override
public KcUserRankResultDTO getUserRank(String customerId) {
List<KcUserRankResultDTO> list = kcUserSummaryDailyDao.getUserRank(customerId);
KcUserRankResultDTO rank = new KcUserRankResultDTO();
list.stream().forEach(i -> {
rank.getGridNameDataList().add(i.getGridName());
rank.getTotalUserDataList().add(i.getViewUserCount());
});
return rank;
}
@Override
public KcUserPortrayalResultDTO getUserPortrayal(String customerId) {
KcUserPortrayalResultDTO.AgeDistribution ageDistribution = kcUserSummaryDailyDao.getAgeDistribution(customerId);
KcUserPortrayalResultDTO.GenderDistribution genderDistribution = kcUserSummaryDailyDao.getGenderDistribution(customerId);
KcUserPortrayalResultDTO portrayal = new KcUserPortrayalResultDTO();
portrayal.setAgeDistribution(ageDistribution);
portrayal.setGenderDistribution(genderDistribution);
return portrayal;
}
@Override
public KcUserPointRankResultDTO getUserPointsRank(String customerId, Integer pageNo, Integer pageSize) {
if (pageNo != null && pageSize != null) {
PageHelper.startPage(pageNo, pageSize);
}
List<KcUserPointRankResultDTO.KcUserPoint> userPoints = partyUserRankDataDao.listUserPoints(customerId);
KcUserPointRankResultDTO rank = new KcUserPointRankResultDTO();
userPoints.stream().forEach(p -> {
rank.getUserNameDataList().add(p.getUserName());
rank.getPointsDataList().add(p.getPointTotal());
});
return rank;
}
@Override
public ScreenKcNewsSummaryResultDTO getNewsSummary(String customerId) {
return screenKcNewsSummaryDailyDao.getNewsSummary(customerId);
}
@Override
public ScreenKcNewsPartiTrendResultDTO getNewsPartiTrend(String customerId) {
List<ScreenKcNewsPartiTrendResultDTO.ScreenKcNewsPartyCount> partyCounts =
screenKcNewsTrendMonthlyDao.getNewsPartiTrend(customerId);
ScreenKcNewsPartiTrendResultDTO trend = new ScreenKcNewsPartiTrendResultDTO();
partyCounts.stream().forEach(pc -> {
String monthId = pc.getMonthId();
trend.getxAxis().add(new Integer(monthId.substring(4)).toString().concat("月"));
trend.getPartiCountDataList().add(pc.getPartiCount());
});
return null;
return trend;
}
@Override
public List<ScreenKcCategoryNewsCountResultDTO> getNewsCountOfCategory(String customerId) {
return screenKcNewsCategoryAnalysisDao.getNewsCountOfCategory(customerId);
}
@Override
public ScreenKcCategoryNewsRankResultDTO getNewsPartiCategoryRank(String customerId) {
List<ScreenKcCategoryNewsCountResultDTO> partiCounts = screenKcNewsCategoryAnalysisDao.listNewsPartiCategoryRank(customerId);
ScreenKcCategoryNewsRankResultDTO rank = new ScreenKcCategoryNewsRankResultDTO();
partiCounts.stream().forEach(pc -> {
rank.getxAxis().add(pc.getCategoryName());
rank.getPartiCountDataList().add(pc.getPartiCount());
});
return rank;
}
@Override
public List<ScreenKcNewsHotRankResultDTO> getNewsHotRank(String customerId, Integer pageNo, Integer pageSize) {
if (pageNo != null && pageSize != null) {
PageHelper.startPage(pageNo, pageSize);
}
return screenKcNewsRankDao.getNewsHotRank(customerId);
}
}

9
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml

@ -35,4 +35,13 @@
ORDER BY
POINT_TOTAL DESC
</select>
<select id="listUserPoints" resultType="com.epmet.dto.result.user.KcUserPointRankResultDTO$KcUserPoint">
select ur.USER_NAME userName,
ur.POINT_TOTAL pointTotal
from screen_party_user_rank_data ur
where ur.DEL_FLAG = 0
and ur.CUSTOMER_ID = #{customerId}
order by ur.POINT_TOTAL desc
</select>
</mapper>

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

@ -31,6 +31,7 @@
where t21.CUSTOMER_ID = #{customerId}) latest
on (isd.CUSTOMER_ID = latest.customerId and isd.DATE_ID = latest.max_date_id)
order by isd.ISSUE_COUNT desc
limit 7
</select>
<select id="getAvgAuditTimeRank" resultType="com.epmet.dto.result.issue.IssueAvgAuditTimeDTO">
@ -42,6 +43,7 @@
where t21.CUSTOMER_ID = #{customerId}) latest
on (isd.CUSTOMER_ID = latest.customerId and isd.DATE_ID = latest.max_date_id)
order by isd.AVG_AUDIT_TIME desc
limit 7
</select>
<select id="getIssueEffective" resultType="com.epmet.dto.result.issue.IssueEffectResultDTO">

30
epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsCategoryAnalysisDao.xml

@ -3,4 +3,34 @@
<mapper namespace="com.epmet.datareport.dao.evaluationindex.screenkc.ScreenKcNewsCategoryAnalysisDao">
<select id="getNewsCountOfCategory"
resultType="com.epmet.dto.result.user.ScreenKcCategoryNewsCountResultDTO">
select pcd.CATEGORY_ID categoryId,
pcd.CATEGORY_NAME categoryName,
pcd.NEWS_COUNT newsCount
from screen_kc_news_category_analysis pcd
inner join (
select CUSTOMER_ID, max(DATE_ID) MAX_DATE_ID
from screen_kc_news_category_analysis
where CUSTOMER_ID = #{customerId}
and DEL_FLAG = 0
) latest on (pcd.CUSTOMER_ID = latest.CUSTOMER_ID and pcd.DATE_ID = latest.MAX_DATE_ID)
where pcd.DEL_FLAG = 0
order by pcd.NEWS_COUNT asc
</select>
<select id="listNewsPartiCategoryRank"
resultType="com.epmet.dto.result.user.ScreenKcCategoryNewsCountResultDTO">
select pcd.CATEGORY_NAME categoryName,
(pcd.READ_COUNT + pcd.LIKE_COUNT + pcd.DIS_LIKE_COUNT) partiCount
from screen_kc_news_category_analysis pcd
inner join (
select CUSTOMER_ID, max(DATE_ID) MAX_DATE_ID
from screen_kc_news_category_analysis
where CUSTOMER_ID = #{customerId}
and DEL_FLAG = 0
) latest on (pcd.CUSTOMER_ID = latest.CUSTOMER_ID and pcd.DATE_ID = latest.MAX_DATE_ID)
where pcd.DEL_FLAG = 0
order by partiCount desc
</select>
</mapper>

16
epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsRankDao.xml

@ -3,6 +3,18 @@
<mapper namespace="com.epmet.datareport.dao.evaluationindex.screenkc.ScreenKcNewsRankDao">
<select id="getNewsHotRank" resultType="com.epmet.dto.result.user.ScreenKcNewsHotRankResultDTO">
select pcd.NEWS_ID newsId,
pcd.NEWS_TITLE newsTitle,
pcd.HOT_COUNT hotCount
from screen_kc_news_rank pcd
inner join (
select CUSTOMER_ID, max(DATE_ID) MAX_DATE_ID
from screen_kc_news_rank
where CUSTOMER_ID = #{customerId}
and DEL_FLAG = 0
) latest on (pcd.CUSTOMER_ID = latest.CUSTOMER_ID and pcd.DATE_ID = latest.MAX_DATE_ID)
where pcd.DEL_FLAG = 0
order by pcd.HOT_COUNT desc
</select>
</mapper>

18
epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsSummaryDailyDao.xml

@ -3,6 +3,20 @@
<mapper namespace="com.epmet.datareport.dao.evaluationindex.screenkc.ScreenKcNewsSummaryDailyDao">
<select id="getNewsSummary" resultType="com.epmet.dto.result.user.ScreenKcNewsSummaryResultDTO">
select ns.DATE_ID dateId,
ns.NEWS_COUNT newsCount,
ns.READ_COUNT readCount,
ns.COMMENT_COUNT commentCount,
ns.LIKE_COUNT likeCount
from screen_kc_news_summary_daily ns
inner join (
select CUSTOMER_ID,
max(DATE_ID) MAX_DATE_ID
from screen_kc_news_summary_daily
where DEL_FLAG = 0
and CUSTOMER_ID = #{customerId}
) latest on (ns.CUSTOMER_ID = latest.CUSTOMER_ID and ns.DATE_ID = latest.MAX_DATE_ID)
where ns.DEL_FLAG = 0
</select>
</mapper>

11
epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsTrendMonthlyDao.xml

@ -3,6 +3,13 @@
<mapper namespace="com.epmet.datareport.dao.evaluationindex.screenkc.ScreenKcNewsTrendMonthlyDao">
<select id="getNewsPartiTrend"
resultType="com.epmet.dto.result.user.ScreenKcNewsPartiTrendResultDTO$ScreenKcNewsPartyCount">
select ntm.MONTH_ID, ntm.PARTI_COUNT
from screen_kc_news_trend_monthly ntm
where ntm.CUSTOMER_ID = #{customerId}
and ntm.DEL_FLAG = 0
order by MONTH_ID asc
limit 12
</select>
</mapper>

17
epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcProjectSatisGridMonthlyDao.xml

@ -3,6 +3,19 @@
<mapper namespace="com.epmet.datareport.dao.evaluationindex.screenkc.ScreenKcProjectSatisGridMonthlyDao">
<select id="getProjectSatisfactionAnalyze" resultType="com.epmet.dto.result.project.ProjectSatisfactionResultDTO">
select t.monthId, greatSatis, goodSatis, disSatis
from (
select psm.MONTH_ID monthId,
sum(psm.GREAT_SATIS) greatSatis,
sum(psm.GOOD_SATIS) goodSatis,
sum(psm.DIS_SATIS) disSatis
from screen_kc_project_satis_grid_monthly psm
where psm.DEL_FLAG = 0
and psm.CUSTOMER_ID = #{customerId}
group by psm.MONTH_ID
) t
order by t.monthId asc
limit 12
</select>
</mapper>

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

@ -36,6 +36,7 @@
) 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
limit 7
</select>
<!--网格的项目平均结案时间分析-->

56
epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcUserSummaryDailyDao.xml

@ -3,6 +3,62 @@
<mapper namespace="com.epmet.datareport.dao.evaluationindex.screenkc.ScreenKcUserSummaryDailyDao">
<select id="getUserSummary" resultType="com.epmet.dto.result.project.UserSummaryResultDTO">
select usd.DATE_ID,
sum(usd.VISITOR_COUNT) vistorCount,
sum(usd.REG_USER_COUNT) regUserCount,
sum(usd.PARTY_USER_COUNT) partyUserCount
from screen_kc_user_summary_daily usd
inner join (
select max(DATE_ID) MAX_DATE_ID, CUSTOMER_ID
from screen_kc_user_summary_daily
where CUSTOMER_ID = #{customerId}
) latest on (usd.DATE_ID = latest.MAX_DATE_ID and usd.CUSTOMER_ID = latest.CUSTOMER_ID)
where DEL_FLAG = 0
</select>
<select id="getUserRank" resultType="com.epmet.dto.result.user.KcUserRankResultDTO">
select usd.GRID_ID gridId,
usd.GRID_NAME gridName,
usd.VISITOR_COUNT viewUserCount
from screen_kc_user_summary_daily usd
inner join (
select max(DATE_ID) MAX_DATE_ID, CUSTOMER_ID
from screen_kc_user_summary_daily
where DEL_FLAG = 0
and CUSTOMER_ID = #{customerId}
) latest on (usd.DATE_ID = latest.MAX_DATE_ID and usd.CUSTOMER_ID = latest.CUSTOMER_ID)
order by viewUserCount desc
limit 7
</select>
<select id="getAgeDistribution"
resultType="com.epmet.dto.result.user.KcUserPortrayalResultDTO$AgeDistribution">
select sum(AGE_LEVEL_1) ageLevel1,
sum(AGE_LEVEL_2) ageLevel2,
sum(AGE_LEVEL_3) ageLevel3,
sum(AGE_LEVEL_4) ageLevel4,
sum(AGE_LEVEL_5) ageLevel5,
sum(AGE_LEVEL_6) ageLevel6
from screen_kc_user_summary_daily usd
inner join (
select max(DATE_ID) MAX_DATE_ID, CUSTOMER_ID
from screen_kc_user_summary_daily
where DEL_FLAG = 0
and CUSTOMER_ID = #{customerId}
) latest on (usd.DATE_ID = latest.MAX_DATE_ID and usd.CUSTOMER_ID = latest.CUSTOMER_ID)
</select>
<select id="getGenderDistribution"
resultType="com.epmet.dto.result.user.KcUserPortrayalResultDTO$GenderDistribution">
select sum(MALE_PARTY_USER_COUNT) malePartyUserCount,
sum(FEMALE_PARTY_USER_COUNT) femalePartyUserCount
from screen_kc_user_summary_daily usd
inner join (
select max(DATE_ID) MAX_DATE_ID, CUSTOMER_ID
from screen_kc_user_summary_daily
where DEL_FLAG = 0
and CUSTOMER_ID = #{customerId}
) latest on (usd.DATE_ID = latest.MAX_DATE_ID and usd.CUSTOMER_ID = latest.CUSTOMER_ID)
</select>
</mapper>

13
epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcUserTrendGridMonthlyDao.xml

@ -3,6 +3,15 @@
<mapper namespace="com.epmet.datareport.dao.evaluationindex.screenkc.ScreenKcUserTrendGridMonthlyDao">
<select id="getUserTrend" resultType="com.epmet.dto.result.user.KcUserTrendResultDTO">
select utm.MONTH_ID monthId,
sum(utm.REG_USER_COUNT) regUserCount,
sum(utm.PARTY_USER_COUNT) partyUserCount
from screen_kc_user_trend_grid_monthly utm
where utm.DEL_FLAG = 0
and utm.CUSTOMER_ID = #{customerId}
group by utm.MONTH_ID
order by utm.MONTH_ID asc
limit 12
</select>
</mapper>

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

@ -115,6 +115,7 @@ public class IndexCalculateController {
/**
* 指标计算
*
* @param formDTO
*/
private void indexCalculate(CalculateCommonFormDTO formDTO) {
@ -137,29 +138,34 @@ public class IndexCalculateController {
/**
* 提交异步计算
*
* @param formDTO
* @return
*/
private void submitCalculate(CalculateCommonFormDTO formDTO) {
Future<?> future = singleThreadPool.submit(() -> {
long start = System.currentTimeMillis();
Boolean aBoolean = indexCalculateService.indexCalculate(formDTO);
if (aBoolean) {
log.error("客户Id:{},全部指标计算完成,总耗时:{}秒", formDTO.getCustomerId(), (System.currentTimeMillis() - start) / 1000);
}
try {
long start = System.currentTimeMillis();
Boolean aBoolean = indexCalculateService.indexCalculate(formDTO);
if (aBoolean) {
log.error("客户Id:{},全部指标计算完成,总耗时:{}秒", formDTO.getCustomerId(), (System.currentTimeMillis() - start) / 1000);
}
redisUtils.delete(RedisKeys.getCustomerStatsCalFlag(formDTO.getCustomerId()));
futureMap.remove(formDTO.getCustomerId());
redisUtils.delete(RedisKeys.getCustomerStatsCalFlag(formDTO.getCustomerId()));
futureMap.remove(formDTO.getCustomerId());
//测试代码
//try {
// Thread.sleep(20000l);
// System.out.println(System.currentTimeMillis());
//} catch (InterruptedException e) {
// e.printStackTrace();
//}
//redisUtils.delete(RedisKeys.getCustomerStatsCalFlag(formDTO.getCustomerId()));
//futureMap.remove(formDTO.getCustomerId());
//测试代码
//try {
// Thread.sleep(20000l);
// System.out.println(System.currentTimeMillis());
//} catch (InterruptedException e) {
// e.printStackTrace();
//}
//redisUtils.delete(RedisKeys.getCustomerStatsCalFlag(formDTO.getCustomerId()));
//futureMap.remove(formDTO.getCustomerId());
} catch (Exception e) {
log.warn("submitCalculate exception", e);
}
});
futureMap.put(formDTO.getCustomerId(), future);
@ -172,6 +178,7 @@ public class IndexCalculateController {
/**
* 终止计算
*
* @param form
* @return
*/
@ -194,10 +201,14 @@ public class IndexCalculateController {
@PostMapping("reAll")
public Result<Boolean> calculateAll(@RequestBody CalculateCommonFormDTO formDTO) {
long start = System.currentTimeMillis();
Boolean aBoolean = indexCalculateService.indexCalculate(formDTO);
HttpClientManager.getInstance().sendAlarmMsg(EnvEnum.getCurrentEnv().getName() + "客户Id:" + formDTO.getCustomerId() + ",calculateAll全部指标计算完成,是否成功:" + aBoolean + ",总耗时:" + (System.currentTimeMillis() - start) / 1000 + "秒");
if (aBoolean) {
return new Result<Boolean>().ok(true);
try {
Boolean aBoolean = indexCalculateService.indexCalculate(formDTO);
HttpClientManager.getInstance().sendAlarmMsg(EnvEnum.getCurrentEnv().getName() + "客户Id:" + formDTO.getCustomerId() + ",calculateAll全部指标计算完成,是否成功:" + aBoolean + ",总耗时:" + (System.currentTimeMillis() - start) / 1000 + "秒");
if (aBoolean) {
return new Result<Boolean>().ok(true);
}
} catch (Exception e) {
return new Result<Boolean>().error(e.getMessage());
}
return new Result<Boolean>().error("指标计算失败");
}

35
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java

@ -34,8 +34,8 @@ import java.util.List;
@Mapper
public interface ScreenCustomerAgencyDao extends BaseDao<ScreenCustomerAgencyEntity> {
/**
*14组织层级
* 1) 根据CUSTOMER_ID 进行查询如果有数据则先进行物理删除, 一次删除1000条
* 14组织层级
* 1) 根据CUSTOMER_ID 进行查询如果有数据则先进行物理删除, 一次删除1000条
*
* @param customerId
* @return java.util.Integer
@ -46,24 +46,25 @@ public interface ScreenCustomerAgencyDao extends BaseDao<ScreenCustomerAgencyEnt
/**
* 14组织层级
* 2) 在批量新增
* 2) 在批量新增
*
* @param list
* @param customerId
* @Author zhangyong
* @Date 10:52 2020-08-18
**/
void batchInsertCustomerAgency(@Param("list") List<CustomerAgencyFormDTO> list, @Param("customerId")String customerId);
void batchInsertCustomerAgency(@Param("list") List<CustomerAgencyFormDTO> list, @Param("customerId") String customerId);
/**
* 返回当前客户下未匹配到的 社区级 组织信息
* @param customerId 客户id
* @param agencyIds 组织id集合
*
* @param customerId 客户id
* @param agencyIds 组织id集合
* @return java.util.List<com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity>
* @Author zhangyong
* @Date 14:38 2020-09-04
**/
List<ScreenCustomerAgencyEntity> selectListMismatcCommunityAgencyInfo(@Param("customerId")String customerId, @Param("agencyIds") String[] agencyIds);
List<ScreenCustomerAgencyEntity> selectListMismatcCommunityAgencyInfo(@Param("customerId") String customerId, @Param("agencyIds") String[] agencyIds);
/**
* 根据客户id查询区/街道 组织名称id
@ -73,24 +74,32 @@ public interface ScreenCustomerAgencyDao extends BaseDao<ScreenCustomerAgencyEnt
* @Author zhangyong
* @Date 16:57 2020-09-03
**/
List<ScreenCustomerAgencyEntity> selectListAgencyInfo(@Param("customerId")String customerId);
List<ScreenCustomerAgencyEntity> selectListAgencyInfo(@Param("customerId") String customerId);
/**
* @Description 根据agencyId查询上级组织Id
* @param agencyId
* @Description 根据agencyId查询上级组织Id
* @author zxc
* @date 2020/9/8 3:36 下午
*/
String selectPid(@Param("agencyId")String agencyId);
String selectPid(@Param("agencyId") String agencyId);
/**
* 返回当前客户下未匹配到的 街道区县级 组织信息
* @param customerId 客户id
* @param agencyIds 组织id集合
*
* @param customerId 客户id
* @param agencyIds 组织id集合
* @return java.util.List<com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity>
* @Author zhangyong
* @Date 14:38 2020-09-04
**/
List<ScreenCustomerAgencyEntity> selectListMismatcStreetAndDistrictAgencyInfo(@Param("customerId")String customerId, @Param("agencyIds") String[] agencyIds);
List<ScreenCustomerAgencyEntity> selectListMismatcStreetAndDistrictAgencyInfo(@Param("customerId") String customerId, @Param("agencyIds") String[] agencyIds);
/**
* desc:获取客户的组织条数
*
* @param customerId
* @return
*/
int selectCountByCustomerId(@Param("customerId") String customerId);
}

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

@ -75,8 +75,8 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
//获取指标权重
List<IndexGroupDetailEntity> parentIndexDetails = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode());
if (CollectionUtils.isEmpty(parentIndexDetails)) {
log.warn("cpcIndexCalculate customerId:{} have not any indexGroupDetail", formDTO.getCustomerId());
throw new RenException("客户【党员相关】指标权重信息不存在");
log.error("cpcIndexCalculate customerId:{} have not init index", formDTO.getCustomerId());
throw new RenException("客户Id:" + formDTO.getCustomerId() + "【党员相关】指标权重信息不存在");
}
Map<String, IndexGroupDetailEntity> indexWeightMap = parentIndexDetails.stream().collect(Collectors.toMap(IndexGroupDetailEntity::getIndexCode, o -> o));
int pageNo = NumConstant.ONE;

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

@ -6,6 +6,7 @@ import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.redis.IndexCalRedis;
@ -47,6 +48,8 @@ public class IndexCalculateServiceImpl implements IndexCalculateService {
private DeptScoreService deptScoreService;
@Autowired
private FactIndexCollectService factIndexCollectService;
@Autowired
private ScreenCustomerAgencyDao screenCustomerAgencyDao;
@Override
@ -91,6 +94,12 @@ public class IndexCalculateServiceImpl implements IndexCalculateService {
Boolean flag;
long start = System.currentTimeMillis();
try {
//校验是否含有组织数据
int agencyCount = screenCustomerAgencyDao.selectCountByCustomerId(formDTO.getCustomerId());
if (agencyCount < 1) {
log.info("客户id:{},组织结构数据缺失,请先上传后再计算", formDTO.getCustomerId());
throw new RenException("组织结构数据缺失,请先上传后再计算");
}
//计算党员相关的
try {

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

@ -64,6 +64,10 @@ public class BatchScoreCalculator {
} else {
normalizeValue = scoreCalculator.normalize(getFinalSampleValue(vo.getSampleValue(), threshold));
}
//反正切函数 [-pi/2,pi/2]
if (idx.getScoreCalculator().getMaxValue().compareTo(idx.getScoreCalculator().getMinValue()) == 0) {
normalizeValue = new BigDecimal(Math.atan(new Double(vo.getSampleValue().toString())) / Math.PI * 100).setScale(6, RoundingMode.HALF_UP);
}
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/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml

@ -128,4 +128,9 @@
</foreach>
</if>
</select>
<select id="selectCountByCustomerId" resultType="int">
select count(*) from screen_customer_agency
where DEL_FLAG = '0' and CUSTOMER_ID = #{customerId}
</select>
</mapper>

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

@ -257,5 +257,33 @@ public class DemoScoreCal {
System.err.println("-----------------2222222222---------------");
}
@Test
public void testMath() {
// 每个指标需要单独的分支计算器,因为每个指标的最大最小值是不同的
ScoreCalculator<Integer> sc1 = new BigDecimalScoreCalculator(new BigDecimal(8), new BigDecimal(8), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE);
ScoreCalculator<Integer> sc2 = new BigDecimalScoreCalculator(new BigDecimal(10), new BigDecimal(10), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE);
List<SampleValue<Integer>> index1SampleValues = Arrays.asList(new SampleValue<>("id1", 4), new SampleValue<>("id2", 1), new SampleValue<>("id3", 8));
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), 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);
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
HashMap<String, CalculateResult> result = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS);
System.err.println("--------------------------------");
result.forEach((key, value) -> {
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("--------------------------------");
}
}

17
epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/MathUtilTest.java

@ -0,0 +1,17 @@
package com.epmet.stats.test.normalizing;
public class MathUtilTest {
public static void main(String[] args) {
double tan = Math.atan(4);
double tan2 = Math.atan(1);
double tan3 = Math.atan(8);
double tan4 = Math.atan(3);
System.out.println((tan / Math.PI));
System.out.println((tan2 / Math.PI));
System.out.println((tan3 / Math.PI));
System.out.println((tan4 / Math.PI * 200));
}
}
Loading…
Cancel
Save