Merge remote-tracking branch 'origin/master'
This commit is contained in:
+3
-3
@@ -166,7 +166,7 @@ public class ActivitiController {
|
||||
taskQuery.processDefinitionKey(processKey); //流程Key
|
||||
}
|
||||
List<Task> list = taskQuery.list();
|
||||
List<Map<String, String>> resut = new ArrayList<>();
|
||||
List<Map<String, String>> result = new ArrayList<>();
|
||||
for (Task task : list) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("流程实例id:", task.getProcessInstanceId());
|
||||
@@ -174,9 +174,9 @@ public class ActivitiController {
|
||||
map.put("任务负责人:", task.getAssignee());
|
||||
map.put("任务名称:", task.getName());
|
||||
//map.put("任务名称:", task.get);
|
||||
resut.add(map);
|
||||
result.add(map);
|
||||
}
|
||||
return Result.OK(resut);
|
||||
return Result.OK(result);
|
||||
}
|
||||
|
||||
@ApiOperation(value="完成任务")
|
||||
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
package com.jero.modules.activiti.process.common.controller;
|
||||
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.modules.activiti.process.common.entity.CenterQueryVO;
|
||||
import com.jero.modules.activiti.process.common.service.ActFlowCommonService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* @author: Mzaxd
|
||||
* @Date: 2023/10/11 9:33
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "流程中心")
|
||||
@RequestMapping("/process/center")
|
||||
public class ProcessCenterController {
|
||||
|
||||
@Resource
|
||||
private ActFlowCommonService actFlowCommonService;
|
||||
|
||||
/**
|
||||
* 待办流程
|
||||
* @param centerQueryVO
|
||||
*/
|
||||
@AutoLog(value = "流程中心-待办流程")
|
||||
@ApiOperation(value="流程中心-待办流程", notes="流程中心-待办流程")
|
||||
@PostMapping("/todoTaskList")
|
||||
public Result<?> todoTaskList(@Valid @RequestBody CenterQueryVO centerQueryVO,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
|
||||
return Result.OK(actFlowCommonService.todoTaskList(centerQueryVO, pageNo, pageSize));
|
||||
}
|
||||
|
||||
/**
|
||||
* 已办流程
|
||||
* @param centerQueryVO
|
||||
*/
|
||||
@AutoLog(value = "流程中心-已办流程")
|
||||
@ApiOperation(value="流程中心-已办流程", notes="流程中心-已办流程")
|
||||
@PostMapping("/doneTaskList")
|
||||
public Result<?> doneTaskList(@Valid @RequestBody CenterQueryVO centerQueryVO) {
|
||||
// TODO
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
* 已发流程
|
||||
* @param centerQueryVO
|
||||
*/
|
||||
@AutoLog(value = "流程中心-已发流程")
|
||||
@ApiOperation(value="流程中心-已发流程", notes="流程中心-已发流程")
|
||||
@PostMapping("/sendTaskList")
|
||||
public Result<?> sendTaskList(@Valid @RequestBody CenterQueryVO centerQueryVO) {
|
||||
// TODO
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
* 监控流程
|
||||
* @param centerQueryVO
|
||||
*/
|
||||
@AutoLog(value = "流程中心-监控流程")
|
||||
@ApiOperation(value="流程中心-监控流程", notes="流程中心-监控流程")
|
||||
@PostMapping("/monitorTaskList")
|
||||
public Result<?> monitorTaskList(@Valid @RequestBody CenterQueryVO centerQueryVO) {
|
||||
// TODO
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
* 草稿
|
||||
* @param centerQueryVO
|
||||
*/
|
||||
@AutoLog(value = "流程中心-草稿")
|
||||
@ApiOperation(value="流程中心-草稿", notes="流程中心-草稿")
|
||||
@PostMapping("/draftList")
|
||||
public Result<?> draftList(@Valid @RequestBody CenterQueryVO centerQueryVO) {
|
||||
// TODO
|
||||
return Result.OK();
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.jero.modules.activiti.process.common.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: Mzaxd
|
||||
* @Date: 2023/10/11 9:37
|
||||
*/
|
||||
@Data
|
||||
public class CenterQueryVO {
|
||||
|
||||
@ApiModelProperty(value = "流程名称")
|
||||
private String prcName;
|
||||
|
||||
@ApiModelProperty(value = "流程编号")
|
||||
private String prcNum;
|
||||
|
||||
@ApiModelProperty(value = "流程类型")
|
||||
private String prcType;
|
||||
|
||||
@ApiModelProperty(value = "流程状态")
|
||||
private String prcState;
|
||||
|
||||
}
|
||||
+178
@@ -0,0 +1,178 @@
|
||||
package com.jero.modules.activiti.process.common.service;
|
||||
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.api.ISysBaseAPI;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.modules.activiti.process.common.entity.CenterQueryVO;
|
||||
import com.jero.modules.activiti.util.SpringContextUtil;
|
||||
import com.jero.modules.sys.utils.UserUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.RuntimeService;
|
||||
import org.activiti.engine.TaskService;
|
||||
import org.activiti.engine.impl.identity.Authentication;
|
||||
import org.activiti.engine.repository.ProcessDefinition;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.activiti.engine.task.TaskQuery;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional
|
||||
public class ActFlowCommonService {
|
||||
|
||||
@Resource
|
||||
private RepositoryService repositoryService;
|
||||
|
||||
@Resource
|
||||
private RuntimeService runtimeService;
|
||||
|
||||
@Resource
|
||||
private TaskService taskService;
|
||||
|
||||
@Resource
|
||||
private ISysBaseAPI sysBaseAPI;
|
||||
|
||||
/**
|
||||
* 启动流程实例
|
||||
*/
|
||||
public ProcessInstance startProcess(String processDefinitionKey, String beanName, String businessId) {
|
||||
ProcessDefinition latestProcessDefinition = repositoryService.createProcessDefinitionQuery()
|
||||
.processDefinitionKey(processDefinitionKey)
|
||||
.orderByProcessDefinitionVersion().desc()
|
||||
.list()
|
||||
.get(0); // 获取最新版本的流程定义
|
||||
|
||||
IActFlowCustomService customService = (IActFlowCustomService) SpringContextUtil.getBean(beanName);
|
||||
// 修改业务的状态
|
||||
customService.startRunTask(businessId);
|
||||
Map<String, Object> variables = customService.setVariables(businessId);
|
||||
// 第一个节点默认通过
|
||||
variables.put("pass", true);
|
||||
// 启动流程
|
||||
ProcessInstance processInstance = runtimeService.startProcessInstanceById(latestProcessDefinition.getId(), variables);
|
||||
// 流程实例ID
|
||||
String processDefinitionId = processInstance.getProcessDefinitionId();
|
||||
log.info("【启动流程】- 成功,processDefinitionId:{}", processDefinitionId);
|
||||
return processInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成提交任务
|
||||
*/
|
||||
public void completeTask(String remark, String taskId, String userId, Map<String, Object> map) {
|
||||
//任务Id 查询任务对象
|
||||
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
|
||||
|
||||
if (task == null) {
|
||||
log.error("completeProcess - task is null!!");
|
||||
throw new JeroBootException("找不到对应任务");
|
||||
}
|
||||
|
||||
//任务对象 获取流程实例Id
|
||||
String processInstanceId = task.getProcessInstanceId();
|
||||
|
||||
//设置审批人的userId
|
||||
Authentication.setAuthenticatedUserId(userId);
|
||||
|
||||
//添加记录
|
||||
taskService.addComment(taskId, processInstanceId, remark);
|
||||
log.info("-----------完成任务操作 开始----------");
|
||||
log.info("任务Id=" + taskId);
|
||||
log.info("负责人id=" + userId);
|
||||
log.info("流程实例id=" + processInstanceId);
|
||||
//完成办理
|
||||
taskService.complete(taskId, map);
|
||||
log.info("-----------完成任务操作 结束----------");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看个人任务列表
|
||||
*/
|
||||
public List<Map<String, Object>> myTaskList(String userid) {
|
||||
TaskQuery taskQuery = taskService.createTaskQuery().taskAssignee(userid);
|
||||
List<Task> list = taskQuery.orderByTaskCreateTime().desc().list();
|
||||
List<Map<String, Object>> listMap = new ArrayList<>();
|
||||
for (Task task : list) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("taskId", task.getId());
|
||||
map.put("taskName", task.getName());
|
||||
map.put("description", task.getDescription());
|
||||
map.put("priority", task.getPriority());
|
||||
map.put("owner", task.getOwner());
|
||||
map.put("assignee", task.getAssignee());
|
||||
map.put("delegationState", task.getDelegationState());
|
||||
map.put("processInstanceId", task.getProcessInstanceId());
|
||||
map.put("executionId", task.getExecutionId());
|
||||
map.put("processDefinitionId", task.getProcessDefinitionId());
|
||||
map.put("createTime", task.getCreateTime());
|
||||
map.put("taskDefinitionKey", task.getTaskDefinitionKey());
|
||||
map.put("dueDate", task.getDueDate());
|
||||
map.put("category", task.getCategory());
|
||||
map.put("parentTaskId", task.getParentTaskId());
|
||||
map.put("tenantId", task.getTenantId());
|
||||
listMap.add(map);
|
||||
}
|
||||
|
||||
return listMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看个人任务信息
|
||||
*/
|
||||
public List<Map<String, Object>> taskInfoList(String userid, CenterQueryVO centerQueryVO, Integer pageNo, Integer pageSize) {
|
||||
//TODO 分页
|
||||
TaskQuery taskQuery = taskService.createTaskQuery().taskAssignee(userid);
|
||||
|
||||
List<Task> list = taskQuery.orderByTaskCreateTime().desc().list();
|
||||
|
||||
List<Map<String, Object>> listMap = new ArrayList<>();
|
||||
for (Task task : list) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("taskId", task.getId());
|
||||
map.put("prcId", task.getProcessInstanceId());
|
||||
map.put("prcName", task.getProcessDefinitionId());
|
||||
LoginUser assigneeUser = sysBaseAPI.getUserById(task.getAssignee());
|
||||
map.put("assignee", assigneeUser.getId());
|
||||
map.put("assigneeText", assigneeUser.getUsername());
|
||||
map.put("claimTaskTime", task.getCreateTime());
|
||||
ProcessInstance processInstance = runtimeService
|
||||
.createProcessInstanceQuery()
|
||||
.processInstanceId(task.getProcessInstanceId())
|
||||
.singleResult();
|
||||
String prcId = processInstance.getId();
|
||||
//TODO 根据流程Id找到对应业务流程实体
|
||||
|
||||
listMap.add(map);
|
||||
}
|
||||
return listMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转办
|
||||
*/
|
||||
public void transfer(String taskId, String userId) {
|
||||
taskService.setAssignee(taskId, userId);
|
||||
log.info("转办 任务Id:{} 转办用户Id{}", taskId, userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 待办任务列表
|
||||
* @param centerQueryVO
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> todoTaskList(CenterQueryVO centerQueryVO, Integer pageNo, Integer pageSize) {
|
||||
String userId = UserUtils.getUserId();
|
||||
return this.taskInfoList(userId, centerQueryVO, pageNo, pageSize);
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.jero.modules.activiti.process.common.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 业务service 的接口 必须实现接口 实现其方法
|
||||
*/
|
||||
public interface IActFlowCustomService {
|
||||
|
||||
|
||||
/**
|
||||
* 设置流程变量
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> setVariables(String id);
|
||||
|
||||
|
||||
/**
|
||||
* 整个流程开始时需要执行的任务
|
||||
* @param id
|
||||
*/
|
||||
void startRunTask(String id);
|
||||
|
||||
|
||||
/**
|
||||
* 整个流程结束需要执行的任务
|
||||
* @param id
|
||||
*/
|
||||
void endRunTask(String id);
|
||||
}
|
||||
+133
@@ -0,0 +1,133 @@
|
||||
package com.jero.modules.activiti.process.esInitChange.controller;
|
||||
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.modules.activiti.process.esInitChange.entity.ProcessEsInitChange;
|
||||
import com.jero.modules.activiti.process.esInitChange.service.ProcessEsInitChangeService;
|
||||
import com.jero.modules.laws.common.constant.FieldCommon;
|
||||
import com.jero.modules.laws.enterprise.util.EnterpriseStandardUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author: Mzaxd
|
||||
* @Date: 2023/10/10 14:14
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "企标立项变更流程")
|
||||
@RequestMapping("/process/es/initChange")
|
||||
public class ProcessESInitChangeController {
|
||||
|
||||
@Resource
|
||||
private ProcessEsInitChangeService initChangeService;
|
||||
|
||||
@Resource
|
||||
private EnterpriseStandardUtil esUtil;
|
||||
|
||||
/**
|
||||
* 生成企标编号并返回
|
||||
* @param esInitChange
|
||||
*/
|
||||
@AutoLog(value = "企标立项变更流程-生成企标编号并返回")
|
||||
@ApiOperation(value="企标立项变更流程-生成企标编号并返回", notes="企标立项变更流程-生成企标编号并返回")
|
||||
@PostMapping("/getStandardNo")
|
||||
public Result<?> getStandardNo(@Valid @RequestBody ProcessEsInitChange esInitChange) {
|
||||
// 生成企标编号并返回
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put(FieldCommon.ENTERPRISE_STANDARD_CODE, esInitChange.getEnStandardCode());
|
||||
map.put(FieldCommon.ENTERPRISE_NAME_CODE, esInitChange.getEnNameCode());
|
||||
map.put(FieldCommon.STANDARD_CATEGORY_CODE, esInitChange.getStandardCategoryCode());
|
||||
return Result.OK(esUtil.generateStandardNumber(map));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存到待办
|
||||
* @param taskId
|
||||
* @param esInitChange
|
||||
*/
|
||||
@AutoLog(value = "企标立项变更流程-保存到待办")
|
||||
@ApiOperation(value="企标立项变更流程-保存到待办", notes="企标立项变更流程-保存到待办")
|
||||
@PostMapping("/saveToWait")
|
||||
public Result<?> saveToWait(@RequestParam("taskId") String taskId,
|
||||
@RequestBody ProcessEsInitChange esInitChange) {
|
||||
initChangeService.saveToWait(taskId, esInitChange);
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存到草稿
|
||||
* @param esInitChange
|
||||
*/
|
||||
@AutoLog(value = "企标立项变更流程-保存到草稿")
|
||||
@ApiOperation(value="企标立项变更流程-保存到草稿", notes="企标立项变更流程-保存到草稿")
|
||||
@PostMapping("/saveToDraft")
|
||||
public Result<?> saveToWait(@RequestBody ProcessEsInitChange esInitChange) {
|
||||
// TODO 保存到草稿
|
||||
initChangeService.saveToDraft(esInitChange);
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增立项变更申请
|
||||
*
|
||||
* @param esInitChangeList
|
||||
*/
|
||||
@AutoLog(value = "企标立项变更流程-发起立项变更申请")
|
||||
@ApiOperation(value="企标立项变更流程-发起立项变更申请", notes="企标立项变更流程-发起立项变更申请")
|
||||
@PostMapping("/start")
|
||||
public Result<?> startInitChange(@RequestBody List<ProcessEsInitChange> esInitChangeList) {
|
||||
initChangeService.startInitChange(esInitChangeList);
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 同意
|
||||
*
|
||||
* @param taskId
|
||||
* @param esInitChangeList
|
||||
*/
|
||||
@AutoLog(value = "企标立项变更流程-同意")
|
||||
@ApiOperation(value="企标立项变更流程-同意", notes="企标立项变更流程-同意")
|
||||
@PostMapping("/agree")
|
||||
public Result<?> agree(@RequestParam("taskId") String taskId, @RequestBody List<ProcessEsInitChange> esInitChangeList) {
|
||||
initChangeService.approvalInitChange(taskId, esInitChangeList, true);
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
* 驳回
|
||||
*
|
||||
* @param taskId
|
||||
* @param esInitChangeList
|
||||
*/
|
||||
@AutoLog(value = "企标立项变更流程-驳回")
|
||||
@ApiOperation(value="企标立项变更流程-驳回", notes="企标立项变更流程-驳回")
|
||||
@PostMapping("/reject")
|
||||
public Result<?> reject(@RequestParam("taskId") String taskId, @RequestBody List<ProcessEsInitChange> esInitChangeList) {
|
||||
initChangeService.approvalInitChange(taskId, esInitChangeList, false);
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
* 转办
|
||||
*
|
||||
* @param taskId
|
||||
* @param userId
|
||||
*/
|
||||
@AutoLog(value = "企标立项变更流程-转办")
|
||||
@ApiOperation(value="企标立项变更流程-转办", notes="企标立项变更流程-转办")
|
||||
@PostMapping(value = "/transfer")
|
||||
public Result<?> transfer(@RequestParam("taskId") String taskId, @RequestParam("userId") String userId) {
|
||||
initChangeService.transfer(taskId, userId);
|
||||
return Result.OK();
|
||||
}
|
||||
}
|
||||
+354
@@ -0,0 +1,354 @@
|
||||
package com.jero.modules.activiti.process.esInitChange.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 企标计划
|
||||
* @TableName process_es_init_change
|
||||
*/
|
||||
@Data
|
||||
@TableName(value ="process_es_init_change")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="process_es_init_change对象", description="企标立项变更对象")
|
||||
public class ProcessEsInitChange implements Serializable {
|
||||
|
||||
/** 主键ID */
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键ID")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
private String orgCode;
|
||||
|
||||
/**
|
||||
* 0表示未删除,1表示删除
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 流程名称
|
||||
*/
|
||||
private String processName;
|
||||
|
||||
/**
|
||||
* 流程实例Id
|
||||
*/
|
||||
private String processInstanceId;
|
||||
|
||||
/**
|
||||
* 截止日期
|
||||
*/
|
||||
private Date deadlineDate;
|
||||
|
||||
/**
|
||||
* 流程说明
|
||||
*/
|
||||
private String processDescription;
|
||||
|
||||
/**
|
||||
* 申请类别
|
||||
*/
|
||||
private String applicationCategory;
|
||||
|
||||
/**
|
||||
* 项目类型
|
||||
*/
|
||||
private String projectType;
|
||||
|
||||
/**
|
||||
* 原企标编号
|
||||
*/
|
||||
private String originEnStandardNo;
|
||||
|
||||
/**
|
||||
* 新企标编号
|
||||
*/
|
||||
private String newEnStandardNo;
|
||||
|
||||
/**
|
||||
* 原企标名称
|
||||
*/
|
||||
private String originEnStandardName;
|
||||
|
||||
/**
|
||||
* 新企标名称
|
||||
*/
|
||||
private String newEnStandardName;
|
||||
|
||||
/**
|
||||
* 企标英文名称
|
||||
*/
|
||||
private String enStandardEnglishName;
|
||||
|
||||
/**
|
||||
* 企标体系
|
||||
*/
|
||||
private String enStandardSystem;
|
||||
|
||||
/**
|
||||
* 企业标准代号
|
||||
*/
|
||||
@NotBlank
|
||||
private String enStandardCode;
|
||||
|
||||
/**
|
||||
* 企业名称代号
|
||||
*/
|
||||
private String enNameCode;
|
||||
|
||||
/**
|
||||
* 标准类别代号
|
||||
*/
|
||||
@NotBlank
|
||||
private String standardCategoryCode;
|
||||
|
||||
/**
|
||||
* 年代号
|
||||
*/
|
||||
@NotBlank
|
||||
private String decadeCode;
|
||||
|
||||
/**
|
||||
* 标准类型
|
||||
*/
|
||||
private String standardType;
|
||||
|
||||
/**
|
||||
* 企标等级分类
|
||||
*/
|
||||
private String enStandardClassification;
|
||||
|
||||
/**
|
||||
* 草稿计划完成日期
|
||||
*/
|
||||
private Date draftPlannedCompleteDate;
|
||||
|
||||
/**
|
||||
* 征求意见稿计划完成日期
|
||||
*/
|
||||
private Date solicitationDraftPlanCompleteDate;
|
||||
|
||||
/**
|
||||
* 计划报批日期
|
||||
*/
|
||||
private Date planApprovalDate;
|
||||
|
||||
/**
|
||||
* 项目状态
|
||||
*/
|
||||
private String projectStatus;
|
||||
|
||||
/**
|
||||
* 编制说明
|
||||
*/
|
||||
private String compilationDescription;
|
||||
|
||||
/**
|
||||
* 零部件名称
|
||||
*/
|
||||
private String componentName;
|
||||
|
||||
/**
|
||||
* 适用专业
|
||||
*/
|
||||
private String applicableProfession;
|
||||
|
||||
/**
|
||||
* 主起草人
|
||||
*/
|
||||
private String mainDraftingUser;
|
||||
|
||||
/**
|
||||
* 主起草单位
|
||||
*/
|
||||
private String mainDraftingUnit;
|
||||
|
||||
/**
|
||||
* 主起草单位责任人
|
||||
*/
|
||||
private String mainDraftingUnitResponsiblePerson;
|
||||
|
||||
/**
|
||||
* 标准推进人
|
||||
*/
|
||||
private String standardPromoter;
|
||||
|
||||
/**
|
||||
* 草稿完成日期
|
||||
*/
|
||||
private Date draftCompletionDate;
|
||||
|
||||
/**
|
||||
* 提交草稿日期
|
||||
*/
|
||||
private Date draftSubmissionDate;
|
||||
|
||||
/**
|
||||
* 是否征求意见
|
||||
*/
|
||||
private String solicitationOpinionEnabled;
|
||||
|
||||
/**
|
||||
* 征求意见稿完成日期
|
||||
*/
|
||||
private Date solicitationDraftCompletionDate;
|
||||
|
||||
/**
|
||||
* 评审日期
|
||||
*/
|
||||
private Date reviewDate;
|
||||
|
||||
/**
|
||||
* 报批日期
|
||||
*/
|
||||
private Date approvalDate;
|
||||
|
||||
/**
|
||||
* 发布日期
|
||||
*/
|
||||
private Date releaseDate;
|
||||
|
||||
/**
|
||||
* 变更状态
|
||||
*/
|
||||
private String changeStatus;
|
||||
|
||||
/**
|
||||
* 立项背景、立项依据
|
||||
*/
|
||||
private String projectBackground;
|
||||
|
||||
/**
|
||||
* 国际、国家及行业同类标准分析
|
||||
*/
|
||||
private String similarNaStandardsAnalysis;
|
||||
|
||||
/**
|
||||
* 企业同类标准对比分析
|
||||
*/
|
||||
private String similarEnStandardsAnalysis;
|
||||
|
||||
/**
|
||||
* 立项标准的领先性与必要性
|
||||
*/
|
||||
private String standardLeadingNecessity;
|
||||
|
||||
/**
|
||||
* 立项目的及预期效果等
|
||||
*/
|
||||
private String projectExpectedEffects;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remarks;
|
||||
|
||||
/**
|
||||
* 附件
|
||||
*/
|
||||
private String attachment;
|
||||
|
||||
/**
|
||||
* 是否为优质标准
|
||||
*/
|
||||
private String qualityFlag;
|
||||
|
||||
/**
|
||||
* 变更原因
|
||||
*/
|
||||
private String changeReason;
|
||||
|
||||
/**
|
||||
* 新主起草人
|
||||
*/
|
||||
private String newMainDraftingUser;
|
||||
|
||||
/**
|
||||
* 新主起草单位
|
||||
*/
|
||||
private String newMainDraftingUnit;
|
||||
|
||||
/**
|
||||
* 部所联络人
|
||||
*/
|
||||
private String contactUser;
|
||||
|
||||
/**
|
||||
* 标准专家
|
||||
*/
|
||||
private String standardExpert;
|
||||
|
||||
/**
|
||||
* 主起草人主管级领导
|
||||
*/
|
||||
private String mainDraftUserLeader;
|
||||
|
||||
/**
|
||||
* 主起草人主管级领导上级领导
|
||||
*/
|
||||
private String mainDraftUserLeaderLeader;
|
||||
|
||||
/**
|
||||
* 标准化审批人
|
||||
*/
|
||||
private String standardizationApprovalUser;
|
||||
|
||||
/**
|
||||
* 新主起草部门领导的领导
|
||||
*/
|
||||
private String newMainDraftUserLeaderLeader;
|
||||
|
||||
/**
|
||||
* 新主起草部门领导
|
||||
*/
|
||||
private String newMainDraftUserLeader;
|
||||
|
||||
/**
|
||||
* 相关人员
|
||||
*/
|
||||
private String relatedUser;
|
||||
|
||||
/**
|
||||
* 抄送人
|
||||
*/
|
||||
private String copyUser;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1781238971297838971L;
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.jero.modules.activiti.process.esInitChange.entity.enums;
|
||||
|
||||
/**
|
||||
* @author: Mzaxd
|
||||
* @Date: 2023/10/9 16:28
|
||||
*/
|
||||
public enum ESApplicationCategoryEnum {
|
||||
|
||||
INITIATION("立项", "1"),
|
||||
|
||||
CHANGE("变更", "2")
|
||||
;
|
||||
|
||||
private final String name;
|
||||
|
||||
private final String value;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
ESApplicationCategoryEnum(String name, String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.jero.modules.activiti.process.esInitChange.entity.enums;
|
||||
|
||||
/**
|
||||
* @author: Mzaxd
|
||||
* @Date: 2023/10/9 16:28
|
||||
*/
|
||||
public enum ESProjectType {
|
||||
|
||||
/** 变更 **/
|
||||
COMPLETE_TIME_CHANGE("完成时间变更", "1"),
|
||||
WORK_TERMINATE("工作中止", "2"),
|
||||
RESPONSIBLE_DEPT_CHANGE("责任部门变更", "3"),
|
||||
MERGE("合并", "4"),
|
||||
|
||||
/** 立项 **/
|
||||
ENACT("制定", "5"),
|
||||
MODIFY("修订", "6"),
|
||||
;
|
||||
|
||||
private final String name;
|
||||
|
||||
private final String value;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
ESProjectType(String name, String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.jero.modules.activiti.entity;
|
||||
package com.jero.modules.activiti.process.esInitChange.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -7,7 +7,7 @@ import lombok.Data;
|
||||
* @Date: 2023/10/9 16:57
|
||||
*/
|
||||
@Data
|
||||
public class FlowUserInfo {
|
||||
public class FlowUserInfoVO {
|
||||
|
||||
// 主起草人
|
||||
private String mainDraftUser;
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.jero.modules.activiti.process.esInitChange.mapper;
|
||||
|
||||
import com.jero.modules.activiti.process.esInitChange.entity.ProcessEsInitChange;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author ThinkBook
|
||||
* @description 针对表【process_es_init_change(企标计划)】的数据库操作Mapper
|
||||
* @createDate 2023-10-10 13:48:56
|
||||
* @Entity com.jero.modules.activiti.process.esInitChange.entity.ProcessEsInitChange
|
||||
*/
|
||||
public interface ProcessEsInitChangeMapper extends BaseMapper<ProcessEsInitChange> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package com.jero.modules.activiti.process.esInitChange.service;
|
||||
|
||||
import com.jero.modules.activiti.process.esInitChange.entity.ProcessEsInitChange;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ThinkBook
|
||||
* @description 针对表【process_es_init_change(企标计划)】的数据库操作Service
|
||||
* @createDate 2023-10-10 13:48:56
|
||||
*/
|
||||
public interface ProcessEsInitChangeService extends IService<ProcessEsInitChange> {
|
||||
|
||||
/**
|
||||
* 新增记录
|
||||
* @param esInitChange
|
||||
* @return
|
||||
*/
|
||||
void startInitChange(List<ProcessEsInitChange> esInitChange);
|
||||
|
||||
/**
|
||||
* 转办
|
||||
* @param taskId
|
||||
* @param userId
|
||||
*/
|
||||
void transfer(String taskId, String userId);
|
||||
|
||||
/**
|
||||
* 审批
|
||||
* @param taskId
|
||||
* @param esInitChange
|
||||
*/
|
||||
void approvalInitChange(String taskId, List<ProcessEsInitChange> esInitChange, boolean pass);
|
||||
|
||||
/**
|
||||
* 保存到待办
|
||||
* @param taskId
|
||||
* @param esInitChange
|
||||
*/
|
||||
void saveToWait(String taskId, ProcessEsInitChange esInitChange);
|
||||
|
||||
/**
|
||||
* 保存到草稿
|
||||
* @param esInitChange
|
||||
*/
|
||||
void saveToDraft(ProcessEsInitChange esInitChange);
|
||||
}
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
package com.jero.modules.activiti.process.esInitChange.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.modules.activiti.process.common.service.ActFlowCommonService;
|
||||
import com.jero.modules.activiti.process.common.service.IActFlowCustomService;
|
||||
import com.jero.modules.activiti.process.esInitChange.entity.ProcessEsInitChange;
|
||||
import com.jero.modules.activiti.process.esInitChange.service.ProcessEsInitChangeService;
|
||||
import com.jero.modules.activiti.process.esInitChange.mapper.ProcessEsInitChangeMapper;
|
||||
import com.jero.modules.laws.enterprise.util.EnterpriseStandardUtil;
|
||||
import com.jero.modules.sys.utils.UserUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author ThinkBook
|
||||
* @description 针对表【process_es_init_change(企标计划)】的数据库操作Service实现
|
||||
* @createDate 2023-10-10 13:48:56
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = JeroBootException.class)
|
||||
@Slf4j
|
||||
public class ProcessEsInitChangeServiceImpl extends ServiceImpl<ProcessEsInitChangeMapper, ProcessEsInitChange>
|
||||
implements ProcessEsInitChangeService, IActFlowCustomService {
|
||||
|
||||
@Resource
|
||||
private ActFlowCommonService actFlowCommonService;
|
||||
|
||||
@Resource
|
||||
private EnterpriseStandardUtil esUtil;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> setVariables(String id) {
|
||||
ProcessEsInitChange initChange = getById(id);
|
||||
// 设置流程中各个节点的人
|
||||
return this.setVariables(initChange);
|
||||
}
|
||||
|
||||
private Map<String, Object> setVariables(ProcessEsInitChange initChange) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
// 设置流程中各个节点的人
|
||||
map.put("createUser", initChange.getCreateBy());
|
||||
map.put("contactUser", initChange.getContactUser());
|
||||
map.put("standardExpertList", Optional.ofNullable(initChange.getStandardExpert()).map(s -> Arrays.asList(s.split(","))).orElse(Collections.emptyList()));
|
||||
map.put("mainDraftUserLeader", initChange.getMainDraftUserLeader());
|
||||
map.put("mainDraftUserLeaderLeader", initChange.getMainDraftUserLeaderLeader());
|
||||
map.put("standardizationApprovalUser", initChange.getStandardizationApprovalUser());
|
||||
map.put("newMainDraftUserLeaderLeader", initChange.getNewMainDraftUserLeaderLeader());
|
||||
map.put("newMainDraftUserLeader", initChange.getNewMainDraftUserLeader());
|
||||
map.put("relatedUserList", Optional.ofNullable(initChange.getRelatedUser()).map(s -> Arrays.asList(s.split(","))).orElse(Collections.emptyList()));
|
||||
map.put("copyUser", initChange.getCopyUser());
|
||||
// 设置流程分支判断变量
|
||||
map.put("applicationCategory", initChange.getApplicationCategory());
|
||||
map.put("projectType", initChange.getProjectType());
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startRunTask(String id) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endRunTask(String id) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startInitChange(List<ProcessEsInitChange> esInitChangeList) {
|
||||
// 校验企标编号是否冲突
|
||||
if (!esUtil.verifyEnStandardNumber(esInitChangeList.get(0).getOriginEnStandardNo())) {
|
||||
throw new JeroBootException("企标编号冲突");
|
||||
}
|
||||
|
||||
String processDefinitionKey = "es-init-change";
|
||||
String userId = UserUtils.getUserId();
|
||||
// 保存到业务流程表
|
||||
saveBatch(esInitChangeList);
|
||||
ProcessEsInitChange initChange = esInitChangeList.get(0);
|
||||
// TODO 根据业务需求设置流程状态
|
||||
// 对数据进行其他操作
|
||||
String beanName = "initChange";
|
||||
|
||||
ProcessInstance processInstance = actFlowCommonService.startProcess(processDefinitionKey, beanName, initChange.getId());
|
||||
|
||||
// 获取流程实例ID
|
||||
String processDefinitionId = processInstance.getProcessDefinitionId();
|
||||
log.info("启动流程实例成功,流程定义ID为:{}", processDefinitionId);
|
||||
|
||||
List<Map<String, Object>> taskList = actFlowCommonService.myTaskList(userId);
|
||||
if (!CollectionUtils.isEmpty(taskList)) {
|
||||
for (Map<String, Object> map : taskList) {
|
||||
if (map.get("assignee").toString().equals(userId) &&
|
||||
map.get("processDefinitionId").toString().equals(processDefinitionId)) {
|
||||
|
||||
log.info("当前用户ID:{},相关联的流程定义ID:{}", userId, map.get("processDefinitionId").toString());
|
||||
log.info("匹配到的任务ID:{}", map.get("taskId").toString());
|
||||
|
||||
actFlowCommonService.completeTask("同意", map.get("taskId").toString(), userId, map);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 设置流程实例Id
|
||||
for (ProcessEsInitChange esInitChange : esInitChangeList) {
|
||||
esInitChange.setProcessInstanceId(processInstance.getId());
|
||||
}
|
||||
// 更新流程实例Id
|
||||
saveOrUpdateBatch(esInitChangeList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transfer(String taskId, String userId) {
|
||||
actFlowCommonService.transfer(taskId, userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void approvalInitChange(String taskId, List<ProcessEsInitChange> esInitChangeList, boolean pass) {
|
||||
String userId = UserUtils.getUserId();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if (pass) {
|
||||
// 校验企标编号是否冲突
|
||||
if (!esUtil.verifyEnStandardNumber(esInitChangeList.get(0).getOriginEnStandardNo())) {
|
||||
throw new JeroBootException("企标编号冲突");
|
||||
}
|
||||
// 更新业务流程数据
|
||||
saveOrUpdateBatch(esInitChangeList);
|
||||
map = setVariables(esInitChangeList.get(0));
|
||||
}
|
||||
// 设置流程变量
|
||||
map.put("pass", pass);
|
||||
// TODO 保存流程审批信息
|
||||
actFlowCommonService.completeTask(esInitChangeList.get(0).getRemarks(), taskId, userId, map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveToWait(String taskId, ProcessEsInitChange esInitChange) {
|
||||
// TODO 检查任务是否存在
|
||||
// 检查任务是否存在
|
||||
saveOrUpdate(esInitChange);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveToDraft(ProcessEsInitChange esInitChange) {
|
||||
// TODO 保存到草稿
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.jero.modules.activiti.util;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Spring 上下文工具, 可用于获取spring 容器中的Bean
|
||||
*/
|
||||
@Component
|
||||
public class SpringContextUtil implements ApplicationContextAware {
|
||||
|
||||
private static ApplicationContext applicationContext;
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
SpringContextUtil.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取spring容器中的bean,通过bean名称获取
|
||||
* @param beanName bean名称
|
||||
* @return: Object 返回Object,需要做强制类型转换
|
||||
*/
|
||||
public static Object getBean(String beanName){
|
||||
return applicationContext.getBean(beanName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取spring容器中的bean, 通过bean类型获取
|
||||
* @param beanClass bean 类型
|
||||
* @return: T 返回指定类型的bean实例
|
||||
*/
|
||||
public static <T> T getBean(Class<T> beanClass) {
|
||||
return applicationContext.getBean(beanClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取spring容器中的bean, 通过bean名称和bean类型精确获取
|
||||
* @param beanName bean 名称
|
||||
* @param beanClass bean 类型
|
||||
* @return: T 返回指定类型的bean实例
|
||||
*/
|
||||
public static <T> T getBean(String beanName, Class<T> beanClass){
|
||||
return applicationContext.getBean(beanName,beanClass);
|
||||
}
|
||||
}
|
||||
+7
@@ -41,6 +41,7 @@ public class EnterpriseStandardUtil {
|
||||
public String generateNewSequenceNumber(String esCodeDictValue, String esNameCodeDictValue, String categoryCodeDictValue) {
|
||||
String sequenceNumber = "0001";
|
||||
// 根据 标准代号/名称代号/标准类别 的相关性生成顺序号
|
||||
// 已经存在的标准
|
||||
LambdaQueryWrapper<LawsEnterpriseStandard> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(LawsEnterpriseStandard::getStandardCode, esCodeDictValue);
|
||||
lambdaQueryWrapper.eq(LawsEnterpriseStandard::getNameCode, esNameCodeDictValue);
|
||||
@@ -50,6 +51,8 @@ public class EnterpriseStandardUtil {
|
||||
|
||||
List<String> dbSequenceNumberList = esList.stream().map(LawsEnterpriseStandard::getStandardNumber)
|
||||
.map(EnterpriseStandardUtil::getSequenceNoFromStandardNo).collect(Collectors.toList());
|
||||
// TODO 流程中的标准
|
||||
|
||||
|
||||
// 获取最大的序列号
|
||||
Optional<String> maxSequence = dbSequenceNumberList.stream().max(Comparator.naturalOrder());
|
||||
@@ -138,4 +141,8 @@ public class EnterpriseStandardUtil {
|
||||
return standardNo.substring(dashIndex - 4, dashIndex);
|
||||
}
|
||||
|
||||
public boolean verifyEnStandardNumber(String StandardNumber) {
|
||||
// TODO 校验企标编号是否有效
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user