0831会议室禅道问题修改

This commit is contained in:
zhangzhikang 2022-08-31 18:27:31 +08:00
parent ce1bce47c5
commit 9c7470a123
5 changed files with 38 additions and 5 deletions

View File

@ -12,6 +12,11 @@ import io.renren.modules.meeting.dto.TMeetingroomBookDTO;
import io.renren.modules.meeting.dto.TMeetingroomDTO; import io.renren.modules.meeting.dto.TMeetingroomDTO;
import io.renren.modules.meeting.service.TMeetingroomBookService; import io.renren.modules.meeting.service.TMeetingroomBookService;
import io.renren.modules.meeting.service.TMeetingroomService; import io.renren.modules.meeting.service.TMeetingroomService;
import io.renren.modules.notice.dto.SysNoticeDTO;
import io.renren.modules.notice.enums.NoticeStatusEnum;
import io.renren.modules.notice.service.SysNoticeService;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.sys.dto.SysUserDTO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
@ -21,6 +26,7 @@ import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.ParseException; import java.text.ParseException;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -33,6 +39,8 @@ public class BookMeetingRoomController {
private TMeetingroomBookService tMeetingroomBookService; private TMeetingroomBookService tMeetingroomBookService;
@Resource @Resource
private TMeetingroomService tMeetingroomService; private TMeetingroomService tMeetingroomService;
@Resource
private SysNoticeService sysNoticeService;
@GetMapping("list") @GetMapping("list")
@ApiOperation("搜索可以预约的会议室") @ApiOperation("搜索可以预约的会议室")
@ -79,7 +87,7 @@ public class BookMeetingRoomController {
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
if (tMeetingroomBookService.checkBookRepeat(dto)){ if (tMeetingroomBookService.checkBookRepeat(dto)){
return new Result().error("该会议室在预申请时段已经存在申请会议,请申请其他会议室或者选择其他时段"); return new Result().error(505,"该时段已被预约!");
} }
dto.setState(1); dto.setState(1);
tMeetingroomBookService.save(dto); tMeetingroomBookService.save(dto);
@ -114,7 +122,27 @@ public class BookMeetingRoomController {
public Result update(@RequestBody TMeetingroomBookDTO dto){ public Result update(@RequestBody TMeetingroomBookDTO dto){
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
dto.setAuditor(SecurityUser.getUser().getId());
dto.setAuditTime(new Date());
tMeetingroomBookService.update(dto); tMeetingroomBookService.update(dto);
// 修改之后推送存通知sysNotice
String state = dto.getState() == 2?"通过":"不通过";
String content = "【通知】" + dto.getName() + ",您发起的" + dto.getRoomName() +
"会议室申请,审核结果为:" + state;
SysNoticeDTO sysNoticeDTO = new SysNoticeDTO();
sysNoticeDTO.setType(2);
sysNoticeDTO.setTitle("会议室申请审核结果通知");
sysNoticeDTO.setContent(content); // 通知内容
sysNoticeDTO.setReceiverType(1);
sysNoticeDTO.setReceiverTypeIds(dto.getCreator().toString());
sysNoticeDTO.setStatus(NoticeStatusEnum.SEND.value());
sysNoticeDTO.setSenderName("流程系统");
sysNoticeDTO.setSenderDate(new Date());
sysNoticeDTO.setCreator(dto.getAuditor());
sysNoticeDTO.setCreateDate(new Date());
sysNoticeDTO.setFrom("通知");
sysNoticeService.save(sysNoticeDTO);
return new Result(); return new Result();
} }
} }

View File

@ -1,5 +1,6 @@
package io.renren.modules.meeting.controller; package io.renren.modules.meeting.controller;
import java.util.Date;
import java.util.Map; import java.util.Map;
import javax.annotation.Resource; import javax.annotation.Resource;
import io.renren.common.annotation.LogOperation; import io.renren.common.annotation.LogOperation;
@ -12,6 +13,7 @@ import io.renren.common.validator.group.DefaultGroup;
import io.renren.common.validator.group.UpdateGroup; import io.renren.common.validator.group.UpdateGroup;
import io.renren.modules.meeting.dto.TMeetingroomDTO; import io.renren.modules.meeting.dto.TMeetingroomDTO;
import io.renren.modules.meeting.service.TMeetingroomService; import io.renren.modules.meeting.service.TMeetingroomService;
import io.renren.modules.security.user.SecurityUser;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
@ -71,6 +73,8 @@ public class MeetingroomController {
public Result update(@RequestBody TMeetingroomDTO dto){ public Result update(@RequestBody TMeetingroomDTO dto){
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
dto.setModifier(SecurityUser.getUser().getId());
dto.setModifyTime(new Date());
meetingroomService.update(dto); meetingroomService.update(dto);
return new Result(); return new Result();
} }

View File

@ -31,10 +31,8 @@ public class TMeetingroom extends BaseEntity {
/** 描述 */ /** 描述 */
private String description; private String description;
/** 修改时间 */ /** 修改时间 */
@TableField(fill = FieldFill.UPDATE)
private Date modifyTime; private Date modifyTime;
private Integer delFlag; private Integer delFlag;
@TableField(fill = FieldFill.UPDATE)
private Long modifier; private Long modifier;
} }

View File

@ -42,6 +42,5 @@ public class TMeetingroomBook extends BaseEntity {
/** 审核者 */ /** 审核者 */
private Long auditor; private Long auditor;
/** 审核时间 */ /** 审核时间 */
@TableField(fill = FieldFill.UPDATE)
private Date auditTime; private Date auditTime;
} }

View File

@ -87,8 +87,12 @@ public class TMeetingroomServiceImpl extends CrudServiceImpl<TMeetingroomMapper,
String finalStartTime = "1970-01-01 "+startTime; String finalStartTime = "1970-01-01 "+startTime;
String finalEndTime = "1970-01-01 "+endTime; String finalEndTime = "1970-01-01 "+endTime;
tMeetingroomDTOS = tMeetingroomDTOS.stream().filter(room -> { tMeetingroomDTOS = tMeetingroomDTOS.stream().filter(room -> {
// 根据时间段去预约表搜如果搜不到那就芜湖起飞 // 如果有时间根据时间段去预约表搜如果搜不到那就芜湖起飞
boolean flag = false; boolean flag = false;
if ("null 00:00:00".equals(finalBookDate) || "1970-01-01 ".equals(finalStartTime) || "1970-01-01 ".equals(finalEndTime)){
return true;
}
List<TMeetingroomBookDTO> meetingroomBookDTOS = tMeetingroomBookMapper.selectByRoomAndTime(room.getId(), finalBookDate, List<TMeetingroomBookDTO> meetingroomBookDTOS = tMeetingroomBookMapper.selectByRoomAndTime(room.getId(), finalBookDate,
finalStartTime, finalEndTime); finalStartTime, finalEndTime);
if (CollectionUtils.isEmpty(meetingroomBookDTOS)){ if (CollectionUtils.isEmpty(meetingroomBookDTOS)){