|
@@ -2655,44 +2655,48 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
params.put("createUserId", AuthUtil.getCurrentUserId());
|
|
|
List<Map<String, Object>> list = simulationProjectTaskMapper.selectRunTaskByState(params);
|
|
|
// 汉化
|
|
|
- list.forEach(map -> {
|
|
|
- if (StateConstant.Aborted.getEnglish().equals(map.get(key2))) {
|
|
|
- map.put(key2, StateConstant.Aborted.getChinese());
|
|
|
- }
|
|
|
- if (StateConstant.PendingAnalysis.getEnglish().equals(map.get(key2))) {
|
|
|
- map.put(key2, StateConstant.PendingAnalysis.getChinese());
|
|
|
- }
|
|
|
- if (StateConstant.Running.getEnglish().equals(map.get(key2))) {
|
|
|
- map.put(key2, StateConstant.Running.getChinese());
|
|
|
- }
|
|
|
- if (StateConstant.Analysing.getEnglish().equals(map.get(key2))) {
|
|
|
- map.put(key2, StateConstant.Analysing.getChinese());
|
|
|
- }
|
|
|
- if (StateConstant.Completed.getEnglish().equals(map.get(key2))) {
|
|
|
- map.put(key2, StateConstant.Completed.getChinese());
|
|
|
- }
|
|
|
- if (StateConstant.Terminated.getEnglish().equals(map.get(key2))) {
|
|
|
- map.put(key2, StateConstant.Terminated.getChinese());
|
|
|
- }
|
|
|
- if (StateConstant.Terminating.getEnglish().equals(map.get(key2))) {
|
|
|
- map.put(key2, StateConstant.Terminating.getChinese());
|
|
|
- }
|
|
|
- if (StateConstant.Pending.getEnglish().equals(map.get(key2))) {
|
|
|
- map.put(key2, StateConstant.Pending.getChinese());
|
|
|
+ if(CollectionUtil.isNotEmpty(list)){
|
|
|
+ list.forEach(map -> {
|
|
|
+ if (StateConstant.Aborted.getEnglish().equals(map.get(key2))) {
|
|
|
+ map.put(key2, StateConstant.Aborted.getChinese());
|
|
|
+ }
|
|
|
+ if (StateConstant.PendingAnalysis.getEnglish().equals(map.get(key2))) {
|
|
|
+ map.put(key2, StateConstant.PendingAnalysis.getChinese());
|
|
|
+ }
|
|
|
+ if (StateConstant.Running.getEnglish().equals(map.get(key2))) {
|
|
|
+ map.put(key2, StateConstant.Running.getChinese());
|
|
|
+ }
|
|
|
+ if (StateConstant.Analysing.getEnglish().equals(map.get(key2))) {
|
|
|
+ map.put(key2, StateConstant.Analysing.getChinese());
|
|
|
+ }
|
|
|
+ if (StateConstant.Completed.getEnglish().equals(map.get(key2))) {
|
|
|
+ map.put(key2, StateConstant.Completed.getChinese());
|
|
|
+ }
|
|
|
+ if (StateConstant.Terminated.getEnglish().equals(map.get(key2))) {
|
|
|
+ map.put(key2, StateConstant.Terminated.getChinese());
|
|
|
+ }
|
|
|
+ if (StateConstant.Terminating.getEnglish().equals(map.get(key2))) {
|
|
|
+ map.put(key2, StateConstant.Terminating.getChinese());
|
|
|
+ }
|
|
|
+ if (StateConstant.Pending.getEnglish().equals(map.get(key2))) {
|
|
|
+ map.put(key2, StateConstant.Pending.getChinese());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 合并手动终止
|
|
|
+ Map<String, Object> newMap = new HashMap<>();
|
|
|
+ int numSum = 0;
|
|
|
+ final Iterator<Map<String, Object>> iterator = list.iterator();
|
|
|
+ while (iterator.hasNext()){
|
|
|
+ final Map<String, Object> map = iterator.next();
|
|
|
+ if (StateConstant.Terminated.getChinese().equals(map.get(key2))) {
|
|
|
+ numSum += Integer.parseInt(map.get(key1) + "");
|
|
|
+ iterator.remove();
|
|
|
+ }
|
|
|
}
|
|
|
- });
|
|
|
- // 合并手动终止
|
|
|
- Map<String, Object> newMap = new HashMap<>();
|
|
|
- int numSum = 0;
|
|
|
- for (Map<String, Object> map : list) {
|
|
|
- if (StateConstant.Terminated.getChinese().equals(map.get(key2))) {
|
|
|
- numSum += Integer.parseInt(map.get(key2) + "");
|
|
|
- list.remove(map);
|
|
|
- }
|
|
|
- }
|
|
|
- newMap.put(key1, numSum + "");
|
|
|
- newMap.put(key2, StateConstant.Terminated.getChinese());
|
|
|
- list.add(newMap);
|
|
|
+ newMap.put(key1, numSum + "");
|
|
|
+ newMap.put(key2, StateConstant.Terminated.getChinese());
|
|
|
+ list.add(newMap);
|
|
|
+ }
|
|
|
return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, list);
|
|
|
}
|
|
|
|