Compare commits
47 Commits
3de7be34b2
...
liug
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8bae1cbd35 | ||
| ee7510f41e | |||
| 44279d9637 | |||
| 860afb9812 | |||
|
|
0ef88ce81d | ||
| 1b81782767 | |||
| 432feb11d2 | |||
| c4ea4650bf | |||
|
|
1173de364c | ||
| 79cb1297db | |||
|
|
7fb9543604 | ||
|
|
bac75778ad | ||
|
|
3dd11b9f37 | ||
| f940b2a911 | |||
|
|
0cc088c51b | ||
| 869ef2cd8b | |||
|
|
35d708612e | ||
| dcb15b1aa7 | |||
| 390172f426 | |||
| 0f61e5b8f2 | |||
|
|
909d9625cd | ||
|
|
cd7bb5ccc5 | ||
| bb986102f3 | |||
| 2cae542098 | |||
| 549da7ec80 | |||
| 8b9f4a5013 | |||
| e0dd2a59ec | |||
| da95ddf810 | |||
| c8b73763bb | |||
| 72331c5e1e | |||
| fa8c84f349 | |||
| e70fa733ef | |||
|
|
246591bb1c | ||
|
|
56e09151e4 | ||
|
|
7a9ae35c18 | ||
|
|
8c97c0f934 | ||
|
|
b629c574f1 | ||
|
|
918ec6c498 | ||
| 81bc9757eb | |||
| 92674cff52 | |||
|
|
b7ebd3778d | ||
| 4f0e1bc860 | |||
|
|
a1c91f2959 | ||
|
|
4cf2e2e90c | ||
|
|
3c9eb35f2c | ||
| e392221045 | |||
| 1c212fb3b3 |
36
doc/新增表和数据字段在此说明.txt
Normal file
36
doc/新增表和数据字段在此说明.txt
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
日期:2026-02-20(新增表)
|
||||||
|
新增表:xxx_demo(附件表说明到doc内)
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
日期:2026-02-21(新增字段)
|
||||||
|
表名:xxx_demo
|
||||||
|
字段 类型 长度
|
||||||
|
xx_aa varchar 20
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
日期:2026-02-11(新增字段)
|
||||||
|
表名:yunji_report_field
|
||||||
|
字段 类型 长度 字段说明
|
||||||
|
is_dynamic_group varchar 60 是否动态分组 Y|N
|
||||||
|
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
日期:2026-02-12(修改字段长度)
|
||||||
|
表名:yunji_report_field
|
||||||
|
字段 类型 长度 字段说明
|
||||||
|
is_hide_dimension varchar 255
|
||||||
|
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
日期:2026-02-13(新增字段)
|
||||||
|
表名:yunji_report_field
|
||||||
|
字段 类型 长度 字段说明
|
||||||
|
width varchar 60 单元格宽度
|
||||||
|
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
日期:2026-02-24(新增字段)
|
||||||
|
表名:yunji_report_field
|
||||||
|
字段 类型 长度 字段说明
|
||||||
|
search_default_value varchar 150 查询控件默认值
|
||||||
|
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
日期:2026-02-27(新增字段)
|
||||||
|
表名:yunji_report_field
|
||||||
|
字段 类型 长度 字段说明
|
||||||
|
is_hide_search varchar 60 查询控件是否隐藏
|
||||||
@@ -9,23 +9,43 @@ spring:
|
|||||||
datasource:
|
datasource:
|
||||||
master:
|
master:
|
||||||
# MYSQL数据库 主库,业务库
|
# MYSQL数据库 主库,业务库
|
||||||
url: jdbc:mysql://127.0.0.1:3306/gr_report?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
|
# url: jdbc:mysql://127.0.0.1:3306/gr_report?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
|
||||||
|
url: jdbc:mysql://192.168.126.128:33306/gr_report?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
|
||||||
username: root
|
username: root
|
||||||
password: root
|
password: root
|
||||||
lideeyunji: # 从库,框架库
|
lideeyunji: # 从库,框架库
|
||||||
url: jdbc:mysql://127.0.0.1:3306/gr_report?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
# url: jdbc:mysql://127.0.0.1:3306/gr_report?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||||
|
url: jdbc:mysql://192.168.126.128:33306/gr_report?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||||
username: root
|
username: root
|
||||||
password: root
|
password: root
|
||||||
slave: # 日志库单独
|
slave: # 日志库单独
|
||||||
lazy: true # 开启懒加载,保证启动速度
|
lazy: true # 开启懒加载,保证启动速度
|
||||||
url: jdbc:mysql://127.0.0.1:3306/gr_report?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
# url: jdbc:mysql://127.0.0.1:3306/gr_report?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||||
|
url: jdbc:mysql://192.168.126.128:33306/gr_report?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||||
username: root
|
username: root
|
||||||
password: root
|
password: root
|
||||||
|
oracle_gryybi: # 报表平台 oracle
|
||||||
|
url: jdbc:oracle:thin:@//192.168.1.247:1521/gryy?oracle.jdbc.defaultNChar=true&oracle.jdbc.convertNcharLiterals=true
|
||||||
|
username: GRYYBI
|
||||||
|
password: xxb147258367
|
||||||
|
# driver-class-name: oracle.jdbc.OracleDriver
|
||||||
|
driver-class-name: oracle.jdbc.driver.OracleDriver
|
||||||
|
erp_bi_data: # 报表平台 mysql
|
||||||
|
# url: jdbc:mysql://127.0.0.1:3306/erp_bi_data?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||||
|
url: jdbc:mysql://192.168.126.128:33306/erp_bi_data?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||||
|
username: root
|
||||||
|
password: root
|
||||||
|
|
||||||
|
# redis:
|
||||||
|
# host: 127.0.0.1 # 地址
|
||||||
|
# port: 6379 # 端口
|
||||||
|
# database: 2 # 数据库索引
|
||||||
|
# password: lidee@123 # 密码,建议生产环境开启
|
||||||
redis:
|
redis:
|
||||||
host: 127.0.0.1 # 地址
|
host: 192.168.126.128 # 地址
|
||||||
port: 6379 # 端口
|
port: 6379 # 端口
|
||||||
database: 2 # 数据库索引
|
database: 2 # 数据库索引
|
||||||
password: lidee@123 # 密码,建议生产环境开启
|
password: 123456 # 密码,建议生产环境开启
|
||||||
|
|
||||||
--- #################### 地代码平台相关配置 ####################
|
--- #################### 地代码平台相关配置 ####################
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ spring:
|
|||||||
name: lideeyunji-server
|
name: lideeyunji-server
|
||||||
profiles:
|
profiles:
|
||||||
active: local # 读取配置
|
active: local # 读取配置
|
||||||
|
#active: prod # 读取配置
|
||||||
main:
|
main:
|
||||||
allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。
|
allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。
|
||||||
|
|
||||||
|
|||||||
@@ -92,5 +92,10 @@
|
|||||||
<artifactId>lidee-service-infra-api</artifactId>
|
<artifactId>lidee-service-infra-api</artifactId>
|
||||||
<version>${lidee.version}</version>
|
<version>${lidee.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.oracle.database.nls</groupId>
|
||||||
|
<artifactId>orai18n</artifactId>
|
||||||
|
<version>21.1.0.0</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -45,8 +45,6 @@ public class FrameWorkAdapter implements IlideeYunjiAdapter {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IFrameSqlService sqlService;
|
private IFrameSqlService sqlService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AdapterMapper adapterMapper;
|
private AdapterMapper adapterMapper;
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import com.lideeyunji.core.framework.service.IFrameService;
|
|||||||
import com.lideeyunji.tool.framework.yunji.model.ResultDataModel;
|
import com.lideeyunji.tool.framework.yunji.model.ResultDataModel;
|
||||||
import com.lideeyunji.tool.framework.yunji.tool.spring.SpringUtils;
|
import com.lideeyunji.tool.framework.yunji.tool.spring.SpringUtils;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,9 +33,6 @@ public class ButtonReceiverReportList implements IButtonCommandReceiver<ResultDa
|
|||||||
String reportCode = param.getReportCode();
|
String reportCode = param.getReportCode();
|
||||||
Page page = param.getPage();
|
Page page = param.getPage();
|
||||||
Map<String, Object> params = param.getParams();
|
Map<String, Object> params = param.getParams();
|
||||||
// 分组集合--测试数据
|
|
||||||
// String[] Groupbylist={"zonename","customname"};
|
|
||||||
// List<String> Groupbylist=param
|
|
||||||
|
|
||||||
IFrameService frameService = SpringUtils.getBean(IFrameService.class);
|
IFrameService frameService = SpringUtils.getBean(IFrameService.class);
|
||||||
ResultDataModel reportDataPage = frameService.getReportDataList(reportCode, page, params);
|
ResultDataModel reportDataPage = frameService.getReportDataList(reportCode, page, params);
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.lideeyunji.core.framework.config.job;
|
||||||
|
|
||||||
|
|
||||||
|
import com.lideeyunji.core.framework.service.IGrBiSaSetdtlService;
|
||||||
|
import com.lideeyunji.core.framework.service.ILideeYunJiService;
|
||||||
|
import com.lideeyunji.tool.framework.quartz.core.handler.JobHandler;
|
||||||
|
import com.lideeyunji.tool.framework.tenant.core.aop.TenantIgnore;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步销售明细表
|
||||||
|
* oracle gryybi GR_BI_SA_SETDTL --> mysql erp_bi_data GR_BI_SA_SETDTL
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class SaSetdtlSyncJob implements JobHandler {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ILideeYunJiService lideeYunJiService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IGrBiSaSetdtlService grBiSaSetdtlService;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@TenantIgnore
|
||||||
|
public String execute(String param) throws Exception {
|
||||||
|
log.info("*********** 开始同步销售明细表 ************");
|
||||||
|
// Integer cou = this.lideeYunJiService.saSetdtlSyncJob();
|
||||||
|
Integer cou = this.grBiSaSetdtlService.saSetdtlSyncJob();
|
||||||
|
String resultStr = "*********** 同步销售明细表,共保存了" + cou + "条数据 ************";
|
||||||
|
log.info(resultStr);
|
||||||
|
return resultStr;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
package com.lideeyunji.core.framework.controller;
|
package com.lideeyunji.core.framework.controller;
|
||||||
|
|
||||||
import com.lideeyunji.core.framework.config.aspect.enhancereport.enums.RefreshPluginEnums;
|
import com.lideeyunji.core.framework.config.aspect.enhancereport.enums.RefreshPluginEnums;
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
package com.lideeyunji.core.framework.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@TableName("GR_BI_SA_SETDTL")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class GrBiSaSetdtl implements Serializable {
|
||||||
|
private final static long serialVersionUID = 1L;
|
||||||
|
@TableId(value = "SASETTLEDTLID", type = IdType.INPUT)
|
||||||
|
private Integer SASETTLEDTLID;
|
||||||
|
@TableField(value = "SASETTLEID")
|
||||||
|
private Integer SASETTLEID;
|
||||||
|
@TableField(value = "USESTATUS")
|
||||||
|
private Integer USESTATUS;
|
||||||
|
@TableField(value = "UPDATE_TIME")
|
||||||
|
private String UPDATETIME;
|
||||||
|
@TableField(value = "USEDATE")
|
||||||
|
private Date USEDATE;
|
||||||
|
@TableField(value = "USEYEAR")
|
||||||
|
private Integer USEYEAR;
|
||||||
|
@TableField(value = "USEMONTH")
|
||||||
|
private Integer USEMONTH;
|
||||||
|
@TableField(value = "SALEZONEID")
|
||||||
|
private Integer SALEZONEID;
|
||||||
|
@TableField(value = "SALEZONENAME")
|
||||||
|
private String SALEZONENAME;
|
||||||
|
@TableField(value = "PROVINCEID")
|
||||||
|
private Integer PROVINCEID;
|
||||||
|
@TableField(value = "PROVINCENAME")
|
||||||
|
private String PROVINCENAME;
|
||||||
|
@TableField(value = "SALETYPE")
|
||||||
|
private Integer SALETYPE;
|
||||||
|
@TableField(value = "SALETYPENAME")
|
||||||
|
private String SALETYPENAME;
|
||||||
|
@TableField(value = "CUSTOMID")
|
||||||
|
private Integer CUSTOMID;
|
||||||
|
@TableField(value = "CUSTOMNAME")
|
||||||
|
private String CUSTOMNAME;
|
||||||
|
@TableField(value = "SALERID")
|
||||||
|
private Integer SALERID;
|
||||||
|
@TableField(value = "SALERNAME")
|
||||||
|
private String SALERNAME;
|
||||||
|
@TableField(value = "DOSAGEID")
|
||||||
|
private Integer DOSAGEID;
|
||||||
|
@TableField(value = "DOSAGENAME")
|
||||||
|
private String DOSAGENAME;
|
||||||
|
@TableField(value = "STDGOODSNAME")
|
||||||
|
private String STDGOODSNAME;
|
||||||
|
@TableField(value = "GOODSID")
|
||||||
|
private Integer GOODSID;
|
||||||
|
@TableField(value = "GOODSNAME")
|
||||||
|
private String GOODSNAME;
|
||||||
|
@TableField(value = "GOODSTYPE")
|
||||||
|
private String GOODSTYPE;
|
||||||
|
@TableField(value = "GOODSUNIT")
|
||||||
|
private String GOODSUNIT;
|
||||||
|
@TableField(value = "SAQTY")
|
||||||
|
private Integer SAQTY;
|
||||||
|
@TableField(value = "SAMONEY")
|
||||||
|
private Integer SAMONEY;
|
||||||
|
@TableField(value = "SAMONEYTX")
|
||||||
|
private Integer SAMONEYTX;
|
||||||
|
@TableField(value = "COST")
|
||||||
|
private Integer COST;
|
||||||
|
@TableField(value = "PROFIT")
|
||||||
|
private Integer PROFIT;
|
||||||
|
}
|
||||||
@@ -95,9 +95,29 @@ public class ReportFieldEntity extends BaseTenantEntity {
|
|||||||
//父字段名称
|
//父字段名称
|
||||||
private String parentFieldName;
|
private String parentFieldName;
|
||||||
|
|
||||||
|
//是否隐藏维度
|
||||||
|
private String isHideDimension;
|
||||||
|
|
||||||
|
//是否是固定列 Y|N
|
||||||
|
private String isFixedColumn;
|
||||||
|
|
||||||
|
//固定列的值
|
||||||
|
private String fixedColumnValue;
|
||||||
|
|
||||||
|
//隐藏列的,表单不显示该字段
|
||||||
|
private String isHideCol;
|
||||||
|
|
||||||
|
//是否动态分组 Y|N
|
||||||
|
private String isDynamicGroup;
|
||||||
|
|
||||||
|
//单元格宽度
|
||||||
|
private String width;
|
||||||
|
|
||||||
|
//查询控件默认值
|
||||||
|
private String searchDefaultValue;
|
||||||
|
|
||||||
|
//查询控件隐藏
|
||||||
|
private String isHideSearch;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.lideeyunji.core.framework.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.lideeyunji.core.framework.entity.GrBiSaSetdtl;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public interface GrBiSaSetdtlMapper extends BaseMapper<GrBiSaSetdtl> {
|
||||||
|
|
||||||
|
@DS(value = "#dataSourceType")
|
||||||
|
default GrBiSaSetdtl getLastUpdated(@Param("dataSourceType") String dataSourceType) {
|
||||||
|
QueryWrapper<GrBiSaSetdtl> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.orderByDesc("UPDATE_TIME");
|
||||||
|
wrapper.last("limit 1");
|
||||||
|
return this.selectOne(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DS(value = "#dataSourceType")
|
||||||
|
default List<GrBiSaSetdtl> getByUpdateTime(@Param("dataSourceType") String dataSourceType, String updateTime) {
|
||||||
|
try {
|
||||||
|
// 假设 updateTime 格式为 "yyyy-MM-dd HH:mm:ss"
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
Date startTime = sdf.parse(updateTime);
|
||||||
|
QueryWrapper<GrBiSaSetdtl> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.gt("UPDATE_TIME", startTime);
|
||||||
|
return this.selectList(queryWrapper);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 处理异常
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@DS(value = "#dataSourceType")
|
||||||
|
default List<GrBiSaSetdtl> queryByIds(@Param("dataSourceType") String dataSourceType, Set<Integer> ids) {
|
||||||
|
return this.selectBatchIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DS(value = "#dataSourceType")
|
||||||
|
default int save(@Param("dataSourceType") String dataSourceType, GrBiSaSetdtl grBiSaSetdtl) {
|
||||||
|
return this.insert(grBiSaSetdtl);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DS(value = "#dataSourceType")
|
||||||
|
default int update(@Param("dataSourceType") String dataSourceType, GrBiSaSetdtl grBiSaSetdtl) {
|
||||||
|
return this.updateById(grBiSaSetdtl);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -59,5 +59,30 @@ public class ReportFieldVo extends ReportFieldIdVo {
|
|||||||
|
|
||||||
//父字段名称
|
//父字段名称
|
||||||
private String parentFieldName;
|
private String parentFieldName;
|
||||||
|
|
||||||
|
//是否隐藏维度
|
||||||
|
private String isHideDimension;
|
||||||
|
|
||||||
|
//是否是固定列 Y|N
|
||||||
|
private String isFixedColumn;
|
||||||
|
|
||||||
|
//固定列的值
|
||||||
|
private String fixedColumnValue;
|
||||||
|
|
||||||
|
//隐藏列的,表单不显示该字段
|
||||||
|
private String isHideCol;
|
||||||
|
|
||||||
|
//是否动态分组 Y|N
|
||||||
|
private String isDynamicGroup;
|
||||||
|
|
||||||
|
//单元格宽度
|
||||||
|
private String width;
|
||||||
|
|
||||||
|
//查询控件默认值
|
||||||
|
private String searchDefaultValue;
|
||||||
|
|
||||||
|
//查询控件隐藏
|
||||||
|
private String isHideSearch;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import com.lideeyunji.tool.framework.yunji.model.ExecuteEnhanceModel;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import net.sf.jsqlparser.JSQLParserException;
|
import net.sf.jsqlparser.JSQLParserException;
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -80,5 +79,4 @@ public interface IFrameService {
|
|||||||
|
|
||||||
//获取数据表数据 -分页
|
//获取数据表数据 -分页
|
||||||
ResultDataModel getReportDataList(String reportCode, Page page, Map<String, Object> params);
|
ResultDataModel getReportDataList(String reportCode, Page page, Map<String, Object> params);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.lideeyunji.core.framework.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.lideeyunji.core.framework.entity.GrBiSaSetdtl;
|
||||||
|
|
||||||
|
public interface IGrBiSaSetdtlService extends IService<GrBiSaSetdtl> {
|
||||||
|
|
||||||
|
//同步销售明细表
|
||||||
|
Integer saSetdtlSyncJob();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -651,8 +651,6 @@ public class FrameServiceImpl implements IFrameService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单个保存
|
* 单个保存
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,112 @@
|
|||||||
|
package com.lideeyunji.core.framework.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.lideeyunji.core.framework.entity.GrBiSaSetdtl;
|
||||||
|
import com.lideeyunji.core.framework.mapper.GrBiSaSetdtlMapper;
|
||||||
|
import com.lideeyunji.core.framework.service.IGrBiSaSetdtlService;
|
||||||
|
import com.lideeyunji.tool.framework.common.constant.lideeYunJiBaseConstant;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class GrBiSaSetdtlServiceImpl extends ServiceImpl<GrBiSaSetdtlMapper, GrBiSaSetdtl> implements IGrBiSaSetdtlService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步销售明细表
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Integer saSetdtlSyncJob() {
|
||||||
|
//获取本地mysql数据库中表中UPDATE_TIME最新的数据
|
||||||
|
GrBiSaSetdtl grBiSaSetdtl = this.baseMapper.getLastUpdated(lideeYunJiBaseConstant.DS_ERP_BI_DATA);
|
||||||
|
|
||||||
|
//本地不存在空的情况 之前会手动导入的情况
|
||||||
|
//查询大于本地最大更新时间的oracle里的数据
|
||||||
|
List<GrBiSaSetdtl> grBiSaSetdtlList = this.baseMapper.getByUpdateTime(lideeYunJiBaseConstant.DS_ORACLE_GRYYBI, grBiSaSetdtl.getUPDATETIME());
|
||||||
|
|
||||||
|
if (CollUtil.isEmpty(grBiSaSetdtlList)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//保存数据
|
||||||
|
return this.saveSyncData(grBiSaSetdtlList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//保存同步数据到本地
|
||||||
|
@Transactional
|
||||||
|
public Integer saveSyncData(List<GrBiSaSetdtl> grBiSaSetdtlList) {
|
||||||
|
|
||||||
|
//需要新增的数据
|
||||||
|
List<GrBiSaSetdtl> needSaveList = grBiSaSetdtlList;
|
||||||
|
List<GrBiSaSetdtl> needUpdateList = null;
|
||||||
|
//校验哪些数据已经存在需要更新
|
||||||
|
List<GrBiSaSetdtl> existList = this.baseMapper.queryByIds(lideeYunJiBaseConstant.DS_ERP_BI_DATA, grBiSaSetdtlList.stream().map(GrBiSaSetdtl::getSASETTLEDTLID).collect(Collectors.toSet()));
|
||||||
|
if (CollUtil.isNotEmpty(existList)) {
|
||||||
|
Set<Integer> needUpdateIdSet = existList.stream().map(GrBiSaSetdtl::getSASETTLEDTLID).collect(Collectors.toSet());
|
||||||
|
needSaveList = grBiSaSetdtlList
|
||||||
|
.stream()
|
||||||
|
.filter(grBiSaSetdtl -> {
|
||||||
|
return !needUpdateIdSet.contains(grBiSaSetdtl.getSASETTLEDTLID());
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
needUpdateList = grBiSaSetdtlList
|
||||||
|
.stream()
|
||||||
|
.filter(grBiSaSetdtl -> {
|
||||||
|
return needUpdateIdSet.contains(grBiSaSetdtl.getSASETTLEDTLID());
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
//将orcale数据集合分割成100条一组、
|
||||||
|
Integer result = 0;
|
||||||
|
if (CollUtil.isNotEmpty(needSaveList)) {
|
||||||
|
result += this.saveBatch(needSaveList);
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(needUpdateList)) {
|
||||||
|
result += this.updateBatch(needUpdateList);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//批量新增
|
||||||
|
@Transactional
|
||||||
|
public Integer saveBatch(List<GrBiSaSetdtl> grBiSaSetdtlList) {
|
||||||
|
Integer result = 0;
|
||||||
|
for (GrBiSaSetdtl grBiSaSetdtl : grBiSaSetdtlList) {
|
||||||
|
int re = this.baseMapper.save(lideeYunJiBaseConstant.DS_ERP_BI_DATA, grBiSaSetdtl);
|
||||||
|
if (re < 1) {
|
||||||
|
throw new RuntimeException("批量新增异常");
|
||||||
|
}
|
||||||
|
result += re;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//批量更新
|
||||||
|
@Transactional
|
||||||
|
public Integer updateBatch(List<GrBiSaSetdtl> grBiSaSetdtlList) {
|
||||||
|
Integer result = 0;
|
||||||
|
for (GrBiSaSetdtl grBiSaSetdtl : grBiSaSetdtlList) {
|
||||||
|
int re = this.baseMapper.update(lideeYunJiBaseConstant.DS_ERP_BI_DATA, grBiSaSetdtl);
|
||||||
|
if (re < 1) {
|
||||||
|
throw new RuntimeException("批量新增异常");
|
||||||
|
}
|
||||||
|
result += re;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -378,6 +378,14 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, ReportEntity> i
|
|||||||
entity.setIsExport(vo.getIsExport());
|
entity.setIsExport(vo.getIsExport());
|
||||||
entity.setIsShowSort(vo.getIsShowSort());
|
entity.setIsShowSort(vo.getIsShowSort());
|
||||||
entity.setIsDimension(vo.getIsDimension());
|
entity.setIsDimension(vo.getIsDimension());
|
||||||
|
entity.setIsHideDimension(vo.getIsHideDimension());
|
||||||
|
entity.setIsFixedColumn(vo.getIsFixedColumn()); //2026-02-10 新增
|
||||||
|
entity.setFixedColumnValue(vo.getFixedColumnValue()); //2026-02-10 新增
|
||||||
|
entity.setIsHideCol(vo.getIsHideCol()); //2026.2.10 新增
|
||||||
|
entity.setSearchDefaultValue(vo.getSearchDefaultValue());
|
||||||
|
entity.setIsHideSearch(vo.getIsHideSearch());
|
||||||
|
entity.setWidth(vo.getWidth());
|
||||||
|
entity.setIsDynamicGroup(vo.getIsDynamicGroup());
|
||||||
entity.setHasChildren(vo.getHasChildren());
|
entity.setHasChildren(vo.getHasChildren());
|
||||||
entity.setParentFieldCode(vo.getParentFieldCode());
|
entity.setParentFieldCode(vo.getParentFieldCode());
|
||||||
entity.setParentFieldName(vo.getParentFieldName());
|
entity.setParentFieldName(vo.getParentFieldName());
|
||||||
|
|||||||
@@ -70,13 +70,14 @@
|
|||||||
WHERE
|
WHERE
|
||||||
report.is_deleted = 0
|
report.is_deleted = 0
|
||||||
AND field.is_deleted = 0
|
AND field.is_deleted = 0
|
||||||
AND field.query_is_db = 'Y'
|
-- AND field.query_is_db = 'Y'
|
||||||
AND report.id = #{reportId}
|
AND report.id = #{reportId}
|
||||||
ORDER BY
|
ORDER BY
|
||||||
field.sort_num ASC,
|
field.sort_num ASC,
|
||||||
field.id ASC
|
field.id ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<select id="getExcelExportFieldList" resultType="map">
|
<select id="getExcelExportFieldList" resultType="map">
|
||||||
SELECT
|
SELECT
|
||||||
df.field_code as "field_code",
|
df.field_code as "field_code",
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public class ConfigController {
|
|||||||
|
|
||||||
@GetMapping(value = "/get-value-by-key")
|
@GetMapping(value = "/get-value-by-key")
|
||||||
@Operation(tags = "参数配置",summary = "根据参数键名查询参数值", description = "不可见的配置,不允许返回给前端")
|
@Operation(tags = "参数配置",summary = "根据参数键名查询参数值", description = "不可见的配置,不允许返回给前端")
|
||||||
@Parameter(name = "key", description = "参数键", required = true, example = "yunai.biz.username")
|
@Parameter(name = "key", description = "参数键", required = true, example = "lidee.biz.username")
|
||||||
public CommonResult<String> getConfigKey(@RequestParam("key") String key) {
|
public CommonResult<String> getConfigKey(@RequestParam("key") String key) {
|
||||||
ConfigDO config = configService.getConfigByKey(key);
|
ConfigDO config = configService.getConfigByKey(key);
|
||||||
if (config == null) {
|
if (config == null) {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class ConfigPageReqVO extends PageParam {
|
|||||||
@Schema(description = "数据源名称,模糊匹配", example = "名称")
|
@Schema(description = "数据源名称,模糊匹配", example = "名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Schema(description = "参数键名,模糊匹配", example = "yunai.db.username")
|
@Schema(description = "参数键名,模糊匹配", example = "lidee.db.username")
|
||||||
private String key;
|
private String key;
|
||||||
|
|
||||||
@Schema(description = "参数类型,参见 SysConfigTypeEnum 枚举", example = "1")
|
@Schema(description = "参数类型,参见 SysConfigTypeEnum 枚举", example = "1")
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class ConfigRespVO {
|
|||||||
@ExcelProperty("参数名称")
|
@ExcelProperty("参数名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Schema(description = "参数键名", requiredMode = Schema.RequiredMode.REQUIRED, example = "yunai.db.username")
|
@Schema(description = "参数键名", requiredMode = Schema.RequiredMode.REQUIRED, example = "lidee.db.username")
|
||||||
@ExcelProperty("参数键名")
|
@ExcelProperty("参数键名")
|
||||||
private String key;
|
private String key;
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class ConfigSaveReqVO {
|
|||||||
@Size(max = 100, message = "参数名称不能超过 100 个字符")
|
@Size(max = 100, message = "参数名称不能超过 100 个字符")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Schema(description = "参数键名", requiredMode = Schema.RequiredMode.REQUIRED, example = "yunai.db.username")
|
@Schema(description = "参数键名", requiredMode = Schema.RequiredMode.REQUIRED, example = "lidee.db.username")
|
||||||
@NotBlank(message = "参数键名长度不能为空")
|
@NotBlank(message = "参数键名长度不能为空")
|
||||||
@Size(max = 100, message = "参数键名长度不能超过 100 个字符")
|
@Size(max = 100, message = "参数键名长度不能超过 100 个字符")
|
||||||
private String key;
|
private String key;
|
||||||
|
|||||||
@@ -120,6 +120,11 @@
|
|||||||
<groupId>com.tencentcloudapi</groupId>
|
<groupId>com.tencentcloudapi</groupId>
|
||||||
<artifactId>tencentcloud-sdk-java-sms</artifactId> <!-- 短信(腾讯云) -->
|
<artifactId>tencentcloud-sdk-java-sms</artifactId> <!-- 短信(腾讯云) -->
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.yulichang</groupId>
|
||||||
|
<artifactId>mybatis-plus-join-boot-starter</artifactId>
|
||||||
|
<version>1.4.11</version> <!-- 请查看最新版本 -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- 低代码 -->
|
<!-- 低代码 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -160,6 +160,15 @@ public class AuthController {
|
|||||||
return success(authService.refreshToken(refreshToken));
|
return success(authService.refreshToken(refreshToken));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/user-info")
|
||||||
|
@PermitAll
|
||||||
|
@Operation(tags = "根据token获取用户信息",summary = "根据token获取用户信息")
|
||||||
|
@Parameter(name = "refreshToken", description = "根据token获取用户信息", required = true)
|
||||||
|
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
||||||
|
public CommonResult<AuthLoginRespVO> getUerInfo(@RequestParam("refreshToken") String refreshToken) {
|
||||||
|
return success(authService.refreshToken(refreshToken));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/get-permission-info")
|
@GetMapping("/get-permission-info")
|
||||||
@Operation(tags = "授权管理",summary = "获取登录用户的权限信息")
|
@Operation(tags = "授权管理",summary = "获取登录用户的权限信息")
|
||||||
public CommonResult<AuthPermissionInfoRespVO> getPermissionInfo() {
|
public CommonResult<AuthPermissionInfoRespVO> getPermissionInfo() {
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
package com.lideeyunji.service.system.controller;
|
package com.lideeyunji.service.system.controller;
|
||||||
|
|
||||||
import com.lideeyunji.tool.framework.common.pojo.CommonResult;
|
|
||||||
import com.lideeyunji.tool.framework.common.pojo.PageResult;
|
|
||||||
import com.lideeyunji.tool.framework.common.util.object.BeanUtils;
|
|
||||||
import com.lideeyunji.service.system.controller.vo.oauth2.client.OAuth2ClientPageReqVO;
|
import com.lideeyunji.service.system.controller.vo.oauth2.client.OAuth2ClientPageReqVO;
|
||||||
import com.lideeyunji.service.system.controller.vo.oauth2.client.OAuth2ClientRespVO;
|
import com.lideeyunji.service.system.controller.vo.oauth2.client.OAuth2ClientRespVO;
|
||||||
import com.lideeyunji.service.system.controller.vo.oauth2.client.OAuth2ClientSaveReqVO;
|
import com.lideeyunji.service.system.controller.vo.oauth2.client.OAuth2ClientSaveReqVO;
|
||||||
import com.lideeyunji.service.system.entity.OAuth2ClientDO;
|
import com.lideeyunji.service.system.entity.OAuth2ClientDO;
|
||||||
|
import com.lideeyunji.service.system.service.IAdminUserService;
|
||||||
import com.lideeyunji.service.system.service.IOAuth2ClientService;
|
import com.lideeyunji.service.system.service.IOAuth2ClientService;
|
||||||
|
import com.lideeyunji.tool.framework.common.pojo.CommonResult;
|
||||||
|
import com.lideeyunji.tool.framework.common.pojo.PageResult;
|
||||||
|
import com.lideeyunji.tool.framework.common.util.object.BeanUtils;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -70,4 +71,12 @@ public class OAuth2ClientController {
|
|||||||
return success(BeanUtils.toBean(pageResult, OAuth2ClientRespVO.class));
|
return success(BeanUtils.toBean(pageResult, OAuth2ClientRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/myPage")
|
||||||
|
@Operation(tags = "OAuth2.0管理",summary = "获得用户角色下 OAuth2 客户端分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:oauth2-client:query')")
|
||||||
|
public CommonResult<PageResult<OAuth2ClientRespVO>> getMyPage(@Valid OAuth2ClientPageReqVO pageVO) {
|
||||||
|
PageResult<OAuth2ClientDO> pageResult = oAuth2ClientService.getMyPage(pageVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, OAuth2ClientRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.lideeyunji.service.system.controller;
|
package com.lideeyunji.service.system.controller;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.lideeyunji.service.system.service.IClientPermissionService;
|
||||||
import com.lideeyunji.tool.framework.common.pojo.CommonResult;
|
import com.lideeyunji.tool.framework.common.pojo.CommonResult;
|
||||||
import com.lideeyunji.service.system.controller.vo.permission.permission.PermissionAssignRoleDataScopeReqVO;
|
import com.lideeyunji.service.system.controller.vo.permission.permission.PermissionAssignRoleDataScopeReqVO;
|
||||||
import com.lideeyunji.service.system.controller.vo.permission.permission.PermissionAssignRoleMenuReqVO;
|
import com.lideeyunji.service.system.controller.vo.permission.permission.PermissionAssignRoleMenuReqVO;
|
||||||
@@ -34,6 +35,8 @@ public class PermissionController {
|
|||||||
private IPermissionService permissionService;
|
private IPermissionService permissionService;
|
||||||
@Resource
|
@Resource
|
||||||
private ITenantService tenantService;
|
private ITenantService tenantService;
|
||||||
|
@Resource
|
||||||
|
private IClientPermissionService clientPermissionService;
|
||||||
|
|
||||||
@Operation(tags = "菜单管理",summary = "获得角色拥有的菜单编号")
|
@Operation(tags = "菜单管理",summary = "获得角色拥有的菜单编号")
|
||||||
@Parameter(name = "roleId", description = "角色编号", required = true)
|
@Parameter(name = "roleId", description = "角色编号", required = true)
|
||||||
@@ -79,4 +82,20 @@ public class PermissionController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/assign-role-client")
|
||||||
|
@Operation(tags = "角色管理",summary = "赋予角色应用")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:permission:assign-role-app')")
|
||||||
|
public CommonResult<Boolean> assignRoleClient(@Validated @RequestBody PermissionAssignRoleMenuReqVO reqVO) {
|
||||||
|
permissionService.assignRoleClient(reqVO.getRoleId(), reqVO.getClientIds());
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(tags = "角色管理",summary = "获得角色拥有的应用id")
|
||||||
|
@Parameter(name = "roleId", description = "角色编号", required = true)
|
||||||
|
@GetMapping("/list-role-clients")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:permission:assign-role-app')")
|
||||||
|
public CommonResult<Set<Long>> getRoleClientList(Long roleId) {
|
||||||
|
return success(clientPermissionService.getRoleClientListByRoleId(roleId));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
import lombok.*;
|
import lombok.*;
|
||||||
import com.lideeyunji.tool.framework.common.pojo.PageParam;
|
import com.lideeyunji.tool.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - OAuth2 客户端分页 Request VO")
|
@Schema(description = "管理后台 - OAuth2 客户端分页 Request VO")
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@@ -16,4 +18,7 @@ public class OAuth2ClientPageReqVO extends PageParam {
|
|||||||
@Schema(description = "状态,参见 CommonStatusEnum 枚举", example = "1")
|
@Schema(description = "状态,参见 CommonStatusEnum 枚举", example = "1")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "应用id", example = "[1]")
|
||||||
|
private Set<Long> ids;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,10 @@ public class OAuth2ClientRespVO {
|
|||||||
@Schema(description = "应用名", requiredMode = Schema.RequiredMode.REQUIRED, example = "土豆")
|
@Schema(description = "应用名", requiredMode = Schema.RequiredMode.REQUIRED, example = "土豆")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Schema(description = "应用图标", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.lidee.cn/xx.png")
|
@Schema(description = "应用分类", requiredMode = Schema.RequiredMode.REQUIRED, example = "category1")
|
||||||
|
private String category;
|
||||||
|
|
||||||
|
@Schema(description = "应用图标", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/xx.png")
|
||||||
private String logo;
|
private String logo;
|
||||||
|
|
||||||
@Schema(description = "应用描述", example = "我是一个应用")
|
@Schema(description = "应用描述", example = "我是一个应用")
|
||||||
@@ -37,8 +40,11 @@ public class OAuth2ClientRespVO {
|
|||||||
@Schema(description = "刷新令牌的有效期", requiredMode = Schema.RequiredMode.REQUIRED, example = "8640000")
|
@Schema(description = "刷新令牌的有效期", requiredMode = Schema.RequiredMode.REQUIRED, example = "8640000")
|
||||||
private Integer refreshTokenValiditySeconds;
|
private Integer refreshTokenValiditySeconds;
|
||||||
|
|
||||||
@Schema(description = "可重定向的 URI 地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.lidee.cn")
|
// @Schema(description = "可重定向的 URI 地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn")
|
||||||
private List<String> redirectUris;
|
// private List<String> redirectUris;
|
||||||
|
|
||||||
|
@Schema(description = "可重定向的 URI 地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn")
|
||||||
|
private String redirectUris;
|
||||||
|
|
||||||
@Schema(description = "授权类型,参见 OAuth2GrantTypeEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "password")
|
@Schema(description = "授权类型,参见 OAuth2GrantTypeEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "password")
|
||||||
private List<String> authorizedGrantTypes;
|
private List<String> authorizedGrantTypes;
|
||||||
@@ -55,7 +61,10 @@ public class OAuth2ClientRespVO {
|
|||||||
@Schema(description = "资源", example = "1024")
|
@Schema(description = "资源", example = "1024")
|
||||||
private List<String> resourceIds;
|
private List<String> resourceIds;
|
||||||
|
|
||||||
@Schema(description = "附加信息", example = "{yunai: true}")
|
@Schema(description = "回调URI地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn")
|
||||||
|
private String callbackUris;
|
||||||
|
|
||||||
|
@Schema(description = "附加信息", example = "{lidee: true}")
|
||||||
private String additionalInformation;
|
private String additionalInformation;
|
||||||
|
|
||||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
|||||||
@@ -30,7 +30,11 @@ public class OAuth2ClientSaveReqVO {
|
|||||||
@NotNull(message = "应用名不能为空")
|
@NotNull(message = "应用名不能为空")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Schema(description = "应用图标", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.lidee.cn/xx.png")
|
@Schema(description = "应用分类", requiredMode = Schema.RequiredMode.REQUIRED, example = "category1")
|
||||||
|
@NotNull(message = "应用分类不能为空")
|
||||||
|
private String category;
|
||||||
|
|
||||||
|
@Schema(description = "应用图标", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/xx.png")
|
||||||
@NotNull(message = "应用图标不能为空")
|
@NotNull(message = "应用图标不能为空")
|
||||||
@URL(message = "应用图标的地址不正确")
|
@URL(message = "应用图标的地址不正确")
|
||||||
private String logo;
|
private String logo;
|
||||||
@@ -46,14 +50,18 @@ public class OAuth2ClientSaveReqVO {
|
|||||||
@NotNull(message = "访问令牌的有效期不能为空")
|
@NotNull(message = "访问令牌的有效期不能为空")
|
||||||
private Integer accessTokenValiditySeconds;
|
private Integer accessTokenValiditySeconds;
|
||||||
|
|
||||||
|
|
||||||
@Schema(description = "刷新令牌的有效期", requiredMode = Schema.RequiredMode.REQUIRED, example = "8640000")
|
@Schema(description = "刷新令牌的有效期", requiredMode = Schema.RequiredMode.REQUIRED, example = "8640000")
|
||||||
@NotNull(message = "刷新令牌的有效期不能为空")
|
@NotNull(message = "刷新令牌的有效期不能为空")
|
||||||
private Integer refreshTokenValiditySeconds;
|
private Integer refreshTokenValiditySeconds;
|
||||||
|
|
||||||
@Schema(description = "可重定向的 URI 地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.lidee.cn")
|
// @Schema(description = "可重定向的 URI 地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn")
|
||||||
|
// @NotNull(message = "可重定向的 URI 地址不能为空")
|
||||||
|
// private List<@NotEmpty(message = "重定向的 URI 不能为空") @URL(message = "重定向的 URI 格式不正确") String> redirectUris;
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "可重定向的 URI 地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn")
|
||||||
@NotNull(message = "可重定向的 URI 地址不能为空")
|
@NotNull(message = "可重定向的 URI 地址不能为空")
|
||||||
private List<@NotEmpty(message = "重定向的 URI 不能为空") @URL(message = "重定向的 URI 格式不正确") String> redirectUris;
|
private String redirectUris;
|
||||||
|
|
||||||
@Schema(description = "授权类型,参见 OAuth2GrantTypeEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "password")
|
@Schema(description = "授权类型,参见 OAuth2GrantTypeEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "password")
|
||||||
@NotNull(message = "授权类型不能为空")
|
@NotNull(message = "授权类型不能为空")
|
||||||
@@ -71,9 +79,12 @@ public class OAuth2ClientSaveReqVO {
|
|||||||
@Schema(description = "资源", example = "1024")
|
@Schema(description = "资源", example = "1024")
|
||||||
private List<String> resourceIds;
|
private List<String> resourceIds;
|
||||||
|
|
||||||
@Schema(description = "附加信息", example = "{yunai: true}")
|
@Schema(description = "附加信息", example = "{lidee: true}")
|
||||||
private String additionalInformation;
|
private String additionalInformation;
|
||||||
|
|
||||||
|
@Schema(description = "回调URI地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn")
|
||||||
|
private String callbackUris;
|
||||||
|
|
||||||
@AssertTrue(message = "附加信息必须是 JSON 格式")
|
@AssertTrue(message = "附加信息必须是 JSON 格式")
|
||||||
public boolean isAdditionalInformationJson() {
|
public boolean isAdditionalInformationJson() {
|
||||||
return StrUtil.isEmpty(additionalInformation) || JsonUtils.isJson(additionalInformation);
|
return StrUtil.isEmpty(additionalInformation) || JsonUtils.isJson(additionalInformation);
|
||||||
|
|||||||
@@ -18,4 +18,7 @@ public class PermissionAssignRoleMenuReqVO {
|
|||||||
@Schema(description = "菜单编号列表", example = "1,3,5")
|
@Schema(description = "菜单编号列表", example = "1,3,5")
|
||||||
private Set<Long> menuIds = Collections.emptySet(); // 兜底
|
private Set<Long> menuIds = Collections.emptySet(); // 兜底
|
||||||
|
|
||||||
|
@Schema(description = "应用id列表", example = "1,3,5")
|
||||||
|
private Set<Long> clientIds = Collections.emptySet();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,11 @@ public class OAuth2ClientDO extends BaseDO {
|
|||||||
* 应用名
|
* 应用名
|
||||||
*/
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
|
/**
|
||||||
|
* 应用分类
|
||||||
|
*/
|
||||||
|
private String category;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 应用图标
|
* 应用图标
|
||||||
*/
|
*/
|
||||||
@@ -65,11 +70,14 @@ public class OAuth2ClientDO extends BaseDO {
|
|||||||
* 刷新令牌的有效期
|
* 刷新令牌的有效期
|
||||||
*/
|
*/
|
||||||
private Integer refreshTokenValiditySeconds;
|
private Integer refreshTokenValiditySeconds;
|
||||||
/**
|
// /**
|
||||||
* 可重定向的 URI 地址
|
// * 可重定向的 URI 地址
|
||||||
*/
|
// */
|
||||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
// @TableField(typeHandler = JacksonTypeHandler.class)
|
||||||
private List<String> redirectUris;
|
// private List<String> redirectUris;
|
||||||
|
|
||||||
|
private String redirectUris;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 授权类型(模式)
|
* 授权类型(模式)
|
||||||
*
|
*
|
||||||
@@ -99,6 +107,12 @@ public class OAuth2ClientDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||||
private List<String> resourceIds;
|
private List<String> resourceIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回调URI地址
|
||||||
|
*/
|
||||||
|
private String callbackUris;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 附加信息,JSON 格式
|
* 附加信息,JSON 格式
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.lideeyunji.service.system.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.lideeyunji.tool.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OAuth2 客户端和角色关联
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableName(value = "system_role_oauth2_client", autoResultMap = true)
|
||||||
|
@KeySequence("system_role_oauth2_client_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class RoleOAuth2ClientDO extends BaseDO {
|
||||||
|
/**
|
||||||
|
* 自增主键
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色ID
|
||||||
|
*/
|
||||||
|
private Long roleId;
|
||||||
|
/**
|
||||||
|
* 菜单ID
|
||||||
|
*/
|
||||||
|
private Long oauthClientId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package com.lideeyunji.service.system.mapper;
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import com.lideeyunji.service.system.controller.vo.oauth2.client.OAuth2ClientPageReqVO;
|
||||||
|
import com.lideeyunji.service.system.entity.DictDataDO;
|
||||||
|
import com.lideeyunji.service.system.entity.OAuth2ClientDO;
|
||||||
|
import com.lideeyunji.tool.framework.common.pojo.PageResult;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface OAuth2ClientJoinMapper extends MPJBaseMapper<OAuth2ClientDO> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询(关联字典表)
|
||||||
|
*/
|
||||||
|
default PageResult<OAuth2ClientDO> selectPage(OAuth2ClientPageReqVO reqVO) {
|
||||||
|
MPJLambdaWrapper<OAuth2ClientDO> wrapper = buildQueryWrapper(reqVO);
|
||||||
|
|
||||||
|
com.baomidou.mybatisplus.extension.plugins.pagination.Page<OAuth2ClientDO> page =
|
||||||
|
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(
|
||||||
|
reqVO.getPageNo(),
|
||||||
|
reqVO.getPageSize()
|
||||||
|
);
|
||||||
|
|
||||||
|
com.baomidou.mybatisplus.extension.plugins.pagination.Page<OAuth2ClientDO> resultPage =
|
||||||
|
selectJoinPage(page, OAuth2ClientDO.class, wrapper);
|
||||||
|
|
||||||
|
return new PageResult<>(resultPage.getRecords(), resultPage.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
default MPJLambdaWrapper<OAuth2ClientDO> buildQueryWrapper(OAuth2ClientPageReqVO reqVO) {
|
||||||
|
MPJLambdaWrapper<OAuth2ClientDO> wrapper = new MPJLambdaWrapper<OAuth2ClientDO>()
|
||||||
|
.selectAll(OAuth2ClientDO.class)
|
||||||
|
.leftJoin(DictDataDO.class, on -> on
|
||||||
|
.eq(DictDataDO::getValue, OAuth2ClientDO::getCategory)
|
||||||
|
.eq(DictDataDO::getDictType, "app_category"));
|
||||||
|
|
||||||
|
applyQueryConditions(wrapper, reqVO);
|
||||||
|
|
||||||
|
wrapper.orderByAsc(DictDataDO::getSort)
|
||||||
|
.orderByDesc(OAuth2ClientDO::getId);
|
||||||
|
|
||||||
|
return wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
default void applyQueryConditions(MPJLambdaWrapper<OAuth2ClientDO> wrapper, OAuth2ClientPageReqVO reqVO) {
|
||||||
|
if (reqVO.getName() != null && !reqVO.getName().isEmpty()) {
|
||||||
|
wrapper.like(OAuth2ClientDO::getName, reqVO.getName());
|
||||||
|
}
|
||||||
|
if (reqVO.getStatus() != null) {
|
||||||
|
wrapper.eq(OAuth2ClientDO::getStatus, reqVO.getStatus());
|
||||||
|
}
|
||||||
|
if (reqVO.getIds() != null && !reqVO.getIds().isEmpty()) {
|
||||||
|
wrapper.in(OAuth2ClientDO::getId, reqVO.getIds());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,8 @@ import com.lideeyunji.service.system.controller.vo.oauth2.client.OAuth2ClientPag
|
|||||||
import com.lideeyunji.service.system.entity.OAuth2ClientDO;
|
import com.lideeyunji.service.system.entity.OAuth2ClientDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OAuth2 客户端 Mapper
|
* OAuth2 客户端 Mapper
|
||||||
@@ -20,6 +22,8 @@ public interface OAuth2ClientMapper extends BaseMapperX<OAuth2ClientDO> {
|
|||||||
return selectPage(reqVO, new LambdaQueryWrapperX<OAuth2ClientDO>()
|
return selectPage(reqVO, new LambdaQueryWrapperX<OAuth2ClientDO>()
|
||||||
.likeIfPresent(OAuth2ClientDO::getName, reqVO.getName())
|
.likeIfPresent(OAuth2ClientDO::getName, reqVO.getName())
|
||||||
.eqIfPresent(OAuth2ClientDO::getStatus, reqVO.getStatus())
|
.eqIfPresent(OAuth2ClientDO::getStatus, reqVO.getStatus())
|
||||||
|
.neIfPresent(OAuth2ClientDO::getClientId, "default")
|
||||||
|
.inIfPresent(OAuth2ClientDO::getId, reqVO.getIds())
|
||||||
.orderByDesc(OAuth2ClientDO::getId));
|
.orderByDesc(OAuth2ClientDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,4 +31,9 @@ public interface OAuth2ClientMapper extends BaseMapperX<OAuth2ClientDO> {
|
|||||||
return selectOne(OAuth2ClientDO::getClientId, clientId);
|
return selectOne(OAuth2ClientDO::getClientId, clientId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default List<OAuth2ClientDO> selectEnableList() {
|
||||||
|
return selectList(new LambdaQueryWrapperX<OAuth2ClientDO>()
|
||||||
|
.eq(OAuth2ClientDO::getStatus, 0));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.lideeyunji.service.system.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.lideeyunji.service.system.entity.RoleOAuth2ClientDO;
|
||||||
|
import com.lideeyunji.tool.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface RoleOAuth2ClientMapper extends BaseMapperX<RoleOAuth2ClientDO> {
|
||||||
|
|
||||||
|
default List<RoleOAuth2ClientDO> selectListByRoleId(Long roleId) {
|
||||||
|
return selectList(RoleOAuth2ClientDO::getRoleId, roleId);
|
||||||
|
}
|
||||||
|
|
||||||
|
default List<RoleOAuth2ClientDO> selectListByRoleId(Collection<Long> roleIds) {
|
||||||
|
return selectList(RoleOAuth2ClientDO::getRoleId, roleIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
default List<RoleOAuth2ClientDO> selectListByMenuId(Long clientId) {
|
||||||
|
return selectList(RoleOAuth2ClientDO::getOauthClientId, clientId);
|
||||||
|
}
|
||||||
|
|
||||||
|
default void deleteListByRoleIdAndOauthClientId(Long roleId, Collection<Long> clientIds) {
|
||||||
|
delete(new LambdaQueryWrapper<RoleOAuth2ClientDO>()
|
||||||
|
.eq(RoleOAuth2ClientDO::getRoleId, roleId)
|
||||||
|
.in(RoleOAuth2ClientDO::getOauthClientId, clientIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
default void deleteListByRoleId(Long roleId) {
|
||||||
|
delete(new LambdaQueryWrapper<RoleOAuth2ClientDO>().eq(RoleOAuth2ClientDO::getRoleId, roleId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.lideeyunji.service.system.service;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Set;
|
||||||
|
import static java.util.Collections.singleton;
|
||||||
|
/**
|
||||||
|
* 应用权限接口
|
||||||
|
*/
|
||||||
|
public interface IClientPermissionService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得角色拥有的应用id集合
|
||||||
|
*
|
||||||
|
* @param roleId 角色编号
|
||||||
|
* @return 应用id集合
|
||||||
|
*/
|
||||||
|
default Set<Long> getRoleClientListByRoleId(Long roleId) {
|
||||||
|
return getRoleClientListByRoleId(singleton(roleId));
|
||||||
|
}
|
||||||
|
Set<Long> getRoleClientListByRoleId(Collection<Long> roleIds);
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ import com.lideeyunji.service.system.entity.OAuth2ClientDO;
|
|||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OAuth2.0 Client Service 接口
|
* OAuth2.0 Client Service 接口
|
||||||
@@ -63,6 +64,14 @@ public interface IOAuth2ClientService {
|
|||||||
*/
|
*/
|
||||||
PageResult<OAuth2ClientDO> getOAuth2ClientPage(OAuth2ClientPageReqVO pageReqVO);
|
PageResult<OAuth2ClientDO> getOAuth2ClientPage(OAuth2ClientPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得 OAuth2 客户端分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return OAuth2 客户端分页
|
||||||
|
*/
|
||||||
|
PageResult<OAuth2ClientDO> getMyPage(OAuth2ClientPageReqVO pageReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 从缓存中,校验客户端是否合法
|
* 从缓存中,校验客户端是否合法
|
||||||
*
|
*
|
||||||
@@ -87,4 +96,10 @@ public interface IOAuth2ClientService {
|
|||||||
OAuth2ClientDO validOAuthClientFromCache(String clientId, String clientSecret, String authorizedGrantType,
|
OAuth2ClientDO validOAuthClientFromCache(String clientId, String clientSecret, String authorizedGrantType,
|
||||||
Collection<String> scopes, String redirectUri);
|
Collection<String> scopes, String redirectUri);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有启用应用
|
||||||
|
* @return 应用列表
|
||||||
|
*/
|
||||||
|
List<OAuth2ClientDO> getAllEnableClient();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,4 +152,12 @@ public interface IPermissionService {
|
|||||||
//清除缓存
|
//清除缓存
|
||||||
Boolean clearCache(Long userId);
|
Boolean clearCache(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置角色应用
|
||||||
|
*
|
||||||
|
* @param roleId 角色编号
|
||||||
|
* @param clientIds 应用集合id
|
||||||
|
*/
|
||||||
|
void assignRoleClient(Long roleId, Set<Long> clientIds);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package com.lideeyunji.service.system.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.lideeyunji.service.system.entity.OAuth2ClientDO;
|
||||||
|
import com.lideeyunji.service.system.entity.RoleOAuth2ClientDO;
|
||||||
|
import com.lideeyunji.service.system.mapper.RoleOAuth2ClientMapper;
|
||||||
|
import com.lideeyunji.service.system.service.IClientPermissionService;
|
||||||
|
import com.lideeyunji.service.system.service.IOAuth2ClientService;
|
||||||
|
import com.lideeyunji.service.system.service.IRoleService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.lideeyunji.tool.framework.common.util.collection.CollectionUtils.convertSet;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
@Slf4j
|
||||||
|
public class ClientPermissionServiceImpl implements IClientPermissionService {
|
||||||
|
@Resource
|
||||||
|
private RoleOAuth2ClientMapper roleOAuth2ClientMapper;
|
||||||
|
@Resource
|
||||||
|
private IRoleService roleService;
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
@Resource
|
||||||
|
private IOAuth2ClientService ioAuth2ClientService;
|
||||||
|
|
||||||
|
public Set<Long> getRoleClientListByRoleId(Collection<Long> roleIds) {
|
||||||
|
if (CollUtil.isEmpty(roleIds)) {
|
||||||
|
return Collections.emptySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (roleService.hasAnySuperAdmin(roleIds)) {
|
||||||
|
List<OAuth2ClientDO> allEnableClient = ioAuth2ClientService.getAllEnableClient();
|
||||||
|
return Optional.ofNullable(allEnableClient)
|
||||||
|
.map(all -> all.stream()
|
||||||
|
.map(OAuth2ClientDO::getId)
|
||||||
|
.collect(Collectors.toSet()))
|
||||||
|
.orElse(new HashSet<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
return convertSet(roleOAuth2ClientMapper.selectListByRoleId(roleIds),
|
||||||
|
RoleOAuth2ClientDO::getOauthClientId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,17 +4,22 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.lideeyunji.tool.framework.common.enums.CommonStatusEnum;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import com.lideeyunji.tool.framework.common.pojo.PageResult;
|
import com.lideeyunji.service.system.config.redis.RedisKeyConstants;
|
||||||
import com.lideeyunji.tool.framework.common.util.object.BeanUtils;
|
|
||||||
import com.lideeyunji.tool.framework.common.util.string.StrUtils;
|
|
||||||
import com.lideeyunji.service.system.controller.vo.oauth2.client.OAuth2ClientPageReqVO;
|
import com.lideeyunji.service.system.controller.vo.oauth2.client.OAuth2ClientPageReqVO;
|
||||||
import com.lideeyunji.service.system.controller.vo.oauth2.client.OAuth2ClientSaveReqVO;
|
import com.lideeyunji.service.system.controller.vo.oauth2.client.OAuth2ClientSaveReqVO;
|
||||||
import com.lideeyunji.service.system.entity.OAuth2ClientDO;
|
import com.lideeyunji.service.system.entity.OAuth2ClientDO;
|
||||||
|
import com.lideeyunji.service.system.entity.UserRoleDO;
|
||||||
|
import com.lideeyunji.service.system.mapper.OAuth2ClientJoinMapper;
|
||||||
import com.lideeyunji.service.system.mapper.OAuth2ClientMapper;
|
import com.lideeyunji.service.system.mapper.OAuth2ClientMapper;
|
||||||
import com.lideeyunji.service.system.config.redis.RedisKeyConstants;
|
import com.lideeyunji.service.system.service.IAdminUserService;
|
||||||
|
import com.lideeyunji.service.system.service.IClientPermissionService;
|
||||||
import com.lideeyunji.service.system.service.IOAuth2ClientService;
|
import com.lideeyunji.service.system.service.IOAuth2ClientService;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.lideeyunji.service.system.service.IPermissionService;
|
||||||
|
import com.lideeyunji.tool.framework.common.enums.CommonStatusEnum;
|
||||||
|
import com.lideeyunji.tool.framework.common.pojo.PageResult;
|
||||||
|
import com.lideeyunji.tool.framework.common.util.object.BeanUtils;
|
||||||
|
import com.lideeyunji.tool.framework.security.core.LoginUser;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
@@ -23,9 +28,14 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.lideeyunji.tool.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static com.lideeyunji.service.system.constant.ErrorCodeConstants.*;
|
import static com.lideeyunji.service.system.constant.ErrorCodeConstants.*;
|
||||||
|
import static com.lideeyunji.tool.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static com.lideeyunji.tool.framework.security.core.util.SecurityFrameworkUtils.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OAuth2.0 Client Service 实现类
|
* OAuth2.0 Client Service 实现类
|
||||||
@@ -40,6 +50,16 @@ public class OAuth2ClientServiceImpl implements IOAuth2ClientService {
|
|||||||
@Resource
|
@Resource
|
||||||
private OAuth2ClientMapper oauth2ClientMapper;
|
private OAuth2ClientMapper oauth2ClientMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OAuth2ClientJoinMapper oAuth2ClientJoinMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IClientPermissionService clientPermissionService;
|
||||||
|
@Resource
|
||||||
|
private IAdminUserService userService;
|
||||||
|
@Resource
|
||||||
|
private IPermissionService permissionService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createOAuth2Client(OAuth2ClientSaveReqVO createReqVO) {
|
public Long createOAuth2Client(OAuth2ClientSaveReqVO createReqVO) {
|
||||||
validateClientIdExists(null, createReqVO.getClientId());
|
validateClientIdExists(null, createReqVO.getClientId());
|
||||||
@@ -111,6 +131,41 @@ public class OAuth2ClientServiceImpl implements IOAuth2ClientService {
|
|||||||
return oauth2ClientMapper.selectPage(pageReqVO);
|
return oauth2ClientMapper.selectPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<OAuth2ClientDO> getMyPage(OAuth2ClientPageReqVO pageReqVO) {
|
||||||
|
LoginUser loginUser = getLoginUser();
|
||||||
|
if (loginUser == null) {
|
||||||
|
return new PageResult<>();
|
||||||
|
}
|
||||||
|
boolean supAdminFlag = userService.isSupAdmin(loginUser.getId());//是否是超级管理员
|
||||||
|
boolean tenantAdminFlag = userService.isTenantAdmin(loginUser.getId());//是否是租户管理员
|
||||||
|
|
||||||
|
//获取当前登录部门和角色
|
||||||
|
Long loginDeptId = getLoginDeptId();
|
||||||
|
Long loginRoleId = getLoginRoleId();
|
||||||
|
|
||||||
|
Set<Long> roleIds = new HashSet<>();
|
||||||
|
if (supAdminFlag || tenantAdminFlag) {//超级管理员 或者租户管理员,直接查自身的所有权限
|
||||||
|
roleIds = permissionService.getUserRoleIdListByUserId(getLoginUserId());
|
||||||
|
} else {
|
||||||
|
if (loginRoleId != null) {//当前登录有角色
|
||||||
|
if (loginRoleId == -1) {//该部门下的所有角色
|
||||||
|
List<UserRoleDO> userRoleList = userService.getUserRoleList(loginUser.getId(), loginDeptId);
|
||||||
|
roleIds = userRoleList.stream()
|
||||||
|
.map(UserRoleDO::getRoleId)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
} else {
|
||||||
|
roleIds.add(loginRoleId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!CollUtil.isEmpty(roleIds)) {
|
||||||
|
Set<Long> clientIds = clientPermissionService.getRoleClientListByRoleId(roleIds);
|
||||||
|
pageReqVO.setIds(clientIds);
|
||||||
|
}
|
||||||
|
return oAuth2ClientJoinMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OAuth2ClientDO validOAuthClientFromCache(String clientId, String clientSecret, String authorizedGrantType,
|
public OAuth2ClientDO validOAuthClientFromCache(String clientId, String clientSecret, String authorizedGrantType,
|
||||||
Collection<String> scopes, String redirectUri) {
|
Collection<String> scopes, String redirectUri) {
|
||||||
@@ -136,12 +191,20 @@ public class OAuth2ClientServiceImpl implements IOAuth2ClientService {
|
|||||||
throw exception(OAUTH2_CLIENT_SCOPE_OVER);
|
throw exception(OAUTH2_CLIENT_SCOPE_OVER);
|
||||||
}
|
}
|
||||||
// 校验回调地址
|
// 校验回调地址
|
||||||
if (StrUtil.isNotEmpty(redirectUri) && !StrUtils.startWithAny(redirectUri, client.getRedirectUris())) {
|
// if (StrUtil.isNotEmpty(redirectUri) && !StrUtils.startWithAny(redirectUri, client.getRedirectUris())) {
|
||||||
|
// throw exception(OAUTH2_CLIENT_REDIRECT_URI_NOT_MATCH, redirectUri);
|
||||||
|
// }
|
||||||
|
if (StrUtil.isNotEmpty(redirectUri) && ObjectUtil.notEqual(client.getRedirectUris(), redirectUri)) {
|
||||||
throw exception(OAUTH2_CLIENT_REDIRECT_URI_NOT_MATCH, redirectUri);
|
throw exception(OAUTH2_CLIENT_REDIRECT_URI_NOT_MATCH, redirectUri);
|
||||||
}
|
}
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<OAuth2ClientDO> getAllEnableClient() {
|
||||||
|
return oauth2ClientMapper.selectEnableList();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得自身的代理对象,解决 AOP 生效问题
|
* 获得自身的代理对象,解决 AOP 生效问题
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -9,12 +9,10 @@ import com.google.common.annotations.VisibleForTesting;
|
|||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.lideeyunji.service.system.config.redis.RedisKeyConstants;
|
import com.lideeyunji.service.system.config.redis.RedisKeyConstants;
|
||||||
import com.lideeyunji.service.system.dto.DeptDataPermissionRespDTO;
|
import com.lideeyunji.service.system.dto.DeptDataPermissionRespDTO;
|
||||||
import com.lideeyunji.service.system.entity.MenuDO;
|
import com.lideeyunji.service.system.entity.*;
|
||||||
import com.lideeyunji.service.system.entity.RoleDO;
|
|
||||||
import com.lideeyunji.service.system.entity.RoleMenuDO;
|
|
||||||
import com.lideeyunji.service.system.entity.UserRoleDO;
|
|
||||||
import com.lideeyunji.service.system.enums.DataScopeEnum;
|
import com.lideeyunji.service.system.enums.DataScopeEnum;
|
||||||
import com.lideeyunji.service.system.mapper.RoleMenuMapper;
|
import com.lideeyunji.service.system.mapper.RoleMenuMapper;
|
||||||
|
import com.lideeyunji.service.system.mapper.RoleOAuth2ClientMapper;
|
||||||
import com.lideeyunji.service.system.mapper.UserRoleMapper;
|
import com.lideeyunji.service.system.mapper.UserRoleMapper;
|
||||||
import com.lideeyunji.service.system.service.*;
|
import com.lideeyunji.service.system.service.*;
|
||||||
import com.lideeyunji.tool.framework.common.enums.CommonStatusEnum;
|
import com.lideeyunji.tool.framework.common.enums.CommonStatusEnum;
|
||||||
@@ -33,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.lideeyunji.tool.framework.common.util.collection.CollectionUtils.convertSet;
|
import static com.lideeyunji.tool.framework.common.util.collection.CollectionUtils.convertSet;
|
||||||
import static com.lideeyunji.tool.framework.common.util.json.JsonUtils.toJsonString;
|
import static com.lideeyunji.tool.framework.common.util.json.JsonUtils.toJsonString;
|
||||||
@@ -50,6 +49,8 @@ public class PermissionServiceImpl implements IPermissionService {
|
|||||||
private RoleMenuMapper roleMenuMapper;
|
private RoleMenuMapper roleMenuMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private UserRoleMapper userRoleMapper;
|
private UserRoleMapper userRoleMapper;
|
||||||
|
@Resource
|
||||||
|
private RoleOAuth2ClientMapper roleOAuth2ClientMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IRoleService roleService;
|
private IRoleService roleService;
|
||||||
@@ -409,6 +410,25 @@ public class PermissionServiceImpl implements IPermissionService {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@DSTransactional
|
||||||
|
public void assignRoleClient(Long roleId, Set<Long> clientIds) {
|
||||||
|
Set<Long> dbMenuIds = convertSet(roleOAuth2ClientMapper.selectListByRoleId(roleId), RoleOAuth2ClientDO::getOauthClientId);
|
||||||
|
Set<Long> menuIdList = CollUtil.emptyIfNull(clientIds);
|
||||||
|
Collection<Long> createMenuIds = CollUtil.subtract(menuIdList, dbMenuIds);
|
||||||
|
Collection<Long> deleteMenuIds = CollUtil.subtract(dbMenuIds, menuIdList);
|
||||||
|
if (CollUtil.isNotEmpty(createMenuIds)) {
|
||||||
|
roleOAuth2ClientMapper.insertBatch(CollectionUtils.convertList(createMenuIds, clientId -> {
|
||||||
|
RoleOAuth2ClientDO entity = new RoleOAuth2ClientDO();
|
||||||
|
entity.setRoleId(roleId);
|
||||||
|
entity.setOauthClientId(clientId);
|
||||||
|
return entity;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(deleteMenuIds)) {
|
||||||
|
roleOAuth2ClientMapper.deleteListByRoleIdAndOauthClientId(roleId, deleteMenuIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ public interface lideeYunJiBaseConstant {
|
|||||||
//多数据源
|
//多数据源
|
||||||
String DS_lideeyunji="lideeyunji";//低代码
|
String DS_lideeyunji="lideeyunji";//低代码
|
||||||
String DS_MASTER="master";//主服务
|
String DS_MASTER="master";//主服务
|
||||||
|
String DS_ORACLE_GRYYBI="oracle_gryybi";//报表平台 oracle
|
||||||
|
String DS_ERP_BI_DATA="erp_bi_data";//报表平台 mysql
|
||||||
|
|
||||||
String REQUEST_URL_START="/lideeyunji";//公共请求
|
String REQUEST_URL_START="/lideeyunji";//公共请求
|
||||||
String BASE_PACKAGES="com.lideeyunji";//公共包名称
|
String BASE_PACKAGES="com.lideeyunji";//公共包名称
|
||||||
|
|||||||
Reference in New Issue
Block a user