|
@@ -24,6 +24,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.concurrent.CompletableFuture;
|
|
|
|
|
|
/**
|
|
|
* @Description: 巡检点
|
|
@@ -196,18 +197,35 @@ public class CmmsInspectSpotServiceImpl extends ServiceImpl<CmmsInspectSpotMappe
|
|
|
@Override
|
|
|
public List<CmmsInspectSpotVo> getCmmsInspectSpotListDetails(Page<CmmsInspectSpotVo> page, CmmsInspectSpot cmmsInspectSpot) {
|
|
|
List<CmmsInspectSpotVo> cmmsInspectSpotList = inspectSpotMapper.getCmmsInspectSpotList(page, cmmsInspectSpot);
|
|
|
- for (int i = 0; i < cmmsInspectSpotList.size(); i++) {
|
|
|
- String id = cmmsInspectSpotList.get(i).getId();
|
|
|
- List<CmmsInspectSpotEquip> list = inspectSpotEquipService.getInspectSpotEquipBySprtId(id);
|
|
|
- ArrayList<CmmsInspectContentVo> contentList = new ArrayList<>();
|
|
|
- for (CmmsInspectSpotEquip spot:list) {
|
|
|
- CmmsInspectContentVo inspectContent = iCmmsInspectContentService.getCmmsInspectContentById(spot.getInspectcontid());
|
|
|
- contentList.add(inspectContent);
|
|
|
- }
|
|
|
- cmmsInspectSpotList.get(i).setInspectContentList(contentList);
|
|
|
+ ArrayList<CmmsInspectSpotVo> list = new ArrayList<>();
|
|
|
+ ArrayList<CompletableFuture<CmmsInspectSpotVo>> completableFutureList = new ArrayList<>();
|
|
|
+ for (CmmsInspectSpot vo:cmmsInspectSpotList) {
|
|
|
+ CompletableFuture<CmmsInspectSpotVo> getInspectSpotFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
+ CmmsInspectSpotVo cmmsInspectSpotVo = this.getCmmsInspectSpotListById(vo.getId());
|
|
|
+ return cmmsInspectSpotVo;
|
|
|
+ });
|
|
|
+ completableFutureList.add(getInspectSpotFuture);
|
|
|
}
|
|
|
+ CompletableFuture.allOf(completableFutureList.toArray(new CompletableFuture[0])).thenRun(() -> {
|
|
|
+ for (CompletableFuture<CmmsInspectSpotVo> future : completableFutureList) {
|
|
|
+ CmmsInspectSpotVo join = future.join();
|
|
|
+ list.add(join);
|
|
|
+ }
|
|
|
+ }).join();
|
|
|
+
|
|
|
+
|
|
|
+ //for (int i = 0; i < cmmsInspectSpotList.size(); i++) {
|
|
|
+ // String id = cmmsInspectSpotList.get(i).getId();
|
|
|
+ // List<CmmsInspectSpotEquip> list = inspectSpotEquipService.getInspectSpotEquipBySprtId(id);
|
|
|
+ // ArrayList<CmmsInspectContentVo> contentList = new ArrayList<>();
|
|
|
+ // for (CmmsInspectSpotEquip spot:list) {
|
|
|
+ // CmmsInspectContentVo inspectContent = iCmmsInspectContentService.getCmmsInspectContentById(spot.getInspectcontid());
|
|
|
+ // contentList.add(inspectContent);
|
|
|
+ // }
|
|
|
+ // cmmsInspectSpotList.get(i).setInspectContentList(contentList);
|
|
|
+ //}
|
|
|
|
|
|
- return cmmsInspectSpotList;
|
|
|
+ return list;
|
|
|
}
|
|
|
|
|
|
@Override
|