|
@@ -14,16 +14,16 @@ import com.css.simulation.resource.algorithm.service.AlgorithmService;
|
|
import com.css.simulation.resource.common.utils.AuthUtil;
|
|
import com.css.simulation.resource.common.utils.AuthUtil;
|
|
import com.css.simulation.resource.common.utils.PageUtil;
|
|
import com.css.simulation.resource.common.utils.PageUtil;
|
|
import com.css.simulation.resource.common.utils.PoUtil;
|
|
import com.css.simulation.resource.common.utils.PoUtil;
|
|
|
|
+import com.css.simulation.resource.configuration.git.GitConfiguration;
|
|
import com.css.simulation.resource.feign.AlgoPlatformService;
|
|
import com.css.simulation.resource.feign.AlgoPlatformService;
|
|
import com.css.simulation.resource.feign.FileDownService;
|
|
import com.css.simulation.resource.feign.FileDownService;
|
|
import com.css.simulation.resource.feign.SchedulerService;
|
|
import com.css.simulation.resource.feign.SchedulerService;
|
|
import com.css.simulation.resource.system.service.DictService;
|
|
import com.css.simulation.resource.system.service.DictService;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
-import org.eclipse.jgit.lib.Ref;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.beans.factory.annotation.Qualifier;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -32,20 +32,31 @@ import java.util.Map;
|
|
@Service
|
|
@Service
|
|
public class AlgorithmServiceImpl implements AlgorithmService {
|
|
public class AlgorithmServiceImpl implements AlgorithmService {
|
|
|
|
|
|
- @Resource
|
|
|
|
AlgoPlatformService algoPlatformService;
|
|
AlgoPlatformService algoPlatformService;
|
|
-
|
|
|
|
- @Resource
|
|
|
|
SchedulerService schedulerService;
|
|
SchedulerService schedulerService;
|
|
-
|
|
|
|
- @Resource
|
|
|
|
FileDownService fileDownService;
|
|
FileDownService fileDownService;
|
|
|
|
+ AlgorithmMapper algorithmMapper;
|
|
|
|
+ DictService dictService;
|
|
|
|
+ GitConfiguration gitConfiguration;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- private AlgorithmMapper algorithmMapper;
|
|
|
|
|
|
+ public AlgorithmServiceImpl(AlgoPlatformService algoPlatformService,
|
|
|
|
+ SchedulerService schedulerService,
|
|
|
|
+ @Qualifier("com.css.simulation.resource.feign.FileDownService") FileDownService fileDownService,
|
|
|
|
+ AlgorithmMapper algorithmMapper,
|
|
|
|
+ DictService dictService,
|
|
|
|
+ GitConfiguration gitConfiguration
|
|
|
|
+ ) {
|
|
|
|
+ this.algoPlatformService = algoPlatformService;
|
|
|
|
+ this.schedulerService = schedulerService;
|
|
|
|
+ this.fileDownService = fileDownService;
|
|
|
|
+ this.algorithmMapper = algorithmMapper;
|
|
|
|
+ this.dictService = dictService;
|
|
|
|
+ this.gitConfiguration = gitConfiguration;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //* -------------------------------- Comment --------------------------------
|
|
|
|
|
|
- @Autowired
|
|
|
|
- DictService dictService;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public ResponseBodyVO addOrUpdate(AlgorithmParameter param) {
|
|
public ResponseBodyVO addOrUpdate(AlgorithmParameter param) {
|
|
@@ -53,21 +64,21 @@ public class AlgorithmServiceImpl implements AlgorithmService {
|
|
String currentUserId = AuthUtil.getCurrentUserId();
|
|
String currentUserId = AuthUtil.getCurrentUserId();
|
|
param.setCreateUserId(currentUserId);
|
|
param.setCreateUserId(currentUserId);
|
|
List<AlgorithmPO> algorithmPOS = algorithmMapper.selectAlgorithmName(param);
|
|
List<AlgorithmPO> algorithmPOS = algorithmMapper.selectAlgorithmName(param);
|
|
- if(algorithmPOS != null && algorithmPOS.size() > 0){
|
|
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE,"该算法名称已存在!");
|
|
|
|
- }else {
|
|
|
|
|
|
+ if (algorithmPOS != null && algorithmPOS.size() > 0) {
|
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "该算法名称已存在!");
|
|
|
|
+ } else {
|
|
String uploadMode = param.getUploadMode();
|
|
String uploadMode = param.getUploadMode();
|
|
- if(DictConstants.FILE.equals(uploadMode)){
|
|
|
|
|
|
+ if (DictConstants.FILE.equals(uploadMode)) {
|
|
String minioPath = param.getMinioPath();
|
|
String minioPath = param.getMinioPath();
|
|
ResponseBodyVO<String> checkRes = schedulerService.check(minioPath);
|
|
ResponseBodyVO<String> checkRes = schedulerService.check(minioPath);
|
|
- if(ObjectUtil.isNull(checkRes)){
|
|
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE,"算法校验服务异常,请联系管理人员!");
|
|
|
|
|
|
+ if (ObjectUtil.isNull(checkRes)) {
|
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "算法校验服务异常,请联系管理人员!");
|
|
}
|
|
}
|
|
- if(!checkRes.isStatus()){//校验失败
|
|
|
|
|
|
+ if (!checkRes.isStatus()) {//校验失败
|
|
MinioParameter minioParameter = new MinioParameter();
|
|
MinioParameter minioParameter = new MinioParameter();
|
|
minioParameter.setObjectName(minioPath);
|
|
minioParameter.setObjectName(minioPath);
|
|
fileDownService.remove(minioParameter);
|
|
fileDownService.remove(minioParameter);
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE,"该算法经校验不可用,无法保存!");
|
|
|
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "该算法经校验不可用,无法保存!");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return doAddOrUpdate(param);
|
|
return doAddOrUpdate(param);
|
|
@@ -75,7 +86,7 @@ public class AlgorithmServiceImpl implements AlgorithmService {
|
|
}
|
|
}
|
|
|
|
|
|
private ResponseBodyVO doAddOrUpdate(AlgorithmParameter param) {
|
|
private ResponseBodyVO doAddOrUpdate(AlgorithmParameter param) {
|
|
- if(isEmpty(param.getId())){
|
|
|
|
|
|
+ if (isEmpty(param.getId())) {
|
|
//添加
|
|
//添加
|
|
String algorithmId = StringUtil.getRandomUUID();
|
|
String algorithmId = StringUtil.getRandomUUID();
|
|
param.setId(algorithmId);
|
|
param.setId(algorithmId);
|
|
@@ -83,20 +94,20 @@ public class AlgorithmServiceImpl implements AlgorithmService {
|
|
param.setAlgorithmCode(algorithmCode);
|
|
param.setAlgorithmCode(algorithmCode);
|
|
AlgorithmPO po = setPo(param, false);
|
|
AlgorithmPO po = setPo(param, false);
|
|
int add = algorithmMapper.add(po);
|
|
int add = algorithmMapper.add(po);
|
|
- if(add > 0){
|
|
|
|
|
|
+ if (add > 0) {
|
|
LogUtil.insert();
|
|
LogUtil.insert();
|
|
return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
|
|
return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
|
|
- }else {
|
|
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE,"添加失败");
|
|
|
|
|
|
+ } else {
|
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "添加失败");
|
|
}
|
|
}
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
//编辑
|
|
//编辑
|
|
AlgorithmPO po = setPo(param, true);
|
|
AlgorithmPO po = setPo(param, true);
|
|
int add = algorithmMapper.update(po);
|
|
int add = algorithmMapper.update(po);
|
|
if (add > 0) {
|
|
if (add > 0) {
|
|
LogUtil.update();
|
|
LogUtil.update();
|
|
return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
|
|
return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "编辑失败");
|
|
return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "编辑失败");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -104,19 +115,19 @@ public class AlgorithmServiceImpl implements AlgorithmService {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public ResponseBodyVO selectAlgorithmList(AlgorithmParameter param){
|
|
|
|
|
|
+ public ResponseBodyVO selectAlgorithmList(AlgorithmParameter param) {
|
|
param.setIsDeleted("0");
|
|
param.setIsDeleted("0");
|
|
param.setCreateUserId(AuthUtil.getCurrentUserId());
|
|
param.setCreateUserId(AuthUtil.getCurrentUserId());
|
|
PageUtil.setPageInfo(param);
|
|
PageUtil.setPageInfo(param);
|
|
List<AlgorithmVO> vos = algorithmMapper.selectAlgorithmList(param);
|
|
List<AlgorithmVO> vos = algorithmMapper.selectAlgorithmList(param);
|
|
- for (AlgorithmVO vo:vos){
|
|
|
|
|
|
+ for (AlgorithmVO vo : vos) {
|
|
vo.setValidationStatus(getDictName(DictConstants.VALIDATION_STATUS, vo.getValidationStatus()));
|
|
vo.setValidationStatus(getDictName(DictConstants.VALIDATION_STATUS, vo.getValidationStatus()));
|
|
}
|
|
}
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS,new PageInfo<>(vos));
|
|
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, new PageInfo<>(vos));
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public ResponseBodyVO selectAlgoPlatformList(AlgorithmParameter param){
|
|
|
|
|
|
+ public ResponseBodyVO selectAlgoPlatformList(AlgorithmParameter param) {
|
|
//获取参数
|
|
//获取参数
|
|
String algorithmId = param.getAlgorithmCode();
|
|
String algorithmId = param.getAlgorithmCode();
|
|
String algorithmName = param.getAlgorithmName();
|
|
String algorithmName = param.getAlgorithmName();
|
|
@@ -125,19 +136,19 @@ public class AlgorithmServiceImpl implements AlgorithmService {
|
|
Integer size = param.getPageSize();
|
|
Integer size = param.getPageSize();
|
|
String sort = "algorithmId-desc";
|
|
String sort = "algorithmId-desc";
|
|
String urlParam = "";
|
|
String urlParam = "";
|
|
- if (StringUtil.isNotEmpty(algorithmId)){
|
|
|
|
|
|
+ if (StringUtil.isNotEmpty(algorithmId)) {
|
|
urlParam = urlParam + "&algorithmId=" + algorithmId;
|
|
urlParam = urlParam + "&algorithmId=" + algorithmId;
|
|
}
|
|
}
|
|
- if (StringUtil.isNotEmpty(algorithmName)){
|
|
|
|
|
|
+ if (StringUtil.isNotEmpty(algorithmName)) {
|
|
urlParam = urlParam + "&algorithmName=" + algorithmName;
|
|
urlParam = urlParam + "&algorithmName=" + algorithmName;
|
|
}
|
|
}
|
|
- if (StringUtil.isNotEmpty(description)){
|
|
|
|
|
|
+ if (StringUtil.isNotEmpty(description)) {
|
|
urlParam = urlParam + "&description=" + description;
|
|
urlParam = urlParam + "&description=" + description;
|
|
}
|
|
}
|
|
- if (StringUtil.isNotEmpty(page)){
|
|
|
|
|
|
+ if (StringUtil.isNotEmpty(page)) {
|
|
urlParam = urlParam + "&page=" + page;
|
|
urlParam = urlParam + "&page=" + page;
|
|
}
|
|
}
|
|
- if (StringUtil.isNotEmpty(size)){
|
|
|
|
|
|
+ if (StringUtil.isNotEmpty(size)) {
|
|
urlParam = urlParam + "&size=" + size;
|
|
urlParam = urlParam + "&size=" + size;
|
|
}
|
|
}
|
|
urlParam = urlParam + "&sort=" + sort;
|
|
urlParam = urlParam + "&sort=" + sort;
|
|
@@ -150,8 +161,8 @@ public class AlgorithmServiceImpl implements AlgorithmService {
|
|
List<Map<String, String>> contentList = (List<Map<String, String>>) dataMap.get("content");
|
|
List<Map<String, String>> contentList = (List<Map<String, String>>) dataMap.get("content");
|
|
Integer totalElements = (Integer) dataMap.get("totalElements");
|
|
Integer totalElements = (Integer) dataMap.get("totalElements");
|
|
List<AlgorithmVO> vos = new ArrayList<>();
|
|
List<AlgorithmVO> vos = new ArrayList<>();
|
|
- if(totalElements > 0){
|
|
|
|
- for (Map<String, String> content: contentList) {
|
|
|
|
|
|
+ if (totalElements > 0) {
|
|
|
|
+ for (Map<String, String> content : contentList) {
|
|
AlgorithmVO vo = new AlgorithmVO();
|
|
AlgorithmVO vo = new AlgorithmVO();
|
|
vo.setId(content.get("id"));
|
|
vo.setId(content.get("id"));
|
|
vo.setAlgorithmCode(content.get("algorithmId"));
|
|
vo.setAlgorithmCode(content.get("algorithmId"));
|
|
@@ -163,7 +174,7 @@ public class AlgorithmServiceImpl implements AlgorithmService {
|
|
PageInfo<AlgorithmVO> objectPageInfo = new PageInfo<>(vos);
|
|
PageInfo<AlgorithmVO> objectPageInfo = new PageInfo<>(vos);
|
|
objectPageInfo.setTotal(totalElements);
|
|
objectPageInfo.setTotal(totalElements);
|
|
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS,objectPageInfo);
|
|
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, objectPageInfo);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -172,63 +183,63 @@ public class AlgorithmServiceImpl implements AlgorithmService {
|
|
param.setShare("1");
|
|
param.setShare("1");
|
|
PageUtil.setPageInfo(param);
|
|
PageUtil.setPageInfo(param);
|
|
List<AlgorithmVO> vos = algorithmMapper.selectSharedAlgorithmList(param);
|
|
List<AlgorithmVO> vos = algorithmMapper.selectSharedAlgorithmList(param);
|
|
- for (AlgorithmVO vo:vos){
|
|
|
|
|
|
+ for (AlgorithmVO vo : vos) {
|
|
vo.setValidationStatus(getDictName(DictConstants.VALIDATION_STATUS, vo.getValidationStatus()));
|
|
vo.setValidationStatus(getDictName(DictConstants.VALIDATION_STATUS, vo.getValidationStatus()));
|
|
}
|
|
}
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS,new PageInfo<>(vos));
|
|
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, new PageInfo<>(vos));
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public ResponseBodyVO shareAlgorithm(AlgorithmParameter param) {
|
|
public ResponseBodyVO shareAlgorithm(AlgorithmParameter param) {
|
|
- if(isEmpty(param.getId())){
|
|
|
|
|
|
+ if (isEmpty(param.getId())) {
|
|
return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
String algorithmId = param.getId();
|
|
String algorithmId = param.getId();
|
|
AlgorithmPO po = algorithmMapper.selectDetailsById(algorithmId);
|
|
AlgorithmPO po = algorithmMapper.selectDetailsById(algorithmId);
|
|
List<AlgorithmPO> algorithmPOS = algorithmMapper.selectSharedAlgorithmName(po.getAlgorithmName());
|
|
List<AlgorithmPO> algorithmPOS = algorithmMapper.selectSharedAlgorithmName(po.getAlgorithmName());
|
|
- if(algorithmPOS != null && algorithmPOS.size() > 0){
|
|
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE,"该算法名称已存在, 无法分享!");
|
|
|
|
- }else {
|
|
|
|
|
|
+ if (algorithmPOS != null && algorithmPOS.size() > 0) {
|
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "该算法名称已存在, 无法分享!");
|
|
|
|
+ } else {
|
|
po.setShare("1");
|
|
po.setShare("1");
|
|
po.setId(StringUtil.getRandomUUID());
|
|
po.setId(StringUtil.getRandomUUID());
|
|
po.setAlgorithmCode(StringUtil.getRandomCode());
|
|
po.setAlgorithmCode(StringUtil.getRandomCode());
|
|
int add = algorithmMapper.add(po);
|
|
int add = algorithmMapper.add(po);
|
|
- if(add > 0){
|
|
|
|
|
|
+ if (add > 0) {
|
|
LogUtil.share();
|
|
LogUtil.share();
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS,"分享成功");
|
|
|
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, "分享成功");
|
|
}
|
|
}
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE,"分享失败");
|
|
|
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "分享失败");
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public ResponseBodyVO testConnection(AlgorithmParameter param) {
|
|
|
|
- try{
|
|
|
|
- Map<String, Ref> asMap = JgitUtil.testConnection(param.getGitUrl(), param.getGitUserName(), param.getGitPassword());
|
|
|
|
- } catch (Exception e){
|
|
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE,"连接失败!");
|
|
|
|
|
|
+ public ResponseBodyVO<String> testConnection(AlgorithmParameter param) {
|
|
|
|
+ try {
|
|
|
|
+ JgitUtil.testConnection(param.getGitUrl().replace(gitConfiguration.getName(), gitConfiguration.getUrl()), param.getGitUserName(), param.getGitPassword());
|
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, "连接成功");
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "连接失败!");
|
|
}
|
|
}
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS,"连接成功");
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public String getGitVersion(String algorithmId) {
|
|
|
|
|
|
+ public String getGitVersion(String algorithmId) {
|
|
AlgorithmPO po = algorithmMapper.selectDetailsById(algorithmId);
|
|
AlgorithmPO po = algorithmMapper.selectDetailsById(algorithmId);
|
|
String gitUrl = po.getGitUrl();
|
|
String gitUrl = po.getGitUrl();
|
|
- if(StringUtil.isEmpty(gitUrl)){
|
|
|
|
|
|
+ if (StringUtil.isEmpty(gitUrl)) {
|
|
return "";
|
|
return "";
|
|
}
|
|
}
|
|
//拼接get请求地址
|
|
//拼接get请求地址
|
|
String prefix = "https://api.github.com/repos/";
|
|
String prefix = "https://api.github.com/repos/";
|
|
String suffix = "/commits?page=1&per_page=1";
|
|
String suffix = "/commits?page=1&per_page=1";
|
|
- String gitInfo = gitUrl.substring(19, gitUrl.length()-4);
|
|
|
|
|
|
+ String gitInfo = gitUrl.substring(19, gitUrl.length() - 4);
|
|
String requestUrl = prefix + gitInfo + suffix;
|
|
String requestUrl = prefix + gitInfo + suffix;
|
|
try {
|
|
try {
|
|
String result = HttpUtil.get(HttpUtil.getHttpClient(), HttpUtil.getRequestConfig(), requestUrl);
|
|
String result = HttpUtil.get(HttpUtil.getHttpClient(), HttpUtil.getRequestConfig(), requestUrl);
|
|
List<HashMap> hashMaps = JsonUtil.jsonToList(result, HashMap.class);
|
|
List<HashMap> hashMaps = JsonUtil.jsonToList(result, HashMap.class);
|
|
- if(hashMaps.size() > 0){
|
|
|
|
|
|
+ if (hashMaps.size() > 0) {
|
|
HashMap hashMap = hashMaps.get(0);
|
|
HashMap hashMap = hashMaps.get(0);
|
|
String version = hashMap.get("sha").toString();
|
|
String version = hashMap.get("sha").toString();
|
|
return version;
|
|
return version;
|
|
@@ -242,26 +253,26 @@ public class AlgorithmServiceImpl implements AlgorithmService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public ResponseBodyVO deleteByid(AlgorithmParameter param) {
|
|
public ResponseBodyVO deleteByid(AlgorithmParameter param) {
|
|
- if(isEmpty(param.getId())){
|
|
|
|
|
|
+ if (isEmpty(param.getId())) {
|
|
return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
String algorithmId = param.getId();
|
|
String algorithmId = param.getId();
|
|
List<RunningProjectVO> runningProjectVos = algorithmMapper.selectRunningProject(algorithmId);
|
|
List<RunningProjectVO> runningProjectVos = algorithmMapper.selectRunningProject(algorithmId);
|
|
- if(runningProjectVos != null && runningProjectVos.size() > 0){
|
|
|
|
|
|
+ if (runningProjectVos != null && runningProjectVos.size() > 0) {
|
|
StringBuffer stringBuffer = new StringBuffer("");
|
|
StringBuffer stringBuffer = new StringBuffer("");
|
|
- for (RunningProjectVO vo:runningProjectVos){
|
|
|
|
|
|
+ for (RunningProjectVO vo : runningProjectVos) {
|
|
String projectId = vo.getProjectId();
|
|
String projectId = vo.getProjectId();
|
|
- stringBuffer.append(projectId+",");
|
|
|
|
|
|
+ stringBuffer.append(projectId + ",");
|
|
}
|
|
}
|
|
String substring = stringBuffer.substring(0, stringBuffer.lastIndexOf(","));
|
|
String substring = stringBuffer.substring(0, stringBuffer.lastIndexOf(","));
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE,"已被工作ID:"+ substring +" 应用,无法删除!");
|
|
|
|
- }else {
|
|
|
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "已被工作ID:" + substring + " 应用,无法删除!");
|
|
|
|
+ } else {
|
|
int i = algorithmMapper.deleteByid(param);
|
|
int i = algorithmMapper.deleteByid(param);
|
|
- if(i > 0){
|
|
|
|
|
|
+ if (i > 0) {
|
|
LogUtil.delete();
|
|
LogUtil.delete();
|
|
return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
|
|
return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
|
|
}
|
|
}
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE,"删除失败");
|
|
|
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "删除失败");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -269,44 +280,44 @@ public class AlgorithmServiceImpl implements AlgorithmService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public ResponseBodyVO selectDetailsById(String algorithmId) {
|
|
public ResponseBodyVO selectDetailsById(String algorithmId) {
|
|
- if(isEmpty(algorithmId)){
|
|
|
|
|
|
+ if (isEmpty(algorithmId)) {
|
|
return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
AlgorithmPO po = algorithmMapper.selectDetailsById(algorithmId);
|
|
AlgorithmPO po = algorithmMapper.selectDetailsById(algorithmId);
|
|
po.setValidationStatus(getDictName(DictConstants.VALIDATION_STATUS, po.getValidationStatus()));
|
|
po.setValidationStatus(getDictName(DictConstants.VALIDATION_STATUS, po.getValidationStatus()));
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS,po);
|
|
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, po);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- private boolean isEmpty(String value){
|
|
|
|
- if(value == null){
|
|
|
|
|
|
+ private boolean isEmpty(String value) {
|
|
|
|
+ if (value == null) {
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
value = value.trim();
|
|
value = value.trim();
|
|
- if(value.length() == 0){
|
|
|
|
|
|
+ if (value.length() == 0) {
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- private AlgorithmPO setPo(AlgorithmParameter param, Boolean isEdit) {
|
|
|
|
|
|
+ private AlgorithmPO setPo(AlgorithmParameter param, Boolean isEdit) {
|
|
|
|
|
|
AlgorithmPO po = new AlgorithmPO();
|
|
AlgorithmPO po = new AlgorithmPO();
|
|
//设置po信息
|
|
//设置po信息
|
|
- if(DictConstants.GIT.equals(param.getUploadMode())){ //使用仓库地址上传
|
|
|
|
|
|
+ if (DictConstants.GIT.equals(param.getUploadMode())) { //使用仓库地址上传
|
|
String gitUrl = param.getGitUrl();
|
|
String gitUrl = param.getGitUrl();
|
|
String gitUserName = param.getGitUserName();
|
|
String gitUserName = param.getGitUserName();
|
|
String gitPassword = param.getGitPassword();
|
|
String gitPassword = param.getGitPassword();
|
|
po.setGitUrl(gitUrl);
|
|
po.setGitUrl(gitUrl);
|
|
po.setGitUserName(gitUserName);
|
|
po.setGitUserName(gitUserName);
|
|
po.setGitPassword(gitPassword);
|
|
po.setGitPassword(gitPassword);
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
String minioPath = param.getMinioPath();
|
|
String minioPath = param.getMinioPath();
|
|
String[] splits = minioPath.split("/");
|
|
String[] splits = minioPath.split("/");
|
|
- String fileName = splits[splits.length-1];
|
|
|
|
|
|
+ String fileName = splits[splits.length - 1];
|
|
po.setMinioPath(param.getMinioPath());
|
|
po.setMinioPath(param.getMinioPath());
|
|
po.setFileName(fileName);
|
|
po.setFileName(fileName);
|
|
}
|
|
}
|
|
@@ -318,9 +329,9 @@ public class AlgorithmServiceImpl implements AlgorithmService {
|
|
po.setShare(DictConstants.NO);
|
|
po.setShare(DictConstants.NO);
|
|
po.setId(param.getId());
|
|
po.setId(param.getId());
|
|
|
|
|
|
- if(isEdit){
|
|
|
|
|
|
+ if (isEdit) {
|
|
PoUtil.initUpdatePo(po);
|
|
PoUtil.initUpdatePo(po);
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
PoUtil.initAddPo(po);
|
|
PoUtil.initAddPo(po);
|
|
}
|
|
}
|
|
return po;
|
|
return po;
|
|
@@ -332,7 +343,7 @@ public class AlgorithmServiceImpl implements AlgorithmService {
|
|
dictParam.setDictTypes(type);
|
|
dictParam.setDictTypes(type);
|
|
Map<String, Map<String, String>> dictMapsByTypes = dictService.getDictMapsByTypes(dictParam);
|
|
Map<String, Map<String, String>> dictMapsByTypes = dictService.getDictMapsByTypes(dictParam);
|
|
Map<String, String> stringStringMap = dictMapsByTypes.get(type);
|
|
Map<String, String> stringStringMap = dictMapsByTypes.get(type);
|
|
- if(stringStringMap != null && stringStringMap.size() > 0){
|
|
|
|
|
|
+ if (stringStringMap != null && stringStringMap.size() > 0) {
|
|
return stringStringMap.get(code);
|
|
return stringStringMap.get(code);
|
|
}
|
|
}
|
|
return "";
|
|
return "";
|
|
@@ -340,16 +351,16 @@ public class AlgorithmServiceImpl implements AlgorithmService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Map selectDetailsBySy() {
|
|
public Map selectDetailsBySy() {
|
|
- AlgorithmParameter param=new AlgorithmParameter();
|
|
|
|
|
|
+ AlgorithmParameter param = new AlgorithmParameter();
|
|
param.setUploadMode("1");
|
|
param.setUploadMode("1");
|
|
param.setShare("0");
|
|
param.setShare("0");
|
|
param.setCreateUserId(AuthUtil.getCurrentUserId());
|
|
param.setCreateUserId(AuthUtil.getCurrentUserId());
|
|
- int fileNum= algorithmMapper.selectDetailsBySy(param);
|
|
|
|
|
|
+ int fileNum = algorithmMapper.selectDetailsBySy(param);
|
|
param.setUploadMode("2");
|
|
param.setUploadMode("2");
|
|
- int pathNum= algorithmMapper.selectDetailsBySy(param);
|
|
|
|
- Map map=new HashMap();
|
|
|
|
- map.put("fileNum",fileNum);
|
|
|
|
- map.put("pathNum",pathNum);
|
|
|
|
|
|
+ int pathNum = algorithmMapper.selectDetailsBySy(param);
|
|
|
|
+ Map map = new HashMap();
|
|
|
|
+ map.put("fileNum", fileNum);
|
|
|
|
+ map.put("pathNum", pathNum);
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|
|
|
|
|