|
|
@ -1,6 +1,7 @@ |
|
|
|
package com.jianshui.api.controller.http.invoice.v1; |
|
|
|
package com.jianshui.api.controller.http.invoice.v1; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
|
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.jianshui.common.core.domain.AjaxResult; |
|
|
|
import com.jianshui.common.core.domain.AjaxResult; |
|
|
|
import com.jianshui.common.core.domain.entity.Companyservice; |
|
|
|
import com.jianshui.common.core.domain.entity.Companyservice; |
|
|
@ -9,6 +10,7 @@ import com.jianshui.common.exception.jianshui.JianshuiParamErrorException; |
|
|
|
import com.jianshui.common.utils.StringUtils; |
|
|
|
import com.jianshui.common.utils.StringUtils; |
|
|
|
import com.jianshui.common.utils.http.HttpHelper; |
|
|
|
import com.jianshui.common.utils.http.HttpHelper; |
|
|
|
import com.jianshui.invoice.domain.BillInfo; |
|
|
|
import com.jianshui.invoice.domain.BillInfo; |
|
|
|
|
|
|
|
import com.jianshui.invoice.domain.FindRedInfo; |
|
|
|
import com.jianshui.platform.dto.InvoiceAdd.BillInfoPDTO; |
|
|
|
import com.jianshui.platform.dto.InvoiceAdd.BillInfoPDTO; |
|
|
|
import com.jianshui.invoice.domain.Redinfo; |
|
|
|
import com.jianshui.invoice.domain.Redinfo; |
|
|
|
import com.jianshui.invoice.domain.dto.*; |
|
|
|
import com.jianshui.invoice.domain.dto.*; |
|
|
@ -27,9 +29,7 @@ import io.swagger.annotations.*; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
|
|
|
|
|
|
@ -62,6 +62,39 @@ public class InvoiceController { |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private InvoiceAddPService addService; |
|
|
|
private InvoiceAddPService addService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 功能描述: 红字查询接口 |
|
|
|
|
|
|
|
* @param identity |
|
|
|
|
|
|
|
* @return : com.jianshui.invoice.domain.dto.HXResponse |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@PostMapping({"/api/invoice/v1/findRedInfo", "/api/invoice/v1/findRedInfo/{identity}", "/invoice/findRedInfo"}) |
|
|
|
|
|
|
|
public Object findRedInfo(HttpServletRequest request,String identity) throws Exception { |
|
|
|
|
|
|
|
log.info("开始执行"); |
|
|
|
|
|
|
|
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("invoice", companyservice.getCompanyid()); |
|
|
|
|
|
|
|
IInvoiceRequestService invoiceRequestService = invoiceRequestFactory.getService(requestAdapterKey); |
|
|
|
|
|
|
|
JSONObject decryptResult = invoiceRequestService.decrypt(request, companyservice, "find_redinfo"); |
|
|
|
|
|
|
|
// 获得请求实例,并且进行扣费
|
|
|
|
|
|
|
|
log.info("解密数据{}",decryptResult); |
|
|
|
|
|
|
|
FindRedInfo findRedInfo = decryptResult.toJavaObject(FindRedInfo.class); |
|
|
|
|
|
|
|
log.info("转换数据{}", JSONUtil.toJsonStr(findRedInfo)); |
|
|
|
|
|
|
|
String serviceKey = serviceManageService.getCompanyServiceSupplier("invoice", companyservice.getCompanyid()); |
|
|
|
|
|
|
|
serviceManageService.companyConsume("invoice", companyservice.getCompanyid()); |
|
|
|
|
|
|
|
IInvoiceApiService invoiceService = invoiceServiceFactory.getService(serviceKey); |
|
|
|
|
|
|
|
HXResponse result = invoiceService.findRedInfo(findRedInfo, companyservice); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String responseAdapterKey = serviceManageService.getResponseAdapterKey("invoice", companyservice.getCompanyid()); |
|
|
|
|
|
|
|
IInvoiceResponseService invoiceResponseService = invoiceResponseFactory.getService(responseAdapterKey); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return invoiceResponseService.response(result, companyservice, "find_redinfo"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* API回调接口 |
|
|
|
* API回调接口 |
|
|
|