Commit da8e9d03 authored by 高建强's avatar 高建强

item:稳压泵统计与分析优化涉及业务调整

parent 484165db
...@@ -38,24 +38,32 @@ public interface IPressurePumpService { ...@@ -38,24 +38,32 @@ public interface IPressurePumpService {
/** /**
* 获取所有稳压泵最近一次启停间隔,min * 获取所有稳压泵最近一次启停间隔,min
*
* @param dataList * @param dataList
* @param dataListFilterTrue
* @param dataListFilterFalse
* @param nowStrLong * @param nowStrLong
*/ */
long getAllPressurePumpStartStopInterval(List<IotDataVO> dataList, String nowStrLong); long getAllPressurePumpStartStopInterval(List<IotDataVO> dataList, List<IotDataVO> dataListFilterTrue, List<IotDataVO> dataListFilterFalse, String nowStrLong);
/** /**
* 获取稳压泵一定时间内启动频率或次数 * 获取稳压泵一定时间内启动频率或次数
*
* @param hour * @param hour
* @param dataList
* @param dateNow * @param dateNow
*/ */
int getAllPressurePumpStartFrequency(double hour, Date dateNow); int getAllPressurePumpStartFrequency(double hour, List<IotDataVO> dataList, Date dateNow);
/** /**
* 获取稳压泵最近一次启停时长,min * 获取稳压泵最近一次启停时长,min
*
* @param dataList * @param dataList
* @param dataListFilterTrue
* @param dataListFilterFalse
* @param nowStrLong * @param nowStrLong
*/ */
long getAllPressurePumpStartStopDuration(List<IotDataVO> dataList, String nowStrLong); long getAllPressurePumpStartStopDuration(List<IotDataVO> dataList, List<IotDataVO> dataListFilterTrue, List<IotDataVO> dataListFilterFalse, String nowStrLong);
/** /**
* 获取稳压泵指定启泵前 minutes 分钟,管网压力差绝对值 * 获取稳压泵指定启泵前 minutes 分钟,管网压力差绝对值
...@@ -97,4 +105,31 @@ public interface IPressurePumpService { ...@@ -97,4 +105,31 @@ public interface IPressurePumpService {
*/ */
List<Map<String, String>> getIotCommonListData(String startTime, String endTime, String prefix, String suffix, String key, String fieldKey); List<Map<String, String>> getIotCommonListData(String startTime, String endTime, String prefix, String suffix, String key, String fieldKey);
/**
* 数据根据指定值过滤
* @param dataList
* @param value
*/
List<IotDataVO> getDataListFilter(List<IotDataVO> dataList, String value);
/**
* 获取稳压泵数据,redis没有,从iot取
*
* @param infoCode
* @param equipmentCode
* @param top
* @param nameKey
* @param bizOrgCode
* @param iotCode
* @return
*/
Map<String, List<IotDataVO>> getDataList(String infoCode, String equipmentCode, String top, String nameKey, String bizOrgCode, String iotCode);
/**
* map 转化为对象
* @param map
* @param aClass
* @return
*/
Object mapToObject(Map<String,String> map,Class<?> aClass) throws IllegalAccessException, InstantiationException;
} }
...@@ -9,7 +9,6 @@ import com.yeejoin.equipmanage.common.enums.PressurePumpRelateEnum; ...@@ -9,7 +9,6 @@ import com.yeejoin.equipmanage.common.enums.PressurePumpRelateEnum;
import com.yeejoin.equipmanage.common.utils.StringUtil; import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.common.utils.UnitTransformUtil; import com.yeejoin.equipmanage.common.utils.UnitTransformUtil;
import com.yeejoin.equipmanage.common.vo.IotDataVO; import com.yeejoin.equipmanage.common.vo.IotDataVO;
import com.yeejoin.equipmanage.fegin.IotFeign;
import com.yeejoin.equipmanage.mapper.EmergencyMapper; import com.yeejoin.equipmanage.mapper.EmergencyMapper;
import com.yeejoin.equipmanage.service.IEmergencyService; import com.yeejoin.equipmanage.service.IEmergencyService;
import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmLogService; import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmLogService;
...@@ -21,8 +20,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -21,8 +20,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -48,9 +45,6 @@ public class EmergencyServiceImpl implements IEmergencyService { ...@@ -48,9 +45,6 @@ public class EmergencyServiceImpl implements IEmergencyService {
private SupervisionVideoServiceImpl supervisionVideoService; private SupervisionVideoServiceImpl supervisionVideoService;
@Autowired @Autowired
private IotFeign iotFeign;
@Autowired
private IPressurePumpService pressurePumpService; private IPressurePumpService pressurePumpService;
@Value("${equipment.pressurepump.start}") @Value("${equipment.pressurepump.start}")
...@@ -235,71 +229,39 @@ public class EmergencyServiceImpl implements IEmergencyService { ...@@ -235,71 +229,39 @@ public class EmergencyServiceImpl implements IEmergencyService {
Map map = infoList.get(0); Map map = infoList.get(0);
String equipmentCode = map.get("equipmentCode").toString(); String equipmentCode = map.get("equipmentCode").toString();
String faultNameKey = map.get("faultNameKey").toString(); String faultNameKey = map.get("faultNameKey").toString();
String top = map.get("top").toString();
// 1. 判断稳压泵整体是否故障 // 1. 判断稳压泵整体是否故障
List<EquipmentSpecificAlarmLog> alarmLogList = equipmentSpecificAlarmLogService.getAlarmLogInfoList(equipmentCode, faultNameKey, PressurePumpRelateEnum.IOT_INDEX_VALUE_TRUE.getValue(), PressurePumpRelateEnum.UN_CLEAN_TIME.getValue(), bizOrgCode); List<EquipmentSpecificAlarmLog> alarmLogList = equipmentSpecificAlarmLogService.getAlarmLogInfoList(equipmentCode, faultNameKey, PressurePumpRelateEnum.IOT_INDEX_VALUE_TRUE.getValue(), PressurePumpRelateEnum.UN_CLEAN_TIME.getValue(), bizOrgCode);
PressurePumpAnalysisEnum.PRESSURE_PUMP_FAULT.setValue(CollectionUtils.isEmpty(alarmLogList) ? PressurePumpRelateEnum.NOT_FAULT.getValue() : PressurePumpRelateEnum.FAULT.getValue()); PressurePumpAnalysisEnum.PRESSURE_PUMP_FAULT.setValue(CollectionUtils.isEmpty(alarmLogList) ? PressurePumpRelateEnum.NOT_FAULT.getValue() : PressurePumpRelateEnum.FAULT.getValue());
// 获取redis稳压泵缓存数据,默认JSON配置最近4小时 // 获取稳压泵数据,redis没有,从iot取
List<IotDataVO> DataList = pressurePumpService.getDataToRedis(PressurePumpRelateEnum.PRESSURE_PUMP.getValue(), pressurePumpStart, null); Map<String, List<IotDataVO>> dataMap = pressurePumpService.getDataList(PressurePumpRelateEnum.PRESSURE_PUMP.getValue(), equipmentCode, top, pressurePumpStart, bizOrgCode, null);
List<IotDataVO> DataPipeList = pressurePumpService.getDataToRedis(PressurePumpRelateEnum.PRESSURE_PUMP.getValue(), pressurePumpPipePressure, null); List<IotDataVO> dataList = dataMap.get("dataList");
String top = map.get("top").toString(); List<IotDataVO> dataListFilterTrue = dataMap.get("dataListFilterTrue");
// 通过 equipmentCode 获取装备 List<IotDataVO> dataListFilterFalse = dataMap.get("dataListFilterFalse");
List<Map<String, Object>> pumpInfoList = equipmentSpecificSerivce.getFirePumpInfoEQ(equipmentCode, bizOrgCode); Map<String, List<IotDataVO>> dataPipMap = pressurePumpService.getDataList(PressurePumpRelateEnum.PRESSURE_PUMP.getValue(), equipmentCode, top, pressurePumpPipePressure, bizOrgCode, null);
if (!ObjectUtils.isEmpty(pumpInfoList)) { List<IotDataVO> dataPipeList = dataPipMap.get("dataList");
String iotCode = pumpInfoList.get(0).get("iotCode").toString();
if (iotCode.length() > 8) {
String prefix = iotCode.substring(0, 8);
//获取iot的数据
if(ObjectUtils.isEmpty(DataList)){
DataList = getIotData(top, prefix, pressurePumpStart);
}
if(ObjectUtils.isEmpty(DataPipeList)){
DataPipeList = getIotData(top, prefix, pressurePumpPipePressure);
}
} else {
throw new BadRequest("装备物联编码错误,请确认!");
}
}
String nowStrLong = DateUtils.getDateNowString(); String nowStrLong = DateUtils.getDateNowString();
// 2. 最近一次启停间隔
long interval = pressurePumpService.getAllPressurePumpStartStopInterval(DataList, nowStrLong);
// 3. 最近一次启动时长
long duration = pressurePumpService.getAllPressurePumpStartStopDuration(DataList, nowStrLong);
// 6. 管网压力状态
double pressureDiff = pressurePumpService.getAllPressurePumpPipePressureDiff(DataList, DataPipeList, PressurePumpRelateEnum.PRESSURE_PUMP_START_BEFORE_MINUTE.getValue());
Date dateNow = DateUtils.getDateNow(); Date dateNow = DateUtils.getDateNow();
// 2. 最近一次启停间隔 // 2. 最近一次启停间隔
long interval = pressurePumpService.getAllPressurePumpStartStopInterval(dataList, dataListFilterTrue, dataListFilterFalse, nowStrLong);
PressurePumpAnalysisEnum.PRESSURE_PUMP_INTERVAL.setValue(interval); PressurePumpAnalysisEnum.PRESSURE_PUMP_INTERVAL.setValue(interval);
// 3. 最近一次启动时长 // 3. 最近一次启动时长
long duration = pressurePumpService.getAllPressurePumpStartStopDuration(dataList, dataListFilterTrue, dataListFilterFalse, nowStrLong);
PressurePumpAnalysisEnum.PRESSURE_PUMP_DURATION.setValue(duration); PressurePumpAnalysisEnum.PRESSURE_PUMP_DURATION.setValue(duration);
// 4. 半小时启动 // 4. 半小时启动
int halfFrequency = pressurePumpService.getAllPressurePumpStartFrequency(Double.parseDouble(PressurePumpRelateEnum.HALF_HOUR.getValue()), dateNow); int halfFrequency = pressurePumpService.getAllPressurePumpStartFrequency(Double.parseDouble(PressurePumpRelateEnum.HALF_HOUR.getValue()), dataListFilterTrue, dateNow);
PressurePumpAnalysisEnum.PRESSURE_PUMP_HALF.setValue(halfFrequency); PressurePumpAnalysisEnum.PRESSURE_PUMP_HALF.setValue(halfFrequency);
// 5. 2小时启动 // 5. 2小时启动
int twoFrequency = pressurePumpService.getAllPressurePumpStartFrequency(Double.parseDouble(PressurePumpRelateEnum.TWO_HOUR.getValue()), dateNow); int twoFrequency = pressurePumpService.getAllPressurePumpStartFrequency(Double.parseDouble(PressurePumpRelateEnum.TWO_HOUR.getValue()), dataListFilterTrue, dateNow);
PressurePumpAnalysisEnum.PRESSURE_PUMP_TWO.setValue(twoFrequency); PressurePumpAnalysisEnum.PRESSURE_PUMP_TWO.setValue(twoFrequency);
// 6. 管网压力状态 // 6. 管网压力状态
double pressureDiff = pressurePumpService.getAllPressurePumpPipePressureDiff(dataList, dataPipeList, PressurePumpRelateEnum.PRESSURE_PUMP_START_BEFORE_MINUTE.getValue());
PressurePumpAnalysisEnum.PRESSURE_PUMP_PIPE.setValue(pressureDiff > Double.parseDouble(PressurePumpRelateEnum.PIPE_PRESSURE_DIFF.getValue()) ? PressurePumpRelateEnum.PIPE_PRESSURE_ABNORMAL_STATUS.getValue() : PressurePumpRelateEnum.PIPE_PRESSURE_NORMAL_STATUS.getValue()); PressurePumpAnalysisEnum.PRESSURE_PUMP_PIPE.setValue(pressureDiff > Double.parseDouble(PressurePumpRelateEnum.PIPE_PRESSURE_DIFF.getValue()) ? PressurePumpRelateEnum.PIPE_PRESSURE_ABNORMAL_STATUS.getValue() : PressurePumpRelateEnum.PIPE_PRESSURE_NORMAL_STATUS.getValue());
} }
return PressurePumpAnalysisEnum.getList(); return PressurePumpAnalysisEnum.getList();
} }
private List<IotDataVO> getIotData(String top, String prefix, String indexKey) {
List<IotDataVO> DataList = new ArrayList<>();
List<Map<String, String>> iotDataList = pressurePumpService.getIotTopSingleField(top, prefix, null, null, indexKey);
//将iot的List<Map<String, String>>转化为List<IotDataVO>类型
iotDataList.stream().forEach(e -> {
try {
IotDataVO iotDataVO = (IotDataVO) supervisionVideoService.mapToObject(e, IotDataVO.class);
DataList.add(iotDataVO);
} catch (Exception el) {
throw new BadRequest("IOT数据类型转换失败");
}
});
return DataList;
}
@Override @Override
public Map<String, Object> getPressurePumpStatusChart(String startTime, String endTime, String bizOrgCode) { public Map<String, Object> getPressurePumpStatusChart(String startTime, String endTime, String bizOrgCode) {
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
......
...@@ -3,7 +3,6 @@ package com.yeejoin.equipmanage.service.impl; ...@@ -3,7 +3,6 @@ package com.yeejoin.equipmanage.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.CommonUtils;
import com.yeejoin.equipmanage.common.entity.SupervisionVideo; import com.yeejoin.equipmanage.common.entity.SupervisionVideo;
import com.yeejoin.equipmanage.common.entity.vo.AlamVideoVO; import com.yeejoin.equipmanage.common.entity.vo.AlamVideoVO;
import com.yeejoin.equipmanage.common.enums.PressurePumpRelateEnum; import com.yeejoin.equipmanage.common.enums.PressurePumpRelateEnum;
...@@ -23,8 +22,6 @@ import org.springframework.util.CollectionUtils; ...@@ -23,8 +22,6 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -85,15 +82,26 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap ...@@ -85,15 +82,26 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap
@Override @Override
public Page<Map<String, Object>> queryPumpInfo(Page page, String bizOrgCode) { public Page<Map<String, Object>> queryPumpInfo(Page page, String bizOrgCode) {
// 从 json 配置文件获取配置信息
List<Map> infoList = pressurePumpService.getNameKeyInfoList(PressurePumpRelateEnum.PRESSURE_PUMP.getValue());
Page<Map<String, Object>> pressurePumpInfo = new Page<>();
if (!CollectionUtils.isEmpty(infoList)) {
Map map = infoList.get(0);
String equipmentCode = map.get("equipmentCode").toString();
String top = map.get("top").toString();
Date dateNow = DateUtils.getDateNow(); Date dateNow = DateUtils.getDateNow();
String nowStrLong = DateUtils.getNowStrLong(); String nowStrLong = DateUtils.getNowStrLong();
// 获取稳压泵数据,redis没有,从iot取
Map<String, List<IotDataVO>> dataMap = pressurePumpService.getDataList(PressurePumpRelateEnum.PRESSURE_PUMP.getValue(), equipmentCode, top, pressurePumpStart, bizOrgCode, null);
List<IotDataVO> dataListFilterTrue = dataMap.get("dataListFilterTrue");
List<IotDataVO> dataListFilterFalse = dataMap.get("dataListFilterFalse");
Long interval = 0L; Long interval = 0L;
//全部稳压泵半小时、一小时、两小时、四小时启动次数 //全部稳压泵半小时、一小时、两小时、四小时启动次数
int halfHourStartNum = pressurePumpService.getAllPressurePumpStartFrequency(Double.parseDouble(PressurePumpRelateEnum.HALF_HOUR.getValue()), dateNow); int halfHourStartNum = pressurePumpService.getAllPressurePumpStartFrequency(Double.parseDouble(PressurePumpRelateEnum.HALF_HOUR.getValue()), dataListFilterTrue, dateNow);
int oneHourStartNum = pressurePumpService.getAllPressurePumpStartFrequency(Double.parseDouble(PressurePumpRelateEnum.ONE_HOUR.getValue()), dateNow); int oneHourStartNum = pressurePumpService.getAllPressurePumpStartFrequency(Double.parseDouble(PressurePumpRelateEnum.ONE_HOUR.getValue()), dataListFilterTrue, dateNow);
int twoHourStartNum = pressurePumpService.getAllPressurePumpStartFrequency(Double.parseDouble(PressurePumpRelateEnum.TWO_HOUR.getValue()), dateNow); int twoHourStartNum = pressurePumpService.getAllPressurePumpStartFrequency(Double.parseDouble(PressurePumpRelateEnum.TWO_HOUR.getValue()), dataListFilterTrue, dateNow);
int fourHourStartNum = pressurePumpService.getAllPressurePumpStartFrequency(Double.parseDouble(PressurePumpRelateEnum.FOUR_HOUR.getValue()), dateNow); int fourHourStartNum = pressurePumpService.getAllPressurePumpStartFrequency(Double.parseDouble(PressurePumpRelateEnum.FOUR_HOUR.getValue()), dataListFilterTrue, dateNow);
Page<Map<String, Object>> pressurePumpInfo = fireFightingSystemMapper.getPressurePumpInfo(page, bizOrgCode, null); pressurePumpInfo = fireFightingSystemMapper.getPressurePumpInfo(page, bizOrgCode, null);
String prefix = null; String prefix = null;
for (Map<String, Object> item : pressurePumpInfo.getRecords()) { for (Map<String, Object> item : pressurePumpInfo.getRecords()) {
String suffix = null; String suffix = null;
...@@ -149,26 +157,21 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap ...@@ -149,26 +157,21 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap
item.put("stateDesc", Integer.parseInt(String.valueOf(item.get("isAlarm"))) == 0 && time ? PressurePumpRelateEnum.PIPE_PRESSURE_NORMAL_STATUS.getValue() : PressurePumpRelateEnum.PIPE_PRESSURE_ABNORMAL_STATUS.getValue()); item.put("stateDesc", Integer.parseInt(String.valueOf(item.get("isAlarm"))) == 0 && time ? PressurePumpRelateEnum.PIPE_PRESSURE_NORMAL_STATUS.getValue() : PressurePumpRelateEnum.PIPE_PRESSURE_ABNORMAL_STATUS.getValue());
} }
List<Map> infoList = pressurePumpService.getNameKeyInfoList(PressurePumpRelateEnum.PRESSURE_PUMP.getValue());
if (!CollectionUtils.isEmpty(infoList)) {
// 获取redis稳压泵缓存数据,默认JSON配置最近4小时 // 获取redis稳压泵缓存数据,默认JSON配置最近4小时
List<IotDataVO> DataList = pressurePumpService.getDataToRedis(PressurePumpRelateEnum.PRESSURE_PUMP.getValue(), pressurePumpStart, null); List<IotDataVO> DataList = pressurePumpService.getDataToRedis(PressurePumpRelateEnum.PRESSURE_PUMP.getValue(), pressurePumpStart, null);
if(CollectionUtils.isEmpty(DataList)){ if(CollectionUtils.isEmpty(DataList)){
//从influxdb中获取最近一次启停间隔 //从influxdb中获取最近一次启停间隔
String top = infoList.get(0).get("top").toString();
List<Map<String, String>> iotDataList = pressurePumpService.getIotTopSingleField(top, prefix, null, null, pressurePumpStart); List<Map<String, String>> iotDataList = pressurePumpService.getIotTopSingleField(top, prefix, null, null, pressurePumpStart);
iotDataList.stream().forEach(e -> { iotDataList.stream().forEach(e -> {
try { try {
IotDataVO iotDataVO = (IotDataVO) mapToObject(e, IotDataVO.class); IotDataVO iotDataVO = (IotDataVO) pressurePumpService.mapToObject(e, IotDataVO.class);
DataList.add(iotDataVO); DataList.add(iotDataVO);
} catch (Exception el) { } catch (Exception el) {
throw new RuntimeException(); throw new RuntimeException();
} }
}); });
}
interval =pressurePumpService.getAllPressurePumpStartStopInterval(DataList, nowStrLong);
} }
interval =pressurePumpService.getAllPressurePumpStartStopInterval(DataList, dataListFilterTrue, dataListFilterFalse, nowStrLong);
double finalDiffMinute = (double) interval; double finalDiffMinute = (double) interval;
pressurePumpInfo.getRecords().stream( pressurePumpInfo.getRecords().stream(
).map(item -> { ).map(item -> {
...@@ -184,39 +187,8 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap ...@@ -184,39 +187,8 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap
List<Map<String, Object>> records = pressurePumpInfo.getRecords(); List<Map<String, Object>> records = pressurePumpInfo.getRecords();
records.sort((t1, t2) -> t1.get("stateDesc").toString().compareTo(t2.get("stateDesc").toString())); records.sort((t1, t2) -> t1.get("stateDesc").toString().compareTo(t2.get("stateDesc").toString()));
pressurePumpInfo.setRecords(records); pressurePumpInfo.setRecords(records);
return pressurePumpInfo;
} }
return pressurePumpInfo;
/**
* map 转化为对象
* @param map 需要转化的参数
* @param aClass 要转化成的对象
* @return 转化成功的对象
* @throws IllegalAccessException 非法访问异常
* @throws InstantiationException 实例化异常
*/
public Object mapToObject(Map<String,String> map,Class<?> aClass) throws IllegalAccessException, InstantiationException {
if(null == map || map.size()<=0){
return null;
}
Object o = aClass.newInstance();
Field[] declaredFields = o.getClass().getDeclaredFields();
for (Field field :declaredFields) {
int modifiers = field.getModifiers();
if(Modifier.isStatic(modifiers) || Modifier.isFinal(modifiers)){
continue;
}
// (此处如果不设置 无法获取对象的私有属性)
field.setAccessible(true);
if("key".equals(field.getName())){
field.set(o,pressurePumpStart);
} else if("value".equals(field.getName())){
field.set(o,map.get(pressurePumpStart));
} else {
field.set(o,map.get(field.getName()));
} }
}
return o;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment