| | |
| | | |
| | | 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); |
| | | |
| | |
| | | |
| | | <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> |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | package com.sandu.ximon.admin.config; |
| | | |
| | | /** |
| | | * 鳿±api |
| | | * 鳿±apiå°å |
| | | */ |
| | | public enum BroadcastAPI { |
| | | |
| | |
| | | DEL_TASK("/del_task"), |
| | | |
| | | ADD_REGION("/add_region"), |
| | | GET_REGION_LIST("/get_region_list");; |
| | | GET_REGION_LIST("/get_region_list"); |
| | | |
| | | private static final String SERVER = "http://47.106.172.9:8000";//todo æåå°é
ç½®æä»¶ |
| | | |
| | | // 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; |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | @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) { |
| | |
| | | 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 |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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."; |
| | | } |
| | |
| | | import com.sandu.common.util.SpringContextHolder; |
| | | import com.sandu.ximon.admin.config.C3mRedisConfig; |
| | | import com.sandu.ximon.admin.dto.ChargingDto; |
| | | import com.sandu.ximon.admin.dto.TerminalDto; |
| | | import com.sandu.ximon.admin.manager.iot.frame.A5Frame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5C3HeartbeatReportInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5C3OperationReportInnerFrame; |
| | |
| | | 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.ä¸å
çµæ¡©å¯¹æ¥ä¸ |
| | | deviceStatus.setStatus(Integer.valueOf(beatDataPackage.getStatusBit())); |
| | | |
| | | }else{ |
| | | |
| | | } |
| | | } |
| | | redisUtils.set(DeviceRedisKey.IP_BROADCAST + device.getC3Id(), deviceStatus); |
| | | } |
| | | ); |
| | | |
| | | } |
| | | } |
| | |
| | | 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.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; |
| | | |
| | | /** |
| | | * 忥ç»ç«¯ |
| | |
| | | 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()); |
| | |
| | | |
| | | |
| | | public static Object getInfo() { |
| | | return TerminalAPIUtils.getTerminalInfo(23); |
| | | 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(), deviceStatus); |
| | | } |
| | | ); |
| | | |
| | | } |
| | | } |
| | |
| | | * @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)); |
| | | } |
| | |
| | | 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.*; |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | private final LightReportDataService lightReportDataService; |
| | | private final PoleBindingService bindingService; |
| | | private final PoleService poleService; |
| | | private final RedisUtils redisUtils; |
| | | |
| | | /** |
| | | * å½å
¥å½å设å¤ç çè·¯ç¯æ°æ® |
| | |
| | | */ |
| | | |
| | | 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 updateBatchById(lights); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * åRedisä¸åå
¥è®¾å¤ç¶æ |
| | | */ |
| | | public void setCacheData() { |
| | | |
| | | List<String> collect = list().stream().map(Light::getDeviceCode).collect(Collectors.toList()); |
| | | List<List<String>> split = CollectionUtil.split(collect, 100); |
| | | |
| | | List<BatchGetDeviceStateResponse.DeviceStatus> deviceStatuses = null; |
| | | List<RedisDeviceStatus> statusList = null; |
| | | 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 { |
| | | device.setStatus(2); |
| | | } |
| | | statusList.add(device); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | statusList.forEach(status -> { |
| | | redisUtils.set(DeviceRedisKey.LIGHT_DEVICE + status.getDeviceId(), status); |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | if (!"0001".equals(param.getLightAddress()) && !"0002".equals(param.getLightAddress())) { |
| | | throw new BusinessException("ç¯å¤´å°åæ ¼å¼ä¸æ£ç¡®"); |
| | | } |
| | | // LightTask lightTask = getById(null); |
| | | |
| | | |
| | | int week = 0; |
| | |
| | | newPoleMap.forEach( |
| | | commend -> { |
| | | //å¼å
³ç¯æ¶é´ |
| | | // String s = newLightTask.getOpenOrder() + newLightTask.getCloseOrder(); |
| | | // if (newLightTask.getControlOrder() != null) { |
| | | // //æ§ç¯æ¶é´ |
| | | // s = s + newLightTask.getControlOrder(); |
| | | // } |
| | | // // æ´æ°ç³»ç»å®æ¶ |
| | | commend.setSysScheduled(JSON.toJSONString(newLightTask)); |
| | | System.out.println(commend.getIssueStatus() + "ç¶æ"); |
| | | if (commend.getIssueStatus() == 0) { |
| | |
| | | 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(SecurityUtils.getUserId())); |
| | |
| | | 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; |
| | |
| | | //ä¸åæå æ´æ°ç³»ç»å®æ¶åç¡¬ä»¶å®æ¶ |
| | | commend.setDeviceScheduled(JSON.toJSONString(newLightTask)); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | |
| | |
| | | |
| | | //ç¼è¾ååææçç¯æIDéå |
| | | poleIdList.addAll(oldList); |
| | | List<Long> longs = new ArrayList<>(); |
| | | //å»é |
| | | List<Long> collect = poleIdList.stream().distinct().collect(Collectors.toList()); |
| | | // for (Long item : poleIdList) { |
| | | // if (!poleIdList.contains(item)) { |
| | | // longs.add(item); |
| | | // } |
| | | // } |
| | | 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); |
| | |
| | | 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())); |
| | |
| | | * ä¸ååä¸ªç¯æçä»»å¡ |
| | | */ |
| | | 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 false; |
| | | } |
| | | |
| | | |
| | |
| | | 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(); |
| | | boolean ledOnLine = lightemitUtils.getLedOnLine(xiXun.getLightemitControlCode()); |
| | | if (ledOnLine) { |
| | | deviceStatus.setStatus(0); |
| | | } else { |
| | | deviceStatus.setStatus(1); |
| | | } |
| | | redisUtils.set(DeviceRedisKey.XIXUN + xiXun.getLightemitControlCode(), deviceStatus); |
| | | } |
| | | ); |
| | | } |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | package com.sandu.ximon.admin.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import com.sandu.ximon.dao.domain.LightTask; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | |
| | | public class LightTaskRelationVO { |
| | | |
| | | private Long poleId; |
| | | |
| | | private String poleName; |
| | | |
| | | |
| | | private String lightAddress; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | |
| | | # ç产é
ç½®æä»¶ ä¸»æº 39.103.154.108 |
| | | # ç产é
ç½®æä»¶ ä¸»æº 39.103.154.108 127.0.0.1 |
| | | server: |
| | | port: 20018 |
| | | spring: |
| | |
| | | logging: |
| | | file: |
| | | path: logs |
| | | wx: |
| | | pay: |
| | | appId: dsd #微信å
¬ä¼å·æè
å°ç¨åºççappid |
| | | mchId: dsdsd #微信æ¯ä»åæ·å· |
| | | mchKey: dsd #微信æ¯ä»åæ·å¯é¥ |
| | | |
| | | |
| | | # ledå±å¹æå¡å¨å°åï¼æ´æ¹éè¦åæ¶æ´æ¹ï¼ |
| | |
| | | secretKey: zhxm2512209 |
| | | secure: false |
| | | |
| | | #鳿±æå¡å¨å°å |
| | | broadcastApi: |
| | | serviceUrl: http://47.106.172.9:8000 |
| | | |
| | | nova-conf: #诺ç¦è´¦å·å¯ç |
| | | username: zhxm |
| | | password: xm2512209. |
| | | |
| | | #主æ¿rrpcéä¿¡PRODUCT_KEY |
| | | #rrpc: |
| | | # key: a1JsfPG4iKW |