Merge branch 'main' of http://carsafe.uicp.cn/toolchaintechnologycenter/spdm-backend
This commit is contained in:
@@ -2,6 +2,7 @@ package com.sdm.common.entity.req.data;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.sdm.common.entity.enums.FileBizTypeEnum;
|
||||
import com.sdm.common.entity.req.system.DictTagReq;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -79,6 +80,8 @@ public class UploadFilesReq {
|
||||
@Schema(description= "算例下文件的排序字段,数值越小越靠前")
|
||||
private Integer sortOrder;
|
||||
|
||||
@Schema(description = "标签请求参数字符串")
|
||||
private String tagReqStr;
|
||||
/**
|
||||
* 标签请求参数 设置tag1-tag10 ,taskId, runId记录文件所属节点信息
|
||||
*/
|
||||
@@ -146,15 +149,19 @@ public class UploadFilesReq {
|
||||
private Boolean isConverSameNameFile = false;
|
||||
|
||||
@Schema(description = "x轴物理量(曲线结果使用)")
|
||||
@JsonProperty(value = "xQuantityType")
|
||||
private String xQuantityType;
|
||||
|
||||
@Schema(description = "x轴结果单位(曲线结果使用)")
|
||||
@JsonProperty(value = "xUnits")
|
||||
private String xUnits;
|
||||
|
||||
@Schema(description = "y轴物理量(曲线结果使用)")
|
||||
@JsonProperty(value = "yQuantityType")
|
||||
private String yQuantityType;
|
||||
|
||||
@Schema(description = "y轴结果单位(曲线结果使用)")
|
||||
@JsonProperty(value = "yUnits")
|
||||
private String yUnits;
|
||||
|
||||
/**
|
||||
|
||||
@@ -143,6 +143,12 @@ public class SpdmTaskVo extends BaseEntity {
|
||||
@JsonProperty(value = "eMemberList")
|
||||
private List<CIDUserResp> eMemberList;
|
||||
|
||||
/**
|
||||
* 关注人
|
||||
*/
|
||||
@JsonProperty(value = "payAttentionMemberList")
|
||||
private List<CIDUserResp> payAttentionMemberList;
|
||||
|
||||
/**
|
||||
* 0:未关注 1:已关注
|
||||
*/
|
||||
@@ -214,12 +220,6 @@ public class SpdmTaskVo extends BaseEntity {
|
||||
private String tag9Code;
|
||||
private String tag10Code;
|
||||
|
||||
/**
|
||||
* 仿真关注人
|
||||
*/
|
||||
@JsonProperty(value = "payAttentionMemberList")
|
||||
private List<CIDUserResp> payAttentionMemberList;
|
||||
|
||||
/**
|
||||
* 仿真执行人userId
|
||||
*/
|
||||
|
||||
@@ -167,19 +167,6 @@ public class DataClientFeignClientImpl implements IDataFeignClient {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse uploadFilesWithTag(UploadFilesReq uploadFilesReq, MultipartFile file) {
|
||||
SdmResponse response;
|
||||
try {
|
||||
response = dataClient.uploadFilesWithTag(uploadFilesReq, file);
|
||||
log.info("上传文件响应:" + response);
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
log.error("上传文件失败", e);
|
||||
return SdmResponse.failed("上传文件失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<FileMetadataInfoResp> queryFileMetadataInfo(String uuid, String uuidOwnType, Long dirId) {
|
||||
SdmResponse<FileMetadataInfoResp> response;
|
||||
|
||||
@@ -62,10 +62,6 @@ public interface IDataFeignClient {
|
||||
@PostMapping(value = "/data/uploadFiles",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
SdmResponse uploadFiles(UploadFilesReq req);
|
||||
|
||||
@PostMapping(value = "/data/uploadFilesWithTag", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
SdmResponse uploadFilesWithTag(@RequestPart("uploadFilesReq") UploadFilesReq uploadFilesReq,
|
||||
@RequestPart("file") MultipartFile file);
|
||||
|
||||
@GetMapping("/data/queryFileMetadataInfo")
|
||||
SdmResponse<FileMetadataInfoResp> queryFileMetadataInfo(@RequestParam(value = "uuid") String uuid, @RequestParam(value = "uuidOwnType") String uuidOwnType, @RequestParam(value = "dirId") Long dirId);
|
||||
|
||||
|
||||
@@ -430,26 +430,6 @@ public class DataFileController implements IDataFeignClient {
|
||||
return IDataFileService.uploadFiles(req);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/uploadFilesWithTag", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
@Operation(
|
||||
summary = "上传文件",
|
||||
description = "上传文件到服务器,支持同时上传文件和附加参数",
|
||||
requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(
|
||||
description = "文件上传请求",
|
||||
required = true,
|
||||
content = @Content(
|
||||
mediaType = MediaType.MULTIPART_FORM_DATA_VALUE,
|
||||
schema = @Schema(implementation = UploadFilesReq.class)
|
||||
)
|
||||
)
|
||||
)
|
||||
public SdmResponse uploadFilesWithTag(@RequestPart("uploadFilesReq") UploadFilesReq uploadFilesReq,
|
||||
@RequestPart("file") MultipartFile file) {
|
||||
uploadFilesReq.setFile(file);
|
||||
return IDataFileService.uploadFiles(uploadFilesReq);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 记录用户下载历史
|
||||
*
|
||||
|
||||
@@ -2207,6 +2207,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public SdmResponse uploadFiles(UploadFilesReq req) {
|
||||
req.setTagReq(JSONObject.parseObject(req.getTagReqStr(),TagReq.class));
|
||||
SdmResponse<FileMetadataInfo> dirResponse = resolveUploadDirectory(req);
|
||||
if (!dirResponse.isSuccess()) {
|
||||
return dirResponse;
|
||||
|
||||
@@ -135,6 +135,7 @@ security:
|
||||
- /data/createDir
|
||||
- /data/approveParamLibrary
|
||||
- /ws/data/modelTraining
|
||||
- /data/batchUpdatePermission
|
||||
|
||||
data:
|
||||
storage-monitor:
|
||||
|
||||
@@ -135,6 +135,7 @@ security:
|
||||
- /data/createDir
|
||||
- /data/approveParamLibrary
|
||||
- /ws/data/modelTraining
|
||||
- /data/batchUpdatePermission
|
||||
|
||||
data:
|
||||
storage-monitor:
|
||||
|
||||
@@ -135,6 +135,7 @@ security:
|
||||
- /data/createDir
|
||||
- /data/approveParamLibrary
|
||||
- /ws/data/modelTraining
|
||||
- /data/batchUpdatePermission
|
||||
|
||||
data:
|
||||
storage-monitor:
|
||||
|
||||
@@ -135,6 +135,7 @@ security:
|
||||
- /data/createDir
|
||||
- /data/approveParamLibrary
|
||||
- /ws/data/modelTraining
|
||||
- /data/batchUpdatePermission
|
||||
|
||||
data:
|
||||
storage-monitor:
|
||||
|
||||
@@ -167,7 +167,7 @@ public class SimulationTaskController implements ISimulationTaskFeignClient {
|
||||
*/
|
||||
@PostMapping("/editTaskForData")
|
||||
@Operation(summary = "修改任务(数据总览使用)", description = "修改任务(数据总览使用)")
|
||||
public SdmResponse editTaskForData(@RequestBody @Validated SpdmEditTaskForDataReq req) {
|
||||
public SdmResponse editTaskForData(@RequestBody TaskEditNodeReq req) {
|
||||
return simulationTaskService.editTaskForData(req);
|
||||
}
|
||||
|
||||
|
||||
@@ -182,6 +182,12 @@ public class SpdmEditTaskForDataReq {
|
||||
@JsonProperty(value = "eMemberList")
|
||||
private String eMemberList;
|
||||
|
||||
/**
|
||||
* 仿真关注人
|
||||
*/
|
||||
@JsonProperty(value = "payAttentionMemberList")
|
||||
private String payAttentionMemberList;
|
||||
|
||||
/**
|
||||
* 任务名称
|
||||
*/
|
||||
|
||||
@@ -39,4 +39,6 @@ public interface IProjectService {
|
||||
|
||||
SdmResponse queryDesignVersions(String projectId, String phaseId);
|
||||
|
||||
void editTaskList(List<TaskEditNodeReq> taskEditNodeReqList);
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.sdm.project.model.entity.SimulationTask;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sdm.project.model.req.SpdmEditTaskForDataReq;
|
||||
import com.sdm.project.model.req.SpdmTaskOprReq;
|
||||
import com.sdm.project.model.req.TaskEditNodeReq;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -21,7 +22,7 @@ public interface ISimulationTaskService extends IService<SimulationTask> {
|
||||
|
||||
boolean updateSimulationTask(SpdmTaskOprReq req);
|
||||
|
||||
SdmResponse editTaskForData(SpdmEditTaskForDataReq req);
|
||||
SdmResponse editTaskForData(TaskEditNodeReq req);
|
||||
|
||||
void batchCreateTaskFromDemand(List<SimulationDemand> demandList);
|
||||
|
||||
|
||||
@@ -14,13 +14,11 @@ import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.common.ThreadLocalContext;
|
||||
import com.sdm.common.entity.ExportExcelFormat;
|
||||
import com.sdm.common.entity.constants.TagConstant;
|
||||
import com.sdm.common.entity.enums.AttachFileTypeEnum;
|
||||
import com.sdm.common.entity.enums.DirTypeEnum;
|
||||
import com.sdm.common.entity.enums.FilePermissionEnum;
|
||||
import com.sdm.common.entity.enums.NodeTypeEnum;
|
||||
import com.sdm.common.entity.enums.*;
|
||||
import com.sdm.common.entity.req.data.*;
|
||||
import com.sdm.common.entity.req.project.*;
|
||||
import com.sdm.common.entity.req.system.QueryGroupDetailReq;
|
||||
import com.sdm.common.entity.req.system.SendMsgReq;
|
||||
import com.sdm.common.entity.req.system.UserListReq;
|
||||
import com.sdm.common.entity.req.system.UserQueryReq;
|
||||
import com.sdm.common.entity.resp.AllNodeByProjectIdAndTypeResp;
|
||||
@@ -32,6 +30,7 @@ import com.sdm.common.entity.resp.system.CIDStaffResp;
|
||||
import com.sdm.common.entity.resp.system.CIDUserResp;
|
||||
import com.sdm.common.entity.resp.system.SysUserGroupDetailResp;
|
||||
import com.sdm.common.feign.impl.data.DataClientFeignClientImpl;
|
||||
import com.sdm.common.feign.impl.system.MessageFeignClientImpl;
|
||||
import com.sdm.common.feign.impl.system.SysConfigFeignClientImpl;
|
||||
import com.sdm.common.feign.impl.system.SysUserFeignClientImpl;
|
||||
import com.sdm.common.feign.inter.data.IDataFeignClient;
|
||||
@@ -129,6 +128,9 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
@Autowired
|
||||
private SysConfigFeignClientImpl sysConfigFeignClient;
|
||||
|
||||
@Autowired
|
||||
private MessageFeignClientImpl messageFeignClient;
|
||||
|
||||
@Autowired
|
||||
private TagMapService tagMapService;
|
||||
|
||||
@@ -3177,19 +3179,41 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
}
|
||||
SdmResponse createDirResult;
|
||||
for (TaskNode taskNode : addTaskList) {
|
||||
UpdatePermissionReq updatePermissionReq = new UpdatePermissionReq();
|
||||
updatePermissionReq.setUuid(taskNode.getUuid());
|
||||
Map<Long, Byte> userPermissions = new HashMap<>();
|
||||
updatePermissionReq.setUserPermissions(userPermissions);
|
||||
|
||||
// 设置仿真执行人
|
||||
if (StringUtils.isNotBlank(taskNode.getEMemberList())) {
|
||||
String[] userIdArr = taskNode.getEMemberList().split(",");
|
||||
List<Long> longUserIdList = Arrays.stream(userIdArr).filter(s -> !s.isEmpty()).map(Long::valueOf).collect(Collectors.toList());
|
||||
simulationTaskMemberService.saveTaskMemberList(taskNode.getUuid(), MemberTypeEnum.EXECUTOR.getCode(), longUserIdList);
|
||||
// 添加执行人权限
|
||||
for (Long userId : longUserIdList) {
|
||||
userPermissions.put(userId, FilePermissionEnum.ALL_EXCLUDE_DELETE.getValue());
|
||||
}
|
||||
// 给执行人发消息
|
||||
longUserIdList.forEach(userId ->
|
||||
sendMessage(MessageTemplateEnum.TASK_ISSUE, taskNode.getNodeName(), String.valueOf(userId), taskNode.getUuid()));
|
||||
}
|
||||
// 设置仿真负责人
|
||||
if (StringUtils.isNotBlank(taskNode.getPMemberList())) {
|
||||
String[] userIdArr = taskNode.getPMemberList().split(",");
|
||||
List<Long> longUserIdList = Arrays.stream(userIdArr).filter(s -> !s.isEmpty()).map(Long::valueOf).collect(Collectors.toList());
|
||||
simulationTaskMemberService.saveTaskMemberList(taskNode.getUuid(), MemberTypeEnum.PRINCIPAL.getCode(), longUserIdList);
|
||||
// 添加负责人权限
|
||||
for (Long userId : longUserIdList) {
|
||||
userPermissions.put(userId, FilePermissionEnum.ALL.getValue());
|
||||
}
|
||||
}
|
||||
if (!userPermissions.values().isEmpty()) {
|
||||
log.info("数据总览创建任务时,更新用户权限的参数为:{}",updatePermissionReq);
|
||||
SdmResponse updatePermissionResponse = dataClientFeignClient.updatePermission(updatePermissionReq);
|
||||
log.info("数据总览创建任务时,更新用户权限的返回值为:{}",updatePermissionResponse);
|
||||
}
|
||||
}
|
||||
|
||||
for (TaskNode taskNode : addTaskList) {
|
||||
createDirResult = createTaskDir(taskNode.getUuid(), taskNode.getNodeType(), taskNode.getPid(), taskNode.getNodeName(),taskNode);
|
||||
if (createDirResult.getCode() != ResultCode.SUCCESS.getCode()) {
|
||||
@@ -3199,6 +3223,18 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
return addTaskList;
|
||||
}
|
||||
|
||||
private void sendMessage(MessageTemplateEnum templateEnum, String taskName, String userId, String uuid) {
|
||||
SendMsgReq req = new SendMsgReq();
|
||||
req.setTitle(templateEnum.getTitle());
|
||||
req.setContent(templateEnum.getContent(taskName));
|
||||
req.setTenantId(ThreadLocalContext.getTenantId().toString());
|
||||
req.setUserId(userId);
|
||||
JSONObject params = new JSONObject();
|
||||
params.put("taskId", uuid);
|
||||
req.setParams(JSONObject.toJSONString(params));
|
||||
messageFeignClient.sendMessage(req);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param addNode 当前新增节点
|
||||
|
||||
@@ -25,12 +25,8 @@ import com.sdm.project.model.entity.SimulationTaskMember;
|
||||
import com.sdm.project.model.req.SpdmEditNodeForDataReq;
|
||||
import com.sdm.project.model.req.SpdmEditTaskForDataReq;
|
||||
import com.sdm.project.model.req.SpdmTaskOprReq;
|
||||
import com.sdm.project.service.ISimulationTaskMemberService;
|
||||
import com.sdm.project.service.ISimulationTaskService;
|
||||
import com.sdm.project.service.ISimulationDemandExtraService;
|
||||
import com.sdm.project.service.ISimulationDemandMemberService;
|
||||
import com.sdm.project.service.ISimulationTaskExtraService;
|
||||
import com.sdm.project.service.ISimulationTaskAttentionService;
|
||||
import com.sdm.project.model.req.TaskEditNodeReq;
|
||||
import com.sdm.project.service.*;
|
||||
import com.sdm.common.service.TagMapService;
|
||||
import com.sdm.project.model.entity.SimulationDemand;
|
||||
import com.sdm.project.model.entity.SimulationDemandExtra;
|
||||
@@ -84,6 +80,10 @@ public class SimulationTaskServiceImpl extends ServiceImpl<SimulationTaskMapper,
|
||||
@Autowired
|
||||
private IDataFeignClient dataFeignClient;
|
||||
|
||||
@Autowired
|
||||
private IProjectService projectService;
|
||||
|
||||
|
||||
@Override
|
||||
public boolean updateSimulationTask(SpdmTaskOprReq req) {
|
||||
LambdaUpdateWrapper<SimulationTask> wrapper = new LambdaUpdateWrapper<>();
|
||||
@@ -124,25 +124,8 @@ public class SimulationTaskServiceImpl extends ServiceImpl<SimulationTaskMapper,
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse editTaskForData(SpdmEditTaskForDataReq req) {
|
||||
SimulationTask simulationTask = new SimulationTask();
|
||||
BeanUtils.copyProperties(req,simulationTask);
|
||||
this.updateById(simulationTask);
|
||||
|
||||
// 设置仿真执行人
|
||||
if (StringUtils.isNotBlank(req.getEMemberList())) {
|
||||
String[] userIdArr = req.getEMemberList().split(",");
|
||||
List<Long> longUserIdList = Arrays.stream(userIdArr).filter(s -> !s.isEmpty()).map(Long::valueOf).collect(Collectors.toList());
|
||||
simulationTaskMemberService.deleteTaskMemberList(req.getUuid(), MemberTypeEnum.EXECUTOR.getCode());
|
||||
simulationTaskMemberService.saveTaskMemberList(req.getUuid(), MemberTypeEnum.EXECUTOR.getCode(), longUserIdList);
|
||||
}
|
||||
// 设置仿真负责人
|
||||
if (StringUtils.isNotBlank(req.getPMemberList())) {
|
||||
String[] userIdArr = req.getPMemberList().split(",");
|
||||
List<Long> longUserIdList = Arrays.stream(userIdArr).filter(s -> !s.isEmpty()).map(Long::valueOf).collect(Collectors.toList());
|
||||
simulationTaskMemberService.deleteTaskMemberList(req.getUuid(), MemberTypeEnum.PRINCIPAL.getCode());
|
||||
simulationTaskMemberService.saveTaskMemberList(req.getUuid(), MemberTypeEnum.PRINCIPAL.getCode(), longUserIdList);
|
||||
}
|
||||
public SdmResponse editTaskForData(TaskEditNodeReq req) {
|
||||
projectService.editTaskList(Arrays.asList(req));
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
|
||||
@@ -2888,6 +2888,18 @@ public class TaskServiceImpl implements ITaskService {
|
||||
taskVo.setEMemberList(spdmEUserVoList);
|
||||
}
|
||||
}
|
||||
List<SpdmTaskMemberVo> aMemberList = memberList.stream().filter(member -> MemberTypeEnum.ATTENTION.getCode().equals(member.getType())).toList();
|
||||
if (CollectionUtils.isNotEmpty(aMemberList)) {
|
||||
List<CIDUserResp> spdmAUserVoList = new ArrayList<>();
|
||||
for (Long userId : aMemberList.stream().map(SpdmTaskMemberVo::getUserId).toList()) {
|
||||
if (ObjectUtils.isNotEmpty(userId) && CollectionUtils.isNotEmpty(userMap.get(userId))) {
|
||||
spdmAUserVoList.addAll(userMap.get(userId));
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(spdmAUserVoList)) {
|
||||
taskVo.setPayAttentionMemberList(spdmAUserVoList);
|
||||
}
|
||||
}
|
||||
}
|
||||
return SdmResponse.success(taskVo);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user