短信汇总

This commit is contained in:
zhangheng 2026-09-30 16:39:50 +08:00
parent 79d1cf9c31
commit 6cd3a7e85b
12 changed files with 154 additions and 5 deletions

View File

@ -9,6 +9,8 @@ import com.xinelu.common.utils.poi.ExcelUtil;
import com.xinelu.manage.domain.phonedialrecord.PhoneDialRecord;
import com.xinelu.manage.service.phonedialrecord.IPhoneDialRecordService;
import com.xinelu.manage.vo.phonedialrecord.BillPhoneDialVo;
import com.xinelu.manage.vo.shortmessagesendrecord.RecordSummary;
import com.xinelu.manage.vo.shortmessagesendrecord.ShortMessageSendRecordVo;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
@ -97,4 +99,16 @@ public class PhoneDialRecordController extends BaseController {
public AjaxResult phoneCount() {
return phoneDialRecordService.phoneCount();
}
/**
* 导出短信发送结果汇总
*/
@PreAuthorize("@ss.hasPermi('system:shortMessageSendRecord:summaryExport')")
@Log(title = "短信发送结果汇总", businessType = BusinessType.EXPORT)
@PostMapping("/phoneSummaryExport")
public void summaryExport(HttpServletResponse response, BillPhoneDialVo phoneDialRecord) {
List<RecordSummary> list = phoneDialRecordService.selectPhoneRecordSummary(phoneDialRecord);
ExcelUtil<RecordSummary> util = new ExcelUtil<>(RecordSummary.class);
util.exportExcel(response, list, "电话拨打记录汇总");
}
}

View File

@ -8,6 +8,7 @@ import com.xinelu.common.enums.BusinessType;
import com.xinelu.common.utils.poi.ExcelUtil;
import com.xinelu.manage.domain.shortmessagesendrecord.ShortMessageSendRecord;
import com.xinelu.manage.service.shortmessagesendrecord.IShortMessageSendRecordService;
import com.xinelu.manage.vo.shortmessagesendrecord.RecordSummary;
import com.xinelu.manage.vo.shortmessagesendrecord.ShortMessageSendRecordVo;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
@ -97,4 +98,16 @@ public class ShortMessageSendRecordController extends BaseController {
public AjaxResult messageCount() {
return shortMessageSendRecordService.messageCount();
}
/**
* 导出短信发送结果汇总列表
*/
@PreAuthorize("@ss.hasPermi('system:shortMessageSendRecord:summaryExport')")
@Log(title = "短信发送结果汇总", businessType = BusinessType.EXPORT)
@PostMapping("/summaryExport")
public void summaryExport(HttpServletResponse response, ShortMessageSendRecordVo shortMessageSendRecord) {
List<RecordSummary> list = shortMessageSendRecordService.selectRecordSummary(shortMessageSendRecord);
ExcelUtil<RecordSummary> util = new ExcelUtil<>(RecordSummary.class);
util.exportExcel(response, list, "短信发送结果记录汇总");
}
}

View File

@ -6,6 +6,7 @@ import com.xinelu.manage.dto.phonedialrecord.PhoneDialRecordDto;
import com.xinelu.manage.dto.statistics.FollowUpRateDto;
import com.xinelu.manage.vo.phonedialrecord.BillPhoneDialVo;
import com.xinelu.manage.vo.phonedialrecord.PhoneDialRecordVo;
import com.xinelu.manage.vo.shortmessagesendrecord.RecordSummary;
import com.xinelu.manage.vo.statistics.PushCount;
import org.apache.ibatis.annotations.Param;
@ -131,4 +132,12 @@ public interface PhoneDialRecordMapper {
* @return int
*/
int updatePhoneDialRecordByIds(@Param("ids") List<Long> ids, @Param("billId") Long billId);
/**
* 电话发送结果汇总
*
* @param billPhoneDialVo 时间
* @return RecordSummary
*/
RecordSummary selectPhoneRecordSummary(BillPhoneDialVo billPhoneDialVo);
}

View File

