Jelajahi Sumber

短信发送记录新增发送人条件查询;
新增短信发送成功数量统计接口;

codingliang 2 tahun lalu
induk
melakukan
b1b42d6db6

+ 3 - 0
src/main/java/com/sqx/modules/errand/IndentSmsSendLogVO.java

@@ -14,4 +14,7 @@ public class IndentSmsSendLogVO extends TbIndentSmsSendLog {
 
     @ApiModelProperty("图片")
     private String imgs;
+
+    @ApiModelProperty("发送人电话号码")
+    private String sendFromPhone;
 }

+ 7 - 0
src/main/java/com/sqx/modules/errand/controller/TbIndentSmsController.java

@@ -70,6 +70,13 @@ public class TbIndentSmsController {
         return Result.success().put("data", pageUtils);
     }
 
+    @ApiOperation("短信发送成功数量统计")
+    @GetMapping(value = "count-of-send-success")
+    public Result countOfSendSuccess() {
+        int count = smsSendLogService.countOfSendSuccess();
+        return Result.success().put("data", count);
+    }
+
     @ApiOperation("删除短信发送记录")
     @DeleteMapping(value = "log")
     public Result delLogs(@RequestBody Long[] ids) {

+ 4 - 1
src/main/java/com/sqx/modules/errand/dto/SmsLogQueryDTO.java

@@ -21,7 +21,10 @@ public class SmsLogQueryDTO extends PageQuery {
     @ApiModelProperty("是否发送成功")
     private String successFlag;
 
-    @ApiModelProperty("接受人")
+    @ApiModelProperty("发送人电话")
+    private String fromTo;
+
+    @ApiModelProperty("接受人电话")
     private String sendTo;
 
     @ApiModelProperty("查询开始时间")

+ 6 - 0
src/main/java/com/sqx/modules/errand/service/TbIndentSmsSendLogService.java

@@ -16,4 +16,10 @@ public interface TbIndentSmsSendLogService extends IService<TbIndentSmsSendLog>
      * @param smsSendResult 短信发送结果
      */
     void saveLog(Long indentId, SmsSendResult smsSendResult);
+
+    /**
+     * 统计发送成功的短信条数
+     * @return count
+     */
+    int countOfSendSuccess();
 }

+ 9 - 0
src/main/java/com/sqx/modules/errand/service/impl/TbIndentSmsSendLogServiceImpl.java

@@ -1,9 +1,11 @@
 package com.sqx.modules.errand.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.sqx.common.sms.SmsSendResult;
+import com.sqx.common.utils.Constant;
 import com.sqx.common.utils.PageUtils;
 import com.sqx.modules.errand.IndentSmsSendLogVO;
 import com.sqx.modules.errand.dao.TbIndentSmsSendLogDao;
@@ -39,4 +41,11 @@ public class TbIndentSmsSendLogServiceImpl extends ServiceImpl<TbIndentSmsSendLo
 
         save(log);
     }
+
+    @Override
+    public int countOfSendSuccess() {
+        LambdaQueryWrapper<TbIndentSmsSendLog> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(TbIndentSmsSendLog::getSuccessFlag, Constant.YES);
+        return this.count(queryWrapper);
+    }
 }

+ 2 - 1
src/main/resources/mapper/errand/TbIndentSmsSendLogMapper.xml

@@ -4,11 +4,12 @@
 <mapper namespace="com.sqx.modules.errand.dao.TbIndentSmsSendLogDao">
     <select id="logPage" resultType="com.sqx.modules.errand.IndentSmsSendLogVO">
         select
-               issl.*, o.delivery_imgs as imgs
+               issl.*, o.delivery_imgs as imgs, u.phone as sendFromPhone
         from
             tb_indent_sms_send_log issl
         left join tb_indent i on i.indent_id = issl.order_id
         left join tb_order o on o.order_id = i.order_id
+        left join tb_user u on u.user_id = issl.send_from_id
         <where>
             <if test="query.orderId != null">
                 and issl.order_id = #{query.orderId}