From f72c88eb30e083da0b3a45c0d1b80b822a11e7a5 Mon Sep 17 00:00:00 2001 From: liuqingkun Date: Tue, 21 Mar 2023 16:06:02 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BC=98=E5=8C=96]=E5=88=A0=E9=99=A4sms?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/resource/entity/Sms.java | 82 ------------------- .../modules/resource/mapper/SmsMapper.java | 42 ---------- .../modules/resource/mapper/SmsMapper.xml | 30 ------- .../modules/resource/service/ISmsService.java | 56 ------------- .../resource/service/impl/SmsServiceImpl.java | 67 --------------- .../modules/resource/vo/SmsVO.java | 45 ---------- .../modules/resource/wrapper/SmsWrapper.java | 49 ----------- 7 files changed, 371 deletions(-) delete mode 100644 src/main/java/org/springblade/modules/resource/entity/Sms.java delete mode 100644 src/main/java/org/springblade/modules/resource/mapper/SmsMapper.java delete mode 100644 src/main/java/org/springblade/modules/resource/mapper/SmsMapper.xml delete mode 100644 src/main/java/org/springblade/modules/resource/service/ISmsService.java delete mode 100644 src/main/java/org/springblade/modules/resource/service/impl/SmsServiceImpl.java delete mode 100644 src/main/java/org/springblade/modules/resource/vo/SmsVO.java delete mode 100644 src/main/java/org/springblade/modules/resource/wrapper/SmsWrapper.java diff --git a/src/main/java/org/springblade/modules/resource/entity/Sms.java b/src/main/java/org/springblade/modules/resource/entity/Sms.java deleted file mode 100644 index 22985dc..0000000 --- a/src/main/java/org/springblade/modules/resource/entity/Sms.java +++ /dev/null @@ -1,82 +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.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.springblade.core.tenant.mp.TenantEntity; - -/** - * 短信配置表实体类 - * - * @author BladeX - */ -@Data -@TableName("blade_sms") -@EqualsAndHashCode(callSuper = true) -@ApiModel(value = "Sms对象", description = "短信配置表") -public class Sms extends TenantEntity { - - private static final long serialVersionUID = 1L; - - /** - * 资源编号 - */ - @ApiModelProperty(value = "资源编号") - private String smsCode; - - /** - * 模板ID - */ - @ApiModelProperty(value = "模板ID") - private String templateId; - /** - * 分类 - */ - @ApiModelProperty(value = "分类") - private Integer category; - /** - * accessKey - */ - @ApiModelProperty(value = "accessKey") - private String accessKey; - /** - * secretKey - */ - @ApiModelProperty(value = "secretKey") - private String secretKey; - /** - * regionId - */ - @ApiModelProperty(value = "regionId") - private String regionId; - /** - * 短信签名 - */ - @ApiModelProperty(value = "短信签名") - private String signName; - /** - * 备注 - */ - @ApiModelProperty(value = "备注") - private String remark; - - -} diff --git a/src/main/java/org/springblade/modules/resource/mapper/SmsMapper.java b/src/main/java/org/springblade/modules/resource/mapper/SmsMapper.java deleted file mode 100644 index 6103d2d..0000000 --- a/src/main/java/org/springblade/modules/resource/mapper/SmsMapper.java +++ /dev/null @@ -1,42 +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.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import org.springblade.modules.resource.entity.Sms; -import org.springblade.modules.resource.vo.SmsVO; - -import java.util.List; - -/** - * 短信配置表 Mapper 接口 - * - * @author BladeX - */ -public interface SmsMapper extends BaseMapper { - - /** - * 自定义分页 - * - * @param page - * @param sms - * @return - */ - List selectSmsPage(IPage page, SmsVO sms); - -} diff --git a/src/main/java/org/springblade/modules/resource/mapper/SmsMapper.xml b/src/main/java/org/springblade/modules/resource/mapper/SmsMapper.xml deleted file mode 100644 index 3c88437..0000000 --- a/src/main/java/org/springblade/modules/resource/mapper/SmsMapper.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/java/org/springblade/modules/resource/service/ISmsService.java b/src/main/java/org/springblade/modules/resource/service/ISmsService.java deleted file mode 100644 index 1ac8cc0..0000000 --- a/src/main/java/org/springblade/modules/resource/service/ISmsService.java +++ /dev/null @@ -1,56 +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.service; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import org.springblade.core.mp.base.BaseService; -import org.springblade.modules.resource.entity.Sms; -import org.springblade.modules.resource.vo.SmsVO; - -/** - * 短信配置表 服务类 - * - * @author BladeX - */ -public interface ISmsService extends BaseService { - - /** - * 自定义分页 - * - * @param page - * @param sms - * @return - */ - IPage selectSmsPage(IPage page, SmsVO sms); - - /** - * 提交oss信息 - * - * @param oss - * @return - */ - boolean submit(Sms oss); - - /** - * 启动配置 - * - * @param id - * @return - */ - boolean enable(Long id); - -} diff --git a/src/main/java/org/springblade/modules/resource/service/impl/SmsServiceImpl.java b/src/main/java/org/springblade/modules/resource/service/impl/SmsServiceImpl.java deleted file mode 100644 index 148f19d..0000000 --- a/src/main/java/org/springblade/modules/resource/service/impl/SmsServiceImpl.java +++ /dev/null @@ -1,67 +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.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import org.springblade.core.log.exception.ServiceException; -import org.springblade.core.mp.base.BaseServiceImpl; -import org.springblade.core.secure.utils.AuthUtil; -import org.springblade.core.tool.utils.Func; -import org.springblade.modules.resource.entity.Sms; -import org.springblade.modules.resource.mapper.SmsMapper; -import org.springblade.modules.resource.service.ISmsService; -import org.springblade.modules.resource.vo.SmsVO; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -/** - * 短信配置表 服务实现类 - * - * @author BladeX - */ -@Service -public class SmsServiceImpl extends BaseServiceImpl implements ISmsService { - - @Override - public IPage selectSmsPage(IPage page, SmsVO sms) { - return page.setRecords(baseMapper.selectSmsPage(page, sms)); - } - - @Override - public boolean submit(Sms sms) { - LambdaQueryWrapper lqw = Wrappers.query().lambda() - .eq(Sms::getSmsCode, sms.getSmsCode()).eq(Sms::getTenantId, AuthUtil.getTenantId()); - Long cnt = baseMapper.selectCount(Func.isEmpty(sms.getId()) ? lqw : lqw.notIn(Sms::getId, sms.getId())); - if (cnt > 0L) { - throw new ServiceException("当前资源编号已存在!"); - } - return this.saveOrUpdate(sms); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean enable(Long id) { - // 先禁用 - boolean temp1 = this.update(Wrappers.update().lambda().set(Sms::getStatus, 1)); - // 在启用 - boolean temp2 = this.update(Wrappers.update().lambda().set(Sms::getStatus, 2).eq(Sms::getId, id)); - return temp1 && temp2; - } - -} diff --git a/src/main/java/org/springblade/modules/resource/vo/SmsVO.java b/src/main/java/org/springblade/modules/resource/vo/SmsVO.java deleted file mode 100644 index 72365bb..0000000 --- a/src/main/java/org/springblade/modules/resource/vo/SmsVO.java +++ /dev/null @@ -1,45 +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.vo; - -import io.swagger.annotations.ApiModel; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.springblade.modules.resource.entity.Sms; - -/** - * 短信配置表视图实体类 - * - * @author BladeX - */ -@Data -@EqualsAndHashCode(callSuper = true) -@ApiModel(value = "SmsVO对象", description = "短信配置表") -public class SmsVO extends Sms { - private static final long serialVersionUID = 1L; - - /** - * 分类名 - */ - private String categoryName; - - /** - * 是否启用 - */ - private String statusName; - -} diff --git a/src/main/java/org/springblade/modules/resource/wrapper/SmsWrapper.java b/src/main/java/org/springblade/modules/resource/wrapper/SmsWrapper.java deleted file mode 100644 index 15b94c8..0000000 --- a/src/main/java/org/springblade/modules/resource/wrapper/SmsWrapper.java +++ /dev/null @@ -1,49 +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.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.modules.resource.entity.Sms; -import org.springblade.modules.resource.vo.SmsVO; - -import java.util.Objects; - -/** - * 短信配置表包装类,返回视图层所需的字段 - * - * @author BladeX - */ -public class SmsWrapper extends BaseEntityWrapper { - - public static SmsWrapper build() { - return new SmsWrapper(); - } - - @Override - public SmsVO entityVO(Sms sms) { - SmsVO smsVO = Objects.requireNonNull(BeanUtil.copy(sms, SmsVO.class)); - String categoryName = DictCache.getValue(DictEnum.SMS, sms.getCategory()); - String statusName = DictCache.getValue(DictEnum.YES_NO, sms.getStatus()); - smsVO.setCategoryName(categoryName); - smsVO.setStatusName(statusName); - return smsVO; - } - -}