diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java index dab65e3..f28f23c 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java @@ -1,28 +1,21 @@ package com.hnac.hzims.alarm.source.service.impl; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; -import com.hnac.hzims.alarm.config.constants.AlarmConstants; -import com.hnac.hzims.alarm.config.service.AlarmConfigService; import com.hnac.hzims.alarm.config.entity.AlarmEntity; import com.hnac.hzims.alarm.source.service.MessageService; import com.hnac.hzims.common.constant.CommonConstant; import com.hnac.hzims.message.MessageConstants; import com.hnac.hzims.message.dto.BusinessMessageDTO; import com.hnac.hzims.message.dto.SmsImmediatelyPushDTO; -import com.hnac.hzims.message.dto.SmsPushDto; import com.hnac.hzims.message.dto.WxMessageDTO; import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.feign.IStationClient; -import lombok.AllArgsConstructor; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.api.R; -import org.springblade.core.tool.jackson.JsonUtil; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.DateUtil; -import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.StringUtil; import org.springblade.system.cache.DictCache; import org.springblade.system.feign.ISysClient; import org.springblade.system.user.entity.User; @@ -31,6 +24,7 @@ import org.springblade.system.user.feign.IUserClient; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import java.time.format.DateTimeFormatter; import java.util.*; import java.util.stream.Collectors; @@ -175,7 +169,7 @@ public class MessageServiceImpl implements MessageService { return; } userList.addAll(result.getData()); - log.info("短信发送用户列表",userList); + log.info("短信发送用户列表,{}",userList); }else { //内测只推给对应的3个用户 List phoneList = Arrays.asList("18351807087", "18163793336", "18285121497"); @@ -185,14 +179,14 @@ public class MessageServiceImpl implements MessageService { userList.add(userByPhone.getData().getUser()); } } - log.info("短信发送用户列表",userList); + log.info("短信发送用户列表,{}",userList); } String userIds = userList.stream().map(o -> String.valueOf(o.getId())).distinct().collect(Collectors.joining(",")); WxMessageDTO message = new WxMessageDTO(); // 模板Id message.setTemplateId(wxPushTemplate); -// // 微信消息跳转地址 -// message.setSkipUrl("http://baidu.com"); + // 微信消息跳转地址 + //message.setSkipUrl("http://baidu.com"); // 机构Id message.setDeptId(station.getData().getRefDept()); // 业务关键字 @@ -204,9 +198,9 @@ public class MessageServiceImpl implements MessageService { // 微信参数键值对 HashMap map = new HashMap<>(); map.put("thing18",getTruncateString(entity.getStationName(), 20)); -// map.put("thing5",Optional.ofNullable(entity.getDeviceCode()).orElse("未知设备")); map.put("thing11",getTruncateString(entity.getAlarmContext(), 20)); - map.put("time2",entity.getAlarmTime()); + DateTimeFormatter format = DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME); + map.put("time2",format.format(entity.getAlarmTime())); map.put("thing14", DictCache.getValue("alarm_type", entity.getAlarmType())); message.setMap(map); // 消息内容