From e8a6d7b0ea6bb6383899d5c56c5fafe4344e3cc2 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 29 Sep 2020 15:25:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/dto/form/AblityIndexFormDTO.java | 6 +- .../dto/form/MonthScoreListFormDTO.java | 6 +- .../screen/dto/form/ScoreListFormDTO.java | 6 +- .../dto/result/AblityIndexResultDTO.java | 10 +- .../dto/result/MonthScoreListResultDTO.java | 6 + .../dao/fact/FactIndexAgencyScoreDao.java | 5 +- .../dao/fact/FactIndexCommunityScoreDao.java | 5 +- .../dao/fact/FactIndexGridScoreDao.java | 3 +- .../fact/impl/FactIndexServiceImpl.java | 202 +++++++----------- .../mapper/fact/FactIndexAgencyScoreDao.xml | 18 +- .../fact/FactIndexCommunityScoreDao.xml | 14 +- .../mapper/fact/FactIndexGridScoreDao.xml | 14 +- 12 files changed, 128 insertions(+), 167 deletions(-) diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityIndexFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityIndexFormDTO.java index 4db977d5b4..738f8c88e1 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityIndexFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityIndexFormDTO.java @@ -13,6 +13,7 @@ import java.io.Serializable; @Data public class AblityIndexFormDTO implements Serializable { private static final long serialVersionUID = -2880432640584616651L; + public interface AddUserInternalGroup {} /** * 组织或网格Id */ @@ -37,10 +38,5 @@ public class AblityIndexFormDTO implements Serializable { */ @NotBlank(message = "月份ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class}) private String monthId; - /** - * 类型(党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli;) - */ - private String indexCode; - public interface AddUserInternalGroup {} } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthScoreListFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthScoreListFormDTO.java index 805495b293..528c3805f0 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthScoreListFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthScoreListFormDTO.java @@ -13,6 +13,7 @@ import java.io.Serializable; @Data public class MonthScoreListFormDTO implements Serializable { private static final long serialVersionUID = -2880432640584616651L; + public interface AddUserInternalGroup {} /** * 组织或网格Id */ @@ -28,10 +29,6 @@ public class MonthScoreListFormDTO implements Serializable { */ @NotBlank(message = "组织或网格类型不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class}) private String orgType; - /** - * 类型(党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli;) - */ - private String indexCode; /** * 月份Id(格式:202009) */ @@ -41,6 +38,5 @@ public class MonthScoreListFormDTO implements Serializable { * 查询月份的前12个月对应的monthId */ private String startMonthId; - public interface AddUserInternalGroup {} } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ScoreListFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ScoreListFormDTO.java index 5070202432..9b622eb568 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ScoreListFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ScoreListFormDTO.java @@ -13,6 +13,7 @@ import java.io.Serializable; @Data public class ScoreListFormDTO implements Serializable { private static final long serialVersionUID = -2880432640584616651L; + public interface AddUserInternalGroup {} /** * 组织或网格Id */ @@ -28,15 +29,10 @@ public class ScoreListFormDTO implements Serializable { */ @NotBlank(message = "组织或网格类型不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class}) private String orgType; - public interface AddUserInternalGroup {} /** * 月份Id(格式:202009) */ @NotBlank(message = "月份ID不能为空",groups = {ScoreListFormDTO.AddUserInternalGroup.class}) private String monthId; - /** - * 类型(党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli;) - */ - private String indexCode; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityIndexResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityIndexResultDTO.java index b93016bca3..2d14b4e42c 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityIndexResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityIndexResultDTO.java @@ -1,5 +1,6 @@ package com.epmet.evaluationindex.screen.dto.result; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -33,11 +34,12 @@ public class AblityIndexResultDTO implements Serializable { * 横坐标(202009) */ private String monthId; + /** + * 能力类型 党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli; + */ + @JsonIgnore + private String indexCode; } - - - - } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthScoreListResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthScoreListResultDTO.java index c40628cdd4..0acdbf9c73 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthScoreListResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthScoreListResultDTO.java @@ -1,5 +1,6 @@ package com.epmet.evaluationindex.screen.dto.result; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -41,6 +42,11 @@ public class MonthScoreListResultDTO implements Serializable { * 横坐标(202009) */ private String monthId; + /** + * 类型(党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli;) + */ + @JsonIgnore + private String indexCode; } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencyScoreDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencyScoreDao.java index 062465f3a7..66cbc46d42 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencyScoreDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencyScoreDao.java @@ -26,6 +26,7 @@ import com.epmet.evaluationindex.screen.dto.result.ScoreListResultDTO; import org.apache.ibatis.annotations.Mapper; import java.util.LinkedList; +import java.util.List; /** * 区/街道相关分数表 @@ -45,10 +46,10 @@ public interface FactIndexAgencyScoreDao { /** * @param formDTO - * @Description 分别查询当前组织某一月份党建能力、治理能力、服务能力对应的总分、本级分、下级分 + * @Description 查询当前组织某一月份党建能力、治理能力、服务能力对应的总分、本级分、下级分 * @author sun */ - ScoreListResultDTO selectScoreList(ScoreListFormDTO formDTO); + List selectScoreList(ScoreListFormDTO formDTO); /** * @param formDTO diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunityScoreDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunityScoreDao.java index f0f381e156..0c7a7a7f65 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunityScoreDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunityScoreDao.java @@ -26,6 +26,7 @@ import com.epmet.evaluationindex.screen.dto.result.ScoreListResultDTO; import org.apache.ibatis.annotations.Mapper; import java.util.LinkedList; +import java.util.List; /** * 社区相关分数表 @@ -45,10 +46,10 @@ public interface FactIndexCommunityScoreDao { /** * @param formDTO - * @Description 分别查询社区级组织某一月份党建能力、治理能力、服务能力对应的总分、本级分、下级分 + * @Description 查询社区级组织某一月份党建能力、治理能力、服务能力对应的总分、本级分、下级分 * @author sun */ - ScoreListResultDTO selectCommunityScoreList(ScoreListFormDTO formDTO); + List selectCommunityScoreList(ScoreListFormDTO formDTO); /** * @param formDTO diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridScoreDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridScoreDao.java index a70efe0ce6..c5153b0933 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridScoreDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridScoreDao.java @@ -26,6 +26,7 @@ import com.epmet.evaluationindex.screen.dto.result.ScoreListResultDTO; import org.apache.ibatis.annotations.Mapper; import java.util.LinkedList; +import java.util.List; /** * 网格相关分值记录表 @@ -48,7 +49,7 @@ public interface FactIndexGridScoreDao { * @Description 分别查网格某一月份党建能力、治理能力、服务能力对应的总分、本级分、下级分 * @author sun */ - ScoreListResultDTO selectGridScoreList(ScoreListFormDTO formDTO); + List selectGridScoreList(ScoreListFormDTO formDTO); /** * @param formDTO diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java index 3793986f00..d9d62734c0 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java @@ -15,10 +15,12 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; -import java.text.NumberFormat; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.LinkedList; +import java.util.List; import java.util.regex.Pattern; /** @@ -57,9 +59,10 @@ public class FactIndexServiceImpl implements FactIndexService { @Override public List ablityIndex(AblityIndexFormDTO formDTO) { LinkedList resultList = new LinkedList<>(); - LinkedList djList = null; - LinkedList zlList = null; - LinkedList fwList = null; + LinkedList list = new LinkedList<>(); + LinkedList djList = new LinkedList<>(); + LinkedList zlList = new LinkedList<>(); + LinkedList fwList = new LinkedList<>(); //1.计算所查月份前12个月的monthId formDTO.setStartMonthId(getDate(formDTO.getMonthId())); //2.根据类型判断是查询组织数据还是网格数据 @@ -73,60 +76,59 @@ public class FactIndexServiceImpl implements FactIndexService { //4.根据组织级别判断查询哪类数据表 //区县级、乡镇街道级 if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) { - //4-1.查询过去12个月党建能力每月总分、本级得分、下级得分数据(不想写union) - formDTO.setIndexCode(FactConstant.DJNL); - djList = factIndexAgencyScoreDao.selectAblityIndex(formDTO); - //4-2.查询过去12个月治理能力每月总分、本级得分、下级得分数据 - formDTO.setIndexCode(FactConstant.ZLNL); - zlList = factIndexAgencyScoreDao.selectAblityIndex(formDTO); - //4-3.查询过去12个月服务能力每月总分、本级得分、下级得分数据 - formDTO.setIndexCode(FactConstant.FWNL); - fwList = factIndexAgencyScoreDao.selectAblityIndex(formDTO); + //4-1.查询过去12个月党建能力、治理能力、服务能力每月总分数据 + list = factIndexAgencyScoreDao.selectAblityIndex(formDTO); //社区级 } else if ("community".equals(agency.getLevel())) { - //4-1.查询过去12个月党建能力每月总分、本级得分、下级得分数据 - formDTO.setIndexCode(FactConstant.DJNL); - djList = factIndexCommunityScoreDao.selectCommunityAblityIndex(formDTO); - //4-2.查询过去12个月治理能力每月总分、本级得分、下级得分数据 - formDTO.setIndexCode(FactConstant.ZLNL); - zlList = factIndexCommunityScoreDao.selectCommunityAblityIndex(formDTO); - //4-3.查询过去12个月服务能力每月总分、本级得分、下级得分数据 - formDTO.setIndexCode(FactConstant.FWNL); - fwList = factIndexCommunityScoreDao.selectCommunityAblityIndex(formDTO); + //4-1.查询过去12个月党建能力、治理能力、服务能力每月总分、本级得分、下级得分数据 + list = factIndexCommunityScoreDao.selectCommunityAblityIndex(formDTO); } else { throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getOrgId())); } //网格层级数据 } else if (FactConstant.GRID.equals(formDTO.getOrgType())) { - //5.查询过去12个月网格层级各项能力对应的各项得分数据 - //5-1.查询网格过去12个月党建能力每月总分、本级得分、下级得分数据(不想写union) - formDTO.setIndexCode(FactConstant.DJNL); - djList = factIndexGridScoreDao.selectGridAblityIndex(formDTO); - //5-2.查询网格过去12个月治理能力每月总分、本级得分、下级得分数据 - formDTO.setIndexCode(FactConstant.ZLNL); - zlList = factIndexGridScoreDao.selectGridAblityIndex(formDTO); - //5-3.查询网格过去12个月服务能力每月总分、本级得分、下级得分数据 - formDTO.setIndexCode(FactConstant.FWNL); - fwList = factIndexGridScoreDao.selectGridAblityIndex(formDTO); + //5.查询网格过去12个月党建能力、治理能力、服务能力每月总分数据 + list = factIndexGridScoreDao.selectGridAblityIndex(formDTO); } else { throw new RenException(String.format("能力指数查询,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType())); } - - if(djList.size()!=zlList.size()||djList.size()!=fwList.size()){ - throw new RenException(String.format("能力指数查询,查询出来的三大能力数据条数不一致,orgId:%s,orgType:%s,monthId:%s", formDTO.getOrgId(), formDTO.getOrgType(), formDTO.getMonthId())); + if (list.size() < NumConstant.ONE) { + return resultList; } //6.遍历计算每个月能力指数 LinkedList nlList = new LinkedList<>(); - for (int i = 0; i < djList.size(); i++) { - AblityIndexResultDTO.ScoreListResultDTO nldto = new AblityIndexResultDTO.ScoreListResultDTO(); - double num1 = new BigDecimal((djList.get(i).getIndexTotal() + zlList.get(i).getIndexTotal() + fwList.get(i).getIndexTotal())).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue(); - nldto.setIndexTotal(num1); - nldto.setMonthId(djList.get(i).getMonthId()); - nlList.add(nldto); + String monthId = list.get(0).getMonthId(); + Double dl = 0.0; + for (AblityIndexResultDTO.ScoreListResultDTO l : list) { + if (l.getMonthId().equals(monthId)) { + dl += l.getIndexTotal(); + } else { + AblityIndexResultDTO.ScoreListResultDTO nldto = new AblityIndexResultDTO.ScoreListResultDTO(); + double num1 = new BigDecimal(dl).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue(); + nldto.setIndexTotal(num1); + nldto.setMonthId(monthId); + nlList.add(nldto); + monthId = l.getMonthId(); + dl = l.getIndexTotal(); + } + if (FactConstant.DJNL.equals(l.getIndexCode())) { + djList.add(l); + } else if (FactConstant.ZLNL.equals(l.getIndexCode())) { + zlList.add(l); + } else if (FactConstant.FWNL.equals(l.getIndexCode())) { + fwList.add(l); + } } - //5.封装数据并返回 + //把最后一个月的能力指标数据放入集合 + AblityIndexResultDTO.ScoreListResultDTO nldto = new AblityIndexResultDTO.ScoreListResultDTO(); + double num1 = new BigDecimal(dl).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue(); + nldto.setIndexTotal(num1); + nldto.setMonthId(monthId); + nlList.add(nldto); + + //7.封装数据并返回 AblityIndexResultDTO nl = new AblityIndexResultDTO(); nl.setIndexCode(FactConstant.NLZB); nl.setScoreList(nlList); @@ -162,10 +164,7 @@ public class FactIndexServiceImpl implements FactIndexService { */ @Override public List scoreList(ScoreListFormDTO formDTO) { - LinkedList resultList = new LinkedList<>(); - ScoreListResultDTO dj = new ScoreListResultDTO(); - ScoreListResultDTO zl = new ScoreListResultDTO(); - ScoreListResultDTO fw = new ScoreListResultDTO(); + List resultList = new LinkedList<>(); //1.根据类型判断是查询组织数据还是网格数据 //组织层级数据 if (FactConstant.AGENCY.equals(formDTO.getOrgType())) { @@ -177,54 +176,23 @@ public class FactIndexServiceImpl implements FactIndexService { //3.根据组织级别判断查询哪类数据表 //区县级、乡镇街道级 if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) { - //3-1.查询当前组织某一月份党建能力对应的总分、本级分、下级分 - formDTO.setIndexCode(FactConstant.DJNL); - dj = factIndexAgencyScoreDao.selectScoreList(formDTO); - //3-2.查询当前组织某一月份治理能力对应的总分、本级分、下级分 - formDTO.setIndexCode(FactConstant.ZLNL); - zl = factIndexAgencyScoreDao.selectScoreList(formDTO); - //3-3.查询当前组织某一月份服务能力对应的总分、本级分、下级分 - formDTO.setIndexCode(FactConstant.FWNL); - fw = factIndexAgencyScoreDao.selectScoreList(formDTO); + //3-1.查询当前组织某一月份党建能力、治理能力、服务能力对应的总分、本级分、下级分 + resultList = factIndexAgencyScoreDao.selectScoreList(formDTO); //社区级 } else if ("community".equals(agency.getLevel())) { - //3-1.查询当前组织某一月份党建能力对应的总分、本级分、下级分 - formDTO.setIndexCode(FactConstant.DJNL); - dj = factIndexCommunityScoreDao.selectCommunityScoreList(formDTO); - //3-2.查询当前组织某一月份治理能力对应的总分、本级分、下级分 - formDTO.setIndexCode(FactConstant.ZLNL); - zl = factIndexCommunityScoreDao.selectCommunityScoreList(formDTO); - //3-3.查询当前组织某一月份服务能力对应的总分、本级分、下级分 - formDTO.setIndexCode(FactConstant.FWNL); - fw = factIndexCommunityScoreDao.selectCommunityScoreList(formDTO); + //3-1.查询当前组织某一月份党建能力、治理能力、服务能力对应的总分、本级分、下级分 + resultList = factIndexCommunityScoreDao.selectCommunityScoreList(formDTO); } else { throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getOrgId())); } //4.网格层级数据 } else if (FactConstant.GRID.equals(formDTO.getOrgType())) { - //4-1.查询当前组织某一月份党建能力对应的总分、本级分、下级分 - formDTO.setIndexCode(FactConstant.DJNL); - dj = factIndexGridScoreDao.selectGridScoreList(formDTO); - //4-2.查询当前组织某一月份治理能力对应的总分、本级分、下级分 - formDTO.setIndexCode(FactConstant.ZLNL); - zl = factIndexGridScoreDao.selectGridScoreList(formDTO); - //4-3.查询当前组织某一月份服务能力对应的总分、本级分、下级分 - formDTO.setIndexCode(FactConstant.FWNL); - fw = factIndexGridScoreDao.selectGridScoreList(formDTO); + //4-1.查询当前组织某一月份党建能力、治理能力、服务能力对应的总分、本级分、下级分 + resultList = factIndexGridScoreDao.selectGridScoreList(formDTO); } else { throw new RenException(String.format("按月份查询各项能力分数,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType())); } - //5.封装数据并返回 - if (null != dj) { - resultList.add(dj); - } - if (null != zl) { - resultList.add(zl); - } - if (null != fw) { - resultList.add(fw); - } return resultList; } @@ -237,6 +205,7 @@ public class FactIndexServiceImpl implements FactIndexService { @Override public List monthScoreList(MonthScoreListFormDTO formDTO) { LinkedList resultList = new LinkedList<>(); + LinkedList list = new LinkedList<>(); LinkedList djList = new LinkedList<>(); LinkedList zlList = new LinkedList<>(); LinkedList fwList = new LinkedList<>(); @@ -253,47 +222,34 @@ public class FactIndexServiceImpl implements FactIndexService { //4.根据组织级别判断查询哪类数据表 //区县级、乡镇街道级 if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) { - //4-1.查询过去12个月党建能力每月总分、本级得分、下级得分数据 - formDTO.setIndexCode(FactConstant.DJNL); - djList = factIndexAgencyScoreDao.selectMonthScoreList(formDTO); - //4-2.查询过去12个月治理能力每月总分、本级得分、下级得分数据 - formDTO.setIndexCode(FactConstant.ZLNL); - zlList = factIndexAgencyScoreDao.selectMonthScoreList(formDTO); - //4-3.查询过去12个月服务能力每月总分、本级得分、下级得分数据 - formDTO.setIndexCode(FactConstant.FWNL); - fwList = factIndexAgencyScoreDao.selectMonthScoreList(formDTO); + //4-1.查询过去12个月党建能力、治理能力、服务能力每月总分、本级得分、下级得分数据 + list = factIndexAgencyScoreDao.selectMonthScoreList(formDTO); //社区级 } else if ("community".equals(agency.getLevel())) { - //4-1.查询过去12个月党建能力每月总分、本级得分、下级得分数据 - formDTO.setIndexCode(FactConstant.DJNL); - djList = factIndexCommunityScoreDao.selectCommunityMonthScoreList(formDTO); - //4-2.查询过去12个月治理能力每月总分、本级得分、下级得分数据 - formDTO.setIndexCode(FactConstant.ZLNL); - zlList = factIndexCommunityScoreDao.selectCommunityMonthScoreList(formDTO); - //4-3.查询过去12个月服务能力每月总分、本级得分、下级得分数据 - formDTO.setIndexCode(FactConstant.FWNL); - fwList = factIndexCommunityScoreDao.selectCommunityMonthScoreList(formDTO); + //4-1.查询过去12个月党建能力、治理能力、服务能力每月总分、本级得分、下级得分数据 + list = factIndexCommunityScoreDao.selectCommunityMonthScoreList(formDTO); } else { throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getOrgId())); } //网格层级数据 } else if (FactConstant.GRID.equals(formDTO.getOrgType())) { - //5.查询过去12个月网格层级各项能力对应的各项得分数据 - //5-1.查询网格过去12个月党建能力每月总分、本级得分、下级得分数据 - formDTO.setIndexCode(FactConstant.DJNL); - djList = factIndexGridScoreDao.selectGridMonthScoreList(formDTO); - //5-2.查询网格过去12个月治理能力每月总分、本级得分、下级得分数据 - formDTO.setIndexCode(FactConstant.ZLNL); - zlList = factIndexGridScoreDao.selectGridMonthScoreList(formDTO); - //5-3.查询网格过去12个月服务能力每月总分、本级得分、下级得分数据 - formDTO.setIndexCode(FactConstant.FWNL); - fwList = factIndexGridScoreDao.selectGridMonthScoreList(formDTO); + //5.查询网格过去12个月党建能力、治理能力、服务能力每月总分、本级得分、下级得分数据 + list = factIndexGridScoreDao.selectGridMonthScoreList(formDTO); } else { throw new RenException(String.format("能力指数查询,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType())); } //5.封装数据并返回 + for (MonthScoreListResultDTO.ScoreListResultDTO l : list) { + if (FactConstant.DJNL.equals(l.getIndexCode())) { + djList.add(l); + } else if (FactConstant.ZLNL.equals(l.getIndexCode())) { + zlList.add(l); + } else if (FactConstant.FWNL.equals(l.getIndexCode())) { + fwList.add(l); + } + } MonthScoreListResultDTO dj = new MonthScoreListResultDTO(); dj.setIndexCode(FactConstant.DJNL); dj.setScoreList(djList); @@ -363,17 +319,17 @@ public class FactIndexServiceImpl implements FactIndexService { //5.遍历数据,判断数据类型并处理 resultList.forEach(result -> { list.stream().filter(dto -> dto.getIndexCode().equals(result.getKey())).forEach(l -> { - result.setShowType(l.getValueType()); - //小数类型,四舍五入保留小数点后一位 - if (FactConstant.DECIMAL.equals(l.getValueType())) { - BigDecimal num = new BigDecimal(result.getValue()).setScale(1, BigDecimal.ROUND_HALF_UP); - result.setValue(num.toString()); - } - //百分数类型,四舍五入保留小数点后一位并转成百分比 - if (FactConstant.PERCENT.equals(l.getValueType())) { - BigDecimal num = new BigDecimal(result.getValue()).setScale(1, BigDecimal.ROUND_HALF_UP); - result.setValue(num+"%"); - } + result.setShowType(l.getValueType()); + //小数类型,四舍五入保留小数点后一位 + if (FactConstant.DECIMAL.equals(l.getValueType())) { + BigDecimal num = new BigDecimal(result.getValue()).setScale(1, BigDecimal.ROUND_HALF_UP); + result.setValue(num.toString()); + } + //百分数类型,四舍五入保留小数点后一位并转成百分比 + if (FactConstant.PERCENT.equals(l.getValueType())) { + BigDecimal num = new BigDecimal(result.getValue()).setScale(1, BigDecimal.ROUND_HALF_UP); + result.setValue(num + "%"); + } }); }); diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml index 374814375d..484abef720 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml @@ -6,38 +6,39 @@ diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunityScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunityScoreDao.xml index 31c051f887..a2a4e89303 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunityScoreDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunityScoreDao.xml @@ -6,23 +6,24 @@ diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridScoreDao.xml index 47d5ad74a0..65e511d43e 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridScoreDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridScoreDao.xml @@ -6,23 +6,24 @@