diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java index 3b2baa00dd..a6a916602d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java @@ -200,6 +200,10 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { String agencyId = issue.getAgencyId(); agencyIdSet.add(agencyId); ScreenUserJoinEntity entity = insertMap.get(agencyId); + //todo 这里为什么会没有 + if (entity == null){ + return; + } entity.setJoinTotal(issue.getIssueIncr()); GridUserCountResultDTO user = userCountMap.get(agencyId); //百人人均议题:统计周期内总的议题数/(注册用户数/100) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java index dd4219e170..c121361eea 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java @@ -116,7 +116,6 @@ public class DeptScoreServiceImpl extends BaseServiceImpl indexList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.QU_ZHI_BU_MEN.getCode()); if (CollectionUtils.isEmpty(indexList)) { @@ -143,7 +142,7 @@ public class DeptScoreServiceImpl extends BaseServiceImpl weightMap = new HashMap<>(); selfSubIndexList.forEach(o -> { //找出自身 和下级的指标 - if (o.getAllIndexCodePath().indexOf(ProjectConstant.XIA_JI) > -1) { + if (o.getAllIndexCodePath().contains(ProjectConstant.XIA_JI)) { selfSubParentMap.get(ProjectConstant.XIA_JI).add(o.getIndexCode()); weightMap.put(ProjectConstant.XIA_JI, weightMap.getOrDefault(ProjectConstant.XIA_JI, new BigDecimal(0)).add(o.getWeight())); } else { @@ -153,7 +152,7 @@ public class DeptScoreServiceImpl extends BaseServiceImpl insertMap = new HashMap<>(); subScore.forEach(score -> { - String key = score.getAgencyId().concat(index.getIndexCode()); + String key = score.getDeptId().concat(index.getIndexCode()); DeptSelfSubScoreEntity scoreEntity = insertMap.get(key); if (scoreEntity == null) { scoreEntity = ConvertUtils.sourceToTarget(score, DeptSelfSubScoreEntity.class); @@ -182,7 +181,7 @@ public class DeptScoreServiceImpl extends BaseServiceImpl insertMap) { int effectRow = 0; do { - deptSelfSubScoreDao.deleteByMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), indexCode); + effectRow = deptSelfSubScoreDao.deleteByMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), indexCode); } while (effectRow > 0); deptSelfSubScoreDao.insertBatch(new ArrayList<>(insertMap.values())); @@ -465,4 +464,4 @@ public class DeptScoreServiceImpl extends BaseServiceImpl weightMap = new HashMap<>(); selfSubIndexList.forEach(o -> { //找出自身 和下级的指标 - if (o.getAllIndexCodePath().indexOf(ProjectConstant.XIA_JI) > -1) { + if (o.getAllIndexCodePath().contains(ProjectConstant.XIA_JI)) { selfSubParentMap.get(ProjectConstant.XIA_JI).add(o.getIndexCode()); weightMap.put(ProjectConstant.XIA_JI, weightMap.getOrDefault(ProjectConstant.XIA_JI, new BigDecimal(0)).add(o.getWeight())); } else { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java index 65e7bfb3fc..f664f09c59 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java @@ -165,7 +165,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni Map weightMap = new HashMap<>(); selfSubIndexList.forEach(o -> { //找出自身 和下级的指标 - if (o.getAllIndexCodePath().indexOf(ProjectConstant.XIA_JI) > -1) { + if (o.getAllIndexCodePath().contains(ProjectConstant.XIA_JI)) { selfSubParentMap.get(ProjectConstant.XIA_JI).add(o.getIndexCode()); weightMap.put(ProjectConstant.XIA_JI, weightMap.getOrDefault(ProjectConstant.XIA_JI, new BigDecimal(0)).add(o.getWeight())); } else { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java index 035c7418d0..15e5d04b2e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java @@ -160,7 +160,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict Map weightMap = new HashMap<>(); selfSubIndexList.forEach(o -> { //找出自身 和下级的指标 - if (o.getAllIndexCodePath().indexOf(ProjectConstant.XIA_JI) > -1) { + if (o.getAllIndexCodePath().contains(ProjectConstant.XIA_JI)) { selfSubParentMap.get(ProjectConstant.XIA_JI).add(o.getIndexCode()); weightMap.put(ProjectConstant.XIA_JI, weightMap.getOrDefault(ProjectConstant.XIA_JI, new BigDecimal(0)).add(o.getWeight())); } else { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java index 01d7f5d581..5694fbaef0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java @@ -135,7 +135,7 @@ public class IndexCalculateServiceImpl implements IndexCalculateService { start = System.currentTimeMillis(); try { flag = gridCorreLationService.calculateGridCorreLation(formDTO); - log.info("客户Id:{}【网格相关】计算完毕,总耗时:{}秒,result:{},result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag); + log.info("客户Id:{}【网格相关】计算完毕,总耗时:{}秒,result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag); } catch (Exception e) { log.error("indexCalculate calculateGridCorreLation exception", e); } @@ -143,7 +143,7 @@ public class IndexCalculateServiceImpl implements IndexCalculateService { start = System.currentTimeMillis(); try { flag = indexCalculateCommunityService.calCommunityAll(formDTO); - log.info("客户Id:{}【社区相关】计算完毕,总耗时:{}秒,result:{},result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag); + log.info("客户Id:{}【社区相关】计算完毕,总耗时:{}秒,result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag); } catch (Exception e) { log.error("indexCalculate calCommunityAll exception", e); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java index 16e90a57a0..4c40fd2861 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java @@ -168,7 +168,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ Map weightMap = new HashMap<>(); selfSubIndexList.forEach(o -> { //找出自身 和下级的指标 - if (o.getAllIndexCodePath().indexOf(ProjectConstant.XIA_JI) > -1) { + if (o.getAllIndexCodePath().contains(ProjectConstant.XIA_JI)) { selfSubParentMap.get(ProjectConstant.XIA_JI).add(o.getIndexCode()); weightMap.put(ProjectConstant.XIA_JI, weightMap.getOrDefault(ProjectConstant.XIA_JI, new BigDecimal(0)).add(o.getWeight())); } else { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java index 47be178b7a..754e2cf7bc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java @@ -80,13 +80,19 @@ public class BatchScoreCalculator { .multiply( (maxScoreValue.subtract(minScoreValue).divide(new BigDecimal(Math.PI / 2), 10, RoundingMode.HALF_UP))) .add(minScoreValue).setScale(6, RoundingMode.HALF_UP); - // - if (scoreCalculator.getCorrelation().getCode().equals(Correlation.NEGATIVE)) { - normalizeValue = maxScoreValue.subtract(normalizeValue); - } + + } else { normalizeValue = scoreCalculator.normalize(getFinalSampleValue(vo.getSampleValue(), threshold)); } + //如果是负相关 则用100-归一后的值为最大值减 + if (Correlation.NEGATIVE.getCode().equals(scoreCalculator.getCorrelation().getCode())) { + normalizeValue = maxScoreValue.subtract(normalizeValue); + } + } + //如果归一后的值小于0 则置为0 + if (normalizeValue.compareTo(NumConstant.ZERO_DECIMAL)<=-1){ + normalizeValue = NumConstant.ZERO_DECIMAL; } BigDecimal score = normalizeValue.multiply(weight).setScale(6, RoundingMode.HALF_UP); CalculateResult result = scoreCountOfSamples.get(sampleId); diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/MathUtilTest.java b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/MathUtilTest.java index 408f837691..9d0178385a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/MathUtilTest.java +++ b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/MathUtilTest.java @@ -5,7 +5,7 @@ import java.math.RoundingMode; public class MathUtilTest { public static void main(String[] args) { - //值 域:(-π/2,π/2) ->(60,100) + //值 域:[-π/2,π/2] ->[60,100] double tan = Math.atan(4); double tan2 = Math.atan(1); double tan3 = Math.atan(8); diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml index 15c14dbd93..2036e76fa6 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml @@ -338,7 +338,7 @@ LEFT JOIN customer_agency ca ON ca.id = cg.pid WHERE cg.id = #{gridId} - AND cg.del_flag = 0 +