浏览代码

多线程查找

wangtong 1 年之前
父节点
当前提交
8e7272c0a3

+ 1 - 1
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/IZEngiineeringPhotoService.java

@@ -25,7 +25,7 @@ public interface IZEngiineeringPhotoService {
     /**
      * 查询照片列表
      */
-    List<String> queryList(String id);
+    List<String> queryList(ZEngineeringInfoBo bo);
 
     /**
      * 查询照片列表

+ 8 - 2
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngiineeringPhotoServiceImpl.java

@@ -16,6 +16,7 @@ import com.ruoyi.zdsz.domain.vo.ZEngiineeringPhotoVo;
 import com.ruoyi.zdsz.mapper.ZEngiineeringPhotoMapper;
 import com.ruoyi.zdsz.service.IZEngiineeringPhotoService;
 import lombok.RequiredArgsConstructor;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -49,10 +50,12 @@ public class ZEngiineeringPhotoServiceImpl implements IZEngiineeringPhotoService
     }
 
     @Override
-    public List<String> queryList(String id) {
+    @DynamicName(spel = "#bo.createTime")
+
+    public List<String> queryList(ZEngineeringInfoBo bo) {
         List<String> list =new ArrayList<>();
         LambdaQueryWrapper<ZEngiineeringPhoto> lqw = Wrappers.lambdaQuery();
-        lqw.eq(StringUtils.isNotBlank(id), ZEngiineeringPhoto::getParentId, id).orderByDesc(ZEngiineeringPhoto::getCreateTime);
+        lqw.eq(StringUtils.isNotBlank(bo.getId()), ZEngiineeringPhoto::getParentId, bo.getId()).orderByDesc(ZEngiineeringPhoto::getCreateTime);
         List<ZEngiineeringPhoto> zEngiineeringPhotoList= baseMapper.selectList(lqw);
         zEngiineeringPhotoList.stream().forEach( item->{
             list.add(item.getPicUrl());
@@ -109,6 +112,7 @@ public class ZEngiineeringPhotoServiceImpl implements IZEngiineeringPhotoService
     @Override
     @Transactional(rollbackFor=Exception.class)
     @DynamicName(spel = "#bo[0].createTime")
+    @Async("threadPoolTaskExecutor")
     public Boolean insertBatch(List<ZEngiineeringPhoto> bo) {
         boolean flag = baseMapper.insertBatch(bo);
         return flag;
@@ -127,6 +131,7 @@ public class ZEngiineeringPhotoServiceImpl implements IZEngiineeringPhotoService
     @Override
     @DynamicName(spel = "#bo[0].createTime")
     @Transactional(rollbackFor = Exception.class)
+    @Async("threadPoolTaskExecutor")
     public Boolean updateBatch(List<ZEngiineeringPhoto> bo) {
         ZEngiineeringPhoto zEngiineeringPhoto = bo.get(0);
         LambdaQueryWrapper<ZEngiineeringPhoto> lqw = Wrappers.lambdaQuery();
@@ -177,6 +182,7 @@ public class ZEngiineeringPhotoServiceImpl implements IZEngiineeringPhotoService
     @Override
     @DynamicName(spel = "#bo.createTime")
     @Transactional(rollbackFor = Exception.class)
+    @Async("threadPoolTaskExecutor")
     public Boolean delete(ZEngineeringInfoBo bo) {
         LambdaQueryWrapper<ZEngiineeringPhoto> lqw = Wrappers.lambdaQuery();
         lqw.eq(StringUtils.isNotBlank(bo.getId()), ZEngiineeringPhoto::getParentId, bo.getId());

+ 6 - 2
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringInfoServiceImpl.java

@@ -24,6 +24,7 @@ import com.ruoyi.zdsz.service.IZEngineeringInfoService;
 import com.ruoyi.zdsz.service.IZEngineeringMaterialService;
 import com.ruoyi.zdsz.service.IZEngineeringReviewService;
 import lombok.RequiredArgsConstructor;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -62,6 +63,7 @@ public class ZEngineeringInfoServiceImpl implements IZEngineeringInfoService {
 
     @Override
     @DynamicName(spel = "#bo.createTime")
+
     public ZEngineeringInfoBo query(ZEngineeringNodeBo bo) {
         LambdaQueryWrapper<ZEngineeringInfo> lqw = Wrappers.lambdaQuery();
         ZEngineeringInfo zEngineeringInfoVo= baseMapper.selectOne(lqw.eq(StringUtils.isNotBlank(bo.getId()), ZEngineeringInfo::getEngInfoId, bo.getId()));
@@ -71,7 +73,7 @@ public class ZEngineeringInfoServiceImpl implements IZEngineeringInfoService {
         zEngineeringInfoBo1.setConstructUser(sysUser.getNickName());
         zEngineeringInfoBo1.setHeadPhone(sysUser.getPhonenumber());
         zEngineeringInfoBo1.setConstructPhone(sysUser.getPhonenumber());
-        List<String> photoList=izEngiineeringPhotoService.queryList(zEngineeringInfoBo1.getId());
+        List<String> photoList=izEngiineeringPhotoService.queryList(zEngineeringInfoBo1);
         List<ZEngineeringMaterialBo> zEngineeringMaterialBo=izEngineeringMaterialService.query(zEngineeringInfoBo1);
         zEngineeringInfoBo1.setzEngiineeringPhotoBoList(photoList);
         zEngineeringInfoBo1.setzEngineeringMaterialBo(zEngineeringMaterialBo);
@@ -147,12 +149,14 @@ public class ZEngineeringInfoServiceImpl implements IZEngineeringInfoService {
         if (flag) {
             bo.setId(add.getId());
         }
+        if (bo.getzEngineeringMaterialBo()!=null&&bo.getzEngineeringMaterialBo().size()>0)
+        {
         bo.getzEngineeringMaterialBo().stream().forEach(item->{
             item.setDetailsId(add.getId());
             item.setCreateTime(bo.getCreateTime());
             izEngineeringMaterialService.insert(item);
         });
-
+        }
         List <ZEngiineeringPhoto> photoList=new ArrayList();
             bo.getzEngiineeringPhotoBoList().stream().forEach(item->{
             ZEngiineeringPhoto zEngiineeringPhoto=new ZEngiineeringPhoto();

+ 3 - 0
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringMaterialServiceImpl.java

@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.ruoyi.zdsz.domain.bo.ZEngineeringInfoBo;
 import lombok.RequiredArgsConstructor;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import com.ruoyi.zdsz.domain.bo.ZEngineeringMaterialBo;
 import com.ruoyi.zdsz.domain.vo.ZEngineeringMaterialVo;
@@ -46,6 +47,7 @@ public class ZEngineeringMaterialServiceImpl implements IZEngineeringMaterialSer
 
     @Override
     @DynamicName(spel = "#bo.createTime")
+
     public List<ZEngineeringMaterialBo> query(ZEngineeringInfoBo bo) {
         LambdaQueryWrapper<ZEngineeringMaterial> lqw = Wrappers.lambdaQuery();
         lqw.eq(StringUtils.isNotBlank(bo.getId()), ZEngineeringMaterial::getDetailsId, bo.getId());
@@ -185,6 +187,7 @@ public class ZEngineeringMaterialServiceImpl implements IZEngineeringMaterialSer
     @Override
     @DynamicName(spel = "#bo.createTime")
     @Transactional(rollbackFor = Exception.class)
+    @Async("threadPoolTaskExecutor")
     public Boolean delete(ZEngineeringInfoBo bo) {
         LambdaQueryWrapper<ZEngineeringMaterial> lqw = Wrappers.lambdaQuery();
         lqw.eq(StringUtils.isNotBlank(bo.getId()), ZEngineeringMaterial::getDetailsId, bo.getId());