feat:账户变更记录
This commit is contained in:
parent
04c50e6fbd
commit
d9d582b117
@ -2,6 +2,7 @@ CREATE TABLE IF NOT EXISTS plat_user_role_job_change
|
|||||||
(
|
(
|
||||||
id bigint auto_increment comment '主键',
|
id bigint auto_increment comment '主键',
|
||||||
axzo_user_id bigint default 0 not null comment '安心筑id',
|
axzo_user_id bigint default 0 not null comment '安心筑id',
|
||||||
|
request_id varchar(64) default 0 not null comment '请求ID',
|
||||||
change_type varchar(20) default '' not null comment '变更类型',
|
change_type varchar(20) default '' not null comment '变更类型',
|
||||||
change_detail varchar(256) default '' not null comment '变更详情',
|
change_detail varchar(256) default '' not null comment '变更详情',
|
||||||
operator varchar(50) not null comment '变更操作人',
|
operator varchar(50) not null comment '变更操作人',
|
||||||
|
|||||||
@ -31,7 +31,7 @@ public interface PlatUserRoleChangeApi {
|
|||||||
* @param req 户变更日志
|
* @param req 户变更日志
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/api/v1/plat/user/change/log")
|
@PostMapping(value = "/api/v1/plat/account/change/log")
|
||||||
ApiResult<Void> savePlatUserAccountChangeLog(@RequestBody @Validated PlatAccountChangeLogReq req);
|
ApiResult<Void> savePlatUserAccountChangeLog(@RequestBody @Validated PlatAccountChangeLogReq req);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,7 +40,7 @@ public interface PlatUserRoleChangeApi {
|
|||||||
* @param platAccountChangeQuery 查询条件
|
* @param platAccountChangeQuery 查询条件
|
||||||
* @return 返回账户变动记录列表
|
* @return 返回账户变动记录列表
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/api/v1/plat/user/change/log/query")
|
@PostMapping(value = "/api/v1/plat/account/change/log/query")
|
||||||
ApiPageResult<PlatAccountChangeLogResp> queryPlatUserAccountChangeLog(@RequestBody @Validated PlatAccountChangeQuery platAccountChangeQuery);
|
ApiPageResult<PlatAccountChangeLogResp> queryPlatUserAccountChangeLog(@RequestBody @Validated PlatAccountChangeQuery platAccountChangeQuery);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,34 @@
|
|||||||
|
package cn.axzo.tyr.client.model.enums;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 账户变更类型
|
||||||
|
*
|
||||||
|
* @author zuoqinbo
|
||||||
|
* @version V1.0
|
||||||
|
* @Date 2023/11/24 11:05
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum ChangeActionType {
|
||||||
|
/**
|
||||||
|
* 加入
|
||||||
|
*/
|
||||||
|
JOIN("join", "加入"),
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*/
|
||||||
|
ADD("add", "添加"),
|
||||||
|
/**
|
||||||
|
* 移除
|
||||||
|
*/
|
||||||
|
REMOVE("remove", "移除"),
|
||||||
|
;
|
||||||
|
|
||||||
|
private final String code;
|
||||||
|
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
package cn.axzo.tyr.client.model.enums;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 账户变更类型
|
||||||
|
*
|
||||||
|
* @version V1.0
|
||||||
|
* @author: zuoqinbo
|
||||||
|
* @date: 2023/11/24 11:05
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum ChangeType {
|
||||||
|
/**
|
||||||
|
* 离职
|
||||||
|
*/
|
||||||
|
DIMISSION("dimission", "离职"),
|
||||||
|
/**
|
||||||
|
* 角色变动
|
||||||
|
*/
|
||||||
|
ROLE_CHANGE("role_change", "角色变动"),
|
||||||
|
/**
|
||||||
|
* 部门变动
|
||||||
|
*/
|
||||||
|
ORGANIZATION_CHANGE("organization_change", "部门变动"),
|
||||||
|
/**
|
||||||
|
* 岗位变动
|
||||||
|
*/
|
||||||
|
JOB_CHANGE("job_change", "岗位变动"),
|
||||||
|
;
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
private String desc;
|
||||||
|
|
||||||
|
}
|
||||||
@ -5,6 +5,8 @@ import lombok.Builder;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
@ -17,26 +19,42 @@ import java.util.Date;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Builder
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class PlatAccountChangeLogReq {
|
public class PlatAccountChangeLogReq {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 安心筑id
|
* 安心筑id
|
||||||
*/
|
*/
|
||||||
|
@NotNull(message = "axzoUserId is required")
|
||||||
private Long axzoUserId;
|
private Long axzoUserId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 变更类型
|
* 请求ID
|
||||||
*/
|
*/
|
||||||
|
private String requestId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 变更类型
|
||||||
|
*
|
||||||
|
* @see cn.axzo.tyr.client.model.enums.ChangeType
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "changeType is required")
|
||||||
private String changeType;
|
private String changeType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 变更详情
|
* 变更详情
|
||||||
|
* 变更动作:变更模板
|
||||||
|
*
|
||||||
|
* @see cn.axzo.tyr.client.model.enums.ChangeActionType
|
||||||
*/
|
*/
|
||||||
|
@NotEmpty(message = "changeDetail is required")
|
||||||
private String changeDetail;
|
private String changeDetail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* operator
|
* operator
|
||||||
*/
|
*/
|
||||||
|
@NotEmpty(message = "operator is required")
|
||||||
private String operator;
|
private String operator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -4,6 +4,8 @@ import cn.axzo.core.domain.PageRequest;
|
|||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
@ -15,12 +17,12 @@ import java.util.Date;
|
|||||||
* @date 2023/11/23 18:03
|
* @date 2023/11/23 18:03
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Builder
|
|
||||||
public class PlatAccountChangeQuery extends PageRequest {
|
public class PlatAccountChangeQuery extends PageRequest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 安心筑id
|
* 安心筑id
|
||||||
*/
|
*/
|
||||||
|
@NotNull(message = "axzoUserId is required")
|
||||||
private Long axzoUserId;
|
private Long axzoUserId;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
package cn.axzo.tyr.client.model.res;
|
package cn.axzo.tyr.client.model.res;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@ -15,6 +17,8 @@ import java.util.Date;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Builder
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class PlatAccountChangeLogResp {
|
public class PlatAccountChangeLogResp {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -22,6 +26,11 @@ public class PlatAccountChangeLogResp {
|
|||||||
*/
|
*/
|
||||||
private Long axzoUserId;
|
private Long axzoUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* requestId
|
||||||
|
*/
|
||||||
|
private String requestId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 变更类型
|
* 变更类型
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -11,6 +11,8 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tyr
|
* tyr
|
||||||
*
|
*
|
||||||
@ -23,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class PlatUserRoleChangeController implements PlatUserRoleChangeApi {
|
public class PlatUserRoleChangeController implements PlatUserRoleChangeApi {
|
||||||
|
|
||||||
|
@Resource
|
||||||
private PlatUserRoleChangeService roleChangeService;
|
private PlatUserRoleChangeService roleChangeService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -34,6 +34,12 @@ public class PlatUserAccountChangeLog extends BaseEntity<PlatUserAccountChangeLo
|
|||||||
@TableField(value = "axzo_user_id")
|
@TableField(value = "axzo_user_id")
|
||||||
private Long axzoUserId;
|
private Long axzoUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求Id
|
||||||
|
*/
|
||||||
|
@TableField(value = "request_id")
|
||||||
|
private String requestId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 变更类型
|
* 变更类型
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package cn.axzo.tyr.server.service.impl;
|
package cn.axzo.tyr.server.service.impl;
|
||||||
|
|
||||||
import cn.axzo.basics.common.BeanMapper;
|
import cn.axzo.basics.common.BeanMapper;
|
||||||
|
import cn.axzo.framework.domain.ServiceException;
|
||||||
import cn.axzo.framework.domain.page.PageResp;
|
import cn.axzo.framework.domain.page.PageResp;
|
||||||
import cn.axzo.framework.domain.web.result.ApiPageResult;
|
import cn.axzo.framework.domain.web.result.ApiPageResult;
|
||||||
import cn.axzo.tyr.client.model.product.ProductVO;
|
import cn.axzo.tyr.client.model.product.ProductVO;
|
||||||
@ -12,12 +13,15 @@ import cn.axzo.tyr.server.repository.dao.SaasFeatureDao;
|
|||||||
import cn.axzo.tyr.server.repository.entity.PlatUserAccountChangeLog;
|
import cn.axzo.tyr.server.repository.entity.PlatUserAccountChangeLog;
|
||||||
import cn.axzo.tyr.server.repository.entity.ProductModule;
|
import cn.axzo.tyr.server.repository.entity.ProductModule;
|
||||||
import cn.axzo.tyr.server.repository.entity.SaasProductModuleFeatureRelation;
|
import cn.axzo.tyr.server.repository.entity.SaasProductModuleFeatureRelation;
|
||||||
|
import com.alibaba.nacos.common.utils.UuidUtils;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,10 +41,19 @@ public class PlatUserRoleChangeService {
|
|||||||
public void savePlatUserAccountChangeLog(PlatAccountChangeLogReq accountChangeLog) {
|
public void savePlatUserAccountChangeLog(PlatAccountChangeLogReq accountChangeLog) {
|
||||||
PlatUserAccountChangeLog platUserAccountChangeLog = new PlatUserAccountChangeLog();
|
PlatUserAccountChangeLog platUserAccountChangeLog = new PlatUserAccountChangeLog();
|
||||||
BeanUtils.copyProperties(accountChangeLog, platUserAccountChangeLog);
|
BeanUtils.copyProperties(accountChangeLog, platUserAccountChangeLog);
|
||||||
|
if (platUserAccountChangeLog.getOperatorTime() == null) {
|
||||||
|
platUserAccountChangeLog.setOperatorTime(new Date());
|
||||||
|
}
|
||||||
|
if (platUserAccountChangeLog.getRequestId() == null) {
|
||||||
|
platUserAccountChangeLog.setRequestId(UuidUtils.generateUuid());
|
||||||
|
}
|
||||||
userRoleChangeDao.saveOrUpdate(platUserAccountChangeLog);
|
userRoleChangeDao.saveOrUpdate(platUserAccountChangeLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApiPageResult<PlatAccountChangeLogResp> queryPlatUserAccountChangeLog(PlatAccountChangeQuery platAccountChangeQuery) {
|
public ApiPageResult<PlatAccountChangeLogResp> queryPlatUserAccountChangeLog(PlatAccountChangeQuery platAccountChangeQuery) {
|
||||||
|
if (platAccountChangeQuery.getAxzoUserId() == null) {
|
||||||
|
throw new ServiceException("axzoUserId不能为空!");
|
||||||
|
}
|
||||||
IPage<PlatUserAccountChangeLog> page = userRoleChangeDao.lambdaQuery()
|
IPage<PlatUserAccountChangeLog> page = userRoleChangeDao.lambdaQuery()
|
||||||
.eq(PlatUserAccountChangeLog::getAxzoUserId, platAccountChangeQuery.getAxzoUserId())
|
.eq(PlatUserAccountChangeLog::getAxzoUserId, platAccountChangeQuery.getAxzoUserId())
|
||||||
.page(platAccountChangeQuery.toPage());
|
.page(platAccountChangeQuery.toPage());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user