mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-10-08 02:56:40 +08:00
Compare commits
3 Commits
b815b8e574
...
b0b4e573f6
Author | SHA1 | Date | |
---|---|---|---|
|
b0b4e573f6 | ||
|
de61899eed | ||
|
3a9bdb36f1 |
@ -21,6 +21,8 @@ import org.dromara.common.core.domain.model.SocialLoginBody;
|
||||
import org.dromara.common.core.utils.*;
|
||||
import org.dromara.common.encrypt.annotation.ApiEncrypt;
|
||||
import org.dromara.common.json.utils.JsonUtils;
|
||||
import org.dromara.common.ratelimiter.annotation.RateLimiter;
|
||||
import org.dromara.common.ratelimiter.enums.LimitType;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.common.social.config.properties.SocialLoginConfigProperties;
|
||||
import org.dromara.common.social.config.properties.SocialProperties;
|
||||
@ -198,6 +200,7 @@ public class AuthController {
|
||||
*
|
||||
* @return 租户列表
|
||||
*/
|
||||
@RateLimiter(time = 60, count = 20, limitType = LimitType.IP)
|
||||
@GetMapping("/tenant/list")
|
||||
public R<LoginTenantVo> tenantList(HttpServletRequest request) throws Exception {
|
||||
// 返回对象
|
||||
|
@ -2,6 +2,8 @@ package org.dromara.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.dromara.common.core.constant.SystemConstants;
|
||||
import org.dromara.common.core.utils.StreamUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.system.domain.SysMenu;
|
||||
import org.dromara.system.domain.vo.SysMenuVo;
|
||||
@ -78,13 +80,13 @@ public interface SysMenuMapper extends BaseMapperPlus<SysMenu, SysMenuVo> {
|
||||
* @return 权限列表
|
||||
*/
|
||||
default Set<String> selectMenuPermsByUserId(Long userId) {
|
||||
return new HashSet<>(this.selectObjs(
|
||||
List<String> list = this.selectObjs(
|
||||
new LambdaQueryWrapper<SysMenu>()
|
||||
.select(SysMenu::getPerms)
|
||||
.inSql(SysMenu::getMenuId, this.buildMenuByUserSql(userId))
|
||||
.isNotNull(SysMenu::getPerms)
|
||||
.ne(SysMenu::getPerms, "")
|
||||
));
|
||||
);
|
||||
return new HashSet<>(StreamUtils.filter(list, StringUtils::isNotBlank));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -94,13 +96,13 @@ public interface SysMenuMapper extends BaseMapperPlus<SysMenu, SysMenuVo> {
|
||||
* @return 权限列表
|
||||
*/
|
||||
default Set<String> selectMenuPermsByRoleId(Long roleId) {
|
||||
return new HashSet<>(this.selectObjs(
|
||||
List<String> list = this.selectObjs(
|
||||
new LambdaQueryWrapper<SysMenu>()
|
||||
.select(SysMenu::getPerms)
|
||||
.inSql(SysMenu::getMenuId, this.buildMenuByRoleSql(roleId))
|
||||
.isNotNull(SysMenu::getPerms)
|
||||
.ne(SysMenu::getPerms, "")
|
||||
));
|
||||
);
|
||||
return new HashSet<>(StreamUtils.filter(list, StringUtils::isNotBlank));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -82,6 +82,17 @@ public class TestLeaveController extends BaseController {
|
||||
return R.ok(testLeaveService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交请假并提交流程
|
||||
*/
|
||||
@SaCheckPermission("workflow:leave:add")
|
||||
@Log(title = "请假", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/submitAndFlowStart")
|
||||
public R<TestLeaveVo> submitAndFlowStart(@Validated(AddGroup.class) @RequestBody TestLeaveBo bo) {
|
||||
return R.ok(testLeaveService.submitAndFlowStart(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改请假
|
||||
*/
|
||||
|
@ -31,6 +31,11 @@ public class TestLeaveBo extends BaseEntity {
|
||||
@NotNull(message = "主键不能为空", groups = {EditGroup.class})
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 流程code
|
||||
*/
|
||||
private String flowCode;
|
||||
|
||||
/**
|
||||
* 请假类型
|
||||
*/
|
||||
|
@ -35,6 +35,11 @@ public interface ITestLeaveService {
|
||||
*/
|
||||
TestLeaveVo insertByBo(TestLeaveBo bo);
|
||||
|
||||
/**
|
||||
* 提交请假并发起流程
|
||||
*/
|
||||
TestLeaveVo submitAndFlowStart(TestLeaveBo bo);
|
||||
|
||||
/**
|
||||
* 修改请假
|
||||
*/
|
||||
|
@ -9,10 +9,14 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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.StartProcessReturnDTO;
|
||||
import org.dromara.common.core.domain.event.ProcessTaskEvent;
|
||||
import org.dromara.common.core.domain.event.ProcessDeleteEvent;
|
||||
import org.dromara.common.core.domain.event.ProcessEvent;
|
||||
import org.dromara.common.core.enums.BusinessStatusEnum;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.service.WorkflowService;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
@ -115,6 +119,35 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
|
||||
return MapstructUtils.convert(add, TestLeaveVo.class);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public TestLeaveVo submitAndFlowStart(TestLeaveBo bo) {
|
||||
long day = DateUtil.betweenDay(bo.getStartDate(), bo.getEndDate(), true);
|
||||
// 截止日期也算一天
|
||||
bo.setLeaveDays((int) day + 1);
|
||||
TestLeave leave = MapstructUtils.convert(bo, TestLeave.class);
|
||||
boolean flag = baseMapper.insertOrUpdate(leave);
|
||||
if (flag) {
|
||||
bo.setId(leave.getId());
|
||||
// 后端发起需要忽略权限
|
||||
bo.getParams().put("ignore", true);
|
||||
StartProcessReturnDTO result = workflowService.startWorkFlow(new StartProcessDTO() {{
|
||||
setBusinessId(leave.getId().toString());
|
||||
setFlowCode(StringUtils.isEmpty(bo.getFlowCode()) ? "leave1" : bo.getFlowCode());
|
||||
setVariables(bo.getParams());
|
||||
}});
|
||||
boolean flag1 = workflowService.completeTask(new CompleteTaskDTO() {{
|
||||
setTaskId(result.getTaskId());
|
||||
setMessageType(List.of("1"));
|
||||
setVariables(bo.getParams());
|
||||
}});
|
||||
if (!flag1) {
|
||||
throw new ServiceException("流程发起异常");
|
||||
}
|
||||
}
|
||||
return MapstructUtils.convert(leave, TestLeaveVo.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改请假
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user