会议室管理
Some checks are pending
Java CI with Maven / build (11) (push) Waiting to run
Java CI with Maven / build (17) (push) Waiting to run
Java CI with Maven / build (8) (push) Waiting to run
yudao-ui-admin CI / build (14.x) (push) Waiting to run
yudao-ui-admin CI / build (16.x) (push) Waiting to run
Some checks are pending
Java CI with Maven / build (11) (push) Waiting to run
Java CI with Maven / build (17) (push) Waiting to run
Java CI with Maven / build (8) (push) Waiting to run
yudao-ui-admin CI / build (14.x) (push) Waiting to run
yudao-ui-admin CI / build (16.x) (push) Waiting to run
This commit is contained in:
parent
930ca83503
commit
3e3cefc587
@ -24,6 +24,7 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
import cn.iocoder.yudao.module.home.controller.admin.hsgl.vo.*;
|
||||
import cn.iocoder.yudao.module.home.dal.dataobject.hsgl.HsglDO;
|
||||
@ -42,7 +43,7 @@ public class HsglController {
|
||||
@Operation(summary = "创建会议室管理")
|
||||
@PreAuthorize("@ss.hasPermission('home:hsgl:create')")
|
||||
public CommonResult<Long> createHsgl(@Valid @RequestBody HsglSaveReqVO createReqVO) {
|
||||
return success(hsglService.createHsgl(createReqVO));
|
||||
return success(hsglService.createHsgl(getLoginUserId(), createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@ -76,6 +77,7 @@ public class HsglController {
|
||||
@PreAuthorize("@ss.hasPermission('home:hsgl:query')")
|
||||
public CommonResult<PageResult<HsglRespVO>> getHsglPage(@Valid HsglPageReqVO pageReqVO) {
|
||||
PageResult<HsglDO> pageResult = hsglService.getHsglPage(pageReqVO);
|
||||
// PageResult<HsglDO> pageResult = hsglService.getHsglPage(getLoginUserId(),pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, HsglRespVO.class));
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,6 @@ public class HsglSaveReqVO {
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "申请人id", requiredMode = Schema.RequiredMode.REQUIRED, example = "30966")
|
||||
@NotNull(message = "申请人id不能为空")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "流程实例的编号", example = "12679")
|
||||
|
@ -38,4 +38,25 @@ public interface HsglMapper extends BaseMapperX<HsglDO> {
|
||||
.orderByDesc(HsglDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
default PageResult<HsglDO> selectPage(Long userId, HsglPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<HsglDO>()
|
||||
.eqIfPresent(HsglDO::getId, reqVO.getId())
|
||||
.eqIfPresent(HsglDO::getTitle, reqVO.getTitle())
|
||||
.likeIfPresent(HsglDO::getName, reqVO.getName())
|
||||
.eqIfPresent(HsglDO::getLocation, reqVO.getLocation())
|
||||
.eqIfPresent(HsglDO::getRoomType, reqVO.getRoomType())
|
||||
.eqIfPresent(HsglDO::getManager, reqVO.getManager())
|
||||
.eqIfPresent(HsglDO::getRoomMax, reqVO.getRoomMax())
|
||||
.eqIfPresent(HsglDO::getCapacity, reqVO.getCapacity())
|
||||
.eqIfPresent(HsglDO::getFacilities, reqVO.getFacilities())
|
||||
.eqIfPresent(HsglDO::getRoomStatus, reqVO.getRoomStatus())
|
||||
.eqIfPresent(HsglDO::getPhoto, reqVO.getPhoto())
|
||||
.eqIfPresent(HsglDO::getRemark, reqVO.getRemark())
|
||||
.eqIfPresent(HsglDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(HsglDO::getUserId, userId)
|
||||
.eqIfPresent(HsglDO::getProcessInstanceId, reqVO.getProcessInstanceId())
|
||||
.betweenIfPresent(HsglDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(HsglDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.home.framework.datapermission.config;
|
||||
import cn.iocoder.yudao.framework.datapermission.core.rule.dept.DeptDataPermissionRuleCustomizer;
|
||||
import cn.iocoder.yudao.module.home.dal.dataobject.bgyp.BgypDO;
|
||||
import cn.iocoder.yudao.module.home.dal.dataobject.clgl.ClglDO;
|
||||
import cn.iocoder.yudao.module.home.dal.dataobject.hsgl.HsglDO;
|
||||
import cn.iocoder.yudao.module.home.dal.dataobject.qjgl.QjglDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
@ -24,6 +25,7 @@ public class homeDataPermissionConfiguration {
|
||||
rule.addDeptColumn(ClglDO.class, "dept"); //车辆管理
|
||||
rule.addDeptColumn(QjglDO.class, "dept_id"); //请假管理
|
||||
rule.addDeptColumn(BgypDO.class, "dept_id"); //办公用品
|
||||
rule.addDeptColumn(HsglDO.class, "dept_id"); //会议室管理
|
||||
// rule.addDeptColumn(DeptDO.class, "id");
|
||||
// user
|
||||
// AdminUserDO 是想要使用权限的表 id 是对那个字段生效 比如 这个表 user_id 使用户id 那就使用 user_id
|
||||
|
@ -21,6 +21,7 @@ public interface HsglService {
|
||||
* @return 编号
|
||||
*/
|
||||
Long createHsgl(@Valid HsglSaveReqVO createReqVO);
|
||||
Long createHsgl(Long userId, @Valid HsglSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新会议室管理
|
||||
@ -51,5 +52,13 @@ public interface HsglService {
|
||||
* @return 会议室管理分页
|
||||
*/
|
||||
PageResult<HsglDO> getHsglPage(HsglPageReqVO pageReqVO);
|
||||
PageResult<HsglDO> getHsglPage(Long userId, HsglPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 更新请假申请的状态
|
||||
*
|
||||
* @param id 编号
|
||||
* @param status 结果
|
||||
*/
|
||||
void updateClglStatus(Long id, Integer status);
|
||||
}
|
||||
|
@ -1,20 +1,22 @@
|
||||
package cn.iocoder.yudao.module.home.service.hsgl;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.home.controller.admin.hsgl.vo.*;
|
||||
import cn.iocoder.yudao.module.home.dal.dataobject.hsgl.HsglDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.home.dal.mysql.hsgl.HsglMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.KNOWLEDGE_NOT_EXISTS;
|
||||
import static cn.iocoder.yudao.module.home.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
@ -25,9 +27,12 @@ import static cn.iocoder.yudao.module.home.enums.ErrorCodeConstants.*;
|
||||
@Service
|
||||
@Validated
|
||||
public class HsglServiceImpl implements HsglService {
|
||||
public static final String PROCESS_KEY = "hsgl-001";
|
||||
|
||||
@Resource
|
||||
private HsglMapper hsglMapper;
|
||||
@Resource
|
||||
private BpmProcessInstanceApi processInstanceApi;
|
||||
|
||||
@Override
|
||||
public Long createHsgl(HsglSaveReqVO createReqVO) {
|
||||
@ -38,6 +43,25 @@ public class HsglServiceImpl implements HsglService {
|
||||
return hsgl.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long createHsgl(Long userId, HsglSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
HsglDO hsgl = BeanUtils.toBean(createReqVO, HsglDO.class)
|
||||
.setUserId(userId).setStatus(BpmTaskStatusEnum.RUNNING.getStatus());
|
||||
hsglMapper.insert(hsgl);
|
||||
|
||||
// 发起 BPM 流程
|
||||
Map<String, Object> processInstanceVariables = new HashMap<>();
|
||||
String processInstanceId = processInstanceApi.createProcessInstance(userId,
|
||||
new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY)
|
||||
.setVariables(processInstanceVariables).setBusinessKey(String.valueOf(hsgl.getId()))
|
||||
.setStartUserSelectAssignees(createReqVO.getStartUserSelectAssignees()));
|
||||
|
||||
hsglMapper.updateById(new HsglDO().setId(hsgl.getId()).setProcessInstanceId(processInstanceId));
|
||||
// 返回
|
||||
return hsgl.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateHsgl(HsglSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
@ -71,4 +95,21 @@ public class HsglServiceImpl implements HsglService {
|
||||
return hsglMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<HsglDO> getHsglPage(Long userId, HsglPageReqVO pageReqVO) {
|
||||
return hsglMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateClglStatus(Long id, Integer status) {
|
||||
validateLeaveExists(id);
|
||||
hsglMapper.updateById(new HsglDO().setId(id).setStatus(status));
|
||||
}
|
||||
|
||||
private void validateLeaveExists(Long id) {
|
||||
if (hsglMapper.selectById(id) == null) {
|
||||
throw exception(KNOWLEDGE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.home.service.hsgl.listener;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.event.BpmProcessInstanceStatusEvent;
|
||||
import cn.iocoder.yudao.module.bpm.event.BpmProcessInstanceStatusEventListener;
|
||||
import cn.iocoder.yudao.module.home.service.hsgl.HsglService;
|
||||
import cn.iocoder.yudao.module.home.service.hsgl.HsglServiceImpl;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component
|
||||
public class BpmHsglStatusListener extends BpmProcessInstanceStatusEventListener {
|
||||
|
||||
@Resource
|
||||
private HsglService hsglService;
|
||||
|
||||
@Override
|
||||
protected String getProcessDefinitionKey() {
|
||||
return HsglServiceImpl.PROCESS_KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEvent(BpmProcessInstanceStatusEvent event) {
|
||||
hsglService.updateClglStatus(Long.parseLong(event.getBusinessKey()), event.getStatus());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user