修改对标报告的附件上传问题
This commit is contained in:
parent
9683489c3a
commit
cf058a1734
@ -11,10 +11,12 @@ import com.xdap.self_development.pojo.view.TodoAndReportView;
|
||||
import com.xdap.self_development.service.BenchmarkingReportService;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@ -23,6 +25,16 @@ public class BenchmarkingReportController {
|
||||
@Resource
|
||||
private BenchmarkingReportService benchmarkingReportService;
|
||||
|
||||
// 上传附件
|
||||
@PostMapping("/uploadFile")
|
||||
public Response uploadFile(
|
||||
@NotNull @RequestPart MultipartFile file,
|
||||
@NotBlank @RequestPart String createBy
|
||||
) {
|
||||
String fileUrl = benchmarkingReportService.uploadFile(file, createBy);
|
||||
return Response.ok().data(fileUrl);
|
||||
}
|
||||
|
||||
// 新增对标报告并发起审批
|
||||
@PostMapping("/startReportApproval")
|
||||
public Response startReportApproval(
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
package com.xdap.self_development.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/custom/permission")
|
||||
public class PermissionController {
|
||||
// 查看
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
package com.xdap.self_development.controller.form;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
@ -36,7 +37,7 @@ public class SaveBenchmarkingReportForm {
|
||||
@NotBlank(message = "项目编号不能为空")
|
||||
private String projectNumber;
|
||||
|
||||
private MultipartFile file;
|
||||
private String fileUrl;
|
||||
|
||||
@NotEmpty(message = "校对人员不能为空")
|
||||
private List<String> proofreadUsers;
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
package com.xdap.self_development.pojo;
|
||||
|
||||
import com.definesys.mpaas.query.annotation.RowID;
|
||||
import com.definesys.mpaas.query.annotation.RowIDType;
|
||||
import com.definesys.mpaas.query.annotation.Table;
|
||||
import com.definesys.mpaas.query.model.MpaasBasePojo;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Table("yfsjglpt_model_permissions")
|
||||
public class Permissions extends MpaasBasePojo {
|
||||
@RowID(value = "permissions_s", type = RowIDType.UUID)
|
||||
private String id;
|
||||
private String permissionName;
|
||||
private String permPath;
|
||||
private String description;
|
||||
}
|
||||
18
src/main/java/com/xdap/self_development/pojo/Role.java
Normal file
18
src/main/java/com/xdap/self_development/pojo/Role.java
Normal file
@ -0,0 +1,18 @@
|
||||
package com.xdap.self_development.pojo;
|
||||
|
||||
import com.definesys.mpaas.query.annotation.RowID;
|
||||
import com.definesys.mpaas.query.annotation.RowIDType;
|
||||
import com.definesys.mpaas.query.annotation.Table;
|
||||
import com.definesys.mpaas.query.model.MpaasBasePojo;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Table("yfsjglpt_model_roles")
|
||||
public class Role extends MpaasBasePojo {
|
||||
@RowID(value = "roles_s", type = RowIDType.UUID)
|
||||
private String id;
|
||||
private String roleName;
|
||||
private String description;
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.xdap.self_development.pojo;
|
||||
|
||||
import com.definesys.mpaas.query.annotation.RowID;
|
||||
import com.definesys.mpaas.query.annotation.RowIDType;
|
||||
import com.definesys.mpaas.query.annotation.Table;
|
||||
import com.definesys.mpaas.query.model.MpaasBasePojo;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Table("yfsjglpt_model_role_permissions")
|
||||
public class RoleAndPermissions extends MpaasBasePojo {
|
||||
@RowID(value = "role_permissions_s", type = RowIDType.UUID)
|
||||
private String id;
|
||||
private String roleId;
|
||||
private String permissionId;
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.xdap.self_development.pojo;
|
||||
|
||||
import com.definesys.mpaas.query.annotation.RowID;
|
||||
import com.definesys.mpaas.query.annotation.RowIDType;
|
||||
import com.definesys.mpaas.query.annotation.Table;
|
||||
import com.definesys.mpaas.query.model.MpaasBasePojo;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Table("yfsjglpt_model_user_roles")
|
||||
public class UserAndRoles extends MpaasBasePojo {
|
||||
@RowID(value = "user_roles_s", type = RowIDType.UUID)
|
||||
private String id;
|
||||
private String roleId;
|
||||
private String userId;
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
package com.xdap.self_development.pojo;
|
||||
|
||||
public class permissions {
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
package com.xdap.self_development.pojo;
|
||||
|
||||
public class role {
|
||||
}
|
||||
@ -6,6 +6,7 @@ import com.xdap.self_development.controller.form.SaveBenchmarkingReportForm;
|
||||
import com.xdap.self_development.pojo.BenchmarkingReport;
|
||||
import com.xdap.self_development.pojo.view.ApprovalFlowView;
|
||||
import com.xdap.self_development.pojo.view.TodoAndReportView;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
@ -21,4 +22,6 @@ public interface BenchmarkingReportService {
|
||||
BenchmarkingReport getReportDetail(@NotBlank String reportId);
|
||||
|
||||
ApprovalFlowView getReportProcess(@NotBlank String flowId);
|
||||
|
||||
String uploadFile(MultipartFile file, @NotBlank String createBy);
|
||||
}
|
||||
|
||||
@ -62,17 +62,9 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
||||
@Transactional
|
||||
public void saveBenchmarkingReport(SaveBenchmarkingReportForm form) {
|
||||
// 1. 创建对标报告并保存
|
||||
String realUrl = "";
|
||||
if (form.getFile() != null) {
|
||||
realUrl = uploadFile(form.getFile(), form.getCreateBy());
|
||||
if (realUrl.isEmpty()) {
|
||||
throw new MpaasBusinessException("附件上传失败");
|
||||
}
|
||||
}
|
||||
|
||||
BenchmarkingReport report = new BenchmarkingReport();
|
||||
BeanUtils.copyProperties(form, report);
|
||||
report.setFilePath(realUrl);
|
||||
report.setFilePath(form.getFileUrl() == null ? "" : form.getFileUrl());
|
||||
report.setUploadTime(Timestamp.valueOf(LocalDateTime.now()));
|
||||
report.setStatus("APPROVING");
|
||||
report.setCreateBy(form.getCreateBy());
|
||||
@ -98,7 +90,8 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
||||
});
|
||||
}
|
||||
|
||||
private String uploadFile(MultipartFile file, String userId) {
|
||||
@Override
|
||||
public String uploadFile(MultipartFile file, String userId) {
|
||||
String currentTenantId = runtimeAppContextService.getCurrentTenantId();
|
||||
AppTokenDTO token = apaasMyTokenFeign.getAppToken(
|
||||
"client_credentials",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user