|
|
|
@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil; |
|
|
|
|
import cn.hutool.core.collection.ListUtil; |
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import cn.hutool.core.util.RandomUtil; |
|
|
|
|
import com.alibaba.nacos.common.utils.CollectionUtils; |
|
|
|
|
import com.dxhy.order.baseservice.config.BaseServiceConfig; |
|
|
|
|
import com.dxhy.order.baseservice.module.base.model.DrawerInfoEntity; |
|
|
|
|
import com.dxhy.order.baseservice.module.base.model.SpjcXx; |
|
|
|
@ -12,10 +13,14 @@ import com.dxhy.order.baseservice.module.base.service.BaseService; |
|
|
|
|
import com.dxhy.order.baseservice.module.base.service.DrawerInfoService; |
|
|
|
|
import com.dxhy.order.baseservice.module.commodity.model.CommodityCodeEntity; |
|
|
|
|
import com.dxhy.order.baseservice.module.commodity.service.CommodityService; |
|
|
|
|
import com.dxhy.order.baseservice.module.taxclass.dao.TaxClassCodeMapper; |
|
|
|
|
import com.dxhy.order.baseservice.module.taxclass.model.TaxClassCodeEntity; |
|
|
|
|
import com.dxhy.order.constant.*; |
|
|
|
|
import com.dxhy.order.consumer.constant.RespStatusEnum; |
|
|
|
|
import com.dxhy.order.consumer.dao.GroupCommodityCodeMapper; |
|
|
|
|
import com.dxhy.order.consumer.model.protocol.ResponseStatus; |
|
|
|
|
import com.dxhy.order.consumer.model.protocol.Result; |
|
|
|
|
import com.dxhy.order.consumer.modules.commodity.service.IGroupCommodityCodeService; |
|
|
|
|
import com.dxhy.order.consumer.modules.order.service.OrderBatchRequestService; |
|
|
|
|
import com.dxhy.order.consumer.modules.order.service.OrderCommonService; |
|
|
|
|
import com.dxhy.order.consumer.openapi.protocol.CheckResult; |
|
|
|
@ -34,6 +39,7 @@ import com.dxhy.order.model.sk.sld.SearchSld; |
|
|
|
|
import com.dxhy.order.utils.*; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
@ -86,6 +92,12 @@ public class CommonInterfaceServiceImpl implements CommonInterfaceService { |
|
|
|
|
@Resource |
|
|
|
|
private BaseServiceConfig baseServiceConfig; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private GroupCommodityCodeMapper commodityCodeMapper; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private TaxClassCodeMapper taxClassCodeMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 校验接口入参数据,非空和数据校验 |
|
|
|
@ -378,7 +390,7 @@ public class CommonInterfaceServiceImpl implements CommonInterfaceService { |
|
|
|
|
public R dealWithSldStartV3(String sldid, String fpzldm, String nsrsbh, String qdbz, String terminalCode) { |
|
|
|
|
//方格税盘单独处理,todo 可以删除,使用同一套逻辑
|
|
|
|
|
String fgSkKpShList = baseServiceConfig.getFgSkKpShList(); |
|
|
|
|
if (CommonUtils.judgeIsFgTerminalOld(terminalCode,fgSkKpShList,nsrsbh)) { |
|
|
|
|
if (CommonUtils.judgeIsFgTerminalOld(terminalCode, fgSkKpShList, nsrsbh)) { |
|
|
|
|
String registCodeStr = fangGeService.getRegisterCodeByRedis(nsrsbh, sldid); |
|
|
|
|
RegistrationCode registrationCode = JsonUtils.getInstance().parseObject(registCodeStr, RegistrationCode.class); |
|
|
|
|
if (ObjectUtil.isNotEmpty(registCodeStr)) { |
|
|
|
@ -426,16 +438,16 @@ public class CommonInterfaceServiceImpl implements CommonInterfaceService { |
|
|
|
|
sldMc = searchSldList.get(0).getSldMc(); |
|
|
|
|
fjh = searchSldList.get(0).getFjh(); |
|
|
|
|
jqbh = searchSldList.get(0).getJqbh(); |
|
|
|
|
}else { |
|
|
|
|
} else { |
|
|
|
|
int i = (int) (RandomUtil.randomDouble() * searchSldList.size()); |
|
|
|
|
sldId = searchSldList.get(i).getSldId(); |
|
|
|
|
sldMc = searchSldList.get(i).getSldMc(); |
|
|
|
|
fjh = searchSldList.get(i).getFjh(); |
|
|
|
|
jqbh = searchSldList.get(i).getJqbh(); |
|
|
|
|
} |
|
|
|
|
if(StringUtils.isNotBlank(sldId)){ |
|
|
|
|
if (StringUtils.isNotBlank(sldId)) { |
|
|
|
|
//新版方格返回机器编号
|
|
|
|
|
if(CommonUtils.judgeIsFgTerminalNew(terminalCode, fgSkKpShList, nsrsbh)) { |
|
|
|
|
if (CommonUtils.judgeIsFgTerminalNew(terminalCode, fgSkKpShList, nsrsbh)) { |
|
|
|
|
return R.ok().put(OrderManagementConstant.CODE, OrderInfoContentEnum.SUCCESS.getKey()) |
|
|
|
|
.put(ConfigureConstant.SLD_ID, sldId) |
|
|
|
|
.put(ConfigureConstant.KPJH, jqbh).put(ConfigureConstant.SLD_MC, sldMc); |
|
|
|
@ -512,13 +524,14 @@ public class CommonInterfaceServiceImpl implements CommonInterfaceService { |
|
|
|
|
* 2.1 商品编码不为空,使用商品编码补全 |
|
|
|
|
* 2.2 商品编码为空,项目名称不为空,使用商品名称补全 |
|
|
|
|
*/ |
|
|
|
|
if(StringUtils.isNotBlank(item.getSpId())){ |
|
|
|
|
item.setZnfm("0"); |
|
|
|
|
if (StringUtils.isNotBlank(item.getSpId())) { |
|
|
|
|
R r = commodityService.queryCommodityById(item.getSpId(), shList); |
|
|
|
|
if(ConfigureConstant.STRING_0000.equals(r.get(OrderManagementConstant.CODE))){ |
|
|
|
|
if (ConfigureConstant.STRING_0000.equals(r.get(OrderManagementConstant.CODE))) { |
|
|
|
|
CommodityCodeEntity commodityCodeEntity = (CommodityCodeEntity) r.get(OrderManagementConstant.DATA); |
|
|
|
|
completeCommodityMessageBySpid(item, commodityCodeEntity); |
|
|
|
|
}else{ |
|
|
|
|
log.error("{}根据商品id查询商品信息异常:{}",LOGGER_MSG,r.get(OrderManagementConstant.MESSAGE)); |
|
|
|
|
} else { |
|
|
|
|
log.error("{}根据商品id查询商品信息异常:{}", LOGGER_MSG, r.get(OrderManagementConstant.MESSAGE)); |
|
|
|
|
errorStr.append(indexStr) |
|
|
|
|
.append(ConfigureConstant.STRING_UNDERLINE) |
|
|
|
|
.append(r.get(OrderManagementConstant.MESSAGE)) |
|
|
|
@ -545,12 +558,12 @@ public class CommonInterfaceServiceImpl implements CommonInterfaceService { |
|
|
|
|
List<CommodityCodeEntity> queryProductList = commodityService.queryProductList(map, shList); |
|
|
|
|
if (ObjectUtil.isEmpty(queryProductList)) { |
|
|
|
|
log.error("{}根据商品名称查询到的商品为空,商品名称:{}", LOGGER_MSG, item.getXmmc()); |
|
|
|
|
errorStr.append(indexStr) |
|
|
|
|
.append(ConfigureConstant.STRING_UNDERLINE) |
|
|
|
|
.append(OrderInfoContentEnum.INVOICE_SPBM_QUERY_NULL.getMessage()) |
|
|
|
|
.append("\r\n"); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
errorStr.append(indexStr) |
|
|
|
|
.append(ConfigureConstant.STRING_UNDERLINE) |
|
|
|
|
.append(OrderInfoContentEnum.INVOICE_SPBM_QUERY_NULL.getMessage()) |
|
|
|
|
.append("\r\n"); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (queryProductList.size() > 1) { |
|
|
|
|
log.error("{}根据商品名称查询到多个商品信息,商品名称:{}", LOGGER_MSG, item.getXmmc()); |
|
|
|
|
errorStr.append(indexStr) |
|
|
|
@ -562,6 +575,41 @@ public class CommonInterfaceServiceImpl implements CommonInterfaceService { |
|
|
|
|
|
|
|
|
|
CommodityCodeEntity commodityCodeEntity = queryProductList.get(0); |
|
|
|
|
completeCommodityMessageByXmmc(item, commodityCodeEntity); |
|
|
|
|
} else if (StringUtils.isNotBlank(item.getZxbm())) { |
|
|
|
|
// 自行编码为mdm的物料编码,通过这个去匹配
|
|
|
|
|
// 4.2.1.11
|
|
|
|
|
// 先从公司物料库匹配
|
|
|
|
|
CommodityCodeEntity commodityCodeEntity = commodityCodeMapper.queryCommodityCodeByZxbmAndXhfNsrsbh(item.getZxbm(), xhfNsrsbh); |
|
|
|
|
if (commodityCodeEntity == null) { |
|
|
|
|
// 如果匹配不到,则去集团物料库匹配
|
|
|
|
|
commodityCodeEntity = commodityCodeMapper.queryCommodityCodeByZxbmAndXhfNsrsbh(item.getZxbm(), "-1"); |
|
|
|
|
if (commodityCodeEntity == null) { |
|
|
|
|
// ③ 若通过集团物料库仍未匹配到税编信息则,使用“物料名称”进行智能赋码开票(用SAAS接口赋码)
|
|
|
|
|
// 智能赋码接口
|
|
|
|
|
Map<String, Object> paramMap = new HashMap<>(); |
|
|
|
|
paramMap.put("parameter", item.getXmmc()); |
|
|
|
|
List<TaxClassCodeEntity> taxClassList = taxClassCodeMapper.selectTaxClassCode(paramMap); |
|
|
|
|
if (CollectionUtils.isNotEmpty(taxClassList)) { |
|
|
|
|
// TODO 配置税收分类编码字段
|
|
|
|
|
TaxClassCodeEntity taxClassCodeEntity = taxClassList.get(0); |
|
|
|
|
item.setSpbm(taxClassCodeEntity.getSpbm()); |
|
|
|
|
// item.setYhzcbs(taxClassCodeEntity.getYhzcmc()); // TODO 优惠政策
|
|
|
|
|
item.setZzstsgl(taxClassCodeEntity.getZzstsgl()); |
|
|
|
|
item.setZnfm("1"); // 配置为智能赋码
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 如果没有找到,记录异常
|
|
|
|
|
if (commodityCodeEntity == null) { |
|
|
|
|
log.error("{}根据商品名称查询到的商品为空,商品名称:{}", LOGGER_MSG, item.getXmmc()); |
|
|
|
|
errorStr.append(indexStr) |
|
|
|
|
.append(ConfigureConstant.STRING_UNDERLINE) |
|
|
|
|
.append(OrderInfoContentEnum.INVOICE_SPBM_QUERY_NULL.getMessage()) |
|
|
|
|
.append("\r\n"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
//商品编码不为空,需要调用底层商品编码获取简码接口获取数据
|
|
|
|
|
String spbm = item.getSpbm(); |
|
|
|
@ -596,34 +644,35 @@ public class CommonInterfaceServiceImpl implements CommonInterfaceService { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 补全商品信息 通过商品ID |
|
|
|
|
* |
|
|
|
|
* @param item 订单明细数据 |
|
|
|
|
* @param commodity 从数据库查询的商品信息 |
|
|
|
|
* @author <a href="yaoxuguang@ele-cloud.com">yaoxuguang</a> |
|
|
|
|
* @date 2022-03-22 |
|
|
|
|
* @param item 订单明细数据 |
|
|
|
|
* @param commodity 从数据库查询的商品信息 |
|
|
|
|
*/ |
|
|
|
|
private void completeCommodityMessageBySpid(OrderItemInfo item, CommodityCodeEntity commodity){ |
|
|
|
|
private void completeCommodityMessageBySpid(OrderItemInfo item, CommodityCodeEntity commodity) { |
|
|
|
|
//商品编码
|
|
|
|
|
if(StringUtils.isBlank(item.getSpbm()) && StringUtils.isNotBlank(commodity.getSpbm())){ |
|
|
|
|
if (StringUtils.isBlank(item.getSpbm()) && StringUtils.isNotBlank(commodity.getSpbm())) { |
|
|
|
|
item.setSpbm(commodity.getSpbm()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//自行编码
|
|
|
|
|
if(StringUtils.isBlank(item.getZxbm()) && StringUtils.isNotBlank(commodity.getZxbm())){ |
|
|
|
|
if (StringUtils.isBlank(item.getZxbm()) && StringUtils.isNotBlank(commodity.getZxbm())) { |
|
|
|
|
item.setZxbm(commodity.getZxbm()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//优惠政策标识
|
|
|
|
|
if(StringUtils.isBlank(item.getYhzcbs()) && StringUtils.isNotBlank(commodity.getYhzcbs())){ |
|
|
|
|
if (StringUtils.isBlank(item.getYhzcbs()) && StringUtils.isNotBlank(commodity.getYhzcbs())) { |
|
|
|
|
item.setYhzcbs(commodity.getYhzcbs()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//零税率标识
|
|
|
|
|
if(StringUtils.isBlank(item.getLslbs()) && StringUtils.isNotBlank(commodity.getLslbs())){ |
|
|
|
|
if (StringUtils.isBlank(item.getLslbs()) && StringUtils.isNotBlank(commodity.getLslbs())) { |
|
|
|
|
item.setLslbs(commodity.getLslbs()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//增值税特殊管理
|
|
|
|
|
if(StringUtils.isBlank(item.getZzstsgl()) && StringUtils.isNotBlank(commodity.getZzstsgl())){ |
|
|
|
|
if (StringUtils.isBlank(item.getZzstsgl()) && StringUtils.isNotBlank(commodity.getZzstsgl())) { |
|
|
|
|
item.setZzstsgl(commodity.getZzstsgl()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -638,7 +687,7 @@ public class CommonInterfaceServiceImpl implements CommonInterfaceService { |
|
|
|
|
item.setXmmc(spmc); |
|
|
|
|
|
|
|
|
|
//发票行性质为折扣行,不补全,单价,数量,单位,规格型号
|
|
|
|
|
if(!OrderInfoEnum.FPHXZ_CODE_1.getKey().equals(item.getFphxz())){ |
|
|
|
|
if (!OrderInfoEnum.FPHXZ_CODE_1.getKey().equals(item.getFphxz())) { |
|
|
|
|
//规格型号
|
|
|
|
|
if (StringUtils.isBlank(item.getGgxh()) && StringUtils.isNotBlank(commodity.getGgxh())) { |
|
|
|
|
item.setGgxh(commodity.getGgxh()); |
|
|
|
@ -648,7 +697,7 @@ public class CommonInterfaceServiceImpl implements CommonInterfaceService { |
|
|
|
|
item.setXmdw(commodity.getXmdw()); |
|
|
|
|
} |
|
|
|
|
//商品数量
|
|
|
|
|
if(StringUtils.isBlank(item.getXmsl())){ |
|
|
|
|
if (StringUtils.isBlank(item.getXmsl())) { |
|
|
|
|
item.setXmsl(""); |
|
|
|
|
} |
|
|
|
|
//单价
|
|
|
|
@ -658,7 +707,7 @@ public class CommonInterfaceServiceImpl implements CommonInterfaceService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//含税标志
|
|
|
|
|
if(StringUtils.isBlank(item.getHsbz()) && StringUtils.isNotBlank(commodity.getHsbz())){ |
|
|
|
|
if (StringUtils.isBlank(item.getHsbz()) && StringUtils.isNotBlank(commodity.getHsbz())) { |
|
|
|
|
item.setHsbz(commodity.getHsbz()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -667,20 +716,21 @@ public class CommonInterfaceServiceImpl implements CommonInterfaceService { |
|
|
|
|
item.setSl(CommonUtils.formatSl(commodity.getSl())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//税额
|
|
|
|
|
if(StringUtils.isBlank(item.getSe())){ |
|
|
|
|
//税额
|
|
|
|
|
if (StringUtils.isBlank(item.getSe())) { |
|
|
|
|
item.setSe(""); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 补全商品信息 通过项目名称 |
|
|
|
|
* |
|
|
|
|
* @param item 订单明细数据 |
|
|
|
|
* @param commodity 从数据库查询的商品信息 |
|
|
|
|
* @author <a href="yaoxuguang@ele-cloud.com">yaoxuguang</a> |
|
|
|
|
* @date 2022-03-22 |
|
|
|
|
* @param item 订单明细数据 |
|
|
|
|
* @param commodity 从数据库查询的商品信息 |
|
|
|
|
*/ |
|
|
|
|
private void completeCommodityMessageByXmmc(OrderItemInfo item,CommodityCodeEntity commodity){ |
|
|
|
|
private void completeCommodityMessageByXmmc(OrderItemInfo item, CommodityCodeEntity commodity) { |
|
|
|
|
item.setSpbm(commodity.getSpbm()); |
|
|
|
|
//如果项目名称为空,使用底层返回数据进行补全,如果不为空,并且需要补全,则进行补全
|
|
|
|
|
String spmc = item.getXmmc(); |
|
|
|
@ -696,7 +746,7 @@ public class CommonInterfaceServiceImpl implements CommonInterfaceService { |
|
|
|
|
item.setSl(CommonUtils.formatSl(commodity.getSl())); |
|
|
|
|
} |
|
|
|
|
//发票行性质为折扣行,不补全,单价,数量,单位,规格型号
|
|
|
|
|
if(!OrderInfoEnum.FPHXZ_CODE_1.getKey().equals(item.getFphxz())){ |
|
|
|
|
if (!OrderInfoEnum.FPHXZ_CODE_1.getKey().equals(item.getFphxz())) { |
|
|
|
|
if (StringUtils.isEmpty(item.getGgxh()) && StringUtils.isNotEmpty(commodity.getGgxh())) { |
|
|
|
|
item.setGgxh(commodity.getGgxh()); |
|
|
|
|
} |
|
|
|
@ -784,8 +834,8 @@ public class CommonInterfaceServiceImpl implements CommonInterfaceService { |
|
|
|
|
orderProcessInfo.setOrderInfoId(orderId); |
|
|
|
|
//记录当前税控设备代码
|
|
|
|
|
orderProcessInfo.setSksbCode(terminalCode); |
|
|
|
|
if(CommonUtils.judgeIsQdfp("", orderProcessInfo.getFpzlDm()) |
|
|
|
|
&& StringUtils.isNotBlank(CommonUtils.getQdSksbdm(qdfwlx))){ |
|
|
|
|
if (CommonUtils.judgeIsQdfp("", orderProcessInfo.getFpzlDm()) |
|
|
|
|
&& StringUtils.isNotBlank(CommonUtils.getQdSksbdm(qdfwlx))) { |
|
|
|
|
orderProcessInfo.setSksbCode(CommonUtils.getQdSksbdm(qdfwlx)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -802,8 +852,8 @@ public class CommonInterfaceServiceImpl implements CommonInterfaceService { |
|
|
|
|
} |
|
|
|
|
//记录当前税控设备代码
|
|
|
|
|
orderInfo.setSksbCode(terminalCode); |
|
|
|
|
if(CommonUtils.judgeIsQdfp("", orderInfo.getFpzlDm()) |
|
|
|
|
&& StringUtils.isNotBlank(CommonUtils.getQdSksbdm(qdfwlx))){ |
|
|
|
|
if (CommonUtils.judgeIsQdfp("", orderInfo.getFpzlDm()) |
|
|
|
|
&& StringUtils.isNotBlank(CommonUtils.getQdSksbdm(qdfwlx))) { |
|
|
|
|
orderInfo.setSksbCode(CommonUtils.getQdSksbdm(qdfwlx)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -815,8 +865,8 @@ public class CommonInterfaceServiceImpl implements CommonInterfaceService { |
|
|
|
|
orderInvoiceInfo.setFply(orderProcessInfo.getDdly()); |
|
|
|
|
//记录当前税控设备代码
|
|
|
|
|
orderInvoiceInfo.setSksbdm(terminalCode); |
|
|
|
|
if(CommonUtils.judgeIsQdfp("", orderInvoiceInfo.getFpzlDm()) |
|
|
|
|
&& StringUtils.isNotBlank(CommonUtils.getQdSksbdm(qdfwlx))){ |
|
|
|
|
if (CommonUtils.judgeIsQdfp("", orderInvoiceInfo.getFpzlDm()) |
|
|
|
|
&& StringUtils.isNotBlank(CommonUtils.getQdSksbdm(qdfwlx))) { |
|
|
|
|
orderInvoiceInfo.setSksbdm(CommonUtils.getQdSksbdm(qdfwlx)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -831,7 +881,7 @@ public class CommonInterfaceServiceImpl implements CommonInterfaceService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//补全全电发票信息
|
|
|
|
|
if(Objects.nonNull(orderInfoQd)){ |
|
|
|
|
if (Objects.nonNull(orderInfoQd)) { |
|
|
|
|
orderInfoQd.setId(apiInvoiceCommonService.getGenerateShotKey()); |
|
|
|
|
orderInfoQd.setOrderId(orderInfo.getId()); |
|
|
|
|
orderInfoQd.setProcessId(orderInfo.getProcessId()); |
|
|
|
@ -840,7 +890,7 @@ public class CommonInterfaceServiceImpl implements CommonInterfaceService { |
|
|
|
|
orderInfoQd.setCreateTime(orderInfo.getCreateTime()); |
|
|
|
|
orderInfoQd.setUpdateTime(orderInfo.getUpdateTime()); |
|
|
|
|
|
|
|
|
|
if(CollectionUtil.isNotEmpty(orderInfoQd.getQdFjysList())){ |
|
|
|
|
if (CollectionUtil.isNotEmpty(orderInfoQd.getQdFjysList())) { |
|
|
|
|
for (QdFjys qdFjys : orderInfoQd.getQdFjysList()) { |
|
|
|
|
qdFjys.setId(apiInvoiceCommonService.getGenerateShotKey()); |
|
|
|
|
qdFjys.setOrderInfoQdId(orderInfoQd.getId()); |
|
|
|
@ -933,12 +983,12 @@ public class CommonInterfaceServiceImpl implements CommonInterfaceService { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void dealWithYfpxxAndChyy(OrderInfo orderInfo) { |
|
|
|
|
if(OrderInfoEnum.ORDER_BILLING_INVOICE_TYPE_1.getKey().equals(orderInfo.getKplx()) && |
|
|
|
|
OrderInfoEnum.ORDER_INVOICE_TYPE_2.getKey().equals(orderInfo.getFpzlDm()) || |
|
|
|
|
OrderInfoEnum.ORDER_INVOICE_TYPE_51.getKey().equals(orderInfo.getFpzlDm())){ |
|
|
|
|
if (OrderInfoEnum.ORDER_BILLING_INVOICE_TYPE_1.getKey().equals(orderInfo.getKplx()) && |
|
|
|
|
OrderInfoEnum.ORDER_INVOICE_TYPE_2.getKey().equals(orderInfo.getFpzlDm()) || |
|
|
|
|
OrderInfoEnum.ORDER_INVOICE_TYPE_51.getKey().equals(orderInfo.getFpzlDm())) { |
|
|
|
|
|
|
|
|
|
//如果是特殊冲红,清空原发票种类、原发票开票日期、冲红原因
|
|
|
|
|
if(OrderInfoEnum.TSCHBZ_1.getKey().equals(orderInfo.getTschbz())){ |
|
|
|
|
if (OrderInfoEnum.TSCHBZ_1.getKey().equals(orderInfo.getTschbz())) { |
|
|
|
|
orderInfo.setYfpFpzl(""); |
|
|
|
|
orderInfo.setYfpKprq(null); |
|
|
|
|
orderInfo.setChyy(""); |
|
|
|
@ -947,24 +997,24 @@ public class CommonInterfaceServiceImpl implements CommonInterfaceService { |
|
|
|
|
Date yfpkprq = orderInfo.getYfpKprq(); |
|
|
|
|
String chyy = orderInfo.getChyy(); |
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(yfplx) && Objects.nonNull(yfpkprq) && StringUtils.isNotBlank(chyy)){ |
|
|
|
|
if (StringUtils.isNotBlank(yfplx) && Objects.nonNull(yfpkprq) && StringUtils.isNotBlank(chyy)) { |
|
|
|
|
//判断冲红原因是否合法,如果不合法默认为2
|
|
|
|
|
if(!CommonUtils.isLegalChyy(chyy)){ |
|
|
|
|
if (!CommonUtils.isLegalChyy(chyy)) { |
|
|
|
|
orderInfo.setChyy(OrderInfoEnum.ORDER_CHYY_2.getKey()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(StringUtils.isBlank(yfplx) && Objects.isNull(yfpkprq) && StringUtils.isBlank(chyy)){ |
|
|
|
|
if (StringUtils.isBlank(yfplx) && Objects.isNull(yfpkprq) && StringUtils.isBlank(chyy)) { |
|
|
|
|
orderInfo.setChyy(OrderInfoEnum.ORDER_CHYY_2.getKey()); |
|
|
|
|
completeYfpxxAnChyy(orderInfo,yfplx,yfpkprq,orderInfo.getChyy()); |
|
|
|
|
completeYfpxxAnChyy(orderInfo, yfplx, yfpkprq, orderInfo.getChyy()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(StringUtils.isBlank(yfplx) && Objects.isNull(yfpkprq) && StringUtils.isNotBlank(chyy)){ |
|
|
|
|
if (StringUtils.isBlank(yfplx) && Objects.isNull(yfpkprq) && StringUtils.isNotBlank(chyy)) { |
|
|
|
|
//判断冲红原因是否合法,如果不合法默认为2
|
|
|
|
|
if(!CommonUtils.isLegalChyy(chyy)){ |
|
|
|
|
if (!CommonUtils.isLegalChyy(chyy)) { |
|
|
|
|
orderInfo.setChyy(OrderInfoEnum.ORDER_CHYY_2.getKey()); |
|
|
|
|
} |
|
|
|
|
completeYfpxxAnChyy(orderInfo,yfplx,yfpkprq,orderInfo.getChyy()); |
|
|
|
|
completeYfpxxAnChyy(orderInfo, yfplx, yfpkprq, orderInfo.getChyy()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -973,32 +1023,32 @@ public class CommonInterfaceServiceImpl implements CommonInterfaceService { |
|
|
|
|
boolean iszpCh = OrderInfoEnum.ORDER_BILLING_INVOICE_TYPE_1.getKey().equals(orderInfo.getKplx()) && |
|
|
|
|
(OrderInfoEnum.ORDER_INVOICE_TYPE_0.getKey().equals(orderInfo.getFpzlDm()) || |
|
|
|
|
OrderInfoEnum.ORDER_INVOICE_TYPE_52.getKey().equals(orderInfo.getFpzlDm())); |
|
|
|
|
if(iszpCh){ |
|
|
|
|
if (iszpCh) { |
|
|
|
|
orderInfo.setChyy(""); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void completeYfpxxAnChyy(OrderInfo orderInfo, String yfplx, Date yfpkprq, String chyy){ |
|
|
|
|
private void completeYfpxxAnChyy(OrderInfo orderInfo, String yfplx, Date yfpkprq, String chyy) { |
|
|
|
|
List<String> shList = NsrsbhUtils.transShListByXhfNsrsbh(orderInfo.getXhfNsrsbh()); |
|
|
|
|
//查询原发票信息
|
|
|
|
|
CommonOrderInvoiceAndOrderMxInfo commonOrderInvoiceAndOrderMxInfo = null; |
|
|
|
|
if(StringUtils.isNotBlank(orderInfo.getYfpDm()) && StringUtils.isNotBlank(orderInfo.getYfpHm())){ |
|
|
|
|
if (StringUtils.isNotBlank(orderInfo.getYfpDm()) && StringUtils.isNotBlank(orderInfo.getYfpHm())) { |
|
|
|
|
commonOrderInvoiceAndOrderMxInfo = orderInvoiceInfoService.selectOrderInvoiceInfoByFpdmFphmAndNsrsbh( |
|
|
|
|
orderInfo.getYfpDm(), orderInfo.getYfpHm(), shList); |
|
|
|
|
log.info("{},根据代码号码查询原发票信息,发票代码:{},发票号码{},查询结果{}", LOGGER_MSG, orderInfo.getYfpDm(), |
|
|
|
|
orderInfo.getYfpHm(), JsonUtils.getInstance().toJsonString(commonOrderInvoiceAndOrderMxInfo)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(Objects.nonNull(commonOrderInvoiceAndOrderMxInfo) && |
|
|
|
|
Objects.nonNull(commonOrderInvoiceAndOrderMxInfo.getOrderInfo())){ |
|
|
|
|
if(StringUtils.isBlank(yfplx)){ |
|
|
|
|
if (Objects.nonNull(commonOrderInvoiceAndOrderMxInfo) && |
|
|
|
|
Objects.nonNull(commonOrderInvoiceAndOrderMxInfo.getOrderInfo())) { |
|
|
|
|
if (StringUtils.isBlank(yfplx)) { |
|
|
|
|
orderInfo.setYfpFpzl(commonOrderInvoiceAndOrderMxInfo.getOrderInfo().getFpzlDm()); |
|
|
|
|
} |
|
|
|
|
if(Objects.isNull(yfpkprq)){ |
|
|
|
|
if (Objects.isNull(yfpkprq)) { |
|
|
|
|
orderInfo.setYfpKprq(commonOrderInvoiceAndOrderMxInfo.getOrderInvoiceInfo().getKprq()); |
|
|
|
|
} |
|
|
|
|
if(StringUtils.isBlank(chyy)){ |
|
|
|
|
if (StringUtils.isBlank(chyy)) { |
|
|
|
|
orderInfo.setChyy(commonOrderInvoiceAndOrderMxInfo.getOrderInfo().getChyy()); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|