|
|
|
@ -2,6 +2,7 @@ package com.dxhy.order.consumer.modules.manager.service.impl; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
import com.dxhy.base.constant.OrderSeparationException; |
|
|
|
|
import com.dxhy.base.constant.OrderSplitException; |
|
|
|
@ -124,16 +125,43 @@ public class InvoiceServiceImpl implements InvoiceService { |
|
|
|
|
List<PageInvoiceItem> pageInvoiceItemList = pageInvoiceReq.getPageInvoiceItemList(); |
|
|
|
|
//查询数据列表
|
|
|
|
|
List<CommonOrderInfo> commonOrderInfos = orderInfoService.batchQueryOrderInfoByOrderIdsAndNsrsbh(pageInvoiceItemList); |
|
|
|
|
StringBuffer errorMsg = new StringBuffer(); |
|
|
|
|
List<Map<String,String>> consumerList = new ArrayList<>(); |
|
|
|
|
List<Map<String,String>> confirmList = new ArrayList<>(); |
|
|
|
|
commonOrderInfos.stream().forEach(f -> { |
|
|
|
|
BuyerEntity buyerEntity = buyerService.queryBuyerInfoByxhfNsrsbhAndBuyerCode(f.getOrderInfo().getXhfNsrsbh(), f.getOrderInfo().getGhfId()); |
|
|
|
|
if(ConfigureConstant.STRING_0.equals(buyerEntity.getStatus())){ |
|
|
|
|
errorMsg.append("【结算单号】:").append(f.getOrderInfo().getDdh()).append(",【客户】:").append(f.getOrderInfo().getGhfMc()).append(";\r"); |
|
|
|
|
OrderInfo orderInfo = f.getOrderInfo(); |
|
|
|
|
List<OrderItemInfo> orderItemInfoList = f.getOrderItemInfo(); |
|
|
|
|
BuyerEntity buyerEntity = null; |
|
|
|
|
if(StrUtil.isNotBlank(orderInfo.getGhfId())){ |
|
|
|
|
buyerEntity = buyerService.queryBuyerInfoByxhfNsrsbhAndBuyerCode(orderInfo.getXhfNsrsbh(), orderInfo.getGhfId()); |
|
|
|
|
if(ObjectUtil.isNull(buyerEntity)){ |
|
|
|
|
buyerEntity = buyerService.queryBuyerInfoByxhfNsrsbhAndBuyerCode(ConfigureConstant.STRING_1_, orderInfo.getGhfId()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(ObjectUtil.isNotNull(buyerEntity) && ConfigureConstant.STRING_0.equals(buyerEntity.getStatus())){ |
|
|
|
|
Map map = new HashMap(); |
|
|
|
|
map.put("ddh",orderInfo.getDdh()); |
|
|
|
|
map.put("ghfMc",orderInfo.getGhfMc()); |
|
|
|
|
map.put("ghfNsrsbh",orderInfo.getGhfNsrsbh()); |
|
|
|
|
map.put("hsje",orderInfo.getKphjje()); |
|
|
|
|
consumerList.add(map); |
|
|
|
|
} |
|
|
|
|
orderItemInfoList.stream().forEach(item -> { |
|
|
|
|
if(ConfigureConstant.STRING_1.equals(item.getZnfm())){ |
|
|
|
|
Map map = new HashMap(); |
|
|
|
|
map.put("ddh",orderInfo.getDdh()); |
|
|
|
|
map.put("xh",item.getSphxh()); |
|
|
|
|
String xmmc = item.getXmmc(); |
|
|
|
|
map.put("xmmc",xmmc.substring(xmmc.lastIndexOf("*")+1,xmmc.length())); |
|
|
|
|
map.put("ssjc",xmmc.substring(1,xmmc.lastIndexOf("*"))); |
|
|
|
|
map.put("ssbm",item.getSpbm()); |
|
|
|
|
confirmList.add(map); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
if(errorMsg.length()>0){ |
|
|
|
|
errorMsg.append("被冻结,不允许开票!"); |
|
|
|
|
return R.error(errorMsg.toString()); |
|
|
|
|
}); |
|
|
|
|
if(consumerList.size()>0){ |
|
|
|
|
return R.error(ConfigureConstant.STRING_9001, "校验客户提示",consumerList); |
|
|
|
|
}else if((StrUtil.isBlank(pageInvoiceReq.getConfirmZnfm()) || !ConfigureConstant.STRING_0.equals(pageInvoiceReq.getConfirmZnfm())) && confirmList.size()>0){ |
|
|
|
|
return R.error(ConfigureConstant.STRING_9002,"请确认以下物料税收分类编码是否准确",confirmList); |
|
|
|
|
}else { |
|
|
|
|
commonOrderInfos.stream().forEach(f -> { |
|
|
|
|
String terminalCode = simsBackService.getTerminalCode(f.getOrderInfo().getXhfNsrsbh(), f.getOrderInfo().getEntId()); |
|
|
|
|