|
@@ -20,6 +20,7 @@ import com.tzld.piaoquan.wecom.utils.page.Page;
|
|
import com.xxl.job.core.biz.model.ReturnT;
|
|
import com.xxl.job.core.biz.model.ReturnT;
|
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
@@ -55,12 +56,20 @@ public class WeComHistoryDataJob {
|
|
|
|
|
|
@XxlJob("saveHistoryMessageJob")
|
|
@XxlJob("saveHistoryMessageJob")
|
|
public ReturnT<String> selectHistoryMessageByDay(String param) {
|
|
public ReturnT<String> selectHistoryMessageByDay(String param) {
|
|
- HistoryMessageExample example = new HistoryMessageExample();
|
|
|
|
- example.setOrderByClause("create_time desc");
|
|
|
|
- example.setPage(new Page<>(1, 1));
|
|
|
|
- List<HistoryMessage> historyMessages = historyMessageMapper.selectByExample(example);
|
|
|
|
- long startTime = historyMessages.get(0).getCreateTime().getTime() / 1000;
|
|
|
|
- long endTime = System.currentTimeMillis() / 1000;
|
|
|
|
|
|
+ long endTime;
|
|
|
|
+ long startTime;
|
|
|
|
+ if (StringUtils.isEmpty(param)) {
|
|
|
|
+ HistoryMessageExample example = new HistoryMessageExample();
|
|
|
|
+ example.setOrderByClause("create_time desc");
|
|
|
|
+ example.setPage(new Page<>(1, 1));
|
|
|
|
+ List<HistoryMessage> historyMessages = historyMessageMapper.selectByExample(example);
|
|
|
|
+ startTime = historyMessages.get(0).getCreateTime().getTime() / 1000;
|
|
|
|
+ endTime = System.currentTimeMillis() / 1000;
|
|
|
|
+ } else {
|
|
|
|
+ String[] split = param.split(",");
|
|
|
|
+ startTime = Long.parseLong(split[0]);
|
|
|
|
+ endTime = Long.parseLong(split[1]);
|
|
|
|
+ }
|
|
for (; startTime < endTime; startTime += TimeConstant.DAY) {
|
|
for (; startTime < endTime; startTime += TimeConstant.DAY) {
|
|
selectHistoryMessage(startTime, Math.min(startTime + TimeConstant.DAY, endTime));
|
|
selectHistoryMessage(startTime, Math.min(startTime + TimeConstant.DAY, endTime));
|
|
}
|
|
}
|