|
|
|
@ -20,6 +20,7 @@ import com.dxhy.order.baseservice.module.commodity.model.CommodityCodeEnum; |
|
|
|
|
import com.dxhy.order.baseservice.module.groupmanagement.dao.GroupManagementMapper; |
|
|
|
|
import com.dxhy.order.baseservice.module.taxclass.dao.TaxClassCodeMapper; |
|
|
|
|
import com.dxhy.order.baseservice.module.taxclass.model.TaxClassCodeEntity; |
|
|
|
|
import com.dxhy.order.baseservice.module.thirdservice.rabbitmq.service.RabbitMqSendMessageService; |
|
|
|
|
import com.dxhy.order.baseservice.module.thirdservice.simsback.service.SimsBackService; |
|
|
|
|
import com.dxhy.order.baseservice.module.thirdservice.user.model.DeptEntity; |
|
|
|
|
import com.dxhy.order.baseservice.module.thirdservice.user.service.UserInfoService; |
|
|
|
@ -40,6 +41,7 @@ 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.IsInput; |
|
|
|
|
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; |
|
|
|
@ -63,10 +65,11 @@ import com.dxhy.order.model.newsk.taxpayerinfo.TaxpayerInfoResponse; |
|
|
|
|
import com.dxhy.order.model.qd.OrderInfoQd; |
|
|
|
|
import com.dxhy.order.model.qdsk.taxpayerinfo.Kysl; |
|
|
|
|
import com.dxhy.order.model.qdsk.taxpayerinfo.Qdjcxx; |
|
|
|
|
import com.dxhy.order.model.queue.CommonTsMqData; |
|
|
|
|
import com.dxhy.order.model.queue.FpTsMqData; |
|
|
|
|
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 org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
@ -194,6 +197,11 @@ public class OrderInfoServiceImpl implements OrderInfoService { |
|
|
|
|
@Resource |
|
|
|
|
private InvoiceDataService invoiceDataService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private RabbitMqSendMessageService rabbitMqSendMessageService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DecimalFormat format = new DecimalFormat("#.###"); |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -2275,27 +2283,40 @@ public class OrderInfoServiceImpl implements OrderInfoService { |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
// 调用sap获取报账单号状态
|
|
|
|
|
IsInput isInput = new IsInput(); |
|
|
|
|
isInput.setSYSID(OrderInfoEnum.SYS_SIGN_FP.getKey()); |
|
|
|
|
isInput.setIFYWID(OrderInfoEnum.INTERFACE_BUSINESS_ID_GSCLIENT.getKey()); |
|
|
|
|
isInput.setBSKEY(UUID.randomUUID().toString().replace("-", " ")); |
|
|
|
|
isInput.setZORG(""); |
|
|
|
|
isInput.setZFILED5(baseServiceConfig.getPoClient()); |
|
|
|
|
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 zdata1 = JsonUtils.getInstance().toJsonString(replaceOdd); |
|
|
|
|
isInput.setZDATA(zdata1); |
|
|
|
|
PoCommonRequestParam poCommonRequestParam = new PoCommonRequestParam(); |
|
|
|
|
poCommonRequestParam.setIS_INPUT(isInput); |
|
|
|
|
String param = JsonUtils.getInstance().toJsonString(poCommonRequestParam); |
|
|
|
|
log.info("{}获取公司client入参:{}",LOGGER_MSG,param); |
|
|
|
|
String result = HttpUtils.sendPo(baseServiceConfig.getPoUrl(), param,baseServiceConfig.getPoUserName(),baseServiceConfig.getPoPassword()); |
|
|
|
|
log.info("{}获取公司client出参:{}",LOGGER_MSG,result); |
|
|
|
|
PoCommonResponseParam poCommonResponseParam = JsonUtils.getInstance().parseObject(result, PoCommonResponseParam.class); |
|
|
|
|
EsOutput es_output = poCommonResponseParam.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("该报账单号状态不允许替换"); |
|
|
|
|
Object zdata = es_output.getZDATA(); |
|
|
|
|
log.info("{},替换报账单号,替换信息:{}",JsonUtils.getInstance().toJsonString(poCommonResponseParam)); |
|
|
|
|
List<String> statusList = new ArrayList<>(); |
|
|
|
|
if(OrderInfoContentEnum.INVOICE_ERROR_CODE_OP_S.getKey().equals(ztype)){ |
|
|
|
|
List<Map<String,String>> gsClientList = JsonUtils.getInstance().parseObject(zdata.toString(), List.class); |
|
|
|
|
gsClientList.stream().forEach(f -> { |
|
|
|
|
String status = ObjectUtil.isNull(f.get("BZDZT"))?"":f.get("BZDZT").toString(); |
|
|
|
|
statusList.add(status); |
|
|
|
|
}); |
|
|
|
|
for (String bzdzt : statusList) { |
|
|
|
|
if ("50".equals(bzdzt)){ |
|
|
|
|
log.error("{}sap报账单号状态不允许替换,报账单号状态:{}",LOGGER_MSG,bzdzt); |
|
|
|
|
return R.error("该报账单号状态不允许替换"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
OrderInfo newOrderInfo = orderMapper.findByFpqqlish(replaceOddDTO.getBzdh()); |
|
|
|
|
if (newOrderInfo == null){ |
|
|
|
@ -2324,12 +2345,7 @@ public class OrderInfoServiceImpl implements OrderInfoService { |
|
|
|
|
orderInvoiceInfo.setOrderInfoId(newOrderInfo.getId()); |
|
|
|
|
orderInvoiceInfo.setOrderProcessInfoId(newOrderInfo.getProcessId()); |
|
|
|
|
orderInvoiceInfo.setFpqqlsh(newOrderInfo.getFpqqlsh()); |
|
|
|
|
resultList.add(orderInvoiceInfo); |
|
|
|
|
} |
|
|
|
|
// 删除原报账单号
|
|
|
|
|
deleteBzdh(replaceOddDTO.getOrderId()); |
|
|
|
|
// 替换报账单号
|
|
|
|
|
for (OrderInvoiceInfo orderInvoiceInfo : resultList) { |
|
|
|
|
orderInvoiceInfo.setDdh(newOrderInfo.getDdh()); |
|
|
|
|
int count = orderInvoiceInfoMapper.updateOrderInvoiceInfoById(orderInvoiceInfo); |
|
|
|
|
if (count > 0){ |
|
|
|
|
log.info("{}替换报账单号接口,更新发票信息成功,发票信息:{}",LOGGER_MSG, |
|
|
|
@ -2338,14 +2354,35 @@ public class OrderInfoServiceImpl implements OrderInfoService { |
|
|
|
|
log.error("{}替换报账单号接口,更新发票信息失败,发票信息:{}",LOGGER_MSG, |
|
|
|
|
JsonUtils.getInstance().toJsonString(orderInvoiceInfo)); |
|
|
|
|
} |
|
|
|
|
resultList.add(orderInvoiceInfo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 删除原报账单号
|
|
|
|
|
deleteBzdh(replaceOddDTO.getOrderId()); |
|
|
|
|
// 回推sap系统
|
|
|
|
|
for (OrderInvoiceInfo orderInvoiceInfo : resultList) { |
|
|
|
|
FpTsMqData fpTsMqData = new FpTsMqData(); |
|
|
|
|
fpTsMqData.setFpqqlsh(orderInvoiceInfo.getFpqqlsh()); |
|
|
|
|
fpTsMqData.setFpdm(orderInvoiceInfo.getFpdm()); |
|
|
|
|
fpTsMqData.setFphm(orderInvoiceInfo.getFphm()); |
|
|
|
|
fpTsMqData.setNsrsbh(orderInvoiceInfo.getXhfNsrsbh()); |
|
|
|
|
fpTsMqData.setForcePush(true); |
|
|
|
|
CommonTsMqData commonTsMqData = new CommonTsMqData(); |
|
|
|
|
commonTsMqData.setPushType(OrderInfoEnum.INTERFACE_TYPE_INVOICE_PUSH_STATUS_1.getKey()); |
|
|
|
|
commonTsMqData.setNsrsbh(orderInvoiceInfo.getXhfNsrsbh()); |
|
|
|
|
commonTsMqData.setEntId(orderInvoiceInfo.getEntId()); |
|
|
|
|
commonTsMqData.setFpTsMqData(fpTsMqData); |
|
|
|
|
rabbitMqSendMessageService.autoSendRabbitMqMessageForBusiness(NsrQueueEnum.PUSH_MESSAGE.getValue(), JsonUtils.getInstance().toJsonString(commonTsMqData)); |
|
|
|
|
} |
|
|
|
|
return R.ok("替换成功"); |
|
|
|
|
}else { |
|
|
|
|
log.error("{}调用sap系统出错,结果不是S,返回错误信息:{}",LOGGER_MSG,zmessage); |
|
|
|
|
}*/ |
|
|
|
|
return R.error("替换失败,调用sap返回信息有误"); |
|
|
|
|
} |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
log.error("{},替换保证单号接口异常,异常信息:{}",LOGGER_MSG,e.getMessage()); |
|
|
|
|
return R.error("替换失败"); |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 删除原报账单信息
|
|
|
|
|