|
|
|
@ -3,41 +3,29 @@ package com.jianshui.api.controller.http.invoice.v1; |
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
|
import cn.hutool.core.codec.Base64Decoder; |
|
|
|
|
import cn.hutool.core.codec.Base64Encoder; |
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
|
import cn.hutool.core.util.IdUtil; |
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import cn.hutool.json.JSONArray; |
|
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
|
import com.alibaba.druid.support.json.JSONUtils; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.extension.api.R; |
|
|
|
|
import com.dxhy.order.protocol.invoke.DxhyInterfaceResponse; |
|
|
|
|
import com.google.gson.Gson; |
|
|
|
|
import com.google.gson.JsonArray; |
|
|
|
|
import com.google.gson.JsonObject; |
|
|
|
|
import com.jianshui.common.constant.HttpStatus; |
|
|
|
|
import com.jianshui.common.core.domain.AjaxResult; |
|
|
|
|
import com.jianshui.common.core.domain.entity.Companyservice; |
|
|
|
|
import com.jianshui.common.enums.ErrorCode; |
|
|
|
|
import com.jianshui.common.exception.jianshui.JianshuiParamErrorException; |
|
|
|
|
import com.jianshui.common.exception.jianshui.JianshuiServiceException; |
|
|
|
|
import com.jianshui.common.utils.StringUtils; |
|
|
|
|
import com.jianshui.common.utils.http.HttpHelper; |
|
|
|
|
import com.jianshui.common.utils.uuid.IdUtils; |
|
|
|
|
import com.jianshui.framework.manager.AsyncManager; |
|
|
|
|
import com.jianshui.invoice.constant.elephant.ElephantConstants; |
|
|
|
|
import com.jianshui.invoice.domain.*; |
|
|
|
|
import com.jianshui.invoice.domain.ele.EleNewMessage; |
|
|
|
|
import com.jianshui.invoice.domain.ele.EleOuterMessage; |
|
|
|
|
import com.jianshui.invoice.domain.ele.FindRedInfoDTO; |
|
|
|
|
import com.jianshui.invoice.domain.ele.HZSQDMessage; |
|
|
|
|
import com.jianshui.invoice.mapper.InvoiceBackMapper; |
|
|
|
|
import com.jianshui.invoice.mapper.InvoiceFileMapper; |
|
|
|
|
import com.jianshui.invoice.service.impl.api.ElephantInvoiceApiV6ServiceImpl; |
|
|
|
|
import com.jianshui.invoice.task.AddInvoiceBatchTask; |
|
|
|
|
import com.jianshui.invoice.task.InvoiceBackTask; |
|
|
|
|
import com.jianshui.invoice.utils.elephant.ElephantUtils; |
|
|
|
|
import com.jianshui.platform.dto.InvoiceAdd.BillInfoPDTO; |
|
|
|
|
import com.jianshui.invoice.domain.dto.*; |
|
|
|
|
import com.jianshui.invoice.domain.dto.api.*; |
|
|
|
@ -58,14 +46,8 @@ import org.apache.pdfbox.pdmodel.PDDocument; |
|
|
|
|
import org.apache.pdfbox.rendering.PDFRenderer; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.http.MediaType; |
|
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
|
|
import org.springframework.scheduling.annotation.Async; |
|
|
|
|
import org.springframework.ui.Model; |
|
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
import org.springframework.web.context.request.RequestContextHolder; |
|
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes; |
|
|
|
|
import org.springframework.web.servlet.ModelAndView; |
|
|
|
|
|
|
|
|
|
import javax.imageio.ImageIO; |
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
@ -73,8 +55,6 @@ import javax.servlet.http.HttpServletResponse; |
|
|
|
|
import java.awt.image.BufferedImage; |
|
|
|
|
import java.io.*; |
|
|
|
|
import java.net.URLEncoder; |
|
|
|
|
import java.security.InvalidKeyException; |
|
|
|
|
import java.security.NoSuchAlgorithmException; |
|
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -113,6 +93,42 @@ public class InvoiceController { |
|
|
|
|
private InvoiceFileMapper invoiceFileMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 发票列表查询接口 |
|
|
|
|
* @param request |
|
|
|
|
* @param identity |
|
|
|
|
* @return |
|
|
|
|
* @throws Exception |
|
|
|
|
*/ |
|
|
|
|
@PostMapping({"/api/invoice/v1/queryInvoiceList", "/api/invoice/v1/queryInvoiceList/{identity}", "/invoice/queryInvoiceList"}) |
|
|
|
|
public Object queryInvoiceList(HttpServletRequest request, String identity) throws Exception { |
|
|
|
|
log.info("发票列表查询接口,开始执行"); |
|
|
|
|
if (StringUtils.isEmpty(identity)) { |
|
|
|
|
DxhyInterfaceResponse dxhyInterfaceResponse = new DxhyInterfaceResponse(); |
|
|
|
|
dxhyInterfaceResponse.setCode("9999"); |
|
|
|
|
dxhyInterfaceResponse.setMessage("身份认证参数为空"); |
|
|
|
|
return dxhyInterfaceResponse; |
|
|
|
|
} |
|
|
|
|
Companyservice companyservice = iCompanyserviceService.selectCompanyserviceByIdentity(identity); |
|
|
|
|
if (companyservice == null) { |
|
|
|
|
DxhyInterfaceResponse dxhyInterfaceResponse = new DxhyInterfaceResponse(); |
|
|
|
|
dxhyInterfaceResponse.setCode("9999"); |
|
|
|
|
dxhyInterfaceResponse.setMessage("企业信息不存在"); |
|
|
|
|
return dxhyInterfaceResponse; |
|
|
|
|
} |
|
|
|
|
String requestAdapterKey = serviceManageService.getRequestAdapterKey("invoice", companyservice.getCompanyid()); |
|
|
|
|
IInvoiceRequestService invoiceRequestService = invoiceRequestFactory.getService(requestAdapterKey); |
|
|
|
|
JSONObject decryptResult = invoiceRequestService.decrypt(request, companyservice, "query_invoice_list"); |
|
|
|
|
// 获得请求实例,并且进行扣费
|
|
|
|
|
log.info("发票列表查询接口,解密数据{}", decryptResult); |
|
|
|
|
QueryInvoiceListDTO queryInvoiceList = decryptResult.toJavaObject(QueryInvoiceListDTO.class); |
|
|
|
|
log.info("发票列表查询接口,转换数据{}", JSONUtil.toJsonStr(queryInvoiceList)); |
|
|
|
|
String serviceKey = serviceManageService.getCompanyServiceSupplier("invoice", companyservice.getCompanyid()); |
|
|
|
|
serviceManageService.companyConsume("invoice", companyservice.getCompanyid()); |
|
|
|
|
IInvoiceApiService invoiceService = invoiceServiceFactory.getService(serviceKey); |
|
|
|
|
return invoiceService.queryInvoiceList(queryInvoiceList, companyservice); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 功能描述: 红字查询接口 |
|
|
|
|
* |
|
|
|
|