|
@@ -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;
|