|
|
|
@ -32,14 +32,16 @@ import com.dxhy.order.consumer.model.OderDetailInfo; |
|
|
|
|
import com.dxhy.order.consumer.model.PageOrderExt; |
|
|
|
|
import com.dxhy.order.consumer.model.page.PageRequestVO; |
|
|
|
|
import com.dxhy.order.consumer.modules.manager.service.InvoiceDataService; |
|
|
|
|
import com.dxhy.order.consumer.modules.order.model.PageInvoiceItem; |
|
|
|
|
import com.dxhy.order.consumer.modules.order.model.PageKySlReq; |
|
|
|
|
import com.dxhy.order.consumer.modules.order.model.PageKySlRsp; |
|
|
|
|
import com.dxhy.order.consumer.modules.order.model.*; |
|
|
|
|
import com.dxhy.order.consumer.modules.order.model.bo.YwlxCountTotalBO; |
|
|
|
|
import com.dxhy.order.consumer.modules.order.model.dto.ReplaceOddDTO; |
|
|
|
|
import com.dxhy.order.consumer.modules.order.model.vo.OrderInfoTotalAmountVO; |
|
|
|
|
import com.dxhy.order.consumer.modules.order.model.vo.OrderInfoVo; |
|
|
|
|
import com.dxhy.order.consumer.modules.order.service.*; |
|
|
|
|
import com.dxhy.order.consumer.modules.validate.service.ValidateOrderInfoService; |
|
|
|
|
import com.dxhy.order.consumer.openapi.protocol.po.EsOutput; |
|
|
|
|
import com.dxhy.order.consumer.openapi.protocol.po.PoCommonRequestParam; |
|
|
|
|
import com.dxhy.order.consumer.openapi.protocol.po.PoCommonResponseParam; |
|
|
|
|
import com.dxhy.order.consumer.openapi.service.CommonInterfaceService; |
|
|
|
|
import com.dxhy.order.consumer.utils.BeanTransitionUtils; |
|
|
|
|
import com.dxhy.order.consumer.utils.PageDataDealUtil; |
|
|
|
@ -2267,6 +2269,111 @@ public class OrderInfoServiceImpl implements OrderInfoService { |
|
|
|
|
return R.ok(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 功能描述: 替换报账单号 |
|
|
|
|
* @param replaceOddDTO |
|
|
|
|
* @return : com.dxhy.order.model.R |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public R replaceOdd(ReplaceOddDTO replaceOddDTO) { |
|
|
|
|
if (StringUtils.isBlank(replaceOddDTO.getOrderId())){ |
|
|
|
|
log.error("{},替换报账单号接口传入订单id为空",LOGGER_MSG); |
|
|
|
|
return R.error("传入订单id为空"); |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isBlank(replaceOddDTO.getOrderId())){ |
|
|
|
|
log.error("{},替换报账单号接口传入报账单号为空",LOGGER_MSG); |
|
|
|
|
return R.error("传入报账单号为空"); |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
// 调用sap获取报账单号状态
|
|
|
|
|
ReplaceOdd replaceOdd = new ReplaceOdd(); |
|
|
|
|
replaceOdd.setMANDT(baseServiceConfig.getPoClient()); |
|
|
|
|
replaceOdd.setZBZDH(replaceOddDTO.getBzdh()); |
|
|
|
|
ReplaceOddParam replaceOddParam = new ReplaceOddParam(); |
|
|
|
|
replaceOddParam.setIS_INPUT(replaceOdd); |
|
|
|
|
String param = JsonUtils.getInstance().toJsonString(replaceOddParam); |
|
|
|
|
log.info("{}调用sap,获取报账单号状态入参:{}",LOGGER_MSG,param); |
|
|
|
|
String result = HttpUtils.sendPo(baseServiceConfig.getPoUrl(), param,baseServiceConfig.getPoUserName(), |
|
|
|
|
baseServiceConfig.getPoPassword()); |
|
|
|
|
log.info("{}调用sap,获取报账单号状态出参:{}",LOGGER_MSG,result); |
|
|
|
|
ReplaceOddResponseParam replaceOddResponseParam = JsonUtils.getInstance().parseObject(result, |
|
|
|
|
ReplaceOddResponseParam.class); |
|
|
|
|
ReplaceOddResponse es_output = replaceOddResponseParam.getES_OUTPUT(); |
|
|
|
|
String ztype = es_output.getZTYPE(); |
|
|
|
|
String zmessage = es_output.getZMESSAGE(); |
|
|
|
|
String bzdzt = es_output.getBZDZT(); |
|
|
|
|
log.info("{},替换报账单号,替换信息:{}",JsonUtils.getInstance().toJsonString(es_output)); |
|
|
|
|
/*if(OrderInfoContentEnum.INVOICE_ERROR_CODE_OP_S.getKey().equals(ztype)){ |
|
|
|
|
if ("50".equals(bzdzt)){ |
|
|
|
|
log.error("{}sap报账单号状态不允许替换,报账单号状态:{}",LOGGER_MSG,bzdzt); |
|
|
|
|
return R.error("该报账单号状态不允许替换"); |
|
|
|
|
} |
|
|
|
|
OrderInfo newOrderInfo = orderMapper.findByFpqqlish(replaceOddDTO.getBzdh()); |
|
|
|
|
if (newOrderInfo == null){ |
|
|
|
|
log.error("{}输入报账单号在该系统未查询到信息,不允许替换",LOGGER_MSG); |
|
|
|
|
return R.error("输入报账单号在该系统未查询到信息,不允许替换"); |
|
|
|
|
} |
|
|
|
|
OrderInfo yOrderInfo = orderMapper.findByOrderId(replaceOddDTO.getOrderId()); |
|
|
|
|
// 判断金额是否一致
|
|
|
|
|
if (!(yOrderInfo.getKphjje().equals(newOrderInfo.getKphjje()))){ |
|
|
|
|
log.error("{}两张报账单金额不一致,不允许替换",LOGGER_MSG); |
|
|
|
|
return R.error("两张报账单金额不一致,不允许替换"); |
|
|
|
|
} |
|
|
|
|
List<OrderInvoiceInfo> orderInvoiceInfoList = orderInvoiceInfoMapper.findByOrderId(replaceOddDTO.getOrderId()); |
|
|
|
|
if (orderInvoiceInfoList == null || orderInvoiceInfoList.size() <= 0){ |
|
|
|
|
log.error("{}原报账单号在该系统未查询到发票信息,不允许替换",LOGGER_MSG); |
|
|
|
|
return R.error("原报账单号在该系统未查询到发票信息,不允许替换"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 校验原报账单号是否开票成功
|
|
|
|
|
List<OrderInvoiceInfo> resultList = new ArrayList<>(); |
|
|
|
|
for (OrderInvoiceInfo orderInvoiceInfo : orderInvoiceInfoList) { |
|
|
|
|
if (!("2".equals(orderInvoiceInfo.getKpzt()))){ |
|
|
|
|
log.error("{}原报账单号未开票成功,不允许替换",LOGGER_MSG); |
|
|
|
|
return R.error("原报账单号未开票成功,不允许替换"); |
|
|
|
|
} |
|
|
|
|
orderInvoiceInfo.setOrderInfoId(newOrderInfo.getId()); |
|
|
|
|
orderInvoiceInfo.setOrderProcessInfoId(newOrderInfo.getProcessId()); |
|
|
|
|
orderInvoiceInfo.setFpqqlsh(newOrderInfo.getFpqqlsh()); |
|
|
|
|
resultList.add(orderInvoiceInfo); |
|
|
|
|
} |
|
|
|
|
// 删除原报账单号
|
|
|
|
|
deleteBzdh(replaceOddDTO.getOrderId()); |
|
|
|
|
// 替换报账单号
|
|
|
|
|
for (OrderInvoiceInfo orderInvoiceInfo : resultList) { |
|
|
|
|
int count = orderInvoiceInfoMapper.updateOrderInvoiceInfoById(orderInvoiceInfo); |
|
|
|
|
if (count > 0){ |
|
|
|
|
log.info("{}替换报账单号接口,更新发票信息成功,发票信息:{}",LOGGER_MSG, |
|
|
|
|
JsonUtils.getInstance().toJsonString(orderInvoiceInfo)); |
|
|
|
|
}else { |
|
|
|
|
log.error("{}替换报账单号接口,更新发票信息失败,发票信息:{}",LOGGER_MSG, |
|
|
|
|
JsonUtils.getInstance().toJsonString(orderInvoiceInfo)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else { |
|
|
|
|
log.error("{}调用sap系统出错,结果不是S,返回错误信息:{}",LOGGER_MSG,zmessage); |
|
|
|
|
}*/ |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
log.error("{},替换保证单号接口异常,异常信息:{}",LOGGER_MSG,e.getMessage()); |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 删除原报账单信息
|
|
|
|
|
private void deleteBzdh(String orderId){ |
|
|
|
|
try { |
|
|
|
|
int countOrderInfo = orderMapper.deleteByOrderId(orderId); |
|
|
|
|
int countOrderProcessInfo = orderProcessInfoMapper.deleteByOrderId(orderId); |
|
|
|
|
int countItem = orderItemInfoMapper.deleteByOrderId(orderId); |
|
|
|
|
log.info("{}替换报账单号,删除原报账单信息:{},{},{}",LOGGER_MSG,countOrderInfo,countOrderProcessInfo,countItem); |
|
|
|
|
if (countOrderInfo > 0 && countOrderProcessInfo > 0 && countItem > 0){ |
|
|
|
|
log.info("{}替换报账单号,删除原报账单信息成功",LOGGER_MSG); |
|
|
|
|
} |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
log.error("{},替换报账单号,删除原报账单号异常,异常信息:{}",LOGGER_MSG,e.getMessage()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void completeCommodityMessageBySpid(OrderItemInfo item, CommodityCodeEntity commodity) { |
|
|
|
|
//商品编码
|
|
|
|
|
item.setSpbm(commodity.getSpbm()); |
|
|
|
|