1、添加任务额外属性 bugfix
2、新增 编辑节点、任务两个接口(数据总览使用)
This commit is contained in:
@@ -285,6 +285,17 @@ public class SimulationNodeController implements ISimulationNodeFeignClient {
|
||||
return nodeService.getNodeDetailForData(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改节点(数据总览使用)
|
||||
*
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/editNodeForData")
|
||||
@Operation(summary = "修改节点(数据总览使用)", description = "修改节点(数据总览使用)")
|
||||
public SdmResponse editNodeForData(@RequestBody @Validated SpdmEditNodeForDataReq req) {
|
||||
return nodeService.editNodeForData(req);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,11 +7,13 @@ import com.sdm.project.model.bo.ModifyTaskNode;
|
||||
import com.sdm.project.model.req.*;
|
||||
import com.sdm.project.model.resp.TaskCountResp;
|
||||
import com.sdm.project.model.resp.UserWorkloadResp;
|
||||
import com.sdm.project.service.ISimulationTaskService;
|
||||
import com.sdm.project.service.ITaskService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.apache.catalina.User;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -26,6 +28,9 @@ public class SimulationTaskController {
|
||||
@Resource
|
||||
private ITaskService taskService;
|
||||
|
||||
@Autowired
|
||||
private ISimulationTaskService simulationTaskService;
|
||||
|
||||
/**
|
||||
* 修改任务
|
||||
*
|
||||
@@ -122,4 +127,16 @@ public class SimulationTaskController {
|
||||
return taskService.getTaskDetail(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改任务(数据总览使用)
|
||||
*
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/editTaskForData")
|
||||
@Operation(summary = "修改任务(数据总览使用)", description = "修改任务(数据总览使用)")
|
||||
public SdmResponse editTaskForData(@RequestBody @Validated SpdmEditTaskForDataReq req) {
|
||||
return simulationTaskService.editTaskForData(req);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.sdm.project.model.req;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SpdmEditNodeForDataReq {
|
||||
|
||||
/**
|
||||
* simulation_node关联的节点id
|
||||
*/
|
||||
@NotBlank(message = "relatedResourceUuid不能为空")
|
||||
private String relatedResourceUuid;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
private String nodeName;
|
||||
|
||||
/**
|
||||
* 节点编码
|
||||
*/
|
||||
private String nodeCode;
|
||||
|
||||
/**
|
||||
* 节点的英文名称
|
||||
*/
|
||||
private String englishName;
|
||||
|
||||
/**
|
||||
* 预留拓展属性
|
||||
*/
|
||||
private List<SpdmNodeExtraReq> extraList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.sdm.project.model.req;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SpdmEditTaskForDataReq {
|
||||
|
||||
/**
|
||||
* simulation_node关联的节点id
|
||||
*/
|
||||
@NotBlank(message = "relatedResourceUuid不能为空")
|
||||
private String relatedResourceUuid;
|
||||
|
||||
private String uuid;
|
||||
|
||||
private String taskName;
|
||||
|
||||
|
||||
private String taskCode;
|
||||
|
||||
private String taskPoolName;
|
||||
|
||||
private String taskPoolVersion;
|
||||
|
||||
private String nodeId;
|
||||
|
||||
private Integer days;
|
||||
|
||||
private Integer realDays;
|
||||
|
||||
private String standard;
|
||||
|
||||
private String foldId;
|
||||
|
||||
private Integer status;
|
||||
|
||||
private String achieveStatus;
|
||||
|
||||
private String beginTime;
|
||||
|
||||
private String endTime;
|
||||
|
||||
private String finishTime;
|
||||
|
||||
private Integer progress;
|
||||
|
||||
private String exeStatus;
|
||||
|
||||
private String confidence;
|
||||
|
||||
private String analyseTarget;
|
||||
|
||||
private String analyseSoftware;
|
||||
|
||||
private String approvalStatus;
|
||||
|
||||
private String comfirmStatus;
|
||||
|
||||
private String description;
|
||||
|
||||
private Float difficult;
|
||||
|
||||
private String tenantId;
|
||||
|
||||
private Integer pid;
|
||||
|
||||
private Long creator;
|
||||
|
||||
private String createTime;
|
||||
|
||||
private Long updater;
|
||||
|
||||
|
||||
private String updateTime;
|
||||
|
||||
|
||||
private String department;
|
||||
|
||||
|
||||
private String sectionName;
|
||||
|
||||
|
||||
private String groupName;
|
||||
|
||||
|
||||
private String bCapacity;
|
||||
|
||||
|
||||
private String flowTemplate;
|
||||
|
||||
private String englishName;
|
||||
|
||||
}
|
||||
@@ -76,4 +76,7 @@ public interface INodeService extends IService<SimulationNode> {
|
||||
SdmResponse getNodeDetailForData(GetNodeDetailReq req);
|
||||
|
||||
BosimSaveProjectTaskRsp syncProject(SyncCidProjectReq req);
|
||||
|
||||
SdmResponse editNodeForData(SpdmEditNodeForDataReq req);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.sdm.project.service;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
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 java.util.List;
|
||||
@@ -18,4 +20,6 @@ public interface ISimulationTaskService extends IService<SimulationTask> {
|
||||
|
||||
boolean updateSimulationTask(SpdmTaskOprReq req);
|
||||
|
||||
SdmResponse editTaskForData(SpdmEditTaskForDataReq req);
|
||||
|
||||
}
|
||||
|
||||
@@ -1452,13 +1452,14 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
}
|
||||
|
||||
// 重命名文件夹
|
||||
public void renameDirNew(String uuid, String newDirName) {
|
||||
public SdmResponse renameDirNew(String uuid, String newDirName) {
|
||||
RenameDirReq req = new RenameDirReq();
|
||||
req.setUuid(uuid);
|
||||
req.setNewName(newDirName);
|
||||
log.info("调用重命名文件夹的参数为:{}", req);
|
||||
SdmResponse response = dataClientFeignClient.renameDirNew(req);
|
||||
log.info("调用重命名文件夹的返回值为:{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
@@ -1520,4 +1521,41 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
return resp;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public SdmResponse editNodeForData(SpdmEditNodeForDataReq req) {
|
||||
String relatedResourceUuid = req.getRelatedResourceUuid();
|
||||
// 修改节点属性
|
||||
boolean updateNodeFlag = this.lambdaUpdate().set(SimulationNode::getNodeName, req.getNodeName())
|
||||
.set(SimulationNode::getNodeCode, req.getNodeCode())
|
||||
.set(SimulationNode::getEnglishName, req.getEnglishName())
|
||||
.eq(SimulationNode::getUuid, relatedResourceUuid).update();
|
||||
if (!updateNodeFlag) {
|
||||
log.error("修改节点信息失败");
|
||||
return SdmResponse.failed("修改节点失败,原因为:修改节点信息失败");
|
||||
}
|
||||
// 删除节点额外属性
|
||||
nodeMapper.deleteNodeExtraBatch(Collections.singletonList(relatedResourceUuid));
|
||||
// 新增节点额外属性
|
||||
List<SpdmNodeExtraReq> extraList = req.getExtraList();
|
||||
if (CollectionUtils.isNotEmpty(extraList)) {
|
||||
for (SpdmNodeExtraReq spdmNodeExtraReq : extraList) {
|
||||
spdmNodeExtraReq.setNodeId(relatedResourceUuid);
|
||||
}
|
||||
if (nodeMapper.addNodeExtraBatch(extraList) == 0) {
|
||||
log.error("新增节点额外属性失败");
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return SdmResponse.failed("修改节点失败,原因为:新增节点额外属性失败");
|
||||
}
|
||||
}
|
||||
// 修改文件夹名称
|
||||
SdmResponse response = renameDirNew(relatedResourceUuid, req.getNodeName());
|
||||
if (ObjectUtils.isEmpty(response) || response.getCode() != ResultCode.SUCCESS.getCode()) {
|
||||
log.error("修改节点时,修改文件夹名称失败,原因为:{}",response.getMessage());
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return SdmResponse.failed("修改节点失败,原因为:" + response.getMessage());
|
||||
}
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,13 +3,17 @@ package com.sdm.project.service.impl;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.common.ThreadLocalContext;
|
||||
import com.sdm.project.model.entity.SimulationTask;
|
||||
import com.sdm.project.dao.SimulationTaskMapper;
|
||||
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.ISimulationTaskService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@@ -55,4 +59,13 @@ public class SimulationTaskServiceImpl extends ServiceImpl<SimulationTaskMapper,
|
||||
return this.update(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse editTaskForData(SpdmEditTaskForDataReq req) {
|
||||
SimulationTask simulationTask = new SimulationTask();
|
||||
BeanUtils.copyProperties(req,simulationTask);
|
||||
LambdaUpdateWrapper<SimulationTask> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
this.update(updateWrapper.setEntity(simulationTask));
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -58,9 +58,9 @@
|
||||
</insert>
|
||||
|
||||
<insert id="batchAddSimulationTaskExtra">
|
||||
insert into simulation_task_extra (uuid,task_id,nodeId,poolName,propertyName,propertyValue,valueType,propertyClass) values
|
||||
insert into simulation_task_extra (uuid,task_id,nodeId,propertyName,propertyValue,valueType,propertyClass) values
|
||||
<foreach collection='list' item='it' index='index' separator=','>
|
||||
(#{it.uuid},#{it.taskId},#{it.nodeId},#{it.poolName},#{it.propertyName},#{it.propertyValue},#{it.valueType},#{it.propertyClass})
|
||||
(#{it.uuid},#{it.taskId},#{it.nodeId},#{it.propertyName},#{it.propertyValue},#{it.valueType},#{it.propertyClass})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user