diff --git a/order-management-invoice/src/main/java/com/dxhy/order/invoice/module/invoice/controller/InvoiceDetailsController.java b/order-management-invoice/src/main/java/com/dxhy/order/invoice/module/invoice/controller/InvoiceDetailsController.java index da5dcb34..0edb7648 100644 --- a/order-management-invoice/src/main/java/com/dxhy/order/invoice/module/invoice/controller/InvoiceDetailsController.java +++ b/order-management-invoice/src/main/java/com/dxhy/order/invoice/module/invoice/controller/InvoiceDetailsController.java @@ -30,6 +30,7 @@ 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.beans.factory.annotation.Value; import org.springframework.http.HttpHeaders; import org.springframework.web.bind.annotation.*; @@ -92,6 +93,9 @@ public class InvoiceDetailsController { @Autowired private OfdToPngSDEnergyService ofdToPngSDEnergyService; + @Value("${yx.isuse}") + private String yxisuse; + @GetMapping("priviewOfd") public R priviewOfd() throws IOException { File file = new File("C:\\Users\\10216\\Desktop\\042002200113_04440777.ofd"); @@ -432,11 +436,16 @@ public class InvoiceDetailsController { OfdToPngRequest ofdToPngRequest = new OfdToPngRequest(); ofdToPngRequest.setNSRSBH(xhfNsrsbh); ofdToPngRequest.setOFDWJL(fileDownLoad.getFileContent()); - // 解密后的文件流 - byte[] fileByte = Base64Encoding.decode(fileDownLoad.getFileContent()); + OfdToPngResponse ofdToPngResponse = null; + if ("Y".equals(yxisuse)) { + // 解密后的文件流 + byte[] fileByte = Base64Encoding.decode(fileDownLoad.getFileContent()); + ofdToPngResponse = ofdToPngSDEnergyService.getOfdPngBySDenergy(fileByte); + + } else { + 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()); }