移除账号AccountTypeEnum,使用Platform数据库字段判断账号所属平台
修复了一些小问题
This commit is contained in:
parent
677b57b16a
commit
b67d0a5f9c
@ -1,33 +0,0 @@
|
|||||||
package com.zayac.admin.system.enums;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import top.continew.starter.data.mybatis.plus.base.IBaseEnum;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public enum AccountTypeEnum implements IBaseEnum<Integer> {
|
|
||||||
/**
|
|
||||||
* 开云
|
|
||||||
*/
|
|
||||||
KY(1, "开云"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 华体会
|
|
||||||
*/
|
|
||||||
HTH(2, "华体会"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 九游
|
|
||||||
*/
|
|
||||||
JY(3, "九游"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 爱体育
|
|
||||||
*/
|
|
||||||
ATY(4, "爱体育"),
|
|
||||||
;
|
|
||||||
|
|
||||||
private final Integer value;
|
|
||||||
private final String description;
|
|
||||||
}
|
|
@ -3,7 +3,6 @@ package com.zayac.admin.system.model.entity;
|
|||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
|
||||||
import com.zayac.admin.common.enums.DisEnableStatusEnum;
|
import com.zayac.admin.common.enums.DisEnableStatusEnum;
|
||||||
import com.zayac.admin.system.enums.AccountTypeEnum;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
@ -38,11 +37,6 @@ public class AccountDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
/**
|
|
||||||
* 账号类型(1:开云,2:华体会,3:九游,4:爱游戏)
|
|
||||||
*/
|
|
||||||
private AccountTypeEnum type;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* headers
|
* headers
|
||||||
*/
|
*/
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.zayac.admin.system.model.entity;
|
package com.zayac.admin.system.model.entity;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
import com.zayac.admin.common.enums.DisEnableStatusEnum;
|
import com.zayac.admin.common.enums.DisEnableStatusEnum;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -25,9 +24,9 @@ public class PlatformDO extends BaseDO {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 平台ID
|
* 平台代码
|
||||||
*/
|
*/
|
||||||
private Integer platformId;
|
private Integer code;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 平台名称
|
* 平台名称
|
||||||
|
@ -29,7 +29,7 @@ public class AccountQuery implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@Schema(description = "账号昵称")
|
@Schema(description = "账号昵称")
|
||||||
@Query(type = QueryType.EQ)
|
@Query(type = QueryType.EQ)
|
||||||
private String name;
|
private String nickname;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 账号
|
* 账号
|
||||||
@ -39,11 +39,18 @@ public class AccountQuery implements Serializable {
|
|||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 账号类型(0:开云,1:华体会,2:九游,3:爱游戏)
|
* 所属平台
|
||||||
*/
|
*/
|
||||||
@Schema(description = "账号类型(0:开云,1:华体会,2:九游,3:爱游戏)")
|
@Schema(description = "账号类型(0:开云,1:华体会,2:九游,3:爱游戏)")
|
||||||
@Query(type = QueryType.EQ)
|
@Query(type = QueryType.EQ)
|
||||||
private Boolean type;
|
private Long platformId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属账号
|
||||||
|
*/
|
||||||
|
@Schema(description = "所属用户")
|
||||||
|
@Query(type = QueryType.EQ)
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态(1:启用;2:禁用)
|
* 状态(1:启用;2:禁用)
|
||||||
|
@ -28,9 +28,9 @@ public class PlatformQuery implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 平台ID
|
* 平台ID
|
||||||
*/
|
*/
|
||||||
@Schema(description = "平台ID", example = "ky")
|
@Schema(description = "平台代码", example = "1")
|
||||||
@Query(type = QueryType.EQ)
|
@Query(type = QueryType.EQ)
|
||||||
private Integer platformId;
|
private Integer code;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 平台名称
|
* 平台名称
|
||||||
|
@ -1,17 +1,8 @@
|
|||||||
package com.zayac.admin.system.model.req;
|
package com.zayac.admin.system.model.req;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
import cn.crane4j.annotation.AssembleMethod;
|
|
||||||
import cn.crane4j.annotation.ContainerMethod;
|
|
||||||
import cn.crane4j.annotation.Mapping;
|
|
||||||
import com.zayac.admin.common.enums.DisEnableStatusEnum;
|
import com.zayac.admin.common.enums.DisEnableStatusEnum;
|
||||||
import com.zayac.admin.system.enums.AccountTypeEnum;
|
|
||||||
import com.zayac.admin.system.model.resp.DeptResp;
|
|
||||||
import com.zayac.admin.system.model.resp.PlatformResp;
|
|
||||||
import com.zayac.admin.system.service.DeptService;
|
|
||||||
import com.zayac.admin.system.service.PlatformService;
|
|
||||||
import jakarta.validation.constraints.*;
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -58,14 +49,6 @@ public class AccountReq extends BaseReq {
|
|||||||
@Length(max = 64, message = "密码长度不能超过 {max} 个字符")
|
@Length(max = 64, message = "密码长度不能超过 {max} 个字符")
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
/**
|
|
||||||
* 账号类型(1:开云,2:华体会,3:九游,4:爱游戏)
|
|
||||||
*/
|
|
||||||
@Schema(description = "账号类型(1:开云,2:华体会,3:九游,4:爱游戏)", type = "Integer", allowableValues = {"1", "2", "3", "4"}, example = "1")
|
|
||||||
@NotNull(message = "账号类型不能为空")
|
|
||||||
@AssembleMethod(targetType = PlatformService.class, method = @ContainerMethod(bindMethod = "getByPlatformId", resultType = PlatformResp.class), prop="id:platformId")
|
|
||||||
private AccountTypeEnum type;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态(1:启用;2:禁用)
|
* 状态(1:启用;2:禁用)
|
||||||
*/
|
*/
|
||||||
@ -82,6 +65,7 @@ public class AccountReq extends BaseReq {
|
|||||||
/**
|
/**
|
||||||
* 所属平台ID
|
* 所属平台ID
|
||||||
*/
|
*/
|
||||||
|
@Schema(description = "所属平台ID", example = "123456789")
|
||||||
private Long platformId;
|
private Long platformId;
|
||||||
|
|
||||||
}
|
}
|
@ -52,11 +52,11 @@ public class PlatformReq extends BaseReq {
|
|||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 平台ID
|
* 平台代码
|
||||||
*/
|
*/
|
||||||
@Schema(description = "平台ID")
|
@Schema(description = "平台代码")
|
||||||
@NotNull(message = "平台ID不能为空")
|
@NotNull(message = "平台代码不能为空")
|
||||||
private Integer platformId;
|
private Integer code;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态(1启用,2禁用)
|
* 状态(1启用,2禁用)
|
||||||
|
@ -3,7 +3,6 @@ package com.zayac.admin.system.model.resp;
|
|||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
|
||||||
import com.zayac.admin.common.enums.DisEnableStatusEnum;
|
import com.zayac.admin.common.enums.DisEnableStatusEnum;
|
||||||
import com.zayac.admin.system.enums.AccountTypeEnum;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@ -48,13 +47,6 @@ public class AccountDetailResp extends BaseDetailResp {
|
|||||||
@ExcelProperty(value = "密码")
|
@ExcelProperty(value = "密码")
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
/**
|
|
||||||
* 账号类型(1:开云,2:华体会,3:九游,4:爱游戏)
|
|
||||||
*/
|
|
||||||
@Schema(description = "账号类型(1:开云,2:华体会,3:九游,4:爱游戏)", type = "Integer", allowableValues = {"1", "2", "3", "4"}, example = "1")
|
|
||||||
@ExcelProperty(value = "账号类型")
|
|
||||||
private AccountTypeEnum type;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* headers
|
* headers
|
||||||
*/
|
*/
|
||||||
@ -76,4 +68,20 @@ public class AccountDetailResp extends BaseDetailResp {
|
|||||||
@Schema(description = "用户ID")
|
@Schema(description = "用户ID")
|
||||||
@ExcelProperty(value = "用户ID")
|
@ExcelProperty(value = "用户ID")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属用户
|
||||||
|
*/
|
||||||
|
@Schema(description = "所属用户")
|
||||||
|
@ExcelProperty(value = "所属用户")
|
||||||
|
private String ownerName;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平台名称
|
||||||
|
*/
|
||||||
|
@Schema(description = "平台名称")
|
||||||
|
@ExcelProperty(value = "平台名称")
|
||||||
|
private String platformName;
|
||||||
}
|
}
|
@ -6,7 +6,7 @@ import cn.crane4j.annotation.AssembleMethod;
|
|||||||
import cn.crane4j.annotation.ContainerMethod;
|
import cn.crane4j.annotation.ContainerMethod;
|
||||||
import cn.crane4j.annotation.Mapping;
|
import cn.crane4j.annotation.Mapping;
|
||||||
import com.zayac.admin.common.enums.DisEnableStatusEnum;
|
import com.zayac.admin.common.enums.DisEnableStatusEnum;
|
||||||
import com.zayac.admin.system.enums.AccountTypeEnum;
|
import com.zayac.admin.system.service.PlatformService;
|
||||||
import com.zayac.admin.system.service.UserService;
|
import com.zayac.admin.system.service.UserService;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@ -49,15 +49,22 @@ public class AccountResp extends BaseResp {
|
|||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 平台(0:开云,1:华体会,2:九游,3:爱游戏)
|
* 平台名称
|
||||||
*/
|
*/
|
||||||
@Schema(description = "平台(0:开云,1:华体会,2:九游,3:爱游戏)", type = "Integer", allowableValues = {"0", "1", "2", "3", "4"}, example = "1")
|
@Schema(description = "平台名称", example = "开云")
|
||||||
private AccountTypeEnum type;
|
private String platformName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平台ID
|
||||||
|
*/
|
||||||
|
@AssembleMethod(targetType = PlatformService.class, method = @ContainerMethod(bindMethod = "get", resultType = PlatformResp.class), prop = "name:platformName")
|
||||||
|
private Long platformId;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* headers
|
* headers
|
||||||
*/
|
*/
|
||||||
@Schema(description = "headers",type = "JSON")
|
@Schema(description = "headers", type = "JSON")
|
||||||
private String headers;
|
private String headers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,11 +28,11 @@ public class PlatformDetailResp extends BaseDetailResp {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 平台ID
|
* 平台代码
|
||||||
*/
|
*/
|
||||||
@Schema(description = "平台ID")
|
@Schema(description = "平台代码")
|
||||||
@ExcelProperty(value = "平台ID")
|
@ExcelProperty(value = "平台代码")
|
||||||
private Integer platformId;
|
private Integer code;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 平台名称
|
* 平台名称
|
||||||
|
@ -24,10 +24,10 @@ public class PlatformResp extends BaseResp {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 平台ID
|
* 平台代码
|
||||||
*/
|
*/
|
||||||
@Schema(description = "平台ID")
|
@Schema(description = "平台代码")
|
||||||
private Integer platformId;
|
private Integer code;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 平台名称
|
* 平台名称
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.zayac.admin.system.service;
|
package com.zayac.admin.system.service;
|
||||||
|
|
||||||
|
import com.zayac.admin.common.model.resp.LabelValueResp;
|
||||||
import com.zayac.admin.system.model.entity.PlatformDO;
|
import com.zayac.admin.system.model.entity.PlatformDO;
|
||||||
import top.continew.starter.extension.crud.service.BaseService;
|
import top.continew.starter.extension.crud.service.BaseService;
|
||||||
import com.zayac.admin.system.model.query.PlatformQuery;
|
import com.zayac.admin.system.model.query.PlatformQuery;
|
||||||
@ -7,6 +8,8 @@ import com.zayac.admin.system.model.req.PlatformReq;
|
|||||||
import com.zayac.admin.system.model.resp.PlatformDetailResp;
|
import com.zayac.admin.system.model.resp.PlatformDetailResp;
|
||||||
import com.zayac.admin.system.model.resp.PlatformResp;
|
import com.zayac.admin.system.model.resp.PlatformResp;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 平台业务接口
|
* 平台业务接口
|
||||||
*
|
*
|
||||||
@ -17,4 +20,6 @@ public interface PlatformService extends BaseService<PlatformResp, PlatformDetai
|
|||||||
PlatformDO getByName(String name);
|
PlatformDO getByName(String name);
|
||||||
|
|
||||||
PlatformDO getByPlatformId(Integer platformId);
|
PlatformDO getByPlatformId(Integer platformId);
|
||||||
|
|
||||||
|
List<LabelValueResp<Long>> buildDict(List<PlatformResp> list);
|
||||||
}
|
}
|
@ -1,5 +1,8 @@
|
|||||||
package com.zayac.admin.system.service.impl;
|
package com.zayac.admin.system.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.zayac.admin.common.model.resp.LabelValueResp;
|
||||||
|
import com.zayac.admin.system.model.resp.RoleResp;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -13,6 +16,9 @@ import com.zayac.admin.system.model.resp.PlatformDetailResp;
|
|||||||
import com.zayac.admin.system.model.resp.PlatformResp;
|
import com.zayac.admin.system.model.resp.PlatformResp;
|
||||||
import com.zayac.admin.system.service.PlatformService;
|
import com.zayac.admin.system.service.PlatformService;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 平台业务实现
|
* 平台业务实现
|
||||||
*
|
*
|
||||||
@ -31,4 +37,12 @@ public class PlatformServiceImpl extends BaseServiceImpl<PlatformMapper, Platfor
|
|||||||
public PlatformDO getByPlatformId(Integer platformId) {
|
public PlatformDO getByPlatformId(Integer platformId) {
|
||||||
return baseMapper.selectByPlatformId(platformId);
|
return baseMapper.selectByPlatformId(platformId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LabelValueResp<Long>> buildDict(List<PlatformResp> list) {
|
||||||
|
if (CollUtil.isEmpty(list)) {
|
||||||
|
return new ArrayList<>(0);
|
||||||
|
}
|
||||||
|
return list.stream().map(r -> new LabelValueResp<>(r.getName(), r.getId())).toList();
|
||||||
|
}
|
||||||
}
|
}
|
@ -72,6 +72,7 @@ public class CommonController {
|
|||||||
private final DictItemService dictItemService;
|
private final DictItemService dictItemService;
|
||||||
private final OptionService optionService;
|
private final OptionService optionService;
|
||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
|
private final PlatformService platformService;
|
||||||
|
|
||||||
@Operation(summary = "上传文件", description = "上传文件")
|
@Operation(summary = "上传文件", description = "上传文件")
|
||||||
@PostMapping("/file")
|
@PostMapping("/file")
|
||||||
@ -106,6 +107,13 @@ public class CommonController {
|
|||||||
return R.ok(userService.buildDict(userService.list(query, sortQuery)));
|
return R.ok(userService.buildDict(userService.list(query, sortQuery)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "查询平台字典", description = "查询平台字典列表")
|
||||||
|
@GetMapping("/dict/platform")
|
||||||
|
public R<List<LabelValueResp<Long>>> listPlatformDict(PlatformQuery query, SortQuery sortQuery) {
|
||||||
|
|
||||||
|
return R.ok(platformService.buildDict(platformService.list(query, sortQuery)));
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(summary = "查询字典", description = "查询字典列表")
|
@Operation(summary = "查询字典", description = "查询字典列表")
|
||||||
@Parameter(name = "code", description = "字典编码", example = "notice_type", in = ParameterIn.PATH)
|
@Parameter(name = "code", description = "字典编码", example = "notice_type", in = ParameterIn.PATH)
|
||||||
@GetMapping("/dict/{code}")
|
@GetMapping("/dict/{code}")
|
||||||
|
@ -39,7 +39,7 @@ import top.continew.starter.web.model.R;
|
|||||||
public class AccountController extends BaseController<AccountService, AccountResp, AccountDetailResp, AccountQuery, AccountReq> {
|
public class AccountController extends BaseController<AccountService, AccountResp, AccountDetailResp, AccountQuery, AccountReq> {
|
||||||
private final PlatformService platformService;
|
private final PlatformService platformService;
|
||||||
|
|
||||||
@Override
|
/* @Override
|
||||||
public R<Long> add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody AccountReq req) {
|
public R<Long> add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody AccountReq req) {
|
||||||
// String rawPassword = ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(req.getPassword()));
|
// String rawPassword = ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(req.getPassword()));
|
||||||
// ValidationUtils.throwIfNull(rawPassword, "密码解密失败");
|
// ValidationUtils.throwIfNull(rawPassword, "密码解密失败");
|
||||||
@ -57,6 +57,6 @@ public class AccountController extends BaseController<AccountService, AccountRes
|
|||||||
.isMatch(RegexConstants.PASSWORD, req.getPassword()), "密码长度为 6 到 32 位,可以包含字母、数字、下划线,特殊字符,同时包含字母和数字");
|
.isMatch(RegexConstants.PASSWORD, req.getPassword()), "密码长度为 6 到 32 位,可以包含字母、数字、下划线,特殊字符,同时包含字母和数字");
|
||||||
req.setPlatformId(platformService.getByPlatformId(req.getType().getValue()).getId());
|
req.setPlatformId(platformService.getByPlatformId(req.getType().getValue()).getId());
|
||||||
return super.update(req, id);
|
return super.update(req, id);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user