|
|
|
@ -2,13 +2,13 @@ package com.dxhy.order.consumer.modules.order.service.impl; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import com.dxhy.order.baseservice.module.taxclass.dao.TaxClassCodeMapper; |
|
|
|
|
import com.dxhy.order.baseservice.module.taxclass.model.TaxClassCodeEntity; |
|
|
|
|
import com.dxhy.order.constant.ConfigureConstant; |
|
|
|
|
import com.dxhy.order.constant.OrderInfoEnum; |
|
|
|
|
import com.dxhy.order.exception.OrderReceiveException; |
|
|
|
|
import com.dxhy.order.model.CommonOrderInfo; |
|
|
|
|
import com.dxhy.order.model.OrderInfo; |
|
|
|
|
import com.dxhy.order.model.OrderItemInfo; |
|
|
|
|
import com.dxhy.order.model.OrderProcessInfo; |
|
|
|
|
import com.dxhy.order.model.*; |
|
|
|
|
import com.dxhy.order.utils.CommonUtils; |
|
|
|
|
import com.dxhy.order.utils.DecimalCalculateUtil; |
|
|
|
|
import com.dxhy.base.constant.OrderSplitConfig; |
|
|
|
@ -70,8 +70,11 @@ public class OrderSplitServiceImpl implements OrderSplitService { |
|
|
|
|
@Resource |
|
|
|
|
private TaxSpecialPolicyUtil taxSpecialPolicyUtil; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private TaxClassCodeMapper taxClassCodeMapper; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void splitOrder(List<CommonOrderInfo> commonList) throws OrderReceiveException { |
|
|
|
|
public void splitOrder(List<CommonOrderInfo> commonList) throws OrderReceiveException,Exception { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 以后添加订单拆分后保存的方法 |
|
|
|
@ -248,7 +251,7 @@ public class OrderSplitServiceImpl implements OrderSplitService { |
|
|
|
|
* @throws OrderReceiveException |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public void saveOrderSplitOrder(List<PageCommonOrderInfo> commonList) throws OrderReceiveException { |
|
|
|
|
public void saveOrderSplitOrder(List<PageCommonOrderInfo> commonList) throws OrderReceiveException,Exception { |
|
|
|
|
List<CommonOrderInfo> list = new ArrayList<>(); |
|
|
|
|
String oldDdh = commonList.get(0).getOrderInfo().getDdh(); |
|
|
|
|
int i = 1; |
|
|
|
@ -298,7 +301,7 @@ public class OrderSplitServiceImpl implements OrderSplitService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void saveOrderSplitInfo(List<CommonOrderInfo> commonList, String type) throws OrderReceiveException { |
|
|
|
|
public void saveOrderSplitInfo(List<CommonOrderInfo> commonList, String type) throws OrderReceiveException,Exception { |
|
|
|
|
|
|
|
|
|
String parentOrderId = commonList.get(0).getOrderInfo().getId(); |
|
|
|
|
List<String> shList = new ArrayList<>(); |
|
|
|
@ -326,6 +329,31 @@ public class OrderSplitServiceImpl implements OrderSplitService { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//购方是否为空、税编是否为空校验、成品油校验
|
|
|
|
|
if(StrUtil.isBlank(commonOrderInfo.getOrderInfo().getGhfNsrsbh()) || StrUtil.isBlank(commonOrderInfo.getOrderInfo().getGhfMc()) ){ |
|
|
|
|
throw new Exception("购方信息为空,请补全!"); |
|
|
|
|
} |
|
|
|
|
String cpy = ""; |
|
|
|
|
for(OrderItemInfo orderItemInfo: commonOrderInfo.getOrderItemInfo()){ |
|
|
|
|
if(StrUtil.isBlank(orderItemInfo.getSpbm())){ |
|
|
|
|
throw new Exception("商品税编存在为空的行,请补全!"); |
|
|
|
|
}else { |
|
|
|
|
TaxClassCodeEntity taxClassCodeEntity = taxClassCodeMapper.selectTaxClassCodeBySpbm(orderItemInfo.getSpbm()); |
|
|
|
|
if(StrUtil.isNotBlank(cpy)){ |
|
|
|
|
if(!cpy.equals(taxClassCodeEntity.getCpy())){ |
|
|
|
|
throw new Exception("成品油和非成品油税编不能混开,请做手动拆分处理!"); |
|
|
|
|
} |
|
|
|
|
}else { |
|
|
|
|
cpy = taxClassCodeEntity.getCpy(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(ConfigureConstant.STRING_Y.equals(cpy) && commonOrderInfo.getOrderItemInfo().size()>ConfigureConstant.INT_8){ |
|
|
|
|
throw new Exception("成品油发票,明细行数不能超过8行,请先进行手动拆分!"); |
|
|
|
|
} |
|
|
|
|
if(ConfigureConstant.STRING_Y.equals(cpy)){ |
|
|
|
|
orderInfo.setQdBz(OrderInfoEnum.QDBZ_CODE_4.getKey()); |
|
|
|
|
} |
|
|
|
|
//清单变非清单
|
|
|
|
|
CommonUtils.resetQdbz(orderInfo); |
|
|
|
|
//重新计算清单标志
|
|
|
|
|