1.剥离账号中的平台url

2.新建独立平台模块
This commit is contained in:
zayac 2024-05-15 19:01:02 +08:00
parent 8fd6011905
commit f9352afd41
15 changed files with 507 additions and 18 deletions

View File

@ -10,22 +10,22 @@ public enum AccountTypeEnum implements IBaseEnum<Integer> {
/**
* 开云
*/
KY(0, "开云"),
KY(1, "开云"),
/**
* 华体会
*/
HTH(1, "华体会"),
HTH(2, "华体会"),
/**
* 九游
*/
JY(2, "九游"),
JY(3, "九游"),
/**
* 爱体育
*/
ATY(3, "爱体育"),
ATY(4, "爱体育"),
;
private final Integer value;

View File

@ -0,0 +1,12 @@
package com.zayac.admin.system.mapper;
import top.continew.starter.data.mybatis.plus.base.BaseMapper;
import com.zayac.admin.system.model.entity.PlatformDO;
/**
* 平台 Mapper
*
* @author zayac
* @since 2024/05/14 12:28
*/
public interface PlatformMapper extends BaseMapper<PlatformDO> {}

View File

@ -39,7 +39,7 @@ public class AccountDO extends BaseDO {
private String password;
/**
* 账号类型(0:开云,1:华体会,2:九游,3:爱游戏)
* 账号类型(1:开云,2:华体会,3:九游,4:爱游戏)
*/
private AccountTypeEnum type;
@ -53,13 +53,13 @@ public class AccountDO extends BaseDO {
*/
private DisEnableStatusEnum status;
/**
* 对应平台的url
*/
private String url;
/**
* 用户ID
*/
private Long userId;
/**
* 平台ID
*/
private Long platformId;
}

View File

@ -0,0 +1,56 @@
package com.zayac.admin.system.model.entity;
import java.io.Serial;
import java.time.LocalDateTime;
import com.zayac.admin.common.enums.DisEnableStatusEnum;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.TableName;
import top.continew.starter.extension.crud.model.entity.BaseDO;
/**
* 平台实体
*
* @author zayac
* @since 2024/05/14 12:28
*/
@Data
@TableName("sys_platform")
public class PlatformDO extends BaseDO {
@Serial
private static final long serialVersionUID = 1L;
/**
* 平台ID
*/
private Integer platformId;
/**
* 平台名称
*/
private String name;
/**
* 别称
*/
private String nickname;
/**
* 平台地址
*/
private String url;
/**
* 状态(1启用,2禁用)
*/
private DisEnableStatusEnum status;
/**
* 描述
*/
private String description;
}

View File

@ -0,0 +1,63 @@
package com.zayac.admin.system.model.query;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import com.zayac.admin.common.enums.DisEnableStatusEnum;
import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;
import top.continew.starter.data.core.annotation.Query;
import top.continew.starter.data.core.enums.QueryType;
/**
* 平台查询条件
*
* @author zayac
* @since 2024/05/14 12:28
*/
@Data
@Schema(description = "平台查询条件")
public class PlatformQuery implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 平台ID
*/
@Schema(description = "平台ID", example = "ky")
@Query(type = QueryType.EQ)
private Integer platformId;
/**
* 平台名称
*/
@Schema(description = "平台名称", example = "开云")
@Query(type = QueryType.LIKE)
private String name;
/**
* 平台别称
*/
@Schema(description = "平台别称", example = "ky")
@Query(type = QueryType.LIKE)
private String nickname;
/**
* 平台地址
*/
@Schema(description = "平台地址", example = "https://www.nvdf9.com:8003")
@Query(type = QueryType.EQ)
private String url;
/**
* 状态(1启用,2禁用)
*/
@Schema(description = "状态(1启用,2禁用)", example = "1")
@Query(type = QueryType.EQ)
private Integer status;
}

View File

@ -0,0 +1,68 @@
/*
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zayac.admin.system.model.query;
import cn.hutool.core.date.DatePattern;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Size;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 用户查询条件
*
* @author Charles7c
* @since 2023/2/20 21:01
*/
@Data
@Schema(description = "用户查询条件")
public class UserDictQuery implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 关键词
*/
@Schema(description = "关键词", example = "zhangsan")
private String description;
/**
* 状态
*/
@Schema(description = "状态1启用2禁用", example = "1")
private Integer status;
/**
* 创建时间
*/
@Schema(description = "创建时间", example = "2023-08-08 00:00:00,2023-08-08 23:59:59")
@DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
@Size(max = 2, message = "创建时间必须是一个范围")
private List<Date> createTime;
/**
* 部门 ID
*/
@Schema(description = "部门 ID", example = "1")
private Long deptId;
}

View File

