红字信息表上传合并开发

beta-prop
dongxiaoke 2 years ago
parent 5bfe4d8a5c
commit 7ca3f51dfd
  1. 1
      jianshui-invoice-all/src/main/java/com/jianshui/invoiceall/service/impl/InvoiceAllImpl.java
  2. 5
      jianshui-invoice/src/main/java/com/jianshui/invoice/domain/dto/DownloadRedInfoDTO.java
  3. 9
      jianshui-invoice/src/main/java/com/jianshui/invoice/domain/dto/api/jcsk/CxhzJsonDataTwoDTO.java
  4. 1
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiServiceImpl.java
  5. 114
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/JcskInvoiceApiServiceImpl.java
  6. 5
      jianshui-invoice/src/main/java/com/jianshui/invoice/utils/InvoiceTest.java
  7. 10
      jianshui-invoice/src/main/java/com/jianshui/invoice/utils/JcskTest.java
  8. 1
      jianshui-invoice/src/main/java/com/jianshui/invoice/utils/elephant/ElephantUtils.java

@ -1000,7 +1000,6 @@ public class InvoiceAllImpl implements IInvoiceAll {
*/ */
@Override @Override
public AjaxResult queryRedInfo(Companyservice companyservice, InvoiceAllCxhzDTO invoiceAllCxhzDTO) { public AjaxResult queryRedInfo(Companyservice companyservice, InvoiceAllCxhzDTO invoiceAllCxhzDTO) {
// TODO: 2023/3/16 外部报文转数科校验
CxhzDTO cxhzDTO = BeanUtil.copyProperties(invoiceAllCxhzDTO,CxhzDTO.class); CxhzDTO cxhzDTO = BeanUtil.copyProperties(invoiceAllCxhzDTO,CxhzDTO.class);
ValidateUtils.validate(cxhzDTO); ValidateUtils.validate(cxhzDTO);

@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.jianshui.common.annotation.Excel; import com.jianshui.common.annotation.Excel;
import com.jianshui.common.core.domain.BaseEntity; import com.jianshui.common.core.domain.BaseEntity;
import com.jianshui.invoice.domain.Redinfodetail; import com.jianshui.invoice.domain.Redinfodetail;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
@ -30,4 +31,8 @@ public class DownloadRedInfoDTO {
private String terminalNumber; // 终端号 | 5 | private String terminalNumber; // 终端号 | 5 |
private String extensionNumber; // 分机号 | 5 | private String extensionNumber; // 分机号 | 5 |
private String serviceKey; // 服务key private String serviceKey; // 服务key
private String applyRemark; // 发票来源
private String originFphm; //蓝字发票号码
} }

@ -1,5 +1,6 @@
package com.jianshui.invoice.domain.dto.api.jcsk; package com.jianshui.invoice.domain.dto.api.jcsk;
import cn.hutool.core.annotation.Alias;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -13,29 +14,35 @@ import javax.validation.constraints.NotEmpty;
@Data @Data
public class CxhzJsonDataTwoDTO { public class CxhzJsonDataTwoDTO {
@Alias("applyRemark")
@NotEmpty @NotEmpty
@ApiModelProperty(value = "申请来源") @ApiModelProperty(value = "申请来源")
private String sqly; private String sqly;
@Alias("billTimeBegin")
@NotEmpty @NotEmpty
@ApiModelProperty(value = "开票日期起") @ApiModelProperty(value = "开票日期起")
private String kprqq; private String kprqq;
@Alias("billTimeEnd")
@NotEmpty @NotEmpty
@ApiModelProperty(value = "开票日期止") @ApiModelProperty(value = "开票日期止")
private String kprqz; private String kprqz;
@Alias("billNo")
@NotEmpty @NotEmpty
@ApiModelProperty(value = "红字发票信息确认单id") @ApiModelProperty(value = "红字发票信息确认单id")
private String hzfpxxqrdid; private String hzfpxxqrdid;
@Alias("billInfoNo")
@NotEmpty @NotEmpty
@ApiModelProperty(value = "红字发票信息确认单编号") @ApiModelProperty(value = "红字发票信息确认单编号")
private String hzfpxxqrdbh; private String hzfpxxqrdbh;
@Alias("originFphm")
@NotEmpty @NotEmpty
@ApiModelProperty(value = "蓝字发票号码") @ApiModelProperty(value = "蓝字发票号码")
private String lzfphm; private String originFphm;
@NotEmpty @NotEmpty
@ApiModelProperty(value = "每页条数") @ApiModelProperty(value = "每页条数")

@ -1491,6 +1491,7 @@ public class ElephantInvoiceApiServiceImpl implements IInvoiceApiService {
return response; return response;
} }
AjaxResult queryResult = null; AjaxResult queryResult = null;
System.out.println(JSONUtil.parse(signESealDTO).toString());
try { try {
queryResult = ElephantUtils.sendRequest(ElephantConstants.SIGN queryResult = ElephantUtils.sendRequest(ElephantConstants.SIGN
, JSONUtil.parse(signESealDTO), companyservice, true); , JSONUtil.parse(signESealDTO), companyservice, true);

@ -1,6 +1,5 @@
package com.jianshui.invoice.service.impl.api; package com.jianshui.invoice.service.impl.api;
import com.jianshui.invoice.domain.dto.api.jcsk.SqhzJsonDataDetailTwoDTO; import com.jianshui.invoice.domain.dto.api.jcsk.*;
import com.jianshui.invoice.domain.dto.api.jcsk.SqhzJsonDataTwoDTO;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
@ -24,8 +23,6 @@ import com.jianshui.invoice.constant.aisino.console.AisinoConsoleConstants;
import com.jianshui.invoice.domain.*; import com.jianshui.invoice.domain.*;
import com.jianshui.invoice.domain.dto.*; import com.jianshui.invoice.domain.dto.*;
import com.jianshui.invoice.domain.dto.api.aisino.console.*; import com.jianshui.invoice.domain.dto.api.aisino.console.*;
import com.jianshui.invoice.domain.dto.api.jcsk.QueryTwoDTO;
import com.jianshui.invoice.domain.dto.api.jcsk.SqhzTwoDTO;
import com.jianshui.invoice.domain.dto.api.jcsk.add.InvoiceAllAddInfoTwoDTO; import com.jianshui.invoice.domain.dto.api.jcsk.add.InvoiceAllAddInfoTwoDTO;
import com.jianshui.invoice.domain.dto.api.jcsk.add.InvoiceAllAddTwoDTO; import com.jianshui.invoice.domain.dto.api.jcsk.add.InvoiceAllAddTwoDTO;
import com.jianshui.invoice.domain.dto.api.jcsk.add.InvoiceAllAddmxListTwoDTO; import com.jianshui.invoice.domain.dto.api.jcsk.add.InvoiceAllAddmxListTwoDTO;
@ -458,25 +455,29 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
} }
} }
/*else if (WebServiceConstant.KSHC.equals(finalServiceId)) { else if (WebServiceConstant.KSHC.equals(finalServiceId)) {
// 快速冲红 // 快速冲红
// TODO: 后期存库 // TODO: 后期存库
KschVO kschVO = BeanUtil.copyProperties(data,KschVO.class); // KschVO kschVO = BeanUtil.copyProperties(data,KschVO.class);
InvoiceAllKschVO invoiceAllKschVO = BeanUtil.copyProperties(kschVO,InvoiceAllKschVO.class); // InvoiceAllKschVO invoiceAllKschVO = BeanUtil.copyProperties(kschVO,InvoiceAllKschVO.class);
}else if (WebServiceConstant.SQHZFPXXQRD.equals(finalServiceId)) { }else if (WebServiceConstant.SQHZFPXXQRD.equals(finalServiceId)) {
// 申请红字信息表 // 申请红字信息表
// TODO: 后期存库 // TODO: 后期存库
}else if (WebServiceConstant.CXHZFPXXQRD.equals(finalServiceId)) { }else if (WebServiceConstant.CXHZFPXXQRD.equals(finalServiceId)) {
// 查询红字信息表 // 查询红字信息表
// TODO: 后期存库 // TODO: 2023/4/4 返回报文处理
}else if (WebServiceConstant.SHHZFPXXQRD.equals(finalServiceId)) { }else if (WebServiceConstant.SHHZFPXXQRD.equals(finalServiceId)) {
// 审核红字信息表 // 审核红字信息表
// TODO: 后期存库 // TODO: 后期存库
}else if (WebServiceConstant.QDFPWJHQ.equals(finalServiceId)) { }else if (WebServiceConstant.QDFPWJHQ.equals(finalServiceId)) {
// 审核红字信息表 // 审核红字信息表
// TODO: 全电发票文件获取 // TODO: 全电发票文件获取
}*/ }
return response; return response;
} else { } else {
return new HXResponse(msg); return new HXResponse(msg);
@ -609,7 +610,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
HXResponse response = new HXResponse("0000", "申请成功"); HXResponse response = new HXResponse("0000", "申请成功");
response.put("data",requestId); response.put("queryid",requestId);
return response; return response;
} else { } else {
@ -680,48 +681,75 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
return response; return response;
} }
// 组装报文 // TODO: 组装进数科需要的报文。 待处理。
AisinoConsoleInvoiceRedDownloadDTO downloadDTO = BeanUtil.copyProperties(redInfoResult, AisinoConsoleInvoiceRedDownloadDTO.class);
downloadDTO.setYQZT("N");
downloadDTO.setXXBFW("0");
downloadDTO.setPAGENO("1");
downloadDTO.setPAGESIZE("1000");
String param = JSONUtil.toXmlStr(JSONUtil.parse(downloadDTO));
param = "<?xml version=\"1.0\" encoding=\"GBK\"?>\n" +
"<FPXT>\n" +
" <INPUT>\n" + param + "</INPUT>\n" +
"</FPXT>";
//发起请求
AjaxResult ajaxResult = null;
try {
ajaxResult = AisinoConsoleUtil.sendRequest(AisinoConsoleConstants.RED_DOWLOAD, param, companyservice);
} catch (Exception e) {
log.error("【销项发票】【总部控制台接口】【发票作废】发票请求异常,请求报文{},销方信息{}", "", JSONObject.toJSONString(companyservice));
e.printStackTrace();
throw new JianshuiServiceException("系统异常!");
}
//返回报文解析 // 查询用户登记参数
if (ajaxResult.isError()) { QueryWrapper<InvoiceAllYhdj> yhdjQueryWrapper = new QueryWrapper<>();
throw new JianshuiServiceException(ajaxResult.getMsg()); yhdjQueryWrapper.eq("nsrsbh", companyservice.getSellertax());
yhdjQueryWrapper.eq("identity", companyservice.getIdentity());
InvoiceAllYhdj invoiceAllYhdj = yhdjMapper.selectOne(yhdjQueryWrapper);
if (BeanUtil.isEmpty(invoiceAllYhdj)) {
return new HXResponse("用户未登记!");
} }
cn.hutool.json.JSONObject resultJSON = JSONUtil.parseObj(ajaxResult.get("data")); // 这里直接用传入的报文进行转换
String retcode = resultJSON.get("retcode") != null ? resultJSON.get("retcode").toString() : ""; CxhzTwoDTO cxhzDTO = BeanUtil.copyProperties(downloadRedInfoDTO,CxhzTwoDTO.class);
String retmsg = resultJSON.get("retmsg") != null ? resultJSON.get("retmsg").toString() : ""; cxhzDTO.setAsync("true");
cxhzDTO.setNsrsbh(invoiceAllYhdj.getNsrsbh());
cxhzDTO.setDqbm(invoiceAllYhdj.getDqbm());
// todo-k: 下载的返回报文需要单独处理,更新信息表状态? CxhzJsonDataTwoDTO cxhzJsonDataDTO = BeanUtil.copyProperties(downloadRedInfoDTO,CxhzJsonDataTwoDTO.class);
// todo-k: 返回的格式看看怎么处理一把,VO都已经创建
if (!StringUtils.equals("0000", retcode)) { ValidateUtils.validate(cxhzDTO);
ValidateUtils.validate(cxhzJsonDataDTO);
cxhzDTO.setJsonData(cxhzJsonDataDTO);
cn.hutool.json.JSONObject result = null;
try {
result = ApiHttp.request(WebServiceConstant.CXHZFPXXQRD, WebServiceConstant.URL, cxhzDTO, companyservice);
String code = result.get("code") != null ? result.get("code").toString() : "";
String msg = result.get("msg") != null ? result.get("msg").toString() : "";
String data = result.get("data") != null ? result.get("data").toString() : "";
if ("0000".equals(code) && StrUtil.isNotEmpty(data)) {
cn.hutool.json.JSONObject json = JSONUtil.parseObj(data);
String requestId = json.getOrDefault("requestId", "").toString();
if (StrUtil.isEmpty(requestId)) {
return new HXResponse(msg);
}
// TODO: 2023/4/3 数据库存储:根据业务调整
InvoiceAllApiLog allApiLog = new InvoiceAllApiLog();
allApiLog.setUrl(WebServiceConstant.CXHZFPXXQRD);
allApiLog.setSendMsg(cxhzDTO.toString());
allApiLog.setResultMsg(JSONUtil.toJsonStr(result));
allApiLog.setCompany(companyservice.getSellertax());
allApiLog.setIdentityId(companyservice.getIdentity());
allApiLog.setRequestId(requestId);
allApiLog.setCreateTime(new Date());
allApiLogMapper.insertInvoiceAllApiLog(allApiLog);
HXResponse response = new HXResponse("0000", "申请成功");
response.put("queryid",requestId);
return response;
} else {
return new HXResponse(msg);
}
} catch (Exception e) {
e.printStackTrace();
log.error("【金四服务类】【金财数科】【查询红字信息表】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
return new HXResponse("查询红字信息表接口异常");
return new HXResponse(retmsg);
} }
return null;
} }

