Merge remote-tracking branch 'base-version/main' into dev

# Conflicts:
#	zt-framework/zt-spring-boot-starter-test/src/main/java/com/zt/plat/framework/test/core/ut/BaseDbUnitTest.java
#	zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/framework/sms/core/client/impl/SmsClientFactoryImpl.java
#	zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/framework/sms/core/enums/SmsChannelEnum.java
This commit is contained in:
chenbowen
2025-12-12 10:05:36 +08:00
66 changed files with 1326 additions and 211 deletions

View File

@@ -1,7 +1,10 @@
package com.zt.plat.module.system.api.sms;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.system.api.sms.dto.log.SmsLogRespDTO;
import com.zt.plat.module.system.api.sms.dto.send.SmsSendSingleToUserReqDTO;
import com.zt.plat.module.system.service.sms.SmsLogService;
import com.zt.plat.module.system.service.sms.SmsSendService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
@@ -16,6 +19,8 @@ public class SmsSendApiImpl implements SmsSendApi {
@Resource
private SmsSendService smsSendService;
@Resource
private SmsLogService smsLogService;
@Override
public CommonResult<Long> sendSingleSmsToAdmin(SmsSendSingleToUserReqDTO reqDTO) {
@@ -29,4 +34,9 @@ public class SmsSendApiImpl implements SmsSendApi {
reqDTO.getTemplateCode(), reqDTO.getTemplateParams()));
}
@Override
public CommonResult<SmsLogRespDTO> getSmsLog(Long id) {
return success(BeanUtils.toBean(smsLogService.getSmsLog(id), SmsLogRespDTO.class));
}
}

View File

@@ -71,6 +71,14 @@ public class SmsChannelController {
return success(BeanUtils.toBean(pageResult, SmsChannelRespVO.class));
}
@GetMapping("/balance")
@Operation(summary = "查询短信渠道余额")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('system:sms-channel:query')")
public CommonResult<Integer> getBalance(@RequestParam("id") Long id) {
return success(smsChannelService.queryBalance(id));
}
@GetMapping({"/list-all-simple", "/simple-list"})
@Operation(summary = "获得短信渠道精简列表", description = "包含被禁用的短信渠道")
public CommonResult<List<SmsChannelSimpleRespVO>> getSimpleSmsChannelList() {

View File

@@ -32,6 +32,9 @@ public class SmsChannelRespVO {
@NotNull(message = "短信 API 的账号不能为空")
private String apiKey;
@Schema(description = "企业编号epid", example = "123456")
private String epid;
@Schema(description = "短信 API 的密钥", example = "yuanma")
private String apiSecret;

View File

@@ -16,6 +16,9 @@ public class SmsChannelSaveReqVO {
@NotNull(message = "短信签名不能为空")
private String signature;
@Schema(description = "企业编号epid", example = "123456")
private String epid;
@Schema(description = "渠道编码,参见 SmsChannelEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "YUN_PIAN")
@NotNull(message = "渠道编码不能为空")
private String code;

View File

@@ -29,6 +29,9 @@ public class UserPageReqVO extends PageParam {
@Schema(description = "手机号码,模糊匹配", example = "zt")
private String mobile;
@Schema(description = "关键词(昵称/账号/手机号模糊匹配)", example = "张三")
private String keyword;
@Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1")
private Integer status;

View File

@@ -35,6 +35,10 @@ public class SmsChannelDO extends BaseDO {
* 短信签名
*/
private String signature;
/**
* 企业编号epid
*/
private String epid;
/**
* 渠道编码
*

View File

@@ -1,5 +1,6 @@
package com.zt.plat.module.system.dal.mysql.user;
import cn.hutool.core.util.StrUtil;
import com.zt.plat.framework.common.pojo.PageParam;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
@@ -36,18 +37,27 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
}
default PageResult<AdminUserDO> selectPage(UserPageReqVO reqVO, Collection<Long> deptIds, Collection<Long> userIds) {
MPJLambdaWrapperX<AdminUserDO> query = new MPJLambdaWrapperX<>();
query.leftJoin(UserDeptDO.class, UserDeptDO::getUserId, AdminUserDO::getId);
query.likeIfPresent(AdminUserDO::getUsername, reqVO.getUsername());
query.likeIfPresent(AdminUserDO::getWorkcode, reqVO.getWorkcode());
query.likeIfPresent(AdminUserDO::getMobile, reqVO.getMobile());
query.eqIfPresent(AdminUserDO::getStatus, reqVO.getStatus());
query.betweenIfPresent(AdminUserDO::getCreateTime, reqVO.getCreateTime());
query.inIfPresent(UserDeptDO::getDeptId, deptIds);
query.inIfPresent(AdminUserDO::getId, userIds);
query.distinct();
query.orderByDesc(AdminUserDO::getId);
return selectJoinPage(reqVO, AdminUserDO.class, new MPJLambdaWrapperX<AdminUserDO>()
.leftJoin(UserDeptDO.class, UserDeptDO::getUserId, AdminUserDO::getId)
.likeIfPresent(AdminUserDO::getUsername, reqVO.getUsername())
.likeIfPresent(AdminUserDO::getWorkcode, reqVO.getWorkcode())
.likeIfPresent(AdminUserDO::getMobile, reqVO.getMobile())
.eqIfPresent(AdminUserDO::getStatus, reqVO.getStatus())
.betweenIfPresent(AdminUserDO::getCreateTime, reqVO.getCreateTime())
.inIfPresent(UserDeptDO::getDeptId, deptIds)
.inIfPresent(AdminUserDO::getId, userIds)
.distinct()
.orderByDesc(AdminUserDO::getId));
if (StrUtil.isNotBlank(reqVO.getKeyword())) {
String keyword = reqVO.getKeyword().trim();
query.and(w -> w.like(AdminUserDO::getNickname, keyword)
.or().like(AdminUserDO::getUsername, keyword)
.or().like(AdminUserDO::getMobile, keyword)
.or().like(AdminUserDO::getWorkcode, keyword));
}
return selectJoinPage(reqVO, AdminUserDO.class, query);
}
default List<AdminUserDO> selectList(UserPageReqVO reqVO, Collection<Long> deptIds, Collection<Long> userIds) {

View File

@@ -31,7 +31,7 @@ public interface SmsClient {
* @param templateParams 短信模板参数。通过 List 数组,保证参数的顺序
* @return 短信发送结果
*/
SmsSendRespDTO sendSms(Long logId, String mobile, String apiTemplateId,
SmsSendRespDTO sendSms(Long logId, String mobile, String content, String apiTemplateId,
List<KeyValue<String, Object>> templateParams) throws Throwable;
/**

View File

@@ -49,7 +49,7 @@ public class AliyunSmsClient extends AbstractSmsClient {
}
@Override
public SmsSendRespDTO sendSms(Long sendLogId, String mobile, String apiTemplateId,
public SmsSendRespDTO sendSms(Long sendLogId, String mobile, String content, String apiTemplateId,
List<KeyValue<String, Object>> templateParams) throws Throwable {
Assert.notBlank(properties.getSignature(), "短信签名不能为空");
// 1. 执行请求

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