浏览代码

短信记录提交

jingyuanchao 1 年之前
父节点
当前提交
077287ad33

+ 47 - 1
project_data/sql/0.1.0/soc/soc.sql

@@ -120,6 +120,12 @@ INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, quer
 delete from sys_role_menu where menu_id=1797883556555395073;
 insert into sys_role_menu select  id,1797883556555395073 from sys_role where org_type in (1,2,3);
 
+-- 新增短信发送记录查询功能
+delete from sys_menu where id=1798589671832403970;
+INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, status, perms, platform_type, icon, image_path, create_by, create_time, update_by, update_time, remark) VALUES (1798589671832403970, '短信发送记录', 2, 300, '/smsSendLog', 'system/smsSendLog', null, 1, 0, 'C', '0', '0', '', '1', 'list', null, '超级管理员', '2024-06-06 13:35:46', '超级管理员', '2024-06-06 13:39:30', '');
+delete from sys_role_menu where menu_id=1798589671832403970;
+insert into sys_role_menu select  id,1798589671832403970 from sys_role where org_type in (1,2,3,4);
+
 -- 新增 营业网点层级字典
 DELETE FROM `sys_dict_type` WHERE `dict_type` ='sys_org_yewd_level';
 INSERT INTO `sys_dict_type` (`dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ('营业网点层级', 'sys_org_yewd_level', '0', '超级管理员', '2024-05-30 15:59:25', '', NULL, NULL);
@@ -128,6 +134,22 @@ DELETE FROM `sys_dict_data` WHERE `dict_type` ='sys_org_yewd_level';
 INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (1, '一级支行', '1', 'sys_org_yewd_level', NULL, 'default', 'N', '0', '超级管理员', '2024-05-30 15:59:45', '', NULL, NULL);
 INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2, '二级支行', '2', 'sys_org_yewd_level', NULL, 'default', 'N', '0', '超级管理员', '2024-05-30 15:59:55', '', NULL, NULL);
 
+delete from sys_dict_type where dict_type='sms_notify_type';
+delete from sys_dict_data where dict_type='sms_notify_type';
+INSERT INTO sys_dict_type (dict_id, dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) VALUES (20231113213, '短信提醒类型', 'sms_notify_type', '0', '超级管理员', '2024-06-06 14:15:13', '', null, null);
+INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES (20231115161, 10100, '临期提醒', '10100', 'sms_notify_type', null, 'default', 'N', '0', '超级管理员', '2024-06-06 14:15:50', '', null, null);
+INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES (20231115162, 10200, '逾期提醒', '10200', 'sms_notify_type', null, 'default', 'N', '0', '超级管理员', '2024-06-06 14:16:03', '', null, null);
+INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES (20231115163, 4184, '水浸告警', '4184', 'sms_notify_type', null, 'default', 'N', '0', '超级管理员', '2024-06-06 14:17:15', '', null, null);
+INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES (20231115164, 4183, '温湿度告警', '4183', 'sms_notify_type', null, 'default', 'N', '0', '超级管理员', '2024-06-06 14:17:42', '', null, null);
+INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES (20231115165, 4182, '烟感告警', '4182', 'sms_notify_type', null, 'default', 'N', '0', '超级管理员', '2024-06-06 14:18:09', '', null, null);
+INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES (20231115166, 4181, '红外告警', '4181', 'sms_notify_type', null, 'default', 'N', '0', '超级管理员', '2024-06-06 14:18:28', '', null, null);
+INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES (20231115167, 41885, '燃气告警', '41885', 'sms_notify_type', null, 'default', 'N', '0', '超级管理员', '2024-06-06 14:18:53', '', null, null);
+INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES (20231115168, 41881, '盗情告警', '41881', 'sms_notify_type', null, 'default', 'N', '0', '超级管理员', '2024-06-06 14:19:44', '', null, null);
+INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES (20231115169, 4188, '门磁告警', '4188', 'sms_notify_type', null, 'default', 'N', '0', '超级管理员', '2024-06-06 14:20:53', '', null, null);
+
+
+
+
 -- core_resumption_rule_item 刷排序号
 UPDATE core_resumption_rule_item
 SET sort = (
@@ -195,4 +217,28 @@ update core_drill_plan SET create_time = NOW() where create_time IS NULL;
 update core_drill_plan SET update_time = create_time where update_time IS NULL;
 
 -- core_safety_task 刷检查开始时间和结束时间
-update core_safety_task set start_time = submit_time,end_time = submit_time where submit_by is not null;
+update core_safety_task set start_time = submit_time,end_time = submit_time where submit_by is not null;
+
+-- 短信发送记录表
+drop table if exists sms_send_record;
+create table sms_send_record
+(
+    id                 bigint       not null comment '主键'
+        primary key,
+    type               varchar(32)  not null comment '提醒类型,见字典',
+    time               datetime     not null comment '发送时间',
+    tran_type          int          not null comment '交易类型',
+    org_id             bigint       not null comment '接收机构id',
+    org_name           varchar(125) not null comment '接收机构名称',
+    user_id            bigint       not null comment '短信接收人id',
+    user_name          varchar(125) not null comment '接受人名称',
+    user_phone         varchar(125) not null comment '接收人联系方式',
+    content_data       varchar(225) not null comment '短信内容',
+    result             varchar(225) null comment '发送结果',
+    result_description varchar(125) null comment '发送结果描述'
+)
+    comment '短信发送记录';
+
+create index idx_orgId
+    on sms_send_record (org_id);
+

+ 26 - 0
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/sms/dto/SmsSendRecordPageDto.java

@@ -0,0 +1,26 @@
+package com.xunmei.common.core.domain.sms.dto;
+
+
+import com.xunmei.common.core.web.domain.PageRequest;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class SmsSendRecordPageDto extends PageRequest {
+
+    @ApiModelProperty(value = "提醒类型")
+    private  String type;
+
+    @ApiModelProperty(value = "用户名")
+    private  String userName;
+
+    @ApiModelProperty(value = "手机号")
+    private  String mobile;
+
+    @ApiModelProperty(value = "发送时间")
+    private Date[] range;
+
+
+}

+ 48 - 0
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/sms/vo/SmsSendRecordPageVo.java

@@ -0,0 +1,48 @@
+package com.xunmei.common.core.domain.sms.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Data
+public class SmsSendRecordPageVo {
+
+
+    @ApiModelProperty(value = "主键")
+    private Long id;
+
+    @ApiModelProperty(value = "发送时间")
+    private LocalDateTime time;
+
+    @ApiModelProperty(value = "交易类型")
+    private String tranType;
+
+    @ApiModelProperty(value = "接收机构id")
+    private Long orgId;
+
+    @ApiModelProperty(value = "接收机构名称")
+    private String orgName;
+
+    @ApiModelProperty(value = "短信接收人id")
+    private Long userId;
+
+    @ApiModelProperty(value = "接受人名称")
+    private String userName;
+
+    @ApiModelProperty(value = "接收人联系方式")
+    private String userPhone;
+
+    @ApiModelProperty(value = "短信内容")
+    private String contentData;
+
+    @ApiModelProperty(value = "发送结果",notes = "0:成功,1:失败")
+    private String result;
+
+    @ApiModelProperty(value = "发送结果描述")
+    private String resultDescription;
+
+
+
+
+}

+ 18 - 1
soc-modules/soc-modules-sms/src/main/java/com/xunmei/sms/controller/SmsSendRecordController.java

@@ -1,8 +1,13 @@
 package com.xunmei.sms.controller;
 
 
+import com.xunmei.common.core.domain.sms.dto.SmsSendRecordPageDto;
+import com.xunmei.common.core.web.page.TableDataInfo;
+import com.xunmei.sms.service.ISmsSendRecordService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-
 import org.springframework.web.bind.annotation.RestController;
 
 /**
@@ -17,5 +22,17 @@ import org.springframework.web.bind.annotation.RestController;
 @RequestMapping("/SendRecord")
 public class SmsSendRecordController {
 
+    @Autowired
+    private ISmsSendRecordService recordService;
+
+
+    @PostMapping("/page")
+    public TableDataInfo<?> page(@RequestBody SmsSendRecordPageDto req){
+
+        return recordService.pageData(req);
+
+    }
+
+
 }
 

+ 5 - 0
soc-modules/soc-modules-sms/src/main/java/com/xunmei/sms/mapper/SmsSendRecordMapper.java

@@ -1,7 +1,11 @@
 package com.xunmei.sms.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.xunmei.common.core.domain.sms.domain.SmsSendRecord;
+import com.xunmei.common.core.domain.sms.dto.SmsSendRecordPageDto;
+import com.xunmei.common.core.domain.sms.vo.SmsSendRecordPageVo;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * <p>
@@ -13,4 +17,5 @@ import com.xunmei.common.core.domain.sms.domain.SmsSendRecord;
  */
 public interface SmsSendRecordMapper extends BaseMapper<SmsSendRecord> {
 
+    Page<SmsSendRecordPageVo> selectPageData(Page<SmsSendRecordPageVo> pageRequest, @Param("req") SmsSendRecordPageDto req);
 }

+ 3 - 0
soc-modules/soc-modules-sms/src/main/java/com/xunmei/sms/service/ISmsSendRecordService.java

@@ -3,7 +3,9 @@ package com.xunmei.sms.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.xunmei.common.core.domain.reminder.dto.ReminderScheduleMsgDto;
 import com.xunmei.common.core.domain.sms.domain.SmsSendRecord;
+import com.xunmei.common.core.domain.sms.dto.SmsSendRecordPageDto;
 import com.xunmei.common.core.web.domain.AjaxResult;
+import com.xunmei.common.core.web.page.TableDataInfo;
 import com.xunmei.system.api.domain.SysOrg;
 import com.xunmei.system.api.domain.SysUser;
 import com.xunmei.system.api.vo.SmsInfoVo;
@@ -25,4 +27,5 @@ public interface ISmsSendRecordService extends IService<SmsSendRecord> {
     SmsSendRecord saveSmsRecord(SysOrg sysOrg, SysUser sysUser, AjaxResult result, SmsInfoVo smsInfoVo);
     SmsSendRecord saveSmsRecord(ReminderScheduleMsgDto msgDto, AjaxResult result, SmsInfoVo smsInfoVo);
 
+    TableDataInfo<?> pageData(SmsSendRecordPageDto req);
 }

+ 33 - 1
soc-modules/soc-modules-sms/src/main/java/com/xunmei/sms/service/impl/SmsSendRecordServiceImpl.java

@@ -1,23 +1,32 @@
 package com.xunmei.sms.service.impl;
 
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.xunmei.common.core.constant.HttpStatus;
+import com.xunmei.common.core.constant.SecurityConstants;
 import com.xunmei.common.core.domain.reminder.dto.ReminderScheduleMsgDto;
 import com.xunmei.common.core.domain.sms.domain.SmsSendRecord;
+import com.xunmei.common.core.domain.sms.dto.SmsSendRecordPageDto;
+import com.xunmei.common.core.domain.sms.vo.SmsSendRecordPageVo;
 import com.xunmei.common.core.web.domain.AjaxResult;
+import com.xunmei.common.core.web.page.TableDataInfo;
 import com.xunmei.sms.mapper.SmsSendRecordMapper;
 import com.xunmei.sms.service.ISmsSendRecordService;
+import com.xunmei.system.api.RemoteOrgService;
 import com.xunmei.system.api.domain.SysOrg;
 import com.xunmei.system.api.domain.SysUser;
 import com.xunmei.system.api.vo.SmsInfoVo;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.time.LocalDateTime;
 import java.util.Collection;
+import java.util.Date;
 
 /**
  * <p>
@@ -30,11 +39,34 @@ import java.util.Collection;
 @Service
 public class SmsSendRecordServiceImpl extends ServiceImpl<SmsSendRecordMapper, SmsSendRecord> implements ISmsSendRecordService {
 
+    @Autowired
+    private RemoteOrgService remoteOrgService;
+
+    @Override
+    public TableDataInfo<?> pageData(SmsSendRecordPageDto req) {
+        dealReqParam(req);
+        Page<SmsSendRecordPageVo> pageRequest = req.getPageRequest();
+
+        Page<SmsSendRecordPageVo> page = baseMapper.selectPageData(pageRequest, req);
+        return TableDataInfo.build(page);
+    }
+
+    private void dealReqParam(SmsSendRecordPageDto req) {
+        if (req.getCheckSub()) {
+            SysOrg sysOrg = remoteOrgService.selectOrgById(req.getOrgId(), SecurityConstants.INNER);
+            req.setOrgPath(sysOrg.getPath());
+        }
+        if (ObjectUtil.isNotEmpty(req.getRange())) {
+            Date startTime = req.getRange()[0];
+            Date endTime = req.getRange()[1];
+            req.setRange(new Date[]{DateUtil.beginOfDay(startTime), DateUtil.endOfDay(endTime)});
+        }
+    }
 
     @Override
     @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
     public void batchSave(Collection<SmsSendRecord> list) {
-        if (ObjectUtil.isEmpty(list)){
+        if (ObjectUtil.isEmpty(list)) {
             return;
         }
         for (SmsSendRecord smsSendRecord : list) {

+ 22 - 0
soc-modules/soc-modules-sms/src/main/resources/mapper/SmsSendRecordMapper.xml

@@ -2,4 +2,26 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.xunmei.sms.mapper.SmsSendRecordMapper">
 
+    <select id="selectPageData" resultType="com.xunmei.common.core.domain.sms.vo.SmsSendRecordPageVo">
+        SELECT * from sms_send_record r inner join sys_org o on r.org_id=o.id
+        where o.deleted=0
+        <if test="req.checkSub==true">
+            and o.path like concat(#{req.orgPath},'%')
+        </if>
+        <if test="req.checkSub==false">
+            and o.id=#{req.orgId}
+        </if>
+        <if test="req.type != null and req.type != ''">
+            and r.type=#{req.type}
+        </if>
+        <if test="req.mobile != null and req.mobile != ''">
+            and r.user_phone=#{req.mobile}
+        </if>
+        <if test="req.userName != null and req.userName != ''">
+            and r.user_name=#{req.userName}
+        </if>
+        <if test="req.range != null and req.range.length==2 ">
+            and r.time between #{req.range[0]} and #{req.range[1]}
+        </if>
+    </select>
 </mapper>