| ÎļþÃû´Ó server/meeting/meeting_admin/src/main/java/com/doumee/api/CloudBookingsController.java ÐÞ¸Ä |
| | |
| | | package com.doumee.api; |
| | | package com.doumee.cloud.admin; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.doumee.config.annotation.LoginNoRequired; |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.core.annotation.excel.ExcelExporter; |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.core.model.ApiResponse; |
| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | * @author æ±è¹è¹ |
| | | * @date 2023/05/04 18:18 |
| | | */ |
| | | @Api(tags = "å¾®æå¡-ä¼è®®å®¤ç¸å
³æ¥å£") |
| | | @Api(tags = "ä¼è®®å®¤é¢å®ä¿¡æ¯è¡¨") |
| | | @RestController |
| | | @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/bookings") |
| | | public class CloudBookingsController extends BaseController { |
| | | @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/business/bookings") |
| | | public class BookingsCloudController extends BaseController { |
| | | |
| | | @Autowired |
| | | private BookingsService bookingsService; |
| | | |
| | | @ApiOperation("æµè¯ç½ç®¡") |
| | | @GetMapping("/test") |
| | | public ApiResponse test() { |
| | | return ApiResponse.success("ä¼è®®å®¤æµè¯æå"); |
| | | } |
| | | |
| | | @LoginNoRequired |
| | | @ApiOperation("æµè¯æ éç»å½æå") |
| | | @GetMapping("/testNoLogin") |
| | | public ApiResponse testNoLogin() { |
| | | return ApiResponse.success("ä¼è®®å®¤ç®¡çæµè¯æ éç»å½æå"); |
| | | } |
| | | @PreventRepeat |
| | | @ApiOperation("æ°å»º") |
| | | @PostMapping("/create") |
| | | public ApiResponse create(@RequestBody Bookings bookings) { |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | @RequiresPermissions("business:bookings:create") |
| | | public ApiResponse create(@RequestBody Bookings bookings,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | LoginUserInfo user = getLoginUser(token); |
| | | bookings.setLoginUserInfo(user); |
| | | bookings.setCreator(user.getId()); |
| | | return ApiResponse.success(bookingsService.create(bookings)); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDå é¤") |
| | | @GetMapping("/delete/{id}") |
| | | public ApiResponse deleteById(@PathVariable Integer id) { |
| | | bookingsService.deleteById(id); |
| | | @RequiresPermissions("business:bookings:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | bookingsService.deleteById(id,this.getLoginUser(token)); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ¹éå é¤") |
| | | @GetMapping("/delete/batch") |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids) { |
| | | @RequiresPermissions("business:bookings:delete") |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | String [] idArray = ids.split(","); |
| | | List<Integer> idList = new ArrayList<>(); |
| | | for (String id : idArray) { |
| | | for (String id : idArray ){ |
| | | idList.add(Integer.valueOf(id)); |
| | | } |
| | | bookingsService.deleteByIdInBatch(idList); |
| | | bookingsService.deleteByIdInBatch(idList,this.getLoginUser(token)); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDä¿®æ¹") |
| | | @PostMapping("/updateById") |
| | | public ApiResponse updateById(@RequestBody Bookings bookings) { |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | bookings.setCreator(user.getId()); |
| | | @RequiresPermissions("business:bookings:update") |
| | | public ApiResponse updateById(@RequestBody Bookings bookings,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | LoginUserInfo user = getLoginUser(token); |
| | | bookings.setLoginUserInfo(user); |
| | | bookings.setEditor(user.getId()); |
| | | bookingsService.updateById(bookings); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @PostMapping("/page") |
| | | public ApiResponse<PageData<Bookings>> findPage (@RequestBody PageWrap<Bookings> pageWrap) { |
| | | @RequiresPermissions("business:bookings:query") |
| | | public ApiResponse<PageData<Bookings>> findPage (@RequestBody PageWrap<Bookings> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | return ApiResponse.success(bookingsService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("导åºExcel") |
| | | @PostMapping("/exportExcel") |
| | | @RequiresPermissions("business:bookings:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<Bookings> pageWrap, HttpServletResponse response) { |
| | | public void exportExcel (@RequestBody PageWrap<Bookings> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | ExcelExporter.build(Bookings.class).export(bookingsService.findPage(pageWrap).getRecords(), "ä¼è®®å®¤é¢å®ä¿¡æ¯è¡¨", response); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDæ¥è¯¢") |
| | | @GetMapping("/{id}") |
| | | public ApiResponse<MeetingDetailResponse> findById(@PathVariable Integer id) { |
| | | @RequiresPermissions("business:bookings:query") |
| | | public ApiResponse<MeetingDetailResponse> findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | return ApiResponse.success(bookingsService.getMeetingDetail(id)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("åæ¶") |
| | | @PostMapping("/cancelById") |
| | | public ApiResponse cancelById(@RequestBody Bookings bookings) { |
| | | @RequiresPermissions("business:bookings:update") |
| | | public ApiResponse cancelById(@RequestBody Bookings bookings,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | bookings.setLoginUserInfo(this.getLoginUser(token)); |
| | | bookingsService.cancelById(bookings); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("ä¼è®®å®¤ä½¿ç¨æ¶é¿ç»è®¡") |
| | | @GetMapping("/getRoomStatistics") |
| | | @RequiresPermissions("business:bookings:update") |
| | | public ApiResponse<List<RoomStatisticsVo>> getRoomStatistics(@RequestParam Integer yearNum, @RequestParam Integer roomId){ |
| | | return ApiResponse.success(bookingsService.getRoomStatistics(yearNum)); |
| | | } |
| | | |
| | | @ApiOperation("人ååå ä¼è®®æ¶å¸¸") |
| | | @PostMapping("/getUserStatistics") |
| | | @RequiresPermissions("business:bookings:update") |
| | | public ApiResponse<PageData<UserStatisticsVo>> getUserStatistics(@RequestBody PageWrap<UserStatisticsDTO> pageWrap ){ |
| | | return ApiResponse.success(bookingsService.getUserStatistics(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("人åå伿¶é¿ç»è®¡å¯¼åºExcel") |
| | | @PostMapping("/exportUserStatistics") |
| | | public void exportUserStatistics (@RequestBody PageWrap<UserStatisticsDTO> pageWrap,HttpServletResponse response) { |
| | | @RequiresPermissions("business:bookings:exportExcel") |
| | | public void exportUserStatistics (@RequestBody PageWrap<UserStatisticsDTO> pageWrap,HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | |
| | | List<UserStatisticsVo> records = bookingsService.getUserStatistics(pageWrap).getRecords(); |
| | | if (!CollectionUtils.isEmpty(records)){ |
| | |
| | | |
| | | @ApiOperation("ä¼è®®å®¤ä½¿ç¨æ¶é¿ç»è®¡å¯¼åºExcel") |
| | | @PostMapping("/exportRoomStatistics") |
| | | public void exportRoomStatistics (@RequestBody PageWrap<UserStatisticsDTO> pageWrap,HttpServletResponse response) { |
| | | @RequiresPermissions("business:bookings:exportExcel") |
| | | public void exportRoomStatistics (@RequestBody PageWrap<UserStatisticsDTO> pageWrap,HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | List<RoomStatisticsVo> roomStatistics = bookingsService.getRoomStatistics(pageWrap.getModel().getYearNum()); |
| | | if (!CollectionUtils.isEmpty(roomStatistics)){ |
| | | JSONArray o = (JSONArray) JSON.toJSON(roomStatistics); |
| | |
| | | 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)); |
| | | } |
| | | } |