2021与蓝度共同重构项目,服务端
fix
zhanzhiqin
2022-05-27 33ecbd69aca2ccc58d47f467f3f7266b37fa9dfc
fix
已修改12个文件
183 ■■■■■ 文件已修改
dao/src/main/java/com/sandu/ximon/dao/mapper/LedPlayerEntityMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/java/com/sandu/ximon/dao/mapper/LightMapper.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/java/com/sandu/ximon/dao/mapper/PoleLightemitEntityMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/java/com/sandu/ximon/dao/mapper/PoleMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/resources/mapper/LedPlayerEntityMapper.xml 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/resources/mapper/LightMapper.xml 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/resources/mapper/PoleLightemitEntityMapper.xml 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/resources/mapper/PoleMapper.xml 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/GetListOnBindingController.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LEDProgramService.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedPlayerEntityService.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleLightemitService.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/java/com/sandu/ximon/dao/mapper/LedPlayerEntityMapper.java
@@ -15,6 +15,8 @@
    boolean saveLed(LedPlayerEntity ledPlayerEntity);
    List<LedPlayerEntity> ledPlayerEntityList(String keyword, Long userid);
    List<LedPlayerEntity> ledPlayerEntityListOnBinding(String keyword, Long userid);
}
dao/src/main/java/com/sandu/ximon/dao/mapper/LightMapper.java
@@ -28,6 +28,15 @@
     * @return
     */
    List<String> listCode(Long userId, String keyword, String deviceCode);
    /***
     * 用在绑定设备
     * @param clientId
     * @param keyword
     * @return
     */
    List<LightBo> listLightOnBinding(Long clientId, String keyword);
}
dao/src/main/java/com/sandu/ximon/dao/mapper/PoleLightemitEntityMapper.java
@@ -19,6 +19,8 @@
    List<PoleLightemitEntity> listLed(String keyword, Long userid, String orderBy);
    List<PoleLightemitEntity> listLedOnBinding(String keyword, Long userid);
    Pole getpole(String lightemitControlCode);
}
dao/src/main/java/com/sandu/ximon/dao/mapper/PoleMapper.java
@@ -16,6 +16,8 @@
    boolean updateDeviceCode(Long id);
    List<Pole> queryPoleOnLineStatesList(Long userid, Integer isTrue, Integer bingStates, Long groupid, String keyword, String orderBy);
    List<Pole> getPoleListOnBinding(Long userid, String keyword);
}
dao/src/main/resources/mapper/LedPlayerEntityMapper.xml
@@ -43,4 +43,27 @@
            </if>
        </where>
    </select>
    <select id="ledPlayerEntityListOnBinding" 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.player_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/LightMapper.xml
