lin 4 年之前
父节点
当前提交
0bb27c94cc

+ 7 - 3
zoniot-rmcp/zoniot-rmcp-dap/src/main/java/com/bz/rmcp/dap/service/impl/DeviceDataServiceImpl.java

@@ -31,6 +31,7 @@ import com.zcxk.rmcp.core.mongo.DeviceData;
 import com.zcxk.rmcp.core.mongo.DeviceDataItem;
 import com.zcxk.rmcp.core.mongo.MeterReadRecord;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.mongodb.core.MongoTemplate;
 import org.springframework.data.mongodb.core.query.Criteria;
@@ -256,6 +257,7 @@ public class DeviceDataServiceImpl implements DeviceDataService {
         Map<String, Object> measureMap = measureDataDto.getMeasureMap();
 
         Product product = productService.findProductByCache(device.getProductId());
+        log.info("product = {}",JSON.toJSON(product));
         Device update = new Device();
         update.setId(device.getId());
         update.setDeviceStatus(DeviceStatusEnum.NORMAL.getCode());
@@ -294,10 +296,12 @@ public class DeviceDataServiceImpl implements DeviceDataService {
      * @author linqingwei
      **/
     private Integer convertValveStatus(Map<String, Object> measureMap,Product product){
-        Integer valve = MapUtil.getInt(measureMap,product.getValveMeasuringCode());
+        String valve = MapUtil.getStr(measureMap,product.getValveMeasuringCode());
         if (valve != null) {
-            if(valve == 0)  return ValveStatusEnum.ON.getCode();
-            if(valve == 1)  return ValveStatusEnum.OFF.getCode();
+            if(StringUtils.equals("0",valve))  return ValveStatusEnum.ON.getCode();
+            if(StringUtils.equals("1",valve))  return ValveStatusEnum.OFF.getCode();
+            if(StringUtils.equals("00",valve))  return ValveStatusEnum.ON.getCode();
+            if(StringUtils.equals("01",valve))  return ValveStatusEnum.OFF.getCode();
             return ValveStatusEnum.ABNORMAL.getCode();
         }
         return null;

+ 0 - 3
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/excel/resolver/service/WaterDeviceHandleExcelService.java

@@ -46,8 +46,6 @@ public class WaterDeviceHandleExcelService implements HandleExcelService {
     private ImportFileServiceImpl importFileService;
     @Autowired
     private MessageSendUtil messageSendUtil;
-    @Value("${rmcp.url}")
-    private String rmcpUrl;
 
     @Override
     public void handle(ExcelData data) {
@@ -122,7 +120,6 @@ public class WaterDeviceHandleExcelService implements HandleExcelService {
         message.setMessageTemplateId(9);
         message.setChannel(0);
         message.setUserId(data.getImportFile().getUserId());
-        message.setPath(rmcpUrl);
         messageSendUtil.send(message);
     }