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 new file mode 100644 index 0000000000..66da4e0e9e --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityIndexFormDTO.java @@ -0,0 +1,34 @@ +package com.epmet.evaluationindex.screen.dto.form; + + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 能力指数--接口入参 + * @Author sun + */ +@Data +public class AblityIndexFormDTO implements Serializable { + private static final long serialVersionUID = -2880432640584616651L; + /** + * 组织Id + */ + @NotBlank(message = "客户ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class}) + private String customerId; + /** + * 组织Id + */ + @NotBlank(message = "组织ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class}) + private String agencyId; + /** + * 月份Id(格式:202009) + */ + @NotBlank(message = "月份ID不能为空",groups = {AblityIndexFormDTO.AddUserInternalGroup.class}) + private String monthId; + public interface AddUserInternalGroup {} + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityListFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityListFormDTO.java new file mode 100644 index 0000000000..f1c4221482 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AblityListFormDTO.java @@ -0,0 +1,42 @@ +package com.epmet.evaluationindex.screen.dto.form; + + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 按月查询各项指标数据--接口入参 + * @Author sun + */ +@Data +public class AblityListFormDTO implements Serializable { + private static final long serialVersionUID = -2880432640584616651L; + /** + * 组织Id + */ + @NotBlank(message = "客户ID不能为空",groups = {AblityListFormDTO.AddUserInternalGroup.class}) + private String customerId; + /** + * 组织Id + */ + @NotBlank(message = "组织ID不能为空",groups = {AblityListFormDTO.AddUserInternalGroup.class}) + private String agencyId; + /** + * 月份Id(格式:202009) + */ + @NotBlank(message = "月份ID不能为空",groups = {AblityListFormDTO.AddUserInternalGroup.class}) + private String monthId; + /** + * 类型(党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli;) + */ + @NotBlank(message = "类型不能为空",groups = {AblityListFormDTO.AddUserInternalGroup.class}) + private String indexCode; + /** + * 所有有权重的指标code拼接的字符串 冒号隔开 + */ + private String allParentIndexCode; + public interface AddUserInternalGroup {} + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthAblityListFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthAblityListFormDTO.java new file mode 100644 index 0000000000..365fdb2000 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthAblityListFormDTO.java @@ -0,0 +1,43 @@ +package com.epmet.evaluationindex.screen.dto.form; + + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 按月查询各项指标最近12个月数据--接口入参 + * @Author sun + */ +@Data +public class MonthAblityListFormDTO implements Serializable { + private static final long serialVersionUID = -2880432640584616651L; + /** + * 组织Id + */ + @NotBlank(message = "客户ID不能为空",groups = {MonthAblityListFormDTO.AddUserInternalGroup.class}) + private String customerId; + /** + * 组织Id + */ + @NotBlank(message = "组织ID不能为空",groups = {MonthAblityListFormDTO.AddUserInternalGroup.class}) + private String agencyId; + /** + * 月份Id(格式:202009) + */ + @NotBlank(message = "月份ID不能为空",groups = {MonthAblityListFormDTO.AddUserInternalGroup.class}) + private String monthId; + /** + * 月份Id(格式:202009) + */ + @NotBlank(message = "类型key不能为空",groups = {MonthAblityListFormDTO.AddUserInternalGroup.class}) + private String key; + /** + * 查询月份的前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/MonthScoreListFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthScoreListFormDTO.java new file mode 100644 index 0000000000..3efeee665f --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthScoreListFormDTO.java @@ -0,0 +1,33 @@ +package com.epmet.evaluationindex.screen.dto.form; + + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 能力指数--接口入参 + * @Author sun + */ +@Data +public class MonthScoreListFormDTO implements Serializable { + private static final long serialVersionUID = -2880432640584616651L; + /** + * 组织Id + */ + @NotBlank(message = "客户ID不能为空",groups = {MonthScoreListFormDTO.AddUserInternalGroup.class}) + private String customerId; + /** + * 组织Id + */ + @NotBlank(message = "组织ID不能为空",groups = {MonthScoreListFormDTO.AddUserInternalGroup.class}) + private String agencyId; + /** + * 月份Id(格式:202009) + */ + @NotBlank(message = "月份ID不能为空",groups = {MonthScoreListFormDTO.AddUserInternalGroup.class}) + private String monthId; + public interface AddUserInternalGroup {} + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/PeerComparisonFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/PeerComparisonFormDTO.java new file mode 100644 index 0000000000..2d0b69bd2f --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/PeerComparisonFormDTO.java @@ -0,0 +1,39 @@ +package com.epmet.evaluationindex.screen.dto.form; + + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 同级对比各项数据查询--接口入参 + * @Author sun + */ +@Data +public class PeerComparisonFormDTO implements Serializable { + private static final long serialVersionUID = -2880432640584616651L; + /** + * 组织Id + */ + @NotBlank(message = "客户ID不能为空",groups = {PeerComparisonFormDTO.AddUserInternalGroup.class}) + private String customerId; + /** + * 组织Id + */ + @NotBlank(message = "组织ID不能为空",groups = {PeerComparisonFormDTO.AddUserInternalGroup.class}) + private String agencyId; + /** + * 类型(党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli;) + */ + @NotBlank(message = "数据类型不能为空",groups = {PeerComparisonFormDTO.AddUserInternalGroup.class}) + private String indexCode; + /** + * 查询条数 + */ + @Min(value = 1, message = "查询条数必须大于0", groups = {PeerComparisonFormDTO.AddUserInternalGroup.class }) + private Integer pageSize; + public interface AddUserInternalGroup {} + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/RootAgencyFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/RootAgencyFormDTO.java new file mode 100644 index 0000000000..97355373a3 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/RootAgencyFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.evaluationindex.screen.dto.form; + + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 是否根组织--接口入参 + * @Author sun + */ +@Data +public class RootAgencyFormDTO implements Serializable { + private static final long serialVersionUID = -2880432640584616651L; + /** + * 组织Id + */ + @NotBlank(message = "组织ID不能为空",groups = {RootAgencyFormDTO.AddUserInternalGroup.class}) + private String agencyId; + + 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 new file mode 100644 index 0000000000..ea430fa0a7 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ScoreListFormDTO.java @@ -0,0 +1,38 @@ +package com.epmet.evaluationindex.screen.dto.form; + + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 按月份查询各项能力分数--接口入参 + * @Author sun + */ +@Data +public class ScoreListFormDTO implements Serializable { + private static final long serialVersionUID = -2880432640584616651L; + /** + * 组织Id + */ + @NotBlank(message = "客户ID不能为空",groups = {ScoreListFormDTO.AddUserInternalGroup.class}) + private String customerId; + /** + * 组织Id + */ + @NotBlank(message = "组织ID不能为空",groups = {ScoreListFormDTO.AddUserInternalGroup.class}) + private String agencyId; + /** + * 月份Id(格式:202009) + */ + @NotBlank(message = "月份ID不能为空",groups = {ScoreListFormDTO.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/result/AblityIndexResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityIndexResultDTO.java new file mode 100644 index 0000000000..d50bcdc137 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityIndexResultDTO.java @@ -0,0 +1,51 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 能力指数--接口返参 + * @Author sun + */ +@Data +public class AblityIndexResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli + */ + private String indexCode; + /** + * 每项能力最近12月各项分数对象 + */ + private List scoreList; + + @Data + public static class ScoreListResultDTO implements Serializable { + /** + * 能力总分 + */ + private Double indexTotal; + /** + * 本级能力分 + */ + private Double agencyScore; + /** + * 下级能力分 + */ + private Double subAgencyScore; + /** + * 横坐标(202009) + */ + private String monthId; + + } + + + + + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java new file mode 100644 index 0000000000..2df53bff05 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java @@ -0,0 +1,29 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 按月查询各项指标数据--接口返参 + * @Author sun + */ +@Data +public class AblityListResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 各项指标名称 + */ + private String name; + /** + * 指标对应值(数值或百分比) + */ + private String value = "0"; + /** + * 各项指标对应key值(index_dict字典表) + */ + private String key; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthAblityListResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthAblityListResultDTO.java new file mode 100644 index 0000000000..86e9372e78 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthAblityListResultDTO.java @@ -0,0 +1,25 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 按月查询各项指标最近12个月数据--接口返参 + * @Author sun + */ +@Data +public class MonthAblityListResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 横坐标(202009) + */ + private String monthId; + /** + * 指标对应值(数值或百分比) + */ + private String ablity; + +} 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 new file mode 100644 index 0000000000..c40628cdd4 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthScoreListResultDTO.java @@ -0,0 +1,48 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 按月份查询各项能力最近12个月得分--接口返参 + * @Author sun + */ +@Data +public class MonthScoreListResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli + */ + private String indexCode; + /** + * 每项能力最近12月各项分数对象 + */ + private List scoreList; + + @Data + public static class ScoreListResultDTO implements Serializable { + /** + * 能力总分 + */ + private Double indexTotal; + /** + * 本级能力分 + */ + private Double agencyScore; + /** + * 下级能力分 + */ + private Double subAgencyScore; + /** + * 横坐标(202009) + */ + private String monthId; + + } + + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PeerComparisonResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PeerComparisonResultDTO.java new file mode 100644 index 0000000000..95e9545a8c --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PeerComparisonResultDTO.java @@ -0,0 +1,29 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 同级对比各项数据查询--接口返参 + * @Author sun + */ +@Data +public class PeerComparisonResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 组织Id + */ + private String agencyId; + /** + * 组织名称 + */ + private String agencyName; + /** + * 能力分值(保留一位小数) + */ + private Double score; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/RootAgencyResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/RootAgencyResultDTO.java new file mode 100644 index 0000000000..910e56eaa3 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/RootAgencyResultDTO.java @@ -0,0 +1,26 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 是否根组织--接口返参 + * @Author sun + */ +@Data +public class RootAgencyResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 是否根组织(是:true 否:false) + */ + private Boolean isRoot = true; + + /** + * 数据更新至(上月月末时间) + */ + private String date; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScoreListResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScoreListResultDTO.java new file mode 100644 index 0000000000..9672f58bfe --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScoreListResultDTO.java @@ -0,0 +1,33 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 按月份查询各项能力分数--接口返参 + * @Author sun + */ +@Data +public class ScoreListResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 类型(党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli;) + */ + private String indexCode; + /** + * 总分(保留一位小数) + */ + private Double indexTotal; + /** + * 本级分数(保留一位小数) + */ + private Double agencyScore; + /** + * 下级分数(保留一位小数) + */ + private Double subAgencyScore; + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/FactConstant.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/FactConstant.java new file mode 100644 index 0000000000..529563feb2 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/FactConstant.java @@ -0,0 +1,36 @@ +package com.epmet.datareport.constant; + +/** + * @author sun + * @dscription 数据 + */ +public interface FactConstant { + /** + * 能力指标 + */ + String NLZB = "nenglizhibiao"; + /** + * 党建能力 + */ + String DJNL = "dangjiannengli"; + /** + * 治理能力 + */ + String ZLNL = "zhilinengli"; + /** + * 服务能力 + */ + String FWNL = "fuwunengli"; + /** + * 全区相关 + */ + String QUAN_QU_XIANG_GUAN = "quanquxiangguan"; + /** + * 街道相关 + */ + String JIE_DAO_XIANG_GUAN = "jiedaoxiangguan"; + /** + * 社区相关 + */ + String SHE_QU_XIANG_GUAN = "shequxiangguan"; +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/fact/FactIndexController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/fact/FactIndexController.java new file mode 100644 index 0000000000..4399756545 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/fact/FactIndexController.java @@ -0,0 +1,107 @@ +package com.epmet.datareport.controller.fact; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.datareport.service.fact.FactIndexService; +import com.epmet.evaluationindex.screen.dto.form.*; +import com.epmet.evaluationindex.screen.dto.result.*; +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.util.List; + +/** + * 数据改版api + * @author sun + */ +@RestController +@RequestMapping("fact") +public class FactIndexController { + + @Autowired + private FactIndexService factIndexService; + + /** + * @param tokenDTO + * @Description 能力指数 + * @author sun + */ + @PostMapping("index/ablityindex") + public Result> ablityIndex(@LoginUser TokenDto tokenDTO, @RequestBody AblityIndexFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, AblityIndexFormDTO.AddUserInternalGroup.class); + return new Result>().ok(factIndexService.ablityIndex(formDTO)); + } + + /** + * @param tokenDTO + * @Description 按月份查询各项能力分数 + * @author sun + */ + @PostMapping("index/scorelist") + public Result> scoreList(@LoginUser TokenDto tokenDTO, @RequestBody ScoreListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ScoreListFormDTO.AddUserInternalGroup.class); + return new Result>().ok(factIndexService.scoreList(formDTO)); + } + + /** + * @param tokenDTO + * @Description 按月份查询各项能力最近12个月得分 + * @author sun + */ + @PostMapping("index/monthscorelist") + public Result> monthScoreList(@LoginUser TokenDto tokenDTO, @RequestBody MonthScoreListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, MonthScoreListFormDTO.AddUserInternalGroup.class); + return new Result>().ok(factIndexService.monthScoreList(formDTO)); + } + + /** + * @param tokenDTO + * @Description 按月查询各项指标数据 + * @author sun + */ + @PostMapping("index/ablitylist") + public Result> ablityList(@LoginUser TokenDto tokenDTO, @RequestBody AblityListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, AblityListFormDTO.AddUserInternalGroup.class); + return new Result>().ok(factIndexService.ablityList(formDTO)); + } + + /** + * @param tokenDTO + * @Description 按月查询各项指标最近12个月数据 + * @author sun + */ + @PostMapping("index/monthablitylist") + public Result> monthAblityList(@LoginUser TokenDto tokenDTO, @RequestBody MonthAblityListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, MonthAblityListFormDTO.AddUserInternalGroup.class); + return new Result>().ok(factIndexService.monthAblityList(formDTO)); + } + + /** + * @param tokenDTO + * @Description 同级对比各项数据查询 + * @author sun + */ + @PostMapping("index/peercomparison") + public Result> peerComparison(@LoginUser TokenDto tokenDTO, @RequestBody PeerComparisonFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, PeerComparisonFormDTO.AddUserInternalGroup.class); + return new Result>().ok(factIndexService.peerComparison(formDTO)); + } + + /** + * @param tokenDTO + * @Description 是否根组织 + * @author sun + */ + @PostMapping("index/rootagency") + public Result rootAgency(@LoginUser TokenDto tokenDTO, @RequestBody RootAgencyFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, RootAgencyFormDTO.AddUserInternalGroup.class); + return new Result().ok(factIndexService.rootAgency(formDTO)); + } + + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index 17c48ae989..88aaf3ae2f 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java @@ -80,4 +80,10 @@ public interface ScreenCustomerAgencyDao { */ List selectParymemberDistribution(@Param("parentId")String parentId); + /** + * @param agencyId + * @Description 根据组织ID判断是否根组织 + * @author sun + */ + int selectRootAgency(@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/evaluationindex/screen/ScreenIndexDataMonthlyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java index 6448f9902b..c64d8dbef9 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java @@ -19,11 +19,9 @@ package com.epmet.datareport.dao.evaluationindex.screen; import com.epmet.evaluationindex.screen.dto.form.AnNingSubAgencyIndexRankFormDTO; import com.epmet.evaluationindex.screen.dto.form.GridIndexRankFormDTO; +import com.epmet.evaluationindex.screen.dto.form.PeerComparisonFormDTO; import com.epmet.evaluationindex.screen.dto.form.SubAgencyIndexRankFormDTO; -import com.epmet.evaluationindex.screen.dto.result.AnNingSubAgencyIndexRankResultDTO; -import com.epmet.evaluationindex.screen.dto.result.MonthBarchartResult; -import com.epmet.evaluationindex.screen.dto.result.MonthPieChartResultDTO; -import com.epmet.evaluationindex.screen.dto.result.SubAgencyIndexRankResultDTO; +import com.epmet.evaluationindex.screen.dto.result.*; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -79,4 +77,11 @@ public interface ScreenIndexDataMonthlyDao{ * @return */ List selectIndexRankByOrgType(GridIndexRankFormDTO formDTO); + + /** + * @param formDTO + * @Description 同级对比--根据组织Id的上级组织Id查询同级组织对应类型的得分排名(查询最近一个月数据) + * @author sun + */ + List selectScoreList(PeerComparisonFormDTO formDTO); } 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 new file mode 100644 index 0000000000..0ca569e995 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencyScoreDao.java @@ -0,0 +1,39 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.datareport.dao.fact; + +import com.epmet.evaluationindex.screen.dto.form.ScoreListFormDTO; +import com.epmet.evaluationindex.screen.dto.result.ScoreListResultDTO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 区/街道相关分数表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-09-02 + */ +@Mapper +public interface FactIndexAgencyScoreDao { + + /** + * @param formDTO + * @Description 分别查询当前组织某一月份党建能力、治理能力、服务能力对应的总分、本级分、下级分 + * @author sun + */ + ScoreListResultDTO selectScore(ScoreListFormDTO formDTO); +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencySubScoreDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencySubScoreDao.java new file mode 100644 index 0000000000..0fd8e29c06 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencySubScoreDao.java @@ -0,0 +1,51 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.datareport.dao.fact; + +import com.epmet.evaluationindex.screen.dto.form.AblityListFormDTO; +import com.epmet.evaluationindex.screen.dto.form.MonthAblityListFormDTO; +import com.epmet.evaluationindex.screen.dto.result.AblityListResultDTO; +import com.epmet.evaluationindex.screen.dto.result.MonthAblityListResultDTO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.LinkedList; +import java.util.List; + +/** + * 区/街道相关分数表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-09-02 + */ +@Mapper +public interface FactIndexAgencySubScoreDao { + + /** + * @param formDTO + * @Description 查询区县级、乡镇街道级组织某月份某项能力对应的各项指标 + * @author sun + */ + List selectAblityList(AblityListFormDTO formDTO); + + /** + * @param formDTO + * @Description 查询区县级、乡镇街道级组织某项能力对应的一项指标过去12个月份数据 + * @author sun + */ + LinkedList selectMonthAblityList(MonthAblityListFormDTO formDTO); +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunitySubScoreDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunitySubScoreDao.java new file mode 100644 index 0000000000..1689ab0b3c --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunitySubScoreDao.java @@ -0,0 +1,51 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.datareport.dao.fact; + +import com.epmet.evaluationindex.screen.dto.form.AblityListFormDTO; +import com.epmet.evaluationindex.screen.dto.form.MonthAblityListFormDTO; +import com.epmet.evaluationindex.screen.dto.result.AblityListResultDTO; +import com.epmet.evaluationindex.screen.dto.result.MonthAblityListResultDTO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.LinkedList; +import java.util.List; + +/** + * 区/街道相关分数表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-09-02 + */ +@Mapper +public interface FactIndexCommunitySubScoreDao { + + /** + * @param formDTO + * @Description 查询社区级组织某一月份某项能力对应的各项指标 + * @author sun + */ + List selectCommunityAblityList(AblityListFormDTO formDTO); + + /** + * @param formDTO + * @Description 查询社区级组织某项能力对应的一项指标过去12个月份数据 + * @author sun + */ + LinkedList selectCommunityMonthAblityList(MonthAblityListFormDTO formDTO); +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/FactIndexService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/FactIndexService.java new file mode 100644 index 0000000000..475549a522 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/FactIndexService.java @@ -0,0 +1,63 @@ +package com.epmet.datareport.service.fact; + +import com.epmet.evaluationindex.screen.dto.form.*; +import com.epmet.evaluationindex.screen.dto.result.*; + +import java.util.List; + +/** + * 数据改版api + * @author sun + */ +public interface FactIndexService { + + /** + * @param formDTO + * @Description 能力指数 + * @author sun + */ + List ablityIndex(AblityIndexFormDTO formDTO); + + /** + * @param formDTO + * @Description 按月份查询各项能力分数 + * @author sun + */ + List scoreList(ScoreListFormDTO formDTO); + + /** + * @param formDTO + * @Description 按月份查询各项能力最近12个月得分 + * @author sun + */ + List monthScoreList(MonthScoreListFormDTO formDTO); + + /** + * @param formDTO + * @Description 按月查询各项指标数据 + * @author sun + */ + List ablityList(AblityListFormDTO formDTO); + + /** + * @param formDTO + * @Description 按月查询各项指标最近12个月数据 + * @author sun + */ + List monthAblityList(MonthAblityListFormDTO formDTO); + + /** + * @param formDTO + * @Description 同级对比各项数据查询 + * @author sun + */ + List peerComparison(PeerComparisonFormDTO formDTO); + + /** + * @param formDTO + * @Description 是否根组织 + * @author sun + */ + RootAgencyResultDTO rootAgency(RootAgencyFormDTO 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 new file mode 100644 index 0000000000..52a9fe1d7a --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java @@ -0,0 +1,235 @@ +package com.epmet.datareport.service.fact.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.ErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.constant.DataSourceConstant; +import com.epmet.datareport.constant.FactConstant; +import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerAgencyDao; +import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataMonthlyDao; +import com.epmet.datareport.dao.fact.FactIndexAgencyScoreDao; +import com.epmet.datareport.dao.fact.FactIndexAgencySubScoreDao; +import com.epmet.datareport.dao.fact.FactIndexCommunitySubScoreDao; +import com.epmet.datareport.service.fact.FactIndexService; +import com.epmet.evaluationindex.screen.dto.form.*; +import com.epmet.evaluationindex.screen.dto.result.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * 数据改版api + * + * @author sun + */ +@Service +@DataSource(DataSourceConstant.EVALUATION_INDEX) +public class FactIndexServiceImpl implements FactIndexService { + + @Autowired + private ScreenCustomerAgencyDao screenCustomerAgencyDao; + @Autowired + private ScreenIndexDataMonthlyDao screenIndexDataMonthlyDao; + @Autowired + private FactIndexAgencyScoreDao factIndexAgencyScoreDao; + @Autowired + private FactIndexAgencySubScoreDao factIndexAgencySubScoreDao; + @Autowired + private FactIndexCommunitySubScoreDao factIndexCommunitySubScoreDao; + + /** + * @param formDTO + * @Description 能力指数 + * @author sun + */ + @Override + public List ablityIndex(AblityIndexFormDTO formDTO) { + LinkedList resultDTO = new LinkedList<>(); + //分别查询过去12个月党建能力、治理能力、服务能力各自总分乘权重后的分值,每个月份三个分值的加和就是当月的能力指数的分值 fact_index_agency_score 按月份升序 + //1.查询组织过去12个月党建能力指标 + //LinkedList djList = factIndexAgencyScoreDao.; + LinkedList djList = null; + //2.查询组织过去12个月治理能力指标 + LinkedList zlList = null; + //3.查询组织过去12个月服务能力指标 + LinkedList fwList = null; + //4.遍历计算每个月能力指数 + LinkedList nlList = new LinkedList<>(); + for (int i = 0; i < djList.size(); i++) { + AblityIndexResultDTO.ScoreListResultDTO nldto = new AblityIndexResultDTO.ScoreListResultDTO(); + nldto.setIndexTotal(djList.get(i).getIndexTotal() + zlList.get(i).getIndexTotal() + fwList.get(i).getIndexTotal()); + nldto.setAgencyScore(djList.get(i).getAgencyScore() + zlList.get(i).getAgencyScore() + fwList.get(i).getAgencyScore()); + nldto.setSubAgencyScore(djList.get(i).getSubAgencyScore() + zlList.get(i).getSubAgencyScore() + fwList.get(i).getSubAgencyScore()); + nldto.setMonthId(djList.get(i).getMonthId()); + nlList.add(nldto); + } + //5.封装数据并返回 + AblityIndexResultDTO nl = new AblityIndexResultDTO(); + nl.setIndexCode(FactConstant.NLZB); + nl.setScoreList(djList); + resultDTO.add(nl); + AblityIndexResultDTO dj = new AblityIndexResultDTO(); + dj.setIndexCode(FactConstant.DJNL); + dj.setScoreList(djList); + resultDTO.add(dj); + AblityIndexResultDTO zl = new AblityIndexResultDTO(); + zl.setIndexCode(FactConstant.ZLNL); + zl.setScoreList(djList); + resultDTO.add(zl); + AblityIndexResultDTO fw = new AblityIndexResultDTO(); + fw.setIndexCode(FactConstant.FWNL); + fw.setScoreList(djList); + resultDTO.add(fw); + + return resultDTO; + } + + /** + * @param formDTO + * @Description 按月份查询各项能力分数 + * @author sun + */ + @Override + public List scoreList(ScoreListFormDTO formDTO) { + //1.查询当前组织某一月份党建能力对应的总分、本级分、下级分 + formDTO.setIndexCode(FactConstant.DJNL); + ScoreListResultDTO dj = factIndexAgencyScoreDao.selectScore(formDTO); + //2.查询当前组织某一月份治理能力对应的总分、本级分、下级分 + //3.查询当前组织某一月份服务能力对应的总分、本级分、下级分 + + return null; + } + + /** + * @param formDTO + * @Description 按月份查询各项能力最近12个月得分 + * @author sun + */ + @Override + public List monthScoreList(MonthScoreListFormDTO formDTO) { + return null; + } + + /** + * @param formDTO + * @Description 按月查询各项指标数据 + * @author sun + */ + @Override + public List ablityList(AblityListFormDTO formDTO) { + List resultList = new ArrayList<>(); + //按月份查询当前组织各项指标数据 fact_index_agency_sub_score + //1.根据组织Id查询组织信息 + CompartmentResultDTO agency = screenCustomerAgencyDao.getAgencyAreaInfo(formDTO.getAgencyId()); + if (null == agency) { + throw new RenException(String.format("根据组织Id未查询到组织信息,组织Id:%s", formDTO.getAgencyId())); + } + //2.根据组织级别拼接查询条件,判断查询不同数据表 + //区县级、乡镇街道级 + if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) { + if ("district".equals(agency.getLevel())) { + formDTO.setAllParentIndexCode(FactConstant.QUAN_QU_XIANG_GUAN + ":" + formDTO.getIndexCode()); + } else { + formDTO.setAllParentIndexCode(FactConstant.JIE_DAO_XIANG_GUAN + ":" + formDTO.getIndexCode()); + } + resultList = factIndexAgencySubScoreDao.selectAblityList(formDTO); + + //社区级 + } else if ("community".equals(agency.getLevel())) { + formDTO.setAllParentIndexCode(FactConstant.SHE_QU_XIANG_GUAN + ":" + formDTO.getIndexCode()); + resultList = factIndexCommunitySubScoreDao.selectCommunityAblityList(formDTO); + } else { + throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getAgencyId())); + } + //3.调用方法判断各项指标是数字指标还是百分比指标 //TODO + return resultList; + } + + /** + * @param formDTO + * @Description 按月查询各项指标最近12个月数据 + * @author sun + */ + @Override + public List monthAblityList(MonthAblityListFormDTO formDTO) { + LinkedList resultList = new LinkedList<>(); + //1.计算所查月份前12个月的monthId + formDTO.setStartMonthId(getDate(formDTO.getMonthId())); + //2.根据组织Id查询组织信息 + CompartmentResultDTO agency = screenCustomerAgencyDao.getAgencyAreaInfo(formDTO.getAgencyId()); + if (null == agency) { + throw new RenException(String.format("查询到组织信息失败,组织Id:%s", formDTO.getAgencyId())); + } + + //3.根据组织级别拼接查询条件,判断查询不同数据表 + //区县级、乡镇街道级 + if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) { + resultList = factIndexAgencySubScoreDao.selectMonthAblityList(formDTO); + + //社区级 + } else if ("community".equals(agency.getLevel())) { + resultList = factIndexCommunitySubScoreDao.selectCommunityMonthAblityList(formDTO); + } else { + throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getAgencyId())); + } + //3.调用方法判断各项指标是数字指标还是百分比指标//TODO + return resultList; + } + + public String getDate(String newDate) { + String date = ""; + SimpleDateFormat sdf = new SimpleDateFormat("yyyymm"); + try { + Calendar ds = Calendar.getInstance(); + ds.setTime(sdf.parse(newDate)); + ds.add(Calendar.YEAR, -1); + date = sdf.format(ds.getTime()); + } catch (RenException | ParseException e) { + e.printStackTrace(); + } + return date; + } + + /** + * @param formDTO + * @Description 同级对比各项数据查询 + * @author sun + */ + @Override + public List peerComparison(PeerComparisonFormDTO formDTO) { + //1.根据组织Id的上级组织Id查询同级组织对应类型的得分排名(查询最近一个月数据) + List resultList = screenIndexDataMonthlyDao.selectScoreList(formDTO); + return resultList; + } + + /** + * @param formDTO + * @Description 是否根组织 + * @author sun + */ + @Override + public RootAgencyResultDTO rootAgency(RootAgencyFormDTO formDTO) { + RootAgencyResultDTO resultDTO = new RootAgencyResultDTO(); + //1.根据agencyId查询是否为根级组织 + int num = screenCustomerAgencyDao.selectRootAgency(formDTO.getAgencyId()); + if (num < NumConstant.ONE) { + resultDTO.setIsRoot(false); + } + //2.计算统计数据更新时间 + SimpleDateFormat d = new SimpleDateFormat("yyyy-MM-dd"); + Calendar calendar = Calendar.getInstance(); + //获取当前月第一天日期 + calendar.add(Calendar.MONTH, 0); + calendar.set(Calendar.DAY_OF_MONTH, 1); + //获取上月最后一天日期 + calendar.set(Calendar.HOUR, -24); + resultDTO.setDate(d.format(calendar.getTime())); + + return resultDTO; + } + +} 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 new file mode 100644 index 0000000000..4ecea63f0a --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml new file mode 100644 index 0000000000..db62b6c918 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml @@ -0,0 +1,42 @@ + + + + + + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml new file mode 100644 index 0000000000..324fbb8a13 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml @@ -0,0 +1,42 @@ + + + + + + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml index 22a62be6d0..932149d9c5 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml @@ -101,4 +101,15 @@ AND sutd.parent_id = #{parentId} + + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml index 36b89ffefe..d244c92906 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml @@ -105,4 +105,62 @@ ORDER BY index_total DESC LIMIT #{topNum} + +