重汽联调

beta
kk 2 years ago
parent f16a893f03
commit 41120ad30a
  1. 309
      jianshui-admin/src/main/java/com/jianshui/api/controller/http/invoice/v1/InvoiceController.java
  2. 1
      jianshui-framework/src/main/java/com/jianshui/framework/config/SecurityConfig.java
  3. 2
      jianshui-invoice/src/main/java/com/jianshui/invoice/mapper/BillInfoMapper.java
  4. 4
      jianshui-invoice/src/main/java/com/jianshui/invoice/mapper/InvoiceMapper.java
  5. 10
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/IInvoiceApiService.java
  6. 64
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/adapter/request/AisinoInvoiceRequestAdapterImpl.java
  7. 6
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/AisinoConsoleInvoiceApiServiceImpl.java
  8. 85
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/AisinoConsoleInvoiceApiZhongQiServiceImpl.java
  9. 5
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiServiceImpl.java
  10. 5
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiV6ServiceImpl.java
  11. 5
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/JcskInvoiceApiServiceImpl.java
  12. 15
      jianshui-invoice/src/main/java/com/jianshui/invoice/task/InvoiceBackTask.java
  13. 3
      jianshui-invoice/src/main/resources/mapper/invoice/BillInfoMapper.xml
  14. 2
      jianshui-invoice/src/main/resources/mapper/invoice/InvoiceBackMapper.xml
  15. 16
      jianshui-invoice/src/main/resources/mapper/invoice/InvoiceMapper.xml

