Browse Source

Merge remote-tracking branch 'remotes/origin/dev'

dev_shibei_match
jianjun 5 years ago
parent
commit
66e1267eda
  1. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/distributedlock/DistributedLock.java
  2. 4
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java
  3. 8
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScoreListResultDTO.java
  4. 6
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml
  5. 1
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml
  6. 6
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunityScoreDao.xml
  7. 6
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridScoreDao.xml
  8. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java

3
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/distributedlock/DistributedLock.java

@ -1,7 +1,6 @@
package com.epmet.commons.tools.distributedlock;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.RedisKeys;
import org.apache.commons.lang3.StringUtils;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
@ -9,7 +8,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
/**
* @Author zxc
@ -23,6 +21,7 @@ public class DistributedLock {
/**
* @Description 抢锁🔒 每个锁持有十分钟
* watchDog模式每隔10s自动更改持锁时间,假设宕机持锁时间达到时会自动释放锁
* @Param name
* @author zxc
* @date 2020/10/28 2:52 下午

4
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java

@ -19,7 +19,7 @@ public class AblityListResultDTO implements Serializable {
*/
private String name;
/**
* 指标对应值数值或百分比
* 指标对应值数值或百分比原始值
*/
private String value = "0";
/**
@ -36,4 +36,6 @@ public class AblityListResultDTO implements Serializable {
*/
private BigDecimal weight;
private Double score;
}

8
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScoreListResultDTO.java

@ -25,9 +25,17 @@ public class ScoreListResultDTO implements Serializable {
* 本级分数(保留一位小数)
*/
private Double agencyScore;
private Double selfOriginScore;
private Double agencyWeight;
/**
* 下级分数(保留一位小数)
*/
private Double subAgencyScore;
private Double subAgencyWeight;
private Double subOriginScore;
}

6
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml

@ -26,7 +26,11 @@
fact.index_code AS "indexCode",
ROUND(fact.score*fact.WEIGHT, 1) AS "indexTotal",
ROUND(self.self_score*fact.WEIGHT, 1) AS "agencyScore",
ROUND(self.sub_score*fact.WEIGHT, 1) AS "subAgencyScore"
self.self_score AS selfOriginScore,
self.SELF_WEIGHT AS agencyWeight,
ROUND(self.sub_score*fact.WEIGHT, 1) AS "subAgencyScore",
self.sub_score AS subOriginScore,
self.SUB_WEIGHT AS subAgencyWeight
FROM
fact_index_agency_score fact
INNER JOIN fact_index_agency_self_sub_score self ON fact.agency_id = self.agency_id

1
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml

@ -7,6 +7,7 @@
SELECT
fact.index_code AS "key",
IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "value",
fact.score,
dict.index_name AS "name",
round(fact.WEIGHT,2) AS weight
FROM

6
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunityScoreDao.xml

@ -26,7 +26,11 @@
fact.index_code AS "indexCode",
ROUND(fact.score*fact.WEIGHT, 1) AS "indexTotal",
ROUND(self.self_score*fact.WEIGHT, 1) AS "agencyScore",
ROUND(self.sub_score*fact.WEIGHT, 1) AS "subAgencyScore"
self.self_score AS selfOriginScore,
self.SELF_WEIGHT AS agencyWeight,
ROUND(self.sub_score*fact.WEIGHT, 1) AS "subAgencyScore",
self.sub_score AS subOriginScore,
self.SUB_WEIGHT AS subAgencyWeight
FROM
fact_index_community_score fact
INNER JOIN fact_index_community_self_sub_score self ON fact.agency_id = self.agency_id

6
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridScoreDao.xml

@ -26,7 +26,11 @@
fact.index_code AS "indexCode",
ROUND(fact.score*fact.WEIGHT, 1) AS "indexTotal",
ROUND(self.self_score*fact.WEIGHT, 1) AS "agencyScore",
ROUND(self.sub_score*fact.WEIGHT, 1) AS "subAgencyScore"
self.self_score AS selfOriginScore,
self.SELF_WEIGHT AS agencyWeight,
ROUND(self.sub_score*fact.WEIGHT, 1) AS "subAgencyScore",
self.sub_score AS subOriginScore,
self.SUB_WEIGHT AS subAgencyWeight
FROM
fact_index_grid_score fact
INNER JOIN fact_index_grid_self_sub_score self ON fact.grid_id = self.grid_id

15
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java

@ -1,10 +1,12 @@
package com.epmet.service.evaluationindex.indexcoll.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.constant.StrConstant;
import com.epmet.commons.tools.distributedlock.DistributedLock;
import com.epmet.commons.tools.distributedlock.LockConstants;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.constant.OrgTypeConstant;
@ -29,6 +31,7 @@ import com.epmet.service.evaluationindex.indexcoll.FactIndexCollectService;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.ListUtils;
import org.redisson.api.RLock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -200,7 +203,17 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
} while (deleteNum > NumConstant.ZERO);
}
if (!CollectionUtils.isEmpty(formDTO.getDataList())) {
factIndexGovrnAblityDeptMonthlyDao.batchInsertFactIndexGovrnAblityDeptMonthly(formDTO.getDataList(), customerId);
List<DeptGovrnAbilityFormDTO> dataList = formDTO.getDataList();
// 有 deptId字段为空时,报错提示
List<DeptGovrnAbilityFormDTO> deptIsNull = dataList.stream().filter(d -> null == d.getDeptId() || d.getDeptId().equals("")).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(deptIsNull)){
throw new RenException("治理能力-部门相关指标计算【deptId为空】的客户ID为:"+customerId+",具体信息信息为:"+ JSON.toJSONString(deptIsNull));
}
// 改成分批插入
List<List<DeptGovrnAbilityFormDTO>> partition = ListUtils.partition(dataList, NumConstant.ONE_HUNDRED);
partition.forEach(p -> {
factIndexGovrnAblityDeptMonthlyDao.batchInsertFactIndexGovrnAblityDeptMonthly(p, customerId);
});
}
}

Loading…
Cancel
Save