Merge branch 'dev' into 'test'

feat:新增门户管理功能

See merge request jygk/dsc!2
This commit is contained in:
wencai he
2025-11-13 02:29:50 +00:00
12 changed files with 817 additions and 0 deletions

View File

@@ -212,4 +212,7 @@ public interface ErrorCodeConstants {
// ========== 系统序列号记录 1-002-032-000 ========== // ========== 系统序列号记录 1-002-032-000 ==========
ErrorCode SEQUENCE_RECORD_NOT_EXISTS = new ErrorCode(1_002_032_000, "系统序列号记录不存在"); ErrorCode SEQUENCE_RECORD_NOT_EXISTS = new ErrorCode(1_002_032_000, "系统序列号记录不存在");
// ========== 门户网站 1-002-033-000 ==========
ErrorCode PORTAL_NOT_EXISTS = new ErrorCode(1_002_033_000, "门户不存在");
} }

View File

@@ -0,0 +1,38 @@
package com.zt.plat.module.system.controller.admin.portal.vo;
import com.zt.plat.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* 门户网站分页查询 Request VO
*
* @author 中铜数字供应链平台
*/
@Schema(description = "管理后台 - 门户网站分页查询 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class PortalPageReqVO extends PageParam {
@Schema(description = "门户名称", example = "采购")
private String name;
@Schema(description = "状态", example = "0")
private Integer status;
@Schema(description = "门户分类", example = "业务系统")
private String category;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@@ -0,0 +1,73 @@
package com.zt.plat.module.system.controller.admin.portal.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 门户网站 Response VO
*
* @author 中铜数字供应链平台
*/
@Schema(description = "管理后台 - 门户网站 Response VO")
@Data
@ExcelIgnoreUnannotated
public class PortalRespVO {
@Schema(description = "门户编号", example = "1024")
@ExcelProperty("门户编号")
private Long id;
@Schema(description = "门户名称", example = "采购管理系统")
@ExcelProperty("门户名称")
private String name;
@Schema(description = "门户描述", example = "统一采购平台,支持在线询价、比价")
@ExcelProperty("门户描述")
private String description;
@Schema(description = "门户地址", example = "http://purchase.zt.com")
@ExcelProperty("门户地址")
private String url;
@Schema(description = "门户图标Element Plus图标", example = "ep:shopping-cart")
private String icon;
@Schema(description = "图标类型", example = "1")
@ExcelProperty("图标类型")
private Integer iconType;
@Schema(description = "图标图片URL当 iconType=2 时使用)", example = "https://example.com/icon.png")
private String iconUrl;
@Schema(description = "门户分类", example = "业务系统")
@ExcelProperty("门户分类")
private String category;
@Schema(description = "显示排序", example = "1")
@ExcelProperty("显示排序")
private Integer sort;
@Schema(description = "状态", example = "0")
@ExcelProperty(value = "状态", converter = com.zt.plat.framework.excel.core.convert.DictConvert.class)
private Integer status;
@Schema(description = "权限标识", example = "portal:purchase:access")
@ExcelProperty("权限标识")
private String permission;
@Schema(description = "打开方式", example = "1")
@ExcelProperty("打开方式")
private Integer openType;
@Schema(description = "认证配置JSON格式", example = "{\"enabled\":true,\"type\":\"url_params\",\"urlParams\":[{\"key\":\"token\",\"value\":\"${userToken}\"}]}")
private String authConfig;
@Schema(description = "创建时间", example = "2025-11-10 10:00:00")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@@ -0,0 +1,81 @@
package com.zt.plat.module.system.controller.admin.portal.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.*;
/**
* 门户网站创建/修改 Request VO
*
* @author 中铜数字供应链平台
*/
@Schema(description = "管理后台 - 门户网站创建/修改 Request VO")
@Data
public class PortalSaveReqVO {
@Schema(description = "门户编号", example = "1024")
private Long id;
@Schema(description = "门户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "采购管理系统")
@NotEmpty(message = "门户名称不能为空")
@Size(max = 50, message = "门户名称长度不能超过50个字符")
private String name;
@Schema(description = "门户描述", example = "统一采购平台,支持在线询价、比价")
@Size(max = 200, message = "门户描述长度不能超过200个字符")
private String description;
@Schema(description = "门户地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "http://purchase.zt.com")
@NotEmpty(message = "门户地址不能为空")
@Size(max = 500, message = "门户地址长度不能超过500个字符")
@Pattern(regexp = "^(http|https)://.*", message = "门户地址必须以 http:// 或 https:// 开头")
private String url;
@Schema(description = "门户图标Element Plus图标", example = "ep:shopping-cart")
@Size(max = 100, message = "门户图标长度不能超过100个字符")
private String icon;
@Schema(description = "图标类型", example = "1")
@Min(value = 1, message = "图标类型值不正确")
@Max(value = 2, message = "图标类型值不正确")
private Integer iconType;
@Schema(description = "图标图片URL当 iconType=2 时使用)", example = "https://example.com/icon.png")
@Size(max = 500, message = "图标图片URL长度不能超过500个字符")
private String iconUrl;
@Schema(description = "门户分类", example = "业务系统")
@Size(max = 50, message = "门户分类长度不能超过50个字符")
private String category;
@Schema(description = "显示排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "显示排序不能为空")
@Min(value = 0, message = "显示排序不能小于0")
private Integer sort;
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
@NotNull(message = "状态不能为空")
@Min(value = 0, message = "状态值不正确")
@Max(value = 1, message = "状态值不正确")
private Integer status;
@Schema(description = "权限标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "portal:purchase:access")
@NotEmpty(message = "权限标识不能为空")
@Size(max = 100, message = "权限标识长度不能超过100个字符")
@Pattern(regexp = "^portal:[a-z]+:access$", message = "权限标识格式不正确,应为 portal:{module}:access")
private String permission;
@Schema(description = "打开方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "打开方式不能为空")
@Min(value = 1, message = "打开方式值不正确")
@Max(value = 3, message = "打开方式值不正确")
private Integer openType;
@Schema(description = "父菜单ID权限自动同步到该菜单下", example = "2500")
private Long parentMenuId;
@Schema(description = "认证配置JSON格式", example = "{\"enabled\":true,\"type\":\"url_params\",\"urlParams\":[{\"key\":\"token\",\"value\":\"${userToken}\"}]}")
private String authConfig;
}

View File

@@ -0,0 +1,48 @@
package com.zt.plat.module.system.controller.app.portal;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.system.controller.admin.portal.vo.PortalRespVO;
import com.zt.plat.module.system.dal.dataobject.portal.PortalDO;
import com.zt.plat.module.system.service.portal.PortalService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
import static com.zt.plat.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
/**
* 用户端 - 门户网站 Controller
*
* @author 中铜数字供应链平台
*/
@Tag(name = "用户端 - 门户网站")
@RestController
@RequestMapping("/system/portal")
@Validated
public class AppPortalController {
@Resource
private PortalService portalService;
/**
* 获取当前用户可访问的门户列表
* 此接口无需权限验证,因为已经通过登录验证,
* 返回的门户列表已经根据用户权限进行了过滤
*/
@GetMapping("/list")
@Operation(summary = "获取我的门户列表")
public CommonResult<List<PortalRespVO>> getMyPortalList() {
Long userId = getLoginUserId();
List<PortalDO> portals = portalService.getPortalListByUserId(userId);
return success(BeanUtils.toBean(portals, PortalRespVO.class));
}
}

View File

@@ -0,0 +1,44 @@
package com.zt.plat.module.system.dal.mysql.portal;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.system.controller.admin.portal.vo.PortalPageReqVO;
import com.zt.plat.module.system.dal.dataobject.portal.PortalDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 门户网站 Mapper
*
* @author 中铜数字供应链平台
*/
@Mapper
public interface PortalMapper extends BaseMapperX<PortalDO> {
default PageResult<PortalDO> selectPage(PortalPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<PortalDO>()
.likeIfPresent(PortalDO::getName, reqVO.getName())
.eqIfPresent(PortalDO::getStatus, reqVO.getStatus())
.eqIfPresent(PortalDO::getCategory, reqVO.getCategory())
.betweenIfPresent(PortalDO::getCreateTime, reqVO.getCreateTime())
.orderByAsc(PortalDO::getSort)
.orderByDesc(PortalDO::getId));
}
/**
* 根据权限标识列表查询门户列表
*
* @param permissions 权限标识列表
* @return 门户列表
*/
default List<PortalDO> selectListByPermissions(List<String> permissions) {
return selectList(new LambdaQueryWrapperX<PortalDO>()
.in(PortalDO::getPermission, permissions)
.eq(PortalDO::getStatus, 0) // 只查询启用的门户
.orderByAsc(PortalDO::getSort)
.orderByDesc(PortalDO::getId));
}
}

View File

@@ -0,0 +1,29 @@
package com.zt.plat.module.system.enums.portal;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 门户分类枚举
*
* @author 中铜数字供应链平台
*/
@Getter
@AllArgsConstructor
public enum PortalCategoryEnum {
BUSINESS("业务系统", "核心业务系统,如采购、销售、财务等"),
MANAGEMENT("管理工具", "管理辅助工具如OA、数据分析等"),
THIRD_PARTY("第三方系统", "外部集成系统如ERP、E办等");
/**
* 分类名称
*/
private final String name;
/**
* 分类描述
*/
private final String description;
}

View File

@@ -0,0 +1,34 @@
package com.zt.plat.module.system.enums.portal;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 门户打开方式枚举
*
* @author 中铜数字供应链平台
*/
@Getter
@AllArgsConstructor
public enum PortalOpenTypeEnum {
NEW_WINDOW(1, "新窗口", "在新窗口中打开门户"),
CURRENT_WINDOW(2, "当前窗口", "在当前窗口中打开门户"),
IFRAME(3, "iframe内嵌", "在iframe中内嵌显示门户");
/**
* 类型
*/
private final Integer type;
/**
* 名称
*/
private final String name;
/**
* 描述
*/
private final String description;
}

Some files were not shown because too many files have changed in this diff Show More