Browse Source

代码调整

dev_shibei_match
jianjun 5 years ago
parent
commit
7795ae9653
  1. 14
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java

14
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java

@ -195,14 +195,22 @@ public class PointRuleServiceImpl extends BaseServiceImpl<PointRuleDao, PointRul
@Override
public InitPointRuleResultDTO initPointRule() {
Result<List<CustomerDTO>> customerListResult = operCrmOpenFeignClient.getAllCustomerList();
log.info("initPointRule operCrmOpenFeignClient.getAllCustomerList result:{}",JSON.toJSONString(customerListResult));
if (!customerListResult.success() || CollectionUtils.isEmpty(customerListResult.getData())) {
log.error("获取所有客户列表失败");
throw new RenException("获取所有客户列表失败");
}
List<CustomerDTO> customerDTOList = customerListResult.getData();
List<PointRuleDefaultEntity> ruleDefaultEntities = pointRuleDefaultDao.selectList(null);
if (CollectionUtils.isEmpty(ruleDefaultEntities)) {
log.warn("initPointRule pointRuleDefaultDao.selectList return empty");
throw new RenException("获取默认规则失败");
}
List<String> haveInitCustomerIds = baseDao.selectCustomerIds();
if (haveInitCustomerIds == null) {
haveInitCustomerIds = new ArrayList<>();
}
List<PointRuleEntity> insertList = new ArrayList<>();
ruleDefaultEntities.forEach(defaultRule -> {
for (PointRuleDefaultEntity defaultRule : ruleDefaultEntities) {
for (CustomerDTO customerDTO : customerDTOList) {
if (haveInitCustomerIds.contains(customerDTO.getId())) {
continue;
@ -211,7 +219,7 @@ public class PointRuleServiceImpl extends BaseServiceImpl<PointRuleDao, PointRul
entity.setCustomerId(customerDTO.getId());
insertList.add(entity);
}
});
}
this.insertBatch(insertList, 100);
InitPointRuleResultDTO result = new InitPointRuleResultDTO();
result.setCustomerTotal(customerDTOList.size());

Loading…
Cancel
Save