ソースを参照

Merge branch '20210223' of http://114.135.61.188:53000/UIMS/Code into 20210223

wangbo 3 年 前
コミット
98612e5712

+ 9 - 4
sms_water/src/main/java/com/huaxu/dto/SetupMethod.java

@@ -8,11 +8,16 @@ import java.util.Date;
 
 @Data
 public class SetupMethod {
-
+//    {
+//        "deviceId":"912cf9e7-8557-4792-a2f9-27ba72bbcb89",
+//            "unitIdentifier":"867126056979409",
+//            "receiveTime":"2021-05-19 09:50:15",
+//            "method":"WriteValve",
+//            "params":{"electronicNo":"AAAAAAAAAAAAAA","valveStatus":"1"}}
     private String deviceId;
-    private String deviceMode;
-    private String deviceType;
-    private String manufacturer;
+    //private String deviceMode;
+    //private String deviceType;
+    //private String manufacturer;
     private String method;
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
     private Date receiveTime;

+ 1 - 1
sms_water/src/main/java/com/huaxu/entity/DeviceSetupMethodEntity.java

@@ -31,7 +31,7 @@ public class DeviceSetupMethodEntity{
     /** 属性ID */
     private Long attributeId;
 
-    /** 类型(0水泵控制 1压力调节 2水表开关阀) */
+    /** 类型(3水泵控制 4压力调节 5水表开关阀) */
     private Integer type;
 
     /** 方法名 */

+ 9 - 6
sms_water/src/main/java/com/huaxu/service/DeviceSetupMethodService.java

@@ -134,15 +134,16 @@ public class DeviceSetupMethodService extends ServiceImpl<DeviceSetupMethodMappe
         //查询到操作方法后执行操作
         if (deviceSetupMethodEntities.size() > 0) {
             //查询设备型号
-            DeviceTypeEntity deviceTypeEntity = deviceTypeService.findDeviceTypeById(Long.valueOf(deviceEntity.getDeviceTypeId()));
+            //DeviceTypeEntity deviceTypeEntity = deviceTypeService.findDeviceTypeById(Long.valueOf(deviceEntity.getDeviceTypeId()));
             String method = deviceSetupMethodEntities.get(0).getMethod();
             methodParms = deviceSetupMethodEntities.get(0).getParams();
             SetupMethod setupMethod = new SetupMethod();
             setupMethod.setMethod(method);
+            setupMethod.setDeviceId("912cf9e7-8557-4792-a2f9-27ba72bbcb89");
             setupMethod.setUnitIdentifier(deviceEntity.getDeviceCode());
-            setupMethod.setDeviceMode(deviceTypeEntity.getDeviceMode());
-            setupMethod.setDeviceType(deviceTypeEntity.getDeviceType());
-            setupMethod.setManufacturer(deviceTypeEntity.getManufacturerId());
+            //setupMethod.setDeviceMode(deviceTypeEntity.getDeviceMode());
+            //setupMethod.setDeviceType(deviceTypeEntity.getDeviceType());
+            //setupMethod.setManufacturer(deviceTypeEntity.getManufacturerId());
             setupMethod.setReceiveTime(new Date());
             //封装指令
             String[] parm = parms.split(",");
@@ -177,7 +178,7 @@ public class DeviceSetupMethodService extends ServiceImpl<DeviceSetupMethodMappe
                 if (resultNode.get("status").toString().equals("0")) {
                     deviceSetupRecordEntity.setState(1);
                 } else {
-                    deviceSetupRecordEntity.setState(1);
+                    deviceSetupRecordEntity.setState(2);
                 }
             } catch (IOException e) {
                 return false;
@@ -205,7 +206,9 @@ public class DeviceSetupMethodService extends ServiceImpl<DeviceSetupMethodMappe
         ParmSettingEntity parmSettingEntity = new ParmSettingEntity();
         parmSettingEntity.setEnableState(1);
         parmSettingEntity.setParmType(1);
-        parmSettingEntity.setCompanyOrgId(Long.valueOf(currentUser.getCompanyId()));
+        if(currentUser!=null&&currentUser.getCompanyId()!=null) {
+            parmSettingEntity.setCompanyOrgId(Long.valueOf(currentUser.getCompanyId()));
+        }
         parmSettingEntity.setTenantId(currentUser.getTenantId());
         List<ParmSettingEntity> parmSettingEntities = parmSettingService.findList(parmSettingEntity);
         if (parmSettingEntities.size() == 0) {