|
@@ -4,6 +4,7 @@ import com.ruoyi.project.training.bccnew.domain.*;
|
|
|
import com.ruoyi.project.training.bccnew.mapper.*;
|
|
|
import com.ruoyi.project.training.bccnew.service.ITTsApproveService;
|
|
|
import com.ruoyi.project.training.bccnew.service.ITTsNewService;
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -48,7 +49,7 @@ public class TTsNewServiceImpl implements ITTsNewService {
|
|
|
private TTsFtplanMapper tTsFtplanMapper;
|
|
|
|
|
|
@Autowired
|
|
|
- private TTsFirstplanMapper tTsFirstplanMapper ;
|
|
|
+ private TTsFirstplanMapper tTsFirstplanMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private TTsFirstplanTmplMapper tTsFirstplanTmplMapper;
|
|
@@ -201,56 +202,193 @@ public class TTsNewServiceImpl implements ITTsNewService {
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public int updateTTsNew(TTsNew tTsNew,Long userId,String nickName) {
|
|
|
- if (tTsNew.getPlanStatus()==1){
|
|
|
+ public int updateTTsNew(TTsNew tTsNew, Long userId, String nickName) {
|
|
|
+ TTsNew tsNew = tTsNewMapper.selectTTsNewById(tTsNew.getNewId());
|
|
|
+ if (tTsNew.getPlanStatus() == 1) {
|
|
|
TTsFirstplan tTsFirstplan = new TTsFirstplan();
|
|
|
tTsFirstplan.setNewId(tTsNew.getNewId());
|
|
|
for (TTsFirstplan tsFirstplan : tTsFirstplanMapper.selectTTsFirstplanListByNewId(tTsFirstplan)) {
|
|
|
- if (tsFirstplan.getPlanStatus()==null){
|
|
|
- tsFirstplan.setPlanStatus(1L);
|
|
|
+ tsFirstplan.setPlanStatus(1L);
|
|
|
+ tTsFirstplanMapper.updateTTsFirstplan(tsFirstplan);
|
|
|
+ }
|
|
|
+ if (tsNew.getPlanType() == 1) {
|
|
|
+ TTsLjplan entity = new TTsLjplan();
|
|
|
+ entity.setNewId(tTsNew.getNewId());
|
|
|
+ for (TTsLjplan item : tTsLjplanMapper.selectTTsLjplanListByNewId(entity)) {
|
|
|
+ item.setPlanStatus(1L);
|
|
|
+ tTsLjplanMapper.updateTTsLjplan(item);
|
|
|
+ }
|
|
|
+ } else if (tsNew.getPlanType() == 2) {
|
|
|
+ TTsYsplan entity = new TTsYsplan();
|
|
|
+ entity.setNewId(tTsNew.getNewId());
|
|
|
+ for (TTsYsplan item : tTsYsplanMapper.selectTTsYsplanListByNewId(entity)) {
|
|
|
+ item.setPlanStatus(1L);
|
|
|
+ tTsYsplanMapper.updateTTsYsplan(item);
|
|
|
+ }
|
|
|
+ } else if (tsNew.getPlanType() == 3) {
|
|
|
+ TTsFlplan entity = new TTsFlplan();
|
|
|
+ entity.setNewId(tTsNew.getNewId());
|
|
|
+ for (TTsFlplan item : tTsFlplanMapper.selectTTsFlplanListByNewId(entity)) {
|
|
|
+ item.setPlanStatus(1L);
|
|
|
+ tTsFlplanMapper.updateTTsFlplan(item);
|
|
|
+ }
|
|
|
+ } else if (tsNew.getPlanType() == 4) {
|
|
|
+ TTsFtplan entity = new TTsFtplan();
|
|
|
+ entity.setNewId(tTsNew.getNewId());
|
|
|
+ for (TTsFtplan item : tTsFtplanMapper.selectTTsFtplanListByNewId(entity)) {
|
|
|
+ item.setPlanStatus(1L);
|
|
|
+ tTsFtplanMapper.updateTTsFtplan(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tTsNewMapper.updateTTsNew(tTsNew);
|
|
|
+ }
|
|
|
+ if (tTsNew.getPlanStatus() == 3) {
|
|
|
+ TTsFirstplan tTsFirstplan = new TTsFirstplan();
|
|
|
+ tTsFirstplan.setNewId(tTsNew.getNewId());
|
|
|
+ for (TTsFirstplan tsFirstplan : tTsFirstplanMapper.selectTTsFirstplanListByNewId(tTsFirstplan)) {
|
|
|
+ tsFirstplan.setPlanStatus(3L);
|
|
|
+ tTsFirstplanMapper.updateTTsFirstplan(tsFirstplan);
|
|
|
+ }
|
|
|
+ if (tsNew.getPlanType() == 1) {
|
|
|
+ TTsLjplan entity = new TTsLjplan();
|
|
|
+ entity.setNewId(tTsNew.getNewId());
|
|
|
+ for (TTsLjplan item : tTsLjplanMapper.selectTTsLjplanListByNewId(entity)) {
|
|
|
+ item.setPlanStatus(3L);
|
|
|
+ tTsLjplanMapper.updateTTsLjplan(item);
|
|
|
+ }
|
|
|
+ } else if (tsNew.getPlanType() == 2) {
|
|
|
+ TTsYsplan entity = new TTsYsplan();
|
|
|
+ entity.setNewId(tTsNew.getNewId());
|
|
|
+ for (TTsYsplan item : tTsYsplanMapper.selectTTsYsplanListByNewId(entity)) {
|
|
|
+ item.setPlanStatus(3L);
|
|
|
+ tTsYsplanMapper.updateTTsYsplan(item);
|
|
|
+ }
|
|
|
+ } else if (tsNew.getPlanType() == 3) {
|
|
|
+ TTsFlplan entity = new TTsFlplan();
|
|
|
+ entity.setNewId(tTsNew.getNewId());
|
|
|
+ for (TTsFlplan item : tTsFlplanMapper.selectTTsFlplanListByNewId(entity)) {
|
|
|
+ item.setPlanStatus(3L);
|
|
|
+ tTsFlplanMapper.updateTTsFlplan(item);
|
|
|
+ }
|
|
|
+ } else if (tsNew.getPlanType() == 4) {
|
|
|
+ TTsFtplan entity = new TTsFtplan();
|
|
|
+ entity.setNewId(tTsNew.getNewId());
|
|
|
+ for (TTsFtplan item : tTsFtplanMapper.selectTTsFtplanListByNewId(entity)) {
|
|
|
+ item.setPlanStatus(3L);
|
|
|
+ tTsFtplanMapper.updateTTsFtplan(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tTsNewMapper.updateTTsNew(tTsNew);
|
|
|
+ }
|
|
|
+ if (tTsNew.getPlanStatus() == 4) {
|
|
|
+ TTsFirstplan tTsFirstplan = new TTsFirstplan();
|
|
|
+ tTsFirstplan.setNewId(tTsNew.getNewId());
|
|
|
+ for (TTsFirstplan tsFirstplan : tTsFirstplanMapper.selectTTsFirstplanListByNewId(tTsFirstplan)) {
|
|
|
+ if (tsFirstplan.getPlanStatus() == null) {
|
|
|
+ tsFirstplan.setPlanStatus(4L);
|
|
|
tTsFirstplanMapper.updateTTsFirstplan(tsFirstplan);
|
|
|
}
|
|
|
}
|
|
|
- if(tTsNew.getPlanType()==1){
|
|
|
+ if (tsNew.getPlanType() == 1) {
|
|
|
TTsLjplan entity = new TTsLjplan();
|
|
|
entity.setNewId(tTsNew.getNewId());
|
|
|
for (TTsLjplan item : tTsLjplanMapper.selectTTsLjplanListByNewId(entity)) {
|
|
|
- if (item.getPlanStatus()==null){
|
|
|
- item.setPlanStatus(1L);
|
|
|
+ if (item.getPlanStatus() == null) {
|
|
|
+ item.setPlanStatus(4L);
|
|
|
tTsLjplanMapper.updateTTsLjplan(item);
|
|
|
}
|
|
|
}
|
|
|
- }else if(tTsNew.getPlanType()==2){
|
|
|
+ } else if (tsNew.getPlanType() == 2) {
|
|
|
TTsYsplan entity = new TTsYsplan();
|
|
|
entity.setNewId(tTsNew.getNewId());
|
|
|
for (TTsYsplan item : tTsYsplanMapper.selectTTsYsplanListByNewId(entity)) {
|
|
|
- if (item.getPlanStatus()==null){
|
|
|
- item.setPlanStatus(1L);
|
|
|
+ if (item.getPlanStatus() == null) {
|
|
|
+ item.setPlanStatus(4L);
|
|
|
tTsYsplanMapper.updateTTsYsplan(item);
|
|
|
}
|
|
|
}
|
|
|
- }else if(tTsNew.getPlanType()==3){
|
|
|
+ } else if (tsNew.getPlanType() == 3) {
|
|
|
TTsFlplan entity = new TTsFlplan();
|
|
|
entity.setNewId(tTsNew.getNewId());
|
|
|
for (TTsFlplan item : tTsFlplanMapper.selectTTsFlplanListByNewId(entity)) {
|
|
|
- if (item.getPlanStatus()==null){
|
|
|
- item.setPlanStatus(1L);
|
|
|
+ if (item.getPlanStatus() == null) {
|
|
|
+ item.setPlanStatus(4L);
|
|
|
tTsFlplanMapper.updateTTsFlplan(item);
|
|
|
}
|
|
|
}
|
|
|
- }else if(tTsNew.getPlanType()==4){
|
|
|
+ } else if (tsNew.getPlanType() == 4) {
|
|
|
TTsFtplan entity = new TTsFtplan();
|
|
|
entity.setNewId(tTsNew.getNewId());
|
|
|
for (TTsFtplan item : tTsFtplanMapper.selectTTsFtplanListByNewId(entity)) {
|
|
|
- if (item.getPlanStatus()==null){
|
|
|
- item.setPlanStatus(1L);
|
|
|
+ if (item.getPlanStatus() == null) {
|
|
|
+ item.setPlanStatus(4L);
|
|
|
tTsFtplanMapper.updateTTsFtplan(item);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- tsApproveService.doApprove(tTsNew.getNewId(),tTsNew.getPlanType().toString(),userId,nickName);
|
|
|
+ tTsNewMapper.updateTTsNew(tTsNew);
|
|
|
+ tsApproveService.doApprove(tTsNew.getNewId(), tsNew.getPlanType().toString(), userId, nickName);
|
|
|
}
|
|
|
- return tTsNewMapper.updateTTsNew(tTsNew);
|
|
|
+ if (tTsNew.getPlanStatus() == 5) {
|
|
|
+ TTsFirstplan plan = new TTsFirstplan();
|
|
|
+ plan.setNewId(tTsNew.getNewId());
|
|
|
+ List<TTsFirstplan> tTsFirstplans = tTsFirstplanMapper.selectTTsFirstplanListByNewId(plan);
|
|
|
+ plan.setPlanStatus(5L);
|
|
|
+ List<TTsFirstplan> tTsFirstplansDone = tTsFirstplanMapper.selectTTsFirstplanListByNewId(plan);
|
|
|
+ boolean flag = false;
|
|
|
+ if (1 == tsNew.getPlanType()) {
|
|
|
+ TTsLjplan tTsLjplan = new TTsLjplan();
|
|
|
+ tTsLjplan.setNewId(tTsNew.getNewId());
|
|
|
+ List<TTsLjplan> tTsLjplans = tTsLjplanMapper.selectTTsLjplanListByNewId(tTsLjplan);
|
|
|
+ tTsLjplan.setPlanStatus(5L);
|
|
|
+ List<TTsLjplan> tTsLjplansDone = tTsLjplanMapper.selectTTsLjplanListByNewId(tTsLjplan);
|
|
|
+ if (!CollectionUtils.isEmpty(tTsLjplans)
|
|
|
+ && !CollectionUtils.isEmpty(tTsLjplansDone)
|
|
|
+ && tTsLjplansDone.size() == tTsLjplans.size()) {
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
+ } else if (2 == tsNew.getPlanType()) {
|
|
|
+ TTsYsplan tTsYsplan = new TTsYsplan();
|
|
|
+ tTsYsplan.setNewId(tTsNew.getNewId());
|
|
|
+ List<TTsYsplan> tTsYsplans = tTsYsplanMapper.selectTTsYsplanListByNewId(tTsYsplan);
|
|
|
+ tTsYsplan.setPlanStatus(5L);
|
|
|
+ List<TTsYsplan> tTsYsplansDone = tTsYsplanMapper.selectTTsYsplanListByNewId(tTsYsplan);
|
|
|
+ if (!CollectionUtils.isEmpty(tTsYsplans)
|
|
|
+ && !CollectionUtils.isEmpty(tTsYsplansDone)
|
|
|
+ && tTsYsplansDone.size() == tTsYsplans.size()) {
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
+ } else if (3 == tsNew.getPlanType()) {
|
|
|
+ TTsFlplan tTsFlplan = new TTsFlplan();
|
|
|
+ tTsFlplan.setNewId(tTsNew.getNewId());
|
|
|
+ List<TTsFlplan> tTsFlplans = tTsFlplanMapper.selectTTsFlplanListByNewId(tTsFlplan);
|
|
|
+ tTsFlplan.setPlanStatus(5L);
|
|
|
+ List<TTsFlplan> tTsFlplansDone = tTsFlplanMapper.selectTTsFlplanListByNewId(tTsFlplan);
|
|
|
+ if (!CollectionUtils.isEmpty(tTsFlplans)
|
|
|
+ && !CollectionUtils.isEmpty(tTsFlplansDone)
|
|
|
+ && tTsFlplansDone.size() == tTsFlplans.size()) {
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
+ } else if (4 == tsNew.getPlanType()) {
|
|
|
+ TTsFtplan tTsFtplan = new TTsFtplan();
|
|
|
+ tTsFtplan.setNewId(tTsNew.getNewId());
|
|
|
+ List<TTsFtplan> tTsFtplans = tTsFtplanMapper.selectTTsFtplanListByNewId(tTsFtplan);
|
|
|
+ tTsFtplan.setPlanStatus(5L);
|
|
|
+ List<TTsFtplan> tTsFtplansDone = tTsFtplanMapper.selectTTsFtplanListByNewId(tTsFtplan);
|
|
|
+ if (!CollectionUtils.isEmpty(tTsFtplans)
|
|
|
+ && !CollectionUtils.isEmpty(tTsFtplansDone)
|
|
|
+ && tTsFtplansDone.size() == tTsFtplans.size()) {
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!CollectionUtils.isEmpty(tTsFirstplans) &&
|
|
|
+ !CollectionUtils.isEmpty(tTsFirstplansDone) &&
|
|
|
+ tTsFirstplans.size() == tTsFirstplansDone.size() && flag) {
|
|
|
+ tTsNewMapper.updateTTsNew(tTsNew);
|
|
|
+ tsApproveService.doApprove(tTsNew.getNewId(), tsNew.getPlanType().toString(), userId, nickName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
}
|
|
|
|
|
|
/**
|