最新公众号管理平台后端

This commit is contained in:
sangchengzhi
2026-01-14 18:06:06 +08:00
commit e4826053ba
4700 changed files with 247006 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4" />

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.jojubanking.boot</groupId>
<artifactId>joju-framework</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>joju-spring-boot-starter-biz-dict</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<description>字典类型、数据</description>
<url>https://www.jojubanking.com</url>
<dependencies>
<dependency>
<groupId>com.jojubanking.boot</groupId>
<artifactId>joju-common</artifactId>
</dependency>
<!-- Spring 核心 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<!-- 业务组件 -->
<dependency>
<groupId>com.jojubanking.boot</groupId>
<artifactId>joju-module-system-api</artifactId> <!-- 需要使用它,进行 Token 的校验 -->
<version>${revision}</version>
</dependency>
<!-- 工具类相关 -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,18 @@
package com.jojubanking.boot.framework.dict.config;
import com.jojubanking.boot.framework.dict.core.util.DictFrameworkUtils;
import com.jojubanking.boot.module.system.api.dict.DictDataApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class JojuDictAutoConfiguration {
@Bean
@SuppressWarnings("InstantiationOfUtilityClass")
public DictFrameworkUtils dictUtils(DictDataApi dictDataApi) {
DictFrameworkUtils.init(dictDataApi);
return new DictFrameworkUtils();
}
}

View File

@@ -0,0 +1,4 @@
/**
* 占位
*/
package com.jojubanking.boot.framework.dict.core;

View File

@@ -0,0 +1,70 @@
package com.jojubanking.boot.framework.dict.core.util;
import cn.hutool.core.util.ObjectUtil;
import com.jojubanking.boot.framework.common.core.KeyValue;
import com.jojubanking.boot.framework.common.util.cache.CacheUtils;
import com.jojubanking.boot.module.system.api.dict.DictDataApi;
import com.jojubanking.boot.module.system.api.dict.dto.DictDataRespDTO;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import java.time.Duration;
/**
* 字典工具类
*
* @author TW
*/
@Slf4j
public class DictFrameworkUtils {
private static DictDataApi dictDataApi;
private static final DictDataRespDTO DICT_DATA_NULL = new DictDataRespDTO();
/**
* 针对 {@link #getDictDataLabel(String, String)} 的缓存
*/
private static final LoadingCache<KeyValue<String, String>, DictDataRespDTO> getDictDataCache = CacheUtils.buildAsyncReloadingCache(
Duration.ofMinutes(1L), // 过期时间 1 分钟
new CacheLoader<KeyValue<String, String>, DictDataRespDTO>() {
@Override
public DictDataRespDTO load(KeyValue<String, String> key) {
return ObjectUtil.defaultIfNull(dictDataApi.getDictData(key.getKey(), key.getValue()), DICT_DATA_NULL);
}
});
/**
* 针对 {@link #parseDictDataValue(String, String)} 的缓存
*/
private static final LoadingCache<KeyValue<String, String>, DictDataRespDTO> parseDictDataCache = CacheUtils.buildAsyncReloadingCache(
Duration.ofMinutes(1L), // 过期时间 1 分钟
new CacheLoader<KeyValue<String, String>, DictDataRespDTO>() {
@Override
public DictDataRespDTO load(KeyValue<String, String> key) {
return ObjectUtil.defaultIfNull(dictDataApi.parseDictData(key.getKey(), key.getValue()), DICT_DATA_NULL);
}
});
public static void init(DictDataApi dictDataApi) {
DictFrameworkUtils.dictDataApi = dictDataApi;
log.info("[init][初始化 DictFrameworkUtils 成功]");
}
@SneakyThrows
public static String getDictDataLabel(String dictType, String value) {
return getDictDataCache.get(new KeyValue<>(dictType, value)).getLabel();
}
@SneakyThrows
public static String parseDictDataValue(String dictType, String label) {
return parseDictDataCache.get(new KeyValue<>(dictType, label)).getValue();
}
}

View File

@@ -0,0 +1,6 @@
/**
* 字典数据模块,提供 {@link com.jojubanking.boot.framework.dict.core.util.DictFrameworkUtils} 工具类
*
* 通过将字典缓存在内存中,保证性能
*/
package com.jojubanking.boot.framework.dict;

View File

@@ -0,0 +1,2 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.jojubanking.boot.framework.dict.config.JojuDictAutoConfiguration

View File

@@ -0,0 +1,2 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.jojubanking.boot.framework.dict.config.JojuDictAutoConfiguration

View File

@@ -0,0 +1,5 @@
#Generated by Maven
#Wed Jan 14 17:48:18 CST 2026
version=2.0.0-beta
groupId=com.jojubanking.boot
artifactId=joju-spring-boot-starter-biz-dict

View File

@@ -0,0 +1,4 @@
com\jojubanking\boot\framework\dict\core\util\DictFrameworkUtils$1.class
com\jojubanking\boot\framework\dict\config\JojuDictAutoConfiguration.class
com\jojubanking\boot\framework\dict\core\util\DictFrameworkUtils.class
com\jojubanking\boot\framework\dict\core\util\DictFrameworkUtils$2.class

View File

@@ -0,0 +1,4 @@
D:\workspace\nxwj\掌医管理平台\jojuboot\joju-framework\joju-spring-boot-starter-biz-dict\src\main\java\com\jojubanking\boot\framework\dict\config\JojuDictAutoConfiguration.java
D:\workspace\nxwj\掌医管理平台\jojuboot\joju-framework\joju-spring-boot-starter-biz-dict\src\main\java\com\jojubanking\boot\framework\dict\core\package-info.java
D:\workspace\nxwj\掌医管理平台\jojuboot\joju-framework\joju-spring-boot-starter-biz-dict\src\main\java\com\jojubanking\boot\framework\dict\package-info.java
D:\workspace\nxwj\掌医管理平台\jojuboot\joju-framework\joju-spring-boot-starter-biz-dict\src\main\java\com\jojubanking\boot\framework\dict\core\util\DictFrameworkUtils.java