feat(制品库功能开发): 产品库增加打包下载产品库功能
异步处理文件打包逻辑:将文件微服务打包生成的文件标识存储到产品库中
This commit is contained in:
parent
95e5b063aa
commit
5c66931650
|
|
@ -79,18 +79,18 @@ public class PmsProductLibraryRepositories extends BaseEntity {
|
|||
@ApiModelProperty(value = "其他属性(JSON字符串)")
|
||||
private String attributes;
|
||||
|
||||
/**
|
||||
* 制品仓库名称
|
||||
*/
|
||||
|
||||
@ApiModelProperty(value = "制品仓库名称")
|
||||
private String alias;
|
||||
|
||||
/**
|
||||
* 预留字段2
|
||||
*/
|
||||
|
||||
@ApiModelProperty(value = "快照标识")
|
||||
private String snapshotName;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "打包的文件标识")
|
||||
private String packagedFileIdentifier;
|
||||
|
||||
public RepoAttributesVo getRepoAttributes() {
|
||||
return JSONObject.parseObject(this.attributes, RepoAttributesVo.class);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,4 +80,6 @@ public interface IPmsProductLibraryService {
|
|||
boolean addDockerComponentToProductRepo(DockerComponentAddToProductRepoVo dockerComponentAddToProductRepoVo);
|
||||
|
||||
boolean packagedProduct(String enterpriseIdentifier, String productRepoName);
|
||||
|
||||
int updatePmsProductLibrary(PmsProductLibraryRepositories pmsProductLibraryRepositories);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import com.microservices.pms.productLibrary.domain.vo.*;
|
|||
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.IPmsProductLibraryService;
|
||||
import com.microservices.pms.utils.CustomExecutorFactory;
|
||||
import com.microservices.pms.utils.NexusRequestHelper;
|
||||
import com.microservices.pms.utils.NexusRequestUrl;
|
||||
|
|
@ -48,6 +49,9 @@ public class PmsProductLibraryAsyncServiceImpl implements IPmsProductLibraryAsyn
|
|||
@Lazy
|
||||
private IPmsProductLibraryRepositoriesService pmsProductLibraryRepositoriesService;
|
||||
@Autowired
|
||||
@Lazy
|
||||
private IPmsProductLibraryService pmsProductLibraryService;
|
||||
@Autowired
|
||||
private RemoteFileService remoteFileService;
|
||||
|
||||
@Override
|
||||
|
|
@ -218,7 +222,8 @@ public class PmsProductLibraryAsyncServiceImpl implements IPmsProductLibraryAsyn
|
|||
productRepo.getPmsEnterpriseIdentifier() + "/productLibrary",
|
||||
SecurityConstants.INNER)
|
||||
);
|
||||
System.out.println(fileIdentifier);
|
||||
productRepo.setPackagedFileIdentifier(fileIdentifier);
|
||||
pmsProductLibraryService.updatePmsProductLibrary(productRepo);
|
||||
} finally {
|
||||
pmsProductLibraryRepositoriesService.unlockRepository(productRepo.getPmsEnterpriseIdentifier(), productRepo.getId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,13 +110,18 @@ public class PmsProductLibraryServiceImpl implements IPmsProductLibraryService {
|
|||
// 构建更新对象
|
||||
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 updatePmsProductLibrary(pmsProductLibraryRepositories);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updatePmsProductLibrary(PmsProductLibraryRepositories pmsProductLibraryRepositories) {
|
||||
pmsProductLibraryRepositories.setUpdateTime(DateUtils.getNowDate());
|
||||
pmsProductLibraryRepositories.setUpdateBy(SecurityUtils.getUsername());
|
||||
return pmsProductLibraryRepositoriesMapper.updatePmsProductLibraryRepositories(pmsProductLibraryRepositories);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
<result property="snapshotName" column="snapshot_name"/>
|
||||
<result property="format" column="format"/>
|
||||
<result property="pmsEnterpriseIdentifier" column="enterprise_identifier"/>
|
||||
<result property="packagedFileIdentifier" column="packaged_file_identifier"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPmsProductLibraryRepositoriesAliasVo">
|
||||
|
|
@ -39,6 +40,7 @@
|
|||
pplr.alias,
|
||||
pplr.snapshot_name,
|
||||
pplr.format,
|
||||
pplr.packaged_file_identifier,
|
||||
pe.enterprise_identifier
|
||||
from pms_product_library_repositories pplr
|
||||
left join pms_enterprise as pe on pplr.pms_enterprise_id = pe.id
|
||||
|
|
@ -164,6 +166,7 @@
|
|||
<if test="attributes != null">attributes,</if>
|
||||
<if test="alias != null">alias,</if>
|
||||
<if test="snapshotName != null">snapshot_name,</if>
|
||||
<if test="packagedFileIdentifier != null">packaged_file_identifier,</if>
|
||||
<if test="format != null">format,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
|
|
@ -180,6 +183,7 @@
|
|||
<if test="attributes != null">#{attributes},</if>
|
||||
<if test="alias != null">#{alias},</if>
|
||||
<if test="snapshotName != null">#{snapshotName},</if>
|
||||
<if test="packagedFileIdentifier != null">#{packagedFileIdentifier},</if>
|
||||
<if test="format != null">#{format},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
|
@ -200,6 +204,7 @@
|
|||
<if test="attributes != null">attributes = #{attributes},</if>
|
||||
<if test="alias != null">alias = #{alias},</if>
|
||||
<if test="snapshotName != null">snapshot_name = #{snapshotName},</if>
|
||||
<if test="packagedFileIdentifier != null">packaged_file_identifier = #{packagedFileIdentifier},</if>
|
||||
<if test="format != null">format = #{format},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
|
|
|
|||
Loading…
Reference in New Issue