From 062eb73c87d1159dc95ea28538bf1ddabe6407d0 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Fri, 21 Apr 2023 09:19:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=A1=AE=E8=AE=A4=E5=90=8D?= =?UTF-8?q?=E5=8D=95=E7=9F=AD=E4=BF=A1=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/meeting/helper/MeetingMsgHelper.java | 20 ++++++++++++-------- .../staging/service/INdWorkNoticeStagingService.java | 7 ++----- .../service/impl/NdWorkNoticeStagingServiceImpl.java | 11 ++++++----- .../ningdatech/pmapi/sys/manage/NotifyManage.java | 10 +++++----- 4 files changed, 25 insertions(+), 23 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingMsgHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingMsgHelper.java index de1cece..43e8188 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingMsgHelper.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingMsgHelper.java @@ -5,7 +5,6 @@ import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.basic.util.NdDateUtils; import com.ningdatech.pmapi.meeting.constant.MeetingMsgTemplateConst; import com.ningdatech.pmapi.meeting.entity.domain.Meeting; import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; @@ -50,10 +49,15 @@ public class MeetingMsgHelper { private final IDingOrganizationService dingOrganizationService; private final INotifyService notifyService; - private Notify getNotify(Long userId, String msg, Map extraPara) { + private static String officialTime(LocalDateTime time) { + return time.format(DatePattern.NORM_DATETIME_MINUTE_FORMATTER); + } + + private Notify getNotify(Long userId, String msg, MsgTypeEnum type, Map extraPara) { Notify notify = new Notify(); notify.setUserId(userId); notify.setContent(msg); + notify.setType(type.name()); notify.setReaded(Boolean.FALSE); notify.setCreateTime(LocalDateTime.now()); String extraJson = JSON.toJSONString(extraPara); @@ -101,7 +105,7 @@ public class MeetingMsgHelper { workNoticeStagingService.addByWorkNotice(swn, MsgTypeEnum.REVIEW_MEETING); Map map = new HashMap<>(); map.put("meetingId", meetingId); - Notify notify = getNotify(userId, msgContent, map); + Notify notify = getNotify(userId, msgContent, MsgTypeEnum.REVIEW_MEETING, map); notifyService.save(notify); } } @@ -111,15 +115,15 @@ public class MeetingMsgHelper { List userIds = CollUtils.fieldList(experts, MeetingExpert::getExpertId); List userInfos = userInfoService.listByIds(userIds); Map userMap = CollUtils.listToMap(userInfos, UserInfo::getId); - String sTime = meeting.getStartTime().format(DatePattern.NORM_DATETIME_MINUTE_FORMATTER); - String eTime = meeting.getEndTime().format(DatePattern.NORM_DATETIME_MINUTE_FORMATTER); - String meetingTime = sTime + " - " + eTime; + String sTime = officialTime(meeting.getStartTime()); + String eTime = officialTime(meeting.getEndTime()); + String meetingTime = sTime + "至" + eTime; List yxtContents = new ArrayList<>(); List notifies = new ArrayList<>(); List workingNotices = new ArrayList<>(); experts.forEach(w -> { String msgContent = String.format(MeetingMsgTemplateConst.CONFIRMED_ROSTER, - w.getExpertName(), w.getCreateOn(), meetingTime, meeting.getMeetingAddress(), + w.getExpertName(), officialTime(w.getCreateOn()), meetingTime, meeting.getMeetingAddress(), meeting.getConnecter(), meeting.getContact()); // 音信通消息 SendSmsContext yxtContent = new SendSmsContext(); @@ -134,7 +138,7 @@ public class MeetingMsgHelper { workingNotices.add(swn); Map map = new HashMap<>(); map.put("meetingId", meeting.getId()); - Notify notify = getNotify(info.getId(), msgContent, map); + Notify notify = getNotify(info.getId(), msgContent, MsgTypeEnum.EXPERT_REVIEW, map); notifies.add(notify); } }); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/INdWorkNoticeStagingService.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/INdWorkNoticeStagingService.java index e7c078d..c1d0e2f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/INdWorkNoticeStagingService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/INdWorkNoticeStagingService.java @@ -1,10 +1,8 @@ package com.ningdatech.pmapi.staging.service; -import com.ningdatech.pmapi.projectlib.model.entity.Project; +import com.baomidou.mybatisplus.extension.service.IService; import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; -import com.ningdatech.pmapi.staging.model.entity.ProjectStaging; import com.ningdatech.pmapi.staging.model.entity.WorkNoticeStaging; -import com.baomidou.mybatisplus.extension.service.IService; import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; import java.util.List; @@ -28,8 +26,7 @@ public interface INdWorkNoticeStagingService extends IService * * @param workNoticeInfos 工作通知内容 * @param msgType 通知类型 - * @return 是否保存成功 */ - Boolean addByWorkNotice(List workNoticeInfos, MsgTypeEnum msgType); + void addByWorkNotice(List workNoticeInfos, MsgTypeEnum msgType); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/impl/NdWorkNoticeStagingServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/impl/NdWorkNoticeStagingServiceImpl.java index b14e117..a91c7b4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/impl/NdWorkNoticeStagingServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/impl/NdWorkNoticeStagingServiceImpl.java @@ -95,7 +95,8 @@ public class NdWorkNoticeStagingServiceImpl extends ServiceImpl workNoticeInfos, MsgTypeEnum msgType) { + public void addByWorkNotice(List workNoticeInfos, MsgTypeEnum msgType) { + LocalDateTime now = LocalDateTime.now(); List workNoticeInfoList = workNoticeInfos.stream() .map(workNoticeInfo -> WorkNoticeStaging.builder() .accountId(workNoticeInfo.getAccountId()) @@ -105,12 +106,12 @@ public class NdWorkNoticeStagingServiceImpl extends ServiceImpl list = page.getRecords().stream() .map(n -> { NotifyVO notifyVo = new NotifyVO(); - BeanUtil.copyProperties(n,notifyVo); + BeanUtil.copyProperties(n, notifyVo); String extraInfo = n.getExtraInfo(); if (StringUtils.isNotBlank(extraInfo)) { JSONObject jsonObject = JSON.parseObject(extraInfo); @@ -66,12 +66,12 @@ public class NotifyManage { return notifyVo; }) .collect(Collectors.toList()); - return PageVo.of(list,page.getTotal()); + return PageVo.of(list, page.getTotal()); } public NotifyVO detail(Long id) { Notify one = notifyService.getById(id); - return BeanUtil.copyProperties(one,NotifyVO.class); + return BeanUtil.copyProperties(one, NotifyVO.class); } public Boolean read(Long id) {