|  |  |  | 
|---|
|  |  |  | import com.doumee.core.utils.*; | 
|---|
|  |  |  | import com.doumee.core.wx.MeetConstants; | 
|---|
|  |  |  | import com.doumee.core.wx.SendWxMessage; | 
|---|
|  |  |  | import com.doumee.core.wx.WxPlatNotice; | 
|---|
|  |  |  | import com.doumee.dao.admin.request.BusinessOverDTO; | 
|---|
|  |  |  | import com.doumee.dao.admin.request.QrOpenDoorDto; | 
|---|
|  |  |  | import com.doumee.dao.admin.response.DevWgResponseParam; | 
|---|
|  |  |  | 
|---|
|  |  |  | bookings.setIsdeleted(MeetConstants.ZERO); | 
|---|
|  |  |  | bookings.setStatus(MeetConstants.ZERO); | 
|---|
|  |  |  | bookingsMapper.insert(bookings); | 
|---|
|  |  |  | bookings.setManagerInfo(user.getRealname()); | 
|---|
|  |  |  | //更新会议室预定时间段 | 
|---|
|  |  |  | updateBookingTimes(bookings, user); | 
|---|
|  |  |  | //添加管理人员 | 
|---|
|  |  |  | 
|---|
|  |  |  | //发送会议预约成功通知 | 
|---|
|  |  |  | if(Constants.equalsInteger(bookings.getJoinNotice(),Constants.ZERO)){ | 
|---|
|  |  |  | this.sendNotice(bookings, MeetConstants.TWO); | 
|---|
|  |  |  | SystemUser systemUser = systemUserMapper.selectById(user.getId()); | 
|---|
|  |  |  | this.sendWxNotice(bookings,Objects.isNull(systemUser)||StringUtils.isBlank(systemUser.getOpenid())?null:systemUser.getOpenid(),Constants.ZERO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //发送微信订阅通知 | 
|---|
|  |  |  | //        sendWxMessage.bookingsReservation(systemUserMapper.selectById(bookings.getCreator()), bookings, roomsMapper.selectById(bookings.getRoomId())); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return bookings.getId(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | updateProjectRel(bookings, user); | 
|---|
|  |  |  | handleFile(bookings, user); | 
|---|
|  |  |  | //发送会议通知 | 
|---|
|  |  |  | this.sendNotice(bookings, MeetConstants.TWO); | 
|---|
|  |  |  | if(Constants.equalsInteger(bookings.getJoinNotice(),Constants.ZERO)){ | 
|---|
|  |  |  | this.sendNotice(bookings, MeetConstants.TWO); | 
|---|
|  |  |  | SystemUser systemUser = systemUserMapper.selectById(bookings.getUserId()); | 
|---|
|  |  |  | this.sendWxNotice(bookings,Objects.isNull(systemUser)||StringUtils.isBlank(systemUser.getOpenid())?null:systemUser.getOpenid(),Constants.ZERO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  | bookings.setEditDate(new Date()); | 
|---|
|  |  |  | bookings.setEditor(user.getId()); | 
|---|
|  |  |  | bookingsMapper.updateById(bookings); | 
|---|
|  |  |  | //取消会议 发送取消通知 | 
|---|
|  |  |  | this.sendNotice(bookings, 3); | 
|---|
|  |  |  | //发送微信订阅通知 | 
|---|
|  |  |  | sendWxMessage.bookingsCancel(systemUserMapper.selectById(bookings.getCreator()), bookings, roomsMapper.selectById(bookings.getRoomId())); | 
|---|
|  |  |  | SystemUser systemUser = systemUserMapper.selectById(bookings.getCreator()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | bookings.setManagerInfo(systemUser.getRealname()); | 
|---|
|  |  |  | //取消会议 发送取消通知 | 
|---|
|  |  |  | if(Constants.equalsInteger(bookings.getJoinNotice(),Constants.ZERO)){ | 
|---|
|  |  |  | this.sendNotice(bookings, 3); | 
|---|
|  |  |  | this.sendWxNotice(bookings,Objects.isNull(systemUser)||StringUtils.isBlank(systemUser.getOpenid())?null:systemUser.getOpenid(),Constants.ONE); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  | String avatarPath = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_RESOURCE_PATH).getCode() | 
|---|
|  |  |  | +systemDictDataBiz.queryByCode(Constants.FTP,Constants.MEMBER_IMG).getCode(); | 
|---|
|  |  |  | userResponseList.forEach(i -> { | 
|---|
|  |  |  | if(StringUtils.isNotBlank(i.getAvatar())){ | 
|---|
|  |  |  | if(StringUtils.isNotBlank(i.getAvatar()) && !i.getAvatar().startsWith("HKIMG") ){ | 
|---|
|  |  |  | i.setAvatar(avatarPath+i.getAvatar()); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | i.setAvatar(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | meetingDetailResponse.setUserResponseList(userResponseList); | 
|---|
|  |  |  | 
|---|
|  |  |  | bookings.setStatus(MeetConstants.ONE); | 
|---|
|  |  |  | bookings.setEditDate(new Date()); | 
|---|
|  |  |  | bookings.setEditor(businessOverDTO.getUserId()); | 
|---|
|  |  |  | Rooms rooms = roomsMapper.selectById(bookings.getRoomId()); | 
|---|
|  |  |  | if(Objects.nonNull(rooms)){ | 
|---|
|  |  |  | bookings.setRoomName(rooms.getName()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | bookingsMapper.updateById(bookings); | 
|---|
|  |  |  | //取消会议 发送取消通知 | 
|---|
|  |  |  | this.sendNotice(bookings, 3); | 
|---|
|  |  |  | //发送微信订阅通知 | 
|---|
|  |  |  | //        sendWxMessage.bookingsCancel(systemUserMapper.selectById(bookings.getCreator()), bookings, roomsMapper.selectById(bookings.getRoomId())); | 
|---|
|  |  |  | //        if(Constants.equalsInteger(bookings.getJoinNotice(),Constants.ZERO)){ | 
|---|
|  |  |  | //            this.sendNotice(bookings, 3); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | SystemUser systemUser = systemUserMapper.selectById(bookings.getCreator()); | 
|---|
|  |  |  | bookings.setManagerInfo(systemUser.getRealname()); | 
|---|
|  |  |  | this.sendWxNotice(bookings,Objects.isNull(systemUser)||StringUtils.isBlank(systemUser.getOpenid())?null:systemUser.getOpenid(),Constants.ONE); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | public void dealMeetingStatus(List<MeetingListResponse> meetingResponseList){ | 
|---|
|  |  |  | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(meetingResponseList)){ | 
|---|
|  |  |  | String path = systemDictDataBiz.queryByCode(MeetConstants.FTP, MeetConstants.FTP_RESOURCE_PATH).getCode() + systemDictDataBiz.queryByCode(MeetConstants.FTP, MeetConstants.PROJECTS).getCode(); | 
|---|
|  |  |  | String configMinute = systemDictDataBiz.queryByCode(MeetConstants.SYSTEM, MeetConstants.SOON_START).getCode(); | 
|---|
|  |  |  | String configMinute = systemDictDataBiz.queryByCode(MeetConstants.SYSTEM, MeetConstants.EARLY_START).getCode(); | 
|---|
|  |  |  | Integer minute = StringUtils.isNotBlank(configMinute) ? Integer.valueOf(configMinute) : 120; | 
|---|
|  |  |  | for (MeetingListResponse m:meetingResponseList) { | 
|---|
|  |  |  | if(Constants.equalsInteger(m.getStatus(),Constants.ZERO)&&Constants.equalsInteger(m.getMeetingStatus(),Constants.ONE)){ | 
|---|
|  |  |  | //开始前120分钟 大于当前时间 则显示即将开始 | 
|---|
|  |  |  | if(DateUtil.afterMinutesDate(m.getStartTime(),-minute).getTime()>System.currentTimeMillis()){ | 
|---|
|  |  |  | if( | 
|---|
|  |  |  | DateUtil.afterMinutesDate(m.getStartTime(),-minute).getTime()<=System.currentTimeMillis() | 
|---|
|  |  |  | ){ | 
|---|
|  |  |  | m.setMeetingStatus(4); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | bookings.setEditDate(new Date()); | 
|---|
|  |  |  | bookingsMapper.updateById(bookings); | 
|---|
|  |  |  | this.sendNotice(bookings, MeetConstants.ONE); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //发送微信通知 | 
|---|
|  |  |  | //            sendWxMessage.bookingsStart(systemUserMapper.selectById(bookings.getCreator()), bookings, roomsMapper.selectById(bookings.getRoomId())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.MEETING_START; | 
|---|
|  |  |  | if (sendType.equals(MeetConstants.THREE)){ | 
|---|
|  |  |  | noticeObjectType = Constants.NoticeObjectType.MEETING_CACEL; | 
|---|
|  |  |  | smsConfig   = smsConfigMapper.selectOne(new QueryWrapper<SmsConfig>().lambda().eq(SmsConfig::getCode, | 
|---|
|  |  |  | SmsConstants.meetingContent.meetingBookCancel) | 
|---|
|  |  |  | .eq(SmsConfig::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .last(" limit 1 ")); | 
|---|
|  |  |  | }else   if (sendType.equals(MeetConstants.TWO)){ | 
|---|
|  |  |  | noticeObjectType = Constants.NoticeObjectType.MEETING_BOOK_SUCCESS; | 
|---|
|  |  |  | smsConfig   = smsConfigMapper.selectOne(new QueryWrapper<SmsConfig>().lambda().eq(SmsConfig::getCode, | 
|---|
|  |  |  | 
|---|
|  |  |  | if(smsEmailList.size()>0){ | 
|---|
|  |  |  | smsEmailMapper.insert(smsEmailList);//待发短信数据 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Async | 
|---|
|  |  |  | public void sendWxNotice(Bookings bookings,String openid, Integer sendType) { | 
|---|
|  |  |  | try{ | 
|---|
|  |  |  | List<UserRel> userRelList = userRelMapper.selectJoinList(UserRel.class,new MPJLambdaWrapper<UserRel>() | 
|---|
|  |  |  | .selectAll(UserRel.class) | 
|---|
|  |  |  | .selectAs(SystemUser::getRealname,UserRel::getRealName) | 
|---|
|  |  |  | .selectAs(SystemUser::getMobile,UserRel::getUserPhone) | 
|---|
|  |  |  | .selectAs(SystemUser::getOpenid,UserRel::getOpenid) | 
|---|
|  |  |  | .leftJoin(SystemUser.class,SystemUser::getId,UserRel::getUserId) | 
|---|
|  |  |  | .eq(UserRel::getObjType, MeetConstants.ONE) | 
|---|
|  |  |  | .eq(UserRel::getObjId, bookings.getId()) | 
|---|
|  |  |  | .eq(UserRel::getIsdeleted, MeetConstants.ZERO) | 
|---|
|  |  |  | .isNotNull(SystemUser::getOpenid) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | List<String> openIdList = userRelList.stream().map(i->i.getOpenid()).collect(Collectors.toList()); | 
|---|
|  |  |  | openIdList.add(openid); | 
|---|
|  |  |  | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(openIdList)){ | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Set<String> openIds = new HashSet<String>(openIdList); | 
|---|
|  |  |  | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(openIds)){ | 
|---|
|  |  |  | WxPlatNotice wxPlatNotice = new WxPlatNotice(); | 
|---|
|  |  |  | if(Constants.equalsInteger(sendType,Constants.ZERO)){ | 
|---|
|  |  |  | wxPlatNotice.sendMeetingBookTemplateNotice(systemDictDataBiz,bookings,"CuoDoxOl6SFwi4NhNgOQgKSJVjDD4VCIaPYlnbv_zdY", | 
|---|
|  |  |  | systemDictDataBiz.queryByCode(Constants.WX_PLATFORM, Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(),openIds); | 
|---|
|  |  |  | }else if(Constants.equalsInteger(sendType,Constants.ONE)){ | 
|---|
|  |  |  | wxPlatNotice.sendMeetingBookCancelTemplateNotice(systemDictDataBiz,bookings,"CiB6vCT2InovAoQfudY-lvzLSV0-3lfz3a5GsSFCzd8", | 
|---|
|  |  |  | systemDictDataBiz.queryByCode(Constants.WX_PLATFORM, Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(),openIds); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | .eq("c.DELETED",0) | 
|---|
|  |  |  | .eq("c.status",0) | 
|---|
|  |  |  | .eq("m.WORK_STATUS",0) | 
|---|
|  |  |  | .orderByAsc("c.id") | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | String path = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_RESOURCE_PATH).getCode() | 
|---|