Merge branch 'refs/heads/zt-test' into test

This commit is contained in:
FCL
2026-02-04 11:25:07 +08:00
3407 changed files with 829 additions and 259881 deletions

View File

@@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>zt-module-system</artifactId>
<artifactId>zt-module-system-dsc</artifactId>
<groupId>com.zt.plat</groupId>
<version>${revision}</version>
</parent>
@@ -24,6 +24,13 @@
<version>${revision}</version>
</dependency>
<!-- Test 测试相关 -->
<dependency>
<groupId>com.zt.plat</groupId>
<artifactId>zt-spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>

View File

@@ -0,0 +1,93 @@
package com.zt.plat.module.system.framework.sms.core.client.impl;
import com.zt.plat.module.system.framework.sms.core.client.SmsClient;
import com.zt.plat.module.system.framework.sms.core.client.SmsClientFactory;
import com.zt.plat.module.system.framework.sms.core.enums.SmsChannelEnum;
import com.zt.plat.module.system.framework.sms.core.property.SmsChannelProperties;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.Assert;
import org.springframework.validation.annotation.Validated;
import java.util.Arrays;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/**
* 短信客户端工厂接口
*
* @author zzf
*/
@Validated
@Slf4j
public class SmsClientFactoryImpl implements SmsClientFactory {
/**
* 短信客户端 Map
* key渠道编号使用 {@link SmsChannelProperties#getId()}
*/
private final ConcurrentMap<Long, AbstractSmsClient> channelIdClients = new ConcurrentHashMap<>();
/**
* 短信客户端 Map
* key渠道编码使用 {@link SmsChannelProperties#getCode()} ()}
*
* 注意,一些场景下,需要获得某个渠道类型的客户端,所以需要使用它。
* 例如说,解析短信接收结果,是相对通用的,不需要使用某个渠道编号的 {@link #channelIdClients}
*/
private final ConcurrentMap<String, AbstractSmsClient> channelCodeClients = new ConcurrentHashMap<>();
public SmsClientFactoryImpl() {
// 初始化 channelCodeClients 集合
Arrays.stream(SmsChannelEnum.values()).forEach(channel -> {
// 创建一个空的 SmsChannelProperties 对象
SmsChannelProperties properties = new SmsChannelProperties().setCode(channel.getCode())
.setApiKey("default default").setApiSecret("default");
// 创建 Sms 客户端
AbstractSmsClient smsClient = createSmsClient(properties);
channelCodeClients.put(channel.getCode(), smsClient);
});
}
@Override
public SmsClient getSmsClient(Long channelId) {
return channelIdClients.get(channelId);
}
@Override
public SmsClient getSmsClient(String channelCode) {
return channelCodeClients.get(channelCode);
}
@Override
public SmsClient createOrUpdateSmsClient(SmsChannelProperties properties) {
AbstractSmsClient client = channelIdClients.get(properties.getId());
if (client == null) {
client = this.createSmsClient(properties);
client.init();
channelIdClients.put(client.getId(), client);
} else {
client.refresh(properties);
}
return client;
}
private AbstractSmsClient createSmsClient(SmsChannelProperties properties) {
SmsChannelEnum channelEnum = SmsChannelEnum.getByCode(properties.getCode());
Assert.notNull(channelEnum, String.format("渠道类型(%s) 为空", channelEnum));
// 创建客户端
switch (channelEnum) {
case ALIYUN: return new AliyunSmsClient(properties);
case DEBUG_DING_TALK: return new DebugDingTalkSmsClient(properties);
case TENCENT: return new TencentSmsClient(properties);
case HUAWEI: return new HuaweiSmsClient(properties);
case QINIU: return new QiniuSmsClient(properties);
// case CMCC_MAS: return new CmccMasSmsClient(properties);
case HL95: return new Hl95SmsClient(properties);
case ZLE: return new ZleSmsClient(properties);
}
// 创建失败,错误日志 + 抛出异常
log.error("[createSmsClient][配置({}) 找不到合适的客户端实现]", properties);
throw new IllegalArgumentException(String.format("配置(%s) 找不到合适的客户端实现", properties));
}
}

