From 611b5b0672f91889c5b151b5d2e21ec344b27b4b Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期四, 27 二月 2025 11:44:37 +0800 Subject: [PATCH] 短信 --- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillServiceImpl.java | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillServiceImpl.java index 88b06ed..0386353 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillServiceImpl.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.basic.PageInfo; +import com.ruoyi.common.config.SmsProperties; import com.ruoyi.common.constant.AmountConstant; import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.core.redis.RedisCache; @@ -30,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import javax.validation.constraints.NotEmpty; import java.util.*; import java.util.stream.Collectors; import java.math.BigDecimal; @@ -79,7 +81,8 @@ @Resource SmsUtil smsUtil; - + @Resource + SmsProperties smsProperties; public PageInfo<TBillDto> queryPage(TBillQuery query){ PageInfo<TBill> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); PageInfo<TBillDto> info = tBillMapper.page(pageInfo, query); @@ -359,9 +362,9 @@ public Integer sendSmsByBillIds(SmsByBillDto dto) { int failNum = 0; for (String billId : dto.getBillIds()) { - TBillDto bill = getTenentByBillId(billId); + TBillDto bill = getDetailByBillId(billId); if (bill.getSmsLastTime()!=null - && (System.currentTimeMillis()-bill.getSmsLastTime().getTime()<smsUtil.getPro().getBillSmsDelayPeriod()*60*1000L)){ + && (System.currentTimeMillis()-bill.getSmsLastTime().getTime()<smsProperties.getBillSmsDelayPeriod()*60*1000L)){ throw new ServiceException("有账单最近一次发送的时间是:"+DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,bill.getSmsLastTime())); } if (StringUtils.isEmpty(bill.getPhone())){ @@ -388,9 +391,9 @@ public Integer sendMailBatchByBillIds(SmsByBillDto dto) { int failNum = 0; for (String billId : dto.getBillIds()) { - TBillDto bill = getTenentByBillId(billId); + TBillDto bill = getDetailByBillId(billId); if (bill.getSmsLastTime()!=null - && (System.currentTimeMillis()-bill.getSmsLastTime().getTime()<smsUtil.getPro().getBillMailDelayPeriod()*60*1000L)){ + && (System.currentTimeMillis()-bill.getSmsLastTime().getTime()<smsProperties.getBillMailDelayPeriod()*60*1000L)){ throw new ServiceException("有账单最近一次发送的时间是:"+DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,bill.getSmsLastTime())); } if (StringUtils.isEmpty(bill.getEmail())){ @@ -413,8 +416,8 @@ return failNum; } - private TBillDto getTenentByBillId(String billId) { - return getBaseMapper().selectTenentByBillId(billId); + public TBillDto getDetailByBillId(@NotEmpty String billId) { + return getBaseMapper().selectDetailByBillId(billId); } -- Gitblit v1.7.1