13 Commits

Author SHA1 Message Date
chy
56cb31c616 根据tokne获取用户信息 2026-03-10 14:23:28 +08:00
chy
de1774b2d3 修改配置文件 2026-03-10 11:13:56 +08:00
chy
43e66ea9c6 根据ticket获取用户信息 2026-03-10 11:09:46 +08:00
f494611789 Merge pull request '销售明细表定时任务' (#24) from liug into master
Reviewed-on: #24
2026-03-06 23:01:12 +08:00
hardy.liu
8bae1cbd35 销售明细表定时任务 2026-03-06 15:00:08 +08:00
chy
ee7510f41e 修改统一身份认证 2026-03-02 15:15:41 +08:00
chy
44279d9637 修改统一身份认证 2026-03-02 10:34:45 +08:00
860afb9812 Merge pull request '新增字段' (#23) from dpx20260211 into master
Reviewed-on: #23
2026-02-28 08:44:07 +08:00
1b81782767 Merge pull request '应用查询按字典排序值排序' (#21) from main_hhl0209 into master
Reviewed-on: #21
2026-02-25 14:01:54 +08:00
432feb11d2 Merge pull request 'dpx20260211' (#22) from dpx20260211 into master
Reviewed-on: #22
2026-02-25 14:01:28 +08:00
c4ea4650bf Merge branch 'master' into main_hhl0209 2026-02-25 14:00:25 +08:00
chy
79cb1297db 修改认证 2026-02-22 21:40:47 +08:00
huhanlin
0cc088c51b 应用查询按字典排序值排序 2026-02-11 14:42:09 +08:00
23 changed files with 453 additions and 22 deletions

View File

@@ -21,6 +21,16 @@ spring:
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 连接的示例
username: root username: root
password: root password: root
oracle_gryybi: # 报表平台 oracle
driver-class-name: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@//192.168.1.247:1521/gryy?oracle.jdbc.defaultNChar=true&oracle.jdbc.convertNcharLiterals=true
username: GRYYBI
password: xxb147258367
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 连接的示例
username: root
password: root
redis: redis:
host: 127.0.0.1 # 地址 host: 127.0.0.1 # 地址
port: 6379 # 端口 port: 6379 # 端口

View File

@@ -9,18 +9,28 @@ spring:
datasource: datasource:
master: master:
# MYSQL数据库 主库,业务库 # MYSQL数据库 主库,业务库
url: jdbc:mysql://127.0.0.1:3306/gr_repoort?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 连接的示例
username: root username: root
password: gryy@8888 password: gryy@8888
lideeyunji: # 从库,框架库 lideeyunji: # 从库,框架库
url: jdbc:mysql://127.0.0.1:3306/gr_repoort?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 连接的示例
username: root username: root
password: gryy@8888 password: gryy@8888
slave: # 日志库单独 slave: # 日志库单独
lazy: true # 开启懒加载,保证启动速度 lazy: true # 开启懒加载,保证启动速度
url: jdbc:mysql://127.0.0.1:3306/gr_repoort?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 连接的示例
username: root username: root
password: gryy@8888 password: gryy@8888
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 连接的示例
username: root
password: root
redis: redis:
host: 127.0.0.1 # 地址 host: 127.0.0.1 # 地址
port: 6379 # 端口 port: 6379 # 端口

View File

@@ -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 # 允许循环依赖,因为项目是三层架构,无法避免这个情况。

View File

@@ -78,5 +78,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>

View File

@@ -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>

View File

@@ -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
*/
@Slf4j
@Component("SaSetdtlSyncJob")
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;
}
}

View File

@@ -60,9 +60,6 @@ public class anyToGrBiSasetdtl implements JobHandler {
while (rs.next()) { while (rs.next()) {
//写入到数据中台表 //写入到数据中台表
System.out.println(rs.getString("SASETTLEDTLID")); System.out.println(rs.getString("SASETTLEDTLID"));
} }

View File

@@ -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;
}

View File

@@ -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);
}
}

