Kaynağa Gözat

ly 全部审核

ly 2 yıl önce
ebeveyn
işleme
2e90e34ccb

+ 1 - 1
master/src/main/java/com/ruoyi/project/check/controller/TCheckRepairpointsController.java

@@ -185,7 +185,7 @@ public class TCheckRepairpointsController extends BaseController {
         List<TCheckRepairpoints> list = new ArrayList<>();
         int rowNum = sheet.getPhysicalNumberOfRows();
         //线程池
-        ExecutorService executorService = Executors.newFixedThreadPool(1);
+        ExecutorService executorService = Executors.newFixedThreadPool(20);
         final CountDownLatch latch = new CountDownLatch(rowNum - 1); //相同线程数量的计数
         AtomicInteger failNumber = new AtomicInteger();
 

+ 15 - 9
master/src/main/java/com/ruoyi/project/check/service/impl/TCheckCheckpointsServiceImpl.java

@@ -21,6 +21,8 @@ import com.ruoyi.project.check.domain.TCheckCheckpoints;
 import com.ruoyi.project.check.service.ITCheckCheckpointsService;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.annotation.Resource;
+
 import static com.ruoyi.common.utils.SecurityUtils.getUserId;
 
 /**
@@ -32,16 +34,16 @@ import static com.ruoyi.common.utils.SecurityUtils.getUserId;
 @Service
 public class TCheckCheckpointsServiceImpl implements ITCheckCheckpointsService
 {
-    @Autowired
+    @Resource
     private TCheckCheckpointsMapper tCheckCheckpointsMapper;
 
-    @Autowired
+    @Resource
     private TCheckRepairpointsMapper tCheckRepairpointsMapper;
 
-    @Autowired
+    @Resource
     private TBasePointMapper tBasePointMapper;
 
-    @Autowired
+    @Resource
     private TTaskInspectionMapper tTaskInspectionMapper;
 
     /**
@@ -272,12 +274,16 @@ public class TCheckCheckpointsServiceImpl implements ITCheckCheckpointsService
                         tCheckRepairpoint.setMediumType(point.getMediumType());
                         tCheckRepairpoints.add(tCheckRepairpoint);
                     }
-                    TBasePoint tBasePoint = new TBasePoint();
-                    tBasePoint.setPointId(point.getPointId());
-                    tBasePoint.setNetTestValue(point.getNetTestValue());
-                    tBasePoint.setLeakageDegree(point.getLeakageDegree());
-                    tBasePointMapper.updateTBasePoint(tBasePoint);// 更新密封点数据
                 }
+                new Thread(() -> {
+                    for (TCheckCheckpoints point : points) {
+                        TBasePoint tBasePoint = new TBasePoint();
+                        tBasePoint.setPointId(point.getPointId());
+                        tBasePoint.setNetTestValue(point.getNetTestValue());
+                        tBasePoint.setLeakageDegree(point.getLeakageDegree());
+                        tBasePointMapper.updateTBasePoint(tBasePoint);// 更新密封点数据
+                    }
+                },"更新密封点数据线程").start();
                 if (CollectionUtils.isNotEmpty(tCheckRepairpoints)) {
                     tCheckRepairpointsMapper.insertTCheckRepairpointsByList(tCheckRepairpoints);
                 }