diff --git a/epmet-cloud-generator/src/main/java/io/renren/GeneratorApplication.java b/epmet-cloud-generator/src/main/java/io/renren/GeneratorApplication.java index 143c4bda3a..caad8b0869 100644 --- a/epmet-cloud-generator/src/main/java/io/renren/GeneratorApplication.java +++ b/epmet-cloud-generator/src/main/java/io/renren/GeneratorApplication.java @@ -8,5 +8,6 @@ public class GeneratorApplication { public static void main(String[] args) { SpringApplication.run(GeneratorApplication.class, args); + System.out.println("http://localhost:8070/epmet-cloud-generator/#generator.html"); } } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/dto/IndexExplainDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/dto/IndexExplainDTO.java new file mode 100644 index 0000000000..9980f5500d --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/dto/IndexExplainDTO.java @@ -0,0 +1,122 @@ +/** + * 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.evaluationindex.index.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 指标说明文案 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-12 + */ +@Data +public class IndexExplainDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 标题 + */ + private String title; + + /** + * 指标code + */ + private String indexCode; + + /** + * 含义 + */ + private String meaning; + + /** + * 组织级别(网格级:grid;社区级:community;乡(镇、街道)级:street;区县级: district;市级: city;省级:province) + */ + private String orgLevel; + + /** + * 父ID + */ + private String pid; + + /** + * 排序 + */ + private Integer sort; + + /** + * 是否需要查询;1有;0:无; + */ + private Integer isSearch; + + /** + * 数据类型:none;本级:self;下级:sub + */ + private String type; + + /** + * 是否下钻:1 是;0否;eg:网格的下级分数 下钻到党员 + */ + private Integer goDown; + + /** + * 删除标记 0:未删除,1:已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/dto/IndexExplainTreeDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/dto/IndexExplainTreeDTO.java new file mode 100644 index 0000000000..e50b466e9d --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/dto/IndexExplainTreeDTO.java @@ -0,0 +1,97 @@ +/** + * 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.evaluationindex.index.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + + +/** + * 指标说明文案 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-12 + */ +@Data +public class IndexExplainTreeDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 标题 + */ + private String title; + + /** + * 含义 + */ + private String meaning; + + /** + * 指标code + */ + private String indexCode; + + /** + * 组织级别(网格级:grid;社区级:community;乡(镇、街道)级:street;区县级: district;市级: city;省级:province) + */ + private String orgLevel; + + /** + * 父ID + */ + private String pid; + + /** + * 排序 + */ + private Integer sort; + + /** + * 是否需要查询;1有;0:无; + */ + private Integer isSearch; + + /** + * 数据类型:none;本级:self;下级:sub + */ + private String type; + + /** + * 是否下钻:1 是;0否;eg:网格的下级分数 下钻到党员 + */ + private Integer goDown; + + /** + * 子节点 + */ + List children; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/form/IndexExplainFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/form/IndexExplainFormDTO.java new file mode 100644 index 0000000000..7d17b128d1 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/form/IndexExplainFormDTO.java @@ -0,0 +1,52 @@ +/** + * 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.evaluationindex.index.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 指标说明文案查询参数 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-12 + */ +@Data +public class IndexExplainFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + + /** + * 客户id + */ + private String customerId; + + /** + * 组织级别(网格级:grid;社区级:community;乡(镇、街道)级:street;区县级: district;市级: city;省级:province) + */ + private String orgLevel; + + /** + * 组织id + */ + private String orgId; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexExplainChildResult.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexExplainChildResult.java new file mode 100644 index 0000000000..261c8b775d --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexExplainChildResult.java @@ -0,0 +1,25 @@ +package com.epmet.evaluationindex.index.result; + +import com.epmet.evaluationindex.index.dto.IndexExplainDTO; +import lombok.Data; + +import java.util.List; + +/** + * desc:得分明细说明结果类 + * + * @author: LiuJanJun + * @date: 2021/5/12 4:19 下午 + * @version: 1.0 + */ +@Data +public class IndexExplainChildResult extends IndexExplainDTO { + + private static final long serialVersionUID = -3997821113617472317L; + + + + + + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexExplainResult.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexExplainResult.java new file mode 100644 index 0000000000..5e37adf827 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexExplainResult.java @@ -0,0 +1,48 @@ +package com.epmet.evaluationindex.index.result; + +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +/** + * desc:得分明细说明结果类 + * + * @author: LiuJanJun + * @date: 2021/5/12 4:19 下午 + * @version: 1.0 + */ +@Data +public class IndexExplainResult { + + /** + * 标题 + */ + private String title; + + /** + * 含义 + */ + private String meaning; + + /** + * 子节点 list + */ + private List children = new ArrayList<>(); + + /** + * 子节点data list + */ + private List tableDataList = new ArrayList<>(); + /** + * 子节点标题 list + */ + private List tableTileList = new ArrayList<>(); + + /** + * 阈值说明列表 + */ + private List thresholdList = new ArrayList<>(); + + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexGroupDetailResult.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexGroupDetailResult.java new file mode 100644 index 0000000000..170aed8ec9 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexGroupDetailResult.java @@ -0,0 +1,92 @@ +/** + * 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.evaluationindex.index.result; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 客户指标详情 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-12 + */ +@Data + +public class IndexGroupDetailResult implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * index_group.id + */ + private String indexGroupId; + + /** + * 指标id + */ + private String indexId; + + /** + * 指标code + */ + private String indexCode; + + /** + * 指标名称 + */ + private String indexName; + + /** + * 所有有权重的指标code拼接的字符串 冒号隔开 + */ + private String allParentIndexCode; + + /** + * 所有指标code拼接的字符串 冒号隔开 + */ + private String allIndexCodePath; + + /** + * 权重(同一组权重总和=1) + */ + private BigDecimal weight; + + /** + * 计算阈值,-1:没有阈值;如果是百分数则 为0.00几;如果为数据则直接填数值 + */ + private BigDecimal threshold; + + /** + * 是否启用:启用:enable 禁用:disabled + */ + private String status; + + /** + * 正相关:positive;负相关:negative + */ + private String correlation; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexScoreDetailResult.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexScoreDetailResult.java new file mode 100644 index 0000000000..8eb5fb8ecb --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexScoreDetailResult.java @@ -0,0 +1,44 @@ +package com.epmet.evaluationindex.index.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * desc:得分明细说明结果类 + * + * @author: LiuJanJun + * @date: 2021/5/12 4:19 下午 + * @version: 1.0 + */ +@Data +public class IndexScoreDetailResult implements Serializable { + + private static final long serialVersionUID = -3997821113617472317L; + /** + * 指标code + */ + private String indexCode; + /** + * 指标名称 + */ + private String indexName; + + /** + * 原始值(如果是平均分的话 则为 参与平均的个数) + */ + private String originValue; + + /** + * 分值 + */ + private String score; + + /** + * 分值 + */ + private String weight; + + + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/IndexConstant.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/IndexConstant.java new file mode 100644 index 0000000000..df3239962b --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/IndexConstant.java @@ -0,0 +1,74 @@ +package com.epmet.datareport.constant; + +import org.apache.commons.lang3.StringUtils; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * @author sun + * @dscription 数据 + */ +public class IndexConstant { + + /** + * 评价指标类型-百分比 + */ + public static final List ScoreLastHeader = Arrays.asList("指标值", "得分", "权重"); + public static final List QuantityLastHeader = Arrays.asList("数量", "平均值", "权重"); + + private static final String DJZS_CN = "党建指数"; + private static final String FWZS_CN = "服务指数"; + private static final String ZLZS_CN = "治理指数"; + private static final String ZB_CN = "指标"; + private static final String BEN_JI = "本级"; + private static final String XIA_JI = "下级"; + + + /** + * desc: 根据indexCode 获取表格表头 + * + * @param allIndexCode + * @return java.util.List + * @author LiuJanJun + * @date 2021/5/13 11:06 上午 + */ + public static List getStandardSelfHeaders(String allIndexCode) { + List result = new ArrayList<>(8); + if (StringUtils.isBlank(allIndexCode)) { + return null; + } + + if (allIndexCode.contains(FactConstant.DJNL)) { + result.add(BEN_JI + DJZS_CN + ZB_CN); + } else if (allIndexCode.contains(FactConstant.FWNL)) { + result.add(BEN_JI + FWZS_CN + ZB_CN); + } else if (allIndexCode.contains(FactConstant.ZLNL)) { + result.add(BEN_JI + ZLZS_CN + ZB_CN); + } + result.addAll(ScoreLastHeader); + return result; + } + + /** + * desc: 根据indexCode 获取表格表头 + * + * @param allIndexCode + * @return java.util.List + * @author LiuJanJun + * @date 2021/5/13 11:06 上午 + */ + public static List getStandardSubHeaders(String allIndexCode) { + List result = new ArrayList<>(8); + if (allIndexCode.contains(FactConstant.DJNL)) { + result.add(XIA_JI + DJZS_CN + ZB_CN); + } else if (allIndexCode.contains(FactConstant.FWNL)) { + result.add(XIA_JI + FWZS_CN + ZB_CN); + } else if (allIndexCode.contains(FactConstant.ZLNL)) { + result.add(XIA_JI + ZLZS_CN + ZB_CN); + } + result.addAll(QuantityLastHeader); + return result; + } +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/index/IndexExplainController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/index/IndexExplainController.java new file mode 100644 index 0000000000..14ab225481 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/index/IndexExplainController.java @@ -0,0 +1,62 @@ +/** + * 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.controller.index; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.datareport.service.evaluationindex.index.IndexExplainService; +import com.epmet.evaluationindex.index.form.IndexExplainFormDTO; +import com.epmet.evaluationindex.index.result.IndexExplainResult; +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; + + +/** + * 指标说明文案 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-12 + */ +@RestController +@RequestMapping("indexexplain") +public class IndexExplainController { + + @Autowired + private IndexExplainService indexExplainService; + + + /** + * desc: 获取得分说明明细 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author LiuJanJun + * @date 2021/5/12 4:12 下午 + */ + @PostMapping("detail") + public Result> getScoreDetail(@RequestBody IndexExplainFormDTO formDTO){ + Result> ok = new Result>().ok(indexExplainService.getScoreDetail(formDTO)); + return ok; + } + + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/.gitignore b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/index/IndexExplainDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/index/IndexExplainDao.java new file mode 100644 index 0000000000..64fc30bac1 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/index/IndexExplainDao.java @@ -0,0 +1,36 @@ +/** + * 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.evaluationindex.index; + +import com.epmet.evaluationindex.index.dto.IndexExplainTreeDTO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 指标说明文案 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-12 + */ +@Mapper +public interface IndexExplainDao { + + List getIndexExplainTreeByOrgType(@Param("orgLevel") String orgLevel); +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/index/IndexGroupDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/index/IndexGroupDao.java new file mode 100644 index 0000000000..31a4dd6030 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/index/IndexGroupDao.java @@ -0,0 +1,33 @@ +/** + * 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.evaluationindex.index; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.datareport.entity.evaluationindex.IndexGroupEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 客户指标分组 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-12 + */ +@Mapper +public interface IndexGroupDao extends BaseDao { + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/index/IndexGroupDetailDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/index/IndexGroupDetailDao.java new file mode 100644 index 0000000000..06cfac4493 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/index/IndexGroupDetailDao.java @@ -0,0 +1,45 @@ +/** + * 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.evaluationindex.index; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.datareport.entity.evaluationindex.IndexGroupDetailEntity; +import com.epmet.evaluationindex.index.result.IndexGroupDetailResult; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 客户指标详情 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-12 + */ +@Mapper +public interface IndexGroupDetailDao extends BaseDao { + + /** + * desc: 根据客户Id获取客户所有指标数据 + * + * @param customerId + * @return java.util.List + * @author LiuJanJun + * @date 2021/5/13 2:41 下午 + */ + List getAllIndexByCId(String customerId); +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/evaluationindex/IndexGroupDetailEntity.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/evaluationindex/IndexGroupDetailEntity.java new file mode 100644 index 0000000000..9e73f700a7 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/evaluationindex/IndexGroupDetailEntity.java @@ -0,0 +1,90 @@ +/** + * 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.entity.evaluationindex; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 客户指标详情 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-12 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("index_group_detail") +public class IndexGroupDetailEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * index_group.id + */ + private String indexGroupId; + + /** + * 指标id + */ + private String indexId; + + /** + * 指标code + */ + private String indexCode; + + /** + * 所有有权重的指标code拼接的字符串 冒号隔开 + */ + private String allParentIndexCode; + + /** + * 所有指标code拼接的字符串 冒号隔开 + */ + private String allIndexCodePath; + + /** + * 权重(同一组权重总和=1) + */ + private BigDecimal weight; + + /** + * 计算阈值,-1:没有阈值;如果是百分数则 为0.00几;如果为数据则直接填数值 + */ + private BigDecimal threshold; + + /** + * 是否启用:启用:enable 禁用:disabled + */ + private String status; + + /** + * 正相关:positive;负相关:negative + */ + private String correlation; + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/evaluationindex/IndexGroupEntity.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/evaluationindex/IndexGroupEntity.java new file mode 100644 index 0000000000..31716ee9ec --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/evaluationindex/IndexGroupEntity.java @@ -0,0 +1,68 @@ +/** + * 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.entity.evaluationindex; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 客户指标分组 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-12 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("index_group") +public class IndexGroupEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 指标id + */ + private String indexId; + + /** + * 指标code + */ + private String indexCode; + + /** + * 是否启用:启用:enable 禁用:disabled + */ + private String status; + + /** + * 当前指标关联的上一级指标分组,如果没有上一级,则为0 + */ + private String parentIndexGroupId; + + /** + * 所有指标code拼接的字符串 冒号隔开 + */ + private String allIndexCodePath; + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/IndexExplainService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/IndexExplainService.java new file mode 100644 index 0000000000..54c12aed09 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/IndexExplainService.java @@ -0,0 +1,42 @@ +/** + * 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.service.evaluationindex.index; + +import com.epmet.evaluationindex.index.form.IndexExplainFormDTO; +import com.epmet.evaluationindex.index.result.IndexExplainResult; + +import java.util.List; + +/** + * 指标说明文案 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-12 + */ +public interface IndexExplainService { + + /** + * desc: 获取指标得分说明 + * + * @param formDTO + * @return java.util.List + * @author LiuJanJun + * @date 2021/5/12 4:38 下午 + */ + List getScoreDetail(IndexExplainFormDTO formDTO); +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/impl/IndexExplainServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/impl/IndexExplainServiceImpl.java new file mode 100644 index 0000000000..b21d3f0ec4 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/impl/IndexExplainServiceImpl.java @@ -0,0 +1,181 @@ +/** + * 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.service.evaluationindex.index.impl; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.constant.DataSourceConstant; +import com.epmet.datareport.constant.IndexConstant; +import com.epmet.datareport.dao.evaluationindex.index.IndexExplainDao; +import com.epmet.datareport.dao.evaluationindex.index.IndexGroupDetailDao; +import com.epmet.datareport.dao.fact.FactIndexGridSubScoreDao; +import com.epmet.datareport.service.evaluationindex.index.IndexExplainService; +import com.epmet.evaluationindex.index.dto.IndexExplainTreeDTO; +import com.epmet.evaluationindex.index.form.IndexExplainFormDTO; +import com.epmet.evaluationindex.index.result.IndexExplainResult; +import com.epmet.evaluationindex.index.result.IndexGroupDetailResult; +import com.epmet.evaluationindex.index.result.IndexScoreDetailResult; +import com.epmet.evaluationindex.screen.dto.form.AblityListFormDTO; +import com.epmet.evaluationindex.screen.dto.result.AblityListResultDTO; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 指标说明文案 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-12 + */ +@Service +@DataSource(DataSourceConstant.EVALUATION_INDEX) +public class IndexExplainServiceImpl implements IndexExplainService { + + @Autowired + private IndexExplainDao indexExplainDao; + @Autowired + private IndexGroupDetailDao indexGroupDetailDao; + @Autowired + private FactIndexGridSubScoreDao gridSubScoreDao; + + + @Override + public List getScoreDetail(IndexExplainFormDTO formDTO) { + List results = new ArrayList<>(); + List explainDTOList = indexExplainDao.getIndexExplainTreeByOrgType(formDTO.getOrgLevel()); + if (CollectionUtils.isEmpty(explainDTOList)) { + return null; + } + List groupDetailEntities = indexGroupDetailDao.getAllIndexByCId(formDTO.getCustomerId()); + if (CollectionUtils.isEmpty(groupDetailEntities)) { + return null; + } + Map> detailEntityMap = groupDetailEntities.stream().collect(Collectors.groupingBy(IndexGroupDetailResult::getAllParentIndexCode)); + + + for (IndexExplainTreeDTO explainDTO : explainDTOList) { + //根节点 + IndexExplainResult result = new IndexExplainResult(); + results.add(result); + result.setTitle(explainDTO.getTitle()); + result.setMeaning(explainDTO.getMeaning()); + + setTableData(formDTO, detailEntityMap, explainDTO, result); + + + setChildren(formDTO, detailEntityMap, result, explainDTO, explainDTO.getChildren()); + System.out.println(JSON.toJSONString(result)); + } + + + return results; + } + + private void setTableData(IndexExplainFormDTO formDTO, Map> detailEntityMap, IndexExplainTreeDTO explainDTO, IndexExplainResult result) { + Integer goDown = explainDTO.getGoDown(); + if (NumConstant.ONE == explainDTO.getIsSearch()) { + List tableHeaders = getTableHeaders(explainDTO); + result.setTableTileList(tableHeaders); + switch (explainDTO.getOrgLevel()) { + case "grid": + String type = explainDTO.getType(); + String allIndexCodePath = explainDTO.getIndexCode(); + List indexGroupDetailEntities = detailEntityMap.get(allIndexCodePath); + List tableList = new ArrayList<>(); + indexGroupDetailEntities.forEach(index -> { + //设置默认值 + if (!index.getAllIndexCodePath().contains(type)) { + return; + } + IndexScoreDetailResult table = new IndexScoreDetailResult(); + table.setIndexCode(index.getIndexCode()); + table.setIndexName(index.getIndexName()); + table.setOriginValue(NumConstant.ZERO_STR); + table.setScore(NumConstant.ZERO_STR); + table.setWeight(index.getWeight().multiply(new BigDecimal(100)).setScale(NumConstant.TWO, BigDecimal.ROUND_HALF_UP) + "%"); + tableList.add(table); + + + }); + result.setTableDataList(tableList); + //set Target value + if (goDown == 1) { + AblityListFormDTO ablityListFormDTO = new AblityListFormDTO(); + ablityListFormDTO.setCustomerId(formDTO.getCustomerId()); + ablityListFormDTO.setOrgId(formDTO.getOrgId()); + ablityListFormDTO.setOrgType(formDTO.getOrgLevel()); + ablityListFormDTO.setMonthId(DateUtils.getCurrentTimeBeforeMonthId()); + ablityListFormDTO.setAllParentIndexCode(allIndexCodePath); + + List scoreList = gridSubScoreDao.selectGridAblityList(ablityListFormDTO); + scoreList.forEach(score -> { + for (IndexScoreDetailResult tb : tableList) { + if (tb.getIndexCode().equals(score.getKey())) { + tb.setOriginValue(score.getValue()); + tb.setScore(String.valueOf(score.getScore())); + tb.setWeight(score.getWeight().multiply(new BigDecimal(100)).setScale(NumConstant.TWO, BigDecimal.ROUND_HALF_UP) + "%"); + } + } + }); + } + break; + default: + + } + } + } + + private void setChildren(IndexExplainFormDTO formDTO, Map> detailEntityMap, IndexExplainResult result, IndexExplainTreeDTO parentNode, List children) { + List childrenList = new ArrayList<>(); + children.forEach(child -> { + IndexExplainResult ch = new IndexExplainResult(); + ch.setTitle(child.getTitle()); + ch.setMeaning(child.getMeaning()); + if (CollectionUtils.isNotEmpty(child.getChildren())) { + setChildren(formDTO, detailEntityMap, ch, child, child.getChildren()); + } + setTableData(formDTO, detailEntityMap, child, ch); + childrenList.add(ch); + }); + result.setChildren(childrenList); + } + + public static void main(String[] args) { + + } + + private List getTableHeaders(IndexExplainTreeDTO explain) { + String type = explain.getType(); + List headers = new ArrayList<>(); + if ("zishen".equals(type)) { + headers = IndexConstant.getStandardSelfHeaders(explain.getIndexCode()); + + } else if ("xiaji".equals(type)) { + headers = IndexConstant.getStandardSubHeaders(explain.getIndexCode()); + } + return headers; + } +} diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/IndexDictDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexDictDao.xml similarity index 100% rename from epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/IndexDictDao.xml rename to epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexDictDao.xml diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexExplainDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexExplainDao.xml new file mode 100644 index 0000000000..392ba21ddd --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexExplainDao.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexGroupDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexGroupDao.xml new file mode 100644 index 0000000000..e91cf12796 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexGroupDao.xml @@ -0,0 +1,23 @@ + + + + + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexGroupDetailDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexGroupDetailDao.xml new file mode 100644 index 0000000000..741df34cfb --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexGroupDetailDao.xml @@ -0,0 +1,36 @@ + + + + + + + + + +