yangys
2025-09-29 4c7296d45efe849dc70a3b2e2240c905481a91c9
blade-service/blade-mdm/src/main/java/org/springblade/mdm/flow/controller/FlowMgrController.java
@@ -15,12 +15,12 @@
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.ApproveTableService;
import org.springblade.mdm.flow.service.FlowBusinessService;
import org.springblade.mdm.flow.service.WIthdrawService;
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,9 +31,6 @@
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
@@ -48,11 +45,13 @@
   private TaskService taskService;
   @Autowired
   private FlowBusinessService businessService;
   @Autowired
   private FlowCommonService flowCommonService;
   @Autowired
   private HistoryService historyService;
   @Autowired
   private ApproveTableService approveTableService;
   private ProgramConfirmTableService programConfirmTableService;
   @Autowired
   private IUserClient userClient;
   @Autowired
@@ -166,19 +165,21 @@
      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);
      }
@@ -195,4 +196,16 @@
         return R.fail(e.getMessage());
      }
   }
   @GetMapping("/takeback")
   @Operation(summary = "组长取回", description = "从其他任务节点直接撤回到组长派工节点")
   public R<Void> takeback(String processInstanceId)  {
      try {
         withdrawService.takeBackToDispatch(processInstanceId);
         return R.success();
      }catch(Exception e) {
         log.error("<UNK>", e);
         return R.fail(e.getMessage());
      }
   }
}