feat:芬玩岛演唱会预售提醒
This commit is contained in:
@@ -4,6 +4,9 @@ import com.xiang.xservice.fwd.entity.pojo.FPerformProjectInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-07-24 17:22
|
||||
@@ -16,4 +19,6 @@ public interface FwdPerformProjectInfoMapper {
|
||||
int insert(FPerformProjectInfo fPerformProjectInfo);
|
||||
|
||||
int update(FPerformProjectInfo fPerformProjectInfo);
|
||||
|
||||
List<FPerformProjectInfo> getPreSaleTodayData(LocalDateTime startTime, LocalDateTime endTime);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.xiang.xservice.fwd.schedule;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.xiang.xservice.basic.utils.DateUtils;
|
||||
import com.xiang.xservice.basic.xservice.dingTalk.service.DingTalkService;
|
||||
import com.xiang.xservice.fwd.entity.pojo.FPerformProjectInfo;
|
||||
import com.xiang.xservice.fwd.mapper.FwdPerformProjectInfoMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2025-07-25 14:13
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class FwdImportantMsgJob {
|
||||
|
||||
private final FwdPerformProjectInfoMapper performProjectInfoMapper;
|
||||
private final DingTalkService dingTalkService;
|
||||
|
||||
@Value("${DingTalk.chatId}")
|
||||
private String chatId;
|
||||
|
||||
@Scheduled(cron = "0 0 8 1/1 * ?")
|
||||
@PostMapping("/preSaleReminderJob")
|
||||
public void preSaleReminderJob() throws Exception {
|
||||
log.info("【芬玩岛】演唱会预售定时任务开始!time:{}", System.currentTimeMillis());
|
||||
|
||||
// 查询所有即将今天预售的演唱会信息
|
||||
LocalDate now = LocalDate.now();
|
||||
List<FPerformProjectInfo> saleTodayData = performProjectInfoMapper.getPreSaleTodayData(now.atTime(0, 0, 0), now.atTime(23, 59, 59));
|
||||
if (CollectionUtils.isEmpty(saleTodayData)) {
|
||||
log.info("【芬玩岛】 今天:{}暂无预售的演唱会门票信息.", now);
|
||||
return;
|
||||
}
|
||||
log.info("【芬玩岛】 即将:{}预售的演唱会门票信息:{}", now, JSONObject.toJSONString(saleTodayData));
|
||||
StringBuilder msg = new StringBuilder("今日" + now + "演唱会门票预售信息:\n");
|
||||
for (FPerformProjectInfo data : saleTodayData) {
|
||||
msg.append("演唱会名称:").append(data.getProjectName()).append("预售时间:").append(DateUtils.getDateTimeStr(data.getPreSaleTime())).append("\n");
|
||||
}
|
||||
dingTalkService.sendChatMessage(chatId, msg.toString());
|
||||
log.info("【芬玩岛】演唱会预售定时任务结束!time:{}", System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@
|
||||
<result column="project_start_date" property="projectStartDate" />
|
||||
<result column="project_end_date" property="projectEndDate" />
|
||||
<result column="sub_classify_name" property="subClassifyName" />
|
||||
<result column="pre_sale_time" property="preSaleTime"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
@@ -43,7 +44,8 @@
|
||||
project_price,
|
||||
project_start_date,
|
||||
project_end_date,
|
||||
sub_classify_name
|
||||
sub_classify_name,
|
||||
pre_sale_time
|
||||
</sql>
|
||||
|
||||
<insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id" parameterType="com.xiang.xservice.fwd.entity.pojo.FPerformProjectInfo">
|
||||
@@ -198,6 +200,11 @@
|
||||
from fwd_perform_project_info
|
||||
where project_id = #{projectId}
|
||||
</select>
|
||||
<select id="getPreSaleTodayData" resultMap="BaseResultMap">
|
||||
select <include refid="Base_Column_List"/>
|
||||
from fwd_perform_project_info
|
||||
where pre_sale_time between #{startTime} and #{endTime} and status = 21
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user