diff --git a/renren-admin/src/main/java/io/renren/modules/meeting/controller/BookMeetingRoomController.java b/renren-admin/src/main/java/io/renren/modules/meeting/controller/BookMeetingRoomController.java index 28016af9..5965d224 100644 --- a/renren-admin/src/main/java/io/renren/modules/meeting/controller/BookMeetingRoomController.java +++ b/renren-admin/src/main/java/io/renren/modules/meeting/controller/BookMeetingRoomController.java @@ -12,6 +12,11 @@ import io.renren.modules.meeting.dto.TMeetingroomBookDTO; import io.renren.modules.meeting.dto.TMeetingroomDTO; import io.renren.modules.meeting.service.TMeetingroomBookService; 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.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -21,6 +26,7 @@ import springfox.documentation.annotations.ApiIgnore; import javax.annotation.Resource; import java.text.ParseException; +import java.util.Date; import java.util.List; import java.util.Map; @@ -33,6 +39,8 @@ public class BookMeetingRoomController { private TMeetingroomBookService tMeetingroomBookService; @Resource private TMeetingroomService tMeetingroomService; + @Resource + private SysNoticeService sysNoticeService; @GetMapping("list") @ApiOperation("搜索可以预约的会议室") @@ -79,7 +87,7 @@ public class BookMeetingRoomController { //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); if (tMeetingroomBookService.checkBookRepeat(dto)){ - return new Result().error("该会议室在预申请时段已经存在申请会议,请申请其他会议室或者选择其他时段"); + return new Result().error(505,"该时段已被预约!"); } dto.setState(1); tMeetingroomBookService.save(dto); @@ -114,7 +122,27 @@ public class BookMeetingRoomController { public Result update(@RequestBody TMeetingroomBookDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + dto.setAuditor(SecurityUser.getUser().getId()); + dto.setAuditTime(new Date()); 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(); } } diff --git a/renren-admin/src/main/java/io/renren/modules/meeting/controller/MeetingroomController.java b/renren-admin/src/main/java/io/renren/modules/meeting/controller/MeetingroomController.java index f5e685d6..d12b1ec0 100644 --- a/renren-admin/src/main/java/io/renren/modules/meeting/controller/MeetingroomController.java +++ b/renren-admin/src/main/java/io/renren/modules/meeting/controller/MeetingroomController.java @@ -1,5 +1,6 @@ package io.renren.modules.meeting.controller; +import java.util.Date; import java.util.Map; import javax.annotation.Resource; 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.modules.meeting.dto.TMeetingroomDTO; import io.renren.modules.meeting.service.TMeetingroomService; +import io.renren.modules.security.user.SecurityUser; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -71,6 +73,8 @@ public class MeetingroomController { public Result update(@RequestBody TMeetingroomDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + dto.setModifier(SecurityUser.getUser().getId()); + dto.setModifyTime(new Date()); meetingroomService.update(dto); return new Result(); } diff --git a/renren-admin/src/main/java/io/renren/modules/meeting/entity/TMeetingroom.java b/renren-admin/src/main/java/io/renren/modules/meeting/entity/TMeetingroom.java index 1cc4103a..351ca214 100644 --- a/renren-admin/src/main/java/io/renren/modules/meeting/entity/TMeetingroom.java +++ b/renren-admin/src/main/java/io/renren/modules/meeting/entity/TMeetingroom.java @@ -31,10 +31,8 @@ public class TMeetingroom extends BaseEntity { /** 描述 */ private String description; /** 修改时间 */ - @TableField(fill = FieldFill.UPDATE) private Date modifyTime; private Integer delFlag; - @TableField(fill = FieldFill.UPDATE) private Long modifier; } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/meeting/entity/TMeetingroomBook.java b/renren-admin/src/main/java/io/renren/modules/meeting/entity/TMeetingroomBook.java index 21bbb93d..fe64a56d 100644 --- a/renren-admin/src/main/java/io/renren/modules/meeting/entity/TMeetingroomBook.java +++ b/renren-admin/src/main/java/io/renren/modules/meeting/entity/TMeetingroomBook.java @@ -42,6 +42,5 @@ public class TMeetingroomBook extends BaseEntity { /** 审核者 */ private Long auditor; /** 审核时间 */ - @TableField(fill = FieldFill.UPDATE) private Date auditTime; } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/meeting/service/Impl/TMeetingroomServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/meeting/service/Impl/TMeetingroomServiceImpl.java index ac72e01c..decd79fa 100644 --- a/renren-admin/src/main/java/io/renren/modules/meeting/service/Impl/TMeetingroomServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/meeting/service/Impl/TMeetingroomServiceImpl.java @@ -87,8 +87,12 @@ public class TMeetingroomServiceImpl extends CrudServiceImpl { - // 根据时间段去预约表搜,如果搜不到,那就芜湖起飞 + // 如果有时间,根据时间段去预约表搜,如果搜不到,那就芜湖起飞 boolean flag = false; + if ("null 00:00:00".equals(finalBookDate) || "1970-01-01 ".equals(finalStartTime) || "1970-01-01 ".equals(finalEndTime)){ + return true; + } + List meetingroomBookDTOS = tMeetingroomBookMapper.selectByRoomAndTime(room.getId(), finalBookDate, finalStartTime, finalEndTime); if (CollectionUtils.isEmpty(meetingroomBookDTOS)){