|
|
|
@ -137,7 +137,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
return new HXResponse(msg); |
|
|
|
|
} |
|
|
|
|
BillInfo billInfoRes = billInfoMapper.selectBillInfoById(billInfoID); |
|
|
|
|
billInfoRes.setOriginSystemOrderno(requestId); |
|
|
|
|
billInfoRes.setOutTradeOrderno(requestId); |
|
|
|
|
billInfoMapper.updateBillInfo(billInfoRes); |
|
|
|
|
|
|
|
|
|
// 保存日志
|
|
|
|
@ -214,35 +214,31 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
@Override |
|
|
|
|
public HXResponse queryInvoice(QueryBillInfoDTO billInfo, Companyservice companyservice) { |
|
|
|
|
|
|
|
|
|
// TODO: 2023/3/28 查询存库Invoice表
|
|
|
|
|
|
|
|
|
|
String systemOrderNo = billInfo.getSystemOrderno(); |
|
|
|
|
BillInfo billInfoResult = billInfoMapper.selectBySystemOrderNo(companyservice.getCompanyid(),systemOrderNo); |
|
|
|
|
|
|
|
|
|
// requestId=OutTradeOrderno
|
|
|
|
|
if(StrUtil.isEmpty(billInfoResult.getOutTradeOrderno())){ |
|
|
|
|
return new HXResponse("未获取到开票记录!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 查询用户登记参数
|
|
|
|
|
QueryWrapper<InvoiceAllYhdj> yhdjQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
yhdjQueryWrapper.eq("nsrsbh",companyservice.getSellertax()); |
|
|
|
|
yhdjQueryWrapper.eq("identity",companyservice.getIdentity()); |
|
|
|
|
InvoiceAllYhdj invoiceAllYhdj = yhdjMapper.selectOne(yhdjQueryWrapper); |
|
|
|
|
|
|
|
|
|
if(BeanUtil.isEmpty(invoiceAllYhdj)){ |
|
|
|
|
if(BeanUtil.isEmpty(invoiceAllYhdj)) { |
|
|
|
|
return new HXResponse("用户未登记!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// TODO: 2023/3/28 用户登记表有问题,数据有重复的,看下什么问题1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QueryTwoDTO queryDTO = new QueryTwoDTO(); |
|
|
|
|
queryDTO.setDqbm(invoiceAllYhdj.get); |
|
|
|
|
queryDTO.setAsync(""); |
|
|
|
|
queryDTO.setBsrysfzjhm(""); |
|
|
|
|
queryDTO.setNsrsbh(""); |
|
|
|
|
queryDTO.setRequestId(""); |
|
|
|
|
|
|
|
|
|
// TODO: 2023/3/28 ...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
queryDTO.setDqbm(invoiceAllYhdj.getDqbm()); |
|
|
|
|
queryDTO.setAsync("false"); |
|
|
|
|
queryDTO.setBsrysfzjhm(invoiceAllYhdj.getBsrysfzjhm()); |
|
|
|
|
queryDTO.setNsrsbh(invoiceAllYhdj.getNsrsbh()); |
|
|
|
|
queryDTO.setRequestId("tycxjk"); |
|
|
|
|
|
|
|
|
|
ValidateUtils.validate(queryDTO); |
|
|
|
|
|
|
|
|
|
String requestId = queryDTO.getRequestId(); |
|
|
|
@ -259,8 +255,6 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
if ("0000".equals(code) && StrUtil.isNotEmpty(data)) { |
|
|
|
|
|
|
|
|
|
// 2022/12/13 这里所有的接口都走,需要根据具体的id判断接口来存库。
|
|
|
|
|
|
|
|
|
|
QueryWrapper<InvoiceAllApiLog> apiLogQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
apiLogQueryWrapper.eq("request_id",requestId); |
|
|
|
|
InvoiceAllApiLog allApiLog = allApiLogMapper.selectOne(apiLogQueryWrapper); |
|
|
|
@ -278,8 +272,8 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
if(BeanUtil.isNotEmpty(addInvoiceVO)){ |
|
|
|
|
QueryWrapper<BillInfo> billInfoQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
billInfoQueryWrapper.eq("out_trade_orderno", requestId); |
|
|
|
|
BillInfo billInfo = billInfoMapper.selectOne(billInfoQueryWrapper); |
|
|
|
|
if (BeanUtil.isNotEmpty(billInfo)) { |
|
|
|
|
BillInfo billInfoR = billInfoMapper.selectOne(billInfoQueryWrapper); |
|
|
|
|
if (BeanUtil.isNotEmpty(billInfoR)) { |
|
|
|
|
QueryWrapper<Invoice> invoiceQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
invoiceQueryWrapper.eq("out_trade_orderno", requestId); |
|
|
|
|
Invoice invoice = invoiceMapper.selectOne(invoiceQueryWrapper); |
|
|
|
@ -299,8 +293,8 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
invoice.setcOfdUrl(addInvoiceVO.getXmlUrl()); |
|
|
|
|
invoice.setState(2); |
|
|
|
|
invoiceMapper.updateInvoice(invoice); |
|
|
|
|
billInfo.setState(2); |
|
|
|
|
billInfoMapper.updateById(billInfo); |
|
|
|
|
billInfoR.setState(2); |
|
|
|
|
billInfoMapper.updateById(billInfoR); |
|
|
|
|
} else { |
|
|
|
|
invoice = BeanUtil.copyProperties(billInfo, Invoice.class); |
|
|
|
|
invoice.setFphm(addInvoiceVO.getFphm()); |
|
|
|
@ -317,8 +311,8 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
invoice.setcOfdUrl(addInvoiceVO.getXmlUrl()); |
|
|
|
|
invoice.setState(2); |
|
|
|
|
invoiceMapper.insertInvoice(invoice); |
|
|
|
|
billInfo.setState(2); |
|
|
|
|
billInfoMapper.updateById(billInfo); |
|
|
|
|
billInfoR.setState(2); |
|
|
|
|
billInfoMapper.updateById(billInfoR); |
|
|
|
|
} |
|
|
|
|
// 返回数据
|
|
|
|
|
response.put("data", invoice); |
|
|
|
|