| | |
| | | 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.RoomsMapper; |
| | | import com.doumee.dao.business.join.*; |
| | | 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; |
| | | |
| | |
| | | private RoomsMapper roomsMapper; |
| | | @Autowired |
| | | private RoomsJoinMapper roomsJoinMapper; |
| | | @Autowired |
| | | private MultifileJoinMapper multifileJoinMapper; |
| | | |
| | | |
| | | @Autowired |
| | | private RoomTimeJoinMapper roomTimeJoinMapper; |
| | |
| | | if (starttime.after(endtime) || starttime.equals(endtime)) { |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "日期区间错误"); |
| | | } |
| | | |
| | | if(!Constants.equalsInteger(rooms.getFileType(),Constants.TWO)&&CollectionUtils.isEmpty(rooms.getMultifileList())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"未上传文件图片"); |
| | | } |
| | | |
| | | rooms.setCreateDate(new Date()); |
| | | rooms.setIsdeleted(Constants.ZERO); |
| | |
| | | rooms.setStatus(Constants.ZERO); |
| | | rooms.setEditDate(rooms.getCreateDate()); |
| | | 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())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"附件参数错误"); |
| | | } |
| | | multifile.setCreateDate(new Date()); |
| | | multifile.setObjId(rooms.getId()); |
| | | multifile.setObjType(Constants.FOUR); |
| | | multifile.setIsdeleted(Constants.ZERO); |
| | | multifile.setCreator(user.getId()); |
| | | } |
| | | multifileJoinMapper.insert(multifileList); |
| | | } |
| | | rooms.setStartTime(rooms.getStartTime()+":00"); |
| | | rooms.setEndTime(rooms.getEndTime()+":00"); |
| | | rooms.setStartTime(DateUtil.formatDate(starttime.getTime(), "yyyy-MM-dd HH:mm:ss")); |
| | |
| | | if (StringUtils.isBlank(rooms.getName()) || |
| | | StringUtils.isBlank(rooms.getStartTime()) || |
| | | StringUtils.isBlank(rooms.getEndTime()) || |
| | | Objects.isNull(rooms.getFileType()) || |
| | | rooms.getIntervalTime() == null |
| | | ) { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), ResponseStatus.BAD_REQUEST.getMessage()); |
| | |
| | | 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); |
| | | } |
| | | |
| | | |
| | | rooms.setEditDate(new Date()); |
| | | rooms.setEditor(user.getId()); |
| | | |
| | | // if(!Constants.equalsInteger(rooms.getFileType(),Constants.TWO)&&StringUtils.isBlank(rooms.getImgurl())){ |
| | | // throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"未上传文件图片"); |
| | | // } |
| | | // if(Constants.equalsInteger(rooms.getFileType(),Constants.TWO)){ |
| | | // rooms.setImgurl(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())); |
| | | |
| | | multifileJoinMapper.delete(new QueryWrapper<Multifile>().lambda() |
| | | .eq(Multifile::getObjId,rooms.getId()) |
| | | .eq(Multifile::getObjType,Constants.FOUR) |
| | | ); |
| | | |
| | | 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())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"附件参数错误"); |
| | | } |
| | | multifile.setCreateDate(new Date()); |
| | | multifile.setObjId(rooms.getId()); |
| | | multifile.setObjType(Constants.FOUR); |
| | | multifile.setIsdeleted(Constants.ZERO); |
| | | multifile.setCreator(user.getId()); |
| | | } |
| | | multifileJoinMapper.insert(multifileList); |
| | | } |
| | | |
| | | rooms.setStartTime(rooms.getStartTime()+":00"); |
| | | rooms.setEndTime(rooms.getEndTime()+":00"); |
| | |
| | | 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 user_rel u where u.ISDELETED=0 and u.OBJ_ID =t.id and u.USER_ID in (" + StringUtils.strip(collect.toString(),"[]")+" )"); |
| | | 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(),"[]")+" )"); |
| | | } |
| | | |
| | | String path = systemDictDataBiz.queryByCode(Constants.FTP, Constants.FTP_RESOURCE_PATH).getCode() + systemDictDataBiz.queryByCode(MeetConstants.FTP, MeetConstants.PROJECTS).getCode(); |
| | |
| | | findpr.leftJoin(Projects.class,Projects::getId,ProjectRel::getProjectId); |
| | | List<ProjectRel> projectLisr= projectRelJoinMapper.selectJoinList(ProjectRel.class,findpr); |
| | | s.setProjectList(projectLisr); |
| | | |
| | | if(!Constants.equalsInteger(s.getFileType(),Constants.TWO)){ |
| | | List<Multifile > multifileList = multifileJoinMapper.selectList(new QueryWrapper<Multifile>().lambda() |
| | | .eq(Multifile::getObjId,s.getId()) |
| | | .eq(Multifile::getObjType,Constants.FOUR) |
| | | ); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(multifileList)){ |
| | | for (Multifile multifile:multifileList) { |
| | | multifile.setFileurlFull(path + multifile.getFileurl()); |
| | | } |
| | | s.setMultifileList(multifileList); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | return PageData.from(result); |
| | |
| | | .eq("STATUS",Constants.ZERO) |
| | | .eq("ISDELETED",Constants.ZERO) |
| | | .like(StringUtils.isNotBlank(pageWrap.getModel().getRoomsName()),"NAME",pageWrap.getModel().getRoomsName()) |
| | | .exists(" select 1 from user_rel u where u.USER_ID = "+pageWrap.getModel().getUserId()+" and u.ISDELETED = 0 and u.OBJ_ID = rooms.id and u.OBJ_TYPE = 0 ") |
| | | .exists(" select 1 from meeting_user_rel u where u.USER_ID = "+pageWrap.getModel().getUserId()+" and u.ISDELETED = 0 and u.OBJ_ID = rooms.id and u.OBJ_TYPE = 0 ") |
| | | .orderByDesc("CREATE_DATE") |
| | | ); |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.FTP, Constants.FTP_RESOURCE_PATH).getCode() |
| | |
| | | List<ProjectRel> projectList= projectRelJoinMapper.selectJoinList(ProjectRel.class,findProjectRel); |
| | | |
| | | roomsResponse.setProjectList(projectList); |
| | | if(Objects.nonNull(roomsResponse.getFileType()) && !Constants.equalsInteger(roomsResponse.getFileType(),Constants.TWO)){ |
| | | roomsResponse.setMultifileList( |
| | | multifileJoinMapper.selectList(new QueryWrapper<Multifile>().lambda().eq(Multifile::getObjId,roomsResponse.getId()) |
| | | .eq(Multifile::getObjType,Constants.FOUR)) |
| | | ); |
| | | } |
| | | |
| | | |
| | | return roomsResponse; |
| | | } |