yangys
2025-09-18 0d61b9bfca526e9c3da2209de8f9f367e76fd013
blade-service/blade-mdm/src/main/java/org/springblade/mdm/statreport/controller/ConfirmTablePrintController.java
@@ -6,12 +6,10 @@
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import liquibase.logging.mdc.customobjects.History;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.DateUtil;
import org.flowable.engine.HistoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.history.HistoricProcessInstance;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
@@ -21,11 +19,8 @@
import org.springblade.mdm.flow.service.FlowCommonService;
import org.springblade.mdm.flow.service.FlowProgramProperties;
import org.springblade.mdm.flow.service.TaskDispatchService;
import org.springblade.mdm.flow.vo.DispathTaskQueryVO;
import org.springblade.mdm.flow.vo.FlowVO;
import org.springblade.mdm.statreport.service.ApproveTableService;
import org.springblade.mdm.statreport.service.ConfirmTablePrintService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -45,8 +40,7 @@
   private FlowCommonService flowCommonService;
   private ConfirmTablePrintService confirmTablePrintService;
   private final TaskDispatchService taskDispatchService;
   private final HistoryService hisService;
   private final HistoryService historyService;
   @GetMapping("/confirm-page")
   @ApiOperationSupport(order = 3)
   @Operation(summary = "确认单列表", description = "确认单列表")
@@ -60,16 +54,15 @@
   @Operation(summary = "导出数控程序确认表", description = "数控程序确认表")
   public void exportConfirmTable(String processInstanceId,HttpServletResponse response) throws IOException {
      HistoricProcessInstance his = hisService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
      String taskDispatchId = his.getBusinessKey();
      TaskDispatch dispatch = taskDispatchService.getById(taskDispatchId);
      FlowProgramProperties props = flowCommonService.getProgramPropertiesFromHis(processInstanceId);
      HistoricProcessInstance his = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
      //TaskDispatch dispatch = taskDispatchService.getById(his.getBusinessKey());
      String progName = props.getDrawingNo()+"-"+props.getProcessNo()+"-"+props.getProcessEdition();
      String filename = UrlUtil.encode("数控程序确认表"+progName)+".docx";
      ByteArrayOutputStream outputStream = confirmTablePrintService.exportConfirmTableDoc(dispatch,props);
      ByteArrayOutputStream outputStream = confirmTablePrintService.exportConfirmTableDoc(props);
      byte[] fileBytes = outputStream.toByteArray();