|
@@ -5,6 +5,7 @@ import api.common.pojo.param.log.LogPageParam;
|
|
|
import api.common.pojo.po.log.LogLoginPO;
|
|
|
import api.common.pojo.po.log.LogOperationPO;
|
|
|
import api.common.pojo.po.log.LogSystemPO;
|
|
|
+import api.common.pojo.po.model.VehicleTempPO;
|
|
|
import api.common.pojo.po.system.UserPO;
|
|
|
import api.common.util.ObjectUtil;
|
|
|
import api.common.util.StringUtil;
|
|
@@ -31,6 +32,9 @@ public class LogService {
|
|
|
@Autowired
|
|
|
DictService dictService;
|
|
|
|
|
|
+ /**
|
|
|
+ * 保存普通操作日志(异步)
|
|
|
+ */
|
|
|
@Async
|
|
|
public void saveOperationLog(LogOperationPO po) {
|
|
|
po.setId(StringUtil.getRandomUUID());
|
|
@@ -38,12 +42,18 @@ public class LogService {
|
|
|
logMapper.insertOperationLog(po);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询登录日志
|
|
|
+ */
|
|
|
public PageInfo<LogLoginPO> getLoginLogPageList(LogPageParam pageParam) {
|
|
|
PageUtil.setPageInfo(pageParam);
|
|
|
List<LogLoginPO> list = logMapper.getLoginLogPageList(pageParam);
|
|
|
return new PageInfo<>(list);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询普通操作日志
|
|
|
+ */
|
|
|
public PageInfo<LogOperationPO> getOperationLogPageList(LogPageParam pageParam) {
|
|
|
PageUtil.setPageInfo(pageParam);
|
|
|
List<LogOperationPO> list = logMapper.getOperationLogPageList(pageParam);
|
|
@@ -56,6 +66,9 @@ public class LogService {
|
|
|
return new PageInfo<>(list);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询系统管理日志
|
|
|
+ */
|
|
|
public PageInfo<LogSystemPO> getSystemLogPageList(LogPageParam pageParam) {
|
|
|
PageUtil.setPageInfo(pageParam);
|
|
|
List<LogSystemPO> list = logMapper.getSystemLogPageList(pageParam);
|
|
@@ -68,15 +81,12 @@ public class LogService {
|
|
|
return new PageInfo<>(list);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 记录用户管理模块日志
|
|
|
+ */
|
|
|
public void logUser(String operationType, UserPO userPO) {
|
|
|
try {
|
|
|
- LogSystemPO po = new LogSystemPO();
|
|
|
- po.setId(StringUtil.getRandomUUID());
|
|
|
- po.setCreateTime(TimeUtil.getNowForMysql());
|
|
|
- po.setUserId(AuthUtil.getCurrentUserId());
|
|
|
- po.setUsername(AuthUtil.getCurrentUsername());
|
|
|
- po.setRoleCode(AuthUtil.getCurrentUserRoleCode());
|
|
|
- po.setModule(LogConstants.SYS_LOG_USER);
|
|
|
+ LogSystemPO po = getLogSystemPO(LogConstants.SYS_LOG_USER, operationType);
|
|
|
String userId = userPO.getId();
|
|
|
String username = userPO.getUsername();
|
|
|
if(ObjectUtil.isNull(username)){
|
|
@@ -84,10 +94,45 @@ public class LogService {
|
|
|
}
|
|
|
String content = username + " ( ID: " + userId + " )";
|
|
|
po.setContent(content);
|
|
|
- po.setOperationType(operationType);
|
|
|
logMapper.insertSystemLog(po);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 记录车辆模板管理模块日志
|
|
|
+ */
|
|
|
+ public void logVehicle(String operationType, VehicleTempPO vehicleTempPO) {
|
|
|
+ try {
|
|
|
+ LogSystemPO po = getLogSystemPO(LogConstants.SYS_LOG_VEHICLE, operationType);
|
|
|
+ String vehicleTempId = vehicleTempPO.getId();
|
|
|
+ String vehicleName = vehicleTempPO.getVehicleName();
|
|
|
+ String content = vehicleName + " ( ID: " + vehicleTempId + " )";
|
|
|
+ po.setContent(content);
|
|
|
+ logMapper.insertSystemLog(po);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取系统管理日志对象
|
|
|
+ */
|
|
|
+ private LogSystemPO getLogSystemPO(String module, String operationType) {
|
|
|
+ LogSystemPO po = new LogSystemPO();
|
|
|
+ po.setId(StringUtil.getRandomUUID());
|
|
|
+ po.setCreateTime(TimeUtil.getNowForMysql());
|
|
|
+ po.setUserId(AuthUtil.getCurrentUserId());
|
|
|
+ po.setUsername(AuthUtil.getCurrentUsername());
|
|
|
+ po.setRoleCode(AuthUtil.getCurrentUserRoleCode());
|
|
|
+ po.setModule(module);
|
|
|
+ po.setOperationType(operationType);
|
|
|
+ return po;
|
|
|
+ }
|
|
|
}
|