cloudroam
2024-10-15 e0e1694d28c1eeb2edddfde6a738dd6259b0ad1d
add:短信模板通知
已修改2个文件
48 ■■■■■ 文件已修改
src/main/java/com/mzl/flower/mapper/payment/OrderMapper.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/schedule/ScheduleService.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/mapper/payment/OrderMapper.java
@@ -55,4 +55,19 @@
    List<OrderListExportDTO> selectOrderExportList(@Param("condition") OrderQueryDTO dto);
    @Select("SELECT si.contact_tel " +
            "FROM t_supplier_info si " +
            "WHERE si.id IN ( " +
            "    SELECT oi.supplier_id " +
            "    FROM t_order_item oi " +
            "    JOIN t_order q ON oi.order_id = q.id " +
            "    WHERE q.deleted = 0 " +
            "        AND q.status_backend = #{Status}  " +
            "        AND q.payment_time >=  #{startTime}  " +
            "        AND q.payment_time <=  #{endTime}  " +
            "    GROUP BY oi.supplier_id " +
            ")")
    List<String> getWaitSendMessageInfoBySupplier(String Status, LocalDateTime startTime, LocalDateTime endTime);
}
src/main/java/com/mzl/flower/schedule/ScheduleService.java
@@ -1,5 +1,6 @@
package com.mzl.flower.schedule;
import com.aliyuncs.exceptions.ClientException;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mzl.flower.constant.Constants;
import com.mzl.flower.dto.response.member.MemberGrowthRecordVO;
@@ -11,21 +12,24 @@
import com.mzl.flower.mapper.member.MemberGrowthRecordMapper;
import com.mzl.flower.mapper.partner.PartnerMapper;
import com.mzl.flower.mapper.payment.OrderMapper;
import com.mzl.flower.service.BaseService;
import com.mzl.flower.service.coupon.CouponRecordService;
import com.mzl.flower.service.coupon.CouponTemplateService2;
import com.mzl.flower.service.flower.FlowerCategoryService;
import com.mzl.flower.service.menber.impl.GrowthValueDealService;
import com.mzl.flower.service.payment.*;
import com.mzl.flower.thread.FlowerCategoryPriceThread;
import com.mzl.flower.utils.SmsUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.ArrayList;
import java.util.List;
@@ -77,6 +81,9 @@
    @Autowired
    private FlowerCategoryPriceThread thread;
    @Autowired
    private BaseService baseService;
    @Scheduled(cron = "1 1 0/2 * * ?")
    public void calculateAvePrice() {
@@ -255,6 +262,28 @@
        log.info("优惠券记录过期开始:" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss"));
    }
    @Scheduled(cron = "0 15 17 * * ?")
    public void DealSendMessageInfoBySupplier() {
        log.info("供应商下单供货提示开始:" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss"));
        // 获取当前日期
        LocalDate currentDate = LocalDate.now();
        // 设置开始时间为前一天的17点以后
        LocalDateTime startDateTime = LocalDateTime.of(currentDate.minusDays(1), LocalTime.of(17, 0));
        // 设置结束时间为当前日期的17点
        LocalDateTime endDateTime = LocalDateTime.of(currentDate, LocalTime.of(17, 0));
        System.out.println("开始时间: " + startDateTime);
        System.out.println("结束时间: " + endDateTime);
        List<String> sends = orderMapper.getWaitSendMessageInfoBySupplier("SEND", startDateTime, endDateTime);
        if(CollectionUtils.isNotEmpty(sends)) {
            sends.forEach(s -> {
                try {
                    SmsUtil.sendSms(s, "SMS_474500141", null);
                } catch (ClientException e) {
                    log.error("发送短信失败,手机号:" + s, e);
                }
            });
        }
        log.info("供应商下单供货提示结束:" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss"));
    }
}