| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.api.R; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.service.LedPlayerEntityService; |
| | | import com.sandu.ximon.admin.service.VnnoxService; |
| | | import com.sandu.ximon.admin.utils.VnnoxAPIUtil; |
| | | import com.sandu.ximon.admin.utils.response.VnnoxResult; |
| | | import com.sandu.ximon.dao.domain.LedPlayerEntity; |
| | | import com.sandu.ximon.dao.domain.LedV2RegisterResultEntity; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.net.URISyntaxException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | private VnnoxService vnnoxService; |
| | | @Autowired |
| | | private LedPlayerEntityService ledPlayerEntityService; |
| | | @Autowired |
| | | private VnnoxAPIUtil vnnoxAPIUtil; |
| | | |
| | | /** |
| | | * 截屏 |
| | | * |
| | | * @param vnnoxWebRequest |
| | | * @return |
| | | */ |
| | | @GetMapping("/screenShot") |
| | | public ResponseVO<Object> screenShot(@RequestBody VnnoxParam vnnoxWebRequest) { |
| | | Map<String, String> map = vnnoxService.getScreenShotUrl(vnnoxWebRequest.getId()); |
| | | if(map.get("code").equals("500")) { |
| | | return ResponseUtil.fail(map.get("msg")); |
| | | } |
| | | return ResponseUtil.success(map.get("url")); |
| | | } |
| | | |
| | | /** |
| | | * 重启 |
| | | * |
| | | * @param vnnoxWebRequest |
| | | * @return |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param vnnoxWebRequest |
| | | * @return |
| | | */ |
| | | @GetMapping("/screenStatusChange") |
| | | public ResponseVO<Object> screenStatusChange(@RequestBody VnnoxParam vnnoxWebRequest) { |
| | | VnnoxResult vnnoxResult = vnnoxService.screenStatusChange(vnnoxWebRequest.getPlayerList(),vnnoxWebRequest.getScreenStatus()); |
| | | VnnoxResult vnnoxResult = vnnoxService.screenStatusChange(vnnoxWebRequest.getPlayerList(), vnnoxWebRequest.getScreenStatus()); |
| | | return ResponseUtil.success(vnnoxResult); |
| | | } |
| | | |
| | | /** |
| | | * 音量调节 |
| | | * |
| | | * @param vnnoxWebRequest |
| | | * @return |
| | | */ |
| | | @GetMapping("/volChange") |
| | | public ResponseVO<Object> volChange(@RequestBody VnnoxParam vnnoxWebRequest) { |
| | | VnnoxResult vnnoxResult = vnnoxService.volChange(vnnoxWebRequest.getPlayerList(),vnnoxWebRequest.getVol()); |
| | | VnnoxResult vnnoxResult = vnnoxService.volChange(vnnoxWebRequest.getPlayerList(), vnnoxWebRequest.getVol()); |
| | | return ResponseUtil.success(vnnoxResult); |
| | | } |
| | | |
| | | /** |
| | | * 亮度调节 |
| | | * |
| | | * @param vnnoxWebRequest |
| | | * @return |
| | | */ |
| | | @GetMapping("/brightnessChange") |
| | | public ResponseVO<Object> brightnessChange(@RequestBody VnnoxParam vnnoxWebRequest) { |
| | | VnnoxResult vnnoxResult = vnnoxService.brightnessChange(vnnoxWebRequest.getPlayerList(),vnnoxWebRequest.getBrightness()); |
| | | VnnoxResult vnnoxResult = vnnoxService.brightnessChange(vnnoxWebRequest.getPlayerList(), vnnoxWebRequest.getBrightness()); |
| | | return ResponseUtil.success(vnnoxResult); |
| | | } |
| | | |
| | |
| | | |
| | | @PostMapping("/validateSN") |
| | | public ResponseVO<Object> validateSN(@RequestBody Map map) throws URISyntaxException { |
| | | String sn = (String)map.get("sn"); |
| | | String name = (String)map.get("name"); |
| | | LedV2RegisterResultEntity ledV2RegisterResultEntity = vnnoxService.validateSN(name,sn); |
| | | String sn = (String) map.get("sn"); |
| | | String name = (String) map.get("name"); |
| | | LedV2RegisterResultEntity ledV2RegisterResultEntity = vnnoxService.validateSN(name, sn); |
| | | return ResponseUtil.success(ledV2RegisterResultEntity); |
| | | } |
| | | |
| | | @PostMapping("/updateLedName/{id}") |
| | | public ResponseVO<Object> updateLedName(@PathVariable Long id,@RequestBody Map map) { |
| | | String name = (String)map.get("name"); |
| | | public ResponseVO<Object> updateLedName(@PathVariable Long id, @RequestBody Map map) { |
| | | String name = (String) map.get("name"); |
| | | boolean b = vnnoxService.updateDataName(id, name); |
| | | if(b){ |
| | | if (b) { |
| | | return ResponseUtil.success("更改成功"); |
| | | }{ |
| | | } |
| | | { |
| | | return ResponseUtil.success("更改失败"); |
| | | } |
| | | |
| | |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | LambdaQueryWrapper<LedPlayerEntity> wrapper = Wrappers.lambdaQuery(LedPlayerEntity.class); |
| | | |
| | | if(AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getAdministratorIdentity())) { |
| | | if (AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getAdministratorIdentity())) { |
| | | //wrapper.eq(LedPlayerEntity::get) |
| | | return ResponseUtil.success(""); // todo |
| | | }else { |
| | | wrapper.like(LedPlayerEntity::getPlayerName,keyword); |
| | | return ResponseUtil.success(ledPlayerEntityService.list(wrapper)); |
| | | } else { |
| | | wrapper.like(LedPlayerEntity::getPlayerName, keyword) |
| | | .or( |
| | | querywrapper->{ |
| | | querywrapper.like(LedPlayerEntity::getName, keyword); |
| | | } |
| | | ); |
| | | List<LedPlayerEntity> list = ledPlayerEntityService.list(wrapper); |
| | | List<LedPlayerEntity> entities = vnnoxService.setCacheInfo(vnnoxAPIUtil.syncCurrentInfo(list)); |
| | | return ResponseUtil.success(entities); |
| | | } |
| | | } |
| | | |
| | | @GetMapping("/onLineList") |
| | | public ResponseVO<Object> onLineList(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) { |
| | | // public ResponseVO<Object> onLineList(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) { |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | LambdaQueryWrapper<LedPlayerEntity> wrapper = Wrappers.lambdaQuery(LedPlayerEntity.class); |
| | | |
| | | if (AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getAdministratorIdentity())) { |
| | | //wrapper.eq(LedPlayerEntity::get) |
| | | return ResponseUtil.success(""); // todo |
| | | } else { |
| | | wrapper.like(LedPlayerEntity::getPlayerName, keyword); |
| | | List<LedPlayerEntity> list = ledPlayerEntityService.list(wrapper); |
| | | List<LedPlayerEntity> entities = vnnoxService.setCacheInfo(vnnoxAPIUtil.syncCurrentInfo(list)); |
| | | List<LedPlayerEntity> online = new ArrayList<>(); |
| | | for (LedPlayerEntity ledPlayer : entities) { |
| | | if (ledPlayer.getOnlineStatus() == 1) { |
| | | online.add(ledPlayer); |
| | | } |
| | | } |
| | | return ResponseUtil.success(online); |
| | | } |
| | | } |
| | | } |