@@ -70,4 +70,28 @@
            </if>
        </where>
    </select>
    <select id="listLightOnBinding" resultType="com.sandu.ximon.dao.bo.LightBo">
        SELECT
        t1.*,
        t2.id AS pole_id,
        t2.pole_code,
        t2.pole_name,
        t4.task_name
        FROM
        light t1
        LEFT JOIN pole t2 USING ( device_code )
        LEFT JOIN light_task_pole_relation t3 ON t3.pole_id = t2.id
        LEFT JOIN light_task t4 ON t3.task_id = t4.task_id
        <where>
            <if test="clientId != null">
                AND (t2.user_id = #{clientId} OR t2.client_id = #{clientId})
            </if>
            <if test="keyword != null and keyword != ''">
                AND (
                t1.device_code LIKE CONCAT('%', #{keyword},'%')
                OR t1.light_id LIKE CONCAT('%', #{keyword},'%')
                )
            </if>
        </where>
    </select>
</mapper>
dao/src/main/resources/mapper/PoleLightemitEntityMapper.xml
@@ -38,7 +38,7 @@
    <select id="listLed" resultType="com.sandu.ximon.dao.domain.PoleLightemitEntity">
        SELECT
        t1.*, t2.pole_id as streetlight_id,
        t3.pole_name  as streetlight_name, t3.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
@@ -46,9 +46,9 @@
        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}), '%')
                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}), '%')
                OR t1.lightemit_id LIKE CONCAT(CONCAT('%', #{keyword}), '%'))
            </if>
            <if test="userid != null">
                AND (t3.user_id = #{userid} OR t3.client_id = #{userid})
@@ -71,4 +71,23 @@
            AND t3.lightemit_control_code = #{lightemitControlCode}
        </if>
    </select>
    <select id="listLedOnBinding" resultType="com.sandu.ximon.dao.domain.PoleLightemitEntity">
        SELECT
        t1.*, t2.pole_id as streetlight_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 = 10
        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}), '%'))
            </if>
            <if test="userid != null">
                AND (t3.user_id = #{userid} OR t3.client_id = #{userid})
            </if>
        </where>
    </select>
</mapper>
dao/src/main/resources/mapper/PoleMapper.xml
@@ -71,7 +71,26 @@
        </where>
        GROUP BY t1.id
        <if test="orderBy != null">
            ORDER BY  ${orderBy}
            ORDER BY ${orderBy}
        </if>
    </select>
    <select id="getPoleListOnBinding" resultType="com.sandu.ximon.dao.domain.Pole">
        SELECT
        t1.*
        FROM
        pole t1
        LEFT JOIN pole_group_relation t2 ON t1.id = t2.pole_id
        LEFT JOIN pole_group t3 ON t3.group_id = t2.pole_group_id
        <where>
            <if test="userid != null">
                AND (t1.user_id = #{userid} OR t1.client_id = #{userid})
            </if>
            <if test="keyword != null and keyword != ''">
                AND ( t1.id LIKE CONCAT(CONCAT('%', #{keyword}), '%')
                OR t1.pole_name LIKE CONCAT(CONCAT('%', #{keyword}), '%'))
            </if>
        </where>
        GROUP BY t1.id
    </select>
</mapper>
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/GetListOnBindingController.java
@@ -74,12 +74,12 @@
    private final PoleMapper poleMapper;
    @GetMapping("/getPoleList")
    public ResponseVO<Object> getPoleList() {
    public ResponseVO<Object> getPoleList(@RequestParam(required = false, value = "keyword") String keyword) {
        List<Pole> poleList;
        if (SecurityUtils.getClientId() == null) {
            poleList = poleMapper.queryPoleOnLineStatesList(null, null, null, null, null, null);
            poleList = poleMapper.getPoleListOnBinding(null, keyword);
        } else {
            poleList = poleMapper.queryPoleOnLineStatesList(SecurityUtils.getUserId(), null, null, null, null, null);
            poleList = poleMapper.getPoleListOnBinding(SecurityUtils.getUserId(), keyword);
        }
        List<Map> mapList = new ArrayList<>();
@@ -99,8 +99,8 @@
    private final LightMapper lightMapper;
    @GetMapping("/getLightList")
    public ResponseVO<Object> getLightList() {
        List<LightBo> listLight = lightMapper.listLight(SecurityUtils.getClientId(), null);
    public ResponseVO<Object> getLightList(@RequestParam(required = false, value = "keyword") String keyword) {
        List<LightBo> listLight = lightMapper.listLightOnBinding(SecurityUtils.getClientId(), keyword);
        List<Map> mapList = new ArrayList<>();
@@ -120,9 +120,9 @@
     * NLED列表(诺瓦设备)
     */
    @GetMapping("/getLedPlayerEntityList")
    public ResponseVO<Object> getLedPlayerEntityList() {
    public ResponseVO<Object> getLedPlayerEntityList(@RequestParam(required = false, value = "keyword") String keyword) {
        List<LedPlayerEntity> list = SpringContextHolder.getBean(LedPlayerEntityService.class).
                ledPlayerEntityList(null, null, null, null);
                ledPlayerEntityListOnBinding(keyword);
        List<Map> mapList = new ArrayList<>();
        Map map;
@@ -168,8 +168,8 @@
    private final LEDProgramService ledProgramService;
    @GetMapping("/getNledProgeamList")
    public ResponseVO<Object> getNledProgeamList() {
        List<LEDProgram> ledPrograms = ledProgramService.listProgram(null, null, null, null);
    public ResponseVO<Object> getNledProgeamList(@RequestParam(required = false, value = "keyword") String keyword) {
        List<LEDProgram> ledPrograms = ledProgramService.listProgramOnBinding(keyword);
        List<Map> mapList = new ArrayList<>();
        Map map;
        for (LEDProgram bean : ledPrograms) {
@@ -190,8 +190,8 @@
    private final PoleLightemitService sLedService;
    @GetMapping("/getSledList")
    public ResponseVO<Object> getSledList() {
        List<PoleLightemitEntity> poleLightemitEntities = sLedService.listLed(null, null, null, false);
    public ResponseVO<Object> getSledList(@RequestParam(required = false, value = "keyword") String keyword) {
        List<PoleLightemitEntity> poleLightemitEntities = sLedService.listLedOnBinding(keyword);
        List<Map> mapList = new ArrayList<>();
        Map map;
        for (PoleLightemitEntity bean : poleLightemitEntities) {
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LEDProgramService.java
@@ -81,7 +81,7 @@
        return param;
    }
    public List<LEDProgram> listProgram(BaseConditionVO baseConditionVO,Integer order,Integer seq, String keyword) {
    public List<LEDProgram> listProgram(BaseConditionVO baseConditionVO, Integer order, Integer seq, String keyword) {
        LambdaQueryWrapper<LEDProgram> wrapper = listPrograms();
        if (keyword != null && !keyword.isEmpty()) {
@@ -120,6 +120,16 @@
        return list(wrapper);
    }
    public List<LEDProgram> listProgramOnBinding(String keyword) {
        LambdaQueryWrapper<LEDProgram> wrapper = listPrograms();
        if (keyword != null && !keyword.isEmpty()) {
            wrapper.like(LEDProgram::getName, keyword);
        }
        return list(wrapper);
    }
    public LambdaQueryWrapper<LEDProgram> listPrograms() {
        if (SecurityUtils.getClientId() == null) {
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedPlayerEntityService.java
@@ -161,4 +161,16 @@
        return SpringContextHolder.getBean(VnnoxService.class).setCacheInfo(vnnoxAPIUtil.syncCurrentInfo(list));
    }
    public List<LedPlayerEntity> ledPlayerEntityListOnBinding(String keyword) {
        List<LedPlayerEntity> list;
        //超管
        if (SecurityUtils.getClientId() == null) {
            list = ledPlayerEntityMapper.ledPlayerEntityListOnBinding(keyword, null);
        } else {
            list = ledPlayerEntityMapper.ledPlayerEntityListOnBinding(keyword, SecurityUtils.getUserId());
        }
        return SpringContextHolder.getBean(VnnoxService.class).setCacheInfo(vnnoxAPIUtil.syncCurrentInfo(list));
    }
}
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleLightemitService.java
@@ -125,6 +125,35 @@
        return temp;
    }
    /**
     * 绑定使用
     *
     * @param keyword
     * @return
     */
    public List<PoleLightemitEntity> listLedOnBinding(String keyword) {
        List<PoleLightemitEntity> poleLightemitEntityList;
        //超管
        if (SecurityUtils.getClientId() == null) {
            poleLightemitEntityList = poleLightemitDao.listLedOnBinding(keyword, null);
        } else {
            poleLightemitEntityList = poleLightemitDao.listLedOnBinding(keyword, SecurityUtils.getUserId());
        }
        for (PoleLightemitEntity poleLightemitEntity : poleLightemitEntityList) {
            //查询设备在线状态
            boolean onLine = lightemitUtils.getLedOnLine(poleLightemitEntity.getLightemitControlCode());
            //查询屏幕的开启状态
            String isOpen = lightemitUtils.getIsScreenOpen(poleLightemitEntity.getLightemitControlCode());
            poleLightemitEntity.setIsOpen(String.valueOf(isOpen));
            poleLightemitEntity.setOnLine(onLine);
        }
        return poleLightemitEntityList;
    }
    /**
     * 取出在线的熙讯
     *