用户的功能迁移
This commit is contained in:
@@ -14,15 +14,11 @@
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>system-application</module>
|
||||
<!-- <module>system-sdk</module>-->
|
||||
<!-- <module>system-service-api</module>-->
|
||||
<!-- <module>system-service-impl</module>-->
|
||||
<module>system-rpc-api</module>
|
||||
<module>system-rpc</module>
|
||||
<module>system-rest</module>
|
||||
<module>system-biz</module>
|
||||
<module>system-biz-api</module>
|
||||
</modules>
|
||||
|
||||
<dependencyManagement>
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>system</artifactId>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>system-application</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!-- Mall 相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>system-rest</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>system-rpc</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,24 +0,0 @@
|
||||
package cn.iocoder.mall.system.application;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.config.ConfigFileApplicationListener;
|
||||
|
||||
@SpringBootApplication(scanBasePackages = {"cn.iocoder.mall.system"})
|
||||
public class SystemApplication {
|
||||
|
||||
/**
|
||||
* 设置需要读取的配置文件的名字。
|
||||
* 基于 {@link org.springframework.boot.context.config.ConfigFileApplicationListener#CONFIG_NAME_PROPERTY} 实现。
|
||||
*/
|
||||
private static final String CONFIG_NAME_VALUE = "biz,rest,rpc,application";
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 设置环境变量
|
||||
System.setProperty(ConfigFileApplicationListener.CONFIG_NAME_PROPERTY, CONFIG_NAME_VALUE);
|
||||
|
||||
// 启动 Spring Boot 应用
|
||||
SpringApplication.run(SystemApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package cn.iocoder.mall.system.biz.convert.user;
|
||||
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.system.biz.bo.ouath2.OAuth2AuthenticateBO;
|
||||
import cn.iocoder.mall.system.biz.bo.user.UserAuthenticateBO;
|
||||
import cn.iocoder.mall.system.biz.bo.user.UserBO;
|
||||
import cn.iocoder.mall.system.biz.dataobject.admin.AdminDO;
|
||||
import cn.iocoder.mall.system.biz.dataobject.user.UserDO;
|
||||
import cn.iocoder.mall.system.biz.dto.user.UserUpdateDTO;
|
||||
import cn.iocoder.mall.system.biz.dto.user.UserUpdateStatusDTO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
public interface UserConvert {
|
||||
|
||||
UserConvert INSTANCE = Mappers.getMapper(UserConvert.class);
|
||||
|
||||
UserBO convert(UserDO bean);
|
||||
|
||||
/**
|
||||
* 用户分页列表 - DOPage转换BO
|
||||
* @param userDOPage
|
||||
* @return
|
||||
*/
|
||||
@Mapping(source = "records", target = "list")
|
||||
PageResult<UserBO> convertToPage(IPage<UserDO> userDOPage);
|
||||
|
||||
/**
|
||||
* 更新用户信息 - DTO转换DO
|
||||
* @param userUpdateDTO
|
||||
* @return
|
||||
*/
|
||||
UserDO convertToUserDO(UserUpdateDTO userUpdateDTO);
|
||||
|
||||
/**
|
||||
* 更新用户状态 - DTO转换DO
|
||||
* @param userUpdateStatusDTO
|
||||
* @return
|
||||
*/
|
||||
UserDO convertToUserDO(UserUpdateStatusDTO userUpdateStatusDTO);
|
||||
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package cn.iocoder.mall.system.biz.dto.user;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @Author: jiangweifan
|
||||
* @Date: 2020/5/12
|
||||
* @Description: 用户信息 - 用户分页列表DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class UserPageDTO {
|
||||
|
||||
/**
|
||||
* 昵称,模糊匹配
|
||||
*/
|
||||
private String nickname;
|
||||
|
||||
/**
|
||||
* 状态。1 - 开启;2 - 禁用
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 页码,从 1 开始
|
||||
*/
|
||||
@NotNull(message = "页码不能为空")
|
||||
private Integer pageNo;
|
||||
|
||||
/**
|
||||
* 每页条数
|
||||
*/
|
||||
@NotNull(message = "每页条数不能为空")
|
||||
private Integer pageSize;
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package cn.iocoder.mall.system.biz.service.user;
|
||||
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.system.biz.bo.user.UserBO;
|
||||
import cn.iocoder.mall.system.biz.dto.user.UserPageDTO;
|
||||
import cn.iocoder.mall.system.biz.dto.user.UserUpdateDTO;
|
||||
import cn.iocoder.mall.system.biz.dto.user.UserUpdateStatusDTO;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 用户 Service 接口
|
||||
*/
|
||||
@Validated
|
||||
public interface UserService {
|
||||
|
||||
/**
|
||||
* 根据条件分页获取用户列表
|
||||
* @param userPageDTO
|
||||
* @return
|
||||
*/
|
||||
PageResult<UserBO> getUserPage(UserPageDTO userPageDTO);
|
||||
|
||||
/**
|
||||
* 更新用户信息
|
||||
* @param userUpdateDTO
|
||||
* @return
|
||||
*/
|
||||
Boolean updateUserInfo(@Valid UserUpdateDTO userUpdateDTO);
|
||||
|
||||
/**
|
||||
* 更新用户状态
|
||||
* @param userUpdateStatusDTO
|
||||
* @return
|
||||
*/
|
||||
Boolean updateUserStatus(@Valid UserUpdateStatusDTO userUpdateStatusDTO);
|
||||
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package cn.iocoder.mall.system.biz.service.user;
|
||||
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.system.biz.bo.ouath2.OAuth2AuthenticateBO;
|
||||
import cn.iocoder.mall.system.biz.bo.user.UserAuthenticateBO;
|
||||
import cn.iocoder.mall.system.biz.bo.user.UserBO;
|
||||
import cn.iocoder.mall.system.biz.convert.user.UserConvert;
|
||||
import cn.iocoder.mall.system.biz.dao.user.UserMapper;
|
||||
import cn.iocoder.mall.system.biz.dataobject.user.UserDO;
|
||||
import cn.iocoder.mall.system.biz.dto.oatuh2.OAuth2MobileCodeAuthenticateDTO;
|
||||
import cn.iocoder.mall.system.biz.dto.user.UserPageDTO;
|
||||
import cn.iocoder.mall.system.biz.dto.user.UserUpdateDTO;
|
||||
import cn.iocoder.mall.system.biz.dto.user.UserUpdateStatusDTO;
|
||||
import cn.iocoder.mall.system.biz.enums.user.UserStatusEnum;
|
||||
import cn.iocoder.mall.system.biz.service.oauth2.OAuth2Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import static cn.iocoder.mall.system.biz.enums.SystemErrorCodeEnum.*;
|
||||
|
||||
@Service
|
||||
public class UserServiceImpl implements UserService {
|
||||
|
||||
@Autowired
|
||||
private UserMapper userMapper;
|
||||
|
||||
/**
|
||||
* 根据条件分页获取用户列表
|
||||
* @param userPageDTO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public PageResult<UserBO> getUserPage(UserPageDTO userPageDTO) {
|
||||
return UserConvert.INSTANCE.convertToPage(userMapper.selectUserPage(userPageDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户信息
|
||||
* @param userUpdateDTO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateUserInfo(UserUpdateDTO userUpdateDTO) {
|
||||
// 查询用户是否存在
|
||||
UserDO userDO = userMapper.selectById(userUpdateDTO.getId());
|
||||
if (null == userDO) {
|
||||
throw ServiceExceptionUtil.exception(USER_NOT_EXISTS);
|
||||
}
|
||||
// 更新用户信息
|
||||
UserDO updateDO = UserConvert.INSTANCE.convertToUserDO(userUpdateDTO);
|
||||
userMapper.updateById(updateDO);
|
||||
// TODO 伟帆 操作日志
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新用户状态
|
||||
* @param userUpdateStatusDTO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateUserStatus(UserUpdateStatusDTO userUpdateStatusDTO) {
|
||||
// 查询用户是否存在
|
||||
UserDO userDO = userMapper.selectById(userUpdateStatusDTO.getId());
|
||||
if (null == userDO) {
|
||||
throw ServiceExceptionUtil.exception(USER_NOT_EXISTS);
|
||||
}
|
||||
// 判断更新状态是否存在
|
||||
if (null != userUpdateStatusDTO.getStatus() &&
|
||||
Arrays.stream(UserStatusEnum.ARRAYS).noneMatch(status -> status == userUpdateStatusDTO.getStatus())) {
|
||||
throw ServiceExceptionUtil.exception(USER_STATUS_NOT_EXISTS);
|
||||
}
|
||||
// 如果状态相同,则返回错误
|
||||
if (null != userUpdateStatusDTO.getStatus() && userUpdateStatusDTO.getStatus().equals(userDO.getStatus())) {
|
||||
throw ServiceExceptionUtil.exception(USER_STATUS_EQUALS);
|
||||
}
|
||||
// 更新用户信息
|
||||
UserDO updateStatusDO = UserConvert.INSTANCE.convertToUserDO(userUpdateStatusDTO);
|
||||
userMapper.updateById(updateStatusDO);
|
||||
// TODO 伟帆 操作日志
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package cn.iocoder.mall.system.rest.controller.admin;
|
||||
|
||||
import cn.iocoder.common.framework.enums.MallConstants;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.system.biz.bo.user.UserBO;
|
||||
import cn.iocoder.mall.system.biz.service.user.UserService;
|
||||
import cn.iocoder.mall.system.rest.convert.admin.AdminsUserConvert;
|
||||
import cn.iocoder.mall.system.rest.request.admin.AdminsUserPageRequest;
|
||||
import cn.iocoder.mall.system.rest.request.admin.AdminsUserUpdateRequest;
|
||||
import cn.iocoder.mall.system.rest.request.admin.AdminsUserUpdateStatusRequest;
|
||||
import cn.iocoder.mall.system.rest.response.admin.AdminsUserPageResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* @Author: jiangweifan
|
||||
* @Date: 2020/5/12
|
||||
* @Description: 管理员 - 用户信息
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(MallConstants.ROOT_PATH_ADMIN + "/user-info")
|
||||
@Api(tags = "管理员 - 用户信息 API")
|
||||
public class AdminsUserController {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation(value = "用户分页列表")
|
||||
public CommonResult<PageResult<AdminsUserPageResponse>> page(AdminsUserPageRequest adminsUserPageRequest) {
|
||||
PageResult<UserBO> userPage = userService.getUserPage(AdminsUserConvert.INSTANCE.convertToPageDTO(adminsUserPageRequest));
|
||||
return success(AdminsUserConvert.INSTANCE.convertToPageResponse(userPage));
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@ApiOperation(value = "更新用户基本信息")
|
||||
public CommonResult<Boolean> update(AdminsUserUpdateRequest adminsUserUpdateRequest) {
|
||||
return success(userService.updateUserInfo(AdminsUserConvert.INSTANCE.convertToUpdateDTO(adminsUserUpdateRequest)));
|
||||
}
|
||||
|
||||
@PostMapping("/update_status")
|
||||
@ApiOperation(value = "更新用户状态")
|
||||
public CommonResult<Boolean> updateStatus(AdminsUserUpdateStatusRequest adminsUserUpdateStatusRequest) {
|
||||
return success(userService.updateUserStatus(AdminsUserConvert.INSTANCE.convertToUpdateStatusDTO(adminsUserUpdateStatusRequest)));
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package cn.iocoder.mall.system.rest.convert.admin;
|
||||
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.system.biz.bo.user.UserBO;
|
||||
import cn.iocoder.mall.system.biz.dto.user.UserPageDTO;
|
||||
import cn.iocoder.mall.system.biz.dto.user.UserUpdateDTO;
|
||||
import cn.iocoder.mall.system.biz.dto.user.UserUpdateStatusDTO;
|
||||
import cn.iocoder.mall.system.rest.request.admin.AdminsUserPageRequest;
|
||||
import cn.iocoder.mall.system.rest.request.admin.AdminsUserUpdateRequest;
|
||||
import cn.iocoder.mall.system.rest.request.admin.AdminsUserUpdateStatusRequest;
|
||||
import cn.iocoder.mall.system.rest.response.admin.AdminsUserPageResponse;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @Author: jiangweifan
|
||||
* @Date: 2020/5/12
|
||||
* @Description: 管理后台 - 用户数据转换
|
||||
*/
|
||||
@Mapper
|
||||
public interface AdminsUserConvert {
|
||||
|
||||
AdminsUserConvert INSTANCE = Mappers.getMapper(AdminsUserConvert.class);
|
||||
|
||||
/**
|
||||
* 分页获取用户列表 - Request转DTO
|
||||
* @param adminsUserPageRequest
|
||||
* @return
|
||||
*/
|
||||
UserPageDTO convertToPageDTO(AdminsUserPageRequest adminsUserPageRequest);
|
||||
|
||||
/**
|
||||
* 更新用户信息 - Request转DTO
|
||||
* @param adminsUserUpdateRequest
|
||||
* @return
|
||||
*/
|
||||
UserUpdateDTO convertToUpdateDTO(AdminsUserUpdateRequest adminsUserUpdateRequest);
|
||||
|
||||
/**
|
||||
* 更新用户状态 - Request转DTO
|
||||
* @param adminsUserUpdateStatusRequest
|
||||
* @return
|
||||
*/
|
||||
UserUpdateStatusDTO convertToUpdateStatusDTO(AdminsUserUpdateStatusRequest adminsUserUpdateStatusRequest);
|
||||
|
||||
/**
|
||||
* 分页获取用户列表 - BO转Response
|
||||
* @param userPage
|
||||
* @return
|
||||
*/
|
||||
PageResult<AdminsUserPageResponse> convertToPageResponse(PageResult<UserBO> userPage);
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package cn.iocoder.mall.system.rest.convert.systemlog;
|
||||
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.system.biz.bo.systemlog.AccessLogBO;
|
||||
import cn.iocoder.mall.system.rest.response.systemlog.AccessLogPageResponse;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author:ycjx
|
||||
* @descriptio
|
||||
* @create:2019-06-23 17:36
|
||||
*/
|
||||
@Mapper
|
||||
public interface AccessLogConvert {
|
||||
|
||||
|
||||
AccessLogConvert INSTANCE = Mappers.getMapper(AccessLogConvert.class);
|
||||
|
||||
|
||||
@Mappings({}) // TODO FROM 芋艿 to 2447007062:注意空行哟;另外,如果不需要专门 mapping,可以不添加该注解,嘿嘿。
|
||||
PageResult<AccessLogPageResponse> convert(PageResult<AccessLogBO> result);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package cn.iocoder.mall.system.rest.request.errorcode;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
@ApiModel("管理员 - 错误码模块 - 添加错误码 Request")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ErrorCodeAddRequest {
|
||||
|
||||
@ApiModelProperty(value = "错误码信息", required = true, example = "系统管理员")
|
||||
@NotEmpty(message = "错误码信息不能为空")
|
||||
private String message;
|
||||
|
||||
@ApiModelProperty(value = "错误码编码", example = "SUPER_ADMIN")
|
||||
@NotEmpty(message = "错误码编码不能为空")
|
||||
private Integer code;
|
||||
|
||||
@ApiModelProperty(value = "错误码分组,字典表获取")
|
||||
@NotEmpty(message = "错误码分组不能为空")
|
||||
private Integer group;
|
||||
|
||||
@ApiModelProperty(value = "错误码角色,系统内置(枚举)还是自定义")
|
||||
@NotEmpty(message = "错误码角色不能空")
|
||||
private Integer type;
|
||||
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package cn.iocoder.mall.system.rest.request.errorcode;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
||||
/**
|
||||
* @author ding
|
||||
*/
|
||||
@ApiModel("管理员 - 错误码模块 - 错误码分页 Request")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ErrorCodePageRequest {
|
||||
|
||||
// TODO FROM 芋艿 to 鱿鱼须:分页参数?
|
||||
// TODO FROM 芋艿 to 鱿鱼须:对于 rest 的接口,要区分下是给 Admins 管理员还是 Users 用户的
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package cn.iocoder.mall.system.rest.request.errorcode;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 类 描 述:错误码模块
|
||||
* @author ding
|
||||
*/
|
||||
@ApiModel("管理员 - 错误码模块 - 修改错误码 Request")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ErrorCodeUpdateRequest {
|
||||
@ApiModelProperty(value = "错误码编号", required = true, example = "1")
|
||||
@NotNull(message = "错误码不能为空")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "错误码信息", required = true, example = "系统管理员")
|
||||
@NotEmpty(message = "错误码信息不能为空")
|
||||
private String message;
|
||||
|
||||
@ApiModelProperty(value = "错误码编码", example = "SUPER_ADMIN")
|
||||
@NotEmpty(message = "错误码编码不能为空")
|
||||
private Integer code;
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package cn.iocoder.mall.system.rest.response.authorization;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel(value = "管理员 - 授权模块 - 菜单资源树 Response", description = "一般用于首页菜单树")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminsAuthorizationMenuTreeResponse {
|
||||
|
||||
@ApiModelProperty(value = "菜单编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "菜单名", required = true, example = "商品管理")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "前端路由", required = true, example = "/order/list")
|
||||
private String route;
|
||||
@ApiModelProperty(value = "菜单图标", required = true, example = "user")
|
||||
private String icon;
|
||||
/**
|
||||
* 子节点数组
|
||||
*/
|
||||
private List<AdminsAuthorizationMenuTreeResponse> children;
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package cn.iocoder.mall.system.rest.response.authorization;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel(value = "管理员 - 授权模块 - 角色拥有的资源树 Response")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminsAuthorizationRoleResourceTreeResponse {
|
||||
|
||||
@ApiModelProperty(value = "菜单编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "菜单名", required = true, example = "商品管理")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "是否分配", required = true, notes = "即角色是否拥有该资源")
|
||||
private Boolean assigned;
|
||||
/**
|
||||
* 子节点数组
|
||||
*/
|
||||
private List<AdminsAuthorizationRoleResourceTreeResponse> children;
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package cn.iocoder.mall.system.rest.response.authorization;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("管理员 - 授权模块 - 菜单资源树 Response")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminsResourceTreeResponse {
|
||||
|
||||
@ApiModelProperty(value = "菜单编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "菜单名", required = true, example = "商品管理")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "权限标识", example = "/order/list")
|
||||
private String permission;
|
||||
@ApiModelProperty(value = "资源类型", required = true, example = "1-菜单;2-按钮")
|
||||
private Integer type;
|
||||
@ApiModelProperty(value = "排序", required = true, example = "1")
|
||||
private Integer sort;
|
||||
@ApiModelProperty(value = "父菜单编号", required = true, example = "1", notes = "如果无父菜单,则值为 0")
|
||||
private Integer pid;
|
||||
@ApiModelProperty(value = "前端路由", example = "/order/list")
|
||||
private String route;
|
||||
@ApiModelProperty(value = "菜单图标", example = "user")
|
||||
private String icon;
|
||||
/**
|
||||
* 子节点数组
|
||||
*/
|
||||
private List<AdminsResourceTreeResponse> children;
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package cn.iocoder.mall.system.rest.response.errorcode;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 类 描 述:错误码模块
|
||||
* @author ding
|
||||
*/
|
||||
@ApiModel("管理员 - 错误码模块 - 查询错误码 Request")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ErrorCodePageResponse {
|
||||
/**
|
||||
* 错误码编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 错误码编码
|
||||
*/
|
||||
private Integer code;
|
||||
/**
|
||||
* 错误码错误信息
|
||||
*/
|
||||
private String message;
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package cn.iocoder.mall.system.rest.response.systemlog;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author mxc
|
||||
* @date 2020/5/11 22:11
|
||||
*/
|
||||
@ApiModel("访问日志 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AccessLogPageResponse {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "链路追踪编号", required = true, example = "1")
|
||||
private String traceId;
|
||||
|
||||
@ApiModelProperty(value = "账号编号", required = true, example = "1")
|
||||
private Integer accountId;;
|
||||
|
||||
@ApiModelProperty(value = "应用名", required = true, example = "1")
|
||||
private String applicationName;
|
||||
|
||||
@ApiModelProperty(value = "访问地址", required = true, example = "1")
|
||||
private String uri;
|
||||
|
||||
@ApiModelProperty(value = "请求参数", required = true, example = "1")
|
||||
private String queryString;
|
||||
|
||||
@ApiModelProperty(value = "http 请求方法", required = true, example = "1")
|
||||
private String method;
|
||||
|
||||
@ApiModelProperty(value = "User-Agent ", required = true, example = "1")
|
||||
private String userAgent;
|
||||
|
||||
@ApiModelProperty(value = "ip", required = true, example = "1")
|
||||
private String ip;
|
||||
|
||||
@ApiModelProperty(value = "请求时间", required = true, example = "1")
|
||||
private Date startTime;
|
||||
|
||||
@ApiModelProperty(value = "响应时长", required = true, example = "1")
|
||||
private Integer responseTime;
|
||||
|
||||
@ApiModelProperty(value = "错误码", required = true, example = "1")
|
||||
private Integer errorCode;
|
||||
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>system</artifactId>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>system-rpc-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!-- Mall 相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>system-biz-api</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 工具类相关 -->
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,15 +0,0 @@
|
||||
package cn.iocoder.mall.system.rpc.api.user;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.system.rpc.response.user.UserResponse;
|
||||
|
||||
/**
|
||||
* User RPC 接口
|
||||
*/
|
||||
public interface UserRPC {
|
||||
|
||||
// CommonResult<UserResponse> getUser(Integer id);
|
||||
|
||||
CommonResult<UserResponse> getUserByAccountId(Integer accountId);
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package cn.iocoder.mall.system.rpc.response.user;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* User 模块 - User 信息 Response
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class UserResponse implements Serializable {
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>system</artifactId>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>system-rpc</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!-- Mall 相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>system-rpc-api</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>system-biz</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- RPC 相关 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-dubbo</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Registry 和 Config 相关 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,15 +0,0 @@
|
||||
package cn.iocoder.mall.system.rpc.convert.user;
|
||||
|
||||
import cn.iocoder.mall.system.biz.bo.user.UserBO;
|
||||
import cn.iocoder.mall.system.rpc.response.user.UserResponse;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
public interface UserConvert {
|
||||
|
||||
UserConvert INSTANCE = Mappers.getMapper(UserConvert.class);
|
||||
|
||||
UserResponse convert(UserBO bean);
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package cn.iocoder.mall.system.rpc.rpc.user;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.system.biz.bo.user.UserBO;
|
||||
import cn.iocoder.mall.system.biz.service.user.UserService;
|
||||
import cn.iocoder.mall.system.rpc.api.user.UserRPC;
|
||||
import cn.iocoder.mall.system.rpc.convert.user.UserConvert;
|
||||
import cn.iocoder.mall.system.rpc.response.user.UserResponse;
|
||||
import org.apache.dubbo.config.annotation.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@Service(version = "${dubbo.provider.UserRPC.version}", validation = "true")
|
||||
public class UserRPCImpl implements UserRPC {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Override
|
||||
public CommonResult<UserResponse> getUserByAccountId(Integer accountId) {
|
||||
UserBO userBO = userService.getUserByAccountId(accountId);
|
||||
return CommonResult.success(UserConvert.INSTANCE.convert(userBO));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
spring:
|
||||
# Spring Cloud 配置项
|
||||
cloud:
|
||||
nacos:
|
||||
# Spring Cloud Nacos Discovery 配置项
|
||||
discovery:
|
||||
server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址
|
||||
namespace: local # Nacos 命名空间
|
||||
|
||||
# Dubbo 配置项
|
||||
dubbo:
|
||||
# Dubbo 注册中心
|
||||
registry:
|
||||
address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址
|
||||
@@ -1,14 +0,0 @@
|
||||
spring:
|
||||
# Spring Cloud 配置项
|
||||
cloud:
|
||||
nacos:
|
||||
# Spring Cloud Nacos Discovery 配置项
|
||||
discovery:
|
||||
server-addr: s1.iocoder.cn:8848 # Nacos 服务器地址
|
||||
namespace: test # Nacos 命名空间
|
||||
|
||||
# Dubbo 配置项
|
||||
dubbo:
|
||||
# Dubbo 注册中心
|
||||
registry:
|
||||
address: spring-cloud://s1.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址
|
||||
@@ -1,44 +0,0 @@
|
||||
# Dubbo 配置项
|
||||
dubbo:
|
||||
# Spring Cloud Alibaba Dubbo 专属配置
|
||||
cloud:
|
||||
subscribed-services: '' # 设置订阅的应用列表,默认为 * 订阅所有应用
|
||||
# Dubbo 提供者的协议
|
||||
protocol:
|
||||
name: dubbo
|
||||
port: -1
|
||||
# Dubbo 提供服务的扫描基础包
|
||||
scan:
|
||||
base-packages: cn.iocoder.mall.system.rpc.rpc
|
||||
# Dubbo 服务提供者的配置
|
||||
provider:
|
||||
filter: -exception
|
||||
SystemLogRPC:
|
||||
version: 1.0.0
|
||||
OAuth2RPC:
|
||||
version: 1.0.0
|
||||
AuthorizationRPC:
|
||||
version: 1.0.0
|
||||
AdminRPC:
|
||||
version: 1.0.0
|
||||
UserRPC:
|
||||
version: 1.0.0
|
||||
UserAddressRPC:
|
||||
version: 1.0.0
|
||||
ErrorCodeRPC:
|
||||
version: 1.0.0
|
||||
|
||||
# Dubbo 服务消费者的配置
|
||||
consumer:
|
||||
SystemLogRPC: # 用于 AccessLogInterceptor 等拦截器,记录 HTTP API 请求的访问日志
|
||||
version: 1.0.0
|
||||
OAuth2RPC: # 用于 AccountAuthInterceptor 拦截器,执行认证
|
||||
version: 1.0.0
|
||||
AuthorizationRPC: # 用于 AccountAuthInterceptor 拦截器,执行鉴权(权限验证)
|
||||
version: 1.0.0
|
||||
AdminRPC:
|
||||
version: 1.0.0
|
||||
UserRPC:
|
||||
version: 1.0.0
|
||||
ErrorCodeRPC:
|
||||
version: 1.0.0
|
||||
Reference in New Issue
Block a user