diff --git a/pqs-system/system-boot/src/main/java/com/njcn/system/service/impl/UserLogServiceImpl.java b/pqs-system/system-boot/src/main/java/com/njcn/system/service/impl/UserLogServiceImpl.java index 691f34179..14623f8b3 100644 --- a/pqs-system/system-boot/src/main/java/com/njcn/system/service/impl/UserLogServiceImpl.java +++ b/pqs-system/system-boot/src/main/java/com/njcn/system/service/impl/UserLogServiceImpl.java @@ -1,5 +1,6 @@ package com.njcn.system.service.impl; +import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.njcn.common.pojo.dto.LogInfoDTO; import com.njcn.system.mapper.UserLogMapper; @@ -26,6 +27,42 @@ public class UserLogServiceImpl extends ServiceImpl impl @Override public void addUserLog(LogInfoDTO logInfoDTO) { + UserLog userLog = new UserLog(); + BeanUtil.copyProperties(logInfoDTO, userLog); + if(logInfoDTO.getIsLogin() == 0){ + userLog.setCreateBy(userLog.getUserName()); + userLog.setUpdateBy(userLog.getUserName()); + } + userLog.setState(0); + this.baseMapper.insert(userLog); + } + /** + * 严重度 文字 转 数字 + */ + private Integer levelStringToNumber(String level) { + switch (level) { + case "中等": + return 1; + case "严重": + return 2; + default: + return 0; + } + } + + + /** + * 严重度 数字 转 文字 + */ + private String levelNumberToString(Integer level) { + switch (level) { + case 1: + return "中等"; + case 2: + return "严重"; + default: + return "普通"; + } } }