@ -5,6 +5,7 @@ import cn.hutool.core.util.IdUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.gson.Gson;
import com.jianshui.common.core.domain.AjaxResult;
import com.jianshui.common.core.domain.entity.Companyservice;
@ -14,6 +15,7 @@ import com.jianshui.common.exception.jianshui.JianshuiServiceException;
import com.jianshui.common.utils.StringUtils;
import com.jianshui.common.utils.http.HttpHelper;
import com.jianshui.common.utils.uuid.IdUtils;
import com.jianshui.framework.manager.AsyncManager;
import com.jianshui.invoice.constant.elephant.ElephantConstants;
import com.jianshui.invoice.domain.BillInfo;
import com.jianshui.invoice.domain.FindRedInfo;
@ -42,6 +44,7 @@ import com.jianshui.system.service.IServiceManageService;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -51,6 +54,7 @@ import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Date;
import java.util.List;
import java.util.TimerTask;
/**
* @Description
@ -85,7 +89,6 @@ public class InvoiceController {
private InvoiceBackMapper invoiceBackMapper;
/**
* 功能描述: 红字查询接口
*
@ -263,7 +266,9 @@ public class InvoiceController {
}
/** 开票查询接口(发票请求流水号)*/
/**
* 开票查询接口发票请求流水号
*/
@Validated
// @ApiOperation("开票查询接口(发票请求流水号)")
@ApiImplicitParams({
@ -273,8 +278,6 @@ public class InvoiceController {
public Object queryInvoice(HttpServletRequest request, String identity) throws Exception {
if (StringUtils.isEmpty(identity)) {
return AjaxResult.error(ErrorCode.EMPTY_IDENTITY);
}
@ -297,7 +300,9 @@ public class InvoiceController {
return invoiceResponseService.response(result, companyservice, "query");
}
/** 开票查询接口(订单号)*/
/**
* 开票查询接口订单号
*/
@Validated
// @ApiOperation("开票查询接口(订单号)")
@ApiImplicitParams({
@ -328,7 +333,9 @@ public class InvoiceController {
}
/** 开票查询接口(范围查询)*/
/**
* 开票查询接口范围查询
*/
@Validated
// @ApiOperation("开票查询接口(范围查询)")
@ApiImplicitParams({
@ -359,7 +366,9 @@ public class InvoiceController {
}
/** 作废发票*/
/**
* 作废发票
*/
@Validated
// @ApiOperation("作废发票")
@ApiImplicitParams({
@ -399,7 +408,9 @@ public class InvoiceController {
return invoiceResponseService.response(result, companyservice, "deprecate");
}
/** 作废发票结果查询*/
/**
* 作废发票结果查询
*/
@Validated
// @ApiOperation("作废发票结果查询")
@ApiImplicitParams({
@ -484,7 +495,9 @@ public class InvoiceController {
}
/** 红字信息表下载*/
/**
* 红字信息表下载
*/
@Validated
// @ApiOperation("红字信息表下载")
@ApiImplicitParams({
@ -526,7 +539,9 @@ public class InvoiceController {
return invoiceResponseService.response(result, companyservice, "download_redinfo");
}
/** 发票推送接口*/
/**
* 发票推送接口
*/
@Validated
// @ApiOperation("发票推送接口")
@ApiImplicitParams({
@ -571,7 +586,9 @@ public class InvoiceController {
}
/** 发票批量打印接口*/
/**
* 发票批量打印接口
*/
@Validated
// @ApiOperation("发票批量打印接口")
@ApiImplicitParams({
@ -615,7 +632,9 @@ public class InvoiceController {
return invoiceResponseService.response(result, companyservice, "batch_print");
}
/** 打印机查询接口*/
/**
* 打印机查询接口
*/
@Validated
// @ApiOperation("打印机查询接口")
@ApiImplicitParams({
@ -659,7 +678,9 @@ public class InvoiceController {
return invoiceResponseService.response(result, companyservice, "printer");
}
/** 发票签章*/
/**
* 发票签章
*/
@Validated
// @ApiOperation("发票签章")
@ApiImplicitParams({
@ -689,7 +710,9 @@ public class InvoiceController {
return invoiceResponseService.response(result, companyservice, "sign_e_seal");
}
/** 发票专用章导入注册*/
/**
* 发票专用章导入注册
*/
@Validated
// @ApiOperation("发票专用章导入注册")
@ApiImplicitParams({
@ -719,7 +742,9 @@ public class InvoiceController {
return invoiceResponseService.response(result, companyservice, "register_e_seal");
}
/** 发票专用章图片生成*/
/**
* 发票专用章图片生成
*/
@Validated
// @ApiOperation("发票专用章图片生成")
@ApiImplicitParams({
@ -1021,7 +1046,9 @@ public class InvoiceController {
* @Return
*/
/** 通用异步查询接口*/
/**
* 通用异步查询接口
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@ -1056,7 +1083,9 @@ public class InvoiceController {
}
/** 获取发票下载地址*/
/**
* 获取发票下载地址
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@ -1091,7 +1120,9 @@ public class InvoiceController {
}
/** 全电文件获取*/
/**
* 全电文件获取
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@ -1129,7 +1160,9 @@ public class InvoiceController {
}
/** 获取人脸识别二维码*/
/**
* 获取人脸识别二维码
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@ -1166,7 +1199,9 @@ public class InvoiceController {
}
/** 获取人脸识别结果*/
/**
* 获取人脸识别结果
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@ -1203,8 +1238,9 @@ public class InvoiceController {
}
/** 发票查询*/
/**
* 发票查询
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@ -1241,7 +1277,9 @@ public class InvoiceController {
}
/** 获取发票打印XML*/
/**
* 获取发票打印XML
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@ -1278,7 +1316,9 @@ public class InvoiceController {
}
/** 快速红冲*/
/**
* 快速红冲
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@ -1316,7 +1356,9 @@ public class InvoiceController {
}
/** 蓝字发票统计*/
/**
* 蓝字发票统计
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@ -1352,7 +1394,9 @@ public class InvoiceController {
}
/** 审核红字信息表*/
/**
* 审核红字信息表
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@ -1390,7 +1434,9 @@ public class InvoiceController {
}
/** 查询红字信息表明细*/
/**
* 查询红字信息表明细
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@ -1427,7 +1473,9 @@ public class InvoiceController {
}
/** 单据传入*/
/**
* 单据传入
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@ -1456,7 +1504,9 @@ public class InvoiceController {
}
/** 大象数电V6 */
/** 生成动态二维码接口 (扫码开票)*/
/**
* 生成动态二维码接口 扫码开票
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@ -1488,7 +1538,9 @@ public class InvoiceController {
}
/** 红字确认单列表查询(数电专用) */
/**
* 红字确认单列表查询数电专用
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@ -1520,7 +1572,9 @@ public class InvoiceController {
}
/** 红字确认单明细查询(数电专用) */
/**
* 红字确认单明细查询(数电专用)
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@ -1585,7 +1639,9 @@ public class InvoiceController {
}*/
/** 红字确认单确认(数电专用) */
/**
* 红字确认单确认(数电专用)
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@ -1618,7 +1674,9 @@ public class InvoiceController {
}
/** 数电登录接口(数电专用接口) */
/**
* 数电登录接口(数电专用接口)
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@ -1651,7 +1709,9 @@ public class InvoiceController {
}
/** 数电实名认证状态查询接口(数电专用接口) */
/**
* 数电实名认证状态查询接口(数电专用接口)
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@ -1684,7 +1744,9 @@ public class InvoiceController {
}
/** 发票平台电子税局账号查询接口(数电专用接口) */
/**
* 发票平台电子税局账号查询接口(数电专用接口)
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@ -1717,8 +1779,9 @@ public class InvoiceController {
}
/** 导出机动车加密数据(重汽) */
/**
* 导出机动车加密数据(重汽)
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@ -1751,7 +1814,6 @@ public class InvoiceController {
}
/**
* 批量 开票请求接口-蓝字发票开具红字发票开具
*
@ -1768,21 +1830,24 @@ public class InvoiceController {
@PostMapping({"/api/invoice/v1/addInvoiceBatch", "/api/invoice/v1/addInvoiceBatch/{identity}", "/invoice/addInvoiceBatch"})
public void addInvoiceBatch(HttpServletRequest request, String identity) throws Exception {
// 异步任务
// 1-前置条件判断
InvoiceBack invoiceBack = new InvoiceBack();
invoiceBack.setUpdateTime(new Date());
invoiceBack.setCreateTime(new Date());
invoiceBack.setId(IdUtil.randomUUID());
invoiceBack.setSystemOrderno(IdUtil.randomUUID());
invoiceBack.setStatus("1");
invoiceBack.setIdentity(identity);
invoiceBack.setBackMsg("");
invoiceBack.setBackUrl("");
// InvoiceBack invoiceBack = new InvoiceBack();
// invoiceBack.setUpdateTime(new Date());
// invoiceBack.setCreateTime(new Date());
// invoiceBack.setId(IdUtil.randomUUID());
// invoiceBack.setSystemOrderno(IdUtil.randomUUID());
// invoiceBack.setStatus("1");
// invoiceBack.setIdentity(identity);
// invoiceBack.setBackMsg("");
// invoiceBack.setBackUrl("");
// 1-1 identity校验
if (StringUtils.isEmpty(identity)) {
invoiceBack.setResultCode("9999");
invoiceBack.setResultMsg("身份认证参数为空!");
// invoiceBack.setResultCode("9999");
// invoiceBack.setResultMsg("身份认证参数为空!");
log.info("[重汽批量开票接口]身份认证参数为空!");
return;
}
@ -1792,15 +1857,15 @@ public class InvoiceController {
try {
companyservice = iCompanyserviceService.selectCompanyserviceByIdentity(identity);
} catch (Exception e) {
invoiceBack.setResultCode("9999");
invoiceBack.setResultMsg("企业信息不存在!");
log.info("[重汽批量开票接口]获取企业信息异常!identity={},e={}",identity,e);
// invoiceBack.setResultCode("9999");
// invoiceBack.setResultMsg("企业信息不存在!");
log.info("[重汽批量开票接口]获取企业信息异常!identity={},e={}", identity, e);
return;
}
if (companyservice == null) {
invoiceBack.setResultCode("9999");
invoiceBack.setResultMsg("企业信息不存在!");
log.info("[重汽批量开票接口]企业信息不存在!identity={}",identity);
// invoiceBack.setResultCode("9999");
// invoiceBack.setResultMsg("企业信息不存在!");
log.info("[重汽批量开票接口]企业信息不存在!identity={}", identity);
return;
}
@ -1809,11 +1874,11 @@ public class InvoiceController {
try {
String requestAdapterKey = serviceManageService.getRequestAdapterKey("invoice", companyservice.getCompanyid());
IInvoiceRequestService invoiceRequestService = invoiceRequestFactory.getService(requestAdapterKey);
decryptResult = invoiceRequestService.decrypt(request, companyservice, "add");
decryptResult = invoiceRequestService.decrypt(request, companyservice, "addBatch");
} catch (Exception e) {
invoiceBack.setResultCode("9999");
invoiceBack.setResultMsg("请求解密失败!");
log.info("[重汽批量开票接口]请求解密失败!identity={}",identity);
// invoiceBack.setResultCode("9999");
// invoiceBack.setResultMsg("请求解密失败!");
log.info("[重汽批量开票接口]请求解密失败!identity={},e={}", identity, e);
return;
}
@ -1822,15 +1887,15 @@ public class InvoiceController {
try {
billJson = JSONUtil.parseObj(decryptResult);
} catch (Exception e) {
invoiceBack.setResultCode("9999");
invoiceBack.setResultMsg("未匹配到发票报文!");
log.info("[重汽批量开票接口]报文格式化异常!identity={},e={}",identity,e);
// invoiceBack.setResultCode("9999");
// invoiceBack.setResultMsg("未匹配到发票报文!");
log.info("[重汽批量开票接口]报文格式化异常!identity={},e={}", identity, e);
return;
}
if(billJson.get("billInfo") == null ){
invoiceBack.setResultCode("9999");
invoiceBack.setResultMsg("未匹配到发票报文!");
log.info("[重汽批量开票接口]未匹配到发票报文!identity={}",identity);
if (billJson.get("billInfo") == null) {
// invoiceBack.setResultCode("9999");
// invoiceBack.setResultMsg("未匹配到发票报文!");
log.info("[重汽批量开票接口]未匹配到发票报文!identity={}", identity);
return;
}
@ -1838,26 +1903,37 @@ public class InvoiceController {
try {
billJsonArray = JSONUtil.parseArray(billJson.get("billInfo"));
} catch (Exception e) {
invoiceBack.setResultCode("9999");
invoiceBack.setResultMsg("发票报文为空!");
log.info("[重汽批量开票接口]发票报文获取异常!identity={},e={}",identity,e);
// invoiceBack.setResultCode("9999");
// invoiceBack.setResultMsg("发票报文为空!");
log.info("[重汽批量开票接口]发票报文获取异常!identity={},e={}", identity, e);
return;
}
if(billJsonArray.size() == 0){
invoiceBack.setResultCode("9999");
invoiceBack.setResultMsg("发票报文为空!");
log.info("[重汽批量开票接口]发票报文为空!identity={}",identity);
if (billJsonArray.size() == 0) {
// invoiceBack.setResultCode("9999");
// invoiceBack.setResultMsg("发票报文为空!");
log.info("[重汽批量开票接口]发票报文为空!identity={}", identity);
return;
}
// 3-报文递交开票
for (Object billInfoObj : billJsonArray) {
BillInfo billInfo = BeanUtil.copyProperties(billInfoObj,BillInfo.class);
// 1-前置条件判断
InvoiceBack invoiceBack = new InvoiceBack();
invoiceBack.setUpdateTime(new Date());
invoiceBack.setCreateTime(new Date());
invoiceBack.setId(IdUtil.randomUUID());
invoiceBack.setSystemOrderno(IdUtil.randomUUID());
invoiceBack.setStatus("1");
invoiceBack.setIdentity(identity);
invoiceBack.setBackMsg("");
invoiceBack.setBackUrl("");
BillInfo billInfo = BeanUtil.copyProperties(billInfoObj, BillInfo.class);
if (billInfo == null) {
invoiceBack.setResultCode("9999");
invoiceBack.setResultMsg("报文格式错误!");
log.info("[重汽批量开票接口]报文格式错误!identity={}",identity);
// invoiceBack.setResultCode("9999");
// invoiceBack.setResultMsg("报文格式错误!");
log.info("[重汽批量开票接口]报文格式错误!identity={}", identity);
continue;
}
billInfo.setSource("2");
@ -1870,47 +1946,78 @@ public class InvoiceController {
billInfo.setServiceSupplierKey(serviceKey);
invoiceService = invoiceServiceFactory.getService(serviceKey);
} catch (Exception e) {
invoiceBack.setResultCode("9999");
invoiceBack.setResultMsg("扣费失败!");
log.info("[重汽批量开票接口]扣费失败!identity={},e={}",identity,e);
// invoiceBack.setResultCode("9999");
// invoiceBack.setResultMsg("扣费失败!");
log.info("[重汽批量开票接口]扣费失败!identity={},e={}", identity, e);
continue;
}
// 5-开票
try {
HXResponse resultHx = invoiceService.addInvoice(billInfo, companyservice);
log.info("[重汽批量开票接口]开票identity={},返回结果result={}",identity,resultHx);
if(!resultHx.isSuccess()){
invoiceBack.setResultCode("9999");
invoiceBack.setResultMsg(resultHx.getMessage());
invoiceBack.setSystemOrderno(billInfo.getSystemOrderno());
invoiceBack.setStatus("0");
invoiceBackMapper.insertInvoiceBack(invoiceBack);
log.info("[重汽批量开票接口]提交开票异常,开票失败!identity={},msg={}",identity,resultHx.getMessage());
log.info("[重汽批量开票接口]开票identity={},返回结果result={}", identity, resultHx);
if (!resultHx.isSuccess()) {
QueryWrapper<InvoiceBack> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("system_orderno", billInfo.getOutTradeOrderno());
InvoiceBack invoiceBackTemp = invoiceBackMapper.selectOne(queryWrapper);
if (invoiceBackTemp != null) {
invoiceBackTemp.setResultCode("9999");
invoiceBackTemp.setResultMsg(resultHx.getMessage());
invoiceBackTemp.setStatus("0");
invoiceBackTemp.setUpdateTime(new Date());
invoiceBackMapper.updateInvoiceBack(invoiceBackTemp);
invoiceService.callBackAisino(invoiceBackTemp,"", Long.valueOf(identity));
} else {
invoiceBack.setResultCode("9999");
invoiceBack.setResultMsg(resultHx.getMessage());
invoiceBack.setSystemOrderno(billInfo.getOutTradeOrderno());
invoiceBack.setStatus("0");
invoiceBack.setCreateTime(new Date());
invoiceBackMapper.insertInvoiceBack(invoiceBack);
invoiceService.callBackAisino(invoiceBackTemp,"", Long.valueOf(identity));
}
log.info("[重汽批量开票接口]提交开票异常,开票失败!identity={},msg={}", identity, resultHx.getMessage());
continue;
}
} catch (Exception e) {
invoiceBack.setResultCode("9999");
invoiceBack.setResultMsg("开票失败!");
invoiceBack.setSystemOrderno(billInfo.getSystemOrderno());
invoiceBack.setStatus("0");
invoiceBackMapper.insertInvoiceBack(invoiceBack);
log.info("[重汽批量开票接口]提交开票异常,开票失败!identity={},e={}",identity,e);
continue;
}
}
log.info("[重汽批量开票接口]{},执行完成!",identity);
}
QueryWrapper<InvoiceBack> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("system_orderno", billInfo.getOutTradeOrderno());
InvoiceBack invoiceBackTemp = invoiceBackMapper.selectOne(queryWrapper);
if (invoiceBackTemp != null) {
invoiceBackTemp.setResultCode("9999");
invoiceBackTemp.setResultMsg("开票失败!");
invoiceBackTemp.setStatus("0");
invoiceBackTemp.setUpdateTime(new Date());
invoiceBackMapper.updateInvoiceBack(invoiceBackTemp);
invoiceService.callBackAisino(invoiceBackTemp,"", Long.valueOf(identity));
} else {
invoiceBack.setResultCode("9999");
invoiceBack.setResultMsg("开票失败!");
invoiceBack.setSystemOrderno(billInfo.getOutTradeOrderno());
invoiceBack.setStatus("0");
invoiceBack.setCreateTime(new Date());
invoiceBackMapper.insertInvoiceBack(invoiceBack);
invoiceService.callBackAisino(invoiceBackTemp,"", Long.valueOf(identity));
}
log.info("[重汽批量开票接口]提交开票异常,开票失败!identity={},e={}", identity, e);
continue;
}
}
log.info("[重汽批量开票接口]{},执行完成!", identity);
}
}

@ -110,6 +110,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers(
"/invoice/redInvoiceApply",
"/invoice/addInvoice",
"/invoice/addInvoiceBatch",
"/invoice/queryInvoice",
"/invoice/queryInvoiceByOrderNo",
"/invoice/redInvoiceDownload",

@ -100,6 +100,6 @@ public interface BillInfoMapper extends BaseMapper<BillInfo> {
public BillInfo selectByOutTradeOrderno(@Param(("companyId")) Long companyId, @Param("out_trade_orderno") String outTradeOrderno);
public BillInfo selectByOutTradeOrdernoNotDel(@Param(("companyId")) Long companyId, @Param("out_trade_orderno") String outTradeOrderno, @Param("updateBy") String updateBy);
public List<BillInfo> selectByOutTradeOrdernoNotDel(@Param(("companyId")) Long companyId, @Param("out_trade_orderno") String outTradeOrderno, @Param("updateBy") String updateBy);
}

@ -98,6 +98,10 @@ public interface InvoiceMapper extends BaseMapper<Invoice> {
*/
public Invoice selectBySystemOrderNo(@Param(("companyId")) Long companyId, @Param("system_orderno") String systemOrderNo);
/** 根据客户系统订单号查询发票 update_by 为0的未删除的 */
public Invoice selectByOutTradeOrderno(@Param(("companyId")) Long companyId, @Param("out_trade_orderno") String systemOrderNo,@Param("update_by") String updateBy);
public List<Invoice> selectByOutTradeOrdernoList(@Param(("companyId")) Long companyId, @Param("out_trade_orderno") String systemOrderNo,@Param("update_by") String updateBy);
/**
* 查询发票信息目前用于控制台发票查询返回整合selectInvoiceByIdselectBySystemOrderNoselectByFpdmFphm有新加字段的时候一起改着这个SQL

@ -3,10 +3,7 @@ package com.jianshui.invoice.service;
import com.alibaba.fastjson.JSONObject;
import com.jianshui.common.core.domain.AjaxResult;
import com.jianshui.common.core.domain.entity.Companyservice;
import com.jianshui.invoice.domain.BillInfo;
import com.jianshui.invoice.domain.FindRedInfo;
import com.jianshui.invoice.domain.Invoice;
import com.jianshui.invoice.domain.Redinfo;
import com.jianshui.invoice.domain.*;
import com.jianshui.invoice.domain.dto.*;
import com.jianshui.invoice.domain.dto.api.*;
import com.jianshui.invoice.domain.ele.EleNewMessage;
@ -154,6 +151,8 @@ public interface IInvoiceApiService {
*/
public HXResponse deprecateQueryInvoice(DeprecateQueryInvoiceDTO invoice, Companyservice companyservice);
/**
* 打印接口
*
@ -349,4 +348,7 @@ public interface IInvoiceApiService {
/** 获取人脸识别结果*/
HXResponse qrcodeResult(JSONObject decryptResult, Companyservice companyservice);
/** 回调方法*/
void callBackAisino(InvoiceBack invoiceBack, String callBackUrl, Long id);
}

@ -1,7 +1,9 @@
package com.jianshui.invoice.service.impl.adapter.request;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONArray;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.jianshui.common.core.domain.entity.Companyservice;
import com.jianshui.common.enums.ErrorCode;
@ -191,6 +193,66 @@ public class AisinoInvoiceRequestAdapterImpl implements IInvoiceRequestService {
json = (JSONObject) JSONObject.toJSON(billInfo);
}
if (StringUtils.equals(serviceKey, "addBatch") ) {
JSONArray billInfoList = JSONUtil.parseArray(json.get("billInfo"));
JSONArray billInfoResult = new JSONArray();
for (Object billInfoTemp : billInfoList) {
// 开始把航信报文转成billInfo
JSONObject orderJsonTemp = JSONObject.parseObject(String.valueOf(billInfoTemp));
HxBillInfoDTO hxBillInfo = orderJsonTemp.toJavaObject(HxBillInfoDTO.class);
BillInfo billInfo = new BillInfo();
BeanUtils.copyProperties(hxBillInfo, billInfo);
if(StringUtils.isNotEmpty(hxBillInfo.getEmail())){
billInfo.setBuyerEmail(hxBillInfo.getEmail());
}
if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) {
String bankNo = IdcardUtils.getBankNo(billInfo.getBuyerAccount());
if (StringUtils.isNotEmpty(bankNo)) {
String raw = billInfo.getBuyerAccount();
billInfo.setBuyerAccount(bankNo);
billInfo.setBuyerBank(raw.replace(bankNo, ""));
}
}
// 处理detail
List<HxBillDetailDTO> hxBillDetailList = hxBillInfo.getDetail();
List<BillDetail> detailList = new ArrayList<>();
if (hxBillDetailList != null && hxBillDetailList.size() > 0) {
for (HxBillDetailDTO detial : hxBillDetailList) {
BillDetail temp = new BillDetail();
BeanUtils.copyProperties(detial, temp);
detailList.add(temp);
}
billInfo.setBillDetailList(detailList);
}
if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) {
String bankNo = IdcardUtils.getBankNo(billInfo.getBuyerAccount());
if (StringUtils.isNotEmpty(bankNo)) {
String raw = billInfo.getBuyerAccount();
billInfo.setBuyerAccount(bankNo);
billInfo.setBuyerBank(raw.replace(bankNo, ""));
}
}
// 处理销方信息
if (StringUtils.isEmpty(billInfo.getSellerBank()) && StringUtils.isNotEmpty(billInfo.getSellerAccount())) {
String bankNo = IdcardUtils.getBankNo(billInfo.getSellerAccount());
if (StringUtils.isNotEmpty(bankNo)) {
String raw = billInfo.getSellerAccount();
billInfo.setSellerAccount(bankNo);
billInfo.setSellerBank(raw.replace(bankNo, ""));
}
}
json = (JSONObject) JSONObject.toJSON(billInfo);
billInfoResult.add(json);
}
// 清除数据,重新组装
json.clear();
json.put("billInfo",billInfoResult);
}
// 如果是redinfo
if (StringUtils.equals(serviceKey, "add_redinfo")) {
// 开始把航信报文转成billInfo

@ -1039,6 +1039,12 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService {
return null;
}
@Override
public void callBackAisino(InvoiceBack invoiceBack, String callBackUrl, Long id) {
}
@Override
public AjaxResult syncStockInfo(Companyservice companyservice) {
return null;

@ -3,10 +3,7 @@ package com.jianshui.invoice.service.impl.api;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.net.URLDecoder;
import cn.hutool.core.util.*;
import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSON;
@ -43,17 +40,12 @@ import com.jianshui.invoice.utils.BillInfoUtils;
import com.jianshui.invoice.utils.aisino.console.AisinoConsoleUtil;
import com.jianshui.system.domain.CompanyserviceProp;
import com.jianshui.system.service.ICompanyservicePropService;
import io.lettuce.core.StrAlgoArgs;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContexts;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
@ -62,18 +54,11 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.servlet.http.HttpServletRequest;
import java.io.*;
import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.*;
/**
@ -124,9 +109,24 @@ public class AisinoConsoleInvoiceApiZhongQiServiceImpl implements IInvoiceApiSer
return new HXResponse("订单号为空,请检查报文!");
}
// update_by 0未删除 1已删除
BillInfo billInfoValidate = billInfoMapper.selectByOutTradeOrdernoNotDel(companyservice.getCompanyid(), outNO,"0");
if (BeanUtil.isNotEmpty(billInfoValidate)) {
return new HXResponse("订单号不允许重复!!!");
Invoice invoiceValidateTemp = new Invoice();
List<Invoice> invoicesValidate = invoiceMapper.selectByOutTradeOrdernoList(companyservice.getCompanyid(), outNO, "0");
// 这里去直接跳出,更新推送关系表去重新推送一下看看。
if (CollectionUtils.isEmpty(invoicesValidate)) {
for (Invoice invoice : invoicesValidate) {
QueryWrapper<InvoiceBack> invoiceBackQueryWrapper = new QueryWrapper<>();
invoiceBackQueryWrapper.eq("system_orderno", invoice.getOutTradeOrderno());
List<InvoiceBack> invoiceBackList = invoiceBackMapper.selectList(invoiceBackQueryWrapper);
for (InvoiceBack invoiceBack : invoiceBackList) {
if ("0000".equals(invoiceBack.getResultCode())) {
invoiceBack.setStatus("0");
invoiceBackMapper.updateInvoiceBack(invoiceBack);
log.error("【销项】【总部控制台发票】开票接口,重复订单启动推送,订单号={}", invoice.getOutTradeOrderno());
return new HXResponse("0000", "重复订单已推送!");
}
}
}
}
// end
@ -238,7 +238,7 @@ public class AisinoConsoleInvoiceApiZhongQiServiceImpl implements IInvoiceApiSer
try {
ValidateUtils.validate(aisinoConsoleInvoiceAddDTO, companyservice, null);
} catch (RuntimeException e) {
return new HXResponse("订单必填字段校验失败!{}",e.getMessage() != null ? e.getMessage().substring(0,100):"");
return new HXResponse("订单必填字段校验失败!{}", e.getMessage() != null ? e.getMessage().substring(0, 100) : "");
}
//发票明细处理
@ -358,17 +358,22 @@ public class AisinoConsoleInvoiceApiZhongQiServiceImpl implements IInvoiceApiSer
invoice.setTaxfreeamt(BigDecimal.valueOf(aisinoConsoleInvoiceAddVO.getInfoAmount()));
invoice.setTax(BigDecimal.valueOf(aisinoConsoleInvoiceAddVO.getInfoTaxAmount()));
// 开票结果处理
// Integer state = invoice.getState();
long id = 0L;
QueryWrapper<Invoice> invoiceQueryWrapper = new QueryWrapper<>();
invoiceQueryWrapper.eq("fpdm", invoice.getFpdm()).eq("fphm", invoice.getFphm());
List<Invoice> invoices = invoiceMapper.selectList(invoiceQueryWrapper);
if (CollectionUtils.isEmpty(invoices)) {
invoice.setUpdateBy("0");
invoiceMapper.insertInvoice(invoice);
invoices = invoiceMapper.selectList(invoiceQueryWrapper);
id = invoices.get(0).getId();
} else {
Invoice invoiceT = invoices.get(0);
invoiceT = BeanUtil.copyProperties(invoice, Invoice.class);
invoiceT.setUpdateBy("0");
invoiceMapper.updateInvoice(invoiceT);
id = invoiceT.getId();
}
@ -384,7 +389,7 @@ public class AisinoConsoleInvoiceApiZhongQiServiceImpl implements IInvoiceApiSer
String callBackUrl = secretIdProp.getValue();
InvoiceBack queryInvoiceBack = new InvoiceBack();
queryInvoiceBack.setSystemOrderno(billInfo.getSystemOrderno());
queryInvoiceBack.setSystemOrderno(billInfo.getOutTradeOrderno());
List<InvoiceBack> invoiceBackList = invoiceBackMapper.selectInvoiceBackList(queryInvoiceBack);
if (CollectionUtils.isEmpty(invoiceBackList)) {
queryInvoiceBack.setId(IdUtils.randomUUID());
@ -392,7 +397,7 @@ public class AisinoConsoleInvoiceApiZhongQiServiceImpl implements IInvoiceApiSer
queryInvoiceBack.setBackUrl(callBackUrl);
queryInvoiceBack.setStatus("0");
queryInvoiceBack.setCreateTime(new Date());
queryInvoiceBack.setSystemOrderno(billInfo.getSystemOrderno());
queryInvoiceBack.setSystemOrderno(billInfo.getOutTradeOrderno());
queryInvoiceBack.setBackMsg("");
invoiceBackMapper.insertInvoiceBack(queryInvoiceBack);
} else {
@ -405,11 +410,11 @@ public class AisinoConsoleInvoiceApiZhongQiServiceImpl implements IInvoiceApiSer
@Override
public void run() {
try {
Long c = Long.valueOf(RandomUtil.randomInt(3, 5));
Thread.sleep(c * 1000);
// Long c = Long.valueOf(RandomUtil.randomInt(1, 2));
// Thread.sleep(c * 1000);
callBackAisino(finalQueryInvoiceBack, callBackUrl, invoice.getId());
} catch (InterruptedException e) {
} catch (Exception e) {
log.info("【重汽批量开票】发票回调失败!invoiceId={}", invoice.getId());
}
}
});
@ -431,7 +436,8 @@ public class AisinoConsoleInvoiceApiZhongQiServiceImpl implements IInvoiceApiSer
* @param callBackUrl
* @param id
*/
private void callBackAisino(InvoiceBack invoiceBack, String callBackUrl, Long id) {
@Override
public void callBackAisino(InvoiceBack invoiceBack, String callBackUrl, Long id) {
// TODO: 2023/10/27 回调处理
@ -440,22 +446,35 @@ public class AisinoConsoleInvoiceApiZhongQiServiceImpl implements IInvoiceApiSer
return;
}
// 回调地址获取
if (StrUtil.isEmpty(callBackUrl)) {
ICompanyservicePropService companyserviceProp = SpringUtils.getBean(ICompanyservicePropService.class);
CompanyserviceProp secretIdProp = companyserviceProp.selectPropByKey(id, "aisino_callback_url");
if (BeanUtil.isNotEmpty(secretIdProp) && secretIdProp.getValue() != null && !"".equals(secretIdProp.getValue())) {
callBackUrl = secretIdProp.getValue();
}
}
Invoice invoice = invoiceMapper.selectInvoiceById(id);
if (invoice == null) {
log.info("【控制台】发票信息未查询到,id={}", id);
return;
}
cn.hutool.json.JSONObject jsonResult = new cn.hutool.json.JSONObject();
jsonResult.set("status", invoiceBack.getResultCode());
jsonResult.set("message", invoiceBack.getResultMsg());
jsonResult.set("data", invoice);
try {
log.info("【控制台】发票回调接口,发送数据开始,id={}", id);
String result = HttpUtil.post(callBackUrl, JSONUtil.toJsonStr(invoice));
String result = HttpUtil.post(callBackUrl, JSONUtil.toJsonStr(jsonResult));
log.info("【控制台】发票回调接口,发送数据结束,id={},接口返回信息={}", id, result);
cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(result);
if (jsonObject != null) {
String status = jsonObject.get("Result") != null ? jsonObject.get("Result").toString() : "";
String message = jsonObject.get("Message") != null ? jsonObject.get("Message").toString() : "";
String status = jsonObject.get("status") != null ? jsonObject.get("status").toString() : "";
String message = jsonObject.get("message") != null ? jsonObject.get("message").toString() : "";
if ("0000".equals(status)) {
invoiceBack.setStatus("1");
@ -476,7 +495,6 @@ public class AisinoConsoleInvoiceApiZhongQiServiceImpl implements IInvoiceApiSer
invoiceBack.setStatus("2");
invoiceBack.setBackMsg("发送数据异常!");
invoiceBackMapper.updateInvoiceBack(invoiceBack);
throw new RuntimeException(e);
}
}
@ -973,7 +991,7 @@ public class AisinoConsoleInvoiceApiZhongQiServiceImpl implements IInvoiceApiSer
return new HXResponse("9999", "系统异常!!!");
}
return new HXResponse("0000", "查询成功!",red,true);
return new HXResponse("0000", "查询成功!", red, true);
}
}
@ -1048,7 +1066,7 @@ public class AisinoConsoleInvoiceApiZhongQiServiceImpl implements IInvoiceApiSer
// 解析
List<Redinfo> redinfoList = null;
try {
redinfoList = new ArrayList<>();
redinfoList = new ArrayList<>();
for (DownloadJdcVO downloadJdcVO : downloadJdcVOList) {
RedinfoCopyAisinoVO redinfoCopyAisinoVO = BeanUtil.copyProperties(downloadJdcVO, RedinfoCopyAisinoVO.class);
@ -1072,6 +1090,7 @@ public class AisinoConsoleInvoiceApiZhongQiServiceImpl implements IInvoiceApiSer
// return new HXResponse("0000", red);
}
/**
* @author kk
* @date 15:25

@ -863,6 +863,11 @@ public class ElephantInvoiceApiServiceImpl implements IInvoiceApiService {
return null;
}
@Override
public void callBackAisino(InvoiceBack invoiceBack, String callBackUrl, Long id) {
}
/**
* 申请/上传 红字发票

@ -884,6 +884,11 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService {
}
@Override
public void callBackAisino(InvoiceBack invoiceBack, String callBackUrl, Long id) {
}
/**
* 红字确认单列表查询数电专用
*/

@ -1649,6 +1649,11 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
}
}
@Override
public void callBackAisino(InvoiceBack invoiceBack, String callBackUrl, Long id) {
}
/**
* 简税和金财数科 发票类型互换
*

@ -79,7 +79,7 @@ public class InvoiceBackTask
break;
}
Invoice invoice = invoiceMapper.selectBySystemOrderNo(Long.valueOf(identity),id);
Invoice invoice = invoiceMapper.selectByOutTradeOrderno(Long.valueOf(identity),id,"0");
if (invoice == null) {
log.info("【控制台】发票信息未查询到,id={}", id);
invoiceBack.setStatus("3");
@ -89,13 +89,18 @@ public class InvoiceBackTask
}
try {
log.info("【控制台】发票回调接口,发送数据开始,id={}", id);
String result = HttpUtil.post(callBackUrl, JSONUtil.toJsonStr(invoice));
cn.hutool.json.JSONObject jsonResult = new cn.hutool.json.JSONObject();
jsonResult.set("status",invoiceBack.getResultCode());
jsonResult.set("message",invoiceBack.getResultMsg());
jsonResult.set("data",invoice);
log.info("【控制台】发票回调接口,发送数据开始,id={},orderno={}", id,invoice.getOutTradeOrderno());
String result = HttpUtil.post(callBackUrl, JSONUtil.toJsonStr(jsonResult));
log.info("【控制台】发票回调接口,发送数据结束,id={},接口返回信息={}", id, result);
JSONObject jsonObject = JSONUtil.parseObj(result);
if(jsonObject != null){
String status = jsonObject.get("Result") != null ? jsonObject.get("Result").toString():"";
String message = jsonObject.get("Message")!= null ? jsonObject.get("Message").toString():"";
String status = jsonObject.get("status") != null ? jsonObject.get("status").toString():"";
String message = jsonObject.get("message")!= null ? jsonObject.get("message").toString():"";
if("0000".equals(status)){
invoiceBack.setStatus("1");

@ -562,8 +562,7 @@
left join bill_detail b on b.bill_info_id = a.id
where a.company_id = #{companyId}
and a.out_trade_orderno = #{out_trade_orderno}
and update_by = #{updateBy}
limit 1
and a.update_by = #{updateBy}
</select>

@ -78,7 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time = #{createTime},</if>
<if test="backMsg != null">back_msg = #{backMsg},</if>
<if test="resultMsg != null">result_msg = #{resultMsg},</if>
<if test="resultCode != null">resultCode = #{resultCode},</if>
<if test="resultCode != null">result_code = #{resultCode},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}

@ -236,6 +236,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where a.company_id = #{companyId} and a.system_orderno = #{system_orderno} order by a.id desc limit 1
</select>
<select id="selectByOutTradeOrderno" resultMap="InvoiceInvoiceDetailResult">
select a.id, a.bill_info_id, a.company_id, a.system_orderno, a.out_trade_orderno, a.fpqqlsh, a.invoice_type, a.state, a.c_invoiceid, a.fpdm, a.fphm, a.kprq, a.buyer_name, a.buyer_taxnum, a.buyer_address, a.buyer_telephone, a.buyer_account, a.buyer_email, a.buyer_phone, a.seller_name, a.seller_taxnum, a.seller_address, a.seller_telephone, a.seller_account, a.message, a.clerk, a.payee, a.checker, a.taxfreeamt, a.tax, a.taxamt, a.origin_fpdm, a.origin_fphm, a.jym, a.qr_code, a.machine_code, a.cipher_text, a.invoice_pdf_url, a.invoice_jpg_url,a.invoice_file_storage, a.invoice_msg, a.invoice_result_msg, a.product_oil_flag, a.qdbz, a.c_ofd_url, a.fjh, a.terminal_number,a.deprecate_type,a.deprecate_reason, a.create_by, a.create_time, a.update_by, a.update_time,
b.id as sub_id, b.invoice_id as sub_invoice_id, b.index as sub_index, b.good_name as sub_good_name, b.num as sub_num, b.price as sub_price, b.hsbz as sub_hsbz, b.taxrate as sub_taxrate, b.spec as sub_spec, b.unit as sub_unit, b.spbm as sub_spbm, b.bmbbh as sub_bmbbh, b.zsbm as sub_zsbm, b.fphxz as sub_fphxz, b.yhzcbs as sub_yhzcbs, b.zzstsgl as sub_zzstsgl, b.lslbs as sub_lslbs, b.kce as sub_kce, b.taxfreeamt as sub_taxfreeamt, b.tax as sub_tax, b.taxamt as sub_taxamt, b.tspz as sub_tspz, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by
from invoice a
left join invoice_detail b on b.invoice_id = a.id
where a.company_id = #{companyId} and a.out_trade_orderno = #{out_trade_orderno} and a.update_by = #{update_by} order by a.id desc limit 1
</select>
<select id="selectByOutTradeOrdernoList" resultMap="InvoiceInvoiceDetailResult">
select a.id, a.bill_info_id, a.company_id, a.system_orderno, a.out_trade_orderno, a.fpqqlsh, a.invoice_type, a.state, a.c_invoiceid, a.fpdm, a.fphm, a.kprq, a.buyer_name, a.buyer_taxnum, a.buyer_address, a.buyer_telephone, a.buyer_account, a.buyer_email, a.buyer_phone, a.seller_name, a.seller_taxnum, a.seller_address, a.seller_telephone, a.seller_account, a.message, a.clerk, a.payee, a.checker, a.taxfreeamt, a.tax, a.taxamt, a.origin_fpdm, a.origin_fphm, a.jym, a.qr_code, a.machine_code, a.cipher_text, a.invoice_pdf_url, a.invoice_jpg_url,a.invoice_file_storage, a.invoice_msg, a.invoice_result_msg, a.product_oil_flag, a.qdbz, a.c_ofd_url, a.fjh, a.terminal_number,a.deprecate_type,a.deprecate_reason, a.create_by, a.create_time, a.update_by, a.update_time,
b.id as sub_id, b.invoice_id as sub_invoice_id, b.index as sub_index, b.good_name as sub_good_name, b.num as sub_num, b.price as sub_price, b.hsbz as sub_hsbz, b.taxrate as sub_taxrate, b.spec as sub_spec, b.unit as sub_unit, b.spbm as sub_spbm, b.bmbbh as sub_bmbbh, b.zsbm as sub_zsbm, b.fphxz as sub_fphxz, b.yhzcbs as sub_yhzcbs, b.zzstsgl as sub_zzstsgl, b.lslbs as sub_lslbs, b.kce as sub_kce, b.taxfreeamt as sub_taxfreeamt, b.tax as sub_tax, b.taxamt as sub_taxamt, b.tspz as sub_tspz, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by
from invoice a
left join invoice_detail b on b.invoice_id = a.id
where a.company_id = #{companyId} and a.out_trade_orderno = #{out_trade_orderno} and a.update_by = #{update_by} order by a.id desc
</select>
<select id="selectByFpdmFphm" resultMap="InvoiceInvoiceDetailResult">
select a.id, a.bill_info_id, a.company_id, a.system_orderno, a.out_trade_orderno, a.fpqqlsh, a.invoice_type, a.state, a.c_invoiceid, a.fpdm, a.fphm, a.kprq, a.buyer_name, a.buyer_taxnum, a.buyer_address, a.buyer_telephone, a.buyer_account, a.buyer_email, a.buyer_phone, a.seller_name, a.seller_taxnum, a.seller_address, a.seller_telephone, a.seller_account, a.message, a.clerk, a.payee, a.checker, a.taxfreeamt, a.tax, a.taxamt, a.origin_fpdm, a.origin_fphm, a.jym, a.qr_code, a.machine_code, a.cipher_text, a.invoice_pdf_url, a.invoice_jpg_url,a.invoice_file_storage, a.invoice_msg, a.invoice_result_msg, a.product_oil_flag, a.qdbz, a.c_ofd_url, a.fjh, a.terminal_number,a.deprecate_type,a.deprecate_reason, a.create_by, a.create_time, a.update_by, a.update_time,
b.id as sub_id, b.invoice_id as sub_invoice_id, b.index as sub_index, b.good_name as sub_good_name, b.num as sub_num, b.price as sub_price, b.hsbz as sub_hsbz, b.taxrate as sub_taxrate, b.spec as sub_spec, b.unit as sub_unit, b.spbm as sub_spbm, b.bmbbh as sub_bmbbh, b.zsbm as sub_zsbm, b.fphxz as sub_fphxz, b.yhzcbs as sub_yhzcbs, b.zzstsgl as sub_zzstsgl, b.lslbs as sub_lslbs, b.kce as sub_kce, b.taxfreeamt as sub_taxfreeamt, b.tax as sub_tax, b.taxamt as sub_taxamt, b.tspz as sub_tspz, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by

Loading…
Cancel
Save