fix:钉钉消息限制

This commit is contained in:
Xiang
2026-01-26 09:23:56 +08:00
parent 0d2ae54678
commit 94b46737da
4 changed files with 67 additions and 6 deletions

View File

@@ -1,12 +1,13 @@
package com.xiang.app.schedule.jntyzx;
import com.google.common.collect.Maps;
import com.xiang.app.common.service.dingtalk.JtDingTalkFactory;
import com.xiang.app.modules.jntyzx.constants.RedisKeyConstant;
import com.xiang.app.modules.jntyzx.entity.pojo.UserTokenInfoDO;
import com.xiang.app.modules.jntyzx.entity.resp.query.SitePositionList;
import com.xiang.app.modules.jntyzx.service.IJntyzxHttpService;
import com.xiang.app.modules.jntyzx.service.IUserTokenInfoService;
import com.xiang.app.modules.jntyzx.service.IVenueService;
import com.xiang.app.modules.jntyzx.utils.MsgSendUtils;
import com.xiang.app.modules.jntyzx.utils.VenueInfoUtils;
import com.xiang.app.modules.jntyzx.utils.WeekendUtils;
import com.xiang.core.quartz.annotation.XxzJob;
@@ -36,8 +37,8 @@ public class JtVenuePullTask {
private final IUserTokenInfoService userTokenInfoService;
private final IJntyzxHttpService jntyzxHttpService;
private final JtDingTalkFactory jtDingTalkFactory;
private final IVenueService venueService;
private final MsgSendUtils msgSendUtils;
@XxzJob(name = "jtVenueInfoPullTask")
@GetMapping("/jtVenueInfoPullTask")
@@ -71,11 +72,14 @@ public class JtVenuePullTask {
return;
}
StringBuffer msg = new StringBuffer("查询到20:00-22:00空闲场地信息===>\n时间:" + DateUtils.getDateFromDate(LocalDate.now()));
StringBuffer msg = new StringBuffer(
"查询到20:00-22:00空闲场地信息=====>\n时间:" + DateUtils.getDateFromDate(LocalDate.now()) + "\n");
sitePositionLists.forEach(item -> {
msg.append(item.getPlaceName()).append("\n");
});
jtDingTalkFactory.sendMsg(msg.toString());
String key = RedisKeyConstant.JNTYZX_VENUE_MSG_SEND_KEY + RedisKeyConstant.getDate();
msgSendUtils.sendMsgRestrict1Hours(key, msg.toString());
}
}

View File

@@ -16,7 +16,6 @@ import com.xiang.xservice.basic.utils.DateUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -78,7 +77,7 @@ public class JtVenueTomorrowPullTask {
}
map.put(sitePositionList.getPlaceName(), sitePositionList);
}
StringBuffer msg = new StringBuffer("查询江体场地信息===>时间:\n" + DateUtils.getDateFromDate(LocalDate.now().plusDays(1)) + " 20:00-22:00\n");
StringBuffer msg = new StringBuffer("查询江体场地信息=====>\n时间:" + DateUtils.getDateFromDate(LocalDate.now().plusDays(1)) + " 20:00-22:00\n");
map.forEach((placeName, sitePositionList) -> {
msg.append(placeName).append("订购人:").append(sitePositionList.getContacts()).append("\n");
});