Browse Source

代码暂存 怕丢

feature/evaluate
jianjun 4 years ago
parent
commit
183977481f
  1. 1
      epmet-cloud-generator/src/main/java/io/renren/GeneratorApplication.java
  2. 122
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/dto/IndexExplainDTO.java
  3. 97
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/dto/IndexExplainTreeDTO.java
  4. 52
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/form/IndexExplainFormDTO.java
  5. 25
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexExplainChildResult.java
  6. 48
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexExplainResult.java
  7. 92
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexGroupDetailResult.java
  8. 44
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexScoreDetailResult.java
  9. 74
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/IndexConstant.java
  10. 62
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/index/IndexExplainController.java
  11. 0
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/.gitignore
  12. 36
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/index/IndexExplainDao.java
  13. 33
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/index/IndexGroupDao.java
  14. 45
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/index/IndexGroupDetailDao.java
  15. 90
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/evaluationindex/IndexGroupDetailEntity.java
  16. 68
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/evaluationindex/IndexGroupEntity.java
  17. 42
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/IndexExplainService.java
  18. 181
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/impl/IndexExplainServiceImpl.java
  19. 0
      epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexDictDao.xml
  20. 41
      epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexExplainDao.xml
  21. 23
      epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexGroupDao.xml
  22. 36
      epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexGroupDetailDao.xml

1
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");
}
}

122
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

97
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<IndexExplainTreeDTO> children;
}

52
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

25
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;
}

48
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<IndexExplainResult> children = new ArrayList<>();
/**
* 子节点data list
*/
private List<IndexScoreDetailResult> tableDataList = new ArrayList<>();
/**
* 子节点标题 list
*/
private List<String> tableTileList = new ArrayList<>();
/**
* 阈值说明列表
*/
private List<String> thresholdList = new ArrayList<>();
}

92
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

44
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;
}

74
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<String> ScoreLastHeader = Arrays.asList("指标值", "得分", "权重");
public static final List<String> 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<java.lang.String>
* @author LiuJanJun
* @date 2021/5/13 11:06 上午
*/
public static List<String> getStandardSelfHeaders(String allIndexCode) {
List<String> 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<java.lang.String>
* @author LiuJanJun
* @date 2021/5/13 11:06 上午
*/
public static List<String> getStandardSubHeaders(String allIndexCode) {
List<String> 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;
}
}

62
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<com.epmet.group.dto.result.GroupSummaryInfoResultDTO>
* @author LiuJanJun
* @date 2021/5/12 4:12 下午
*/
@PostMapping("detail")
public Result<List<IndexExplainResult>> getScoreDetail(@RequestBody IndexExplainFormDTO formDTO){
Result<List<IndexExplainResult>> ok = new Result<List<IndexExplainResult>>().ok(indexExplainService.getScoreDetail(formDTO));
return ok;
}
}

0
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/.gitignore

36
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<IndexExplainTreeDTO> getIndexExplainTreeByOrgType(@Param("orgLevel") String orgLevel);
}

33
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<IndexGroupEntity> {
}

45
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<IndexGroupDetailEntity> {
/**
* desc: 根据客户Id获取客户所有指标数据
*
* @param customerId
* @return java.util.List<com.epmet.evaluationindex.index.result.IndexGroupDetailResult>
* @author LiuJanJun
* @date 2021/5/13 2:41 下午
*/
List<IndexGroupDetailResult> getAllIndexByCId(String customerId);
}

90
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

68
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

42
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<com.epmet.evaluationindex.index.result.IndexExplainResult>
* @author LiuJanJun
* @date 2021/5/12 4:38 下午
*/
List<IndexExplainResult> getScoreDetail(IndexExplainFormDTO formDTO);
}

