|
@@ -4,12 +4,17 @@ import java.io.IOException;
|
|
import java.io.OutputStream;
|
|
import java.io.OutputStream;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
+import java.util.concurrent.CopyOnWriteArrayList;
|
|
|
|
+import java.util.concurrent.CountDownLatch;
|
|
|
|
+import java.util.concurrent.ExecutorService;
|
|
|
|
+import java.util.concurrent.Executors;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.ruoyi.common.utils.document.DocumentHandler;
|
|
import com.ruoyi.common.utils.document.DocumentHandler;
|
|
import com.ruoyi.common.utils.document.PDFTemplateUtil;
|
|
import com.ruoyi.common.utils.document.PDFTemplateUtil;
|
|
|
|
+import com.ruoyi.framework.interceptor.annotation.RepeatSubmit;
|
|
import com.ruoyi.project.approve.damain.DevTask;
|
|
import com.ruoyi.project.approve.damain.DevTask;
|
|
import com.ruoyi.project.listener.monthSemsApprove.*;
|
|
import com.ruoyi.project.listener.monthSemsApprove.*;
|
|
import com.ruoyi.project.listener.semsApprove.*;
|
|
import com.ruoyi.project.listener.semsApprove.*;
|
|
@@ -50,8 +55,7 @@ import javax.servlet.http.HttpServletResponse;
|
|
*/
|
|
*/
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/sems/approve")
|
|
@RequestMapping("/sems/approve")
|
|
-public class TApproveController extends BaseController
|
|
|
|
-{
|
|
|
|
|
|
+public class TApproveController extends BaseController {
|
|
@Autowired
|
|
@Autowired
|
|
private ITApproveService tApproveService;
|
|
private ITApproveService tApproveService;
|
|
@Autowired
|
|
@Autowired
|
|
@@ -84,13 +88,13 @@ public class TApproveController extends BaseController
|
|
private ITReportYlgdService tReportYlgdService;
|
|
private ITReportYlgdService tReportYlgdService;
|
|
@Autowired
|
|
@Autowired
|
|
private ITReportMonthService tReportMonthService;
|
|
private ITReportMonthService tReportMonthService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 查询特种设备申请列表
|
|
* 查询特种设备申请列表
|
|
*/
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('sems:approve:list')")
|
|
@PreAuthorize("@ss.hasPermi('sems:approve:list')")
|
|
@GetMapping("/list")
|
|
@GetMapping("/list")
|
|
- public TableDataInfo list(TApprove tApprove)
|
|
|
|
- {
|
|
|
|
|
|
+ public TableDataInfo list(TApprove tApprove) {
|
|
startPage();
|
|
startPage();
|
|
List<TApprove> list = tApproveService.selectTApproveList(tApprove);
|
|
List<TApprove> list = tApproveService.selectTApproveList(tApprove);
|
|
return getDataTable(list);
|
|
return getDataTable(list);
|
|
@@ -118,8 +122,7 @@ public class TApproveController extends BaseController
|
|
@PreAuthorize("@ss.hasPermi('sems:approve:export')")
|
|
@PreAuthorize("@ss.hasPermi('sems:approve:export')")
|
|
@Log(title = "特种设备申请", businessType = BusinessType.EXPORT)
|
|
@Log(title = "特种设备申请", businessType = BusinessType.EXPORT)
|
|
@GetMapping("/export")
|
|
@GetMapping("/export")
|
|
- public AjaxResult export(TApprove tApprove)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult export(TApprove tApprove) {
|
|
List<TApprove> list = tApproveService.selectTApproveList(tApprove);
|
|
List<TApprove> list = tApproveService.selectTApproveList(tApprove);
|
|
ExcelUtil<TApprove> util = new ExcelUtil<TApprove>(TApprove.class);
|
|
ExcelUtil<TApprove> util = new ExcelUtil<TApprove>(TApprove.class);
|
|
return util.exportExcel(list, "approve");
|
|
return util.exportExcel(list, "approve");
|
|
@@ -130,8 +133,7 @@ public class TApproveController extends BaseController
|
|
*/
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('sems:approve:query')")
|
|
@PreAuthorize("@ss.hasPermi('sems:approve:query')")
|
|
@GetMapping(value = "/{id}")
|
|
@GetMapping(value = "/{id}")
|
|
- public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult getInfo(@PathVariable("id") Long id) {
|
|
return AjaxResult.success(tApproveService.selectTApproveById(id));
|
|
return AjaxResult.success(tApproveService.selectTApproveById(id));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -140,8 +142,7 @@ public class TApproveController extends BaseController
|
|
*/
|
|
*/
|
|
@Log(title = "特种设备申请", businessType = BusinessType.INSERT)
|
|
@Log(title = "特种设备申请", businessType = BusinessType.INSERT)
|
|
@PostMapping
|
|
@PostMapping
|
|
- public AjaxResult add(@RequestBody TApprove tApprove)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult add(@RequestBody TApprove tApprove) {
|
|
logger.info(JSON.toJSONString(tApprove));
|
|
logger.info(JSON.toJSONString(tApprove));
|
|
Long userid = getUserId();
|
|
Long userid = getUserId();
|
|
tApprove.setUserId(userid);
|
|
tApprove.setUserId(userid);
|
|
@@ -260,12 +261,16 @@ public class TApproveController extends BaseController
|
|
String[] ids = null;
|
|
String[] ids = null;
|
|
if (tApprove.getApproveType() == 7) {
|
|
if (tApprove.getApproveType() == 7) {
|
|
ids = tApprove.getReportId().split(",");
|
|
ids = tApprove.getReportId().split(",");
|
|
- }else if (tApprove.getApproveType() == 8) {
|
|
|
|
|
|
+ } else if (tApprove.getApproveType() == 8) {
|
|
ids = tApprove.getMonthId().split(",");
|
|
ids = tApprove.getMonthId().split(",");
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
ids = tApprove.getDevId().split(",");
|
|
ids = tApprove.getDevId().split(",");
|
|
}
|
|
}
|
|
- List<Object> devList = new ArrayList<>();
|
|
|
|
|
|
+ CopyOnWriteArrayList<Object> devList = new CopyOnWriteArrayList<>();
|
|
|
|
+ //线程池
|
|
|
|
+ ExecutorService executorService = Executors.newFixedThreadPool(30);
|
|
|
|
+ final CountDownLatch latch = new CountDownLatch(ids.length); //相同线程数量的计数
|
|
|
|
+
|
|
if (tApprove.getDevType() != null && tApprove.getApproveType() != 7) {
|
|
if (tApprove.getDevType() != null && tApprove.getApproveType() != 7) {
|
|
switch (Integer.parseInt(tApprove.getDevType().toString())) {
|
|
switch (Integer.parseInt(tApprove.getDevType().toString())) {
|
|
case 1:
|
|
case 1:
|
|
@@ -324,17 +329,34 @@ public class TApproveController extends BaseController
|
|
case "1":
|
|
case "1":
|
|
for (String i : ids
|
|
for (String i : ids
|
|
) {
|
|
) {
|
|
- TReportYlrq reportYlrqEntity = tReportYlrqService.selectTReportYlrqById(Long.parseLong(i));
|
|
|
|
- reportYlrqEntity.setDevEntity(tSpecdevYlrqService.getById(reportYlrqEntity.getDevId()));
|
|
|
|
- devList.add(reportYlrqEntity);
|
|
|
|
|
|
+ executorService.execute(() -> {
|
|
|
|
+ //-- 业务模块
|
|
|
|
+ try {
|
|
|
|
+ TReportYlrq reportYlrqEntity = tReportYlrqService.selectTReportYlrqById(Long.parseLong(i));
|
|
|
|
+ reportYlrqEntity.setDevEntity(tSpecdevYlrqService.getById(reportYlrqEntity.getDevId()));
|
|
|
|
+ devList.add(reportYlrqEntity);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ } finally {
|
|
|
|
+ latch.countDown(); //线程计数
|
|
|
|
+ }
|
|
|
|
+ });
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
case "2":
|
|
case "2":
|
|
for (String i : ids
|
|
for (String i : ids
|
|
) {
|
|
) {
|
|
- TReportYlgd reportYlgdEntity = tReportYlgdService.selectTReportYlgdById(Long.parseLong(i));
|
|
|
|
- reportYlgdEntity.setDevEntity(tSpecdevYlgdService.getById(reportYlgdEntity.getDevId()));
|
|
|
|
- devList.add(reportYlgdEntity);
|
|
|
|
|
|
+ executorService.execute(() -> {
|
|
|
|
+ //-- 业务模块
|
|
|
|
+ try {
|
|
|
|
+ TReportYlgd reportYlgdEntity = tReportYlgdService.selectTReportYlgdById(Long.parseLong(i));
|
|
|
|
+ reportYlgdEntity.setDevEntity(tSpecdevYlgdService.getById(reportYlgdEntity.getDevId()));
|
|
|
|
+ devList.add(reportYlgdEntity);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ } finally {
|
|
|
|
+ latch.countDown(); //线程计数
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
@@ -346,6 +368,12 @@ public class TApproveController extends BaseController
|
|
tApprove.setDevType(0l);
|
|
tApprove.setDevType(0l);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ try {
|
|
|
|
+ latch.await(); //线程计数完毕后继续执行
|
|
|
|
+ } catch (InterruptedException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ executorService.shutdown();
|
|
tApprove.setDevList(devList);
|
|
tApprove.setDevList(devList);
|
|
return AjaxResult.success(tApprove);
|
|
return AjaxResult.success(tApprove);
|
|
}
|
|
}
|
|
@@ -358,14 +386,14 @@ public class TApproveController extends BaseController
|
|
public AjaxResult handle(@RequestBody DevTask devTask) {
|
|
public AjaxResult handle(@RequestBody DevTask devTask) {
|
|
Map<String, Object> param = new HashMap<>();
|
|
Map<String, Object> param = new HashMap<>();
|
|
//流程审批意见
|
|
//流程审批意见
|
|
- String symbol= "";
|
|
|
|
|
|
+ String symbol = "";
|
|
if (devTask.getComment() != "") {
|
|
if (devTask.getComment() != "") {
|
|
symbol = ",";
|
|
symbol = ",";
|
|
}
|
|
}
|
|
if (devTask.getCondition().equals("1")) {
|
|
if (devTask.getCondition().equals("1")) {
|
|
- /* devTask.setComment("通过" + symbol + devTask.getComment());*/
|
|
|
|
|
|
+ /* devTask.setComment("通过" + symbol + devTask.getComment());*/
|
|
devTask.setComment("批准" + symbol + devTask.getComment());
|
|
devTask.setComment("批准" + symbol + devTask.getComment());
|
|
- }else if (devTask.getCondition().equals("0")) {
|
|
|
|
|
|
+ } else if (devTask.getCondition().equals("0")) {
|
|
devTask.setComment("未通过" + symbol + devTask.getComment());
|
|
devTask.setComment("未通过" + symbol + devTask.getComment());
|
|
}
|
|
}
|
|
//使用任务服务完成任务(提交任务)
|
|
//使用任务服务完成任务(提交任务)
|
|
@@ -432,7 +460,7 @@ public class TApproveController extends BaseController
|
|
|
|
|
|
@RequestMapping("/exportPDF")
|
|
@RequestMapping("/exportPDF")
|
|
public AjaxResult exportWorld(@RequestParam String approveId, String processId, HttpServletRequest request, HttpServletResponse response) {
|
|
public AjaxResult exportWorld(@RequestParam String approveId, String processId, HttpServletRequest request, HttpServletResponse response) {
|
|
- String pid =processId;
|
|
|
|
|
|
+ String pid = processId;
|
|
logger.info("processId:" + JSON.toJSONString(pid));
|
|
logger.info("processId:" + JSON.toJSONString(pid));
|
|
HistoricTaskInstanceQuery htiq = historyService.createHistoricTaskInstanceQuery();
|
|
HistoricTaskInstanceQuery htiq = historyService.createHistoricTaskInstanceQuery();
|
|
List<HistoricTaskInstance> htiLists = htiq.processInstanceId(pid).finished().orderByHistoricTaskInstanceEndTime().asc().list();
|
|
List<HistoricTaskInstance> htiLists = htiq.processInstanceId(pid).finished().orderByHistoricTaskInstanceEndTime().asc().list();
|
|
@@ -510,7 +538,7 @@ public class TApproveController extends BaseController
|
|
}
|
|
}
|
|
tApprove.setDevList(devList);
|
|
tApprove.setDevList(devList);
|
|
|
|
|
|
- OutputStream out= null;
|
|
|
|
|
|
+ OutputStream out = null;
|
|
|
|
|
|
try {
|
|
try {
|
|
out = response.getOutputStream();
|
|
out = response.getOutputStream();
|
|
@@ -528,13 +556,27 @@ public class TApproveController extends BaseController
|
|
map.put("devCount", devCount);
|
|
map.put("devCount", devCount);
|
|
//申请类型
|
|
//申请类型
|
|
String devType = "";
|
|
String devType = "";
|
|
- if (tApprove.getDevType() == 1){devType = "压力容器"; }
|
|
|
|
- if (tApprove.getDevType() == 2){devType = "压力管道"; }
|
|
|
|
- if (tApprove.getDevType() == 3){devType = "吊装设备"; }
|
|
|
|
- if (tApprove.getDevType() == 4){devType = "锅炉"; }
|
|
|
|
- if (tApprove.getDevType() == 5){devType = "电梯"; }
|
|
|
|
- if (tApprove.getDevType() == 6){devType = "叉车"; }
|
|
|
|
- if (tApprove.getDevType() == 7){devType = "空气罐"; }
|
|
|
|
|
|
+ if (tApprove.getDevType() == 1) {
|
|
|
|
+ devType = "压力容器";
|
|
|
|
+ }
|
|
|
|
+ if (tApprove.getDevType() == 2) {
|
|
|
|
+ devType = "压力管道";
|
|
|
|
+ }
|
|
|
|
+ if (tApprove.getDevType() == 3) {
|
|
|
|
+ devType = "吊装设备";
|
|
|
|
+ }
|
|
|
|
+ if (tApprove.getDevType() == 4) {
|
|
|
|
+ devType = "锅炉";
|
|
|
|
+ }
|
|
|
|
+ if (tApprove.getDevType() == 5) {
|
|
|
|
+ devType = "电梯";
|
|
|
|
+ }
|
|
|
|
+ if (tApprove.getDevType() == 6) {
|
|
|
|
+ devType = "叉车";
|
|
|
|
+ }
|
|
|
|
+ if (tApprove.getDevType() == 7) {
|
|
|
|
+ devType = "空气罐";
|
|
|
|
+ }
|
|
//延期时间
|
|
//延期时间
|
|
Date dd = tApprove.getDelayDate();
|
|
Date dd = tApprove.getDelayDate();
|
|
SimpleDateFormat sd = new SimpleDateFormat("yyyy年MM月dd日");
|
|
SimpleDateFormat sd = new SimpleDateFormat("yyyy年MM月dd日");
|
|
@@ -547,14 +589,26 @@ public class TApproveController extends BaseController
|
|
//申请单位会签
|
|
//申请单位会签
|
|
|
|
|
|
logger.info(JSON.toJSONString(devTaskList));
|
|
logger.info(JSON.toJSONString(devTaskList));
|
|
- for (int i = 0; i < devTaskList.size(); i ++){
|
|
|
|
|
|
+ for (int i = 0; i < devTaskList.size(); i++) {
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
DevTask devTask = objectMapper.convertValue(devTaskList.get(i), DevTask.class);
|
|
DevTask devTask = objectMapper.convertValue(devTaskList.get(i), DevTask.class);
|
|
String taskEndTime = sd.format(devTask.getTaskEndTime());
|
|
String taskEndTime = sd.format(devTask.getTaskEndTime());
|
|
- if (i == 0){map.put("equipmentMaintenance",devTask); map.put("emEndTime",taskEndTime); }//装置维修经理
|
|
|
|
- if (i == 1){map.put("equipmentProcess",devTask); map.put("epEndTime",taskEndTime); }//装置工艺经理
|
|
|
|
- if (i == 2){map.put("processDirector",devTask); map.put("pdEndTime",taskEndTime); }//工艺总监
|
|
|
|
- if (i == 3){map.put("mechanicalMaintenance",devTask); map.put("mmEndTime",taskEndTime); }//机械维修总监
|
|
|
|
|
|
+ if (i == 0) {
|
|
|
|
+ map.put("equipmentMaintenance", devTask);
|
|
|
|
+ map.put("emEndTime", taskEndTime);
|
|
|
|
+ }//装置维修经理
|
|
|
|
+ if (i == 1) {
|
|
|
|
+ map.put("equipmentProcess", devTask);
|
|
|
|
+ map.put("epEndTime", taskEndTime);
|
|
|
|
+ }//装置工艺经理
|
|
|
|
+ if (i == 2) {
|
|
|
|
+ map.put("processDirector", devTask);
|
|
|
|
+ map.put("pdEndTime", taskEndTime);
|
|
|
|
+ }//工艺总监
|
|
|
|
+ if (i == 3) {
|
|
|
|
+ map.put("mechanicalMaintenance", devTask);
|
|
|
|
+ map.put("mmEndTime", taskEndTime);
|
|
|
|
+ }//机械维修总监
|
|
}
|
|
}
|
|
//注意 变量名要与xml中占位符保持一致
|
|
//注意 变量名要与xml中占位符保持一致
|
|
map.put("delayReason", tApprove.getDelayReason().replaceAll("\n", "<p></p>"));
|
|
map.put("delayReason", tApprove.getDelayReason().replaceAll("\n", "<p></p>"));
|
|
@@ -565,22 +619,36 @@ public class TApproveController extends BaseController
|
|
map.put("userName", user.getNickName());
|
|
map.put("userName", user.getNickName());
|
|
map.put("createTime", createTime);
|
|
map.put("createTime", createTime);
|
|
logger.info("delayNotice:" + tApprove.getDelayNotice());
|
|
logger.info("delayNotice:" + tApprove.getDelayNotice());
|
|
- if(map== null)
|
|
|
|
|
|
+ if (map == null)
|
|
return AjaxResult.error("导出失败!");
|
|
return AjaxResult.error("导出失败!");
|
|
/*ExportWordUtils word =new ExportWordUtils("/freeMaker", "fmaker.ftl"); // 项目使用的spring boot 。/excel/questionnaire.ftl文件存放在src/main/resources目录下
|
|
/*ExportWordUtils word =new ExportWordUtils("/freeMaker", "fmaker.ftl"); // 项目使用的spring boot 。/excel/questionnaire.ftl文件存放在src/main/resources目录下
|
|
word.setHeader(request, response, encodeFilename("1.doc" ,request ));
|
|
word.setHeader(request, response, encodeFilename("1.doc" ,request ));
|
|
word.doExport(out, map);*/
|
|
word.doExport(out, map);*/
|
|
- if (tApprove.getDevType() == 1){ PDFTemplateUtil.exportPdf("ylrqFMaker.ftl", "压力容器延期检验报请备案函.pdf","" , map, response); }
|
|
|
|
- if (tApprove.getDevType() == 2){ PDFTemplateUtil.exportPdf("ylgdFMaker.ftl", "压力管道延期检验报请备案函.pdf","" , map, response); }
|
|
|
|
- if (tApprove.getDevType() == 3){ PDFTemplateUtil.exportPdf("dzsbFMaker.ftl", "吊装设备延期检验报请备案函.pdf","" , map, response); }
|
|
|
|
- if (tApprove.getDevType() == 4){ PDFTemplateUtil.exportPdf("glFMaker.ftl", "锅炉延期检验报请备案函.pdf","" , map, response); }
|
|
|
|
- if (tApprove.getDevType() == 5){ PDFTemplateUtil.exportPdf("dtFMaker.ftl", "电梯延期检验报请备案函.pdf","" , map, response); }
|
|
|
|
- if (tApprove.getDevType() == 6){ PDFTemplateUtil.exportPdf("ccFMaker.ftl", "叉车延期检验报请备案函.pdf","" , map, response); }
|
|
|
|
- if (tApprove.getDevType() == 7){ PDFTemplateUtil.exportPdf("tankFMaker.ftl", "空气罐延期检验报请备案函.pdf","" , map, response); }
|
|
|
|
|
|
+ if (tApprove.getDevType() == 1) {
|
|
|
|
+ PDFTemplateUtil.exportPdf("ylrqFMaker.ftl", "压力容器延期检验报请备案函.pdf", "", map, response);
|
|
|
|
+ }
|
|
|
|
+ if (tApprove.getDevType() == 2) {
|
|
|
|
+ PDFTemplateUtil.exportPdf("ylgdFMaker.ftl", "压力管道延期检验报请备案函.pdf", "", map, response);
|
|
|
|
+ }
|
|
|
|
+ if (tApprove.getDevType() == 3) {
|
|
|
|
+ PDFTemplateUtil.exportPdf("dzsbFMaker.ftl", "吊装设备延期检验报请备案函.pdf", "", map, response);
|
|
|
|
+ }
|
|
|
|
+ if (tApprove.getDevType() == 4) {
|
|
|
|
+ PDFTemplateUtil.exportPdf("glFMaker.ftl", "锅炉延期检验报请备案函.pdf", "", map, response);
|
|
|
|
+ }
|
|
|
|
+ if (tApprove.getDevType() == 5) {
|
|
|
|
+ PDFTemplateUtil.exportPdf("dtFMaker.ftl", "电梯延期检验报请备案函.pdf", "", map, response);
|
|
|
|
+ }
|
|
|
|
+ if (tApprove.getDevType() == 6) {
|
|
|
|
+ PDFTemplateUtil.exportPdf("ccFMaker.ftl", "叉车延期检验报请备案函.pdf", "", map, response);
|
|
|
|
+ }
|
|
|
|
+ if (tApprove.getDevType() == 7) {
|
|
|
|
+ PDFTemplateUtil.exportPdf("tankFMaker.ftl", "空气罐延期检验报请备案函.pdf", "", map, response);
|
|
|
|
+ }
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
- }finally {
|
|
|
|
- if(out!=null)
|
|
|
|
|
|
+ } finally {
|
|
|
|
+ if (out != null)
|
|
try {
|
|
try {
|
|
out.close();
|
|
out.close();
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
@@ -596,8 +664,7 @@ public class TApproveController extends BaseController
|
|
@PreAuthorize("@ss.hasPermi('sems:approve:edit')")
|
|
@PreAuthorize("@ss.hasPermi('sems:approve:edit')")
|
|
@Log(title = "特种设备申请", businessType = BusinessType.UPDATE)
|
|
@Log(title = "特种设备申请", businessType = BusinessType.UPDATE)
|
|
@PutMapping
|
|
@PutMapping
|
|
- public AjaxResult edit(@RequestBody TApprove tApprove)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult edit(@RequestBody TApprove tApprove) {
|
|
return toAjax(tApproveService.updateTApprove(tApprove));
|
|
return toAjax(tApproveService.updateTApprove(tApprove));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -606,9 +673,8 @@ public class TApproveController extends BaseController
|
|
*/
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('sems:approve:remove')")
|
|
@PreAuthorize("@ss.hasPermi('sems:approve:remove')")
|
|
@Log(title = "特种设备申请", businessType = BusinessType.DELETE)
|
|
@Log(title = "特种设备申请", businessType = BusinessType.DELETE)
|
|
- @DeleteMapping("/{ids}")
|
|
|
|
- public AjaxResult remove(@PathVariable Long[] ids)
|
|
|
|
- {
|
|
|
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
|
+ public AjaxResult remove(@PathVariable Long[] ids) {
|
|
return toAjax(tApproveService.deleteTApproveByIds(ids));
|
|
return toAjax(tApproveService.deleteTApproveByIds(ids));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -616,76 +682,83 @@ public class TApproveController extends BaseController
|
|
* 年度检查报告任务申请
|
|
* 年度检查报告任务申请
|
|
*/
|
|
*/
|
|
@RequestMapping("/year")
|
|
@RequestMapping("/year")
|
|
|
|
+ @RepeatSubmit
|
|
public AjaxResult year(@RequestBody TApprove tApprove) {
|
|
public AjaxResult year(@RequestBody TApprove tApprove) {
|
|
- //任务开始时间
|
|
|
|
- long startTime = System.currentTimeMillis();
|
|
|
|
- logger.info("任务申请" + JSON.toJSONString(tApprove));
|
|
|
|
- Long userid = getUserId();
|
|
|
|
- //审批编号
|
|
|
|
- Date dt = new Date();
|
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmmss");
|
|
|
|
- String data = sdf.format(dt) + userid;
|
|
|
|
- tApprove.setApNo(data);
|
|
|
|
- tApprove.setUserId(userid);
|
|
|
|
- tApproveService.insertTApprove(tApprove);
|
|
|
|
|
|
+ //任务开始时间
|
|
|
|
+ long startTime = System.currentTimeMillis();
|
|
|
|
+ logger.info("任务申请" + JSON.toJSONString(tApprove));
|
|
|
|
+ Long userid = getUserId();
|
|
|
|
+ //审批编号
|
|
|
|
+ Date dt = new Date();
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmmss");
|
|
|
|
+ String data = sdf.format(dt) + userid;
|
|
|
|
+ tApprove.setApNo(data);
|
|
|
|
+ tApprove.setUserId(userid);
|
|
|
|
+ tApproveService.insertTApprove(tApprove);
|
|
|
|
|
|
- //修改设备申请状态
|
|
|
|
- String[] ids = tApprove.getReportId().split(",");
|
|
|
|
- switch (tApprove.getDevType().toString()) {
|
|
|
|
- case "1":
|
|
|
|
- for (String i : ids
|
|
|
|
- ) {
|
|
|
|
|
|
+ //修改设备申请状态
|
|
|
|
+ String[] ids = tApprove.getReportId().split(",");
|
|
|
|
+ ExecutorService executorService = Executors.newFixedThreadPool(30);
|
|
|
|
+
|
|
|
|
+ switch (tApprove.getDevType().toString()) {
|
|
|
|
+ case "1":
|
|
|
|
+ for (String i : ids
|
|
|
|
+ ) {
|
|
|
|
+ executorService.execute(() -> {
|
|
TReportYlrq rq = tReportYlrqService.selectTReportYlrqById(Long.parseLong(i));
|
|
TReportYlrq rq = tReportYlrqService.selectTReportYlrqById(Long.parseLong(i));
|
|
rq.setApproveStatus(7l);
|
|
rq.setApproveStatus(7l);
|
|
rq.setApproveTime(new Date());
|
|
rq.setApproveTime(new Date());
|
|
tReportYlrqService.updateTReportYlrq(rq);
|
|
tReportYlrqService.updateTReportYlrq(rq);
|
|
- }
|
|
|
|
- break;
|
|
|
|
- case "2":
|
|
|
|
- for (String i : ids
|
|
|
|
- ) {
|
|
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case "2":
|
|
|
|
+ for (String i : ids
|
|
|
|
+ ) {
|
|
|
|
+ executorService.execute(() -> {
|
|
TReportYlgd gd = tReportYlgdService.selectTReportYlgdById(Long.parseLong(i));
|
|
TReportYlgd gd = tReportYlgdService.selectTReportYlgdById(Long.parseLong(i));
|
|
gd.setApproveStatus(7l);
|
|
gd.setApproveStatus(7l);
|
|
gd.setApproveTime(new Date());
|
|
gd.setApproveTime(new Date());
|
|
tReportYlgdService.updateTReportYlgd(gd);
|
|
tReportYlgdService.updateTReportYlgd(gd);
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- Map<String, Object> variables = new HashMap<>();
|
|
|
|
- //开始工作流、监听
|
|
|
|
- variables.put("endSucessListener", new YearEndSucessListener());
|
|
|
|
- variables.put("endFaileListener", new YearEndFaileListener());
|
|
|
|
- variables.put("inspectorsTaskCreateListener", new InspectorTaskCreateListener());
|
|
|
|
- variables.put("auditorTaskCreateListener", new AuditorTaskCreateListener());
|
|
|
|
- variables.put("approverTaskCreateListener", new ApproverTaskCreateListener());
|
|
|
|
- //初始化会签人员
|
|
|
|
- List<Long> inspectorlist = new ArrayList<>();
|
|
|
|
- inspectorlist.add(tApprove.getInspectorOne());
|
|
|
|
- inspectorlist.add(tApprove.getInspectorTwo());
|
|
|
|
- inspectorlist.add(tApprove.getInspectorThree());
|
|
|
|
- //条件表达式方法 一定要序列号
|
|
|
|
- variables.put("inspectorlist", inspectorlist);
|
|
|
|
- //审批人员设置
|
|
|
|
- variables.put("auditor", tApprove.getAuditor());
|
|
|
|
- variables.put("approver", tApprove.getApprover());
|
|
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ executorService.shutdown();
|
|
|
|
+ Map<String, Object> variables = new HashMap<>();
|
|
|
|
+ //开始工作流、监听
|
|
|
|
+ variables.put("endSucessListener", new YearEndSucessListener());
|
|
|
|
+ variables.put("endFaileListener", new YearEndFaileListener());
|
|
|
|
+ variables.put("inspectorsTaskCreateListener", new InspectorTaskCreateListener());
|
|
|
|
+ variables.put("auditorTaskCreateListener", new AuditorTaskCreateListener());
|
|
|
|
+ variables.put("approverTaskCreateListener", new ApproverTaskCreateListener());
|
|
|
|
+ //初始化会签人员
|
|
|
|
+ List<Long> inspectorlist = new ArrayList<>();
|
|
|
|
+ inspectorlist.add(tApprove.getInspectorOne());
|
|
|
|
+ inspectorlist.add(tApprove.getInspectorTwo());
|
|
|
|
+ inspectorlist.add(tApprove.getInspectorThree());
|
|
|
|
+ //条件表达式方法 一定要序列号
|
|
|
|
+ variables.put("inspectorlist", inspectorlist);
|
|
|
|
+ //审批人员设置
|
|
|
|
+ variables.put("auditor", tApprove.getAuditor());
|
|
|
|
+ variables.put("approver", tApprove.getApprover());
|
|
|
|
|
|
- long bussniseeKey = tApprove.getId();
|
|
|
|
- logger.info("bussniseeKey:" + bussniseeKey);
|
|
|
|
- Authentication.setAuthenticatedUserId(userid.toString());
|
|
|
|
- //任务执行总时长
|
|
|
|
- long times = System.currentTimeMillis() - startTime;
|
|
|
|
- logger.debug(" 总共耗时:" + times + "毫秒");
|
|
|
|
- //采用key来启动流程定义并设置流程变量,返回流程实例
|
|
|
|
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("yearProcess", String.valueOf(bussniseeKey), variables);
|
|
|
|
- logger.info("流程部署id:" + pi.getDeploymentId());
|
|
|
|
- logger.info("流程定义id:" + pi.getProcessDefinitionId());
|
|
|
|
- logger.info("流程实例id:" + pi.getProcessInstanceId());
|
|
|
|
- logger.info("流程定义对象:" + pi.getProcessVariables());
|
|
|
|
- tApprove.setProcessId(pi.getProcessInstanceId());
|
|
|
|
- tApproveService.updateById(tApprove);
|
|
|
|
- //任务执行总时长
|
|
|
|
- long times2 = System.currentTimeMillis() - startTime;
|
|
|
|
- logger.debug(" 总共耗时:" + times2 + "毫秒");
|
|
|
|
|
|
+ long bussniseeKey = tApprove.getId();
|
|
|
|
+ logger.info("bussniseeKey:" + bussniseeKey);
|
|
|
|
+ Authentication.setAuthenticatedUserId(userid.toString());
|
|
|
|
+ //任务执行总时长
|
|
|
|
+ long times = System.currentTimeMillis() - startTime;
|
|
|
|
+ logger.debug(" 总共耗时:" + times + "毫秒");
|
|
|
|
+ //采用key来启动流程定义并设置流程变量,返回流程实例
|
|
|
|
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("yearProcess", String.valueOf(bussniseeKey), variables);
|
|
|
|
+ logger.info("流程部署id:" + pi.getDeploymentId());
|
|
|
|
+ logger.info("流程定义id:" + pi.getProcessDefinitionId());
|
|
|
|
+ logger.info("流程实例id:" + pi.getProcessInstanceId());
|
|
|
|
+ logger.info("流程定义对象:" + pi.getProcessVariables());
|
|
|
|
+ tApprove.setProcessId(pi.getProcessInstanceId());
|
|
|
|
+ tApproveService.updateById(tApprove);
|
|
|
|
+ //任务执行总时长
|
|
|
|
+ long times2 = System.currentTimeMillis() - startTime;
|
|
|
|
+ logger.debug(" 总共耗时:" + times2 + "毫秒");
|
|
return AjaxResult.success();
|
|
return AjaxResult.success();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -694,57 +767,57 @@ public class TApproveController extends BaseController
|
|
*/
|
|
*/
|
|
@RequestMapping("/month")
|
|
@RequestMapping("/month")
|
|
public AjaxResult month(@RequestBody TApprove tApprove) {
|
|
public AjaxResult month(@RequestBody TApprove tApprove) {
|
|
- //任务开始时间
|
|
|
|
- long startTime = System.currentTimeMillis();
|
|
|
|
- logger.info("任务申请" + JSON.toJSONString(tApprove));
|
|
|
|
- Long userid = getUserId();
|
|
|
|
- //审批编号
|
|
|
|
- Date dt = new Date();
|
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmmss");
|
|
|
|
- String data = sdf.format(dt) + userid;
|
|
|
|
- tApprove.setApNo(data);
|
|
|
|
- tApprove.setUserId(userid);
|
|
|
|
- tApproveService.insertTApprove(tApprove);
|
|
|
|
|
|
+ //任务开始时间
|
|
|
|
+ long startTime = System.currentTimeMillis();
|
|
|
|
+ logger.info("任务申请" + JSON.toJSONString(tApprove));
|
|
|
|
+ Long userid = getUserId();
|
|
|
|
+ //审批编号
|
|
|
|
+ Date dt = new Date();
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmmss");
|
|
|
|
+ String data = sdf.format(dt) + userid;
|
|
|
|
+ tApprove.setApNo(data);
|
|
|
|
+ tApprove.setUserId(userid);
|
|
|
|
+ tApproveService.insertTApprove(tApprove);
|
|
|
|
|
|
- //修改设备申请状态
|
|
|
|
- String[] ids = tApprove.getMonthId().split(",");
|
|
|
|
- for (String i : ids
|
|
|
|
- ) {
|
|
|
|
- TReportMonth tReportMonthEntity = tReportMonthService.selectTReportMonthById(Long.parseLong(i));
|
|
|
|
- tReportMonthEntity.setApproveStatus(7l);
|
|
|
|
- tReportMonthEntity.setApproveId(tApprove.getId().toString());
|
|
|
|
- tReportMonthEntity.setApproveTime(new Date());
|
|
|
|
- tReportMonthService.updateTReportMonth(tReportMonthEntity);
|
|
|
|
- }
|
|
|
|
- Map<String, Object> variables = new HashMap<>();
|
|
|
|
- //开始工作流、监听
|
|
|
|
- variables.put("endSucessListener", new MonthEndSucessListener());
|
|
|
|
- variables.put("endFaileListener", new MonthEndFaileListener());
|
|
|
|
- variables.put("mechanicalTaskCreateListener", new MechanicalTaskCreateListener());
|
|
|
|
- variables.put("electricTaskCreateListener", new ElectricTaskCreateListener());
|
|
|
|
- variables.put("craftTaskCreateListener", new CraftTaskCreateListener());
|
|
|
|
- //审批人员设置
|
|
|
|
- variables.put("mechanical", tApprove.getMechanical());
|
|
|
|
- variables.put("electric", tApprove.getElectric());
|
|
|
|
- variables.put("craft", tApprove.getCraft());
|
|
|
|
|
|
+ //修改设备申请状态
|
|
|
|
+ String[] ids = tApprove.getMonthId().split(",");
|
|
|
|
+ for (String i : ids
|
|
|
|
+ ) {
|
|
|
|
+ TReportMonth tReportMonthEntity = tReportMonthService.selectTReportMonthById(Long.parseLong(i));
|
|
|
|
+ tReportMonthEntity.setApproveStatus(7l);
|
|
|
|
+ tReportMonthEntity.setApproveId(tApprove.getId().toString());
|
|
|
|
+ tReportMonthEntity.setApproveTime(new Date());
|
|
|
|
+ tReportMonthService.updateTReportMonth(tReportMonthEntity);
|
|
|
|
+ }
|
|
|
|
+ Map<String, Object> variables = new HashMap<>();
|
|
|
|
+ //开始工作流、监听
|
|
|
|
+ variables.put("endSucessListener", new MonthEndSucessListener());
|
|
|
|
+ variables.put("endFaileListener", new MonthEndFaileListener());
|
|
|
|
+ variables.put("mechanicalTaskCreateListener", new MechanicalTaskCreateListener());
|
|
|
|
+ variables.put("electricTaskCreateListener", new ElectricTaskCreateListener());
|
|
|
|
+ variables.put("craftTaskCreateListener", new CraftTaskCreateListener());
|
|
|
|
+ //审批人员设置
|
|
|
|
+ variables.put("mechanical", tApprove.getMechanical());
|
|
|
|
+ variables.put("electric", tApprove.getElectric());
|
|
|
|
+ variables.put("craft", tApprove.getCraft());
|
|
|
|
|
|
- long bussniseeKey = tApprove.getId();
|
|
|
|
- logger.info("bussniseeKey:" + bussniseeKey);
|
|
|
|
- Authentication.setAuthenticatedUserId(userid.toString());
|
|
|
|
- //任务执行总时长
|
|
|
|
- long times = System.currentTimeMillis() - startTime;
|
|
|
|
- logger.debug(" 总共耗时:" + times + "毫秒");
|
|
|
|
- //采用key来启动流程定义并设置流程变量,返回流程实例
|
|
|
|
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("monthProcess", String.valueOf(bussniseeKey), variables);
|
|
|
|
- logger.info("流程部署id:" + pi.getDeploymentId());
|
|
|
|
- logger.info("流程定义id:" + pi.getProcessDefinitionId());
|
|
|
|
- logger.info("流程实例id:" + pi.getProcessInstanceId());
|
|
|
|
- logger.info("流程定义对象:" + pi.getProcessVariables());
|
|
|
|
- tApprove.setProcessId(pi.getProcessInstanceId());
|
|
|
|
- tApproveService.updateById(tApprove);
|
|
|
|
- //任务执行总时长
|
|
|
|
- long times2 = System.currentTimeMillis() - startTime;
|
|
|
|
- logger.debug(" 总共耗时:" + times2 + "毫秒");
|
|
|
|
- return AjaxResult.success();
|
|
|
|
|
|
+ long bussniseeKey = tApprove.getId();
|
|
|
|
+ logger.info("bussniseeKey:" + bussniseeKey);
|
|
|
|
+ Authentication.setAuthenticatedUserId(userid.toString());
|
|
|
|
+ //任务执行总时长
|
|
|
|
+ long times = System.currentTimeMillis() - startTime;
|
|
|
|
+ logger.debug(" 总共耗时:" + times + "毫秒");
|
|
|
|
+ //采用key来启动流程定义并设置流程变量,返回流程实例
|
|
|
|
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("monthProcess", String.valueOf(bussniseeKey), variables);
|
|
|
|
+ logger.info("流程部署id:" + pi.getDeploymentId());
|
|
|
|
+ logger.info("流程定义id:" + pi.getProcessDefinitionId());
|
|
|
|
+ logger.info("流程实例id:" + pi.getProcessInstanceId());
|
|
|
|
+ logger.info("流程定义对象:" + pi.getProcessVariables());
|
|
|
|
+ tApprove.setProcessId(pi.getProcessInstanceId());
|
|
|
|
+ tApproveService.updateById(tApprove);
|
|
|
|
+ //任务执行总时长
|
|
|
|
+ long times2 = System.currentTimeMillis() - startTime;
|
|
|
|
+ logger.debug(" 总共耗时:" + times2 + "毫秒");
|
|
|
|
+ return AjaxResult.success();
|
|
}
|
|
}
|
|
}
|
|
}
|