瀏覽代碼

fix 发送短信

Administrator 3 年之前
父節點
當前提交
c0f7b96030

+ 103 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TextMessageController.java

@@ -0,0 +1,103 @@
+package com.ruoyi.web.controller.system;
+
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.system.domain.TextMessage;
+import com.ruoyi.system.service.ITextMessageService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 短信设置Controller
+ * 
+ * @author ruoyi
+ * @date 2021-07-20
+ */
+@RestController
+@RequestMapping("/system/sendMessage")
+public class TextMessageController extends BaseController
+{
+    @Autowired
+    private ITextMessageService textMessageService;
+
+    /**
+     * 查询短信设置列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:sendMessage:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(TextMessage textMessage)
+    {
+        startPage();
+        List<TextMessage> list = textMessageService.selectTextMessageList(textMessage);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出短信设置列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:sendMessage:export')")
+    @Log(title = "短信设置", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(TextMessage textMessage)
+    {
+        List<TextMessage> list = textMessageService.selectTextMessageList(textMessage);
+        ExcelUtil<TextMessage> util = new ExcelUtil<TextMessage>(TextMessage.class);
+        return util.exportExcel(list, "sendMessage");
+    }
+
+    /**
+     * 获取短信设置详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:sendMessage:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(textMessageService.selectTextMessageById(id));
+    }
+
+    /**
+     * 新增短信设置
+     */
+    @PreAuthorize("@ss.hasPermi('system:sendMessage:add')")
+    @Log(title = "短信设置", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody TextMessage textMessage)
+    {
+        return toAjax(textMessageService.insertTextMessage(textMessage));
+    }
+
+    /**
+     * 修改短信设置
+     */
+    @PreAuthorize("@ss.hasPermi('system:sendMessage:edit')")
+    @Log(title = "短信设置", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody TextMessage textMessage)
+    {
+        return toAjax(textMessageService.updateTextMessage(textMessage));
+    }
+
+    /**
+     * 删除短信设置
+     */
+    @PreAuthorize("@ss.hasPermi('system:sendMessage:remove')")
+    @Log(title = "短信设置", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(textMessageService.deleteTextMessageByIds(ids));
+    }
+}

+ 103 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TextMessageLogController.java

@@ -0,0 +1,103 @@
+package com.ruoyi.web.controller.system;
+
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.system.domain.TextMessageLog;
+import com.ruoyi.system.service.ITextMessageLogService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 短信记录Controller
+ * 
+ * @author ruoyi
+ * @date 2021-07-20
+ */
+@RestController
+@RequestMapping("/system/messageLog")
+public class TextMessageLogController extends BaseController
+{
+    @Autowired
+    private ITextMessageLogService textMessageLogService;
+
+    /**
+     * 查询短信记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:messageLog:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(TextMessageLog textMessageLog)
+    {
+        startPage();
+        List<TextMessageLog> list = textMessageLogService.selectTextMessageLogList(textMessageLog);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出短信记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:messageLog:export')")
+    @Log(title = "短信记录", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(TextMessageLog textMessageLog)
+    {
+        List<TextMessageLog> list = textMessageLogService.selectTextMessageLogList(textMessageLog);
+        ExcelUtil<TextMessageLog> util = new ExcelUtil<TextMessageLog>(TextMessageLog.class);
+        return util.exportExcel(list, "messageLog");
+    }
+
+    /**
+     * 获取短信记录详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:messageLog:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(textMessageLogService.selectTextMessageLogById(id));
+    }
+
+    /**
+     * 新增短信记录
+     */
+    @PreAuthorize("@ss.hasPermi('system:messageLog:add')")
+    @Log(title = "短信记录", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody TextMessageLog textMessageLog)
+    {
+        return toAjax(textMessageLogService.insertTextMessageLog(textMessageLog));
+    }
+
+    /**
+     * 修改短信记录
+     */
+    @PreAuthorize("@ss.hasPermi('system:messageLog:edit')")
+    @Log(title = "短信记录", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody TextMessageLog textMessageLog)
+    {
+        return toAjax(textMessageLogService.updateTextMessageLog(textMessageLog));
+    }
+
+    /**
+     * 删除短信记录
+     */
+    @PreAuthorize("@ss.hasPermi('system:messageLog:remove')")
+    @Log(title = "短信记录", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(textMessageLogService.deleteTextMessageLogByIds(ids));
+    }
+}

+ 4 - 5
ruoyi-common/src/main/java/com/ruoyi/common/utils/SendSmsUtils.java

