forked from Gitlink/microservices
feat(制品库功能开发): 针对各种格式的制品上传开发接口(开发Maven制品上传接口)
新增Maven制品上传接口: 1. 上传Body由原本的form-data转换为json,保障微服务统一性 2. 文件由原本的实体上传调整为前端先调用上传文件接口再用返回的文件标识作为载体一起上传 3. 支持多制品文件上传
This commit is contained in:
parent
401e031abf
commit
80a065f2a3
|
|
@ -1,18 +1,18 @@
|
|||
package com.microservices.pms.productLibrary.controller;
|
||||
|
||||
import com.microservices.common.core.utils.poi.ExcelUtil;
|
||||
import com.microservices.common.core.web.controller.BaseController;
|
||||
import com.microservices.common.core.web.domain.AjaxResult;
|
||||
import com.microservices.common.core.web.page.TableDataInfo;
|
||||
import com.microservices.common.log.annotation.Log;
|
||||
import com.microservices.common.log.enums.BusinessType;
|
||||
import com.microservices.common.security.annotation.RequiresPermissions;
|
||||
import com.microservices.pms.productLibrary.domain.PmsProductLibraryComponent;
|
||||
import com.microservices.pms.productLibrary.domain.vo.ComponentMavenInputVo;
|
||||
import com.microservices.pms.productLibrary.service.IPmsProductLibraryComponentService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -22,7 +22,11 @@ import java.util.List;
|
|||
* @date 2024-06-27
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pmsProductLibraryComponent")
|
||||
@Api(tags = "制品库-制品相关接口")
|
||||
@RequestMapping("/{enterpriseIdentifier}/pmsProductLibraryComponent")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "enterpriseIdentifier", value = "企业标识", paramType = "path", dataType = "String")
|
||||
})
|
||||
public class PmsProductLibraryComponentController extends BaseController {
|
||||
@Autowired
|
||||
private IPmsProductLibraryComponentService pmsProductLibraryComponentService;
|
||||
|
|
@ -30,7 +34,7 @@ public class PmsProductLibraryComponentController extends BaseController {
|
|||
/**
|
||||
* 查询制品库-制品列表
|
||||
*/
|
||||
@RequiresPermissions("pms:pmsProductLibraryComponent:list")
|
||||
// @RequiresPermissions("pms:pmsProductLibraryComponent:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(PmsProductLibraryComponent pmsProductLibraryComponent) {
|
||||
startPage();
|
||||
|
|
@ -38,22 +42,10 @@ public class PmsProductLibraryComponentController extends BaseController {
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出制品库-制品列表
|
||||
*/
|
||||
@RequiresPermissions("pms:pmsProductLibraryComponent:export")
|
||||
@Log(title = "制品库-制品", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, PmsProductLibraryComponent pmsProductLibraryComponent) {
|
||||
List<PmsProductLibraryComponent> list = pmsProductLibraryComponentService.selectPmsProductLibraryComponentList(pmsProductLibraryComponent);
|
||||
ExcelUtil<PmsProductLibraryComponent> util = new ExcelUtil<PmsProductLibraryComponent>(PmsProductLibraryComponent.class);
|
||||
util.exportExcel(response, list, "制品库-制品数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取制品库-制品详细信息
|
||||
*/
|
||||
@RequiresPermissions("pms:pmsProductLibraryComponent:query")
|
||||
// @RequiresPermissions("pms:pmsProductLibraryComponent:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(pmsProductLibraryComponentService.selectPmsProductLibraryComponentById(id));
|
||||
|
|
@ -62,17 +54,22 @@ public class PmsProductLibraryComponentController extends BaseController {
|
|||
/**
|
||||
* 新增制品库-制品
|
||||
*/
|
||||
@RequiresPermissions("pms:pmsProductLibraryComponent:add")
|
||||
// @RequiresPermissions("pms:pmsProductLibraryComponent:add")
|
||||
@Log(title = "制品库-制品", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody PmsProductLibraryComponent pmsProductLibraryComponent) {
|
||||
return toAjax(pmsProductLibraryComponentService.insertPmsProductLibraryComponent(pmsProductLibraryComponent));
|
||||
@PostMapping("/{repoName}/maven")
|
||||
@ApiOperation(value = "Maven类型制品库上传制品")
|
||||
public AjaxResult add(@PathVariable String enterpriseIdentifier,
|
||||
@ApiParam(value = "制品库名称", required = true) @PathVariable String repoName,
|
||||
@Valid @RequestBody ComponentMavenInputVo componentMavenInputVo) {
|
||||
componentMavenInputVo.setRepoName(repoName);
|
||||
componentMavenInputVo.setEnterpriseIdentifier(enterpriseIdentifier);
|
||||
return toAjax(pmsProductLibraryComponentService.insertMavenComponent(componentMavenInputVo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改制品库-制品
|
||||
*/
|
||||
@RequiresPermissions("pms:pmsProductLibraryComponent:edit")
|
||||
// @RequiresPermissions("pms:pmsProductLibraryComponent:edit")
|
||||
@Log(title = "制品库-制品", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody PmsProductLibraryComponent pmsProductLibraryComponent) {
|
||||
|
|
@ -82,7 +79,7 @@ public class PmsProductLibraryComponentController extends BaseController {
|
|||
/**
|
||||
* 删除制品库-制品
|
||||
*/
|
||||
@RequiresPermissions("pms:pmsProductLibraryComponent:remove")
|
||||
// @RequiresPermissions("pms:pmsProductLibraryComponent:remove")
|
||||
@Log(title = "制品库-制品", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
package com.microservices.pms.productLibrary.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 制品组件Maven输入对象
|
||||
*
|
||||
* @author otto
|
||||
* @date 2024-06-28
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("制品文件Maven输入对象")
|
||||
public class AssetMavenInputVo {
|
||||
@ApiModelProperty(value = "后缀")
|
||||
@NotBlank(message = "制品文件后缀不能为空")
|
||||
private String extension;
|
||||
@ApiModelProperty(value = "分类")
|
||||
private String classifier;
|
||||
@ApiModelProperty(value = "文件标识")
|
||||
@NotBlank(message = "制品文件标识不能为空")
|
||||
private String fileIdentifier;
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package com.microservices.pms.productLibrary.domain.vo;
|
||||
|
||||
import com.microservices.pms.productLibrary.domain.PmsProductLibraryRepositories;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 制品Maven输入对象
|
||||
*
|
||||
* @author otto
|
||||
* @date 2024-06-28
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("制品Maven输入对象")
|
||||
public class ComponentMavenInputVo {
|
||||
@ApiModelProperty(value = "制品库名称", hidden = true)
|
||||
private String repoName;
|
||||
@ApiModelProperty(value = "组织标识", hidden = true)
|
||||
private String enterpriseIdentifier;
|
||||
@ApiModelProperty(value = "文件列表")
|
||||
@Size(min = 1, message = "最少上传一个文件")
|
||||
@Valid
|
||||
private List<AssetMavenInputVo> assetList;
|
||||
@ApiModelProperty(value = "组Id")
|
||||
@NotNull(message = "组Id不能为空")
|
||||
private String groupId;
|
||||
@ApiModelProperty(value = "制品Id")
|
||||
@NotNull(message = "制品Id不能为空")
|
||||
private String artifactId;
|
||||
@ApiModelProperty(value = "版本")
|
||||
@NotNull(message = "版本不能为空")
|
||||
private String version;
|
||||
@ApiModelProperty(value = "是否生成pom文件")
|
||||
private Boolean generatePom;
|
||||
@ApiModelProperty(value = "包装")
|
||||
private String packaging;
|
||||
|
||||
public String getNexusRepoName() {
|
||||
return PmsProductLibraryRepositories.getNexusRepositoriesName(
|
||||
enterpriseIdentifier,
|
||||
repoName
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue