From 26dc73b7b03df485bb74af47060ea93ed13fe7c4 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Sun, 28 Jun 2020 12:47:16 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=9B=B4=E5=B1=9E?= =?UTF-8?q?=E7=BD=91=E6=A0=BC=E3=80=81=E7=9B=B4=E5=B1=9E=E6=9C=BA=E5=85=B3?= =?UTF-8?q?=E6=9F=B1=E7=8A=B6=E5=9B=BE=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/impl/UserAnalysisServiceImpl.java | 40 +++++++++++++++---- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/user/impl/UserAnalysisServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/user/impl/UserAnalysisServiceImpl.java index 9e02c60af2..da03803515 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/user/impl/UserAnalysisServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/user/impl/UserAnalysisServiceImpl.java @@ -28,9 +28,9 @@ import org.springframework.util.CollectionUtils; import java.text.DecimalFormat; import java.util.ArrayList; +import java.util.Collections; import java.util.Comparator; import java.util.List; -import java.util.stream.Collectors; /** * 组织能力用户相关接口 @@ -169,10 +169,23 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { logger.error(String.format("各机关注册用户数缺少记录:date_id=%s,agencyId=%s",formDTO.getDateId(),dimInitResultDto.getAgencyId())); } } + logger.info("排序前"); + for(UserSubAgencyResultDTO m:dimList){ + logger.info("机关名:"+m.getName()+",总数="+m.getTotal()); + } //返回集合按照total降序排序 - List returnList = dimList.stream().sorted(Comparator.comparing(UserSubAgencyResultDTO::getTotal)) - .collect(Collectors.toList()); - return returnList; + Collections.sort(dimList, new Comparator() { + @Override + public int compare(UserSubAgencyResultDTO o1, UserSubAgencyResultDTO o2) { + int i=o2.getTotal()-o1.getTotal();//降序 + return i; + } + }); + logger.info("排序后"); + for(UserSubAgencyResultDTO m:dimList){ + logger.info("机关名:"+m.getName()+",总数="+m.getTotal()); + } + return dimList; } private List initUserSubAgencyResultDTO(String myAgencyId) { @@ -273,10 +286,23 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { logger.error(String.format("直属网格注册用户数缺少记录:date_id=%s,gridId=%s",formDTO.getDateId(),dimInitResultDto.getGridId())); } } + logger.info("排序前"); + for(UserSubGridResultDTO m:dimList){ + logger.info("网格名:"+m.getName()+",总数="+m.getTotal()); + } //返回集合按照total降序排序 - List returnList = dimList.stream().sorted(Comparator.comparing(UserSubGridResultDTO::getTotal)) - .collect(Collectors.toList()); - return returnList; + Collections.sort(dimList, new Comparator() { + @Override + public int compare(UserSubGridResultDTO o1, UserSubGridResultDTO o2) { + int i=o2.getTotal()-o1.getTotal();//降序 + return i; + } + }); + logger.info("排序后"); + for(UserSubGridResultDTO m:dimList){ + logger.info("网格名:"+m.getName()+",总数="+m.getTotal()); + } + return dimList; } private List initUserSubGridResultDTO(String myAgencyId) { From e28732d20688d2b885e04e3703849abb25695709 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Sun, 28 Jun 2020 12:49:19 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7+1=EF=BC=9Adatar?= =?UTF-8?q?eport0.3.7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data-report-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/data-report/data-report-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/data-report/data-report-server/deploy/docker-compose-dev.yml b/epmet-module/data-report/data-report-server/deploy/docker-compose-dev.yml index d9df4ec6ab..7382b031d5 100644 --- a/epmet-module/data-report/data-report-server/deploy/docker-compose-dev.yml +++ b/epmet-module/data-report/data-report-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: data-report-server: container_name: data-report-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/data-report-server:0.3.6 + image: 192.168.1.130:10080/epmet-cloud-dev/data-report-server:0.3.7 ports: - "8109:8109" network_mode: host # 使用现有网络 diff --git a/epmet-module/data-report/data-report-server/pom.xml b/epmet-module/data-report/data-report-server/pom.xml index 8cfd6b8fda..e67c1b6c1c 100644 --- a/epmet-module/data-report/data-report-server/pom.xml +++ b/epmet-module/data-report/data-report-server/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - 0.3.6 + 0.3.7 data-report-server From 201bbdd94a5437ab52210c56ea54a4e5a3e54c5b Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Sun, 28 Jun 2020 13:34:09 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=8A=98=E7=BA=BF?= =?UTF-8?q?=E5=9B=BE=E6=97=A5=E5=A2=9E=E9=87=8F=E8=BF=94=E5=9B=9E=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E6=A0=BC=E5=BC=8F=E4=BF=AE=E6=94=B9=E4=B8=BAMM/dd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/service/user/impl/UserAnalysisServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/user/impl/UserAnalysisServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/user/impl/UserAnalysisServiceImpl.java index da03803515..5265749de5 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/user/impl/UserAnalysisServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/user/impl/UserAnalysisServiceImpl.java @@ -425,7 +425,7 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { for(UserIncrTrendResDTO userIncrTrendResDTO:list){ String date=""; if(UserAnalysisConstant.DAY_TYPE.equals(formDTO.getType())){ - date=DateUtils.getxAxisDatePattern(userIncrTrendResDTO.getDateIdOrMonthId(),"."); + date=DateUtils.getxAxisDatePattern(userIncrTrendResDTO.getDateIdOrMonthId(),"/"); }else if(UserAnalysisConstant.MONTH_TYPE.equals(formDTO.getType())){ date=DateUtils.getxAxisDatePattern(userIncrTrendResDTO.getDateIdOrMonthId(),"/"); } From a7c16d2ae630408edacbb3c1200ac178e10b4ff8 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Sun, 28 Jun 2020 13:47:08 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E7=BD=91=E6=A0=BC=E5=B0=8F=E7=BB=84,?= =?UTF-8?q?=E8=AF=9D=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/result/TopicSubAgencyResultDTO.java | 7 +++++ .../dto/result/TopicSubGridResultDTO.java | 7 +++++ .../service/group/impl/GroupServiceImpl.java | 5 +++- .../service/topic/impl/TopicServiceImpl.java | 30 +++++++++++++++---- .../main/resources/mapper/group/GroupDao.xml | 3 +- 5 files changed, 45 insertions(+), 7 deletions(-) diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSubAgencyResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSubAgencyResultDTO.java index 87dd107010..3b599a64ff 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSubAgencyResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSubAgencyResultDTO.java @@ -1,5 +1,6 @@ package com.epmet.topic.dto.result; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -32,4 +33,10 @@ public class TopicSubAgencyResultDTO implements Serializable { * 机关Id */ private String agencyId; + + /** + * 排序 + */ + @JsonIgnore + private Integer sort; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSubGridResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSubGridResultDTO.java index 64cad1615c..d319e2c128 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSubGridResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSubGridResultDTO.java @@ -1,5 +1,6 @@ package com.epmet.topic.dto.result; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -32,4 +33,10 @@ public class TopicSubGridResultDTO implements Serializable { * 网格Id */ private String gridId; + + /** + * 排序 + */ + @JsonIgnore + private Integer sort; } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/group/impl/GroupServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/group/impl/GroupServiceImpl.java index 80a5624e3b..1c72f584fc 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/group/impl/GroupServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/group/impl/GroupServiceImpl.java @@ -15,7 +15,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; +import java.util.stream.Collectors; /** * @Author zxc @@ -60,7 +62,8 @@ public class GroupServiceImpl implements GroupService { } }); }); - return result; + //倒序 + return result.stream().sorted(Comparator.comparing(GroupSubAgencyResultDTO::getValue).reversed()).collect(Collectors.toList()); } return new ArrayList<>(); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java index 0859bd2632..ad8d8e7eee 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java @@ -14,9 +14,7 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; +import java.util.*; import java.util.stream.Collectors; /** @@ -94,6 +92,7 @@ public class TopicServiceImpl implements TopicService { public List topicSubGrid(TokenDto tokenDto) { String agencyId = this.getLoginUserDetails(tokenDto); List result = new ArrayList<>(); + List resultAll = new ArrayList<>(); List subGridIdList = topicDao.getSubGridIdList(agencyId); if (subGridIdList.size() != NumConstant.ZERO){ List gridAllTopicInfoLastDay = topicDao.getGridAllTopicInfoLastDay(); @@ -110,7 +109,17 @@ public class TopicServiceImpl implements TopicService { } }); }); - return result; + Map> collect = result.stream().collect(Collectors.groupingBy(TopicSubGridResultDTO::getGridId)); + Set>> entries = collect.entrySet(); + entries.forEach(entry -> { + List value = entry.getValue(); + Integer sort = value.stream().collect(Collectors.summingInt(TopicSubGridResultDTO::getValue)); + value.forEach(v -> { + v.setSort(sort); + resultAll.add(v); + }); + }); + return resultAll.stream().sorted(Comparator.comparing(TopicSubGridResultDTO::getSort).reversed()).collect(Collectors.toList()); } return new ArrayList<>(); } @@ -124,6 +133,7 @@ public class TopicServiceImpl implements TopicService { public List topicSubAgency(TokenDto tokenDto) { String agencyId = this.getLoginUserDetails(tokenDto); List result = new ArrayList<>(); + List resultAll = new ArrayList<>(); List subAgencyIdList = topicDao.getSubAgencyIdList(agencyId); //存在下级机关 if (subAgencyIdList.size() != NumConstant.ZERO){ @@ -142,7 +152,17 @@ public class TopicServiceImpl implements TopicService { } }); }); - return result; + Map> collect = result.stream().collect(Collectors.groupingBy(TopicSubAgencyResultDTO::getAgencyId)); + Set>> entries = collect.entrySet(); + entries.forEach(entry -> { + List value = entry.getValue(); + Integer sort = value.stream().collect(Collectors.summingInt(TopicSubAgencyResultDTO::getValue)); + value.forEach(v -> { + v.setSort(sort); + resultAll.add(v); + }); + }); + return resultAll.stream().sorted(Comparator.comparing(TopicSubAgencyResultDTO::getSort).reversed()).collect(Collectors.toList()); } //不存在 return new ArrayList<>(); diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/group/GroupDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/group/GroupDao.xml index 6bee70e94b..47b42695ee 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/group/GroupDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/group/GroupDao.xml @@ -59,6 +59,7 @@ fggd.del_flag = '0' AND fggd.agency_id = #{agencyId} AND fggd.date_id = (SELECT MAX(date_id) FROM fact_group_grid_daily WHERE del_flag = '0') + ORDER BY value DESC @@ -89,7 +90,7 @@ del_flag = '0' AND agency_id = #{agencyId} ORDER BY - month_id DESC + month_id DESC, value DESC LIMIT 12 From 2caacd536de147d4effbe29ab7c4c388010fc923 Mon Sep 17 00:00:00 2001 From: jiangyuying Date: Sun, 28 Jun 2020 14:14:57 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E5=AE=A3=E4=BC=A0=E8=83=BD=E5=8A=9B--NEI?= =?UTF-8?q?=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/result/FactTagAgencyDTO.java | 2 +- .../data-report/data-report-server/pom.xml | 2 +- .../mapper/publicity/PublicityDao.xml | 21 +++++++++++++------ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactTagAgencyDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactTagAgencyDTO.java index 1d91a3287a..35cbbc0390 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactTagAgencyDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactTagAgencyDTO.java @@ -47,7 +47,7 @@ public class FactTagAgencyDTO implements Serializable { /** * 固定值:文章数量 */ - private String type="文章数量"; + private String type="阅读次数"; /** * 机关Id diff --git a/epmet-module/data-report/data-report-server/pom.xml b/epmet-module/data-report/data-report-server/pom.xml index a818e16cf5..c4c1073c33 100644 --- a/epmet-module/data-report/data-report-server/pom.xml +++ b/epmet-module/data-report/data-report-server/pom.xml @@ -112,7 +112,7 @@ 123456 - true + false 122.152.200.70:8848 fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/publicity/PublicityDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/publicity/PublicityDao.xml index cd536caa30..c7d032eb43 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/publicity/PublicityDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/publicity/PublicityDao.xml @@ -24,7 +24,7 @@ where agency_id = #{agencyId} AND month_id = #{monthId} GROUP BY TAG_ID - ORDER BY value DESC + ORDER BY value DESC ,tagId ASC LIMIT #{pageSize} @@ -39,7 +39,7 @@ where agency_id = #{agencyId} AND quarter_id = #{quarterId} GROUP BY TAG_ID - ORDER BY value DESC + ORDER BY value DESC ,tagId ASC LIMIT #{pageSize} @@ -54,7 +54,7 @@ where agency_id = #{agencyId} AND year_id = #{yearId} GROUP BY tag_id - ORDER BY value DESC + ORDER BY value DESC ,tagId ASC LIMIT #{pageSize} @@ -69,7 +69,7 @@ where agency_id = #{agencyId} AND month_id = #{monthId} GROUP BY TAG_ID - ORDER BY value DESC + ORDER BY value DESC ,tagId ASC LIMIT #{pageSize} @@ -84,7 +84,7 @@ where agency_id = #{agencyId} AND quarter_id = #{quarterId} GROUP BY TAG_ID - ORDER BY value DESC + ORDER BY value DESC ,tagId ASC LIMIT #{pageSize} @@ -99,7 +99,7 @@ where agency_id = #{agencyId} AND year_id = #{yearId} GROUP BY tag_id - ORDER BY value DESC + ORDER BY value DESC ,tagId ASC LIMIT #{pageSize} @@ -118,6 +118,7 @@ AND pub.PID =#{agencyId} AND pub.month_id=#{monthId} GROUP BY pub.agency_id + ORDER BY value DESC,agencyId ASC @@ -136,6 +137,7 @@ AND pub.PID =#{agencyId} AND pub.quarter_id=#{quarterId} GROUP BY pub.agency_id + ORDER BY value DESC,agencyId ASC @@ -153,6 +155,7 @@ AND pub.PID =#{agencyId} AND pub.year_id=#{yearId} GROUP BY pub.agency_id + ORDER BY value DESC,agencyId ASC @@ -170,6 +173,7 @@ AND pub.agency_id =#{agencyId} AND pub.month_id=#{monthId} GROUP BY pub.department_id + ORDER BY value DESC,departmentId ASC @@ -188,6 +192,7 @@ AND pub.agency_id =#{agencyId} AND pub.quarter_id=#{quarterId} GROUP BY pub.department_id + ORDER BY value DESC,departmentId ASC @@ -205,6 +210,7 @@ AND pub.agency_id =#{agencyId} AND pub.year_id=#{yearId} GROUP BY pub.department_id + ORDER BY value DESC,departmentId ASC @@ -222,6 +228,7 @@ AND pub.agency_id = #{agencyId} AND pub.month_id=#{monthId} GROUP BY pub.grid_id + ORDER BY value DESC,gridId ASC @@ -240,6 +247,7 @@ AND pub.agency_id = #{agencyId} AND pub.quarter_id=#{quarterId} GROUP BY pub.grid_id + ORDER BY value DESC,gridId ASC @@ -257,6 +265,7 @@ AND pub.agency_id = #{agencyId} AND pub.year_id = #{yearId} GROUP BY pub.grid_id + ORDER BY value DESC,gridId ASC \ No newline at end of file From 07a192de765947ff061eda3cb8e78e0919d39212 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Sun, 28 Jun 2020 14:22:05 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E8=AE=AE=E9=A2=98=E5=A2=9E=E9=87=8F?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/StatsIssueController.java | 15 +++ .../com/epmet/dao/issue/StatsIssueDao.java | 3 +- .../com/epmet/service/Issue/IssueService.java | 3 +- .../service/Issue/impl/IssueServiceImpl.java | 4 +- .../com/epmet/service/StatsIssueService.java | 9 ++ .../service/impl/StatsIssueServiceImpl.java | 55 +++++++--- .../resources/mapper/issue/StatsIssueDao.xml | 102 +++++++++++++----- 7 files changed, 146 insertions(+), 45 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsIssueController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsIssueController.java index 850c3b7a75..b78ca89680 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsIssueController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsIssueController.java @@ -1,12 +1,17 @@ package com.epmet.controller; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.service.StatsIssueService; +import lombok.Data; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.io.Serializable; + /** * @author zhaoqifeng * @dscription @@ -30,4 +35,14 @@ public class StatsIssueController { statsIssueService.agencyGridIssueStats(); return new Result(); } + @Data + private static class StatsDate implements Serializable { + private static final long serialVersionUID = 149723067011918433L; + private String date; + } + @PostMapping("date") + public Result agencyGridIssueStatsOfDate(@RequestBody StatsDate statsDate) { + statsIssueService.agencyGridIssueStatsOfDate(DateUtils.parse(statsDate.getDate(), DateUtils.DATE_PATTERN)); + return new Result(); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java index 98d2e0e96d..87cd7c6879 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java @@ -18,11 +18,12 @@ public interface StatsIssueDao extends BaseDao { * 获取当前日期组织下议题统计结果 * * @param customerId + * @param date * @return java.util.List * @author zhaoqifeng * @date 2020/6/17 14:13 */ - List selectAgencyIssueTotal(@Param("customerId") String customerId); + List selectAgencyIssueTotal(@Param("customerId") String customerId, @Param("date") String date); /** * 获取当前日期组织下议题增量 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java index c6b8a8bee0..4ffeb599c9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java @@ -18,9 +18,10 @@ public interface IssueService { * @author zhaoqifeng * @date 2020/6/17 16:04 * @param customerId + * @param date * @return java.util.List */ - List getAgencyIssueTotal(String customerId); + List getAgencyIssueTotal(String customerId, String date); /** * 获取当前日期组织下议题增量 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java index 9cef7c5340..443c9ddc41 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java @@ -26,8 +26,8 @@ public class IssueServiceImpl implements IssueService { private StatsIssueDao statsIssueDao; @Override - public List getAgencyIssueTotal(String customerId) { - List list = statsIssueDao.selectAgencyIssueTotal(customerId); + public List getAgencyIssueTotal(String customerId, String date) { + List list = statsIssueDao.selectAgencyIssueTotal(customerId, date); list.forEach(dto -> { String[] pIds = dto.getPIds().split(":"); dto.setPId(pIds[pIds.length - 2]); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsIssueService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsIssueService.java index 5d0e6b4292..7faf406333 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsIssueService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsIssueService.java @@ -17,6 +17,15 @@ public interface StatsIssueService { */ void agencyGridIssueStats(); + /** + * 指定日期议题统计 + * @author zhaoqifeng + * @date 2020/6/28 11:01 + * @param date + * @return void + */ + void agencyGridIssueStatsOfDate(Date date); + /** * 机关下议题日统计 * @author zhaoqifeng diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java index ab38ff305a..3043e97e1a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java @@ -20,6 +20,7 @@ import com.epmet.service.project.ProjectService; import com.epmet.service.stats.*; import com.epmet.util.DimIdGenerator; import lombok.extern.slf4j.Slf4j; +import oracle.sql.DATE; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @@ -66,6 +67,28 @@ public class StatsIssueServiceImpl implements StatsIssueService { //获取当前日期前一天 Date date = DateUtils.getBeforeDay(new Date()); customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); + if (!CollectionUtils.isEmpty(customerIdList)) { + for (String customerId : customerIdList) { + //遍历统计每一个客户数据 + try { + customerStats(customerId, date); + } catch(Exception e) { + log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "agencyGridIssueStats", customerId, DateUtils.format(date), + e.getMessage())); + } + } + } + } while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize); + } + + @Override + public void agencyGridIssueStatsOfDate(Date date) { + int pageNo = 1; + int pageSize = 100; + List customerIdList = null; + do { + //获取当前日期前一天 + customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); if (!CollectionUtils.isEmpty(customerIdList)) { for (String customerId : customerIdList) { //遍历统计每一个客户数据 @@ -109,7 +132,7 @@ public class StatsIssueServiceImpl implements StatsIssueService { //获取当前客户下所有机关 List agencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO); //获取机关下议题各种状态的数目统计 - List issueAgencyTotalList = issueService.getAgencyIssueTotal(customerId); + List issueAgencyTotalList = issueService.getAgencyIssueTotal(customerId, dateString); //获取机关下议题各种状态的数目增量 List issueAgencyIncList = issueService.getAgencyIssueInc(customerId, dateString); //获取机关下已关闭议题统计 @@ -129,10 +152,10 @@ public class StatsIssueServiceImpl implements StatsIssueService { entity.setPid(agency.getPid()); String pIds; - if (null == agency.getPids() || agency.getPids().isEmpty()) { - pIds = agency.getPid().concat(":").concat(agency.getId()); + if (NumConstant.ZERO_STR.equals(agency.getPid())) { + pIds = agency.getPid(); } else { - pIds = ("0").concat(":").concat(agency.getPids()).concat(":").concat(agency.getId()); + pIds = agency.getPids().concat(":").concat(agency.getId()); } //总量统计 saveTotal(issueAgencyTotalList, agency, entity, pIds); @@ -172,7 +195,7 @@ public class StatsIssueServiceImpl implements StatsIssueService { //获取当前客户下所有机关 List agencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO); //获取机关下议题各种状态的数目统计 - List issueAgencyTotalList = issueService.getAgencyIssueTotal(customerId); + List issueAgencyTotalList = issueService.getAgencyIssueTotal(customerId, dateString); //获取机关下已关闭议题统计 List issueAgencyClosedTotalList = issueService.getAgencyClosedIssueTotal(customerId, dateString); //已结案项目统计 @@ -185,10 +208,10 @@ public class StatsIssueServiceImpl implements StatsIssueService { FactIssueAgencyMonthlyEntity monthly = initIssueAgencyMonthly(dimId); String pIds; - if (null == agency.getPids() || agency.getPids().isEmpty()) { - pIds = agency.getPid().concat(":").concat(agency.getId()); + if (NumConstant.ZERO_STR.equals(agency.getPid())) { + pIds = agency.getPid(); } else { - pIds = ("0").concat(":").concat(agency.getPids()).concat(":").concat(agency.getId()); + pIds = agency.getPids().concat(":").concat(agency.getId()); } //总量统计 saveTotal(issueAgencyTotalList, agency, daily, pIds); @@ -550,6 +573,8 @@ public class StatsIssueServiceImpl implements StatsIssueService { int shiftInc = NumConstant.ZERO; //已关闭增量 int closedInc = NumConstant.ZERO; + //议题增量 + int issueInc = NumConstant.ZERO; for (IssueGridDTO dto : list) { if (grid.getId().equals(dto.getGridId())) { if (IssueConstant.VOTING.equals(dto.getStatus())) { @@ -558,13 +583,15 @@ public class StatsIssueServiceImpl implements StatsIssueService { } else if (IssueConstant.SHIFT_PROJECT.equals(dto.getStatus())) { //已转项目议题数量 shiftInc = dto.getCount(); - } else { + } else if(IssueConstant.CLOSED.equals(dto.getStatus())) { //已关闭议题数量 closedInc = dto.getCount(); + } else { + issueInc = dto.getCount(); } } } - int issueInc = votingInc + shiftInc + closedInc; + entity.setVotingIncr(votingInc); entity.setShiftProjectIncr(shiftInc); entity.setClosedIncr(closedInc); @@ -712,6 +739,8 @@ public class StatsIssueServiceImpl implements StatsIssueService { int shiftInc = NumConstant.ZERO; //已关闭增量 int closedInc = NumConstant.ZERO; + //议题增量 + int issueInc = NumConstant.ZERO; for (IssueAgencyDTO issueAgency : list) { if (agency.getId().equals(issueAgency.getAgencyId()) || issueAgency.getPIds().contains(pIds)) { if (IssueConstant.VOTING.equals(issueAgency.getStatus())) { @@ -720,13 +749,15 @@ public class StatsIssueServiceImpl implements StatsIssueService { } else if (IssueConstant.SHIFT_PROJECT.equals(issueAgency.getStatus())) { //已转项目议题数量 shiftInc = shiftInc + issueAgency.getCount(); - } else { + } else if(IssueConstant.CLOSED.equals(issueAgency.getStatus())) { //已关闭议题数量 closedInc = closedInc + issueAgency.getCount(); + } else { + //议题增量 + issueInc = issueInc + issueAgency.getCount(); } } } - int issueInc = votingInc + shiftInc + closedInc; entity.setVotingIncr(votingInc); entity.setShiftProjectIncr(shiftInc); entity.setClosedIncr(closedInc); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml index 3120f939d8..23dd47e689 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml @@ -12,26 +12,49 @@ WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} + AND DATE(UPDATED_TIME) #{date} GROUP BY ORG_ID, ISSUE_STATUS From b0f912f089e3e52310f47ab4f6fbeb88161be913 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Sun, 28 Jun 2020 14:52:33 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E8=AF=9D=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/service/topic/impl/TopicServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java index f63d887dd9..3b81c15cfa 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java @@ -14,6 +14,7 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.text.DecimalFormat; import java.time.LocalDate; import java.util.*; import java.util.stream.Collectors; @@ -182,8 +183,9 @@ public class TopicServiceImpl implements TopicService { TopicShiftedCountResultDTO shiftedCount = topicDao.getShiftedCount(agencyId); if (topicSummaryInfo.size() != NumConstant.ZERO && shiftedCount != null) { Integer collect = topicSummaryInfo.stream().collect(Collectors.summingInt(TopicSummaryInfoResultDTO::getValue)); + DecimalFormat decimalFormat = new DecimalFormat(".00"); String ratio; - ratio = collect == NumConstant.ZERO ? NumConstant.ZERO + TopicConstant.RATIO : ((float) shiftedCount.getShiftedIssueCount() / (float) collect) * NumConstant.ONE_HUNDRED + TopicConstant.RATIO; + ratio = collect == NumConstant.ZERO ? NumConstant.ZERO + TopicConstant.RATIO : decimalFormat.format(((float) shiftedCount.getShiftedIssueCount() / (float) collect) * NumConstant.ONE_HUNDRED) + TopicConstant.RATIO; TopicSummaryInfoResultDTO result = new TopicSummaryInfoResultDTO(); result.setName(TopicConstant.SHIFTED); result.setRatio(ratio);