Merge remote-tracking branch 'origin/master'
# Conflicts:
# ximon-admin/src/main/java/com/sandu/ximon/admin/service/C3ChargingService.java
| | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * åªå£° |
| | | */ |
| | | private BigDecimal noise; |
| | | private String noise; |
| | | |
| | | /** |
| | | * ç¡«åæ°¢ |
| | | */ |
| | | private BigDecimal hydrogenSulfide; |
| | | private String hydrogenSulfide; |
| | | |
| | | /** |
| | | * SO2 æµåº¦ |
| | | */ |
| | | private BigDecimal so2; |
| | | private String so2; |
| | | |
| | | /** |
| | | * NO2 æµåº¦ |
| | | */ |
| | | private BigDecimal no2; |
| | | private String no2; |
| | | |
| | | /** |
| | | * CO æµåº¦ |
| | | */ |
| | | private BigDecimal co; |
| | | private String co; |
| | | |
| | | /** |
| | | * o3 æµåº¦ |
| | | */ |
| | | private BigDecimal o3; |
| | | private String o3; |
| | | |
| | | /** |
| | | * pm2.5 æµåº¦ |
| | | */ |
| | | private BigDecimal pm2point5; |
| | | private String pm2point5; |
| | | |
| | | /** |
| | | * pm10 |
| | | */ |
| | | private BigDecimal pm10; |
| | | private String pm10; |
| | | |
| | | /** |
| | | * ç©ºæ°æ¸©åº¦ |
| | | */ |
| | | private BigDecimal airTemperature; |
| | | private String airTemperature; |
| | | |
| | | /** |
| | | * ç©ºæ°æ¹¿åº¦ |
| | | */ |
| | | private BigDecimal airHumidity; |
| | | private String airHumidity; |
| | | |
| | | /** |
| | | * 大æ°å强 |
| | | */ |
| | | private BigDecimal airPressure; |
| | | private String airPressure; |
| | | |
| | | /** |
| | | * é£å |
| | | */ |
| | | private BigDecimal windDirection; |
| | | private String windDirection; |
| | | |
| | | /** |
| | | * é£é |
| | | */ |
| | | private BigDecimal windSpeed; |
| | | private String windSpeed; |
| | | |
| | | /** |
| | | * ååéé¨é |
| | | */ |
| | | private BigDecimal tenRainfallMin; |
| | | private String tenRainfallMin; |
| | | |
| | | /** |
| | | * è¾å° |
| | | */ |
| | | private BigDecimal radiation; |
| | | private String radiation; |
| | | |
| | | /** |
| | | * å
ç
§ |
| | | */ |
| | | private BigDecimal illumination; |
| | | private String illumination; |
| | | |
| | | /** |
| | | * ç´«å¤çº¿ |
| | | */ |
| | | private String ultraviolet; |
| | | |
| | | /** |
| | | * co2 äºæ°§å碳 |
| | | */ |
| | | private String co2; |
| | | |
| | | /** |
| | | * æ°§æ° |
| | | */ |
| | | private String o2; |
| | | |
| | | /** |
| | | * 设å¤ç±»å |
| | | */ |
| | | private String type; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | |
| | | package com.sandu.ximon.dao.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * |
| | | * @TableName air_equipment_nong_geng |
| | | */ |
| | | @TableName(value = "air_equipment_nong_geng") |
| | | @TableName(value ="air_equipment_nong_geng") |
| | | @Data |
| | | public class AirEquipmentNongGeng implements Serializable { |
| | | /** |
| | | * |
| | | * |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | |
| | | private String mac; |
| | | |
| | | /** |
| | | * 设å¤ç±»å 0常è§åæ°è±¡ç« 1è¾å°åæ°è±¡ç« 2å¤§æ°æ±¡æç©æ°è±¡ç« |
| | | */ |
| | | private String type; |
| | | |
| | | /** |
| | | * æ¥å
¥æ¶é´ |
| | | */ |
| | | private LocalDateTime createTime; |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * åç¯ä»»å¡è½è/èè½ç表 |
| | | * |
| | | * @TableName light_energy_data |
| | | */ |
| | | @TableName(value = "light_energy_data") |
| | | @TableName(value ="light_energy_data") |
| | | @Data |
| | | public class LightEnergyData implements Serializable { |
| | | /** |
| | | * |
| | | * |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | |
| | | private Long poleId; |
| | | |
| | | /** |
| | | * ç¯å¤´å°å |
| | | */ |
| | | private String lightAdderss; |
| | | |
| | | /** |
| | | * ç¨æ·id |
| | | */ |
| | | private Long userId; |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * ç¯ä¸æ¥æ
éç 表 |
| | | * åç¯æ
éæ°æ®å表 |
| | | * @TableName light_report_error |
| | | */ |
| | | @TableName(value ="light_report_error") |
| | |
| | | private Long lightReportErrorId; |
| | | |
| | | /** |
| | | * 设å¤mac |
| | | * mac |
| | | */ |
| | | private String deviceCode; |
| | | |
| | | /** |
| | | * ç¯å¤´å°å |
| | | */ |
| | | private String lightAddress; |
| | | |
| | | /** |
| | | * æ
éç |
| | |
| | | private Integer errorCode; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | * |
| | | */ |
| | | private LocalDateTime createTime; |
| | | |
| | |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * è·¯ç¯ä»»å¡è¡¨ |
| | |
| | | /** |
| | | * 1æåã0å¯ç¨ |
| | | */ |
| | | @JsonIgnore |
| | | private Integer pause; |
| | | |
| | | /** |
| | | * ææå ï¼ä½è¿ç®ä¿åï¼1代表ææä¸ï¼2ææäºï¼4ææä¸ï¼8ææåï¼16ææäºï¼32ææå
ï¼64æææ¥ |
| | | */ |
| | | @JsonIgnore |
| | | private Integer week; |
| | | |
| | | /** |
| | |
| | | |
| | | @TableField(exist = false) |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | |
| | | @TableField(exist = false) |
| | | private List<Integer> weekList; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.dao.enums; |
| | | |
| | | /** |
| | | * @author LiuHaoNan |
| | | * @date 2022/10/9 |
| | | * 大æ°è®¾å¤åç±»æä¸¾ |
| | | */ |
| | | public class AirNongGengEnums { |
| | | |
| | | /** |
| | | * RY-G/W |
| | | */ |
| | | public static final String RY_GW = "1"; |
| | | |
| | | /** |
| | | * RY-CPM2510 |
| | | */ |
| | | public static final String RY_CPM2510 = "2"; |
| | | |
| | | /** |
| | | * RY-CPM2516 |
| | | */ |
| | | public static final String RY_CPM2516 = "3"; |
| | | |
| | | /** |
| | | * RY-CPM2512 |
| | | */ |
| | | public static final String RY_CPM2512 = "4"; |
| | | |
| | | /** |
| | | * HCD6815 |
| | | */ |
| | | public static final String HCD_6815 = "5"; |
| | | |
| | | /** |
| | | * HCD6816Z |
| | | */ |
| | | public static final String HCD_6816Z_1 = "6"; |
| | | |
| | | /** |
| | | * HCD6817Z |
| | | */ |
| | | public static final String HCD_6817Z = "7"; |
| | | |
| | | /** |
| | | * HCD6816Z |
| | | */ |
| | | public static final String HCD_6816Z_2 = "8"; |
| | | |
| | | /** |
| | | *HCD6817 |
| | | */ |
| | | public static final String HCD_6817 = "9"; |
| | | |
| | | /** |
| | | * HCD6817B |
| | | */ |
| | | public static final String HCD_6817B = "10"; |
| | | |
| | | /** |
| | | * HCD6818A |
| | | */ |
| | | public static final String HCD_6818A = "16"; |
| | | |
| | | /** |
| | | * HCD6818N |
| | | */ |
| | | public static final String HCD_6818N = "18"; |
| | | |
| | | /** |
| | | * HCD6818D |
| | | */ |
| | | public static final String HCD_6818D = "19"; |
| | | |
| | | /** |
| | | * HCD6818B |
| | | */ |
| | | public static final String HCD_6818B = "11"; |
| | | |
| | | /** |
| | | * HCD6818E |
| | | */ |
| | | public static final String HCD_6818E = "12"; |
| | | |
| | | /** |
| | | * HCD6818C |
| | | */ |
| | | public static final String HCD_6818C = "13"; |
| | | |
| | | /** |
| | | * HCD6818 |
| | | */ |
| | | public static final String HCD_6818 = "14"; |
| | | |
| | | /** |
| | | * HCD6820 |
| | | */ |
| | | public static final String HCD_6820 = "15"; |
| | | |
| | | /** |
| | | * HCD6820ï¼é«é
çï¼ |
| | | */ |
| | | public static final String HCD_6820_Pro = "17"; |
| | | |
| | | /** |
| | | * HCD6818Våç½æ ¼å空æ°è´¨éåéå¨ï¼æ·å¤åï¼ |
| | | */ |
| | | public static final String HCD_6818V_Out = "20"; |
| | | |
| | | } |
| | |
| | | GROUP_LIST("åç»å表"), |
| | | LIGHT_TASK_LIST("è·¯ç¯ä»»å¡å表"), |
| | | LIGHT_DATA("åç¯çæ§æ°æ®"), |
| | | LIGHT_SETCALENDAR("åç¯è®¾ç½®æ¥å"), |
| | | LIGHT_ERROR_LIST("åç¯æ
éå表"), |
| | | LED_LIST("LEDå±å表"), |
| | | LED_PROGRAM_LIST("èç®å表"), |
| | |
| | | AIR_QUERYVERSION("æ¥è¯¢è½¯ç¡¬ä»¶çæ¬"), |
| | | AIR_REBOOT("软éå¯"), |
| | | AIR_DATA_UPDATE("æå¨æ´æ°å¤§æ°æ°æ®"), |
| | | AIR_SET_TYPE("设置åè设å¤ç±»å"), |
| | | BANNER_ADD("æ·»å 微信logo"), |
| | | BANNER_UPDATE("ç¼è¾å¾®ä¿¡logo"), |
| | | BANNER_DETAIL("è·å微信logo详æ
"), |
| | |
| | | C3_REFUND("å
çµæ¡©é款"), |
| | | CHARGE_UPDATE("ç¼è¾è´¹ç"), |
| | | ORDER_LIST("订åå表"), |
| | | CHARGE_LIST("è·åè´¹ç") |
| | | |
| | | |
| | | ; |
| | | CHARGE_LIST("è·åè´¹ç"); |
| | | |
| | | |
| | | private final String code; |
| | |
| | | package com.sandu.ximon.dao.mapper; |
| | | |
| | | import com.sandu.ximon.dao.bo.AirDataBo; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.sandu.ximon.dao.bo.AirDataNongGengBo; |
| | | import com.sandu.ximon.dao.domain.AirDataNongGeng; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Administrator |
| | | * @description é对表ãair_data_nong_geng(åè大æ°çæµæ°æ®)ãçæ°æ®åºæä½Mapper |
| | | * @createDate 2022-10-14 15:01:06 |
| | | * @Entity com.sandu.ximon.dao.domain.AirDataNongGeng |
| | | */ |
| | | @Mapper |
| | |
| | | package com.sandu.ximon.dao.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.sandu.ximon.dao.bo.AirEquipmentNongGengBo; |
| | | import com.sandu.ximon.dao.domain.AirEquipmentNongGeng; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Administrator |
| | | * @description é对表ãair_equipment_nong_gengãçæ°æ®åºæä½Mapper |
| | | * @createDate 2022-10-10 09:58:08 |
| | | * @Entity com.sandu.ximon.dao.domain.AirEquipmentNongGeng |
| | | */ |
| | | @Mapper |
| | |
| | | |
| | | boolean saveLed(LedPlayerEntity ledPlayerEntity); |
| | | |
| | | List<LedPlayerEntity> ledPlayerEntityList(String keyword, Long userid); |
| | | /** |
| | | * ç¨äºé¤å表å±ç¤ºä»¥å¤ç(æ°å¢äºåç»æä½ ä¸ºä¸å½±åå
¶ä» æ°å¢ledListByGroupId) |
| | | * @param keyword |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | List<LedPlayerEntity> ledPlayerEntityList(String keyword, Long userId); |
| | | |
| | | /** |
| | | * ç¨äºå表å±ç¤º |
| | | * @param keyword |
| | | * @param userId |
| | | * @param groupId |
| | | * @return |
| | | */ |
| | | List<LedPlayerEntity> ledListByGroupId(String keyword, Long userId,Long groupId); |
| | | |
| | | List<LedPlayerEntity> ledPlayerEntityListOnBinding(String keyword, Long userid); |
| | | |
| | |
| | | /** |
| | | * @author Administrator |
| | | * @description é对表ãlight_energy_data(åç¯ä»»å¡è½è/èè½ç表)ãçæ°æ®åºæä½Mapper |
| | | * @createDate 2022-05-20 14:21:29 |
| | | * @createDate 2022-09-23 11:13:50 |
| | | * @Entity com.sandu.ximon.dao.domain.LightEnergyData |
| | | */ |
| | | @Mapper |
| | |
| | | package com.sandu.ximon.dao.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | 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; |
| | | |
| | | /** |
| | | * @author Administrator |
| | | * @description é对表ãlight_report_error(åç¯æ
éæ°æ®å表)ãçæ°æ®åºæä½Mapper |
| | | * @createDate 2022-09-28 14:58:29 |
| | | * @Entity com.sandu.ximon.dao.domain.LightReportError |
| | | */ |
| | | @Mapper |
| | |
| | | <mapper namespace="com.sandu.ximon.dao.mapper.AirDataNongGengMapper"> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.AirDataNongGeng"> |
| | | <id property="id" column="id" jdbcType="BIGINT"/> |
| | | <result property="mac" column="mac" jdbcType="VARCHAR"/> |
| | | <result property="noise" column="noise" jdbcType="DECIMAL"/> |
| | | <result property="hydrogenSulfide" column="hydrogen_sulfide" jdbcType="DECIMAL"/> |
| | | <result property="so2" column="so2" jdbcType="DECIMAL"/> |
| | | <result property="no2" column="no2" jdbcType="DECIMAL"/> |
| | | <result property="co" column="co" jdbcType="DECIMAL"/> |
| | | <result property="o3" column="o3" jdbcType="DECIMAL"/> |
| | | <result property="pm2point5" column="pm2point5" jdbcType="DECIMAL"/> |
| | | <result property="pm10" column="pm10" jdbcType="DECIMAL"/> |
| | | <result property="airTemperature" column="air_temperature" jdbcType="DECIMAL"/> |
| | | <result property="airHumidity" column="air_humidity" jdbcType="DECIMAL"/> |
| | | <result property="airPressure" column="air_pressure" jdbcType="DECIMAL"/> |
| | | <result property="windDirection" column="wind_direction" jdbcType="DECIMAL"/> |
| | | <result property="windSpeed" column="wind_speed" jdbcType="DECIMAL"/> |
| | | <result property="tenRainfallMin" column="ten_rainfall_min" jdbcType="DECIMAL"/> |
| | | <result property="radiation" column="radiation" jdbcType="DECIMAL"/> |
| | | <result property="illumination" column="illumination" jdbcType="DECIMAL"/> |
| | | <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
| | | <id property="id" column="id" jdbcType="BIGINT"/> |
| | | <result property="mac" column="mac" jdbcType="VARCHAR"/> |
| | | <result property="noise" column="noise" jdbcType="VARCHAR"/> |
| | | <result property="hydrogenSulfide" column="hydrogen_sulfide" jdbcType="VARCHAR"/> |
| | | <result property="so2" column="so2" jdbcType="VARCHAR"/> |
| | | <result property="no2" column="no2" jdbcType="VARCHAR"/> |
| | | <result property="co" column="co" jdbcType="VARCHAR"/> |
| | | <result property="o3" column="o3" jdbcType="VARCHAR"/> |
| | | <result property="pm2point5" column="pm2point5" jdbcType="VARCHAR"/> |
| | | <result property="pm10" column="pm10" jdbcType="VARCHAR"/> |
| | | <result property="airTemperature" column="air_temperature" jdbcType="VARCHAR"/> |
| | | <result property="airHumidity" column="air_humidity" jdbcType="VARCHAR"/> |
| | | <result property="airPressure" column="air_pressure" jdbcType="VARCHAR"/> |
| | | <result property="windDirection" column="wind_direction" jdbcType="VARCHAR"/> |
| | | <result property="windSpeed" column="wind_speed" jdbcType="VARCHAR"/> |
| | | <result property="tenRainfallMin" column="ten_rainfall_min" jdbcType="VARCHAR"/> |
| | | <result property="radiation" column="radiation" jdbcType="VARCHAR"/> |
| | | <result property="illumination" column="illumination" jdbcType="VARCHAR"/> |
| | | <result property="ultraviolet" column="ultraviolet" jdbcType="VARCHAR"/> |
| | | <result property="co2" column="co2" jdbcType="VARCHAR"/> |
| | | <result property="o2" column="o2" jdbcType="VARCHAR"/> |
| | | <result property="type" column="type" jdbcType="VARCHAR"/> |
| | | <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | |
| | | pm10,air_temperature,air_humidity, |
| | | air_pressure,wind_direction,wind_speed, |
| | | ten_rainfall_min,radiation,illumination, |
| | | create_time |
| | | ultraviolet,co2,o2, |
| | | type,create_time |
| | | </sql> |
| | | <select id="listAirId" resultType="java.lang.Long"> |
| | | SELECT |
| | |
| | | <mapper namespace="com.sandu.ximon.dao.mapper.AirEquipmentNongGengMapper"> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.AirEquipmentNongGeng"> |
| | | <id property="id" column="id" jdbcType="BIGINT"/> |
| | | <result property="mac" column="mac" jdbcType="VARCHAR"/> |
| | | <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
| | | <id property="id" column="id" jdbcType="BIGINT"/> |
| | | <result property="mac" column="mac" jdbcType="VARCHAR"/> |
| | | <result property="type" column="type" jdbcType="VARCHAR"/> |
| | | <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | id,mac,create_time |
| | | id,mac,type, |
| | | create_time |
| | | </sql> |
| | | <select id="listAirEquipmentByIds" resultType="com.sandu.ximon.dao.bo.AirEquipmentNongGengBo"> |
| | | SELECT |
| | |
| | | |
| | | <select id="ledPlayerEntityList" resultType="com.sandu.ximon.dao.domain.LedPlayerEntity"> |
| | | SELECT |
| | | t1.*, t2.pole_id, |
| | | t1.*, |
| | | t2.pole_id, |
| | | t3.pole_name |
| | | FROM |
| | | led t1 |
| | |
| | | AND t2.device_type = 1 |
| | | LEFT JOIN pole t3 ON t3.id = t2.pole_id |
| | | <where> |
| | | 1=1 |
| | | <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 test="userId != null"> |
| | | AND (t3.user_id = #{userId} OR t3.client_id = #{userId}) |
| | | </if> |
| | | </where> |
| | | </select> |
| | |
| | | AND (t2.user_id = #{clientId} OR t2.client_id = #{clientId}) |
| | | </if> |
| | | </select> |
| | | <select id="ledListByGroupId" resultType="com.sandu.ximon.dao.domain.LedPlayerEntity"> |
| | | SELECT |
| | | t1.*, |
| | | t2.pole_id, |
| | | t3.pole_name |
| | | 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 |
| | | LEFT JOIN led_nova_group_relation t4 ON t4.nova_id = t1.id |
| | | LEFT JOIN led_nova_group t5 ON t5.group_id = t4.nova_group_id |
| | | <where> |
| | | 1=1 |
| | | <if test="groupId != null"> |
| | | AND t5.group_id=#{groupId} |
| | | </if> |
| | | <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> |
| | | GROUP BY t1.id |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | <mapper namespace="com.sandu.ximon.dao.mapper.LightEnergyDataMapper"> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.LightEnergyData"> |
| | | <id property="id" column="id" jdbcType="BIGINT"/> |
| | | <result property="taskId" column="task_id" jdbcType="BIGINT"/> |
| | | <result property="ytdTime" column="ytd_time" jdbcType="VARCHAR"/> |
| | | <result property="energy" column="energy" jdbcType="DOUBLE"/> |
| | | <result property="energySaving" column="energy_saving" jdbcType="DOUBLE"/> |
| | | <result property="poleId" column="pole_id" jdbcType="BIGINT"/> |
| | | <result property="userId" column="user_id" jdbcType="BIGINT"/> |
| | | <result property="clientId" column="client_id" jdbcType="BIGINT"/> |
| | | <id property="id" column="id" jdbcType="BIGINT"/> |
| | | <result property="taskId" column="task_id" jdbcType="BIGINT"/> |
| | | <result property="ytdTime" column="ytd_time" jdbcType="VARCHAR"/> |
| | | <result property="energy" column="energy" jdbcType="DECIMAL"/> |
| | | <result property="energySaving" column="energy_saving" jdbcType="DECIMAL"/> |
| | | <result property="poleId" column="pole_id" jdbcType="BIGINT"/> |
| | | <result property="lightAdderss" column="light_adderss" jdbcType="VARCHAR"/> |
| | | <result property="userId" column="user_id" jdbcType="BIGINT"/> |
| | | <result property="clientId" column="client_id" jdbcType="BIGINT"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | id |
| | | ,task_id,ytd_time, |
| | | energy,energy_saving,user_id, |
| | | client_id |
| | | id,task_id,ytd_time, |
| | | energy,energy_saving,pole_id, |
| | | light_adderss,user_id,client_id |
| | | </sql> |
| | | <select id="getEnergyList" resultType="com.sandu.ximon.dao.domain.LightEnergyData"> |
| | | SELECT |
| | |
| | | <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="lightAddress" column="light_address" 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"/> |
| | |
| | | AND t2.device_type = 0 |
| | | LEFT JOIN pole t3 ON t3.id = t2.pole_id |
| | | <where> |
| | | t1.error_code != 0 |
| | | <if test="keyword != null and keyword != ''"> |
| | | AND ( |
| | | t3.id LIKE CONCAT('%', #{keyword},'%') |
| | |
| | | <select id="listError" resultType="com.sandu.ximon.dao.bo.LightReportErrorBo" |
| | | parameterType="java.lang.Long"> |
| | | SELECT |
| | | t1.* |
| | | t1.* |
| | | FROM |
| | | light_report_error t1 |
| | | LEFT JOIN pole t3 ON t1.device_code = t3.device_code |
| | | light_report_error t1 |
| | | LEFT JOIN pole t3 ON t1.device_code = t3.device_code |
| | | WHERE |
| | | <if test="userid != null"> |
| | | t3.client_id = #{userId} OR t3.user_id = #{userId} |
| | | </if> |
| | | t1.light_report_error_id IN ( SELECT t.max_id FROM ( SELECT Max( light_report_error.light_report_error_id ) AS max_id FROM light_report_error GROUP BY light_report_error.device_code ) AS t ) |
| | | <if test="userid != null"> |
| | | t3.client_id = #{userId} OR t3.user_id = #{userId} |
| | | </if> |
| | | t1.light_report_error_id IN ( SELECT t.max_id FROM ( SELECT Max( light_report_error.light_report_error_id ) AS |
| | | max_id FROM light_report_error GROUP BY light_report_error.device_code ) AS t ) |
| | | ORDER BY |
| | | t1.create_time DESC |
| | | t1.create_time DESC |
| | | </select> |
| | | </mapper> |
| | |
| | | package com.sandu.ximon.admin.config; |
| | | |
| | | /** |
| | | * 鳿±api |
| | | * 鳿±apiå°å |
| | | */ |
| | | public enum BroadcastAPI { |
| | | |
| | |
| | | ADD_REGION("/add_region"), |
| | | GET_REGION_LIST("/get_region_list"); |
| | | |
| | | ; |
| | | |
| | | private static final String SERVER = "http://47.106.172.9:8000"; |
| | | |
| | | BroadcastAPI(String url){ |
| | | // private String service; |
| | | // |
| | | // private static String SERVER = "http://47.106.172.9:8000"; |
| | | BroadcastAPI(String url) { |
| | | this.url = url; |
| | | } |
| | | |
| | | private String url; |
| | | |
| | | public String getUrl() { |
| | | return SERVER + url; |
| | | return BroadcastIP.getServerIP() + url; |
| | | } |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.config; |
| | | |
| | | import org.springframework.beans.factory.InitializingBean; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * @author LiuHaoNan |
| | | * @date 2022/9/26 |
| | | */ |
| | | @Component |
| | | public class BroadcastIP implements InitializingBean { |
| | | |
| | | |
| | | private static String SERVER; |
| | | |
| | | @Value("${broadcastApi.serviceUrl}") |
| | | private String server; |
| | | |
| | | @Override |
| | | public void afterPropertiesSet() throws Exception { |
| | | SERVER = server; |
| | | } |
| | | |
| | | public static String getServerIP() { |
| | | return SERVER; |
| | | } |
| | | } |
| | |
| | | private String screenShotNotifyUrl; |
| | | @Value("${nova-conf.status-notify-url}") |
| | | private String statusNotifyUrl; |
| | | @Value("${nova-conf.username}") |
| | | private String userName; |
| | | @Value("${nova-conf.password}") |
| | | private String passWord; |
| | | |
| | | |
| | | public static String NOTIFY_URL; |
| | | public static String SCREEN_SHOT_NOTIFY_URL; |
| | | public static String STATUS_NOTIFY_URL; |
| | | public static String STATUS_NOTIFY_URL1; |
| | | |
| | | public static final String username = "zhxm"; |
| | | public static final String password = "xm2512209."; |
| | | public static String username; |
| | | public static String password; |
| | | |
| | | public static final Gson GSON = new Gson(); |
| | | |
| | |
| | | SCREEN_SHOT_NOTIFY_URL = screenShotNotifyUrl; |
| | | |
| | | STATUS_NOTIFY_URL = statusNotifyUrl; |
| | | System.out.println(STATUS_NOTIFY_URL); |
| | | |
| | | username = userName; |
| | | |
| | | password = passWord; |
| | | |
| | | |
| | | } |
| | |
| | | * @date 2022/4/24 17:36 |
| | | */ |
| | | |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.manager.iot.amqp.processor.AirDataProcessor; |
| | | import com.sandu.ximon.admin.manager.iot.frame.A5Frame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.request.AtmosphereNewReqInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.dto.CommonFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.A5OrderEnum; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.mainboard.MainBoardInvokeSyncService; |
| | | import com.sandu.ximon.admin.security.PermissionConfig; |
| | | import com.sandu.ximon.admin.service.AirDataNongGengService; |
| | | import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils; |
| | | import com.sandu.ximon.dao.bo.AirDataNongGengBo; |
| | | import com.sandu.ximon.dao.enums.MenuEnum; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * å¤§æ°æ°æ® |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @Slf4j |
| | | @RequestMapping("/v1/admin/airdata_nonggeng") |
| | | public class AirDataNongGengController { |
| | | private PermissionConfig permissionConfig; |
| | | private final AirDataNongGengService airDataNongGengService; |
| | | |
| | | @PostMapping("/updateAirEquipmentInfo") |
| | | public ResponseVO<Object> updataAirEquipmentInfo(@RequestBody List<String> listMac) { |
| | | AtmosphereNewReqInnerFrame atmosphereNewReqInnerFrame = new AtmosphereNewReqInnerFrame(); |
| | | A5Frame a5Frame = new A5Frame(A5OrderEnum.REQUEST_ATMOSPHERE_DATA.getCode(), atmosphereNewReqInnerFrame); |
| | | System.out.println(a5Frame + " --------a5Frame"); |
| | | |
| | | List<String> success = new ArrayList<>(); |
| | | List<String> failed = new ArrayList<>(); |
| | | listMac.parallelStream().forEach(macStr -> { |
| | | try { |
| | | |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(macStr, a5Frame); |
| | | StoreOperationRecordsUtils.storeInnerFrameData(macStr, "大æ°è®¾å¤-å¿è·³å
", a5Frame, commonFrame); |
| | | System.out.println(commonFrame + " -----------commonFrame"); |
| | | AirDataProcessor.getInstance().process("a1JsfPG4iKW", macStr, commonFrame); |
| | | if (commonFrame != null) { |
| | | success.add(macStr); |
| | | } else { |
| | | failed.add(macStr); |
| | | } |
| | | } catch (Exception e) { |
| | | failed.add(macStr); |
| | | } |
| | | }); |
| | | |
| | | Map<String, List> resultMap = new HashMap<>(); |
| | | resultMap.put("success", success); |
| | | resultMap.put("failed", failed); |
| | | return ResponseUtil.success(resultMap); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å¤§æ°æ°æ®æ¨¡ç³æ¥è¯¢ |
| | |
| | | * @param keyword å
³é®å |
| | | * @return |
| | | */ |
| | | @GetMapping("/listAirData") |
| | | public ResponseVO<Object> listAirDataByKeyword(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) { |
| | | if (!permissionConfig.check(MenuEnum.AIR_DATA__NONG_GENG_LIST.getCode())) { |
| | | return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | } |
| | | List<AirDataNongGengBo> list = airDataNongGengService.listAirDataByKeyword(baseConditionVO, keyword); |
| | | return ResponseUtil.successPage(list); |
| | | } |
| | | // @GetMapping("/listAirData") |
| | | // public ResponseVO<Object> listAirDataByKeyword(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) { |
| | | // if (!permissionConfig.check(MenuEnum.AIR_DATA__NONG_GENG_LIST.getCode())) { |
| | | // return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | // } |
| | | // List<AirDataNongGengBo> list = airDataNongGengService.listAirDataByKeyword(baseConditionVO, keyword); |
| | | // return ResponseUtil.successPage(list); |
| | | // } |
| | | } |
| | |
| | | import com.sandu.ximon.admin.security.PermissionConfig; |
| | | import com.sandu.ximon.admin.service.AirEquipmentNongGengService; |
| | | import com.sandu.ximon.dao.bo.AirEquipmentNongGengBo; |
| | | import com.sandu.ximon.dao.domain.AirEquipmentNongGeng; |
| | | import com.sandu.ximon.dao.enums.MenuEnum; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | public ResponseVO<Object> getAirEquipment(@PathVariable String mac) { |
| | | return ResponseUtil.success(airEquipmentNongGengService.getAirEquipment(mac)); |
| | | } |
| | | |
| | | /** |
| | | * 设置å¿è·³å
é´éæ¶é´ |
| | | * |
| | | * @param mac |
| | | * @param time |
| | | * @return |
| | | */ |
| | | @GetMapping("/setHeartBeatTime") |
| | | public ResponseVO<Object> setHeartBeatTime(@RequestParam(value = "mac", required = false) String mac, |
| | | @RequestParam(value = "time", required = false) Integer time) { |
| | | if (!permissionConfig.check(MenuEnum.AIR_HEARTBEATTIME.getCode())) { |
| | | return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | } |
| | | return ResponseUtil.success(airEquipmentNongGengService.setHeartBeatTime(mac, time)); |
| | | } |
| | | |
| | | /** |
| | | * 设置大æ°è®¾å¤åè设å¤ç±»å |
| | | * |
| | | * @return |
| | | */ |
| | | @PostMapping("/setType") |
| | | public ResponseVO<Object> setAirEquipmentType(@RequestBody AirEquipmentNongGeng param) { |
| | | //åæ°ä½¿ç¨æä¸¾ä¼ å¼ |
| | | if (!permissionConfig.check(MenuEnum.AIR_SET_TYPE.getCode())) { |
| | | return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | } |
| | | return ResponseUtil.success(airEquipmentNongGengService.setAirEquipmentType(param)); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.sandu.common.security.annotation.AnonymousAccess; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.service.ErrorMsgService; |
| | | import com.sandu.ximon.admin.utils.RedisUtils; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | private final ErrorMsgService errorMsgService; |
| | | |
| | | @AnonymousAccess |
| | | @GetMapping("/listMsg") |
| | | public ResponseVO<Object> list(BaseConditionVO conditionVO){ |
| | | @GetMapping("/lightListMsg") |
| | | public ResponseVO<Object> lightListMsg(BaseConditionVO conditionVO) { |
| | | return ResponseUtil.success(errorMsgService.lightListMsg(conditionVO)); |
| | | } |
| | | |
| | | return ResponseUtil.success(errorMsgService.listMsg(conditionVO)); |
| | | @AnonymousAccess |
| | | @GetMapping("/C3ListMsg") |
| | | public ResponseVO<Object> C3ListMsg(BaseConditionVO conditionVO) { |
| | | return ResponseUtil.success(errorMsgService.C3ListMsg(conditionVO)); |
| | | } |
| | | |
| | | @AnonymousAccess |
| | | @GetMapping("/atmosphereListMsg") |
| | | public ResponseVO<Object> atmosphereListMsg(BaseConditionVO conditionVO) { |
| | | |
| | | return ResponseUtil.success(errorMsgService.atmosphereListMsg(conditionVO)); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.security.annotation.AnonymousAccess; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.param.BroadcastTerminalV2Param; |
| | | import com.sandu.ximon.admin.param.ReceiveParam; |
| | |
| | | return ResponseUtil.success("ä¿®æ¹é³é失败ï¼"); |
| | | } |
| | | } |
| | | |
| | | @AnonymousAccess |
| | | @PostMapping("/getInfo") |
| | | public ResponseVO<Object> getInfo() { |
| | | return ResponseUtil.success(IpVolumeService.getInfo()); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.sandu.common.domain.CommonPage; |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.security.annotation.AnonymousAccess; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.param.LightControlParam; |
| | | import com.sandu.ximon.admin.param.LightPowerSettingParam; |
| | | import com.sandu.ximon.admin.param.LightRemarkParam; |
| | | import com.sandu.common.util.SpringContextHolder; |
| | | import com.sandu.ximon.admin.param.*; |
| | | import com.sandu.ximon.admin.schedule.LightTimeSynchronizationSchedule; |
| | | import com.sandu.ximon.admin.security.PermissionConfig; |
| | | import com.sandu.ximon.admin.service.LightEnergyDataService; |
| | | import com.sandu.ximon.admin.service.LightReportDataService; |
| | |
| | | |
| | | return ResponseUtil.success(reportDataList); |
| | | } |
| | | |
| | | /** |
| | | * 设置æ¥åï¼åå¿è·³å
ä¸ç6åèæ¥ææ¶é´ï¼ |
| | | */ |
| | | @PostMapping("/SetCalendar") |
| | | public ResponseVO<Object> SetCalendar(@RequestBody @Validated LightSetCalendarParam lightSetCalendarParam) { |
| | | if (!permissionConfig.check(MenuEnum.LIGHT_SETCALENDAR.getCode())) { |
| | | return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | } |
| | | |
| | | return ResponseUtil.success(lightService.SetCalendar(lightSetCalendarParam.getLightId(), lightSetCalendarParam.getAddress())); |
| | | } |
| | | |
| | | @AnonymousAccess |
| | | @GetMapping("/test") |
| | | public ResponseVO<Object> test() { |
| | | SpringContextHolder.getBean(LightTimeSynchronizationSchedule.class).UserSubjectRefund(); |
| | | |
| | | return ResponseUtil.success(null); |
| | | } |
| | | } |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * è·¯ç¯ä»»å¡ç¸å
³æ§å¶ç±» |
| | |
| | | if (!permissionConfig.check(MenuEnum.LIGHT_TASK_DELETE.getCode())) { |
| | | return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | } |
| | | String result = lightTaskService.delLightTask(param.getTaskIdList()); |
| | | String result = lightTaskService.delLightTask(param.getTaskId()); |
| | | return ResponseUtil.success(result); |
| | | |
| | | } |
| | |
| | | * @param |
| | | * @return |
| | | */ |
| | | @PostMapping("/clear") |
| | | public ResponseVO<Object> clearLightTask(@RequestBody List<Long> poleIds) { |
| | | if (!permissionConfig.check(MenuEnum.LIGHT_TASK_UPDATE.getCode())) { |
| | | return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | } |
| | | boolean result = lightTaskService.clearLightTask(poleIds); |
| | | return ResponseUtil.success(result); |
| | | } |
| | | |
| | | // @PostMapping("/clear") |
| | | // public ResponseVO<Object> clearLightTask(@RequestBody List<Long> poleIds) { |
| | | // if (!permissionConfig.check(MenuEnum.LIGHT_TASK_UPDATE.getCode())) { |
| | | // return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | // } |
| | | // boolean result = lightTaskService.clearLightTask(poleIds); |
| | | // return ResponseUtil.success(result); |
| | | // } |
| | | @GetMapping("/{taskId}") |
| | | public ResponseVO<Object> detailLightTask(@PathVariable Long taskId) { |
| | | if (!permissionConfig.check(MenuEnum.LIGHT_TASK_DETAIL.getCode())) { |
| | | return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | } |
| | | Map<Object, Object> objectObjectMap = lightTaskService.detailLightTask(taskId); |
| | | return ResponseUtil.success(objectObjectMap); |
| | | |
| | | return ResponseUtil.success(lightTaskService.detailLightTask(taskId)); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.sandu.ximon.admin.dto.DeviceStatusDto; |
| | | import com.sandu.ximon.admin.param.*; |
| | | import com.sandu.ximon.admin.security.PermissionConfig; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.service.AirEquipmentService; |
| | | import com.sandu.ximon.admin.service.IpVolumeService; |
| | | import com.sandu.ximon.admin.service.MonitorService; |
| | |
| | | /** |
| | | * å¨çº¿æ°é |
| | | */ |
| | | // @AnonymousAccess |
| | | @GetMapping("/online") |
| | | public ResponseVO<Object> online() { |
| | | return ResponseUtil.success(poleService.poleCount()); |
| | |
| | | @AnonymousAccess |
| | | @PostMapping("/isRegisterByCode") |
| | | public ResponseVO<Object> getStatusByCode() { |
| | | /*// if (!permissionConfig.check(MenuEnum.GET_STATE_BY_DEVICECODE.getCode())) { |
| | | // return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | // }*/ |
| | | if (!permissionConfig.check(MenuEnum.GET_STATE_BY_DEVICECODE.getCode())) { |
| | | return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | } |
| | | ArrayList<String> deviceCodeList = new ArrayList<>(); |
| | | deviceCodeList.add("baseDevice01"); |
| | | deviceCodeList.add("baseDevice02"); |
| | |
| | | return ResponseUtil.success(poleService.pushAirDataToXiXun(poleId)); |
| | | } |
| | | |
| | | |
| | | @AnonymousAccess |
| | | @PostMapping("/setRedis") |
| | | public ResponseVO<Object> pushAirDataToXiXun() { |
| | | poleService.setRedis(); |
| | | return ResponseUtil.success("æ´æ°ç¶æå®æ"); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.sandu.ximon.admin.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.dto.RemoteFileDto; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.A5OrderEnum; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.RemoteUpdateTypeEnum; |
| | | import com.sandu.ximon.admin.param.RemotePrarm; |
| | | import com.sandu.ximon.admin.param.RemoteUpdateParam; |
| | | import com.sandu.ximon.admin.security.PermissionConfig; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.service.RemoteUpdateService; |
| | | import com.sandu.ximon.admin.utils.RedisUtils; |
| | | import com.sandu.ximon.admin.vo.RemoteUpgradeProgress; |
| | | import com.sandu.ximon.dao.enums.MenuEnum; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * åºä»¶å级Controller |
| | |
| | | } |
| | | String orderType; |
| | | boolean UpdateFlag = false; |
| | | String deviceType; |
| | | |
| | | switch (remotePrarm.getDeviceType()) { |
| | | case "MQTT串å£": |
| | | case "CAT1": |
| | | orderType = A5OrderEnum.REQUEST_LIGHT_DATA.getCode(); |
| | | break; |
| | | case "大æ°": |
| | | orderType = A5OrderEnum.REQUEST_ATMOSPHERE_DATA.getCode(); |
| | | break; |
| | | case "C3å
çµæ¡©": |
| | | orderType = A5OrderEnum.REQUEST_C3_DATA.getCode(); |
| | | break; |
| | | case "æä½å¾æ": |
| | | orderType = A5OrderEnum.REQUEST_POLE_MONITOR_DATA.getCode(); |
| | | break; |
| | | default: |
| | | throw new BusinessException("å级硬件设å¤ç±»åæä»¤æè¯¯ï¼è¯·ç¡®è®¤ï¼"); |
| | | if(remotePrarm.getDeviceType()==null){ |
| | | throw new BusinessException("å级硬件设å¤ç±»åæä»¤æè¯¯ï¼è¯·ç¡®è®¤ï¼"); |
| | | } |
| | | if (RemoteUpdateTypeEnum.MQTT_MAIN.equals(remotePrarm.getDeviceType())) { |
| | | //MQTTä¸»æ¿ |
| | | orderType = A5OrderEnum.REQUEST_LIGHT_DATA.getCode(); |
| | | deviceType=RemoteUpdateTypeEnum.MQTT_MAIN; |
| | | } else if (RemoteUpdateTypeEnum.MQTT_CORE.equals(remotePrarm.getDeviceType())) { |
| | | //MQTTæ ¸å¿æ¿ |
| | | orderType = A5OrderEnum.REQUEST_LIGHT_DATA.getCode(); |
| | | deviceType=RemoteUpdateTypeEnum.MQTT_CORE; |
| | | } else if (RemoteUpdateTypeEnum.LIGHT.equals(remotePrarm.getDeviceType())) { |
| | | //åç¯æ¨¡å |
| | | orderType = A5OrderEnum.REQUEST_LIGHT_DATA.getCode(); |
| | | deviceType=RemoteUpdateTypeEnum.LIGHT; |
| | | } else if (RemoteUpdateTypeEnum.C3_CHARGING.equals(remotePrarm.getDeviceType())) { |
| | | //C3å
çµæ¡©æ¨¡å |
| | | orderType = A5OrderEnum.REQUEST_C3_DATA.getCode(); |
| | | deviceType=RemoteUpdateTypeEnum.C3_CHARGING; |
| | | } else if (RemoteUpdateTypeEnum.CAT1_MAIN.equals(remotePrarm.getDeviceType())) { |
| | | //Cat.1ä¸»æ¿ |
| | | orderType = A5OrderEnum.REQUEST_LIGHT_DATA.getCode(); |
| | | deviceType=RemoteUpdateTypeEnum.CAT1_MAIN; |
| | | } else if (RemoteUpdateTypeEnum.LIGHT_POLE_HELING.equals(remotePrarm.getDeviceType())) { |
| | | //ç¯æå¾ææ¨¡å |
| | | orderType = A5OrderEnum.REQUEST_POLE_MONITOR_DATA.getCode(); |
| | | deviceType=RemoteUpdateTypeEnum.LIGHT_POLE_HELING; |
| | | } else if (RemoteUpdateTypeEnum.AIR_EQUIPMENT.equals(remotePrarm.getDeviceType())) { |
| | | //大æ°è®¾å¤æ¨¡å |
| | | orderType = A5OrderEnum.REQUEST_ATMOSPHERE_DATA.getCode(); |
| | | deviceType=RemoteUpdateTypeEnum.AIR_EQUIPMENT; |
| | | } else { |
| | | throw new BusinessException("å级硬件设å¤ç±»åæä»¤æè¯¯ï¼è¯·ç¡®è®¤ï¼"); |
| | | } |
| | | |
| | | //å¯å¨è¿ç¨å级å½ä»¤ |
| | | boolean startRemoteUpdateFlag = remoteUpdateService.StartRemoteUpdate(orderType, remotePrarm.getMac(), remotePrarm.getHardwareVersion() |
| | | , remotePrarm.getSoftwareVersion(), remotePrarm.getUpdateFlag()); |
| | | //åå
¥å级è¿åº¦ |
| | | RemoteUpgradeProgress progress = new RemoteUpgradeProgress(); |
| | | RedisUtils.getBean().set(deviceType + ":" + SecurityUtils.getUserId() + remotePrarm.getMac(), JSON.toJSON(progress)); |
| | | |
| | | if (startRemoteUpdateFlag) { |
| | | //æå¡å¨ä¸åå级æä»¶ä¿¡æ¯ |
| | | //"C:\\Users\\Administrator\\Desktop\\test\\MQTT-è¿æ»¤å¤§æ°çæ¬1-09-20220310.bin" |
| | |
| | | |
| | | if (remoteFileDto != null) { |
| | | System.out.println(remoteFileDto.getList().size()); |
| | | progress.setTotalProgress(remoteFileDto.getList().size() + 1); |
| | | for (int i = 0; i < remoteFileDto.getList().size(); i++) { |
| | | //å级å
æ°æ® |
| | | remoteUpdateService.UpdateData(orderType, remotePrarm.getMac(), i, remoteFileDto.getList().get(i)); |
| | | progress.setCurrentProgress(i + 1); |
| | | if (i != remoteFileDto.getList().size()) { |
| | | RedisUtils.getBean().set(deviceType + ":" + SecurityUtils.getUserId() + remotePrarm.getMac(), JSON.toJSON(progress)); |
| | | } |
| | | } |
| | | |
| | | //æå¡å¨ä¸åæ¥è¯¢æ¼å
帧 |
| | | boolean searchLoseDataFlag = remoteUpdateService.SearchLoseData(orderType, remotePrarm.getMac(), remoteFileDto, 0); |
| | | if (searchLoseDataFlag) { |
| | | //æ æ¼å
æ
åµ æ´æ°æåè¿åº¦ä¸º100% å¦åæé«å¡å¨99% |
| | | RedisUtils.getBean().set(deviceType + ":" + SecurityUtils.getUserId() + remotePrarm.getMac(), JSON.toJSON(progress)); |
| | | //æå¡å¨ä¸åç»æå级帧 |
| | | boolean finishUpdateFlag = remoteUpdateService.FinishUpdate(orderType, remotePrarm.getMac()); |
| | | UpdateFlag = finishUpdateFlag; |
| | |
| | | } |
| | | } |
| | | |
| | | RedisUtils.getBean().delete(deviceType + ":" + SecurityUtils.getUserId() + remotePrarm.getMac()); |
| | | if (UpdateFlag) { |
| | | return ResponseUtil.success("å级æåï¼"); |
| | | } else { |
| | |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/getRemoteUpgradeProgress") |
| | | public ResponseVO<Object> getRemoteUpgradeProgress(@RequestBody RemotePrarm remotePrarm) { |
| | | // if (!permissionConfig.check(MenuEnum.REMOTE_UPDATE_START.getCode())) { |
| | | // return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | // } |
| | | String orderType; |
| | | String deviceType; |
| | | |
| | | if(remotePrarm.getDeviceType()==null){ |
| | | throw new BusinessException("å级硬件设å¤ç±»åæä»¤æè¯¯ï¼è¯·ç¡®è®¤ï¼"); |
| | | } |
| | | if (RemoteUpdateTypeEnum.MQTT_MAIN.equals(remotePrarm.getDeviceType())) { |
| | | //MQTTä¸»æ¿ |
| | | orderType = A5OrderEnum.REQUEST_LIGHT_DATA.getCode(); |
| | | deviceType=RemoteUpdateTypeEnum.MQTT_MAIN; |
| | | } else if (RemoteUpdateTypeEnum.MQTT_CORE.equals(remotePrarm.getDeviceType())) { |
| | | //MQTTæ ¸å¿æ¿ |
| | | orderType = A5OrderEnum.REQUEST_LIGHT_DATA.getCode(); |
| | | deviceType=RemoteUpdateTypeEnum.MQTT_CORE; |
| | | } else if (RemoteUpdateTypeEnum.LIGHT.equals(remotePrarm.getDeviceType())) { |
| | | //åç¯æ¨¡å |
| | | orderType = A5OrderEnum.REQUEST_LIGHT_DATA.getCode(); |
| | | deviceType=RemoteUpdateTypeEnum.LIGHT; |
| | | } else if (RemoteUpdateTypeEnum.C3_CHARGING.equals(remotePrarm.getDeviceType())) { |
| | | //C3å
çµæ¡©æ¨¡å |
| | | orderType = A5OrderEnum.REQUEST_C3_DATA.getCode(); |
| | | deviceType=RemoteUpdateTypeEnum.C3_CHARGING; |
| | | } else if (RemoteUpdateTypeEnum.CAT1_MAIN.equals(remotePrarm.getDeviceType())) { |
| | | //Cat.1ä¸»æ¿ |
| | | orderType = A5OrderEnum.REQUEST_LIGHT_DATA.getCode(); |
| | | deviceType=RemoteUpdateTypeEnum.CAT1_MAIN; |
| | | } else if (RemoteUpdateTypeEnum.LIGHT_POLE_HELING.equals(remotePrarm.getDeviceType())) { |
| | | //ç¯æå¾ææ¨¡å |
| | | orderType = A5OrderEnum.REQUEST_POLE_MONITOR_DATA.getCode(); |
| | | deviceType=RemoteUpdateTypeEnum.LIGHT_POLE_HELING; |
| | | } else if (RemoteUpdateTypeEnum.AIR_EQUIPMENT.equals(remotePrarm.getDeviceType())) { |
| | | //大æ°è®¾å¤æ¨¡å |
| | | orderType = A5OrderEnum.REQUEST_ATMOSPHERE_DATA.getCode(); |
| | | deviceType=RemoteUpdateTypeEnum.AIR_EQUIPMENT; |
| | | } else { |
| | | throw new BusinessException("å级硬件设å¤ç±»åæä»¤æè¯¯ï¼è¯·ç¡®è®¤ï¼"); |
| | | } |
| | | |
| | | RemoteUpgradeProgress progress = new RemoteUpgradeProgress(); |
| | | String s = RedisUtils.getBean().get(deviceType + ":" + SecurityUtils.getUserId() + remotePrarm.getMac()); |
| | | if (s != null) { |
| | | RemoteUpgradeProgress temp = JSON.parseObject(s, RemoteUpgradeProgress.class); |
| | | BeanUtils.copyProperties(temp, progress); |
| | | } |
| | | Map map = new HashMap<>(); |
| | | if (progress.getTotalProgress() != 0) { |
| | | //说æå¼å§å级æå åå¨é0è¿åº¦ |
| | | BigDecimal divide = BigDecimal.valueOf(progress.getCurrentProgress()).divide(BigDecimal.valueOf(progress.getTotalProgress()), 2, BigDecimal.ROUND_HALF_UP); |
| | | map.put("progress", divide); |
| | | |
| | | return ResponseUtil.success(map); |
| | | } else { |
| | | map.put("progress", BigDecimal.valueOf(0.0)); |
| | | return ResponseUtil.success(map); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢åºä»¶çæ¬å· |
| | |
| | | |
| | | |
| | | @GetMapping("/list") |
| | | public ResponseVO<Object> list(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword, @RequestParam(value = "order", required = false) Integer order, @RequestParam(value = "seq", required = false) Integer seq) { |
| | | public ResponseVO<Object> list(BaseConditionVO baseConditionVO, |
| | | @RequestParam(value = "keyword", required = false) String keyword, |
| | | @RequestParam(value = "order", required = false) Integer order, |
| | | @RequestParam(value = "seq", required = false) Integer seq, |
| | | @RequestParam(value = "groupId", required = false) Long groupId) { |
| | | if (!permissionConfig.check(MenuEnum.LED_LIST.getCode())) { |
| | | return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | } |
| | | return ResponseUtil.successPage(ledPlayerEntityService.ledPlayerEntityList(baseConditionVO, keyword, order, seq)); |
| | | return ResponseUtil.successPage(ledPlayerEntityService.ledPlayerEntityList(baseConditionVO, keyword, order, seq, groupId)); |
| | | } |
| | | |
| | | @GetMapping("/onLineList") |
| | | public ResponseVO<Object> onLineList(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword, @RequestParam(value = "order", required = false) Integer order, @RequestParam(value = "seq", required = false) Integer seq) { |
| | | public ResponseVO<Object> onLineList(BaseConditionVO baseConditionVO, |
| | | @RequestParam(value = "keyword", required = false) String keyword, |
| | | @RequestParam(value = "order", required = false) Integer order, |
| | | @RequestParam(value = "seq", required = false) Integer seq, |
| | | @RequestParam(value = "groupId", required = false) Long groupId) { |
| | | if (!permissionConfig.check(MenuEnum.LED_LIST.getCode())) { |
| | | return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | } |
| | | List<LedPlayerEntity> list = ledPlayerEntityService.ledPlayerEntityList(baseConditionVO, keyword, order, seq); |
| | | List<LedPlayerEntity> list = ledPlayerEntityService.ledPlayerEntityList(baseConditionVO, keyword, order, seq, groupId); |
| | | List<LedPlayerEntity> entities = vnnoxService.setCacheInfo(vnnoxAPIUtil.syncCurrentInfo(list)); |
| | | List<LedPlayerEntity> online = new ArrayList<>(); |
| | | for (LedPlayerEntity ledPlayer : entities) { |
| | |
| | | /** |
| | | * ç¯å¤´1æ¯å¦æ§è¡ |
| | | */ |
| | | private Boolean light1 = false; |
| | | // private Boolean light1 = false; |
| | | |
| | | /** |
| | | * ç¯å¤´2æ¯å¦æ§è¡ |
| | | */ |
| | | private Boolean light2 = false; |
| | | // private Boolean light2 = false; |
| | | } |
| | |
| | | |
| | | private String fileTypeName; |
| | | |
| | | private String val; |
| | | |
| | | public RemoteUpdateTypeDto(String fileTypeName) { |
| | | this.fileTypeName = fileTypeName; |
| | | } |
| | | } |
| | |
| | | // ç»ç«¯ IP å°å |
| | | private String ip; |
| | | // ç»ç«¯é³é(1-100) |
| | | private Integer volume; |
| | | // ç»ç«¯é³é(1-100) |
| | | private Integer volumn; |
| | | // ç»ç«¯ç»éçé»è®¤é³é |
| | | private Integer defaultVolumn; |
| | |
| | | // å¼å«çç¥ IDï¼è¦ç»ç«¯æå¼å«åè½æ¯æ |
| | | private Integer strategy_id; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | @Override |
| | | public void process(String productKey, String deviceName, CommonFrame frame) { |
| | | /** |
| | | * connectTypeç¨äºå¤æä¸»å¨ä¸æ¥çæ°æ®æ¯å±äºæ§å¤§æ°è®¾å¤è¿æ¯åè大æ°è®¾å¤ |
| | | * åèå¿è·³å
主å¨ä¸æ¥ç³»ç»å°åï¼MQTTè¯·æ±æ¹å¼ï¼ï¼01 åè½ç ï¼03 |
| | | */ |
| | | String connectType = frame.getPayload().substring(0, 2); |
| | | String functionCode = frame.getPayload().substring(2, 4); |
| | | if (A5AtmosphereReportEnum.HeartBeat_Data.getCode().equals(functionCode)) { |
| | | log.info("å¿è·³ç¸åºââå¤§æ°æ°æ®"); |
| | | A5AtmosphereHeartbeatReportInnerFrame heartbeatReportInnerFrame = new A5AtmosphereHeartbeatReportInnerFrame().transformFrame(frame.getPayload()); |
| | | if(heartbeatReportInnerFrame != null){ |
| | | if (heartbeatReportInnerFrame != null) { |
| | | log.info(heartbeatReportInnerFrame.toString()); |
| | | SpringContextHolder.getBean(AirDataService.class).saveReportData(deviceName, heartbeatReportInnerFrame.getHeartBeatDataPackage()); |
| | | } |
| | | } else if (A5AtmosphereReportEnum.HeartBeat_Data_Nong_Geng.getCode().equals(functionCode)) { |
| | | } else if (A5AtmosphereReportEnum.HeartBeat_Data_Nong_Geng.getCode().equals(functionCode) && "01".equals(connectType)) { |
| | | log.info("å¿è·³ç¸åºââå¤§æ°æ°æ®(åè)"); |
| | | A5AtmosphereNewHeartbeatReportInnerFrame heartbeatReportInnerFrame = new A5AtmosphereNewHeartbeatReportInnerFrame().transformFrame(frame.getPayload()); |
| | | if (heartbeatReportInnerFrame != null && heartbeatReportInnerFrame.isValidate()) { |
| | | log.info(heartbeatReportInnerFrame.toString()); |
| | | SpringContextHolder.getBean(AirDataNongGengService.class).saveReportData(deviceName, heartbeatReportInnerFrame.getHeartBeatDataPackage()); |
| | | }else{ |
| | | } else { |
| | | System.out.println("æ°æ®æ ¡éªå¼å¸¸ï¼"); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | } else if (A5LightReportEnum.Time_Synchronized.getCode().equals(functionCode)) { |
| | | // log.info("è¯·æ±æ¶é´åæ¥"); |
| | | log.info("è¯·æ±æ¶é´åæ¥"); |
| | | A5LightTimeSyncReportInnerFrame syncRespInnerFrame = new A5LightTimeSyncReportInnerFrame().transformFrame(frame.getPayload()); |
| | | // log.info(syncRespInnerFrame.toString()); |
| | | log.info(syncRespInnerFrame.toString()); |
| | | if (syncRespInnerFrame.isValidate()) { |
| | | SpringContextHolder.getBean(LightService.class).timeSynchronizationInitiative(deviceName, syncRespInnerFrame.getDestinationAddress()); |
| | | } |
| | | |
| | | } else if (A5LightReportEnum.Error_Code.getCode().equals(functionCode)) { |
| | | log.info("æ
éç 䏿¥"); |
| | | A5LightErrorCodeReportInnerFrame codeRespInnerFrame = new A5LightErrorCodeReportInnerFrame().transformFrame(frame.getPayload()); |
| | | log.info(codeRespInnerFrame.isValidate() + "æ¯å¦éè¿æ ¡éª"); |
| | | log.info(codeRespInnerFrame.getErrorCode() + "æ
éç "); |
| | | if (codeRespInnerFrame.isValidate() && (codeRespInnerFrame.getErrorCode() != 0)) { |
| | | if (codeRespInnerFrame.isValidate()) { |
| | | SpringContextHolder.getBean(LightReportErrorService.class).saveReportError(deviceName, codeRespInnerFrame); |
| | | } |
| | | //0000 表示没ææ
éï¼å鿏
餿
éæä»¤ |
| | | if (codeRespInnerFrame.getErrorCode() == 0) { |
| | | System.out.println("æ¸
餿
éæä½!"); |
| | | SpringContextHolder.getBean(LightReportErrorService.class).cleanErrorCode(deviceName, codeRespInnerFrame.getDestinationAddress()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.IResponseInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.util.CRC16Utils; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.util.CRC32Utils; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.util.CRCUtils; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | */ |
| | | @Data |
| | | public class A5AtmosphereNewHeartbeatReportInnerFrame extends BaseResponseInnerFrame<A5AtmosphereNewHeartbeatReportInnerFrame> { |
| | | //ff03200241000000000000000000000009000a198a186327b8000c000000000000000b8c35c1cad6bf |
| | | //010326FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1B341022277F000D05B5000000015DDD0000FFFF000070C9 主å¨ä¸æ¥å¿è·³å
|
| | | private HeartBeatDataPackage heartBeatDataPackage; |
| | | |
| | | @Override |
| | |
| | | } |
| | | //æ ¡éª |
| | | hex = hex.replaceAll(" ", ""); |
| | | if (hex.length() < 74) { |
| | | if (hex.length() != 86) { |
| | | return null; |
| | | } |
| | | |
| | |
| | | setHeartBeatDataPackage(heartBeatDataPackage); |
| | | |
| | | setCrc16(hex.substring(hex.length() - 4)); |
| | | // æ ¡éªCRC32 |
| | | // æ ¡éªCRC16 |
| | | String frame = hex.substring(0, hex.length() - 4); |
| | | this.setValidate(getCrc16().equals(CRC16Utils.getCRC16(frame))); |
| | | this.setValidate(getCrc16().equals(CRCUtils.getCRC16(frame))); |
| | | return this; |
| | | } |
| | | |
| | |
| | | private BigDecimal radiation; |
| | | //("å
ç
§") |
| | | private BigDecimal illumination; |
| | | //ç´«å¤ææ° |
| | | private BigDecimal ultraviolet; |
| | | //CO2 |
| | | private BigDecimal co2; |
| | | //è´æ°§ç¦»å |
| | | private BigDecimal o2; |
| | | |
| | | @Override |
| | | public HeartBeatDataPackage transformFrame(String hex) { |
| | | //ff 03 20 0241000000000000000000000009000a198a186327b8000c000000000000000b8c35c1ca(åèå¼) |
| | | // 0241 0000 0000 0000 0000 0000 0009 000a 198a 1863 27b8 000c 0000 0000 0000 000b 8c35 c1ca |
| | | // 010326FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1B341022277F000D05B5000000015DDD0000FFFF000070C9 主å¨ä¸æ¥å¿è·³å
|
| | | // 01ï¼ç³»ç»å°å |
| | | // 03ï¼åè½ç |
| | | // 26ï¼æ°æ®æ®µå èæ°é |
| | | // FFFFï¼åªå£°-------ã |
| | | // FFFFï¼ç¡«åæ°¢-------ã |
| | | // FFFFï¼SO2 æµåº¦-------ã |
| | | // FFFFï¼NO2 æµåº¦-------ã |
| | | // FFFFï¼CO æµåº¦-------ã |
| | | // FFFFï¼O3 æµåº¦-------ã |
| | | // FFFFï¼PM2.5 æµåº¦-------ã |
| | | // FFFFï¼PM10 æµåº¦-------ã |
| | | // 1B34ï¼ç©ºæ°æ¸©åº¦-------ã29.64â |
| | | // 1022ï¼ç©ºæ°æ¹¿åº¦-------ã41.30% |
| | | // 277Fï¼å¤§æ°å强-------ã101.11hPa |
| | | // 000Dï¼é£é-------ã0.13m/s |
| | | // 05B5ï¼é£å-------ã146.1° |
| | | // 0000ï¼è¿ç»é¨é-------ã0mm |
| | | // 0001ï¼è¾å°-------ã1W/ã¡ |
| | | // 5DDDï¼å
ç
§-------ã240.29Klux |
| | | // 0000ï¼ç´«å¤ææ°-------ã |
| | | // FFFFï¼CO2-------ã |
| | | // 0000ï¼è´æ°§ç¦»å-------ã |
| | | // 70C9ï¼CRC16 æ ¡éªä½ |
| | | |
| | | //åªå£° |
| | | this.noise = BigDecimal.valueOf(parseVal(hex, 6, 10) / 10.0); |
| | | if (isValidData(hex, 6, 10)) { |
| | | this.noise = new BigDecimal(parseVal(hex, 6, 10)).divide(new BigDecimal(10), 1, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | //ç¡«åæ°¢ |
| | | this.hydrogenSulfide = BigDecimal.valueOf(parseVal(hex, 10, 14) / 1.0); |
| | | if (isValidData(hex, 10, 14)) { |
| | | this.hydrogenSulfide = new BigDecimal(parseVal(hex, 10, 14)); |
| | | } |
| | | //SO2 æµåº¦ |
| | | this.so2 = BigDecimal.valueOf(parseVal(hex, 14, 18) / 1.0); |
| | | if (isValidData(hex, 14, 18)) { |
| | | this.so2 = new BigDecimal(parseVal(hex, 14, 18)); |
| | | } |
| | | //NO2 æµåº¦ |
| | | this.no2 = BigDecimal.valueOf(parseVal(hex, 18, 22) / 1.0); |
| | | if (isValidData(hex, 18, 22)) { |
| | | this.no2 = new BigDecimal(parseVal(hex, 18, 22)); |
| | | } |
| | | //CO æµåº¦ |
| | | this.co = BigDecimal.valueOf(parseVal(hex, 22, 26) / 1.0); |
| | | if (isValidData(hex, 22, 26)) { |
| | | this.co = new BigDecimal(parseVal(hex, 22, 26)); |
| | | } |
| | | //O3 æµåº¦ |
| | | this.o3 = BigDecimal.valueOf(parseVal(hex, 26, 30) / 1.0); |
| | | if (isValidData(hex, 26, 30)) { |
| | | this.o3 = new BigDecimal(parseVal(hex, 26, 30)); |
| | | } |
| | | //PM2.5 æµåº¦ |
| | | this.pm2point5 = BigDecimal.valueOf(parseVal(hex, 30, 34) / 1.0); |
| | | if (isValidData(hex, 30, 34)) { |
| | | this.pm2point5 = new BigDecimal(parseVal(hex, 30, 34)); |
| | | } |
| | | //PM10 æµåº¦ |
| | | this.pm10 = BigDecimal.valueOf(parseVal(hex, 34, 38) / 1.0); |
| | | if (isValidData(hex, 34, 38)) { |
| | | this.pm10 = new BigDecimal(parseVal(hex, 34, 38)); |
| | | } |
| | | //ç©ºæ°æ¸©åº¦ |
| | | this.airTemperature = BigDecimal.valueOf(parseVal(hex, 38, 42) / 100.0 - 40); |
| | | if (isValidData(hex, 38, 42)) { |
| | | this.airTemperature = new BigDecimal(parseVal(hex, 38, 42)).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).subtract(new BigDecimal(40)); |
| | | } |
| | | //ç©ºæ°æ¹¿åº¦ |
| | | this.airHumidity = BigDecimal.valueOf(parseVal(hex, 42, 46) / 100.0); |
| | | if (isValidData(hex, 42, 46)) { |
| | | this.airHumidity = new BigDecimal(parseVal(hex, 42, 46)).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | //大æ°å强 |
| | | this.airPressure = BigDecimal.valueOf(parseVal(hex, 46, 50) / 10.0); |
| | | if (isValidData(hex, 46, 50)) { |
| | | this.airPressure = new BigDecimal(parseVal(hex, 46, 50)).divide(new BigDecimal(10), 1, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | //é£é |
| | | this.windSpeed = BigDecimal.valueOf(parseVal(hex, 50, 54) / 100.0); |
| | | if (isValidData(hex, 50, 54)) { |
| | | this.windSpeed = new BigDecimal(parseVal(hex, 50, 54)).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | //é£å |
| | | this.windDirection = BigDecimal.valueOf(parseVal(hex, 54, 58) / 10.0); |
| | | if (isValidData(hex, 54, 58)) { |
| | | this.windDirection = new BigDecimal(parseVal(hex, 54, 58)).divide(new BigDecimal(10), 1, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | //10 åéé¨é |
| | | this.tenRainfallMin = BigDecimal.valueOf(parseVal(hex, 58, 62) / 10.0); |
| | | if (isValidData(hex, 58, 62)) { |
| | | this.tenRainfallMin = new BigDecimal(parseVal(hex, 58, 62)).divide(new BigDecimal(10), 1, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | //è¾å° |
| | | this.radiation = BigDecimal.valueOf(parseVal(hex, 62, 66) / 1.0); |
| | | if (isValidData(hex, 62, 66)) { |
| | | this.radiation = new BigDecimal(parseVal(hex, 62, 66)); |
| | | } |
| | | //å
ç
§ |
| | | this.illumination = BigDecimal.valueOf(parseVal(hex, 66, 70) / 100.0); |
| | | if (isValidData(hex, 66, 70)) { |
| | | this.illumination = new BigDecimal(parseVal(hex, 66, 70)).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | //ç´«å¤ææ° |
| | | if (isValidData(hex, 70, 74)) { |
| | | this.ultraviolet = new BigDecimal(parseVal(hex, 70, 74)).divide(new BigDecimal(1), 2, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | //CO2 |
| | | if (isValidData(hex, 74, 78)) { |
| | | this.co2 = new BigDecimal(parseVal(hex, 74, 78)); |
| | | } |
| | | //è´æ°§ç¦»å |
| | | if (isValidData(hex, 78, 82)) { |
| | | this.o2 = BigDecimal.valueOf(parseVal(hex, 78, 82) * 10.0); |
| | | this.o2 = new BigDecimal(parseVal(hex, 78, 82)).multiply(new BigDecimal(1)); |
| | | } |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * å¤æè¯¥å¤§æ°è®¾å¤æ¯å¦æå¯¹åºçæåºå¨ |
| | | * |
| | | * @param value |
| | | * @param startIndex |
| | | * @param endIndex |
| | | * @return |
| | | */ |
| | | private boolean isValidData(String value, int startIndex, int endIndex) { |
| | | //FFFFæ¯ä»£è¡¨è¿ä¸ªè®¾å¤ä¸æ¯æè¿ä¸ªæ°æ®é¡¹ã0000æ¯è¡¨ç¤ºæ¯æä½æ¯æ°æ®ä¸ºé¶ |
| | | if ("FFFF".equals(value.substring(startIndex, endIndex))) { |
| | | return false; |
| | | } else { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | private Integer parseVal(String frame, int start, int end) { |
| | | return Integer.parseInt(frame.substring(start, end), 16); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.manager.iot.frame.inner.report; |
| | | |
| | | 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; |
| | | import lombok.Data; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author ZZQ |
| | | * @date 2022/3/14 16:36 |
| | | * åç¯æä½æä»¤ååºå¸§ |
| | | */ |
| | | @Data |
| | | @ToString(callSuper = true) |
| | | public class A5LightOperationReportInnerFrame extends BaseResponseInnerFrame<A5LightOperationReportInnerFrame> { |
| | | //MACå°å |
| | | private String address; |
| | | |
| | | private String state; |
| | | |
| | | @Override |
| | | public A5LightOperationReportInnerFrame transformFrame(String hex) { // é¿åº¦ä¸ä¸è´æ¶ï¼è¿ånull |
| | | if (StrUtil.isBlank(hex)) { |
| | | return null; |
| | | } |
| | | // MQTTéä¿¡æ¹å¼(1) |
| | | setConnectType(hex.substring(0, 2)); |
| | | // åè½ç (1) |
| | | setFunctionCode(hex.substring(2, 4)); |
| | | // è´è·é¿åº¦(2) |
| | | setPayloadLength(hex.substring(4, 8)); |
| | | //MACå°å |
| | | setAddress(hex.substring(8, 12)); |
| | | //硬件交äºååºç»æ |
| | | setState(returnState(hex.substring(12, 14))); |
| | | |
| | | setCrc32(hex.substring(hex.length() - 8)); |
| | | // æ ¡éªCRC32 |
| | | String frame = hex.substring(2, hex.length() - 8); |
| | | this.setValidate(CRC32Utils.validateFrame(frame, getCrc32())); |
| | | return this; |
| | | } |
| | | |
| | | public String returnState(String stateCode) { |
| | | String State = ""; |
| | | switch (stateCode) { |
| | | case "00": |
| | | State = "æä½æå"; |
| | | break; |
| | | case "01": |
| | | State = "æ ¡éªç é误"; |
| | | break; |
| | | case "02": |
| | | State = "é¿åº¦é误"; |
| | | break; |
| | | case "03": |
| | | State = "åFlash失败é误"; |
| | | break; |
| | | case "FF": |
| | | State = "å
¶ä»é误"; |
| | | break; |
| | | default: |
| | | State = "æªç¥é误"; |
| | | } |
| | | return State; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.manager.iot.frame.inner.request; |
| | | |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.IRequestInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.A5LightDataEnum; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.MQTTConnectTypeEnum; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.util.CRC32Utils; |
| | | |
| | | /** |
| | | * A5->01->29 æ
éç 䏿¥æ¸
é¤ |
| | | */ |
| | | public class A5LightCleanErrorCodeInnerFrame implements IRequestInnerFrame { |
| | | //ç¯å¤´å°å |
| | | private String payload; |
| | | |
| | | public A5LightCleanErrorCodeInnerFrame(String address) { |
| | | this.payload = address; |
| | | } |
| | | |
| | | @Override |
| | | public String getEncodeFrame() { |
| | | String functionCode = A5LightDataEnum.LightCleanErrorCode.getCode(); |
| | | String payloadLength = "0002"; |
| | | String frame = functionCode + payloadLength + payload; |
| | | return MQTTConnectTypeEnum.SYNCHRONIZATION.getCode() + frame.toUpperCase() + CRC32Utils.getCRC32(frame.toUpperCase()); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.manager.iot.frame.inner.request; |
| | | |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.IRequestInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.A5LightDataEnum; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.C3ChargingEnum; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.MQTTConnectTypeEnum; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.util.CRC32Utils; |
| | | |
| | | /** |
| | | * åç¯è®¾ç½®æ¥å |
| | | * |
| | | * @author ZZQ |
| | | * @date 2022/3/3 16:43 |
| | | */ |
| | | public class A5LightSetCalendarReqInnerFrame implements IRequestInnerFrame { |
| | | private final String payload; |
| | | |
| | | public A5LightSetCalendarReqInnerFrame(String lightAddress, int year, int month, int day, int hour, int min, int sec) { |
| | | |
| | | payload = lightAddress + hex10To16(year) + hex10To16(month) + hex10To16(day) + hex10To16(hour) + hex10To16(min) + hex10To16(sec); |
| | | } |
| | | |
| | | @Override |
| | | public String getEncodeFrame() { |
| | | String functionCode = A5LightDataEnum.SetCalendar.getCode(); |
| | | String payloadLength = "0008"; |
| | | String frame = functionCode + payloadLength + payload; |
| | | return MQTTConnectTypeEnum.SYNCHRONIZATION.getCode() + frame.toUpperCase() + CRC32Utils.getCRC32(frame.toUpperCase()); |
| | | // return MQTTConnectTypeEnum.SYNCHRONIZATION.getCode() + frame.toUpperCase() + CRC32Utils.getCRC32(payload.toUpperCase()); |
| | | } |
| | | |
| | | private String hex10To16(int value) { |
| | | return String.format("%02X", value); |
| | | } |
| | | } |
| | |
| | | @Override |
| | | public String getEncodeFrame() { |
| | | String functionCode = NewAtmoFunctionCode.NewQueryHeartBeat.getCode(); |
| | | String payloadLength = "0000"; |
| | | String payload = "0010"; |
| | | String sensorAddress = "0000"; |
| | | String sensorNums = "0013"; |
| | | |
| | | String frame = MQTTConnectTypeEnum.NONG_GENG_SYSTEM_ADDRESS.getCode() + functionCode + payloadLength + payload; |
| | | String frame = MQTTConnectTypeEnum.NONG_GENG_SYSTEM_ADDRESS.getCode() + functionCode + sensorAddress + sensorNums; |
| | | return frame.toUpperCase() + CRC16Utils.getCRC16(frame.toUpperCase()); |
| | | } |
| | | |
| | |
| | | // å
ææ§å¶ |
| | | LightSensorControl("04"), |
| | | |
| | | |
| | | //è®¾ç½®å®æ¶æ§ç¯åæ° |
| | | LightTimer("23"), |
| | | // æ¸
é¤åç¯ç´¯è®¡æ°æ® |
| | | LightReset("25"), |
| | | //æ
éç 䏿¥æ¸
é¤ |
| | | LightCleanErrorCode("29"), |
| | | //设置æ¥åï¼åå¿è·³å
ä¸ç6åèæ¥ææ¶é´ï¼ |
| | | SetCalendar("28"), |
| | | LIGHT_HEART_BEAT("LightReportData:light_heart_beat/"); |
| | | |
| | | A5LightDataEnum(String code) { |
| | |
| | | * @author ZZQ |
| | | * @date 2022/4/12 11:39 |
| | | */ |
| | | public enum RemoteUpdateTypeEnum { |
| | | public class RemoteUpdateTypeEnum { |
| | | //âMQTT主æ¿âãâMQTTæ ¸å¿æ¿âãâåç¯æ¨¡åâãâC3å
çµæ¡©æ¨¡åâãâCat.1主æ¿âï¼âç¯æå¾ææ¨¡åâåâ大æ°è®¾å¤æ¨¡åâè¿7个类å |
| | | // MQTTä¸»æ¿ |
| | | MQTT_MAIN("0"), |
| | | public static String MQTT_MAIN = "MQTT主æ¿"; |
| | | // MQTTæ ¸å¿æ¿ |
| | | MQTT_CORE("1"), |
| | | public static String MQTT_CORE = "MQTTæ ¸å¿æ¿"; |
| | | // åç¯æ¨¡å |
| | | LIGHT("2"), |
| | | public static String LIGHT = "åç¯æ¨¡å"; |
| | | // C3å
çµæ¡©æ¨¡å |
| | | C3_CHARGING("3"); |
| | | |
| | | private String code; |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | | |
| | | |
| | | RemoteUpdateTypeEnum(String code) { |
| | | this.code = code; |
| | | } |
| | | public static String C3_CHARGING = "C3å
çµæ¡©æ¨¡å"; |
| | | // Cat.1ä¸»æ¿ |
| | | public static String CAT1_MAIN = "Cat.1主æ¿"; |
| | | // ç¯æå¾ææ¨¡å |
| | | public static String LIGHT_POLE_HELING = "ç¯æå¾ææ¨¡å"; |
| | | // 大æ°è®¾å¤æ¨¡å |
| | | public static String AIR_EQUIPMENT = "大æ°è®¾å¤æ¨¡å"; |
| | | |
| | | public static List<RemoteUpdateTypeDto> getAllType() { |
| | | |
| | | List<RemoteUpdateTypeDto> list = new ArrayList<>(); |
| | | for (RemoteUpdateTypeEnum r : RemoteUpdateTypeEnum.values()) { |
| | | RemoteUpdateTypeDto remoteUpdateTypeEntity = new RemoteUpdateTypeDto(); |
| | | remoteUpdateTypeEntity.setVal(r.getCode()); |
| | | remoteUpdateTypeEntity.setFileTypeName(map.get(r.getCode())); |
| | | list.add(remoteUpdateTypeEntity); |
| | | } |
| | | list.add(new RemoteUpdateTypeDto(MQTT_MAIN)); |
| | | list.add(new RemoteUpdateTypeDto(MQTT_CORE)); |
| | | list.add(new RemoteUpdateTypeDto(LIGHT)); |
| | | list.add(new RemoteUpdateTypeDto(C3_CHARGING)); |
| | | list.add(new RemoteUpdateTypeDto(CAT1_MAIN)); |
| | | list.add(new RemoteUpdateTypeDto(LIGHT_POLE_HELING)); |
| | | list.add(new RemoteUpdateTypeDto(AIR_EQUIPMENT)); |
| | | |
| | | return list; |
| | | } |
| | | |
| | | private static ConcurrentHashMap<String, String> map = new ConcurrentHashMap<String, String>() { |
| | | { |
| | | put("0", "MQTTæ ¸å¿æ¿"); |
| | | put("1", "Cat.1主æ¿"); |
| | | put("2", "C3å
çµæ¡©æ¨¡å"); |
| | | put("3", "大æ°è®¾å¤æ¨¡å"); |
| | | put("4", "æä½å¾ææ¨¡å"); |
| | | } |
| | | }; |
| | | |
| | | } |
| | |
| | | package com.sandu.ximon.admin.manager.iot.rrpc.mainboard; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.aliyuncs.DefaultAcsClient; |
| | | import com.aliyuncs.iot.model.v20180120.InvokeThingServiceResponse; |
| | | import com.aliyuncs.profile.DefaultProfile; |
| | | import com.aliyuncs.profile.IClientProfile; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.ximon.admin.manager.iot.amqp.MqttMainBoardConfig; |
| | | import com.sandu.ximon.admin.manager.iot.frame.IRequestFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.BaseResponseInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.BaseInvokeSyncService; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.dto.CommonFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.dto.InvokeParam; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.dto.WrapResponseCommonFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.util.FrameUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author chenjiantian |
| | |
| | | public class MainBoardInvokeSyncService extends BaseInvokeSyncService { |
| | | private static volatile DefaultAcsClient client = null; |
| | | |
| | | private final static String PRODUCT_KEY = "a1JsfPG4iKW"; |
| | | private final static String PRODUCT_KEY = "a1JsfPG4iKW"; //todo æåå°é
ç½®æä»¶ |
| | | |
| | | @Override |
| | | public String getProductKey() { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.manager.iot.rrpc.util; |
| | | |
| | | public class CRCUtils { |
| | | /** |
| | | * 计ç®CRC16/Modbusæ ¡éªç é«ä½å¨å,ä½ä½å¨å |
| | | * |
| | | * @param hex åå
è¿å¶å符串 |
| | | * @return CRC16æ ¡éªç |
| | | */ |
| | | public static String getCRC16 (String hex) { |
| | | byte[] tx_buff = SupplementUtils.hexStringToBytes(hex); |
| | | int[] result = CRCValidate.calculateCRC(tx_buff, 0, tx_buff.length); |
| | | String hex1 = Integer.toHexString(result[1]); |
| | | String hex2 = Integer.toHexString(result[0]); |
| | | |
| | | if (hex1.length()<2) { |
| | | hex1 = "0" + hex1; |
| | | } |
| | | if (hex2.length()<2) { |
| | | hex2 = "0" + hex2; |
| | | } |
| | | return ( hex2 + hex1 ).toUpperCase(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.manager.iot.rrpc.util; |
| | | |
| | | /** |
| | | * Created by 11833 on 2018/1/5. |
| | | */ |
| | | public class CRCValidate { |
| | | |
| | | private static final String TAG="CRCValidate"; |
| | | /** |
| | | * 计ç®CRC |
| | | * */ |
| | | public static final int[] calculateCRC(byte[] data, int offset, int len) { |
| | | |
| | | int[] crc = { 0xFF, 0xFF }; |
| | | |
| | | int nextByte = 0; |
| | | |
| | | int uIndex; |
| | | |
| | | for (int i = offset; i < len && i < data.length; i++) { |
| | | |
| | | nextByte = 0xFF & ((int) data[i]); |
| | | |
| | | uIndex = crc[0] ^ nextByte; |
| | | |
| | | crc[0] = crc[1] ^ auchCRCHi[uIndex]; |
| | | |
| | | crc[1] = auchCRCLo[uIndex]; |
| | | |
| | | } |
| | | |
| | | return crc; |
| | | |
| | | }// calculateCRC |
| | | |
| | | /** |
| | | * 鿤æ·éæ¤æ·ä¸ä½CRC??鿤æ·éæ¤æ·ä½éæ¤æ·é? |
| | | * 鿤æ·ä¸éæ¤æ·éæ¤æ·éæ¤æ·éæ¤æ·è¦éæ¤æ·éæ¤æ·éçµuff |
| | | * 鿤æ·ä¸éæ¤æ·éæ¤æ·éæ¤æ·éæ¤æ·éæ¤æ·å§ä½éæ¤æ· |
| | | * 鿤æ·éæ¤æ·éæ¤æ·éæ¤æ·éæ¤æ·éæ¤æ·éæ¤æ·éå§é¿éæ¤æ· |
| | | * |
| | | * */ |
| | | public static final int calculateSingleCRC(byte[] data, int offset, int len) { |
| | | |
| | | int crc = data[offset]; |
| | | |
| | | /* pass through message buffer */ |
| | | |
| | | for (int i = offset+1; i < (offset+len) && i < data.length; i++) { |
| | | |
| | | crc = crc ^ ((int) data[i]); // *puchMsg++; /* calculate the CRC */ |
| | | |
| | | } |
| | | |
| | | return crc; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * /鿤æ·éæ¤æ·CRC?? 鿤æ·ä¸éæ¤æ·éæ¤æ·éæ¤æ·éæ¤æ·è¦éæ¤æ·éæ¤æ·éçµalcStr |
| | | * // "01 10 00 5e 00 02 04 11 12 13 14"éç«ç¢æ·crc="df 19" |
| | | */ |
| | | public static final String calculateStringCRC(String calcStr) { |
| | | |
| | | String crcStr = null; |
| | | if (SupplementUtils.isHex(calcStr)) { |
| | | byte[] data = SupplementUtils.hexStringToBytes(calcStr); |
| | | int[] crcIntArr = CRCValidate.calculateCRC(data, 0, data.length); |
| | | byte[] crcByteArr1 = { 0, (byte) crcIntArr[0] }; |
| | | byte[] crcByteArr2 = { 0, (byte) crcIntArr[1] }; |
| | | // String crcStr1 = HexStrConvertUtil.bytesToHexString(crcByteArr1).substring(2); |
| | | // String crcStr2 = HexStrConvertUtil.bytesToHexString(crcByteArr2).substring(2); |
| | | // crcStr = crcStr1 + " " + crcStr2; |
| | | } |
| | | |
| | | return crcStr.toLowerCase(); |
| | | |
| | | } |
| | | |
| | | /* Table of CRC values for high-order byte */ |
| | | |
| | | private final static short[] auchCRCHi = { |
| | | |
| | | 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, |
| | | |
| | | 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, |
| | | |
| | | 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, |
| | | |
| | | 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, |
| | | |
| | | 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, |
| | | |
| | | 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, |
| | | |
| | | 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, |
| | | |
| | | 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, |
| | | |
| | | 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, |
| | | |
| | | 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, |
| | | |
| | | 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, |
| | | |
| | | 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, |
| | | |
| | | 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, |
| | | |
| | | 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, |
| | | |
| | | 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, |
| | | |
| | | 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, |
| | | |
| | | 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, |
| | | |
| | | 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, |
| | | |
| | | 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, |
| | | |
| | | 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, |
| | | |
| | | 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, |
| | | |
| | | 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, |
| | | |
| | | 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, |
| | | |
| | | 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, |
| | | |
| | | 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, |
| | | |
| | | 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 |
| | | |
| | | }; |
| | | |
| | | /* Table of CRC values for low-order byte */ |
| | | |
| | | private final static short[] auchCRCLo = { |
| | | |
| | | 0x00, 0xC0, 0xC1, 0x01, 0xC3, 0x03, 0x02, 0xC2, 0xC6, 0x06, |
| | | |
| | | 0x07, 0xC7, 0x05, 0xC5, 0xC4, 0x04, 0xCC, 0x0C, 0x0D, 0xCD, |
| | | |
| | | 0x0F, 0xCF, 0xCE, 0x0E, 0x0A, 0xCA, 0xCB, 0x0B, 0xC9, 0x09, |
| | | |
| | | 0x08, 0xC8, 0xD8, 0x18, 0x19, 0xD9, 0x1B, 0xDB, 0xDA, 0x1A, |
| | | |
| | | 0x1E, 0xDE, 0xDF, 0x1F, 0xDD, 0x1D, 0x1C, 0xDC, 0x14, 0xD4, |
| | | |
| | | 0xD5, 0x15, 0xD7, 0x17, 0x16, 0xD6, 0xD2, 0x12, 0x13, 0xD3, |
| | | |
| | | 0x11, 0xD1, 0xD0, 0x10, 0xF0, 0x30, 0x31, 0xF1, 0x33, 0xF3, |
| | | |
| | | 0xF2, 0x32, 0x36, 0xF6, 0xF7, 0x37, 0xF5, 0x35, 0x34, 0xF4, |
| | | |
| | | 0x3C, 0xFC, 0xFD, 0x3D, 0xFF, 0x3F, 0x3E, 0xFE, 0xFA, 0x3A, |
| | | |
| | | 0x3B, 0xFB, 0x39, 0xF9, 0xF8, 0x38, 0x28, 0xE8, 0xE9, 0x29, |
| | | |
| | | 0xEB, 0x2B, 0x2A, 0xEA, 0xEE, 0x2E, 0x2F, 0xEF, 0x2D, 0xED, |
| | | |
| | | 0xEC, 0x2C, 0xE4, 0x24, 0x25, 0xE5, 0x27, 0xE7, 0xE6, 0x26, |
| | | |
| | | 0x22, 0xE2, 0xE3, 0x23, 0xE1, 0x21, 0x20, 0xE0, 0xA0, 0x60, |
| | | |
| | | 0x61, 0xA1, 0x63, 0xA3, 0xA2, 0x62, 0x66, 0xA6, 0xA7, 0x67, |
| | | |
| | | 0xA5, 0x65, 0x64, 0xA4, 0x6C, 0xAC, 0xAD, 0x6D, 0xAF, 0x6F, |
| | | |
| | | 0x6E, 0xAE, 0xAA, 0x6A, 0x6B, 0xAB, 0x69, 0xA9, 0xA8, 0x68, |
| | | |
| | | 0x78, 0xB8, 0xB9, 0x79, 0xBB, 0x7B, 0x7A, 0xBA, 0xBE, 0x7E, |
| | | |
| | | 0x7F, 0xBF, 0x7D, 0xBD, 0xBC, 0x7C, 0xB4, 0x74, 0x75, 0xB5, |
| | | |
| | | 0x77, 0xB7, 0xB6, 0x76, 0x72, 0xB2, 0xB3, 0x73, 0xB1, 0x71, |
| | | |
| | | 0x70, 0xB0, 0x50, 0x90, 0x91, 0x51, 0x93, 0x53, 0x52, 0x92, |
| | | |
| | | 0x96, 0x56, 0x57, 0x97, 0x55, 0x95, 0x94, 0x54, 0x9C, 0x5C, |
| | | |
| | | 0x5D, 0x9D, 0x5F, 0x9F, 0x9E, 0x5E, 0x5A, 0x9A, 0x9B, 0x5B, |
| | | |
| | | 0x99, 0x59, 0x58, 0x98, 0x88, 0x48, 0x49, 0x89, 0x4B, 0x8B, |
| | | |
| | | 0x8A, 0x4A, 0x4E, 0x8E, 0x8F, 0x4F, 0x8D, 0x4D, 0x4C, 0x8C, |
| | | |
| | | 0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86, 0x82, 0x42, |
| | | |
| | | 0x43, 0x83, 0x41, 0x81, 0x80, 0x40 |
| | | |
| | | }; |
| | | |
| | | /* |
| | | * éå«è®¹æ·CRCå¼éè§å¤æ·éæ¤æ·ç¡®--CRCæ ¡éæ¤æ· |
| | | */ |
| | | public static Boolean isCRCConfig(byte[] buff) { |
| | | int offset = 0; |
| | | int len = buff.length - 2; |
| | | // 鿤æ·éæ¤æ·åéæ¤æ·æ¨¡éæ¤æ·éè¡å¤æ·éè¡é©æ·ç¢î®æ·éæ¤æ·è©éæ¤æ·éæ¤æ·éå«ï½æ·éæ¤æ·èâæ·é? |
| | | // 鿤æ·éæ¤æ·CRCå¼,(鿤æ·ä¸éæ¤æ·éæ¤æ·éæ¤æ·éæ¤æ·è¦éæ¤æ·éæ¤æ·éçµuff 鿤æ·ä¸éæ¤æ·éæ¤æ·éæ¤æ·éæ¤æ·éæ¤æ·å§ä½ 鿤æ·éæ¤æ·éæ¤æ·éæ¤æ·éæ¤æ·éæ¤æ·éæ¤æ·éå§é¿éæ¤æ·) |
| | | int[] crc = CRCValidate.calculateCRC(buff, offset, len); |
| | | // éé¥ºæ¤æ·buff鿤æ·éæ¤æ·éæ¤æ·é轿ç±RC鿤æ·éè§å¤æ·éæ¤æ·è¯©éæ¤æ·éæ¤æ·éæ¤æ·éæ¤æ·CRCéæ¤æ· |
| | | return (byte) crc[0] == buff[buff.length - 2] & (byte) crc[1] == buff[buff.length - 1]; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | public static boolean isHex(String str) { |
| | | boolean isHexFlg = true; |
| | | int i = 0; |
| | | char c; |
| | | for (i = 0; i < str.length(); i++) { |
| | | c = str.charAt(i); |
| | | if (!(((c >= '0') && (c <= '9')) || ((c >= 'A') && (c <= 'F')) || ((c >= 'a') && (c <= 'f')) || (c == ' '))) { |
| | | isHexFlg = false; |
| | | break; |
| | | } |
| | | } |
| | | return isHexFlg; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.param; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | /** |
| | | * @author ZZQ |
| | | * @date 2022/3/3 18:07 |
| | | */ |
| | | @Data |
| | | public class LightSetCalendarParam { |
| | | @NotNull(message = "åç¯IDä¸è½ä¸ºç©º") |
| | | private Long lightId; |
| | | |
| | | /** |
| | | * ç¯å¤´å°å |
| | | */ |
| | | private String address; |
| | | } |
| | |
| | | package com.sandu.ximon.admin.param; |
| | | |
| | | import lombok.Data; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author chenjiantian |
| | |
| | | @Data |
| | | public class LightTaskDelParam { |
| | | |
| | | @NotEmpty(message = "ä»»å¡idä¸è½ä¸ºç©º") |
| | | private List<Long> taskIdList; |
| | | @NotNull(message = "ä»»å¡idä¸è½ä¸ºç©º") |
| | | private Long taskId; |
| | | |
| | | } |
| | |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | private String lightAddress; |
| | | |
| | | private List<Long> poleIdList; |
| | | |
| | | |
| | | private Long taskId; |
| | | } |
| | |
| | | private String mac; |
| | | |
| | | /** |
| | | * 设å¤ç±»åï¼åç¯/大æ°/C3å
çµæ¡©/æä½å¾æ |
| | | * âMQTT主æ¿âãâMQTTæ ¸å¿æ¿âãâåç¯æ¨¡åâãâC3å
çµæ¡©æ¨¡åâãâCat.1主æ¿âï¼âç¯æå¾ææ¨¡åâåâ大æ°è®¾å¤æ¨¡åâè¿7个类å |
| | | */ |
| | | @NotEmpty |
| | | private String deviceType; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.redis; |
| | | |
| | | /** |
| | | * @author LiuHaoNan |
| | | * @date 2022/9/26 |
| | | */ |
| | | public class DeviceRedisKey { |
| | | |
| | | /** |
| | | * 鳿± |
| | | */ |
| | | public static final String IP_BROADCAST = "volume:"; |
| | | |
| | | /** |
| | | * æå头 |
| | | */ |
| | | public static final String MONITOR = "monitor:"; |
| | | |
| | | /** |
| | | * åç¯ |
| | | */ |
| | | public static final String LIGHT_DEVICE = "lightDevice:"; |
| | | |
| | | /** |
| | | * å
çµæ¡© |
| | | */ |
| | | public static final String C3M = "c3m:"; |
| | | |
| | | /** |
| | | * å¤§æ° |
| | | */ |
| | | public static final String AIR = "air:"; |
| | | |
| | | /** |
| | | * åè |
| | | */ |
| | | public static final String AIR_NONGGENG = "airNongGeng:"; |
| | | |
| | | /** |
| | | * çæ± |
| | | */ |
| | | public static final String XIXUN = "led_xixun:"; |
| | | |
| | | /** |
| | | * è¯ºç¦ |
| | | */ |
| | | public static final String NOVA = "led_nova:"; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.schedule; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.sandu.common.util.SpringContextHolder; |
| | | import com.sandu.ximon.admin.service.LightService; |
| | | import com.sandu.ximon.admin.service.LightTaskPoleRelationService; |
| | | import com.sandu.ximon.dao.domain.Light; |
| | | import com.sandu.ximon.dao.domain.LightTask; |
| | | import com.sandu.ximon.dao.domain.LightTaskPoleRelation; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | /** |
| | | * åç¯åæ¥æ¶é´å®æ¶ |
| | | */ |
| | | |
| | | @Component |
| | | @Slf4j |
| | | @AllArgsConstructor |
| | | @EnableScheduling |
| | | public class LightTimeSynchronizationSchedule { |
| | | private final LightService lightService; |
| | | private final LightTaskPoleRelationService lightTaskPoleRelationService; |
| | | |
| | | //æ¯å¤©02:00 å¼å§æ§è¡ |
| | | @Scheduled(cron = "0 0 2 * * ? ") |
| | | public void UserSubjectRefund() { |
| | | //ææåç¯æ°æ® |
| | | List<Light> lightList = lightService.list(); |
| | | |
| | | //åç¯ä»»å¡ |
| | | List<LightTaskPoleRelation> lightTaskPoleRelationList = |
| | | lightTaskPoleRelationService.list(); |
| | | |
| | | /** |
| | | * å»é¤æ ææ°æ® |
| | | */ |
| | | lightTaskPoleRelationList = lightTaskPoleRelationList.stream().filter(bean -> bean.getDeviceScheduled() != null).collect(Collectors.toList()); |
| | | |
| | | Map<String, LightTask> map = new HashMap<>(); |
| | | for (LightTaskPoleRelation bean : lightTaskPoleRelationList) { |
| | | LightTask lightTask = JSONObject.parseObject(bean.getDeviceScheduled(), LightTask.class); |
| | | map.put(bean.getDeviceCode() + bean.getLightAddress(), lightTask); |
| | | } |
| | | |
| | | for (Light light : lightList) { |
| | | //TODO |
| | | if (!light.getDeviceCode().equals("32313243305007ff8711ffff")) { |
| | | continue; |
| | | } |
| | | if (map.get(light.getDeviceCode() + "0001") != null) { |
| | | /** |
| | | * åæ°1ï¼åç¯ä¿¡æ¯ |
| | | * åæ°2ï¼åç¯ä»»å¡ |
| | | */ |
| | | lightService.timeSynchronization(light, "0001", map.get(light.getDeviceCode() + "0001")); |
| | | } else { |
| | | /** |
| | | * åæ°1ï¼åç¯ä¿¡æ¯ |
| | | * åæ°2ï¼ä»»å¡ä¸ºnull |
| | | */ |
| | | lightService.timeSynchronization(light, "0001", null); |
| | | } |
| | | |
| | | if (map.get(light.getDeviceCode() + "0002") != null) { |
| | | /** |
| | | * åæ°1ï¼åç¯ä¿¡æ¯ |
| | | * åæ°2ï¼åç¯ä»»å¡ |
| | | */ |
| | | lightService.timeSynchronization(light, "0002", map.get(light.getDeviceCode() + "0002")); |
| | | } else { |
| | | /** |
| | | * åæ°1ï¼åç¯ä¿¡æ¯ |
| | | * åæ°2ï¼ä»»å¡ä¸ºnull |
| | | */ |
| | | lightService.timeSynchronization(light, "0002", null); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5AtmosphereHeartbeatReportInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5AtmosphereNewHeartbeatReportInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.AtmoFunctionCode; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.utils.RedisUtils; |
| | | import com.sandu.ximon.dao.bo.AirDataBo; |
| | | import com.sandu.ximon.dao.bo.AirDataNongGengBo; |
| | | import com.sandu.ximon.dao.domain.AirData; |
| | | import com.sandu.ximon.dao.domain.AirDataNongGeng; |
| | | import com.sandu.ximon.dao.domain.AirEquipment; |
| | | import com.sandu.ximon.dao.domain.AirEquipmentNongGeng; |
| | | import com.sandu.ximon.dao.mapper.AirDataNongGengMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å¤§æ°æ°æ®ï¼åè硬件 |
| | |
| | | public boolean saveReportData(String deviceName, A5AtmosphereNewHeartbeatReportInnerFrame.HeartBeatDataPackage heartBeatDataPackage) { |
| | | |
| | | AirDataNongGeng airDataNongGeng = new AirDataNongGeng(); |
| | | BeanUtils.copyProperties(heartBeatDataPackage, airDataNongGeng); |
| | | //("åªå£°") |
| | | airDataNongGeng.setNoise(heartBeatDataPackage.getNoise() == null ? null : heartBeatDataPackage.getNoise() + "dB"); |
| | | //("ç¡«åæ°¢") |
| | | airDataNongGeng.setHydrogenSulfide(heartBeatDataPackage.getHydrogenSulfide() == null ? null : heartBeatDataPackage.getHydrogenSulfide() + ""); |
| | | //("SO2 æµåº¦") |
| | | airDataNongGeng.setSo2(heartBeatDataPackage.getSo2() == null ? null : heartBeatDataPackage.getSo2() + "ppb"); |
| | | //("NO2 æµåº¦") |
| | | airDataNongGeng.setNo2(heartBeatDataPackage.getNo2() == null ? null : heartBeatDataPackage.getNo2() + "ppb"); |
| | | //("CO æµåº¦") |
| | | airDataNongGeng.setCo(heartBeatDataPackage.getCo() == null ? null : heartBeatDataPackage.getCo() + "ppb"); |
| | | //("O3 æµåº¦") |
| | | airDataNongGeng.setO3(heartBeatDataPackage.getO3() == null ? null : heartBeatDataPackage.getO3() + "ppb"); |
| | | //("PM2.5 æµåº¦") |
| | | airDataNongGeng.setPm2point5(heartBeatDataPackage.getPm2point5() == null ? null : heartBeatDataPackage.getPm2point5() + "ug/m³"); |
| | | //("PM10 æµåº¦") |
| | | airDataNongGeng.setPm10(heartBeatDataPackage.getPm10() == null ? null : heartBeatDataPackage.getPm10() + "ug/m³"); |
| | | //("ç©ºæ°æ¸©åº¦") |
| | | airDataNongGeng.setAirTemperature(heartBeatDataPackage.getAirTemperature() == null ? null : heartBeatDataPackage.getAirTemperature() + "â"); |
| | | //("ç©ºæ°æ¹¿åº¦") |
| | | airDataNongGeng.setAirHumidity(heartBeatDataPackage.getAirHumidity() == null ? null : heartBeatDataPackage.getAirHumidity() + "%"); |
| | | //("大æ°å强") |
| | | airDataNongGeng.setAirPressure(heartBeatDataPackage.getAirPressure() == null ? null : heartBeatDataPackage.getAirPressure() + "hPa"); |
| | | //("é£é") |
| | | airDataNongGeng.setWindSpeed(heartBeatDataPackage.getWindSpeed() == null ? null : heartBeatDataPackage.getWindSpeed() + "m/s"); |
| | | //("é£å") |
| | | airDataNongGeng.setWindDirection(heartBeatDataPackage.getWindDirection() == null ? null : heartBeatDataPackage.getWindDirection() + "°"); |
| | | //("10 åéé¨é") |
| | | airDataNongGeng.setTenRainfallMin(heartBeatDataPackage.getTenRainfallMin() == null ? null : heartBeatDataPackage.getTenRainfallMin() + "mm"); |
| | | //("è¾å°") |
| | | airDataNongGeng.setRadiation(heartBeatDataPackage.getRadiation() == null ? null : heartBeatDataPackage.getRadiation() + "0W/ã¡"); |
| | | //("å
ç
§") |
| | | airDataNongGeng.setIllumination(heartBeatDataPackage.getIllumination() == null ? null : heartBeatDataPackage.getIllumination() + "Klux"); |
| | | //ç´«å¤ææ° |
| | | airDataNongGeng.setUltraviolet(heartBeatDataPackage.getUltraviolet() == null ? null : heartBeatDataPackage.getUltraviolet() + ""); |
| | | //CO2 |
| | | airDataNongGeng.setCo2(heartBeatDataPackage.getCo2() == null ? null : heartBeatDataPackage.getCo2() + "0ppm"); |
| | | //è´æ°§ç¦»å |
| | | airDataNongGeng.setO2(heartBeatDataPackage.getO2() == null ? null : heartBeatDataPackage.getO2() + "个"); |
| | | |
| | | airDataNongGeng.setMac(deviceName); |
| | | |
| | | //å°è®¾å¤ä¿¡æ¯æ·»å å°å¤§æ°è®¾å¤è¡¨ |
| | |
| | | return save(airDataNongGeng); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å¤§æ°æ°æ®(æ¨¡ç³æ¥è¯¢) |
| | | */ |
| | | public List<AirDataNongGengBo> listAirDataByKeyword(BaseConditionVO baseConditionVO, String keyword) { |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | List<Long> listAirId; |
| | | if (SecurityUtils.getClientId() == null) { |
| | | listAirId = baseMapper.listAirId(keyword, null); |
| | | } else { |
| | | listAirId = baseMapper.listAirId(keyword, SecurityUtils.getUserId()); |
| | | } |
| | | if (CollUtil.isEmpty(listAirId)) { |
| | | return CollUtil.newArrayList(); |
| | | } |
| | | List<AirDataNongGengBo> airDataBos = baseMapper.listAirDataByIds(listAirId); |
| | | return airDataBos; |
| | | |
| | | } |
| | | // |
| | | // /** |
| | | // * æ¥è¯¢å¤§æ°æ°æ®(æ¨¡ç³æ¥è¯¢) |
| | | // */ |
| | | // public List<AirDataNongGengBo> listAirDataByKeyword(BaseConditionVO baseConditionVO, String keyword) { |
| | | // PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | // List<Long> listAirId; |
| | | // if (SecurityUtils.getClientId() == null) { |
| | | // listAirId = baseMapper.listAirId(keyword, null); |
| | | // } else { |
| | | // listAirId = baseMapper.listAirId(keyword, SecurityUtils.getUserId()); |
| | | // } |
| | | // if (CollUtil.isEmpty(listAirId)) { |
| | | // return CollUtil.newArrayList(); |
| | | // } |
| | | // List<AirDataNongGengBo> airDataBos = baseMapper.listAirDataByIds(listAirId); |
| | | // return airDataBos; |
| | | // |
| | | // } |
| | | } |
| | |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.common.util.SpringContextHolder; |
| | | import com.sandu.ximon.admin.manager.iot.frame.A5Frame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5AtmosphereOperationReportInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.request.AtmosphereSetHeartBeatTimeReqInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.dto.CommonFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.A5OrderEnum; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.AtmoFunctionCode; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.mainboard.MainBoardInvokeSyncService; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.utils.RedisUtils; |
| | | import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils; |
| | | import com.sandu.ximon.admin.utils.StringUtil; |
| | | import com.sandu.ximon.dao.bo.AirEquipmentNongGengBo; |
| | | import com.sandu.ximon.dao.domain.AirEquipmentNongGeng; |
| | | import com.sandu.ximon.dao.mapper.AirEquipmentNongGengMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | public void addAirEquipment(AirEquipmentNongGeng airEquipmentNongGeng) { |
| | | AirEquipmentNongGeng one = getOne(Wrappers.lambdaQuery(AirEquipmentNongGeng.class).eq(AirEquipmentNongGeng::getMac, airEquipmentNongGeng.getMac())); |
| | | if (one == null) { |
| | | //TODO |
| | | save(airEquipmentNongGeng); |
| | | /** |
| | | * æ·»å åè大æ°è®¾å¤ æ¥å¿è®°å½å¼å§ |
| | |
| | | airEquipmentBos = airEquipmentNongGengMapper.listAirEquipmentByIds(keyword, SecurityUtils.getUserId()); |
| | | } |
| | | |
| | | return airEquipmentBos; |
| | | if (SecurityUtils.getClientId() == null) { |
| | | airEquipmentBos = airEquipmentNongGengMapper.listAirEquipmentByIds(keyword, null); |
| | | } else { |
| | | airEquipmentBos = airEquipmentNongGengMapper.listAirEquipmentByIds(keyword, SecurityUtils.getUserId()); |
| | | } |
| | | |
| | | return null; |
| | | // return airEquipmentBos; |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | return airEquipmentBos; |
| | | // return null; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public AirEquipmentNongGeng getAirEquipment(String mac) { |
| | | AirEquipmentNongGeng one = getOne(Wrappers.lambdaQuery(AirEquipmentNongGeng.class).eq(AirEquipmentNongGeng::getMac, mac)); |
| | | if (one == null) { |
| | | throw new BusinessException("大æ°è®¾å¤ä¸åå¨ï¼"); |
| | | } |
| | | if (RedisUtils.getBean().get(AtmoFunctionCode.AIR_HEARTBEAT_NONG_GENG_STATE.getCode() + mac) != null) { |
| | | one.setState(1); |
| | | } else { |
| | |
| | | } |
| | | return one; |
| | | } |
| | | |
| | | /** |
| | | * 设置大æ°è®¾å¤å¿è·³å
é´éæ¶é´ |
| | | * |
| | | * @param mac |
| | | * @param time |
| | | */ |
| | | public String setHeartBeatTime(String mac, Integer time) { |
| | | if (StringUtil.strIsNullOrEmpty(mac)) { |
| | | throw new BusinessException("ç¯æmacåæ°é误ï¼"); |
| | | } |
| | | if (time == null) { |
| | | throw new BusinessException("å¿è·³å
é´éæ¶é´ä¸è½ä¸ºç©ºï¼"); |
| | | } |
| | | |
| | | if (time < 30) { |
| | | throw new BusinessException("å¿è·³å
é´éæ¶é´ä¸è½å°äº30sï¼"); |
| | | } |
| | | AirEquipmentNongGeng airEquipmentNongGeng = SpringContextHolder.getBean(AirEquipmentNongGengService.class). |
| | | getOne(Wrappers.lambdaQuery(AirEquipmentNongGeng.class).eq(AirEquipmentNongGeng::getMac, mac).last("limit 1")); |
| | | if (airEquipmentNongGeng == null) { |
| | | throw new BusinessException("大æ°è®¾å¤ä¸åå¨ï¼"); |
| | | } |
| | | |
| | | AtmosphereSetHeartBeatTimeReqInnerFrame atmosphereSetHeartBeatTimeReqInnerFrame = new AtmosphereSetHeartBeatTimeReqInnerFrame(time); |
| | | A5Frame a5Frame = new A5Frame(A5OrderEnum.REQUEST_ATMOSPHERE_DATA.getCode(), atmosphereSetHeartBeatTimeReqInnerFrame); |
| | | System.out.println(a5Frame + " --------a5Frame"); |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(mac, a5Frame); |
| | | System.out.println(commonFrame + " -----------commonFrame"); |
| | | |
| | | A5AtmosphereOperationReportInnerFrame a5AtmosphereOperationReportInnerFrame |
| | | = new A5AtmosphereOperationReportInnerFrame().transformFrame(commonFrame.getPayload()); |
| | | if (a5AtmosphereOperationReportInnerFrame != null && a5AtmosphereOperationReportInnerFrame.isValidate()) { |
| | | return a5AtmosphereOperationReportInnerFrame.getState(); |
| | | } else { |
| | | throw new BusinessException("æ°æ®æ ¡éªå¼å¸¸ï¼"); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置类å |
| | | * |
| | | * @param param |
| | | * @return |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean setAirEquipmentType(AirEquipmentNongGeng param) { |
| | | if (param.getType() == null || param.getId() == null || param.getType().isEmpty()) { |
| | | throw new BusinessException("设å¤idæç±»åä¸è½ä¸ºç©º"); |
| | | } |
| | | if (!"0".equals(param.getType()) && !"1".equals(param.getType()) && !"2".equals(param.getType())) { |
| | | throw new BusinessException("设å¤ç±»å䏿£ç¡®"); |
| | | } |
| | | AirEquipmentNongGeng byId = getById(param.getId()); |
| | | if (byId == null) { |
| | | throw new BusinessException("设å¤idé误æè®¾å¤ä¸åå¨!"); |
| | | } |
| | | byId.setType(param.getType()); |
| | | |
| | | return updateById(byId); |
| | | } |
| | | } |
| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.sandu.common.execption.BusinessException; |
| | |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.A5OrderEnum; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.AtmoFunctionCode; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.mainboard.MainBoardInvokeSyncService; |
| | | import com.sandu.ximon.admin.redis.DeviceRedisKey; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.utils.RedisUtils; |
| | | import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils; |
| | | import com.sandu.ximon.admin.utils.StringUtil; |
| | | import com.sandu.ximon.admin.vo.EquipmentInfomation; |
| | | import com.sandu.ximon.admin.vo.RedisDeviceStatus; |
| | | import com.sandu.ximon.dao.bo.AirEquipmentBo; |
| | | import com.sandu.ximon.dao.domain.AirEquipment; |
| | | import com.sandu.ximon.dao.mapper.AirEquipmentMapper; |
| | |
| | | public class AirEquipmentService extends BaseServiceImpl<AirEquipmentMapper, AirEquipment> { |
| | | |
| | | private final AirEquipmentMapper airEquipmentMapper; |
| | | private final RedisUtils redisUtils; |
| | | |
| | | |
| | | /** |
| | |
| | | throw new BusinessException("æ°æ®æ ¡éªå¼å¸¸ï¼"); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * åRedisä¸åå
¥è®¾å¤ç¶æ |
| | | */ |
| | | public void setCacheData() { |
| | | list().forEach( |
| | | device -> { |
| | | RedisDeviceStatus deviceStatus = new RedisDeviceStatus(); |
| | | deviceStatus.setDeviceId(device.getAirMac()); |
| | | |
| | | if (RedisUtils.getBean().get(AtmoFunctionCode.AIR_HEARTBEAT_STATE.getCode() + device.getAirMac()) != null) { |
| | | deviceStatus.setStatus(0); |
| | | } else { |
| | | deviceStatus.setStatus(1); |
| | | } |
| | | redisUtils.set(DeviceRedisKey.AIR + device.getAirMac(), JSON.toJSONString(deviceStatus)); |
| | | // redisUtils.delete(DeviceRedisKey.AIR + device.getAirMac()); |
| | | } |
| | | ); |
| | | } |
| | | } |
| | |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.util.SupplementUtils; |
| | | import com.sandu.ximon.admin.param.C3ChargingAddParam; |
| | | import com.sandu.ximon.admin.param.C3ChargingParam; |
| | | import com.sandu.ximon.admin.redis.DeviceRedisKey; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.utils.*; |
| | | import com.sandu.ximon.admin.vo.EquipmentInfomation; |
| | | import com.sandu.ximon.admin.vo.RedisDeviceStatus; |
| | | import com.sandu.ximon.dao.bo.C3ChargingBo; |
| | | import com.sandu.ximon.dao.domain.*; |
| | | import com.sandu.ximon.dao.enums.OrderByEnums; |
| | |
| | | private final C3mChargingChargeService c3mChargingChargeService; |
| | | private final PoleBindingService bindingService; |
| | | private final PoleService poleService; |
| | | private final RedisUtils redisUtils; |
| | | |
| | | /** |
| | | * ä¿å䏿¥C3å
çµè®¾å¤å¿è·³æ°æ® |
| | |
| | | System.out.println("设置费çå¼å§"); |
| | | C3mCharging c3mCharging1 = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, mcuUdid).last("limit 1")); |
| | | List<C3mChargingCharge> list = c3mChargingChargeService.list(Wrappers.lambdaQuery(C3mChargingCharge.class).eq(C3mChargingCharge::getC3Id, c3mCharging1.getC3Id())); |
| | | if (list == null || list.size() == 0) {//è´¹çè¡¨ä¸æ²¡ææ¤å
çµæ¡©æ°æ®æ¶ æ·»å é»è®¤è´¹ç |
| | | if (list.size() == 0) {//è´¹çè¡¨ä¸æ²¡ææ¤å
çµæ¡©æ°æ®æ¶ æ·»å é»è®¤è´¹ç |
| | | c3mChargingChargeService.initCharge((c3mCharging1.getC3Id()).intValue()); |
| | | } |
| | | String rateState = setRate(newC3Mac, list, true); |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * åRedisä¸åå
¥è®¾å¤ç¶æ |
| | | */ |
| | | // public void setCacheData() { |
| | | // list().forEach( |
| | | // device -> { |
| | | // RedisDeviceStatus deviceStatus = new RedisDeviceStatus(); |
| | | // deviceStatus.setDeviceId(device.getC3Id().toString()); |
| | | // if (device != null) { |
| | | // A5C3HeartbeatReportInnerFrame.HeartBeatDataPackage beatDataPackage = ReadTheHeartbeatPackage(device.getC3Id(), false); |
| | | // if (beatDataPackage != null) { |
| | | // //å¨çº¿ç¶æ 1.ç©ºé² 2.å
çµä¸ 3.å
çµä¸æï¼çå¾
æå¡å¨ç¡®è®¤ 4.å
çµç»æï¼çå¾
æå¡å¨ç¡®è®¤ 5.ææ
é 6.ä¸å
çµæ¡©å¯¹æ¥ä¸ |
| | | // if (Integer.valueOf(beatDataPackage.getStatusBit()) == 5) { |
| | | // deviceStatus.setStatus(2); |
| | | // } else { |
| | | // deviceStatus.setStatus(0); |
| | | // } |
| | | // |
| | | // } else { |
| | | // deviceStatus.setStatus(1); |
| | | // } |
| | | // } |
| | | // redisUtils.set(DeviceRedisKey.C3M + device.getC3Id(), JSON.toJSONString(deviceStatus)); |
| | | //// redisUtils.delete(DeviceRedisKey.C3M + device.getC3Id()); |
| | | // } |
| | | // ); |
| | | // |
| | | // } |
| | | } |
| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.sandu.common.domain.CommonPage; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5C3ErrorCodeReportInnerFrame; |
| | |
| | | poles.forEach( |
| | | pole -> { |
| | | pole.setClientId(-1L); |
| | | pole.setUserId(-1L); |
| | | } |
| | | ); |
| | | |
| | | //å é¤ç¨æ·åéè¦èªå¨è§£ç»è¯¥ç¨æ·çè®¾å¤ |
| | | |
| | | //ç¯æidéå |
| | | List<Long> collect = poles.stream().map(p -> p.getId()).collect(Collectors.toList()); |
| | | List<Long> collect1 = poles.stream().map(Pole::getId).collect(Collectors.toList()); |
| | | //å é¤ç»å®å
³ç³» |
| | | SpringContextHolder.getBean(PoleBindingService.class) |
| | | .remove(Wrappers.lambdaQuery(PoleBinding.class) |
| | | .in(PoleBinding::getPoleId, collect)); |
| | | //æ´æ¹ç¯æå½å± |
| | | flag = SpringContextHolder.getBean(PoleService.class).updateBatchById(poles); |
| | | |
| | | |
| | | //å é¤å¤±è´¥åæ»æ°æ® |
| | | if (!flag) { |
| | | throw new BusinessException("å é¤ç¨æ·å¤±è´¥ï¼"); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.Executors; |
| | | |
| | | /** |
| | | * @author LiuHaoNan |
| | | * @date 2022/9/27 |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class DeviceStatusCountService implements Runnable { |
| | | |
| | | private final WaterQualityEquipmentService waterQualityEquipmentService; |
| | | private final AirEquipmentNongGengService airEquipmentNongGengService; |
| | | private final LightPoleHeelingService poleHeelingService; |
| | | private final AirEquipmentService airEquipmentService; |
| | | private final LedPlayerEntityService ledNovaService; |
| | | private final PoleLightemitService ledXixunService; |
| | | private final C3ChargingService c3ChargingService; |
| | | private final IpVolumeService ipVolumeService; |
| | | private final MonitorService monitorService; |
| | | private final LightService lightService; |
| | | |
| | | |
| | | @Override |
| | | public void run() { |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.sandu.common.domain.CommonPage; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.ximon.admin.dto.ErrorMsgDto; |
| | | import com.sandu.ximon.dao.bo.C3ReportErrorBo; |
| | |
| | | private final C3ChargingService c3ChargingService; |
| | | |
| | | |
| | | public List<ErrorMsgDto> listMsg(BaseConditionVO baseConditionVO) { |
| | | List<ErrorMsgDto> errorMsgDtos = new ArrayList<>(); |
| | | /** |
| | | * åç¯ |
| | | * |
| | | * @param baseConditionVO |
| | | * @return |
| | | */ |
| | | public CommonPage lightListMsg(BaseConditionVO baseConditionVO) { |
| | | List<ErrorMsgDto> errorMsgDtoList = new ArrayList<>(); |
| | | //åç¯æ
éæ°æ® |
| | | List<LightReportErrorBo> lightReportErrors = lightReportErrorService.queryErrorCode(baseConditionVO); |
| | | if (!lightReportErrors.isEmpty()) { |
| | | for (LightReportErrorBo lightReportError : lightReportErrors) { |
| | | CommonPage commonPage = lightReportErrorService.queryErrorCode(baseConditionVO); |
| | | if (!commonPage.getList().isEmpty()) { |
| | | for (LightReportErrorBo lightReportError : (List<LightReportErrorBo>) commonPage.getList()) { |
| | | ErrorMsgDto errorMsgDto = new ErrorMsgDto(); |
| | | errorMsgDto.setMac(lightReportError.getDeviceCode()); |
| | | errorMsgDto.setErrorCode(lightReportError.getErrorCode()); |
| | |
| | | errorMsgDto.setErrorTime(lightReportError.getCreateTime()); |
| | | errorMsgDto.setDeviceType(1); |
| | | Light one = lightService.getOne(Wrappers.lambdaQuery(Light.class).eq(Light::getDeviceCode, lightReportError.getDeviceCode())); |
| | | System.out.println(lightReportError.getDeviceCode() + " ---code "); |
| | | if (one != null) { |
| | | errorMsgDto.setDeviceJson(JSON.toJSONString(one)); |
| | | } else { |
| | | errorMsgDto.setDeviceJson("ç³»ç»æªæ¾å°è®¾å¤æ°æ®"); |
| | | } |
| | | errorMsgDtos.add(errorMsgDto); |
| | | errorMsgDtoList.add(errorMsgDto); |
| | | } |
| | | } |
| | | commonPage.setList(errorMsgDtoList); |
| | | return commonPage; |
| | | } |
| | | |
| | | /** |
| | | * å
çµæ¡© |
| | | * |
| | | * @param baseConditionVO |
| | | * @return |
| | | */ |
| | | public List<ErrorMsgDto> C3ListMsg(BaseConditionVO baseConditionVO) { |
| | | List<ErrorMsgDto> errorMsgDtoList = new ArrayList<>(); |
| | | //å
çµæ¡©æ
éæ°æ® |
| | | List<C3ReportErrorBo> c3ReportErrorBos = c3mReportErrorService.listReportError(baseConditionVO); |
| | | if (!c3ReportErrorBos.isEmpty()) { |
| | | c3ReportErrorBos.forEach(c3ReportError -> { |
| | | List<C3ReportErrorBo> list = c3ReportErrorBos; |
| | | list.forEach(c3ReportError -> { |
| | | ErrorMsgDto errorMsgDto = new ErrorMsgDto(); |
| | | errorMsgDto.setMac(c3ReportError.getC3Mac()); |
| | | errorMsgDto.setErrorDesc(c3ReportError.getErrorMsg()); |
| | |
| | | C3mCharging one = c3ChargingService.getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getC3Mac, c3ReportError.getC3Mac())); |
| | | if (one != null) { |
| | | errorMsgDto.setDeviceJson(JSON.toJSONString(one)); |
| | | }else { |
| | | errorMsgDto.setDeviceJson("ç³»ç»æªæ¾å°è®¾å¤æ°æ®"); |
| | | } |
| | | errorMsgDtos.add(errorMsgDto); |
| | | errorMsgDtoList.add(errorMsgDto); |
| | | }); |
| | | } |
| | | |
| | | //å¤§æ°æ
éæ°æ® todo ææ |
| | | |
| | | //对errorMsgDtosæå建æ¶é´åå |
| | | errorMsgDtos.sort((a, b) -> b.getErrorTime().compareTo(a.getErrorTime())); |
| | | //æå¨å页 baseConditionVO.getPageNo() å½å页 baseConditionVO.getPageSize() æ¯é¡µæ¡æ° |
| | | return errorMsgDtos.subList((baseConditionVO.getPageNo() - 1) * baseConditionVO.getPageSize(), baseConditionVO.getPageNo() * baseConditionVO.getPageSize()); |
| | | return errorMsgDtoList; |
| | | } |
| | | |
| | | /** |
| | | * å¤§æ° |
| | | * |
| | | * @param baseConditionVO |
| | | * @return |
| | | */ |
| | | public List<ErrorMsgDto> atmosphereListMsg(BaseConditionVO baseConditionVO) { |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.common.util.SpringContextHolder; |
| | | import com.sandu.ximon.admin.dto.TerminalDto; |
| | | import com.sandu.ximon.admin.param.BroadcastTerminalV2Param; |
| | | import com.sandu.ximon.admin.redis.DeviceRedisKey; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.utils.RedisUtils; |
| | | import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils; |
| | | import com.sandu.ximon.admin.utils.TerminalAPIUtils; |
| | | import com.sandu.ximon.admin.vo.EquipmentInfomation; |
| | | import com.sandu.ximon.admin.dto.TerminalDto; |
| | | import com.sandu.ximon.admin.vo.RedisDeviceStatus; |
| | | import com.sandu.ximon.dao.bo.BroadcastTerminalV2EntityBo; |
| | | import com.sandu.ximon.dao.domain.BroadcastTerminalV2Entity; |
| | | import com.sandu.ximon.dao.enums.AdministratorEnums; |
| | |
| | | |
| | | @Autowired |
| | | private IPBroadcastMapper broadcastTerminalV2EntityMapper; |
| | | @Autowired |
| | | private RedisUtils redisUtils; |
| | | |
| | | /** |
| | | * 忥ç»ç«¯ |
| | |
| | | */ |
| | | public List<BroadcastTerminalV2EntityBo> getBroadcastTerminalListOnHome() { |
| | | List<BroadcastTerminalV2EntityBo> broadcastTerminalV2EntityBos; |
| | | List<BroadcastTerminalV2EntityBo> broadcastTerminalV2EntityBos_final = new ArrayList<>(); |
| | | |
| | | if (SecurityUtils.getClientId() == null) { |
| | | broadcastTerminalV2EntityBos = broadcastTerminalV2EntityMapper.getBroadcastTerminalList(null, null, 2); |
| | |
| | | if (bean.getId().equals(terminalDto.getId())) { |
| | | bean.setStatus(terminalDto.getStatus()); |
| | | bean.setIp(terminalDto.getIp()); |
| | | bean.setVolumn(terminalDto.getVolumn()); |
| | | bean.setVolumn(terminalDto.getVolume()); |
| | | bean.setDefaultVolumn(terminalDto.getDefaultVolumn()); |
| | | bean.setPower(terminalDto.getPower()); |
| | | bean.setDefaultPower(terminalDto.getDefaultPower()); |
| | |
| | | */ |
| | | return flag; |
| | | } |
| | | |
| | | |
| | | public static Object getInfo() { |
| | | return TerminalAPIUtils.getTerminalInfo(25); |
| | | } |
| | | |
| | | /** |
| | | * åRedisä¸åå
¥è®¾å¤ç¶æ |
| | | */ |
| | | public void setCacheData() { |
| | | //æå¡å¨ææé³æ±ä¿¡æ¯ |
| | | List<TerminalDto> list = TerminalAPIUtils.getTerminalList(); |
| | | list.forEach( |
| | | device -> { |
| | | RedisDeviceStatus deviceStatus = new RedisDeviceStatus(); |
| | | deviceStatus.setDeviceId(device.getId().toString()); |
| | | if (device != null) { |
| | | //ç©ºé² 1ã å·¥ä½ä¸ 2 æè
4ã æçº¿ 0ï¼ æ¥ é 8 |
| | | switch (device.getStatus()) { |
| | | case 1: |
| | | case 2: |
| | | case 4: |
| | | deviceStatus.setStatus(0); |
| | | break; |
| | | case 0: |
| | | deviceStatus.setStatus(1); |
| | | break; |
| | | case 8: |
| | | deviceStatus.setStatus(0); |
| | | break; |
| | | default: |
| | | deviceStatus.setStatus(1); |
| | | |
| | | } |
| | | } |
| | | redisUtils.set(DeviceRedisKey.IP_BROADCAST + device.getId(), JSON.toJSONString(deviceStatus)); |
| | | // redisUtils.delete(DeviceRedisKey.IP_BROADCAST + device.getId()); |
| | | } |
| | | ); |
| | | |
| | | } |
| | | } |
| | |
| | | * @param seq |
| | | * @return |
| | | */ |
| | | public List<LedPlayerEntity> ledPlayerEntityList(BaseConditionVO baseConditionVO, String keyword, Integer order, Integer seq) { |
| | | public List<LedPlayerEntity> ledPlayerEntityList(BaseConditionVO baseConditionVO, String keyword, Integer order, Integer seq, Long groupId) { |
| | | //æåºå段 |
| | | String orderByResult = OrderByEnums.VNNOX_ID.getCode(); |
| | | //æ£åºãåå |
| | |
| | | List<LedPlayerEntity> list; |
| | | //è¶
管 |
| | | if (SecurityUtils.getClientId() == null) { |
| | | list = ledPlayerEntityMapper.ledPlayerEntityList(keyword, null); |
| | | list = ledPlayerEntityMapper.ledListByGroupId(keyword, null, groupId); |
| | | } else { |
| | | list = ledPlayerEntityMapper.ledPlayerEntityList(keyword, SecurityUtils.getUserId()); |
| | | list = ledPlayerEntityMapper.ledListByGroupId(keyword, SecurityUtils.getUserId(), groupId); |
| | | } |
| | | return SpringContextHolder.getBean(VnnoxService.class).setCacheInfo(vnnoxAPIUtil.syncCurrentInfo(list)); |
| | | } |
| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.sandu.common.domain.CommonPage; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.admin.manager.iot.frame.A5Frame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5C3QueryReportInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5LightErrorCodeReportInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5LightOperationReportInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.request.A5LightCleanErrorCodeInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.request.C3QueryAddressReqInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.dto.CommonFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.A5OrderEnum; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.LightErrorEnum; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.mainboard.MainBoardInvokeSyncService; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.utils.ListPagingUtils; |
| | | import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils; |
| | | import com.sandu.ximon.dao.bo.LightReportErrorBo; |
| | | import com.sandu.ximon.dao.domain.LightReportError; |
| | | import com.sandu.ximon.dao.mapper.LightReportErrorMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author chenjiantian |
| | | * @date 2021/12/17 17:47 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class LightReportErrorService extends BaseServiceImpl<LightReportErrorMapper, LightReportError> { |
| | | |
| | |
| | | LightReportError lightReportError = new LightReportError(); |
| | | lightReportError.setDeviceCode(deviceName); |
| | | lightReportError.setErrorCode(codeRespInnerFrame.getErrorCode()); |
| | | lightReportError.setLightAddress(codeRespInnerFrame.getDestinationAddress()); |
| | | save(lightReportError); |
| | | } |
| | | |
| | |
| | | * |
| | | * @return |
| | | */ |
| | | public List<LightReportErrorBo> queryErrorCode(BaseConditionVO baseConditionVO) { |
| | | |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | public CommonPage queryErrorCode(BaseConditionVO baseConditionVO) { |
| | | List<LightReportErrorBo> lightReportErrorBos = baseMapper.listError(SecurityUtils.getClientId()); |
| | | for (LightReportErrorBo lightReportErrorBo : lightReportErrorBos) { |
| | | lightReportErrorBos = lightReportErrorBos.stream().filter(bean -> bean.getErrorCode() != 0).collect(Collectors.toList()); |
| | | CommonPage commonPage = ListPagingUtils.pages(lightReportErrorBos, baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | |
| | | for (LightReportErrorBo lightReportErrorBo : (List<LightReportErrorBo>) commonPage.getList()) { |
| | | Integer errorCode = lightReportErrorBo.getErrorCode(); |
| | | StringBuilder sb = new StringBuilder(); |
| | | LightErrorEnum[] values = LightErrorEnum.values(); |
| | |
| | | } |
| | | lightReportErrorBo.setErrorMsg(sb.toString()); |
| | | } |
| | | return lightReportErrorBos; |
| | | return commonPage; |
| | | } |
| | | |
| | | /** |
| | | * æ¸
餿
éç |
| | | * |
| | | * @param deviceName |
| | | * @param address |
| | | */ |
| | | public void cleanErrorCode(String deviceName, String address) { |
| | | A5LightCleanErrorCodeInnerFrame a5LightCleanErrorCodeInnerFram = new A5LightCleanErrorCodeInnerFrame(address); |
| | | |
| | | A5Frame a5Frame = new A5Frame(A5OrderEnum.REQUEST_LIGHT_DATA.getCode(), a5LightCleanErrorCodeInnerFram); |
| | | System.out.println(a5Frame + " -----a5Frame"); |
| | | |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(deviceName, a5Frame); |
| | | StoreOperationRecordsUtils.storeInnerFrameData(deviceName, "åç¯å¸§-åç¯æ
鿏
é¤", a5Frame, commonFrame); |
| | | |
| | | System.out.println(commonFrame + " -----commonFrame"); |
| | | A5LightOperationReportInnerFrame operationReportInnerFrame = new A5LightOperationReportInnerFrame().transformFrame(commonFrame.getPayload()); |
| | | if (operationReportInnerFrame.isValidate()) { |
| | | log.error("æ¸
餿
éç æåï¼codeï¼" + deviceName + "ï¼ç¯å¤´å°åï¼" + address); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.util.HexUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.aliyuncs.iot.model.v20180120.BatchGetDeviceStateResponse; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | |
| | | import com.sandu.ximon.admin.dto.LightTaskDto; |
| | | import com.sandu.ximon.admin.manager.iot.frame.A5Frame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5LightHeartbeatReportInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5LightOperationReportInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.request.A5LightBrightnessReqInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.request.A5LightSetCalendarReqInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.response.A5LightBrightnessRespInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.dto.CommonFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.dto.WrapResponseCommonFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.A5OrderEnum; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.mainboard.MainBoardInvokeSyncService; |
| | | import com.sandu.ximon.admin.param.LightControlParam; |
| | | import com.sandu.ximon.admin.param.LightPowerSettingParam; |
| | | import com.sandu.ximon.admin.param.LightRemarkParam; |
| | | import com.sandu.ximon.admin.redis.DeviceRedisKey; |
| | | import com.sandu.ximon.admin.redis.LightKey; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.utils.RedisUtils; |
| | | import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils; |
| | | import com.sandu.ximon.admin.vo.ControlLightCommandVO; |
| | | import com.sandu.ximon.admin.vo.EquipmentInfomation; |
| | | import com.sandu.ximon.admin.vo.RedisDeviceStatus; |
| | | import com.sandu.ximon.dao.bo.LightBo; |
| | | import com.sandu.ximon.dao.bo.PoleTaskLightPowerBo; |
| | | import com.sandu.ximon.dao.domain.Light; |
| | | import com.sandu.ximon.dao.domain.LightReportData; |
| | | import com.sandu.ximon.dao.domain.Pole; |
| | | import com.sandu.ximon.dao.domain.PoleBinding; |
| | | import com.sandu.ximon.dao.domain.*; |
| | | import com.sandu.ximon.dao.enums.DeviceRespStatusEnums; |
| | | import com.sandu.ximon.dao.enums.OrderByEnums; |
| | | import com.sandu.ximon.dao.mapper.LightMapper; |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | private final LightReportDataService lightReportDataService; |
| | | private final PoleBindingService bindingService; |
| | | private final PoleService poleService; |
| | | private final RedisUtils redisUtils; |
| | | |
| | | /** |
| | | * å½å
¥å½å设å¤ç çè·¯ç¯æ°æ® |
| | |
| | | */ |
| | | public Light getLight(String deviceCode) { |
| | | Light one = getOne(Wrappers.<Light>lambdaQuery().eq(Light::getDeviceCode, deviceCode)); |
| | | Object o = redisService.get(LightKey.REPORT_MAC.key(deviceCode)); |
| | | if (o != null) { |
| | | one.setOnlineStatus(1); |
| | | if (one == null) { |
| | | return null; |
| | | } else { |
| | | one.setOnlineStatus(0); |
| | | Object o = redisService.get(LightKey.REPORT_MAC.key(deviceCode)); |
| | | if (o != null) { |
| | | one.setOnlineStatus(1); |
| | | } else { |
| | | one.setOnlineStatus(0); |
| | | } |
| | | return one; |
| | | } |
| | | return one; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | |
| | | return resultList; |
| | | } |
| | | |
| | | /** |
| | | * åç¯èè½ç |
| | | * |
| | | * @return |
| | | */ |
| | | public List controlEnergySaving() { |
| | | //è·åå°æ£å¨æ§è¡çä»»å¡å表 |
| | | List<LightTaskDto> lightTaskDtos = SpringContextHolder.getBean(LightTaskService.class).listTask(); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | |
| | | List<LightTaskDto> list1 = new ArrayList<>(); |
| | | List<LightTaskDto> list2 = new ArrayList<>(); |
| | | List<LightTaskDto> list3 = new ArrayList<>(); |
| | | List<LightTaskDto> list4 = new ArrayList<>(); |
| | | List<LightTaskDto> list5 = new ArrayList<>(); |
| | | List<LightTaskDto> list6 = new ArrayList<>(); |
| | | List<LightTaskDto> list7 = new ArrayList<>(); |
| | | |
| | | for (LightTaskDto lightTaskDto : lightTaskDtos) { |
| | | List<Integer> weekList = lightTaskDto.getWeekList(); |
| | | for (Integer one : weekList) { |
| | | switch (one) { |
| | | case 1: |
| | | list1.add(lightTaskDto); |
| | | break; |
| | | case 2: |
| | | list2.add(lightTaskDto); |
| | | break; |
| | | case 4: |
| | | list3.add(lightTaskDto); |
| | | break; |
| | | case 8: |
| | | list4.add(lightTaskDto); |
| | | break; |
| | | case 16: |
| | | list5.add(lightTaskDto); |
| | | break; |
| | | case 32: |
| | | list6.add(lightTaskDto); |
| | | break; |
| | | case 64: |
| | | list7.add(lightTaskDto); |
| | | break; |
| | | default: |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //è·åå½åææå 1-7 |
| | | |
| | | int currentWeekValue = now.getDayOfWeek().getValue(); |
| | | Map map; |
| | | List<Map> temp = new ArrayList<>(); |
| | | //è·åæ¥æ 精确å°å¤© |
| | | LocalDateTime localDateTime = now.with(LocalTime.MIN); |
| | | |
| | | |
| | | for (int i = 1; i < 8; i++) { |
| | | currentWeekValue--; |
| | | if (currentWeekValue < 1) { |
| | | currentWeekValue = 7; |
| | | } |
| | | map = new LinkedHashMap(); |
| | | map.put("time", localDateTime.minusDays(i).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| | | map.put("value", getlist(currentWeekValue)); |
| | | temp.add(map); |
| | | } |
| | | |
| | | |
| | | return temp; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * åç¯è½è |
| | | * |
| | | * @return |
| | | */ |
| | | public List controlEnergy() { |
| | | //è·åå°æ£å¨æ§è¡çä»»å¡å表 |
| | | List<LightTaskDto> lightTaskDtos = SpringContextHolder.getBean(LightTaskService.class).listTask(); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | |
| | | List<LightTaskDto> list1 = new ArrayList<>(); |
| | | List<LightTaskDto> list2 = new ArrayList<>(); |
| | | List<LightTaskDto> list3 = new ArrayList<>(); |
| | | List<LightTaskDto> list4 = new ArrayList<>(); |
| | | List<LightTaskDto> list5 = new ArrayList<>(); |
| | | List<LightTaskDto> list6 = new ArrayList<>(); |
| | | List<LightTaskDto> list7 = new ArrayList<>(); |
| | | |
| | | for (LightTaskDto lightTaskDto : lightTaskDtos) { |
| | | List<Integer> weekList = lightTaskDto.getWeekList(); |
| | | System.out.println(weekList + "==========================="); |
| | | for (Integer one : weekList) { |
| | | switch (one) { |
| | | case 1: |
| | | list1.add(lightTaskDto); |
| | | break; |
| | | case 2: |
| | | list2.add(lightTaskDto); |
| | | break; |
| | | case 4: |
| | | list3.add(lightTaskDto); |
| | | break; |
| | | case 8: |
| | | list4.add(lightTaskDto); |
| | | break; |
| | | case 16: |
| | | list5.add(lightTaskDto); |
| | | break; |
| | | case 32: |
| | | list6.add(lightTaskDto); |
| | | break; |
| | | case 64: |
| | | list7.add(lightTaskDto); |
| | | break; |
| | | default: |
| | | } |
| | | } |
| | | } |
| | | |
| | | Integer currentWeekValue = now.getDayOfWeek().getValue(); |
| | | Map map; |
| | | List<Map> temp = new ArrayList<>(); |
| | | //è·åå½åæ¥æ æ ¼å¼ä¸ºyyyy-MM-dd |
| | | LocalDateTime localDateTime = now.with(LocalTime.MIN); |
| | | |
| | | |
| | | for (int i = 1; i < 8; i++) { |
| | | currentWeekValue--; |
| | | if (currentWeekValue < 1) { |
| | | currentWeekValue = 7; |
| | | } |
| | | map = new LinkedHashMap(); |
| | | map.put("time", localDateTime.minusDays(i).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| | | map.put("value", getlistEnergy(currentWeekValue)); |
| | | temp.add(map); |
| | | } |
| | | |
| | | |
| | | return temp; |
| | | } |
| | | |
| | | |
| | |
| | | * |
| | | * @return |
| | | */ |
| | | public BigDecimal jisuan(LightTaskDto Task) { |
| | | public BigDecimal jisuan(LightTaskDto Task, LightTaskPoleRelation bean) { |
| | | final BigDecimal[] bigDecimalResult = {new BigDecimal(0.00)}; |
| | | /** |
| | | * èè½ç计ç®å¼å§ |
| | |
| | | * ä¸å¤©çè½è |
| | | * |
| | | * @param |
| | | * @param bean |
| | | * @return |
| | | */ |
| | | public BigDecimal jisuanEnergy(LightTaskDto Task) { |
| | | public BigDecimal jisuanEnergy(LightTaskDto Task, LightTaskPoleRelation bean) { |
| | | //åæ¾è½è |
| | | final BigDecimal[] bigEnergy = {new BigDecimal(0.00)}; |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * èè½ç计ç®å¼å§ |
| | | * è½è计ç®å¼å§ |
| | | */ |
| | | List<PoleTaskLightPowerBo> poleTaskLightPowerBos = SpringContextHolder.getBean(LightTaskMapper.class).listLightTaskByTaskId(Task.getTaskId()); |
| | | // List<PoleTaskLightPowerBo> poleTaskLightPowerBos = SpringContextHolder.getBean(LightTaskMapper.class).listLightTaskByTaskId(Task.getTaskId()); |
| | | List<PoleTaskLightPowerBo> poleTaskLightPowerBos = new ArrayList<>(); |
| | | PoleTaskLightPowerBo poleTaskLightPowerBo = new PoleTaskLightPowerBo(); |
| | | Light one = getOne(Wrappers.lambdaQuery(Light.class).eq(Light::getDeviceCode, bean.getDeviceCode())); |
| | | |
| | | if (one != null) { |
| | | if ("0001".equals(bean.getLightAddress())) { |
| | | poleTaskLightPowerBo.setPower1(one.getPower1()); |
| | | } else { |
| | | poleTaskLightPowerBo.setPower2(one.getPower2()); |
| | | } |
| | | } |
| | | poleTaskLightPowerBos.add(poleTaskLightPowerBo); |
| | | ControlLightCommandVO startTime = parseSwitchLightCommand(Task.getOpenOrder()); |
| | | ControlLightCommandVO endTime = parseSwitchLightCommand(Task.getCloseOrder()); |
| | | //è·åå°åç¯ä»»å¡çèè½ç |
| | |
| | | /** |
| | | * è·åç¨æ·ææç设å¤ç |
| | | */ |
| | | public CommonPage<String> listDeviceCode(int pageNo, int pageSize, String keyword, String deviceCode,String orderBy) { |
| | | public CommonPage<String> listDeviceCode(int pageNo, int pageSize, String keyword, String deviceCode, String orderBy) { |
| | | List<String> list; |
| | | if (SecurityUtils.getClientId() != null) { |
| | | PageHelper.startPage(pageNo, pageSize); |
| | | list = baseMapper.listCode(SecurityUtils.getUserId(), keyword, deviceCode); |
| | | } else { |
| | | |
| | | PageHelper.startPage(pageNo, pageSize,orderBy); |
| | | PageHelper.startPage(pageNo, pageSize, orderBy); |
| | | list = baseMapper.listCode(null, keyword, deviceCode); |
| | | } |
| | | |
| | |
| | | }); |
| | | return updateBatchById(lights); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * åRedisä¸åå
¥è®¾å¤ç¶æ |
| | | */ |
| | | public void setCacheData() { |
| | | |
| | | List<String> collect = list().stream().map(Light::getDeviceCode).collect(Collectors.toList()); |
| | | // collect.forEach( |
| | | // code -> { |
| | | // redisUtils.delete(DeviceRedisKey.LIGHT_DEVICE + code); |
| | | // } |
| | | // ); |
| | | List<List<String>> split = CollectionUtil.split(collect, 100); |
| | | |
| | | List<BatchGetDeviceStateResponse.DeviceStatus> deviceStatuses = new ArrayList<>(); |
| | | List<RedisDeviceStatus> statusList = new ArrayList<>(); |
| | | for (List<String> splist : split) { |
| | | deviceStatuses = MainBoardInvokeSyncService.getInstance().batchGetDeviceState(splist); |
| | | if (deviceStatuses != null) { |
| | | for (BatchGetDeviceStateResponse.DeviceStatus deviceStatus : deviceStatuses) { |
| | | RedisDeviceStatus device = new RedisDeviceStatus(); |
| | | device.setDeviceId(deviceStatus.getDeviceName()); |
| | | if ("ONLINE".equals(deviceStatus.getStatus())) { |
| | | device.setStatus(0); |
| | | } else if ("OFFLINE".equals(deviceStatus.getStatus())) { |
| | | device.setStatus(1); |
| | | } else if ("UNACTIVE".equals(deviceStatus.getStatus())) { |
| | | device.setStatus(0); |
| | | } else if ("DISABLE".equals(deviceStatus.getStatus())) { |
| | | device.setStatus(0); |
| | | } else { |
| | | device.setStatus(2); |
| | | } |
| | | statusList.add(device); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | statusList.forEach(status -> { |
| | | redisUtils.set(DeviceRedisKey.LIGHT_DEVICE + status.getDeviceId(), JSON.toJSONString(status)); |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置æ¥åï¼åå¿è·³å
ä¸ç6åèæ¥ææ¶é´ï¼ |
| | | * |
| | | * @return |
| | | */ |
| | | public String SetCalendar(Long lightId, String address) { |
| | | Calendar cal = Calendar.getInstance(); |
| | | //è·åå½åæ¶é´ |
| | | int year = cal.get(Calendar.YEAR); |
| | | int month = cal.get(Calendar.MONTH); |
| | | int day = cal.get(Calendar.DATE); |
| | | int hour = cal.get(Calendar.HOUR_OF_DAY); |
| | | int min = cal.get(Calendar.MINUTE); |
| | | int sec = cal.get(Calendar.SECOND); |
| | | |
| | | if (!"0001".equals(address) && !"0002".equals(address)) { |
| | | throw new BusinessException("ç¯å¤´å°åé误ï¼"); |
| | | } |
| | | |
| | | Light one = getById(lightId); |
| | | if (one == null) { |
| | | System.out.println("åç¯ä¸åå¨ï¼"); |
| | | } |
| | | |
| | | A5LightSetCalendarReqInnerFrame setCalendarReqInnerFrame = |
| | | new A5LightSetCalendarReqInnerFrame(address, year % 100, month + 1, day, hour, min, sec); |
| | | |
| | | A5Frame a5Frame = new A5Frame(A5OrderEnum.REQUEST_LIGHT_DATA.getCode(), setCalendarReqInnerFrame); |
| | | System.out.println(a5Frame + " -----a5Frame"); |
| | | |
| | | CommonFrame commonFrame; |
| | | |
| | | commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(one.getDeviceCode(), a5Frame); |
| | | StoreOperationRecordsUtils.storeInnerFrameData(one.getDeviceCode(), "åç¯å¸§-设置æ¥å", a5Frame, commonFrame); |
| | | |
| | | System.out.println(commonFrame + " -----commonFrame"); |
| | | |
| | | A5LightOperationReportInnerFrame operationReportInnerFrame = new A5LightOperationReportInnerFrame().transformFrame(commonFrame.getPayload()); |
| | | if (operationReportInnerFrame.isValidate()) { |
| | | return operationReportInnerFrame.getState(); |
| | | } else { |
| | | throw new BusinessException("æ°æ®æ ¡éªé误ï¼è¯·éæ°è¯·æ±"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * åç¯ä¸»å¨åæ¥æ¶é´è¯·æ± |
| | | */ |
| | | public void timeSynchronizationInitiative(String deviceCode, String lightAddress) { |
| | | //åç¯ä¿¡æ¯ |
| | | Light light = getLight(deviceCode); |
| | | if (light == null) { |
| | | log.error("åç¯ä¸»å¨åæ¥æ¶é´è¯·æ±å¼å¸¸ï¼åç¯ä¿¡æ¯ä¸åå¨ï¼"); |
| | | return; |
| | | } |
| | | //åç¯ä»»å¡ä¿¡æ¯ |
| | | LightTaskPoleRelation lightTaskPoleRelation = SpringContextHolder.getBean(LightTaskPoleRelationService.class) |
| | | .getOne(Wrappers.lambdaQuery(LightTaskPoleRelation.class) |
| | | .eq(LightTaskPoleRelation::getDeviceCode, deviceCode).eq(LightTaskPoleRelation::getLightAddress, lightAddress)); |
| | | |
| | | LightTask lightTask = null; |
| | | //ç¯å¤´æ²¡æä»»å¡ |
| | | if (lightTaskPoleRelation != null) { |
| | | if (lightTaskPoleRelation.getDeviceScheduled() != null) { |
| | | lightTask = JSONObject.parseObject(lightTaskPoleRelation.getDeviceScheduled(), LightTask.class); |
| | | } |
| | | } |
| | | |
| | | timeSynchronization(light, lightAddress, lightTask); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * åç¯æ¶é´åæ¥ |
| | | * |
| | | * @param light åç¯ä¿¡æ¯å®ä½ |
| | | * @param lightTask åç¯ä»»å¡å®ä½ï¼ä¸ºç©ºæ è¯åç¯æ²¡æå®æ¶ä»»å¡ï¼ |
| | | */ |
| | | public void timeSynchronization(Light light, String lightAddress, LightTask lightTask) { |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | //è·åå½åæ¶é´æ¶ãå |
| | | Calendar cal = Calendar.getInstance(); |
| | | |
| | | if (lightTask != null) { |
| | | String closeOrder = lightTask.getCloseOrder(); |
| | | String openOrder = lightTask.getOpenOrder(); |
| | | String controlOrder = lightTask.getControlOrder() == null ? null : lightTask.getControlOrder(); |
| | | |
| | | List<String> timeList = new ArrayList<>(); |
| | | timeList.add(openOrder.substring(0, 4)); |
| | | timeList.add(closeOrder.substring(0, 4)); |
| | | if (controlOrder != null && controlOrder.length() % 7 == 0) { |
| | | for (int i = 0; i < controlOrder.length() / 7; i++) { |
| | | timeList.add(controlOrder.substring(i * 7, i * 7 + 4)); |
| | | } |
| | | } else { |
| | | log.error("æ§ç¯æä»¤ä¸æ£ç¡®ï¼æ°æ®é¿åº¦ä¸ä¸º7çåæ°ï¼"); |
| | | return; |
| | | } |
| | | //æ¶é´æåº |
| | | timeList = timeList.stream().sorted().collect(Collectors.toList()); |
| | | |
| | | int count = 0; |
| | | boolean haveTime = false; |
| | | |
| | | while (!haveTime && count <= 144) { |
| | | haveTime = judgeTime(cal, timeList); |
| | | cal.add(Calendar.MINUTE, 10); |
| | | count++; |
| | | } |
| | | if (haveTime) { |
| | | try { |
| | | long longTime = cal.getTimeInMillis() - System.currentTimeMillis(); |
| | | log.error("ç¡ç æ¶é´ï¼æ¯«ç§ï¼ï¼" + longTime); |
| | | Thread.sleep(longTime); |
| | | SetCalendar(light.getLightId(), lightAddress); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } else { |
| | | log.error("ç¯æID为ï¼" + light.getLightId() + "ï¼ç¯å¤´å°å为ï¼" + lightAddress + "æ²¡ææ¾å°å¯åæ¥çæ¶é´ï¼è¯·æ£æ¥ä»»å¡ï¼"); |
| | | } |
| | | |
| | | } else { |
| | | SetCalendar(light.getLightId(), lightAddress); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | |
| | | /** |
| | | * 夿æ¶é´æ¯å¦å¯ä»¥æ§è¡åæ¥æä»¤ |
| | | * |
| | | * @param time |
| | | * @param timeList |
| | | * @return true å¯ä»¥æ§è¡ ,false ä¸å¯æ§è¡ |
| | | */ |
| | | private boolean judgeTime(Calendar time, List<String> timeList) { |
| | | int hour = time.get(Calendar.HOUR_OF_DAY); |
| | | int min = time.get(Calendar.MINUTE); |
| | | int allMin = hour * 60 + min; |
| | | for (String value : timeList) { |
| | | int targetHour = Integer.valueOf(value.substring(0, 2)); |
| | | int targetMin = Integer.valueOf(value.substring(2, 4)); |
| | | int allTargetMin = targetHour * 60 + targetMin; |
| | | if (allMin >= allTargetMin - 10 && allMin <= allTargetMin + 10) { |
| | | return false; |
| | | } else { |
| | | continue; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | } |
| | |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.collection.ListUtil; |
| | | import cn.hutool.core.map.MapUtil; |
| | | import cn.hutool.core.util.ArrayUtil; |
| | | import cn.hutool.core.util.HexUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.druid.support.json.JSONUtils; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.Page; |
| | |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils; |
| | | import com.sandu.ximon.admin.utils.TaskOrderUtil; |
| | | import com.sandu.ximon.dao.bo.LightTaskPoleRelationBo; |
| | | import com.sandu.ximon.dao.bo.LightTaskStatusAndPole; |
| | | import com.sandu.ximon.admin.vo.LightTaskInfoVO; |
| | | import com.sandu.ximon.admin.vo.LightTaskRelationVO; |
| | | import com.sandu.ximon.admin.vo.LightTaskVO; |
| | | import com.sandu.ximon.dao.domain.LightEnergyData; |
| | | import com.sandu.ximon.dao.domain.LightTask; |
| | | import com.sandu.ximon.dao.domain.LightTaskPoleRelation; |
| | |
| | | import com.sandu.ximon.dao.enums.DeviceRespStatusEnums; |
| | | import com.sandu.ximon.dao.enums.OrderByEnums; |
| | | import com.sandu.ximon.dao.mapper.LightTaskMapper; |
| | | import com.sandu.ximon.dao.mapper.LightTaskPoleRelationMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | if (!"0001".equals(param.getLightAddress()) && !"0002".equals(param.getLightAddress())) { |
| | | throw new BusinessException("ç¯å¤´å°åæ ¼å¼ä¸æ£ç¡®"); |
| | | } |
| | | // LightTask lightTask = getById(null); |
| | | |
| | | |
| | | int week = 0; |
| | |
| | | LightTask newLightTask = new LightTask(); |
| | | newLightTask.setTaskName(param.getTaskName()); |
| | | |
| | | newLightTask.setClientId(clientService.getClientId()); |
| | | newLightTask.setClientId(clientService.getClientId(SecurityUtils.getUserId())); |
| | | newLightTask.setUserId(SecurityUtils.getUserId()); |
| | | |
| | | newLightTask.setWeek(week); |
| | |
| | | newPoleMap.forEach( |
| | | commend -> { |
| | | //å¼å
³ç¯æ¶é´ |
| | | // String s = newLightTask.getOpenOrder() + newLightTask.getCloseOrder(); |
| | | // if (newLightTask.getControlOrder() != null) { |
| | | // //æ§ç¯æ¶é´ |
| | | // s = s + newLightTask.getControlOrder(); |
| | | // } |
| | | // // æ´æ°ç³»ç»å®æ¶ |
| | | // commend.setSysScheduled(s); |
| | | commend.setSysScheduled(JSON.toJSONString(newLightTask)); |
| | | System.out.println(commend.getIssueStatus() + "ç¶æ"); |
| | | if (commend.getIssueStatus() == 0) { |
| | | //ä¸åæå æ´æ°ç³»ç»å®æ¶åç¡¬ä»¶å®æ¶ |
| | | commend.setDeviceScheduled(JSONObject.toJSONString(newLightTask)); |
| | | commend.setDeviceScheduled(JSON.toJSONString(newLightTask)); |
| | | } else { |
| | | //ä¸å失败 æ´æ°ç³»ç»å®æ¶ ä¿çç¡¬ä»¶å®æ¶ ç¡¬ä»¶å®æ¶ |
| | | // commend.setSysScheduled(s); |
| | | oldLightTaskStatusAndPoles.forEach(task -> { |
| | | if (task.getLightAddress().equals(commend.getLightAddress()) && task.getDeviceCode().equals(commend.getDeviceCode())) { |
| | | //åä¸ä¸ªç¯å¤´ |
| | | LightTask oldTask = getById(task.getTaskId()); |
| | | commend.setDeviceScheduled(JSONObject.toJSONString(oldTask)); |
| | | commend.setDeviceScheduled(task.getDeviceScheduled()); |
| | | } |
| | | }); |
| | | |
| | |
| | | |
| | | //å 餿§çå
³ç³» |
| | | lightTaskPoleRelationService.remove(Wrappers.lambdaQuery(LightTaskPoleRelation.class) |
| | | .eq(LightTaskPoleRelation::getLightAddress, newLightTask.getLightAdress()).in(LightTaskPoleRelation::getPoleId, poleIdList)); |
| | | .in(LightTaskPoleRelation::getPoleId, poleIdList).eq(LightTaskPoleRelation::getLightAddress, newLightTask.getLightAdress())); |
| | | |
| | | boolean b = true; |
| | | //ä¿åä»»å¡å
³ç³» |
| | |
| | | if (StrUtil.length(param.getControlOrder()) % LightTaskParam.REQUEST_ORDER_LENGTH != 0) { |
| | | throw new BusinessException("ç¯æ§å½ä»¤æ ¼å¼ä¸æ£ç¡®"); |
| | | } |
| | | if (!"0001".equals(param.getLightAddress()) && !"0002".equals(param.getLightAddress())) { |
| | | throw new BusinessException("ç¯å¤´å°åæ ¼å¼ä¸æ£ç¡®"); |
| | | } |
| | | LightTask newLightTask = getById(taskId); |
| | | if (newLightTask == null) { |
| | | throw new BusinessException("æ¾ä¸å°è·¯ç¯ä»»å¡"); |
| | |
| | | week |= w; |
| | | } |
| | | |
| | | // LightTask newLightTask = new LightTask(); |
| | | newLightTask.setTaskName(param.getTaskName()); |
| | | |
| | | newLightTask.setClientId(clientService.getClientId()); |
| | | newLightTask.setClientId(clientService.getClientId(SecurityUtils.getUserId())); |
| | | newLightTask.setUserId(SecurityUtils.getUserId()); |
| | | |
| | | newLightTask.setWeek(week); |
| | |
| | | all.addAll(newPoleFail); |
| | | all.addAll(oldPoleSuccess); |
| | | all.addAll(oldPoleFail); |
| | | all.addAll(closePoleSuccess); |
| | | all.addAll(closePoleFail); |
| | | |
| | | |
| | | if (closePoleFail.size() != 0) { |
| | | List<LightTaskPoleRelation> colesFail = new ArrayList<>(); |
| | | //忥任å¡ä¸æ¬èº«å°±ä¸å失败çä»»å¡ å³ç¡¬ä»¶å®æ¶ä¸ºç©º ç¼è¾åè¿è¡å
³ç¯æä½ å¯ç´æ¥åé¤ä»»å¡å
³ç³» |
| | | closePoleFail.forEach( |
| | | close -> { |
| | | relations.forEach( |
| | | task -> { |
| | | System.out.println(task.getLightAddress().equals(close.getLightAddress()) + " addressResult"); |
| | | System.out.println(close.getLightAddress() + " close.getLightAddress()"); |
| | | if (task.getLightAddress().equals(close.getLightAddress()) && task.getDeviceCode().equals(close.getDeviceCode()) |
| | | && task.getDeviceScheduled() != null && !task.getDeviceScheduled().isEmpty()) { |
| | | colesFail.add(close); |
| | | } |
| | | } |
| | | ); |
| | | all.addAll(colesFail); |
| | | } |
| | | ); |
| | | |
| | | } |
| | | |
| | | |
| | | if (!all.isEmpty()) { |
| | | List<LightTaskPoleRelation> finalOldRelation = relations; |
| | | all.forEach( |
| | | commend -> { |
| | | commend.setTaskId(newLightTask.getTaskId()); |
| | | //å¼å
³ç¯æ¶é´ |
| | | String s = newLightTask.getOpenOrder() + newLightTask.getCloseOrder(); |
| | | if (newLightTask.getControlOrder() != null) { |
| | | //æ§ç¯æ¶é´ |
| | | s = s + newLightTask.getControlOrder(); |
| | | } |
| | | // æ´æ°ç³»ç»å®æ¶ |
| | | commend.setSysScheduled(s); |
| | | commend.setSysScheduled(JSON.toJSONString(newLightTask)); |
| | | commend.setTaskId(taskId); |
| | | // å
è®¾ç½®ç¡¬ä»¶å®æ¶ä¸ºä¸æ¬¡çç¡¬ä»¶å®æ¶ ä¸è®ºæå失败 |
| | | String finalS = s; |
| | | finalOldRelation.forEach(task -> { |
| | | if (task.getLightAddress().equals(commend.getLightAddress()) && task.getDeviceCode().equals(commend.getDeviceCode())) { |
| | | //åä¸ä¸ªç¯å¤´ |
| | | commend.setDeviceScheduled(task.getDeviceScheduled()); |
| | | if (commend.getIssueStatus() == 0) { |
| | | //ä¸åæå æ´æ°ç³»ç»å®æ¶åç¡¬ä»¶å®æ¶ |
| | | commend.setDeviceScheduled(finalS); |
| | | commend.setDeviceScheduled(JSON.toJSONString(newLightTask)); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | |
| | |
| | | |
| | | //ç¼è¾ååææçç¯æIDéå |
| | | poleIdList.addAll(oldList); |
| | | if (!poleIdList.isEmpty()) { |
| | | lightTaskPoleRelationService.remove(Wrappers.lambdaQuery(LightTaskPoleRelation.class).in(LightTaskPoleRelation::getPoleId, poleIdList)); |
| | | //å»é |
| | | List<Long> collect = poleIdList.stream().distinct().collect(Collectors.toList()); |
| | | if (!collect.isEmpty()) { |
| | | lightTaskPoleRelationService.remove(Wrappers.lambdaQuery(LightTaskPoleRelation.class) |
| | | .in(LightTaskPoleRelation::getPoleId, collect).eq(LightTaskPoleRelation::getLightAddress, newLightTask.getLightAdress())); |
| | | |
| | | } |
| | | |
| | | |
| | | if (!all.isEmpty()) { |
| | | b = lightTaskPoleRelationService.saveBatch(all); |
| | |
| | | lightTaskPoleRelation.setTaskId(lightTask.getTaskId()); |
| | | |
| | | // rrpc åç宿¶å½ä»¤ |
| | | // if ("FFFF".equals(lightAddress)) { |
| | | // LightTaskPoleRelation lightTaskPoleRelation01 = new LightTaskPoleRelation(); |
| | | // lightTaskPoleRelation01.setPoleId(pole.getId()); |
| | | // lightTaskPoleRelation01.setTaskId(lightTask.getTaskId()); |
| | | // lightTaskPoleRelation01.setLightAddress("0001"); |
| | | // |
| | | // LightTaskPoleRelation lightTaskPoleRelation02 = new LightTaskPoleRelation(); |
| | | // lightTaskPoleRelation02.setPoleId(pole.getId()); |
| | | // lightTaskPoleRelation02.setTaskId(lightTask.getTaskId()); |
| | | // lightTaskPoleRelation02.setLightAddress("0002"); |
| | | // |
| | | // // ç¯å¤´1 rrpc åç宿¶å½ä»¤ |
| | | // try { |
| | | // A5LightTimerRespInnerFrame a5LightTimerRespInnerFrame01 = sendTimeRRpc(framePayload, pole.getDeviceCode(), "0001"); |
| | | // //ç¯å¤´1 |
| | | // if (a5LightTimerRespInnerFrame01 == null) { |
| | | // lightTaskPoleRelation01.setIssueStatus(DeviceRespStatusEnums.OTHER_ERROR.getCode()); |
| | | // } else { |
| | | // lightTaskPoleRelation01.setIssueStatus(HexUtil.hexToInt(a5LightTimerRespInnerFrame01.getResponseStatus())); |
| | | // } |
| | | // |
| | | // } catch (BusinessException e) { |
| | | // lightTaskPoleRelation01.setIssueStatus(DeviceRespStatusEnums.OTHER_ERROR.getCode()); |
| | | // } |
| | | // |
| | | // // ç¯å¤´2 rrpc åç宿¶å½ä»¤ |
| | | // try { |
| | | // A5LightTimerRespInnerFrame a5LightTimerRespInnerFrame02 = sendTimeRRpc(framePayload, pole.getDeviceCode(), "0002"); |
| | | // //ç¯å¤´2 |
| | | // if (a5LightTimerRespInnerFrame02 == null) { |
| | | // lightTaskPoleRelation02.setIssueStatus(DeviceRespStatusEnums.OTHER_ERROR.getCode()); |
| | | // } else { |
| | | // lightTaskPoleRelation02.setIssueStatus(HexUtil.hexToInt(a5LightTimerRespInnerFrame02.getResponseStatus())); |
| | | // } |
| | | // |
| | | // } catch (BusinessException e) { |
| | | // lightTaskPoleRelation02.setIssueStatus(DeviceRespStatusEnums.OTHER_ERROR.getCode()); |
| | | // } |
| | | // |
| | | // lightTaskPoleRelationList.add(lightTaskPoleRelation01); |
| | | // lightTaskPoleRelationList.add(lightTaskPoleRelation02); |
| | | // } else { |
| | | lightTaskPoleRelation.setDeviceCode(pole.getDeviceCode()); |
| | | lightTaskPoleRelation.setLightAddress(lightAddress); |
| | | // rrpc åç宿¶å½ä»¤ |
| | |
| | | |
| | | |
| | | // rrpc åç宿¶å½ä»¤ |
| | | // if ("FFFF".equals(lightAddress)) { |
| | | // LightTaskPoleRelation lightTaskPoleRelation01 = new LightTaskPoleRelation(); |
| | | // lightTaskPoleRelation01.setPoleId(pole.getId()); |
| | | // lightTaskPoleRelation01.setLightAddress("0001"); |
| | | // |
| | | // LightTaskPoleRelation lightTaskPoleRelation02 = new LightTaskPoleRelation(); |
| | | // lightTaskPoleRelation02.setPoleId(pole.getId()); |
| | | // lightTaskPoleRelation02.setLightAddress("0002"); |
| | | // |
| | | // // ç¯å¤´1 rrpc åç宿¶å½ä»¤ |
| | | // try { |
| | | // A5LightTimerRespInnerFrame a5LightTimerRespInnerFrame01 = sendTimeRRpc(framePayload, pole.getDeviceCode(), "0001"); |
| | | // //ç¯å¤´1 |
| | | // if (a5LightTimerRespInnerFrame01 == null) { |
| | | // lightTaskPoleRelation01.setIssueStatus(DeviceRespStatusEnums.OTHER_ERROR.getCode()); |
| | | // fail.add(lightTaskPoleRelation01); |
| | | // } else { |
| | | // lightTaskPoleRelation01.setIssueStatus(HexUtil.hexToInt(a5LightTimerRespInnerFrame01.getResponseStatus())); |
| | | // success.add(lightTaskPoleRelation01); |
| | | // } |
| | | // |
| | | // } catch (BusinessException e) { |
| | | // lightTaskPoleRelation01.setIssueStatus(DeviceRespStatusEnums.OTHER_ERROR.getCode()); |
| | | // fail.add(lightTaskPoleRelation01); |
| | | // } |
| | | // |
| | | // // ç¯å¤´2 rrpc åç宿¶å½ä»¤ |
| | | // try { |
| | | // A5LightTimerRespInnerFrame a5LightTimerRespInnerFrame02 = sendTimeRRpc(framePayload, pole.getDeviceCode(), "0002"); |
| | | // //ç¯å¤´2 |
| | | // if (a5LightTimerRespInnerFrame02 == null) { |
| | | // lightTaskPoleRelation02.setIssueStatus(DeviceRespStatusEnums.OTHER_ERROR.getCode()); |
| | | // fail.add(lightTaskPoleRelation02); |
| | | // } else { |
| | | // lightTaskPoleRelation02.setIssueStatus(HexUtil.hexToInt(a5LightTimerRespInnerFrame02.getResponseStatus())); |
| | | // success.add(lightTaskPoleRelation02); |
| | | // } |
| | | // |
| | | // } catch (BusinessException e) { |
| | | // lightTaskPoleRelation02.setIssueStatus(DeviceRespStatusEnums.OTHER_ERROR.getCode()); |
| | | // fail.add(lightTaskPoleRelation02); |
| | | // } |
| | | // |
| | | // lightTaskPoleRelationList.add(lightTaskPoleRelation01); |
| | | // lightTaskPoleRelationList.add(lightTaskPoleRelation02); |
| | | // } else { |
| | | lightTaskPoleRelation.setLightAddress(lightAddress); |
| | | lightTaskPoleRelation.setDeviceCode(pole.getDeviceCode()); |
| | | // rrpc åç宿¶å½ä»¤ |
| | |
| | | lightTaskPoleRelationList.add(lightTaskPoleRelation); |
| | | } |
| | | |
| | | // } |
| | | map.put("success", success); |
| | | map.put("fail", fail); |
| | | map.put("all", lightTaskPoleRelationList); |
| | |
| | | |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public String delLightTask(List<Long> taskIdList) { |
| | | List<LightTask> lightTaskList = listByIds(taskIdList); |
| | | if (CollectionUtil.isEmpty(lightTaskList)) { |
| | | public String delLightTask(Long taskId) { |
| | | LightTask byId = getById(taskId); |
| | | if (byId == null) { |
| | | throw new BusinessException("æ¾ä¸å°ä»»å¡ä¿¡æ¯"); |
| | | } |
| | | |
| | | //ååºä»»å¡å
³ç³» |
| | | List<LightTaskPoleRelation> relations = lightTaskPoleRelationService.list(Wrappers.lambdaQuery(LightTaskPoleRelation.class).in(LightTaskPoleRelation::getTaskId, taskIdList)); |
| | | List<LightTaskPoleRelation> relations = lightTaskPoleRelationService.list(Wrappers.lambdaQuery(LightTaskPoleRelation.class).eq(LightTaskPoleRelation::getTaskId, taskId)); |
| | | |
| | | //ååºç¯æid |
| | | List<Long> poleIds = relations.stream().map(LightTaskPoleRelation::getPoleId).distinct().collect(Collectors.toList()); |
| | | |
| | | //ä¸åæ¸
é¤ä»»å¡æä»¤ |
| | | // boolean b = clearLightTask(lightTaskIds); |
| | | Map<String, List<LightTaskPoleRelation>> ffff = sendControllerFrame(poleIds, "", "FFFF"); |
| | | /** |
| | | * å 餿§ç¯ä»»å¡æ¥å¿è®°å½å¼å§ |
| | | */ |
| | | String content = "{æ§ç¯ä»»å¡idï¼" + taskIdList + " }"; |
| | | StoreOperationRecordsUtils.storeOperationData(null, null, "å 餿§ç¯ä»»å¡", content); |
| | | /** |
| | | * å 餿§ç¯ä»»å¡æ¥å¿è®°å½ç»æ |
| | | */ |
| | | if (ffff.get("fail").size() == 0) { |
| | | //å
¨é¨æ¸
餿å å é¤å
¨é¨ä»»å¡å
³ç³» |
| | | lightTaskPoleRelationService.remove(Wrappers.lambdaQuery(LightTaskPoleRelation.class).in(LightTaskPoleRelation::getTaskId, taskIdList)); |
| | | //å é¤ä»»å¡ |
| | | removeByIds(taskIdList); |
| | | return "ä»»å¡å 餿å"; |
| | | if (poleIds != null && poleIds.size() > 0) { |
| | | //åå¨ä»»å¡å
³ç³» ä¸åæ¸
é¤ä»»å¡æä»¤ |
| | | Map<String, List<LightTaskPoleRelation>> ffff = sendControllerFrame(poleIds, "", byId.getLightAdress()); |
| | | |
| | | /** |
| | | * å 餿§ç¯ä»»å¡æ¥å¿è®°å½å¼å§ |
| | | */ |
| | | String content = "{æ§ç¯ä»»å¡idï¼" + taskId + " }"; |
| | | StoreOperationRecordsUtils.storeOperationData(null, null, "å 餿§ç¯ä»»å¡", content); |
| | | /** |
| | | * å 餿§ç¯ä»»å¡æ¥å¿è®°å½ç»æ |
| | | */ |
| | | if (ffff.get("fail").size() == 0) { |
| | | //å
¨é¨æ¸
餿å å é¤å
¨é¨ä»»å¡å
³ç³» |
| | | lightTaskPoleRelationService.remove(Wrappers.lambdaQuery(LightTaskPoleRelation.class).eq(LightTaskPoleRelation::getTaskId, taskId)); |
| | | //å é¤ä»»å¡ |
| | | removeById(taskId); |
| | | return "ä»»å¡å 餿å"; |
| | | } else if (ffff.get("success").size() != ffff.get("all").size()) { |
| | | //é¨åæå å 餿åé¨åçå
³ç³» ä¿çä»»å¡ |
| | | List<LightTaskPoleRelation> relations1 = ffff.get("success"); |
| | | if (relations1 != null && relations1.size() > 0) { |
| | | relations1.forEach(lightTaskPoleRelation -> { |
| | | lightTaskPoleRelationService.remove(Wrappers.lambdaUpdate(LightTaskPoleRelation.class) |
| | | .eq(LightTaskPoleRelation::getPoleId, lightTaskPoleRelation.getPoleId()).eq(LightTaskPoleRelation::getTaskId, taskId)); |
| | | }); |
| | | } |
| | | return "é¨åä»»å¡å 餿å,æ¸
é¤ä»»å¡å¤±è´¥çä»»å¡åæ°æ®ä¿ç!"; |
| | | } else if (ffff.get("fail").size() == ffff.get("all").size()) { |
| | | //å
¨é¨å¤±è´¥ ä¿çä»»å¡ |
| | | return "ä»»å¡å é¤å¤±è´¥ ,è¯·æ£æ¥ç¡¬ä»¶è®¾å¤!"; |
| | | } else { |
| | | return "ä»»å¡å é¤å¤±è´¥,æªç¥é误类å!"; |
| | | } |
| | | } else { |
| | | //é¨åæ¸
餿å å 餿åé¨åçä»»å¡å
³ç³» |
| | | ffff.get("success").forEach(lightTaskPoleRelation -> { |
| | | lightTaskPoleRelationService.remove(Wrappers.lambdaUpdate(LightTaskPoleRelation.class) |
| | | .eq(LightTaskPoleRelation::getPoleId, lightTaskPoleRelation.getPoleId()).eq(LightTaskPoleRelation::getTaskId, lightTaskPoleRelation.getTaskId())); |
| | | }); |
| | | //å é¤ä»»å¡ |
| | | lightTaskList.forEach( |
| | | taskId -> { |
| | | List<LightTaskPoleRelation> poleRelations = lightTaskPoleRelationService.list(Wrappers.lambdaQuery(LightTaskPoleRelation.class).eq(LightTaskPoleRelation::getTaskId, taskId)); |
| | | if (poleRelations.size() == 0) { |
| | | //ä¸åå¨ä»»å¡å
³ç³» å é¤ä»»å¡ |
| | | removeById(taskId); |
| | | } |
| | | } |
| | | ); |
| | | return "é¨åä»»å¡å 餿å,æ¸
é¤ä»»å¡å¤±è´¥çä»»å¡åæ°æ®ä¿ç"; |
| | | //ä¸åå¨ä»»å¡å
³ç³» 空任å¡ç´æ¥å é¤ |
| | | removeById(taskId); |
| | | return "ä»»å¡å 餿å"; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ä»»å¡è¯¦æ
|
| | | */ |
| | | public Map<Object, Object> detailLightTask(Long taskId) { |
| | | public Object detailLightTask(Long taskId) { |
| | | LightTask lightTask = getById(taskId); |
| | | if (lightTask == null) { |
| | | throw new BusinessException("æ¾ä¸å°ä»»å¡"); |
| | | } |
| | | List<LightTaskStatusAndPole> lightTaskStatusAndPoles = lightTaskPoleRelationService.listPoleAndStatusIdByTaskId(taskId); |
| | | return MapUtil.builder().put("task", lightTask).put("poles", lightTaskStatusAndPoles).build(); |
| | | LightTaskInfoVO vo = new LightTaskInfoVO(); |
| | | |
| | | // LightTaskDto lightTaskDto = new LightTaskDto(); |
| | | // BeanUtils.copyProperties(lightTask, lightTaskDto); |
| | | |
| | | lightTask.setWeekList(TaskOrderUtil.parseLightWeek2List(lightTask.getWeek())); |
| | | |
| | | vo.setLightTask(lightTask); |
| | | List<LightTaskRelationVO> relations = new ArrayList<>(); |
| | | List<LightTaskPoleRelation> taskPoleRelations = lightTaskPoleRelationService.list(Wrappers.lambdaQuery(LightTaskPoleRelation.class) |
| | | .eq(LightTaskPoleRelation::getTaskId, taskId)); |
| | | if (taskPoleRelations != null && !taskPoleRelations.isEmpty()) { |
| | | taskPoleRelations.forEach( |
| | | relation -> { |
| | | LightTaskRelationVO lightTaskRelationVO = new LightTaskRelationVO(); |
| | | lightTaskRelationVO.setLightAddress(relation.getLightAddress()); |
| | | lightTaskRelationVO.setIssueStatus(relation.getIssueStatus()); |
| | | lightTaskRelationVO.setPoleId(relation.getPoleId()); |
| | | Pole byId = poleService.getById(relation.getPoleId()); |
| | | if (byId != null) { |
| | | lightTaskRelationVO.setPoleName(byId.getPoleName()); |
| | | } |
| | | |
| | | LightTaskVO sys = JSONObject.parseObject(relation.getSysScheduled(), LightTaskVO.class); |
| | | sys.setWeekList(TaskOrderUtil.parseLightWeek2List(sys.getWeek())); |
| | | lightTaskRelationVO.setSysScheduled(sys); |
| | | |
| | | LightTaskVO device = JSONObject.parseObject(relation.getDeviceScheduled(), LightTaskVO.class); |
| | | if (device != null) { |
| | | device.setWeekList(TaskOrderUtil.parseLightWeek2List(device.getWeek())); |
| | | lightTaskRelationVO.setDeviceScheduled(device); |
| | | } |
| | | relations.add(lightTaskRelationVO); |
| | | } |
| | | ); |
| | | |
| | | vo.setRelations(relations); |
| | | } |
| | | |
| | | // List<LightTaskStatusAndPole> lightTaskStatusAndPoles = lightTaskPoleRelationService.listPoleAndStatusIdByTaskId(taskId); |
| | | |
| | | // return MapUtil.builder().put("task", lightTask).put("poles", lightTaskStatusAndPoles).build(); |
| | | return vo; |
| | | } |
| | | |
| | | /** |
| | |
| | | * ä¸ååä¸ªç¯æçä»»å¡ |
| | | */ |
| | | public boolean issueLightTask(LightTaskIssueParam param) { |
| | | LightTask lightTask = getById(param.getTaskId()); |
| | | |
| | | LightTaskPoleRelation relation = lightTaskPoleRelationService.getOne(Wrappers.lambdaQuery(LightTaskPoleRelation.class) |
| | | .eq(LightTaskPoleRelation::getPoleId, param.getPoleId()).eq(LightTaskPoleRelation::getTaskId, param.getTaskId())); |
| | | |
| | | if (relation == null) { |
| | | throw new BusinessException("æ¾ä¸å°ä»»å¡å
³ç³»,æ æ³è¡¥å"); |
| | | } |
| | | LightTask lightTask = JSONObject.parseObject(relation.getSysScheduled(), LightTask.class); |
| | | // LightTask lightTask = getById(param.getTaskId()); |
| | | if (lightTask == null) { |
| | | throw new BusinessException("æ¾ä¸å°ä»»å¡"); |
| | | } |
| | | //转æ¢å¸§æä»¤ |
| | | String framePayload = buildControlFramePayload(lightTask.getOpenOrder(), lightTask.getCloseOrder(), lightTask.getControlOrder(), lightTask.getWeek()); |
| | | //åérrpc å¾å°åéç»æ |
| | | List<LightTaskPoleRelation> lightTaskPoleRelationList = sendControllerFrame(lightTask, ListUtil.toList(param.getPoleId()), framePayload, lightTask.getLightAdress()); |
| | | |
| | | /** |
| | |
| | | |
| | | |
| | | if (CollectionUtil.isNotEmpty(lightTaskPoleRelationList)) { |
| | | return lightTaskPoleRelationService.update(lightTaskPoleRelationList.get(0), Wrappers.lambdaUpdate(LightTaskPoleRelation.class).eq(LightTaskPoleRelation::getPoleId, param.getPoleId()).eq(LightTaskPoleRelation::getTaskId, param.getTaskId())); |
| | | LightTaskPoleRelation lightTaskPoleRelation = lightTaskPoleRelationList.get(0); |
| | | if (lightTaskPoleRelation.getIssueStatus() == 0) { |
| | | //ä¸åæå æ´æ°ç¡¬ä»¶å®æ¶ è¿åæå |
| | | relation.setDeviceScheduled(JSON.toJSONString(lightTaskPoleRelation)); |
| | | lightTaskPoleRelationService.updateById(relation); |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | return true; |
| | | return false; |
| | | } |
| | | |
| | | |
| | |
| | | * 计ç®åçåè½è |
| | | */ |
| | | public void energy() { |
| | | List<LightTask> lightTasks = list(Wrappers.lambdaQuery(LightTask.class)); |
| | | |
| | | List<Long> taskIdList = new ArrayList<>(); |
| | | for (LightTask bean : lightTasks) { |
| | | taskIdList.add(bean.getTaskId()); |
| | | } |
| | | if (taskIdList.size() != 0) { |
| | | List<LightTaskPoleRelationBo> list = SpringContextHolder.getBean(LightTaskPoleRelationMapper.class).test(taskIdList); |
| | | for (LightTaskPoleRelationBo bean : list) { |
| | | |
| | | //ææåå¨ä»»å¡çç¯æå
³ç³» |
| | | List<LightTaskPoleRelation> list = lightTaskPoleRelationService.list(); |
| | | for (LightTaskPoleRelation bean : list) { |
| | | if (bean.getDeviceScheduled() != null) { |
| | | //åå¨ç¡¬ä»¶ä»»å¡ |
| | | LightTask lightTask = JSONObject.parseObject(bean.getDeviceScheduled(), LightTask.class); |
| | | LightTaskDto lightTaskDto = new LightTaskDto(); |
| | | BeanUtils.copyProperties(bean, lightTaskDto); |
| | | lightTaskDto.setWeekList(TaskOrderUtil.parseLightWeek2List(bean.getWeek())); |
| | | BeanUtils.copyProperties(lightTask, lightTaskDto); |
| | | lightTaskDto.setWeekList(TaskOrderUtil.parseLightWeek2List(lightTask.getWeek())); |
| | | BigDecimal energySaving; |
| | | BigDecimal energy; |
| | | //è·åæ¨å¤©çæææ° |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDateTime yesterday = now.minusDays(1); |
| | | int week = yesterday.getDayOfWeek().getValue(); |
| | | if (!list.isEmpty()) { |
| | | //æç»å®ç¯æ è¿è¡è®¡ç® |
| | | if (lightTaskDto.getWeekList().contains(week)) { |
| | | //ä»»å¡æè¯¥æææ° è®¡ç® |
| | | energySaving = SpringContextHolder.getBean(LightService.class).jisuan(lightTaskDto); |
| | | energy = SpringContextHolder.getBean(LightService.class).jisuanEnergy(lightTaskDto); |
| | | } else { |
| | | //任塿 è¯¥æææ° è¿å |
| | | energySaving = new BigDecimal(1); |
| | | energy = BigDecimal.ZERO; |
| | | } |
| | | for (int i = 0; i < list.size(); i++) { |
| | | LightTaskPoleRelation relation = list.get(i); |
| | | if (relation.getIssueStatus() != 0) { |
| | | //ä»»å¡ä¸å失败 è¿å |
| | | energySaving = new BigDecimal(1); |
| | | energy = BigDecimal.ZERO; |
| | | } |
| | | } |
| | | |
| | | if (lightTaskDto.getWeekList().contains(week)) { |
| | | //ä»»å¡æè¯¥æææ° è®¡ç® |
| | | energySaving = SpringContextHolder.getBean(LightService.class).jisuan(lightTaskDto, bean); |
| | | energy = SpringContextHolder.getBean(LightService.class).jisuanEnergy(lightTaskDto, bean); |
| | | System.out.println("è½è: " + energy + ", èè½ç: " + energySaving); |
| | | } else { |
| | | //æªç»å®ç¯æ ç´æ¥è¿å |
| | | //任塿 è¯¥æææ° è¿å |
| | | energySaving = new BigDecimal(1); |
| | | energy = BigDecimal.ZERO; |
| | | } |
| | |
| | | * å卿°æ® |
| | | */ |
| | | |
| | | System.out.println("è½è: " + energy + ", èè½ç: " + energySaving); |
| | | LightEnergyData lightEnergyData = new LightEnergyData(); |
| | | lightEnergyData.setTaskId(bean.getTaskId()); |
| | | lightEnergyData.setTaskId(lightTask.getTaskId()); |
| | | lightEnergyData.setYtdTime(yesterday.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| | | lightEnergyData.setEnergySaving(energySaving); |
| | | lightEnergyData.setEnergy(energy); |
| | | lightEnergyData.setUserId(bean.getUserId()); |
| | | lightEnergyData.setClientId(bean.getClientId()); |
| | | lightEnergyData.setLightAdderss(lightTask.getLightAdress()); |
| | | lightEnergyData.setUserId(lightTask.getUserId()); |
| | | lightEnergyData.setClientId(lightTask.getClientId()); |
| | | lightEnergyData.setPoleId(bean.getPoleId()); |
| | | //ä¿åè½èæ°æ®å°æ°æ®åº |
| | | lightEnergyDataService.save(lightEnergyData); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | public boolean clearLightTask(List<Long> poleIds) { |
| | |
| | | String lightAddress = param.getLightAddress(); |
| | | List<Long> poleIdList = param.getPoleIdList(); |
| | | List<LightTaskPoleRelation> lightTaskPoleRelations = lightTaskPoleRelationService.list(Wrappers.lambdaQuery(LightTaskPoleRelation.class) |
| | | .in(LightTaskPoleRelation::getPoleId, poleIdList).eq(LightTaskPoleRelation::getLightAddress, param.getLightAddress())); |
| | | .in(LightTaskPoleRelation::getPoleId, poleIdList).eq(LightTaskPoleRelation::getLightAddress, lightAddress)); |
| | | //éå¤çä»»å¡id |
| | | List<Long> taskIds = lightTaskPoleRelations.stream().map(LightTaskPoleRelation::getTaskId).collect(Collectors.toList()); |
| | | List<Long> poleIds = lightTaskPoleRelations.stream().map(LightTaskPoleRelation::getPoleId).collect(Collectors.toList()); |
| | | //poleIdsä¸éå¤å
ç´ åªä¿çä¸ä¸ª |
| | | //éå¤çç¯æid |
| | | List<Long> oldPoleIds = lightTaskPoleRelations.stream().map(LightTaskPoleRelation::getPoleId).collect(Collectors.toList()); |
| | | //æªéå¤çç¯æid |
| | | List<Long> finalOldPoleIds = oldPoleIds; |
| | | //ååºåå¨äºpoleIdListèä¸å¨oldPoleIdsä¸çç¯æ |
| | | List<Long> newPoleIds = poleIdList.stream().filter(id -> !finalOldPoleIds.contains(id)).collect(Collectors.toList()); |
| | | |
| | | //éå¤å
ç´ åªä¿çä¸ä¸ª |
| | | taskIds = taskIds.stream().distinct().collect(Collectors.toList()); |
| | | poleIds = poleIds.stream().distinct().collect(Collectors.toList()); |
| | | oldPoleIds = oldPoleIds.stream().distinct().collect(Collectors.toList()); |
| | | newPoleIds = newPoleIds.stream().distinct().collect(Collectors.toList()); |
| | | Map map = new HashMap(); |
| | | if (!lightTaskPoleRelations.isEmpty()) { |
| | | |
| | | map.put("request", "false"); |
| | | map.put("msg", "ä»»å¡ä¸åå¨å·²æä»»å¡çåç¯," + "ä»»å¡id为{" + taskIds + "}, " |
| | | + "ç¯æid为{" + poleIds + "}"); |
| | | // throw new BusinessException("ä»»å¡ä¸åå¨å·²æä»»å¡çåç¯," + "ä»»å¡id为{" + taskIds + "}, " |
| | | // + "ç¯æid为{" + poleIds + "}"); |
| | | map.put("result", "false"); |
| | | map.put("newPoleIds", newPoleIds); |
| | | map.put("oldPoleIds", oldPoleIds); |
| | | map.put("taskIds", taskIds); |
| | | } else { |
| | | map.put("request", "true"); |
| | | map.put("result", "true"); |
| | | map.put("msg", "ä»»å¡ä¸æ éå¤ç¯æå°å"); |
| | | } |
| | | return map; |
| | |
| | | import com.sandu.ximon.admin.dto.YSY_AccessTokenDto; |
| | | import com.sandu.ximon.admin.dto.YSY_MonitorDto; |
| | | import com.sandu.ximon.admin.param.MonitorParam; |
| | | import com.sandu.ximon.admin.redis.DeviceRedisKey; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.utils.ListPagingUtils; |
| | | import com.sandu.ximon.admin.utils.RedisUtils; |
| | | import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils; |
| | | import com.sandu.ximon.admin.vo.EquipmentInfomation; |
| | | import com.sandu.ximon.admin.vo.RedisDeviceStatus; |
| | | import com.sandu.ximon.dao.bo.MonitorBo; |
| | | import com.sandu.ximon.dao.domain.Monitor; |
| | | import com.sandu.ximon.dao.domain.PoleBinding; |
| | |
| | | import com.sandu.ximon.dao.enums.PoleBindingEnums; |
| | | import com.sandu.ximon.dao.mapper.MonitorMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | |
| | | |
| | | @Service |
| | | @AllArgsConstructor |
| | | @Slf4j |
| | | public class MonitorService extends BaseServiceImpl<MonitorMapper, Monitor> { |
| | | private final MonitorMapper monitorMapper; |
| | | //è¤ç³äºAppKey |
| | |
| | | |
| | | |
| | | private final PoleBindingService poleBindingService; |
| | | |
| | | private final RedisUtils redisUtils; |
| | | |
| | | /** |
| | | * æå头åè¡¨æ¨¡ç³æ¥è¯¢ |
| | |
| | | paramMap.put("appKey", AppKey); |
| | | paramMap.put("appSecret", Secret); |
| | | String s = HttpUtil.post(YSY_URL + ACCESSTOKEN_URL, paramMap); |
| | | if (!s.startsWith("{") || !s.endsWith("}")) { |
| | | log.error("è·åæå头token失败,æ ¼å¼æè¯¯!"); |
| | | } |
| | | YSY_AccessTokenDto accessTokenDto = JSON.parseObject(s, YSY_AccessTokenDto.class); |
| | | |
| | | //äºæ¬¡è·å |
| | | if(accessTokenDto == null){ |
| | | log.error("è·åæå头token失败,æ ¼å¼æè¯¯!"); |
| | | s = HttpUtil.post(YSY_URL + ACCESSTOKEN_URL, paramMap); |
| | | accessTokenDto = JSON.parseObject(s, YSY_AccessTokenDto.class); |
| | | } |
| | | return accessTokenDto.getData().getAccessToken(); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * åRedisä¸åå
¥è®¾å¤ç¶æ |
| | | */ |
| | | public void setCacheData() { |
| | | list().forEach( |
| | | device -> { |
| | | RedisDeviceStatus deviceStatus = new RedisDeviceStatus(); |
| | | deviceStatus.setDeviceId(device.getDeviceSerial()); |
| | | if (device != null) { |
| | | EquipmentInfomation monitorInfo = getMonitorInfo(device.getDeviceSerial()); |
| | | if (monitorInfo != null) { |
| | | if ("å¨çº¿".equals(monitorInfo.getEquipmentState())) { |
| | | deviceStatus.setStatus(0); |
| | | } else { |
| | | deviceStatus.setStatus(1); |
| | | } |
| | | |
| | | } else { |
| | | deviceStatus.setStatus(1); |
| | | } |
| | | } |
| | | redisUtils.set(DeviceRedisKey.MONITOR + device.getDeviceSerial(), JSON.toJSONString(deviceStatus)); |
| | | // redisUtils.delete(DeviceRedisKey.MONITOR + device.getDeviceSerial()); |
| | | } |
| | | ); |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.sandu.ximon.admin.param.PlatformFilePermissionParam; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.dao.bo.PlatformFileListBo; |
| | | import com.sandu.ximon.dao.domain.*; |
| | | import com.sandu.ximon.dao.domain.Admin; |
| | | import com.sandu.ximon.dao.domain.Client; |
| | | import com.sandu.ximon.dao.domain.PlatformFile; |
| | | import com.sandu.ximon.dao.domain.PlatformFileUser; |
| | | import com.sandu.ximon.dao.enums.AdministratorEnums; |
| | | import com.sandu.ximon.dao.mapper.PlatformFileMapper; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | throw new BusinessException("å 餿¶åæ°ä¸è½ä¸ºç©º!"); |
| | | } |
| | | List<PlatformFile> platformFiles = listByIds(param.getFileIds()); |
| | | if (platformFiles == null && platformFiles.size() == 0) { |
| | | if (platformFiles == null || platformFiles.size() == 0) { |
| | | throw new BusinessException("æªæ¾å°æä»¶!"); |
| | | } |
| | | |
| | |
| | | .list(Wrappers.lambdaQuery(PlatformFileUser.class).eq(PlatformFileUser::getUserId, SecurityUtils.getUserId())); |
| | | List<Long> fileIdList = platformFileUsers.stream().map(PlatformFileUser::getFileId).collect(Collectors.toList()); |
| | | |
| | | if(fileIdList.size() == 0){ |
| | | if (fileIdList.size() == 0) { |
| | | fileIdList.add(-1L); |
| | | } |
| | | PageHelper.startPage(vo.getPageNo(), vo.getPageSize()); |
| | |
| | | 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.redis.DeviceRedisKey; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.utils.*; |
| | | import com.sandu.ximon.admin.vo.EquipmentInfomation; |
| | | import com.sandu.ximon.admin.vo.RedisDeviceStatus; |
| | | import com.sandu.ximon.dao.domain.Pole; |
| | | import com.sandu.ximon.dao.domain.PoleLightemitEntity; |
| | | import com.sandu.ximon.dao.enums.OrderByEnums; |
| | |
| | | |
| | | @Autowired |
| | | LedSFileService xiXunFileService; |
| | | |
| | | @Autowired |
| | | RedisUtils redisUtils; |
| | | |
| | | @PostConstruct |
| | | public void init() { |
| | |
| | | Map map = JSON.parseObject(requestBody, Map.class); |
| | | return map; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * åRedisä¸åå
¥è®¾å¤ç¶æ |
| | | */ |
| | | public void setCacheData() { |
| | | list().forEach( |
| | | xiXun -> { |
| | | RedisDeviceStatus deviceStatus = new RedisDeviceStatus(); |
| | | deviceStatus.setDeviceId(xiXun.getLightemitControlCode()); |
| | | boolean ledOnLine = lightemitUtils.getLedOnLine(xiXun.getLightemitControlCode()); |
| | | if (ledOnLine) { |
| | | deviceStatus.setStatus(0); |
| | | } else { |
| | | deviceStatus.setStatus(1); |
| | | } |
| | | redisUtils.set(DeviceRedisKey.XIXUN + xiXun.getLightemitControlCode(), JSON.toJSONString(deviceStatus)); |
| | | // redisUtils.delete(DeviceRedisKey.XIXUN + xiXun.getLightemitControlCode()); |
| | | } |
| | | ); |
| | | } |
| | | } |
| | |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.aliyuncs.iot.model.v20180120.BatchGetDeviceStateResponse; |
| | | import com.aliyuncs.iot.model.v20180120.QueryDeviceDetailResponse; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | |
| | | 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.frame.inner.report.A5AtmosphereHeartbeatReportInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5C3HeartbeatReportInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.request.A1TernaryCodeReqInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.request.A5LightResetReqInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.request.EmptyRequestInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.response.A1DeviceMacRespInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.response.A1TernaryCodeRespInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.dto.CommonFrame; |
| | | 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.enums.*; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.mainboard.MainBoardInvokeSyncService; |
| | | import com.sandu.ximon.admin.param.PoleBindingParam; |
| | | import com.sandu.ximon.admin.param.PoleParam; |
| | | import com.sandu.ximon.admin.param.PoleStatesParam; |
| | | import com.sandu.ximon.admin.param.PushAirDataToNovaParam; |
| | | import com.sandu.ximon.admin.redis.DeviceRedisKey; |
| | | import com.sandu.ximon.admin.redis.LightKey; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.utils.LightemitUtils; |
| | | import com.sandu.ximon.admin.utils.ListPagingUtils; |
| | | import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils; |
| | | import com.sandu.ximon.admin.utils.*; |
| | | import com.sandu.ximon.admin.utils.response.VnnoxResult; |
| | | import com.sandu.ximon.admin.vo.DeviceOnLineCountVO; |
| | | import com.sandu.ximon.admin.vo.OnLineCountVO; |
| | | import com.sandu.ximon.admin.vo.PoleBindVO; |
| | | import com.sandu.ximon.admin.vo.RedisDeviceStatus; |
| | | import com.sandu.ximon.dao.bo.*; |
| | | import com.sandu.ximon.dao.domain.*; |
| | | import com.sandu.ximon.dao.enums.OrderByEnums; |
| | | import com.sandu.ximon.dao.mapper.PoleMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.RandomStringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.util.concurrent.CountDownLatch; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | private final PoleGroupRelationService groupRelationService; |
| | | private final ClientService clientService; |
| | | private final PoleMapper poleMapper; |
| | | private final RedisUtils redisUtils; |
| | | private final CountDownLatchUtil countDownLatchUtil; |
| | | |
| | | public boolean addPole(PoleParam param) { |
| | | Pole pole = new Pole(); |
| | |
| | | * |
| | | * @return |
| | | */ |
| | | public Map<String, Integer> poleCount() { |
| | | public Map<String, Integer> poleCount1() { |
| | | Map<String, Integer> result = new HashMap<>(); |
| | | LambdaQueryWrapper<Pole> wrapper; |
| | | if (SecurityUtils.getClientId() == null) { |
| | |
| | | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * ç»è®¡å¨çº¿ç¯ææ°é |
| | | * |
| | | * @return |
| | | */ |
| | | public OnLineCountVO poleCount() { |
| | | System.out.println("è¯·æ±æ¶é´: " + LocalDateTime.now()); |
| | | OnLineCountVO onLineCountVO = new OnLineCountVO(); |
| | | CountDownLatch countDownLatch = new CountDownLatch(9);//todo |
| | | //è·åä¸ä¸ª7ä½éæºæ° |
| | | String str = RandomStringUtils.randomAlphanumeric(7); |
| | | countDownLatchUtil.push(str, countDownLatch); |
| | | //è¯ºç¦ |
| | | List<LedPlayerEntity> ledPlayerEntities = SpringContextHolder.getBean(LedPlayerEntityService.class).ledPlayerEntityListOnHome(); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | AtomicInteger onLine = new AtomicInteger(0); |
| | | AtomicInteger offLine = new AtomicInteger(0); |
| | | |
| | | |
| | | //ip鳿± |
| | | |
| | | DeviceOnLineCountVO ledNova = new DeviceOnLineCountVO(); |
| | | ledPlayerEntities.forEach( |
| | | Volume -> { |
| | | String s = redisUtils.get(DeviceRedisKey.NOVA + Volume.getId()); |
| | | if (s != null) { |
| | | RedisDeviceStatus redisDeviceStatus = JSON.parseObject(s, RedisDeviceStatus.class); |
| | | if (redisDeviceStatus.getStatus() == 0) { |
| | | //å¨çº¿ |
| | | onLine.getAndIncrement(); |
| | | } else { |
| | | //离线 |
| | | offLine.getAndIncrement(); |
| | | } |
| | | } else { |
| | | offLine.getAndIncrement(); |
| | | } |
| | | } |
| | | ); |
| | | |
| | | ledNova.setTotalCount(ledPlayerEntities.size()); |
| | | ledNova.setOnlineCount(onLine.get()); |
| | | ledNova.setOfflineCount(offLine.get()); |
| | | |
| | | onLineCountVO.setLedNova(ledNova); |
| | | System.out.println("è¯ºç¦æ§è¡æ¶é´: " + LocalDateTime.now()); |
| | | countDownLatchUtil.countDown(str); |
| | | } |
| | | }).start(); |
| | | |
| | | //鳿± |
| | | List<BroadcastTerminalV2EntityBo> broadcastTerminalList = SpringContextHolder.getBean(IpVolumeService.class).getBroadcastTerminalListOnHome(); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | AtomicInteger onLine = new AtomicInteger(0); |
| | | AtomicInteger offLine = new AtomicInteger(0); |
| | | |
| | | |
| | | //ip鳿± |
| | | |
| | | DeviceOnLineCountVO ipVolume = new DeviceOnLineCountVO(); |
| | | broadcastTerminalList.forEach( |
| | | Volume -> { |
| | | String s = redisUtils.get(DeviceRedisKey.IP_BROADCAST + Volume.getId()); |
| | | if (s != null) { |
| | | RedisDeviceStatus redisDeviceStatus = JSON.parseObject(s, RedisDeviceStatus.class); |
| | | if (redisDeviceStatus.getStatus() == 0) { |
| | | //å¨çº¿ |
| | | onLine.getAndIncrement(); |
| | | } else { |
| | | //离线 |
| | | offLine.getAndIncrement(); |
| | | } |
| | | } else { |
| | | offLine.getAndIncrement(); |
| | | } |
| | | } |
| | | ); |
| | | |
| | | ipVolume.setTotalCount(broadcastTerminalList.size()); |
| | | ipVolume.setOnlineCount(onLine.get()); |
| | | ipVolume.setOfflineCount(offLine.get()); |
| | | |
| | | onLineCountVO.setBroadcast(ipVolume); |
| | | System.out.println("鳿±æ§è¡æ¶é´: " + LocalDateTime.now()); |
| | | countDownLatchUtil.countDown(str); |
| | | } |
| | | }).start(); |
| | | |
| | | //æå头 |
| | | List<MonitorBo> monitorBos = SpringContextHolder.getBean(MonitorService.class).listMonitorOnHome(); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | |
| | | AtomicInteger onLine = new AtomicInteger(0); |
| | | AtomicInteger offLine = new AtomicInteger(0); |
| | | |
| | | DeviceOnLineCountVO Monitor = new DeviceOnLineCountVO(); |
| | | monitorBos.forEach( |
| | | device -> { |
| | | String s = redisUtils.get(DeviceRedisKey.MONITOR + device.getDeviceSerial()); |
| | | if (s != null) { |
| | | RedisDeviceStatus redisDeviceStatus = JSON.parseObject(s, RedisDeviceStatus.class); |
| | | if (redisDeviceStatus.getStatus() == 0) { |
| | | //å¨çº¿ |
| | | onLine.getAndIncrement(); |
| | | } else { |
| | | //离线 |
| | | offLine.getAndIncrement(); |
| | | } |
| | | } else { |
| | | offLine.getAndIncrement(); |
| | | } |
| | | } |
| | | ); |
| | | |
| | | Monitor.setTotalCount(monitorBos.size()); |
| | | Monitor.setOnlineCount(onLine.get()); |
| | | Monitor.setOfflineCount(offLine.get()); |
| | | |
| | | onLineCountVO.setMonitor(Monitor); |
| | | System.out.println("æå头æ§è¡æ¶é´: " + LocalDateTime.now()); |
| | | countDownLatchUtil.countDown(str); |
| | | } |
| | | }).start(); |
| | | |
| | | |
| | | //åç¯ |
| | | List<LightBo> lights = SpringContextHolder.getBean(LightService.class).listLightOnHome(); |
| | | BaseConditionVO baseConditionVO = new BaseConditionVO(); |
| | | baseConditionVO.setPageNo(1); |
| | | baseConditionVO.setPageSize(999); |
| | | System.out.println("åç¯æ
éç»è®¡æ¶é´: " + LocalDateTime.now()); |
| | | CommonPage commonPage = SpringContextHolder.getBean(LightReportErrorService.class).queryErrorCode(baseConditionVO); |
| | | System.out.println("åç¯æ
éç»è®¡æ¶é´: " + LocalDateTime.now()); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | |
| | | AtomicInteger onLine = new AtomicInteger(0); |
| | | AtomicInteger offLine = new AtomicInteger(0); |
| | | AtomicInteger error = new AtomicInteger(commonPage.getList().size()); |
| | | |
| | | |
| | | DeviceOnLineCountVO light = new DeviceOnLineCountVO(); |
| | | lights.forEach( |
| | | device -> { |
| | | String s = redisUtils.get(DeviceRedisKey.LIGHT_DEVICE + device.getDeviceCode()); |
| | | if (s != null) { |
| | | RedisDeviceStatus redisDeviceStatus = JSON.parseObject(s, RedisDeviceStatus.class); |
| | | if (redisDeviceStatus.getStatus() == 0) { |
| | | //å¨çº¿ |
| | | onLine.getAndIncrement(); |
| | | } else { |
| | | //离线 |
| | | offLine.getAndIncrement(); |
| | | } |
| | | } else { |
| | | offLine.getAndIncrement(); |
| | | } |
| | | } |
| | | ); |
| | | |
| | | light.setTotalCount(lights.size()); |
| | | light.setOnlineCount(onLine.get()); |
| | | light.setOfflineCount(offLine.get()); |
| | | light.setErrorCount(error.get()); |
| | | |
| | | onLineCountVO.setLight(light); |
| | | System.out.println("åç¯æ§è¡æ¶é´: " + LocalDateTime.now()); |
| | | countDownLatchUtil.countDown(str); |
| | | } |
| | | }).start(); |
| | | |
| | | |
| | | //å
çµæ¡© |
| | | List<C3ChargingBo> c3mChargings = SpringContextHolder.getBean(C3ChargingService.class).getC3ChargingList(); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | AtomicInteger onLine = new AtomicInteger(0); |
| | | AtomicInteger offLine = new AtomicInteger(0); |
| | | AtomicInteger error = new AtomicInteger(0); |
| | | |
| | | |
| | | DeviceOnLineCountVO c3m = new DeviceOnLineCountVO(); |
| | | c3mChargings.forEach( |
| | | device -> { |
| | | String s = redisUtils.get(C3mRedisConstant.C3_STATUS.getCode() + device.getC3Mac()); |
| | | RedisDeviceStatus redisDeviceStatus = new RedisDeviceStatus(); |
| | | redisDeviceStatus.setDeviceId(device.getC3Id().toString()); |
| | | if (s != null) { |
| | | A5C3HeartbeatReportInnerFrame.HeartBeatDataPackage heartBeatDataPackage = JSON.parseObject(s, A5C3HeartbeatReportInnerFrame.HeartBeatDataPackage.class); |
| | | // å
çµæ¡©å£ç¶æä½ 1.ç©ºé² 2.å
çµä¸ 3.å
çµä¸æï¼çå¾
æå¡å¨ç¡®è®¤ 4.å
çµç»æï¼çå¾
æå¡å¨ç¡®è®¤ 5.ææ
é 6.ä¸å
çµæ¡©å¯¹æ¥ä¸ |
| | | if ("5".equals(heartBeatDataPackage.getStatusBit())) { |
| | | //æ
é |
| | | onLine.getAndIncrement(); |
| | | error.getAndIncrement(); |
| | | } else { |
| | | //å¨çº¿ |
| | | onLine.getAndIncrement(); |
| | | } |
| | | } else { |
| | | //离线 |
| | | offLine.getAndIncrement(); |
| | | } |
| | | } |
| | | ); |
| | | |
| | | c3m.setTotalCount(c3mChargings.size()); |
| | | c3m.setOnlineCount(onLine.get()); |
| | | c3m.setOfflineCount(offLine.get()); |
| | | c3m.setErrorCount(error.get()); |
| | | |
| | | onLineCountVO.setC3m(c3m); |
| | | System.out.println("å
çµæ¡©æ§è¡æ¶é´: " + LocalDateTime.now()); |
| | | countDownLatchUtil.countDown(str); |
| | | } |
| | | }).start(); |
| | | |
| | | |
| | | //å¤§æ° |
| | | List<AirEquipmentBo> airEquipments = SpringContextHolder.getBean(AirEquipmentService.class).listAirEquipmentOnHome(); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | AtomicInteger onLine = new AtomicInteger(0); |
| | | AtomicInteger offLine = new AtomicInteger(0); |
| | | AtomicInteger error = new AtomicInteger(0); |
| | | |
| | | |
| | | DeviceOnLineCountVO air = new DeviceOnLineCountVO(); |
| | | airEquipments.forEach( |
| | | device -> { |
| | | String s = redisUtils.get(DeviceRedisKey.AIR + device.getAirMac()); |
| | | if (s != null) { |
| | | RedisDeviceStatus redisDeviceStatus = JSON.parseObject(s, RedisDeviceStatus.class); |
| | | if (redisDeviceStatus.getStatus() == 0) { |
| | | //å¨çº¿ |
| | | onLine.getAndIncrement(); |
| | | } else if (redisDeviceStatus.getStatus() == 1) { |
| | | //离线 |
| | | offLine.getAndIncrement(); |
| | | } else { |
| | | error.getAndIncrement(); |
| | | } |
| | | } else { |
| | | error.getAndIncrement(); |
| | | } |
| | | } |
| | | ); |
| | | |
| | | air.setTotalCount(airEquipments.size()); |
| | | air.setOnlineCount(onLine.get()); |
| | | air.setOfflineCount(offLine.get()); |
| | | air.setErrorCount(error.get()); |
| | | |
| | | onLineCountVO.setAirEquipment(air); |
| | | System.out.println("å¤§æ°æ§è¡æ¶é´: " + LocalDateTime.now()); |
| | | countDownLatchUtil.countDown(str); |
| | | } |
| | | }).start(); |
| | | |
| | | |
| | | //大æ°(åè) |
| | | // List<AirEquipmentNongGengBo> airEquipmentNongGengBos = SpringContextHolder.getBean(AirEquipmentNongGengService.class).listAirEquipmentOnHome(); |
| | | // result.put("AirEquipmentNongGengTotalCount", airEquipmentNongGengBos.size()); |
| | | |
| | | //æ°´è´¨ |
| | | List<WaterQualityEquipmentBo> waterQualityEquipments = SpringContextHolder.getBean(WaterQualityEquipmentService.class).listWaterQualityEquipmentByKeyword(null, null); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | |
| | | DeviceOnLineCountVO water = new DeviceOnLineCountVO(); |
| | | water.setTotalCount(waterQualityEquipments.size()); |
| | | water.setOnlineCount(waterQualityEquipments.size()); |
| | | water.setOfflineCount(0); |
| | | water.setErrorCount(0); |
| | | onLineCountVO.setWaterEquipment(water); |
| | | System.out.println("æ°´è´¨æ§è¡æ¶é´: " + LocalDateTime.now()); |
| | | countDownLatchUtil.countDown(str); |
| | | } |
| | | }).start(); |
| | | |
| | | |
| | | //ç¯æå¾æ |
| | | List<LightPoleHeelingEquipmentBo> lightPoleHeelingEquipmentBos = SpringContextHolder.getBean(LightPoleHeelingEquipmentService.class).LightPoleHeelingEquipmentListOnHome(); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | |
| | | DeviceOnLineCountVO PoleHeeling = new DeviceOnLineCountVO(); |
| | | PoleHeeling.setTotalCount(lightPoleHeelingEquipmentBos.size()); |
| | | PoleHeeling.setOnlineCount(lightPoleHeelingEquipmentBos.size()); |
| | | PoleHeeling.setOfflineCount(0); |
| | | PoleHeeling.setErrorCount(0); |
| | | onLineCountVO.setLightPoleHeeling(PoleHeeling); |
| | | System.out.println("ç¯æå¾ææ§è¡æ¶é´: " + LocalDateTime.now()); |
| | | countDownLatchUtil.countDown(str); |
| | | } |
| | | }).start(); |
| | | |
| | | //ç讯 |
| | | List<PoleLightemitEntity> xiXuns = SpringContextHolder.getBean(PoleLightemitService.class).listLedOnHome(); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | AtomicInteger onLine = new AtomicInteger(0); |
| | | AtomicInteger offLine = new AtomicInteger(0); |
| | | |
| | | DeviceOnLineCountVO xixunLed = new DeviceOnLineCountVO(); |
| | | xiXuns.forEach( |
| | | device -> { |
| | | String s = redisUtils.get(DeviceRedisKey.XIXUN + device.getLightemitControlCode()); |
| | | if (s != null) { |
| | | RedisDeviceStatus redisDeviceStatus = JSON.parseObject(s, RedisDeviceStatus.class); |
| | | if (redisDeviceStatus.getStatus() == 0) { |
| | | //å¨çº¿ |
| | | onLine.getAndIncrement(); |
| | | } else { |
| | | //离线 |
| | | offLine.getAndIncrement(); |
| | | } |
| | | } else { |
| | | offLine.getAndIncrement(); |
| | | } |
| | | } |
| | | ); |
| | | |
| | | xixunLed.setTotalCount(xiXuns.size()); |
| | | xixunLed.setOnlineCount(onLine.get()); |
| | | xixunLed.setOfflineCount(offLine.get()); |
| | | |
| | | onLineCountVO.setLedXiXun(xixunLed); |
| | | System.out.println("çæ±æ§è¡æ¶é´: " + LocalDateTime.now()); |
| | | countDownLatchUtil.countDown(str); |
| | | } |
| | | }).start(); |
| | | try { |
| | | countDownLatch.await(20000, TimeUnit.MILLISECONDS); |
| | | countDownLatchUtil.remove(str); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | System.out.println("ååºæ¶é´: " + LocalDateTime.now()); |
| | | return onLineCountVO; |
| | | } |
| | | |
| | | |
| | | public CommonPage queryAllStatesAndList(Integer pageNo, Integer pageSize, PoleStatesParam param, Integer order, Integer seq) { |
| | | if (param == null) { |
| | |
| | | * @param param |
| | | * @return |
| | | */ |
| | | public List<Pole> isBind(List<Pole> list, PoleStatesParam param) { |
| | | List<Pole> bindList = new ArrayList<>();//å·²ç»å®å®¢æ· |
| | | List<Pole> unbindList = new ArrayList<>();//æªç»å®å®¢æ· |
| | | list.forEach(bindwarpper -> { |
| | | // Long clientId = bindwarpper.getClientId(); |
| | | if (bindwarpper.getClientId() == null) {//夿æ¯å¦ç»å® |
| | | unbindList.add(bindwarpper); |
| | | } else { |
| | | bindList.add(bindwarpper); |
| | | } |
| | | }); |
| | | if (param.getBingStates() == 0) { |
| | | return bindList; |
| | | } else if (param.getBingStates() == 1) { |
| | | return unbindList; |
| | | } |
| | | return list; |
| | | } |
| | | // public List<Pole> isBind(List<Pole> list, PoleStatesParam param) { |
| | | // List<Pole> bindList = new ArrayList<>();//å·²ç»å®å®¢æ· |
| | | // List<Pole> unbindList = new ArrayList<>();//æªç»å®å®¢æ· |
| | | // list.forEach(bindwarpper -> { |
| | | //// Long clientId = bindwarpper.getClientId(); |
| | | // if (bindwarpper.getClientId() == null) {//夿æ¯å¦ç»å® |
| | | // unbindList.add(bindwarpper); |
| | | // } else { |
| | | // bindList.add(bindwarpper); |
| | | // } |
| | | // }); |
| | | // if (param.getBingStates() == 0) { |
| | | // return bindList; |
| | | // } else if (param.getBingStates() == 1) { |
| | | // return unbindList; |
| | | // } |
| | | // return list; |
| | | // } |
| | | |
| | | public List<Pole> isTrue(List<Pole> list, PoleStatesParam param) { |
| | | //å®ä½ç¯æ |
| | |
| | | } |
| | | String deviceName = byId.getDeviceCode(); |
| | | if (deviceName.isEmpty()) { |
| | | throw new BusinessException("è¯¥ç¯æMca为空"); |
| | | throw new BusinessException("è¯¥ç¯æMac为空"); |
| | | } |
| | | IRequestFrame build = FrameBuilder.builderA5().orderType(A5OrderEnum.REQUEST_LIGHT_DATA.getCode()).innerFrame(new A5LightResetReqInnerFrame()).build(); |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(deviceName, build); |
| | |
| | | if (pole == null) { |
| | | throw new BusinessException("ç¯æä¸åå¨"); |
| | | } |
| | | |
| | | //ä¸çº§å®¢æ· -1 userId |
| | | //äºçº§å®¢æ· ä¸çº§å®¢æ·id userId |
| | | pole.setClientId(-1L); |
| | | pole.setUserId(-1L); |
| | | r = updateById(pole); |
| | | |
| | | if (!r) { |
| | |
| | | |
| | | public List<Pole> getOwnerPole(BaseConditionVO baseConditionVO, String keyword, Long cilentId) { |
| | | LambdaQueryWrapper<Pole> eq; |
| | | // if(SecurityUtils.getClientId()!=null){ |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | if (clientService.findClientId(cilentId)) { |
| | | eq = Wrappers.lambdaQuery(Pole.class).eq(Pole::getUserId, cilentId); |
| | | eq = Wrappers.lambdaQuery(Pole.class).eq(Pole::getClientId, cilentId); |
| | | } else { |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | eq = Wrappers.lambdaQuery(Pole.class).eq(Pole::getClientId, cilentId).or(pole -> { |
| | | pole.eq(Pole::getUserId, cilentId); |
| | | }); |
| | | } |
| | | |
| | | // }else { |
| | | // PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | // eq = Wrappers.lambdaQuery(Pole.class); |
| | | // } |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | |
| | | if (!keyword.isEmpty()) { |
| | | eq.like(Pole::getPoleName, keyword).or(code -> { |
| | | code.like(Pole::getPoleCode, keyword); |
| | |
| | | deviceCode.like(Pole::getDeviceCode, keyword); |
| | | }); |
| | | } |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | List<Pole> list; |
| | | list = list(eq); |
| | | setCount(list); |
| | |
| | | * æ¨é大æ°çæµæ°æ®å°novaLED |
| | | */ |
| | | public VnnoxResult pushAirDataToNova(PushAirDataToNovaParam param) { |
| | | Long poleId=param.getPoleId(); |
| | | Long poleId = param.getPoleId(); |
| | | Pole pole = getById(poleId); |
| | | PoleBinding air = poleBindingService.getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getPoleId, poleId).eq(PoleBinding::getDeviceType, 3)); |
| | | PoleBinding nova = poleBindingService.getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getPoleId, poleId).eq(PoleBinding::getDeviceType, 1)); |
| | |
| | | A5AtmosphereHeartbeatReportInnerFrame.HeartBeatDataPackage data = SpringContextHolder.getBean(AirDataService.class).getDataByPoleid(poleId); |
| | | //æ¨éæ°æ® |
| | | // return SpringContextHolder.getBean(VnnoxService.class).publishWaterData(LED.getPlayerId(),param.getDuration(), data); |
| | | return SpringContextHolder.getBean(VnnoxService.class).WaterData(LED.getPlayerId(),param.getDuration(), data); |
| | | return SpringContextHolder.getBean(VnnoxService.class).WaterData(LED.getPlayerId(), param.getDuration(), data); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * ç»è®¡è®¾å¤ç¶æåå
¥redis |
| | | */ |
| | | public void setRedis() { |
| | | |
| | | // redisStatusKeyTimeout为空 ä»£è¡¨ä¸æ¬¡è°ç¨å¨15åéå |
| | | if (redisUtils.get("redisStatusKeyTimeout") != null) { |
| | | //ä¸ä¸ºç©º 说æçæ¶é´å
è°ç¨è¿ ç´æ¥è¿å |
| | | System.out.println("15åéå
å·²ç»æ´æ°è¿æ°æ®"); |
| | | return; |
| | | } |
| | | |
| | | //è®¾ç½®è§¦åæ¡ä»¶ åå
¥Redis 15åéè¶
æ¶ 15åéå
忬¡è°ç¨ç´æ¥è¿å |
| | | redisUtils.set("redisStatusKeyTimeout", System.currentTimeMillis(), 60 * 15); |
| | | |
| | | CountDownLatch countDownLatch = new CountDownLatch(7);//todo |
| | | //è·åä¸ä¸ª7ä½éæºæ° |
| | | String str = RandomStringUtils.randomAlphanumeric(7); |
| | | countDownLatchUtil.push(str, countDownLatch); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | SpringContextHolder.getBean(IpVolumeService.class).setCacheData(); |
| | | countDownLatchUtil.countDown(str); |
| | | System.out.println("鳿±æ§è¡"); |
| | | |
| | | } |
| | | }).start(); |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | SpringContextHolder.getBean(MonitorService.class).setCacheData(); |
| | | countDownLatchUtil.countDown(str); |
| | | System.out.println("æå头æ§è¡"); |
| | | } |
| | | }).start(); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | SpringContextHolder.getBean(LightService.class).setCacheData(); |
| | | countDownLatchUtil.countDown(str); |
| | | System.out.println("åç¯æ§è¡"); |
| | | } |
| | | }).start(); |
| | | // new Thread(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | // SpringContextHolder.getBean(C3ChargingService.class).setCacheData(); |
| | | // countDownLatchUtil.countDown(str); |
| | | // System.out.println("å
çµæ¡©æ§è¡"); |
| | | // } |
| | | // }).start(); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | SpringContextHolder.getBean(AirEquipmentService.class).setCacheData(); |
| | | countDownLatchUtil.countDown(str); |
| | | System.out.println("å¤§æ°æ§è¡"); |
| | | } |
| | | }).start(); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | SpringContextHolder.getBean(PoleLightemitService.class).setCacheData(); |
| | | countDownLatchUtil.countDown(str); |
| | | System.out.println("çæ±æ§è¡"); |
| | | } |
| | | }).start(); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | SpringContextHolder.getBean(VnnoxService.class).setCacheData(); |
| | | countDownLatchUtil.countDown(str); |
| | | System.out.println("è¯ºç¦æ§è¡"); //todo è¯ºç¦æ
éææ |
| | | } |
| | | }).start(); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | SpringContextHolder.getBean(PoleLightemitService.class).setCacheData(); |
| | | countDownLatchUtil.countDown(str); |
| | | System.out.println("çæ±æ§è¡"); |
| | | } |
| | | }).start(); |
| | | |
| | | |
| | | try { |
| | | countDownLatch.await(12000, TimeUnit.MILLISECONDS); |
| | | countDownLatchUtil.remove(str); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | throw new BusinessException("å½åç¨æ·æ²¡æè§è²"); |
| | | } |
| | | List<Long> roleIdList = roles.stream().map(Role::getId).collect(Collectors.toList()); |
| | | List<Long> menuIdList = roleMenuRelationService.list(Wrappers.lambdaQuery(RoleMenuRelation.class).in(RoleMenuRelation::getRoleId, roleIdList).select(RoleMenuRelation::getMenuId)) |
| | | .stream().map(RoleMenuRelation::getMenuId).distinct().collect(Collectors.toList()); |
| | | List<Long> menuIdList = roleMenuRelationService.list(Wrappers.lambdaQuery(RoleMenuRelation.class).in(RoleMenuRelation::getRoleId, roleIdList) |
| | | .select(RoleMenuRelation::getMenuId)).stream().map(RoleMenuRelation::getMenuId).distinct().collect(Collectors.toList()); |
| | | |
| | | Set<String> menuPermissions = new HashSet<>(); |
| | | // èåæé |
| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.util.SpringContextHolder; |
| | | import com.sandu.ximon.admin.config.VnnoxConstant; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5AtmosphereHeartbeatReportInnerFrame; |
| | | import com.sandu.ximon.admin.redis.DeviceRedisKey; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.utils.*; |
| | | import com.sandu.ximon.admin.utils.request.VnnoxScreenStatusType; |
| | |
| | | import com.sandu.ximon.admin.utils.response.VnnoxPlayerResponse; |
| | | import com.sandu.ximon.admin.utils.response.VnnoxResult; |
| | | import com.sandu.ximon.admin.utils.response.VnnoxResultResponse; |
| | | import com.sandu.ximon.admin.vo.NovaAStateInfoVO; |
| | | import com.sandu.ximon.admin.vo.NovaPushResultVO; |
| | | import com.sandu.ximon.admin.vo.NovaScreenShorUrlVO; |
| | | import com.sandu.ximon.admin.vo.NovaWeatherVO; |
| | | import com.sandu.ximon.admin.vo.*; |
| | | import com.sandu.ximon.dao.domain.LedPlayerEntity; |
| | | import com.sandu.ximon.dao.domain.LedPlayerInfoEntity; |
| | | import com.sandu.ximon.dao.domain.LedV2RegisterResultEntity; |
| | |
| | | List<String> temp = new ArrayList<>(); |
| | | for (LedPlayerEntity item : ledList) { |
| | | String playerId = item.getPlayerId(); |
| | | if (redisUtils.get(VnnoxConstant.REDIS_VOL + playerId) == null || redisUtils.get(VnnoxConstant.REDIS_BRIGHTNESS + playerId) == null) { |
| | | if (redisUtils.get(VnnoxConstant.REDIS_VOL + playerId) == null |
| | | || redisUtils.get(VnnoxConstant.REDIS_BRIGHTNESS + playerId) == null |
| | | || redisUtils.get(VnnoxConstant.REDIS_SCREEN_STATUS + playerId) == null) { |
| | | temp.add(item.getPlayerId()); |
| | | } |
| | | } |
| | |
| | | for (LedPlayerEntity playerEntity : list) { |
| | | String playerId = playerEntity.getPlayerId(); |
| | | LedPlayerInfoEntity cache = new LedPlayerInfoEntity(); |
| | | // 设置å±å¹ç¶æ |
| | | // 设置å±å¹ç¶æ æ´æ°ç¶æä¹åè¿æ¿ä¸å°æ°æ®è¯´æè®¾å¤æé®é¢æä¸å¨çº¿ 设置é»è®¤ä¸ºé»å± |
| | | String result = redisUtils.get(VnnoxConstant.REDIS_SCREEN_STATUS + playerId); |
| | | Integer screenStatus = 1; |
| | | Integer screenStatus = 0; |
| | | if (null != result) { |
| | | screenStatus = Integer.parseInt(result); |
| | | } |
| | |
| | | novaAStateInfoVO.setTimeValue(timeValue); |
| | | break; |
| | | case "screenPowerStatus": |
| | | if ("CLOSE".equals(screenPowerStatus)) { |
| | | novaAStateInfoVO.setScreenPowerStatus("0"); |
| | | } else { |
| | | novaAStateInfoVO.setScreenPowerStatus("1"); |
| | | } |
| | | novaAStateInfoVO.setScreenPowerStatus(screenPowerStatus); |
| | | break; |
| | | case "syncPlayStatus": |
| | | novaAStateInfoVO.setSyncPlayStatus(syncPlayStatus); |
| | |
| | | vnnoxAPIUtil.getAsyncStatus(playerIdList, stateValue); |
| | | } |
| | | ); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * åRedisä¸åå
¥è®¾å¤ç¶æ |
| | | */ |
| | | public void setCacheData() { |
| | | |
| | | List<List<LedPlayerEntity>> split = CollectionUtil.split(ledPlayerEntityService.list(), 100); |
| | | List<LedPlayerEntity> ledList = new ArrayList<>(); |
| | | split.forEach( |
| | | list -> { |
| | | List<LedPlayerEntity> ledPlayerEntities = vnnoxAPIUtil.syncCurrentInfo(list); |
| | | ledList.addAll(ledPlayerEntities); |
| | | } |
| | | ); |
| | | |
| | | ledList.forEach( |
| | | device -> { |
| | | RedisDeviceStatus deviceStatus = new RedisDeviceStatus(); |
| | | deviceStatus.setDeviceId(device.getPlayerId()); |
| | | if (device.getOnlineStatus() == 0) { |
| | | deviceStatus.setStatus(1); |
| | | } else if (device.getOnlineStatus() == 1) { |
| | | deviceStatus.setStatus(0); |
| | | } else { |
| | | deviceStatus.setStatus(1); |
| | | } |
| | | redisUtils.set(DeviceRedisKey.NOVA + device.getPlayerId(), JSON.toJSONString(deviceStatus)); |
| | | // redisUtils.delete(DeviceRedisKey.IP_BROADCAST + device.getId()); |
| | | } |
| | | ); |
| | | |
| | | } |
| | | } |
| | |
| | | Integer screenHeight = Integer.parseInt(lightemitUtils.getScreenHeight(lightemitControlCode)); |
| | | String size = String.valueOf(screenHeight / 18); |
| | | //åå¹ä¸»ä½æ¼æ¥ |
| | | //TODO |
| | | String body = |
| | | "<head><style type=\"text/css\">body{background-color:#000;}</style></head>" + |
| | | "<p style=\"font-size:" + size + "px;line-height:17px;color:#fff\">" + |
| | |
| | | lightemitUtils.clearPlayerTask(lightemitControlCode); |
| | | //æ¨éæåå½ä»¤ |
| | | lightemitUtils.sendLastCommand(lightemitControlCode); |
| | | |
| | | /** |
| | | * çæ±å¤§æ°æ°æ®æ¨éæ¥å¿è®°å½å¼å§ |
| | | // */ |
| | | // String content = "{设å¤codeï¼" + lightemitControlCode |
| | | // + "ï¼ æ¨éå
容ï¼" + body |
| | | // + " }"; |
| | | // List<String> listCode = new ArrayList<>(); |
| | | // listCode.add(lightemitControlCode); |
| | | // StoreOperationRecordsUtils.storeOperationData(listCode, null, "çæ±å¤§æ°æ°æ®æ¨é", content); |
| | | /** |
| | | * çæ±å¤§æ°æ°æ®æ¨éæ¥å¿è®°å½ç»æ |
| | | */ |
| | | } |
| | | }, 60 * 1000); |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.ximon.admin.config.BroadcastAPI; |
| | | import com.sandu.ximon.admin.dto.TerminalDto; |
| | | import com.sandu.ximon.admin.utils.request.CommonRequestParams; |
| | | import com.sandu.ximon.admin.utils.response.CommonResponseVO; |
| | | import com.sandu.ximon.admin.utils.response.DataResponseVO; |
| | | import com.sandu.ximon.admin.vo.ListDataResponseVO; |
| | | import com.sandu.ximon.admin.dto.TerminalDto; |
| | | import com.sandu.ximon.admin.vo.TerminalVO; |
| | | import jodd.bean.BeanCopy; |
| | | import jodd.bean.BeanUtil; |
| | | import org.springframework.beans.BeanUtils; |
| | | |
| | | import java.util.ArrayList; |
| | |
| | | * @return |
| | | */ |
| | | public static TerminalDto getTerminalInfo(Integer terminalId) { |
| | | DataResponseVO responseVO = JSON.parseObject( |
| | | BroadcastPostUtils.Post( |
| | | new CommonRequestParams().put("id", terminalId).getParams(), |
| | | BroadcastAPI.GET_TERMINAL.getUrl(), |
| | | CharUtils.GBK), |
| | | DataResponseVO.class |
| | | ); |
| | | DataResponseVO responseVO = JSON.parseObject(BroadcastPostUtils.Post(new CommonRequestParams().put("id", terminalId).getParams(), BroadcastAPI.GET_TERMINAL.getUrl(), CharUtils.GBK), DataResponseVO.class); |
| | | |
| | | TerminalVO bean = responseVO.convert(TerminalVO.class); |
| | | |
| | |
| | | * è·åç»ç«¯æå¡å¨å¯¹è±¡å表 |
| | | */ |
| | | public static List<TerminalDto> getTerminalList() { |
| | | ListDataResponseVO responseVO = JSON.parseObject( |
| | | BroadcastPostUtils.Post( |
| | | new CommonRequestParams().getParams(), |
| | | BroadcastAPI.GET_TERMINAL_LIST.getUrl(), |
| | | CharUtils.GBK), |
| | | ListDataResponseVO.class |
| | | ); |
| | | ListDataResponseVO responseVO = JSON.parseObject(BroadcastPostUtils.Post(new CommonRequestParams().getParams(), BroadcastAPI.GET_TERMINAL_LIST.getUrl(), CharUtils.GBK), ListDataResponseVO.class); |
| | | |
| | | List<TerminalDto> list = new ArrayList<>(); |
| | | if (responseVO.covertTerminalList() != null) { |
| | |
| | | * @return |
| | | */ |
| | | public static boolean updateTerminal(Integer terminalId, TerminalVO terminalVO, Long userId) { |
| | | CommonResponseVO responseVO = JSON.parseObject( |
| | | BroadcastPostUtils.Post( |
| | | new CommonRequestParams() |
| | | .put("id", terminalId) |
| | | .put("data", JSON.toJSONString(terminalVO)) |
| | | .getParams(), |
| | | BroadcastAPI.UPDATE_TERMINAL.getUrl(), |
| | | CharUtils.GBK), |
| | | CommonResponseVO.class |
| | | ); |
| | | CommonResponseVO responseVO = JSON.parseObject(BroadcastPostUtils.Post(new CommonRequestParams().put("id", terminalId).put("data", JSON.toJSONString(terminalVO)).getParams(), BroadcastAPI.UPDATE_TERMINAL.getUrl(), CharUtils.GBK), CommonResponseVO.class); |
| | | if (responseVO.isOK()) { |
| | | // log("ä¿®æ¹ææ¾ç»ç«¯(id:"+terminalId+", name:"+terminalVO.getName()+")",userId,null); |
| | | return true; |
| | |
| | | * @return |
| | | */ |
| | | public static boolean delTerminal(Integer terminalId, Long userId) { |
| | | CommonResponseVO responseVO = JSON.parseObject( |
| | | BroadcastPostUtils.Post( |
| | | new CommonRequestParams() |
| | | .put("id", terminalId) |
| | | .getParams(), |
| | | BroadcastAPI.DEL_TERMINAL.getUrl(), |
| | | CharUtils.GBK), |
| | | CommonResponseVO.class |
| | | ); |
| | | CommonResponseVO responseVO = JSON.parseObject(BroadcastPostUtils.Post(new CommonRequestParams().put("id", terminalId).getParams(), BroadcastAPI.DEL_TERMINAL.getUrl(), CharUtils.GBK), CommonResponseVO.class); |
| | | if (responseVO.isOK()) { |
| | | // log("å 餿æ¾ç»ç«¯(id:"+terminalId+")",userId,null); |
| | | return true; |
| | |
| | | throw new BusinessException("IP鳿±ç¡¬ä»¶è®¾å¤ä¸åå¨"); |
| | | } |
| | | terminalInfo.setDefaultVolumn(defaultVolumn); |
| | | terminalInfo.setVolumn(defaultVolumn); |
| | | CommonResponseVO responseVO = JSON.parseObject( |
| | | BroadcastPostUtils.Post( |
| | | new CommonRequestParams() |
| | | .put("id", terminalId) |
| | | .put("data", terminalInfo) |
| | | .getParams(), |
| | | BroadcastAPI.UPDATE_TERMINAL.getUrl(), |
| | | CharUtils.GBK), |
| | | CommonResponseVO.class |
| | | ); |
| | | terminalInfo.setVolume(defaultVolumn); |
| | | |
| | | CommonResponseVO responseVO = JSON.parseObject(BroadcastPostUtils.Post(new CommonRequestParams().put("id", terminalId).put("data", terminalInfo).getParams(), BroadcastAPI.UPDATE_TERMINAL.getUrl(), CharUtils.GBK), CommonResponseVO.class); |
| | | System.out.println(responseVO + " response"); |
| | | if (responseVO.isOK()) { |
| | | return true; |
| | | } |
| | |
| | | List<String> commands = new ArrayList<>(); |
| | | commands.add("volumeValue"); |
| | | commands.add("brightnessValue"); |
| | | commands.add("screenPowerStatus"); |
| | | VnnoxBaseRequest request = new VnnoxBaseRequest(); |
| | | request.setPlayerIds(playerId); |
| | | request.setCommands(commands); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author LiuHaoNan |
| | | * @date 2022/9/27 |
| | | * è®¾å¤æ°éç»è®¡ |
| | | */ |
| | | @Data |
| | | public class DeviceOnLineCountVO { |
| | | |
| | | /** |
| | | * è®¾å¤æ»æ°é |
| | | */ |
| | | private Integer totalCount; |
| | | |
| | | /** |
| | | * å¨çº¿æ°é |
| | | */ |
| | | private Integer onlineCount; |
| | | |
| | | /** |
| | | * 离线æ°é |
| | | */ |
| | | private Integer offlineCount = 0; |
| | | |
| | | /** |
| | | * æ
éæ°é |
| | | */ |
| | | private Integer errorCount = 0; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.vo; |
| | | |
| | | import com.sandu.ximon.dao.domain.LightTask; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author LiuHaoNan |
| | | * @date 2022/9/23 |
| | | */ |
| | | @Data |
| | | public class LightTaskInfoVO { |
| | | |
| | | /** |
| | | * ä»»å¡ |
| | | */ |
| | | private LightTask lightTask; |
| | | |
| | | private List<LightTaskRelationVO> relations; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author LiuHaoNan |
| | | * @date 2022/9/23 |
| | | */ |
| | | @Data |
| | | public class LightTaskRelationVO { |
| | | |
| | | private Long poleId; |
| | | private String poleName; |
| | | |
| | | |
| | | private String lightAddress; |
| | | |
| | | /** |
| | | * ä»»å¡ä¸åç¶æï¼0æåï¼1æ ¡éªç é误ï¼2é¿åº¦é误ï¼3åflashé误ï¼255å
¶ä»é误 |
| | | */ |
| | | private Integer issueStatus; |
| | | |
| | | |
| | | /** |
| | | * ç³»ç»å®æ¶ |
| | | */ |
| | | private LightTaskVO sysScheduled; |
| | | |
| | | /** |
| | | * ç¡¬ä»¶å®æ¶ |
| | | */ |
| | | private LightTaskVO deviceScheduled; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author LiuHaoNan |
| | | * @date 2022/9/23 |
| | | */ |
| | | @Data |
| | | public class LightTaskVO { |
| | | |
| | | private Long taskId; |
| | | |
| | | |
| | | /** |
| | | * ä»»å¡åç§° |
| | | */ |
| | | private String taskName; |
| | | |
| | | /** |
| | | * ææå ï¼ä½è¿ç®ä¿åï¼1代表ææä¸ï¼2ææäºï¼4ææä¸ï¼8ææåï¼16ææäºï¼32ææå
ï¼64æææ¥ |
| | | */ |
| | | @JsonIgnore |
| | | private Integer week; |
| | | |
| | | private List<Integer> weekList; |
| | | |
| | | /** |
| | | * å¼ç¯å½ä»¤ |
| | | */ |
| | | private String openOrder; |
| | | |
| | | /** |
| | | * å
³éç¯å½ä»¤ |
| | | */ |
| | | private String closeOrder; |
| | | |
| | | /** |
| | | * ç¯æ§å½ä»¤ |
| | | */ |
| | | private String controlOrder; |
| | | |
| | | |
| | | /** |
| | | * æ§ç¯å°å |
| | | */ |
| | | private String lightAdress; |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author LiuHaoNan |
| | | * @date 2022/9/27 |
| | | * é¦é¡µæ°éç»è®¡å®ä½ |
| | | */ |
| | | @Data |
| | | public class OnLineCountVO { |
| | | |
| | | /** |
| | | * è¯ºç¦ |
| | | */ |
| | | private DeviceOnLineCountVO ledNova; |
| | | |
| | | /** |
| | | * 鳿± |
| | | */ |
| | | private DeviceOnLineCountVO broadcast; |
| | | |
| | | /** |
| | | * æå头 |
| | | */ |
| | | private DeviceOnLineCountVO monitor; |
| | | |
| | | /** |
| | | * åç¯ |
| | | */ |
| | | private DeviceOnLineCountVO light; |
| | | |
| | | /** |
| | | * å
çµæ¡© |
| | | */ |
| | | private DeviceOnLineCountVO c3m; |
| | | |
| | | /** |
| | | * å¤§æ° |
| | | */ |
| | | private DeviceOnLineCountVO airEquipment; |
| | | |
| | | /** |
| | | * åè |
| | | */ |
| | | private DeviceOnLineCountVO airEquipmentNongGeng; |
| | | |
| | | /** |
| | | * æ°´è´¨ |
| | | */ |
| | | private DeviceOnLineCountVO waterEquipment; |
| | | |
| | | /** |
| | | * ç¯æå¾æ |
| | | */ |
| | | private DeviceOnLineCountVO LightPoleHeeling; |
| | | |
| | | /** |
| | | * çæ± |
| | | */ |
| | | private DeviceOnLineCountVO ledXiXun; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author LiuHaoNan |
| | | * @date 2022/9/26 |
| | | * Redisä¸ç设å¤ç¶æå®ä½ |
| | | */ |
| | | @Data |
| | | public class RedisDeviceStatus { |
| | | |
| | | private String deviceId; |
| | | |
| | | /** |
| | | * 设å¤ç¶æ 0å¨çº¿ 1离线 2æ
é |
| | | */ |
| | | private Integer status; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * è¿ç¨å级 å级è¿åº¦ |
| | | */ |
| | | @Data |
| | | public class RemoteUpgradeProgress { |
| | | |
| | | /** |
| | | * å½åè¿åº¦ |
| | | */ |
| | | private int currentProgress = 0; |
| | | |
| | | /** |
| | | * æ»è¿åº¦ |
| | | */ |
| | | private int totalProgress = 0; |
| | | } |
| | |
| | | enable: true |
| | | |
| | | listenter: |
| | | isOpen: false |
| | | isOpen: true |
| | | |
| | | minio: |
| | | endpoint: 47.106.172.9 |
| | |
| | | nova-conf: #诺ç¦åè° |
| | | notify-url: http://112.74.63.130:20017/serv/vnnox/progress |
| | | screen-shot-notify-url: http://112.74.63.130:20017/serv/vnnox/screenshot |
| | | status-notify-url: http://112.74.63.130:20017/serv/vnnox/asyncStatus |
| | | status-notify-url: http://112.74.63.130:20017/serv/vnnox/asyncStatus |
| | |
| | | # ç产é
ç½®æä»¶ ä¸»æº 39.103.154.108 |
| | | # ç产é
ç½®æä»¶ ä¸»æº 39.103.154.108 127.0.0.1 |
| | | server: |
| | | port: 20018 |
| | | spring: |
| | |
| | | spring: |
| | | profiles: |
| | | active: prod |
| | | active: prod |
| | | jackson: |
| | | date-format: yyyy-MM-dd HH:mm:ss |
| | | time-zone: GMT+8 |
| | |
| | | logging: |
| | | file: |
| | | path: logs |
| | | wx: |
| | | pay: |
| | | appId: dsd #微信å
¬ä¼å·æè
å°ç¨åºççappid |
| | | mchId: dsdsd #微信æ¯ä»åæ·å· |
| | | mchKey: dsd #微信æ¯ä»åæ·å¯é¥ |
| | | |
| | | |
| | | # ledå±å¹æå¡å¨å°åï¼æ´æ¹éè¦åæ¶æ´æ¹ï¼ |
| | | realtime-server: |
| | | # command: http://101.132.131.91:8081/payload/ |
| | | # url: http://101.132.131.91:8081/ |
| | | # command: http://101.132.131.91:8081/payload/ |
| | | # url: http://101.132.131.91:8081/ |
| | | command: http://112.74.63.130:20018/command/ |
| | | url: http://112.74.63.130:20018/ |
| | | |
| | |
| | | secretKey: zhxm2512209 |
| | | secure: false |
| | | |
| | | #鳿±æå¡å¨å°å |
| | | broadcastApi: |
| | | serviceUrl: http://47.106.172.9:8000 |
| | | |
| | | nova-conf: #诺ç¦è´¦å·å¯ç |
| | | username: zhxm |
| | | password: xm2512209. |
| | | |
| | | #主æ¿rrpcéä¿¡PRODUCT_KEY |
| | | #rrpc: |
| | | # key: a1JsfPG4iKW |