|
@@ -3,6 +3,9 @@ package com.fdkankan.manage.service.impl;
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
|
|
+import cn.hutool.core.io.file.FileReader;
|
|
|
|
|
+import cn.hutool.core.util.NumberUtil;
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -38,6 +41,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
+import java.io.File;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
@@ -105,7 +109,8 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
IMqSendLogService mqSendLogService;
|
|
IMqSendLogService mqSendLogService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
OverallService overallService;
|
|
OverallService overallService;
|
|
|
-
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ISceneProService sceneProService;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public ScenePro getByNum(String num) {
|
|
public ScenePro getByNum(String num) {
|
|
@@ -925,4 +930,61 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
wrapper.in(ScenePro::getStatus,0,-2);
|
|
wrapper.in(ScenePro::getStatus,0,-2);
|
|
|
return this.count(wrapper);
|
|
return this.count(wrapper);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public BuildSceneVO getSceneProgress(String num) {
|
|
|
|
|
+ //V3
|
|
|
|
|
+ ScenePro scenePro = sceneProService.getByNum(num);
|
|
|
|
|
+ //V4
|
|
|
|
|
+ ScenePlus plus = scenePlusService.getByNum(num);
|
|
|
|
|
+ if(scenePro == null && plus == null){
|
|
|
|
|
+ throw new BusinessException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
|
|
|
|
|
+ }
|
|
|
|
|
+ String dataSource ="";
|
|
|
|
|
+ Integer sceneStatus =null;
|
|
|
|
|
+ if (ObjectUtil.isNotNull(plus)){
|
|
|
|
|
+ ScenePlus scenePlus = scenePlusService.getByNum(num);
|
|
|
|
|
+ sceneStatus = scenePlus.getSceneStatus();
|
|
|
|
|
+ //=-2 =0计算中 -1=失败
|
|
|
|
|
+ ScenePlusExt scenePlusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
|
|
|
|
|
+ if (ObjectUtil.isNotNull(scenePlus)){
|
|
|
|
|
+ dataSource=scenePlusExt.getDataSource();
|
|
|
|
|
+ }
|
|
|
|
|
+ }else {
|
|
|
|
|
+ dataSource = scenePro.getDataSource();
|
|
|
|
|
+ sceneStatus = scenePro.getStatus();
|
|
|
|
|
+ }
|
|
|
|
|
+ BuildSceneVO buildSceneVO = new BuildSceneVO();
|
|
|
|
|
+ //=-2 =0计算中 -1=失败
|
|
|
|
|
+ if (sceneStatus == 0){
|
|
|
|
|
+ //去目录检查project.json
|
|
|
|
|
+ File projectJson = FileUtil.file(dataSource + File.separator + "project.json");
|
|
|
|
|
+ if (FileUtil.exist(projectJson)) {
|
|
|
|
|
+ FileReader reader = new FileReader(projectJson);
|
|
|
|
|
+ String data = reader.readString();
|
|
|
|
|
+ JSONObject data_project = JSONObject.parseObject(data);
|
|
|
|
|
+ if (data_project.containsKey("progress")) {
|
|
|
|
|
+ JSONObject state = data_project.getJSONObject("state");
|
|
|
|
|
+ Double progress = state.getDouble("progress");
|
|
|
|
|
+ if (ObjectUtil.isNotNull(progress)) {
|
|
|
|
|
+ if (progress == 1){
|
|
|
|
|
+ buildSceneVO.setProgress(90);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ progress = NumberUtil.mul(progress, new Double(100.00));
|
|
|
|
|
+ buildSceneVO.setProgress(progress.intValue());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }else {
|
|
|
|
|
+ buildSceneVO.setProgress(0);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }else if (sceneStatus == -2){
|
|
|
|
|
+ buildSceneVO.setProgress(100);
|
|
|
|
|
+ }else if (sceneStatus == -1){
|
|
|
|
|
+ buildSceneVO.setProgress(0);
|
|
|
|
|
+ }
|
|
|
|
|
+ buildSceneVO.setProgress(sceneStatus);
|
|
|
|
|
+ buildSceneVO.setNum(num);
|
|
|
|
|
+ return buildSceneVO;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|