Showing
5 changed files
with
43 additions
and
67 deletions
| ... | @@ -131,6 +131,7 @@ public class OperationLogAspect { | ... | @@ -131,6 +131,7 @@ public class OperationLogAspect { |
| 131 | 131 | ||
| 132 | //获取用户信息。 login,logout,oss登录特殊处理 | 132 | //获取用户信息。 login,logout,oss登录特殊处理 |
| 133 | User user = CurrentUserInfo.getUser(); | 133 | User user = CurrentUserInfo.getUser(); |
| 134 | + log.setLoginName(user.getLoginName()); | ||
| 134 | log.setUserId(user.getId()); | 135 | log.setUserId(user.getId()); |
| 135 | log.setUserName(user.getUserName()); | 136 | log.setUserName(user.getUserName()); |
| 136 | //请求时间 | 137 | //请求时间 | ... | ... |
| ... | @@ -7,6 +7,7 @@ import com.fedex.connect.common.dependencies.contants.ParamConfigConstants; | ... | @@ -7,6 +7,7 @@ import com.fedex.connect.common.dependencies.contants.ParamConfigConstants; |
| 7 | import com.fedex.connect.common.dependencies.contants.RedisConstants; | 7 | import com.fedex.connect.common.dependencies.contants.RedisConstants; |
| 8 | import com.fedex.connect.common.dependencies.date.vo.ResponseVo; | 8 | import com.fedex.connect.common.dependencies.date.vo.ResponseVo; |
| 9 | import com.fedex.connect.common.dependencies.enums.sys.UserLoginTypeEnum; | 9 | import com.fedex.connect.common.dependencies.enums.sys.UserLoginTypeEnum; |
| 10 | +import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils; | ||
| 10 | import com.fedex.connect.common.dependencies.util.GsonUtils; | 11 | import com.fedex.connect.common.dependencies.util.GsonUtils; |
| 11 | import com.fedex.connect.common.dependencies.util.JwtTokenUtils; | 12 | import com.fedex.connect.common.dependencies.util.JwtTokenUtils; |
| 12 | import com.fedex.connect.common.dependencies.util.StringExtUtil; | 13 | import com.fedex.connect.common.dependencies.util.StringExtUtil; |
| ... | @@ -141,6 +142,14 @@ public class SysAuthController extends BaseController implements ISysAuthControl | ... | @@ -141,6 +142,14 @@ public class SysAuthController extends BaseController implements ISysAuthControl |
| 141 | //如果用户不存在,则创建FCL用户信息 | 142 | //如果用户不存在,则创建FCL用户信息 |
| 142 | SysUserDto dto = new SysUserDto(fcl_uuid, fcl_contactname); | 143 | SysUserDto dto = new SysUserDto(fcl_uuid, fcl_contactname); |
| 143 | sysUserService.initUserInfo(fclInfoDto,dto); | 144 | sysUserService.initUserInfo(fclInfoDto,dto); |
| 145 | + try { | ||
| 146 | + /** | ||
| 147 | + * 初始化表基础字段 | ||
| 148 | + */ | ||
| 149 | + AssignmentFieldUtils.assignmentTableBaseField(dto); | ||
| 150 | + }catch(Exception ex){ | ||
| 151 | + log.error("用户登录初始化账号基础信息失败:",ex); | ||
| 152 | + } | ||
| 144 | loginUser = sysUserService.save(dto); | 153 | loginUser = sysUserService.save(dto); |
| 145 | } else { | 154 | } else { |
| 146 | //首先对用户中的姓名进行解密 | 155 | //首先对用户中的姓名进行解密 |
| ... | @@ -158,7 +167,14 @@ public class SysAuthController extends BaseController implements ISysAuthControl | ... | @@ -158,7 +167,14 @@ public class SysAuthController extends BaseController implements ISysAuthControl |
| 158 | } else { | 167 | } else { |
| 159 | loginUser.setUserName(StringUtils.trimToEmpty(fcl_contactname)); | 168 | loginUser.setUserName(StringUtils.trimToEmpty(fcl_contactname)); |
| 160 | } | 169 | } |
| 161 | - loginUser.setModifyTime(new Date()); | 170 | + try { |
| 171 | + /** | ||
| 172 | + * 初始化表基础字段 | ||
| 173 | + */ | ||
| 174 | + AssignmentFieldUtils.assignmentTableBaseField(loginUser); | ||
| 175 | + }catch(Exception ex){ | ||
| 176 | + log.error("用户登录初始化账号基础信息失败:",ex); | ||
| 177 | + } | ||
| 162 | sysUserService.initUserInfo(fclInfoDto,loginUser); | 178 | sysUserService.initUserInfo(fclInfoDto,loginUser); |
| 163 | sysUserService.update(loginUser); | 179 | sysUserService.update(loginUser); |
| 164 | } | 180 | } |
| ... | @@ -171,7 +187,7 @@ public class SysAuthController extends BaseController implements ISysAuthControl | ... | @@ -171,7 +187,7 @@ public class SysAuthController extends BaseController implements ISysAuthControl |
| 171 | 187 | ||
| 172 | DictionaryEntries dicUserLoginType = cacheSystem.getDicUserLoginType(UserLoginTypeEnum.FCLLOGINREGISTRATION.getCode()); | 188 | DictionaryEntries dicUserLoginType = cacheSystem.getDicUserLoginType(UserLoginTypeEnum.FCLLOGINREGISTRATION.getCode()); |
| 173 | //记录日志 | 189 | //记录日志 |
| 174 | - LogLoginDto dto = new LogLoginDto(loginUser.getId(), dicUserLoginType.getId(), | 190 | + LogLoginDto dto = new LogLoginDto(loginUser.getId(), dicUserLoginType.getCode(), |
| 175 | UserLoginTypeEnum.LOGIN.getMsg()); | 191 | UserLoginTypeEnum.LOGIN.getMsg()); |
| 176 | logLoginService.saveLoginLog(dto); | 192 | logLoginService.saveLoginLog(dto); |
| 177 | try{ | 193 | try{ |
| ... | @@ -282,7 +298,7 @@ public class SysAuthController extends BaseController implements ISysAuthControl | ... | @@ -282,7 +298,7 @@ public class SysAuthController extends BaseController implements ISysAuthControl |
| 282 | //插入日志 | 298 | //插入日志 |
| 283 | User sysUser = sysUserService.findById(Long.parseLong(id)); | 299 | User sysUser = sysUserService.findById(Long.parseLong(id)); |
| 284 | DictionaryEntries dicUserLoginType = cacheSystem.getDicUserLoginType(UserLoginTypeEnum.EXIT.getCode()); | 300 | DictionaryEntries dicUserLoginType = cacheSystem.getDicUserLoginType(UserLoginTypeEnum.EXIT.getCode()); |
| 285 | - LogLoginDto dto = new LogLoginDto(sysUser.getId(), dicUserLoginType.getId(), | 301 | + LogLoginDto dto = new LogLoginDto(sysUser.getId(), dicUserLoginType.getCode(), |
| 286 | UserLoginTypeEnum.EXIT.getMsg()); | 302 | UserLoginTypeEnum.EXIT.getMsg()); |
| 287 | logLoginService.saveLoginLog(dto); | 303 | logLoginService.saveLoginLog(dto); |
| 288 | } | 304 | } | ... | ... |
| 1 | package com.fedex.connect.manager.data.dto; | 1 | package com.fedex.connect.manager.data.dto; |
| 2 | 2 | ||
| 3 | +import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils; | ||
| 3 | import com.fedex.connect.common.model.log.UserLoginInfo; | 4 | import com.fedex.connect.common.model.log.UserLoginInfo; |
| 5 | +import lombok.Data; | ||
| 4 | 6 | ||
| 5 | import java.net.InetAddress; | 7 | import java.net.InetAddress; |
| 6 | import java.net.UnknownHostException; | 8 | import java.net.UnknownHostException; |
| ... | @@ -12,12 +14,13 @@ import java.util.Date; | ... | @@ -12,12 +14,13 @@ import java.util.Date; |
| 12 | * 不建议反射:数据量上来反射copy很慢。set最快 | 14 | * 不建议反射:数据量上来反射copy很慢。set最快 |
| 13 | * dao 转dto 看业务是否需要了。 | 15 | * dao 转dto 看业务是否需要了。 |
| 14 | */ | 16 | */ |
| 17 | +@Data | ||
| 15 | public class LogLoginDto { | 18 | public class LogLoginDto { |
| 16 | 19 | ||
| 17 | /** | 20 | /** |
| 18 | * 重载构造函数 | 21 | * 重载构造函数 |
| 19 | */ | 22 | */ |
| 20 | - public LogLoginDto(Long userId, Long operType, String operDesc){ | 23 | + public LogLoginDto(Long userId, String operType, String operDesc){ |
| 21 | this.userId = userId; | 24 | this.userId = userId; |
| 22 | this.operTime = new Date(); | 25 | this.operTime = new Date(); |
| 23 | this.operType = operType; | 26 | this.operType = operType; |
| ... | @@ -42,9 +45,19 @@ public class LogLoginDto { | ... | @@ -42,9 +45,19 @@ public class LogLoginDto { |
| 42 | if (dto.getId() != null && dto.getId() != 0){ | 45 | if (dto.getId() != null && dto.getId() != 0){ |
| 43 | log.setId(dto.getId()); | 46 | log.setId(dto.getId()); |
| 44 | } | 47 | } |
| 48 | + log.setOperTypeCode(dto.getOperType()); | ||
| 49 | + log.setOperTypeName(dto.getOperDesc()); | ||
| 45 | log.setUserId(dto.getUserId()); | 50 | log.setUserId(dto.getUserId()); |
| 46 | log.setOperDesc(dto.getOperDesc()); | 51 | log.setOperDesc(dto.getOperDesc()); |
| 47 | log.setIp(dto.getIp()); | 52 | log.setIp(dto.getIp()); |
| 53 | + try { | ||
| 54 | + /** | ||
| 55 | + * 初始化表基础字段 | ||
| 56 | + */ | ||
| 57 | + AssignmentFieldUtils.assignmentTableBaseField(dto); | ||
| 58 | + }catch(Exception ex){ | ||
| 59 | + ex.printStackTrace(); | ||
| 60 | + } | ||
| 48 | return log; | 61 | return log; |
| 49 | } | 62 | } |
| 50 | 63 | ||
| ... | @@ -66,9 +79,14 @@ public class LogLoginDto { | ... | @@ -66,9 +79,14 @@ public class LogLoginDto { |
| 66 | 79 | ||
| 67 | /** | 80 | /** |
| 68 | * 操作类型 | 81 | * 操作类型 |
| 69 | - 1:登录 2:退出 3:修改密码4:FCL登录注册 | 82 | + userLoginType_01 登录 |
| 83 | + userLoginType_02 退出 | ||
| 84 | + userLoginType_03 修改密码 | ||
| 85 | + userLoginType_04 FCL登录注册 | ||
| 86 | + userLoginType_05 停用 | ||
| 87 | + userLoginType_06 启用 | ||
| 70 | */ | 88 | */ |
| 71 | - private Long operType; | 89 | + private String operType; |
| 72 | 90 | ||
| 73 | /** | 91 | /** |
| 74 | * 操作描述 | 92 | * 操作描述 |
| ... | @@ -79,64 +97,4 @@ public class LogLoginDto { | ... | @@ -79,64 +97,4 @@ public class LogLoginDto { |
| 79 | * IP | 97 | * IP |
| 80 | */ | 98 | */ |
| 81 | private String ip; | 99 | private String ip; |
| 82 | - | ||
| 83 | - public Long getId() { | ||
| 84 | - return id; | ||
| 85 | - } | ||
| 86 | - | ||
| 87 | - public void setId(Long id) { | ||
| 88 | - this.id = id; | ||
| 89 | - } | ||
| 90 | - | ||
| 91 | - public Long getUserId() { | ||
| 92 | - return userId; | ||
| 93 | - } | ||
| 94 | - | ||
| 95 | - public void setUserId(Long userId) { | ||
| 96 | - this.userId = userId; | ||
| 97 | - } | ||
| 98 | - | ||
| 99 | - public Date getOperTime() { | ||
| 100 | - return operTime; | ||
| 101 | - } | ||
| 102 | - | ||
| 103 | - public void setOperTime(Date operTime) { | ||
| 104 | - this.operTime = operTime; | ||
| 105 | - } | ||
| 106 | - | ||
| 107 | - public Long getOperType() { | ||
| 108 | - return operType; | ||
| 109 | - } | ||
| 110 | - | ||
| 111 | - public void setOperType(Long operType) { | ||
| 112 | - this.operType = operType; | ||
| 113 | - } | ||
| 114 | - | ||
| 115 | - public String getOperDesc() { | ||
| 116 | - return operDesc; | ||
| 117 | - } | ||
| 118 | - | ||
| 119 | - public void setOperDesc(String operDesc) { | ||
| 120 | - this.operDesc = operDesc; | ||
| 121 | - } | ||
| 122 | - | ||
| 123 | - public String getIp() { | ||
| 124 | - return ip; | ||
| 125 | - } | ||
| 126 | - | ||
| 127 | - public void setIp(String ip) { | ||
| 128 | - this.ip = ip; | ||
| 129 | - } | ||
| 130 | - | ||
| 131 | - public LogLoginDto() { | ||
| 132 | - } | ||
| 133 | - | ||
| 134 | - public LogLoginDto(Long id, Long userId, Date operTime, Long operType, String operDesc, String ip) { | ||
| 135 | - this.id = id; | ||
| 136 | - this.userId = userId; | ||
| 137 | - this.operTime = operTime; | ||
| 138 | - this.operType = operType; | ||
| 139 | - this.operDesc = operDesc; | ||
| 140 | - this.ip = ip; | ||
| 141 | - } | ||
| 142 | } | 100 | } | ... | ... |
| 1 | package com.fedex.connect.manager.service.log.impl; | 1 | package com.fedex.connect.manager.service.log.impl; |
| 2 | 2 | ||
| 3 | +import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils; | ||
| 3 | import com.fedex.connect.manager.data.dto.LogLoginDto; | 4 | import com.fedex.connect.manager.data.dto.LogLoginDto; |
| 4 | import com.fedex.connect.manager.data.model.LogShowModel; | 5 | import com.fedex.connect.manager.data.model.LogShowModel; |
| 5 | import com.fedex.connect.manager.service.base.BaseService; | 6 | import com.fedex.connect.manager.service.base.BaseService; | ... | ... |
| ... | @@ -71,7 +71,7 @@ public class SysUserServiceImpl extends BaseService implements ISysUserService { | ... | @@ -71,7 +71,7 @@ public class SysUserServiceImpl extends BaseService implements ISysUserService { |
| 71 | UserExample example = new UserExample(); | 71 | UserExample example = new UserExample(); |
| 72 | UserExample.Criteria criteria = example.createCriteria(); | 72 | UserExample.Criteria criteria = example.createCriteria(); |
| 73 | criteria.andStatusEqualTo(DatabaseConstants.GLOBAL_STATUS_VALID); | 73 | criteria.andStatusEqualTo(DatabaseConstants.GLOBAL_STATUS_VALID); |
| 74 | - criteria.andLoginNameEqualTo(fclUuid); | 74 | + criteria.andUserUuidEqualTo(fclUuid); |
| 75 | //criteria.andFedexAccNoEqualTo(fclUuid); | 75 | //criteria.andFedexAccNoEqualTo(fclUuid); |
| 76 | example.setOrderByClause("ID DESC"); | 76 | example.setOrderByClause("ID DESC"); |
| 77 | 77 | ... | ... |
-
Please register or login to post a comment