Compare commits

..

No commits in common. '5f1536e5deb88b3aab44d410a07817a958828c68' and '00233651334ee99a7380ee4e600690785e3ff838' have entirely different histories.

  1. 26
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiServiceImpl.java
  2. 30
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiV6ByInspurServiceImpl.java
  3. 29
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiV6ServiceImpl.java
  4. 38
      jianshui-invoice/src/main/java/com/jianshui/invoice/task/InvoiceBackTask.java
  5. 3
      jianshui-invoice/src/main/java/com/jianshui/invoice/utils/elephant/ElephantUtils.java

@ -47,9 +47,7 @@ import com.jianshui.queue.utils.RedisQueueUtil;
import com.jianshui.storage.domain.StorageUrlDTO; import com.jianshui.storage.domain.StorageUrlDTO;
import com.jianshui.storage.factory.StorageFactory; import com.jianshui.storage.factory.StorageFactory;
import com.jianshui.storage.service.IStorageService; import com.jianshui.storage.service.IStorageService;
import com.jianshui.system.domain.CompanyserviceProp;
import com.jianshui.system.mapper.CompanyserviceMapper; import com.jianshui.system.mapper.CompanyserviceMapper;
import com.jianshui.system.mapper.CompanyservicePropMapper;
import com.jianshui.system.service.ISysConfigService; import com.jianshui.system.service.ISysConfigService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
@ -96,9 +94,6 @@ public class ElephantInvoiceApiServiceImpl implements IInvoiceApiService {
@Autowired @Autowired
private IBillInfoService billInfoService; private IBillInfoService billInfoService;
@Autowired
private CompanyservicePropMapper companyservicePropMapper;
/** /**
* 发票开具 * 发票开具
* *
@ -212,8 +207,7 @@ public class ElephantInvoiceApiServiceImpl implements IInvoiceApiService {
e.printStackTrace(); e.printStackTrace();
throw new JianshuiServiceException("系统异常!"); throw new JianshuiServiceException("系统异常!");
} }
// log.info("【销项发票】【大象发票】发票开具请求结果{}", queryResult.toString()); log.info("【销项发票】【大象发票】发票开具请求结果{}", queryResult.toString());
log.info("【销项发票】【大象发票】发票开具请求结果");
// 判断外层报文是否成功 // 判断外层报文是否成功
if (queryResult.isError()) { if (queryResult.isError()) {
@ -240,14 +234,7 @@ public class ElephantInvoiceApiServiceImpl implements IInvoiceApiService {
queryBody.put("DDQQPCH", billInfo.getSystemOrderno()); queryBody.put("DDQQPCH", billInfo.getSystemOrderno());
queryBody.put("FPLXDM", fplxdm); queryBody.put("FPLXDM", fplxdm);
queryBody.put("SFFHSBSJ", "0"); queryBody.put("SFFHSBSJ", "0");
queryBody.put("BSWJ", "1");
CompanyserviceProp companyservicePropBSWJ = companyservicePropMapper.selectPropByKey(companyservice.getCompanyid(), "BSWJ");
if (companyservicePropBSWJ != null && StrUtil.isNotEmpty(companyservicePropBSWJ.getValue())) {
queryBody.put("BSWJ", companyservicePropBSWJ.getValue() );
} else {
queryBody.put("BSWJ", "1");
}
// queryResult = ElephantUtils.sendRequest(ElephantConstants.ADD_INVOICE_RESULT, JSONUtil.parse(queryBody)); // queryResult = ElephantUtils.sendRequest(ElephantConstants.ADD_INVOICE_RESULT, JSONUtil.parse(queryBody));
try { try {
queryResult = ElephantUtils.sendRequestWithoutToken(ElephantConstants.ADD_INVOICE_RESULT_LOCALHOST, ElephantConstants.ADD_INVOICE_RESULT_METHOD, JSONUtil.parse(queryBody), companyservice); queryResult = ElephantUtils.sendRequestWithoutToken(ElephantConstants.ADD_INVOICE_RESULT_LOCALHOST, ElephantConstants.ADD_INVOICE_RESULT_METHOD, JSONUtil.parse(queryBody), companyservice);
@ -373,14 +360,7 @@ public class ElephantInvoiceApiServiceImpl implements IInvoiceApiService {
JSONObject queryBody = new JSONObject(); JSONObject queryBody = new JSONObject();
queryBody.put("NSRSBH", companyservice.getSellertax()); queryBody.put("NSRSBH", companyservice.getSellertax());
queryBody.put("DDQQLSH", originBillInfo.getSystemOrderno()); queryBody.put("DDQQLSH", originBillInfo.getSystemOrderno());
queryBody.put("BSWJ", "1");
CompanyserviceProp companyservicePropBSWJ = companyservicePropMapper.selectPropByKey(companyservice.getCompanyid(), "BSWJ");
if (companyservicePropBSWJ != null && StrUtil.isNotEmpty(companyservicePropBSWJ.getValue())) {
queryBody.put("BSWJ", companyservicePropBSWJ.getValue() );
} else {
queryBody.put("BSWJ", "1");
}
debugLog("断点4", uuid, timestamp); debugLog("断点4", uuid, timestamp);
// AjaxResult queryResult = ElephantUtils.sendRequest(ElephantConstants.QUERY_INVOICE, JSONUtil.parse(queryBody)); // AjaxResult queryResult = ElephantUtils.sendRequest(ElephantConstants.QUERY_INVOICE, JSONUtil.parse(queryBody));

@ -296,8 +296,7 @@ public class ElephantInvoiceApiV6ByInspurServiceImpl implements IInvoiceApiServi
e.printStackTrace(); e.printStackTrace();
throw new JianshuiServiceException("系统异常!"); throw new JianshuiServiceException("系统异常!");
} }
// log.info("【销项发票】【大象发票】发票开具请求结果-暂不打印", queryResult.toString()); log.info("【销项发票】【大象发票】发票开具请求结果{}", queryResult.toString());
log.info("【销项发票】【大象发票】发票开具请求结果-暂不打印");
// 判断外层报文是否成功 // 判断外层报文是否成功
if (queryResult.isError()) { if (queryResult.isError()) {
@ -328,12 +327,7 @@ public class ElephantInvoiceApiV6ByInspurServiceImpl implements IInvoiceApiServi
// TODO: 2023/10/8 数电 // TODO: 2023/10/8 数电
// TODO kk:2024/7/8 寿仙谷定制 去掉文件流 // TODO kk:2024/7/8 寿仙谷定制 去掉文件流
CompanyserviceProp companyservicePropBSWJ = companyservicePropMapper.selectPropByKey(companyservice.getCompanyid(), "BSWJ"); queryBody.put("BSWJ", "1");
if (companyservicePropBSWJ != null && StrUtil.isNotEmpty(companyservicePropBSWJ.getValue())) {
queryBody.put("BSWJ", companyservicePropBSWJ.getValue() );
} else {
queryBody.put("BSWJ", "1");
}
// 订单请求流水号 // 订单请求流水号
@ -480,15 +474,7 @@ public class ElephantInvoiceApiV6ByInspurServiceImpl implements IInvoiceApiServi
JSONObject queryBody = new JSONObject(); JSONObject queryBody = new JSONObject();
queryBody.put("NSRSBH", companyservice.getSellertax()); queryBody.put("NSRSBH", companyservice.getSellertax());
queryBody.put("DDQQLSH", originBillInfo.getSystemOrderno()); queryBody.put("DDQQLSH", originBillInfo.getSystemOrderno());
queryBody.put("BSWJ", "1");
CompanyserviceProp companyservicePropBSWJ = companyservicePropMapper.selectPropByKey(companyservice.getCompanyid(), "BSWJ");
if (companyservicePropBSWJ != null && StrUtil.isNotEmpty(companyservicePropBSWJ.getValue())) {
queryBody.put("BSWJ", companyservicePropBSWJ.getValue() );
} else {
queryBody.put("BSWJ", "1");
}
// TODO kk:2024/7/8 寿仙谷定制 不需要文件流 // TODO kk:2024/7/8 寿仙谷定制 不需要文件流
// queryBody.put("BSWJ", "1"); // queryBody.put("BSWJ", "1");
debugLog("断点4", uuid, timestamp); debugLog("断点4", uuid, timestamp);
@ -3306,8 +3292,7 @@ public class ElephantInvoiceApiV6ByInspurServiceImpl implements IInvoiceApiServi
log.error("【销项发票】【大象接口】【发票开具】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(elephantInvoiceAddDTO).toString(), JSONObject.toJSONString(companyservice)); log.error("【销项发票】【大象接口】【发票开具】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(elephantInvoiceAddDTO).toString(), JSONObject.toJSONString(companyservice));
return new HXResponse("系统异常!"); return new HXResponse("系统异常!");
} }
log.info("【销项发票】【大象发票】发票开具请求结果"); log.info("【销项发票】【大象发票】发票开具请求结果{}", queryResult.toString());
// log.info("【销项发票】【大象发票】发票开具请求结果{}", queryResult.toString());
// 判断外层报文是否成功 // 判断外层报文是否成功
if (queryResult.isError()) { if (queryResult.isError()) {
@ -3339,13 +3324,8 @@ public class ElephantInvoiceApiV6ByInspurServiceImpl implements IInvoiceApiServi
// 订单请求流水号 // 订单请求流水号
queryBody.put("DDQQLSH", billInfo.getSystemOrderno()); queryBody.put("DDQQLSH", billInfo.getSystemOrderno());
CompanyserviceProp companyservicePropBSWJ = companyservicePropMapper.selectPropByKey(companyservice.getCompanyid(), "BSWJ");
if (companyservicePropBSWJ != null && StrUtil.isNotEmpty(companyservicePropBSWJ.getValue())) {
queryBody.put("BSWJ", companyservicePropBSWJ.getValue() );
} else {
queryBody.put("BSWJ", "1");
}
queryBody.put("BSWJ", "1");
/*// 提取码 /*// 提取码
queryBody.put("TQM", "0"); queryBody.put("TQM", "0");
// 订单号 // 订单号

@ -343,8 +343,7 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService {
e.printStackTrace(); e.printStackTrace();
throw new JianshuiServiceException("系统异常!"); throw new JianshuiServiceException("系统异常!");
} }
// log.info("【销项发票】【大象发票】发票开具请求结果{}", queryResult.toString()); log.info("【销项发票】【大象发票】发票开具请求结果{}", queryResult.toString());
log.info("【销项发票】【大象发票】发票开具请求结果");
// 判断外层报文是否成功 // 判断外层报文是否成功
if (queryResult.isError()) { if (queryResult.isError()) {
@ -387,12 +386,7 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService {
queryBody.put("DDRQQ", "0"); queryBody.put("DDRQQ", "0");
// 订单日期止 // 订单日期止
queryBody.put("DDRQZ", "0");*/ queryBody.put("DDRQZ", "0");*/
CompanyserviceProp companyservicePropBSWJ = companyservicePropMapper.selectPropByKey(companyservice.getCompanyid(), "BSWJ"); queryBody.put("BSWJ", "1");
if (companyservicePropBSWJ != null && StrUtil.isNotEmpty(companyservicePropBSWJ.getValue())) {
queryBody.put("BSWJ", companyservicePropBSWJ.getValue() );
} else {
queryBody.put("BSWJ", "1");
}
// queryResult = ElephantUtils.sendRequest(ElephantConstantsV6.ADD_INVOICE_RESULT, JSONUtil.parse(queryBody)); // queryResult = ElephantUtils.sendRequest(ElephantConstantsV6.ADD_INVOICE_RESULT, JSONUtil.parse(queryBody));
try { try {
queryResult = ElephantUtils.sendRequestWithoutTokenV6New(ElephantConstantsV6.ADD_INVOICE_RESULT_LOCALHOST, ElephantConstantsV6.ADD_INVOICE_RESULT_METHOD, JSONUtil.parse(queryBody), companyservice); queryResult = ElephantUtils.sendRequestWithoutTokenV6New(ElephantConstantsV6.ADD_INVOICE_RESULT_LOCALHOST, ElephantConstantsV6.ADD_INVOICE_RESULT_METHOD, JSONUtil.parse(queryBody), companyservice);
@ -524,14 +518,7 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService {
JSONObject queryBody = new JSONObject(); JSONObject queryBody = new JSONObject();
queryBody.put("NSRSBH", companyservice.getSellertax()); queryBody.put("NSRSBH", companyservice.getSellertax());
queryBody.put("DDQQLSH", originBillInfo.getSystemOrderno()); queryBody.put("DDQQLSH", originBillInfo.getSystemOrderno());
queryBody.put("BSWJ", "1");
CompanyserviceProp companyservicePropBSWJ = companyservicePropMapper.selectPropByKey(companyservice.getCompanyid(), "BSWJ");
if (companyservicePropBSWJ != null && StrUtil.isNotEmpty(companyservicePropBSWJ.getValue())) {
queryBody.put("BSWJ", companyservicePropBSWJ.getValue() );
} else {
queryBody.put("BSWJ", "1");
}
debugLog("断点4", uuid, timestamp); debugLog("断点4", uuid, timestamp);
AjaxResult queryResult = null; AjaxResult queryResult = null;
@ -3408,8 +3395,7 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService {
log.error("【销项发票】【大象接口】【发票开具】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(elephantInvoiceAddDTO).toString(), JSONObject.toJSONString(companyservice)); log.error("【销项发票】【大象接口】【发票开具】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(elephantInvoiceAddDTO).toString(), JSONObject.toJSONString(companyservice));
return new HXResponse("系统异常!"); return new HXResponse("系统异常!");
} }
// log.info("【销项发票】【大象发票】发票开具请求结果{}", queryResult.toString()); log.info("【销项发票】【大象发票】发票开具请求结果{}", queryResult.toString());
log.info("【销项发票】【大象发票】发票开具请求结果");
// 判断外层报文是否成功 // 判断外层报文是否成功
if (queryResult.isError()) { if (queryResult.isError()) {
@ -3452,12 +3438,7 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService {
queryBody.put("DDRQQ", "0"); queryBody.put("DDRQQ", "0");
// 订单日期止 // 订单日期止
queryBody.put("DDRQZ", "0");*/ queryBody.put("DDRQZ", "0");*/
CompanyserviceProp companyservicePropBSWJ = companyservicePropMapper.selectPropByKey(companyservice.getCompanyid(), "BSWJ"); queryBody.put("BSWJ", "1");
if (companyservicePropBSWJ != null && StrUtil.isNotEmpty(companyservicePropBSWJ.getValue())) {
queryBody.put("BSWJ", companyservicePropBSWJ.getValue() );
} else {
queryBody.put("BSWJ", "1");
}
// queryResult = ElephantUtils.sendRequest(ElephantConstantsV6.ADD_INVOICE_RESULT, JSONUtil.parse(queryBody)); // queryResult = ElephantUtils.sendRequest(ElephantConstantsV6.ADD_INVOICE_RESULT, JSONUtil.parse(queryBody));
try { try {
queryResult = ElephantUtils.sendRequestWithoutTokenV6New(ElephantConstantsV6.ADD_INVOICE_RESULT_LOCALHOST, ElephantConstantsV6.ADD_INVOICE_RESULT_METHOD, JSONUtil.parse(queryBody), companyservice); queryResult = ElephantUtils.sendRequestWithoutTokenV6New(ElephantConstantsV6.ADD_INVOICE_RESULT_LOCALHOST, ElephantConstantsV6.ADD_INVOICE_RESULT_METHOD, JSONUtil.parse(queryBody), companyservice);

@ -416,29 +416,25 @@ public class InvoiceBackTask {
if (BeanUtil.isEmpty(billInfo)) { if (BeanUtil.isEmpty(billInfo)) {
log.info("billInfo中不存咋,id为:{}", id); log.info("billInfo中不存咋,id为:{}", id);
} }
invoice = new Invoice(); Invoice invoice1 = new Invoice();
invoice.setFpqqlsh(billInfo.getFpqqlsh()); invoice1.setFpqqlsh(billInfo.getFpqqlsh());
invoice.setSellerTaxnum(billInfo.getSellerTaxnum()); invoice1.setSellerTaxnum(billInfo.getSellerTaxnum());
invoice.setOutTradeOrderno(billInfo.getOutTradeOrderno()); invoice1.setOutTradeOrderno(billInfo.getOutTradeOrderno());
} }
Integer state = invoice.getState() != null ? invoice.getState() : 1; Integer state = invoice.getState() != null ? invoice.getState() : 1;
log.info(ZQ_BACK_DXHY + "id={},state={}", id, state); log.info(ZQ_BACK_DXHY + "id={},state={}", id, state);
log.info(ZQ_BACK_DXHY + "请求大象接口更新发票状态,id={},state={}", id, state); log.info(ZQ_BACK_DXHY + "请求大象接口更新发票状态,id={},state={}", id, state);
try { IInvoiceApiService invoiceService = invoiceServiceFactory.getService("elephantV6_invoice");
IInvoiceApiService invoiceService = invoiceServiceFactory.getService("elephantV6_invoice"); Companyservice companyservice = new Companyservice();
Companyservice companyservice = new Companyservice(); companyservice.setCompanyid(Long.valueOf(invoiceBack.getIdentity()));
companyservice.setCompanyid(Long.valueOf(invoiceBack.getIdentity())); companyservice.setSellertax(invoice.getSellerTaxnum());
companyservice.setSellertax(invoice.getSellerTaxnum()); BillInfo billInfo = new BillInfo();
BillInfo billInfo = new BillInfo(); billInfo.setFpqqlsh("[\"" + invoice.getFpqqlsh() + "\"]");
billInfo.setFpqqlsh("[\"" + invoice.getFpqqlsh() + "\"]"); billInfo.setOutTradeOrderno(invoice.getOutTradeOrderno());
billInfo.setOutTradeOrderno(invoice.getOutTradeOrderno()); log.info("发票回调invoice.id={},getOutTradeOrderno()={},invoice.getFpqqlsh()={}", id, invoice.getOutTradeOrderno(), invoice.getFpqqlsh());
log.info("发票回调invoice.id={},getOutTradeOrderno()={},invoice.getFpqqlsh()={}", id, invoice.getOutTradeOrderno(), invoice.getFpqqlsh()); HXResponse resultDxhy = invoiceService.batchQueryInvoices(billInfo, "fpqqlsh", companyservice);
HXResponse resultDxhy = invoiceService.batchQueryInvoices(billInfo, "fpqqlsh", companyservice);
} catch (NumberFormatException e) {
log.info("发票回调,拉取异常,拉取大象异常了,id={},异常原因={}", id,e.toString());
}
log.info("发票回调id={}", id); log.info("发票回调id={}", id);
@ -452,7 +448,7 @@ public class InvoiceBackTask {
continue; continue;
} }
state = invoice.getState(); state = invoice.getState();
log.info(ZQ_BACK_DXHY + "拉后查询状态为,id={},state={}", id, state); log.info(ZQ_BACK_DXHY + "拉后查询状态为,id={},state={}", id, state);
if (state == 20) { if (state == 20) {
log.info(ZQ_BACK_DXHY + "20为开票中,不回调,id={},state={}", id, state); log.info(ZQ_BACK_DXHY + "20为开票中,不回调,id={},state={}", id, state);
@ -481,8 +477,7 @@ public class InvoiceBackTask {
if (message.length() > 200) { if (message.length() > 200) {
message = message.substring(0, Math.min(message.length(), 200)); message = message.substring(0, Math.min(message.length(), 200));
} }
invoiceBack.setResultCode("zq:" + status); invoiceBack.setBackMsg("zq:" + message);
invoiceBack.setResultMsg("zq:" + message);
if ("0000".equals(status)) { if ("0000".equals(status)) {
invoiceBack.setStatus("1"); invoiceBack.setStatus("1");
@ -490,7 +485,7 @@ public class InvoiceBackTask {
invoiceBack.setStatus("3"); invoiceBack.setStatus("3");
} else { } else {
invoiceBack.setStatus("3"); invoiceBack.setStatus("3");
invoiceBack.setBackMsg("k:客户系统回调异常,status=" + status); invoiceBack.setResultMsg("k:客户系统回调异常,status=" + status);
} }
invoiceBack.setUpdateTime(new Date()); invoiceBack.setUpdateTime(new Date());
invoiceBackMapper.updateInvoiceBack(invoiceBack); invoiceBackMapper.updateInvoiceBack(invoiceBack);
@ -518,7 +513,6 @@ public class InvoiceBackTask {
BillInfo billInfoQuery = new BillInfo(); BillInfo billInfoQuery = new BillInfo();
billInfoQuery.setFpqqlsh("[\"" + billInfo.getFpqqlsh() + "\"]"); billInfoQuery.setFpqqlsh("[\"" + billInfo.getFpqqlsh() + "\"]");
billInfoQuery.setOutTradeOrderno(billInfo.getOutTradeOrderno()); billInfoQuery.setOutTradeOrderno(billInfo.getOutTradeOrderno());
billInfoQuery.setSellerTaxnum(billInfo.getSellerTaxnum());
log.info("发票回调getOutTradeOrderno()={},invoice.getFpqqlsh()={}", billInfoQuery.getOutTradeOrderno(), billInfoQuery.getFpqqlsh()); log.info("发票回调getOutTradeOrderno()={},invoice.getFpqqlsh()={}", billInfoQuery.getOutTradeOrderno(), billInfoQuery.getFpqqlsh());
HXResponse resultDxhy = invoiceService.batchQueryInvoices(billInfoQuery, "fpqqlsh", companyservice); HXResponse resultDxhy = invoiceService.batchQueryInvoices(billInfoQuery, "fpqqlsh", companyservice);

@ -735,8 +735,7 @@ public class ElephantUtils {
// 大象v6调用方法(获取结果处理) // 大象v6调用方法(获取结果处理)
log.info("【销项】【大象工具类】调用V6接口,入参{}", JSONUtil.toJsonStr(dxhyInterfaceRequest)); log.info("【销项】【大象工具类】调用V6接口,入参{}", JSONUtil.toJsonStr(dxhyInterfaceRequest));
dxhyInterfaceResponse = InvokeDxhyApi.dxhyInterfaceInvoke(dxhyInterfaceRequest); dxhyInterfaceResponse = InvokeDxhyApi.dxhyInterfaceInvoke(dxhyInterfaceRequest);
// log.info("【销项】【大象工具类】请求成功,结果{}", JSONUtil.toJsonStr(dxhyInterfaceResponse)); log.info("【销项】【大象工具类】请求成功,结果{}", JSONUtil.toJsonStr(dxhyInterfaceResponse));
log.info("【销项】【大象工具类】请求成功,结果");
// 返回报文处理为简税报文 // 返回报文处理为简税报文
String dataDxhy = dxhyInterfaceResponse.getData(); String dataDxhy = dxhyInterfaceResponse.getData();

Loading…
Cancel
Save