|
|
|
@ -51,6 +51,7 @@ import com.dxhy.order.utils.JsonUtils; |
|
|
|
|
import com.dxhy.order.utils.NsrsbhUtils; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
@ -59,7 +60,6 @@ import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.text.DecimalFormat; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
@ -173,7 +173,6 @@ public class InvoiceServiceImpl implements InvoiceService { |
|
|
|
|
// if(StrUtil.isBlank(commonOrderInfo.getOrderInfo().getGhfNsrsbh()) || StrUtil.isBlank(commonOrderInfo.getOrderInfo().getGhfMc()) ){
|
|
|
|
|
// return R.error("结算单:"+commonOrderInfo.getOrderInfo().getDdh()+"购方信息为空,请补全!");
|
|
|
|
|
// }
|
|
|
|
|
String cpy = ""; |
|
|
|
|
String kcp = baseServiceConfig.getKcp(); |
|
|
|
|
boolean kcpMark; |
|
|
|
|
List<OrderItemInfo> cpyOrderItems = new ArrayList<OrderItemInfo>(); |
|
|
|
@ -301,34 +300,35 @@ public class InvoiceServiceImpl implements InvoiceService { |
|
|
|
|
orderSplit.stream().forEach(splitEn -> { |
|
|
|
|
List<OrderItemInfo> orderItemInfo = splitEn.getOrderItemInfo(); |
|
|
|
|
orderItemInfo.stream().forEach(splitItem -> { |
|
|
|
|
List<OrderItemInfo> collect = commonOrderInfo.getOrderItemInfo().stream().filter(oi -> oi.getXmmc().equals(splitItem.getXmmc()) && |
|
|
|
|
((StrUtil.isBlank(oi.getGgxh()) && StrUtil.isBlank(splitItem.getGgxh())) || oi.getGgxh().equals(splitItem.getGgxh())) && |
|
|
|
|
((StrUtil.isBlank(oi.getXmdw()) && StrUtil.isBlank(splitItem.getXmdw())) || oi.getXmdw().equals(splitItem.getXmdw())) && |
|
|
|
|
((StrUtil.isBlank(oi.getSl()) && StrUtil.isBlank(splitItem.getSl())) || oi.getSl().equals(splitItem.getSl()))).collect(Collectors.toList()); |
|
|
|
|
if (collect.size() == 1) { |
|
|
|
|
List<RuleSplitEntity> ruleSplitEntityList = ruleSplitService.queryRuleSplit(commonOrderInfo.getOrderInfo().getXhfNsrsbh(), pageInvoiceReq.getUserId()); |
|
|
|
|
log.info("税号:{},用户ID:{},查询的拆分限额信息结果:{}", commonOrderInfo.getOrderInfo().getXhfNsrsbh(), |
|
|
|
|
pageInvoiceReq.getUserId(), JsonUtils.getInstance().toJsonString(ruleSplitEntityList)); |
|
|
|
|
String djce = ConfigureConstant.STRING_0; |
|
|
|
|
if(ruleSplitEntityList.size() != 0){ |
|
|
|
|
djce = StrUtil.isBlank(ruleSplitEntityList.get(0).getDjce())?ConfigureConstant.STRING_0:ruleSplitEntityList.get(0).getDjce(); |
|
|
|
|
} |
|
|
|
|
if(ObjectUtil.isNotNull(collect.get(0).getXmdj()) && StrUtil.isNotBlank(collect.get(0).getXmdj()) && |
|
|
|
|
ObjectUtil.isNotNull(splitItem.getXmdj()) && StrUtil.isNotBlank(splitItem.getXmdj())){ |
|
|
|
|
BigDecimal abs = new BigDecimal(collect.get(0).getXmdj()).subtract(new BigDecimal(splitItem.getXmdj())).abs(); |
|
|
|
|
if (abs.compareTo(new BigDecimal(djce)) > 0) { |
|
|
|
|
Map map = new HashMap(); |
|
|
|
|
map.put("ddh", commonOrderInfo.getOrderInfo().getDdh()); |
|
|
|
|
map.put("ghfMc", commonOrderInfo.getOrderInfo().getGhfMc()); |
|
|
|
|
map.put("xhfMc", commonOrderInfo.getOrderInfo().getXhfMc()); |
|
|
|
|
map.put("jshj", commonOrderInfo.getOrderInfo().getKphjje()); |
|
|
|
|
djOverflowList.add(map); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
log.error("{}校验单价容差范围发生错误:在原结算单中未匹配到唯一明细,找到了{}条", LOGGER_MSG, collect.size()); |
|
|
|
|
throw new RuntimeException("校验单价容差范围发生错误:在原结算单中未匹配到唯一明细"); |
|
|
|
|
} |
|
|
|
|
// List<OrderItemInfo> collect = commonOrderInfo.getOrderItemInfo().stream().filter(oi -> oi.getXmmc().equals(splitItem.getXmmc()) &&
|
|
|
|
|
// ((StrUtil.isBlank(oi.getGgxh()) && StrUtil.isBlank(splitItem.getGgxh())) || oi.getGgxh().equals(splitItem.getGgxh())) &&
|
|
|
|
|
// ((StrUtil.isBlank(oi.getXmdw()) && StrUtil.isBlank(splitItem.getXmdw())) || oi.getXmdw().equals(splitItem.getXmdw())) &&
|
|
|
|
|
// ((StrUtil.isBlank(oi.getSl()) && StrUtil.isBlank(splitItem.getSl())) || oi.getSl().equals(splitItem.getSl()))).collect(Collectors.toList());
|
|
|
|
|
// if (collect.size() == 1) {
|
|
|
|
|
// List<RuleSplitEntity> ruleSplitEntityList = ruleSplitService.queryRuleSplit(commonOrderInfo.getOrderInfo().getXhfNsrsbh(), pageInvoiceReq.getUserId());
|
|
|
|
|
// log.info("税号:{},用户ID:{},查询的拆分限额信息结果:{}", commonOrderInfo.getOrderInfo().getXhfNsrsbh(),
|
|
|
|
|
// pageInvoiceReq.getUserId(), JsonUtils.getInstance().toJsonString(ruleSplitEntityList));
|
|
|
|
|
// String djce = ConfigureConstant.STRING_0;
|
|
|
|
|
// if(ruleSplitEntityList.size() != 0){
|
|
|
|
|
// djce = StrUtil.isBlank(ruleSplitEntityList.get(0).getDjce())?ConfigureConstant.STRING_0:ruleSplitEntityList.get(0).getDjce();
|
|
|
|
|
// }
|
|
|
|
|
// if(ObjectUtil.isNotNull(collect.get(0).getXmdj()) && StrUtil.isNotBlank(collect.get(0).getXmdj()) &&
|
|
|
|
|
// ObjectUtil.isNotNull(splitItem.getXmdj()) && StrUtil.isNotBlank(splitItem.getXmdj())){
|
|
|
|
|
// BigDecimal abs = new BigDecimal(collect.get(0).getXmdj()).subtract(new BigDecimal(splitItem.getXmdj())).abs();
|
|
|
|
|
// if (abs.compareTo(new BigDecimal(djce)) > 0) {
|
|
|
|
|
// Map map = new HashMap();
|
|
|
|
|
// map.put("ddh", commonOrderInfo.getOrderInfo().getDdh());
|
|
|
|
|
// map.put("ghfMc", commonOrderInfo.getOrderInfo().getGhfMc());
|
|
|
|
|
// map.put("xhfMc", commonOrderInfo.getOrderInfo().getXhfMc());
|
|
|
|
|
// map.put("jshj", commonOrderInfo.getOrderInfo().getKphjje());
|
|
|
|
|
// djOverflowList.add(map);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// else {
|
|
|
|
|
// log.error("{}校验单价容差范围发生错误:在原结算单中未匹配到唯一明细,找到了{}条", LOGGER_MSG, collect.size());
|
|
|
|
|
// throw new RuntimeException("校验单价容差范围发生错误:在原结算单中未匹配到唯一明细");
|
|
|
|
|
// }
|
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
@ -1596,9 +1596,10 @@ public class InvoiceServiceImpl implements InvoiceService { |
|
|
|
|
orderInfoIdList.stream().forEach(id->{ |
|
|
|
|
OrderInfo orderInfo = orderInfoMapper.selectOrderInfoByOrderId(id, null); |
|
|
|
|
BuyerEntity buyerEntity = buyerMapper.queryBuyerInfoByGhfIdAndEntId(orderInfo.getGhfId(), orderInfo.getEntId()); |
|
|
|
|
if (buyerEntity == null) { |
|
|
|
|
throw new RuntimeException("结算单:"+orderInfo.getDdh()+"购方信息为空,请补全!"); |
|
|
|
|
} |
|
|
|
|
// if (buyerEntity == null) {
|
|
|
|
|
// throw new RuntimeException("结算单:"+orderInfo.getDdh()+"购方信息为空,请补全!");
|
|
|
|
|
// }
|
|
|
|
|
if (buyerEntity != null) { |
|
|
|
|
if (OrderInfoEnum.CHECK_BANK_FLAG_YES.getKey().equals(buyerEntity.getCheckBankFlag())) { |
|
|
|
|
log.info("开始校验客户信息完整"); |
|
|
|
|
if (StrUtil.isBlank(orderInfo.getGhfNsrsbh())) { |
|
|
|
@ -1617,6 +1618,7 @@ public class InvoiceServiceImpl implements InvoiceService { |
|
|
|
|
throw new RuntimeException("结算单:"+orderInfo.getDdh()+"购方银行账号为空,请补全!"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|