View File

@@ -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();
}

View File

@@ -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;
}
}

View File

@@ -97,6 +97,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>
<groupId>com.lideeyunji</groupId> <groupId>com.lideeyunji</groupId>
<artifactId>lidee-module-api</artifactId> <artifactId>lidee-module-api</artifactId>

View File

@@ -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>

View File

@@ -6,7 +6,6 @@ import cn.hutool.core.util.StrUtil;
import com.lideeyunji.service.system.config.convert.auth.AuthConvert; import com.lideeyunji.service.system.config.convert.auth.AuthConvert;
import com.lideeyunji.service.system.constant.ErrorCodeConstants; import com.lideeyunji.service.system.constant.ErrorCodeConstants;
import com.lideeyunji.service.system.controller.vo.auth.*; import com.lideeyunji.service.system.controller.vo.auth.*;
import com.lideeyunji.service.system.controller.vo.auth.*;
import com.lideeyunji.service.system.controller.vo.user.user.UserRespVO; import com.lideeyunji.service.system.controller.vo.user.user.UserRespVO;
import com.lideeyunji.service.system.entity.AdminUserDO; import com.lideeyunji.service.system.entity.AdminUserDO;
import com.lideeyunji.service.system.entity.MenuDO; import com.lideeyunji.service.system.entity.MenuDO;
@@ -23,7 +22,6 @@ import com.lideeyunji.tool.framework.operatelog.core.annotations.OperateLog;
import com.lideeyunji.tool.framework.security.config.SecurityProperties; import com.lideeyunji.tool.framework.security.config.SecurityProperties;
import com.lideeyunji.tool.framework.security.core.util.SecurityFrameworkUtils; import com.lideeyunji.tool.framework.security.core.util.SecurityFrameworkUtils;
import com.lideeyunji.tool.framework.tenant.core.context.TenantContextHolder; import com.lideeyunji.tool.framework.tenant.core.context.TenantContextHolder;
import com.lideeyunji.service.system.service.*;
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.Parameters; import io.swagger.v3.oas.annotations.Parameters;
@@ -160,6 +158,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<AdminUserDO> getUerInfo(@RequestParam("refreshToken") String refreshToken) {
return success(authService.getTokenTouserInfo(refreshToken));
}
@GetMapping("/get-permission-info") @GetMapping("/get-permission-info")
@Operation(tags = "授权管理",summary = "获取登录用户的权限信息") @Operation(tags = "授权管理",summary = "获取登录用户的权限信息")
public CommonResult<AuthPermissionInfoRespVO> getPermissionInfo() { public CommonResult<AuthPermissionInfoRespVO> getPermissionInfo() {

View File

@@ -73,7 +73,7 @@ public class OAuth2ClientController {
@GetMapping("/myPage") @GetMapping("/myPage")
@Operation(tags = "OAuth2.0管理",summary = "获得用户角色下 OAuth2 客户端分页") @Operation(tags = "OAuth2.0管理",summary = "获得用户角色下 OAuth2 客户端分页")
@PreAuthorize("@ss.hasPermission('system:oauth2-client:query')") // @PreAuthorize("@ss.hasPermission('system:oauth2-client:query')")
public CommonResult<PageResult<OAuth2ClientRespVO>> getMyPage(@Valid OAuth2ClientPageReqVO pageVO) { public CommonResult<PageResult<OAuth2ClientRespVO>> getMyPage(@Valid OAuth2ClientPageReqVO pageVO) {
PageResult<OAuth2ClientDO> pageResult = oAuth2ClientService.getMyPage(pageVO); PageResult<OAuth2ClientDO> pageResult = oAuth2ClientService.getMyPage(pageVO);
return success(BeanUtils.toBean(pageResult, OAuth2ClientRespVO.class)); return success(BeanUtils.toBean(pageResult, OAuth2ClientRespVO.class));

View File

@@ -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());
}
}
}

View File

@@ -22,6 +22,7 @@ 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()) .inIfPresent(OAuth2ClientDO::getId, reqVO.getIds())
.orderByDesc(OAuth2ClientDO::getId)); .orderByDesc(OAuth2ClientDO::getId));
} }

