| | |
| | | package com.sandu.ximon.admin.controller; |
| | | |
| | | import com.sandu.common.domain.CommonPage; |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.security.annotation.AnonymousAccess; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.param.LightControlParam; |
| | | import com.sandu.ximon.admin.param.LightPowerSettingParam; |
| | | import com.sandu.ximon.admin.param.LightRemarkParam; |
| | | import com.sandu.ximon.admin.security.PermissionConfig; |
| | | import com.sandu.ximon.admin.service.LightReportDataService; |
| | |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | if (!permissionConfig.check(MenuEnum.LIGHT_DATA.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | List<LightReportDataBo> list = lightReportDataService.listReportData(conditionVO.getPageNo(), conditionVO.getPageSize(), keyword, deviceCode); |
| | | return ResponseUtil.success(list); |
| | | CommonPage commonPage = lightReportDataService.listReportData(conditionVO.getPageNo(), conditionVO.getPageSize(), keyword, deviceCode); |
| | | List<LightReportDataBo> lightReportDataBos = (List<LightReportDataBo>) commonPage.getList(); |
| | | |
| | | if (lightReportDataBos == null) { |
| | | return ResponseUtil.success(CommonPage.restPage(new ArrayList<>())); |
| | | } |
| | | CommonPage commonPage1 = CommonPage.restPage(lightReportDataBos); |
| | | commonPage1.setTotal(commonPage.getTotal()); |
| | | commonPage1.setTotalPage(commonPage.getTotalPage()); |
| | | |
| | | return ResponseUtil.success(commonPage1); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | @GetMapping("/error/list") |
| | | public ResponseVO<Object> listReportError(BaseConditionVO conditionVO, @RequestParam(required = false) String keyword |
| | | , @RequestParam(required = false) int errorCode) { |
| | | , @RequestParam(required = false) Integer errorCode) { |
| | | if (!permissionConfig.check(MenuEnum.LIGHT_ERROR_LIST.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | |
| | | return ResponseUtil.success(list); |
| | | } |
| | | |
| | | @PostMapping("/Energy") |
| | | @AnonymousAccess |
| | | public ResponseVO<Object> Energy() { |
| | | return ResponseUtil.success(lightService.controlEnergy()); |
| | | } |
| | | |
| | | @AnonymousAccess |
| | | @PostMapping("/EnergySaving") |
| | | public ResponseVO<Object> controlEnergySaving() { |
| | | return ResponseUtil.success(lightService.controlEnergySaving()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 设置功率 |
| | | */ |
| | | @PostMapping("/setPower") |
| | | public ResponseVO<Object> setPower(@RequestBody LightPowerSettingParam lightPowerSettingParam) { |
| | | boolean resule = lightService.setPower(lightPowerSettingParam); |
| | | return ResponseUtil.success(resule); |
| | | } |
| | | } |