Browse Source

Merge remote-tracking branch 'origin/dev_pyscreen' into dev

dev_shibei_match
yinzuomei 5 years ago
parent
commit
7052b3a901
  1. 1
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/CalculateCommonFormDTO.java
  2. 29
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java
  3. 14
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerRelationServiceImpl.java
  4. 14
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/IndexCalculateService.java
  5. 25
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java
  6. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java

1
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 * 月份id: yyyyMM
*/ */
@NotBlank(message = "monthId不能为空", groups = { CancelCalculateGroup.class })
private String monthId; private String monthId;
/** /**

29
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.epmet.util.DimIdGenerator;
import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.common.util.concurrent.ThreadFactoryBuilder;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.PreDestroy; import javax.annotation.PreDestroy;
import java.util.Date; import java.util.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.*; import java.util.concurrent.*;
/** /**
@ -106,6 +104,7 @@ public class IndexCalculateController {
@PostMapping("all") @PostMapping("all")
public Result<Boolean> indexCalculate(@RequestHeader("CustomerId") String customerId, @RequestBody CalculateCommonFormDTO formDTO) { public Result<Boolean> indexCalculate(@RequestHeader("CustomerId") String customerId, @RequestBody CalculateCommonFormDTO formDTO) {
formDTO.setCustomerId(customerId); formDTO.setCustomerId(customerId);
ValidatorUtils.validateEntity(formDTO);
indexCalculate(formDTO); indexCalculate(formDTO);
return new Result<Boolean>().ok(true); return new Result<Boolean>().ok(true);
} }
@ -342,4 +341,26 @@ public class IndexCalculateController {
indexCalculateService.indexStatistics(formDTO); indexCalculateService.indexStatistics(formDTO);
return new Result(); 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(@RequestBody List<String> customerIds) {
if(CollectionUtils.isNotEmpty(customerIds)){
return new Result().ok(indexCalculateService.getCustomerInfoMap(customerIds));
}
return new Result().error("customerIds不能为空");
}
} }

14
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerRelationServiceImpl.java

@ -26,6 +26,7 @@ import com.epmet.dto.stats.DimCustomerDTO;
import com.epmet.entity.crm.CustomerRelationEntity; import com.epmet.entity.crm.CustomerRelationEntity;
import com.epmet.service.crm.CustomerRelationService; import com.epmet.service.crm.CustomerRelationService;
import com.epmet.service.stats.DimCustomerService; import com.epmet.service.stats.DimCustomerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@ -42,6 +43,7 @@ import java.util.stream.Collectors;
* @author generator generator@elink-cn.com * @author generator generator@elink-cn.com
* @since v1.0.0 2021-01-14 * @since v1.0.0 2021-01-14
*/ */
@Slf4j
@DataSource(DataSourceConstant.OPER_CRM) @DataSource(DataSourceConstant.OPER_CRM)
@Service @Service
public class CustomerRelationServiceImpl extends BaseServiceImpl<CustomerRelationDao, CustomerRelationEntity> implements CustomerRelationService { public class CustomerRelationServiceImpl extends BaseServiceImpl<CustomerRelationDao, CustomerRelationEntity> implements CustomerRelationService {
@ -60,13 +62,13 @@ public class CustomerRelationServiceImpl extends BaseServiceImpl<CustomerRelatio
List<CustomerSubInfoDTO> list=new ArrayList<>(); List<CustomerSubInfoDTO> list=new ArrayList<>();
for(String customerId:customerIds){ for(String customerId:customerIds){
CustomerSubInfoDTO customerSubInfoDTO = baseDao.selectCustomerSubInfo(customerId); CustomerSubInfoDTO customerSubInfoDTO = baseDao.selectCustomerSubInfo(customerId);
if(null!=customerSubInfoDTO){ if(null==customerSubInfoDTO){
DimCustomerDTO dimCustomerDTO=dimCustomerService.get(customerId); log.info(String.format("当前客户customerId: %s, 没有下一级客户 ",customerId));
if(null!=dimCustomerDTO){ continue;
customerSubInfoDTO.setCustomerName(dimCustomerDTO.getCustomerName());
}
list.add(customerSubInfoDTO);
} }
DimCustomerDTO dimCustomerDTO=dimCustomerService.get(customerId);
customerSubInfoDTO.setCustomerName(dimCustomerDTO.getCustomerName());
list.add(customerSubInfoDTO);
} }
if(CollectionUtils.isEmpty(list)){ if(CollectionUtils.isEmpty(list)){
return new HashMap<>(); return new HashMap<>();

14
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; package com.epmet.service.evaluationindex.indexcal;
import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.dto.indexcal.CustomerSubInfoDTO;
import com.epmet.dto.indexcal.IndexStatisticsFormDTO; import com.epmet.dto.indexcal.IndexStatisticsFormDTO;
import java.util.List;
import java.util.Map;
/** /**
* 指标计算service * 指标计算service
* *
@ -19,4 +23,14 @@ public interface IndexCalculateService {
Boolean indexCalculate(CalculateCommonFormDTO formDTO); Boolean indexCalculate(CalculateCommonFormDTO formDTO);
Boolean indexStatistics(IndexStatisticsFormDTO 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<String, CustomerSubInfoDTO> getCustomerInfoMap(List<String> customerIds);
} }

25
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信息以及下一级客户列表 * @description 查询当前客户的area_code信息以及下一级客户列表
* @Date 2021/1/21 11:28 * @Date 2021/1/21 11:28
**/ **/
private Map<String, CustomerSubInfoDTO> getCustomerInfoMap(List<String> customerIds) { @Override
public Map<String, CustomerSubInfoDTO> getCustomerInfoMap(List<String> customerIds) {
return customerRelationService.getCustomerInfoMap(customerIds); return customerRelationService.getCustomerInfoMap(customerIds);
} }
@ -246,4 +247,26 @@ public class IndexCalculateServiceImpl implements IndexCalculateService {
}); });
return true; 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<String> customerIds=new ArrayList<>();
customerIds.add(formDTO.getCustomerId());
//查询客户编码、以及下一级客户列表 add01.14
Map<String, CustomerSubInfoDTO> 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);
}
} }

4
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)) { 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; continue;
} }
// 补充表中其他字段 // 补充表中其他字段
@ -753,7 +753,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
} }
} }
if ("".equals(agencyName)) { 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; continue;
} }
// 补充表中其他字段 // 补充表中其他字段

Loading…
Cancel
Save