181
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<IndexExplainResult> getScoreDetail(IndexExplainFormDTO formDTO) {
List<IndexExplainResult> results = new ArrayList<>();
List<IndexExplainTreeDTO> explainDTOList = indexExplainDao.getIndexExplainTreeByOrgType(formDTO.getOrgLevel());
if (CollectionUtils.isEmpty(explainDTOList)) {
return null;
}
List<IndexGroupDetailResult> groupDetailEntities = indexGroupDetailDao.getAllIndexByCId(formDTO.getCustomerId());
if (CollectionUtils.isEmpty(groupDetailEntities)) {
return null;
}
Map<String, List<IndexGroupDetailResult>> 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<String, List<IndexGroupDetailResult>> detailEntityMap, IndexExplainTreeDTO explainDTO, IndexExplainResult result) {
Integer goDown = explainDTO.getGoDown();
if (NumConstant.ONE == explainDTO.getIsSearch()) {
List<String> tableHeaders = getTableHeaders(explainDTO);
result.setTableTileList(tableHeaders);
switch (explainDTO.getOrgLevel()) {
case "grid":
String type = explainDTO.getType();
String allIndexCodePath = explainDTO.getIndexCode();
List<IndexGroupDetailResult> indexGroupDetailEntities = detailEntityMap.get(allIndexCodePath);
List<IndexScoreDetailResult> 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<AblityListResultDTO> 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<String, List<IndexGroupDetailResult>> detailEntityMap, IndexExplainResult result, IndexExplainTreeDTO parentNode, List<IndexExplainTreeDTO> children) {
List<IndexExplainResult> 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<String> getTableHeaders(IndexExplainTreeDTO explain) {
String type = explain.getType();
List<String> headers = new ArrayList<>();
if ("zishen".equals(type)) {
headers = IndexConstant.getStandardSelfHeaders(explain.getIndexCode());
} else if ("xiaji".equals(type)) {
headers = IndexConstant.getStandardSubHeaders(explain.getIndexCode());
}
return headers;
}
}

0
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/IndexDictDao.xml → epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexDictDao.xml

41
epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexExplainDao.xml

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.datareport.dao.evaluationindex.index.IndexExplainDao">
<resultMap id="explainTreeResultMap" type="com.epmet.evaluationindex.index.dto.IndexExplainTreeDTO">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="title" column="TITLE"/>
<result property="meaning" column="MEANING"/>
<result property="indexCode" column="INDEX_CODE"/>
<result property="orgLevel" column="ORG_LEVEL"/>
<result property="pid" column="PID"/>
<result property="sort" column="SORT"/>
<result property="isSearch" column="IS_SEARCH"/>
<result property="type" column="TYPE"/>
<result property="goDown" column="GO_DOWN"/>
<collection property="children" ofType="com.epmet.evaluationindex.index.dto.IndexExplainTreeDTO" column="ID" select="getIndexExplainTreeByPid">
</collection>
</resultMap>
<select id="getIndexExplainTreeByOrgType" resultMap="explainTreeResultMap">
SELECT
ID, CUSTOMER_ID, TITLE, MEANING, INDEX_CODE, ORG_LEVEL, PID, SORT, IS_SEARCH, TYPE, GO_DOWN
FROM index_explain
WHERE
ORG_LEVEL = #{orgLevel}
and DEL_FLAG = '0'
AND PID = '0'
ORDER BY SORT
</select>
<select id="getIndexExplainTreeByPid" resultMap="explainTreeResultMap">
SELECT
ID, CUSTOMER_ID, TITLE, MEANING, INDEX_CODE, ORG_LEVEL, PID, SORT, IS_SEARCH, TYPE, GO_DOWN
FROM index_explain
WHERE
DEL_FLAG = '0'
AND PID = #{pid}
ORDER BY SORT
</select>
</mapper>

23
epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexGroupDao.xml

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.datareport.dao.evaluationindex.index.IndexGroupDao">
<!--<resultMap type="com.epmet.entity.IndexGroupEntity" id="indexGroupMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="indexId" column="INDEX_ID"/>
<result property="indexCode" column="INDEX_CODE"/>
<result property="status" column="STATUS"/>
<result property="parentIndexGroupId" column="PARENT_INDEX_GROUP_ID"/>
<result property="allIndexCodePath" column="ALL_INDEX_CODE_PATH"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>-->
</mapper>

36
epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexGroupDetailDao.xml

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.datareport.dao.evaluationindex.index.IndexGroupDetailDao">
<!--<resultMap type="com.epmet.entity.IndexGroupDetailEntity" id="indexGroupDetailMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="indexGroupId" column="INDEX_GROUP_ID"/>
<result property="indexId" column="INDEX_ID"/>
<result property="indexCode" column="INDEX_CODE"/>
<result property="allParentIndexCode" column="ALL_PARENT_INDEX_CODE"/>
<result property="allIndexCodePath" column="ALL_INDEX_CODE_PATH"/>
<result property="weight" column="WEIGHT"/>
<result property="threshold" column="THRESHOLD"/>
<result property="status" column="STATUS"/>
<result property="correlation" column="CORRELATION"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>-->
<select id="getAllIndexByCId" resultType="com.epmet.evaluationindex.index.result.IndexGroupDetailResult">
SELECT
d.ID, d.CUSTOMER_ID, d.INDEX_GROUP_ID, d.INDEX_ID, d.INDEX_CODE, d.ALL_PARENT_INDEX_CODE,
d.ALL_INDEX_CODE_PATH, d.WEIGHT, d.THRESHOLD, d.STATUS, d.CORRELATION,
id.INDEX_NAME
FROM index_group_detail d LEFT JOIN index_dict id ON d.index_code = id.index_code
WHERE
d.DEL_FLAG = 0 AND id.DEL_FLAG = 0 AND d.CUSTOMER_ID = #{customerId}
</select>
</mapper>
Loading…
Cancel
Save