|  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSON; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONArray; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
|---|
|  |  |  | import com.doumee.api.BaseController; | 
|---|
|  |  |  | import com.doumee.config.annotation.LoginRequired; | 
|---|
|  |  |  | import com.doumee.core.annotation.excel.ExcelExporter; | 
|---|
|  |  |  | import com.doumee.core.annotation.pr.PreventRepeat; | 
|---|
|  |  |  | import com.doumee.core.model.ApiResponse; | 
|---|
|  |  |  | import com.doumee.core.model.LoginUserInfo; | 
|---|
|  |  |  | import com.doumee.core.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.core.model.PageData; | 
|---|
|  |  |  | import com.doumee.core.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.core.utils.DateUtil; | 
|---|
|  |  |  | import com.doumee.dao.business.model.Bookings; | 
|---|
|  |  |  | import com.doumee.dao.business.vo.RoomStatisticsVo; | 
|---|
|  |  |  | import com.doumee.dao.system.dto.UserStatisticsDTO; | 
|---|
|  |  |  | import com.doumee.dao.system.vo.RoomStatisticsVo; | 
|---|
|  |  |  | import com.doumee.dao.system.vo.UserStatisticsVo; | 
|---|
|  |  |  | import com.doumee.dao.web.response.DateTimeResourceDate; | 
|---|
|  |  |  | import com.doumee.dao.web.response.MeetingDetailResponse; | 
|---|
|  |  |  | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.util.CollectionUtils; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  | import javax.servlet.http.HttpServletResponse; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.servlet.http.HttpServletResponse; | 
|---|
|  |  |  | import java.math.BigDecimal; | 
|---|
|  |  |  | import java.math.RoundingMode; | 
|---|
|  |  |  | import java.time.LocalDate; | 
|---|
|  |  |  | import java.time.LocalDateTime; | 
|---|
|  |  |  | import java.time.LocalTime; | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  | import java.util.Set; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author 江蹄蹄 | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping("/create") | 
|---|
|  |  |  | @RequiresPermissions("business:bookings:create") | 
|---|
|  |  |  | public ApiResponse create(@RequestBody Bookings bookings) { | 
|---|
|  |  |  | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); | 
|---|
|  |  |  | LoginUserInfo user = getLoginUser(null); | 
|---|
|  |  |  | bookings.setCreator(user.getId()); | 
|---|
|  |  |  | return ApiResponse.success(bookingsService.create(bookings)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | @GetMapping("/delete/{id}") | 
|---|
|  |  |  | @RequiresPermissions("business:bookings:delete") | 
|---|
|  |  |  | public ApiResponse deleteById(@PathVariable Integer id) { | 
|---|
|  |  |  | bookingsService.deleteById(id); | 
|---|
|  |  |  | bookingsService.deleteById(id,this.getLoginUser(null)); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | for (String id : idArray) { | 
|---|
|  |  |  | idList.add(Integer.valueOf(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | bookingsService.deleteByIdInBatch(idList); | 
|---|
|  |  |  | bookingsService.deleteByIdInBatch(idList,this.getLoginUser(null)); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping("/updateById") | 
|---|
|  |  |  | @RequiresPermissions("business:bookings:update") | 
|---|
|  |  |  | public ApiResponse updateById(@RequestBody Bookings bookings) { | 
|---|
|  |  |  | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); | 
|---|
|  |  |  | bookings.setCreator(user.getId()); | 
|---|
|  |  |  | bookings.setLoginUserInfo(getLoginUser(null)); | 
|---|
|  |  |  | bookingsService.updateById(bookings); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | startTime =  DateUtil.getMonday(); | 
|---|
|  |  |  | endTime = DateUtil.getSunday(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return ApiResponse.success(bookingsService.getMyJoinBookingMeet(getLoginUser().getId(), null,startTime,endTime)); | 
|---|
|  |  |  | return ApiResponse.success(bookingsService.getMyJoinBookingMeet(getLoginUser(null).getId(), null,startTime,endTime)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation("获取用户当当月预约会议情况") | 
|---|
|  |  |  | @PostMapping("/findMothBookingMeet") | 
|---|
|  |  |  | public ApiResponse<List<DateTimeResourceDate>> findMothBookingMeet( @RequestParam(required = false) Integer roomId,String dateMonth){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ApiResponse.success(bookingsService.findMothBookingMeet(getLoginUser().getId(),roomId,dateMonth)); | 
|---|
|  |  |  | return ApiResponse.success(bookingsService.findMothBookingMeet(getLoginUser(null).getId(),roomId,dateMonth)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|