diff --git a/pom.xml b/pom.xml
index fb9408b..a764332 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
4.0.0org.springblade
- BladeX-Boot
+ checkup-apponitmentjar3.0.1.RELEASE
diff --git a/src/main/java/org/springblade/modules/business/controller/NoticeController.java b/src/main/java/org/springblade/modules/business/controller/NoticeController.java
deleted file mode 100644
index 7b9ef42..0000000
--- a/src/main/java/org/springblade/modules/business/controller/NoticeController.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the dreamlu.net developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.modules.business.controller;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
-import com.github.xiaoymin.knife4j.annotations.ApiSort;
-import io.swagger.annotations.*;
-import lombok.AllArgsConstructor;
-import org.springblade.core.boot.ctrl.BladeController;
-import org.springblade.core.launch.constant.AppConstant;
-import org.springblade.core.mp.support.Condition;
-import org.springblade.core.mp.support.Query;
-import org.springblade.core.tenant.annotation.TenantDS;
-import org.springblade.core.tool.api.R;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.modules.business.entity.Notice;
-import org.springblade.modules.business.service.INoticeService;
-import org.springblade.modules.business.vo.NoticeVO;
-import org.springblade.modules.business.wrapper.NoticeWrapper;
-import org.springframework.web.bind.annotation.*;
-import springfox.documentation.annotations.ApiIgnore;
-
-import java.util.Map;
-
-/**
- * 控制器
- *
- * @author Chill
- */
-@TenantDS
-@RestController
-@RequestMapping(AppConstant.APPLICATION_DESK_NAME + "/notice")
-@AllArgsConstructor
-@ApiSort(2)
-@Api(value = "用户博客", tags = "博客接口")
-public class NoticeController extends BladeController {
-
- private final INoticeService noticeService;
-
- /**
- * 详情
- */
- @GetMapping("/detail")
- @ApiOperationSupport(order = 1)
- @ApiOperation(value = "详情", notes = "传入notice")
- public R detail(Notice notice) {
- Notice detail = noticeService.getOne(Condition.getQueryWrapper(notice));
- return R.data(NoticeWrapper.build().entityVO(detail));
- }
-
- /**
- * 分页
- */
- @GetMapping("/list")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "category", value = "公告类型", paramType = "query", dataType = "integer"),
- @ApiImplicitParam(name = "title", value = "公告标题", paramType = "query", dataType = "string")
- })
- @ApiOperationSupport(order = 2)
- @ApiOperation(value = "分页", notes = "传入notice")
- public R> list(@ApiIgnore @RequestParam Map notice, Query query) {
- NoticeWrapper.build().noticeQuery(notice);
- IPage pages = noticeService.page(Condition.getPage(query), Condition.getQueryWrapper(notice, Notice.class));
- return R.data(NoticeWrapper.build().pageVO(pages));
- }
-
- /**
- * 多表联合查询自定义分页
- */
- @GetMapping("/page")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "category", value = "公告类型", paramType = "query", dataType = "integer"),
- @ApiImplicitParam(name = "title", value = "公告标题", paramType = "query", dataType = "string")
- })
- @ApiOperationSupport(order = 3)
- @ApiOperation(value = "分页", notes = "传入notice")
- public R> page(@ApiIgnore NoticeVO notice, Query query) {
- IPage pages = noticeService.selectNoticePage(Condition.getPage(query), notice);
- return R.data(pages);
- }
-
- /**
- * 新增
- */
- @PostMapping("/save")
- @ApiOperationSupport(order = 4)
- @ApiOperation(value = "新增", notes = "传入notice")
- public R save(@RequestBody Notice notice) {
- return R.status(noticeService.save(notice));
- }
-
- /**
- * 修改
- */
- @PostMapping("/update")
- @ApiOperationSupport(order = 5)
- @ApiOperation(value = "修改", notes = "传入notice")
- public R update(@RequestBody Notice notice) {
- return R.status(noticeService.updateById(notice));
- }
-
- /**
- * 新增或修改
- */
- @PostMapping("/submit")
- @ApiOperationSupport(order = 6)
- @ApiOperation(value = "新增或修改", notes = "传入notice")
- public R submit(@RequestBody Notice notice) {
- return R.status(noticeService.saveOrUpdate(notice));
- }
-
- /**
- * 删除
- */
- @PostMapping("/remove")
- @ApiOperationSupport(order = 7)
- @ApiOperation(value = "逻辑删除", notes = "传入notice")
- public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
- boolean temp = noticeService.deleteLogic(Func.toLongList(ids));
- return R.status(temp);
- }
-
-}
diff --git a/src/main/java/org/springblade/modules/business/entity/Notice.java b/src/main/java/org/springblade/modules/business/entity/Notice.java
deleted file mode 100644
index b6800c0..0000000
--- a/src/main/java/org/springblade/modules/business/entity/Notice.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the dreamlu.net developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.modules.business.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import org.springblade.core.tenant.mp.TenantEntity;
-
-import java.util.Date;
-
-/**
- * 实体类
- *
- * @author Chill
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-@TableName("blade_notice")
-public class Notice extends TenantEntity {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 标题
- */
- @ApiModelProperty(value = "标题")
- private String title;
-
- /**
- * 通知类型
- */
- @ApiModelProperty(value = "通知类型")
- private Integer category;
-
- /**
- * 发布日期
- */
- @ApiModelProperty(value = "发布日期")
- private Date releaseTime;
-
- /**
- * 内容
- */
- @ApiModelProperty(value = "内容")
- private String content;
-
-
-}
diff --git a/src/main/java/org/springblade/modules/business/mapper/NoticeMapper.java b/src/main/java/org/springblade/modules/business/mapper/NoticeMapper.java
deleted file mode 100644
index d0435ef..0000000
--- a/src/main/java/org/springblade/modules/business/mapper/NoticeMapper.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the dreamlu.net developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.modules.business.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import org.springblade.modules.business.entity.Notice;
-import org.springblade.modules.business.vo.NoticeVO;
-
-import java.util.List;
-
-/**
- * Mapper 接口
- *
- * @author Chill
- */
-public interface NoticeMapper extends BaseMapper {
-
- /**
- * 前N条数据
- *
- * @param number 数量
- * @return List
- */
- List topList(Integer number);
-
- /**
- * 自定义分页
- *
- * @param page 分页
- * @param notice 实体
- * @return List
- */
- List selectNoticePage(IPage page, NoticeVO notice);
-
-}
diff --git a/src/main/java/org/springblade/modules/business/mapper/NoticeMapper.xml b/src/main/java/org/springblade/modules/business/mapper/NoticeMapper.xml
deleted file mode 100644
index 94d2813..0000000
--- a/src/main/java/org/springblade/modules/business/mapper/NoticeMapper.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/main/java/org/springblade/modules/business/service/IApmRecordService.java b/src/main/java/org/springblade/modules/business/service/IApmRecordService.java
index f838480..9cc35c2 100644
--- a/src/main/java/org/springblade/modules/business/service/IApmRecordService.java
+++ b/src/main/java/org/springblade/modules/business/service/IApmRecordService.java
@@ -1,15 +1,11 @@
package org.springblade.modules.business.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
-import org.apache.ibatis.annotations.Param;
import org.springblade.core.mp.base.BaseService;
-import org.springblade.core.mp.support.Query;
import org.springblade.modules.business.dto.ApmRecordCountDTO;
import org.springblade.modules.business.entity.ApmRecord;
import org.springblade.modules.business.vo.ApmRecordListVO;
import org.springblade.modules.business.vo.ApmRecordVO;
-import org.springblade.modules.business.vo.NoticeVO;
-import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
diff --git a/src/main/java/org/springblade/modules/business/service/INoticeService.java b/src/main/java/org/springblade/modules/business/service/INoticeService.java
deleted file mode 100644
index 17e159a..0000000
--- a/src/main/java/org/springblade/modules/business/service/INoticeService.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the dreamlu.net developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.modules.business.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import org.springblade.core.mp.base.BaseService;
-import org.springblade.modules.business.entity.Notice;
-import org.springblade.modules.business.vo.NoticeVO;
-
-/**
- * 服务类
- *
- * @author Chill
- */
-public interface INoticeService extends BaseService {
-
- /**
- * 自定义分页
- * @param page
- * @param notice
- * @return
- */
- IPage selectNoticePage(IPage page, NoticeVO notice);
-
-}
diff --git a/src/main/java/org/springblade/modules/business/service/impl/NoticeServiceImpl.java b/src/main/java/org/springblade/modules/business/service/impl/NoticeServiceImpl.java
deleted file mode 100644
index 2488554..0000000
--- a/src/main/java/org/springblade/modules/business/service/impl/NoticeServiceImpl.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the dreamlu.net developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.modules.business.service.impl;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import org.springblade.core.mp.base.BaseServiceImpl;
-import org.springblade.core.secure.utils.AuthUtil;
-import org.springblade.modules.business.entity.Notice;
-import org.springblade.modules.business.mapper.NoticeMapper;
-import org.springblade.modules.business.service.INoticeService;
-import org.springblade.modules.business.vo.NoticeVO;
-import org.springframework.stereotype.Service;
-
-/**
- * 服务实现类
- *
- * @author Chill
- */
-@Service
-public class NoticeServiceImpl extends BaseServiceImpl implements INoticeService {
-
- @Override
- public IPage selectNoticePage(IPage page, NoticeVO notice) {
- // 若不使用mybatis-plus自带的分页方法,则不会自动带入tenantId,所以我们需要自行注入
- notice.setTenantId(AuthUtil.getTenantId());
- return page.setRecords(baseMapper.selectNoticePage(page, notice));
- }
-
-}
diff --git a/src/main/java/org/springblade/modules/business/vo/NoticeVO.java b/src/main/java/org/springblade/modules/business/vo/NoticeVO.java
deleted file mode 100644
index 3e7309d..0000000
--- a/src/main/java/org/springblade/modules/business/vo/NoticeVO.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.springblade.modules.business.vo;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import org.springblade.modules.business.entity.Notice;
-
-/**
- * 通知公告视图类
- *
- * @author Chill
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-public class NoticeVO extends Notice {
-
- @ApiModelProperty(value = "通知类型名")
- private String categoryName;
-
- @ApiModelProperty(value = "租户编号")
- private String tenantId;
-
-}
diff --git a/src/main/java/org/springblade/modules/business/wrapper/NoticeWrapper.java b/src/main/java/org/springblade/modules/business/wrapper/NoticeWrapper.java
deleted file mode 100644
index 38f5dc4..0000000
--- a/src/main/java/org/springblade/modules/business/wrapper/NoticeWrapper.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the dreamlu.net developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.modules.business.wrapper;
-
-import org.springblade.common.cache.DictCache;
-import org.springblade.common.enums.DictEnum;
-import org.springblade.core.mp.support.BaseEntityWrapper;
-import org.springblade.core.tool.utils.BeanUtil;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.modules.business.entity.Notice;
-import org.springblade.modules.business.vo.NoticeVO;
-
-import java.util.Map;
-import java.util.Objects;
-
-/**
- * Notice包装类,返回视图层所需的字段
- *
- * @author Chill
- */
-public class NoticeWrapper extends BaseEntityWrapper {
-
- public static NoticeWrapper build() {
- return new NoticeWrapper();
- }
-
- @Override
- public NoticeVO entityVO(Notice notice) {
- NoticeVO noticeVO = Objects.requireNonNull(BeanUtil.copy(notice, NoticeVO.class));
- String dictValue = DictCache.getValue(DictEnum.NOTICE, noticeVO.getCategory());
- noticeVO.setCategoryName(dictValue);
- return noticeVO;
- }
-
- /**
- * 查询条件处理
- */
- public void noticeQuery(Map notice) {
- // 此场景仅在 pg数据库 map类型传参的情况下需要处理,entity传参已经包含数据类型,则无需关心
- // 针对 pg数据库 int类型字段查询需要强转的处理示例
- String searchKey = "category";
- if (Func.isNotEmpty(notice.get(searchKey))) {
- // 数据库字段为int类型,设置"="查询,具体查询参数请见 @org.springblade.core.mp.support.SqlKeyword
- notice.put(searchKey.concat("_equal"), Func.toInt(notice.get(searchKey)));
- // 默认"like"查询,pg数据库 场景会报错,所以将其删除
- notice.remove(searchKey);
- }
- }
-
-}
diff --git a/src/main/java/org/springblade/modules/resource/builder/sms/AliSmsBuilder.java b/src/main/java/org/springblade/modules/resource/builder/sms/AliSmsBuilder.java
deleted file mode 100644
index b33312c..0000000
--- a/src/main/java/org/springblade/modules/resource/builder/sms/AliSmsBuilder.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the dreamlu.net developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.modules.resource.builder.sms;
-
-import com.aliyuncs.DefaultAcsClient;
-import com.aliyuncs.IAcsClient;
-import com.aliyuncs.profile.DefaultProfile;
-import com.aliyuncs.profile.IClientProfile;
-import lombok.SneakyThrows;
-import org.springblade.core.redis.cache.BladeRedis;
-import org.springblade.core.sms.SmsTemplate;
-import org.springblade.core.sms.AliSmsTemplate;
-import org.springblade.core.sms.props.SmsProperties;
-import org.springblade.modules.resource.entity.Sms;
-
-/**
- * 阿里云短信构建类
- *
- * @author Chill
- */
-public class AliSmsBuilder {
-
- @SneakyThrows
- public static SmsTemplate template(Sms sms, BladeRedis bladeRedis) {
- SmsProperties smsProperties = new SmsProperties();
- smsProperties.setTemplateId(sms.getTemplateId());
- smsProperties.setAccessKey(sms.getAccessKey());
- smsProperties.setSecretKey(sms.getSecretKey());
- smsProperties.setRegionId(sms.getRegionId());
- smsProperties.setSignName(sms.getSignName());
- IClientProfile profile = DefaultProfile.getProfile(smsProperties.getRegionId(), smsProperties.getAccessKey(), smsProperties.getSecretKey());
- IAcsClient acsClient = new DefaultAcsClient(profile);
- return new AliSmsTemplate(smsProperties, acsClient, bladeRedis);
- }
-
-}
diff --git a/src/main/java/org/springblade/modules/resource/builder/sms/QiniuSmsBuilder.java b/src/main/java/org/springblade/modules/resource/builder/sms/QiniuSmsBuilder.java
deleted file mode 100644
index e104e9c..0000000
--- a/src/main/java/org/springblade/modules/resource/builder/sms/QiniuSmsBuilder.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the dreamlu.net developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.modules.resource.builder.sms;
-
-import com.qiniu.sms.SmsManager;
-import com.qiniu.util.Auth;
-import lombok.SneakyThrows;
-import org.springblade.core.redis.cache.BladeRedis;
-import org.springblade.core.sms.SmsTemplate;
-import org.springblade.core.sms.props.SmsProperties;
-import org.springblade.core.sms.QiniuSmsTemplate;
-import org.springblade.modules.resource.entity.Sms;
-
-/**
- * 七牛云短信构建类
- *
- * @author Chill
- */
-public class QiniuSmsBuilder {
-
- @SneakyThrows
- public static SmsTemplate template(Sms sms, BladeRedis bladeRedis) {
- SmsProperties smsProperties = new SmsProperties();
- smsProperties.setTemplateId(sms.getTemplateId());
- smsProperties.setAccessKey(sms.getAccessKey());
- smsProperties.setSecretKey(sms.getSecretKey());
- smsProperties.setSignName(sms.getSignName());
- Auth auth = Auth.create(smsProperties.getAccessKey(), smsProperties.getSecretKey());
- SmsManager smsManager = new SmsManager(auth);
- return new QiniuSmsTemplate(smsProperties, smsManager, bladeRedis);
- }
-
-}
diff --git a/src/main/java/org/springblade/modules/resource/builder/sms/SmsBuilder.java b/src/main/java/org/springblade/modules/resource/builder/sms/SmsBuilder.java
deleted file mode 100644
index 0080099..0000000
--- a/src/main/java/org/springblade/modules/resource/builder/sms/SmsBuilder.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the dreamlu.net developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.modules.resource.builder.sms;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import org.springblade.core.cache.utils.CacheUtil;
-import org.springblade.core.log.exception.ServiceException;
-import org.springblade.core.redis.cache.BladeRedis;
-import org.springblade.core.secure.utils.AuthUtil;
-import org.springblade.core.sms.SmsTemplate;
-import org.springblade.core.sms.enums.SmsEnum;
-import org.springblade.core.sms.enums.SmsStatusEnum;
-import org.springblade.core.sms.props.SmsProperties;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.core.tool.utils.StringPool;
-import org.springblade.core.tool.utils.StringUtil;
-import org.springblade.core.tool.utils.WebUtil;
-import org.springblade.modules.resource.entity.Sms;
-import org.springblade.modules.resource.service.ISmsService;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import static org.springblade.core.cache.constant.CacheConstant.RESOURCE_CACHE;
-
-/**
- * Sms短信服务统一构建类
- *
- * @author Chill
- */
-public class SmsBuilder {
-
- public static final String SMS_CODE = "sms:code:";
- public static final String SMS_PARAM_KEY = "code";
-
- private final SmsProperties smsProperties;
- private final ISmsService smsService;
- private final BladeRedis bladeRedis;
-
-
- public SmsBuilder(SmsProperties smsProperties, ISmsService smsService, BladeRedis bladeRedis) {
- this.smsProperties = smsProperties;
- this.smsService = smsService;
- this.bladeRedis = bladeRedis;
- }
-
- /**
- * SmsTemplate配置缓存池
- */
- private final Map templatePool = new ConcurrentHashMap<>();
-
- /**
- * Sms配置缓存池
- */
- private final Map smsPool = new ConcurrentHashMap<>();
-
-
- /**
- * 获取template
- *
- * @return SmsTemplate
- */
- public SmsTemplate template() {
- return template(StringPool.EMPTY);
- }
-
- /**
- * 获取template
- *
- * @param code 资源编号
- * @return SmsTemplate
- */
- public SmsTemplate template(String code) {
- String tenantId = AuthUtil.getTenantId();
- Sms sms = getSms(tenantId, code);
- Sms smsCached = smsPool.get(tenantId);
- SmsTemplate template = templatePool.get(tenantId);
- // 若为空或者不一致,则重新加载
- if (Func.hasEmpty(template, smsCached) || !sms.getTemplateId().equals(smsCached.getTemplateId()) || !sms.getAccessKey().equals(smsCached.getAccessKey())) {
- synchronized (SmsBuilder.class) {
- template = templatePool.get(tenantId);
- if (Func.hasEmpty(template, smsCached) || !sms.getTemplateId().equals(smsCached.getTemplateId()) || !sms.getAccessKey().equals(smsCached.getAccessKey())) {
- if (sms.getCategory() == SmsEnum.YUNPIAN.getCategory()) {
- template = YunpianSmsBuilder.template(sms, bladeRedis);
- } else if (sms.getCategory() == SmsEnum.QINIU.getCategory()) {
- template = QiniuSmsBuilder.template(sms, bladeRedis);
- } else if (sms.getCategory() == SmsEnum.ALI.getCategory()) {
- template = AliSmsBuilder.template(sms, bladeRedis);
- } else if (sms.getCategory() == SmsEnum.TENCENT.getCategory()) {
- template = TencentSmsBuilder.template(sms, bladeRedis);
- }
- templatePool.put(tenantId, template);
- smsPool.put(tenantId, sms);
- }
- }
- }
- return template;
- }
-
-
- /**
- * 获取短信实体
- *
- * @param tenantId 租户ID
- * @return Sms
- */
- public Sms getSms(String tenantId, String code) {
- String key = tenantId;
- LambdaQueryWrapper lqw = Wrappers.query().lambda().eq(Sms::getTenantId, tenantId);
- // 获取传参的资源编号并查询,若有则返回,若没有则调启用的配置
- String smsCode = StringUtil.isBlank(code) ? WebUtil.getParameter(SMS_PARAM_KEY) : code;
- if (StringUtil.isNotBlank(smsCode)) {
- key = key.concat(StringPool.DASH).concat(smsCode);
- lqw.eq(Sms::getSmsCode, smsCode);
- } else {
- lqw.eq(Sms::getStatus, SmsStatusEnum.ENABLE.getNum());
- }
- Sms sms = CacheUtil.get(RESOURCE_CACHE, SMS_CODE, key, () -> {
- Sms s = smsService.getOne(lqw);
- // 若为空则调用默认配置
- if ((Func.isEmpty(s))) {
- Sms defaultSms = new Sms();
- defaultSms.setId(0L);
- defaultSms.setTemplateId(smsProperties.getTemplateId());
- defaultSms.setRegionId(smsProperties.getRegionId());
- defaultSms.setCategory(SmsEnum.of(smsProperties.getName()).getCategory());
- defaultSms.setAccessKey(smsProperties.getAccessKey());
- defaultSms.setSecretKey(smsProperties.getSecretKey());
- defaultSms.setSignName(smsProperties.getSignName());
- return defaultSms;
- } else {
- return s;
- }
- });
- if (sms == null || sms.getId() == null) {
- throw new ServiceException("未获取到对应的短信配置");
- } else {
- return sms;
- }
- }
-
-}
diff --git a/src/main/java/org/springblade/modules/resource/builder/sms/TencentSmsBuilder.java b/src/main/java/org/springblade/modules/resource/builder/sms/TencentSmsBuilder.java
deleted file mode 100644
index 293e651..0000000
--- a/src/main/java/org/springblade/modules/resource/builder/sms/TencentSmsBuilder.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the dreamlu.net developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.modules.resource.builder.sms;
-
-import com.github.qcloudsms.SmsMultiSender;
-import lombok.SneakyThrows;
-import org.springblade.core.redis.cache.BladeRedis;
-import org.springblade.core.sms.SmsTemplate;
-import org.springblade.core.sms.props.SmsProperties;
-import org.springblade.core.sms.TencentSmsTemplate;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.modules.resource.entity.Sms;
-
-/**
- * 腾讯云短信构建类
- *
- * @author Chill
- */
-public class TencentSmsBuilder {
-
- @SneakyThrows
- public static SmsTemplate template(Sms sms, BladeRedis bladeRedis) {
- SmsProperties smsProperties = new SmsProperties();
- smsProperties.setTemplateId(sms.getTemplateId());
- smsProperties.setAccessKey(sms.getAccessKey());
- smsProperties.setSecretKey(sms.getSecretKey());
- smsProperties.setSignName(sms.getSignName());
- SmsMultiSender smsSender = new SmsMultiSender(Func.toInt(smsProperties.getAccessKey()), sms.getSecretKey());
- return new TencentSmsTemplate(smsProperties, smsSender, bladeRedis);
- }
-
-}
diff --git a/src/main/java/org/springblade/modules/resource/builder/sms/YunpianSmsBuilder.java b/src/main/java/org/springblade/modules/resource/builder/sms/YunpianSmsBuilder.java
deleted file mode 100644
index 7860077..0000000
--- a/src/main/java/org/springblade/modules/resource/builder/sms/YunpianSmsBuilder.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the dreamlu.net developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.modules.resource.builder.sms;
-
-import com.yunpian.sdk.YunpianClient;
-import lombok.SneakyThrows;
-import org.springblade.core.redis.cache.BladeRedis;
-import org.springblade.core.sms.SmsTemplate;
-import org.springblade.core.sms.props.SmsProperties;
-import org.springblade.core.sms.YunpianSmsTemplate;
-import org.springblade.modules.resource.entity.Sms;
-
-/**
- * 云片短信构建类
- *
- * @author Chill
- */
-public class YunpianSmsBuilder {
-
- @SneakyThrows
- public static SmsTemplate template(Sms sms, BladeRedis bladeRedis) {
- SmsProperties smsProperties = new SmsProperties();
- smsProperties.setTemplateId(sms.getTemplateId());
- smsProperties.setAccessKey(sms.getAccessKey());
- smsProperties.setSignName(sms.getSignName());
- YunpianClient client = new YunpianClient(smsProperties.getAccessKey()).init();
- return new YunpianSmsTemplate(smsProperties, client, bladeRedis);
- }
-
-}
diff --git a/src/main/java/org/springblade/modules/resource/config/BladeSmsConfiguration.java b/src/main/java/org/springblade/modules/resource/config/BladeSmsConfiguration.java
deleted file mode 100644
index 510bbba..0000000
--- a/src/main/java/org/springblade/modules/resource/config/BladeSmsConfiguration.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the dreamlu.net developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.modules.resource.config;
-
-import lombok.AllArgsConstructor;
-import org.springblade.core.redis.cache.BladeRedis;
-import org.springblade.core.sms.props.SmsProperties;
-import org.springblade.modules.resource.builder.sms.SmsBuilder;
-import org.springblade.modules.resource.service.ISmsService;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * Sms配置类
- *
- * @author Chill
- */
-@Configuration(proxyBeanMethods = false)
-@AllArgsConstructor
-public class BladeSmsConfiguration {
-
- private final SmsProperties smsProperties;
-
- private final ISmsService smsService;
-
- private final BladeRedis bladeRedis;
-
- @Bean
- public SmsBuilder smsBuilder() {
- return new SmsBuilder(smsProperties, smsService, bladeRedis);
- }
-
-}
diff --git a/src/main/java/org/springblade/modules/resource/enums/SmsCodeEnum.java b/src/main/java/org/springblade/modules/resource/enums/SmsCodeEnum.java
deleted file mode 100644
index 1c46e27..0000000
--- a/src/main/java/org/springblade/modules/resource/enums/SmsCodeEnum.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the dreamlu.net developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.modules.resource.enums;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import org.springblade.core.tool.utils.StringPool;
-
-/**
- * Sms资源编码枚举类
- *
- * @author Chill
- * @apiNote 该枚举类对应短信配置模块的资源编码,可根据业务需求自行拓展
- */
-@Getter
-@AllArgsConstructor
-public enum SmsCodeEnum {
-
- /**
- * 默认编号
- */
- DEFAULT(StringPool.EMPTY, 1),
-
- /**
- * 验证码编号
- */
- VALIDATE("qiniu-validate", 2),
-
- /**
- * 通知公告编号
- */
- NOTICE("notice", 3),
-
- /**
- * 下单通知编号
- */
- ORDER("order", 4),
-
- /**
- * 会议通知编号
- */
- MEETING("meeting", 5),
- ;
-
- final String name;
- final int category;
-
-}
diff --git a/src/main/java/org/springblade/modules/resource/utils/SmsUtil.java b/src/main/java/org/springblade/modules/resource/utils/SmsUtil.java
deleted file mode 100644
index 4ed8c15..0000000
--- a/src/main/java/org/springblade/modules/resource/utils/SmsUtil.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the dreamlu.net developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.modules.resource.utils;
-
-import org.springblade.core.sms.model.SmsCode;
-import org.springblade.core.sms.model.SmsData;
-import org.springblade.core.sms.model.SmsResponse;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.core.tool.utils.RandomType;
-import org.springblade.core.tool.utils.SpringUtil;
-import org.springblade.core.tool.utils.StringUtil;
-import org.springblade.modules.resource.builder.sms.SmsBuilder;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * 短信服务工具类
- *
- * @author Chill
- */
-public class SmsUtil {
-
- public static final String PARAM_KEY = "code";
- public static final String SEND_SUCCESS = "短信发送成功";
- public static final String SEND_FAIL = "短信发送失败";
- public static final String VALIDATE_SUCCESS = "短信校验成功";
- public static final String VALIDATE_FAIL = "短信校验失败";
-
-
- private static SmsBuilder smsBuilder;
-
- /**
- * 获取短信服务构建类
- *
- * @return SmsBuilder
- */
- public static SmsBuilder getBuilder() {
- if (smsBuilder == null) {
- smsBuilder = SpringUtil.getBean(SmsBuilder.class);
- }
- return smsBuilder;
- }
-
- /**
- * 获取短信验证码参数
- *
- * @return 验证码参数
- */
- public static Map getValidateParams() {
- Map params = new HashMap<>(1);
- params.put(PARAM_KEY, StringUtil.random(6, RandomType.INT));
- return params;
- }
-
- /**
- * 发送短信
- *
- * @param code 资源编号
- * @param params 模板参数
- * @param phones 手机号集合
- * @return 发送结果
- */
- public static SmsResponse sendMessage(String code, Map params, String phones) {
- SmsData smsData = new SmsData(params);
- return getBuilder().template(code).sendMessage(smsData, Func.toStrList(phones));
- }
-
- /**
- * 发送验证码
- *
- * @param code 资源编号
- * @param phone 手机号
- * @return 发送结果
- */
- public static SmsCode sendValidate(String code, String phone) {
- Map params = SmsUtil.getValidateParams();
- return getBuilder().template(code).sendValidate(new SmsData(params).setKey(PARAM_KEY), phone);
- }
-
- /**
- * 校验短信
- *
- * @param code 资源编号
- * @param id 校验id
- * @param value 校验值
- * @param phone 手机号
- * @return 发送结果
- */
- public static boolean validateMessage(String code, String id, String value, String phone) {
- SmsCode smsCode = new SmsCode().setId(id).setValue(value).setPhone(phone);
- return getBuilder().template(code).validateMessage(smsCode);
- }
-
-}