feat: 成品油发票校验、置成品油清单标志

release
liufeilong 2 years ago
parent 23dbc5e2ee
commit 54b2bbbea2
  1. 14
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/service/impl/InvoiceServiceImpl.java
  2. 4
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/OrderSplitService.java
  3. 42
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/impl/OrderSplitServiceImpl.java

@ -139,7 +139,7 @@ public class InvoiceServiceImpl implements InvoiceService {
List<PageInvoiceItem> pageInvoiceItemList = pageInvoiceReq.getPageInvoiceItemList(); List<PageInvoiceItem> pageInvoiceItemList = pageInvoiceReq.getPageInvoiceItemList();
//查询数据列表 //查询数据列表
List<CommonOrderInfo> commonOrderInfos = orderInfoService.batchQueryOrderInfoByOrderIdsAndNsrsbh(pageInvoiceItemList); List<CommonOrderInfo> commonOrderInfos = orderInfoService.batchQueryOrderInfoByOrderIdsAndNsrsbh(pageInvoiceItemList);
//购方是否为空、税编是否为空校验、成品油混开校验 //购方是否为空、税编是否为空校验、成品油校验
for(CommonOrderInfo commonOrderInfo:commonOrderInfos){ for(CommonOrderInfo commonOrderInfo:commonOrderInfos){
if(StrUtil.isBlank(commonOrderInfo.getOrderInfo().getGhfNsrsbh()) || StrUtil.isBlank(commonOrderInfo.getOrderInfo().getGhfMc()) ){ if(StrUtil.isBlank(commonOrderInfo.getOrderInfo().getGhfNsrsbh()) || StrUtil.isBlank(commonOrderInfo.getOrderInfo().getGhfMc()) ){
return R.error("结算单:"+commonOrderInfo.getOrderInfo().getDdh()+"购方信息为空,请补全!"); return R.error("结算单:"+commonOrderInfo.getOrderInfo().getDdh()+"购方信息为空,请补全!");
@ -159,6 +159,9 @@ public class InvoiceServiceImpl implements InvoiceService {
} }
} }
} }
if(ConfigureConstant.STRING_Y.equals(cpy) && commonOrderInfo.getOrderItemInfo().size()>ConfigureConstant.INT_8){
return R.error("结算单:"+commonOrderInfo.getOrderInfo().getDdh()+"是成品油发票,明细行数不能超过8行,请先进行手动拆分!");
}
} }
//客户冻结状态校验、确认智能赋码、单价误差校验 //客户冻结状态校验、确认智能赋码、单价误差校验
@ -245,6 +248,10 @@ public class InvoiceServiceImpl implements InvoiceService {
return R.error(ConfigureConstant.STRING_9003, "以下订单自动拆分时单价超过设定范围,请手动拆分",djOverflowList); return R.error(ConfigureConstant.STRING_9003, "以下订单自动拆分时单价超过设定范围,请手动拆分",djOverflowList);
}else { }else {
for (CommonOrderInfo f : commonOrderInfos) { for (CommonOrderInfo f : commonOrderInfos) {
TaxClassCodeEntity taxClassCodeEntity = taxClassCodeMapper.selectTaxClassCodeBySpbm(f.getOrderItemInfo().get(0).getSpbm());
if(ObjectUtil.isNotNull(taxClassCodeEntity) && ConfigureConstant.STRING_Y.equals(taxClassCodeEntity.getCpy())){
f.getOrderInfo().setQdBz(OrderInfoEnum.QDBZ_CODE_4.getKey());
}
String terminalCode = simsBackService.getTerminalCode(f.getOrderInfo().getXhfNsrsbh(), f.getOrderInfo().getEntId()); String terminalCode = simsBackService.getTerminalCode(f.getOrderInfo().getXhfNsrsbh(), f.getOrderInfo().getEntId());
List<CommonOrderInfo> originalCommonOrderInfo = new ArrayList<>(); List<CommonOrderInfo> originalCommonOrderInfo = new ArrayList<>();
originalCommonOrderInfo.add(f); originalCommonOrderInfo.add(f);
@ -256,6 +263,11 @@ public class InvoiceServiceImpl implements InvoiceService {
OrderProcessInfo processInfo = f.getProcessInfo(); OrderProcessInfo processInfo = f.getProcessInfo();
processInfo.setYzfp(ConfigureConstant.STRING_1); processInfo.setYzfp(ConfigureConstant.STRING_1);
orderProcessService.updateOrderProcessInfoByProcessId(processInfo, null); orderProcessService.updateOrderProcessInfoByProcessId(processInfo, null);
if(ObjectUtil.isNotNull(taxClassCodeEntity) && ConfigureConstant.STRING_Y.equals(taxClassCodeEntity.getCpy())){
OrderInfo orderInfo = f.getOrderInfo();
orderInfo.setQdBz(OrderInfoEnum.QDBZ_CODE_4.getKey());
orderInfoService.updateOrderInfoByOrderId(orderInfo,null);
}
} else if (orderSplit.size() > 1) { } else if (orderSplit.size() > 1) {
List<CommonOrderInfo> commonOrderInfoSaveResults = new ArrayList<>(); List<CommonOrderInfo> commonOrderInfoSaveResults = new ArrayList<>();

@ -23,7 +23,7 @@ public interface OrderSplitService {
* @param commonList * @param commonList
* @throws OrderReceiveException * @throws OrderReceiveException
*/ */
void splitOrder(List<CommonOrderInfo> commonList) throws OrderReceiveException; void splitOrder(List<CommonOrderInfo> commonList) throws OrderReceiveException,Exception;
/** /**
* 订单拆分 * 订单拆分
@ -42,5 +42,5 @@ public interface OrderSplitService {
* @param commonList * @param commonList
* @throws OrderReceiveException * @throws OrderReceiveException
*/ */
void saveOrderSplitOrder(List<PageCommonOrderInfo> commonList) throws OrderReceiveException; void saveOrderSplitOrder(List<PageCommonOrderInfo> commonList) throws OrderReceiveException,Exception;
} }

@ -2,13 +2,13 @@ package com.dxhy.order.consumer.modules.order.service.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; 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.ConfigureConstant;
import com.dxhy.order.constant.OrderInfoEnum; import com.dxhy.order.constant.OrderInfoEnum;
import com.dxhy.order.exception.OrderReceiveException; import com.dxhy.order.exception.OrderReceiveException;
import com.dxhy.order.model.CommonOrderInfo; import com.dxhy.order.model.*;
import com.dxhy.order.model.OrderInfo;
import com.dxhy.order.model.OrderItemInfo;
import com.dxhy.order.model.OrderProcessInfo;
import com.dxhy.order.utils.CommonUtils; import com.dxhy.order.utils.CommonUtils;
import com.dxhy.order.utils.DecimalCalculateUtil; import com.dxhy.order.utils.DecimalCalculateUtil;
import com.dxhy.base.constant.OrderSplitConfig; import com.dxhy.base.constant.OrderSplitConfig;
@ -70,8 +70,11 @@ public class OrderSplitServiceImpl implements OrderSplitService {
@Resource @Resource
private TaxSpecialPolicyUtil taxSpecialPolicyUtil; private TaxSpecialPolicyUtil taxSpecialPolicyUtil;
@Resource
private TaxClassCodeMapper taxClassCodeMapper;
@Override @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 * @throws OrderReceiveException
*/ */
@Override @Override
public void saveOrderSplitOrder(List<PageCommonOrderInfo> commonList) throws OrderReceiveException { public void saveOrderSplitOrder(List<PageCommonOrderInfo> commonList) throws OrderReceiveException,Exception {
List<CommonOrderInfo> list = new ArrayList<>(); List<CommonOrderInfo> list = new ArrayList<>();
String oldDdh = commonList.get(0).getOrderInfo().getDdh(); String oldDdh = commonList.get(0).getOrderInfo().getDdh();
int i = 1; 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(); String parentOrderId = commonList.get(0).getOrderInfo().getId();
List<String> shList = new ArrayList<>(); List<String> shList = new ArrayList<>();
@ -326,6 +329,31 @@ public class OrderSplitServiceImpl implements OrderSplitService {
continue; 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); CommonUtils.resetQdbz(orderInfo);
//重新计算清单标志 //重新计算清单标志

Loading…
Cancel
Save