mirror of
https://gitee.com/elegant_wings/dbd-meeting.git
synced 2025-06-21 12:29:36 +08:00
会议室占用逻辑调整
This commit is contained in:
parent
d76ad5e7ac
commit
18d769dede
@ -162,12 +162,12 @@ public class MeetingReservationController extends BaseController {
|
||||
public R booking(@RequestBody MeetingReservationDTO meetingReservationDTO) {
|
||||
MeetingReservation meetingReservation = new MeetingReservation();
|
||||
BeanUtils.copyBeanProp(meetingReservation, meetingReservationDTO.getMr());
|
||||
if (meetingReservation.getTimeFormat() > 0) {//非任意时间
|
||||
if (meetingReservation.getTimeFormat() > 0) {
|
||||
Date start = convert(meetingReservationDTO.getMr().getMrdate(), meetingReservation.getTimeFormat(), true);
|
||||
Date end = convert(meetingReservationDTO.getMr().getMrdate(), meetingReservation.getTimeFormat(), false);
|
||||
if (start == null || end == null) return R.error("预约时间解析错误");
|
||||
meetingReservation.setStart(start);
|
||||
meetingReservation.setEnd(end);
|
||||
meetingReservation.getParams().put("startTime",start);
|
||||
meetingReservation.getParams().put("endTime",end);//根据上、下午、晚上,确定具体时间
|
||||
}
|
||||
if (meetingReservation.getEnd().getTime() <= meetingReservation.getStart().getTime()) return R.error("预约时间无效");
|
||||
Long userId = getLoginStaffId();
|
||||
@ -182,10 +182,10 @@ public class MeetingReservationController extends BaseController {
|
||||
/* 预定时间的转换 */
|
||||
private Date convert(String date, Integer timeFormat, boolean start) {
|
||||
String time = "";
|
||||
if (timeFormat == 1) time = start ? " 08:00:00" : " 12:00:00";//1 上午
|
||||
if (timeFormat == 2) time = start ? " 12:00:01" : " 18:00:00";//2 下午
|
||||
if (timeFormat == 3) time = start ? " 18:00:01" : " 23:59:59";//3 晚上
|
||||
if (timeFormat == 4) time = start ? " 08:00:00" : " 23:59:59";//4 全天
|
||||
if (timeFormat == 1) time = start ? " 08:30:00" : " 12:00:00";//1 上午
|
||||
if (timeFormat == 2) time = start ? " 12:00:01" : " 17:30:00";//2 下午
|
||||
if (timeFormat == 3) time = start ? " 17:30:01" : " 23:59:59";//3 晚上
|
||||
if (timeFormat == 4) time = start ? " 08:30:00" : " 23:59:59";//4 全天
|
||||
try {
|
||||
return DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, date + time);
|
||||
} catch (Exception e) {
|
||||
@ -232,8 +232,8 @@ public class MeetingReservationController extends BaseController {
|
||||
if (meetingReservation.getTimeFormat() > 0) {//非任意时间
|
||||
Date start = convert(meetingReservationDTO.getMr().getMrdate(), meetingReservation.getTimeFormat(), true);
|
||||
Date end = convert(meetingReservationDTO.getMr().getMrdate(), meetingReservation.getTimeFormat(), false);
|
||||
meetingReservation.setStart(start);
|
||||
meetingReservation.setEnd(end);
|
||||
meetingReservation.getParams().put("startTime",start);
|
||||
meetingReservation.getParams().put("endTime",end);//根据上、下午、晚上,确定具体时间
|
||||
}
|
||||
if (meetingReservation.getStart() == null || meetingReservation.getEnd() == null)
|
||||
return R.error("预约时间解析错误");//防止用户端置空预约记录时间
|
||||
|
@ -130,7 +130,12 @@ public class MeetingReservationServiceImpl implements IMeetingReservationService
|
||||
@Transactional(rollbackFor = Exception.class, isolation = Isolation.SERIALIZABLE)
|
||||
@Override
|
||||
public String insertMeetingReservation(Long currentUserId, MeetingReservation meetingReservation, MeetingServe[] meetingServes) {
|
||||
List<Long> ids = meetingReservationMapper.checkBooking(meetingReservation.getRoomId(), null, meetingReservation.getStart(), meetingReservation.getEnd());
|
||||
List<Long> ids = meetingReservationMapper.checkBooking(
|
||||
meetingReservation.getRoomId(),
|
||||
null,
|
||||
meetingReservation.getTimeFormat() > 0 ? (Date) meetingReservation.getParams().get("startTime") : meetingReservation.getStart(),
|
||||
meetingReservation.getTimeFormat() > 0 ? (Date) meetingReservation.getParams().get("endTime") : meetingReservation.getEnd()
|
||||
);
|
||||
if (ids.size() > 0) return "会议室已被占用,预约失败";
|
||||
Date now = new Date();
|
||||
meetingReservation.setSn(snService.generate(Sn.Type.REPAIR));
|
||||
@ -240,7 +245,12 @@ public class MeetingReservationServiceImpl implements IMeetingReservationService
|
||||
rList = processRemind(meetingReservation, currentUserId, null, 0, null, null);
|
||||
//提醒--end
|
||||
}
|
||||
List<Long> ids = meetingReservationMapper.checkBooking(meetingReservation.getRoomId(), meetingReservation.getId(), meetingReservation.getStart(), meetingReservation.getEnd());
|
||||
List<Long> ids = meetingReservationMapper.checkBooking(
|
||||
meetingReservation.getRoomId(),
|
||||
meetingReservation.getId(),
|
||||
meetingReservation.getTimeFormat() > 0 ? (Date) meetingReservation.getParams().get("startTime") : meetingReservation.getStart(),
|
||||
meetingReservation.getTimeFormat() > 0 ? (Date) meetingReservation.getParams().get("endTime") : meetingReservation.getEnd()
|
||||
);
|
||||
if (ids.size() > 0) return "会议室已被占用,预约失败";
|
||||
Date now = new Date();
|
||||
meetingReservation.setUpdateTime(now);
|
||||
|
@ -46,8 +46,12 @@ public class RepairRemindPushServiceImpl implements RepairRemindPushService {
|
||||
@Autowired
|
||||
private RedisTemplate<String, String> redisTemplate;
|
||||
|
||||
@Value("${webchatGZH.templateId}")
|
||||
private String templateId;
|
||||
@Value("${webchatGZH.templateRP}")
|
||||
private String templateRP;
|
||||
|
||||
|
||||
@Value("${webchatGZH.templateMR}")
|
||||
private String templateMR;
|
||||
|
||||
@Value("${webchatGZH.appid}")
|
||||
private String appid;
|
||||
@ -95,23 +99,31 @@ public class RepairRemindPushServiceImpl implements RepairRemindPushService {
|
||||
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("touser", openid);
|
||||
param.put("template_id", templateId);
|
||||
param.put("touser", openid);
|
||||
if (repairRemind.getTypeId() == 0) param.put("template_id", templateRP);//工单模板
|
||||
if (repairRemind.getTypeId() == 1) param.put("template_id", templateMR);//会议预约模板
|
||||
|
||||
JSONObject miniprogram = new JSONObject();
|
||||
miniprogram.put("appid", WX_SMALL_APP_ID);
|
||||
miniprogram.put("pagepath", WX_SMALL_APP_PAGE);
|
||||
param.put("miniprogram", miniprogram);
|
||||
|
||||
|
||||
JSONObject dataTime = new JSONObject();
|
||||
dataTime.put("value", time);
|
||||
JSONObject msg = new JSONObject();
|
||||
msg.put("value", content);
|
||||
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("time38", dataTime);
|
||||
data.put("thing37", msg);
|
||||
//工单模板填充数据
|
||||
if (repairRemind.getTypeId() == 0) {
|
||||
data.put("time38", dataTime);
|
||||
data.put("thing37", msg);
|
||||
|
||||
}
|
||||
//会议预约模板填充数据
|
||||
if (repairRemind.getTypeId() == 1) {
|
||||
data.put("time", dataTime);
|
||||
data.put("thing", msg);
|
||||
}
|
||||
param.put("data", data);
|
||||
JSONObject result = send(url, JSON.toJSONString(param));
|
||||
//System.out.println(result.toString());
|
||||
|
@ -147,4 +147,5 @@ webchatGZH: #微信公众号用户绑定及模板消息推送相关配置
|
||||
appid: wxf164eab7ad1d9075
|
||||
secret: 199fc64445882192ae798816d949be0d
|
||||
access: https://company.haxy.com.cn:4443/shoot-hand #pc后端访问地址
|
||||
templateId: 3VU7ZY8RgiR9hcPysc34y-S2PxKQU2JrIT8v_mhkuic #模板消息模板id
|
||||
templateRP: 8zU-6KI4gz0NJeTeAjPbzu9eEBlWe18gGa3PW6h7MbM #工单模板消息模板id
|
||||
templateMR: bxOb3RO8pFGUhYnTaJBoDvTeapmZnczlBOk5zTjiu0U #会议室预约模板消息id
|
||||
|
@ -137,4 +137,5 @@ webchatGZH: #微信公众号用户绑定及模板消息推送相关配置
|
||||
appid: wxf164eab7ad1d9075
|
||||
secret: 199fc64445882192ae798816d949be0d
|
||||
access: https://company.haxy.com.cn:4443/shoot-hand #pc后端访问地址
|
||||
templateId: 3VU7ZY8RgiR9hcPysc34y-S2PxKQU2JrIT8v_mhkuic #模板消息模板id
|
||||
templateRP: 8zU-6KI4gz0NJeTeAjPbzu9eEBlWe18gGa3PW6h7MbM #工单模板消息模板id
|
||||
templateMR: bxOb3RO8pFGUhYnTaJBoDvTeapmZnczlBOk5zTjiu0U #会议室预约模板消息id
|
@ -137,4 +137,5 @@ webchatGZH: #微信公众号用户绑定及模板消息推送相关配置
|
||||
appid: wx88c3ba1d01b33b8b
|
||||
secret: db375b6db9c7b87b1daa48375b45731e
|
||||
access: https://baoxiu.jsgdha.com/shoot-hand #pc后端访问地址
|
||||
templateId: 4jgtzPfyX546n5ZDPHbN69YSSFf8NSOQUDJuPb6bYwA #模板消息模板id
|
||||
templateRP: 4jgtzPfyX546n5ZDPHbN69YSSFf8NSOQUDJuPb6bYwA #工单模板消息模板id
|
||||
templateMR: XXX #会议室预约模板消息id
|
Loading…
x
Reference in New Issue
Block a user