From 13b2ee113e0a79f080fb32c79c1fc502136b4d11 Mon Sep 17 00:00:00 2001 From: tyty Date: Tue, 16 May 2023 18:25:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E7=9F=AD=E4=BF=A1-=E9=9B=86?= =?UTF-8?q?=E4=B8=AD=E6=8E=A8=E9=80=81=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../message/schedule/MessagePushSchedule.java | 29 +++++++++++----------- .../service/impl/TicketProcessServiceImpl.java | 6 ----- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java index fa08db4..f727620 100644 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java +++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java @@ -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 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 min = list.stream().min(Comparator.comparing(MessagePushRecordEntity::getPlanTime)); + Optional 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; diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java index c1f675e..c97b63a 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java +++ b/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.vo.process.FristWorkTicketVo; 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.workTicket.entity.*; 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.stereotype.Service; 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.IOException; import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors;