中交建-销项合并测试:通用查询接口

beta-enc
dongxiaoke 2 years ago
parent 6e81d1e874
commit 9df18f797f
  1. 44
      jianshui-admin/src/main/java/com/jianshui/api/controller/http/invoiceall/v1/InvoiceAllController.java
  2. 35
      jianshui-invoice-all/src/main/java/com/jianshui/invoiceall/domain/dto/InvoiceAllCanRedDTO.java
  3. 49
      jianshui-invoice-all/src/main/java/com/jianshui/invoiceall/domain/dto/InvoiceAllCanRedJsonDataDTO.java
  4. 21
      jianshui-invoice-all/src/main/java/com/jianshui/invoiceall/utils/GenVoCodeTest.java
  5. 25
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/JcskInvoiceApiServiceImpl.java
  6. 6
      jianshui-invoice/src/main/java/com/jianshui/invoice/utils/JcskTest.java

@ -660,6 +660,50 @@ public class InvoiceAllController {
/** 查询蓝字发票可红冲金额*/
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "string", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体", required = true)})
@PostMapping({"/api/invoice_all/v1/queryInvoiceBeRed/{identity}", "/api/invoice_all/v1/queryInvoiceBeRed"})
public Object queryInvoiceBeRed(HttpServletRequest request, String identity) throws Exception {
// TODO: 2023/5/6 .....||||
if (StringUtils.isEmpty(identity)) {
return AjaxResult.error(ErrorCode.EMPTY_IDENTITY);
}
Companyservice companyservice = iCompanyserviceService.selectCompanyserviceByIdentity(identity);
if (companyservice == null) {
return AjaxResult.error(ErrorCode.COMPANY_NOT_FOUND);
}
// 获得入口报文适配器
String requestAdapterKey = serviceManageService.getRequestAdapterKey(SERVICE_KEY, companyservice.getCompanyid());
IInvoiceAllRequestService incomeRequestService = invoiceAllRequestFactory.getService(requestAdapterKey);
JSONObject requestBody = incomeRequestService.decrypt(request, companyservice);
// 获得请求实例,并且进行扣费
String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid());
IInvoiceAll invoiceAllService = iInvoceiAllServiceFactory.getService(serviceKey);
InvoiceAllRedInvoiceDetailDTO invoiceAllRedInvoiceDetailDTO= requestBody.toJavaObject(InvoiceAllRedInvoiceDetailDTO.class);
AjaxResult result = invoiceAllService.queryRedInfoDetail(companyservice, invoiceAllRedInvoiceDetailDTO);
//返回处理 增加调用次数
if (result.isSuccess()) {
serviceManageService.companyConsume(SERVICE_KEY, companyservice.getCompanyid());
}
//返回报文处理器
String responseAdapterKey = serviceManageService.getResponseAdapterKey(SERVICE_KEY, companyservice.getCompanyid());
IInvoiceAllResponseService incomeResponseService = invoiceAllResponseFactory.getService(responseAdapterKey);
return incomeResponseService.response(result, companyservice, "");
}

@ -0,0 +1,35 @@
package com.jianshui.invoiceall.domain.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
/**
* 查询蓝字发票可红冲金额
*/
@Data
public class InvoiceAllCanRedDTO {
@NotEmpty
@ApiModelProperty(value = "办税人身份证号")
private String bsrysfzjhm;
@NotEmpty
@ApiModelProperty(value = "*地区编码(参考码表)")
private String dqbm;
@NotEmpty
@ApiModelProperty(value = "")
private InvoiceAllCanRedJsonDataDTO jsonData;
@NotEmpty
@ApiModelProperty(value = "纳税人识别号")
private String nsrsbh;
}

@ -0,0 +1,49 @@
package com.jianshui.invoiceall.domain.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
/**
* 查询蓝字发票可红冲金额
*/
@Data
public class InvoiceAllCanRedJsonDataDTO {
@NotEmpty
@ApiModelProperty(value = "冲红原因代码")
private String chyydm;
@NotEmpty
@ApiModelProperty(value = "购买方纳税人识别号")
private String gmfnsrsbh;
@NotEmpty
@ApiModelProperty(value = "申请来源")
private String sqly;
@ApiModelProperty(value = "特定要素类型代码(参考码表)")
private String tdyslxdm;
@NotEmpty
@ApiModelProperty(value = "销售方纳税人识别号")
private String xsfnsrsbh;
@NotEmpty
@ApiModelProperty(value = "原发票号码")
private String yfphm;
@NotEmpty
@ApiModelProperty(value = "原开票日期")
private String ykprq;
@ApiModelProperty(value = "原纸质发票代码")
private String yzzfpdm;
@ApiModelProperty(value = "原纸质发票号码")
private String yzzfphm;
}

@ -16,19 +16,14 @@ public class GenVoCodeTest {
public static void main(String[] args) {
String json = "{\n" +
" \"dw\": \"单位\",\n" +
" \"ggxh\": \"规格型号\",\n" +
" \"je\": \"金额\",\n" +
" \"lzmxxh\": \"蓝字明细序号\",\n" +
" \"se\": \"税额\",\n" +
" \"slv\": \"税率\",\n" +
" \"spbm\": \"商品编码\",\n" +
" \"spdj\": \"商品单价\",\n" +
" \"spmc\": \"商品名称\",\n" +
" \"spsl\": \"商品数量\",\n" +
" \"tdzsfsdm\": \"特定征税方式代码\",\n" +
" \"xh\": \"序号\"\n" +
" }";
" \"appkey\": \"渠道标识\",\n" +
" \"async\": true,\n" +
" \"bsrysfzjhm\": \"办税人身份证号\",\n" +
" \"dqbm\": \"*地区编码(参考码表)\",\n" +
" \"jsonData\": \"\",\n" +
" \"nsrsbh\": \"纳税人识别号\",\n" +
" \"serviceId\": \"cxlzfpkhcje\"\n" +
"}";
JSONObject jsonObject = JSONUtil.parseObj(json);

@ -218,7 +218,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
);
HXResponse response = new HXResponse("0000", "同步成功");
response.put("fpqqlsh", billInfo.getSystemOrderno());
response.put("fpqqlsh", requestId);
return response;
} else {
return new HXResponse(msg);
@ -1079,7 +1079,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
return new HXResponse(msg);
}
HXResponse response = new HXResponse("0000", "同步成功",json);
HXResponse response = new HXResponse("0000", "请求成功",json);
return response;
} else {
return new HXResponse(msg);
@ -1327,16 +1327,8 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
@Override
public HXResponse queryResultInfo(InvoiceAllQueryTWODTO invoiceAllYhdjDTO, Companyservice companyservice) {
// requestId => systemorderid
String systemOrderNo = invoiceAllYhdjDTO.getRequestId();
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());
@ -1353,7 +1345,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
queryDTO.setBsrysfzjhm(invoiceAllYhdj.getBsrysfzjhm());
queryDTO.setNsrsbh(invoiceAllYhdj.getNsrsbh());
queryDTO.setServiceId("tycxjk");
queryDTO.setRequestId(billInfoResult.getOutTradeOrderno());
queryDTO.setRequestId(systemOrderNo);
ValidateUtils.validate(queryDTO);
@ -1394,6 +1386,9 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
QueryWrapper<Invoice> invoiceQueryWrapper = new QueryWrapper<>();
invoiceQueryWrapper.eq("out_trade_orderno", requestId);
Invoice invoice = invoiceMapper.selectOne(invoiceQueryWrapper);
BillInfo billInfoResult = billInfoMapper.selectBySystemOrderNo(companyservice.getCompanyid(), systemOrderNo);
if (BeanUtil.isNotEmpty(invoice)) {
invoice = BeanUtil.copyProperties(billInfoResult, Invoice.class);
invoice.setFphm(addInvoiceVO.getFphm());
@ -1474,10 +1469,10 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
Invoice originInvoice = invoiceMapper.selectInvoiceByBillInfoId(originBillInfo.getId());
Invoice invoice = BeanUtil.copyProperties(originInvoice, Invoice.class);
invoice.setFphm(addRedInvoiceVO.getFphm());
invoice.setBillInfoId(billInfoResult.getId());
invoice.setSystemOrderno(billInfoResult.getSystemOrderno());
invoice.setOutTradeOrderno(billInfoResult.getOutTradeOrderno());
invoice.setFpqqlsh(billInfoResult.getFpqqlsh());
invoice.setBillInfoId(billInfoR.getId());
invoice.setSystemOrderno(billInfoR.getSystemOrderno());
invoice.setOutTradeOrderno(billInfoR.getOutTradeOrderno());
invoice.setFpqqlsh(billInfoR.getFpqqlsh());
invoice.setKprq(DateUtil.parse(addRedInvoiceVO.getKprq()));
invoice.setZzfpdm(addRedInvoiceVO.getZzfpdm());
invoice.setZzfphm(addRedInvoiceVO.getZzfphm());

@ -174,10 +174,10 @@ public class JcskTest {
order = "{\n" +
" \"appkey\": \"935248bf224f6c8431cdc1969f029519\",\n" +
" \"dqbm\":\"guangdong\",\n" +
" \"dqbm\":\"qingdao\",\n" +
" \"async\": true,\n" +
" \"bsrysfzjhm\":\"440823199706182127\",\n" +
" \"nsrsbh\": \"91440101MA5CT3T24L\",\n" +
" \"bsrysfzjhm\":\"37028519930620441X\",\n" +
" \"nsrsbh\": \"92370214MACAAEK16E\",\n" +
" \"serviceId\": \"hqrlsbewm\"\n" +
"}";
System.out.println(order);

Loading…
Cancel
Save