2021与蓝度共同重构项目,服务端
zhanzhiqin
2022-04-18 f2dfd5e6fbbb9c4e96e91c86be0bb6f7a44d87c3
LED屏列表
已修改8个文件
733 ■■■■■ 文件已修改
dao/src/main/java/com/sandu/ximon/dao/mapper/LedPlayerEntityMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/java/com/sandu/ximon/dao/mapper/PoleLightemitEntityMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/resources/mapper/LedPlayerEntityMapper.xml 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/resources/mapper/PoleLightemitEntityMapper.xml 49 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/VnnoxController.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java 153 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedPlayerEntityService.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleLightemitService.java 433 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/java/com/sandu/ximon/dao/mapper/LedPlayerEntityMapper.java
@@ -4,6 +4,8 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
 * @Entity com.sandu.ximon.dao.domain.LedPlayerEntity
 */
@@ -11,6 +13,8 @@
public interface LedPlayerEntityMapper extends BaseMapper<LedPlayerEntity> {
    boolean saveLed(LedPlayerEntity ledPlayerEntity);
    List<LedPlayerEntity> ledPlayerEntityList(String keyword, Long userid);
}
dao/src/main/java/com/sandu/ximon/dao/mapper/PoleLightemitEntityMapper.java
@@ -5,6 +5,8 @@
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * @Entity com.sandu.ximon.dao.domain.PoleLightemitEntity
 */
