@@ -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<String, Object> 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<String, Object> 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<String, Object> 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<Long> userIds = CollUtils.fieldList(experts, MeetingExpert::getExpertId); | |||
List<UserInfo> userInfos = userInfoService.listByIds(userIds); | |||
Map<Long, UserInfo> 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<SendSmsContext> yxtContents = new ArrayList<>(); | |||
List<Notify> notifies = new ArrayList<>(); | |||
List<WorkNoticeInfo> 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<String, Object> 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); | |||
} | |||
}); | |||
@@ -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<WorkNoticeStaging> | |||
* | |||
* @param workNoticeInfos 工作通知内容 | |||
* @param msgType 通知类型 | |||
* @return 是否保存成功 | |||
*/ | |||
Boolean addByWorkNotice(List<WorkNoticeInfo> workNoticeInfos, MsgTypeEnum msgType); | |||
void addByWorkNotice(List<WorkNoticeInfo> workNoticeInfos, MsgTypeEnum msgType); | |||
} |
@@ -95,7 +95,8 @@ public class NdWorkNoticeStagingServiceImpl extends ServiceImpl<NdWorkNoticeStag | |||
* @since 2023/02/28 20:02 | |||
*/ | |||
@Override | |||
public Boolean addByWorkNotice(List<WorkNoticeInfo> workNoticeInfos, MsgTypeEnum msgType) { | |||
public void addByWorkNotice(List<WorkNoticeInfo> workNoticeInfos, MsgTypeEnum msgType) { | |||
LocalDateTime now = LocalDateTime.now(); | |||
List<WorkNoticeStaging> workNoticeInfoList = workNoticeInfos.stream() | |||
.map(workNoticeInfo -> WorkNoticeStaging.builder() | |||
.accountId(workNoticeInfo.getAccountId()) | |||
@@ -105,12 +106,12 @@ public class NdWorkNoticeStagingServiceImpl extends ServiceImpl<NdWorkNoticeStag | |||
.organizationName(workNoticeInfo.getOrganizationName()) | |||
.receiverUserId(workNoticeInfo.getReceiverUserId()) | |||
.msgType(msgType) | |||
.createOn(LocalDateTime.now()) | |||
.updateOn(LocalDateTime.now()) | |||
.nextTime(LocalDateTime.now()) | |||
.createOn(now) | |||
.updateOn(now) | |||
.nextTime(now) | |||
.retryTimes(0) | |||
.build()).collect(Collectors.toList()); | |||
return saveBatch(workNoticeInfoList); | |||
saveBatch(workNoticeInfoList); | |||
} | |||
} |
@@ -45,14 +45,14 @@ public class NotifyManage { | |||
.like(Objects.nonNull(notifyListReq.getTitle()), Notify::getTitle, notifyListReq.getTitle()) | |||
.eq(Objects.nonNull(notifyListReq.getType()), Notify::getType, notifyListReq.getType()) | |||
.orderByDesc(Notify::getCreateTime); | |||
notifyService.page(page,wrapper); | |||
if(page.getTotal() == 0L){ | |||
notifyService.page(page, wrapper); | |||
if (page.getTotal() == 0L) { | |||
return PageVo.empty(); | |||
} | |||
List<NotifyVO> 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) { | |||