@@ -39,13 +39,13 @@ public class SendSmsUtils {
      * @return
      * @throws ClientException
      */
-    public static SendSmsResponse sendSms(String phone,String remark ) throws ClientException {
+    public static SendSmsResponse sendSms(String phone,String remark,String accessKeyId,String accessKeySecret,String signName,String templateCode ) throws ClientException {
         //可自助调整超时时间
         System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
         System.setProperty("sun.net.client.defaultReadTimeout", "10000");
 
         //初始化acsClient,暂不支持region化
-        IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", ACCESS_KEY_ID, ACCESS_KEY_SECRET);
+        IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);
         DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", PRODUCT, DOMAIN);
         IAcsClient acsClient = new DefaultAcsClient(profile);
 
@@ -54,9 +54,9 @@ public class SendSmsUtils {
         //必填:待发送手机号 多个手机号用逗号分割
         request.setPhoneNumbers(phone);
         //必填:短信签名-可在短信控制台中找到
-        request.setSignName("安徽博曼网络科技有限公司");
+        request.setSignName(signName);
         //必填:短信模板-可在短信控制台中找到
-        request.setTemplateCode("SMS_219525380");
+        request.setTemplateCode(templateCode);
         //可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
         request.setTemplateParam("{\"remark\":\"" + remark + "\"}");
         //可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
@@ -66,7 +66,6 @@ public class SendSmsUtils {
         SendSmsResponse sendSmsResponse = null;
         try {
             sendSmsResponse = acsClient.getAcsResponse(request);
-            System.out.println(sendSmsResponse.getMessage());
         } catch (ClientException e) {
             e.printStackTrace();
         }

+ 111 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/TextMessage.java

@@ -0,0 +1,111 @@
+package com.ruoyi.system.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 短信设置对象 text_message
+ * 
+ * @author ruoyi
+ * @date 2021-07-20
+ */
+public class TextMessage extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 编号 */
+    private Long id;
+
+    /** 标识用户 */
+    @Excel(name = "标识用户")
+    private String accessKeyId;
+
+    /** 验证用户的密钥 */
+    @Excel(name = "验证用户的密钥")
+    private String accessKeySecret;
+
+    /** 签名 */
+    @Excel(name = "签名")
+    private String signName;
+
+    /** 短信模板 */
+    @Excel(name = "短信模板")
+    private String templateCode;
+
+    /** 是否删除 */
+    @Excel(name = "是否删除")
+    private String isDel;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setAccessKeyId(String accessKeyId) 
+    {
+        this.accessKeyId = accessKeyId;
+    }
+
+    public String getAccessKeyId() 
+    {
+        return accessKeyId;
+    }
+    public void setAccessKeySecret(String accessKeySecret) 
+    {
+        this.accessKeySecret = accessKeySecret;
+    }
+
+    public String getAccessKeySecret() 
+    {
+        return accessKeySecret;
+    }
+    public void setSignName(String signName) 
+    {
+        this.signName = signName;
+    }
+
+    public String getSignName() 
+    {
+        return signName;
+    }
+    public void setTemplateCode(String templateCode) 
+    {
+        this.templateCode = templateCode;
+    }
+
+    public String getTemplateCode() 
+    {
+        return templateCode;
+    }
+    public void setIsDel(String isDel) 
+    {
+        this.isDel = isDel;
+    }
+
+    public String getIsDel() 
+    {
+        return isDel;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("accessKeyId", getAccessKeyId())
+            .append("accessKeySecret", getAccessKeySecret())
+            .append("signName", getSignName())
+            .append("templateCode", getTemplateCode())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .append("isDel", getIsDel())
+            .toString();
+    }
+}

+ 97 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/TextMessageLog.java

@@ -0,0 +1,97 @@
+package com.ruoyi.system.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 短信记录对象 text_message_log
+ * 
+ * @author ruoyi
+ * @date 2021-07-20
+ */
+public class TextMessageLog extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 编号 */
+    private Long id;
+
+    /** 用户名称 */
+    @Excel(name = "用户名称")
+    private String nickName;
+
+    /** 手机号 */
+    @Excel(name = "手机号")
+    private String phoneNum;
+
+    /** 短信内容 */
+    @Excel(name = "短信内容")
+    private String content;
+
+    /** 是否删除 */
+    @Excel(name = "是否删除")
+    private String isDel;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setNickName(String nickName) 
+    {
+        this.nickName = nickName;
+    }
+
+    public String getNickName() 
+    {
+        return nickName;
+    }
+    public void setPhoneNum(String phoneNum) 
+    {
+        this.phoneNum = phoneNum;
+    }
+
+    public String getPhoneNum() 
+    {
+        return phoneNum;
+    }
+    public void setContent(String content) 
+    {
+        this.content = content;
+    }
+
+    public String getContent() 
+    {
+        return content;
+    }
+    public void setIsDel(String isDel) 
+    {
+        this.isDel = isDel;
+    }
+
+    public String getIsDel() 
+    {
+        return isDel;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("nickName", getNickName())
+            .append("phoneNum", getPhoneNum())
+            .append("content", getContent())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .append("isDel", getIsDel())
+            .toString();
+    }
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TextMessageLogMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.system.domain.TextMessageLog;
+
+/**
+ * 短信记录Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2021-07-20
+ */
+public interface TextMessageLogMapper 
+{
+    /**
+     * 查询短信记录
+     * 
+     * @param id 短信记录ID
+     * @return 短信记录
+     */
+    public TextMessageLog selectTextMessageLogById(Long id);
+
+    /**
+     * 查询短信记录列表
+     * 
+     * @param textMessageLog 短信记录
+     * @return 短信记录集合
+     */
+    public List<TextMessageLog> selectTextMessageLogList(TextMessageLog textMessageLog);
+
+    /**
+     * 新增短信记录
+     * 
+     * @param textMessageLog 短信记录
+     * @return 结果
+     */
+    public int insertTextMessageLog(TextMessageLog textMessageLog);
+
+    /**
+     * 修改短信记录
+     * 
+     * @param textMessageLog 短信记录
+     * @return 结果
+     */
+    public int updateTextMessageLog(TextMessageLog textMessageLog);
+
+    /**
+     * 删除短信记录
+     * 
+     * @param id 短信记录ID
+     * @return 结果
+     */
+    public int deleteTextMessageLogById(Long id);
+
+    /**
+     * 批量删除短信记录
+     * 
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteTextMessageLogByIds(Long[] ids);
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TextMessageMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.system.domain.TextMessage;
+
+/**
+ * 短信设置Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2021-07-20
+ */
+public interface TextMessageMapper 
+{
+    /**
+     * 查询短信设置
+     * 
+     * @param id 短信设置ID
+     * @return 短信设置
+     */
+    public TextMessage selectTextMessageById(Long id);
+
+    /**
+     * 查询短信设置列表
+     * 
+     * @param textMessage 短信设置
+     * @return 短信设置集合
+     */
+    public List<TextMessage> selectTextMessageList(TextMessage textMessage);
+
+    /**
+     * 新增短信设置
+     * 
+     * @param textMessage 短信设置
+     * @return 结果
+     */
+    public int insertTextMessage(TextMessage textMessage);
+
+    /**
+     * 修改短信设置
+     * 
+     * @param textMessage 短信设置
+     * @return 结果
+     */
+    public int updateTextMessage(TextMessage textMessage);
+
+    /**
+     * 删除短信设置
+     * 
+     * @param id 短信设置ID
+     * @return 结果
+     */
+    public int deleteTextMessageById(Long id);
+
+    /**
+     * 批量删除短信设置
+     * 
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteTextMessageByIds(Long[] ids);
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ITextMessageLogService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import com.ruoyi.system.domain.TextMessageLog;
+
+/**
+ * 短信记录Service接口
+ * 
+ * @author ruoyi
+ * @date 2021-07-20
+ */
+public interface ITextMessageLogService 
+{
+    /**
+     * 查询短信记录
+     * 
+     * @param id 短信记录ID
+     * @return 短信记录
+     */
+    public TextMessageLog selectTextMessageLogById(Long id);
+
+    /**
+     * 查询短信记录列表
+     * 
+     * @param textMessageLog 短信记录
+     * @return 短信记录集合
+     */
+    public List<TextMessageLog> selectTextMessageLogList(TextMessageLog textMessageLog);
+
+    /**
+     * 新增短信记录
+     * 
+     * @param textMessageLog 短信记录
+     * @return 结果
+     */
+    public int insertTextMessageLog(TextMessageLog textMessageLog);
+
+    /**
+     * 修改短信记录
+     * 
+     * @param textMessageLog 短信记录
+     * @return 结果
+     */
+    public int updateTextMessageLog(TextMessageLog textMessageLog);
+
+    /**
+     * 批量删除短信记录
+     * 
+     * @param ids 需要删除的短信记录ID
+     * @return 结果
+     */
+    public int deleteTextMessageLogByIds(Long[] ids);
+
+    /**
+     * 删除短信记录信息
+     * 
+     * @param id 短信记录ID
+     * @return 结果
+     */
+    public int deleteTextMessageLogById(Long id);
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ITextMessageService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import com.ruoyi.system.domain.TextMessage;
+
+/**
+ * 短信设置Service接口
+ * 
+ * @author ruoyi
+ * @date 2021-07-20
+ */
+public interface ITextMessageService 
+{
+    /**
+     * 查询短信设置
+     * 
+     * @param id 短信设置ID
+     * @return 短信设置
+     */
+    public TextMessage selectTextMessageById(Long id);
+
+    /**
+     * 查询短信设置列表
+     * 
+     * @param textMessage 短信设置
+     * @return 短信设置集合
+     */
+    public List<TextMessage> selectTextMessageList(TextMessage textMessage);
+
+    /**
+     * 新增短信设置
+     * 
+     * @param textMessage 短信设置
+     * @return 结果
+     */
+    public int insertTextMessage(TextMessage textMessage);
+
+    /**
+     * 修改短信设置
+     * 
+     * @param textMessage 短信设置
+     * @return 结果
+     */
+    public int updateTextMessage(TextMessage textMessage);
+
+    /**
+     * 批量删除短信设置
+     * 
+     * @param ids 需要删除的短信设置ID
+     * @return 结果
+     */
+    public int deleteTextMessageByIds(Long[] ids);
+
+    /**
+     * 删除短信设置信息
+     * 
+     * @param id 短信设置ID
+     * @return 结果
+     */
+    public int deleteTextMessageById(Long id);
+}

+ 122 - 144
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java

@@ -5,9 +5,13 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
+import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
 import com.aliyuncs.exceptions.ClientException;
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.SendSmsUtils;
+import com.ruoyi.system.domain.*;
+import com.ruoyi.system.mapper.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -20,14 +24,6 @@ import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.exception.CustomException;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.system.domain.SysPost;
-import com.ruoyi.system.domain.SysUserPost;
-import com.ruoyi.system.domain.SysUserRole;
-import com.ruoyi.system.mapper.SysPostMapper;
-import com.ruoyi.system.mapper.SysRoleMapper;
-import com.ruoyi.system.mapper.SysUserMapper;
-import com.ruoyi.system.mapper.SysUserPostMapper;
-import com.ruoyi.system.mapper.SysUserRoleMapper;
 import com.ruoyi.system.service.ISysConfigService;
 import com.ruoyi.system.service.ISysUserService;
 
@@ -35,12 +31,11 @@ import javax.validation.constraints.Size;
 
 /**
  * 用户 业务层处理
- * 
+ *
  * @author ruoyi
  */
 @Service
-public class SysUserServiceImpl implements ISysUserService
-{
+public class SysUserServiceImpl implements ISysUserService {
     private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
 
     @Autowired
@@ -61,60 +56,60 @@ public class SysUserServiceImpl implements ISysUserService
     @Autowired
     private ISysConfigService configService;
 
+    @Autowired
+    private TextMessageMapper textMessageMapper;
+
+    @Autowired
+    private TextMessageLogMapper textMessageLogMapper;
+
     /**
      * 根据条件分页查询用户列表
-     * 
+     *
      * @param user 用户信息
      * @return 用户信息集合信息
      */
     @Override
     @DataScope(deptAlias = "d", userAlias = "u")
-    public List<SysUser> selectUserList(SysUser user)
-    {
+    public List<SysUser> selectUserList(SysUser user) {
         return userMapper.selectUserList(user);
     }
 
     /**
      * 通过用户名查询用户
-     * 
+     *
      * @param userName 用户名
      * @return 用户对象信息
      */
     @Override
-    public SysUser selectUserByUserName(String userName)
-    {
+    public SysUser selectUserByUserName(String userName) {
         return userMapper.selectUserByUserName(userName);
     }
 
     /**
      * 通过用户ID查询用户
-     * 
+     *
      * @param userId 用户ID
      * @return 用户对象信息
      */
     @Override
-    public SysUser selectUserById(Long userId)
-    {
+    public SysUser selectUserById(Long userId) {
         return userMapper.selectUserById(userId);
     }
 
     /**
      * 查询用户所属角色组
-     * 
+     *
      * @param userName 用户名
      * @return 结果
      */
     @Override
-    public String selectUserRoleGroup(String userName)
-    {
+    public String selectUserRoleGroup(String userName) {
         List<SysRole> list = roleMapper.selectRolesByUserName(userName);
         StringBuffer idsStr = new StringBuffer();
-        for (SysRole role : list)
-        {
+        for (SysRole role : list) {
             idsStr.append(role.getRoleName()).append(",");
         }
-        if (StringUtils.isNotEmpty(idsStr.toString()))
-        {
+        if (StringUtils.isNotEmpty(idsStr.toString())) {
             return idsStr.substring(0, idsStr.length() - 1);
         }
         return idsStr.toString();
@@ -122,21 +117,18 @@ public class SysUserServiceImpl implements ISysUserService
 
     /**
      * 查询用户所属岗位组
-     * 
+     *
      * @param userName 用户名
      * @return 结果
      */
     @Override
-    public String selectUserPostGroup(String userName)
-    {
+    public String selectUserPostGroup(String userName) {
         List<SysPost> list = postMapper.selectPostsByUserName(userName);
         StringBuffer idsStr = new StringBuffer();
-        for (SysPost post : list)
-        {
+        for (SysPost post : list) {
             idsStr.append(post.getPostName()).append(",");
         }
-        if (StringUtils.isNotEmpty(idsStr.toString()))
-        {
+        if (StringUtils.isNotEmpty(idsStr.toString())) {
             return idsStr.substring(0, idsStr.length() - 1);
         }
         return idsStr.toString();
@@ -144,16 +136,14 @@ public class SysUserServiceImpl implements ISysUserService
 
     /**
      * 校验用户名称是否唯一
-     * 
+     *
      * @param userName 用户名称
      * @return 结果
      */
     @Override
-    public String checkUserNameUnique(String userName)
-    {
+    public String checkUserNameUnique(String userName) {
         int count = userMapper.checkUserNameUnique(userName);
-        if (count > 0)
-        {
+        if (count > 0) {
             return UserConstants.NOT_UNIQUE;
         }
         return UserConstants.UNIQUE;
@@ -166,12 +156,10 @@ public class SysUserServiceImpl implements ISysUserService
      * @return
      */
     @Override
-    public String checkPhoneUnique(SysUser user)
-    {
+    public String checkPhoneUnique(SysUser user) {
         Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
         SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber());
-        if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
-        {
+        if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
             return UserConstants.NOT_UNIQUE;
         }
         return UserConstants.UNIQUE;
@@ -184,12 +172,10 @@ public class SysUserServiceImpl implements ISysUserService
      * @return
      */
     @Override
-    public String checkEmailUnique(SysUser user)
-    {
+    public String checkEmailUnique(SysUser user) {
         Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
         SysUser info = userMapper.checkEmailUnique(user.getEmail());
-        if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
-        {
+        if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
             return UserConstants.NOT_UNIQUE;
         }
         return UserConstants.UNIQUE;
@@ -197,28 +183,25 @@ public class SysUserServiceImpl implements ISysUserService
 
     /**
      * 校验用户是否允许操作
-     * 
+     *
      * @param user 用户信息
      */
     @Override
-    public void checkUserAllowed(SysUser user)
-    {
-        if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin())
-        {
+    public void checkUserAllowed(SysUser user) {
+        if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin()) {
             throw new CustomException("不允许操作超级管理员用户");
         }
     }
 
     /**
      * 新增保存用户信息
-     * 
+     *
      * @param user 用户信息
      * @return 结果
      */
     @Override
     @Transactional
-    public int insertUser(SysUser user)
-    {
+    public int insertUser(SysUser user) {
         // 新增用户信息
         int rows = userMapper.insertUser(user);
         // 新增用户岗位关联
@@ -230,14 +213,13 @@ public class SysUserServiceImpl implements ISysUserService
 
     /**
      * 修改保存用户信息
-     * 
+     *
      * @param user 用户信息
      * @return 结果
      */
     @Override
     @Transactional
-    public int updateUser(SysUser user)
-    {
+    public int updateUser(SysUser user) {
         Long userId = user.getUserId();
         // 删除用户与角色关联
         userRoleMapper.deleteUserRoleByUserId(userId);
@@ -252,88 +234,79 @@ public class SysUserServiceImpl implements ISysUserService
 
     /**
      * 修改用户状态
-     * 
+     *
      * @param user 用户信息
      * @return 结果
      */
     @Override
-    public int updateUserStatus(SysUser user)
-    {
+    public int updateUserStatus(SysUser user) {
         return userMapper.updateUser(user);
     }
 
     /**
      * 修改用户基本信息
-     * 
+     *
      * @param user 用户信息
      * @return 结果
      */
     @Override
-    public int updateUserProfile(SysUser user)
-    {
+    public int updateUserProfile(SysUser user) {
         return userMapper.updateUser(user);
     }
 
     /**
      * 修改用户头像
-     * 
+     *
      * @param userName 用户名
-     * @param avatar 头像地址
+     * @param avatar   头像地址
      * @return 结果
      */
     @Override
-    public boolean updateUserAvatar(String userName, String avatar)
-    {
+    public boolean updateUserAvatar(String userName, String avatar) {
         return userMapper.updateUserAvatar(userName, avatar) > 0;
     }
 
     /**
      * 重置用户密码
-     * 
+     *
      * @param user 用户信息
      * @return 结果
      */
     @Override
-    public int resetPwd(SysUser user)
-    {
+    public int resetPwd(SysUser user) {
         return userMapper.updateUser(user);
     }
 
     /**
      * 重置用户密码
-     * 
-     * @param userName 用户名
-     * @param password 密码
+     *
+     * @param userName           用户名
+     * @param password           密码
      * @param clearTextPasswords 明文密码
      * @return 结果
      */
     @Override
-    public int resetUserPwd(String userName, String password, String clearTextPasswords)
-    {
+    public int resetUserPwd(String userName, String password, String clearTextPasswords) {
         return userMapper.resetUserPwd(userName, password, clearTextPasswords);
     }
 
     /**
      * 新增用户角色信息
-     * 
+     *
      * @param user 用户对象
      */
-    public void insertUserRole(SysUser user)
-    {
+    public void insertUserRole(SysUser user) {
         Long[] roles = user.getRoleIds();
-        if (StringUtils.isNotNull(roles))
-        {
+        if (StringUtils.isNotNull(roles)) {
             // 新增用户与角色管理
             List<SysUserRole> list = new ArrayList<SysUserRole>();
-            for (Long roleId : roles)
-            {
+            for (Long roleId : roles) {
                 SysUserRole ur = new SysUserRole();
                 ur.setUserId(user.getUserId());
                 ur.setRoleId(roleId);
                 list.add(ur);
             }
-            if (list.size() > 0)
-            {
+            if (list.size() > 0) {
                 userRoleMapper.batchUserRole(list);
             }
         }
@@ -341,25 +314,21 @@ public class SysUserServiceImpl implements ISysUserService
 
     /**
      * 新增用户岗位信息
-     * 
+     *
      * @param user 用户对象
      */
-    public void insertUserPost(SysUser user)
-    {
+    public void insertUserPost(SysUser user) {
         Long[] posts = user.getPostIds();
-        if (StringUtils.isNotNull(posts))
-        {
+        if (StringUtils.isNotNull(posts)) {
             // 新增用户与岗位管理
             List<SysUserPost> list = new ArrayList<SysUserPost>();
-            for (Long postId : posts)
-            {
+            for (Long postId : posts) {
                 SysUserPost up = new SysUserPost();
                 up.setUserId(user.getUserId());
                 up.setPostId(postId);
                 list.add(up);
             }
-            if (list.size() > 0)
-            {
+            if (list.size() > 0) {
                 userPostMapper.batchUserPost(list);
             }
         }
@@ -367,14 +336,13 @@ public class SysUserServiceImpl implements ISysUserService
 
     /**
      * 通过用户ID删除用户
-     * 
+     *
      * @param userId 用户ID
      * @return 结果
      */
     @Override
     @Transactional
-    public int deleteUserById(Long userId)
-    {
+    public int deleteUserById(Long userId) {
         // 删除用户与角色关联
         userRoleMapper.deleteUserRoleByUserId(userId);
         // 删除用户与岗位表
@@ -384,16 +352,14 @@ public class SysUserServiceImpl implements ISysUserService
 
     /**
      * 批量删除用户信息
-     * 
+     *
      * @param userIds 需要删除的用户ID
      * @return 结果
      */
     @Override
     @Transactional
-    public int deleteUserByIds(Long[] userIds)
-    {
-        for (Long userId : userIds)
-        {
+    public int deleteUserByIds(Long[] userIds) {
+        for (Long userId : userIds) {
             checkUserAllowed(new SysUser(userId));
         }
         // 删除用户与角色关联
@@ -405,17 +371,15 @@ public class SysUserServiceImpl implements ISysUserService
 
     /**
      * 导入用户数据
-     * 
-     * @param userList 用户数据列表
+     *
+     * @param userList        用户数据列表
      * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
-     * @param operName 操作用户
+     * @param operName        操作用户
      * @return 结果
      */
     @Override
-    public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName)
-    {
-        if (StringUtils.isNull(userList) || userList.size() == 0)
-        {
+    public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName) {
+        if (StringUtils.isNull(userList) || userList.size() == 0) {
             throw new CustomException("导入用户数据不能为空!");
         }
         int successNum = 0;
@@ -423,48 +387,36 @@ public class SysUserServiceImpl implements ISysUserService
         StringBuilder successMsg = new StringBuilder();
         StringBuilder failureMsg = new StringBuilder();
         String password = configService.selectConfigByKey("sys.user.initPassword");
-        for (SysUser user : userList)
-        {
-            try
-            {
+        for (SysUser user : userList) {
+            try {
                 // 验证是否存在这个用户
                 SysUser u = userMapper.selectUserByUserName(user.getUserName());
-                if (StringUtils.isNull(u))
-                {
+                if (StringUtils.isNull(u)) {
                     user.setPassword(SecurityUtils.encryptPassword(password));
                     user.setCreateBy(operName);
                     this.insertUser(user);
                     successNum++;
                     successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功");
-                }
-                else if (isUpdateSupport)
-                {
+                } else if (isUpdateSupport) {
                     user.setUpdateBy(operName);
                     this.updateUser(user);
                     successNum++;
                     successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 更新成功");
-                }
-                else
-                {
+                } else {
                     failureNum++;
                     failureMsg.append("<br/>" + failureNum + "、账号 " + user.getUserName() + " 已存在");
                 }
-            }
-            catch (Exception e)
-            {
+            } catch (Exception e) {
                 failureNum++;
                 String msg = "<br/>" + failureNum + "、账号 " + user.getUserName() + " 导入失败:";
                 failureMsg.append(msg + e.getMessage());
                 log.error(msg, e);
             }
         }
-        if (failureNum > 0)
-        {
+        if (failureNum > 0) {
             failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
             throw new CustomException(failureMsg.toString());
-        }
-        else
-        {
+        } else {
             successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
         }
         return successMsg.toString();
@@ -472,39 +424,65 @@ public class SysUserServiceImpl implements ISysUserService
 
     /**
      * 给用户发短信
+     *
      * @param map
      * @return
      */
     @Override
-    public AjaxResult sendSms(Map<String,Object> map) {
-        StringBuilder nickNames = new StringBuilder("发送失败的人:");
-        ArrayList<LinkedHashMap> userList = (ArrayList<LinkedHashMap>)map.get("userList");
+    public AjaxResult sendSms(Map<String, Object> map) {
+        StringBuilder nickNames = new StringBuilder("发送失败的人:");
+        ArrayList<LinkedHashMap> userList = (ArrayList<LinkedHashMap>) map.get("userList");
         String content = String.valueOf(map.get("content"));
-        if (userList.size() > 0){
+        String accessKeyId = "LTAI5tNA2fcBJH6EWRH6Pxr6";
+        String accessKeySecret = "5WdaPEOvC3u9LC7pwy2DQ9pgmJvgUr";
+        String signName = "安徽博曼网络科技有限公司";
+        String templateCode = "SMS_219525380";
+        String message = null;
+        boolean flag = false;
+        Long textMessageId = Long.valueOf(String.valueOf(map.get("textMessageId")));
+        TextMessage textMessage = textMessageMapper.selectTextMessageById(textMessageId);
+        if (textMessage != null){
+            accessKeyId = textMessage.getAccessKeyId();
+            accessKeySecret = textMessage.getAccessKeySecret();
+            signName = textMessage.getSignName();
+            templateCode = textMessage.getTemplateCode();
+        }
+        if (userList.size() > 0) {
             StringBuilder sb = new StringBuilder();
             for (LinkedHashMap sysUser : userList) {
                 String phone = String.valueOf(sysUser.get("phonenumber"));
-                if (StringUtils.isNotBlank(phone)){
+                if (StringUtils.isNotBlank(phone)) {
                     sb.append(phone).append(",");
-                }else {
+                    TextMessageLog textMessageLog = new TextMessageLog();
+                    textMessageLog.setPhoneNum(phone);
+                    textMessageLog.setNickName(sysUser.get("nickName").toString());
+                    textMessageLog.setCreateTime(DateUtils.getNowDate());
+                    textMessageLog.setContent(content);
+                    textMessageLog.setCreateBy(SecurityUtils.getUsername());
+                    textMessageLogMapper.insertTextMessageLog(textMessageLog);
+                } else {
                     String nikeName = sysUser.get("nickName").toString();
-                    if(!"null".equals(nikeName)){
+                    if (!"null".equals(nikeName)) {
+                        flag = true;
                         nickNames.append(sysUser.get("nickName")).append(",");
                     }
                 }
             }
-            if (StringUtils.isNotBlank(sb)){
+            if (StringUtils.isNotBlank(sb)) {
                 sb.replace(sb.length() - 1, sb.length(), "");
             }
-            if (StringUtils.isNotBlank(nickNames)){
-                nickNames.replace(nickNames.length() - 1, nickNames.length(), "");
-            }
-/*            try {
-                SendSmsUtils.sendSms(sb.toString(),content);
+            try {
+                SendSmsResponse sendSmsResponse = SendSmsUtils.sendSms(sb.toString(), content, accessKeyId, accessKeySecret, signName, templateCode);
+                message = sendSmsResponse.getMessage();
             } catch (ClientException e) {
                 e.printStackTrace();
-            }*/
+            }
+            if (flag) {
+                nickNames.replace(nickNames.length() - 1, nickNames.length(), "");
+                return AjaxResult.success(nickNames);
+            }
+
         }
-        return AjaxResult.success(nickNames);
+        return AjaxResult.success(message);
     }
 }

+ 96 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TextMessageLogServiceImpl.java

@@ -0,0 +1,96 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.List;
+import com.ruoyi.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.system.mapper.TextMessageLogMapper;
+import com.ruoyi.system.domain.TextMessageLog;
+import com.ruoyi.system.service.ITextMessageLogService;
+
+/**
+ * 短信记录Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2021-07-20
+ */
+@Service
+public class TextMessageLogServiceImpl implements ITextMessageLogService 
+{
+    @Autowired
+    private TextMessageLogMapper textMessageLogMapper;
+
+    /**
+     * 查询短信记录
+     * 
+     * @param id 短信记录ID
+     * @return 短信记录
+     */
+    @Override
+    public TextMessageLog selectTextMessageLogById(Long id)
+    {
+        return textMessageLogMapper.selectTextMessageLogById(id);
+    }
+
+    /**
+     * 查询短信记录列表
+     * 
+     * @param textMessageLog 短信记录
+     * @return 短信记录
+     */
+    @Override
+    public List<TextMessageLog> selectTextMessageLogList(TextMessageLog textMessageLog)
+    {
+        return textMessageLogMapper.selectTextMessageLogList(textMessageLog);
+    }
+
+    /**
+     * 新增短信记录
+     * 
+     * @param textMessageLog 短信记录
+     * @return 结果
+     */
+    @Override
+    public int insertTextMessageLog(TextMessageLog textMessageLog)
+    {
+        textMessageLog.setCreateTime(DateUtils.getNowDate());
+        return textMessageLogMapper.insertTextMessageLog(textMessageLog);
+    }
+
+    /**
+     * 修改短信记录
+     * 
+     * @param textMessageLog 短信记录
+     * @return 结果
+     */
+    @Override
+    public int updateTextMessageLog(TextMessageLog textMessageLog)
+    {
+        textMessageLog.setUpdateTime(DateUtils.getNowDate());
+        return textMessageLogMapper.updateTextMessageLog(textMessageLog);
+    }
+
+    /**
+     * 批量删除短信记录
+     * 
+     * @param ids 需要删除的短信记录ID
+     * @return 结果
+     */
+    @Override
+    public int deleteTextMessageLogByIds(Long[] ids)
+    {
+        return textMessageLogMapper.deleteTextMessageLogByIds(ids);
+    }
+
+    /**
+     * 删除短信记录信息
+     * 
+     * @param id 短信记录ID
+     * @return 结果
+     */
+    @Override
+    public int deleteTextMessageLogById(Long id)
+    {
+        return textMessageLogMapper.deleteTextMessageLogById(id);
+    }
+}

+ 96 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TextMessageServiceImpl.java

@@ -0,0 +1,96 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.List;
+import com.ruoyi.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.system.mapper.TextMessageMapper;
+import com.ruoyi.system.domain.TextMessage;
+import com.ruoyi.system.service.ITextMessageService;
+
+/**
+ * 短信设置Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2021-07-20
+ */
+@Service
+public class TextMessageServiceImpl implements ITextMessageService 
+{
+    @Autowired
+    private TextMessageMapper textMessageMapper;
+
+    /**
+     * 查询短信设置
+     * 
+     * @param id 短信设置ID
+     * @return 短信设置
+     */
+    @Override
+    public TextMessage selectTextMessageById(Long id)
+    {
+        return textMessageMapper.selectTextMessageById(id);
+    }
+
+    /**
+     * 查询短信设置列表
+     * 
+     * @param textMessage 短信设置
+     * @return 短信设置
+     */
+    @Override
+    public List<TextMessage> selectTextMessageList(TextMessage textMessage)
+    {
+        return textMessageMapper.selectTextMessageList(textMessage);
+    }
+
+    /**
+     * 新增短信设置
+     * 
+     * @param textMessage 短信设置
+     * @return 结果
+     */
+    @Override
+    public int insertTextMessage(TextMessage textMessage)
+    {
+        textMessage.setCreateTime(DateUtils.getNowDate());
+        return textMessageMapper.insertTextMessage(textMessage);
+    }
+
+    /**
+     * 修改短信设置
+     * 
+     * @param textMessage 短信设置
+     * @return 结果
+     */
+    @Override
+    public int updateTextMessage(TextMessage textMessage)
+    {
+        textMessage.setUpdateTime(DateUtils.getNowDate());
+        return textMessageMapper.updateTextMessage(textMessage);
+    }
+
+    /**
+     * 批量删除短信设置
+     * 
+     * @param ids 需要删除的短信设置ID
+     * @return 结果
+     */
+    @Override
+    public int deleteTextMessageByIds(Long[] ids)
+    {
+        return textMessageMapper.deleteTextMessageByIds(ids);
+    }
+
+    /**
+     * 删除短信设置信息
+     * 
+     * @param id 短信设置ID
+     * @return 结果
+     */
+    @Override
+    public int deleteTextMessageById(Long id)
+    {
+        return textMessageMapper.deleteTextMessageById(id);
+    }
+}

+ 87 - 0
ruoyi-system/src/main/resources/mapper/system/TextMessageLogMapper.xml

@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.system.mapper.TextMessageLogMapper">
+    
+    <resultMap type="TextMessageLog" id="TextMessageLogResult">
+        <result property="id"    column="id"    />
+        <result property="nickName"    column="nick_name"    />
+        <result property="phoneNum"    column="phone_num"    />
+        <result property="content"    column="content"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="isDel"    column="is_del"    />
+    </resultMap>
+
+    <sql id="selectTextMessageLogVo">
+        select id, nick_name, phone_num, content, create_by, create_time, update_by, update_time, is_del from text_message_log
+    </sql>
+
+    <select id="selectTextMessageLogList" parameterType="TextMessageLog" resultMap="TextMessageLogResult">
+        <include refid="selectTextMessageLogVo"/>
+        <where>  
+            <if test="nickName != null  and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
+            <if test="phoneNum != null  and phoneNum != ''"> and phone_num = #{phoneNum}</if>
+            <if test="content != null  and content != ''"> and content = #{content}</if>
+            <if test="isDel != null  and isDel != ''"> and is_del = #{isDel}</if>
+        </where>
+    </select>
+    
+    <select id="selectTextMessageLogById" parameterType="Long" resultMap="TextMessageLogResult">
+        <include refid="selectTextMessageLogVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertTextMessageLog" parameterType="TextMessageLog" useGeneratedKeys="true" keyProperty="id">
+        insert into text_message_log
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="nickName != null">nick_name,</if>
+            <if test="phoneNum != null">phone_num,</if>
+            <if test="content != null">content,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="isDel != null">is_del,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="nickName != null">#{nickName},</if>
+            <if test="phoneNum != null">#{phoneNum},</if>
+            <if test="content != null">#{content},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="isDel != null">#{isDel},</if>
+         </trim>
+    </insert>
+
+    <update id="updateTextMessageLog" parameterType="TextMessageLog">
+        update text_message_log
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="nickName != null">nick_name = #{nickName},</if>
+            <if test="phoneNum != null">phone_num = #{phoneNum},</if>
+            <if test="content != null">content = #{content},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="isDel != null">is_del = #{isDel},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteTextMessageLogById" parameterType="Long">
+        delete from text_message_log where id = #{id}
+    </delete>
+
+    <delete id="deleteTextMessageLogByIds" parameterType="String">
+        delete from text_message_log where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 94 - 0
ruoyi-system/src/main/resources/mapper/system/TextMessageMapper.xml

@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.system.mapper.TextMessageMapper">
+    
+    <resultMap type="TextMessage" id="TextMessageResult">
+        <result property="id"    column="id"    />
+        <result property="accessKeyId"    column="access_key_id"    />
+        <result property="accessKeySecret"    column="access_key_secret"    />
+        <result property="signName"    column="sign_name"    />
+        <result property="templateCode"    column="template_code"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="isDel"    column="is_del"    />
+    </resultMap>
+
+    <sql id="selectTextMessageVo">
+        select id, access_key_id, access_key_secret, sign_name, template_code, create_by, create_time, update_by, update_time, is_del from text_message
+    </sql>
+
+    <select id="selectTextMessageList" parameterType="TextMessage" resultMap="TextMessageResult">
+        <include refid="selectTextMessageVo"/>
+        <where>  
+            <if test="accessKeyId != null  and accessKeyId != ''"> and access_key_id = #{accessKeyId}</if>
+            <if test="accessKeySecret != null  and accessKeySecret != ''"> and access_key_secret = #{accessKeySecret}</if>
+            <if test="signName != null  and signName != ''"> and sign_name like concat('%', #{signName}, '%')</if>
+            <if test="templateCode != null  and templateCode != ''"> and template_code = #{templateCode}</if>
+            <if test="isDel != null  and isDel != ''"> and is_del = #{isDel}</if>
+        </where>
+    </select>
+    
+    <select id="selectTextMessageById" parameterType="Long" resultMap="TextMessageResult">
+        <include refid="selectTextMessageVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertTextMessage" parameterType="TextMessage">
+        insert into text_message
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="accessKeyId != null">access_key_id,</if>
+            <if test="accessKeySecret != null">access_key_secret,</if>
+            <if test="signName != null">sign_name,</if>
+            <if test="templateCode != null">template_code,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="isDel != null">is_del,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="accessKeyId != null">#{accessKeyId},</if>
+            <if test="accessKeySecret != null">#{accessKeySecret},</if>
+            <if test="signName != null">#{signName},</if>
+            <if test="templateCode != null">#{templateCode},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="isDel != null">#{isDel},</if>
+         </trim>
+    </insert>
+
+    <update id="updateTextMessage" parameterType="TextMessage">
+        update text_message
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="accessKeyId != null">access_key_id = #{accessKeyId},</if>
+            <if test="accessKeySecret != null">access_key_secret = #{accessKeySecret},</if>
+            <if test="signName != null">sign_name = #{signName},</if>
+            <if test="templateCode != null">template_code = #{templateCode},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="isDel != null">is_del = #{isDel},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteTextMessageById" parameterType="Long">
+        delete from text_message where id = #{id}
+    </delete>
+
+    <delete id="deleteTextMessageByIds" parameterType="String">
+        delete from text_message where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>