修改以前的垃圾代码
This commit is contained in:
+6
-21
@@ -2,7 +2,6 @@ package com.adc.da.wkflow.business_activiti.define;
|
||||
|
||||
import com.adc.da.sys.entity.UserEO;
|
||||
import com.adc.da.sys.service.iservice.IUserEoService;
|
||||
import com.adc.da.wkflow.enums.FlowTypeEnum;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
@@ -15,7 +14,6 @@ import com.adc.da.wkflow.business_main.entity.*;
|
||||
import com.adc.da.wkflow.business_main.service.IBusProcessNameService;
|
||||
import com.adc.da.wkflow.enums.SubmitStatusEnum;
|
||||
import com.adc.da.wkflow.util.ImpulseSenderUtils;
|
||||
import com.adc.da.wkflow.util.SessionTool;
|
||||
import com.adc.da.wkflow.util.activiti.ActivitiTools;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -173,7 +171,9 @@ public class ActivitDefineController extends BaseAction {
|
||||
busProcessName.setCreatUserName(byId.getUsname());
|
||||
busProcessName.setPrcNum((String) prcNameAndPrcNum.get("prcNum"));
|
||||
busProcessName.setPrcType(prcType);
|
||||
busProcessName.setMes(JSON.toJSONString(msg, SerializerFeature.DisableCircularReferenceDetect));
|
||||
// TODO 待处理字段 ---start
|
||||
// busProcessName.setMes(JSON.toJSONString(msg, SerializerFeature.DisableCircularReferenceDetect));
|
||||
// TODO 待处理字段 ---end
|
||||
busProcessName.setPrcName((String) prcNameAndPrcNum.get("prcName"));
|
||||
busProcessName.setSubmitStatus(SubmitStatusEnum.SUBMIT.getValue());
|
||||
ibusprocessnameService.save(busProcessName);
|
||||
@@ -192,7 +192,9 @@ public class ActivitDefineController extends BaseAction {
|
||||
one.setPrcId(pi.getId());
|
||||
one.setSubmitStatus(SubmitStatusEnum.SUBMIT.getValue());
|
||||
one.setCreatTime(sdf.format(new Date()));
|
||||
one.setMes(JSON.toJSONString(msg, SerializerFeature.DisableCircularReferenceDetect));
|
||||
// TODO 待处理字段 ---start
|
||||
// one.setMes(JSON.toJSONString(msg, SerializerFeature.DisableCircularReferenceDetect));
|
||||
// TODO 待处理字段 ---end
|
||||
ibusprocessnameService.save(one);
|
||||
}
|
||||
|
||||
@@ -200,23 +202,6 @@ public class ActivitDefineController extends BaseAction {
|
||||
return WrapMapper.ok(task.getId());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "启动流程-以key")
|
||||
@ApiImplicitParam(name = "keyName", value = "key")
|
||||
@GetMapping("/start")
|
||||
public Wrapper<String> startProcess(String keyName) {
|
||||
// 在流程启动之前设置发起人
|
||||
identityService.setAuthenticatedUserId(SessionTool.getSessionAdminId());
|
||||
// 启动流程
|
||||
ProcessInstance process = runtimeService.startProcessInstanceByKey(keyName);
|
||||
|
||||
// 用于开启第一个 task任务
|
||||
Task task = taskService.createTaskQuery().processInstanceId(process.getId()).singleResult();
|
||||
task.setAssignee(SessionTool.getSessionAdminId());
|
||||
taskService.saveTask(task);
|
||||
|
||||
return WrapMapper.ok(process.getId() + " : " + process.getProcessDefinitionId());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "判断流程定义key的唯一性")
|
||||
@GetMapping("/check_define_key")
|
||||
public Wrapper<String> check_define_key(String modelId, String key) {
|
||||
|
||||
-59
@@ -1,59 +0,0 @@
|
||||
package com.adc.da.wkflow.business_activiti.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.tmsps.fk.common.util.ChkUtil;
|
||||
import com.adc.da.wkflow.business_main.entity.Datas;
|
||||
import com.adc.da.wkflow.business_main.entity.HiDatas;
|
||||
import com.adc.da.wkflow.business_main.service.IDatasService;
|
||||
import com.adc.da.wkflow.business_main.service.IHiDatasService;
|
||||
import org.activiti.engine.HistoryService;
|
||||
import org.activiti.engine.history.HistoricTaskInstance;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* TODO 任务回退
|
||||
*
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class TaskRollBackService {
|
||||
|
||||
protected Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Autowired
|
||||
private HistoryService historyService;
|
||||
@Autowired
|
||||
private IDatasService datasService;
|
||||
@Autowired
|
||||
private IHiDatasService hiDatasService;
|
||||
|
||||
@Transactional
|
||||
public String rollBack(String backTaskId) {
|
||||
// TODO 流程回退
|
||||
logger.info("任务流程回退-->{}", backTaskId);
|
||||
HistoricTaskInstance preTask = historyService.createHistoricTaskInstanceQuery().taskId(backTaskId)
|
||||
.singleResult();
|
||||
if (ChkUtil.isNull(preTask)) {
|
||||
return "任务不存在";
|
||||
}
|
||||
// 获取任务提交信息
|
||||
QueryWrapper<Datas> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("ACTI_PROC_INST_ID", preTask.getProcessInstanceId());
|
||||
queryWrapper.eq("ACTI_TASK_ID", preTask.getId());
|
||||
Datas datas = datasService.getOne(queryWrapper);
|
||||
QueryWrapper<HiDatas> hiQueryWrapper = new QueryWrapper<>();
|
||||
hiQueryWrapper.eq("DATAS_ID", datas.getObjectId());
|
||||
HiDatas hiDatas = hiDatasService.getOne(hiQueryWrapper);
|
||||
// 删除工作流历史记录数据
|
||||
hiDatasService.rollBack(hiDatas, preTask.getProcessInstanceId());
|
||||
// 删除任务记录数据
|
||||
datasService.rollBack(datas);
|
||||
return "回退成功";
|
||||
}
|
||||
|
||||
}
|
||||
+1
-6
@@ -2,7 +2,6 @@ package com.adc.da.wkflow.business_activiti.service;
|
||||
|
||||
import com.tmsps.fk.common.util.ChkUtil;
|
||||
import com.adc.da.wkflow.business_activiti.dto.TaskCommonQuery;
|
||||
import com.adc.da.wkflow.util.SessionTool;
|
||||
import com.adc.da.wkflow.util.date.DateTools;
|
||||
import org.activiti.engine.TaskService;
|
||||
import org.activiti.engine.task.NativeTaskQuery;
|
||||
@@ -64,11 +63,7 @@ public class TaskTodoService {
|
||||
sb.append(
|
||||
" or (RES.ASSIGNEE_ = de.USER or (RES.ASSIGNEE_ is null and I.TYPE_ = 'candidate' and (I.USER_ID_ = de.USER ))) ");
|
||||
sb.append(" order by RES.CREATE_TIME_ desc ");
|
||||
if(StringUtils.isBlank(taskCommonQuery.getUserId())){
|
||||
nativeTaskQuery = nativeTaskQuery.parameter("userd", SessionTool.getSessionAdminId())
|
||||
.parameter("assignee", SessionTool.getSessionAdminId())
|
||||
.parameter("user_id", SessionTool.getSessionAdminId());
|
||||
}else{
|
||||
if(StringUtils.isNotBlank(taskCommonQuery.getUserId())){
|
||||
nativeTaskQuery = nativeTaskQuery.parameter("userd", taskCommonQuery.getUserId())
|
||||
.parameter("assignee", taskCommonQuery.getUserId())
|
||||
.parameter("user_id", taskCommonQuery.getUserId());
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
package com.adc.da.wkflow.util;
|
||||
|
||||
import com.tmsps.fk.common.util.ChkUtil;
|
||||
import com.tmsps.fk.common.util.CookieUtil;
|
||||
import com.tmsps.fk.common.util.DesUtil;
|
||||
import com.adc.da.wkflow.config.WebConfig;
|
||||
|
||||
/**
|
||||
* Session业务相关工具类
|
||||
*
|
||||
* @author 冯晓东 398479251@qq.com
|
||||
*
|
||||
*/
|
||||
public class SessionMemberTool {
|
||||
|
||||
// Session 分割符
|
||||
private static final String SPLIT = ":";
|
||||
|
||||
/**
|
||||
* 设置 or 取消设置 登录key
|
||||
*
|
||||
* 加密 memberId
|
||||
*
|
||||
* @param sessionKey
|
||||
* @return
|
||||
*/
|
||||
public static String setSessionMemberLoginKey(String memberId) {
|
||||
String sessionKey = DesUtil.encrypt(WebConfig.MEMBERSESSION + SPLIT + memberId, WebConfig.DESKEY);
|
||||
CookieUtil.setCookie(WebUtil.getReponse(), WebConfig.MEMBERSESSION, sessionKey, 10 * 365 * 24 * 60 * 60);
|
||||
return sessionKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密 memberId
|
||||
*
|
||||
* @param loginKey
|
||||
* @return
|
||||
*/
|
||||
public static String getMemberIdFromKey(String loginKey) {
|
||||
if (ChkUtil.isNull(loginKey) || "null".equals(loginKey)) {
|
||||
return null;
|
||||
}
|
||||
System.err.println(loginKey);
|
||||
String key = DesUtil.decrypt(loginKey, WebConfig.DESKEY);
|
||||
if (key == null || !key.startsWith(WebConfig.MEMBERSESSION + SPLIT)) {
|
||||
return null;
|
||||
}
|
||||
String memberId = key.substring((WebConfig.MEMBERSESSION + SPLIT).length());
|
||||
return memberId;
|
||||
}
|
||||
|
||||
public static void setSessionMemberId(String memberId) {
|
||||
WebUtil.getSession().setAttribute("MEMBER_ID", memberId);
|
||||
}
|
||||
|
||||
public static String getSessionMemberId() {
|
||||
return (String) WebUtil.getSession().getAttribute("MEMBER_ID");
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.adc.da.wkflow.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.tmsps.fk.common.util.ChkUtil;
|
||||
import com.tmsps.fk.common.util.CookieUtil;
|
||||
import com.tmsps.fk.common.util.DesUtil;
|
||||
import com.tmsps.fk.common.util.JsonUtil;
|
||||
import com.adc.da.wkflow.config.WebConfig;
|
||||
|
||||
/**
|
||||
* Session业务相关工具类
|
||||
*
|
||||
* @author 冯晓东 398479251@qq.com
|
||||
*
|
||||
*/
|
||||
public class SessionTool {
|
||||
|
||||
// Session 分割符
|
||||
private static final String SPLIT = ":";
|
||||
// 短信验证码
|
||||
public static final String CODE = "SMS_CODE";
|
||||
|
||||
/**
|
||||
* 设置 or 取消设置 登录key
|
||||
*
|
||||
* @param sessionKey
|
||||
*/
|
||||
public static void setSessionAdminLoginKey(String userJson) {
|
||||
String sessionKey = DesUtil.encrypt(WebConfig.ADMINSESSION + SPLIT + userJson, WebConfig.DESKEY);
|
||||
CookieUtil.setCookie(WebUtil.getReponse(), WebConfig.ADMINSESSION, sessionKey, 1 * 24 * 60 * 60);
|
||||
}
|
||||
|
||||
public static JSONObject getSessionAdmin() {
|
||||
String sessionKey = CookieUtil.getCookie(WebUtil.getRequest(), WebConfig.ADMINSESSION);
|
||||
if (ChkUtil.isNull(sessionKey)) {
|
||||
return null;
|
||||
} else {
|
||||
String key = DesUtil.decrypt(sessionKey, WebConfig.DESKEY);
|
||||
if (!key.startsWith(WebConfig.ADMINSESSION + SPLIT)) {
|
||||
return null;
|
||||
}
|
||||
String userJson = key.substring((WebConfig.ADMINSESSION + SPLIT).length());
|
||||
JSONObject user = JsonUtil.jsonStrToJsonObject(userJson);
|
||||
return user;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getSessionAdminId() {
|
||||
JSONObject userJSON = getSessionAdmin();
|
||||
if(ChkUtil.isNotNull(userJSON)) {
|
||||
return userJSON.getString("objectId");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user