@ -0,0 +1,73 @@
package com.zayac.admin.system.model.req;
import java.io.Serial;
import java.time.LocalDateTime;
import com.zayac.admin.common.enums.DisEnableStatusEnum;
import jakarta.validation.constraints.*;
import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;
import org.hibernate.validator.constraints.Length;
import top.continew.starter.extension.crud.model.req.BaseReq;
/**
* 创建或修改平台信息
*
* @author zayac
* @since 2024/05/14 12:28
*/
@Data
@Schema(description = "创建或修改平台信息")
public class PlatformReq extends BaseReq {
@Serial
private static final long serialVersionUID = 1L;
/**
* 平台名称
*/
@Schema(description = "平台名称")
@NotBlank(message = "平台名称不能为空")
@Length(max = 100, message = "平台名称长度不能超过 {max} 个字符")
private String name;
/**
* 平台别称
*/
@Schema(description = "平台别称")
@NotBlank(message = "平台别称不能为空")
@Length(max = 100, message = "平台别称长度不能超过 {max} 个字符")
private String nickname;
/**
* 平台地址
*/
@Schema(description = "平台地址")
@NotBlank(message = "平台地址不能为空")
@Length(max = 100, message = "平台地址长度不能超过 {max} 个字符")
private String url;
/**
* 平台ID
*/
@Schema(description = "平台ID")
@NotNull(message = "平台ID不能为空")
private Integer platformId;
/**
* 状态(1启用,2禁用)
*/
@Schema(description = "平台状态1启用2禁用", type = "Integer", allowableValues = {"1", "2"}, example = "1")
@NotNull(message = "平台状态非法")
private DisEnableStatusEnum status;
/**
* 描述
*/
@Length(max = 200, message = "平台描述长度不能超过 {max} 个字符")
private String description;
}

View File

@ -0,0 +1,71 @@
package com.zayac.admin.system.model.resp;
import java.io.Serial;
import java.time.LocalDateTime;
import com.zayac.admin.common.enums.DisEnableStatusEnum;
import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import top.continew.starter.extension.crud.model.resp.BaseDetailResp;
/**
* 平台详情信息
*
* @author zayac
* @since 2024/05/14 12:28
*/
@Data
@ExcelIgnoreUnannotated
@Schema(description = "平台详情信息")
public class PlatformDetailResp extends BaseDetailResp {
@Serial
private static final long serialVersionUID = 1L;
/**
* 平台ID
*/
@Schema(description = "平台ID")
@ExcelProperty(value = "平台ID")
private Integer platformId;
/**
* 平台名称
*/
@Schema(description = "平台名称")
@ExcelProperty(value = "平台名称")
private String name;
/**
* 平台名称
*/
@Schema(description = "平台别称")
@ExcelProperty(value = "平台别称")
private String nickname;
/**
* 平台地址
*/
@Schema(description = "平台地址")
@ExcelProperty(value = "平台地址")
private String url;
/**
* 状态(1启用,2禁用)
*/
@Schema(description = "状态1启用2禁用", type = "Integer", allowableValues = {"1", "2"}, example = "1")
@ExcelProperty(value = "状态(1启用,2禁用)")
private DisEnableStatusEnum status;
/**
* 描述
*/
@Schema(description = "描述")
@ExcelProperty(value = "描述")
private String description;
}

View File

@ -0,0 +1,61 @@
package com.zayac.admin.system.model.resp;
import java.io.Serial;
import java.time.LocalDateTime;
import com.zayac.admin.common.enums.DisEnableStatusEnum;
import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;
import top.continew.starter.extension.crud.model.resp.BaseResp;
/**
* 平台信息
*
* @author zayac
* @since 2024/05/14 12:28
*/
@Data
@Schema(description = "平台信息")
public class PlatformResp extends BaseResp {
@Serial
private static final long serialVersionUID = 1L;
/**
* 平台ID
*/
@Schema(description = "平台ID")
private Integer platformId;
/**
* 平台名称
*/
@Schema(description = "平台名称")
private String name;
/**
* 平台别称
*/
@Schema(description = "平台别称")
private String nickname;
/**
* 平台地址
*/
@Schema(description = "平台地址")
private String url;
/**
* 状态(1启用,2禁用)
*/
@Schema(description = "状态1启用2禁用", type = "Integer", allowableValues = {"1", "2"}, example = "1")
private DisEnableStatusEnum status;
/**
* 描述
*/
@Schema(description = "描述")
private String description;
}

View File

@ -0,0 +1,15 @@
package com.zayac.admin.system.service;
import top.continew.starter.extension.crud.service.BaseService;
import com.zayac.admin.system.model.query.PlatformQuery;
import com.zayac.admin.system.model.req.PlatformReq;
import com.zayac.admin.system.model.resp.PlatformDetailResp;
import com.zayac.admin.system.model.resp.PlatformResp;
/**
* 平台业务接口
*
* @author zayac
* @since 2024/05/14 12:28
*/
public interface PlatformService extends BaseService<PlatformResp, PlatformDetailResp, PlatformQuery, PlatformReq> {}

View File

