|
|
@@ -0,0 +1,55 @@
|
|
|
+package com.zksy.pole.factory;
|
|
|
+
|
|
|
+import cn.hutool.json.JSON;
|
|
|
+import cn.hutool.json.JSONArray;
|
|
|
+import cn.hutool.json.JSONObject;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
+import com.zksy.common.exception.CommonException;
|
|
|
+import com.zksy.pole.domain.po.*;
|
|
|
+import com.zksy.pole.factory.impl.*;
|
|
|
+
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+public class HandleCmdFactory {
|
|
|
+ public static String HandleCmd(String data) {
|
|
|
+ JSONObject jsonObject = JSONUtil.parseObj(data);
|
|
|
+ if(jsonObject.getInt("cmd") == 6031){
|
|
|
+ var c = new HandleDgEquipmentAlarmCmd();
|
|
|
+ String s = c.HandleCmdMethod(jsonObject.toBean(DgEquipmentAlarm.class));
|
|
|
+ return s;
|
|
|
+ }else if(jsonObject.getInt("cmd") == 6012){
|
|
|
+ var c = new HandleDgEquipmentStatusCmd();
|
|
|
+ String s = c.HandleCmdMethod(jsonObject.toBean(DgEquipmentStatus.class));
|
|
|
+ return s;
|
|
|
+ }else if(jsonObject.getInt("cmd") == 1111){
|
|
|
+ var c = new HandleDgGatewayRegistrationCmd();
|
|
|
+ String s = c.HandleCmdMethod(jsonObject.toBean(DgGatewayRegistration.class));
|
|
|
+ return s;
|
|
|
+ }else if(jsonObject.getInt("cmd") == 6022){
|
|
|
+ var c = new HandleDgGatewayStrategyCmd();
|
|
|
+ String s = c.HandleCmdMethod(jsonObject.toBean(DgGatewayStrategy.class));
|
|
|
+ return s;
|
|
|
+ }else if(jsonObject.getInt("cmd") == 6010){
|
|
|
+ var c = new HandleDgLampControlledHeartbeatCmd();
|
|
|
+ String s = c.HandleCmdMethod(jsonObject.toBean(DgLampControlledHeartbeat.class));
|
|
|
+ return s;
|
|
|
+ }else if(jsonObject.getInt("cmd") == 6014){
|
|
|
+ var c = new HandleDgRelayControlCmd();
|
|
|
+ String s = c.HandleCmdMethod(jsonObject.toBean(DgRelayControl.class));
|
|
|
+ return s;
|
|
|
+ }else if(jsonObject.getInt("cmd") == 6015){
|
|
|
+ var c = new HandleDgRelayTimingStrategyCmd();
|
|
|
+ String s = c.HandleCmdMethod(jsonObject.toBean(DgRelayTimingStrategy.class));
|
|
|
+ return s;
|
|
|
+ }else if(jsonObject.getInt("cmd") == 2000){
|
|
|
+ var c = new HandleDgReportEnvironmentalDataCmd();
|
|
|
+ String s = c.HandleCmdMethod(jsonObject.toBean(DgReportEnvironmentalData.class));
|
|
|
+ return s;
|
|
|
+ }else if(jsonObject.getInt("cmd") == 6011){
|
|
|
+ var c = new HandleDgTimelyControlCmd();
|
|
|
+ String s = c.HandleCmdMethod(jsonObject.toBean(DgTimelyControl.class));
|
|
|
+ return s;
|
|
|
+ }
|
|
|
+ throw new CommonException("cmd有误或者没有对应的cmd处理", 500);
|
|
|
+ }
|
|
|
+}
|