考核,巡检生成消息逻辑修改,APP-消息中心接口
parent
4ce1b8c8ca
commit
229b7373b3
|
|
@ -2,6 +2,7 @@ package com.gunshi.project.xyt.controller;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.db.dto.DateTimeRangeSo;
|
||||
import com.gunshi.project.xyt.entity.so.MessageCenterPageSo;
|
||||
import com.gunshi.project.xyt.model.MessageCenter;
|
||||
import com.gunshi.project.xyt.service.MessageCenterService;
|
||||
|
|
@ -12,6 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 描述: 消息中心
|
||||
* author: xusan
|
||||
|
|
@ -44,5 +47,9 @@ public class MessageCenterController {
|
|||
return R.ok(service.allRead(receiveUserId));
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "APP-消息中心")
|
||||
@PostMapping("/list")
|
||||
public R<List<MessageCenter>> listMes(@Validated @RequestBody DateTimeRangeSo dateTimeRangeSo) {
|
||||
return R.ok(service.listMes(dateTimeRangeSo));
|
||||
}
|
||||
}
|
||||
|
|
@ -124,7 +124,16 @@ public class AssessTaskService extends ServiceImpl<AssessTaskMapper, AssessTask>
|
|||
assessObjectService.updateTeams(teams);
|
||||
//考核指标
|
||||
List<AssessTeamRating> ratings = new ArrayList<>();
|
||||
List<MessageCenter> messages = new ArrayList<>();
|
||||
List<Long> teamUserIds = teams.stream().map(AssessTeam::getTeamUserId).distinct().collect(Collectors.toList());
|
||||
List<MessageCenter> messages = teamUserIds.stream().map(o->{
|
||||
MessageCenter center = new MessageCenter();
|
||||
center.setPublishUserId(task.getCreateUserId());
|
||||
center.setPublishUserName(task.getCreateUserName());
|
||||
center.setReceiveUserId(o);
|
||||
center.setTitle("评分任务");
|
||||
center.setContent("您收到一条考核评分任务的提醒:"+task.getTaskName()+",请及时处理。");
|
||||
return center;
|
||||
}).collect(Collectors.toList());
|
||||
List<AssessIndicator> indicatorIds = this.baseMapper.queryIndicators(task.getTemplateId());
|
||||
for(AssessTeam team : teams){
|
||||
for(AssessIndicator indicator : indicatorIds){
|
||||
|
|
@ -135,13 +144,6 @@ public class AssessTaskService extends ServiceImpl<AssessTaskMapper, AssessTask>
|
|||
rating.setStandardScore(indicator.getStandardScore());
|
||||
ratings.add(rating);
|
||||
}
|
||||
MessageCenter center = new MessageCenter();
|
||||
center.setPublishUserId(task.getCreateUserId());
|
||||
center.setPublishUserName(task.getCreateUserName());
|
||||
center.setReceiveUserId(team.getTeamUserId());
|
||||
center.setTitle("评分任务");
|
||||
center.setContent("您收到一条考核评分任务的提醒:"+task.getTaskName()+",请及时处理。");
|
||||
messages.add(center);
|
||||
}
|
||||
teamRatingService.saveBatch(ratings);
|
||||
messageCenterService.insertMessage(messages);
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ public class InspectTaskService extends ServiceImpl<InspectTaskMapper, InspectTa
|
|||
task.setFinishTime(vo.getStatus() == 2 ? new Date() : null);
|
||||
task.setStatus(vo.getStatus());
|
||||
|
||||
List<MessageCenter> messageCenters = list.stream().filter(o -> o.getIsHandle() == 1).map(t->{
|
||||
List<MessageCenter> messageCenters = list.stream().filter(o -> o.getIsNormal() == 0 && o.getIsHandle() == 0).map(t->{
|
||||
MessageCenter center = new MessageCenter();
|
||||
center.setPublishUserId(task.getInspectUserId());
|
||||
center.setPublishUserName(task.getInspectUserName());
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gunshi.db.dto.DateTimeRangeSo;
|
||||
import com.gunshi.project.xyt.entity.so.MessageCenterPageSo;
|
||||
import com.gunshi.project.xyt.mapper.AttResBaseMapper;
|
||||
import com.gunshi.project.xyt.mapper.MessageCenterMapper;
|
||||
|
|
@ -15,6 +16,7 @@ import com.gunshi.project.xyt.model.MessageCenter;
|
|||
import com.gunshi.project.xyt.model.OsmoticWarnR;
|
||||
import com.gunshi.project.xyt.model.StRsvrR;
|
||||
import com.gunshi.project.xyt.util.DateUtil;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -78,7 +80,7 @@ public class MessageCenterService extends ServiceImpl<MessageCenterMapper, Messa
|
|||
BigDecimal rz = new BigDecimal(first.get().getRz());
|
||||
MessageCenter center =new MessageCenter();
|
||||
center.setPublishUserId(1L);
|
||||
center.setPublishUserName("admin");
|
||||
center.setPublishUserName("若依");
|
||||
center.setTitle("水位告警");
|
||||
String content = "系统检测到小玉潭水库水位";
|
||||
//校核水位
|
||||
|
|
@ -162,11 +164,24 @@ public class MessageCenterService extends ServiceImpl<MessageCenterMapper, Messa
|
|||
break;
|
||||
}
|
||||
center.setPublishUserId(1L);
|
||||
center.setPublishUserName("admin");
|
||||
center.setPublishUserName("若依");
|
||||
center.setTitle(title);
|
||||
center.setContent(content);
|
||||
rzMesHandle(center);
|
||||
}
|
||||
|
||||
public List<MessageCenter> listMes(DateTimeRangeSo dateTimeRangeSo) {
|
||||
LambdaQueryWrapper<MessageCenter> queryWrapper = Wrappers.lambdaQuery();
|
||||
queryWrapper.eq(MessageCenter::getReceiveUserId, SecurityUtils.getUserId());
|
||||
if (ObjectUtils.isNotNull(dateTimeRangeSo) && ObjectUtils.isNotNull(dateTimeRangeSo.getStart())) {
|
||||
queryWrapper.gt(MessageCenter::getPublishTime, dateTimeRangeSo.getStart());
|
||||
}
|
||||
if (ObjectUtils.isNotNull(dateTimeRangeSo) && ObjectUtils.isNotNull(dateTimeRangeSo.getEnd())) {
|
||||
queryWrapper.lt(MessageCenter::getPublishTime, dateTimeRangeSo.getEnd());
|
||||
}
|
||||
queryWrapper.orderByAsc(MessageCenter::getStatus).orderByDesc(MessageCenter::getPublishTime);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue