|
|
|
@ -1,7 +1,6 @@
|
|
|
|
|
package com.hnac.hzims.message.schedule; |
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|
|
|
@ -20,20 +19,16 @@ import com.xxl.job.core.handler.annotation.XxlJob;
|
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
|
|
import java.time.LocalDate; |
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
import java.time.LocalTime; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
import static com.hnac.hzims.message.constants.XxlJobConstants.PUSH_MESSAGE_BY_NOTICE; |
|
|
|
|
import static com.hnac.hzims.message.constants.XxlJobConstants.PUSH_SMS_MESSAGE_BY_NOTICE; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @ClassName MessagePushSchedule |
|
|
|
@ -108,7 +103,7 @@ public class MessagePushSchedule {
|
|
|
|
|
|
|
|
|
|
/** @Author hx |
|
|
|
|
* @Description 获取群推送内容 |
|
|
|
|
* @Date 2023/4/4 16:06 |
|
|
|
|
* @Date 2023/4/4 16:06r |
|
|
|
|
* @Param [type, list] |
|
|
|
|
* @return java.lang.String |
|
|
|
|
**/ |
|
|
|
@ -117,13 +112,19 @@ public class MessagePushSchedule {
|
|
|
|
|
return list.stream().map(MessagePushRecordEntity::getContent).collect(Collectors.joining("\r\n")); |
|
|
|
|
} |
|
|
|
|
else if(MessageConstants.SMS_PUSH.equals(type)) { |
|
|
|
|
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
Map<String,String> params = new HashMap<>(); |
|
|
|
|
list.stream().map(MessagePushRecordEntity::getSmsParam).forEachOrdered(param -> { |
|
|
|
|
JSONObject paramJson = JSONObject.parseObject(param); |
|
|
|
|
paramJson.forEach((k,v) -> { |
|
|
|
|
params.put(k, params.containsKey(k) && Func.isNotEmpty(params.get(k)) ? params.get(k) + "," + v : (String) v); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
Optional<MessagePushRecordEntity> min = list.stream().min(Comparator.comparing(MessagePushRecordEntity::getPlanTime)); |
|
|
|
|
Optional<MessagePushRecordEntity> max = list.stream().max(Comparator.comparing(MessagePushRecordEntity::getPlanTime)); |
|
|
|
|
params.put("one",df.format(min.get().getPlanTime())); |
|
|
|
|
params.put("two",df.format(max.get().getPlanTime())); |
|
|
|
|
params.put("three",String.valueOf(list.size())); |
|
|
|
|
// list.stream().map(MessagePushRecordEntity::getSmsParam).forEachOrdered(param -> {
|
|
|
|
|
// JSONObject paramJson = JSONObject.parseObject(param);
|
|
|
|
|
// paramJson.forEach((k,v) -> {
|
|
|
|
|
// params.put(k, params.containsKey(k) && Func.isNotEmpty(params.get(k)) ? params.get(k) + "," + v : (String) v);
|
|
|
|
|
// });
|
|
|
|
|
// });
|
|
|
|
|
return JSON.toJSONString(params); |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|