diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/CalculateCommonFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/CalculateCommonFormDTO.java index 03c5ae0ddb..9e019b6d24 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/CalculateCommonFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/CalculateCommonFormDTO.java @@ -23,6 +23,7 @@ public class CalculateCommonFormDTO implements Serializable { /** * 月份id: yyyyMM */ + @NotBlank(message = "monthId不能为空", groups = { CancelCalculateGroup.class }) private String monthId; /** diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java index 58bd3ab491..30922b4d6c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java @@ -17,15 +17,13 @@ import com.epmet.service.evaluationindex.indexcal.IndexCalculateService; import com.epmet.util.DimIdGenerator; import com.google.common.util.concurrent.ThreadFactoryBuilder; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.annotation.PreDestroy; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.concurrent.*; /** @@ -106,6 +104,7 @@ public class IndexCalculateController { @PostMapping("all") public Result indexCalculate(@RequestHeader("CustomerId") String customerId, @RequestBody CalculateCommonFormDTO formDTO) { formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO); indexCalculate(formDTO); return new Result().ok(true); } @@ -342,4 +341,26 @@ public class IndexCalculateController { indexCalculateService.indexStatistics(formDTO); return new Result(); } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description + * @Date 2021/3/4 18:52 + **/ + @PostMapping("toscreenindexdata") + public Result toScreenIndexData(CalculateCommonFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO); + indexCalculateService.toScreenIndexData(formDTO); + return new Result(); + } + + @PostMapping("getCustomerInfoMap") + public Result getCustomerInfoMap(List customerIds) { + if(CollectionUtils.isNotEmpty(customerIds)){ + return new Result().ok(indexCalculateService.getCustomerInfoMap(customerIds)); + } + return new Result().error("customerIds不能为空"); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/IndexCalculateService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/IndexCalculateService.java index 4e7c074a57..137a2624b1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/IndexCalculateService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/IndexCalculateService.java @@ -1,8 +1,12 @@ package com.epmet.service.evaluationindex.indexcal; import com.epmet.dto.indexcal.CalculateCommonFormDTO; +import com.epmet.dto.indexcal.CustomerSubInfoDTO; import com.epmet.dto.indexcal.IndexStatisticsFormDTO; +import java.util.List; +import java.util.Map; + /** * 指标计算service * @@ -19,4 +23,14 @@ public interface IndexCalculateService { Boolean indexCalculate(CalculateCommonFormDTO formDTO); Boolean indexStatistics(IndexStatisticsFormDTO formDTO); + + /** + * @return void + * @param formDTO + * @description 单独将分数插入screen_index_data_monthly,screen_index_data_yearly + * @Date 2021/3/4 18:54 + **/ + void toScreenIndexData(CalculateCommonFormDTO formDTO); + + Map getCustomerInfoMap(List customerIds); } 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 d517fd70ec..abdfa9a343 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 @@ -207,7 +207,8 @@ public class IndexCalculateServiceImpl implements IndexCalculateService { * @description 查询当前客户的area_code信息、以及下一级客户列表 * @Date 2021/1/21 11:28 **/ - private Map getCustomerInfoMap(List customerIds) { + @Override + public Map getCustomerInfoMap(List customerIds) { return customerRelationService.getCustomerInfoMap(customerIds); } @@ -246,4 +247,26 @@ public class IndexCalculateServiceImpl implements IndexCalculateService { }); return true; } + + /** + * @param formDTO + * @return void + * @description 单独将分数插入screen_index_data_monthly, screen_index_data_yearly + * @Date 2021/3/4 18:54 + **/ + @Override + public void toScreenIndexData(CalculateCommonFormDTO formDTO) { + List customerIds=new ArrayList<>(); + customerIds.add(formDTO.getCustomerId()); + //查询客户编码、以及下一级客户列表 add01.14 + Map customerInfoMap=this.getCustomerInfoMap(customerIds); + log.info("customerInfoMap: "+JSON.toJSONString(customerInfoMap,true)); + //01.14 add + if (!customerInfoMap.isEmpty() && null != customerInfoMap.get(formDTO.getCustomerId())) { + formDTO.setCustomerAreaCode(customerInfoMap.get(formDTO.getCustomerId()).getCustomerAreaCode()); + formDTO.setSubCustomerIds(customerInfoMap.get(formDTO.getCustomerId()).getSubCustomerIds()); + } + log.info("入参: "+JSON.toJSONString(formDTO,true)); + factIndexCollectService.insertScreenIndexDataMonthlyAndYearly(formDTO); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java index a117021b91..7df7c2920d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java @@ -518,7 +518,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { } } if ("".equals(agencyName)) { - log.error("在screen_customer_agency表中未查询到该客户下的组织名称:customerId =" + customerId + ", agencyId = " + communityScore.getKey()); + log.error("1)在screen_customer_agency表中未查询到该客户下的组织名称:当前计算的customerId =" + customerId + ", agencyId = " + communityScore.getKey()); continue; } // 补充表中其他字段 @@ -753,7 +753,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { } } if ("".equals(agencyName)) { - log.error("在screen_customer_agency表中未查询到该客户下的组织名称:customerId =" + customerId + ", agencyId = " + agencyScore.getKey()); + log.error("2)在screen_customer_agency表中未查询到该客户下的组织名称:当前计算的customerId =" + customerId + ", agencyId = " + agencyScore.getKey()); continue; } // 补充表中其他字段