中交建-销项合并测试:红字发票开具查询接口

beta-enc
dongxiaoke 2 years ago
parent 723eba9f6e
commit 3814f40e8c
  1. 23
      jianshui-invoice-all/src/main/java/com/jianshui/invoiceall/utils/GenVoCodeTest.java
  2. 71
      jianshui-invoice/src/main/java/com/jianshui/invoice/domain/vo/jcsk/AddRedInfoInvoiceJsonDataTWOVO.java
  3. 35
      jianshui-invoice/src/main/java/com/jianshui/invoice/domain/vo/jcsk/AddRedInfoInvoiceTWOVO.java
  4. 208
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/JcskInvoiceApiServiceImpl.java

@ -16,14 +16,21 @@ public class GenVoCodeTest {
public static void main(String[] args) {
String json = "{\n" +
" \"appkey\": \"渠道标识\",\n" +
" \"async\": true,\n" +
" \"bsrysfzjhm\": \"办税人身份证号\",\n" +
" \"dqbm\": \"*地区编码(参考码表)\",\n" +
" \"jsonData\": \"\",\n" +
" \"nsrsbh\": \"纳税人识别号\",\n" +
" \"serviceId\": \"cxlzfpkhcje\"\n" +
"}";
" \"fpqqlsh\": \"发票请求流水号\",\n" +
" \"fphm\": \"全电发票号码\",\n" +
" \"gmfnsrsbh\": \"购买方税号\",\n" +
" \"gmfmc\": \"购买方名称\",\n" +
" \"kprq\": \"开票日期\",\n" +
" \"xsfmc\": \"销售方名称\",\n" +
" \"xsfnsrsbh\": \"销售方税号\",\n" +
" \"zzfpdm\": \"全电纸票发票代码\",\n" +
" \"zzfphm\": \"全电纸票发票号码\",\n" +
" \"ewmUrl\": \"发票二维码下载地址\",\n" +
" \"pdfUrl\": \"PDF下载地址\",\n" +
" \"ofdUrl\": \"OFD下载地址\",\n" +
" \"xmlUrl\": \"XML下载地址\",\n" +
" \"error\":\"异常信息\"\n" +
" }";
JSONObject jsonObject = JSONUtil.parseObj(json);

@ -0,0 +1,71 @@
package com.jianshui.invoice.domain.vo.jcsk;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
/**
* 申请红字信息表
*/
@Data
public class AddRedInfoInvoiceJsonDataTWOVO {
@ApiModelProperty(value = "发票请求流水号")
private String fpqqlsh;
@ApiModelProperty(value = "全电发票号码")
private String fphm;
@ApiModelProperty(value = "购买方税号")
private String gmfnsrsbh;
@ApiModelProperty(value = "购买方名称")
private String gmfmc;
@ApiModelProperty(value = "开票日期")
private String kprq;
@ApiModelProperty(value = "销售方名称")
private String xsfmc;
@ApiModelProperty(value = "销售方税号")
private String xsfnsrsbh;
@ApiModelProperty(value = "全电纸票发票代码")
private String zzfpdm;
@ApiModelProperty(value = "全电纸票发票号码")
private String zzfphm;
@ApiModelProperty(value = "发票二维码下载地址")
private String ewmUrl;
@ApiModelProperty(value = "PDF下载地址")
private String pdfUrl;
@ApiModelProperty(value = "OFD下载地址")
private String ofdUrl;
@ApiModelProperty(value = "XML下载地址")
private String xmlUrl;
@ApiModelProperty(value = "异常信息")
private String error;
}

@ -0,0 +1,35 @@
package com.jianshui.invoice.domain.vo.jcsk;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
/**
* 申请红字信息表
*/
@Data
public class AddRedInfoInvoiceTWOVO {
@ApiModelProperty(value = "红字发票信息确认单编号")
private String hzfpxxqrdbh;
@ApiModelProperty(value = "红字发票信息确认单id")
private String hzfpxxqrdid;
@ApiModelProperty(value = "红字发票信息确认单状态代码")
private String hzfpxxqrdZtdm;
@ApiModelProperty(value = "录入日期")
private String lrrq;
@ApiModelProperty(value = "")
private AddRedInfoInvoiceJsonDataTWOVO hzfpxx;
}

@ -1,4 +1,5 @@
package com.jianshui.invoice.service.impl.api;
import java.util.Date;
import cn.hutool.core.bean.copier.CopyOptions;
@ -122,7 +123,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
// 忽略明细属性
InvoiceAllAddInfoTwoDTO invoiceAllAddInfoTwoDTO = BeanUtil.copyProperties(billInfo, InvoiceAllAddInfoTwoDTO.class
,"fjxxList","mxList","tdywxx","ext");
, "fjxxList", "mxList", "tdywxx", "ext");
// 发票类型处理
ValidateUtils.validate(invoiceAllAddInfoTwoDTO);
@ -141,15 +142,15 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
// 报文转换存储
billInfo.setCompanyId(companyservice.getCompanyid());
billInfo.setServiceSupplierKey("JCSK");
String invoiceType = getInvoiceType(billInfo.getInvoiceType(),true);
if(StrUtil.isEmpty(invoiceType)){
String invoiceType = getInvoiceType(billInfo.getInvoiceType(), true);
if (StrUtil.isEmpty(invoiceType)) {
return new HXResponse("发票类型代码不存在!");
}
billInfo.setInvoiceType(invoiceType);
String systemOrderno = IdUtils.randomSystemOrderno();
billInfo.setSystemOrderno(systemOrderno);
billInfo.setOutTradeOrderno(systemOrderno);
if(BeanUtil.isEmpty(billInfo.getClerk())){
if (BeanUtil.isEmpty(billInfo.getClerk())) {
billInfo.setClerk("");
}
try {
@ -178,7 +179,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
cn.hutool.json.JSONObject result = null;
try {
Map<String,Object> map = BeanToMapUtils.fastJsonBean2Map(invoiceAllAddTwoDTO);
Map<String, Object> map = BeanToMapUtils.fastJsonBean2Map(invoiceAllAddTwoDTO);
result = ApiHttp.request(WebServiceConstant.LZFPKJ, WebServiceConstant.URL, JSONUtil.parse(map), companyservice);
String code = result.get("code") != null ? result.get("code").toString() : "";
@ -339,6 +340,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
/**
* 数科报文=简税报文转换
*
* @param redInvoiceQueryAllTWOVO
* @return
*/
@ -350,15 +352,16 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
// 每页条数
int pageSize = redInvoiceQueryAllTWOVO.getPageSize();
// 总条数
int total = redInvoiceQueryAllTWOVO.getTotal();;
int total = redInvoiceQueryAllTWOVO.getTotal();
;
//发票集合
List<RedInvoiceQueryTWOVO> redInvoiceQueryTWOVOS = redInvoiceQueryAllTWOVO.getFpList();
for (RedInvoiceQueryTWOVO redInvoiceQueryTWOVO : redInvoiceQueryTWOVOS) {
RedinfoCopyVO redinfoVO = BeanUtil.copyProperties(redInvoiceQueryTWOVO,RedinfoCopyVO.class);
RedinfoCopyVO redinfoVO = BeanUtil.copyProperties(redInvoiceQueryTWOVO, RedinfoCopyVO.class);
Redinfo redinfo = BeanUtil.copyProperties(JSONUtil.parseObj(redinfoVO),Redinfo.class);
Redinfo redinfo = BeanUtil.copyProperties(JSONUtil.parseObj(redinfoVO), Redinfo.class);
// TODO: 2023/4/6 明细接口数科还没对
// redinfo.setRedinfodetailList(null);
@ -405,14 +408,14 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
return new HXResponse("用户未登记!");
}
SqhzTwoDTO sqhzDTO = BeanUtil.copyProperties(redinfo,SqhzTwoDTO.class);
SqhzTwoDTO sqhzDTO = BeanUtil.copyProperties(redinfo, SqhzTwoDTO.class);
sqhzDTO.setAsync("true");
sqhzDTO.setBsrysfzjhm(invoiceAllYhdj.getBsrysfzjhm());
sqhzDTO.setDqbm(invoiceAllYhdj.getDqbm());
sqhzDTO.setNsrsbh(invoiceAllYhdj.getNsrsbh());
ValidateUtils.validate(sqhzDTO);
SqhzJsonDataTwoDTO sqhzJsonDataTwoDTO = BeanUtil.copyProperties(redinfo,SqhzJsonDataTwoDTO.class);
SqhzJsonDataTwoDTO sqhzJsonDataTwoDTO = BeanUtil.copyProperties(redinfo, SqhzJsonDataTwoDTO.class);
ValidateUtils.validate(sqhzJsonDataTwoDTO);
// redInfo 前置处理 start
@ -433,14 +436,14 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
redinfoMapper.insertRedinfo(redinfo);
int index = 0;
List<Redinfodetail> redinfodetailList = redinfo.getRedinfodetailList();
if(CollectionUtil.isNotEmpty(redinfodetailList)){
if (CollectionUtil.isNotEmpty(redinfodetailList)) {
redinfoMapper.batchRedinfodetail(redinfodetailList);
}
// end
List<SqhzJsonDataDetailTwoDTO> sqhzJsonDataDetailTwoDTOS = BeanUtil.copyToList(redinfo.getRedinfodetailList(),SqhzJsonDataDetailTwoDTO.class);
if(CollectionUtil.isNotEmpty(sqhzJsonDataDetailTwoDTOS)){
List<SqhzJsonDataDetailTwoDTO> sqhzJsonDataDetailTwoDTOS = BeanUtil.copyToList(redinfo.getRedinfodetailList(), SqhzJsonDataDetailTwoDTO.class);
if (CollectionUtil.isNotEmpty(sqhzJsonDataDetailTwoDTOS)) {
sqhzJsonDataTwoDTO.setHzqrxxmxlist(sqhzJsonDataDetailTwoDTOS);
}
sqhzDTO.setJsonData(sqhzJsonDataTwoDTO);
@ -469,9 +472,12 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
allApiLog.setCreateTime(new Date());
allApiLogMapper.insertInvoiceAllApiLog(allApiLog);
// 更新响应ID
redinfo.setOutTradeOrderno(requestId);
redinfoMapper.updateRedinfo(redinfo);
HXResponse response = new HXResponse("0000", "申请成功");
response.put("queryid",requestId);
response.put("queryid", requestId);
return response;
} else {
@ -543,12 +549,12 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
}
// 这里直接用传入的报文进行转换
CxhzTwoDTO cxhzDTO = BeanUtil.copyProperties(downloadRedInfoDTO,CxhzTwoDTO.class);
CxhzTwoDTO cxhzDTO = BeanUtil.copyProperties(downloadRedInfoDTO, CxhzTwoDTO.class);
cxhzDTO.setAsync("true");
cxhzDTO.setNsrsbh(invoiceAllYhdj.getNsrsbh());
cxhzDTO.setDqbm(invoiceAllYhdj.getDqbm());
CxhzJsonDataTwoDTO cxhzJsonDataDTO = BeanUtil.copyProperties(downloadRedInfoDTO,CxhzJsonDataTwoDTO.class);
CxhzJsonDataTwoDTO cxhzJsonDataDTO = BeanUtil.copyProperties(downloadRedInfoDTO, CxhzJsonDataTwoDTO.class);
ValidateUtils.validate(cxhzDTO);
ValidateUtils.validate(cxhzJsonDataDTO);
@ -585,7 +591,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
allApiLogMapper.insertInvoiceAllApiLog(allApiLog);
HXResponse response = new HXResponse("0000", "申请成功");
response.put("queryid",requestId);
response.put("queryid", requestId);
return response;
} else {
@ -714,9 +720,9 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
}
/** 金财数科新增接口 **/
/**
* 金财数科新增接口
**/
@Override
public Object addCallback(HttpServletRequest request) {
@ -729,8 +735,6 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
}
@Override
public HXResponse getFileUrl(InvoiceAllFileAcquisitionTWODTO invoiceAllFileAcquisitionTWODTO, Companyservice companyservice) {
@ -771,14 +775,14 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
}
HXResponse response = new HXResponse("0000", "同步成功",result);
HXResponse response = new HXResponse("0000", "同步成功", result);
return response;
}
@Override
public HXResponse getFileAcquisitionOn(InvoiceAllFileAcquisitionOnTWODTO invoiceAllFileAcquisitionOnTWODTO, Companyservice companyservice) {
FileAcquisitionOnTwoDTO fileAcquisitionOnDTO = BeanUtil.copyProperties(invoiceAllFileAcquisitionOnTWODTO, FileAcquisitionOnTwoDTO.class);
FileAcquisitionOnDetailTwoDTO fileAcquisitionOnDetailDTO = BeanUtil.copyProperties(invoiceAllFileAcquisitionOnTWODTO.getJsonData(),FileAcquisitionOnDetailTwoDTO.class);
FileAcquisitionOnDetailTwoDTO fileAcquisitionOnDetailDTO = BeanUtil.copyProperties(invoiceAllFileAcquisitionOnTWODTO.getJsonData(), FileAcquisitionOnDetailTwoDTO.class);
fileAcquisitionOnDTO.setJsonData(fileAcquisitionOnDetailDTO);
ValidateUtils.validate(fileAcquisitionOnDTO);
ValidateUtils.validate(fileAcquisitionOnDetailDTO);
@ -817,11 +821,13 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
}
HXResponse response = new HXResponse("0000", "同步成功",result);
HXResponse response = new HXResponse("0000", "同步成功", result);
return response;
}
/** 获取人脸识别二维码*/
/**
* 获取人脸识别二维码
*/
@Override
public HXResponse qrcode(JSONObject decryptResult, Companyservice companyservice) {
cn.hutool.json.JSONObject result = null;
@ -851,7 +857,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
allApiLog.setCreateTime(new Date());
allApiLogMapper.insertInvoiceAllApiLog(allApiLog);
HXResponse response = new HXResponse("0000", "请求成功",json);
HXResponse response = new HXResponse("0000", "请求成功", json);
return response;
} else {
return new HXResponse(msg);
@ -884,7 +890,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
// TODO 处理日志
HXResponse response = new HXResponse("0000", "同步成功",result);
HXResponse response = new HXResponse("0000", "同步成功", result);
return response;
}
@ -903,7 +909,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
// TODO 处理日志
HXResponse response = new HXResponse("0000", "同步成功",result);
HXResponse response = new HXResponse("0000", "同步成功", result);
return response;
}
@ -947,7 +953,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
}
HXResponse response = new HXResponse("0000", "同步成功",result);
HXResponse response = new HXResponse("0000", "同步成功", result);
return response;
}
@ -982,7 +988,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
// String requestId = data.getStr("requestId");
HXResponse response = new HXResponse("0000", "同步成功",data);
HXResponse response = new HXResponse("0000", "同步成功", data);
return response;
}
@ -990,10 +996,10 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
public HXResponse auditRedInfo(InvoiceAllShhzTWODTO invoiceAllShhzTWODTO, Companyservice companyservice) {
// TODO: 2023/3/16 外部报文转数科校验
ShhzTwoDTO shhzDTO = BeanUtil.copyProperties(invoiceAllShhzTWODTO,ShhzTwoDTO.class);
ShhzTwoDTO shhzDTO = BeanUtil.copyProperties(invoiceAllShhzTWODTO, ShhzTwoDTO.class);
ValidateUtils.validate(shhzDTO);
ShhzJsonDataTwoDTO shhzJsonDataDTO = BeanUtil.copyProperties(shhzDTO.getJsonData(),ShhzJsonDataTwoDTO.class);
ShhzJsonDataTwoDTO shhzJsonDataDTO = BeanUtil.copyProperties(shhzDTO.getJsonData(), ShhzJsonDataTwoDTO.class);
ValidateUtils.validate(shhzJsonDataDTO);
shhzDTO.setJsonData(shhzJsonDataDTO);
@ -1033,12 +1039,13 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
}
HXResponse response = new HXResponse("0000", "同步成功",result);
HXResponse response = new HXResponse("0000", "同步成功", result);
return response;
}
/**
* 查询红字信息表明细
*
* @param invoiceAllRedInvoiceDetailDTO
* @param companyservice
* @return
@ -1047,7 +1054,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
public HXResponse queryRedInfoDetail(InvoiceAllRedInvoiceDetailTWODTO invoiceAllRedInvoiceDetailDTO, Companyservice companyservice) {
RedInvoiceDetailTWODTO redInvoiceDetailDTO = BeanUtil.copyProperties(invoiceAllRedInvoiceDetailDTO, RedInvoiceDetailTWODTO.class);
InvoiceAllRedInvoiceDetailJsonDataTWODTO redInvoiceDetailJsonDataDTO = BeanUtil.copyProperties(invoiceAllRedInvoiceDetailDTO.getJsonData(),InvoiceAllRedInvoiceDetailJsonDataTWODTO.class);
InvoiceAllRedInvoiceDetailJsonDataTWODTO redInvoiceDetailJsonDataDTO = BeanUtil.copyProperties(invoiceAllRedInvoiceDetailDTO.getJsonData(), InvoiceAllRedInvoiceDetailJsonDataTWODTO.class);
redInvoiceDetailDTO.setJsonData(redInvoiceDetailJsonDataDTO);
ValidateUtils.validate(redInvoiceDetailDTO);
ValidateUtils.validate(redInvoiceDetailJsonDataDTO);
@ -1085,13 +1092,14 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
return new HXResponse("查询红字申请表明细错误!");
}
HXResponse response = new HXResponse("0000", "同步成功",result);
HXResponse response = new HXResponse("0000", "同步成功", result);
return response;
}
/**
* 通用查询接口
*
* @param invoiceAllYhdjDTO
* @param companyservice
* @return
@ -1126,7 +1134,30 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
cn.hutool.json.JSONObject result = null;
try {
result = ApiHttp.request(WebServiceConstant.TYCXJK, WebServiceConstant.URL, queryDTO, companyservice);
// result = ApiHttp.request(WebServiceConstant.TYCXJK, WebServiceConstant.URL, queryDTO, companyservice);
result = new cn.hutool.json.JSONObject();
result.set("code", "0000");
result.set("msg", "123");
result.set("data", "{\n" +
" \"hzfpxxqrdbh\": \"37021423051000203148\",\n" +
" \"hzfpxxqrdid\": \"953bf4ef7ac74c24ae9a056262939f96\",\n" +
" \"hzfpxxqrdZtdm\": \"01\",\n" +
" \"lrrq\": \"2023-05-09 09:47:53\",\n" +
" \"hzfpxx\": {\n" +
" \"fpqqlsh\": \"c817769da5c27e3fbda4fe5ce72857f7\",\n" +
" \"gmfnsrsbh\": \"91370102MA3UD2FG21\",\n" +
" \"gmfmc\": \"山东慧永信息科技有限公司\",\n" +
" \"xsfmc\": \"城阳区兴顺通制冷设备维修服务部\",\n" +
" \"xsfnsrsbh\": \"92370214MACAAEK16E\",\n" +
" \"kprq\": \"2023-05-09 09:47:54\",\n" +
" \"fphm\": \"23922000000005190521\",\n" +
" \"ewmUrl\": \"https://dppt.qingdao.chinatax.gov.cn:8443/v/2_23922000000005190521_202305090947549016EF6F4\",\n" +
" \"pdfUrl\": \"https://rocgw.jcsk100.com/external/d/v/qingdao_23922000000005190521_202305090947549016EF6F4_cde295cba75225c66fe9902c88fc4d03_pdf\",\n" +
" \"ofdUrl\": \"https://rocgw.jcsk100.com/external/d/v/qingdao_23922000000005190521_202305090947549016EF6F4_cde295cba75225c66fe9902c88fc4d03_ofd\",\n" +
" \"xmlUrl\": \"https://rocgw.jcsk100.com/external/d/v/qingdao_23922000000005190521_202305090947549016EF6F4_cde295cba75225c66fe9902c88fc4d03_xml\"\n" +
" }\n" +
"}");
String code = result.get("code") != null ? result.get("code").toString() : "";
@ -1142,8 +1173,8 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
serviceId = allApiLog.getUrl();
}
if(BeanUtil.isEmpty(allApiLog)){
log.error("金四日志表未记录,requestId={},返回结果={}",requestId,data);
if (BeanUtil.isEmpty(allApiLog)) {
log.error("金四日志表未记录,requestId={},返回结果={}", requestId, data);
}
HXResponse response = new HXResponse("0000", "查询成功");
@ -1165,7 +1196,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
// 根据
BillInfo billInfoResult = billInfoMapper.selectByOutTradeOrderno(companyservice.getCompanyid(), systemOrderNo);
if(BeanUtil.isNotEmpty(billInfoResult)){
if (BeanUtil.isNotEmpty(billInfoResult)) {
if (BeanUtil.isNotEmpty(invoice)) {
invoice = BeanUtil.copyProperties(billInfoResult, Invoice.class);
invoice.setBillInfoId(billInfoResult.getId());
@ -1183,6 +1214,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
invoice.setcOfdUrl(addInvoiceVO.getXmlUrl());
invoice.setState(2);
invoiceMapper.updateInvoice(invoice);
billInfoR.setOriginFphm(addInvoiceVO.getFphm());
billInfoR.setState(2);
billInfoMapper.updateById(billInfoR);
} else {
@ -1203,6 +1235,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
invoice.setState(2);
invoiceMapper.insertInvoice(invoice);
billInfoR.setState(2);
billInfoR.setOriginFphm(addInvoiceVO.getFphm());
billInfoMapper.updateById(billInfoR);
}
}
@ -1214,7 +1247,8 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
}
}
} else if (WebServiceConstant.FPEWMXZ.equals(finalServiceId)) {
}
else if (WebServiceConstant.FPEWMXZ.equals(finalServiceId)) {
// 获取发票下载地址
cn.hutool.json.JSONObject json = JSONUtil.parseObj(data);
String ewmUrl = json.getOrDefault("ewmUrl", "").toString();
@ -1232,27 +1266,26 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
}
}
// TODO: 2023/3/29 返回数据处理
} else if (WebServiceConstant.ADD_RED_INVOICE.equals(finalServiceId)) {
}
else if (WebServiceConstant.ADD_RED_INVOICE.equals(finalServiceId)) {
// 查找原发票信息
AddRedInvoiceTWOVO addRedInvoiceVO = BeanUtil.copyProperties(data, AddRedInvoiceTWOVO.class);
QueryWrapper<BillInfo> billInfoQueryWrapper = new QueryWrapper<>();
billInfoQueryWrapper.eq("fpqqlsh", requestId);
billInfoQueryWrapper.eq("out_trade_orderno", requestId);
BillInfo billInfoR = billInfoMapper.selectOne(billInfoQueryWrapper);
if (billInfoR != null) {
// return AjaxResult.error("未查询到原发票信息");
// 根据billInfo获得原发票号码
QueryWrapper<BillInfo> originBillInfoWrapper = new QueryWrapper<>();
originBillInfoWrapper.eq("origin_fphm", billInfoR.getOriginFphm());
BillInfo originBillInfo = billInfoMapper.selectOne(originBillInfoWrapper);
if (originBillInfo != null) {
// return AjaxResult.error("未查询到原发票信息");
if (billInfoR != null && StrUtil.isNotEmpty(billInfoR.getOriginFphm())) {
// 查找原发票信息
Invoice originInvoice = invoiceMapper.selectInvoiceByBillInfoId(originBillInfo.getId());
Invoice invoice = BeanUtil.copyProperties(originInvoice, Invoice.class);
String originFphm = billInfoR.getOriginFphm();
QueryWrapper<Invoice> invoiceQueryWrapper = new QueryWrapper<>();
invoiceQueryWrapper.eq("fphm", originFphm);
Invoice invoice = invoiceMapper.selectOne(invoiceQueryWrapper);
invoice.setId(null);
invoice.setFphm(addRedInvoiceVO.getFphm());
invoice.setBillInfoId(billInfoR.getId());
invoice.setSystemOrderno(billInfoR.getSystemOrderno());
invoice.setOutTradeOrderno(billInfoR.getOutTradeOrderno());
invoice.setOutTradeOrderno(requestId);
invoice.setFpqqlsh(billInfoR.getFpqqlsh());
invoice.setKprq(DateUtil.parse(addRedInvoiceVO.getKprq()));
invoice.setZzfpdm(addRedInvoiceVO.getZzfpdm());
@ -1273,18 +1306,13 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
response.put("data", invoice);
}
}
}
else if (WebServiceConstant.KSHC.equals(finalServiceId)) {
// 快速冲红
// TODO: 后期存库
// KschVO kschVO = BeanUtil.copyProperties(data,KschVO.class);
// InvoiceAllKschVO invoiceAllKschVO = BeanUtil.copyProperties(kschVO,InvoiceAllKschVO.class);
}else if (WebServiceConstant.SQHZFPXXQRD.equals(finalServiceId)) {
// 申请红字信息表
// TODO: 后期存库
}else if (WebServiceConstant.CXHZFPXXQRD.equals(finalServiceId)) {
} else if (WebServiceConstant.CXHZFPXXQRD.equals(finalServiceId)) {
// 查询红字信息表
RedInvoiceQueryAllTWOVO redInvoiceQueryAllTWOVO = BeanUtil.copyProperties(data, RedInvoiceQueryAllTWOVO.class);
@ -1292,17 +1320,68 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
List<Redinfo> resultDownload = parseRedINFO(redInvoiceQueryAllTWOVO);
// TODO: 2023/4/6 数据存储
response.put("data", resultDownload);
}else if (WebServiceConstant.SHHZFPXXQRD.equals(finalServiceId)) {
} else if (WebServiceConstant.SHHZFPXXQRD.equals(finalServiceId)) {
// 审核红字信息表
// TODO: 后期存库
}else if (WebServiceConstant.QDFPWJHQ.equals(finalServiceId)) {
} else if (WebServiceConstant.QDFPWJHQ.equals(finalServiceId)) {
// 审核红字信息表
// TODO: 全电发票文件获取
}else if(WebServiceConstant.QRCODE.equals(finalServiceId)){
} else if (WebServiceConstant.QRCODE.equals(finalServiceId)) {
response.put("data", JSONUtil.parse(data));
} else if (WebServiceConstant.SQHZFPXXQRD.equals(finalServiceId)) {
// 申请红字信息表
AddRedInfoInvoiceTWOVO addRedInfoInvoiceTWOVO = BeanUtil.copyProperties(JSONUtil.parse(data), AddRedInfoInvoiceTWOVO.class);
QueryWrapper<Redinfo> billInfoQueryWrapper = new QueryWrapper<>();
billInfoQueryWrapper.eq("out_trade_orderno", requestId);
Redinfo billInfoR = redinfoMapper.selectOne(billInfoQueryWrapper);
if (billInfoR != null && StrUtil.isNotEmpty(billInfoR.getOriginFphm())) {
// 查找原发票信息
String originFphm = billInfoR.getOriginFphm();
QueryWrapper<Invoice> invoiceQueryWrapper = new QueryWrapper<>();
invoiceQueryWrapper.eq("fphm", originFphm);
Invoice invoice = invoiceMapper.selectOne(invoiceQueryWrapper);
AddRedInfoInvoiceJsonDataTWOVO addRedInfoInvoiceJsonDataTWOVO = addRedInfoInvoiceTWOVO.getHzfpxx();
if(BeanUtil.isNotEmpty(addRedInfoInvoiceJsonDataTWOVO)){
//更新蓝字发票状态为冲红 99
invoice.setState(99);
invoiceMapper.updateInvoice(invoice);
invoice.setId(null);
invoice.setOriginFphm(invoice.getFphm());
invoice.setFphm(addRedInfoInvoiceJsonDataTWOVO.getFphm());
invoice.setBillInfoId(billInfoR.getId());
invoice.setSystemOrderno(billInfoR.getSystemOrderno());
invoice.setOutTradeOrderno(requestId);
invoice.setFpqqlsh(billInfoR.getFpqqlsh());
invoice.setKprq(DateUtil.parse(addRedInfoInvoiceJsonDataTWOVO.getKprq()));
invoice.setZzfpdm(addRedInfoInvoiceJsonDataTWOVO.getZzfpdm());
invoice.setZzfphm(addRedInfoInvoiceJsonDataTWOVO.getZzfphm());
//二维码=二维码下载地址
invoice.setQrCode(addRedInfoInvoiceJsonDataTWOVO.getEwmUrl());
//发票 pdf 地址=PDF格式下载地址
invoice.setInvoicePdfUrl(addRedInfoInvoiceJsonDataTWOVO.getPdfUrl());
//发票详情地址=OFD格式下载地址
invoice.setInvoiceJpgUrl(addRedInfoInvoiceJsonDataTWOVO.getOfdUrl());
//ofdUrl=XML格式下载地址
invoice.setcOfdUrl(addRedInfoInvoiceJsonDataTWOVO.getXmlUrl());
invoice.setState(2);
invoiceMapper.insertInvoice(invoice);
}
billInfoR.setRedInfoNo(addRedInfoInvoiceTWOVO.getHzfpxxqrdbh());
billInfoR.setRedInfoStatus(addRedInfoInvoiceTWOVO.getHzfpxxqrdZtdm());
billInfoR.setBillInputTime(addRedInfoInvoiceTWOVO.getLrrq());
redinfoMapper.updateById(billInfoR);
response.put("data", addRedInfoInvoiceTWOVO);
}
}
return response;
} else {
// TODO: 2023/5/9 这里更新到日志表记录
return new HXResponse(msg);
}
@ -1373,7 +1452,4 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
}
}

Loading…
Cancel
Save