View File

@@ -78,4 +78,6 @@ public interface IAdminAuthService {
*/ */
AuthLoginRespVO refreshToken(String refreshToken); AuthLoginRespVO refreshToken(String refreshToken);
AdminUserDO getTokenTouserInfo(String refreshToken);
} }

View File

@@ -1,5 +1,6 @@
package com.lideeyunji.service.system.service; package com.lideeyunji.service.system.service;
import com.lideeyunji.service.system.entity.AdminUserDO;
import com.lideeyunji.tool.framework.common.pojo.PageResult; import com.lideeyunji.tool.framework.common.pojo.PageResult;
import com.lideeyunji.service.system.controller.vo.oauth2.token.OAuth2AccessTokenPageReqVO; import com.lideeyunji.service.system.controller.vo.oauth2.token.OAuth2AccessTokenPageReqVO;
import com.lideeyunji.service.system.entity.OAuth2AccessTokenDO; import com.lideeyunji.service.system.entity.OAuth2AccessTokenDO;
@@ -41,6 +42,10 @@ public interface IOAuth2TokenService {
*/ */
OAuth2AccessTokenDO refreshAccessToken(String refreshToken, String clientId); OAuth2AccessTokenDO refreshAccessToken(String refreshToken, String clientId);
AdminUserDO getTokenTouserInfo(String refreshToken);
/** /**
* 获得访问令牌 * 获得访问令牌
* *

View File

@@ -362,6 +362,15 @@ public class AdminAuthServiceImpl implements IAdminAuthService {
return AuthConvert.INSTANCE.convert(accessTokenDO); return AuthConvert.INSTANCE.convert(accessTokenDO);
} }
@Override
public AdminUserDO getTokenTouserInfo(String refreshToken) {
AdminUserDO user= oauth2TokenService.getTokenTouserInfo(refreshToken);
return user;
}
@Override @Override
public void logout(String token, Integer logType) { public void logout(String token, Integer logType) {
// 删除访问令牌 // 删除访问令牌

View File

@@ -1,26 +1,24 @@
package com.lideeyunji.service.system.service.impl; package com.lideeyunji.service.system.service.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.stream.CollectorUtil;
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.service.system.entity.AdminUserDO; import com.google.common.annotations.VisibleForTesting;
import com.lideeyunji.service.system.config.redis.RedisKeyConstants;
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.entity.OAuth2ClientDO;
import com.lideeyunji.service.system.entity.UserRoleDO; 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.service.IAdminUserService; import com.lideeyunji.service.system.service.IAdminUserService;
import com.lideeyunji.service.system.service.IClientPermissionService; import com.lideeyunji.service.system.service.IClientPermissionService;
import com.lideeyunji.service.system.service.IOAuth2ClientService;
import com.lideeyunji.service.system.service.IPermissionService; import com.lideeyunji.service.system.service.IPermissionService;
import com.lideeyunji.tool.framework.common.enums.CommonStatusEnum; import com.lideeyunji.tool.framework.common.enums.CommonStatusEnum;
import com.lideeyunji.tool.framework.common.pojo.PageResult; import com.lideeyunji.tool.framework.common.pojo.PageResult;
import com.lideeyunji.tool.framework.common.util.object.BeanUtils; 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.OAuth2ClientSaveReqVO;
import com.lideeyunji.service.system.entity.OAuth2ClientDO;
import com.lideeyunji.service.system.mapper.OAuth2ClientMapper;
import com.lideeyunji.service.system.config.redis.RedisKeyConstants;
import com.lideeyunji.service.system.service.IOAuth2ClientService;
import com.google.common.annotations.VisibleForTesting;
import com.lideeyunji.tool.framework.security.core.LoginUser; 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;
@@ -35,10 +33,9 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; 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.*; import static com.lideeyunji.tool.framework.security.core.util.SecurityFrameworkUtils.*;
import static com.lideeyunji.tool.framework.security.core.util.SecurityFrameworkUtils.getLoginRoleId;
/** /**
* OAuth2.0 Client Service 实现类 * OAuth2.0 Client Service 实现类
@@ -53,6 +50,9 @@ public class OAuth2ClientServiceImpl implements IOAuth2ClientService {
@Resource @Resource
private OAuth2ClientMapper oauth2ClientMapper; private OAuth2ClientMapper oauth2ClientMapper;
@Resource
private OAuth2ClientJoinMapper oAuth2ClientJoinMapper;
@Resource @Resource
private IClientPermissionService clientPermissionService; private IClientPermissionService clientPermissionService;
@Resource @Resource
@@ -163,7 +163,7 @@ public class OAuth2ClientServiceImpl implements IOAuth2ClientService {
Set<Long> clientIds = clientPermissionService.getRoleClientListByRoleId(roleIds); Set<Long> clientIds = clientPermissionService.getRoleClientListByRoleId(roleIds);
pageReqVO.setIds(clientIds); pageReqVO.setIds(clientIds);
} }
return oauth2ClientMapper.selectPage(pageReqVO); return oAuth2ClientJoinMapper.selectPage(pageReqVO);
} }
@Override @Override

View File

@@ -61,6 +61,7 @@ public class OAuth2TokenServiceImpl implements IOAuth2TokenService {
@Lazy // 懒加载,避免循环依赖 @Lazy // 懒加载,避免循环依赖
private IAdminUserService adminUserService; private IAdminUserService adminUserService;
@Override @Override
public OAuth2AccessTokenDO createAccessToken(Long userId, Long lastLoginDeptId, Long lastLoginRoleId, Integer userType, String clientId, List<String> scopes) { public OAuth2AccessTokenDO createAccessToken(Long userId, Long lastLoginDeptId, Long lastLoginRoleId, Integer userType, String clientId, List<String> scopes) {
return createAccessToken(userId, lastLoginDeptId, lastLoginRoleId, userType, clientId, scopes,false); return createAccessToken(userId, lastLoginDeptId, lastLoginRoleId, userType, clientId, scopes,false);
@@ -77,6 +78,16 @@ public class OAuth2TokenServiceImpl implements IOAuth2TokenService {
} }
@Override
public AdminUserDO getTokenTouserInfo(String refreshToken ) {
// 获得用户基本信息
OAuth2AccessTokenDO accessTokenDO= oauth2AccessTokenMapper.selectByAccessToken(refreshToken);
AdminUserDO user = adminUserService.getUser(accessTokenDO.getUserId());
return user;
}
@Override @Override
public OAuth2AccessTokenDO refreshAccessToken(String refreshToken, String clientId) { public OAuth2AccessTokenDO refreshAccessToken(String refreshToken, String clientId) {
boolean supAdmin = SecurityFrameworkUtils.isSupAdmin(); boolean supAdmin = SecurityFrameworkUtils.isSupAdmin();
@@ -110,6 +121,12 @@ public class OAuth2TokenServiceImpl implements IOAuth2TokenService {
return createOAuth2AccessToken(refreshTokenDO, clientDO, supAdmin); return createOAuth2AccessToken(refreshTokenDO, clientDO, supAdmin);
} }
@Override @Override
public OAuth2AccessTokenDO getAccessToken(String accessToken) { public OAuth2AccessTokenDO getAccessToken(String accessToken) {
// 优先从 Redis 中获取 // 优先从 Redis 中获取

View File

@@ -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";//公共包名称