Browse Source

提交短信-集中推送相关代码

zhongwei
tyty 2 years ago
parent
commit
13b2ee113e
  1. 29
      hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java
  2. 6
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java

29
hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java

@ -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;

6
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java

@ -27,7 +27,6 @@ import com.hnac.hzims.ticket.twoTicket.service.IWorkTicketFinishService;
import com.hnac.hzims.ticket.twoTicket.service.TicketProcessService; import com.hnac.hzims.ticket.twoTicket.service.TicketProcessService;
import com.hnac.hzims.ticket.twoTicket.vo.process.FristWorkTicketVo; import com.hnac.hzims.ticket.twoTicket.vo.process.FristWorkTicketVo;
import com.hnac.hzims.ticket.twoTicket.vo.process.WorkTicketVo; import com.hnac.hzims.ticket.twoTicket.vo.process.WorkTicketVo;
import com.hnac.hzims.ticket.utils.ExcelUtil;
import com.hnac.hzims.ticket.utils.PdfUtils; import com.hnac.hzims.ticket.utils.PdfUtils;
import com.hnac.hzims.ticket.workTicket.entity.*; import com.hnac.hzims.ticket.workTicket.entity.*;
import com.hnac.hzims.ticket.workTicket.service.*; import com.hnac.hzims.ticket.workTicket.service.*;
@ -52,13 +51,8 @@ import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletResponse;
import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;

Loading…
Cancel
Save