Commit 296a9212 by “zcwang”

add: 创建待办

parent 35830cf7
......@@ -70,6 +70,7 @@ CREATE TABLE `TB_YX_QC_CHANGE_RECORD`
`change_result_desc` varchar(550) NOT NULL DEFAULT '' COMMENT '结论说明',
`remark` varchar(550) NOT NULL DEFAULT '' COMMENT '备注',
`creator` varchar(50) NOT NULL DEFAULT '' COMMENT '创建人邮箱',
`todo_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '待办id',
`create_time` bigint(20) NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` bigint(20) NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`id`)
......
......@@ -73,6 +73,9 @@ import com.netease.mail.yanxuan.change.dal.meta.model.vo.ItemVO;
import com.netease.mail.yanxuan.change.dal.meta.model.vo.PageVO;
import com.netease.mail.yanxuan.change.integration.excel.ChangeFlowExcelDTO;
import com.netease.mail.yanxuan.change.integration.flow.FlowRpcService;
import com.netease.mail.yanxuan.change.integration.todo.TaskCreateDTO;
import com.netease.mail.yanxuan.change.integration.todo.TaskCreateParamVO;
import com.netease.mail.yanxuan.change.integration.todo.TodoRpcService;
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.UserReachDTO;
......@@ -117,6 +120,9 @@ public class ChangeFlowBiz {
@Autowired
private ChangeRecordMapper changeRecordMapper;
@Autowired
private TodoRpcService todoRpcService;
public String createAndSubmit(ChangeFlowCreateReq changeFlowCreateReq) {
String uid = RequestLocalBean.getUid();
......@@ -166,7 +172,7 @@ public class ChangeFlowBiz {
changeFiles.forEach(file->changeFileService.saveRecord(file));
}
// 创建代办
createSupplierTodoTask(changeRecord);
createTodoTask(changeRecord);
// 如果发起人=变更负责人
if (changeCommander.equals(uid)) {
log.debug("[createAndSubmit] changeCommander:{}, uid:{}", changeCommander, uid);
......@@ -190,7 +196,7 @@ public class ChangeFlowBiz {
* 创建代办
* @param entity
*/
public void createSupplierTodoTask(ChangeRecord entity) {
public void createTodoTask(ChangeRecord entity) {
String changeCommander = entity.getChangeCommander();
if (StringUtils.isNotEmpty(changeCommander)) {
String flowId = String.valueOf(entity.getFlowId());
......@@ -198,6 +204,25 @@ public class ChangeFlowBiz {
businessContent.put("nodeTitle", entity.getChangeContent());
businessContent.put("taskFlowId", flowId);
businessContent.put("newFlow", flowId);
TaskCreateParamVO taskCreateParamVO = new TaskCreateParamVO();
taskCreateParamVO.setBusinessKey(flowId);
taskCreateParamVO.setContent(JSON.toJSONString(businessContent));
taskCreateParamVO.setProduct(CommonConstants.FLOWX_PRODUCT);
taskCreateParamVO.setTaskCreator(changeCommander);
taskCreateParamVO.setTaskHandler(changeCommander);
taskCreateParamVO.setTaskHandlerName(changeCommander);
taskCreateParamVO.setTaskTitle("测试");
taskCreateParamVO.setTaskTypeKey(SupplierTodoTaskTypeEnum.QC_CHANGE.getValue());
TaskCreateDTO taskCreateDTO;
AjaxResponse<TaskCreateDTO> taskCreateResponse = todoRpcService.create(taskCreateParamVO);
if (ResponseCodeEnum.SUCCESS.getCode() == taskCreateResponse.getCode()) {
taskCreateDTO = taskCreateResponse.getData();
log.info("[createTodoTask] taskCreateDTO={}", JSON.toJSONString(taskCreateDTO));
} else {
log.error("[createTodoTask] create todo failed, param={}, errMsg={}", JSON.toJSONString(taskCreateParamVO),
JSON.toJSONString(taskCreateResponse));
throw ExceptionFactory.createBiz(ResponseCode.CREATE_TODO_ERROR, "查询工单详情错误");
}
}
}
......
......@@ -131,6 +131,8 @@ public enum ResponseCode {
CHANGE_TYPE_NOT_EXIST(1007, "变更类型不存在"),
OPERATOR_NOT_EXIST(1008, "操作人不存在"),
CREATE_TODO_ERROR(1009, "传单待办错误"),
/**
* 无权限
*/
......
/**
* @(#)OperateType.java, 2022/11/28.
* <p/>
* Copyright 2022 Netease, Inc. All rights reserved.
* NETEASE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package com.netease.mail.yanxuan.change.common.enums;
/**
* @Author zcwang
* @Date 2022/11/28
*/
public enum OperateTypeEnum {
FINISH(1, "完成"),
CANCEL(2, "取消"),
DELIVER(3, "转交"),
DALAY(4, "延期"),
SAVE(7, "保存");
private Integer type;
private String desc;
OperateTypeEnum(Integer type) {
this.type = type;
}
OperateTypeEnum(Integer type, String desc) {
this.type = type;
this.desc = desc;
}
public Integer getType() {
return type;
}
}
\ No newline at end of file
......@@ -6,21 +6,17 @@ package com.netease.mail.yanxuan.change.common.enums;
* @author dmx
*/
public enum SupplierTodoTaskTypeEnum {
QC_CHANGE(101, "变更工单处理");
QC_CHANGE("101", "变更工单处理");
SupplierTodoTaskTypeEnum(Integer value, String desc) {
SupplierTodoTaskTypeEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
private final Integer value;
private final String value;
private final String desc;
public Integer getValue() {
public String getValue() {
return value;
}
public String getDesc() {
return desc;
}
}
/**
* @(#)TaskCreateDTO.java, 2022/11/29.
* <p/>
* Copyright 2022 Netease, Inc. All rights reserved.
* NETEASE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package com.netease.mail.yanxuan.change.integration.todo;
import java.util.List;
import lombok.Data;
/**
* @Author zcwang
* @Date 2022/11/29
*/
@Data
public class TaskCreateDTO {
/**
* 待办id
*/
private Long id;
/**
* 废弃
*/
@Deprecated
private Long taskTypeId;
/**
* 任务类型key
*/
private String taskTypeKey;
/**
* 任务标题
*/
private String taskTitle;
/**
* 任务类型名
*/
private String taskTypeName;
/**
* 产品号
*/
private String product;
/**
* 业务key
*/
private String businessKey;
/**
* 业务数据
*/
private String content;
/**
* 任务状态
*/
private Integer taskState;
/**
*
*/
private Integer taskAdvanceState;
/**
* 任务过期时间
*/
private String taskOriginalExpireTime;
/**
* 任务过期时间
*/
private Integer taskExpireTime;
/**
*
*/
private Integer taskAdvanceTime;
/**
* 剩余日期
*/
private String remainDays;
/**
* 处理人列表
*/
private List<UserInfo> taskHandlerList;
private String recentlyOperator;
private String recentylyOperatorName;
private String sourceRemark;
private String creator;
private String updator;
private long createTime;
private long updateTime;
private String childTaskList;
private String taskDetailUrl;
}
\ No newline at end of file
/**
* @(#)CreateParamVO.java, 2022/11/28.
* <p/>
* Copyright 2022 Netease, Inc. All rights reserved.
* NETEASE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package com.netease.mail.yanxuan.change.integration.todo;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author zcwang
* @Date 2022/11/28
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class TaskCreateParamVO {
/**
* 业务key
*/
private String businessKey;
/**
* 任务详情数据
*/
private String content;
/**
* 产品号
*/
private String product;
/**
* 任务创建人
*/
private String taskCreator;
/**
* 任务处理人
*/
private String taskHandler;
/**
* 任务处理人集合
*/
private List<UserInfo> taskHandlerList;
/**
* 单个任务处理人场景
*/
private String taskHandlerName;
/**
* 任务标题
*/
private String taskTitle;
/**
* 已废弃
*/
@Deprecated
private Integer taskTypeId;
/**
* 任务类型key
*/
private String taskTypeKey;
}
\ No newline at end of file
/**
* @(#)TaskProcessParamVO.java, 2022/11/28.
* <p/>
* Copyright 2022 Netease, Inc. All rights reserved.
* NETEASE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package com.netease.mail.yanxuan.change.integration.todo;
import com.netease.mail.yanxuan.change.common.enums.OperateTypeEnum;
/**
* @Author zcwang
* @Date 2022/11/28
*/
public class TaskProcessParamVO {
/**
* 业务key,非必填
*/
private String businessKey;
/**
* 系统自定义抄送人,非必填
*/
private String cc;
/**
* 任务详情,仅保存操作时必填
*/
private String content;
/**
* 延期时间,仅延期操作时必填
*/
private Integer delayTime;
/**
* 任务的上次更新时间,用于版本控制,非必填
*/
private Integer lastUpdateTime;
/**
* 操作:1 完成 2 取消 3 转交 4 延期 7 保存,必填
* @see OperateTypeEnum
*/
private Integer operateType;
/**
* 操作人邮箱,必填
*/
private String operator;
/**
* 操作人名称,必填
*/
private String operatorName;
/**
* 系统产品号,必填
*/
private String product;
/**
* 系统自定义收件人,非必填
*/
private String recipient;
/**
* 备注信息,非必填
*/
private String remark;
/**
* 任务ID,必填
*/
private Integer taskId;
/**
* 被转交人邮箱,仅转交操作时必填
*/
private String transfer;
/**
* 被转交人姓名,仅转交操作时必填
*/
private String transferName;
}
\ No newline at end of file
/**
* @(#)FlowRpcService.java, 2022/11/16.
* <p/>
* Copyright 2022 Netease, Inc. All rights reserved.
* NETEASE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package com.netease.mail.yanxuan.change.integration.todo;
import java.util.List;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
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.flow.NodeSubmitReqDTO;
import com.netease.yanxuan.missa.client.annotation.MissaClient;
/**
* @Author zcwang
* @Date 2022/11/16
*/
@Service
@MissaClient(serviceCode = "yanxuan-sc-todo-center")
public interface TodoRpcService {
/**
* 创建待办
* @param param
* @return
*/
@PostMapping(value = "/xhr/todo/task/create.json", consumes = MediaType.APPLICATION_JSON_VALUE)
AjaxResponse<TaskCreateDTO> create(TaskCreateParamVO param);
/**
* 处理待办
* @param param
* @return
*/
@PostMapping(value = "/xhr/todo/task/process.json", consumes = MediaType.APPLICATION_JSON_VALUE)
AjaxResponse<List<String>> progress(TaskProcessParamVO param);
}
/**
* @(#)TaskHandlerList.java, 2022/11/28.
* <p/>
* Copyright 2022 Netease, Inc. All rights reserved.
* NETEASE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package com.netease.mail.yanxuan.change.integration.todo;
/**
* @Author zcwang
* @Date 2022/11/28
*/
public class UserInfo {
private String name;
private String uid;
}
\ No newline at end of file
......@@ -33,14 +33,14 @@ public class TestController {
@PostMapping("/createToDo")
public AjaxResult<Void> createTodoTask(ChangeRecord entity) {
log.info("[createToDoTask] entity:{}", JSON.toJSONString(entity));
changeFlowBiz.createSupplierTodoTask(entity);
changeFlowBiz.createTodoTask(entity);
return AjaxResult.success();
}
@PostMapping("/finishToDo")
public AjaxResult<Void> finishTodoTask(ChangeRecord entity) {
log.info("[createToDoTask] entity:{}", JSON.toJSONString(entity));
changeFlowBiz.createSupplierTodoTask(entity);
changeFlowBiz.createTodoTask(entity);
return AjaxResult.success();
}
}
\ No newline at end of file
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