|
|
@@ -46,8 +46,6 @@ import cn.start.tz.module.pressure2.dal.dataobject.notificationformreport.Notifi
|
|
|
import cn.start.tz.module.pressure2.dal.dataobject.opinionnotificationfollowrecord.OpinionNotificationFollowRecordDO;
|
|
|
import cn.start.tz.module.pressure2.dal.dataobject.pipetaskorder.PipeTaskOrderDO;
|
|
|
import cn.start.tz.module.pressure2.dal.dataobject.pipetaskorderitem.PipeTaskOrderItemDO;
|
|
|
-import cn.start.tz.module.pressure2.dal.dataobject.pipetaskorderitemreport.PipeTaskOrderItemReportDO;
|
|
|
-import cn.start.tz.module.pressure2.dal.dataobject.pipetaskorderitemreportuser.PipeTaskOrderItemReportUserDO;
|
|
|
import cn.start.tz.module.pressure2.dal.dataobject.pipetaskorderuser.PipeTaskOrderUserDO;
|
|
|
import cn.start.tz.module.pressure2.dal.dataobject.taskordernontaxrecord.TaskOrderNonTaxRecordDO;
|
|
|
import cn.start.tz.module.pressure2.dal.dataobject.taskordernontaxrecorditem.TaskOrderNonTaxRecordItemDO;
|
|
|
@@ -71,7 +69,6 @@ import cn.start.tz.module.pressure2.controller.admin.boilertaskorderitemreport.v
|
|
|
import cn.start.tz.module.pressure2.controller.admin.bpmtaskinfo.vo.BpmTaskRespVO;
|
|
|
import cn.start.tz.module.pressure2.controller.admin.costfield.vo.CostFieldRespVO;
|
|
|
import cn.start.tz.module.pressure2.controller.admin.dynamictbins.vo.CreateInstantiateWithRuleVO;
|
|
|
-import cn.start.tz.module.pressure2.controller.admin.reporttemplate.vo.ReportPreviewVO;
|
|
|
import cn.start.tz.module.pressure2.dal.dataobject.acceptorder.AcceptOrderDO;
|
|
|
import cn.start.tz.module.pressure2.dal.dataobject.appointmentconfirmorder.AppointmentConfirmOrderDO;
|
|
|
import cn.start.tz.module.pressure2.dal.dataobject.appointmentconfirmorderrefuseitem.AppointmentConfirmOrderRefuseItemDO;
|
|
|
@@ -189,7 +186,6 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.github.yulichang.query.MPJLambdaQueryWrapper;
|
|
|
import com.google.common.collect.Lists;
|
|
|
-import com.grapecity.documents.excel.drawing.S;
|
|
|
import jodd.util.StringUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
@@ -252,6 +248,9 @@ import static java.time.LocalDate.now;
|
|
|
@Slf4j
|
|
|
public class BoilerTaskOrderServiceImpl extends ServiceImpl<BoilerTaskOrderMapper, BoilerTaskOrderDO> implements BoilerTaskOrderService {
|
|
|
|
|
|
+ @Value("${tz.env.name}")
|
|
|
+ private String env;
|
|
|
+
|
|
|
@Value("${tz.qrCodeWebUrl.boiler}")
|
|
|
private String boilerQrCodeUrl;
|
|
|
|
|
|
@@ -1757,48 +1756,6 @@ public class BoilerTaskOrderServiceImpl extends ServiceImpl<BoilerTaskOrderMappe
|
|
|
}
|
|
|
|
|
|
taskOrderItemReportMapper.updateById(itemReportDO);
|
|
|
- String reportUrl = null;
|
|
|
- if (StringUtils.isNotBlank(reportDO.getReportUrl())) {
|
|
|
- /*if ("uat".equals(env)) {
|
|
|
- try {
|
|
|
- byte[] reportBytes = fileApi.getFileByPath(reportDO.getReportUrl()).getData();
|
|
|
- List<SignValuesDTO> valuesDTOList = Lists.newArrayList();
|
|
|
- SignValuesDTO valuesDTO1 = new SignValuesDTO();
|
|
|
- valuesDTO1.setCode("JDY");
|
|
|
- valuesDTO1.setSealType("JYZ");
|
|
|
- valuesDTO1.setTextonce(0);
|
|
|
- valuesDTO1.setText("(检验检测专用章或公章)");
|
|
|
- valuesDTOList.add(valuesDTO1);
|
|
|
- byte[] signedPdfBytes = this.sign(reportBytes, valuesDTOList);
|
|
|
- reportUrl = fileApi.createFile(signedPdfBytes);
|
|
|
- } catch (Exception e) {
|
|
|
- log.info("出具报告盖章失败:{}", e.getMessage());
|
|
|
-
|
|
|
- try {
|
|
|
- ReportPreviewVO reportPreview = new ReportPreviewVO();
|
|
|
- reportPreview.setReportId(id);
|
|
|
- reportPreview.setFileType(200);
|
|
|
- ByteArrayOutputStream recordOutputStreamReport = reportTemplateService.getRecordOutputStreamReport(reportPreview);
|
|
|
- // excel 转 pdf
|
|
|
- reportUrl = fileApi.createFile(recordOutputStreamReport.toByteArray());
|
|
|
- } catch (Exception ex) {
|
|
|
- log.error("出具报告失败:{}", ex.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
- } else {*/
|
|
|
- try {
|
|
|
- ReportPreviewVO reportPreview = new ReportPreviewVO();
|
|
|
- reportPreview.setReportId(id);
|
|
|
- reportPreview.setFileType(200);
|
|
|
-// ByteArrayOutputStream recordOutputStreamReport = reportTemplateService.getRecordOutputStreamReport(reportPreview);
|
|
|
- // excel 转 pdf
|
|
|
-// reportUrl = fileApi.createFile(recordOutputStreamReport.toByteArray());
|
|
|
- } catch (Exception ex) {
|
|
|
- log.error("出具报告失败:{}", ex.getMessage());
|
|
|
- }
|
|
|
-// }
|
|
|
- }
|
|
|
- itemReportDO.setOpinionReportedUrl(reportUrl);
|
|
|
} else {
|
|
|
itemReportDO.setRatifyId(userId);
|
|
|
itemReportDO.setRatifyTime(LocalDateTime.now());
|
|
|
@@ -1818,7 +1775,46 @@ public class BoilerTaskOrderServiceImpl extends ServiceImpl<BoilerTaskOrderMappe
|
|
|
syncReportVO.setRefId(id);
|
|
|
syncReportVO.setReportType("record");
|
|
|
syncReportData(syncReportVO);
|
|
|
+ String reportUrl = null;
|
|
|
+ if ("prod".equals(env)) {
|
|
|
+ try {
|
|
|
+ byte[] bytes = pdfService.pdfByRefId(reportDO.getTemplateId(), reportDO.getId());
|
|
|
+ List<SignValuesDTO> valuesDTOList = Lists.newArrayList();
|
|
|
+ SignValuesDTO valuesDTO1 = new SignValuesDTO();
|
|
|
+ valuesDTO1.setCode("JDY");
|
|
|
+ valuesDTO1.setSealType("JYZ");
|
|
|
+ valuesDTO1.setTextonce(0);
|
|
|
+ valuesDTO1.setText("(检验检测专用章或公章)");
|
|
|
+ valuesDTOList.add(valuesDTO1);
|
|
|
+ byte[] signedPdfBytes = this.sign(bytes, valuesDTOList);
|
|
|
+ reportUrl = fileApi.createFile(signedPdfBytes);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info("出具报告盖章失败:{}", e.getMessage());
|
|
|
|
|
|
+ try {
|
|
|
+ byte[] bytes = pdfService.pdfByRefId(reportDO.getTemplateId(), reportDO.getId());
|
|
|
+ ByteArrayOutputStream recordOutputStreamReport = new ByteArrayOutputStream();
|
|
|
+ recordOutputStreamReport.write(bytes);
|
|
|
+ // excel 转 pdf
|
|
|
+ reportUrl = fileApi.createFile(recordOutputStreamReport.toByteArray());
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error("出具报告失败:{}", ex.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }else {
|
|
|
+ try {
|
|
|
+ byte[] bytes = pdfService.pdfByRefId(reportDO.getTemplateId(), reportDO.getId());
|
|
|
+ ByteArrayOutputStream recordOutputStreamReport = new ByteArrayOutputStream();
|
|
|
+ recordOutputStreamReport.write(bytes);
|
|
|
+ // excel 转 pdf
|
|
|
+ reportUrl = fileApi.createFile(recordOutputStreamReport.toByteArray());
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error("出具报告失败:{}", ex.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ itemReportDO.setOpinionReportedUrl(reportUrl);
|
|
|
+ taskOrderItemReportMapper.updateById(itemReportDO);
|
|
|
//首页待办 - 去掉待办
|
|
|
String typeName = "";
|
|
|
if (reportDO.getReportType() == 600){
|
|
|
@@ -1873,6 +1869,60 @@ public class BoilerTaskOrderServiceImpl extends ServiceImpl<BoilerTaskOrderMappe
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public byte[] getInitiatePdf(String reportId) throws Exception {
|
|
|
+ BoilerTaskOrderItemReportDO reportDO = taskOrderItemReportMapper.selectById(reportId);
|
|
|
+ if (reportDO == null) {
|
|
|
+ throw new ServiceException(404, "数据不存在");
|
|
|
+ }
|
|
|
+ if (reportDO.getOpinionReportedUrl() != null){
|
|
|
+ return fileApi.getFileByPath(reportDO.getOpinionReportedUrl()).getData();
|
|
|
+ }
|
|
|
+ // 没有要重新生成
|
|
|
+ BoilerTaskOrderItemReportDO itemReportDO = new BoilerTaskOrderItemReportDO().setId(reportDO.getId());
|
|
|
+ String reportUrl = null;
|
|
|
+ if ("prod".equals(env)) {
|
|
|
+ try {
|
|
|
+ byte[] bytes = pdfService.pdfByRefId(reportDO.getTemplateId(), reportDO.getId());
|
|
|
+ List<SignValuesDTO> valuesDTOList = Lists.newArrayList();
|
|
|
+ SignValuesDTO valuesDTO1 = new SignValuesDTO();
|
|
|
+ valuesDTO1.setCode("JDY");
|
|
|
+ valuesDTO1.setSealType("JYZ");
|
|
|
+ valuesDTO1.setTextonce(0);
|
|
|
+ valuesDTO1.setText("机构公章或");
|
|
|
+ valuesDTOList.add(valuesDTO1);
|
|
|
+ byte[] signedPdfBytes = this.sign(bytes, valuesDTOList);
|
|
|
+ reportUrl = fileApi.createFile(signedPdfBytes);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info("出具报告盖章失败:{}", e.getMessage());
|
|
|
+
|
|
|
+ try {
|
|
|
+ byte[] bytes = pdfService.pdfByRefId(reportDO.getTemplateId(), reportDO.getId());
|
|
|
+ ByteArrayOutputStream recordOutputStreamReport = new ByteArrayOutputStream();
|
|
|
+ recordOutputStreamReport.write(bytes);
|
|
|
+ // excel 转 pdf
|
|
|
+ reportUrl = fileApi.createFile(recordOutputStreamReport.toByteArray());
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error("出具报告失败:{}", ex.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }else {
|
|
|
+ try {
|
|
|
+ byte[] bytes = pdfService.pdfByRefId(reportDO.getTemplateId(), reportDO.getId());
|
|
|
+ ByteArrayOutputStream recordOutputStreamReport = new ByteArrayOutputStream();
|
|
|
+ recordOutputStreamReport.write(bytes);
|
|
|
+ // excel 转 pdf
|
|
|
+ reportUrl = fileApi.createFile(recordOutputStreamReport.toByteArray());
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error("出具报告失败:{}", ex.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ itemReportDO.setOpinionReportedUrl(reportUrl);
|
|
|
+ taskOrderItemReportMapper.updateById(itemReportDO);
|
|
|
+ return fileApi.getFileByPath(reportUrl).getData();
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void serviceFromUpdate(OrderFormEnterReqVO reqVO) throws Exception {
|
|
|
|
|
|
@@ -2293,8 +2343,6 @@ public class BoilerTaskOrderServiceImpl extends ServiceImpl<BoilerTaskOrderMappe
|
|
|
@Resource
|
|
|
private PushTaskOrderService pushTaskOrderService;
|
|
|
|
|
|
- @Value("${tz.env.name}")
|
|
|
- private String env;
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
@@ -7679,5 +7727,18 @@ public class BoilerTaskOrderServiceImpl extends ServiceImpl<BoilerTaskOrderMappe
|
|
|
|
|
|
return signApi.getSignFile(signUrl).getCheckedData();
|
|
|
}
|
|
|
+ private byte[] sign(byte[] bytes, List<SignValuesDTO> valuesDTOList) throws Exception {
|
|
|
+ CntSignReqDTO signReqDTO = new CntSignReqDTO();
|
|
|
+ signReqDTO.setBytes(bytes);
|
|
|
+ signReqDTO.setValuesDTOList(valuesDTOList);
|
|
|
+ CntSignResponseRepsDTO signRepsDTO = signApi.sign(signReqDTO).getCheckedData();
|
|
|
+ String signUrl = signRepsDTO.getRecord_saved_urls().get(0);
|
|
|
+
|
|
|
+ if(env.equals("local")){
|
|
|
+ Thread.sleep(5000);
|
|
|
+ }
|
|
|
+
|
|
|
+ return signApi.getSignFile(signUrl).getCheckedData();
|
|
|
+ }
|
|
|
|
|
|
}
|