yangys
13 小时以前 4ab2cb495ccece311bbd8d0ecb992c7de0bc8500
blade-service/blade-mdm/src/main/java/org/springblade/mdm/flow/controller/FlowMgrController.java
@@ -13,12 +13,15 @@
import org.flowable.engine.task.Comment;
import org.flowable.task.api.history.HistoricTaskInstance;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.mdm.basesetting.machine.vo.MachineExcelVO;
import org.springblade.mdm.commons.vo.IdsVO;
import org.springblade.mdm.flow.service.ApproveRecordService;
import org.springblade.mdm.flow.service.ApproveTableService;
import org.springblade.mdm.flow.service.FlowBusinessService;
import org.springblade.mdm.flow.vo.FlowVO;
import org.springblade.mdm.flow.vo.OvertimeTaskExcelVO;
@@ -27,6 +30,9 @@
import org.springframework.beans.factory.annotation.Autowired;
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.util.ArrayList;
import java.util.Collections;
@@ -46,6 +52,8 @@
   private HistoryService historyService;
   @Autowired
   private RuntimeService runtimeService;
   @Autowired
   private ApproveTableService approveTableService;
   @GetMapping("overtime-list")
   @ApiOperationSupport(order = 3)
@@ -108,7 +116,8 @@
   @Operation(summary = "流程删除", description = "删除id指定的流程实例")
   public R<Void> deleteInstance(@Parameter(description = "任务到达时间开始") String processInstancesId) {
      try {
         runtimeService.deleteProcessInstance(processInstancesId, "流程查询-删除");
         businessService.deleteProcessInstance(processInstancesId);
      } catch (Exception e) {
         log.error("删除流程失败",e);
         return R.fail(e.getMessage());
@@ -116,5 +125,21 @@
      return R.success();
   }
   @PostMapping("/export-approve-table")
   @Operation(summary = "导出审批表", description = "导出审批表excel")
   public void exportApproveTable(String processInstanceId, HttpServletResponse response) {
      try {
         String filename = URLEncoder.encode("数控程序编制审批单", StandardCharsets.UTF_8)+ DateUtil.format(DateUtil.now(), "yyyyMMddHHmm")+".pdf";
         response.setHeader("Content-Disposition", "attachment; filename="+filename);
         response.setContentType("application/octet-stream");
         approveTableService.exportApproveTable(processInstanceId,response.getOutputStream());
      } catch (Exception e) {
         log.error("导出DNC异常", e);
         throw new RuntimeException(e);
      }
   }
}