|
@@ -31,6 +31,9 @@ import java.io.InputStream;
|
|
|
import java.io.OutputStream;
|
|
|
import java.util.List;
|
|
|
import java.util.UUID;
|
|
|
+import java.util.concurrent.CountDownLatch;
|
|
|
+import java.util.concurrent.ExecutorService;
|
|
|
+import java.util.concurrent.Executors;
|
|
|
|
|
|
/**
|
|
|
* 安全设施-安全阀Controller
|
|
@@ -42,7 +45,7 @@ import java.util.UUID;
|
|
|
@RequestMapping("/pssr/safetyValve")
|
|
|
public class TPssrSafetyValveController extends BaseController {
|
|
|
@Resource
|
|
|
- private TPssrSafetyValveMapper tPssrSafetyValveMapper;
|
|
|
+ private TPssrSafetyValveMapper tPssrSafetyValveMapper;
|
|
|
@Autowired
|
|
|
private ITPssrFileService tPssrFileService;
|
|
|
|
|
@@ -63,11 +66,33 @@ public class TPssrSafetyValveController extends BaseController {
|
|
|
public TableDataInfo list(TPssrSafetyValve tPssrSafetyValve) {
|
|
|
startPage();
|
|
|
List<TPssrSafetyValve> list = tPssrSafetyValveService.selectTPssrSafetyValveList(tPssrSafetyValve);
|
|
|
- list.forEach(item -> {
|
|
|
- item.setFileList(tPssrFileService.selectTPssrFileListByItem(item.getSubId(), item.getId(), "aqss-v"));
|
|
|
- if (item.getApproveStatus() != 2)
|
|
|
- item.setReason(tPssrTurndownService.selectTPssrTurndownByItem(item.getSubId(), item.getId(), "aqss-v"));
|
|
|
- });
|
|
|
+
|
|
|
+ if (list.size() > 0) {
|
|
|
+ //线程池
|
|
|
+ ExecutorService executorService = Executors.newFixedThreadPool(30);
|
|
|
+ final CountDownLatch latch = new CountDownLatch(list.size()); //相同线程数量的计数
|
|
|
+ for (TPssrSafetyValve item : list
|
|
|
+ ) {
|
|
|
+ executorService.submit(() -> {
|
|
|
+ try {
|
|
|
+ item.setFileList(tPssrFileService.selectTPssrFileListByItem(item.getSubId(), item.getId(), "aqss-v"));
|
|
|
+ if (item.getApproveStatus() != 2)
|
|
|
+ item.setReason(tPssrTurndownService.selectTPssrTurndownByItem(item.getSubId(), item.getId(), "aqss-v"));
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error("e:", e);
|
|
|
+ } finally {
|
|
|
+ latch.countDown(); //线程计数
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ latch.await(); //线程计数完毕后继续执行
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ logger.error("e", e);
|
|
|
+ }
|
|
|
+ executorService.shutdown();
|
|
|
+ }
|
|
|
+
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
|
|
@@ -139,7 +164,7 @@ public class TPssrSafetyValveController extends BaseController {
|
|
|
num++;
|
|
|
rowIndex++;
|
|
|
}
|
|
|
- filename = "PSSR_14_安全设施_安全阀_" + UUID.randomUUID().toString() + ".xlsx";
|
|
|
+ filename = "PSSR_14_安全设施_安全阀_" + UUID.randomUUID().toString() + ".xlsx";
|
|
|
out = new FileOutputStream(ExcelUtil.getAbsoluteFile(filename));
|
|
|
wb.write(out);
|
|
|
wb.close();
|
|
@@ -158,8 +183,8 @@ public class TPssrSafetyValveController extends BaseController {
|
|
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
|
|
TPssrSafetyValve item = tPssrSafetyValveService.selectTPssrSafetyValveById(id);
|
|
|
item.setFileList(tPssrFileService.selectTPssrFileListByItem(item.getSubId(), item.getId(), "aqss-v"));
|
|
|
- if (item.getApproveStatus() != 2)
|
|
|
- item.setReason(tPssrTurndownService.selectTPssrTurndownByItem(item.getSubId(), item.getId(), "aqss-v"));
|
|
|
+ if (item.getApproveStatus() != 2)
|
|
|
+ item.setReason(tPssrTurndownService.selectTPssrTurndownByItem(item.getSubId(), item.getId(), "aqss-v"));
|
|
|
return AjaxResult.success(item);
|
|
|
}
|
|
|
|
|
@@ -170,7 +195,7 @@ public class TPssrSafetyValveController extends BaseController {
|
|
|
@Log(title = "安全设施-安全阀", businessType = BusinessType.INSERT)
|
|
|
@PostMapping
|
|
|
public AjaxResult add(@RequestBody TPssrSafetyValve tPssrSafetyValve) {
|
|
|
- if (tPssrSafetyValve.getConfirmer1().equals(tPssrSafetyValve.getConfirmer2())){
|
|
|
+ if (tPssrSafetyValve.getConfirmer1().equals(tPssrSafetyValve.getConfirmer2())) {
|
|
|
return AjaxResult.error("确认人不能为同一人,请重新选择!");
|
|
|
}
|
|
|
tPssrSafetyValve.setApproveStatus(0L);
|
|
@@ -184,7 +209,7 @@ public class TPssrSafetyValveController extends BaseController {
|
|
|
@Log(title = "安全设施-安全阀", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
|
public AjaxResult edit(@RequestBody TPssrSafetyValve tPssrSafetyValve) {
|
|
|
- if (tPssrSafetyValve.getConfirmer1().equals(tPssrSafetyValve.getConfirmer2())){
|
|
|
+ if (tPssrSafetyValve.getConfirmer1().equals(tPssrSafetyValve.getConfirmer2())) {
|
|
|
return AjaxResult.error("确认人不能为同一人,请重新选择!");
|
|
|
}
|
|
|
tPssrFileService.updateFileRelevance(tPssrSafetyValve.getFileIds(), "aqss-v", tPssrSafetyValve.getId(), tPssrSafetyValve.getSubId());
|
|
@@ -198,11 +223,12 @@ public class TPssrSafetyValveController extends BaseController {
|
|
|
@Log(title = "安全设施-安全阀", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping("/editBatch")
|
|
|
public AjaxResult editb(@RequestBody TPssrSafetyValve tPssrSafetyValve) {
|
|
|
- if (tPssrSafetyValve.getConfirmer1().equals(tPssrSafetyValve.getConfirmer2())){
|
|
|
+ if (tPssrSafetyValve.getConfirmer1().equals(tPssrSafetyValve.getConfirmer2())) {
|
|
|
return AjaxResult.error("确认人不能为同一人,请重新选择!");
|
|
|
}
|
|
|
return toAjax(tPssrSafetyValveMapper.updateTPssrSafetyValveByIds(tPssrSafetyValve));
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 删除安全设施-安全阀
|
|
|
*/
|