feat(制品库功能开发): 优化代码结构
This commit is contained in:
parent
3760704998
commit
63d45c39e7
|
|
@ -9,7 +9,7 @@ import com.microservices.common.log.enums.BusinessType;
|
|||
import com.microservices.pms.productLibrary.domain.ProductLibraryRepositoriesFormatEnum;
|
||||
import com.microservices.pms.productLibrary.domain.vo.*;
|
||||
import com.microservices.pms.productLibrary.service.IPmsProductLibraryComponentService;
|
||||
import com.microservices.pms.productLibrary.service.IPmsProductLibraryRepositoriesService;
|
||||
import com.microservices.pms.productLibrary.service.IPmsProductLibraryProductRepoService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
|
@ -31,7 +31,7 @@ import java.util.List;
|
|||
})
|
||||
public class PmsProductLibraryController extends BaseController {
|
||||
@Autowired
|
||||
private IPmsProductLibraryRepositoriesService pmsProductLibraryRepositoriesService;
|
||||
private IPmsProductLibraryProductRepoService pmsProductLibraryProductRepoService;
|
||||
@Autowired
|
||||
private IPmsProductLibraryComponentService pmsProductLibraryComponentService;
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ public class PmsProductLibraryController extends BaseController {
|
|||
@ApiOperation(value = "获取产品库详情")
|
||||
public GenericsAjaxResult<PmsProductLibraryRepositoriesDataVo> getByRepoName(@PathVariable String enterpriseIdentifier,
|
||||
@ApiParam(value = "产品库名称", required = true) @PathVariable String repoName) {
|
||||
return GenericsAjaxResult.success(pmsProductLibraryRepositoriesService.selectPmsProductLibraryDataByName(enterpriseIdentifier, repoName));
|
||||
return GenericsAjaxResult.success(pmsProductLibraryProductRepoService.selectPmsProductLibraryDataByName(enterpriseIdentifier, repoName));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -56,7 +56,7 @@ public class PmsProductLibraryController extends BaseController {
|
|||
@PathVariable String enterpriseIdentifier,
|
||||
@ApiParam("模糊搜索产品库名称") String name) {
|
||||
startPage();
|
||||
return pmsProductLibraryRepositoriesService.selectPmsProductLibraryPageList(enterpriseIdentifier, name);
|
||||
return pmsProductLibraryProductRepoService.selectPmsProductLibraryPageList(enterpriseIdentifier, name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -69,7 +69,7 @@ public class PmsProductLibraryController extends BaseController {
|
|||
public AjaxResult addProduct(@PathVariable String enterpriseIdentifier,
|
||||
@Valid @RequestBody ProductRepositoriesInputVo productRepositoriesInputVo) {
|
||||
productRepositoriesInputVo.setEnterpriseIdentifier(enterpriseIdentifier);
|
||||
return toAjax(pmsProductLibraryRepositoriesService.insertPmsProductLibrary(productRepositoriesInputVo));
|
||||
return toAjax(pmsProductLibraryProductRepoService.insertPmsProductLibrary(productRepositoriesInputVo));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -84,7 +84,7 @@ public class PmsProductLibraryController extends BaseController {
|
|||
@Valid @RequestBody ProductRepositoriesOperateVo productRepositoriesOperateVo) {
|
||||
productRepositoriesOperateVo.setEnterpriseIdentifier(enterpriseIdentifier);
|
||||
productRepositoriesOperateVo.setName(name);
|
||||
return toAjax(pmsProductLibraryRepositoriesService.updatePmsProductLibrary(productRepositoriesOperateVo));
|
||||
return toAjax(pmsProductLibraryProductRepoService.updatePmsProductLibrary(productRepositoriesOperateVo));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -96,7 +96,7 @@ public class PmsProductLibraryController extends BaseController {
|
|||
@ApiOperation(value = "删除产品库")
|
||||
public AjaxResult remove(@PathVariable String enterpriseIdentifier,
|
||||
@ApiParam(value = "产品库名称", required = true) @PathVariable String name) {
|
||||
return toAjax(pmsProductLibraryRepositoriesService.deletePmsProductLibraryByName(enterpriseIdentifier, name));
|
||||
return toAjax(pmsProductLibraryProductRepoService.deletePmsProductLibraryByName(enterpriseIdentifier, name));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -245,7 +245,7 @@ public class PmsProductLibraryController extends BaseController {
|
|||
@ApiOperation(value = "制品库查询关键制品列表")
|
||||
public AjaxResult keyComponentList(@PathVariable String enterpriseIdentifier, @Valid ComponentSearchVo componentSearchVo) {
|
||||
NexusComponentResultVo<List<NexusResultDataVo>> result =
|
||||
pmsProductLibraryComponentService.selectPmsProductLibraryKeyComponentList(enterpriseIdentifier, componentSearchVo);
|
||||
pmsProductLibraryProductRepoService.selectPmsProductLibraryKeyComponentList(enterpriseIdentifier, componentSearchVo);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
|
|
@ -263,6 +263,6 @@ public class PmsProductLibraryController extends BaseController {
|
|||
commonAssetAddToProductRepoVo.setEnterpriseIdentifier(enterpriseIdentifier);
|
||||
commonAssetAddToProductRepoVo.setProductRepoName(productRepoName);
|
||||
commonAssetAddToProductRepoVo.setRepoName(repoName);
|
||||
return toAjax(pmsProductLibraryComponentService.addCommonAssetToProductRepo(commonAssetAddToProductRepoVo));
|
||||
return toAjax(pmsProductLibraryProductRepoService.addCommonAssetToProductRepo(commonAssetAddToProductRepoVo));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.microservices.pms.productLibrary.service;
|
||||
|
||||
import com.microservices.pms.productLibrary.domain.PmsProductLibraryComponent;
|
||||
import com.microservices.pms.productLibrary.domain.PmsProductLibraryRepositories;
|
||||
import com.microservices.pms.productLibrary.domain.vo.*;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -111,22 +112,7 @@ public interface IPmsProductLibraryComponentService {
|
|||
|
||||
NexusComponentResultVo<Object> deleteFolderByNode(String enterpriseIdentifier, ComponentSearchVo componentSearchVo, boolean isProduct);
|
||||
|
||||
/**
|
||||
* 查询关键制品列表
|
||||
*
|
||||
* @param enterpriseIdentifier 企业标识
|
||||
* @param componentSearchVo 查询条件
|
||||
* @return 制品列表
|
||||
*/
|
||||
NexusComponentResultVo<List<NexusResultDataVo>> selectPmsProductLibraryKeyComponentList(String enterpriseIdentifier, ComponentSearchVo componentSearchVo);
|
||||
|
||||
/**
|
||||
* 选择普通制品移入产品库
|
||||
*
|
||||
* @param commonAssetAddToProductRepoVo 普通制品移入产品库对象
|
||||
* @return 移入状态
|
||||
*/
|
||||
boolean addCommonAssetToProductRepo(CommonAssetAddToProductRepoVo commonAssetAddToProductRepoVo);
|
||||
|
||||
/**
|
||||
* 在数据库中查找制品文件列表
|
||||
|
|
@ -134,4 +120,6 @@ public interface IPmsProductLibraryComponentService {
|
|||
* @return 制品文件列表
|
||||
*/
|
||||
List<PmsProductLibraryComponent> selectPmsProductLibraryComponentListByDatabase(Long repoId);
|
||||
|
||||
PmsProductLibraryRepositories getPmsProductLibraryRepositories(Boolean isProduct, String enterpriseIdentifier, String repositoryName, String snapshotName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,77 @@
|
|||
package com.microservices.pms.productLibrary.service;
|
||||
|
||||
import com.microservices.common.core.web.page.GenericsTableDataInfo;
|
||||
import com.microservices.pms.productLibrary.domain.PmsProductLibraryRepositories;
|
||||
import com.microservices.pms.productLibrary.domain.vo.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author OTTO
|
||||
*/
|
||||
public interface IPmsProductLibraryProductRepoService {
|
||||
|
||||
PmsProductLibraryRepositoriesDataVo selectPmsProductLibraryDataByName(String enterpriseIdentifier, String repoName);
|
||||
|
||||
/**
|
||||
* 根据组织标识和名称查找产品库
|
||||
*
|
||||
* @param enterpriseIdentifier 组织标识
|
||||
* @param repoName 产品库名称
|
||||
* @return 产品库
|
||||
*/
|
||||
PmsProductLibraryRepositories selectPmsProductLibraryByName(String enterpriseIdentifier, String repoName);
|
||||
|
||||
|
||||
/**
|
||||
* 查询产品库列表
|
||||
*
|
||||
* @param enterpriseIdentifier 企业标识
|
||||
* @param name 产品库名称
|
||||
* @return 产品库列表
|
||||
*/
|
||||
GenericsTableDataInfo<PmsProductLibrarySimpleVo> selectPmsProductLibraryPageList(String enterpriseIdentifier, String name);
|
||||
|
||||
|
||||
/**
|
||||
* 创建产品库
|
||||
*
|
||||
* @param productRepositoriesInputVo 产品库输入对象
|
||||
* @return 结果
|
||||
*/
|
||||
int insertPmsProductLibrary(ProductRepositoriesInputVo productRepositoriesInputVo);
|
||||
|
||||
/**
|
||||
* 更新产品库
|
||||
*
|
||||
* @param productRepositoriesOperateVo 产品库操作对象
|
||||
* @return 结果
|
||||
*/
|
||||
int updatePmsProductLibrary(ProductRepositoriesOperateVo productRepositoriesOperateVo);
|
||||
|
||||
/**
|
||||
* 删除产品库
|
||||
*
|
||||
* @param enterpriseIdentifier 组织标识
|
||||
* @param name 产品库名称
|
||||
* @return 产品库
|
||||
*/
|
||||
int deletePmsProductLibraryByName(String enterpriseIdentifier, String name);
|
||||
|
||||
/**
|
||||
* 选择普通制品移入产品库
|
||||
*
|
||||
* @param commonAssetAddToProductRepoVo 普通制品移入产品库对象
|
||||
* @return 移入状态
|
||||
*/
|
||||
boolean addCommonAssetToProductRepo(CommonAssetAddToProductRepoVo commonAssetAddToProductRepoVo);
|
||||
|
||||
/**
|
||||
* 查询关键制品列表
|
||||
*
|
||||
* @param enterpriseIdentifier 企业标识
|
||||
* @param componentSearchVo 查询条件
|
||||
* @return 制品列表
|
||||
*/
|
||||
NexusComponentResultVo<List<NexusResultDataVo>> selectPmsProductLibraryKeyComponentList(String enterpriseIdentifier, ComponentSearchVo componentSearchVo);
|
||||
}
|
||||
|
|
@ -85,15 +85,6 @@ public interface IPmsProductLibraryRepositoriesService {
|
|||
*/
|
||||
PmsProductLibraryRepositories selectPmsProductLibraryRepositoriesByName(String enterpriseIdentifier, String repoName);
|
||||
|
||||
/**
|
||||
* 根据组织标识和名称查找产品库
|
||||
*
|
||||
* @param enterpriseIdentifier 组织标识
|
||||
* @param repoName 产品库名称
|
||||
* @return 产品库
|
||||
*/
|
||||
PmsProductLibraryRepositories selectPmsProductLibraryByName(String enterpriseIdentifier, String repoName);
|
||||
|
||||
/**
|
||||
* 创建虚拟仓库
|
||||
*
|
||||
|
|
@ -110,40 +101,6 @@ public interface IPmsProductLibraryRepositoriesService {
|
|||
*/
|
||||
int updateGroupPmsProductLibraryRepositories(GroupRepositoriesOperateVo groupRepositoriesOperateVo);
|
||||
|
||||
/**
|
||||
* 查询产品库列表
|
||||
*
|
||||
* @param enterpriseIdentifier 企业标识
|
||||
* @param name 产品库名称
|
||||
* @return 产品库列表
|
||||
*/
|
||||
GenericsTableDataInfo<PmsProductLibrarySimpleVo> selectPmsProductLibraryPageList(String enterpriseIdentifier, String name);
|
||||
|
||||
/**
|
||||
* 创建产品库
|
||||
*
|
||||
* @param productRepositoriesInputVo 产品库输入对象
|
||||
* @return 结果
|
||||
*/
|
||||
int insertPmsProductLibrary(ProductRepositoriesInputVo productRepositoriesInputVo);
|
||||
|
||||
/**
|
||||
* 更新产品库
|
||||
*
|
||||
* @param productRepositoriesOperateVo 产品库操作对象
|
||||
* @return 结果
|
||||
*/
|
||||
int updatePmsProductLibrary(ProductRepositoriesOperateVo productRepositoriesOperateVo);
|
||||
|
||||
/**
|
||||
* 删除产品库
|
||||
*
|
||||
* @param enterpriseIdentifier 组织标识
|
||||
* @param name 产品库名称
|
||||
* @return 产品库
|
||||
*/
|
||||
int deletePmsProductLibraryByName(String enterpriseIdentifier, String name);
|
||||
|
||||
/**
|
||||
* 根据制品库名称获取制品库详情
|
||||
*
|
||||
|
|
@ -153,8 +110,6 @@ public interface IPmsProductLibraryRepositoriesService {
|
|||
*/
|
||||
PmsProductLibraryRepositoriesDataVo selectPmsProductLibraryRepositoriesDataByName(String enterpriseIdentifier, String repoName);
|
||||
|
||||
PmsProductLibraryRepositoriesDataVo selectPmsProductLibraryDataByName(String enterpriseIdentifier, String repoName);
|
||||
|
||||
|
||||
void checkLockRepositoryStatus(String enterpriseIdentifier, Long repoId);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,10 +14,7 @@ import com.microservices.pms.productLibrary.domain.PmsProductLibraryRepositories
|
|||
import com.microservices.pms.productLibrary.domain.ProductLibraryRepositoriesFormatEnum;
|
||||
import com.microservices.pms.productLibrary.domain.vo.*;
|
||||
import com.microservices.pms.productLibrary.mapper.PmsProductLibraryComponentMapper;
|
||||
import com.microservices.pms.productLibrary.service.IPmsProductLibraryAsyncService;
|
||||
import com.microservices.pms.productLibrary.service.IPmsProductLibraryComponentService;
|
||||
import com.microservices.pms.productLibrary.service.IPmsProductLibraryRepositoriesService;
|
||||
import com.microservices.pms.productLibrary.service.IPmsProductLibrarySnapshotRepoService;
|
||||
import com.microservices.pms.productLibrary.service.*;
|
||||
import com.microservices.pms.utils.NexusRequestHelper;
|
||||
import com.microservices.pms.utils.NexusRequestUrl;
|
||||
import com.microservices.system.api.RemoteFileService;
|
||||
|
|
@ -26,6 +23,7 @@ import com.microservices.system.api.utils.FeignUtils;
|
|||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
|
@ -45,6 +43,9 @@ public class PmsProductLibraryComponentServiceImpl implements IPmsProductLibrary
|
|||
@Autowired
|
||||
private IPmsProductLibraryRepositoriesService pmsProductLibraryRepositoriesService;
|
||||
@Autowired
|
||||
@Lazy
|
||||
private IPmsProductLibraryProductRepoService pmsProductLibraryProductRepoService;
|
||||
@Autowired
|
||||
private IPmsProductLibrarySnapshotRepoService pmsProductLibrarySnapshotRepoService;
|
||||
@Autowired
|
||||
private RemoteFileService fileService;
|
||||
|
|
@ -66,11 +67,12 @@ public class PmsProductLibraryComponentServiceImpl implements IPmsProductLibrary
|
|||
return pmsProductLibraryComponentMapper.selectPmsProductLibraryComponentById(id);
|
||||
}
|
||||
|
||||
private PmsProductLibraryRepositories getPmsProductLibraryRepositories(Boolean isProduct, String enterpriseIdentifier, String repoName, String snapshotName) {
|
||||
@Override
|
||||
public PmsProductLibraryRepositories getPmsProductLibraryRepositories(Boolean isProduct, String enterpriseIdentifier, String repoName, String snapshotName) {
|
||||
PmsProductLibraryRepositories pmsProductLibraryRepositories;
|
||||
if (isProduct) {
|
||||
pmsProductLibraryRepositories =
|
||||
pmsProductLibraryRepositoriesService.selectPmsProductLibraryByName(enterpriseIdentifier, repoName);
|
||||
pmsProductLibraryProductRepoService.selectPmsProductLibraryByName(enterpriseIdentifier, repoName);
|
||||
} else {
|
||||
if (StringUtils.isNotEmpty(snapshotName)) {
|
||||
pmsProductLibraryRepositories =
|
||||
|
|
@ -106,127 +108,6 @@ public class PmsProductLibraryComponentServiceImpl implements IPmsProductLibrary
|
|||
);
|
||||
}
|
||||
|
||||
private NexusComponentResultVo<List<NexusResultDataVo>> buildDockerResultVo(List<NexusResultDataVo> data) {
|
||||
NexusComponentResultVo<List<NexusResultDataVo>> target = new NexusComponentResultVo<>();
|
||||
target.setAction("coreui_Browse");
|
||||
target.setMethod("read");
|
||||
target.setTid(1);
|
||||
target.setType("rpc");
|
||||
NexusComponentResultStateVo<List<NexusResultDataVo>> nexusComponentResultStateVo = new NexusComponentResultStateVo<List<NexusResultDataVo>>();
|
||||
nexusComponentResultStateVo.setData(data);
|
||||
nexusComponentResultStateVo.setSuccess(true);
|
||||
target.setResult(nexusComponentResultStateVo);
|
||||
return target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NexusComponentResultVo<List<NexusResultDataVo>> selectPmsProductLibraryKeyComponentList(String enterpriseIdentifier, ComponentSearchVo componentSearchVo) {
|
||||
PmsProductLibraryRepositories repo =
|
||||
getPmsProductLibraryRepositories(false, enterpriseIdentifier, componentSearchVo.getRepositoryName(), null);
|
||||
componentSearchVo.setRepositoryName(repo.getNexusRepositoriesName());
|
||||
// Docker类型调用Nexus获取制品列表接口获取
|
||||
if (ProductLibraryRepositoriesFormatEnum.DOCKER.getKey().equals(repo.getFormat())) {
|
||||
List<NexusResultDataVo> keyNexusResultDataVoList = new ArrayList<>();
|
||||
// 需循环遍历获取所有镜像列表
|
||||
boolean isAll = false;
|
||||
// Nexus分页Token
|
||||
String continuationToken = null;
|
||||
while (!isAll) {
|
||||
NexusComponentAndAssetListVo<NexusDockerComponentVo> assetListVo = nexusRequestHelper.doRequestToJavaObject(
|
||||
NexusRequestUrl.GET_COMPONENTS(repo.getNexusRepositoriesName(), continuationToken),
|
||||
NexusComponentAndAssetListVo.class,
|
||||
NexusDockerComponentVo.class);
|
||||
if (assetListVo != null) {
|
||||
if (StringUtils.isEmpty(assetListVo.getContinuationToken())) {
|
||||
isAll = true;
|
||||
} else {
|
||||
continuationToken = assetListVo.getContinuationToken();
|
||||
}
|
||||
for (NexusDockerComponentVo nexusDockerComponentVo : assetListVo.getItems()) {
|
||||
NexusResultDataVo nexusResultDataVo = nexusDockerComponentVo.toNexusResultDataVo();
|
||||
keyNexusResultDataVoList.add(nexusResultDataVo);
|
||||
}
|
||||
} else {
|
||||
isAll = true;
|
||||
}
|
||||
|
||||
}
|
||||
return buildDockerResultVo(keyNexusResultDataVoList);
|
||||
} else {
|
||||
NexusComponentSearchVo<ComponentSearchVo> nexusComponentSearchVo = NexusComponentSearchVo.toRead(componentSearchVo, nexusRequestHelper.getNexusTid());
|
||||
NexusComponentResultVo<List<NexusResultDataVo>> assetResultDataVo = nexusRequestHelper.doRequestToJavaObjectList(
|
||||
NexusRequestUrl.DO_OPERATION(),
|
||||
JSONObject.from(nexusComponentSearchVo),
|
||||
NexusComponentResultVo.class,
|
||||
NexusResultDataVo.class
|
||||
);
|
||||
if (assetResultDataVo != null && assetResultDataVo.getResult() != null) {
|
||||
NexusComponentResultStateVo<List<NexusResultDataVo>> nexusComponentResultStateVo = assetResultDataVo.getResult();
|
||||
if (nexusComponentResultStateVo.getSuccess()) {
|
||||
List<NexusResultDataVo> nexusResultDataVoList = nexusComponentResultStateVo.getData();
|
||||
// 当制品库为Maven时,需排除自动生成的制品数据
|
||||
if (ProductLibraryRepositoriesFormatEnum.MAVEN.getKey().equals(repo.getFormat())) {
|
||||
List<NexusResultDataVo> keyNexusResultDataVoList = new ArrayList<>();
|
||||
for (NexusResultDataVo nexusResultDataVo : nexusResultDataVoList) {
|
||||
// 当类型为asset时,需检查数据库是否存在记录,若存在则返回
|
||||
if ("asset".equals(nexusResultDataVo.getType())) {
|
||||
PmsProductLibraryComponent pmsProductLibraryComponent =
|
||||
pmsProductLibraryComponentMapper.selectPmsProductLibraryComponentByPath(
|
||||
nexusResultDataVo.getId(),
|
||||
repo.getId(),
|
||||
repo.getPmsEnterpriseId()
|
||||
);
|
||||
if (pmsProductLibraryComponent != null) {
|
||||
keyNexusResultDataVoList.add(nexusResultDataVo);
|
||||
}
|
||||
} else {
|
||||
keyNexusResultDataVoList.add(nexusResultDataVo);
|
||||
}
|
||||
}
|
||||
nexusComponentResultStateVo.setData(keyNexusResultDataVoList);
|
||||
assetResultDataVo.setResult(nexusComponentResultStateVo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return assetResultDataVo;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addCommonAssetToProductRepo(CommonAssetAddToProductRepoVo commonAssetAddToProductRepoVo) {
|
||||
// 先校验产品库、制品库、制品库下制品Id列表是否存在,再进行异步处理
|
||||
PmsProductLibraryRepositories productRepo =
|
||||
pmsProductLibraryRepositoriesService.selectPmsProductLibraryByName(
|
||||
commonAssetAddToProductRepoVo.getEnterpriseIdentifier(),
|
||||
commonAssetAddToProductRepoVo.getProductRepoName());
|
||||
PmsProductLibraryRepositories repo =
|
||||
pmsProductLibraryRepositoriesService.selectPmsProductLibraryRepositoriesByName(
|
||||
commonAssetAddToProductRepoVo.getEnterpriseIdentifier(),
|
||||
commonAssetAddToProductRepoVo.getRepoName());
|
||||
if (ProductLibraryRepositoriesFormatEnum.DOCKER.getKey().equals(repo.getFormat())) {
|
||||
throw new ServiceException("Docker制品移入不能使用该接口");
|
||||
}
|
||||
List<NexusAssetResultDataVo> nexusAssetResultDataVoList = new ArrayList<>();
|
||||
for (String assetId : commonAssetAddToProductRepoVo.getAssetIdList()) {
|
||||
NexusComponentResultVo<NexusAssetResultDataVo> nexusAssetResultVo = getAssetDetailByAssetId(
|
||||
commonAssetAddToProductRepoVo.getEnterpriseIdentifier(),
|
||||
commonAssetAddToProductRepoVo.getRepoName(),
|
||||
null,
|
||||
assetId,
|
||||
false
|
||||
);
|
||||
if (nexusAssetResultVo == null || nexusAssetResultVo.getResult() == null || !nexusAssetResultVo.getResult().getSuccess()) {
|
||||
throw new ServiceException("该制品不存在(制品库[%s],制品Id[%s])", commonAssetAddToProductRepoVo.getRepoName(), assetId);
|
||||
} else {
|
||||
nexusAssetResultDataVoList.add(nexusAssetResultVo.getResult().getData());
|
||||
}
|
||||
}
|
||||
pmsProductLibraryAsyncService.asyncAddCommonAssetToProductRepo(productRepo, repo, nexusAssetResultDataVoList);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PmsProductLibraryComponent> selectPmsProductLibraryComponentListByDatabase(Long repoId) {
|
||||
PmsProductLibraryComponent componentSearch = new PmsProductLibraryComponent();
|
||||
|
|
@ -702,9 +583,10 @@ public class PmsProductLibraryComponentServiceImpl implements IPmsProductLibrary
|
|||
for (AssetMavenInputVo assetMavenInputVo : componentMavenInputVo.getAssetList()) {
|
||||
JSONObject assetJSON = JSONObject.from(assetMavenInputVo);
|
||||
if (assetMavenInputVo.getFileBytes() != null) {
|
||||
bodyLog.put("fileName", assetMavenInputVo.getFileBytes().getFileName());
|
||||
bodyLog.remove("fileBytes");
|
||||
assetJSON.put("fileName", assetMavenInputVo.getFileBytes().getFileName());
|
||||
assetJSON.remove("fileBytes");
|
||||
}
|
||||
assetJsonList.add(assetJSON);
|
||||
}
|
||||
bodyLog.put("assetList", assetJsonList);
|
||||
return bodyLog;
|
||||
|
|
@ -716,9 +598,10 @@ public class PmsProductLibraryComponentServiceImpl implements IPmsProductLibrary
|
|||
for (AssetRawInputVo assetRawInputVo : componentRawInputVo.getAssetList()) {
|
||||
JSONObject assetJSON = JSONObject.from(assetRawInputVo);
|
||||
if (assetRawInputVo.getFileBytes() != null) {
|
||||
bodyLog.put("fileName", assetRawInputVo.getFileBytes().getFileName());
|
||||
bodyLog.remove("fileBytes");
|
||||
assetJSON.put("fileName", assetRawInputVo.getFileBytes().getFileName());
|
||||
assetJSON.remove("fileBytes");
|
||||
}
|
||||
assetJsonList.add(assetJSON);
|
||||
}
|
||||
bodyLog.put("assetList", assetJsonList);
|
||||
return bodyLog;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,255 @@
|
|||
package com.microservices.pms.productLibrary.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.common.core.exception.ServiceException;
|
||||
import com.microservices.common.core.utils.DateUtils;
|
||||
import com.microservices.common.core.utils.PageUtils;
|
||||
import com.microservices.common.core.utils.StringUtils;
|
||||
import com.microservices.common.core.web.page.GenericsTableDataInfo;
|
||||
import com.microservices.common.security.utils.SecurityUtils;
|
||||
import com.microservices.pms.enterprise.domain.PmsEnterprise;
|
||||
import com.microservices.pms.enterprise.service.IPmsEnterpriseService;
|
||||
import com.microservices.pms.productLibrary.domain.PmsProductLibraryComponent;
|
||||
import com.microservices.pms.productLibrary.domain.PmsProductLibraryRepositories;
|
||||
import com.microservices.pms.productLibrary.domain.ProductLibraryRepositoriesFormatEnum;
|
||||
import com.microservices.pms.productLibrary.domain.vo.*;
|
||||
import com.microservices.pms.productLibrary.mapper.PmsProductLibraryComponentMapper;
|
||||
import com.microservices.pms.productLibrary.mapper.PmsProductLibraryRepositoriesMapper;
|
||||
import com.microservices.pms.productLibrary.service.IPmsProductLibraryAsyncService;
|
||||
import com.microservices.pms.productLibrary.service.IPmsProductLibraryComponentService;
|
||||
import com.microservices.pms.productLibrary.service.IPmsProductLibraryProductRepoService;
|
||||
import com.microservices.pms.productLibrary.service.IPmsProductLibraryRepositoriesService;
|
||||
import com.microservices.pms.utils.NexusRequestHelper;
|
||||
import com.microservices.pms.utils.NexusRequestUrl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author OTTO
|
||||
*/
|
||||
@Service
|
||||
public class PmsProductLibraryProductRepoServiceImpl implements IPmsProductLibraryProductRepoService {
|
||||
|
||||
@Autowired
|
||||
private PmsProductLibraryRepositoriesMapper pmsProductLibraryRepositoriesMapper;
|
||||
@Autowired
|
||||
private PmsProductLibraryComponentMapper pmsProductLibraryComponentMapper;
|
||||
@Autowired
|
||||
private NexusRequestHelper nexusRequestHelper;
|
||||
@Autowired
|
||||
private IPmsEnterpriseService pmsEnterpriseService;
|
||||
@Autowired
|
||||
private IPmsProductLibraryAsyncService pmsProductLibraryAsyncService;
|
||||
@Autowired
|
||||
private IPmsProductLibraryComponentService pmsProductLibraryComponentService;
|
||||
@Autowired
|
||||
private IPmsProductLibraryRepositoriesService pmsProductLibraryRepositoriesService;
|
||||
|
||||
@Override
|
||||
public PmsProductLibraryRepositoriesDataVo selectPmsProductLibraryDataByName(String enterpriseIdentifier, String repoName) {
|
||||
PmsProductLibraryRepositories pmsProductLibraryRepositories =
|
||||
selectPmsProductLibraryByName(enterpriseIdentifier, repoName);
|
||||
return pmsProductLibraryRepositories.toPmsProductLibraryRepositoriesDataVo();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PmsProductLibraryRepositories selectPmsProductLibraryByName(String enterpriseIdentifier, String name) {
|
||||
PmsProductLibraryRepositories pmsProductLibraryRepositories =
|
||||
pmsProductLibraryRepositoriesMapper.selectPmsProductLibraryByName(enterpriseIdentifier, name);
|
||||
if (pmsProductLibraryRepositories == null) {
|
||||
throw new ServiceException("组织下不存在该产品库(组织标识[%s],产品库名称[%s])", enterpriseIdentifier, name);
|
||||
}
|
||||
return pmsProductLibraryRepositories;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GenericsTableDataInfo<PmsProductLibrarySimpleVo> selectPmsProductLibraryPageList(String enterpriseIdentifier, String name) {
|
||||
return PageUtils.toPage(
|
||||
pmsProductLibraryRepositoriesMapper.selectPmsProductLibraryList(enterpriseIdentifier, name),
|
||||
PmsProductLibraryRepositories::toPmsProductLibrarySimpleVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updatePmsProductLibrary(ProductRepositoriesOperateVo productRepositoriesOperateVo) {
|
||||
PmsProductLibraryRepositories oldRepo = selectPmsProductLibraryByName(
|
||||
productRepositoriesOperateVo.getEnterpriseIdentifier(),
|
||||
productRepositoriesOperateVo.getName());
|
||||
// 构建更新对象
|
||||
PmsProductLibraryRepositories pmsProductLibraryRepositories = productRepositoriesOperateVo.toPmsProductLibraryRepositories();
|
||||
pmsProductLibraryRepositories.setId(oldRepo.getId());
|
||||
pmsProductLibraryRepositories.setUpdateTime(DateUtils.getNowDate());
|
||||
pmsProductLibraryRepositories.setUpdateBy(SecurityUtils.getUsername());
|
||||
NexusHostedRepoInputVo requestBody = productRepositoriesOperateVo.toNexusRepoDataVo();
|
||||
|
||||
// 调用制品库更新接口更新制品库
|
||||
nexusRequestHelper.doRequest(
|
||||
NexusRequestUrl.UPDATE_REPOSITORIES(
|
||||
requestBody.getType(),
|
||||
requestBody.getFormat(),
|
||||
requestBody.getName()),
|
||||
JSONObject.from(requestBody)
|
||||
);
|
||||
|
||||
return pmsProductLibraryRepositoriesMapper.updatePmsProductLibraryRepositories(pmsProductLibraryRepositories);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int insertPmsProductLibrary(ProductRepositoriesInputVo productRepositoriesInputVo) {
|
||||
PmsEnterprise pmsEnterprise = pmsEnterpriseService.selectPmsEnterpriseByIdentifier(productRepositoriesInputVo.getEnterpriseIdentifier());
|
||||
// 校验制品库名称
|
||||
Integer count = pmsProductLibraryRepositoriesMapper.selectPmsProductLibraryRepositoriesByNameCount(
|
||||
productRepositoriesInputVo.getName(), productRepositoriesInputVo.getEnterpriseIdentifier(), productRepositoriesInputVo.getFormat());
|
||||
if (count > 0) {
|
||||
throw new ServiceException("该产品库名称在当前企业下已存在(产品库名称[%s])", productRepositoriesInputVo.getName());
|
||||
}
|
||||
NexusHostedRepoInputVo requestBody = productRepositoriesInputVo.toNexusRepoDataVo();
|
||||
|
||||
// 调用制品库创建接口创建产品库
|
||||
nexusRequestHelper.doRequest(
|
||||
NexusRequestUrl.ADD_REPOSITORIES(
|
||||
requestBody.getType(),
|
||||
requestBody.getFormat()),
|
||||
JSONObject.from(requestBody)
|
||||
);
|
||||
// 数据库添加该制品库
|
||||
PmsProductLibraryRepositories pmsProductLibraryRepositories = productRepositoriesInputVo.toPmsProductLibraryRepositories();
|
||||
pmsProductLibraryRepositories.setPmsEnterpriseId(pmsEnterprise.getId());
|
||||
pmsProductLibraryRepositories.setDeptId(pmsEnterprise.getDeptId());
|
||||
pmsProductLibraryRepositories.setCreateTime(DateUtils.getNowDate());
|
||||
pmsProductLibraryRepositories.setCreateBy(SecurityUtils.getUsername());
|
||||
return pmsProductLibraryRepositoriesMapper.insertPmsProductLibraryRepositories(pmsProductLibraryRepositories);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deletePmsProductLibraryByName(String enterpriseIdentifier, String name) {
|
||||
PmsProductLibraryRepositories oldRepo = selectPmsProductLibraryByName(enterpriseIdentifier, name);
|
||||
// 调用制品库删除接口删除制品库
|
||||
nexusRequestHelper.doRequest(
|
||||
NexusRequestUrl.DELETE_REPOSITORIES(PmsProductLibraryRepositories.getNexusProductRepositoriesName(enterpriseIdentifier, name))
|
||||
);
|
||||
return pmsProductLibraryRepositoriesMapper.deletePmsProductLibraryRepositoriesById(oldRepo.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addCommonAssetToProductRepo(CommonAssetAddToProductRepoVo commonAssetAddToProductRepoVo) {
|
||||
// 先校验产品库、制品库、制品库下制品Id列表是否存在,再进行异步处理
|
||||
PmsProductLibraryRepositories productRepo = selectPmsProductLibraryByName(
|
||||
commonAssetAddToProductRepoVo.getEnterpriseIdentifier(),
|
||||
commonAssetAddToProductRepoVo.getProductRepoName());
|
||||
PmsProductLibraryRepositories repo =
|
||||
pmsProductLibraryRepositoriesService.selectPmsProductLibraryRepositoriesByName(
|
||||
commonAssetAddToProductRepoVo.getEnterpriseIdentifier(),
|
||||
commonAssetAddToProductRepoVo.getRepoName());
|
||||
if (ProductLibraryRepositoriesFormatEnum.DOCKER.getKey().equals(repo.getFormat())) {
|
||||
throw new ServiceException("Docker制品移入不能使用该接口");
|
||||
}
|
||||
List<NexusAssetResultDataVo> nexusAssetResultDataVoList = new ArrayList<>();
|
||||
for (String assetId : commonAssetAddToProductRepoVo.getAssetIdList()) {
|
||||
NexusComponentResultVo<NexusAssetResultDataVo> nexusAssetResultVo = pmsProductLibraryComponentService.getAssetDetailByAssetId(
|
||||
commonAssetAddToProductRepoVo.getEnterpriseIdentifier(),
|
||||
commonAssetAddToProductRepoVo.getRepoName(),
|
||||
null,
|
||||
assetId,
|
||||
false
|
||||
);
|
||||
if (nexusAssetResultVo == null || nexusAssetResultVo.getResult() == null || !nexusAssetResultVo.getResult().getSuccess()) {
|
||||
throw new ServiceException("该制品不存在(制品库[%s],制品Id[%s])", commonAssetAddToProductRepoVo.getRepoName(), assetId);
|
||||
} else {
|
||||
nexusAssetResultDataVoList.add(nexusAssetResultVo.getResult().getData());
|
||||
}
|
||||
}
|
||||
pmsProductLibraryAsyncService.asyncAddCommonAssetToProductRepo(productRepo, repo, nexusAssetResultDataVoList);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NexusComponentResultVo<List<NexusResultDataVo>> selectPmsProductLibraryKeyComponentList(String enterpriseIdentifier, ComponentSearchVo componentSearchVo) {
|
||||
PmsProductLibraryRepositories repo =
|
||||
pmsProductLibraryComponentService.getPmsProductLibraryRepositories(false, enterpriseIdentifier, componentSearchVo.getRepositoryName(), null);
|
||||
componentSearchVo.setRepositoryName(repo.getNexusRepositoriesName());
|
||||
// Docker类型调用Nexus获取制品列表接口获取
|
||||
if (ProductLibraryRepositoriesFormatEnum.DOCKER.getKey().equals(repo.getFormat())) {
|
||||
List<NexusResultDataVo> keyNexusResultDataVoList = new ArrayList<>();
|
||||
// 需循环遍历获取所有镜像列表
|
||||
boolean isAll = false;
|
||||
// Nexus分页Token
|
||||
String continuationToken = null;
|
||||
while (!isAll) {
|
||||
NexusComponentAndAssetListVo<NexusDockerComponentVo> assetListVo = nexusRequestHelper.doRequestToJavaObject(
|
||||
NexusRequestUrl.GET_COMPONENTS(repo.getNexusRepositoriesName(), continuationToken),
|
||||
NexusComponentAndAssetListVo.class,
|
||||
NexusDockerComponentVo.class);
|
||||
if (assetListVo != null) {
|
||||
if (StringUtils.isEmpty(assetListVo.getContinuationToken())) {
|
||||
isAll = true;
|
||||
} else {
|
||||
continuationToken = assetListVo.getContinuationToken();
|
||||
}
|
||||
for (NexusDockerComponentVo nexusDockerComponentVo : assetListVo.getItems()) {
|
||||
NexusResultDataVo nexusResultDataVo = nexusDockerComponentVo.toNexusResultDataVo();
|
||||
keyNexusResultDataVoList.add(nexusResultDataVo);
|
||||
}
|
||||
} else {
|
||||
isAll = true;
|
||||
}
|
||||
|
||||
}
|
||||
return buildDockerResultVo(keyNexusResultDataVoList);
|
||||
} else {
|
||||
NexusComponentSearchVo<ComponentSearchVo> nexusComponentSearchVo = NexusComponentSearchVo.toRead(componentSearchVo, nexusRequestHelper.getNexusTid());
|
||||
NexusComponentResultVo<List<NexusResultDataVo>> assetResultDataVo = nexusRequestHelper.doRequestToJavaObjectList(
|
||||
NexusRequestUrl.DO_OPERATION(),
|
||||
JSONObject.from(nexusComponentSearchVo),
|
||||
NexusComponentResultVo.class,
|
||||
NexusResultDataVo.class
|
||||
);
|
||||
if (assetResultDataVo != null && assetResultDataVo.getResult() != null) {
|
||||
NexusComponentResultStateVo<List<NexusResultDataVo>> nexusComponentResultStateVo = assetResultDataVo.getResult();
|
||||
if (nexusComponentResultStateVo.getSuccess()) {
|
||||
List<NexusResultDataVo> nexusResultDataVoList = nexusComponentResultStateVo.getData();
|
||||
// 当制品库为Maven时,需排除自动生成的制品数据
|
||||
if (ProductLibraryRepositoriesFormatEnum.MAVEN.getKey().equals(repo.getFormat())) {
|
||||
List<NexusResultDataVo> keyNexusResultDataVoList = new ArrayList<>();
|
||||
for (NexusResultDataVo nexusResultDataVo : nexusResultDataVoList) {
|
||||
// 当类型为asset时,需检查数据库是否存在记录,若存在则返回
|
||||
if ("asset".equals(nexusResultDataVo.getType())) {
|
||||
PmsProductLibraryComponent pmsProductLibraryComponent =
|
||||
pmsProductLibraryComponentMapper.selectPmsProductLibraryComponentByPath(
|
||||
nexusResultDataVo.getId(),
|
||||
repo.getId(),
|
||||
repo.getPmsEnterpriseId()
|
||||
);
|
||||
if (pmsProductLibraryComponent != null) {
|
||||
keyNexusResultDataVoList.add(nexusResultDataVo);
|
||||
}
|
||||
} else {
|
||||
keyNexusResultDataVoList.add(nexusResultDataVo);
|
||||
}
|
||||
}
|
||||
nexusComponentResultStateVo.setData(keyNexusResultDataVoList);
|
||||
assetResultDataVo.setResult(nexusComponentResultStateVo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return assetResultDataVo;
|
||||
}
|
||||
}
|
||||
|
||||
private NexusComponentResultVo<List<NexusResultDataVo>> buildDockerResultVo(List<NexusResultDataVo> data) {
|
||||
NexusComponentResultVo<List<NexusResultDataVo>> target = new NexusComponentResultVo<>();
|
||||
target.setAction("coreui_Browse");
|
||||
target.setMethod("read");
|
||||
target.setTid(1);
|
||||
target.setType("rpc");
|
||||
NexusComponentResultStateVo<List<NexusResultDataVo>> nexusComponentResultStateVo = new NexusComponentResultStateVo<List<NexusResultDataVo>>();
|
||||
nexusComponentResultStateVo.setData(data);
|
||||
nexusComponentResultStateVo.setSuccess(true);
|
||||
target.setResult(nexusComponentResultStateVo);
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
|
@ -48,16 +48,6 @@ public class PmsProductLibraryRepositoriesServiceImpl implements IPmsProductLibr
|
|||
return pmsProductLibraryRepositories;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PmsProductLibraryRepositories selectPmsProductLibraryByName(String enterpriseIdentifier, String name) {
|
||||
PmsProductLibraryRepositories pmsProductLibraryRepositories =
|
||||
pmsProductLibraryRepositoriesMapper.selectPmsProductLibraryByName(enterpriseIdentifier, name);
|
||||
if (pmsProductLibraryRepositories == null) {
|
||||
throw new ServiceException("组织下不存在该产品库(组织标识[%s],产品库名称[%s])", enterpriseIdentifier, name);
|
||||
}
|
||||
return pmsProductLibraryRepositories;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NexusHostedRepoInputVo getNexusRepo(String type, String format, String nexusRepoName) {
|
||||
NexusHostedRepoInputVo nexusRepo = nexusRequestHelper.doRequestToJavaObject(
|
||||
|
|
@ -121,34 +111,6 @@ public class PmsProductLibraryRepositoriesServiceImpl implements IPmsProductLibr
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int insertPmsProductLibrary(ProductRepositoriesInputVo productRepositoriesInputVo) {
|
||||
PmsEnterprise pmsEnterprise = pmsEnterpriseService.selectPmsEnterpriseByIdentifier(productRepositoriesInputVo.getEnterpriseIdentifier());
|
||||
// 校验制品库名称
|
||||
Integer count = pmsProductLibraryRepositoriesMapper.selectPmsProductLibraryRepositoriesByNameCount(
|
||||
productRepositoriesInputVo.getName(), productRepositoriesInputVo.getEnterpriseIdentifier(), productRepositoriesInputVo.getFormat());
|
||||
if (count > 0) {
|
||||
throw new ServiceException("该产品库名称在当前企业下已存在(产品库名称[%s])", productRepositoriesInputVo.getName());
|
||||
}
|
||||
NexusHostedRepoInputVo requestBody = productRepositoriesInputVo.toNexusRepoDataVo();
|
||||
|
||||
// 调用制品库创建接口创建产品库
|
||||
nexusRequestHelper.doRequest(
|
||||
NexusRequestUrl.ADD_REPOSITORIES(
|
||||
requestBody.getType(),
|
||||
requestBody.getFormat()),
|
||||
JSONObject.from(requestBody)
|
||||
);
|
||||
// 数据库添加该制品库
|
||||
PmsProductLibraryRepositories pmsProductLibraryRepositories = productRepositoriesInputVo.toPmsProductLibraryRepositories();
|
||||
pmsProductLibraryRepositories.setPmsEnterpriseId(pmsEnterprise.getId());
|
||||
pmsProductLibraryRepositories.setDeptId(pmsEnterprise.getDeptId());
|
||||
pmsProductLibraryRepositories.setCreateTime(DateUtils.getNowDate());
|
||||
pmsProductLibraryRepositories.setCreateBy(SecurityUtils.getUsername());
|
||||
return pmsProductLibraryRepositoriesMapper.insertPmsProductLibraryRepositories(pmsProductLibraryRepositories);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增制品库-仓库
|
||||
*
|
||||
|
|
@ -230,30 +192,6 @@ public class PmsProductLibraryRepositoriesServiceImpl implements IPmsProductLibr
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int updatePmsProductLibrary(ProductRepositoriesOperateVo productRepositoriesOperateVo) {
|
||||
PmsProductLibraryRepositories oldRepo = selectPmsProductLibraryByName(
|
||||
productRepositoriesOperateVo.getEnterpriseIdentifier(),
|
||||
productRepositoriesOperateVo.getName());
|
||||
// 构建更新对象
|
||||
PmsProductLibraryRepositories pmsProductLibraryRepositories = productRepositoriesOperateVo.toPmsProductLibraryRepositories();
|
||||
pmsProductLibraryRepositories.setId(oldRepo.getId());
|
||||
pmsProductLibraryRepositories.setUpdateTime(DateUtils.getNowDate());
|
||||
pmsProductLibraryRepositories.setUpdateBy(SecurityUtils.getUsername());
|
||||
NexusHostedRepoInputVo requestBody = productRepositoriesOperateVo.toNexusRepoDataVo();
|
||||
|
||||
// 调用制品库更新接口更新制品库
|
||||
nexusRequestHelper.doRequest(
|
||||
NexusRequestUrl.UPDATE_REPOSITORIES(
|
||||
requestBody.getType(),
|
||||
requestBody.getFormat(),
|
||||
requestBody.getName()),
|
||||
JSONObject.from(requestBody)
|
||||
);
|
||||
|
||||
return pmsProductLibraryRepositoriesMapper.updatePmsProductLibraryRepositories(pmsProductLibraryRepositories);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改制品库-仓库
|
||||
*
|
||||
|
|
@ -325,13 +263,6 @@ public class PmsProductLibraryRepositoriesServiceImpl implements IPmsProductLibr
|
|||
PmsProductLibraryRepositories::toPmsProductLibraryRepositoriesSimpleVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GenericsTableDataInfo<PmsProductLibrarySimpleVo> selectPmsProductLibraryPageList(String enterpriseIdentifier, String name) {
|
||||
return PageUtils.toPage(
|
||||
pmsProductLibraryRepositoriesMapper.selectPmsProductLibraryList(enterpriseIdentifier, name),
|
||||
PmsProductLibraryRepositories::toPmsProductLibrarySimpleVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CommonTypeVo> selectVersionPolicyList() {
|
||||
return VersionPolicyEnum.getAllToList();
|
||||
|
|
@ -353,16 +284,6 @@ public class PmsProductLibraryRepositoriesServiceImpl implements IPmsProductLibr
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int deletePmsProductLibraryByName(String enterpriseIdentifier, String name) {
|
||||
PmsProductLibraryRepositories oldRepo = selectPmsProductLibraryByName(enterpriseIdentifier, name);
|
||||
// 调用制品库删除接口删除制品库
|
||||
nexusRequestHelper.doRequest(
|
||||
NexusRequestUrl.DELETE_REPOSITORIES(PmsProductLibraryRepositories.getNexusProductRepositoriesName(enterpriseIdentifier, name))
|
||||
);
|
||||
return pmsProductLibraryRepositoriesMapper.deletePmsProductLibraryRepositoriesById(oldRepo.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PmsProductLibraryRepositoriesDataVo selectPmsProductLibraryRepositoriesDataByName(String enterpriseIdentifier, String repoName) {
|
||||
PmsProductLibraryRepositories pmsProductLibraryRepositories =
|
||||
|
|
@ -370,13 +291,6 @@ public class PmsProductLibraryRepositoriesServiceImpl implements IPmsProductLibr
|
|||
return pmsProductLibraryRepositories.toPmsProductLibraryRepositoriesDataVo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PmsProductLibraryRepositoriesDataVo selectPmsProductLibraryDataByName(String enterpriseIdentifier, String repoName) {
|
||||
PmsProductLibraryRepositories pmsProductLibraryRepositories =
|
||||
selectPmsProductLibraryByName(enterpriseIdentifier, repoName);
|
||||
return pmsProductLibraryRepositories.toPmsProductLibraryRepositoriesDataVo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deletePmsProductLibraryRepositoriesByName(String enterpriseIdentifier, String name) {
|
||||
PmsProductLibraryRepositories oldRepo = selectPmsProductLibraryRepositoriesByName(enterpriseIdentifier, name);
|
||||
|
|
|
|||
Loading…
Reference in New Issue