|  |  |  | 
|---|
|  |  |  | import com.doumee.biz.system.SystemDictDataBiz; | 
|---|
|  |  |  | import com.doumee.core.constants.ResponseStatus; | 
|---|
|  |  |  | import com.doumee.core.exception.BusinessException; | 
|---|
|  |  |  | import com.doumee.core.model.LoginUserInfo; | 
|---|
|  |  |  | import com.doumee.core.model.PageData; | 
|---|
|  |  |  | import com.doumee.core.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.service.business.third.model.LoginUserInfo; | 
|---|
|  |  |  | import com.doumee.service.business.third.model.PageData; | 
|---|
|  |  |  | import com.doumee.service.business.third.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.core.utils.DESUtil; | 
|---|
|  |  |  | import com.doumee.core.utils.DateUtil; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.doumee.dao.business.model.*; | 
|---|
|  |  |  | import com.doumee.dao.system.model.Multifile; | 
|---|
|  |  |  | import com.doumee.dao.system.model.SystemUser; | 
|---|
|  |  |  | import com.doumee.dao.web.request.MeetingPageRequest; | 
|---|
|  |  |  | import com.doumee.dao.web.request.RoomsRequest; | 
|---|
|  |  |  | import com.doumee.dao.web.response.MeetingListResponse; | 
|---|
|  |  |  | import com.doumee.dao.web.response.ProjectsResponse; | 
|---|
|  |  |  | import com.doumee.dao.web.response.RoomsResponse; | 
|---|
|  |  |  | import com.doumee.service.business.RoomsService; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  | import org.springframework.util.CollectionUtils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.text.ParseException; | 
|---|
|  |  |  | import java.text.SimpleDateFormat; | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  | import java.util.stream.Collectors; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | roomsMapper.insert(rooms); | 
|---|
|  |  |  | if(!Constants.equalsInteger(rooms.getFileType(),Constants.TWO)){ | 
|---|
|  |  |  | List<Multifile> multifileList = rooms.getMultifileList(); | 
|---|
|  |  |  | if(CollectionUtils.isEmpty(multifileList)){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"请上传附件信息"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (Multifile multifile:multifileList) { | 
|---|
|  |  |  | if(Objects.isNull(multifile) | 
|---|
|  |  |  | || StringUtils.isBlank(multifile.getFileurl())){ | 
|---|
|  |  |  | || StringUtils.isBlank(multifile.getFileurl())){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"附件参数错误"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | multifile.setCreateDate(new Date()); | 
|---|
|  |  |  | 
|---|
|  |  |  | Integer re = recordisExist(rooms.getId()); | 
|---|
|  |  |  | if (Constants.equalsInteger(re, Constants.ONE)) { | 
|---|
|  |  |  | //存下预约记录不允许更新开放时间和粒度分钟 | 
|---|
|  |  |  | // throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "会议室存在预约中的记录,不允许修改"); | 
|---|
|  |  |  | //            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "会议室存在预约中的记录,不允许修改"); | 
|---|
|  |  |  | rooms.setStartTime(null); | 
|---|
|  |  |  | rooms.setEndTime(null); | 
|---|
|  |  |  | rooms.setIntervalTime(null); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | roomsMapper.update(rooms, Wrappers.<Rooms>lambdaUpdate() | 
|---|
|  |  |  | .set(Rooms::getFileType, rooms.getFileType()) | 
|---|
|  |  |  | //                .set(Rooms::getEndTime, rooms.getEndTime()) | 
|---|
|  |  |  | //                .set(Rooms::getStartTime, rooms.getStartTime()) | 
|---|
|  |  |  | .set(Rooms::getLimitNum, rooms.getLimitNum()) | 
|---|
|  |  |  | .set(Rooms::getTips, rooms.getTips()) | 
|---|
|  |  |  | .set(Rooms::getIntervalTime, rooms.getIntervalTime()) | 
|---|
|  |  |  | .set(Rooms::getImgurl, rooms.getImgurl()) | 
|---|
|  |  |  | .eq(Rooms::getId, rooms.getId())); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(!Constants.equalsInteger(rooms.getFileType(),Constants.TWO)){ | 
|---|
|  |  |  | List<Multifile> multifileList = rooms.getMultifileList(); | 
|---|
|  |  |  | if(CollectionUtils.isEmpty(multifileList)){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"请上传附件信息"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (Multifile multifile:multifileList) { | 
|---|
|  |  |  | if(Objects.isNull(multifile) | 
|---|
|  |  |  | || StringUtils.isBlank(multifile.getFileurl())){ | 
|---|
|  |  |  | 
|---|
|  |  |  | rooms.setEndTime(DateUtil.formatDate(endtime.getTime(), "yyyy-MM-dd HH:mm:ss")); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //TODO 更新会议室时间段 | 
|---|
|  |  |  | //TODO更 新会议室时间段 | 
|---|
|  |  |  | if (!Constants.equalsInteger(re, Constants.ONE)) { | 
|---|
|  |  |  | updateRoomTimes(rooms, user); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | IPage<Rooms> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); | 
|---|
|  |  |  | MPJLambdaWrapper<Rooms> queryWrapper = new MPJLambdaWrapper<>(); | 
|---|
|  |  |  | Utils.MP.blankToNull(pageWrap.getModel()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | queryWrapper.selectAll(Rooms.class); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | queryWrapper.select("(select count(a.id) from meeting_book a where a.room_id=t.id and a.isdeleted=0 and a.status=0)",Rooms::getBookingNum); | 
|---|
|  |  |  | queryWrapper.orderByDesc(Rooms::getCreateDate); | 
|---|
|  |  |  | queryWrapper.eq(Rooms::getIsdeleted, Constants.ZERO); | 
|---|
|  |  |  | queryWrapper.like(StringUtils.isNotBlank(pageWrap.getModel().getName()),Rooms::getName, pageWrap.getModel().getName()); | 
|---|
|  |  |  | 
|---|
|  |  |  | if(org.apache.commons.collections4.CollectionUtils.isNotEmpty(pageWrap.getModel().getSysList())){ | 
|---|
|  |  |  | //   queryWrapper.leftJoin(UserRel.class,UserRel::getObjId,Rooms::getId); | 
|---|
|  |  |  | List<Integer> collect = pageWrap.getModel().getSysList().stream().map(UserRel::getUserId).collect(Collectors.toList()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | queryWrapper.exists("select u.id from meeting_user_rel u where u.ISDELETED=0 and u.OBJ_ID =t.id and  u.USER_ID in (" +     StringUtils.strip(collect.toString(),"[]")+" )"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|