| | |
| | | package com.sandu.ximon.admin.controller; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.system.UserInfo; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.sandu.common.domain.CommonPage; |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.entity.ProgramPro; |
| | | import com.sandu.ximon.admin.param.LEDScheduleParam_xixun; |
| | | import com.sandu.ximon.admin.param.SetScreenOpenParam; |
| | | import com.sandu.ximon.admin.param.SetVolumeParam; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.service.ClientService; |
| | |
| | | import com.sandu.ximon.admin.service.PoleLightemitService; |
| | | import com.sandu.ximon.admin.service.XiXunPlayerService; |
| | | import com.sandu.ximon.admin.utils.LightemitUtils; |
| | | import com.sandu.ximon.admin.utils.ListPageUtil; |
| | | import com.sandu.ximon.dao.domain.PoleLightemitEntity; |
| | | import com.sandu.ximon.dao.domain.PoleXixunPlayerEntity; |
| | | import com.sandu.ximon.dao.enums.AdministratorEnums; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | /** |
| | | * @Author liuhaonan |
| | |
| | | |
| | | /** |
| | | * æ°å¢èç® |
| | | * |
| | | * @param programPro |
| | | * @return |
| | | */ |
| | |
| | | boolean insert=false; |
| | | if(xiXunPlayerService.removeById(programPro.getProgramId())){ |
| | | insert = xiXunPlayerService.insert(programPro); |
| | | }; |
| | | } |
| | | ; |
| | | return ResponseUtil.success(insert); |
| | | } |
| | | |
| | | /** |
| | | * å é¤èç® |
| | | * |
| | | * @param pid |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * è·åèç®è¯¦æ
|
| | | * |
| | | * @param pid |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * èç®å表 |
| | | * |
| | | * @param baseConditionVO |
| | | * @param keyword |
| | | * @return |
| | |
| | | |
| | | /** |
| | | * èç®æ¨é |
| | | * |
| | | * @param pid |
| | | * @param lightemitIds |
| | | * @return |
| | |
| | | |
| | | /** |
| | | * LEDå±å¹æ°å¢ |
| | | * |
| | | * @param poleLightemit |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * LEDå±å¹ä¿®æ¹ |
| | | * |
| | | * @param ledId |
| | | * @param poleLightemit |
| | | * @return |
| | |
| | | |
| | | /** |
| | | * LEDå±å¹å é¤ |
| | | * |
| | | * @param ledIds |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * LEDå±å¹å表 |
| | | * |
| | | * @param baseConditionVO |
| | | * @param keyword |
| | | * @return |
| | | */ |
| | | @GetMapping("/listLed") |
| | | public ResponseVO<Object> listLed(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) { |
| | | public ResponseVO<Object> listLed(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword, |
| | | @RequestParam(value = "isOnLine", required = false) boolean isOnLine) { |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | LambdaQueryWrapper<PoleLightemitEntity> wrapper = Wrappers.lambdaQuery(PoleLightemitEntity.class); |
| | | if(AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getAdministratorIdentity())){ |
| | |
| | | } |
| | | ); |
| | | } |
| | | return ResponseUtil.success(poleLightemitService.list(wrapper)); |
| | | List<PoleLightemitEntity> list = poleLightemitService.list(wrapper); |
| | | if(isOnLine){ |
| | | List<PoleLightemitEntity> results = poleLightemitService.ledOnline(list); |
| | | CommonPage commonPage = CommonPage.restPage(results); |
| | | int size = results.size(); |
| | | commonPage.setTotal((long) size); |
| | | commonPage.setTotalPage(size / baseConditionVO.getPageSize() + 1); |
| | | if (size % baseConditionVO.getPageSize() == 0) { |
| | | commonPage.setTotalPage(size / baseConditionVO.getPageSize()); |
| | | } |
| | | |
| | | @GetMapping("/onLineLed") |
| | | public ResponseVO<Object> onlineLed(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) { |
| | | // PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | List<PoleLightemitEntity> list = poleLightemitService.ledList(); |
| | | if(list!=null&&!keyword.isEmpty()){ |
| | | List results = new ArrayList(); |
| | | //æ¨¡ç³æ¥è¯¢ 使ç¨ï¼PatternãMatcherï¼ |
| | | Pattern pattern = Pattern.compile("å¼ "); |
| | | for(int i=0; i < list.size(); i++){ |
| | | Matcher matcher = pattern.matcher((list.get(i)).getLightemitName()); |
| | | Matcher matcher1 = pattern.matcher((list.get(i)).getLightemitControlCode()); |
| | | if(matcher.find()||matcher1.find()){ //matcher.find()-ä¸ºæ¨¡ç³æ¥è¯¢ matcher.matches()-为精确æ¥è¯¢ |
| | | results.add(list.get(i)); |
| | | } |
| | | } |
| | | return ResponseUtil.success(results); |
| | | } |
| | | |
| | | return ResponseUtil.success(commonPage); |
| | | }else { |
| | | poleLightemitService.ledOnlineCheck(list); |
| | | return ResponseUtil.success(list); |
| | | } |
| | | // return ResponseUtil.success(poleLightemitService.list(wrapper)); |
| | | } |
| | | |
| | | /* |
| | | 设置å±å¹å¼å
³ |
| | | */ |
| | | |
| | | @PostMapping("/setScreenOpen") |
| | | public ResponseVO<Object> setScreenOpen(@RequestBody SetScreenOpenParam setScreenOpenEntity){ |
| | | if(setScreenOpenEntity.getIds() == null || setScreenOpenEntity.getIds().length == 0 || setScreenOpenEntity.getBool() == null){ |
| | | throw new BusinessException("æªéæ©LEDå±"); |
| | | } |
| | | Collection poleLightemitControllers = poleLightemitService.listByIds(Arrays.asList(setScreenOpenEntity.getIds())); |
| | | if (!poleLightemitControllers.isEmpty()) { |
| | | |
| | | Map<Long, Object> map = new HashMap<>(); |
| | | |
| | | Iterator iterator = poleLightemitControllers.iterator(); |
| | | while (iterator.hasNext()) { |
| | | PoleLightemitEntity poleLightemitEntity = (PoleLightemitEntity) iterator.next(); |
| | | //ç»ææ¥è¯¢ |
| | | String result = lightemitUtils.setScreenOpen(poleLightemitEntity.getLightemitControlCode(), setScreenOpenEntity.getBool()); |
| | | |
| | | System.out.println("result:---------------------"+result); |
| | | if(result.isEmpty() || !"true".equals(result)){ |
| | | |
| | | } |
| | | |
| | | map.put(poleLightemitEntity.getLightemitId(), result); |
| | | } |
| | | return ResponseUtil.success(map); |
| | | }else { |
| | | throw new BusinessException("æªæ£ç¡®éæ©LEDå±"); |
| | | } |
| | | } |
| | | |
| | | |
| | | /* |