已重命名12个文件
已删除3个文件
已添加14个文件
已修改7个文件
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.api.data; |
| | | |
| | | |
| | | /** |
| | | * ç½å
³ä¸è®¾å¤ç´æ¥çé讯åè®® |
| | | */ |
| | | public enum GatewayDeviceProtocol { |
| | | |
| | | GRAIN_FZZY_ZH_2023("GRAIN_FZZY_ZH_2023", "ç²®æ
-飿£è´è¿æ§å¶æåè®®2023"), |
| | | DEVICE_WEIGHT_HTTP("DEVICE_WEIGHT_HTTP", "å°ç£
-HTTPåè®®"), |
| | | DEVICE_IDCARD_HTTP("DEVICE_IDCARD_HTTP", "身份è¯-HTTPåè®®"), |
| | | DEVICE_LED_HTTP("DEVICE_LED_HTTP", "LED-HTTPåè®®"), |
| | | DEVICE_LPR_HTTP("DEVICE_LPR_HTTP", "车çè¯å«-HTTPåè®®"), |
| | | DEVICE_TEST("DEVICE_TEST", "æµè¯åè®®"); |
| | | |
| | | |
| | | private String code; |
| | | private String name; |
| | | |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(String code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | GatewayDeviceProtocol(String code, String name) { |
| | | this.code = code; |
| | | this.name = name; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.api.data; |
| | | |
| | | |
| | | /** |
| | | * ç³»ç»ä¸ç½å
³ä¹é´çé讯åè®® |
| | | */ |
| | | public enum GatewayProtocol { |
| | | |
| | | GATE_WEBSOCKET("GATE_WEBSOCKET", "webSocket"), |
| | | GATE_MQTT("GATE_MQTT", "MQTT"), |
| | | GATE_HTTP("GATE_HTTP", "HTTP"), |
| | | GATE_TEST("GATE_TEST", "æµè¯"); |
| | | |
| | | |
| | | private String code; |
| | | private String name; |
| | | |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(String code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | GatewayProtocol(String code, String name) { |
| | | this.code = code; |
| | | this.name = name; |
| | | } |
| | | } |
| | |
| | | import com.bstek.dorado.annotation.DataProvider; |
| | | import com.bstek.dorado.annotation.Expose; |
| | | import com.fzzy.api.Constant; |
| | | import com.fzzy.api.data.GatewayDeviceProtocol; |
| | | import com.fzzy.api.data.GatewayProtocol; |
| | | import com.fzzy.api.data.PushProtocol; |
| | | import com.fzzy.api.data.SyncProtocol; |
| | | import com.fzzy.api.entity.ApiTrigger; |
| | |
| | | list.add(new ApiTrigger(PushProtocol.HB_FZZY_JG_2022.getCode(), PushProtocol.HB_FZZY_JG_2022.getName())); |
| | | list.add(new ApiTrigger(PushProtocol.SB_SHJdJW_2023.getCode(), PushProtocol.SB_SHJdJW_2023.getName())); |
| | | list.add(new ApiTrigger(PushProtocol.SB_SH_2023.getCode(), PushProtocol.SB_SH_2023.getName())); |
| | | |
| | | list.add(new ApiTrigger(PushProtocol.GATEWAY_SC_2023.getCode(), PushProtocol.GATEWAY_SC_2023.getName())); |
| | | return list; |
| | | } |
| | | |
| | |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * ${dorado.getDataProvider("apiTriggerService#triggerGatewayProtocol").getResult()} |
| | | * ç³»ç»ä¸ç½å
³ç´æ¥çé讯åè®® |
| | | * |
| | | * @return |
| | | */ |
| | | @DataProvider |
| | | public List<ApiTrigger> triggerGatewayProtocol() { |
| | | List<ApiTrigger> list = new ArrayList<>(); |
| | | list.add(new ApiTrigger(GatewayProtocol.GATE_HTTP.getCode(), GatewayProtocol.GATE_HTTP.getName())); |
| | | list.add(new ApiTrigger(GatewayProtocol.GATE_MQTT.getCode(), GatewayProtocol.GATE_MQTT.getName())); |
| | | list.add(new ApiTrigger(GatewayProtocol.GATE_WEBSOCKET.getCode(), GatewayProtocol.GATE_WEBSOCKET.getName())); |
| | | list.add(new ApiTrigger(GatewayProtocol.GATE_TEST.getName(), GatewayProtocol.GATE_TEST.getName())); |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * ${dorado.getDataProvider("apiTriggerService#triggerGatewayDeviceProtocol").getResult()} |
| | | * ç³»ç»ä¸ç½å
³ç´æ¥çé讯åè®® |
| | | * |
| | | * @return |
| | | */ |
| | | @DataProvider |
| | | public List<ApiTrigger> triggerGatewayDeviceProtocol() { |
| | | List<ApiTrigger> list = new ArrayList<>(); |
| | | list.add(new ApiTrigger(GatewayDeviceProtocol.GRAIN_FZZY_ZH_2023.getCode(), GatewayDeviceProtocol.GRAIN_FZZY_ZH_2023.getName())); |
| | | |
| | | list.add(new ApiTrigger(GatewayDeviceProtocol.DEVICE_WEIGHT_HTTP.getCode(), GatewayDeviceProtocol.DEVICE_WEIGHT_HTTP.getName())); |
| | | list.add(new ApiTrigger(GatewayDeviceProtocol.DEVICE_IDCARD_HTTP.getCode(), GatewayDeviceProtocol.DEVICE_IDCARD_HTTP.getName())); |
| | | list.add(new ApiTrigger(GatewayDeviceProtocol.DEVICE_LED_HTTP.getCode(), GatewayDeviceProtocol.DEVICE_LED_HTTP.getName())); |
| | | list.add(new ApiTrigger(GatewayDeviceProtocol.DEVICE_LPR_HTTP.getCode(), GatewayDeviceProtocol.DEVICE_LPR_HTTP.getName())); |
| | | list.add(new ApiTrigger(GatewayDeviceProtocol.DEVICE_TEST.getCode(), GatewayDeviceProtocol.DEVICE_TEST.getName())); |
| | | |
| | | return list; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.fzzy.gateway; |
| | | |
| | | import com.fzzy.gateway.sc2023.service.ApiInitService; |
| | | import com.fzzy.gateway.hx2023.service.ApiInitService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.boot.CommandLineRunner; |
| | | import org.springframework.core.annotation.Order; |
| | |
| | | |
| | | //åå·ç½å
³æ¥å£ï¼å¯å¨é»è®¤è·åé´æä¿¡æ¯ï¼é¿æææ |
| | | apiInitService.init(); |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * æ¥å£å°è£
|
| | | */ |
| | | @Component |
| | | public class GatewayRemoteManager implements ApplicationContextAware { |
| | | |
| | | public static Map<String, GatewayRemoteService> remoteMap = new HashMap<>(); |
| | | |
| | | public static Map<String, GatewaySyncService> syncMap = new HashMap<>(); |
| | | public static Map<String, GatewaySyncGranService> syncGrain = new HashMap<>(); |
| | | |
| | | public static Map<String, GatewaySyncIdCardService> syncIdCard = new HashMap<>(); |
| | | |
| | | public static Map<String, GatewaySyncLedService> syncLed = new HashMap<>(); |
| | | |
| | | public static Map<String, GatewaySyncLprService> syncLpr = new HashMap<>(); |
| | | |
| | | public static Map<String, GatewaySyncWeightService> syncWeight = new HashMap<>(); |
| | | |
| | | @Override |
| | | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { |
| | | Map<String, GatewayRemoteService> serviceMap1 = applicationContext.getBeansOfType(GatewayRemoteService.class); |
| | | |
| | | for (String key : serviceMap1.keySet()) { |
| | | remoteMap.put(serviceMap1.get(key).getProtocol(), serviceMap1.get(key)); |
| | | } |
| | | |
| | | |
| | | Map<String, GatewaySyncService> serviceMap2 = applicationContext.getBeansOfType(GatewaySyncService.class); |
| | | |
| | | Map<String, GatewaySyncGranService> serviceMap2 = applicationContext.getBeansOfType(GatewaySyncGranService.class); |
| | | for (String key : serviceMap2.keySet()) { |
| | | syncMap.put(serviceMap2.get(key).getProtocol(), serviceMap2.get(key)); |
| | | syncGrain.put(serviceMap2.get(key).getGrainProtocol(), serviceMap2.get(key)); |
| | | } |
| | | |
| | | Map<String, GatewaySyncIdCardService> serviceMap3 = applicationContext.getBeansOfType(GatewaySyncIdCardService.class); |
| | | for (String key : serviceMap3.keySet()) { |
| | | syncIdCard.put(serviceMap3.get(key).getIdCardProtocol(), serviceMap3.get(key)); |
| | | } |
| | | |
| | | |
| | | Map<String, GatewaySyncLedService> serviceMap4 = applicationContext.getBeansOfType(GatewaySyncLedService.class); |
| | | for (String key : serviceMap4.keySet()) { |
| | | syncLed.put(serviceMap4.get(key).getLedProtocol(), serviceMap4.get(key)); |
| | | } |
| | | |
| | | Map<String, GatewaySyncLprService> serviceMap5 = applicationContext.getBeansOfType(GatewaySyncLprService.class); |
| | | for (String key : serviceMap5.keySet()) { |
| | | syncLpr.put(serviceMap5.get(key).getLprProtocol(), serviceMap5.get(key)); |
| | | } |
| | | |
| | | Map<String, GatewaySyncWeightService> serviceMap6 = applicationContext.getBeansOfType(GatewaySyncWeightService.class); |
| | | for (String key : serviceMap6.keySet()) { |
| | | syncWeight.put(serviceMap6.get(key).getWeightProtocol(), serviceMap6.get(key)); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | * @param protocol |
| | | * @return |
| | | */ |
| | | public GatewaySyncService getSyncService(String protocol) { |
| | | return syncMap.get(protocol); |
| | | public GatewaySyncGranService getSyncGrainService(String protocol) { |
| | | return syncGrain.get(protocol); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®å®ç°åè®®è·åå½åå®ç°æ¹æ³ |
| | | * |
| | | * @param protocol |
| | | * @return |
| | | */ |
| | | public GatewaySyncIdCardService getSyncIdCardService(String protocol) { |
| | | return syncIdCard.get(protocol); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®å®ç°åè®®è·åå½åå®ç°æ¹æ³ |
| | | * |
| | | * @param protocol |
| | | * @return |
| | | */ |
| | | public GatewaySyncLedService getSyncLedService(String protocol) { |
| | | return syncLed.get(protocol); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®å®ç°åè®®è·åå½åå®ç°æ¹æ³ |
| | | * |
| | | * @param protocol |
| | | * @return |
| | | */ |
| | | public GatewaySyncLprService getSyncLprService(String protocol) { |
| | | return syncLpr.get(protocol); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®å®ç°åè®®è·åå½åå®ç°æ¹æ³ |
| | | * |
| | | * @param protocol |
| | | * @return |
| | | */ |
| | | public GatewaySyncWeightService getSyncWeightService(String protocol) { |
| | | return syncWeight.get(protocol); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.gateway.api; |
| | | |
| | | |
| | | import com.fzzy.gateway.hx2023.data.GrainData; |
| | | import com.fzzy.gateway.hx2023.data.*; |
| | | |
| | | /** |
| | | * ç½å
³è®¾å¤åæ¥æ¥å£ï¼æ ¹æ®ä¸å¡éæ±å®ä¹æ¥å£ |
| | | */ |
| | | public interface GatewaySyncGranService { |
| | | |
| | | /** |
| | | * åè®®å®ä¹ |
| | | * |
| | | * @return |
| | | */ |
| | | String getGrainProtocol(); |
| | | |
| | | /** |
| | | * åæ¥ç²®æ
ä¿¡æ¯ |
| | | * |
| | | * @param reqData |
| | | * @return |
| | | */ |
| | | public GrainData syncGrain(SyncReqData reqData); |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.gateway.api; |
| | | |
| | | |
| | | import com.fzzy.gateway.hx2023.data.IdCardData; |
| | | import com.fzzy.gateway.hx2023.data.*; |
| | | |
| | | /** |
| | | * ç½å
³è®¾å¤åæ¥æ¥å£ï¼æ ¹æ®ä¸å¡éæ±å®ä¹æ¥å£ |
| | | */ |
| | | public interface GatewaySyncIdCardService { |
| | | |
| | | /** |
| | | * åè®®å®ä¹ |
| | | * |
| | | * @return |
| | | */ |
| | | String getIdCardProtocol(); |
| | | |
| | | /** |
| | | * 身份è¯è¯»å¡å¨ |
| | | * |
| | | * @return |
| | | */ |
| | | public IdCardData syncIdCard(SyncReqData reqData); |
| | | |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.gateway.api; |
| | | |
| | | |
| | | import com.fzzy.gateway.hx2023.data.*; |
| | | |
| | | /** |
| | | * ç½å
³è®¾å¤åæ¥æ¥å£ï¼æ ¹æ®ä¸å¡éæ±å®ä¹æ¥å£ |
| | | */ |
| | | public interface GatewaySyncLedService { |
| | | |
| | | /** |
| | | * åè®®å®ä¹ |
| | | * |
| | | * @return |
| | | */ |
| | | String getLedProtocol(); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * æ¨éæ¥æç»LED |
| | | * <p> |
| | | * TODO>>>>>å½åæ¥å£ææ¡£ç䏿 |
| | | * |
| | | * @return |
| | | */ |
| | | public String push2Led(SyncReqData reqData); |
| | | |
| | | |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.gateway.api; |
| | | |
| | | |
| | | import com.fzzy.gateway.hx2023.data.*; |
| | | |
| | | /** |
| | | * ç½å
³è®¾å¤åæ¥æ¥å£ï¼æ ¹æ®ä¸å¡éæ±å®ä¹æ¥å£ |
| | | */ |
| | | public interface GatewaySyncLprService { |
| | | |
| | | /** |
| | | * åè®®å®ä¹ |
| | | * |
| | | * @return |
| | | */ |
| | | String getLprProtocol(); |
| | | |
| | | |
| | | /** |
| | | * 车çè¯å«è·å |
| | | * |
| | | * @return |
| | | */ |
| | | public LprData syncLpr(SyncReqData reqData); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.gateway.api; |
| | | |
| | | |
| | | import com.fzzy.gateway.hx2023.data.*; |
| | | |
| | | /** |
| | | * ç½å
³è®¾å¤åæ¥æ¥å£ï¼æ ¹æ®ä¸å¡éæ±å®ä¹æ¥å£ |
| | | */ |
| | | public interface GatewaySyncWeightService { |
| | | |
| | | /** |
| | | * åè®®å®ä¹ |
| | | * |
| | | * @return |
| | | */ |
| | | String getWeightProtocol(); |
| | | |
| | | |
| | | /** |
| | | * 忥å°ç£
ä¿¡æ¯ |
| | | * |
| | | * @return |
| | | */ |
| | | public WeightInfo syncWeightInfo(SyncReqData reqData); |
| | | |
| | | } |
| | |
| | | @Data |
| | | public class GatewayResult implements Serializable { |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public String token; |
| | | } |
| | |
| | | @Column(name = "kqmc", length = 100) |
| | | private String kqmc; |
| | | |
| | | @PropertyDef(label = "ç½å
³ID") |
| | | @Column(name = "gatewayId", length = 50) |
| | | private String gatewayId; |
| | | |
| | | @PropertyDef(label = "ç½å
³IP") |
| | | @Column(name = "gatewayIp", length = 20) |
| | | private String gatewayIp; |
| | | |
| | | @PropertyDef(label = "ç½å
³Mac") |
| | | @Column(name = "gatewayMac", length = 20) |
| | | private String gatewayMac; |
| | | |
| | | @PropertyDef(label = "ç½å
³CPU") |
| | | @Column(name = "gatewayCPU", length = 50) |
| | | private String gatewayCPU; |
| | | |
| | | @PropertyDef(label = "ç½å
³å
å") |
| | | @Column(name = "gatewayMem", length = 50) |
| | | private String gatewayMem; |
| | | |
| | | @PropertyDef(label = "ç½å
³ç¡¬ç") |
| | | @Column(name = "gatewayHardDisk", length = 50) |
| | | private String gatewayHardDisk; |
| | | |
| | | @PropertyDef(label = "ç¨æ·å") |
| | | @Column(name = "username", length = 50) |
| | | private String userName; |
| | |
| | | @Column(name = "apiUrl", length = 200) |
| | | private String apiUrl; |
| | | |
| | | @PropertyDef(label = "appId") |
| | | @Column(name = "appId", length = 50) |
| | | private String appId; |
| | | |
| | | @PropertyDef(label = "æ¨éåè®®") |
| | | @Column(name = "pushProtocol", length = 20) |
| | | private String pushProtocol; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.gateway.hx2023; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 常é |
| | | */ |
| | | public class ScConstant { |
| | | |
| | | public static String API_URL_AUTH = "${auth}/authorize/login"; |
| | | |
| | | |
| | | /** |
| | | * 设å¤å¨çº¿æ è®°ï¼é对WEBSocket请æ±ï¼æ§å¶è®¾å¤æ¯å¦å¨çº¿ï¼key = deviceIdï¼Value=Y/N |
| | | */ |
| | | public static Map<String, String> contextOnlineMap = new HashMap<>(); |
| | | |
| | | |
| | | public static void updateOnline(String deviceId) { |
| | | contextOnlineMap.put(deviceId, "Y"); |
| | | } |
| | | |
| | | public static void updateOffOnline(String deviceId) { |
| | | contextOnlineMap.put(deviceId, "N"); |
| | | } |
| | | |
| | | public static boolean isOnline(String deviceId) { |
| | | String value = contextOnlineMap.get(deviceId); |
| | | if (null == value || "N".equals(value)) return false; |
| | | return true; |
| | | } |
| | | |
| | | |
| | | } |
ÎļþÃû´Ó src/main/java/com/fzzy/gateway/sc2023/data/GrainData.java ÐÞ¸Ä |
| | |
| | | package com.fzzy.gateway.sc2023.data; |
| | | package com.fzzy.gateway.hx2023.data; |
| | | |
| | | import lombok.Data; |
| | | |
ÎļþÃû´Ó src/main/java/com/fzzy/gateway/sc2023/data/IdCardData.java ÐÞ¸Ä |
| | |
| | | package com.fzzy.gateway.sc2023.data; |
| | | package com.fzzy.gateway.hx2023.data; |
| | | |
| | | import lombok.Data; |
| | | |
ÎļþÃû´Ó src/main/java/com/fzzy/gateway/sc2023/data/LprData.java ÐÞ¸Ä |
| | |
| | | package com.fzzy.gateway.sc2023.data; |
| | | package com.fzzy.gateway.hx2023.data; |
| | | |
| | | import lombok.Data; |
| | | |
ÎļþÃû´Ó src/main/java/com/fzzy/gateway/sc2023/data/SyncReqData.java ÐÞ¸Ä |
| | |
| | | package com.fzzy.gateway.sc2023.data; |
| | | package com.fzzy.gateway.hx2023.data; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class SyncReqData { |
| | | |
| | | private String productId; |
ÎļþÃû´Ó src/main/java/com/fzzy/gateway/sc2023/data/WebSocketPacket.java ÐÞ¸Ä |
| | |
| | | package com.fzzy.gateway.sc2023.data; |
| | | package com.fzzy.gateway.hx2023.data; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import lombok.Data; |
ÎļþÃû´Ó src/main/java/com/fzzy/gateway/sc2023/data/WebSocketPacketHeader.java ÐÞ¸Ä |
| | |
| | | package com.fzzy.gateway.sc2023.data; |
| | | package com.fzzy.gateway.hx2023.data; |
| | | |
| | | import lombok.Data; |
| | | |
ÎļþÃû´Ó src/main/java/com/fzzy/gateway/sc2023/data/WeightInfo.java ÐÞ¸Ä |
| | |
| | | package com.fzzy.gateway.sc2023.data; |
| | | package com.fzzy.gateway.hx2023.data; |
| | | |
| | | import lombok.Data; |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /** |
| | | * åä¿¡-2023å¹´æ¥å£ |
| | | */ |
| | | package com.fzzy.gateway.hx2023; |
| | | |
ÎļþÃû´Ó src/main/java/com/fzzy/gateway/sc2023/service/ApiInitService.java ÐÞ¸Ä |
| | |
| | | package com.fzzy.gateway.sc2023.service; |
| | | package com.fzzy.gateway.hx2023.service; |
| | | |
| | | import com.fzzy.gateway.api.GatewayRemoteManager; |
| | | import com.fzzy.gateway.api.GatewayRemoteService; |
ÎļþÃû´Ó src/main/java/com/fzzy/gateway/sc2023/service/ScGatewayRemoteServiceImpl.java ÐÞ¸Ä |
| | |
| | | package com.fzzy.gateway.sc2023.service; |
| | | package com.fzzy.gateway.hx2023.service; |
| | | |
| | | import com.fzzy.api.data.AuthToken; |
| | | import com.fzzy.api.data.PushProtocol; |
| | |
| | | import com.fzzy.gateway.api.GatewayRemoteService; |
| | | import com.fzzy.gateway.data.GatewayResponse; |
| | | import com.fzzy.gateway.entity.GatewayConf; |
| | | import com.fzzy.gateway.sc2023.ScConstant; |
| | | import com.fzzy.gateway.hx2023.ScConstant; |
| | | import com.fzzy.push.gb2022.HttpClientUtil; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Slf4j |
| | | @Data |
| | | @Service |
| | | public class ScGatewayRemoteServiceImpl implements GatewayRemoteService { |
| | | @Component |
| | | public class HxGatewayRemoteServiceImpl implements GatewayRemoteService { |
| | | |
| | | |
| | | @Resource |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.gateway.hx2023.service; |
| | | |
| | | import com.fzzy.gateway.api.GatewaySyncGranService; |
| | | import com.fzzy.gateway.hx2023.data.GrainData; |
| | | import com.fzzy.gateway.hx2023.data.SyncReqData; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * ç½å
³ä¸ç²®æ
åæºé讯åè§£æ |
| | | */ |
| | | @Slf4j |
| | | @Data |
| | | @Component |
| | | public class HxGatewaySyncGrainImpl implements GatewaySyncGranService { |
| | | |
| | | |
| | | @Override |
| | | public String getGrainProtocol() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public GrainData syncGrain(SyncReqData reqData) { |
| | | return null; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.gateway.hx2023.service; |
| | | |
| | | import com.fzzy.gateway.api.GatewaySyncIdCardService; |
| | | import com.fzzy.gateway.api.GatewaySyncLedService; |
| | | import com.fzzy.gateway.api.GatewaySyncLprService; |
| | | import com.fzzy.gateway.api.GatewaySyncWeightService; |
| | | import com.fzzy.gateway.hx2023.data.IdCardData; |
| | | import com.fzzy.gateway.hx2023.data.*; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * ç½å
³ä¸è®¾å¤ä¹é´çé讯 |
| | | */ |
| | | @Slf4j |
| | | @Data |
| | | @Component |
| | | public class HxGatewaySyncIdCardImpl1 implements GatewaySyncIdCardService { |
| | | |
| | | |
| | | @Override |
| | | public String getIdCardProtocol() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public IdCardData syncIdCard(SyncReqData reqData) { |
| | | return null; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.gateway.hx2023.service; |
| | | |
| | | import com.fzzy.gateway.api.GatewaySyncLedService; |
| | | import com.fzzy.gateway.hx2023.data.SyncReqData; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * ç½å
³ä¸è®¾å¤ä¹é´çé讯 |
| | | */ |
| | | @Slf4j |
| | | @Data |
| | | @Component |
| | | public class HxGatewaySyncLedImpl1 implements GatewaySyncLedService { |
| | | |
| | | |
| | | @Override |
| | | public String getLedProtocol() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public String push2Led(SyncReqData reqData) { |
| | | return null; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.gateway.hx2023.service; |
| | | |
| | | import com.fzzy.gateway.api.GatewaySyncLedService; |
| | | import com.fzzy.gateway.api.GatewaySyncLprService; |
| | | import com.fzzy.gateway.hx2023.data.LprData; |
| | | import com.fzzy.gateway.hx2023.data.SyncReqData; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * ç½å
³ä¸è®¾å¤ä¹é´çé讯 |
| | | */ |
| | | @Slf4j |
| | | @Data |
| | | @Component |
| | | public class HxGatewaySyncLprImpl1 implements GatewaySyncLprService { |
| | | |
| | | |
| | | @Override |
| | | public String getLprProtocol() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public LprData syncLpr(SyncReqData reqData) { |
| | | return null; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.gateway.hx2023.service; |
| | | |
| | | import com.fzzy.api.data.GatewayDeviceProtocol; |
| | | import com.fzzy.gateway.api.GatewaySyncLprService; |
| | | import com.fzzy.gateway.api.GatewaySyncWeightService; |
| | | import com.fzzy.gateway.hx2023.data.LprData; |
| | | import com.fzzy.gateway.hx2023.data.SyncReqData; |
| | | import com.fzzy.gateway.hx2023.data.WeightInfo; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * ç½å
³ä¸è®¾å¤ä¹é´çé讯 |
| | | */ |
| | | @Slf4j |
| | | @Data |
| | | @Component |
| | | public class HxGatewaySyncWeightImpl1 implements GatewaySyncWeightService { |
| | | |
| | | |
| | | @Override |
| | | public String getWeightProtocol() { |
| | | return GatewayDeviceProtocol.DEVICE_WEIGHT_HTTP.getCode(); |
| | | } |
| | | |
| | | @Override |
| | | public WeightInfo syncWeightInfo(SyncReqData reqData) { |
| | | |
| | | |
| | | |
| | | return null; |
| | | } |
| | | } |
ÎļþÃû´Ó src/main/java/com/fzzy/gateway/sc2023/websocket/WebSocketDevice.java ÐÞ¸Ä |
| | |
| | | package com.fzzy.gateway.sc2023.websocket; |
| | | package com.fzzy.gateway.hx2023.websocket; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.fzzy.gateway.sc2023.data.WebSocketPacket; |
| | | import com.fzzy.gateway.hx2023.ScConstant; |
| | | import com.fzzy.gateway.hx2023.data.WebSocketPacket; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | @ServerEndpoint(value = "/device/${productId}/${deviceId}/message/property/report") |
| | | @ServerEndpoint(value = "/device/{productId}/{deviceId}/message/property/report") |
| | | public class WebSocketDevice { |
| | | |
| | | private static Map<String, Session> sessionPool = new ConcurrentHashMap<>(); |
| | |
| | | sessionPool.put(key, session); |
| | | sessionIds.put(session.getId(), key); |
| | | |
| | | ScConstant.updateOnline(deviceId); |
| | | |
| | | log.info("new webSocket,clientId={}", key); |
| | | } |
| | | |
| | |
| | | |
| | | String key = sessionIds.get(session.getId()); |
| | | |
| | | String deviceId = key.substring(0, key.indexOf("-")); |
| | | |
| | | ScConstant.updateOffOnline(deviceId); |
| | | |
| | | sessionPool.remove(key); |
| | | sessionIds.remove(session.getId()); |
| | | |
| | | log.info("WebSocketè¿æ¥å
³é={}", key); |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | String key = sessionIds.get(session.getId()); |
| | | |
| | | String deviceId = key.substring(0, key.indexOf("-")); |
| | | |
| | | ScConstant.updateOffOnline(deviceId); |
| | | |
| | | sessionPool.remove(key); |
| | | sessionIds.remove(session.getId()); |
| | | error.printStackTrace(); |
| | |
| | | |
| | | |
| | | /** |
| | | * æ¨éä¿¡æ¯å°å端 |
| | | * |
| | | * @param packet |
| | | */ |
| | | public static void sendByPacket(WebSocketPacket packet) { |
ÎļþÃû´Ó src/main/java/com/fzzy/gateway/sc2023/websocket/WebSocketDeviceLed.java ÐÞ¸Ä |
| | |
| | | package com.fzzy.gateway.sc2023.websocket; |
| | | package com.fzzy.gateway.hx2023.websocket; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.fzzy.gateway.sc2023.data.WebSocketPacket; |
| | | import com.fzzy.gateway.hx2023.ScConstant; |
| | | import com.fzzy.gateway.hx2023.data.WebSocketPacket; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | @ServerEndpoint(value = "/device-message-sender/${productId}/${deviceId}") |
| | | @ServerEndpoint(value = "/device-message-sender/{productId}/{deviceId}") |
| | | public class WebSocketDeviceLed { |
| | | |
| | | private static Map<String, Session> sessionPool = new ConcurrentHashMap<>(); |
| | |
| | | sessionPool.put(key, session); |
| | | sessionIds.put(session.getId(), key); |
| | | |
| | | ScConstant.updateOnline(deviceId); |
| | | |
| | | log.info("new webSocket,clientId={}", key); |
| | | } |
| | | |
| | |
| | | |
| | | sessionPool.remove(key); |
| | | sessionIds.remove(session.getId()); |
| | | |
| | | String deviceId = key.substring(0, key.indexOf("-")); |
| | | |
| | | ScConstant.updateOffOnline(deviceId); |
| | | |
| | | log.info("WebSocketè¿æ¥å
³é={}", key); |
| | | |
| | |
| | | |
| | | String key = sessionIds.get(session.getId()); |
| | | |
| | | String deviceId = key.substring(0, key.indexOf("-")); |
| | | |
| | | ScConstant.updateOffOnline(deviceId); |
| | | |
| | | sessionPool.remove(key); |
| | | sessionIds.remove(session.getId()); |
| | | error.printStackTrace(); |
ÎļþÃû´Ó src/main/java/com/fzzy/gateway/sc2023/websocket/WebSocketMqtt.java ÐÞ¸Ä |
| | |
| | | package com.fzzy.gateway.sc2023.websocket; |
| | | package com.fzzy.gateway.hx2023.websocket; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | |
| | | <DataType name="dtMain"> |
| | | <Property name="creationType">com.fzzy.gateway.entity.GatewayConf</Property> |
| | | <PropertyDef name="kqmc"> |
| | | <Property/> |
| | | <Property></Property> |
| | | <Property name="label">åºåºåç§°</Property> |
| | | <Property name="required">true</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="kqdm"> |
| | | <Property/> |
| | | <Property></Property> |
| | | <Property name="label">åºåºä»£ç </Property> |
| | | <Property name="required">true</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="userName"> |
| | | <PropertyDef name="appId"> |
| | | <Property/> |
| | | <Property name="label">appId</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="gatewayId"> |
| | | <Property/> |
| | | <Property name="label">ç½å
³ID</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="gatewayIp"> |
| | | <Property/> |
| | | <Property name="label">ç½å
³IP</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="gatewayMac"> |
| | | <Property/> |
| | | <Property name="label">ç½å
³Mac</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="gatewayCPU"> |
| | | <Property/> |
| | | <Property name="label">ç½å
³CPU</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="gatewayMem"> |
| | | <Property/> |
| | | <Property name="label">ç½å
³å
å</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="gatewayHardDisk"> |
| | | <Property/> |
| | | <Property name="label">ç½å
³ç¡¬ç</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="userName"> |
| | | <Property></Property> |
| | | <Property name="label">çå¹³å°å¸å·</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="password"> |
| | | <Property/> |
| | | <Property></Property> |
| | | <Property name="label">çå¹³å°å¯ç </Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="publicKey"> |
| | | <Property/> |
| | | <Property></Property> |
| | | <Property name="label">çå¹³å°å
¬é¥</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="apiUrl"> |
| | | <Property/> |
| | | <Property></Property> |
| | | <Property name="label">ç平尿¥å£å°å</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="exeTag"> |
| | | <Property/> |
| | | <Property></Property> |
| | | <Property name="label">æ¯å¦å¯ç¨</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="pushProtocol"> |
| | | <Property></Property> |
| | | <Property name="label">ä¸è¡åè®®</Property> |
| | | <Property name="label">çå¹³å°åè®®</Property> |
| | | <Property name="mapping"> |
| | | <Property name="mapValues">${dorado.getDataProvider("apiTriggerService#triggerPushProtocol").getResult()}</Property> |
| | | <Property name="keyProperty">code</Property> |
| | |
| | | <Property name="required">true</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="deptId"> |
| | | <Property/> |
| | | <Property></Property> |
| | | <Property name="label">ç²®åºç³»ç»ä¸åºåºç¼ç </Property> |
| | | </PropertyDef> |
| | | </DataType> |
| | |
| | | <Editor/> |
| | | </AutoFormElement> |
| | | <AutoFormElement> |
| | | <Property name="name">gatewayId</Property> |
| | | <Property name="property">gatewayId</Property> |
| | | <Editor/> |
| | | </AutoFormElement> |
| | | <AutoFormElement> |
| | | <Property name="name">gatewayIp</Property> |
| | | <Property name="property">gatewayIp</Property> |
| | | <Editor/> |
| | | </AutoFormElement> |
| | | <AutoFormElement> |
| | | <Property name="name">gatewayMac</Property> |
| | | <Property name="property">gatewayMac</Property> |
| | | <Editor/> |
| | | </AutoFormElement> |
| | | <AutoFormElement> |
| | | <Property name="name">gatewayCPU</Property> |
| | | <Property name="property">gatewayCPU</Property> |
| | | <Editor/> |
| | | </AutoFormElement> |
| | | <AutoFormElement> |
| | | <Property name="name">gatewayMem</Property> |
| | | <Property name="property">gatewayMem</Property> |
| | | <Editor/> |
| | | </AutoFormElement> |
| | | <AutoFormElement> |
| | | <Property name="name">gatewayHardDisk</Property> |
| | | <Property name="property">gatewayHardDisk</Property> |
| | | <Editor/> |
| | | </AutoFormElement> |
| | | <AutoFormElement> |
| | | <Property name="name">appId</Property> |
| | | <Property name="property">appId</Property> |
| | | <Editor/> |
| | | </AutoFormElement> |
| | | <AutoFormElement> |
| | | <Property name="name">userName</Property> |
| | | <Property name="property">userName</Property> |
| | | <Editor/> |
| | |
| | | <DataType name="dtMain"> |
| | | <Property name="creationType">com.fzzy.gateway.entity.GatewayDevice</Property> |
| | | <PropertyDef name="id"> |
| | | <Property/> |
| | | <Property></Property> |
| | | <Property name="label">ç³»ç»ID</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="deviceId"> |
| | | <Property/> |
| | | <Property></Property> |
| | | <Property name="label">设å¤ID</Property> |
| | | <Property name="required">true</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="deviceName"> |
| | | <Property/> |
| | | <Property></Property> |
| | | <Property name="label">åç§°</Property> |
| | | <Property name="required">true</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="type"> |
| | | <Property/> |
| | | <Property></Property> |
| | | <Property name="label">设å¤ç±»å</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="depotId"> |
| | | <Property/> |
| | | <Property></Property> |
| | | <Property name="label">æå±ä»åº</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="depotName"> |
| | | <Property/> |
| | | <Property></Property> |
| | | <Property name="label">æå±ä»åº</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="ip"> |
| | | <Property/> |
| | | <Property></Property> |
| | | <Property name="label">é讯IP</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="port"> |
| | |
| | | <Property name="label">é讯端å£</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="rtsp"> |
| | | <Property/> |
| | | <Property></Property> |
| | | <Property name="label">è§é¢RTSP</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="syncProtocol"> |
| | | <Property/> |
| | | <Property name="label">设å¤åè®®</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="pushProtocol"> |
| | | <Property></Property> |
| | | <Property name="label">ç½å
³é讯</Property> |
| | | <Property name="label">ç³»ç»ç½å
³é讯åè®®</Property> |
| | | <Property name="mapping"> |
| | | <Property name="mapValues">${dorado.getDataProvider("apiTriggerService#triggerPushProtocol").getResult()}</Property> |
| | | <Property name="mapValues">${dorado.getDataProvider("apiTriggerService#triggerGatewayProtocol").getResult()}</Property> |
| | | <Property name="keyProperty">code</Property> |
| | | <Property name="valueProperty">name</Property> |
| | | </Property> |
| | | <Property name="required">true</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="syncProtocol"> |
| | | <Property></Property> |
| | | <Property name="label">ç½å
³ä¸è®¾å¤é讯åè®®</Property> |
| | | <Property name="mapping"> |
| | | <Property name="keyProperty">code</Property> |
| | | <Property name="valueProperty">name</Property> |
| | | <Property name="mapValues">${dorado.getDataProvider("apiTriggerService#triggerGatewayDeviceProtocol").getResult()}</Property> |
| | | </Property> |
| | | <Property name="required">true</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="orgId"> |
| | | <Property/> |
| | | <Property></Property> |
| | | <Property name="label">ç»ç»ç¼ç </Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="remark"> |
| | | <Property/> |
| | | <Property></Property> |
| | | <Property name="label">夿³¨</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="httpUrl"> |
| | | <Property/> |
| | | <Property></Property> |
| | | <Property name="label">HTTPå°å</Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="deviceSn"> |
| | | <Property/> |
| | | <Property name="label">设å¤åºåå·</Property> |
| | | </PropertyDef> |
| | | </DataType> |
| | | </Model> |
| | | <View layout="regionPadding:10"> |