|
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil; |
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import com.dxhy.order.constant.*; |
|
|
|
|
import com.dxhy.order.exception.OrderReceiveException; |
|
|
|
|
import com.dxhy.order.invoice.module.invoice.service.OfdToPngSDEnergyService; |
|
|
|
|
import com.dxhy.order.model.CommonOrderInvoiceAndOrderMxInfo; |
|
|
|
|
import com.dxhy.order.model.OrderInvoiceInfo; |
|
|
|
|
import com.dxhy.order.model.R; |
|
|
|
@ -28,15 +29,14 @@ import io.swagger.annotations.ApiOperation; |
|
|
|
|
import io.swagger.annotations.ApiParam; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.http.HttpHeaders; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.io.OutputStream; |
|
|
|
|
import java.io.PrintWriter; |
|
|
|
|
import java.io.*; |
|
|
|
|
import java.net.URLEncoder; |
|
|
|
|
import java.nio.charset.StandardCharsets; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
@ -89,6 +89,36 @@ public class InvoiceDetailsController { |
|
|
|
|
@Resource |
|
|
|
|
private InvoiceConfig invoiceConfig; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private OfdToPngSDEnergyService ofdToPngSDEnergyService; |
|
|
|
|
|
|
|
|
|
@GetMapping("priviewOfd") |
|
|
|
|
public R priviewOfd() throws IOException { |
|
|
|
|
File file = new File("C:\\Users\\10216\\Desktop\\042002200113_04440777.ofd"); |
|
|
|
|
|
|
|
|
|
FileInputStream fis = null; |
|
|
|
|
ByteArrayOutputStream bos = new ByteArrayOutputStream(1000); |
|
|
|
|
try { |
|
|
|
|
fis = new FileInputStream(file); |
|
|
|
|
byte[] b = new byte[1000]; |
|
|
|
|
int n; |
|
|
|
|
while ((n = fis.read(b)) != -1) { |
|
|
|
|
bos.write(b, 0, n); |
|
|
|
|
} |
|
|
|
|
byte[] data = bos.toByteArray(); |
|
|
|
|
OfdToPngResponse ofdToPngResponse = ofdToPngSDEnergyService.getOfdPngBySDenergy(data); |
|
|
|
|
return R.ok(ofdToPngResponse); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
System.out.println(e); |
|
|
|
|
} finally { |
|
|
|
|
if (fis != null){ |
|
|
|
|
fis.close(); |
|
|
|
|
} |
|
|
|
|
bos.close(); |
|
|
|
|
} |
|
|
|
|
return R.error(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 查询发票信息详情 |
|
|
|
|
* |
|
|
|
@ -404,7 +434,9 @@ public class InvoiceDetailsController { |
|
|
|
|
ofdToPngRequest.setOFDWJL(fileDownLoad.getFileContent()); |
|
|
|
|
// 解密后的文件流
|
|
|
|
|
byte[] fileByte = Base64Encoding.decode(fileDownLoad.getFileContent()); |
|
|
|
|
OfdToPngResponse ofdToPngResponse = HttpInvoiceRequestUtil.getOfdPng(invoiceConfig.configOfdToPngUrl(), ofdToPngRequest); |
|
|
|
|
|
|
|
|
|
OfdToPngResponse ofdToPngResponse = ofdToPngSDEnergyService.getOfdPngBySDenergy(fileByte); |
|
|
|
|
// OfdToPngResponse ofdToPngResponse = HttpInvoiceRequestUtil.getOfdPng(invoiceConfig.configOfdToPngUrl(), ofdToPngRequest);
|
|
|
|
|
if (ofdToPngResponse != null && ConfigureConstant.STRING_0000.equals(ofdToPngResponse.getZTDM()) && ObjectUtil.isNotEmpty(ofdToPngResponse.getPNGWJL())) { |
|
|
|
|
pngBase64List.addAll(ofdToPngResponse.getPNGWJL()); |
|
|
|
|
} |
|
|
|
|