diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java index 92af86d3a9..0c7b46ef93 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java @@ -35,6 +35,8 @@ public interface NumConstant { int ONE_HUNDRED = 100; int ONE_THOUSAND = 1000; int MAX = 99999999; + int EIGHTY_EIGHT = 88; + long ZERO_L = 0L; long ONE_L = 1L; diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/form/BranchBuildRankFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/form/BranchBuildRankFormDTO.java new file mode 100644 index 0000000000..169a24b29a --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/form/BranchBuildRankFormDTO.java @@ -0,0 +1,33 @@ +package com.epmet.screen.dto.form; + +import com.epmet.commons.tools.constant.NumConstant; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 4、支部建设情况|联建共建情况-排行 入参dto + * @NEI https://nei.netease.com/interface/detail/?pid=57068&id=321982 + * @ClassName BranchBuildRankFormDTO + * @Auth wangc + * @Date 2020-08-19 15:06 + */ +@Data +public class BranchBuildRankFormDTO implements Serializable { + private static final long serialVersionUID = -6580433475773171870L; + + /** + * 机关Id + * */ + private String agencyId; + + /** + * 支部建设情况:zbjs; 联建共建情况:ljgj;支部建设情况:zbjs; 联建共建情况:ljgj;联建党员志愿服务情况:ljdyzy + * */ + private String category; + + /** + * 默认显示前4,显示全部传入0 + * */ + private Integer topNum = NumConstant.FOUR; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/form/BranchBuildTrendFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/form/BranchBuildTrendFormDTO.java new file mode 100644 index 0000000000..1d68458b20 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/form/BranchBuildTrendFormDTO.java @@ -0,0 +1,39 @@ +package com.epmet.screen.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 3、支部建设情况|联建共建情况-折线图 入参DTO + * @NEI https://nei.netease.com/interface/detail/req/?pid=57068&id=321981 + * @ClassName BranchBuildTrendFormDTO + * @Auth wangc + * @Date 2020-08-19 10:01 + */ +@Data +public class BranchBuildTrendFormDTO implements Serializable { + private static final long serialVersionUID = 2998463730542699247L; + + public interface branchBuildTrendGroup extends CustomerClientShowGroup{} + + /** + * 机关Id + * */ + @NotBlank(message = "agencyId不可为空" , groups = branchBuildTrendGroup.class) + private String agencyId; + + /** + * 组织次数:organize; 参加人数:joinuser; 平均参加人数:averagejoinuser + * */ + @NotBlank(message = "基层党建折线图类型不可为空" , groups = branchBuildTrendGroup.class) + private String type; + + /** + * 支部建设情况:zbjs; 联建共建情况:ljgj + * */ + @NotBlank(message = "基层党建情况不可为空" , groups = branchBuildTrendGroup.class) + private String category; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/BranchBuildRankResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/BranchBuildRankResultDTO.java new file mode 100644 index 0000000000..9b1584e276 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/BranchBuildRankResultDTO.java @@ -0,0 +1,18 @@ +package com.epmet.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 4、支部建设情况|联建共建情况-排行 返参dto + * @NEI https://nei.netease.com/interface/detail/?pid=57068&id=321982 + * @Auth wangc + * @Date 2020-08-19 15:09 + */ +@Data +public class BranchBuildRankResultDTO implements Serializable { + private static final long serialVersionUID = 6213072175254509349L; + + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/BranchBuildTrendResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/BranchBuildTrendResultDTO.java new file mode 100644 index 0000000000..58a277322f --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/BranchBuildTrendResultDTO.java @@ -0,0 +1,31 @@ +package com.epmet.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description 3、支部建设情况|联建共建情况-折线图 返参DTO + * @NEI https://nei.netease.com/interface/detail/req/?pid=57068&id=321981 + * @ClassName BranchBuildTrendResultDTO + * @Auth wangc + * @Date 2020-08-19 10:06 + */ +@Data +public class BranchBuildTrendResultDTO implements Serializable { + private static final long serialVersionUID = 2453727230656371207L; + + /** + * 分类数组 ["三会党课","主体党日","三述专题","志愿服务","党内关怀"] + * */ + private List legend; + + /** + * 横坐标,近12个月的结合 ["8月","9月"] + * */ + private List xAxis; + + private List seriesData; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/BranchIssueDataResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/BranchIssueDataResultDTO.java new file mode 100644 index 0000000000..65a6888047 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/BranchIssueDataResultDTO.java @@ -0,0 +1,22 @@ +package com.epmet.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @ClassName BranchIssueDataResultDTO + * @Auth wangc + * @Date 2020-08-19 10:50 + */ +@Data +public class BranchIssueDataResultDTO implements Serializable { + private static final long serialVersionUID = 2417543749267496482L; + + private String issue; + + private String monthId; + + private Integer data; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/BranchTrendSeriesDataResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/BranchTrendSeriesDataResultDTO.java new file mode 100644 index 0000000000..7d5f415547 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/BranchTrendSeriesDataResultDTO.java @@ -0,0 +1,27 @@ +package com.epmet.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description 3、支部建设情况|联建共建情况-折线图 返参中的系列数组 + * @ClassName BranchTrendSeriesDataResultDTO + * @Auth wangc + * @Date 2020-08-19 10:22 + */ +@Data +public class BranchTrendSeriesDataResultDTO implements Serializable { + private static final long serialVersionUID = -2288264050517402039L; + + /** + * 和legend集合值一致 + * */ + private String name; + + /** + * 对应每个月的数值 + * */ + private List data; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/PartymemberAgeDistributionResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/PartymemberAgeDistributionResultDTO.java new file mode 100644 index 0000000000..b9a22cb55b --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/PartymemberAgeDistributionResultDTO.java @@ -0,0 +1,36 @@ +package com.epmet.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @ClassName PartymemberAgeDistributionResultDTO + * @Auth wangc + * @Date 2020-08-18 17:04 + */ +@Data +public class PartymemberAgeDistributionResultDTO implements Serializable { + private static final long serialVersionUID = -3477512511475784330L; + + /** + * 30岁以下 的党员占 注册党员总数的百分比 (返回数字,小数点后保留两位) + * */ + private String under30Ratio; + + /** + * 31-50岁 的党员占 注册党员总数的百分比(返回数字,小数点后保留两位) + * */ + private String between31And50Ratio; + + /** + * 51-60岁 的党员占 注册党员总数的百分比(返回数字,小数点后保留两位) + * */ + private String between51And60Ratio; + + /** + * 61岁以上 的党员占 注册党员总数的百分比(返回数字,小数点后保留两位) + * */ + private String above61; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/PartymemberAgePercentResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/PartymemberAgePercentResultDTO.java new file mode 100644 index 0000000000..c5eec4d539 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/PartymemberAgePercentResultDTO.java @@ -0,0 +1,37 @@ +package com.epmet.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * @Description + * @ClassName PartymemberAgePercentResultDTO + * @Auth wangc + * @Date 2020-08-19 09:13 + */ +@Data +public class PartymemberAgePercentResultDTO implements Serializable { + private static final long serialVersionUID = 2228109850328978771L; + + /** + * 30岁以下 的党员占 注册党员总数的百分比 (返回数字,小数点后保留两位) + * */ + private BigDecimal under30Ratio; + + /** + * 31-50岁 的党员占 注册党员总数的百分比(返回数字,小数点后保留两位) + * */ + private BigDecimal between31And50Ratio; + + /** + * 51-60岁 的党员占 注册党员总数的百分比(返回数字,小数点后保留两位) + * */ + private BigDecimal between51And60Ratio; + + /** + * 61岁以上 的党员占 注册党员总数的百分比(返回数字,小数点后保留两位) + * */ + private BigDecimal above61; +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassrootsPartyDevController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassrootsPartyDevController.java index 9747aa3ff9..d5934455bb 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassrootsPartyDevController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassrootsPartyDevController.java @@ -1,5 +1,13 @@ package com.epmet.datareport.controller.screen; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.datareport.dao.screen.ScreenUserTotalDataDao; +import com.epmet.datareport.service.screen.GrassrootsPartyDevService; +import com.epmet.screen.dto.form.ParymemberFormDTO; +import com.epmet.screen.dto.result.PartymemberPercentResultDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -12,4 +20,22 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/screen/grassrootspartydev") public class GrassrootsPartyDevController { + + @Autowired + private GrassrootsPartyDevService grassrootsPartyDevService; + + /** + * @Description 党员基本情况-饼状图概况 + * @NEI https://nei.netease.com/interface/detail/?pid=57068&id=321324 + * @param param + * @return + * @author wangc + * @date 2020.08.18 16:59 + **/ + @PostMapping("basicinfo") + Result partymemberBaseInfo(ParymemberFormDTO param){ + ValidatorUtils.validateEntity(param, ParymemberFormDTO.Parymember.class); + return new Result().ok(grassrootsPartyDevService.partymemberBaseInfo(param)); + } + } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCpcBaseDataDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCpcBaseDataDao.java index 76edf9c12b..26f91ed0be 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCpcBaseDataDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCpcBaseDataDao.java @@ -17,7 +17,10 @@ package com.epmet.datareport.dao.screen; +import com.epmet.screen.dto.result.PartymemberAgePercentResultDTO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + /** * 基层党建-党员基本情况 @@ -27,5 +30,15 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ScreenCpcBaseDataDao{ - + + /** + * @Description 查询党员年龄分布情况 + * @param agencyId + * @return + * @author wangc + * @date 2020.08.18 17:47 + **/ + PartymemberAgePercentResultDTO selectPartymemberAgeDistribution(@Param("agencyId") String agencyId); + + } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenPartyBranchDataDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenPartyBranchDataDao.java index 83b3fb5c15..bd51bb6869 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenPartyBranchDataDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenPartyBranchDataDao.java @@ -17,7 +17,11 @@ package com.epmet.datareport.dao.screen; +import com.epmet.screen.dto.result.BranchIssueDataResultDTO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 基层党建-建设情况数据(支部,联建) @@ -27,5 +31,24 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ScreenPartyBranchDataDao { - + + /** + * @Description 根据agencyTd、type(数据类别 party:支部建设;union:联合建设)查出共有多少议题主题 + * @param agencyId + * @param type + * @return List + * @author wangc + * @date 2020.08.19 10:44 + **/ + List selectIssueGroup(@Param("agencyId") String agencyId , @Param("type") String type); + + /** + * @Description 根据议题名称查找近12个月的数据 + * @param agencyId .. + * @return List + * @author wangc + * @date 2020.08.19 10:59 + **/ + List selectBranchDataByTypeAndTimeZone(@Param("agencyId") String agencyId , @Param("type") String type, @Param("category") String category, @Param("bottomMonthId") String bottomMonthId); + } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/GrassrootsPartyDevService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/GrassrootsPartyDevService.java index 4f25eb5f0d..8caa92ac10 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/GrassrootsPartyDevService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/GrassrootsPartyDevService.java @@ -1,6 +1,9 @@ package com.epmet.datareport.service.screen; +import com.epmet.screen.dto.form.BranchBuildTrendFormDTO; import com.epmet.screen.dto.form.ParymemberFormDTO; +import com.epmet.screen.dto.result.BranchBuildTrendResultDTO; +import com.epmet.screen.dto.result.PartymemberAgeDistributionResultDTO; import com.epmet.screen.dto.result.PartymemberPercentResultDTO; /** @@ -20,5 +23,24 @@ public interface GrassrootsPartyDevService { * @date 2020.08.18 14:58 **/ PartymemberPercentResultDTO partymemberBaseInfo(ParymemberFormDTO param); + + /** + * @Description 2、党员基本情况-年龄分布 + * @NEI https://nei.netease.com/interface/detail/req/?pid=57068&id=321980 + * @param param + * @return + * @author wangc + * @date 2020.08.18 17:54 + **/ + PartymemberAgeDistributionResultDTO partymemberAgeDistribution(ParymemberFormDTO param); + /** + * @Description 3、支部建设情况|联建共建情况-折线图 + * @NEI https://nei.netease.com/interface/detail/req/?pid=57068&id=321981 + * @param param + * @return BranchBuildTrendResultDTO + * @author wangc + * @date 2020.08.19 11:02 + **/ + BranchBuildTrendResultDTO branchBuildTrend(BranchBuildTrendFormDTO param); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/GrassrootsPartyDevServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/GrassrootsPartyDevServiceImpl.java index 94cf163888..d0458bfca5 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/GrassrootsPartyDevServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/GrassrootsPartyDevServiceImpl.java @@ -1,14 +1,26 @@ package com.epmet.datareport.service.screen.impl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.datareport.dao.screen.ScreenCpcBaseDataDao; +import com.epmet.datareport.dao.screen.ScreenPartyBranchDataDao; import com.epmet.datareport.dao.screen.ScreenUserTotalDataDao; +import com.epmet.screen.dto.form.BranchBuildTrendFormDTO; import com.epmet.screen.dto.form.ParymemberFormDTO; -import com.epmet.screen.dto.result.PartymemberPercentResultDTO; +import com.epmet.screen.dto.result.*; import com.epmet.datareport.service.screen.GrassrootsPartyDevService; +import com.google.common.collect.Maps; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + /** * 基层党建相关各指标查询 * @@ -22,6 +34,11 @@ public class GrassrootsPartyDevServiceImpl implements GrassrootsPartyDevService @Autowired private ScreenUserTotalDataDao screenUserTotalDataDao; + @Autowired + private ScreenCpcBaseDataDao screenCpcBaseDataDao; + @Autowired + private ScreenPartyBranchDataDao screenPartyBranchDataDao; + private List issueGroup; /** * @Description 1、党员基本情况-饼状图概况 @@ -35,7 +52,203 @@ public class GrassrootsPartyDevServiceImpl implements GrassrootsPartyDevService public PartymemberPercentResultDTO partymemberBaseInfo(ParymemberFormDTO param) { PartymemberPercentResultDTO result = screenUserTotalDataDao.selectAgencyPartymemberPercent(param.getAgencyId()); + if(null == result){ + logger.warn("com.epmet.datareport.service.screen.impl.GrassrootsPartyDevServiceImpl.partymemberBaseInfo:未查询出指定agencyId下的党员基础信息数据,agencyId :: {}",param.getAgencyId()); + result.setPercentInPlatForm(convertPercentStr(BigDecimal.ZERO)); + return result; + } + //partymember / platform + if(null == result.getPlatFormTotal() || NumConstant.ZERO == result.getPlatFormTotal()){ + result.setPercentInPlatForm(convertPercentStr(BigDecimal.ZERO)); + }else{ + result.setPercentInPlatForm(convertPercentStr(new BigDecimal(result.getPartyMemberTotal()/result.getPlatFormTotal()))); + } + return result; + } + + /** + * @Description 2、党员基本情况-年龄分布 + * @NEI https://nei.netease.com/interface/detail/req/?pid=57068&id=321980 + * @param param + * @return + * @author wangc + * @date 2020.08.18 17:54 + **/ + @Override + public PartymemberAgeDistributionResultDTO partymemberAgeDistribution(ParymemberFormDTO param) { + PartymemberAgePercentResultDTO percent = screenCpcBaseDataDao.selectPartymemberAgeDistribution(param.getAgencyId()); + PartymemberAgeDistributionResultDTO result = new PartymemberAgeDistributionResultDTO(); + + if(null == percent.getUnder30Ratio()) percent.setUnder30Ratio(new BigDecimal(NumConstant.ZERO)); + result.setUnder30Ratio(convertPercentStr(percent.getUnder30Ratio())); + + if(null == percent.getBetween31And50Ratio()) percent.setBetween31And50Ratio(new BigDecimal(NumConstant.ZERO)); + result.setBetween31And50Ratio(convertPercentStr(percent.getBetween31And50Ratio())); + + if(null == percent.getBetween51And60Ratio()) percent.setBetween51And60Ratio(new BigDecimal(NumConstant.ZERO)); + result.setBetween51And60Ratio(convertPercentStr(percent.getBetween51And60Ratio())); + + if(null == percent.getAbove61()) percent.setAbove61(new BigDecimal(NumConstant.ZERO)); + result.setAbove61(convertPercentStr(percent.getAbove61())); + + return result; + } + + /** + * @Description 3、支部建设情况|联建共建情况-折线图 + * @NEI https://nei.netease.com/interface/detail/req/?pid=57068&id=321981 + * @param param + * @return BranchBuildTrendResultDTO + * @author wangc + * @date 2020.08.19 11:02 + **/ + @Override + public BranchBuildTrendResultDTO branchBuildTrend(BranchBuildTrendFormDTO param) { + if(StringUtils.equals("ljgj",param.getCategory())){ + //联建共建情况 + param.setCategory("union"); + }else if(StringUtils.equals("ljdyzy",param.getCategory())){ + //联建党员志愿服务情况 + param.setCategory("voluntaryservice"); + }else{ + //默认支部建设 + param.setCategory("party"); + } + BranchBuildTrendResultDTO result = new BranchBuildTrendResultDTO(); + //生成近十二个月的横坐标数组 + Map monthMap = getX(); + result.setXAxis(monthMap.values().stream().collect(Collectors.toList())); + + List dataArray = new LinkedList<>(); + List yearlyDataList = + screenPartyBranchDataDao.selectBranchDataByTypeAndTimeZone(param.getAgencyId(),param.getType(),param.getCategory(),monthMap.keySet().iterator().next()); + + + if(null != yearlyDataList && !yearlyDataList.isEmpty()){ + + Map> dataMapByIssue = + yearlyDataList.stream().collect(Collectors.groupingBy(BranchIssueDataResultDTO::getIssue)); + + + result.setLegend(new LinkedList<>(dataMapByIssue.keySet())); + + dataMapByIssue.forEach((issue,val) ->{ + List issueYearlyDataList = val; + List numArray = new LinkedList<>(); + BranchTrendSeriesDataResultDTO data = new BranchTrendSeriesDataResultDTO(); + data.setName(issue); + if(null != issueYearlyDataList && issueYearlyDataList.isEmpty()){ + monthMap.keySet().forEach( monthId ->{ + Optional optional + = issueYearlyDataList.stream().filter(yearly -> StringUtils.equals(monthId,yearly.getMonthId())).findAny(); + if(optional.isPresent()){ + numArray.add(optional.get().getData()); + }else{ + numArray.add(NumConstant.ZERO); + } + }); + }else{ + for(int i = NumConstant.ZERO ; i < NumConstant.TWELVE ; i++){ + numArray.add(NumConstant.ZERO); + } + } + dataArray.add(data); + }); + } + + result.setSeriesData(dataArray); + result.setLegend(null == result.getLegend() ? new ArrayList<>() : result.getLegend()); return null; } + + + private String convertPercentStr(BigDecimal percent){ + if(null == percent || BigDecimal.ZERO == percent) return "0.00%"; + String percentStr = percent.setScale(NumConstant.TWO, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString(); + return percentStr.concat("%"); + } + + /** + * @Description 返回当前月以及前十一个月,升序 + * @param + * @return Map key:202001 value:1月 + * @author wangc + * @date 2020.08.19 12:46 + **/ + private Map getX(){ + SimpleDateFormat format = new SimpleDateFormat("YYYYmm"); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); // 设置为当前时间 + calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - 1); // 设置为上一个月 + String currentMonth = format.format(calendar.getTime()); + Integer monthCounter = Integer.parseInt(currentMonth); + Map monthMap = new HashMap<>(); + int i = NumConstant.ONE; + while(i <= NumConstant.TWELVE){ + + if(monthCounter.toString().endsWith("00")){ + monthCounter -= NumConstant.EIGHTY_EIGHT; + } + + String abscissa = monthCounter.toString().substring(monthCounter.toString().length() - NumConstant.TWO); + if(abscissa.startsWith("0")) { + abscissa = abscissa.replace("0","").concat("月"); + }else{ + abscissa = abscissa.concat("月"); + } + monthMap.put(monthCounter.toString(),abscissa); + monthCounter-- ; + i++; + } + + Map result = Maps.newLinkedHashMap(); + monthMap.entrySet().stream().sorted(Map.Entry.comparingByKey()) + .forEachOrdered((e -> result.put(e.getKey(),e.getValue()))); + + return result; + } + + + public static void main(String[] args) { + SimpleDateFormat format = new SimpleDateFormat("yyyyMM"); + String currentMonth = format.format(new Date()); + Integer monthCounter = Integer.parseInt(currentMonth); + Map monthMap = new HashMap<>(); + int i = NumConstant.ONE; + while(i <= NumConstant.TWELVE){ + + if(monthCounter.toString().endsWith("00")){ + monthCounter -= NumConstant.EIGHTY_EIGHT; + } + + String abscissa = monthCounter.toString().substring(monthCounter.toString().length() - NumConstant.TWO); + if(abscissa.startsWith("0")) { + abscissa = abscissa.replace("0","").concat("月"); + }else{ + abscissa = abscissa.concat("月"); + } + monthMap.put(monthCounter.toString(),abscissa); + monthCounter-- ; + i++; + } + + + Map result = Maps.newLinkedHashMap(); + monthMap.entrySet().stream().sorted(Map.Entry.comparingByKey()) + .forEachOrdered((e -> result.put(e.getKey(),e.getValue()))); + result.forEach((k,v) -> { + System.out.print(k); + System.out.print(" -> "); + System.out.print(v); + System.out.println(); + }); + + List xLine = result.values().stream().collect(Collectors.toList()); + xLine.forEach(x -> { + System.out.println(x); + }); + + result.keySet().forEach(key -> System.out.println(key)); + } } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCpcBaseDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCpcBaseDataDao.xml index 356c3bae7e..24b84fb507 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCpcBaseDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCpcBaseDataDao.xml @@ -3,6 +3,19 @@ - + + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyBranchDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyBranchDataDao.xml index bab712283c..c095f123a6 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyBranchDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyBranchDataDao.xml @@ -3,6 +3,39 @@ + + + + \ No newline at end of file