|
|
@@ -4,7 +4,7 @@ import com.github.microservice.net.ResultContent;
|
|
|
import com.github.microservice.types.deviceUse.DeviceCategory;
|
|
|
import com.zhongshu.card.client.model.base.IDParam;
|
|
|
import com.zhongshu.iot.client.model.mqtt.*;
|
|
|
-import com.zhongshu.iot.client.type.type.LogsLevel;
|
|
|
+import com.zhongshu.iot.client.type.OperationLogBusType;
|
|
|
import com.zhongshu.iot.client.type.type.MqttUserState;
|
|
|
import com.zhongshu.iot.server.core.dao.mqtt.*;
|
|
|
import com.zhongshu.iot.server.core.dataConfig.MqttConfig;
|
|
|
@@ -151,6 +151,7 @@ public class GateWayUserInfoService extends SuperService {
|
|
|
if (ObjectUtils.isNotEmpty(ids)) {
|
|
|
List<GateWayUserInfo> list = gateWayUserInfoDao.findByIdIn(ids);
|
|
|
jmxSyncService.syncUserToMQTTService(list);
|
|
|
+
|
|
|
}
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
@@ -255,6 +256,8 @@ public class GateWayUserInfoService extends SuperService {
|
|
|
}
|
|
|
BeanUtils.copyProperties(param, entity);
|
|
|
gateWayUserInfoDao.save(entity);
|
|
|
+
|
|
|
+ operationLogsService.addLogs(String.format("添加了账号:%s", entity.getUserName()), OperationLogBusType.GateWayUser, entity);
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
@@ -270,9 +273,7 @@ public class GateWayUserInfoService extends SuperService {
|
|
|
// 同步用户
|
|
|
jmxSyncService.syncUserToMQTTService(entity);
|
|
|
|
|
|
- // 添加日志
|
|
|
- String userId = getCurrentUserId();
|
|
|
- operationLogsService.addLogs(String.format("%s重置了 %s mqtt账号的密码", userId, entity.getUserName()), LogsLevel.High);
|
|
|
+ operationLogsService.addLogs(String.format("重置了【%s】mqtt账号的密码", entity.getUserName()), OperationLogBusType.GateWayUser);
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
@@ -318,7 +319,7 @@ public class GateWayUserInfoService extends SuperService {
|
|
|
return ResultContent.buildFail(String.format("账号不存在: %s", param.getUserName()));
|
|
|
}
|
|
|
if (param.getState() == entity.getState()) {
|
|
|
- return ResultContent.buildFail(String.format("当前用户状态以为:%s", param.getState()));
|
|
|
+ return ResultContent.buildFail(String.format("当前账号状态已为:%s", param.getState()));
|
|
|
}
|
|
|
entity.setState(param.getState());
|
|
|
gateWayUserInfoDao.save(entity);
|
|
|
@@ -327,9 +328,11 @@ public class GateWayUserInfoService extends SuperService {
|
|
|
if (entity.getState() == MqttUserState.Disable) {
|
|
|
// 不过不可用,则删除QMTT服务上的用户信息
|
|
|
jmxSyncService.removeUserToMQTTService(entity);
|
|
|
+ operationLogsService.addLogs(String.format("停用了账号:%s", entity.getUserName()), OperationLogBusType.GateWayUser, entity);
|
|
|
} else {
|
|
|
// 添加用户
|
|
|
jmxSyncService.syncUserToMQTTService(entity);
|
|
|
+ operationLogsService.addLogs(String.format("启用了账号:%s", entity.getUserName()), OperationLogBusType.GateWayUser, entity);
|
|
|
}
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
@@ -386,6 +389,8 @@ public class GateWayUserInfoService extends SuperService {
|
|
|
|
|
|
// 删除服务文件上的用户
|
|
|
jmxSyncService.removeUserToMQTTService(entity);
|
|
|
+
|
|
|
+ operationLogsService.addLogs(String.format("删除了连接账号:%s", entity.getUserName()), OperationLogBusType.GateWayUser, entity);
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|