|
@@ -6,7 +6,9 @@ import com.fire.admin.dto.CustomerProductDto;
|
|
import com.fire.admin.mapper.CustomerProductInfoMapper;
|
|
import com.fire.admin.mapper.CustomerProductInfoMapper;
|
|
import com.fire.admin.service.CustomerProductInfoService;
|
|
import com.fire.admin.service.CustomerProductInfoService;
|
|
import com.fire.admin.vo.CustomerProductInfoVo;
|
|
import com.fire.admin.vo.CustomerProductInfoVo;
|
|
|
|
+import com.fire.common.exception.BaseException;
|
|
import com.fire.dto.CustomerProduct;
|
|
import com.fire.dto.CustomerProduct;
|
|
|
|
+import com.fire.dto.enums.Status;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -82,25 +84,28 @@ public class CustomerProductInfoServiceImpl extends ServiceImpl<CustomerProductI
|
|
@Override
|
|
@Override
|
|
public void saveOrUpdate(List<CustomerProductDto> productDtoList) {
|
|
public void saveOrUpdate(List<CustomerProductDto> productDtoList) {
|
|
|
|
|
|
- List<CustomerProduct> productList = Lists.newArrayList();
|
|
|
|
|
|
+ if(!productDtoList.isEmpty()){
|
|
|
|
+ List<CustomerProduct> productList = Lists.newArrayList();
|
|
|
|
+ productDtoList.forEach(dto->{
|
|
|
|
+ CustomerProduct product = CustomerProduct.builder()
|
|
|
|
+ .customerProductId(dto.getCustomerProductId())
|
|
|
|
+ .customerId(dto.getCustomerId())
|
|
|
|
+ .packageId(dto.getPackageId())
|
|
|
|
+ .type(dto.getType())
|
|
|
|
+ .price(Integer.parseInt(String.valueOf((dto.getPrice().multiply(new BigDecimal(10000))).longValue())))
|
|
|
|
+ .facePrice(Integer.parseInt(String.valueOf(dto.getFacePrice().multiply(new BigDecimal(10000)).longValue())))
|
|
|
|
+ .isEffective(dto.getIsEffective())
|
|
|
|
+ .disCount(dto.getPrice().divide(dto.getFacePrice())).build();
|
|
|
|
+ log.info("产品为:【{}】",product.toString());
|
|
|
|
+ productList.add(product);
|
|
|
|
+ });
|
|
|
|
|
|
- productDtoList.forEach(dto->{
|
|
|
|
- CustomerProduct product = CustomerProduct.builder().customerProductId(dto.getCustomerProductId())
|
|
|
|
- .customerId(dto.getCustomerId())
|
|
|
|
- .packageId(dto.getPackageId())
|
|
|
|
- .type(dto.getType())
|
|
|
|
- .price(Integer.parseInt(String.valueOf(new BigDecimal(dto.getPrice()).multiply(new BigDecimal(10000)))))
|
|
|
|
- .facePrice(Integer.parseInt(String.valueOf(new BigDecimal(dto.getFacePrice()).multiply(new BigDecimal(10000)))))
|
|
|
|
- .isEffective(dto.getIsEffective())
|
|
|
|
- .disCount(new BigDecimal(dto.getPrice()).divide(new BigDecimal(dto.getFacePrice()))).build();
|
|
|
|
- productList.add(product);
|
|
|
|
- });
|
|
|
|
- boolean flag = this.saveOrUpdateBatch(productList);
|
|
|
|
- if(flag){
|
|
|
|
- //TODO 发送消息到topic
|
|
|
|
|
|
+ boolean flag = this.saveOrUpdateBatch(productList);
|
|
|
|
+ if(flag){
|
|
|
|
+ //TODO 发送消息到topic
|
|
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|