|
|
|
@ -23,6 +23,7 @@ import com.dxhy.order.consumer.dao.SkOrderInfoMapper; |
|
|
|
|
import com.dxhy.order.consumer.dao.SkOrderItemInfoMapper; |
|
|
|
|
import com.dxhy.order.consumer.dao.SkOrderMapper; |
|
|
|
|
import com.dxhy.order.consumer.dao.TInvoiceInvmapMapper; |
|
|
|
|
import com.dxhy.order.consumer.modules.bespoke.config.datasource.LuoxinBack; |
|
|
|
|
import com.dxhy.order.consumer.modules.bespoke.config.datasource.config.DynamicContextHolder; |
|
|
|
|
import com.dxhy.order.consumer.modules.bespoke.model.req.FileModel; |
|
|
|
|
import com.dxhy.order.consumer.modules.bespoke.model.req.ReqParam; |
|
|
|
@ -35,13 +36,16 @@ import com.dxhy.order.consumer.modules.bespoke.service.OrderService; |
|
|
|
|
import com.dxhy.order.consumer.openapi.protocol.v4.order.*; |
|
|
|
|
import com.dxhy.order.consumer.openapi.protocol.v6.order.QdTxxBO; |
|
|
|
|
import com.dxhy.order.consumer.openapi.service.AllocateInvoiceInterfaceServiceV3; |
|
|
|
|
import com.dxhy.order.invoice.module.invoice.dao.OrderInfoMapper; |
|
|
|
|
import com.dxhy.order.invoice.module.invoice.dao.OrderItemInfoMapper; |
|
|
|
|
import com.dxhy.order.invoice.module.invoice.service.OrderInvoiceInfoService; |
|
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
|
import com.github.pagehelper.page.PageMethod; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.math.RoundingMode; |
|
|
|
@ -81,6 +85,9 @@ public class SkOrderServiceImpl implements OrderService { |
|
|
|
|
@Resource |
|
|
|
|
private TInvoiceInvmapMapper tInvoiceInvmapMapper; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private LuoxinBack luoxinBack; |
|
|
|
|
|
|
|
|
|
// 订单读入
|
|
|
|
|
@Override |
|
|
|
|
public R orderRead(ReqParam reqParam) { |
|
|
|
@ -100,7 +107,7 @@ public class SkOrderServiceImpl implements OrderService { |
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(skOrderItemInfoList)) { |
|
|
|
|
DynamicContextHolder.push(ConfigureConstant.MAIN); |
|
|
|
|
count+= saveOrder(skOrderInfo, skOrderItemInfoList, reqParam); |
|
|
|
|
count += saveOrder(skOrderInfo, skOrderItemInfoList, reqParam); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -125,7 +132,7 @@ public class SkOrderServiceImpl implements OrderService { |
|
|
|
|
public R delOrder(ReqParam reqParam) { |
|
|
|
|
int count = skOrderInfoMapper.delOrder(reqParam); |
|
|
|
|
skOrderItemInfoMapper.delOrder(reqParam.getIds()); |
|
|
|
|
return R.ok("成功删除"+count+"条订单数据"); |
|
|
|
|
return R.ok("成功删除" + count + "条订单数据"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -154,8 +161,8 @@ public class SkOrderServiceImpl implements OrderService { |
|
|
|
|
for (SkOrderInfo skOrderInfo : skOrderInfoList) { |
|
|
|
|
try { |
|
|
|
|
List<SkOrderItemInfo> skOrderItemInfoList = skOrderItemInfoMapper.queryOrderItemInfo(skOrderInfo.getId()); |
|
|
|
|
if (CollectionUtils.isNotEmpty(skOrderItemInfoList)){ |
|
|
|
|
DdpcxxReqBO ddpcxxReqBO = transitionReadData(skOrderInfo,skOrderItemInfoList, deptEntity); |
|
|
|
|
if (CollectionUtils.isNotEmpty(skOrderItemInfoList)) { |
|
|
|
|
DdpcxxReqBO ddpcxxReqBO = transitionReadData(skOrderInfo, skOrderItemInfoList, deptEntity); |
|
|
|
|
DdpcxxRspBO ddpcxxRspBO = allocateInvoiceInterfaceServiceImplV3.allocateInvoicesV3(ddpcxxReqBO, "", null, ConfigurerInfo.INTERFACE_VERSION_V6); |
|
|
|
|
log.debug("V3生成预制返回信息:{}", JSON.toJSONString(ddpcxxRspBO)); |
|
|
|
|
String format = String.format(message, skOrderInfo.getXsddm(), ddpcxxRspBO.getZTXX()); |
|
|
|
@ -164,7 +171,7 @@ public class SkOrderServiceImpl implements OrderService { |
|
|
|
|
} else { |
|
|
|
|
backMessage.add(format); |
|
|
|
|
} |
|
|
|
|
}else { |
|
|
|
|
} else { |
|
|
|
|
backMessage.add(String.format(message, skOrderInfo.getXsddm(), "订单明细信息丢失请删除重新读入")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -179,56 +186,60 @@ public class SkOrderServiceImpl implements OrderService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R backMsg(OrderInvoiceInfo orderInvoiceInfo, List<OrderOriginExtendInfo> orderOriginExtendInfos, FileModel fileModel,String ddh) { |
|
|
|
|
public R backMsg(OrderInvoiceInfo orderInvoiceInfo, List<OrderOriginExtendInfo> orderOriginExtendInfos, FileModel fileModel, String ddh) { |
|
|
|
|
|
|
|
|
|
for (OrderOriginExtendInfo orderOriginExtendInfo : orderOriginExtendInfos) { |
|
|
|
|
|
|
|
|
|
List<OrderItemInfo> orderItemInfos = orderItemInfoMapper.selectOrderItemInfoByOrderId(orderOriginExtendInfo.getOriginOrderId(), Arrays.asList(orderInvoiceInfo.getXhfNsrsbh())); |
|
|
|
|
if (CollectionUtils.isNotEmpty(orderItemInfos)){ |
|
|
|
|
if (CollectionUtils.isNotEmpty(orderItemInfos)) { |
|
|
|
|
for (OrderItemInfo orderItemInfo : orderItemInfos) { |
|
|
|
|
BackProduct backProduct = new BackProduct(); |
|
|
|
|
backProduct.setFphm(orderInvoiceInfo.getSdfphm()); |
|
|
|
|
backProduct.setDjbh(orderOriginExtendInfo.getOriginDdh()); |
|
|
|
|
backProduct.setMxxh(orderItemInfo.getSphxh()); |
|
|
|
|
backProduct.setKprq(DateUtil.formatDate(orderInvoiceInfo.getKprq())); |
|
|
|
|
backProduct.setBz(orderItemInfo.getBz()==null?"":orderItemInfo.getBz()); |
|
|
|
|
backProduct.setKpr(orderInvoiceInfo.getKpr()==null?"":orderInvoiceInfo.getKpr()); |
|
|
|
|
backProduct.setBz(orderItemInfo.getBz() == null ? "" : orderItemInfo.getBz()); |
|
|
|
|
backProduct.setKpr(orderInvoiceInfo.getKpr() == null ? "" : orderInvoiceInfo.getKpr()); |
|
|
|
|
backProduct.setSpsl(new BigDecimal(orderItemInfo.getXmsl())); |
|
|
|
|
backProduct.setDj(new BigDecimal(orderItemInfo.getXmdj())); |
|
|
|
|
backProduct.setJe(new BigDecimal(orderItemInfo.getXmje())); |
|
|
|
|
backProduct.setSl(new BigDecimal(orderItemInfo.getSl())); |
|
|
|
|
backProduct.setSe(new BigDecimal(orderItemInfo.getSe())); |
|
|
|
|
backProduct.setMark(ConfigureConstant.KP); |
|
|
|
|
if (ConfigureConstant.STRING_1.equals(orderInvoiceInfo.getKplx())){ |
|
|
|
|
backProduct.setDjbh(orderItemInfo.getByzd2()); |
|
|
|
|
if (ConfigureConstant.STRING_1.equals(orderInvoiceInfo.getKplx())) { |
|
|
|
|
backProduct.setDjbh(ddh); |
|
|
|
|
backProduct.setMark(ConfigureConstant.CH); |
|
|
|
|
} |
|
|
|
|
DynamicContextHolder.push(orderInvoiceInfo.getXhfNsrsbh()); |
|
|
|
|
log.info("调用存储过程参数:{}", JSON.toJSONString(backProduct)); |
|
|
|
|
skOrderMapper.callProcedure(backProduct); |
|
|
|
|
|
|
|
|
|
if (ConfigureConstant.STRING_0.equals(orderInvoiceInfo.getKplx())){ |
|
|
|
|
//回写创建表
|
|
|
|
|
DynamicContextHolder.push(orderInvoiceInfo.getXhfNsrsbh()); |
|
|
|
|
BackDjbh backDjbh = skOrderMapper.selectBackDjbh(orderItemInfo.getByzd2()); |
|
|
|
|
NewTable newTable = new NewTable(); |
|
|
|
|
if (backDjbh != null){ |
|
|
|
|
newTable.setCDLCode(backDjbh.getDjbh()); |
|
|
|
|
newTable.setBpmNo(backDjbh.getBpmNo()); |
|
|
|
|
newTable.setBpmlsNo(backDjbh.getBpmlsNo()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
newTable.setInvoiceNo(orderInvoiceInfo.getSdfphm()); |
|
|
|
|
newTable.setInvoiceTime(orderInvoiceInfo.getKprq()); |
|
|
|
|
newTable.setInvoiceAmount(orderInvoiceInfo.getKphjje()); |
|
|
|
|
newTable.setInvoicePhoto(fileModel.getFilePath()); |
|
|
|
|
newTable.setInvoiceFilename(fileModel.getFileName()); |
|
|
|
|
newTable.setOperater(orderInvoiceInfo.getKpr()); |
|
|
|
|
newTable.setOperateDate(orderInvoiceInfo.getKprq()); |
|
|
|
|
DynamicContextHolder.push(ConfigureConstant.MAIN); |
|
|
|
|
tInvoiceInvmapMapper.deleteBackMsg(newTable.getCDLCode()); |
|
|
|
|
tInvoiceInvmapMapper.insertBackMsg(newTable); |
|
|
|
|
//回写创建表
|
|
|
|
|
DynamicContextHolder.push(orderInvoiceInfo.getXhfNsrsbh()); |
|
|
|
|
String xgdjbh = orderItemInfo.getByzd2(); |
|
|
|
|
if (ConfigureConstant.STRING_1.equals(orderInvoiceInfo.getKplx())) { |
|
|
|
|
xgdjbh = ddh; |
|
|
|
|
} |
|
|
|
|
BackDjbh backDjbh = skOrderMapper.selectBackDjbh(xgdjbh); |
|
|
|
|
NewTable newTable = new NewTable(); |
|
|
|
|
if (backDjbh != null) { |
|
|
|
|
newTable.setCDLCode(backDjbh.getDjbh()); |
|
|
|
|
newTable.setBpmNo(backDjbh.getBpmNo()); |
|
|
|
|
newTable.setBpmlsNo(backDjbh.getBpmlsNo()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
newTable.setInvoiceNo(orderInvoiceInfo.getSdfphm()); |
|
|
|
|
newTable.setInvoiceTime(orderInvoiceInfo.getKprq()); |
|
|
|
|
newTable.setInvoiceAmount(orderInvoiceInfo.getKphjje()); |
|
|
|
|
newTable.setInvoicePhoto(fileModel.getFilePath()); |
|
|
|
|
newTable.setInvoiceFilename(fileModel.getFileName()); |
|
|
|
|
newTable.setOperater(orderInvoiceInfo.getKpr()); |
|
|
|
|
newTable.setOperateDate(orderInvoiceInfo.getKprq()); |
|
|
|
|
newTable.setShipper(luoxinBack.getWrite(orderInvoiceInfo.getXhfNsrsbh())); |
|
|
|
|
DynamicContextHolder.push(ConfigureConstant.MAIN); |
|
|
|
|
tInvoiceInvmapMapper.deleteBackMsg(newTable.getCDLCode()); |
|
|
|
|
tInvoiceInvmapMapper.insertBackMsg(newTable); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -243,7 +254,7 @@ public class SkOrderServiceImpl implements OrderService { |
|
|
|
|
|
|
|
|
|
//校验订单信息是否存在
|
|
|
|
|
SkOrderInfo skOrderInfoExist = skOrderInfoMapper.checkOrderExist(skOrderInfo.getXsddm()); |
|
|
|
|
if (skOrderInfoExist != null){ |
|
|
|
|
if (skOrderInfoExist != null) { |
|
|
|
|
log.debug("订单信息已存在,订单编号:{}", skOrderInfoExist.getXsddm()); |
|
|
|
|
return ConfigureConstant.INT_0; |
|
|
|
|
} |
|
|
|
@ -269,10 +280,10 @@ public class SkOrderServiceImpl implements OrderService { |
|
|
|
|
skOrderInfo.setDetailCount(String.valueOf(skOrderItemInfoList.size())); |
|
|
|
|
skOrderInfo.setCreateTime(now); |
|
|
|
|
skOrderInfo.setHsje(hsje.setScale(ConfigureConstant.INT_2, RoundingMode.HALF_UP).toPlainString()); |
|
|
|
|
skOrderInfo.setSe(se.setScale(ConfigureConstant.INT_2,RoundingMode.HALF_UP).toPlainString()); |
|
|
|
|
skOrderInfo.setSe(se.setScale(ConfigureConstant.INT_2, RoundingMode.HALF_UP).toPlainString()); |
|
|
|
|
|
|
|
|
|
String fplx = ConfigureConstant.STRING_002; |
|
|
|
|
if ("增值税专用发票".equals(skOrderInfo.getFplx())){ |
|
|
|
|
if ("增值税专用发票".equals(skOrderInfo.getFplx())) { |
|
|
|
|
fplx = ConfigureConstant.STRING_001; |
|
|
|
|
} |
|
|
|
|
skOrderInfo.setFplx(fplx); |
|
|
|
@ -281,7 +292,7 @@ public class SkOrderServiceImpl implements OrderService { |
|
|
|
|
return ConfigureConstant.INT_1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public DdpcxxReqBO transitionReadData(SkOrderInfo skOrderInfo,List<SkOrderItemInfo> skOrderItemInfoList, DeptEntity deptEntity) { |
|
|
|
|
public DdpcxxReqBO transitionReadData(SkOrderInfo skOrderInfo, List<SkOrderItemInfo> skOrderItemInfoList, DeptEntity deptEntity) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TaxEquipmentInfo taxEquipmentInfo = simsBackService.queryTaxEquipment(deptEntity.getTaxpayerCode(), deptEntity.getDeptId()); |
|
|
|
@ -343,7 +354,7 @@ public class SkOrderServiceImpl implements OrderService { |
|
|
|
|
ddmxxxBO.setSPSL(sl); |
|
|
|
|
ddmxxxBO.setJE(new BigDecimal(orderItemInfo.getHsje()).setScale(ConfigureConstant.INT_2, RoundingMode.HALF_UP).toPlainString()); |
|
|
|
|
ddmxxxBO.setSL(new BigDecimal(orderItemInfo.getSl()).divide(new BigDecimal(ConfigureConstant.STRING_100)).toPlainString()); |
|
|
|
|
ddmxxxBO.setSE(new BigDecimal(orderItemInfo.getSe()).setScale(ConfigureConstant.INT_2,RoundingMode.HALF_UP).toPlainString()); |
|
|
|
|
ddmxxxBO.setSE(new BigDecimal(orderItemInfo.getSe()).setScale(ConfigureConstant.INT_2, RoundingMode.HALF_UP).toPlainString()); |
|
|
|
|
ddmxxxBO.setDJ(getDynamicLengthDecimal(ddmxxxBO.getJE(), ddmxxxBO.getSPSL())); |
|
|
|
|
ddmxxxBO.setFPHXZ(ConfigureConstant.STRING_0); |
|
|
|
|
ddmxxxBO.setHSBZ(ConfigureConstant.STRING_1); |
|
|
|
|