会议审批
This commit is contained in:
1 parent
62e136f22a
commit
b05665afd5
8 files changed
+107
-5
No files matched your search
+4
-3
@@ -11,7 +11,8 @@ public final class IntegratedFlowConstant {
|
||||
public static final String INTEGRATED_VISITOR= "INTEGRATED_VISITOR";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 会议预约
|
||||
*/
|
||||
public static final String INTEGRATED_MEETING_BOOKING = "MEETING_CHECK";
|
||||
}
|
||||
+3
-1
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.integrated.entity.MeetingBookingEntity;
|
||||
import com.bsd.pjcloud.integrated.service.MeetingBookingService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -50,7 +51,7 @@ public class MeetingBookingController {
|
||||
public R getMeetingBookingPage(@ParameterObject Page page, @ParameterObject MeetingBookingEntity meetingBooking) {
|
||||
LambdaQueryWrapper<MeetingBookingEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(StrUtil.isNotBlank(meetingBooking.getTitle()),MeetingBookingEntity::getTitle,meetingBooking.getTitle());
|
||||
return R.ok(meetingBookingService.page(page, wrapper));
|
||||
return R.ok(meetingBookingService.pageScope(page, wrapper));
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +77,7 @@ public class MeetingBookingController {
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('integrated_meetingBooking_add')" )
|
||||
public R save(@RequestBody MeetingBookingEntity meetingBooking) {
|
||||
meetingBooking.setDeptId(SecurityUtils.getUser().getDeptId());
|
||||
return R.ok(meetingBookingService.save(meetingBooking));
|
||||
}
|
||||
|
||||
|
||||
+61
-1
@@ -3,13 +3,24 @@ package com.bsd.pjcloud.integrated.controller;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.exception.ServiceException;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.flow.task.api.feign.RemoteFlowApiFlowService;
|
||||
import com.bsd.pjcloud.flow.task.constant.TaskCheckStatusEnum;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessInstanceParamDto;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordParamDto;
|
||||
import com.bsd.pjcloud.flow.task.entity.Process;
|
||||
import com.bsd.pjcloud.flow.task.utils.GetCheckReasonUtils;
|
||||
import com.bsd.pjcloud.flow.task.vo.CheckStatusAndReasonVo;
|
||||
import com.bsd.pjcloud.integrated.constant.IntegratedFlowConstant;
|
||||
import com.bsd.pjcloud.integrated.dto.flow.MeetingFlowDto;
|
||||
import com.bsd.pjcloud.integrated.dto.meeting.app.MeetingPageDto;
|
||||
import com.bsd.pjcloud.integrated.entity.MeetingBookingEntity;
|
||||
import com.bsd.pjcloud.integrated.entity.MeetingRoomEntity;
|
||||
@@ -32,6 +43,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.time.LocalTime;
|
||||
import java.time.LocalDate;
|
||||
@@ -58,6 +70,8 @@ public class MeetingRoomController {
|
||||
|
||||
private final MeetingBookingService meetingBookingService;
|
||||
|
||||
private final RemoteFlowApiFlowService remoteFlowApiFlowService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
@@ -235,6 +249,7 @@ public class MeetingRoomController {
|
||||
|
||||
@PostMapping("/{roomId}/book")
|
||||
@Operation(summary = "预约会议室", description = "预约会议室")
|
||||
@Transactional
|
||||
public R<Boolean> bookMeetingRoom(@PathVariable("roomId") Long roomId, @RequestBody MeetingBookingReqVo reqVo) {
|
||||
// 1. 验证会议室是否存在
|
||||
MeetingRoomEntity room = meetingRoomService.getById(roomId);
|
||||
@@ -297,8 +312,29 @@ public class MeetingRoomController {
|
||||
booking.setBookingDate(bookingDate);
|
||||
booking.setStartTime(startTime);
|
||||
booking.setEndTime(endTime);
|
||||
booking.setCheckStatus(TaskCheckStatusEnum.RESULT.getCode());
|
||||
|
||||
|
||||
//发起流程
|
||||
R<Process> processByBusinessKey = remoteFlowApiFlowService.getProcessByBusinessKey(IntegratedFlowConstant.INTEGRATED_MEETING_BOOKING);
|
||||
if (!processByBusinessKey.isOk() || processByBusinessKey.getData() == null) {
|
||||
throw new ServiceException("流程配置获取失败: " + processByBusinessKey.getMsg());
|
||||
}
|
||||
Process process = processByBusinessKey.getData();
|
||||
|
||||
MeetingFlowDto meetingFlowDto = new MeetingFlowDto();
|
||||
meetingFlowDto.setRoomName(room.getRoomName());
|
||||
meetingFlowDto.setApplicantName(SecurityUtils.getUser().getUsername());
|
||||
meetingFlowDto.setMeetingTime(booking.getBookingDate() + " " +booking.getStartTime() + "-" + booking.getEndTime());
|
||||
Map<String, Object> stringObjectMap = BeanUtil.beanToMap(meetingFlowDto);
|
||||
ProcessInstanceParamDto processInstanceParamDto = new ProcessInstanceParamDto();
|
||||
processInstanceParamDto.setFlowId(process.getFlowId());
|
||||
processInstanceParamDto.setParamMap(stringObjectMap);
|
||||
|
||||
R<String> stringR = remoteFlowApiFlowService.startProcessInstance(processInstanceParamDto);
|
||||
|
||||
|
||||
booking.setCheckStatus(TaskCheckStatusEnum.PADDING.getCode());
|
||||
booking.setProcessInstanceId(stringR.getData());
|
||||
boolean success = meetingBookingService.save(booking);
|
||||
return R.ok(success);
|
||||
}
|
||||
@@ -357,4 +393,28 @@ public class MeetingRoomController {
|
||||
return R.ok(booking);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/flow-callback")
|
||||
@Operation(summary = "流程节点回调通知")
|
||||
@Inner(value = false)
|
||||
@Transactional
|
||||
public R flowCallback(@RequestBody ProcessNodeRecordParamDto processNodeRecordParamDto) {
|
||||
String processInstanceId = processNodeRecordParamDto.getProcessInstanceId();
|
||||
MeetingBookingEntity meetingBookingEntity = new MeetingBookingEntity();
|
||||
// meetingBookingEntity.setProcessInstanceId(processInstanceId);
|
||||
System.out.println(processNodeRecordParamDto.getData());
|
||||
LambdaQueryWrapper<MeetingBookingEntity> boxesBookingEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
boxesBookingEntityLambdaQueryWrapper.eq(MeetingBookingEntity::getProcessInstanceId, processInstanceId);
|
||||
CheckStatusAndReasonVo checkReason = GetCheckReasonUtils.getCheckReason(processNodeRecordParamDto);
|
||||
meetingBookingEntity.setCheckStatus(checkReason.getCheckStatus());
|
||||
meetingBookingEntity.setCheckReason(checkReason.getCheckReason());
|
||||
meetingBookingService.update(meetingBookingEntity,boxesBookingEntityLambdaQueryWrapper);
|
||||
return R.ok();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.bsd.pjcloud.integrated.dto.flow;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MeetingFlowDto {
|
||||
|
||||
private String roomName;
|
||||
|
||||
private String applicantName;
|
||||
|
||||
private String meetingTime;
|
||||
}
|
||||
+6
@@ -132,4 +132,10 @@ public class MeetingBookingEntity extends Model<MeetingBookingEntity> {
|
||||
@Schema(description = "预约日期")
|
||||
private LocalDate bookingDate;
|
||||
|
||||
@Schema(description = "流程实例id")
|
||||
private String processInstanceId;
|
||||
|
||||
@Schema(description = "审批原因")
|
||||
private String checkReason;
|
||||
|
||||
}
|
||||
+10
@@ -1,8 +1,18 @@
|
||||
package com.bsd.pjcloud.integrated.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.integrated.entity.MeetingBookingEntity;
|
||||
|
||||
public interface MeetingBookingService extends IService<MeetingBookingEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page
|
||||
* @param wrapper
|
||||
* @return
|
||||
*/
|
||||
Object pageScope(Page page, LambdaQueryWrapper<MeetingBookingEntity> wrapper);
|
||||
}
|
||||
+7
@@ -1,6 +1,9 @@
|
||||
package com.bsd.pjcloud.integrated.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.integrated.entity.MeetingBookingEntity;
|
||||
import com.bsd.pjcloud.integrated.mapper.MeetingBookingMapper;
|
||||
import com.bsd.pjcloud.integrated.service.MeetingBookingService;
|
||||
@@ -13,4 +16,8 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@Service
|
||||
public class MeetingBookingServiceImpl extends ServiceImpl<MeetingBookingMapper, MeetingBookingEntity> implements MeetingBookingService {
|
||||
@Override
|
||||
public Object pageScope(Page page, LambdaQueryWrapper<MeetingBookingEntity> wrapper) {
|
||||
return baseMapper.selectPageByScope(page, wrapper, DataScope.of());
|
||||
}
|
||||
}
|
||||
+2
@@ -21,6 +21,8 @@
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
<result property="bookingDate" column="booking_date"/>
|
||||
<result property="processInstanceId" column="process_instance_id"/>
|
||||
<result property="checkReason" column="check_reason"/>
|
||||
</resultMap>
|
||||
<select id="findByRoomIdAndDate" resultType="com.bsd.pjcloud.integrated.entity.MeetingBookingEntity">
|
||||
SELECT * FROM meeting_booking WHERE room_id = #{roomId} AND start_time >= #{date} AND start_time <= #{date}
|
||||
|
||||
Reference in new issue
Block a user