@ -3,6 +3,7 @@ package com.xinelu.manage.mapper.shortmessagesendrecord;
import com.xinelu.manage.domain.shortmessagesendrecord.ShortMessageSendRecord;
import com.xinelu.manage.dto.billinfo.BillInfoDto;
import com.xinelu.manage.dto.statistics.FollowUpRateDto;
import com.xinelu.manage.vo.shortmessagesendrecord.RecordSummary;
import com.xinelu.manage.vo.shortmessagesendrecord.ShortMessageSendRecordVo;
import com.xinelu.manage.vo.statistics.MessageSendVo;
import com.xinelu.manage.vo.statistics.PushCount;
@ -131,4 +132,12 @@ public interface ShortMessageSendRecordMapper {
* @return int
*/
int selectSendRecordCountByNodeId(Long nodeId);
/**
* 短信发送结果汇总
*
* @param shortMessageSendRecord 时间
* @return RecordSummary
*/
RecordSummary selectRecordSummary(ShortMessageSendRecordVo shortMessageSendRecord);
}

View File

@ -3,6 +3,7 @@ package com.xinelu.manage.service.phonedialrecord;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.manage.domain.phonedialrecord.PhoneDialRecord;
import com.xinelu.manage.vo.phonedialrecord.BillPhoneDialVo;
import com.xinelu.manage.vo.shortmessagesendrecord.RecordSummary;
import java.util.List;
@ -65,4 +66,12 @@ public interface IPhoneDialRecordService {
* 电话推送统计
*/
AjaxResult phoneCount();
/**
* 电话发送结果汇总
*
* @param billPhoneDialVo 时间
* @return RecordSummary
*/
List<RecordSummary> selectPhoneRecordSummary(BillPhoneDialVo billPhoneDialVo);
}

View File

@ -5,6 +5,7 @@ import com.xinelu.manage.domain.phonedialrecord.PhoneDialRecord;
import com.xinelu.manage.mapper.phonedialrecord.PhoneDialRecordMapper;
import com.xinelu.manage.service.phonedialrecord.IPhoneDialRecordService;
import com.xinelu.manage.vo.phonedialrecord.BillPhoneDialVo;
import com.xinelu.manage.vo.shortmessagesendrecord.RecordSummary;
import com.xinelu.manage.vo.statistics.PushCount;
import org.springframework.stereotype.Service;
@ -12,6 +13,7 @@ import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@ -45,7 +47,7 @@ public class PhoneDialRecordServiceImpl implements IPhoneDialRecordService {
*/
@Override
public List<BillPhoneDialVo> selectPhoneDialRecordList(BillPhoneDialVo phoneDialRecord) {
if (Objects.nonNull(phoneDialRecord.getDialTimeEnd())){
if (Objects.nonNull(phoneDialRecord.getDialTimeEnd())) {
phoneDialRecord.setDialTimeEnd(phoneDialRecord.getDialTimeEnd().plusDays(1));
}
return phoneDialRecordMapper.selectPhoneDialRecords(phoneDialRecord);
@ -111,4 +113,19 @@ public class PhoneDialRecordServiceImpl implements IPhoneDialRecordService {
}
return AjaxResult.success(pushCount);
}
/**
* 电话发送结果汇总
*
* @param billPhoneDialVo 时间
* @return RecordSummary
*/
@Override
public List<RecordSummary> selectPhoneRecordSummary(BillPhoneDialVo billPhoneDialVo) {
RecordSummary recordSummary = phoneDialRecordMapper.selectPhoneRecordSummary(billPhoneDialVo);
recordSummary.setDateRange(billPhoneDialVo.getDialTimeStart() + "——————" + billPhoneDialVo.getDialTimeEnd());
List<RecordSummary> recordSummaries = new ArrayList<>();
recordSummaries.add(recordSummary);
return recordSummaries;
}
}

View File

@ -2,6 +2,7 @@ package com.xinelu.manage.service.shortmessagesendrecord;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.manage.domain.shortmessagesendrecord.ShortMessageSendRecord;
import com.xinelu.manage.vo.shortmessagesendrecord.RecordSummary;
import com.xinelu.manage.vo.shortmessagesendrecord.ShortMessageSendRecordVo;
import java.util.List;
@ -65,4 +66,12 @@ public interface IShortMessageSendRecordService {
* 短信推送统计
*/
AjaxResult messageCount();
/**
* 短信发送结果汇总
*
* @param shortMessageSendRecord 时间
* @return RecordSummary
*/
List<RecordSummary> selectRecordSummary(ShortMessageSendRecordVo shortMessageSendRecord);
}

View File

@ -4,6 +4,7 @@ import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.manage.domain.shortmessagesendrecord.ShortMessageSendRecord;
import com.xinelu.manage.mapper.shortmessagesendrecord.ShortMessageSendRecordMapper;
import com.xinelu.manage.service.shortmessagesendrecord.IShortMessageSendRecordService;
import com.xinelu.manage.vo.shortmessagesendrecord.RecordSummary;
import com.xinelu.manage.vo.shortmessagesendrecord.ShortMessageSendRecordVo;
import com.xinelu.manage.vo.statistics.PushCount;
import org.springframework.stereotype.Service;
@ -12,6 +13,7 @@ import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@ -111,4 +113,13 @@ public class ShortMessageSendRecordServiceImpl implements IShortMessageSendRecor
}
return AjaxResult.success(pushCount);
}
@Override
public List<RecordSummary> selectRecordSummary(ShortMessageSendRecordVo shortMessageSendRecord) {
RecordSummary recordSummary = shortMessageSendRecordMapper.selectRecordSummary(shortMessageSendRecord);
recordSummary.setDateRange(shortMessageSendRecord.getSendTimeStart() + "——————" + shortMessageSendRecord.getSendTimeEnd());
List<RecordSummary> recordSummaries = new ArrayList<>();
recordSummaries.add(recordSummary);
return recordSummaries;
}
}

