Commit a7c5a8a9 by “zcwang”

modify: 发起变更

parent 34f84e9a
...@@ -16,6 +16,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -16,6 +16,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.netease.mail.yanxuan.change.biz.config.AppConfig; import com.netease.mail.yanxuan.change.biz.config.AppConfig;
...@@ -23,6 +24,7 @@ import com.netease.mail.yanxuan.change.biz.meta.exception.ExceptionFactory; ...@@ -23,6 +24,7 @@ import com.netease.mail.yanxuan.change.biz.meta.exception.ExceptionFactory;
import com.netease.mail.yanxuan.change.biz.service.ChangeFlowService; import com.netease.mail.yanxuan.change.biz.service.ChangeFlowService;
import com.netease.mail.yanxuan.change.biz.service.change.ChangeConfigService; import com.netease.mail.yanxuan.change.biz.service.change.ChangeConfigService;
import com.netease.mail.yanxuan.change.common.bean.CommonConstants; import com.netease.mail.yanxuan.change.common.bean.CommonConstants;
import com.netease.mail.yanxuan.change.common.bean.RequestLocalBean;
import com.netease.mail.yanxuan.change.common.bean.ResponseCode; import com.netease.mail.yanxuan.change.common.bean.ResponseCode;
import com.netease.mail.yanxuan.change.common.bean.ResponseCodeEnum; import com.netease.mail.yanxuan.change.common.bean.ResponseCodeEnum;
import com.netease.mail.yanxuan.change.common.enums.ChangeFlowEnum; import com.netease.mail.yanxuan.change.common.enums.ChangeFlowEnum;
...@@ -34,6 +36,7 @@ import com.netease.mail.yanxuan.change.common.util.DateUtils; ...@@ -34,6 +36,7 @@ import com.netease.mail.yanxuan.change.common.util.DateUtils;
import com.netease.mail.yanxuan.change.dal.entity.ChangeRecord; import com.netease.mail.yanxuan.change.dal.entity.ChangeRecord;
import com.netease.mail.yanxuan.change.dal.meta.model.req.ChangeExecConfigReq; import com.netease.mail.yanxuan.change.dal.meta.model.req.ChangeExecConfigReq;
import com.netease.mail.yanxuan.change.dal.meta.model.req.ChangeFlowCreateReq; import com.netease.mail.yanxuan.change.dal.meta.model.req.ChangeFlowCreateReq;
import com.netease.mail.yanxuan.change.dal.meta.model.req.ChangeFlowReq;
import com.netease.mail.yanxuan.change.integration.flow.FlowRpcService; import com.netease.mail.yanxuan.change.integration.flow.FlowRpcService;
import com.netease.yanxuan.flowx.sdk.meta.controller.communal.AjaxResponse; import com.netease.yanxuan.flowx.sdk.meta.controller.communal.AjaxResponse;
import com.netease.yanxuan.flowx.sdk.meta.dto.base.FlowDataDTO; import com.netease.yanxuan.flowx.sdk.meta.dto.base.FlowDataDTO;
...@@ -62,11 +65,11 @@ public class ChangeFlowBiz { ...@@ -62,11 +65,11 @@ public class ChangeFlowBiz {
@Autowired @Autowired
private FlowRpcService flowRpcService; private FlowRpcService flowRpcService;
public List<String> createAndSubmit(ChangeFlowCreateReq changeFlowCreateReq) { public String createAndSubmit(ChangeFlowCreateReq changeFlowCreateReq) {
// String uid = RequestLocalBean.getUid(); // String uid = RequestLocalBean.getUid();
String uid = "1"; String uid = "1";
// String name = RequestLocalBean.getName(); // String userName = RequestLocalBean.getName();
String name = "x@mesg.com"; String userName = "x@mesg.com";
// 校验变更主体 // 校验变更主体
Boolean containsChangeSubject = ChangeSubjectEnum.getByType(changeFlowCreateReq.getChangeSubject()); Boolean containsChangeSubject = ChangeSubjectEnum.getByType(changeFlowCreateReq.getChangeSubject());
Assert.isTrue(containsChangeSubject, "变更主体不存在"); Assert.isTrue(containsChangeSubject, "变更主体不存在");
...@@ -85,28 +88,39 @@ public class ChangeFlowBiz { ...@@ -85,28 +88,39 @@ public class ChangeFlowBiz {
Long tomorrowSpecificTime = DateUtils.getTomorrowSpecificTime("09:00:00"); Long tomorrowSpecificTime = DateUtils.getTomorrowSpecificTime("09:00:00");
Assert.isTrue(changeFlowCreateReq.getChangeConfirmResultTime() >= tomorrowSpecificTime, "时间不可晚于下次执行时间"); Assert.isTrue(changeFlowCreateReq.getChangeConfirmResultTime() >= tomorrowSpecificTime, "时间不可晚于下次执行时间");
Map<String, Object> content = new HashMap<>(10); Map<String, Object> content = new HashMap<>(10);
content.put("createUserName", name); content.put("createUserName", userName);
content.put("createUser", uid); content.put("createUser", uid);
content.put("createTime", System.currentTimeMillis()); content.put("createTime", System.currentTimeMillis());
content.put("updateTime", System.currentTimeMillis()); content.put("updateTime", System.currentTimeMillis());
content.put(CommonConstants.FLOW_OPERATION_KEY, FlowOperationTypeEnum.PASS.getValue()); content.put(CommonConstants.FLOW_OPERATION_KEY, FlowOperationTypeEnum.PASS.getValue());
// 组装工单创建数据 // 组装工单创建数据
FlowCreateReqDTO flowCreateReqDTO = buildFlowCreateReqDTO(ChangeFlowEnum.CHANGE_FLOW_CONFIRM.getTopoId(), uid, name, JSON.toJSONString(content), FlowCreateReqDTO flowCreateReqDTO = buildFlowCreateReqDTO(ChangeFlowEnum.CHANGE_FLOW_START.getTopoId(), uid,
FlowxOperationEnum.CREATE.getName()); userName, JSON.toJSONString(content), FlowxOperationEnum.CREATE.getName());
// 创建工单 // 创建工单
String flowId = createFlow(flowCreateReqDTO); String flowId = createFlow(flowCreateReqDTO);
// 查询工单详情 // 查询工单详情
FlowDataDTO flowDataDTO = detailFlow(flowId); FlowDataDTO flowDataDTO = flowDetail(flowId);
String nodeId = flowDataDTO.getFlowMeta().getCurrNodeDataList().get(0).getNodeId(); String nodeId = flowDataDTO.getFlowMeta().getCurrNodeDataList().get(0).getNodeId();
// todo: 根据类型查询负责人详情,格式邮箱
String changeCommander = "";
// 保存工单数据 // 保存工单数据
ChangeRecord changeRecord = buildRecord(flowId, nodeId, changeFlowCreateReq); ChangeRecord changeRecord = buildRecord(flowId, nodeId, changeFlowCreateReq, changeCommander);
changeFlowService.saveRecord(changeRecord); changeFlowService.saveRecord(changeRecord);
Integer occLock = flowDataDTO.getOccLock(); // todo:判断发起人和审核人
// 如果发起人=变更负责人 // 如果发起人=变更负责人
return submitFlow(flowId, nodeId, occLock, flowCreateReqDTO); if (true) {
List<String> nextNodeIdList = submitFlow(flowId, flowDataDTO, uid, userName,
ChangeFlowEnum.CHANGE_FLOW_START.getTopoId(), JSON.toJSONString(content));
if (CollectionUtils.isEmpty(nextNodeIdList)) {
throw ExceptionFactory.createBiz(ResponseCode.SUBMIT_FLOW_ERROR, "首次提交节点失败");
}
return nextNodeIdList.get(0);
}
return flowId;
} }
private FlowDataDTO detailFlow(String flowId) { private FlowDataDTO flowDetail(String flowId) {
// 查询工单详情,根据详情提交 // 查询工单详情,根据详情提交
FlowDataDTO flowDataDTO; FlowDataDTO flowDataDTO;
AjaxResponse<FlowDataDTO> flowDetailResponse = flowRpcService.getDetail(CommonConstants.FLOWX_PRODUCT, flowId); AjaxResponse<FlowDataDTO> flowDetailResponse = flowRpcService.getDetail(CommonConstants.FLOWX_PRODUCT, flowId);
...@@ -116,12 +130,13 @@ public class ChangeFlowBiz { ...@@ -116,12 +130,13 @@ public class ChangeFlowBiz {
} else { } else {
log.error("[detailFlow] get flow detail failed, query={}, errMsg={}", JSON.toJSONString(flowId), log.error("[detailFlow] get flow detail failed, query={}, errMsg={}", JSON.toJSONString(flowId),
JSON.toJSONString(flowDetailResponse)); JSON.toJSONString(flowDetailResponse));
throw ExceptionFactory.createBiz(ResponseCode.DETAIL_FLOW_ERROR, flowDetailResponse.getErrorMsg()); throw ExceptionFactory.createBiz(ResponseCode.DETAIL_FLOW_ERROR, "查询工单详情错误");
} }
return flowDataDTO; return flowDataDTO;
} }
private FlowCreateReqDTO buildFlowCreateReqDTO(String topoId, String uid, String userName, String content, String operateResult) { private FlowCreateReqDTO buildFlowCreateReqDTO(String topoId, String uid, String userName, String content,
String operateResult) {
FlowCreateReqDTO flowCreateReqDTO = new FlowCreateReqDTO(); FlowCreateReqDTO flowCreateReqDTO = new FlowCreateReqDTO();
flowCreateReqDTO.setTopoId(topoId); flowCreateReqDTO.setTopoId(topoId);
flowCreateReqDTO.setUid(uid); flowCreateReqDTO.setUid(uid);
...@@ -131,29 +146,31 @@ public class ChangeFlowBiz { ...@@ -131,29 +146,31 @@ public class ChangeFlowBiz {
return flowCreateReqDTO; return flowCreateReqDTO;
} }
private List<String> submitFlow(String flowId, String nodeId, Integer occLock, FlowCreateReqDTO flowCreateReqDTO) { private List<String> submitFlow(String flowId, FlowDataDTO flowDataDTO, String uid, String userName, String topoId,
String content) {
NodeSubmitReqDTO nodeSubmitReqDTO = new NodeSubmitReqDTO(); NodeSubmitReqDTO nodeSubmitReqDTO = new NodeSubmitReqDTO();
nodeSubmitReqDTO.setFlowId(flowId); nodeSubmitReqDTO.setFlowId(flowId);
nodeSubmitReqDTO.setNodeId(nodeId); nodeSubmitReqDTO.setNodeId(flowDataDTO.getFlowMeta().getCurrNodeDataList().get(0).getNodeId());
nodeSubmitReqDTO.setUid(flowCreateReqDTO.getUid()); nodeSubmitReqDTO.setUid(uid);
nodeSubmitReqDTO.setUserName(flowCreateReqDTO.getUserName()); nodeSubmitReqDTO.setUserName(userName);
nodeSubmitReqDTO.setFlowId(flowId); nodeSubmitReqDTO.setTopoId(topoId);
nodeSubmitReqDTO.setTopoId(flowCreateReqDTO.getTopoId()); nodeSubmitReqDTO.setContent(content);
nodeSubmitReqDTO.setContent(flowCreateReqDTO.getContent());
nodeSubmitReqDTO.setOperateResult(FlowxOperationEnum.SUBMIT.getName()); nodeSubmitReqDTO.setOperateResult(FlowxOperationEnum.SUBMIT.getName());
nodeSubmitReqDTO.setCreateTime(System.currentTimeMillis()); nodeSubmitReqDTO.setCreateTime(System.currentTimeMillis());
nodeSubmitReqDTO.setApproved(true); nodeSubmitReqDTO.setApproved(true);
nodeSubmitReqDTO.setOccLock(occLock + 1); nodeSubmitReqDTO.setOccLock(flowDataDTO.getOccLock() + 1);
log.info("[submitFlow] nodeSubmitReqDTO={}", JSON.toJSONString(nodeSubmitReqDTO));
List<String> nextNodeIdList; List<String> nextNodeIdList;
// 提交工单 // 提交工单
AjaxResponse<List<String>> submitResponse = flowRpcService.submit(CommonConstants.FLOWX_PRODUCT, nodeSubmitReqDTO); AjaxResponse<List<String>> submitResponse = flowRpcService.submit(CommonConstants.FLOWX_PRODUCT,
nodeSubmitReqDTO);
if (ResponseCodeEnum.SUCCESS.getCode() == submitResponse.getCode()) { if (ResponseCodeEnum.SUCCESS.getCode() == submitResponse.getCode()) {
nextNodeIdList = submitResponse.getData(); nextNodeIdList = submitResponse.getData();
log.info("[submitFlow] nextNodeIdList={}", JSON.toJSONString(nextNodeIdList)); log.info("[submitFlow] nextNodeIdList={}", JSON.toJSONString(nextNodeIdList));
} else { } else {
log.error("[submitFlow] submit flow failed, query={}, errMsg={}", JSON.toJSONString(nodeSubmitReqDTO), log.error("[submitFlow] submit flow failed, query={}, errMsg={}", JSON.toJSONString(nodeSubmitReqDTO),
JSON.toJSONString(submitResponse)); JSON.toJSONString(submitResponse));
throw ExceptionFactory.createBiz(ResponseCode.SUBMIT_FLOW_ERROR, submitResponse.getErrorMsg()); throw ExceptionFactory.createBiz(ResponseCode.SUBMIT_FLOW_ERROR, "提交工单错误");
} }
return nextNodeIdList; return nextNodeIdList;
} }
...@@ -169,12 +186,12 @@ public class ChangeFlowBiz { ...@@ -169,12 +186,12 @@ public class ChangeFlowBiz {
} else { } else {
log.error("[createFlow] create flow failed, query={}, errMsg={}", JSON.toJSONString(flowCreateReqDTO), log.error("[createFlow] create flow failed, query={}, errMsg={}", JSON.toJSONString(flowCreateReqDTO),
JSON.toJSONString(flowCreateResponse)); JSON.toJSONString(flowCreateResponse));
throw ExceptionFactory.createBiz(ResponseCode.CREATE_FLOW_ERROR, flowCreateResponse.getErrorMsg()); throw ExceptionFactory.createBiz(ResponseCode.CREATE_FLOW_ERROR, "创建工单错误");
} }
return flowId; return flowId;
} }
private ChangeRecord buildRecord(String flowId, String nodeId, ChangeFlowCreateReq changeFlowCreateReq) { private ChangeRecord buildRecord(String flowId, String nodeId, ChangeFlowCreateReq changeFlowCreateReq, String changeCommander) {
ChangeRecord changeRecord = new ChangeRecord(); ChangeRecord changeRecord = new ChangeRecord();
changeRecord.setFlowId(Long.parseLong(flowId)); changeRecord.setFlowId(Long.parseLong(flowId));
changeRecord.setFlowNode(nodeId); changeRecord.setFlowNode(nodeId);
...@@ -182,32 +199,63 @@ public class ChangeFlowBiz { ...@@ -182,32 +199,63 @@ public class ChangeFlowBiz {
changeRecord.setParentChangeClassId(changeFlowCreateReq.getParentChangeClassId()); changeRecord.setParentChangeClassId(changeFlowCreateReq.getParentChangeClassId());
changeRecord.setSonChangeClassId(changeFlowCreateReq.getSonChangeClassId()); changeRecord.setSonChangeClassId(changeFlowCreateReq.getSonChangeClassId());
changeRecord.setChangeLevel(changeFlowCreateReq.getChangeLevel()); changeRecord.setChangeLevel(changeFlowCreateReq.getChangeLevel());
changeRecord.setChangeCommander(changeFlowCreateReq.getChangeCommander()); // todo: 查询负责人
changeRecord.setChangeCommander("");
changeRecord.setChangeDepartment(changeFlowCreateReq.getChangeDepartment()); changeRecord.setChangeDepartment(changeFlowCreateReq.getChangeDepartment());
List<ChangeExecConfigReq> changeExecProject = changeFlowCreateReq.getChangeExecProject(); List<ChangeExecConfigReq> changeExecProject = changeFlowCreateReq.getChangeExecProject();
List<String> execDepartmentList = changeExecProject.stream().map(ChangeExecConfigReq::getChangeExecDepartment) List<String> execDepartmentList = changeExecProject.stream().map(ChangeExecConfigReq::getChangeExecDepartment)
.collect(Collectors.toList()); .collect(Collectors.toList());
changeRecord.setParticipateChangeExecDepartment(JSON.toJSONString(execDepartmentList)); changeRecord.setParticipateChangeExecDepartment(JSON.toJSONString(execDepartmentList));
// todo: 当变更类型是商品时有值
changeRecord.setChangeItem(changeFlowCreateReq.getChangeItems()); changeRecord.setChangeItem(changeFlowCreateReq.getChangeItems());
// todo: 当变更类型是供应商时有效
changeRecord.setChangeSupplier(changeFlowCreateReq.getChangeSupplier()); changeRecord.setChangeSupplier(changeFlowCreateReq.getChangeSupplier());
changeRecord.setChangeReason(changeFlowCreateReq.getChangeReason()); changeRecord.setChangeReason(changeFlowCreateReq.getChangeReason());
changeRecord.setChangeContent(changeFlowCreateReq.getChangeContent()); changeRecord.setChangeContent(changeFlowCreateReq.getChangeContent());
changeRecord.setChangeChecking("");
changeRecord.setChangeRiskDesc(changeFlowCreateReq.getChangeRiskDesc()); changeRecord.setChangeRiskDesc(changeFlowCreateReq.getChangeRiskDesc());
changeRecord.setChangeProfit(changeFlowCreateReq.getChangeProfit()); changeRecord.setChangeProfit(changeFlowCreateReq.getChangeProfit());
changeRecord.setChangeProfitDesc(changeFlowCreateReq.getChangeProfitDesc()); changeRecord.setChangeProfitDesc(changeFlowCreateReq.getChangeProfitDesc());
changeRecord.setChangeConfirmResultTime(changeFlowCreateReq.getChangeConfirmResultTime()); changeRecord.setChangeConfirmResultTime(changeFlowCreateReq.getChangeConfirmResultTime());
changeRecord.setState(ChangeStatusEnum.IN.getStatus()); changeRecord.setState(ChangeStatusEnum.IN.getStatus());
changeRecord.setIsCancel(0);
// 变更结论 // 变更结论
changeRecord.setChangeResult(1); changeRecord.setChangeResult(1);
changeRecord.setCreateSource(changeFlowCreateReq.getCreateSource()); changeRecord.setCreateSource(changeFlowCreateReq.getCreateSource());
changeRecord.setCreateSupplier(changeFlowCreateReq.getChangeSupplier()); changeRecord.setCreateSupplier(changeFlowCreateReq.getChangeSupplier());
changeRecord.setChangeResultDesc("");
changeRecord.setRemark("");
changeRecord.setCreator("");
changeRecord.setCreateTime(DateUtils.getCurrentTime()); changeRecord.setCreateTime(DateUtils.getCurrentTime());
changeRecord.setUpdateTime(DateUtils.getCurrentTime()); changeRecord.setUpdateTime(DateUtils.getCurrentTime());
return changeRecord; return changeRecord;
} }
public String submit(ChangeFlowReq changeFlowReq) {
log.info("[submit] changeFlowReq:{}", JSON.toJSONString(changeFlowReq));
Long flowId = changeFlowReq.getFlowId();
// 查询工单有效性
ChangeRecord changeRecord = changeFlowService.getByFlowId(flowId);
if (changeRecord == null) {
throw ExceptionFactory.createBiz(ResponseCode.ERROR_FLOW_ID, "工单id不存在");
}
if (!changeRecord.getFlowNode().equals(changeFlowReq.getCurrentNodeId())) {
throw ExceptionFactory.createBiz(ResponseCode.NODE_ERROR, "工单已流转至其他节点");
}
// todo:检验操作权限
// String uid = RequestLocalBean.getUid();
String userName = RequestLocalBean.getName();
String uid = "1";
String changeCommander = changeRecord.getChangeCommander();
if (!uid.equals(changeCommander)) {
throw ExceptionFactory.createBiz(ResponseCode.NO_AUTH, ResponseCode.NO_AUTH.getMsg());
}
// 获取工单详情
FlowDataDTO flowDataDTO = this.flowDetail(flowId.toString());
// 工单流传
Map<String, Object> content = new HashMap<>(CommonConstants.INIT_HASH_MAP_SIZE);
content.put("updateTime", System.currentTimeMillis());
content.put(CommonConstants.FLOW_OPERATION_KEY, FlowOperationTypeEnum.PASS.getValue());
List<String> nextNodeList = this.submitFlow(flowId.toString(), flowDataDTO, uid, userName,
ChangeFlowEnum.CHANGE_FLOW_SUBMIT.getTopoId(), JSON.toJSONString(content));
if (CollectionUtils.isEmpty(nextNodeList)) {
return ChangeFlowEnum.END.getNodeId();
}
return nextNodeList.get(0);
}
} }
...@@ -21,5 +21,18 @@ public interface ChangeFlowService { ...@@ -21,5 +21,18 @@ public interface ChangeFlowService {
*/ */
TitleConfig getTitleConfig(); TitleConfig getTitleConfig();
/**
* 保存工单详情
* @param changeRecord
* @return
*/
Boolean saveRecord(ChangeRecord changeRecord); Boolean saveRecord(ChangeRecord changeRecord);
/**
* 根据工单id查询
* @param flowId
* @return
*/
ChangeRecord getByFlowId(Long flowId);
} }
\ No newline at end of file
...@@ -38,4 +38,9 @@ public class ChangeFlowServiceImpl implements ChangeFlowService { ...@@ -38,4 +38,9 @@ public class ChangeFlowServiceImpl implements ChangeFlowService {
public Boolean saveRecord(ChangeRecord changeRecord) { public Boolean saveRecord(ChangeRecord changeRecord) {
return changeRecordMapper.insertSelective(changeRecord) > 0; return changeRecordMapper.insertSelective(changeRecord) > 0;
} }
@Override
public ChangeRecord getByFlowId(Long flowId) {
return changeRecordMapper.selectByFlowId(flowId);
}
} }
\ No newline at end of file
...@@ -15,6 +15,8 @@ public class CommonConstants { ...@@ -15,6 +15,8 @@ public class CommonConstants {
// 工单业务数据操作key // 工单业务数据操作key
public static final String FLOW_OPERATION_KEY = "operation";; public static final String FLOW_OPERATION_KEY = "operation";;
public static final int INIT_HASH_MAP_SIZE = 10;
public static Integer SIZE = 1; public static Integer SIZE = 1;
public static Integer PAGE = 10; public static Integer PAGE = 10;
......
...@@ -122,7 +122,10 @@ public enum ResponseCode { ...@@ -122,7 +122,10 @@ public enum ResponseCode {
CREATE_FLOW_ERROR(1001, "创建工单错误"), CREATE_FLOW_ERROR(1001, "创建工单错误"),
DETAIL_FLOW_ERROR(1002, "查询工单详情错误"), DETAIL_FLOW_ERROR(1002, "查询工单详情错误"),
SUBMIT_FLOW_ERROR(1002, "查询工单详情错误"), SUBMIT_FLOW_ERROR(1002, "提交工单错误"),
ERROR_FLOW_ID(1003, "工单id不存在"),
NODE_ERROR(1004, "工单已流转至其他节点"),
NO_AUTH(1005, "没有当前节点操作权限"),
//----------10xx----------- //----------10xx-----------
......
...@@ -13,7 +13,8 @@ package com.netease.mail.yanxuan.change.common.enums; ...@@ -13,7 +13,8 @@ package com.netease.mail.yanxuan.change.common.enums;
public enum ChangeStatusEnum { public enum ChangeStatusEnum {
IN(1, "进行中"), IN(1, "进行中"),
END(2, "完结"); CANCEL(2, "取消"),
END(3, "完结");
private Integer status; private Integer status;
......
...@@ -130,7 +130,7 @@ public class ChangeRecord { ...@@ -130,7 +130,7 @@ public class ChangeRecord {
/** /**
* 是否被取消 * 是否被取消
*/ */
private Integer isCancel; private String cancelReason;
/** /**
* 变更结论 * 变更结论
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
package com.netease.mail.yanxuan.change.dal.mapper; package com.netease.mail.yanxuan.change.dal.mapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.netease.mail.yanxuan.change.dal.entity.ChangeRecord; import com.netease.mail.yanxuan.change.dal.entity.ChangeRecord;
...@@ -16,4 +18,7 @@ import com.netease.mail.yanxuan.change.dal.entity.ChangeRecord; ...@@ -16,4 +18,7 @@ import com.netease.mail.yanxuan.change.dal.entity.ChangeRecord;
*/ */
@Mapper @Mapper
public interface ChangeRecordMapper extends tk.mybatis.mapper.common.Mapper<ChangeRecord> { public interface ChangeRecordMapper extends tk.mybatis.mapper.common.Mapper<ChangeRecord> {
@Select("select * from TB_YX_QC_CHANGE_RECORD where `flow_id` = #{flowId}")
ChangeRecord selectByFlowId(@Param("flowId") Long flowId);
} }
\ No newline at end of file
...@@ -8,6 +8,10 @@ package com.netease.mail.yanxuan.change.dal.meta.model.req; ...@@ -8,6 +8,10 @@ package com.netease.mail.yanxuan.change.dal.meta.model.req;
import java.util.List; import java.util.List;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
/** /**
...@@ -20,7 +24,15 @@ public class ChangeFlowReq { ...@@ -20,7 +24,15 @@ public class ChangeFlowReq {
/** /**
* 工单id * 工单id
*/ */
private long flowId; @NotNull(message = "工单id不能为空")
private Long flowId;
/**
* 当前节点id
*/
@NotBlank(message = "当前节点不能为空")
private String currentNodeId;
/** /**
* 一级类型id * 一级类型id
*/ */
......
...@@ -75,7 +75,7 @@ public class ChangeFlowController { ...@@ -75,7 +75,7 @@ public class ChangeFlowController {
* @return * @return
*/ */
@PostMapping("/create") @PostMapping("/create")
public AjaxResult<List<String>> createAndSubmit(@RequestBody @Valid ChangeFlowCreateReq changeFlowCreateReq) { public AjaxResult<String> createAndSubmit(@RequestBody @Valid ChangeFlowCreateReq changeFlowCreateReq) {
log.info("[createAndSubmit] createAndSubmit req={}", JSON.toJSONString(changeFlowCreateReq)); log.info("[createAndSubmit] createAndSubmit req={}", JSON.toJSONString(changeFlowCreateReq));
return AjaxResult.success(changeFlowBiz.createAndSubmit(changeFlowCreateReq)); return AjaxResult.success(changeFlowBiz.createAndSubmit(changeFlowCreateReq));
} }
...@@ -85,9 +85,8 @@ public class ChangeFlowController { ...@@ -85,9 +85,8 @@ public class ChangeFlowController {
* @return * @return
*/ */
@PostMapping("/submit") @PostMapping("/submit")
public AjaxResult<Boolean> submit(@RequestBody ChangeFlowReq changeFlowReq) { public AjaxResult<String> submit(@RequestBody @Valid ChangeFlowReq changeFlowReq) {
return AjaxResult.success(changeFlowBiz.submit(changeFlowReq));
return AjaxResult.success();
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment