| @@ -1,6 +1,8 @@ | |||||
| package com.ruoyi.platform.service.impl; | package com.ruoyi.platform.service.impl; | ||||
| import cn.hutool.core.bean.BeanUtil; | import cn.hutool.core.bean.BeanUtil; | ||||
| import cn.hutool.core.collection.CollectionUtil; | |||||
| import cn.hutool.core.util.StrUtil; | |||||
| import com.ruoyi.common.core.utils.DateUtils; | import com.ruoyi.common.core.utils.DateUtils; | ||||
| import com.ruoyi.common.security.utils.SecurityUtils; | import com.ruoyi.common.security.utils.SecurityUtils; | ||||
| import com.ruoyi.platform.domain.CodeConfig; | import com.ruoyi.platform.domain.CodeConfig; | ||||
| @@ -204,20 +206,22 @@ public class DevEnvironmentServiceImpl implements DevEnvironmentService { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| private void cloneCodePath(Map<String, Object> codeMap) { | private void cloneCodePath(Map<String, Object> codeMap) { | ||||
| CodeConfig codeConfig = BeanUtil.copyProperties(codeMap, CodeConfig.class); | |||||
| if (CollectionUtil.isEmpty(codeMap)) { | |||||
| return; | |||||
| } | |||||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | LoginUser loginUser = SecurityUtils.getLoginUser(); | ||||
| String gitLinkUsername = loginUser.getSysUser().getUserName(); | String gitLinkUsername = loginUser.getSysUser().getUserName(); | ||||
| String ci4sUsername = Boolean.TRUE.equals(codeConfig.getIsPublic()) ? Constant.Item_Public : loginUser.getUsername(); | |||||
| String ci4sUsername = Boolean.TRUE.equals(codeMap.get("is_public")) ? Constant.Item_Public : loginUser.getUsername(); | |||||
| String gitLinkPassword = decrypt(loginUser.getSysUser().getOriginPassword()); | String gitLinkPassword = decrypt(loginUser.getSysUser().getOriginPassword()); | ||||
| String repositoryName = ci4sUsername + "_code_" + DateUtils.dateTimeNow(); | String repositoryName = ci4sUsername + "_code_" + DateUtils.dateTimeNow(); | ||||
| String relatePath = ci4sUsername + "/code/" + repositoryName + "/" + codeConfig.getGitBranch(); | |||||
| String relatePath = ci4sUsername + "/code/" + repositoryName + "/" + codeMap.get("branch"); | |||||
| String localPath = localPathlocal + relatePath; | String localPath = localPathlocal + relatePath; | ||||
| try { | try { | ||||
| dvcUtils.gitClone(localPath, codeConfig.getGitUrl(), codeConfig.getGitBranch(), gitLinkUsername, gitLinkPassword); | |||||
| dvcUtils.gitClone(localPath, StrUtil.toString(codeMap.get(" code_path")), StrUtil.toString(codeMap.get(" branch")), gitLinkUsername, gitLinkPassword); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| log.error("[returnCodeConfig error,e={},codeConfigId={}]", e.getMessage(), codeConfig.getId()); | |||||
| log.error("[returnCodeConfig error,e={},codeConfigId={}]", e.getMessage(), codeMap.get("id")); | |||||
| } | } | ||||
| codeMap.put("path", localPath); | codeMap.put("path", localPath); | ||||
| } | } | ||||