From cbae166d00a043c4235b7235550cc9936cc9bc17 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 16 Sep 2020 16:24:34 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=AD=94=E6=9D=91=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=BC=80=E5=8F=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../result/issue/KcPartiTrendResultDTO.java | 34 ++++- .../result/project/ProjectSatisfaction.java | 23 --- .../project/ProjectSatisfactionResultDTO.java | 87 +++++++++++ .../result/project/UserSummaryResultDTO.java | 13 ++ .../result/user/KcUserPointRankResultDTO.java | 20 +++ .../result/user/KcUserPortrayalResultDTO.java | 29 ++++ .../dto/result/user/KcUserRankResultDTO.java | 19 +++ .../dto/result/user/KcUserTrendResultDTO.java | 63 ++++++++ .../ScreenKcCategoryNewsCountResultDTO.java | 12 ++ .../ScreenKcCategoryNewsRankResultDTO.java | 26 ++++ .../user/ScreenKcNewsHotRankResultDTO.java | 12 ++ .../user/ScreenKcNewsPartiTrendResultDTO.java | 37 +++++ .../user/ScreenKcNewsSummaryResultDTO.java | 14 ++ .../controller/screen/KcScreenController.java | 133 ++++++++++++++++- .../screen/ScreenPartyUserRankDataDao.java | 2 + .../ScreenKcNewsCategoryAnalysisDao.java | 6 + .../screenkc/ScreenKcNewsRankDao.java | 4 + .../screenkc/ScreenKcNewsSummaryDailyDao.java | 2 + .../screenkc/ScreenKcNewsTrendMonthlyDao.java | 4 + .../ScreenKcProjectSatisGridMonthlyDao.java | 4 + .../screenkc/ScreenKcUserSummaryDailyDao.java | 12 ++ .../ScreenKcUserTrendGridMonthlyDao.java | 4 + .../screen/KcScreenService.java | 23 ++- .../screen/impl/KcScreenServiceImpl.java | 137 +++++++++++++++++- .../screen/ScreenPartyUserRankDataDao.xml | 9 ++ .../ScreenKcIssueSummaryGridDailyDao.xml | 2 + .../ScreenKcNewsCategoryAnalysisDao.xml | 30 ++++ .../mapper/screenkc/ScreenKcNewsRankDao.xml | 16 +- .../screenkc/ScreenKcNewsSummaryDailyDao.xml | 18 ++- .../screenkc/ScreenKcNewsTrendMonthlyDao.xml | 11 +- .../ScreenKcProjectSatisGridMonthlyDao.xml | 17 ++- .../ScreenKcProjectSummaryGridDailyDao.xml | 1 + .../screenkc/ScreenKcUserSummaryDailyDao.xml | 56 +++++++ .../ScreenKcUserTrendGridMonthlyDao.xml | 13 +- 34 files changed, 848 insertions(+), 45 deletions(-) delete mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/ProjectSatisfaction.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/ProjectSatisfactionResultDTO.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/UserSummaryResultDTO.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserPointRankResultDTO.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserPortrayalResultDTO.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserRankResultDTO.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserTrendResultDTO.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcCategoryNewsCountResultDTO.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcCategoryNewsRankResultDTO.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcNewsHotRankResultDTO.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcNewsPartiTrendResultDTO.java create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcNewsSummaryResultDTO.java diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/issue/KcPartiTrendResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/issue/KcPartiTrendResultDTO.java index 5b7db61bbb..ee831f9761 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/issue/KcPartiTrendResultDTO.java +++ b/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 xAxis = new ArrayList<>(); private List 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 getxAxis() { + return xAxis; + } + + public void setxAxis(List xAxis) { + this.xAxis = xAxis; + } + + public List getReportCountDataList() { + return reportCountDataList; + } + + public void setReportCountDataList(List reportCountDataList) { + this.reportCountDataList = reportCountDataList; + } } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/ProjectSatisfaction.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/ProjectSatisfaction.java deleted file mode 100644 index 03d1c9bded..0000000000 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/ProjectSatisfaction.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.epmet.dto.result.project; - -import lombok.Data; - -import java.util.List; - -@Data -public class ProjectSatisfaction { - - private List xAxis; - private List greatSatisDataList; - private List goodStatisDataList; - private List disStatisDataList; - - private String monthId; - private String monthName; - // 满意 - private Integer goodSatis; - // 非常满意 - private Integer greatSatis; - // 不满意 - private Integer disSatis; -} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/ProjectSatisfactionResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/ProjectSatisfactionResultDTO.java new file mode 100644 index 0000000000..717fc32c23 --- /dev/null +++ b/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 xAxis = new ArrayList<>(); + private List greatSatisDataList = new ArrayList<>(); + private List goodSatisDataList = new ArrayList<>(); + private List disSatisDataList = new ArrayList<>(); + + private String monthId; + // 满意 + private Integer goodSatis; + // 非常满意 + private Integer greatSatis; + // 不满意 + private Integer disSatis; + + public List getxAxis() { + return xAxis; + } + + public void setxAxis(List xAxis) { + this.xAxis = xAxis; + } + + public List getGreatSatisDataList() { + return greatSatisDataList; + } + + public void setGreatSatisDataList(List greatSatisDataList) { + this.greatSatisDataList = greatSatisDataList; + } + + public List getGoodSatisDataList() { + return goodSatisDataList; + } + + public void setGoodSatisDataList(List goodSatisDataList) { + this.goodSatisDataList = goodSatisDataList; + } + + public List getDisSatisDataList() { + return disSatisDataList; + } + + public void setDisSatisDataList(List 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; + } +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/UserSummaryResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/UserSummaryResultDTO.java new file mode 100644 index 0000000000..926310a31d --- /dev/null +++ b/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; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserPointRankResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserPointRankResultDTO.java new file mode 100644 index 0000000000..51d156b993 --- /dev/null +++ b/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 userNameDataList = new ArrayList<>(); + private List pointsDataList = new ArrayList<>(); + + @Data + public static class KcUserPoint { + private String userId; + private String userName; + private Integer pointTotal; + } +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserPortrayalResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserPortrayalResultDTO.java new file mode 100644 index 0000000000..c87ddbc2cd --- /dev/null +++ b/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; + } + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserRankResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserRankResultDTO.java new file mode 100644 index 0000000000..f29c9e3124 --- /dev/null +++ b/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 gridNameDataList = new ArrayList<>(); + private List totalUserDataList = new ArrayList<>(); + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserTrendResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserTrendResultDTO.java new file mode 100644 index 0000000000..5c2ef112d7 --- /dev/null +++ b/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 xAxis = new ArrayList<>(); + private List userDataList = new ArrayList<>(); + private List 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 getxAxis() { + return xAxis; + } + + public void setxAxis(List xAxis) { + this.xAxis = xAxis; + } + + public List getUserDataList() { + return userDataList; + } + + public void setUserDataList(List userDataList) { + this.userDataList = userDataList; + } + + public List getPartyUserDataList() { + return partyUserDataList; + } + + public void setPartyUserDataList(List partyUserDataList) { + this.partyUserDataList = partyUserDataList; + } +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcCategoryNewsCountResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcCategoryNewsCountResultDTO.java new file mode 100644 index 0000000000..09d2fb8584 --- /dev/null +++ b/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; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcCategoryNewsRankResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcCategoryNewsRankResultDTO.java new file mode 100644 index 0000000000..1d2d60f98d --- /dev/null +++ b/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 xAxis = new ArrayList<>(); + private List partiCountDataList = new ArrayList<>(); + + public List getxAxis() { + return xAxis; + } + + public void setxAxis(List xAxis) { + this.xAxis = xAxis; + } + + public List getPartiCountDataList() { + return partiCountDataList; + } + + public void setPartiCountDataList(List partiCountDataList) { + this.partiCountDataList = partiCountDataList; + } +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcNewsHotRankResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcNewsHotRankResultDTO.java new file mode 100644 index 0000000000..2fe7201164 --- /dev/null +++ b/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; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcNewsPartiTrendResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcNewsPartiTrendResultDTO.java new file mode 100644 index 0000000000..c240f7da10 --- /dev/null +++ b/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 xAxis = new ArrayList<>(); + + private List partiCountDataList = new ArrayList<>(); + + @Data + public static class ScreenKcNewsPartyCount { + + private String monthId; + private Integer partiCount; + + } + + public List getxAxis() { + return xAxis; + } + + public void setxAxis(List xAxis) { + this.xAxis = xAxis; + } + + public List getPartiCountDataList() { + return partiCountDataList; + } + + public void setPartiCountDataList(List partiCountDataList) { + this.partiCountDataList = partiCountDataList; + } +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcNewsSummaryResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcNewsSummaryResultDTO.java new file mode 100644 index 0000000000..0cf7fab7cd --- /dev/null +++ b/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; + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java index d6d3c8bcbf..a3f03120df 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java @@ -4,9 +4,11 @@ import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; 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.dao.evaluationindex.screenkc.ScreenKcNewsSummaryDailyDao; import com.epmet.datareport.service.evaluationindex.screen.KcScreenService; import com.epmet.dto.result.issue.IssueGridTotalRankDTO; 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; @@ -123,7 +125,7 @@ public class KcScreenController { } /** - * 议题分析-审核效率 + * 议题分析-议题效率 * @param externalAppRequestParam * @return */ @@ -277,14 +279,133 @@ public class KcScreenController { * @param externalAppRequestParam * @return */ - //@ExternalAppRequestAuth + @ExternalAppRequestAuth @PostMapping("project/statis") - public Result getProjectSatisfactionAnalyze(ExternalAppRequestParam externalAppRequestParam){ - String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933"; - //String customerId = externalAppRequestParam.getCustomerId(); - return new Result().ok(kcScreenService.getProjectSatisfactionAnalyze(customerId)); + public Result getProjectSatisfactionAnalyze(ExternalAppRequestParam externalAppRequestParam){ + String customerId = externalAppRequestParam.getCustomerId(); + return new Result().ok(kcScreenService.getProjectSatisfactionAnalyze(customerId)); + } + + /** + * 用户-summary + * @param externalAppRequestParam + * @return + */ + @ExternalAppRequestAuth + @PostMapping("user/summary") + public Result getUserSummary(ExternalAppRequestParam externalAppRequestParam){ + String customerId = externalAppRequestParam.getCustomerId(); + //String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933"; + return new Result().ok(kcScreenService.getUserSummary(customerId)); + } + + /** + * 用户量趋势 + * @param externalAppRequestParam + * @return + */ + @ExternalAppRequestAuth + @PostMapping("user/trend") + public Result getUserTrend(ExternalAppRequestParam externalAppRequestParam){ + String customerId = externalAppRequestParam.getCustomerId(); + return new Result().ok(kcScreenService.getUserTrend(customerId)); + } + + /** + * 网格用户排名 + * @param externalAppRequestParam + * @return + */ + @ExternalAppRequestAuth + @PostMapping("user/griduserrank") + public Result getUserRank(ExternalAppRequestParam externalAppRequestParam){ + String customerId = externalAppRequestParam.getCustomerId(); + return new Result().ok(kcScreenService.getUserRank(customerId)); + } + + /** + * 用户画像 + * @param externalAppRequestParam + * @return + */ + @ExternalAppRequestAuth + @PostMapping("user/userportrayal") + public Result getUserPortrayal(ExternalAppRequestParam externalAppRequestParam){ + String customerId = externalAppRequestParam.getCustomerId(); + return new Result().ok(kcScreenService.getUserPortrayal(customerId)); + } + + /** + * 用户积分排名 + * @param externalAppRequestParam + * @return + */ + @ExternalAppRequestAuth + @PostMapping("user/pointsrank") + public Result getUserPointsRank(ExternalAppRequestParam externalAppRequestParam){ + String customerId = externalAppRequestParam.getCustomerId(); + return new Result().ok(kcScreenService.getUserPointsRank(customerId)); } + /** + * 党建声音-各类总数 + * @param externalAppRequestParam + * @return + */ + @ExternalAppRequestAuth + @PostMapping("news/summary") + public Result getNewsSummary(ExternalAppRequestParam externalAppRequestParam){ + String customerId = externalAppRequestParam.getCustomerId(); + return new Result().ok(kcScreenService.getNewsSummary(customerId)); + } + + /** + * 新闻阅读参与趋势 + * @param externalAppRequestParam + * @return + */ + @ExternalAppRequestAuth + @PostMapping("news/partitrend") + public Result getNewsPartiTrend(ExternalAppRequestParam externalAppRequestParam){ + String customerId = externalAppRequestParam.getCustomerId(); + return new Result().ok(kcScreenService.getNewsPartiTrend(customerId)); + } + + /** + * 党建声音-分类的news数量 + * @param externalAppRequestParam + * @return + */ + @ExternalAppRequestAuth + @PostMapping("news/category") + public Result> getNewsCountGroupByCategory(ExternalAppRequestParam externalAppRequestParam){ + String customerId = externalAppRequestParam.getCustomerId(); + return new Result>().ok(kcScreenService.getNewsCountOfCategory(customerId)); + } + + /** + * 党建声音-分类的用户参与数排行 + * @param externalAppRequestParam + * @return + */ + @ExternalAppRequestAuth + @PostMapping("news/userparticategoryrank") + public Result getNewsPartiCategoryRank(ExternalAppRequestParam externalAppRequestParam){ + String customerId = externalAppRequestParam.getCustomerId(); + return new Result().ok(kcScreenService.getNewsPartiCategoryRank(customerId)); + } + + /** + * 党建声音-热点新闻排行 + * @param externalAppRequestParam + * @return + */ + @ExternalAppRequestAuth + @PostMapping("news/hotrank") + public Result> listNewsHotRank(ExternalAppRequestParam externalAppRequestParam){ + String customerId = externalAppRequestParam.getCustomerId(); + return new Result>().ok(kcScreenService.getNewsHotRank(customerId)); + } } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPartyUserRankDataDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPartyUserRankDataDao.java index 2c4358ce15..bc15ca191f 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPartyUserRankDataDao.java +++ b/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 selectPartymemberPointOrder(@Param("agencyId")String agencyId); + List listUserPoints(String customerId); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcNewsCategoryAnalysisDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcNewsCategoryAnalysisDao.java index 6a779fb248..ce34407ab0 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcNewsCategoryAnalysisDao.java +++ b/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 getNewsCountOfCategory(String customerId); + + List listNewsPartiCategoryRank(String customerId); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcNewsRankDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcNewsRankDao.java index 6a03be5485..bf42d979df 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcNewsRankDao.java +++ b/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 getNewsHotRank(String customerId); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcNewsSummaryDailyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcNewsSummaryDailyDao.java index ec9d49c5c2..16b215f5f2 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcNewsSummaryDailyDao.java +++ b/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); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcNewsTrendMonthlyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcNewsTrendMonthlyDao.java index c3d60f0b83..92422cf436 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcNewsTrendMonthlyDao.java +++ b/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 getNewsPartiTrend(String customerId); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcProjectSatisGridMonthlyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcProjectSatisGridMonthlyDao.java index 324bc723c5..1a204bc242 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcProjectSatisGridMonthlyDao.java +++ b/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 getProjectSatisfactionAnalyze(String customerId); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcUserSummaryDailyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcUserSummaryDailyDao.java index ff33f78b39..40bb9f7ae3 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcUserSummaryDailyDao.java +++ b/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 getUserRank(String customerId); + + KcUserPortrayalResultDTO.AgeDistribution getAgeDistribution(String customerId); + + KcUserPortrayalResultDTO.GenderDistribution getGenderDistribution(String customerId); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcUserTrendGridMonthlyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcUserTrendGridMonthlyDao.java index 92bb3dce0f..c4010379cd 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcUserTrendGridMonthlyDao.java +++ b/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 getUserTrend(String customerId); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java index bbce62b9c9..f17e492904 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java +++ b/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 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); + + ScreenKcNewsSummaryResultDTO getNewsSummary(String customerId); + + ScreenKcNewsPartiTrendResultDTO getNewsPartiTrend(String customerId); + + List getNewsCountOfCategory(String customerId); + + ScreenKcCategoryNewsRankResultDTO getNewsPartiCategoryRank(String customerId); + + List getNewsHotRank(String customerId); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java index aa49430859..b300d5d4c8 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java +++ b/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; @@ -71,6 +73,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 +188,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 +345,113 @@ public class KcScreenServiceImpl implements KcScreenService { } @Override - public ProjectSatisfaction getProjectSatisfactionAnalyze(String customerId) { + public ProjectSatisfactionResultDTO getProjectSatisfactionAnalyze(String customerId) { + List 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 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 list = kcUserSummaryDailyDao.getUserRank(customerId); - return null; + 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) { + List 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 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 trend; + } + + @Override + public List getNewsCountOfCategory(String customerId) { + return screenKcNewsCategoryAnalysisDao.getNewsCountOfCategory(customerId); + } + + @Override + public ScreenKcCategoryNewsRankResultDTO getNewsPartiCategoryRank(String customerId) { + List 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 getNewsHotRank(String customerId) { + return screenKcNewsRankDao.getNewsHotRank(customerId); } } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml index 8d865b6341..983ced249a 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml @@ -35,4 +35,13 @@ ORDER BY POINT_TOTAL DESC + + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcIssueSummaryGridDailyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcIssueSummaryGridDailyDao.xml index 1c12b7c53c..57c743144f 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcIssueSummaryGridDailyDao.xml +++ b/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 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 + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsRankDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsRankDao.xml index 49fb7817e0..ff51305086 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsRankDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsRankDao.xml @@ -3,6 +3,18 @@ - - + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsSummaryDailyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsSummaryDailyDao.xml index 715ce1f038..1094a408a4 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsSummaryDailyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsSummaryDailyDao.xml @@ -3,6 +3,20 @@ - - + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsTrendMonthlyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsTrendMonthlyDao.xml index 71d977bd38..06d6826cbb 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsTrendMonthlyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsTrendMonthlyDao.xml @@ -3,6 +3,13 @@ - - + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcProjectSatisGridMonthlyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcProjectSatisGridMonthlyDao.xml index 0155931631..0727b6fbb2 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcProjectSatisGridMonthlyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcProjectSatisGridMonthlyDao.xml @@ -3,6 +3,19 @@ - - + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcProjectSummaryGridDailyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcProjectSummaryGridDailyDao.xml index fff84de166..7c79e5da1c 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcProjectSummaryGridDailyDao.xml +++ b/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 diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcUserSummaryDailyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcUserSummaryDailyDao.xml index 7ccf73a888..48e8bc1604 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcUserSummaryDailyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcUserSummaryDailyDao.xml @@ -3,6 +3,62 @@ + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcUserTrendGridMonthlyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcUserTrendGridMonthlyDao.xml index 39f0f5a0fc..f86c96af36 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcUserTrendGridMonthlyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcUserTrendGridMonthlyDao.xml @@ -3,6 +3,15 @@ - - + From 2af96ddbc119417f1741b75a0335c24e237213d0 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 16 Sep 2020 18:17:29 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=83=A8=E5=88=86=E6=8E=A5=E5=8F=A3=E7=9A=84=E5=88=86?= =?UTF-8?q?=E9=A1=B5=20=E4=BF=AE=E6=94=B9=EF=BC=9A=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E9=83=A8=E5=88=86=E6=8E=A5=E5=8F=A3=E7=9A=84=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/dto/PageFormDTO.java | 9 +++++++++ .../controller/screen/KcScreenController.java | 17 +++++++++-------- .../evaluationindex/screen/KcScreenService.java | 4 ++-- .../screen/impl/KcScreenServiceImpl.java | 11 +++++++++-- .../screen/ScreenPartyUserRankDataDao.xml | 2 +- .../ScreenKcNewsCategoryAnalysisDao.xml | 2 +- .../screenkc/ScreenKcUserSummaryDailyDao.xml | 2 +- .../EpmetCommonServiceOpenFeignClient.java | 4 ++-- 8 files changed, 34 insertions(+), 17 deletions(-) create mode 100644 epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/PageFormDTO.java diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/PageFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/PageFormDTO.java new file mode 100644 index 0000000000..c3da303f4d --- /dev/null +++ b/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; +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java index a3f03120df..db794ca26b 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java @@ -4,9 +4,8 @@ import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; 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.dao.evaluationindex.screenkc.ScreenKcNewsSummaryDailyDao; 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; @@ -99,7 +98,7 @@ public class KcScreenController { } /** - * 按照议题总数排名 + * 按照议题数量排名 * @param externalAppRequestParam * @return */ @@ -312,7 +311,7 @@ public class KcScreenController { } /** - * 网格用户排名 + * 网格用户数量排名 * @param externalAppRequestParam * @return */ @@ -342,9 +341,10 @@ public class KcScreenController { */ @ExternalAppRequestAuth @PostMapping("user/pointsrank") - public Result getUserPointsRank(ExternalAppRequestParam externalAppRequestParam){ + public Result getUserPointsRank(ExternalAppRequestParam externalAppRequestParam, + @RequestBody PageFormDTO form) { String customerId = externalAppRequestParam.getCustomerId(); - return new Result().ok(kcScreenService.getUserPointsRank(customerId)); + return new Result().ok(kcScreenService.getUserPointsRank(customerId, form.getPageNo(), form.getPageSize())); } /** @@ -402,9 +402,10 @@ public class KcScreenController { */ @ExternalAppRequestAuth @PostMapping("news/hotrank") - public Result> listNewsHotRank(ExternalAppRequestParam externalAppRequestParam){ + public Result> listNewsHotRank(ExternalAppRequestParam externalAppRequestParam, + @RequestBody PageFormDTO form){ String customerId = externalAppRequestParam.getCustomerId(); - return new Result>().ok(kcScreenService.getNewsHotRank(customerId)); + return new Result>().ok(kcScreenService.getNewsHotRank(customerId, form.getPageNo(), form.getPageSize())); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java index f17e492904..f40e8517ae 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java @@ -123,7 +123,7 @@ public interface KcScreenService { KcUserPortrayalResultDTO getUserPortrayal(String customerId); - KcUserPointRankResultDTO getUserPointsRank(String customerId); + KcUserPointRankResultDTO getUserPointsRank(String customerId, Integer pageNo, Integer pageSize); ScreenKcNewsSummaryResultDTO getNewsSummary(String customerId); @@ -133,5 +133,5 @@ public interface KcScreenService { ScreenKcCategoryNewsRankResultDTO getNewsPartiCategoryRank(String customerId); - List getNewsHotRank(String customerId); + List getNewsHotRank(String customerId, Integer pageNo, Integer pageSize); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java index b300d5d4c8..661a43306a 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java @@ -18,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; @@ -404,7 +405,10 @@ public class KcScreenServiceImpl implements KcScreenService { } @Override - public KcUserPointRankResultDTO getUserPointsRank(String customerId) { + public KcUserPointRankResultDTO getUserPointsRank(String customerId, Integer pageNo, Integer pageSize) { + if (pageNo != null && pageSize != null) { + PageHelper.startPage(pageNo, pageSize); + } List userPoints = partyUserRankDataDao.listUserPoints(customerId); KcUserPointRankResultDTO rank = new KcUserPointRankResultDTO(); userPoints.stream().forEach(p -> { @@ -451,7 +455,10 @@ public class KcScreenServiceImpl implements KcScreenService { } @Override - public List getNewsHotRank(String customerId) { + public List getNewsHotRank(String customerId, Integer pageNo, Integer pageSize) { + if (pageNo != null && pageSize != null) { + PageHelper.startPage(pageNo, pageSize); + } return screenKcNewsRankDao.getNewsHotRank(customerId); } } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml index 983ced249a..9366bc90f7 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml @@ -42,6 +42,6 @@ from screen_party_user_rank_data ur where ur.DEL_FLAG = 0 and ur.CUSTOMER_ID = #{customerId} - order by ur.POINT_TOTAL asc + order by ur.POINT_TOTAL desc \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsCategoryAnalysisDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsCategoryAnalysisDao.xml index da547c9ba0..a93bd0d439 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsCategoryAnalysisDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsCategoryAnalysisDao.xml @@ -31,6 +31,6 @@ 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 convert(pcd.CATEGORY_NAME using gbk) + order by partiCount desc diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcUserSummaryDailyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcUserSummaryDailyDao.xml index 48e8bc1604..5e27540bb9 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcUserSummaryDailyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcUserSummaryDailyDao.xml @@ -28,7 +28,7 @@ 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 asc + order by viewUserCount desc limit 7 diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java index caa9bd6301..a3e26a5d80 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java @@ -19,8 +19,8 @@ import java.util.List; * @author yinzuomei@elink-cn.com * @date 2020/6/4 10:28 */ -@FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallback = EpmetCommonServiceOpenFeignClientFallback.class) -//@FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallback = EpmetCommonServiceOpenFeignClientFallback.class, url = "http://localhost:8103") +//@FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallback = EpmetCommonServiceOpenFeignClientFallback.class) +@FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallback = EpmetCommonServiceOpenFeignClientFallback.class, url = "http://localhost:8103") public interface EpmetCommonServiceOpenFeignClient { /** * @param formDTO From 70cba3bff2a895d3c412b8c4d9838a6b1bb3e160 Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 17 Sep 2020 09:21:13 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9kcscreen=E7=99=BD?= =?UTF-8?q?=E5=90=8D=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-gateway/src/main/resources/bootstrap.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index 323b2a7fca..9748b1ca26 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/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: From 88fccb65fd2d18bbb961c1c5ef39f9742058a664 Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 17 Sep 2020 10:19:25 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E7=9A=84Feignclient?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/feign/EpmetCommonServiceOpenFeignClient.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java index a3e26a5d80..caa9bd6301 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java @@ -19,8 +19,8 @@ import java.util.List; * @author yinzuomei@elink-cn.com * @date 2020/6/4 10:28 */ -//@FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallback = EpmetCommonServiceOpenFeignClientFallback.class) -@FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallback = EpmetCommonServiceOpenFeignClientFallback.class, url = "http://localhost:8103") +@FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallback = EpmetCommonServiceOpenFeignClientFallback.class) +//@FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallback = EpmetCommonServiceOpenFeignClientFallback.class, url = "http://localhost:8103") public interface EpmetCommonServiceOpenFeignClient { /** * @param formDTO From 4fff0c0180da8c7bbe99542ab5c6fae4a8d65031 Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 17 Sep 2020 13:57:02 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=9C=80=E5=A4=A7?= =?UTF-8?q?=E5=80=BC=E6=9C=80=E5=B0=8F=E5=80=BC=E4=B8=80=E8=87=B4=20=20?= =?UTF-8?q?=E5=88=99=E4=BD=BF=E7=94=A8=E5=8F=8D=E6=AD=A3=E5=88=87=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E8=AE=A1=E7=AE=97=E5=88=86=E6=95=B0;2:=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E8=AE=A1=E7=AE=97=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/IndexCalculateController.java | 51 +++++++++++-------- .../screen/ScreenCustomerAgencyDao.java | 35 ++++++++----- .../impl/CpcIndexCalculateServiceImpl.java | 4 +- .../impl/IndexCalculateServiceImpl.java | 9 ++++ .../batch/BatchScoreCalculator.java | 4 ++ .../screen/ScreenCustomerAgencyDao.xml | 5 ++ .../stats/test/normalizing/DemoScoreCal.java | 28 ++++++++++ .../stats/test/normalizing/MathUtilTest.java | 17 +++++++ 8 files changed, 118 insertions(+), 35 deletions(-) create mode 100644 epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/MathUtilTest.java diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java index 4d44af0d47..c6e24b6893 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java +++ b/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 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().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().ok(true); + } + } catch (Exception e) { + return new Result().error(e.getMessage()); } return new Result().error("指标计算失败"); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index 56f6c9d5b4..04e5a0027d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/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 { /** - *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 list, @Param("customerId")String customerId); + void batchInsertCustomerAgency(@Param("list") List list, @Param("customerId") String customerId); /** * 返回当前客户下,未匹配到的 【社区级】 组织信息 - * @param customerId 客户id - * @param agencyIds 组织id集合 + * + * @param customerId 客户id + * @param agencyIds 组织id集合 * @return java.util.List * @Author zhangyong * @Date 14:38 2020-09-04 **/ - List selectListMismatcCommunityAgencyInfo(@Param("customerId")String customerId, @Param("agencyIds") String[] agencyIds); + List selectListMismatcCommunityAgencyInfo(@Param("customerId") String customerId, @Param("agencyIds") String[] agencyIds); /** * 根据客户id,查询区/街道 组织名称、id @@ -73,24 +74,32 @@ public interface ScreenCustomerAgencyDao extends BaseDao selectListAgencyInfo(@Param("customerId")String customerId); + List 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 * @Author zhangyong * @Date 14:38 2020-09-04 **/ - List selectListMismatcStreetAndDistrictAgencyInfo(@Param("customerId")String customerId, @Param("agencyIds") String[] agencyIds); + List selectListMismatcStreetAndDistrictAgencyInfo(@Param("customerId") String customerId, @Param("agencyIds") String[] agencyIds); + /** + * desc:获取客户的组织条数 + * + * @param customerId + * @return + */ + int selectCountByCustomerId(@Param("customerId") String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java index 9d9cfe5739..71359d8b32 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java +++ b/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 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 indexWeightMap = parentIndexDetails.stream().collect(Collectors.toMap(IndexGroupDetailEntity::getIndexCode, o -> o)); int pageNo = NumConstant.ONE; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java index c4fef95f7b..a2703968ec 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java +++ b/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 { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java index b8efe2a1ff..786ec50233 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java @@ -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); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml index 7963aefd4c..49ce41b17c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml @@ -128,4 +128,9 @@ + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java index 05a9360b47..556e4a6029 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java +++ b/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 sc1 = new BigDecimalScoreCalculator(new BigDecimal(8), new BigDecimal(8), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE); + ScoreCalculator sc2 = new BigDecimalScoreCalculator(new BigDecimal(10), new BigDecimal(10), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE); + + List> index1SampleValues = Arrays.asList(new SampleValue<>("id1", 4), new SampleValue<>("id2", 1), new SampleValue<>("id3", 8)); + List> index2SampleValues = Arrays.asList(new SampleValue<>("id1", 1), new SampleValue<>("id2", 8), new SampleValue<>("id3", 3)); + + // 每个指标的信息,包括样本列表,权重,指标标记 + IndexInputVO index1VO = new IndexInputVO<>("aaa", "a:bbb2", index1SampleValues, new BigDecimal(10), new BigDecimal(1), false, sc1); + IndexInputVO index2VO = new IndexInputVO<>("bbb", "a:bbb2", index2SampleValues, new BigDecimal(10), new BigDecimal(1), false, sc2); + + List indexInputVOS = Arrays.asList(index1VO, index2VO); + + BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); + HashMap 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("--------------------------------"); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/MathUtilTest.java b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/MathUtilTest.java new file mode 100644 index 0000000000..bed5fc95b7 --- /dev/null +++ b/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)); + } + +}