@@ -13,8 +15,11 @@
    void updateRequestBody(@Param("ledCode")String ledCode, @Param("postBody")String postBody);
    List<PoleLightemitEntity> listLed(String keyword, Long userid);
}
dao/src/main/resources/mapper/LedPlayerEntityMapper.xml
@@ -22,4 +22,25 @@
        insert into led (player_name, player_id, sn, create_timestamp)
        values (#{playerName}, #{playerId}, #{sn}, #{createTimestamp})
    </insert>
    <select id="ledPlayerEntityList" resultType="com.sandu.ximon.dao.domain.LedPlayerEntity">
        SELECT
        t1.*, t2.pole_id,
        t3.pole_name, t3.id
        FROM
        led t1
        LEFT JOIN pole_binding t2 ON t1.sn = t2.device_code
        AND t2.device_type = 1
        LEFT JOIN pole t3 ON t3.id = t2.pole_id
        <where>
            <if test="keyword != null and keyword != ''">
                AND t1.name LIKE CONCAT(CONCAT('%', #{keyword}), '%')
                OR t1.sn LIKE CONCAT(CONCAT('%', #{keyword}), '%')
                OR t1.id LIKE CONCAT(CONCAT('%', #{keyword}), '%')
            </if>
            <if test="userid != null">
                AND (t3.user_id = #{userid} OR t3.client_id = #{userid})
            </if>
        </where>
    </select>
</mapper>
dao/src/main/resources/mapper/PoleLightemitEntityMapper.xml
@@ -5,20 +5,20 @@
<mapper namespace="com.sandu.ximon.dao.mapper.PoleLightemitEntityMapper">
    <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.PoleLightemitEntity">
            <id property="lightemitId" column="lightemit_id" jdbcType="BIGINT"/>
            <result property="lightemitName" column="lightemit_name" jdbcType="VARCHAR"/>
            <result property="lightemitControlCode" column="lightemit_control_code" jdbcType="VARCHAR"/>
            <result property="url" column="url" jdbcType="VARCHAR"/>
            <result property="playTime" column="play_time" jdbcType="INTEGER"/>
            <result property="addTime" column="add_time" jdbcType="TIMESTAMP"/>
            <result property="requestBody" column="request_body" jdbcType="VARCHAR"/>
            <result property="playerSetting" column="player_setting" jdbcType="TINYINT"/>
            <result property="status" column="status" jdbcType="TINYINT"/>
            <result property="remark" column="remark" jdbcType="VARCHAR"/>
            <result property="createUserId" column="create_user_id" jdbcType="BIGINT"/>
            <result property="clientId" column="client_id" jdbcType="BIGINT"/>
            <result property="userId" column="user_id" jdbcType="BIGINT"/>
            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
        <id property="lightemitId" column="lightemit_id" jdbcType="BIGINT"/>
        <result property="lightemitName" column="lightemit_name" jdbcType="VARCHAR"/>
        <result property="lightemitControlCode" column="lightemit_control_code" jdbcType="VARCHAR"/>
        <result property="url" column="url" jdbcType="VARCHAR"/>
        <result property="playTime" column="play_time" jdbcType="INTEGER"/>
        <result property="addTime" column="add_time" jdbcType="TIMESTAMP"/>
        <result property="requestBody" column="request_body" jdbcType="VARCHAR"/>
        <result property="playerSetting" column="player_setting" jdbcType="TINYINT"/>
        <result property="status" column="status" jdbcType="TINYINT"/>
        <result property="remark" column="remark" jdbcType="VARCHAR"/>
        <result property="createUserId" column="create_user_id" jdbcType="BIGINT"/>
        <result property="clientId" column="client_id" jdbcType="BIGINT"/>
        <result property="userId" column="user_id" jdbcType="BIGINT"/>
        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
    </resultMap>
    <sql id="Base_Column_List">
@@ -33,4 +33,25 @@
        SET request_body = #{postBody}
        WHERE lightemit_control_code = #{ledCode}
    </update>
    <select id="listLed" resultType="com.sandu.ximon.dao.domain.PoleLightemitEntity">
        SELECT
        t1.*, t2.pole_id,
        t3.pole_name as streetlight_name , t3.id
        FROM
        pole_lightemit t1
        LEFT JOIN pole_binding t2 ON t1.lightemit_control_code = t2.device_code
        AND t2.device_type = 1
        LEFT JOIN pole t3 ON t3.id = t2.pole_id
        <where>
            <if test="keyword != null and keyword != ''">
                AND t1.lightemit_name LIKE CONCAT(CONCAT('%', #{keyword}), '%')
                OR t1.lightemit_control_code LIKE CONCAT(CONCAT('%', #{keyword}), '%')
                OR t1.lightemit_id LIKE CONCAT(CONCAT('%', #{keyword}), '%')
            </if>
            <if test="userid != null">
                AND (t3.user_id = #{userid} OR t3.client_id = #{userid})
            </if>
        </where>
    </select>
</mapper>
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/VnnoxController.java
@@ -140,36 +140,7 @@
        if (!permissionConfig.check(MenuEnum.LED_LIST.getCode())) {
            return ResponseUtil.fail("缺少对应用户权限");
        }
        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)
                    .or(
                            querywrapper -> {
                                querywrapper.like(LedPlayerEntity::getName, keyword);
                            }
                    ).or(
                            sn->{
                                sn.like(LedPlayerEntity::getSn,keyword);
                            }
                    );
            List<LedPlayerEntity> list = ledPlayerEntityService.list(wrapper);
            List<LedPlayerEntity> entities = vnnoxService.setCacheInfo(vnnoxAPIUtil.syncCurrentInfo(list));
            entities.forEach(
                    led -> {
                        PoleBinding binding = bindingService.getOne(Wrappers.lambdaQuery(PoleBinding.class)
                                .eq(PoleBinding::getDeviceType, 1).eq(PoleBinding::getDeviceCode, led.getSn()));
                        if (binding != null) {
                            led.setPoleId(poleService.getById(binding.getPoleId()).getId());
                            led.setPoleName(poleService.getById(binding.getPoleId()).getPoleName());
                        }
                    }
            );
            return ResponseUtil.success(entities);
        }
        return ResponseUtil.successPage(ledPlayerEntityService.ledPlayerEntityList(baseConditionVO, keyword));
    }
    @GetMapping("/onLineList")
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java
@@ -216,77 +216,90 @@
    @GetMapping("/listLed")
    public ResponseVO<Object> listLed(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword,
                                      @RequestParam(value = "isOnLine", required = false) boolean isOnLine) {
        if (!permissionConfig.check(MenuEnum.LED_LIST.getCode())) {
            return ResponseUtil.fail("缺少对应用户权限");
        List<PoleLightemitEntity> poleLightemitEntityList = poleLightemitService.listLed(keyword, isOnLine);
        CommonPage commonPage = CommonPage.restPage(poleLightemitEntityList);
        int size = poleLightemitEntityList.size();
        commonPage.setTotal((long) size);
        commonPage.setTotalPage(size / baseConditionVO.getPageSize() + 1);
        if (size % baseConditionVO.getPageSize() == 0) {
            commonPage.setTotalPage(size / baseConditionVO.getPageSize());
        }
        PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
        LambdaQueryWrapper<PoleLightemitEntity> wrapper = Wrappers.lambdaQuery(PoleLightemitEntity.class);
        if (AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getAdministratorIdentity())) {
            boolean clientId = clientService.findClientId();
            if (clientId) {
                wrapper = wrapper.eq(PoleLightemitEntity::getUserId, SecurityUtils.getUserId());
            }
            wrapper = wrapper.eq(PoleLightemitEntity::getClientId, clientService.getClientId());
        }
        wrapper = Wrappers.lambdaQuery(PoleLightemitEntity.class);
        if (StrUtil.isNotBlank(keyword)) {
            wrapper.like(PoleLightemitEntity::getLightemitName, keyword).or(
                    lambdaQueryWrapper -> {
                        lambdaQueryWrapper.like(PoleLightemitEntity::getLightemitControlCode, keyword);
                    }
            );
        }
        List<PoleBinding> bindings = bindingService.list(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getDeviceType, 1));
        List<PoleLightemitEntity> list = poleLightemitService.list(wrapper);
        if (isOnLine) {
            List<PoleLightemitEntity> results = poleLightemitService.ledOnline(list);
            results.forEach(
                    led -> {
                        bindings.forEach(
                                bind -> {
                                    if (bind.getDeviceCode() != null && led.getLightemitControlCode() == bind.getDeviceCode()) {
                                        led.setStreetlightId(bind.getPoleId());
                                        System.out.println("有没有运行到这里?---------------" + bind.getPoleId());
                                        led.setStreetlightName(poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getId, bind.getPoleId())).getPoleName());
                                    }
                                }
                        );
                    }
            );
            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());
            }
            return ResponseUtil.success(commonPage);
        } else {
            poleLightemitService.ledOnlineCheck(list);
            list.forEach(
                    led -> {
                        bindings.forEach(
                                bind -> {
                                    if (bind.getDeviceCode() != null && led.getLightemitControlCode().equals(bind.getDeviceCode())) {
                                        led.setStreetlightId(bind.getPoleId());
                                        System.out.println("有没有运行到这里?---------------" + bind.getPoleId());
                                        led.setStreetlightName(poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getId, bind.getPoleId())).getPoleName());
                                    }
                                }
                        );
                    }
            );
            CommonPage commonPage = CommonPage.restPage(list);
            int size = list.size();
            commonPage.setTotal((long) size);
            commonPage.setTotalPage(size / baseConditionVO.getPageSize() + 1);
            if (size % baseConditionVO.getPageSize() == 0) {
                commonPage.setTotalPage(size / baseConditionVO.getPageSize());
            }
            return ResponseUtil.success(commonPage);
            // return ResponseUtil.success(list);
        }
//        return ResponseUtil.success(poleLightemitService.list(wrapper));
        return ResponseUtil.success(commonPage);
//        if (!permissionConfig.check(MenuEnum.LED_LIST.getCode())) {
//            return ResponseUtil.fail("缺少对应用户权限");
//        }
//        PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
//        LambdaQueryWrapper<PoleLightemitEntity> wrapper = Wrappers.lambdaQuery(PoleLightemitEntity.class);
//        if (AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getAdministratorIdentity())) {
//            boolean clientId = clientService.findClientId();
//            if (clientId) {
//                wrapper = wrapper.eq(PoleLightemitEntity::getUserId, SecurityUtils.getUserId());
//            }
//            wrapper = wrapper.eq(PoleLightemitEntity::getClientId, clientService.getClientId());
//        }
//        wrapper = Wrappers.lambdaQuery(PoleLightemitEntity.class);
//        if (StrUtil.isNotBlank(keyword)) {
//            wrapper.like(PoleLightemitEntity::getLightemitName, keyword).or(
//                    lambdaQueryWrapper -> {
//                        lambdaQueryWrapper.like(PoleLightemitEntity::getLightemitControlCode, keyword);
//                    }
//            );
//        }
//        List<PoleBinding> bindings = bindingService.list(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getDeviceType, 1));
//        List<PoleLightemitEntity> list = poleLightemitService.list(wrapper);
//        if (isOnLine) {
//            List<PoleLightemitEntity> results = poleLightemitService.ledOnline(list);
//            results.forEach(
//                    led -> {
//                        bindings.forEach(
//                                bind -> {
//                                    if (bind.getDeviceCode() != null && led.getLightemitControlCode() == bind.getDeviceCode()) {
//                                        led.setStreetlightId(bind.getPoleId());
//                                        System.out.println("有没有运行到这里?---------------" + bind.getPoleId());
//                                        led.setStreetlightName(poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getId, bind.getPoleId())).getPoleName());
//                                    }
//                                }
//                        );
//                    }
//            );
//            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());
//            }
//            return ResponseUtil.success(commonPage);
//        } else {
//            poleLightemitService.ledOnlineCheck(list);
//            list.forEach(
//                    led -> {
//                        bindings.forEach(
//                                bind -> {
//                                    if (bind.getDeviceCode() != null && led.getLightemitControlCode().equals(bind.getDeviceCode())) {
//                                        led.setStreetlightId(bind.getPoleId());
//                                        System.out.println("有没有运行到这里?---------------" + bind.getPoleId());
//                                        led.setStreetlightName(poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getId, bind.getPoleId())).getPoleName());
//                                    }
//                                }
//                        );
//                    }
//            );
//            CommonPage commonPage = CommonPage.restPage(list);
//            int size = list.size();
//            commonPage.setTotal((long) size);
//            commonPage.setTotalPage(size / baseConditionVO.getPageSize() + 1);
//            if (size % baseConditionVO.getPageSize() == 0) {
//                commonPage.setTotalPage(size / baseConditionVO.getPageSize());
//            }
//            return ResponseUtil.success(commonPage);
//            // return ResponseUtil.success(list);
//        }
////        return ResponseUtil.success(poleLightemitService.list(wrapper));
    }
    /**
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedPlayerEntityService.java
@@ -1,10 +1,14 @@
package com.sandu.ximon.admin.service;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import com.sandu.common.object.BaseConditionVO;
import com.sandu.common.service.impl.BaseServiceImpl;
import com.sandu.common.util.SpringContextHolder;
import com.sandu.ximon.admin.security.SecurityUtils;
import com.sandu.ximon.admin.utils.VnnoxAPIUtil;
import com.sandu.ximon.dao.domain.LedPlayerEntity;
import com.sandu.ximon.dao.domain.PoleBinding;
import com.sandu.ximon.dao.mapper.LedPlayerEntityMapper;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
@@ -25,14 +29,15 @@
    private final LedPlayerEntityMapper ledPlayerEntityMapper;
    private VnnoxAPIUtil vnnoxAPIUtil;
    public LedPlayerEntity getBySn(String sn){
    public LedPlayerEntity getBySn(String sn) {
        return getOne(Wrappers.lambdaQuery(LedPlayerEntity.class).eq(LedPlayerEntity::getSn, sn));
    }
    public LedPlayerEntity getByPlayerId(String playerId){
        return getOne(Wrappers.lambdaQuery(LedPlayerEntity.class).eq(LedPlayerEntity::getPlayerId,playerId));
    public LedPlayerEntity getByPlayerId(String playerId) {
        return getOne(Wrappers.lambdaQuery(LedPlayerEntity.class).eq(LedPlayerEntity::getPlayerId, playerId));
    }
    public boolean saveLed(LedPlayerEntity ledPlayerEntity){
    public boolean saveLed(LedPlayerEntity ledPlayerEntity) {
        return ledPlayerEntityMapper.saveLed(ledPlayerEntity);
    }
@@ -40,26 +45,34 @@
    /**
     * 诺瓦硬件设备
     */
    public LedPlayerEntity getBySnAndPlayerSn(String sn){
    public LedPlayerEntity getBySnAndPlayerSn(String sn) {
        LedPlayerEntity one = getOne(Wrappers.lambdaQuery(LedPlayerEntity.class).eq(LedPlayerEntity::getSn, sn));
        if(one==null){
        if (one == null) {
            throw new RuntimeException("诺瓦设备不存在");
        }
        List list=new ArrayList();
        List list = new ArrayList();
        list.add(one);
        List<LedPlayerEntity> led = vnnoxAPIUtil.syncCurrentInfo(list);
        Map<String, String> screenShotUrl = SpringContextHolder.getBean(VnnoxService.class).getScreenShotUrl(one.getId().intValue());
        if(screenShotUrl.get("code").equals("200")){
        if (screenShotUrl.get("code").equals("200")) {
            one.setScreenShotUrl(screenShotUrl.get("url"));
        }else {
        } else {
            one.setScreenShotUrl("缩略图获取失败");
        }
        return one;
    }
    public List<LedPlayerEntity> ledPlayerEntityList(BaseConditionVO baseConditionVO, String keyword) {
        PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
        List<LedPlayerEntity> list;
        //超管
        if (SecurityUtils.getClientId() == null) {
            list = ledPlayerEntityMapper.ledPlayerEntityList(keyword, null);
        } else {
            list = ledPlayerEntityMapper.ledPlayerEntityList(keyword, SecurityUtils.getUserId());
        }
        return SpringContextHolder.getBean(VnnoxService.class).setCacheInfo(vnnoxAPIUtil.syncCurrentInfo(list));
    }
}
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleLightemitService.java
@@ -2,13 +2,16 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import com.google.gson.Gson;
import com.sandu.common.execption.BusinessException;
import com.sandu.common.object.BaseConditionVO;
import com.sandu.common.service.impl.BaseServiceImpl;
import com.sandu.ximon.admin.config.NginxConfigBean;
import com.sandu.ximon.admin.config.RealtimeServerBean;
import com.sandu.ximon.admin.entity.*;
import com.sandu.ximon.admin.param.PoleBindingParam;
import com.sandu.ximon.admin.security.SecurityUtils;
import com.sandu.ximon.admin.utils.Constant;
import com.sandu.ximon.admin.utils.FileUtil;
import com.sandu.ximon.admin.utils.HtmlTemplateUtils;
@@ -38,8 +41,6 @@
    @Autowired
    private PoleBindingService poleBindingService;
    //    @Autowired
//    PoleStreetlightLightemitService poleStreetlightLightemitService;
    LightemitUtils lightemitUtils;
    @Autowired
@@ -48,10 +49,6 @@
    private String port;
    @Autowired
    ApplicationContext applicationContext;
    //    @Autowired
//    FfmpegUtils ffmpegUtils;
//    @Autowired
//    FileUploadPathBean fileUploadPathBean;
    @Autowired
    NginxConfigBean nginxConfigBean;
@@ -64,127 +61,28 @@
        lightemitUtils = applicationContext.getBean(LightemitUtils.class);
    }
    /*@Override
    public PageUtils queryPage(Map<String, Object> params, Long userId) {
        String key = (String)params.get("key");
        Long groupId = StringUtils.isNotBlank((String)params.get("group"))? Long.valueOf((String)params.get("group")): null;
        String order = (String)params.get("order");
        String column = (String)params.get("sortby");
        IPage<PoleLightemitEntity> page = new Page<>();
        //获取角色列表
        Long roleId = (sysUserRoleService.queryRoleId(userId));
        if(roleId == null || roleId == 0){
            return null;
    /**
     * 熙讯list
     *
     * @param keyword
     * @param isOnLine
     * @return
     */
    public List<PoleLightemitEntity> listLed(String keyword, boolean isOnLine) {
        List<PoleLightemitEntity> poleLightemitEntityList;
        //超管
        if (SecurityUtils.getClientId() == null) {
            poleLightemitEntityList = poleLightemitDao.listLed(keyword, null);
        } else {
            poleLightemitEntityList = poleLightemitDao.listLed(keyword, SecurityUtils.getUserId());
        }
        if(roleId.longValue() == Constant.SUPER_ADMIN){
//            page = this.page(
//                    new Query<PoleLightemitEntity>().getPage(params),
//                    new QueryWrapper<PoleLightemitEntity>().like(StringUtils.isNotBlank(key),"lightemit_name", key));
            if (order != null && order.equals("ASC") && column.equals("isOpen")) {
                Map<String, Object> map = new HashMap<>();
                Integer pg = 1;
                Integer size = 200;
                map.put("page",pg);
                params.put("limit",size);
                page = baseMapper.superAdminSelectPageVo(PageTransform.transformPage(params),key,groupId,order,column);
                ledOnlineCheck(page.getRecords());
                page.setRecords(page.getRecords().stream().filter(h-> h.getIsOpen().equals(true)).collect(Collectors.toList()));
                return new PageUtils(page);
            }else if (order != null && order.equals("DESC") && column.equals("isOpen")){
                Map<String, Object> map = new HashMap<>();
                Integer pg = 1;
                Integer size = 200;
                map.put("page",pg);
                params.put("limit",size);
                page = baseMapper.superAdminSelectPageVo(PageTransform.transformPage(params),key,groupId,order,column);
                ledOnlineCheck(page.getRecords());
                page.setRecords(page.getRecords().stream().filter(h-> h.getIsOpen().equals(false)).collect(Collectors.toList()));
                return new PageUtils(page);
            }else {
                page = baseMapper.superAdminSelectPageVo(PageTransform.transformPage(params), key, groupId,order,column);
            }
        }else if(roleId.longValue() == Constant.ADMIN){
            if (order != null && order.equals("ASC") && column.equals("isOpen")) {
                Map<String, Object> map = new HashMap<>();
                Integer pg = 1;
                Integer size = 200;
                map.put("page",pg);
                params.put("limit",size);
                page = baseMapper.adminSelectPageVo(PageTransform.transformPage(params), userId, key, groupId,order,column);
                ledOnlineCheck(page.getRecords());
                page.setRecords(page.getRecords().stream().filter(h-> h.getIsOpen().equals(true)).collect(Collectors.toList()));
                return new PageUtils(page);
            }else if (order != null && order.equals("DESC") && column.equals("isOpen")){
                Map<String, Object> map = new HashMap<>();
                Integer pg = 1;
                Integer size = 200;
                map.put("page",pg);
                params.put("limit",size);
                page = baseMapper.adminSelectPageVo(PageTransform.transformPage(params), userId, key, groupId,order,column);
                ledOnlineCheck(page.getRecords());
                page.setRecords(page.getRecords().stream().filter(h-> h.getIsOpen().equals(false)).collect(Collectors.toList()));
                return new PageUtils(page);
            }else {
                page = baseMapper.adminSelectPageVo(PageTransform.transformPage(params), userId, key, groupId,order,column);
            }
        }else if(roleId.longValue() == Constant.USER){
            if (order != null && order.equals("ASC") && column.equals("isOpen")) {
                Map<String, Object> map = new HashMap<>();
                Integer pg = 1;
                Integer size = 200;
                map.put("page",pg);
                params.put("limit",size);
                page = baseMapper.userSelectPageVo(PageTransform.transformPage(params), userId, key, groupId,order,column);
                ledOnlineCheck(page.getRecords());
                page.setRecords(page.getRecords().stream().filter(h-> h.getIsOpen().equals(true)).collect(Collectors.toList()));
                return new PageUtils(page);
            }else if (order != null && order.equals("DESC") && column.equals("isOpen")){
                Map<String, Object> map = new HashMap<>();
                Integer pg = 1;
                Integer size = 200;
                map.put("page",pg);
                params.put("limit",size);
                page = baseMapper.userSelectPageVo(PageTransform.transformPage(params), userId, key, groupId,order,column);
                ledOnlineCheck(page.getRecords());
                page.setRecords(page.getRecords().stream().filter(h-> h.getIsOpen().equals(false)).collect(Collectors.toList()));
                return new PageUtils(page);
            }else {
                page = baseMapper.userSelectPageVo(PageTransform.transformPage(params), userId, key, groupId,order,column);
            }
        if (isOnLine) {
            return ledOnline(poleLightemitEntityList);
        } else {
            ledOnlineCheck(poleLightemitEntityList);
            return poleLightemitEntityList;
        }
        ledOnlineCheck(page.getRecords());
        return new PageUtils(page);
    }
*//*
    @Override
    public List<PoleLightemitEntity> getAll(Long userId) {
        //获取角色列表
        Long roleId = (sysUserRoleService.queryRoleId(userId));
        if(roleId == null || roleId == 0){
            return null;
        }
        List<PoleLightemitEntity> list = null;
        if(roleId.longValue() == Constant.SUPER_ADMIN){
            list = poleLightemitDao.selectAll();
        }else if(roleId.longValue() == Constant.ADMIN){
            list = poleLightemitDao.selectAllByCompany(userId);
        }else if(roleId.longValue() == Constant.USER){
            list = poleLightemitDao.selectAllByUser(userId);
        }
        return list;
    }
*/
    public List<PoleLightemitEntity> ledOnline(List<PoleLightemitEntity> list) {
        List<PoleLightemitEntity> onLineList = new ArrayList<>();
@@ -208,16 +106,17 @@
    /**
     * 查询单个LED
     *
     * @param lightControlCode
     * @return
     */
    public PoleLightemitEntity getLedByLightControlCode(String lightControlCode) {
        PoleLightemitEntity xiXun = getOne(Wrappers.lambdaQuery(PoleLightemitEntity.class).eq(PoleLightemitEntity::getLightemitControlCode, lightControlCode));
        if(xiXun==null){
        if (xiXun == null) {
            return null;
        }
        String isScreenOpen = lightemitUtils.getIsScreenOpen(xiXun.getLightemitControlCode());
        if(isScreenOpen.contains("true")){
        if (isScreenOpen.contains("true")) {
            xiXun.setIsOpen(true);
        }
        xiXun.setIsOpen(false);
@@ -282,40 +181,13 @@
    }
    /**
     * 查询权限范围内的所有led屏信息
     * led上传图片
     *
     * @param
     * @return
     */
   /* public List<PoleLightemitEntity> selectLightemitByUserId(Long userId) {
        List<PoleLightemitEntity> list = new ArrayList<>();
        Long roleId = sysUserRoleService.queryRoleId(userId);
        if(roleId == null || roleId == 0){
            return new ArrayList<>();
        }
        if(roleId.longValue() == Constant.SUPER_ADMIN){
            list = this.list();
        }else if(roleId.longValue() == Constant.ADMIN){
            list = baseMapper.selectCompanyLightemitByUserId(userId);
        }else if(roleId.longValue() == Constant.USER){
            list = baseMapper.selectLightemitByUserId(userId);
        }
        return list;
    }
*/
    /*
    通过屏幕编码查询
     */
    public PoleLightemitEntity selectByLightemitControlCode(String lightemitControlCode) {
        QueryWrapper<PoleLightemitEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("lightemit_control_code", lightemitControlCode);
        return this.getOne(queryWrapper);
    }
    /*
    led上传图片
     * @param lightemitControlCode
     * @param path
     * @param filenameList
     * @param userName
     * @throws IOException
     */
    @Async("taskExecutor")
    public void photoUpload(String lightemitControlCode, String path, List<String> filenameList, String userName) throws IOException {
@@ -352,10 +224,15 @@
        }
    }
    /*
    led上传视频
    /**
     * led上传视频
     *
     * @param lightemitControlCode
     * @param filename
     * @param path
     * @param userName
     * @throws IOException
     */
    @Async("taskExecutor")
    public void videoUpload(String lightemitControlCode, String filename, String path, String userName) throws IOException {
        //获取屏幕宽
@@ -405,21 +282,6 @@
        }
    }
    /*
    删除
     */
   /* public void deleteByIds(List<Long> lightemitIds) {
        this.removeByIds(lightemitIds);
        //删除关系表中的数据
        poleStreetlightLightemitService.remove(
                new UpdateWrapper<PoleStreetlightLightemitEntity>().in("lightemit_id", lightemitIds.toArray()));
    }*/
    /*
    熙讯视频设置
     */
    @Async("taskExecutor")
    public void videoXixunPlayer(String lightemitControlCode, String ip, String filename, Long filesize, Integer videoTime) {
        //获取屏幕宽
@@ -432,13 +294,20 @@
        ProgramsTask task = new ProgramsTask();
        Command command = new Command();
        XixunPlayer xixun = new XixunPlayer();
        source.set_id(UUID.randomUUID().toString());//所有_id都可用UUID随机生成
        source.setId(filename);//请求头拼接该ID为该资源的完整下载地址
        source.set_type("Video");    //设置资源类型,其他资源类型请参考xixunplayer节目json说明文档
        source.setFileExt(".mp4");    //资源后缀名
        source.setHeight(screenHeight);        //资源高度
        source.setWidth(screenWidth);        //资源宽度
        source.setLeft(0);            //距左
        //所有_id都可用UUID随机生成
        source.set_id(UUID.randomUUID().toString());
        //请求头拼接该ID为该资源的完整下载地址
        source.setId(filename);
        //设置资源类型,其他资源类型请参考xixunplayer节目json说明文档
        source.set_type("Video");
        //资源后缀名
        source.setFileExt(".mp4");
        //资源高度
        source.setHeight(screenHeight);
        //资源宽度
        source.setWidth(screenWidth);
        //距左
        source.setLeft(0);
        source.setMd5("dd135d5d2d44d619a542db773ab529a4");
        source.setMime("video/mp4");
        source.setName(filename);
@@ -483,112 +352,54 @@
        lightemitUtils.post(realtimeServerBean.getCommand() + lightemitControlCode, jsondata);
    }
    /*
    推送天气数据
    /**
     * 更新请求数据
     *
     * @param ledCode
     * @param postBody
     */
    //@Async("taskExecutor")
   /* public Boolean pushWeather(String lightemitControlCode, PoleSensorEntity sensorEntity, PoleStreetlightEntity streetlightEntity) {
        if(StringUtils.isBlank(lightemitControlCode)){
            return Boolean.valueOf(false);
        }
        Integer screenHeight = Integer.parseInt(lightemitUtils.getScreenHeight(lightemitControlCode));
        String size = String.valueOf(screenHeight/18);
        //字幕主体拼接
        String body =
                "<head><style type=\"text/css\">body{background-color:#000;}</style></head>" +
                        "<p style=\"font-size:" + size + "px;line-height:17px;color:#fff\">" +
                        (streetlightEntity == null || streetlightEntity.getCity() == null? "": streetlightEntity.getCity().replace("市", "")) + "<br/>" +
                        "温度:" + (sensorEntity == null || sensorEntity.getTemperature() == null? "-": sensorEntity.getTemperature()) + "℃<br/>" +
                        "湿度:" + (sensorEntity == null || sensorEntity.getHumidity() == null? "-": sensorEntity.getHumidity()) + "%RH<br/>" +
                        "亮度:" + (sensorEntity == null || sensorEntity.getBrightness() == null? "-": sensorEntity.getBrightness()) + "lux<br/>" +
                        "风速:" + (sensorEntity == null || sensorEntity.getWindSpeed() == null? "-": sensorEntity.getWindSpeed()) + "m/s<br/>" +
                        "CO2:" + (sensorEntity == null || sensorEntity.getEco2() == null? "-": sensorEntity.getEco2()) + "ppm<br/>" +
                        "甲醛:" + (sensorEntity == null || sensorEntity.getEch2o() == null? "-": sensorEntity.getEch2o()) + "mg/m³<br/>" +
                        "TVOC:" + (sensorEntity == null || sensorEntity.getTvoc() == null? "-": sensorEntity.getTvoc()) + "mg/m³<br/>" +
                        "PM25:" + (sensorEntity == null || sensorEntity.getPm25() == null? "-": sensorEntity.getPm25()) + "mg/m³<br/>" +
                        "PM10:" + (sensorEntity == null || sensorEntity.getPm10() == null? "-": sensorEntity.getPm10()) + "mg/m³<br/>";
        //组装请求参数
        SubTitleSet subTitleSet = new SubTitleSet();
        subTitleSet.html = body;
        subTitleSet.num = 1;
        //清屏操作
        lightemitUtils.clear(lightemitControlCode);
        //清除播放列表
        lightemitUtils.clearVideoPlay(lightemitControlCode);
        //清除节目列表
        lightemitUtils.clearPlayerTask(lightemitControlCode);
        try{
            lightemitUtils.subTitleSet(subTitleSet, lightemitControlCode, false);
            return true;
        }catch (Exception e){
            return false;
        }finally {
            //一分钟后清除屏幕
            new Timer().schedule(new TimerTask() {
                @Override
                public void run() {
                    lightemitUtils.clear(lightemitControlCode);
                    //清除播放列表
                    lightemitUtils.clearVideoPlay(lightemitControlCode);
                    //清除节目列表
                    lightemitUtils.clearPlayerTask(lightemitControlCode);
                    //推送最后命令
                    lightemitUtils.sendLastCommand(lightemitControlCode);
                }
            }, 60*1000);
        }
    }*/
    /*
    更新请求数据
     */
    public void updateRequestBody(String ledCode, String postBody) {
        baseMapper.updateRequestBody(ledCode, postBody);
    }
    /*
    根据led屏编码获取灯杆所有信息
     */
//    /**
//     * 根据led屏编码获取灯杆所有信息
//     *
//     * @param ledCode
//     * @return
//     */
//    public PoleStreetlightEntity getStreetlightByLedCode(String ledCode) {
//        return baseMapper.getStreetlightByLedCode(ledCode);
//    }
    /*
    根据led屏编码设置音量
     */
    /**
     * 根据led屏编码设置音量
     *
     * @param lightemitControlCode
     * @param volume
     */
    @Async("taskExecutor")
    public void setVolume(String lightemitControlCode, Integer volume) {
        lightemitUtils.setVoiume(lightemitControlCode, volume);
    }
       /*
    根据led屏编码设置音量
     */
    /**
     * 根据led屏编码设置音量
     *
     * @param lightemitControlCode
     * @param brightness
     */
    @Async("taskExecutor")
    public void setBrightness(String lightemitControlCode, Integer brightness) {
        lightemitUtils.setBrightness(lightemitControlCode, brightness);
    }
//    public List<PoleLightemitEntity> listOfStreetlight(String streetlightId) {
//        return baseMapper.listOfStreetlight(streetlightId);
//    }
//    public List<PoleLightemitEntity> selectLedByStreetlightId(String streetlightId) {
//        return baseMapper.getLedByStreetlightId(streetlightId);
//    }
    /*
        上传水平滚动单行字幕
         */
    /**
     * 上传水平滚动单行字幕
     *
     * @param subTitleSetEntity
     */
    private void BuildHorizonSingSubTitleText(SubTitleSetEntity subTitleSetEntity) {
        //拼装LED屏幕设置请求body
        SubTitleSet subTitleSet = new SubTitleSet();
@@ -624,8 +435,13 @@
        }
    }
    /*
    上传垂直滚动单行字幕
    /**
     * 上传垂直滚动单行字幕
     *
     * @param subTitleSetEntity
     * @param path
     * @param userName
     * @throws IOException
     */
    private void BuildVerticalSingSubTitleText(SubTitleSetEntity subTitleSetEntity, String path, String userName) throws IOException {
        //html地址
@@ -684,9 +500,13 @@
        }
    }
    /*
    上传垂直滚动多行字幕
    /**
     * 上传垂直滚动多行字幕
     *
     * @param subTitleSetEntity
     * @param path
     * @param userName
     * @throws IOException
     */
    private void BuildVerticalMultiSubTitleText(SubTitleSetEntity subTitleSetEntity, String path, String userName) throws IOException {
        //html地址
@@ -738,68 +558,5 @@
                }
            }
        }
    }
    //   @Override
    public void xixunplaySetting(String lightemitControlCode) {
        //获取屏幕宽
//        Integer screenWidth = Integer.valueOf(lightemitUtils.getScreenWidth(lightemitControlCode));
//        Integer screenHeight = Integer.valueOf(lightemitUtils.getScreenHeight(lightemitControlCode));
//        Source source = new Source();
//        Layer layer = new Layer();
//        Program pro = new Program();
//        TaskItem items = new TaskItem();
//        ProgramsTask task = new ProgramsTask();
//        Command payload = new Command();
//        XixunPlayer xixun = new XixunPlayer();
//        source.set_id(UUID.randomUUID().toString());//所有_id都可用UUID随机生成
//        source.setId(filename);//请求头拼接该ID为该资源的完整下载地址
//        source.set_type("Video");    //设置资源类型,其他资源类型请参考xixunplayer节目json说明文档
//        source.setFileExt(".mp4");    //资源后缀名
//        source.setHeight(screenHeight);        //资源高度
//        source.setWidth(screenWidth);        //资源宽度
//        source.setLeft(0);            //距左
//        source.setMd5("dd135d5d2d44d619a542db773ab529a4");
//        source.setMime("video/mp4");
//        source.setName(filename);
//        source.setPlayTime(0);    //播放起始时间
//        source.setSize(filesize);    //资源字节数,要精准
//        source.setTimeSpan(videoTime);        //该资源播放时长
//        source.setTop(0);            //距顶
//        List<Source> list = new ArrayList<Source>();
//        list.add(source);
//        layer.setSources(list);
//        pro.set_id(UUID.randomUUID().toString());
//        pro.setHeight(screenHeight);        //节目高度
//        List<Layer> list1=new ArrayList<Layer>();
//        list1.add(layer);
//        pro.setLayers(list1);
//        pro.setName("demo");    //节目名称
//        pro.setOthers(true);//如果为true,则该节目来自第三方接口,不是来自我们自己的web,二次开发请务必赋值为true
//        pro.setTotalSize(filesize);    //所有资源总字节数
//        pro.setVersion(0);            //高级节目=0,简易节目=2
//        pro.setWidth(screenWidth);        //节目宽度
//        items.set_id(UUID.randomUUID().toString());
//        items.set_program(pro);
//        items.setRepeatTimes(1);
//        items.setSchedules(null);//定时段,不做定时可为null
//        task.set_id(UUID.randomUUID().toString());
//        task.setName("这是一个示例");
//        List<TaskItem> list2=new ArrayList<TaskItem>();
//        list2.add(items);
//        task.setItems(list2);
//        payload.setId(UUID.randomUUID().toString());
//        //这里是下方的post回调地址,需要修改IP地址
//        payload.setNotificationURL("http://" + ip + ":" + port + "/machine-fast/serv/download/getJSON");
//        //资源下载链接的请求头
//        payload.setPreDownloadURL("http://" + ip + ":" + port + "/machine-fast/serv/download/downloadFile/");
//        payload.setTask(task);
//        xixun.set_id(UUID.randomUUID().toString());
//        xixun.setCommand(payload);
//        xixun.setType("commandXixunPlayer");    //命令固定类型,不可更改
//        String jsondata = new Gson().toJson(xixun);
//        lightemitUtils.clear(lightemitControlCode);
//        this.updateRequestBody(lightemitControlCode,jsondata);
//        lightemitUtils.post(realtimeServerBean.getCommand() + lightemitControlCode,jsondata);
    }
}