Merge branch 'test' of http://192.168.12.182/invoice/sims-order into test
commit
86f1dfa2ab
@ -0,0 +1,17 @@ |
|||||||
|
package com.dxhy.order.consumer.dao; |
||||||
|
|
||||||
|
import com.dxhy.order.consumer.model.PushInfoRecord; |
||||||
|
|
||||||
|
public interface PushInfoRecordMapper { |
||||||
|
int deleteByPrimaryKey(Long id); |
||||||
|
|
||||||
|
int insert(PushInfoRecord record); |
||||||
|
|
||||||
|
int insertSelective(PushInfoRecord record); |
||||||
|
|
||||||
|
PushInfoRecord selectByPrimaryKey(Long id); |
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(PushInfoRecord record); |
||||||
|
|
||||||
|
int updateByPrimaryKey(PushInfoRecord record); |
||||||
|
} |
@ -0,0 +1,46 @@ |
|||||||
|
package com.dxhy.order.consumer.model; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class PushInfoRecord { |
||||||
|
private Long id; |
||||||
|
/** |
||||||
|
* 接口类型 |
||||||
|
*/ |
||||||
|
private String interfacePushType; |
||||||
|
/** |
||||||
|
* 企业类型 |
||||||
|
*/ |
||||||
|
private String qyType; |
||||||
|
/** |
||||||
|
* 推送状态 |
||||||
|
*/ |
||||||
|
private String pushStatus; |
||||||
|
/** |
||||||
|
* 创建时间 |
||||||
|
*/ |
||||||
|
private Date createTime; |
||||||
|
/** |
||||||
|
* 推送内容 |
||||||
|
*/ |
||||||
|
private String pushContent; |
||||||
|
/** |
||||||
|
* 结果 |
||||||
|
*/ |
||||||
|
private String result; |
||||||
|
/** |
||||||
|
* 失败原因 |
||||||
|
*/ |
||||||
|
private String failReason; |
||||||
|
/** |
||||||
|
* 推送路径ID |
||||||
|
*/ |
||||||
|
private String pushInfoId; |
||||||
|
/** |
||||||
|
* 重试次数 |
||||||
|
*/ |
||||||
|
private Integer retryCount; |
||||||
|
} |
@ -0,0 +1,38 @@ |
|||||||
|
package com.dxhy.order.consumer.modules.order.controller; |
||||||
|
|
||||||
|
import com.dxhy.order.consumer.modules.order.service.InvoicePushService; |
||||||
|
import com.dxhy.order.model.R; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
|
||||||
|
/** |
||||||
|
* @title: InvoicePushController |
||||||
|
* @Author: wrr |
||||||
|
* @Date: 2023/7/20 09:44 |
||||||
|
* @Description: |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@Slf4j |
||||||
|
@RequestMapping("/invoicePush") |
||||||
|
public class InvoicePushController { |
||||||
|
|
||||||
|
@Resource |
||||||
|
private InvoicePushService invoicePushService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 推送重试 |
||||||
|
* @author: wrr |
||||||
|
* @date: 2023/7/20 09:59 |
||||||
|
* @param pushInfoRecordId |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@GetMapping("/retryPush") |
||||||
|
public R retryPush(@RequestParam Long pushInfoRecordId){ |
||||||
|
return R.ok().put("data", invoicePushService.retryPush(pushInfoRecordId)); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,20 @@ |
|||||||
|
package com.dxhy.order.consumer.modules.order.service; |
||||||
|
|
||||||
|
import com.dxhy.order.model.R; |
||||||
|
|
||||||
|
/** |
||||||
|
* @title: InvoicePushService |
||||||
|
* @Author: wrr |
||||||
|
* @Date: 2023/7/20 09:48 |
||||||
|
* @Description: |
||||||
|
*/ |
||||||
|
public interface InvoicePushService { |
||||||
|
/** |
||||||
|
* 重试推送 |
||||||
|
* @author: wrr |
||||||
|
* @date: 2023/7/20 10:00 |
||||||
|
* @param pushInfoRecordId |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
R retryPush(Long pushInfoRecordId); |
||||||
|
} |
@ -0,0 +1,306 @@ |
|||||||
|
package com.dxhy.order.consumer.modules.order.service.impl; |
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil; |
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.dxhy.order.baseservice.config.BaseServiceConfig; |
||||||
|
import com.dxhy.order.constant.*; |
||||||
|
import com.dxhy.order.consumer.dao.PushInfoRecordMapper; |
||||||
|
import com.dxhy.order.consumer.model.PushInfoRecord; |
||||||
|
import com.dxhy.order.consumer.model.protocol.CommonResponse; |
||||||
|
import com.dxhy.order.consumer.model.protocol.ResponseData; |
||||||
|
import com.dxhy.order.consumer.model.protocol.ResponseStatus; |
||||||
|
import com.dxhy.order.consumer.modules.manager.service.PushInvoiceService; |
||||||
|
import com.dxhy.order.consumer.modules.order.service.InvoicePushService; |
||||||
|
import com.dxhy.order.consumer.modules.order.service.OrderProcessService; |
||||||
|
import com.dxhy.order.consumer.openapi.protocol.CommonRequestParam; |
||||||
|
import com.dxhy.order.consumer.openapi.protocol.po.EsOutput; |
||||||
|
import com.dxhy.order.consumer.openapi.protocol.po.PoCommonResponseParam; |
||||||
|
import com.dxhy.order.consumer.openapi.protocol.v4.push.DdfptsV5; |
||||||
|
import com.dxhy.order.consumer.openapi.protocol.v5.DxhyInterfaceResponse; |
||||||
|
import com.dxhy.order.consumer.openapi.protocol.v5.invalid.ZffpxxV5; |
||||||
|
import com.dxhy.order.consumer.openapi.service.CommonDisposeService; |
||||||
|
import com.dxhy.order.invoice.module.invoice.dao.PushInfoMapper; |
||||||
|
import com.dxhy.order.invoice.module.invoice.model.PushInfo; |
||||||
|
import com.dxhy.order.invoice.module.invoice.service.OrderInvoiceInfoService; |
||||||
|
import com.dxhy.order.model.OrderInvoiceInfo; |
||||||
|
import com.dxhy.order.model.OrderProcessInfo; |
||||||
|
import com.dxhy.order.model.R; |
||||||
|
import com.dxhy.order.model.queue.CommonTsMqData; |
||||||
|
import com.dxhy.order.utils.Base64Encoding; |
||||||
|
import com.dxhy.order.utils.HttpUtils; |
||||||
|
import com.dxhy.order.utils.JsonUtils; |
||||||
|
import com.google.common.collect.Maps; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @title: InvoicePushServiceImpl |
||||||
|
* @Author: wrr |
||||||
|
* @Date: 2023/7/20 09:48 |
||||||
|
* @Description: |
||||||
|
*/ |
||||||
|
@Slf4j |
||||||
|
@Service |
||||||
|
public class InvoicePushServiceImpl implements InvoicePushService { |
||||||
|
private static final String LOGGER_MSG = "(推送重试业务实现类)"; |
||||||
|
|
||||||
|
@Resource |
||||||
|
private PushInfoRecordMapper pushInfoRecordMapper; |
||||||
|
@Resource |
||||||
|
private PushInfoMapper pushInfoMapper; |
||||||
|
|
||||||
|
@Resource |
||||||
|
private CommonDisposeService commonDisposeService; |
||||||
|
|
||||||
|
@Resource |
||||||
|
private OrderProcessService orderProcessService; |
||||||
|
@Resource |
||||||
|
private OrderInvoiceInfoService orderInvoiceInfoService; |
||||||
|
|
||||||
|
@Resource |
||||||
|
private BaseServiceConfig baseServiceConfig; |
||||||
|
|
||||||
|
@Resource |
||||||
|
private PushInvoiceService pushInvoiceService; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* @param pushInfoRecordId |
||||||
|
* @return * @return R |
||||||
|
* @author: wrr |
||||||
|
* @date: 2023/7/20 10:01 |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public R retryPush(Long pushInfoRecordId) { |
||||||
|
R r = new R(); |
||||||
|
//查询未推送成功的数据
|
||||||
|
PushInfoRecord pushInfoRecord = pushInfoRecordMapper.selectByPrimaryKey(pushInfoRecordId); |
||||||
|
if (StringUtils.isBlank(pushInfoRecord.getPushContent())) { |
||||||
|
r.put(OrderManagementConstant.CODE, "9999"); |
||||||
|
r.put(OrderManagementConstant.ALL_MESSAGE, "推送内容为空"); |
||||||
|
return r; |
||||||
|
} |
||||||
|
CommonTsMqData fpTsMqData = JSONObject.parseObject(pushInfoRecord.getPushContent(), CommonTsMqData.class); |
||||||
|
List<String> shList = new ArrayList<>(); |
||||||
|
shList.add(fpTsMqData.getNsrsbh()); |
||||||
|
//推送地址
|
||||||
|
String pushUrl = ""; |
||||||
|
String errorMsg = ""; |
||||||
|
String xtly = "SAP"; |
||||||
|
PushInfo pushInfo = new PushInfo(); |
||||||
|
try { |
||||||
|
//查询推送地址
|
||||||
|
pushInfo.setId(pushInfoRecord.getPushInfoId()); |
||||||
|
pushInfo = pushInfoMapper.selectByPushInfo(pushInfo); |
||||||
|
log.info("查询到的推送地址信息:{}", JsonUtils.getInstance().toJsonString(pushInfo)); |
||||||
|
|
||||||
|
if (pushInfo == null) { |
||||||
|
log.warn("{}税号:{},推送地址没有配置", LOGGER_MSG, fpTsMqData.getNsrsbh()); |
||||||
|
String error = "税号:" + fpTsMqData.getNsrsbh() + ",推送地址没有配置"; |
||||||
|
pushInvoiceService.failPush(pushInfoRecordId, JsonUtils.getInstance().toJsonString(fpTsMqData), error, error, null, fpTsMqData.getPushType()); |
||||||
|
r.put(OrderManagementConstant.CODE, "9999"); |
||||||
|
r.put(OrderManagementConstant.ALL_MESSAGE, error); |
||||||
|
return r; |
||||||
|
} |
||||||
|
|
||||||
|
if (StringUtils.isBlank(pushInfo.getPushUrl())) { |
||||||
|
String error = String.format("税号:%s,推送地址未配置", fpTsMqData.getNsrsbh()); |
||||||
|
log.warn(error); |
||||||
|
pushInvoiceService.failPush(pushInfoRecordId, JsonUtils.getInstance().toJsonString(fpTsMqData), error, error, pushInfo, fpTsMqData.getPushType()); |
||||||
|
r.put(OrderManagementConstant.CODE, "9999"); |
||||||
|
r.put(OrderManagementConstant.ALL_MESSAGE, error); |
||||||
|
return r; |
||||||
|
} |
||||||
|
pushUrl = pushInfo.getPushUrl(); |
||||||
|
//按照接口类型获取对应的报文数据
|
||||||
|
String content = pushInvoiceService.getPushContent(fpTsMqData, pushInfo, shList); |
||||||
|
if (StrUtil.isBlank(content)) { |
||||||
|
String error = String.format("税号:%s,组装请求报文为空,不进行推送数据", fpTsMqData.getNsrsbh()); |
||||||
|
log.warn(error); |
||||||
|
pushInvoiceService.failPush(pushInfoRecordId, JsonUtils.getInstance().toJsonString(fpTsMqData), error, error, pushInfo, fpTsMqData.getPushType()); |
||||||
|
r.put(OrderManagementConstant.CODE, "9999"); |
||||||
|
r.put(OrderManagementConstant.ALL_MESSAGE, error); |
||||||
|
return r; |
||||||
|
} |
||||||
|
//判断是不是影像的推送
|
||||||
|
if ("yxxt".equals(pushInfoRecord.getQyType())) { |
||||||
|
try { |
||||||
|
//推送影像系统
|
||||||
|
pushInvoiceService.sendImageSys(content, fpTsMqData.getPushType(), pushInfo); |
||||||
|
return r; |
||||||
|
} catch (Exception e) { |
||||||
|
String error = String.format("影像推送出现异常%s,推送类型%s", e.getMessage(), fpTsMqData.getPushType()); |
||||||
|
log.error(error); |
||||||
|
pushInfo.setByzd1("yxxt"); |
||||||
|
pushInvoiceService.failPush(pushInfoRecordId, JsonUtils.getInstance().toJsonString(fpTsMqData), error, error, pushInfo, fpTsMqData.getPushType()); |
||||||
|
e.printStackTrace(); |
||||||
|
r.put(OrderManagementConstant.CODE, "9999"); |
||||||
|
r.put(OrderManagementConstant.ALL_MESSAGE, error); |
||||||
|
return r; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
OrderProcessInfo orderProcessInfo = null; |
||||||
|
Map<String, String> requestMap = commonDisposeService.getRequestParameter(pushInfo.getNsrsbh(), pushInfo.getZipCode(), pushInfo.getEncryptCode(), content, pushInfo.getPushUrl(), pushInfo.getInterfaceType(), pushInfo.getVersionIdent()); |
||||||
|
if (OrderInfoEnum.INTERFACE_TYPE_INVOICE_PUSH_STATUS_1.getKey().equals(fpTsMqData.getPushType())) { |
||||||
|
orderProcessInfo = orderProcessService.queryOrderProcessInfoByFpqqlsh(fpTsMqData.getFpTsMqData().getFpqqlsh(), null); |
||||||
|
} else if (OrderInfoEnum.INTERFACE_TYPE_INVOICE_PUSH_STATUS_2.getKey().equals(fpTsMqData.getPushType())) { |
||||||
|
OrderInvoiceInfo orderInvoiceInfo = orderInvoiceInfoService.selectOrderInvoiceInfoByFpdmAndFphm(fpTsMqData.getZfTsMqData().getFpdm(), fpTsMqData.getZfTsMqData().getFphm(), null); |
||||||
|
orderProcessInfo = orderProcessService.selectByOrderId(orderInvoiceInfo.getOrderInfoId(), null); |
||||||
|
} |
||||||
|
String fptsParam = JsonUtils.getInstance().toJsonString(requestMap); |
||||||
|
if (StringUtils.isNotBlank(pushInfo.getByzd1())) { |
||||||
|
fptsParam = pushInvoiceService.convertToYwxtParam(fpTsMqData, content); |
||||||
|
} |
||||||
|
|
||||||
|
log.info("{}推送企业开始,推送企业url:{},用户:{},密码:{},推送参数:{}", LOGGER_MSG, pushInfo.getPushUrl(), baseServiceConfig.getPoUserName(), baseServiceConfig.getPoPassword(), fptsParam); |
||||||
|
long startTime = System.currentTimeMillis(); |
||||||
|
String result = ""; |
||||||
|
if (ConfigurerInfo.INTERFACE_VERSION_V5.equals(pushInfo.getVersionIdent()) |
||||||
|
|| ConfigurerInfo.INTERFACE_VERSION_V6.equals(pushInfo.getVersionIdent())) { |
||||||
|
if (StringUtils.isNotBlank(pushInfo.getByzd1()) && OrderInfoEnum.SYS_SOURCE_SAP.getKey().equals(pushInfo.getByzd1())) { |
||||||
|
result = HttpUtils.sendPo(pushInfo.getPushUrl(), fptsParam, baseServiceConfig.getPoUserName(), baseServiceConfig.getPoPassword()); |
||||||
|
} else if (OrderInfoEnum.SYS_SOURCE_DSXT01.getKey().equals(orderProcessInfo.getXtly()) && StringUtils.isNotBlank(pushInfo.getByzd1()) |
||||||
|
&& pushInfo.getByzd1().equals(orderProcessInfo.getXtly())) { |
||||||
|
result = HttpUtils.sendPo(pushInfo.getPushUrl(), fptsParam, baseServiceConfig.getPoUserName(), baseServiceConfig.getPoPassword()); |
||||||
|
} else if (OrderInfoEnum.SYS_SOURCE_DSXT02.getKey().equals(orderProcessInfo.getXtly()) && StringUtils.isNotBlank(pushInfo.getByzd1()) |
||||||
|
&& pushInfo.getByzd1().equals(orderProcessInfo.getXtly())) { |
||||||
|
Map map = Maps.newHashMap(); |
||||||
|
map.put("ec-key", baseServiceConfig.getEcKey()); |
||||||
|
result = HttpUtils.sendPoWithHead(pushInfo.getPushUrl(), fptsParam, baseServiceConfig.getPoUserName(), baseServiceConfig.getPoPassword(), map); |
||||||
|
} |
||||||
|
} else { |
||||||
|
result = HttpUtils.doPost(pushInfo.getPushUrl(), requestMap); |
||||||
|
} |
||||||
|
long endTime = System.currentTimeMillis(); |
||||||
|
log.info("{}推送企业结束,推送企业url:{},企业返回结果:{},推送耗时:{}", LOGGER_MSG, pushInfo.getPushUrl(), result, endTime - startTime); |
||||||
|
|
||||||
|
if (!StringUtils.isBlank(result)) { |
||||||
|
if (ConfigurerInfo.INTERFACE_VERSION_V5.equals(pushInfo.getVersionIdent()) |
||||||
|
|| ConfigurerInfo.INTERFACE_VERSION_V6.equals(pushInfo.getVersionIdent())) { |
||||||
|
DxhyInterfaceResponse dxhyInterfaceResponse = JsonUtils.getInstance().parseObject(result, DxhyInterfaceResponse.class); |
||||||
|
if (OrderInfoEnum.INTERFACE_TYPE_INVOICE_PUSH_STATUS_1.getKey().equals(fpTsMqData.getPushType())) { |
||||||
|
if (OrderInfoEnum.SYS_SOURCE_SAP.getKey().equals(xtly)) { |
||||||
|
PoCommonResponseParam poCommonResponseParam = JsonUtils.getInstance().parseObject(result, PoCommonResponseParam.class); |
||||||
|
EsOutput es_output = poCommonResponseParam.getES_OUTPUT(); |
||||||
|
String sapkey = es_output.getSAPKEY(); |
||||||
|
String ztype = es_output.getZTYPE(); |
||||||
|
String zmessage = es_output.getZMESSAGE(); |
||||||
|
List<DdfptsV5> resultList = new ArrayList<>(); |
||||||
|
DdfptsV5 ddfptsV5 = new DdfptsV5(); |
||||||
|
ddfptsV5.setDDQQLSH(fpTsMqData.getFpTsMqData().getFpqqlsh()); |
||||||
|
ddfptsV5.setNSRSBH(""); |
||||||
|
if (OrderInfoContentEnum.INVOICE_ERROR_CODE_OP_S.getKey().equals(ztype)) { |
||||||
|
ddfptsV5.setZTDM(ConfigureConstant.STRING_000000); |
||||||
|
} else { |
||||||
|
ddfptsV5.setZTDM(ConfigureConstant.STRING_9999); |
||||||
|
} |
||||||
|
ddfptsV5.setZTXX(zmessage); |
||||||
|
dxhyInterfaceResponse.setReturnCode(ConfigureConstant.STRING_000000); |
||||||
|
dxhyInterfaceResponse.setReturnMessage("处理成功"); |
||||||
|
dxhyInterfaceResponse.setEncryptCode(ConfigurerInfo.ENCRYPTCODE_0); |
||||||
|
dxhyInterfaceResponse.setZipCode(ConfigurerInfo.ENCRYPTCODE_0); |
||||||
|
resultList.add(ddfptsV5); |
||||||
|
dxhyInterfaceResponse.setContent(Base64Encoding.encode(JsonUtils.getInstance().toJsonString(resultList))); |
||||||
|
} else { |
||||||
|
dxhyInterfaceResponse = JsonUtils.getInstance().parseObject(result, DxhyInterfaceResponse.class); |
||||||
|
} |
||||||
|
} else if (OrderInfoEnum.INTERFACE_TYPE_INVOICE_PUSH_STATUS_2.getKey().equals(fpTsMqData.getPushType())) { |
||||||
|
if (OrderInfoEnum.SYS_SOURCE_SAP.getKey().equals(xtly)) { |
||||||
|
PoCommonResponseParam poCommonResponseParam = JsonUtils.getInstance().parseObject(result, PoCommonResponseParam.class); |
||||||
|
EsOutput es_output = poCommonResponseParam.getES_OUTPUT(); |
||||||
|
String ztype = es_output.getZTYPE(); |
||||||
|
String zmessage = es_output.getZMESSAGE(); |
||||||
|
ZffpxxV5 zffpxxV5 = new ZffpxxV5(); |
||||||
|
zffpxxV5.setXHFSBH(fpTsMqData.getZfTsMqData().getNsrsbh()); |
||||||
|
zffpxxV5.setFPDM(fpTsMqData.getZfTsMqData().getFpdm()); |
||||||
|
zffpxxV5.setFPHM(fpTsMqData.getZfTsMqData().getFphm()); |
||||||
|
if (OrderInfoContentEnum.INVOICE_ERROR_CODE_OP_S.getKey().equals(ztype)) { |
||||||
|
zffpxxV5.setZTDM(ConfigureConstant.STRING_000000); |
||||||
|
} else { |
||||||
|
zffpxxV5.setZTDM(ConfigureConstant.STRING_9999); |
||||||
|
} |
||||||
|
zffpxxV5.setZTXX(zmessage); |
||||||
|
dxhyInterfaceResponse.setReturnCode(ConfigureConstant.STRING_000000); |
||||||
|
dxhyInterfaceResponse.setReturnMessage("处理成功"); |
||||||
|
dxhyInterfaceResponse.setEncryptCode(ConfigurerInfo.ENCRYPTCODE_0); |
||||||
|
dxhyInterfaceResponse.setZipCode(ConfigurerInfo.ENCRYPTCODE_0); |
||||||
|
dxhyInterfaceResponse.setContent(Base64Encoding.encode(JsonUtils.getInstance().toJsonString(zffpxxV5))); |
||||||
|
} else { |
||||||
|
dxhyInterfaceResponse = JsonUtils.getInstance().parseObject(result, DxhyInterfaceResponse.class); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (ObjectUtil.isNotNull(dxhyInterfaceResponse)) { |
||||||
|
if (ConfigureConstant.STRING_000000.equals(dxhyInterfaceResponse.getReturnCode())) { |
||||||
|
CommonRequestParam commonRequestParam1 = new CommonRequestParam(); |
||||||
|
commonRequestParam1.setContent(dxhyInterfaceResponse.getContent()); |
||||||
|
commonRequestParam1.setEncryptCode(dxhyInterfaceResponse.getEncryptCode()); |
||||||
|
commonRequestParam1.setZipCode(dxhyInterfaceResponse.getZipCode()); |
||||||
|
commonRequestParam1.setSecretId(commonDisposeService.getAuthMap(pushInfo.getNsrsbh())); |
||||||
|
String s = commonDisposeService.commonDecrypt(commonRequestParam1); |
||||||
|
log.info("解析结果为,{}", s); |
||||||
|
pushInvoiceService.processPushSuccess(fpTsMqData, s, pushInfo.getVersionIdent()); |
||||||
|
pushInvoiceService.successPush(pushInfoRecordId, JsonUtils.getInstance().toJsonString(fpTsMqData), s, pushInfo, fpTsMqData.getPushType()); |
||||||
|
|
||||||
|
} else { |
||||||
|
String error = String.format("推送数据返回的状态结果为失败,信息为:%s", dxhyInterfaceResponse.getReturnMessage()); |
||||||
|
log.error(error); |
||||||
|
errorMsg = dxhyInterfaceResponse.getReturnMessage(); |
||||||
|
pushInvoiceService.failPush(pushInfoRecordId, JsonUtils.getInstance().toJsonString(fpTsMqData), error, error, pushInfo, fpTsMqData.getPushType()); |
||||||
|
} |
||||||
|
} else { |
||||||
|
log.error("推送返回没有接收到状态码!"); |
||||||
|
errorMsg = "未接收到企业返回推送数据"; |
||||||
|
pushInvoiceService.failPush(pushInfoRecordId, JsonUtils.getInstance().toJsonString(fpTsMqData), errorMsg, errorMsg, pushInfo, fpTsMqData.getPushType()); |
||||||
|
} |
||||||
|
} else { |
||||||
|
CommonResponse commonResponse = JSONObject.parseObject(result, CommonResponse.class); |
||||||
|
if (commonResponse != null && commonResponse.getResponseStatus() != null) { |
||||||
|
|
||||||
|
ResponseStatus res = commonResponse.getResponseStatus(); |
||||||
|
String code = res.getCode(); |
||||||
|
ResponseData responseData = commonResponse.getResponseData(); |
||||||
|
|
||||||
|
if (ConfigureConstant.STRING_0000.equals(code) || ConfigureConstant.STRING_2000.equals(code)) { |
||||||
|
CommonRequestParam commonRequestParam1 = new CommonRequestParam(); |
||||||
|
commonRequestParam1.setContent(responseData.getContent()); |
||||||
|
commonRequestParam1.setEncryptCode(responseData.getEncryptCode()); |
||||||
|
commonRequestParam1.setZipCode(responseData.getZipCode()); |
||||||
|
commonRequestParam1.setSecretId(commonDisposeService.getAuthMap(pushInfo.getNsrsbh())); |
||||||
|
String s = commonDisposeService.commonDecrypt(commonRequestParam1); |
||||||
|
log.info("解析结果为,{}", s); |
||||||
|
pushInvoiceService.processPushSuccess(fpTsMqData, s, pushInfo.getVersionIdent()); |
||||||
|
|
||||||
|
} else { |
||||||
|
log.error("推送数据返回的状态结果为失败!"); |
||||||
|
errorMsg = res.getMessage(); |
||||||
|
pushInvoiceService.failPush(pushInfoRecordId, JsonUtils.getInstance().toJsonString(fpTsMqData), errorMsg, errorMsg, pushInfo, fpTsMqData.getPushType()); |
||||||
|
} |
||||||
|
} else { |
||||||
|
log.error("推送返回没有接收到状态码!"); |
||||||
|
errorMsg = "未接收到企业返回推送数据"; |
||||||
|
pushInvoiceService.failPush(pushInfoRecordId, JsonUtils.getInstance().toJsonString(fpTsMqData), errorMsg, errorMsg, pushInfo, fpTsMqData.getPushType()); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
} catch (Exception e) { |
||||||
|
log.error("{}推送异常,异常信息:{}", LOGGER_MSG, e); |
||||||
|
errorMsg = e.getMessage(); |
||||||
|
} |
||||||
|
if (StrUtil.isNotBlank(errorMsg)) { |
||||||
|
log.error("{}推送失败,失败信息:{}", LOGGER_MSG, errorMsg); |
||||||
|
r = pushInvoiceService.processPushFail(fpTsMqData, pushUrl, errorMsg, shList); |
||||||
|
pushInvoiceService.failPush(pushInfoRecordId, JsonUtils.getInstance().toJsonString(fpTsMqData), errorMsg, errorMsg, pushInfo, fpTsMqData.getPushType()); |
||||||
|
} |
||||||
|
return r; |
||||||
|
} |
||||||
|
} |
@ -1,25 +1,25 @@ |
|||||||
#Mybatis Generator configuration |
#Mybatis Generator configuration |
||||||
#\u751F\u6210\u6570\u636E\u7684\u4E3B\u76EE\u5F55 |
#\u751F\u6210\u6570\u636E\u7684\u4E3B\u76EE\u5F55 |
||||||
projectPath=src/main/java/sn |
projectPath=src/main/java |
||||||
#\u751F\u6210\u6570\u636E\u7684\u8D44\u6E90\u76EE\u5F55 |
#\u751F\u6210\u6570\u636E\u7684\u8D44\u6E90\u76EE\u5F55 |
||||||
mapLocation=src/main/resources/sn |
mapLocation=src/main/resources |
||||||
#\u6570\u636E\u5E93\u9A71\u52A8\u5305\u8DEF\u5F84 |
#\u6570\u636E\u5E93\u9A71\u52A8\u5305\u8DEF\u5F84 |
||||||
mysqlConJarPath=C:/Users/liufeilong/.m2/repository/mysql/mysql-connector-java/5.1.35/mysql-connector-java-5.1.35.jar |
mysqlConJarPath=/Users/wangrangrang/Documents/office-software/apache-maven-3.8.6/repository/mysql/mysql-connector-java/5.1.32/mysql-connector-java-5.1.32.jar |
||||||
#\u6570\u636E\u5E93\u9A71\u52A8\u8DEF\u5F84 |
#\u6570\u636E\u5E93\u9A71\u52A8\u8DEF\u5F84 |
||||||
jdbc_driver=com.mysql.jdbc.Driver |
jdbc_driver=com.mysql.jdbc.Driver |
||||||
#\u6570\u636E\u5E93\u5730\u5740 |
#\u6570\u636E\u5E93\u5730\u5740 |
||||||
jdbc_url=jdbc:mysql://10.1.1.76:3306/sales_order_sdenergy?useUnicode=true&characterEncoding=utf8&useSSL=false |
jdbc_url=jdbc:mysql://172.31.36.143:36000/sales_order?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true |
||||||
#\u6570\u636E\u5E93\u7528\u6237 |
#\u6570\u636E\u5E93\u7528\u6237 |
||||||
jdbc_user=root |
jdbc_user=sales_manager |
||||||
#\u6570\u636E\u5E93\u5BC6\u7801 |
#\u6570\u636E\u5E93\u5BC6\u7801 |
||||||
jdbc_password=dxhydever |
jdbc_password=ueHjqtam%zB^WqW5 |
||||||
#\u5B9E\u4F53\u5BF9\u8C61\u751F\u6210\u8DEF\u5F84 |
#\u5B9E\u4F53\u5BF9\u8C61\u751F\u6210\u8DEF\u5F84 |
||||||
javaModelTargetPath=com.dxhy.order.model |
javaModelTargetPath=com.dxhy.order.consumer.model |
||||||
#xml\u751F\u6210\u8DEF\u5F84 |
#xml\u751F\u6210\u8DEF\u5F84 |
||||||
xmlTargetPath=mybatis.mapper |
xmlTargetPath=mybatis.mapper |
||||||
#\u6570\u636E\u5E93dao\u5C42 |
#\u6570\u636E\u5E93dao\u5C42 |
||||||
daoTargetPath=com.dxhy.order.dao |
daoTargetPath=com.dxhy.order.consumer.dao |
||||||
#\u9700\u8981\u751F\u6210\u6570\u636E\u7684\u8868\u540D |
#\u9700\u8981\u751F\u6210\u6570\u636E\u7684\u8868\u540D |
||||||
tableName=invoice_remark_set |
tableName=push_info_record |
||||||
#\u9700\u8981\u751F\u6210\u6570\u636E\u7684\u5B9E\u4F53\u5BF9\u8C61\u540D\u79F0 |
#\u9700\u8981\u751F\u6210\u6570\u636E\u7684\u5B9E\u4F53\u5BF9\u8C61\u540D\u79F0 |
||||||
domainObjectName=InvoiceRemarkSet |
domainObjectName=PushInfoRecord |
||||||
|
@ -0,0 +1,150 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||||
|
<mapper namespace="com.dxhy.order.consumer.dao.PushInfoRecordMapper" > |
||||||
|
<resultMap id="BaseResultMap" type="com.dxhy.order.consumer.model.PushInfoRecord" > |
||||||
|
<id column="id" property="id" jdbcType="BIGINT" /> |
||||||
|
<result column="interface_push_type" property="interfacePushType" jdbcType="VARCHAR" /> |
||||||
|
<result column="qy_type" property="qyType" jdbcType="VARCHAR" /> |
||||||
|
<result column="push_status" property="pushStatus" jdbcType="VARCHAR" /> |
||||||
|
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> |
||||||
|
<result column="push_content" property="pushContent" jdbcType="LONGVARCHAR" /> |
||||||
|
<result column="result" property="result" jdbcType="LONGVARCHAR" /> |
||||||
|
<result column="fail_reason" property="failReason" jdbcType="LONGVARCHAR" /> |
||||||
|
<result column="push_info_id" property="pushInfoId" jdbcType="BIGINT" /> |
||||||
|
<result column="retry_count" property="retryCount" jdbcType="INTEGER" /> |
||||||
|
</resultMap> |
||||||
|
<sql id="Base_Column_List" > |
||||||
|
id, interface_push_type, qy_type, push_status, create_time,push_content, result, fail_reason,push_info_id,retry_count |
||||||
|
</sql> |
||||||
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" > |
||||||
|
select |
||||||
|
<include refid="Base_Column_List" /> |
||||||
|
from push_info_record |
||||||
|
where id = #{id,jdbcType=BIGINT} |
||||||
|
</select> |
||||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" > |
||||||
|
delete from push_info_record |
||||||
|
where id = #{id,jdbcType=BIGINT} |
||||||
|
</delete> |
||||||
|
<insert id="insert" parameterType="com.dxhy.order.consumer.model.PushInfoRecord" > |
||||||
|
insert into push_info_record (id, interface_push_type, qy_type, |
||||||
|
push_status, create_time, push_content, |
||||||
|
result, fail_reason, push_info_id,retry_count) |
||||||
|
values (#{id,jdbcType=BIGINT}, #{interfacePushType,jdbcType=VARCHAR}, #{qyType,jdbcType=VARCHAR}, |
||||||
|
#{pushStatus,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{pushContent,jdbcType=LONGVARCHAR}, |
||||||
|
#{result,jdbcType=LONGVARCHAR}, #{failReason,jdbcType=LONGVARCHAR},#{pushInfoId},#{retryCount}) |
||||||
|
</insert> |
||||||
|
<insert id="insertSelective" parameterType="com.dxhy.order.consumer.model.PushInfoRecord" > |
||||||
|
insert into push_info_record |
||||||
|
<trim prefix="(" suffix=")" suffixOverrides="," > |
||||||
|
<if test="id != null" > |
||||||
|
id, |
||||||
|
</if> |
||||||
|
<if test="interfacePushType != null" > |
||||||
|
interface_push_type, |
||||||
|
</if> |
||||||
|
<if test="qyType != null" > |
||||||
|
qy_type, |
||||||
|
</if> |
||||||
|
<if test="pushStatus != null" > |
||||||
|
push_status, |
||||||
|
</if> |
||||||
|
<if test="createTime != null" > |
||||||
|
create_time, |
||||||
|
</if> |
||||||
|
<if test="pushContent != null" > |
||||||
|
push_content, |
||||||
|
</if> |
||||||
|
<if test="result != null" > |
||||||
|
result, |
||||||
|
</if> |
||||||
|
<if test="failReason != null" > |
||||||
|
fail_reason, |
||||||
|
</if> |
||||||
|
<if test="pushInfoId != null" > |
||||||
|
push_info_id, |
||||||
|
</if> |
||||||
|
<if test="retryCount != null" > |
||||||
|
retry_count, |
||||||
|
</if> |
||||||
|
</trim> |
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides="," > |
||||||
|
<if test="id != null" > |
||||||
|
#{id,jdbcType=BIGINT}, |
||||||
|
</if> |
||||||
|
<if test="interfacePushType != null" > |
||||||
|
#{interfacePushType,jdbcType=VARCHAR}, |
||||||
|
</if> |
||||||
|
<if test="qyType != null" > |
||||||
|
#{qyType,jdbcType=VARCHAR}, |
||||||
|
</if> |
||||||
|
<if test="pushStatus != null" > |
||||||
|
#{pushStatus,jdbcType=VARCHAR}, |
||||||
|
</if> |
||||||
|
<if test="createTime != null" > |
||||||
|
#{createTime,jdbcType=TIMESTAMP}, |
||||||
|
</if> |
||||||
|
<if test="pushContent != null" > |
||||||
|
#{pushContent,jdbcType=LONGVARCHAR}, |
||||||
|
</if> |
||||||
|
<if test="result != null" > |
||||||
|
#{result,jdbcType=LONGVARCHAR}, |
||||||
|
</if> |
||||||
|
<if test="failReason != null" > |
||||||
|
#{failReason,jdbcType=LONGVARCHAR}, |
||||||
|
</if> |
||||||
|
<if test="pushInfoId != null" > |
||||||
|
#{pushInfoId}, |
||||||
|
</if> |
||||||
|
<if test="retryCount != null" > |
||||||
|
#{retryCount}, |
||||||
|
</if> |
||||||
|
</trim> |
||||||
|
</insert> |
||||||
|
<update id="updateByPrimaryKeySelective" parameterType="com.dxhy.order.consumer.model.PushInfoRecord" > |
||||||
|
update push_info_record |
||||||
|
<set > |
||||||
|
<if test="interfacePushType != null" > |
||||||
|
interface_push_type = #{interfacePushType,jdbcType=VARCHAR}, |
||||||
|
</if> |
||||||
|
<if test="qyType != null" > |
||||||
|
qy_type = #{qyType,jdbcType=VARCHAR}, |
||||||
|
</if> |
||||||
|
<if test="pushStatus != null" > |
||||||
|
push_status = #{pushStatus,jdbcType=VARCHAR}, |
||||||
|
</if> |
||||||
|
<if test="createTime != null" > |
||||||
|
create_time = #{createTime,jdbcType=TIMESTAMP}, |
||||||
|
</if> |
||||||
|
<if test="pushContent != null" > |
||||||
|
push_content = #{pushContent,jdbcType=LONGVARCHAR}, |
||||||
|
</if> |
||||||
|
<if test="result != null" > |
||||||
|
result = #{result,jdbcType=LONGVARCHAR}, |
||||||
|
</if> |
||||||
|
<if test="failReason != null" > |
||||||
|
fail_reason = #{failReason,jdbcType=LONGVARCHAR}, |
||||||
|
</if> |
||||||
|
<if test="pushInfoId != null" > |
||||||
|
push_info_id = #{pushInfoId}, |
||||||
|
</if> |
||||||
|
<if test="retryCount != null" > |
||||||
|
retry_count = #{retryCount}, |
||||||
|
</if> |
||||||
|
</set> |
||||||
|
where id = #{id,jdbcType=BIGINT} |
||||||
|
</update> |
||||||
|
<update id="updateByPrimaryKey" parameterType="com.dxhy.order.consumer.model.PushInfoRecord" > |
||||||
|
update push_info_record |
||||||
|
set interface_push_type = #{interfacePushType,jdbcType=VARCHAR}, |
||||||
|
qy_type = #{qyType,jdbcType=VARCHAR}, |
||||||
|
push_status = #{pushStatus,jdbcType=VARCHAR}, |
||||||
|
create_time = #{createTime,jdbcType=TIMESTAMP}, |
||||||
|
push_content = #{pushContent,jdbcType=LONGVARCHAR}, |
||||||
|
result = #{result,jdbcType=LONGVARCHAR}, |
||||||
|
fail_reason = #{failReason,jdbcType=LONGVARCHAR}, |
||||||
|
push_info_id = #{pushInfoId}, |
||||||
|
retry_count = #{retryCount} |
||||||
|
where id = #{id,jdbcType=BIGINT} |
||||||
|
</update> |
||||||
|
</mapper> |
Loading…
Reference in new issue