Browse Source

-修改成绩后发起申请流程变更

jiangbiao 1 year ago
parent
commit
16fe4f47e0

+ 41 - 16
master/src/main/java/com/ruoyi/project/training/bccnew/service/impl/TTsNewServiceImpl.java

@@ -8,6 +8,7 @@ import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -323,7 +324,7 @@ public class TTsNewServiceImpl implements ITTsNewService {
         return tTsNewMapper.updateTTsNew(tTsNew);
     }
 
-        @Override
+    @Override
     public int updateTTsNew(TTsNew tTsNew, Long userId, String nickName) {
         TTsNew tsNew = tTsNewMapper.selectTTsNewById(tTsNew.getNewId());
         if (tTsNew.getPlanStatus() == 1) {
@@ -406,7 +407,7 @@ public class TTsNewServiceImpl implements ITTsNewService {
             TTsFirstplan tTsFirstplan = new TTsFirstplan();
             tTsFirstplan.setNewId(tTsNew.getNewId());
             for (TTsFirstplan tsFirstplan : tTsFirstplanMapper.selectTTsFirstplanListByNewId(tTsFirstplan)) {
-                if (tsFirstplan.getPlanStatus() == null || tsFirstplan.getPlanStatus() == 0|| tsFirstplan.getPlanStatus() == 2) {
+                if (tsFirstplan.getPlanStatus() == null || tsFirstplan.getPlanStatus() == 0 || tsFirstplan.getPlanStatus() == 2) {
                     tsFirstplan.setPlanStatus(4L);
                     tTsFirstplanMapper.updateTTsFirstplan(tsFirstplan);
                 }
@@ -415,7 +416,7 @@ public class TTsNewServiceImpl implements ITTsNewService {
                 TTsLjplan entity = new TTsLjplan();
                 entity.setNewId(tTsNew.getNewId());
                 for (TTsLjplan item : tTsLjplanMapper.selectTTsLjplanListByNewId(entity)) {
-                    if (item.getPlanStatus() == null || item.getPlanStatus() == 0|| item.getPlanStatus() == 2) {
+                    if (item.getPlanStatus() == null || item.getPlanStatus() == 0 || item.getPlanStatus() == 2) {
                         item.setPlanStatus(4L);
                         tTsLjplanMapper.updateTTsLjplan(item);
                     }
@@ -424,7 +425,7 @@ public class TTsNewServiceImpl implements ITTsNewService {
                 TTsYsplan entity = new TTsYsplan();
                 entity.setNewId(tTsNew.getNewId());
                 for (TTsYsplan item : tTsYsplanMapper.selectTTsYsplanListByNewId(entity)) {
-                    if (item.getPlanStatus() == null || item.getPlanStatus() == 0|| item.getPlanStatus() == 2) {
+                    if (item.getPlanStatus() == null || item.getPlanStatus() == 0 || item.getPlanStatus() == 2) {
                         item.setPlanStatus(4L);
                         tTsYsplanMapper.updateTTsYsplan(item);
                     }
@@ -433,7 +434,7 @@ public class TTsNewServiceImpl implements ITTsNewService {
                 TTsFlplan entity = new TTsFlplan();
                 entity.setNewId(tTsNew.getNewId());
                 for (TTsFlplan item : tTsFlplanMapper.selectTTsFlplanListByNewId(entity)) {
-                    if (item.getPlanStatus() == null || item.getPlanStatus() == 0|| item.getPlanStatus() == 2) {
+                    if (item.getPlanStatus() == null || item.getPlanStatus() == 0 || item.getPlanStatus() == 2) {
                         item.setPlanStatus(4L);
                         tTsFlplanMapper.updateTTsFlplan(item);
                     }
@@ -442,14 +443,14 @@ public class TTsNewServiceImpl implements ITTsNewService {
                 TTsFtplan entity = new TTsFtplan();
                 entity.setNewId(tTsNew.getNewId());
                 for (TTsFtplan item : tTsFtplanMapper.selectTTsFtplanListByNewId(entity)) {
-                    if (item.getPlanStatus() == null || item.getPlanStatus() == 0|| item.getPlanStatus() == 2) {
+                    if (item.getPlanStatus() == null || item.getPlanStatus() == 0 || item.getPlanStatus() == 2) {
                         item.setPlanStatus(4L);
                         tTsFtplanMapper.updateTTsFtplan(item);
                     }
                 }
             }
             tTsNewMapper.updateTTsNew(tTsNew);
-            tsApproveService.doApprove(tTsNew.getNewId(), tsNew.getPlanType().toString(), userId, nickName,"dsdtTraining");
+            tsApproveService.doApprove(tTsNew.getNewId(), tsNew.getPlanType().toString(), userId, nickName, "dsdtTraining");
         }
         if (tTsNew.getPlanStatus() == 5) {
             TTsFirstplan plan = new TTsFirstplan();
@@ -462,44 +463,68 @@ public class TTsNewServiceImpl implements ITTsNewService {
                 TTsLjplan tTsLjplan = new TTsLjplan();
                 tTsLjplan.setNewId(tTsNew.getNewId());
                 List<TTsLjplan> tTsLjplans = tTsLjplanMapper.selectTTsLjplanListByNewId(tTsLjplan);
+                List<TTsLjplan> newList = new ArrayList<>();
+                for (TTsLjplan item : tTsLjplans) {
+                    if (item.getPlanStatus() != 1) {
+                        newList.add(item);
+                    }
+                }
                 tTsLjplan.setPlanStatus(5L);
                 List<TTsLjplan> tTsLjplansDone = tTsLjplanMapper.selectTTsLjplanListByNewId(tTsLjplan);
-                if (!CollectionUtils.isEmpty(tTsLjplans)
+                if (!CollectionUtils.isEmpty(newList)
                         && !CollectionUtils.isEmpty(tTsLjplansDone)
-                        && tTsLjplansDone.size() == tTsLjplans.size()) {
+                        && tTsLjplansDone.size() == newList.size()) {
                     flag = true;
                 }
             } else if (2 == tsNew.getPlanType()) {
                 TTsYsplan tTsYsplan = new TTsYsplan();
                 tTsYsplan.setNewId(tTsNew.getNewId());
                 List<TTsYsplan> tTsYsplans = tTsYsplanMapper.selectTTsYsplanListByNewId(tTsYsplan);
+                List<TTsYsplan> newList = new ArrayList<>();
+                for (TTsYsplan item : tTsYsplans) {
+                    if (item.getPlanStatus() != 1) {
+                        newList.add(item);
+                    }
+                }
                 tTsYsplan.setPlanStatus(5L);
                 List<TTsYsplan> tTsYsplansDone = tTsYsplanMapper.selectTTsYsplanListByNewId(tTsYsplan);
-                if (!CollectionUtils.isEmpty(tTsYsplans)
+                if (!CollectionUtils.isEmpty(newList)
                         && !CollectionUtils.isEmpty(tTsYsplansDone)
-                        && tTsYsplansDone.size() == tTsYsplans.size()) {
+                        && tTsYsplansDone.size() == newList.size()) {
                     flag = true;
                 }
             } else if (3 == tsNew.getPlanType()) {
                 TTsFlplan tTsFlplan = new TTsFlplan();
                 tTsFlplan.setNewId(tTsNew.getNewId());
                 List<TTsFlplan> tTsFlplans = tTsFlplanMapper.selectTTsFlplanListByNewId(tTsFlplan);
+                List<TTsFlplan> newList = new ArrayList<>();
+                for (TTsFlplan item : tTsFlplans) {
+                    if (item.getPlanStatus() != 1) {
+                        newList.add(item);
+                    }
+                }
                 tTsFlplan.setPlanStatus(5L);
                 List<TTsFlplan> tTsFlplansDone = tTsFlplanMapper.selectTTsFlplanListByNewId(tTsFlplan);
-                if (!CollectionUtils.isEmpty(tTsFlplans)
+                if (!CollectionUtils.isEmpty(newList)
                         && !CollectionUtils.isEmpty(tTsFlplansDone)
-                        && tTsFlplansDone.size() == tTsFlplans.size()) {
+                        && tTsFlplansDone.size() == newList.size()) {
                     flag = true;
                 }
             } else if (4 == tsNew.getPlanType()) {
                 TTsFtplan tTsFtplan = new TTsFtplan();
                 tTsFtplan.setNewId(tTsNew.getNewId());
                 List<TTsFtplan> tTsFtplans = tTsFtplanMapper.selectTTsFtplanListByNewId(tTsFtplan);
+                List<TTsFtplan> newList = new ArrayList<>();
+                for (TTsFtplan item : tTsFtplans) {
+                    if (item.getPlanStatus() != 1) {
+                        newList.add(item);
+                    }
+                }
                 tTsFtplan.setPlanStatus(5L);
                 List<TTsFtplan> tTsFtplansDone = tTsFtplanMapper.selectTTsFtplanListByNewId(tTsFtplan);
-                if (!CollectionUtils.isEmpty(tTsFtplans)
+                if (!CollectionUtils.isEmpty(newList)
                         && !CollectionUtils.isEmpty(tTsFtplansDone)
-                        && tTsFtplansDone.size() == tTsFtplans.size()) {
+                        && tTsFtplansDone.size() == newList.size()) {
                     flag = true;
                 }
             }
@@ -507,7 +532,7 @@ public class TTsNewServiceImpl implements ITTsNewService {
                     !CollectionUtils.isEmpty(tTsFirstplansDone) &&
                     tTsFirstplans.size() == tTsFirstplansDone.size() && flag) {
                 tTsNewMapper.updateTTsNew(tTsNew);
-                tsApproveService.doApprove(tTsNew.getNewId(), tsNew.getPlanType().toString(), userId, nickName,"dsdtTraining");
+                tsApproveService.doApprove(tTsNew.getNewId(), tsNew.getPlanType().toString(), userId, nickName, "dsdtTraining");
             }
         }
         return 1;