View File

@ -0,0 +1,30 @@
package com.xinelu.manage.vo.shortmessagesendrecord;
import lombok.Data;
/**
* 电话短信推送记录汇总
*/
@Data
public class RecordSummary {
/**
* 时间范围
*/
private String dateRange;
/**
* 总数
*/
private Integer totalCount;
/**
* 成功数量
*/
private Integer successCount;
/**
* 失败数量
*/
private Integer failCount;
}

View File

@ -78,28 +78,28 @@ public class ShortMessageSendRecordVo {
* 短信长度
*/
@ApiModelProperty(value = "短信长度")
@Excel(name = "短信长度")
@Excel(name = "短信长度", cellType = Excel.ColumnType.NUMERIC)
private Long messageLength;
/**
* 短信数量
*/
@ApiModelProperty(value = "短信数量")
@Excel(name = "短信数量")
@Excel(name = "短信数量", cellType = Excel.ColumnType.NUMERIC)
private Long messageQuantity;
/**
* 短信单价
*/
@ApiModelProperty(value = "短信单价")
@Excel(name = "短信单价")
@Excel(name = "短信单价", cellType = Excel.ColumnType.NUMERIC)
private BigDecimal messageUnitPrice;
/**
* 短信价格
*/
@ApiModelProperty(value = "短信价格")
@Excel(name = "短信价格")
@Excel(name = "短信价格", cellType = Excel.ColumnType.NUMERIC)
private BigDecimal messageExpense;
/**

View File

@ -410,4 +410,17 @@
#{id}
</foreach>
</update>
<select id="selectPhoneRecordSummary"
resultType="com.xinelu.manage.vo.shortmessagesendrecord.RecordSummary">
SELECT COUNT(1) AS totalCount,
COALESCE(SUM(CASE WHEN t.error_status = 'success' THEN 1 ELSE 0 END),
0) AS successCount,
COALESCE(SUM(CASE WHEN t.error_status = 'fail' THEN 1 ELSE 0 END), 0) AS failCount,
COALESCE(SUM(CASE WHEN t.error_status = 'success'
THEN t.phone_duration END), 0) AS successDuration
FROM phone_dial_record t
WHERE t.dial_time >= #{dialTimeStart}
AND t.dial_time &lt; DATEADD(DAY, 1, #{dialTimeEnd})
</select>
</mapper>

View File

@ -462,4 +462,19 @@
from short_message_send_record
where manage_route_node_id = #{nodeId}
</select>
<select id="selectRecordSummary" resultType="com.xinelu.manage.vo.shortmessagesendrecord.RecordSummary">
SELECT COALESCE(SUM(COALESCE(t.message_quantity, 1)), 0) AS totalCount,
COALESCE(SUM(CASE
WHEN t.error_status = 'success'
THEN COALESCE(t.message_quantity, 1)
ELSE 0 END), 0) AS successCount,
COALESCE(SUM(CASE
WHEN t.error_status = 'fail'
THEN COALESCE(t.message_quantity, 1)
ELSE 0 END), 0) AS failCount
FROM fd_message_send_record t
WHERE t.send_time >= #{sendTimeStart}
AND t.send_time &lt; DATEADD(DAY, 1, #{sendTimeEnd})
</select>
</mapper>