yangys
2025-09-06 61763cc1a182effa7e5535ac72d54a6a56f029eb
blade-service/blade-mdm/src/main/java/org/springblade/mdm/flow/controller/FlowMgrController.java
@@ -5,22 +5,22 @@
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.mail.MessagingException;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.HistoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.task.Comment;
import org.flowable.task.api.history.HistoricTaskInstance;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.mdm.flow.service.ApproveRecordService;
import org.springblade.mdm.flow.service.ApproveTableService;
import org.springblade.mdm.flow.service.FlowBusinessService;
import org.springblade.core.tool.utils.UrlUtil;
import org.springblade.mdm.flow.service.*;
import org.springblade.mdm.flow.vo.FlowVO;
import org.springblade.mdm.flow.vo.OvertimeTaskExcelVO;
import org.springblade.mdm.flow.vo.TaskTraceVO;
@@ -31,8 +31,6 @@
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
@@ -47,17 +45,19 @@
   private TaskService taskService;
   @Autowired
   private FlowBusinessService businessService;
   @Autowired
   private FlowCommonService flowCommonService;
   @Autowired
   private HistoryService historyService;
   @Autowired
   private RuntimeService runtimeService;
   @Autowired
   private ApproveTableService approveTableService;
   @Autowired
   private ApproveRecordService approveRecordService;
   private ProgramConfirmTableService programConfirmTableService;
   @Autowired
   private IUserClient userClient;
   @Autowired
   private WIthdrawService withdrawService;
   @GetMapping("overtime-list")
   @ApiOperationSupport(order = 3)
   @Operation(summary = "超时查询", description = "查询所有超时任务")
@@ -165,21 +165,35 @@
      return R.success();
   }
   @PostMapping("/export-approve-table")
   @Operation(summary = "导出审批表", description = "导出审批表excel")
   public void exportApproveTable(String processInstanceId, HttpServletResponse response) {
   @PostMapping("/export-confirm-table")
   @Operation(summary = "导出确认表", description = "导出数控程序确认表pdf")
   public void exportConfirmTable(String processInstanceId, HttpServletResponse response) {
      try {
         String filename = URLEncoder.encode("数控程序编制审批单", StandardCharsets.UTF_8)+ DateUtil.format(DateUtil.now(), "yyyyMMddHHmm")+".pdf";
         FlowProgramProperties props = flowCommonService.getProgramPropertiesFromHis(processInstanceId);
         String progName = props.getDrawingNo()+"-"+props.getProcessNo()+"-"+props.getProcessEdition();
         String filename = UrlUtil.encode("数控程序确认表"+progName)+".pdf";
         response.setHeader("Content-Disposition", "attachment; filename="+filename);
         response.setContentType("application/octet-stream");
         approveTableService.exportApproveTable(processInstanceId,response.getOutputStream());
         programConfirmTableService.exportConfirmTable(props,response.getOutputStream());
      } catch (Exception e) {
         log.error("导出审批表异常", e);
         log.error("导出数控程序确认表pdf异常", e);
         throw new RuntimeException(e);
      }
   }
   @GetMapping("/withdraw")
   @Operation(summary = "撤回任务", description = "从其他任务节点直接撤回编程员节点")
   public R<Void> withdraw(String processInstanceId)  {
      try {
         withdrawService.withdraw(processInstanceId);
         return R.success();
      }catch(Exception e) {
         log.error("<UNK>", e);
         return R.fail(e.getMessage());
      }
   }
}