@ -16,6 +16,8 @@
package com.zayac.admin.system.service;
import com.zayac.admin.common.model.resp.LabelValueResp;
import com.zayac.admin.system.model.resp.RoleResp;
import org.springframework.web.multipart.MultipartFile;
import com.zayac.admin.system.model.entity.UserDO;
import com.zayac.admin.system.model.query.UserQuery;
@ -137,4 +139,12 @@ public interface UserService extends BaseService<UserResp, UserDetailResp, UserQ
* @return 用户数量
*/
Long countByDeptIds(List<Long> deptIds);
/**
* 构建字典
*
* @param list 原始列表数据
* @return 字典列表
*/
List<LabelValueResp<Long>> buildDict(List<UserResp> list);
}

View File

@ -0,0 +1,24 @@
package com.zayac.admin.system.service.impl;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import top.continew.starter.extension.crud.service.impl.BaseServiceImpl;
import com.zayac.admin.system.mapper.PlatformMapper;
import com.zayac.admin.system.model.entity.PlatformDO;
import com.zayac.admin.system.model.query.PlatformQuery;
import com.zayac.admin.system.model.req.PlatformReq;
import com.zayac.admin.system.model.resp.PlatformDetailResp;
import com.zayac.admin.system.model.resp.PlatformResp;
import com.zayac.admin.system.service.PlatformService;
/**
* 平台业务实现
*
* @author zayac
* @since 2024/05/14 12:28
*/
@Service
@RequiredArgsConstructor
public class PlatformServiceImpl extends BaseServiceImpl<PlatformMapper, PlatformDO, PlatformResp, PlatformDetailResp, PlatformQuery, PlatformReq> implements PlatformService {}

View File

@ -27,6 +27,7 @@ import com.alicp.jetcache.anno.CacheUpdate;
import com.alicp.jetcache.anno.Cached;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zayac.admin.common.model.resp.LabelValueResp;
import com.zayac.admin.system.mapper.UserMapper;
import com.zayac.admin.system.service.*;
import jakarta.annotation.Resource;
@ -60,10 +61,7 @@ import top.continew.starter.extension.crud.service.CommonUserService;
import top.continew.starter.extension.crud.service.impl.BaseServiceImpl;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -256,6 +254,14 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes
return baseMapper.lambdaQuery().in(UserDO::getDeptId, deptIds).count();
}
@Override
public List<LabelValueResp<Long>> buildDict(List<UserResp> list) {
if (CollUtil.isEmpty(list)) {
return new ArrayList<>(0);
}
return list.stream().map(r -> new LabelValueResp<>(r.getUsername(), r.getId())).toList();
}
@Override
@Cached(key = "#id", cacheType = CacheType.BOTH, name = CacheConstants.USER_KEY_PREFIX, syncLocal = true)
public String getNicknameById(Long id) {

View File

@ -21,10 +21,7 @@ import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.util.ClassUtil;
import cn.hutool.core.util.StrUtil;
import com.alicp.jetcache.anno.Cached;
import com.zayac.admin.system.model.query.DeptQuery;
import com.zayac.admin.system.model.query.MenuQuery;
import com.zayac.admin.system.model.query.OptionQuery;
import com.zayac.admin.system.model.query.RoleQuery;
import com.zayac.admin.system.model.query.*;
import com.zayac.admin.system.model.resp.FileUploadResp;
import com.zayac.admin.system.service.*;
import io.swagger.v3.oas.annotations.Operation;
@ -74,6 +71,7 @@ public class CommonController {
private final RoleService roleService;
private final DictItemService dictItemService;
private final OptionService optionService;
private final UserService userService;
@Operation(summary = "上传文件", description = "上传文件")
@PostMapping("/file")
@ -102,6 +100,12 @@ public class CommonController {
return R.ok(roleService.buildDict(roleService.list(query, sortQuery)));
}
@Operation(summary = "查询用户字典", description = "查询用户字典列表")
@GetMapping("/dict/user")
public R<List<LabelValueResp<Long>>> listUserDict(UserQuery query, SortQuery sortQuery) {
return R.ok(userService.buildDict(userService.list(query, sortQuery)));
}
@Operation(summary = "查询字典", description = "查询字典列表")
@Parameter(name = "code", description = "字典编码", example = "notice_type", in = ParameterIn.PATH)
@GetMapping("/dict/{code}")

View File

@ -0,0 +1,26 @@
package com.zayac.admin.webapi.system;
import top.continew.starter.extension.crud.enums.Api;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
import top.continew.starter.extension.crud.controller.BaseController;
import com.zayac.admin.system.model.query.PlatformQuery;
import com.zayac.admin.system.model.req.PlatformReq;
import com.zayac.admin.system.model.resp.PlatformDetailResp;
import com.zayac.admin.system.model.resp.PlatformResp;
import com.zayac.admin.system.service.PlatformService;
/**
* 平台管理 API
*
* @author zayac
* @since 2024/05/14 12:28
*/
@Tag(name = "平台管理 API")
@RestController
@CrudRequestMapping(value = "/system/platform", api = {Api.PAGE, Api.GET, Api.ADD, Api.UPDATE, Api.DELETE, Api.EXPORT})
public class PlatformController extends BaseController<PlatformService, PlatformResp, PlatformDetailResp, PlatformQuery, PlatformReq> {}