|
|
|
@ -2,7 +2,15 @@ package com.dxhy.order.consumer.openapi.api; |
|
|
|
|
|
|
|
|
|
import com.dxhy.order.constant.ConfigureConstant; |
|
|
|
|
import com.dxhy.order.constant.ConfigurerInfo; |
|
|
|
|
import com.dxhy.order.constant.OrderInfoContentEnum; |
|
|
|
|
import com.dxhy.order.constant.OrderInfoEnum; |
|
|
|
|
import com.dxhy.order.consumer.config.OpenApiConfig; |
|
|
|
|
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.InterfaceServiceV6; |
|
|
|
|
import com.dxhy.order.utils.JsonUtils; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
@ -50,6 +58,56 @@ public class InvoiceOpenGateRestApi { |
|
|
|
|
@Resource |
|
|
|
|
private OpenApiConfig openApiConfig; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private InterfaceServiceV6 interfaceServiceV6; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 山能对外接口PO统一入口 |
|
|
|
|
* @param param |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@RequestMapping(path = "/v6/po", method = {RequestMethod.POST, RequestMethod.GET}) |
|
|
|
|
public String orderApiV6(@RequestBody String param, HttpServletRequest request) { |
|
|
|
|
|
|
|
|
|
log.info("{}-山能对外接口PO统一入口,请求数据为:{}", LOGGER_MESSAGE_V6, param); |
|
|
|
|
String token = request.getHeader("token"); |
|
|
|
|
if(StringUtils.isBlank(token) || !ConfigureConstant.POTOKEN.equals(token)){ |
|
|
|
|
return "非法请求,请停止访问!"; |
|
|
|
|
} |
|
|
|
|
//返回数据
|
|
|
|
|
String resultString = ""; |
|
|
|
|
try { |
|
|
|
|
PoCommonRequestParam requestParam = JsonUtils.getInstance().parseObject(param, PoCommonRequestParam.class); |
|
|
|
|
String interfaceName = ""; |
|
|
|
|
if(OrderInfoEnum.INTERFACE_BUSINESS_ID_FPKJ.getKey().equals(requestParam.getISINPUT().getIFYWID())){ |
|
|
|
|
interfaceName = ConfigurerInfo.GENERATE_QD_INVOICE; |
|
|
|
|
}else if(OrderInfoEnum.INTERFACE_BUSINESS_ID_DDZTGX.getKey().equals(requestParam.getISINPUT().getIFYWID())){ |
|
|
|
|
interfaceName = ConfigurerInfo.ORDER_STATUS_UPDATE; |
|
|
|
|
}else { |
|
|
|
|
log.error("{}-山能对外接口PO业务接口ID:{},未定义", LOGGER_MESSAGE_V6, requestParam.getISINPUT().getIFYWID()); |
|
|
|
|
return "请传输正确的业务ID"; |
|
|
|
|
} |
|
|
|
|
//保存请求报文
|
|
|
|
|
interfaceServiceV6.saveRequestData(interfaceName,param); |
|
|
|
|
//调用销项v6业务处理逻辑
|
|
|
|
|
long startTime = System.currentTimeMillis(); |
|
|
|
|
resultString = invoiceRestApiV6.orderApiV6HandingBusiness(interfaceName, param, ""); |
|
|
|
|
long endTime = System.currentTimeMillis(); |
|
|
|
|
log.info("{}-业务处理结果:{},接口耗时为:{}", LOGGER_MESSAGE_V6, resultString, endTime - startTime); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("{}-处理业务出现异常,异常原因为:{}", LOGGER_MESSAGE_V6, e.getMessage()); |
|
|
|
|
PoCommonResponseParam poCommonResponseParam = new PoCommonResponseParam(); |
|
|
|
|
EsOutput esOutput = new EsOutput(); |
|
|
|
|
esOutput.setBSKEY(""); |
|
|
|
|
esOutput.setSAPKEY(""); |
|
|
|
|
esOutput.setZTYPE(OrderInfoContentEnum.INVOICE_ERROR_CODE_OP_E.getKey()); |
|
|
|
|
esOutput.setZMESSAGE(e.getMessage()); |
|
|
|
|
poCommonResponseParam.setES_OUTPUT(esOutput); |
|
|
|
|
return JsonUtils.getInstance().toJsonString(poCommonResponseParam); |
|
|
|
|
} |
|
|
|
|
return resultString; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 订单对内V6接口 |
|
|
|
|