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