Compare commits

...

3 Commits

Author SHA1 Message Date
DoubleH
0f0a3a181e !743 update 注册功能同步优化 验证码校验逻辑
* update 注册功能同步优化 验证码校验逻辑
2025-08-15 08:29:49 +00:00
疯狂的狮子Li
e24e2c51e4 update 优化 验证码校验逻辑 2025-08-15 14:04:17 +08:00
疯狂的狮子Li
2b0dd82d3d update 优化 工作流后台发起或审批可以手动设置办理人 2025-08-15 11:18:46 +08:00
9 changed files with 46 additions and 20 deletions

View File

@ -87,7 +87,7 @@ public class SysRegisterService {
recordLogininfor(tenantId, username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire")); recordLogininfor(tenantId, username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire"));
throw new CaptchaExpireException(); throw new CaptchaExpireException();
} }
if (!code.equalsIgnoreCase(captcha)) { if (!StringUtils.equalsIgnoreCase(code, captcha)) {
recordLogininfor(tenantId, username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error")); recordLogininfor(tenantId, username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error"));
throw new CaptchaException(); throw new CaptchaException();
} }

View File

@ -102,7 +102,7 @@ public class PasswordAuthStrategy implements IAuthStrategy {
loginService.recordLogininfor(tenantId, username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire")); loginService.recordLogininfor(tenantId, username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire"));
throw new CaptchaExpireException(); throw new CaptchaExpireException();
} }
if (!code.equalsIgnoreCase(captcha)) { if (!StringUtils.equalsIgnoreCase(code, captcha)) {
loginService.recordLogininfor(tenantId, username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error")); loginService.recordLogininfor(tenantId, username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error"));
throw new CaptchaException(); throw new CaptchaException();
} }

View File

@ -50,6 +50,11 @@ public class CompleteTaskDTO implements Serializable {
*/ */
private String notice; private String notice;
/**
* 办理人(可不填 用于覆盖当前节点办理人)
*/
private String handler;
/** /**
* 流程变量 * 流程变量
*/ */

View File

@ -30,6 +30,11 @@ public class StartProcessDTO implements Serializable {
*/ */
private String flowCode; private String flowCode;
/**
* 办理人(可不填 用于覆盖当前节点办理人)
*/
private String handler;
/** /**
* 流程变量前端会提交一个元素{'entity': {业务详情数据对象}} * 流程变量前端会提交一个元素{'entity': {业务详情数据对象}}
*/ */

View File

@ -53,6 +53,11 @@ public class CompleteTaskBo implements Serializable {
*/ */
private String notice; private String notice;
/**
* 办理人(可不填 用于覆盖当前节点办理人)
*/
private String handler;
/** /**
* 流程变量 * 流程变量
*/ */

View File

@ -34,6 +34,11 @@ public class StartProcessBo implements Serializable {
@NotBlank(message = "流程定义编码不能为空", groups = {AddGroup.class}) @NotBlank(message = "流程定义编码不能为空", groups = {AddGroup.class})
private String flowCode; private String flowCode;
/**
* 办理人(可不填 用于覆盖当前节点办理人)
*/
private String handler;
/** /**
* 流程变量前端会提交一个元素{'entity': {业务详情数据对象}} * 流程变量前端会提交一个元素{'entity': {业务详情数据对象}}
*/ */

View File

@ -126,6 +126,7 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
variables.put(FlowConstant.AUTO_PASS, autoPass); variables.put(FlowConstant.AUTO_PASS, autoPass);
FlowParams flowParams = FlowParams.build() FlowParams flowParams = FlowParams.build()
.handler(startProcessBo.getHandler())
.flowCode(startProcessBo.getFlowCode()) .flowCode(startProcessBo.getFlowCode())
.variable(startProcessBo.getVariables()) .variable(startProcessBo.getVariables())
.flowStatus(BusinessStatusEnum.DRAFT.getStatus()); .flowStatus(BusinessStatusEnum.DRAFT.getStatus());
@ -186,6 +187,7 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
} }
// 构建流程参数包括变量跳转类型消息处理人权限等信息 // 构建流程参数包括变量跳转类型消息处理人权限等信息
FlowParams flowParams = FlowParams.build() FlowParams flowParams = FlowParams.build()
.handler(completeTaskBo.getHandler())
.variable(variables) .variable(variables)
.skipType(SkipType.PASS.getKey()) .skipType(SkipType.PASS.getKey())
.message(completeTaskBo.getMessage()) .message(completeTaskBo.getMessage())

View File

@ -9,12 +9,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.domain.dto.CompleteTaskDTO;
import org.dromara.common.core.domain.dto.StartProcessDTO; import org.dromara.common.core.domain.dto.StartProcessDTO;
import org.dromara.common.core.domain.dto.StartProcessReturnDTO;
import org.dromara.common.core.domain.event.ProcessTaskEvent;
import org.dromara.common.core.domain.event.ProcessDeleteEvent; import org.dromara.common.core.domain.event.ProcessDeleteEvent;
import org.dromara.common.core.domain.event.ProcessEvent; import org.dromara.common.core.domain.event.ProcessEvent;
import org.dromara.common.core.domain.event.ProcessTaskEvent;
import org.dromara.common.core.enums.BusinessStatusEnum; import org.dromara.common.core.enums.BusinessStatusEnum;
import org.dromara.common.core.exception.ServiceException; import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.service.WorkflowService; import org.dromara.common.core.service.WorkflowService;
@ -132,12 +130,14 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
// 后端发起需要忽略权限 // 后端发起需要忽略权限
bo.getParams().put("ignore", true); bo.getParams().put("ignore", true);
StartProcessDTO startProcess = new StartProcessDTO();
startProcess.setBusinessId(leave.getId().toString());
startProcess.setFlowCode(StringUtils.isEmpty(bo.getFlowCode()) ? "leave1" : bo.getFlowCode());
startProcess.setVariables(bo.getParams());
// 后端发起 如果没有登录用户 比如定时任务 可以手动设置一个处理人id
// startProcess.setHandler("0");
boolean flag1 = workflowService.startCompleteTask(new StartProcessDTO() {{ boolean flag1 = workflowService.startCompleteTask(startProcess);
setBusinessId(leave.getId().toString());
setFlowCode(StringUtils.isEmpty(bo.getFlowCode()) ? "leave1" : bo.getFlowCode());
setVariables(bo.getParams());
}});
if (!flag1) { if (!flag1) {
throw new ServiceException("流程发起异常"); throw new ServiceException("流程发起异常");
} }

View File

@ -161,16 +161,20 @@ public class WorkflowServiceImpl implements WorkflowService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean startCompleteTask(StartProcessDTO startProcess) { public boolean startCompleteTask(StartProcessDTO startProcess) {
try { try {
StartProcessReturnDTO result = flwTaskService.startWorkFlow(new StartProcessBo() {{ StartProcessBo processBo = new StartProcessBo();
setBusinessId(startProcess.getBusinessId()); processBo.setBusinessId(startProcess.getBusinessId());
setFlowCode(startProcess.getFlowCode()); processBo.setFlowCode(startProcess.getFlowCode());
setVariables(startProcess.getVariables()); processBo.setVariables(startProcess.getVariables());
}}); processBo.setHandler(startProcess.getHandler());
boolean flag = flwTaskService.completeTask(new CompleteTaskBo() {{
setTaskId(result.getTaskId()); StartProcessReturnDTO result = flwTaskService.startWorkFlow(processBo);
setMessageType(Collections.singletonList(MessageTypeEnum.SYSTEM_MESSAGE.getCode())); CompleteTaskBo taskBo = new CompleteTaskBo();
setVariables(startProcess.getVariables()); taskBo.setTaskId(result.getTaskId());
}}); taskBo.setMessageType(Collections.singletonList(MessageTypeEnum.SYSTEM_MESSAGE.getCode()));
taskBo.setVariables(startProcess.getVariables());
taskBo.setHandler(startProcess.getHandler());
boolean flag = flwTaskService.completeTask(taskBo);
if (!flag) { if (!flag) {
throw new ServiceException("流程发起异常"); throw new ServiceException("流程发起异常");
} }