diff --git a/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/service/impl/CommodityServiceImpl.java b/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/service/impl/CommodityServiceImpl.java index 199b2490..ae66cb8f 100644 --- a/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/service/impl/CommodityServiceImpl.java +++ b/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/service/impl/CommodityServiceImpl.java @@ -134,6 +134,7 @@ public class CommodityServiceImpl implements CommodityService { } if(StringUtils.isBlank(codeEntity.getYhzcbs())|| "0".equals(codeEntity.getYhzcbs())){ codeEntity.setZzstsgl(""); + codeEntity.setLslbs(""); } codeEntity.setXhfNsrsbh(null);//不更新税号 codeEntity.setModifyTime(new Date()); diff --git a/order-management-base-service/src/main/resources/mybatis/mapper/CommodityMapper.xml b/order-management-base-service/src/main/resources/mybatis/mapper/CommodityMapper.xml index c00360d4..6dc936ff 100644 --- a/order-management-base-service/src/main/resources/mybatis/mapper/CommodityMapper.xml +++ b/order-management-base-service/src/main/resources/mybatis/mapper/CommodityMapper.xml @@ -297,7 +297,7 @@ tax_classification_name = #{commodityCode.ssflMc,jdbcType=VARCHAR}, - + preferential_policies_type = #{commodityCode.lslbs,jdbcType=VARCHAR}, diff --git a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/service/impl/InvoiceServiceImpl.java b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/service/impl/InvoiceServiceImpl.java index 4fd04778..61b9bb1c 100644 --- a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/service/impl/InvoiceServiceImpl.java +++ b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/service/impl/InvoiceServiceImpl.java @@ -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 cpyOrderItems = new ArrayList(); @@ -301,34 +300,35 @@ public class InvoiceServiceImpl implements InvoiceService { orderSplit.stream().forEach(splitEn -> { List orderItemInfo = splitEn.getOrderItemInfo(); orderItemInfo.stream().forEach(splitItem -> { - List 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 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 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 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,25 +1596,27 @@ 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 (OrderInfoEnum.CHECK_BANK_FLAG_YES.getKey().equals(buyerEntity.getCheckBankFlag())) { - log.info("开始校验客户信息完整"); - if (StrUtil.isBlank(orderInfo.getGhfNsrsbh())) { - throw new RuntimeException("结算单:"+orderInfo.getDdh()+"购方纳税人识别号为空,请补全!"); - } - if (StrUtil.isBlank(orderInfo.getGhfDz())) { - throw new RuntimeException("结算单:"+orderInfo.getDdh()+"购方地址为空,请补全!"); - } - if (StrUtil.isBlank(orderInfo.getGhfDh())) { - throw new RuntimeException("结算单:"+orderInfo.getDdh()+"购方电话为空,请补全!"); - } - if (StrUtil.isBlank(orderInfo.getGhfYh())) { - throw new RuntimeException("结算单:"+orderInfo.getDdh()+"购方开户行为空,请补全!"); - } - if (StrUtil.isBlank(orderInfo.getGhfZh())) { - 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())) { + throw new RuntimeException("结算单:"+orderInfo.getDdh()+"购方纳税人识别号为空,请补全!"); + } + if (StrUtil.isBlank(orderInfo.getGhfDz())) { + throw new RuntimeException("结算单:"+orderInfo.getDdh()+"购方地址为空,请补全!"); + } + if (StrUtil.isBlank(orderInfo.getGhfDh())) { + throw new RuntimeException("结算单:"+orderInfo.getDdh()+"购方电话为空,请补全!"); + } + if (StrUtil.isBlank(orderInfo.getGhfYh())) { + throw new RuntimeException("结算单:"+orderInfo.getDdh()+"购方开户行为空,请补全!"); + } + if (StrUtil.isBlank(orderInfo.getGhfZh())) { + throw new RuntimeException("结算单:"+orderInfo.getDdh()+"购方银行账号为空,请补全!"); + } } } });