Explorar el Código

外部报验功能-构件跟踪

wangming hace 1 año
padre
commit
288ee053f2

+ 31 - 6
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxOutsideInspectionComponentTrackServiceImpl.java

@@ -14,6 +14,8 @@ import com.rongwei.rwcommon.utils.SecurityUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  * 外部报验-构件跟踪 服务实现类
@@ -127,7 +129,7 @@ public class ZhcxOutsideInspectionComponentTrackServiceImpl extends ServiceImpl<
         LambdaQueryWrapper<ZhcxItpProjectNodesDo> tWrapper = Wrappers.lambdaQuery();
         tWrapper.eq(ZhcxItpProjectNodesDo::getPid, itpDo.getStructureid())
                 .eq(ZhcxItpProjectNodesDo::getDeleted, "0")
-                .eq(ZhcxItpProjectNodesDo::getNodename, itpDo.getInspectioncontent())
+                .eq(ZhcxItpProjectNodesDo::getNodename, itpDo.getInspectioncontent().replace(itpDo.getStructurename().concat("-"), ""))
                 .eq(ZhcxItpProjectNodesDo::getProjectid, itpDo.getProjectid());
         ZhcxItpProjectNodesDo nodesDo = zhcxItpProjectNodesService.getOne(tWrapper);
         if(ObjectUtil.isNull(nodesDo)) {
@@ -146,15 +148,38 @@ public class ZhcxOutsideInspectionComponentTrackServiceImpl extends ServiceImpl<
         //已保存的构件和报验点,不再重新保存
         LambdaQueryWrapper<ZhcxOutsideInspectionComponentTrackDo> queryWrapper = Wrappers.lambdaQuery();
         queryWrapper.eq(ZhcxOutsideInspectionComponentTrackDo::getStructurename, itpDo.getStructurename())
-                .eq(ZhcxOutsideInspectionComponentTrackDo::getMachineno, itpDo.getMachineno())
-                .eq(ZhcxOutsideInspectionComponentTrackDo::getStructuremachineno, itpDo.getStructuremachineno())
+//                .eq(ZhcxOutsideInspectionComponentTrackDo::getMachineno, itpDo.getMachineno())
+//                .eq(ZhcxOutsideInspectionComponentTrackDo::getStructuremachineno, itpDo.getStructuremachineno())
                 .eq(ZhcxOutsideInspectionComponentTrackDo::getDeleted, "0")
                 .eq(ZhcxOutsideInspectionComponentTrackDo::getProjectid, itpDo.getProjectid());
-        int count = count(queryWrapper);
-        if(count > 0) {
+        List<ZhcxOutsideInspectionComponentTrackDo> trackDoList = list(queryWrapper);
+        if(ObjectUtil.isNull(trackDoList)) {
+            return true;
+        }
+
+        //总装机号和机构机号都不存在
+        boolean zzFlag = false, jgFlag = false;
+        for(ZhcxOutsideInspectionComponentTrackDo row : trackDoList) {
+            if(row.getMachineno().equals(itpDo.getMachineno())) {
+                zzFlag = true;
+            }
+
+            if(row.getStructuremachineno().equals(itpDo.getStructuremachineno())) {
+                jgFlag = true;
+            }
+        }
+
+        //总装结构都能匹配到,不做再重复添加
+        if(zzFlag && jgFlag) {
             return false;
         }
 
-        return true;
+        //总装结构都不能匹配,需要添加
+        if(!zzFlag && !jgFlag) {
+            return true;
+        }
+
+        //某一个机号相同,另一个机号不相同,不需要添加
+        return false;
     }
 }