已添加13个文件
已修改17个文件
已删除4个文件
已重命名1个文件
已复制1个文件
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.dao.bo; |
| | | |
| | | import com.sandu.ximon.dao.domain.Light; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @author chenjiantian |
| | | * @date 2021/12/17 14:51 |
| | | * è·¯ç¯å表å®ä½ç±» |
| | | */ |
| | | @Data |
| | | public class LightBo extends Light { |
| | | |
| | | private Long poleId; |
| | | private String poleCode; |
| | | private String poleName; |
| | | private String taskName; |
| | | private LocalDateTime reportTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.dao.bo; |
| | | |
| | | import com.sandu.ximon.dao.domain.LightReportData; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author chenjiantian |
| | | * @date 2021/12/17 16:51 |
| | | */ |
| | | @Data |
| | | public class LightReportDataBo extends LightReportData { |
| | | |
| | | private String poleName; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.dao.bo; |
| | | |
| | | import com.sandu.ximon.dao.domain.LightReportError; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author chenjiantian |
| | | * @date 2021/12/17 16:51 |
| | | */ |
| | | @Data |
| | | public class LightReportErrorBo extends LightReportError { |
| | | |
| | | private String poleName; |
| | | private String errorMsg; |
| | | } |
| ÎļþÃû´Ó dao/src/main/java/com/sandu/ximon/dao/domain/LightRemark.java ÐÞ¸Ä |
| | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * è·¯ç¯å¤æ³¨è¡¨ |
| | | * @TableName light_remark |
| | | * è·¯ç¯è¡¨ |
| | | * @TableName light |
| | | */ |
| | | @TableName(value ="light_remark") |
| | | @TableName(value ="light") |
| | | @Data |
| | | public class LightRemark implements Serializable { |
| | | public class Light implements Serializable { |
| | | /** |
| | | * |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | private Long lightId; |
| | | |
| | | /** |
| | | * 设å¤è¯å«ç |
| | | */ |
| | | private String deviceMac; |
| | | private String deviceCode; |
| | | |
| | | /** |
| | | * 夿³¨ä¿¡æ¯ |
| | |
| | | /** |
| | | * 设å¤mac |
| | | */ |
| | | private String deviceMac; |
| | | private String deviceCode; |
| | | |
| | | /** |
| | | * å¸çµçµå |
| | |
| | | private Double reactivePower; |
| | | |
| | | /** |
| | | * 亮度ç¾åæ¯ï¼0-100 |
| | | * ç¯1亮度ç¾åæ¯ï¼0-100 |
| | | */ |
| | | private Integer lightPercent; |
| | | |
| | | /** |
| | | * ç¯2亮度ç¾åæ¯ |
| | | */ |
| | | private Integer light2Percent; |
| | | |
| | | /** |
| | | * æè¿ä¸æ¬¡äº®ç¯æ¶é´ |
| | | */ |
| | | private Long recentlyLightSec; |
copy from dao/src/main/java/com/sandu/ximon/dao/domain/LightRemark.java
copy to dao/src/main/java/com/sandu/ximon/dao/domain/LightReportError.java
| Îļþ´Ó dao/src/main/java/com/sandu/ximon/dao/domain/LightRemark.java ¸´ÖÆ |
| | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * è·¯ç¯å¤æ³¨è¡¨ |
| | | * @TableName light_remark |
| | | * ç¯ä¸æ¥æ
éç 表 |
| | | * @TableName light_report_error |
| | | */ |
| | | @TableName(value ="light_remark") |
| | | @TableName(value ="light_report_error") |
| | | @Data |
| | | public class LightRemark implements Serializable { |
| | | public class LightReportError implements Serializable { |
| | | /** |
| | | * |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | private Long lightReportErrorId; |
| | | |
| | | /** |
| | | * 设å¤è¯å«ç |
| | | * 设å¤mac |
| | | */ |
| | | private String deviceMac; |
| | | private String deviceCode; |
| | | |
| | | /** |
| | | * 夿³¨ä¿¡æ¯ |
| | | * æ
éç |
| | | */ |
| | | private String remark; |
| | | private Integer errorCode; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | |
| | | private String deviceName; |
| | | |
| | | /** |
| | | * ç»å®è®¾å¤mac |
| | | * ç»å®è®¾å¤ç |
| | | */ |
| | | private String deviceMac; |
| | | private String deviceCode; |
| | | |
| | | /** |
| | | * 设å¤ç±»åï¼0è·¯ç¯ï¼1ledå±å¹ï¼2å
çµæ¡©ï¼3大æ°çæµï¼4æ°´è´¨çæµï¼5ip鳿±ï¼6lcdå¹¿åæºï¼7æå头ï¼8æä½å¾æµï¼9ä¸é®æå© |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.dao.mapper; |
| | | |
| | | import com.sandu.ximon.dao.bo.LightBo; |
| | | import com.sandu.ximon.dao.domain.Light; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.sandu.ximon.dao.domain.LightReportData; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Entity com.sandu.ximon.dao.domain.Light |
| | | */ |
| | | @Mapper |
| | | public interface LightMapper extends BaseMapper<Light> { |
| | | |
| | | /** |
| | | * æå¡å¨è·åè·¯ç¯å表 |
| | | * |
| | | * @param clientId 客æ·id |
| | | * @param keyword å
³é®å |
| | | * @return è·¯ç¯å表 |
| | | */ |
| | | List<LightBo> listLight(Long clientId, String keyword); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | package com.sandu.ximon.dao.mapper; |
| | | |
| | | import com.sandu.ximon.dao.bo.LightReportDataBo; |
| | | import com.sandu.ximon.dao.domain.LightReportData; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Entity com.sandu.ximon.dao.domain.LightReportData |
| | |
| | | @Mapper |
| | | public interface LightReportDataMapper extends BaseMapper<LightReportData> { |
| | | |
| | | /** |
| | | * è·åæå®è®¾å¤åææ°ä¸æ¥ç䏿¡æ°æ® |
| | | * @param deviceCodeList æå®è®¾å¤ç |
| | | * @return 䏿¥æ°æ® |
| | | */ |
| | | List<LightReportData> getNewestReportByDeviceCode(List<String> deviceCodeList); |
| | | |
| | | |
| | | /** |
| | | * è·å䏿¥æ°æ®å表 |
| | | * @param keyword å
³é®è¯ |
| | | * @param deviceCode 设å¤ç |
| | | * @return 䏿¥æ°æ® |
| | | */ |
| | | List<LightReportDataBo> listReportData(String keyword, String deviceCode); |
| | | } |
| | | |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.dao.mapper; |
| | | |
| | | import com.sandu.ximon.dao.bo.LightReportErrorBo; |
| | | import com.sandu.ximon.dao.domain.LightReportError; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Entity com.sandu.ximon.dao.domain.LightReportError |
| | | */ |
| | | @Mapper |
| | | public interface LightReportErrorMapper extends BaseMapper<LightReportError> { |
| | | |
| | | /** |
| | | * è·åæ
éç å表 |
| | | * @param keyword å
³é®è¯ |
| | | * @return æ
éç å表 |
| | | */ |
| | | List<LightReportErrorBo> listReportError(String keyword); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.sandu.ximon.dao.mapper.LightMapper"> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.Light"> |
| | | <id property="lightId" column="light_id" jdbcType="BIGINT"/> |
| | | <result property="deviceCode" column="device_code" jdbcType="VARCHAR"/> |
| | | <result property="remark" column="remark" jdbcType="VARCHAR"/> |
| | | <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
| | | <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="listLight" type="com.sandu.ximon.dao.bo.LightBo" extends="BaseResultMap"> |
| | | <result property="poleId" column="pole_id" jdbcType="BIGINT"/> |
| | | <result property="poleCode" column="pole_code" jdbcType="VARCHAR"/> |
| | | <result property="poleName" column="pole_name" jdbcType="VARCHAR"/> |
| | | <result property="taskName" column="task_name" jdbcType="VARCHAR"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="listLight" resultMap="listLight"> |
| | | 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.client_id = #{clientId} |
| | | </if> |
| | | <if test="keyword != null and keyword != ''"> |
| | | AND ( |
| | | t1.device_code LIKE CONCAT('%', #{keyword},'%') |
| | | OR t2.pole_name LIKE CONCAT('%', #{keyword},'%') |
| | | ) |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.LightReportData"> |
| | | <id property="lightReportDataId" column="light_report_data_id" jdbcType="BIGINT"/> |
| | | <result property="deviceMac" column="device_mac" jdbcType="VARCHAR"/> |
| | | <result property="deviceCode" column="device_code" jdbcType="VARCHAR"/> |
| | | <result property="voltage" column="voltage" jdbcType="FLOAT"/> |
| | | <result property="electricCurrent" column="electric_current" jdbcType="FLOAT"/> |
| | | <result property="deviceTemperature" column="device_temperature" jdbcType="FLOAT"/> |
| | |
| | | <result property="activePower" column="active_power" jdbcType="FLOAT"/> |
| | | <result property="reactivePower" column="reactive_power" jdbcType="FLOAT"/> |
| | | <result property="lightPercent" column="light_percent" jdbcType="INTEGER"/> |
| | | <result property="light2Percent" column="light2_percent" jdbcType="INTEGER"/> |
| | | <result property="recentlyLightSec" column="recently_light_sec" jdbcType="BIGINT"/> |
| | | <result property="totalLightSec" column="total_light_sec" jdbcType="BIGINT"/> |
| | | <result property="recentlyUsingPower" column="recently_using_power" jdbcType="DOUBLE"/> |
| | |
| | | <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | light_report_data_id,device_mac,voltage, |
| | | electric_current,device_temperature,power_factor, |
| | | active_power,reactive_power,light_percent, |
| | | recently_light_sec,total_light_sec,recently_using_power, |
| | | total_using_power,create_time,update_time |
| | | </sql> |
| | | <resultMap id="listReportData" type="com.sandu.ximon.dao.bo.LightReportDataBo" extends="BaseResultMap"> |
| | | <result property="poleName" column="pole_name" jdbcType="VARCHAR"/> |
| | | </resultMap> |
| | | |
| | | <select id="getNewestReportByDeviceCode" resultMap="BaseResultMap"> |
| | | SELECT |
| | | t1.* |
| | | FROM |
| | | light_report_data t1 |
| | | JOIN ( |
| | | SELECT |
| | | MAX( light_report_data_id ) AS light_report_data_id |
| | | FROM |
| | | light_report_data |
| | | WHERE device_code IN |
| | | <foreach collection="deviceCodeList" open="(" close=")" separator="," item="deviceCode"> |
| | | #{deviceCode} |
| | | </foreach> |
| | | GROUP BY device_code |
| | | ) AS t2 USING ( light_report_data_id ) |
| | | </select> |
| | | <select id="listReportData" resultMap="listReportData"> |
| | | SELECT |
| | | t1.* ,t2.pole_name |
| | | FROM |
| | | light_report_data t1 |
| | | LEFT JOIN pole t2 USING ( device_code ) |
| | | <where> |
| | | <if test="keyword != null and keyword != ''"> |
| | | AND ( |
| | | t1.device_code LIKE CONCAT('%', #{keyword},'%') |
| | | OR t2.pole_name LIKE CONCAT('%', #{keyword},'%') |
| | | ) |
| | | </if> |
| | | <if test="deviceCode != null and keyword != ''"> |
| | | AND t1.device_code = #{deviceCode} |
| | | </if> |
| | | </where> |
| | | ORDER BY t1.light_report_data_id DESC |
| | | </select> |
| | | </mapper> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.sandu.ximon.dao.mapper.LightReportErrorMapper"> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.LightReportError"> |
| | | <id property="lightReportErrorId" column="light_report_error_id" jdbcType="BIGINT"/> |
| | | <result property="deviceCode" column="device_code" jdbcType="VARCHAR"/> |
| | | <result property="errorCode" column="error_code" jdbcType="INTEGER"/> |
| | | <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
| | | <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <resultMap id="listReportError" type="com.sandu.ximon.dao.bo.LightReportErrorBo" extends="BaseResultMap"> |
| | | <result property="poleName" column="pole_name" jdbcType="INTEGER"/> |
| | | </resultMap> |
| | | |
| | | <select id="listReportError" resultMap="listReportError"> |
| | | SELECT |
| | | t1.*, |
| | | t2.pole_name |
| | | FROM |
| | | light_report_error t1 |
| | | LEFT JOIN pole t2 USING ( device_code ) |
| | | <where> |
| | | <if test="keyword != null and keyword != ''"> |
| | | AND ( |
| | | t1.device_code LIKE CONCAT('%', #{keyword},'%') |
| | | OR t2.pole_name LIKE CONCAT('%', #{keyword},'%') |
| | | ) |
| | | </if> |
| | | </where> |
| | | ORDER BY t1.light_report_error_id DESC |
| | | </select> |
| | | </mapper> |
| | |
| | | <id property="id" column="id" jdbcType="BIGINT"/> |
| | | <result property="poleId" column="pole_id" jdbcType="BIGINT"/> |
| | | <result property="deviceName" column="device_name" jdbcType="VARCHAR"/> |
| | | <result property="deviceMac" column="device_mac" jdbcType="VARCHAR"/> |
| | | <result property="deviceCode" column="device_code" jdbcType="VARCHAR"/> |
| | | <result property="deviceType" column="device_type" jdbcType="INTEGER"/> |
| | | <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
| | | <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> |
| | |
| | | |
| | | <sql id="Base_Column_List"> |
| | | id,pole_id,device_name, |
| | | device_mac,device_type,create_time, |
| | | device_code,device_type,create_time, |
| | | update_time |
| | | </sql> |
| | | </mapper> |
| | |
| | | package com.sandu.ximon.admin.controller; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.dto.LightDataDto; |
| | | import com.sandu.ximon.admin.param.LightRemarkParam; |
| | | import com.sandu.ximon.admin.service.LightReportDataService; |
| | | import com.sandu.ximon.dao.domain.Pole; |
| | | import com.sandu.ximon.admin.service.LightReportErrorService; |
| | | import com.sandu.ximon.admin.service.LightService; |
| | | import com.sandu.ximon.dao.bo.LightBo; |
| | | import com.sandu.ximon.dao.bo.LightReportDataBo; |
| | | import com.sandu.ximon.dao.bo.LightReportErrorBo; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | @RequestMapping("/v1/light") |
| | | public class LightController { |
| | | |
| | | private final LightService lightService; |
| | | private final LightReportDataService lightReportDataService; |
| | | private final LightReportErrorService lightReportErrorService; |
| | | |
| | | |
| | | @GetMapping("/list") |
| | | public ResponseVO<Object> listLight(BaseConditionVO conditionVO, @RequestParam(required = false) String keyword) { |
| | | List<LightDataDto> list = lightReportDataService.listLight(conditionVO.getPageNo(),conditionVO.getPageSize(),keyword); |
| | | List<LightBo> list = lightService.listLight(conditionVO.getPageNo(), conditionVO.getPageSize(), keyword); |
| | | return ResponseUtil.success(list); |
| | | } |
| | | |
| | | @PostMapping("/remark") |
| | | public ResponseVO<Object> addRemark(@RequestBody @Validated LightRemarkParam param) { |
| | | boolean result = lightService.addRemark(param); |
| | | if (result) { |
| | | return ResponseUtil.success("æ·»å æå"); |
| | | } else { |
| | | return ResponseUtil.fail("æ·»å 失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·å䏿¥æ°æ® |
| | | * |
| | | * @param conditionVO |
| | | * @return |
| | | */ |
| | | @GetMapping("/report/list") |
| | | public ResponseVO<Object> listReportData(BaseConditionVO conditionVO, @RequestParam(required = false) String keyword, @RequestParam(required = false) String deviceCode) { |
| | | List<LightReportDataBo> list = lightReportDataService.listReportData(conditionVO.getPageNo(), conditionVO.getPageSize(), keyword, deviceCode); |
| | | return ResponseUtil.success(list); |
| | | } |
| | | |
| | | @GetMapping("/error/list") |
| | | public ResponseVO<Object> listReportError(BaseConditionVO conditionVO, @RequestParam(required = false) String keyword) { |
| | | List<LightReportErrorBo> list = lightReportErrorService.listReportError(conditionVO.getPageNo(), conditionVO.getPageSize(), keyword); |
| | | return ResponseUtil.success(list); |
| | | } |
| | | } |
| | |
| | | |
| | | @PostMapping("/update/{taskId}") |
| | | public ResponseVO<Object> updateLightTask(@PathVariable Long taskId, @RequestBody @Validated LightTaskParam param) { |
| | | boolean result = lightTaskService.updateLightTask(taskId,param); |
| | | boolean result = lightTaskService.updateLightTask(taskId, param); |
| | | if (result) { |
| | | return ResponseUtil.success("ç¼è¾æå"); |
| | | } else { |
| | |
| | | package com.sandu.ximon.admin.controller; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.util.ArrayUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.dto.DeviceStatus; |
| | | import com.sandu.ximon.admin.param.PoleBindingParam; |
| | | import com.sandu.ximon.admin.param.PoleParam; |
| | | import com.sandu.ximon.admin.service.PoleService; |
| | |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/listStatusByDeviceCode") |
| | | public ResponseVO<Object> getStatusById(@RequestBody String[] deviceCodeList){ |
| | | if(ArrayUtil.isEmpty(deviceCodeList)) { |
| | | return ResponseUtil.fail("åæ°ä¸è½ä¸ºç©º"); |
| | | } |
| | | List<DeviceStatus> statusList = poleService.listStatusByDeviceCode(CollectionUtil.toList(deviceCodeList)); |
| | | return ResponseUtil.success(statusList); |
| | | } |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author chenjiantian |
| | | * @date 2021/12/17 15:55 |
| | | * é¿éäºè®¾å¤ç¶æ |
| | | */ |
| | | @Data |
| | | public class DeviceStatus { |
| | | |
| | | private String deviceCode; |
| | | /** |
| | | * 0 ä¸çº¿ |
| | | * 1 ä¸çº¿ |
| | | * 2 æªæ¿æ´» |
| | | * 3 ä¸å¯ç¨ |
| | | */ |
| | | private Integer status; |
| | | } |
| | |
| | | @AllArgsConstructor |
| | | public class InitAmqpListener { |
| | | |
| | | private final MqttMainBoardConfig mqttMainBoardConfig; |
| | | private final MqttMainBoardConfig mqttMainBoardConfig; |
| | | |
| | | /* @PostConstruct |
| | | public void initListener() throws Exception { |
| | | new AmqpClient( |
| | | mqttMainBoardConfig |
| | | ).execute(); |
| | | }*/ |
| | | // @PostConstruct |
| | | // public void initListener() throws Exception { |
| | | // new AmqpClient( |
| | | // mqttMainBoardConfig |
| | | // ).execute(); |
| | | // } |
| | | } |
| | |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.dto.CommonFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.A5LightReportEnum; |
| | | import com.sandu.ximon.admin.service.LightReportDataService; |
| | | import com.sandu.ximon.admin.service.LightReportErrorService; |
| | | import com.sandu.ximon.admin.service.LightService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.util.ArrayList; |
| | | |
| | | /** |
| | | * @author chenjiantian |
| | |
| | | if (A5LightReportEnum.HeartBeat_Data.getCode().equals(functionCode)) { |
| | | log.info("å¿è·³ç¸åº"); |
| | | A5LightHeartbeatReportInnerFrame heartbeatReportInnerFrame = new A5LightHeartbeatReportInnerFrame().transformFrame(frame.getPayload()); |
| | | log.info(heartbeatReportInnerFrame.toString()); |
| | | |
| | | SpringContextHolder.getBean(LightReportDataService.class).saveReportData(deviceName,heartbeatReportInnerFrame.getHeartBeatDataPackage()); |
| | | |
| | | // SpringContextHolder.getBean(LightService.class).saveLight(deviceName,heartbeatReportInnerFrame.getHeartBeatDataPackage()); |
| | | SpringContextHolder.getBean(LightReportDataService.class).saveReportData(deviceName, heartbeatReportInnerFrame.getHeartBeatDataPackage()); |
| | | SpringContextHolder.getBean(LightService.class).saveLight(deviceName); |
| | | |
| | | } else if (A5LightReportEnum.Time_Synchronized.getCode().equals(functionCode)) { |
| | | // log.info("è¯·æ±æ¶é´åæ¥"); |
| | | A5LightTimeSyncReportInnerFrame syncRespInnerFrame = new A5LightTimeSyncReportInnerFrame().transformFrame(frame.getPayload()); |
| | | // log.info(syncRespInnerFrame.toString()); |
| | | } else if (A5LightReportEnum.Error_Code.getCode().equals(functionCode)) { |
| | | // log.info("æ
éç 䏿¥"); |
| | | log.info("æ
éç 䏿¥"); |
| | | A5LightErrorCodeReportInnerFrame codeRespInnerFrame = new A5LightErrorCodeReportInnerFrame().transformFrame(frame.getPayload()); |
| | | // log.info(codeRespInnerFrame.toString()); |
| | | if (codeRespInnerFrame.getErrorCode() != 0) { |
| | | SpringContextHolder.getBean(LightReportErrorService.class).saveReportError(deviceName, codeRespInnerFrame); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.sandu.ximon.admin.manager.iot.frame.inner.report; |
| | | |
| | | import cn.hutool.core.util.HexUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.BaseResponseInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.util.CRC32Utils; |
| | |
| | | /** |
| | | * æ
éç |
| | | */ |
| | | private String errorCode; |
| | | private int errorCode; |
| | | |
| | | @Override |
| | | public A5LightErrorCodeReportInnerFrame transformFrame(String hex) { |
| | |
| | | |
| | | setDestinationAddress(hex.substring(8, 12)); |
| | | |
| | | setErrorCode(hex.substring(12, 16)); |
| | | String errorCodeHex = hex.substring(12, 16); |
| | | errorCode = HexUtil.hexToInt(errorCodeHex); |
| | | System.out.println("æ
éç ï¼"+ errorCodeHex +" - " + errorCode); |
| | | |
| | | setCrc32(hex.substring(hex.length() - 8)); |
| | | // æ ¡éªCRC32 |
| | | String frame = getFunctionCode() + getPayloadLength() + getDestinationAddress() + getErrorCode(); |
| | |
| | | private Integer sec; |
| | | // è®¾å¤æ¸©åº¦ 2 1åèæ´æ°1åèå°æ° |
| | | private Double deviceTemperature; |
| | | // 亮度ç¾åæ¯ 1 |
| | | // ç¯1亮度ç¾åæ¯ 1 |
| | | private Integer lightPercent; |
| | | // çµç½çµå 2 1åèæ´æ°1åèå°æ° |
| | | private Double voltage; |
| | |
| | | private Double recentlyUsingPower; |
| | | // 累计ç¨çµçµé 4 |
| | | private Double totalUsingPower; |
| | | // ç¯2亮度ç¾åæ¯ 1 |
| | | private Integer light2Percent; |
| | | // ä¿ç 11 |
| | | private String retain; |
| | | // å帧 |
| | |
| | | this.totalLightSec = HexUtil.hexToLong(hex.substring(50, 58)); |
| | | this.recentlyUsingPower = NumberUtil.round(HexUtil.hexToInt(hex.substring(58, 66)) * (double) 0.001, 3).doubleValue(); |
| | | this.totalUsingPower = NumberUtil.round(HexUtil.hexToInt(hex.substring(66, 74)) * (double) 0.001, 3).doubleValue(); |
| | | this.retain = hex.substring(74, 96); |
| | | this.light2Percent = HexUtil.hexToInt(hex.substring(74, 76)); |
| | | this.retain = hex.substring(76, 96); |
| | | return this; |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(HexUtil.hexToLong("F64D020F")); |
| | | System.out.println(5 * (float) 0.001); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.manager.iot.rrpc.enums; |
| | | |
| | | import com.sandu.common.enums.ResponseStatusEnums; |
| | | |
| | | /** |
| | | * @author chenjiantian |
| | | * é¿éäºè®¾å¤ç¶ææä¸¾ |
| | | */ |
| | | public enum DeviceStateEnum { |
| | | |
| | | /* |
| | | ON_LINE 设å¤å¨çº¿ã |
| | | OFFLINE 设å¤ç¦»çº¿ |
| | | UNACTIVE è®¾å¤æªæ¿æ´» |
| | | DISABLE 设å¤å·²ç¦ç¨ |
| | | */ |
| | | |
| | | OFFLINE(0), |
| | | ONLINE(1), |
| | | UNACTIVE(2), |
| | | DISABLE(3); |
| | | |
| | | |
| | | DeviceStateEnum(Integer code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | private final Integer code; |
| | | |
| | | public Integer getCode() { |
| | | return code; |
| | | } |
| | | |
| | | |
| | | public static Integer getCode(String name) { |
| | | for (DeviceStateEnum ut : DeviceStateEnum.values()) { |
| | | if (ut.name().equals(name)) { |
| | | return ut.getCode(); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.manager.iot.rrpc.enums; |
| | | |
| | | /** |
| | | * @author chenjiantian |
| | | * åç¯éè¯¯ä¸æ¥ç |
| | | * "æ
éç ï¼ï¼ç¨äºè¿å¶è¡¨ç¤ºï¼ |
| | | * 0x0000,äºè¿å¶å³ä¸º[bit15:bit0]ã |
| | | * å¯¹åºæ
ébitä½ç½®1ï¼æ£å¸¸ç½®0" bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8 bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 |
| | | * 0 0 0 0 0 0 0 0 æ¥åæ¶é´é误 å¸çµçµåè¿ä½(110V) å¸çµçµåè¿é«(250V) è¾åºæ¼çµ åçè¿è½½ è®¾å¤æ¸©åº¦è¿é« æ çµæµ æ çµå |
| | | */ |
| | | public enum LightErrorEnum { |
| | | |
| | | /** |
| | | * æ çµå |
| | | */ |
| | | NO_VOL(1,"æ çµå"), |
| | | /** |
| | | * æ çµæµ |
| | | */ |
| | | NO_CUR(2,"æ çµæµ"), |
| | | /** |
| | | * è®¾å¤æ¸©åº¦è¿é« |
| | | */ |
| | | DEVICE_TEMPERATURE_HIGHER(4,"è®¾å¤æ¸©åº¦è¿é«"), |
| | | /** |
| | | * åçè¿è½½ |
| | | */ |
| | | OVER_POWER(8,"åçè¿è½½"), |
| | | /** |
| | | * è¾åºæ¼çµ |
| | | */ |
| | | OUTPUT_ELE_LEAKAGE(16,"è¾åºæ¼çµ"), |
| | | /** |
| | | * å¸çµçµåè¿é«(250V) |
| | | */ |
| | | OVER_VOL(32,"å¸çµçµåè¿é«(250V)"), |
| | | /** |
| | | * å¸çµçµåè¿ä½(110V) |
| | | */ |
| | | LOWER_VOL(64,"å¸çµçµåè¿ä½(110V)"), |
| | | /** |
| | | * æ¥åæ¶é´é误 |
| | | */ |
| | | CALENDAR_ERROR(128,"æ¥åæ¶é´é误"); |
| | | |
| | | private final Integer code; |
| | | private final String message; |
| | | |
| | | LightErrorEnum(Integer code, String message) { |
| | | this.code = code; |
| | | this.message = message; |
| | | } |
| | | |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public Integer getCode() { |
| | | return code; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.param; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author chenjiantian |
| | | */ |
| | | @Data |
| | | public class LightRemarkParam { |
| | | |
| | | @NotNull(message = "è·¯ç¯idä¸è½ä¸ºç©º") |
| | | private Long lightId; |
| | | @NotEmpty(message = "夿³¨ä¸è½ä¸ºç©º") |
| | | private String remark; |
| | | |
| | | |
| | | } |
| | |
| | | @Data |
| | | public class PoleBindingParam { |
| | | |
| | | @NotBlank(message = "设å¤Macä¸è½ä¸ºç©º") |
| | | private String deviceMac; |
| | | @NotBlank(message = "设å¤ç ä¸è½ä¸ºç©º") |
| | | private String deviceCode; |
| | | @NotNull(message = "设å¤ç±»åä¸è½ä¸ºç©º") |
| | | private Integer deviceType; |
| | | |
| | |
| | | /** |
| | | * åç¯ä¸æ¥çmacï¼å¦ææè¯´æè¯¥ä¸æ¥çåç¯ä»¥åå·²ç»ä¸æ¥è¿ |
| | | */ |
| | | public static LightKey REPORT_MAC = new LightKey(0, "ReportMac"); |
| | | public static LightKey REPORT_MAC = new LightKey(3600, "ReportMac"); |
| | | |
| | | /** |
| | | * ç¯æç¼å·åç¼æ¯å¤©ä»1å¼å§éå¢ï¼å®æ¶ä»»å¡0ç¹éç½® |
| | | */ |
| | | public static LightKey POLE_SN = new LightKey(300, "PoleSn"); |
| | | |
| | | } |
| | |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.admin.dto.LightDataDto; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5LightHeartbeatReportInnerFrame; |
| | | import com.sandu.ximon.dao.bo.LightBo; |
| | | import com.sandu.ximon.dao.bo.LightReportDataBo; |
| | | import com.sandu.ximon.dao.domain.LightReportData; |
| | | import com.sandu.ximon.dao.mapper.LightReportDataMapper; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | @Service |
| | | public class LightReportDataService extends BaseServiceImpl<LightReportDataMapper, LightReportData> { |
| | | |
| | | |
| | | /** |
| | | * ä¿å䏿¥çç¯å¿è·³æ°æ® |
| | | * |
| | | * @return æ¯å¦æå |
| | | */ |
| | | public boolean saveReportData(String deviceName, A5LightHeartbeatReportInnerFrame.HeartBeatDataPackage heartBeatDataPackage) { |
| | | |
| | | LightReportData lightReportData = new LightReportData(); |
| | | BeanUtils.copyProperties(heartBeatDataPackage, lightReportData); |
| | | lightReportData.setDeviceMac(deviceName); |
| | | lightReportData.setDeviceCode(deviceName); |
| | | |
| | | return save(lightReportData); |
| | | } |
| | | |
| | | /** |
| | | * è·åè·¯ç¯å表 |
| | | * @return è¿åç»åæ°æ®dto |
| | | * è·åæå®è®¾å¤ç ææ°çä¸å¤©ä¸æ¥æ°æ® |
| | | * @param deviceCodeList 设å¤ç å表 |
| | | * @return 䏿¥æ°æ® |
| | | */ |
| | | public List<LightDataDto> listLight(int pageNo, int pageSize, String keyword) { |
| | | PageHelper.startPage(pageNo,pageSize); |
| | | public List<LightReportData> getNewestReportByDeviceCode(List<String> deviceCodeList) { |
| | | return baseMapper.getNewestReportByDeviceCode(deviceCodeList); |
| | | } |
| | | |
| | | return null; |
| | | /** |
| | | * è·å䏿¥æ°æ® |
| | | * @param keyword å
³é®è¯ |
| | | * @param deviceCode 设å¤ç |
| | | */ |
| | | public List<LightReportDataBo> listReportData(int pageNo, int pageSize, String keyword, String deviceCode) { |
| | | PageHelper.startPage(pageNo,pageSize); |
| | | return baseMapper.listReportData(keyword,deviceCode); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5LightErrorCodeReportInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.LightErrorEnum; |
| | | import com.sandu.ximon.dao.bo.LightReportErrorBo; |
| | | import com.sandu.ximon.dao.domain.LightReportError; |
| | | import com.sandu.ximon.dao.mapper.LightReportErrorMapper; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author chenjiantian |
| | | * @date 2021/12/17 17:47 |
| | | */ |
| | | @Service |
| | | public class LightReportErrorService extends BaseServiceImpl<LightReportErrorMapper, LightReportError> { |
| | | |
| | | public void saveReportError(String deviceName, A5LightErrorCodeReportInnerFrame codeRespInnerFrame) { |
| | | LightReportError lightReportError = new LightReportError(); |
| | | lightReportError.setDeviceCode(deviceName); |
| | | lightReportError.setErrorCode(codeRespInnerFrame.getErrorCode()); |
| | | save(lightReportError); |
| | | } |
| | | |
| | | public List<LightReportErrorBo> listReportError(int pageNo, int pageSize, String keyword) { |
| | | PageHelper.startPage(pageNo,pageSize); |
| | | List<LightReportErrorBo> lightReportErrorBos = baseMapper.listReportError(keyword); |
| | | for (LightReportErrorBo lightReportErrorBo : lightReportErrorBos) { |
| | | Integer errorCode = lightReportErrorBo.getErrorCode(); |
| | | StringBuilder sb = new StringBuilder(); |
| | | LightErrorEnum[] values = LightErrorEnum.values(); |
| | | for (LightErrorEnum value : values) { |
| | | if((value.getCode() & errorCode) > 0){ |
| | | sb.append(value.getMessage()); |
| | | } |
| | | } |
| | | lightReportErrorBo.setErrorMsg(sb.toString()); |
| | | } |
| | | return lightReportErrorBos; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.redis.RedisService; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.admin.dto.LightDataDto; |
| | | import com.sandu.ximon.admin.param.LightRemarkParam; |
| | | import com.sandu.ximon.admin.redis.LightKey; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.dao.bo.LightBo; |
| | | import com.sandu.ximon.dao.domain.Light; |
| | | import com.sandu.ximon.dao.domain.LightReportData; |
| | | import com.sandu.ximon.dao.mapper.LightMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author chenjiantian |
| | | * @date 2021/12/13 16:00 |
| | | * ç¯è®¾å¤service |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | @AllArgsConstructor |
| | | public class LightService extends BaseServiceImpl<LightMapper, Light> { |
| | | |
| | | private final RedisService redisService; |
| | | private final LightReportDataService lightReportDataService; |
| | | |
| | | /** |
| | | * å½å
¥å½å设å¤ç çè·¯ç¯æ°æ® |
| | | * @param deviceName mac |
| | | */ |
| | | public void saveLight(String deviceName) { |
| | | Boolean hasKey = redisService.hasKey(LightKey.REPORT_MAC.key(deviceName)); |
| | | if(!hasKey){ |
| | | int count = count(Wrappers.lambdaQuery(Light.class).eq(Light::getDeviceCode, deviceName)); |
| | | log.info("redisæ¥ä¸å°è·¯ç¯æ°æ®{}={}",count,deviceName); |
| | | // å½åè·¯ç¯è¡¨æ²¡æå½å
¥è®¾å¤å |
| | | if(count == 0){ |
| | | Light light = new Light(); |
| | | light.setDeviceCode(deviceName); |
| | | save(light); |
| | | } |
| | | redisService.set(LightKey.REPORT_MAC.key(deviceName),1,LightKey.REPORT_MAC.expireSeconds()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åè·¯ç¯å表 |
| | | * |
| | | * @return è¿åç»åæ°æ®dto |
| | | */ |
| | | public List<LightBo> listLight(int pageNo, int pageSize, String keyword) { |
| | | Long clientId = SecurityUtils.getClientId(); |
| | | |
| | | PageHelper.startPage(pageNo, pageSize); |
| | | |
| | | List<LightBo> listLight = baseMapper.listLight(clientId,keyword); |
| | | |
| | | // è·åæè¿ç䏿¥æ¶é´ |
| | | List<String> deviceCodeList = listLight.stream().map(Light::getDeviceCode).collect(Collectors.toList()); |
| | | if(CollectionUtil.isNotEmpty(deviceCodeList)){ |
| | | List<LightReportData> reportDataList = lightReportDataService.getNewestReportByDeviceCode(deviceCodeList); |
| | | for (LightBo lightBo : listLight) { |
| | | for (LightReportData lightReportData : reportDataList) { |
| | | if(StrUtil.equals(lightBo.getDeviceCode(),lightReportData.getDeviceCode())){ |
| | | lightBo.setReportTime(lightReportData.getCreateTime()); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return listLight; |
| | | } |
| | | |
| | | public boolean addRemark(LightRemarkParam param) { |
| | | Light light = getById(param.getLightId()); |
| | | if(light == null){ |
| | | throw new BusinessException("æ¾ä¸å°è·¯ç¯"); |
| | | } |
| | | Light update = new Light(); |
| | | update.setLightId(param.getLightId()); |
| | | update.setRemark(param.getRemark()); |
| | | return updateById(update); |
| | | } |
| | | } |
| | |
| | | |
| | | public boolean bindPole(Long poleId, PoleBindingParam param) { |
| | | Integer deviceType = param.getDeviceType(); |
| | | if (PoleBindingEnums.LIGHT.getCode().equals(deviceType)) { |
| | | PoleBinding poleBinding = new PoleBinding(); |
| | | poleBinding.setPoleId(poleId); |
| | | poleBinding.setDeviceType(deviceType); |
| | | poleBinding.setDeviceName(param.getDeviceName()); |
| | | poleBinding.setDeviceMac(param.getDeviceMac()); |
| | | return save(poleBinding); |
| | | } |
| | | // if (PoleBindingEnums.LIGHT.getCode().equals(deviceType)) { |
| | | // } |
| | | PoleBinding poleBinding = new PoleBinding(); |
| | | poleBinding.setPoleId(poleId); |
| | | poleBinding.setDeviceType(deviceType); |
| | | poleBinding.setDeviceName(param.getDeviceName()); |
| | | poleBinding.setDeviceCode(param.getDeviceCode()); |
| | | return save(poleBinding); |
| | | |
| | | return false; |
| | | // return false; |
| | | } |
| | | } |
| | |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.redis.RedisService; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.admin.dto.DeviceStatus; |
| | | import com.sandu.ximon.admin.manager.iot.frame.A1Frame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.FrameBuilder; |
| | | import com.sandu.ximon.admin.manager.iot.frame.IRequestFrame; |
| | |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.A1OrderEnum; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.A2OrderEnum; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.A5OrderEnum; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.DeviceStateEnum; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.mainboard.MainBoardInvokeSyncService; |
| | | import com.sandu.ximon.admin.param.PoleBindingParam; |
| | | import com.sandu.ximon.admin.param.PoleParam; |
| | |
| | | return list(Wrappers.lambdaQuery(Pole.class).in(Pole::getId, poleIdList).select(Pole::getDeviceCode)) |
| | | .stream().map(Pole::getDeviceCode).filter(StrUtil::isNotEmpty).collect(Collectors.toList()); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éè·åé¿éäºè®¾å¤çç¶æ |
| | | * @param deviceCodeList é¿éäºè®¾å¤ç |
| | | * @return 设å¤ç¶æå表 |
| | | */ |
| | | public List<DeviceStatus> listStatusByDeviceCode(ArrayList<String> deviceCodeList) { |
| | | // æå¤§åªè½æ¥50个 |
| | | List<List<String>> split = CollectionUtil.split(deviceCodeList, 50); |
| | | List<DeviceStatus> statusList = new ArrayList<>(); |
| | | for (List<String> list : split) { |
| | | List<BatchGetDeviceStateResponse.DeviceStatus> deviceStatuses = MainBoardInvokeSyncService.getInstance().batchGetDeviceState(list); |
| | | if(CollectionUtil.isNotEmpty(deviceStatuses)){ |
| | | for (BatchGetDeviceStateResponse.DeviceStatus d : deviceStatuses) { |
| | | DeviceStatus deviceStatus = new DeviceStatus(); |
| | | deviceStatus.setDeviceCode(d.getDeviceName()); |
| | | deviceStatus.setStatus(DeviceStateEnum.getCode(d.getStatus())); |
| | | statusList.add(deviceStatus); |
| | | } |
| | | } |
| | | } |
| | | return statusList; |
| | | } |
| | | } |