| | |
| | | package com.sandu.ximon.admin.newnova.led; |
| | | |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.newnova.param.NewNovaLedParam; |
| | | import com.sandu.ximon.admin.newnova.param.NewNovaStatusParam; |
| | | import com.sandu.ximon.admin.newnova.utils.NovaAPIUtil; |
| | | import com.sandu.ximon.admin.newnova.vo.StatusVO; |
| | | import com.sandu.ximon.admin.security.PermissionConfig; |
| | | import com.sandu.ximon.dao.domain.LedV2RegisterResultEntity; |
| | | import com.sandu.ximon.dao.enums.MenuEnum; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.net.URISyntaxException; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author LiuHaoNan |
| | |
| | | public class NewNovaLedController { |
| | | private final PermissionConfig permissionConfig; |
| | | private final NewNovaLedService newNovaLedService; |
| | | private final NovaAPIUtil novaApiUtil; |
| | | |
| | | |
| | | /** |
| | | * 屏幕注册 |
| | | * |
| | | * @param param |
| | | * @return |
| | | */ |
| | | @PostMapping("/validateSN") |
| | | public ResponseVO<Object> validateSN(@RequestBody @Validated NewNovaLedParam param) { |
| | | if (!permissionConfig.check(MenuEnum.VNNOX_ADD.getCode())) { |
| | | public ResponseVO<Object> validateSN(@RequestBody @Validated NewNovaLedParam param) { |
| | | if (!permissionConfig.check(MenuEnum.LED_NEW_ADD.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | boolean b= newNovaLedService.saveLed(param); |
| | | return ResponseUtil.success("ledV2RegisterResultEntity"); |
| | | boolean b = newNovaLedService.saveLed(param); |
| | | return ResponseUtil.success(b); |
| | | } |
| | | @PostMapping("/test") |
| | | public ResponseVO<Object> validateSN() { |
| | | StatusVO mzva51930N2113017308 = novaApiUtil.login("MZVA51930N2113017308"); |
| | | return ResponseUtil.success(mzva51930N2113017308); |
| | | |
| | | /** |
| | | * 编辑屏幕名称 |
| | | */ |
| | | @PostMapping("/editLed") |
| | | public ResponseVO editLed(@RequestBody NewNovaLedParam param) { |
| | | if (!permissionConfig.check(MenuEnum.LED_NEW_EDIT.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(newNovaLedService.editLed(param)); |
| | | } |
| | | |
| | | /** |
| | | * 删除屏幕 |
| | | */ |
| | | @PostMapping("/delLed") |
| | | public ResponseVO delLEd(@RequestBody List<Long> ids) { |
| | | if (!permissionConfig.check(MenuEnum.LED_NEW_DEL.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(newNovaLedService.delLed(ids)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 屏幕列表 |
| | | */ |
| | | @GetMapping("/listLed") |
| | | public ResponseVO listLed(BaseConditionVO baseConditionVO, @RequestParam(required = false, value = "keyword") String keyword, |
| | | @RequestParam(required = false, value = "onlineStatus") boolean onlineStatus) { |
| | | if (!permissionConfig.check(MenuEnum.LED_NEW_LIST.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(newNovaLedService.listLed(baseConditionVO, keyword, onlineStatus)); |
| | | } |
| | | |
| | | /** |
| | | * 详细信息 |
| | | * |
| | | * @param ledId |
| | | * @return |
| | | */ |
| | | @GetMapping("/getInfo") |
| | | public ResponseVO getInfo(@RequestParam(required = true, value = "ledId") Long ledId) { |
| | | if (!permissionConfig.check(MenuEnum.LED_NEW_INFO.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(newNovaLedService.getInfo(ledId)); |
| | | } |
| | | |
| | | /** |
| | | * 设置亮度 |
| | | */ |
| | | @PostMapping("/setBrightness") |
| | | public ResponseVO setScreenBrightness(@RequestBody @Validated NewNovaStatusParam param) { |
| | | if (!permissionConfig.check(MenuEnum.LED_NEW_VOL.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | if (param.getBrightness() == null) { |
| | | return ResponseUtil.fail("亮度不能为空"); |
| | | } else { |
| | | if (param.getBrightness() > 100 || param.getBrightness() < 0) { |
| | | return ResponseUtil.fail("亮度范围为: 0-100"); |
| | | } |
| | | } |
| | | if (newNovaLedService.getById(param.getId()) == null) { |
| | | return ResponseUtil.fail("设备不存在"); |
| | | } |
| | | return ResponseUtil.success(NovaAPIUtil.getInstanceUtil().setScreenBrightness(param)); |
| | | } |
| | | |
| | | |
| | | // @PostMapping("/tranPro") |
| | | // public ResponseVO<Object> tranPro(@RequestBody Map pageInfo) throws InterruptedException { |
| | | // NovaAPIUtil a = NovaAPIUtil.getInstanceUtil(); |
| | | // StatusVO login = a.login("MZVA51930N2113017308"); |
| | | // if (login.getStatusCode() != 0) { |
| | | // return ResponseUtil.fail("genVO"); |
| | | // } |
| | | // StatusVO createPro = a.createPro(new ProWHVO("jiemu 1", 128, 256)); |
| | | // System.out.println(createPro + "createPro"); |
| | | // StatusVO editPro = a.editProgram(Integer.valueOf(createPro.getStatusData()), pageInfo); |
| | | // StatusVO genVO = a.genrateProgram(Integer.valueOf(createPro.getStatusData())); |
| | | // ProgramPrarm page = new ProgramPrarm(); |
| | | // page.setInsertPlay(true); |
| | | // page.setProgramID(Integer.valueOf(createPro.getStatusData())); |
| | | // page.setStartPlayAfterTransferred(true); |
| | | // List<String> sns = new ArrayList<String>(); |
| | | // sns.add("MZVA51930N2113017308"); |
| | | // page.setSnList(sns); |
| | | // List<TrasfromStatusVO> trasfromStatusVOS = a.trasfromProgram(page); |
| | | // return ResponseUtil.success(trasfromStatusVOS); |
| | | // } |
| | | |
| | | } |