| | |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | |
| | | @PostMapping("/remark") |
| | | public ResponseVO<Object> addRemark(@RequestBody @Validated LightRemarkParam param) { |
| | | if (!permissionConfig.check(MenuEnum.LIGHT_REMARK.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | boolean result = lightService.addRemark(param); |
| | | if (result) { |
| | | return ResponseUtil.success("添加成功"); |
| | |
| | | /** |
| | | * 导出Excel |
| | | * |
| | | * @param conditionVO |
| | | * @param keyword |
| | | * @param deviceCode |
| | | * @return |
| | | */ |
| | | @AnonymousAccess |
| | | @GetMapping("/report/exportList") |
| | | public ResponseVO<Object> exportList(BaseConditionVO conditionVO, @RequestParam(required = false) String keyword, @RequestParam(required = false) String deviceCode) { |
| | | String url = lightReportDataService.exportList(conditionVO.getPageNo(), conditionVO.getPageSize(), keyword, deviceCode); |
| | | public ResponseVO<Object> exportList(HttpServletRequest request, HttpServletResponse response, @RequestParam(required = false) String deviceCode) { |
| | | if (!permissionConfig.check(MenuEnum.LIGHT_EXPORT_LIST.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | if (deviceCode.isEmpty()) { |
| | | return ResponseUtil.fail("设备编号不能为空"); |
| | | } |
| | | String url = lightReportDataService.exportList(request,response, deviceCode); |
| | | return ResponseUtil.success(url); |
| | | } |
| | | |
| | |
| | | // 亮度控制 |
| | | @PostMapping("/control") |
| | | public ResponseVO<Object> controlBrightness(@RequestBody @Validated List<LightControlParam> paramList) { |
| | | if (!permissionConfig.check(MenuEnum.LIGHT_CONTROL.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | List<Map<String, Object>> list = lightService.controlBrightness(paramList); |
| | | return ResponseUtil.success(list); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 设置功率 |
| | | */ |
| | | @PostMapping("/setPower") |
| | | public ResponseVO<Object> setPower(@RequestBody LightPowerSettingParam lightPowerSettingParam) { |
| | | if (!permissionConfig.check(MenuEnum.LIGHT_SET_POWER.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | boolean resule = lightService.setPower(lightPowerSettingParam); |
| | | return ResponseUtil.success(resule); |
| | | } |