@ -38,7 +38,8 @@ public class InvoiceTest {
// String key = "3UU4Lw6NIC2JPXZjH0+vEw=="; // 1238 // String key = "3UU4Lw6NIC2JPXZjH0+vEw=="; // 1238
// String key = "ZWaJUo9tKNKKQTQCryW9dw=="; // 1242 // String key = "ZWaJUo9tKNKKQTQCryW9dw=="; // 1242
// String key = "LTEO+oOgWMsuQAOUglqXuQ=="; // 1200 // String key = "LTEO+oOgWMsuQAOUglqXuQ=="; // 1200
String key = "n9tFehADzqvXWeX4pqHf0g=="; // 1260 // String key = "n9tFehADzqvXWeX4pqHf0g=="; // 1260
String key = "BUgDX62Wh1NChV+h1XCXdw=="; // 1255
// String key = "TG1NR1N0R3RPcEY0eE55dg=="; // 1132 // String key = "TG1NR1N0R3RPcEY0eE55dg=="; // 1132
// String key = "2KF3rawkN1B1gGjwrtBMlQ=="; // 500 // String key = "2KF3rawkN1B1gGjwrtBMlQ=="; // 500
@ -389,7 +390,7 @@ public class InvoiceTest {
System.out.println("-------------------发票签章-----------------------------"); System.out.println("-------------------发票签章-----------------------------");
query = "{\"fpdm\":\"037001900111\",\"fphm\":\"00094201\"}"; query = "{\"FP\":{\"GMFDZDH\":\"山东省潍坊市奎文区胜利东街4778号中央商务区2号楼301号\",\"XHFSBH\":\"91370703334376454N\",\"QDXMMC\":\"销售货物或者提供应税劳务、服务清单\",\"KPRQ\":\"20230331163347\",\"SGBZ\":\"\",\"XHFDZDH\":\"山东省潍坊市寒亭区白云路9号3号楼1-9 15165614885\",\"KPR\":\"庄莹莹\",\"QDBZ\":0,\"FHR\":\"于艺娇\",\"KPLX\":0,\"FPMX\":[{\"XMMC\":\"*设计服务*物料制作费\",\"ZXBM\":\"\",\"DJ\":\"128.712871\",\"ZZSTSGL\":\"\",\"KCE\":\"\",\"SPBM\":\"3040301990000000000\",\"SPSL\":\"1\",\"GGXH\":\"\",\"SE\":\"1.29\",\"DW\":\"批\",\"YHZCBS\":\"0\",\"SL\":\"0.01\",\"JE\":\"128.71\",\"FPHXZ\":0}],\"XHFMC\":\"山东达飞文化传播有限公司\",\"XHFYHZH\":\"潍坊农村商业银行股份有限公司寒亭支行 9070107120142050010911\",\"BZ\":\"\",\"EWM\":\"01,10,037002000311,66223914,128.71,20230331,05834122603484774628,2C6E,\",\"HJJE\":\"128.71\",\"FWM\":\"03-17-*>>1/062*89538-9/2265>975>20477<-/2-149-+4503*/6+3-/<>2+>90523-8><<7*8545668<276-503+9150181/-194>21</587*\",\"GMFYHZH\":\"中信银行潍坊分行8110601012700778796\",\"JYM\":\"05834122603484774628\",\"QZID\":\"4169455300053b94000000040003fb18\",\"JSHJ\":\"130.00\",\"BMBBBH\":\"48.0\",\"YFPDM\":\"\",\"FPHM\":\"66223914\",\"JQBH\":\"539902787121\",\"YFPHM\":\"\",\"FPDM\":\"037002000311\",\"GMFYX\":\"\",\"HJSE\":\"1.29\",\"GMFMC\":\"潍坊圣希门诊部有限公司\",\"MBDM\":\"3700\",\"SKR\":\"张海英\",\"GMFSJ\":\"\",\"GMFSBH\":\"91370700MA3MNWGFXD\",\"DKBZ\":0}}";
// query = "{}"; // query = "{}";
m = AisinoInvoiceDecryptUtil.encrypt(query, key); m = AisinoInvoiceDecryptUtil.encrypt(query, key);

File diff suppressed because one or more lines are too long

@ -99,6 +99,7 @@ public class ElephantUtils {
try { try {
// 构造请求String // 构造请求String
stringRequest = requestBody.toJSONString(); stringRequest = requestBody.toJSONString();
System.out.println(stringRequest);
RequestEntity se = new StringRequestEntity(stringRequest, "application/json", "UTF-8"); RequestEntity se = new StringRequestEntity(stringRequest, "application/json", "UTF-8");
// 开始构造请求体 // 开始构造请求体
httpclient = new HttpClient(); httpclient = new HttpClient();

Loading…
Cancel
Save