初始版本提交
This commit is contained in:
@@ -1,7 +1,12 @@
|
|||||||
package com.njcn.gather.event.transientes.service;
|
package com.njcn.gather.event.transientes.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO;
|
||||||
import com.njcn.gather.event.transientes.pojo.po.MsgEventInfo;
|
import com.njcn.gather.event.transientes.pojo.po.MsgEventInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface MsgEventInfoService extends IService<MsgEventInfo> {
|
public interface MsgEventInfoService extends IService<MsgEventInfo> {
|
||||||
|
|
||||||
|
List<MsgEventInfo> getMsgByIds(List<String> ids);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -209,19 +209,8 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
|||||||
List<PqsEventdetail> warnEvent = eventdetails.stream().filter(temp -> temp.getEventvalue() >= 0.5&& temp.getEventvalue() <0.9).collect(Collectors.toList());
|
List<PqsEventdetail> warnEvent = eventdetails.stream().filter(temp -> temp.getEventvalue() >= 0.5&& temp.getEventvalue() <0.9).collect(Collectors.toList());
|
||||||
List<String> eventIds = eventdetails.stream().map(PqsEventdetail::getEventdetailIndex).collect(Collectors.toList());
|
List<String> eventIds = eventdetails.stream().map(PqsEventdetail::getEventdetailIndex).collect(Collectors.toList());
|
||||||
//通知
|
//通知
|
||||||
List<MsgEventInfo> msgEventInfoList = new ArrayList<>();
|
|
||||||
if(!CollectionUtils.isEmpty(eventIds)){
|
List<MsgEventInfo> msgEventInfoList =msgEventInfoService.getMsgByIds(eventIds);
|
||||||
if(eventIds.size()>1000){
|
|
||||||
List<List<String>> listEven = CollUtil.split(eventIds,1000);
|
|
||||||
for(List<String> pList: listEven){
|
|
||||||
List<MsgEventInfo> temp = msgEventInfoService.lambdaQuery().in(MsgEventInfo::getEventIndex,pList).list();
|
|
||||||
msgEventInfoList.addAll(temp);
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
List<MsgEventInfo> temp = msgEventInfoService.lambdaQuery().in(MsgEventInfo::getEventIndex,eventIds).list();
|
|
||||||
msgEventInfoList.addAll(temp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
msgEventInfoList = msgEventInfoList.stream().sorted(Comparator.comparing(MsgEventInfo::getSendTime,Comparator.reverseOrder())).collect(Collectors.toList());
|
msgEventInfoList = msgEventInfoList.stream().sorted(Comparator.comparing(MsgEventInfo::getSendTime,Comparator.reverseOrder())).collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
@@ -312,20 +301,7 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
|||||||
if (Objects.equals(largeScreenCountParam.getEventtype(), 1)) {
|
if (Objects.equals(largeScreenCountParam.getEventtype(), 1)) {
|
||||||
List<String> eventIds = eventdetails.stream().map(PqsEventdetail::getEventdetailIndex).collect(Collectors.toList());
|
List<String> eventIds = eventdetails.stream().map(PqsEventdetail::getEventdetailIndex).collect(Collectors.toList());
|
||||||
//通知
|
//通知
|
||||||
List<MsgEventInfo> msgEventInfoList = new ArrayList<>();
|
List<MsgEventInfo> msgEventInfoList =msgEventInfoService.getMsgByIds(eventIds);
|
||||||
if(!CollectionUtils.isEmpty(eventIds)){
|
|
||||||
if(eventIds.size()>1000){
|
|
||||||
List<List<String>> listEven = CollUtil.split(eventIds,1000);
|
|
||||||
for(List<String> pList: listEven){
|
|
||||||
List<MsgEventInfo> temp = msgEventInfoService.lambdaQuery().in(MsgEventInfo::getEventIndex,pList).list();
|
|
||||||
msgEventInfoList.addAll(temp);
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
List<MsgEventInfo> temp = msgEventInfoService.lambdaQuery().in(MsgEventInfo::getEventIndex,eventIds).list();
|
|
||||||
msgEventInfoList.addAll(temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
// 使用 for 循环处理日期范围
|
// 使用 for 循环处理日期范围
|
||||||
for (LocalDate date = startDate; !date.isAfter(endDate); date = date.plusDays(1)) {
|
for (LocalDate date = startDate; !date.isAfter(endDate); date = date.plusDays(1)) {
|
||||||
EventTrendVO eventTrendVO = new EventTrendVO();
|
EventTrendVO eventTrendVO = new EventTrendVO();
|
||||||
@@ -611,7 +587,8 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
|||||||
List<String> eveIdndex = eventdetails.stream().map(PqsEventdetail::getEventdetailIndex).collect(Collectors.toList());
|
List<String> eveIdndex = eventdetails.stream().map(PqsEventdetail::getEventdetailIndex).collect(Collectors.toList());
|
||||||
List<MsgEventInfo> temp = new ArrayList<>();
|
List<MsgEventInfo> temp = new ArrayList<>();
|
||||||
if(!CollectionUtils.isEmpty(eveIdndex)){
|
if(!CollectionUtils.isEmpty(eveIdndex)){
|
||||||
temp = msgEventInfoService.lambdaQuery().in(MsgEventInfo::getEventIndex,eveIdndex).list();
|
temp =msgEventInfoService.getMsgByIds(eveIdndex);
|
||||||
|
|
||||||
}
|
}
|
||||||
List<EventDetailVO> change = change(eventdetails,temp);
|
List<EventDetailVO> change = change(eventdetails,temp);
|
||||||
|
|
||||||
@@ -668,16 +645,7 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<String> eventIds = allEventList.stream().map(PqsEventdetail::getEventdetailIndex).collect(Collectors.toList());
|
List<String> eventIds = allEventList.stream().map(PqsEventdetail::getEventdetailIndex).collect(Collectors.toList());
|
||||||
if (eventIds.size() > 1000) {
|
result =msgEventInfoService.getMsgByIds(eventIds);
|
||||||
List<List<String>> listEven = CollUtil.split(eventIds, 1000);
|
|
||||||
for (List<String> pList : listEven) {
|
|
||||||
List<MsgEventInfo> msgEventInfoList = msgEventInfoService.lambdaQuery().in(MsgEventInfo::getEventIndex, pList).list();
|
|
||||||
result.addAll(msgEventInfoList);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
List<MsgEventInfo> msgEventInfoList = msgEventInfoService.lambdaQuery().in(MsgEventInfo::getEventIndex, eventIds).list();
|
|
||||||
result.addAll(msgEventInfoList);
|
|
||||||
}
|
|
||||||
result = result.stream().sorted(Comparator.comparing(MsgEventInfo::getSendTime, Comparator.reverseOrder())).collect(Collectors.toList());
|
result = result.stream().sorted(Comparator.comparing(MsgEventInfo::getSendTime, Comparator.reverseOrder())).collect(Collectors.toList());
|
||||||
if (result.size() > 200) {
|
if (result.size() > 200) {
|
||||||
result = result.subList(0, 200);
|
result = result.subList(0, 200);
|
||||||
@@ -775,19 +743,8 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
|||||||
List<PqsEventdetail> warnEvent = eventdetails.stream().filter(temp -> temp.getEventvalue() >= 0.5&& temp.getEventvalue() <0.9).collect(Collectors.toList());
|
List<PqsEventdetail> warnEvent = eventdetails.stream().filter(temp -> temp.getEventvalue() >= 0.5&& temp.getEventvalue() <0.9).collect(Collectors.toList());
|
||||||
List<String> eventIds = eventdetails.stream().map(PqsEventdetail::getEventdetailIndex).collect(Collectors.toList());
|
List<String> eventIds = eventdetails.stream().map(PqsEventdetail::getEventdetailIndex).collect(Collectors.toList());
|
||||||
//通知
|
//通知
|
||||||
List<MsgEventInfo> msgEventInfoList = new ArrayList<>();
|
List<MsgEventInfo> msgEventInfoList =msgEventInfoService.getMsgByIds(eventIds);
|
||||||
if(!CollectionUtils.isEmpty(eventIds)){
|
|
||||||
if(eventIds.size()>1000){
|
|
||||||
List<List<String>> listEven = CollUtil.split(eventIds,1000);
|
|
||||||
for(List<String> pList: listEven){
|
|
||||||
List<MsgEventInfo> temp = msgEventInfoService.lambdaQuery().in(MsgEventInfo::getEventIndex,pList).list();
|
|
||||||
msgEventInfoList.addAll(temp);
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
List<MsgEventInfo> temp = msgEventInfoService.lambdaQuery().in(MsgEventInfo::getEventIndex,eventIds).list();
|
|
||||||
msgEventInfoList.addAll(temp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
msgEventInfoList = msgEventInfoList.stream().sorted(Comparator.comparing(MsgEventInfo::getSendTime,Comparator.reverseOrder())).collect(Collectors.toList());
|
msgEventInfoList = msgEventInfoList.stream().sorted(Comparator.comparing(MsgEventInfo::getSendTime,Comparator.reverseOrder())).collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
package com.njcn.gather.event.transientes.service.impl;
|
package com.njcn.gather.event.transientes.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.gather.event.transientes.mapper.MsgEventInfoMapper;
|
import com.njcn.gather.event.transientes.mapper.MsgEventInfoMapper;
|
||||||
import com.njcn.gather.event.transientes.pojo.po.MsgEventInfo;
|
import com.njcn.gather.event.transientes.pojo.po.MsgEventInfo;
|
||||||
import com.njcn.gather.event.transientes.service.MsgEventInfoService;
|
import com.njcn.gather.event.transientes.service.MsgEventInfoService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: cdf
|
* @Author: cdf
|
||||||
@@ -13,4 +18,22 @@ import org.springframework.stereotype.Service;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class MsgEventInfoServiceImpl extends ServiceImpl<MsgEventInfoMapper, MsgEventInfo> implements MsgEventInfoService {
|
public class MsgEventInfoServiceImpl extends ServiceImpl<MsgEventInfoMapper, MsgEventInfo> implements MsgEventInfoService {
|
||||||
|
@Override
|
||||||
|
public List<MsgEventInfo> getMsgByIds(List<String> ids) {
|
||||||
|
//通知
|
||||||
|
List<MsgEventInfo> msgEventInfoList = new ArrayList<>();
|
||||||
|
if(!CollectionUtils.isEmpty(ids)){
|
||||||
|
if(ids.size()>1000){
|
||||||
|
List<List<String>> listEven = CollUtil.split(ids,1000);
|
||||||
|
for(List<String> pList: listEven){
|
||||||
|
List<MsgEventInfo> temp = this.lambdaQuery().in(MsgEventInfo::getEventIndex,pList).list();
|
||||||
|
msgEventInfoList.addAll(temp);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
List<MsgEventInfo> temp = this.lambdaQuery().in(MsgEventInfo::getEventIndex,ids).list();
|
||||||
|
msgEventInfoList.addAll(temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return msgEventInfoList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user