| | |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.dao.business.dto.YwConditionerLockDTO; |
| | | import com.doumee.dao.business.dto.YwConditionerOperateDTO; |
| | | import com.doumee.dao.business.model.YwConditioner; |
| | | import com.doumee.dao.business.model.YwConditionerActions; |
| | | import com.doumee.service.business.YwConditionerService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 空调设备信息 |
| | |
| | | pageWrap.getModel().setLoginUserInfo(this.getLoginUser(token)); |
| | | ExcelExporter.build(YwConditioner.class).export(ywConditionerService.findPage(pageWrap).getRecords(), "空调设备信息", response); |
| | | } |
| | | |
| | | @ApiOperation("卡片分页") |
| | | @PostMapping("/cardPage") |
| | | @CloudRequiredPermission("business:ywconditioner:query") |
| | | public ApiResponse<PageData<YwConditioner>> findCardPage(@RequestBody PageWrap<YwConditioner> pageWrap, |
| | | @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | if (pageWrap.getModel() != null) { |
| | | pageWrap.getModel().setLoginUserInfo(this.getLoginUser(token)); |
| | | } |
| | | return ApiResponse.success(ywConditionerService.findCardPage(pageWrap)); |
| | | } |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("全量同步") |
| | | @PostMapping("/syncAll") |
| | | @CloudRequiredPermission("business:ywconditioner:sync") |
| | | public ApiResponse<String> syncAll(@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(ywConditionerService.syncAll()); |
| | | } |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("同步设备与状态") |
| | | @PostMapping("/syncDevicesAndStatus") |
| | | @CloudRequiredPermission("business:ywconditioner:sync") |
| | | public ApiResponse<String> syncDevicesAndStatus(@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(ywConditionerService.syncDevicesAndStatus()); |
| | | } |
| | | |
| | | @ApiOperation("设备控制") |
| | | @PostMapping("/operate") |
| | | @CloudRequiredPermission("business:ywconditioner:operate") |
| | | public ApiResponse<String> operate(@RequestBody YwConditionerOperateDTO dto, |
| | | @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(ywConditionerService.operate(dto, this.getLoginUser(token))); |
| | | } |
| | | |
| | | @ApiOperation("设备锁定") |
| | | @PostMapping("/lock") |
| | | @CloudRequiredPermission("business:ywconditioner:operate") |
| | | public ApiResponse<String> lock(@RequestBody YwConditionerLockDTO dto, |
| | | @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(ywConditionerService.lock(dto, this.getLoginUser(token))); |
| | | } |
| | | |
| | | @ApiOperation("单设备控制历史") |
| | | @PostMapping("/historyPage") |
| | | @CloudRequiredPermission("business:ywconditioner:query") |
| | | public ApiResponse<PageData<YwConditionerActions>> historyPage(@RequestBody PageWrap<YwConditionerActions> pageWrap, |
| | | @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | if (pageWrap.getModel() != null) { |
| | | pageWrap.getModel().setLoginUserInfo(this.getLoginUser(token)); |
| | | } |
| | | return ApiResponse.success(ywConditionerService.historyPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("网关下拉") |
| | | @GetMapping("/gatewayOptions") |
| | | @CloudRequiredPermission("business:ywconditioner:query") |
| | | public ApiResponse<List<Map<String, Object>>> gatewayOptions(@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(ywConditionerService.gatewayOptions()); |
| | | } |
| | | } |