View File

@@ -0,0 +1,41 @@
package com.zt.plat.module.system.framework.sms.core.enums;
import cn.hutool.core.util.ArrayUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 短信渠道枚举
*
* @author zzf
* @since 2021/1/25 10:56
*/
@Getter
@AllArgsConstructor
public enum SmsChannelEnum {
DEBUG_DING_TALK("DEBUG_DING_TALK", "调试(钉钉)"),
ALIYUN("ALIYUN", "阿里云"),
TENCENT("TENCENT", "腾讯云"),
HUAWEI("HUAWEI", "华为云"),
QINIU("QINIU", "七牛云"),
HL95("HL95", "鸿联九五"),
// CMCC_MAS("CMCC_MAS", "中国移动云MAS"),
ZLE("ZLE", "中铝e办"),
;
/**
* 编码
*/
private final String code;
/**
* 名字
*/
private final String name;
public static SmsChannelEnum getByCode(String code) {
return ArrayUtil.firstMatch(o -> o.getCode().equals(code), values());
}
}

View File

@@ -0,0 +1,40 @@
package com.zt.plat.module.system.job.sync;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.zt.plat.framework.tenant.core.job.TenantJob;
import com.zt.plat.module.system.service.sync.SyncIWorkOrgChangeService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* 用于定时同步 iWork 当日变更的组织数据
* 同步时间每日23:00
*/
@Component
@Slf4j
public class SyncIWorkOrgChangeJob {
@Resource
private SyncIWorkOrgChangeService syncIWorkOrgChangeService;
/**
* 执行定时任务
* 配置执行频率每日23:00时执行一次
* cron表达式0 0 23 * * ?
*/
@XxlJob("syncIWorkOrgChangeJob")
@TenantJob
public void execute() {
log.info("[syncIWorkOrgChangeJob][开始执行同步 iWork 当日变更组织任务]");
try {
int processedCount = syncIWorkOrgChangeService.process();
if (processedCount > 0) {
log.info("[syncIWorkOrgChangeJob][同步任务执行完成,处理了 {} 条记录]", processedCount);
}
} catch (Exception e) {
log.error("[syncIWorkOrgChangeJob][同步任务执行失败]", e);
throw e;
}
}
}

View File

@@ -0,0 +1,70 @@
package com.zt.plat.module.system.service.portal;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.system.controller.admin.portal.vo.PortalPageReqVO;
import com.zt.plat.module.system.controller.admin.portal.vo.PortalSaveReqVO;
import com.zt.plat.module.system.dal.dataobject.portal.PortalDO;
import java.util.List;
/**
* 门户网站 Service 接口
*
* @author 中铜数字供应链平台
*/
public interface PortalService {
/**
* 创建门户
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createPortal(PortalSaveReqVO createReqVO);
/**
* 更新门户
*
* @param updateReqVO 更新信息
*/
void updatePortal(PortalSaveReqVO updateReqVO);
/**
* 删除门户
*
* @param id 编号
*/
void deletePortal(Long id);
/**
* 获得门户
*
* @param id 编号
* @return 门户
*/
PortalDO getPortal(Long id);
/**
* 获得门户分页
*
* @param pageReqVO 分页查询
* @return 门户分页
*/
PageResult<PortalDO> getPortalPage(PortalPageReqVO pageReqVO);
/**
* 获得用户有权限访问的门户列表
*
* @param userId 用户ID
* @return 门户列表
*/
List<PortalDO> getPortalListByUserId(Long userId);
/**
* 获得公开门户列表(无需登录)
*
* @return 门户列表
*/
List<PortalDO> getPublicPortalList();
}

View File

@@ -0,0 +1,13 @@
package com.zt.plat.module.system.service.sync;
/**
* 定时同步 iWork 组织变更服务
*/
public interface SyncIWorkOrgChangeService {
/**
* 执行同步
* @return 拉取记录数量
*/
int process();
}

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