北京暂降平台调整

This commit is contained in:
cdf
2025-08-25 08:49:32 +08:00
parent b4bd2e6d1d
commit b074ba29fc
9 changed files with 161 additions and 67 deletions

View File

@@ -102,7 +102,9 @@ public class EventGateController extends BaseController {
//下面一行代码正式环境需要放开
//jsonObject = test();
if (msgEventConfigService.getEventType().contains(jsonObject.get("wavetype").toString()) &&Float.parseFloat(jsonObject.get("eventvalue").toString()) <= msgEventConfigService.getEventValue()) {
if (msgEventConfigService.getEventType().contains(jsonObject.get("wavetype").toString())
&& Float.parseFloat(jsonObject.get("eventvalue").toString()) <= msgEventConfigService.getEventValue()
&& (Float.parseFloat(jsonObject.get("persisttime").toString())*1000) >= msgEventConfigService.getEventDuration()) {
//过滤重要暂降事件
Integer lineId = Integer.valueOf(jsonObject.get("lineid").toString());
List<PqUserLineAssPO> assList = pqUserLineAssMapper.selectList(new LambdaQueryWrapper<PqUserLineAssPO>().eq(PqUserLineAssPO::getLineIndex,lineId));
@@ -124,8 +126,6 @@ public class EventGateController extends BaseController {
jsonObject.putOpt("dept", String.join(StrUtil.COMMA, set));
webSocketServer.sendMessageToAll(jsonObject.toString());
}
} catch (Exception e) {

View File

@@ -36,7 +36,7 @@ public class JwtRequestFilter extends OncePerRequestFilter {
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
throws ServletException, IOException {
/* final String authorizationHeader = request.getHeader("Authorization");
final String authorizationHeader = request.getHeader("Authorization");
String username = null;
String jwt = null;
if (authorizationHeader != null && authorizationHeader.startsWith("Bearer ")) {
@@ -64,7 +64,7 @@ public class JwtRequestFilter extends OncePerRequestFilter {
usernamePasswordAuthenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
SecurityContextHolder.getContext().setAuthentication(usernamePasswordAuthenticationToken);
}
}*/
}
chain.doFilter(request, response);
}

View File

@@ -59,5 +59,8 @@ public class LargeScreenCountParam extends BaseParam {
private Float eventDurationMax;
@ApiModelProperty(value = "导出标识")
private Boolean exportFlag = false;
}

View File

@@ -3,6 +3,7 @@ package com.njcn.gather.event.transientes.pojo.po;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.gather.event.transientes.pojo.vo.EventDetailVO;
import lombok.Data;
import java.io.Serializable;
@@ -103,4 +104,7 @@ public class PqUserLedgerPO implements Serializable {
@TableField(exist = false)
private String info;
@TableField(exist = false)
private List<PqsEventdetail> eventList;
}

View File

@@ -99,4 +99,10 @@ public class PqsEventdetail {
@TableField(exist = false)
private Integer eventSeverity;
@TableField(exist = false)
private String stationName;
@TableField(exist = false)
private String busBarName;
}

View File

@@ -34,14 +34,14 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable()
.authorizeRequests()
//.antMatchers("/cn_authenticate","/ws/**","/accept/testEvent").permitAll() // 允许访问认证接口
.antMatchers("/**").permitAll() // 允许访问认证接口
.antMatchers("/cn_authenticate","/ws/**","/accept/testEvent","/accept/eventMsg").permitAll() // 允许访问认证接口
//.antMatchers("/**").permitAll() // 允许访问认证接口
.anyRequest().authenticated()
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS); // 使用无状态会话
// http.addFilterBefore(jwtRequestFilter, UsernamePasswordAuthenticationFilter.class);
http.addFilterBefore(jwtRequestFilter, UsernamePasswordAuthenticationFilter.class);
}
@Bean

View File

@@ -384,17 +384,47 @@ public class EventRightServiceImpl implements EventRightService {
return result;
}
LambdaQueryWrapper<PqLine> queryWrapper = new LambdaQueryWrapper<>();
PqSubstation pqSubstation = null;
if(Objects.nonNull(param.getBdId())){
List<PqSubstation> pqSubstationList = pqSubstationMapper.selectList(new LambdaQueryWrapper<PqSubstation>().like(PqSubstation::getSubIndex,param.getBdId()));
if(CollUtil.isEmpty(pqSubstationList)){
return result;
}
List<Integer> subIds = pqSubstationList.stream().map(PqSubstation::getSubIndex).collect(Collectors.toList());
pqSubstation = pqSubstationMapper.selectOne(new LambdaQueryWrapper<PqSubstation>().eq(PqSubstation::getSubIndex,param.getBdId()));
if(Objects.isNull(pqSubstation)){
return result;
}
queryWrapper.in(PqLine::getSubIndex, pqSubstation.getSubIndex());
List<PqLine> pqLineList = pqLineService.list(new LambdaQueryWrapper<PqLine>().in(PqLine::getSubIndex,subIds));
}
PqGdCompany pqGdCompany = null;
if(Objects.nonNull(param.getGdIndex())){
pqGdCompany = pqGdCompanyMapper.selectOne(new LambdaQueryWrapper<PqGdCompany>().eq(PqGdCompany::getGdIndex,param.getGdIndex()));
if(Objects.isNull(pqGdCompany)){
return result;
}
queryWrapper.in(PqLine::getGdIndex, pqGdCompany.getGdIndex());
}
if(Objects.nonNull(param.getBdId()) || Objects.nonNull(param.getGdIndex())) {
if(deptLineIds.size()>1000){
List<List<Integer>> assUserIdsList = CollUtil.split(deptLineIds, 1000);
queryWrapper.and(w -> {
for (List<Integer> ids : assUserIdsList) {
w.or(wIn -> wIn.in(PqLine::getLineIndex, ids));
}
});
}else {
queryWrapper.in(PqLine::getLineIndex, deptLineIds);
}
List<PqLine> pqLineList = pqLineService.list(queryWrapper);
deptLineIds = pqLineList.stream().map(PqLine::getLineIndex).distinct().collect(Collectors.toList());
}
if(CollUtil.isEmpty(deptLineIds)){
return result;
}
//获取用户监测点关系符合部门监测点的
List<PqUserLineAssPO> assList = getUserLineAssociations(deptLineIds);
@@ -541,17 +571,46 @@ public class EventRightServiceImpl implements EventRightService {
return result;
}
LambdaQueryWrapper<PqLine> queryWrapper = new LambdaQueryWrapper<>();
PqSubstation pqSubstation = null;
if(Objects.nonNull(param.getBdId())){
List<PqSubstation> pqSubstationList = pqSubstationMapper.selectList(new LambdaQueryWrapper<PqSubstation>().like(PqSubstation::getSubIndex,param.getBdId()));
if(CollUtil.isEmpty(pqSubstationList)){
pqSubstation = pqSubstationMapper.selectOne(new LambdaQueryWrapper<PqSubstation>().eq(PqSubstation::getSubIndex,param.getBdId()));
if(Objects.isNull(pqSubstation)){
return result;
}
List<Integer> subIds = pqSubstationList.stream().map(PqSubstation::getSubIndex).collect(Collectors.toList());
queryWrapper.in(PqLine::getSubIndex, pqSubstation.getSubIndex());
List<PqLine> pqLineList = pqLineService.list(new LambdaQueryWrapper<PqLine>().in(PqLine::getSubIndex,subIds));
}
PqGdCompany pqGdCompany = null;
if(Objects.nonNull(param.getGdIndex())){
pqGdCompany = pqGdCompanyMapper.selectOne(new LambdaQueryWrapper<PqGdCompany>().eq(PqGdCompany::getGdIndex,param.getGdIndex()));
if(Objects.isNull(pqGdCompany)){
return result;
}
queryWrapper.in(PqLine::getGdIndex, pqGdCompany.getGdIndex());
}
if(Objects.nonNull(param.getBdId()) || Objects.nonNull(param.getGdIndex())) {
if(lineIds.size()>1000){
List<List<Integer>> assUserIdsList = CollUtil.split(lineIds, 1000);
queryWrapper.and(w -> {
for (List<Integer> ids : assUserIdsList) {
w.or(wIn -> wIn.in(PqLine::getLineIndex, ids));
}
});
}else {
queryWrapper.in(PqLine::getLineIndex, lineIds);
}
List<PqLine> pqLineList = pqLineService.list(queryWrapper);
lineIds = pqLineList.stream().map(PqLine::getLineIndex).distinct().collect(Collectors.toList());
}
if(CollUtil.isEmpty(lineIds)){
return result;
}
List<PqUserLineAssPO> assPOList =getUserLineAssociations(lineIds);
if(CollUtil.isEmpty(assPOList)){
return result;
@@ -603,7 +662,7 @@ public class EventRightServiceImpl implements EventRightService {
List<Integer> temLineIds = eventdetailList.stream().map(PqsEventdetail::getLineid).distinct().collect(Collectors.toList());
List<String> lastUserList = aassList.stream().filter(it->temLineIds.contains(it.getLineIndex())).map(PqUserLineAssPO::getUserIndex).distinct().collect(Collectors.toList());
Page<PqUserLedgerPO> page = pqUserLedgerMapper.selectPage(new Page<>(PageFactory.getPageNum(param),PageFactory.getPageSize(param)),new LambdaQueryWrapper<PqUserLedgerPO>().in(PqUserLedgerPO::getId,lastUserList));
Page<PqUserLedgerPO> page = pqUserLedgerMapper.selectPage(new Page<>(PageFactory.getPageNum(param),PageFactory.getPageSize(param)),new LambdaQueryWrapper<PqUserLedgerPO>().in(PqUserLedgerPO::getId,lastUserList).orderByAsc(PqUserLedgerPO::getSmallObjType,PqUserLedgerPO::getUpdateTime));
if(CollUtil.isEmpty(page.getRecords())){
return page;
}
@@ -628,6 +687,23 @@ public class EventRightServiceImpl implements EventRightService {
List<PqsEventdetail> countObj = eventdetailList.stream().filter(it->objMap.get(item.getId()).contains(it.getLineid())).collect(Collectors.toList());
item.setEventCount(countObj.size());
item.setEventIds(countObj.stream().map(PqsEventdetail::getEventdetailIndex).collect(Collectors.toList()));
if(param.getExportFlag()){
item.setEventList(countObj);
if(lastMap.containsKey(item.getId())){
List<PqLine> abList = lastMap.get(item.getId());
Map<Integer,PqLine> lineMap= abList.stream().collect(Collectors.toMap(PqLine::getLineIndex,Function.identity()));
for(PqsEventdetail pqsEventdetail:countObj){
if(lineMap.containsKey(pqsEventdetail.getLineid())){
PqLine pqLine = lineMap.get(pqsEventdetail.getLineid());
pqsEventdetail.setBusBarName(pqLine.getSubvName());
pqsEventdetail.setStationName(pqLine.getSubName());
}
}
}
}
}
if(lastMap.containsKey(item.getId())){
List<PqLine> abList = lastMap.get(item.getId());
@@ -716,6 +792,9 @@ public class EventRightServiceImpl implements EventRightService {
}
PqUserLedgerPO po = pqUserLedgerMapper.selectOne(new LambdaQueryWrapper<PqUserLedgerPO>().eq(PqUserLedgerPO::getId,param.getSearchValue()));
PqsDicTreePO pqsDicTreePO = pqsDicTreeMapper.selectOne(new LambdaQueryWrapper<PqsDicTreePO>().eq(PqsDicTreePO::getId,po.getSmallObjType()));
po.setSmallObjType(pqsDicTreePO.getName());
List<PqUserLineAssPO> pqUserLineAssPOS = pqUserLineAssMapper.selectList(new LambdaQueryWrapper<PqUserLineAssPO>().eq(PqUserLineAssPO::getUserIndex,po.getId()));
List<PqUserLineAssPO> lastAss = pqUserLineAssPOS.stream().filter(it->deptLineIds.contains(it.getLineIndex())).collect(Collectors.toList());
@@ -847,6 +926,7 @@ public class EventRightServiceImpl implements EventRightService {
}
LambdaQueryWrapper<PqUserLedgerPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.orderByAsc(PqUserLedgerPO::getSmallObjType,PqUserLedgerPO::getUpdateTime);
if(StrUtil.isNotBlank(param.getBigObjType())){
//对象大类不为空
lambdaQueryWrapper.eq(PqUserLedgerPO::getBigObjType,param.getBigObjType());

View File

@@ -465,24 +465,9 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
@Override
public List<EventDetailVO> noDealEventList(LargeScreenCountParam largeScreenCountParam) {
List<EventDetailVO> result = new ArrayList<>();
//起始时间
LocalDateTime startTime;
//结束时间
LocalDateTime endTime;
if (largeScreenCountParam.getType() == 3) {
//起始时间
startTime = LocalDateTimeUtil.parse(DateUtil.format(DateUtil.beginOfMonth(new Date()), DatePattern.NORM_DATETIME_FORMATTER), DatePattern.NORM_DATETIME_FORMATTER);
//结束时间
endTime = LocalDateTimeUtil.parse(DateUtil.format(DateUtil.endOfMonth(new Date()), DatePattern.NORM_DATETIME_FORMATTER), DatePattern.NORM_DATETIME_FORMATTER);
} else if (largeScreenCountParam.getType() == 4) {
//起始时间
startTime = LocalDateTimeUtil.parse(DateUtil.format(DateUtil.beginOfWeek(new Date()), DatePattern.NORM_DATETIME_FORMATTER), DatePattern.NORM_DATETIME_FORMATTER);
//结束时间
endTime = LocalDateTimeUtil.parse(DateUtil.format(DateUtil.endOfWeek(new Date()), DatePattern.NORM_DATETIME_FORMATTER), DatePattern.NORM_DATETIME_FORMATTER);
} else {
throw new BusinessException("统计类型有误类型");
}
//根据用户获取当前部门及子部门id
DateTime startTime = DateUtil.beginOfDay(DateUtil.parse(largeScreenCountParam.getSearchBeginTime()));
DateTime endTime = DateUtil.endOfDay(DateUtil.parse(largeScreenCountParam.getSearchEndTime()));
List<Integer> deptslineIds = commGeneralService.getLineIdsByRedis(largeScreenCountParam.getDeptId());
if (CollUtil.isEmpty(deptslineIds)) {
return result;
@@ -499,13 +484,6 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
.le(PqsEventdetail::getEventvalue,msgEventConfigService.getEventValue())
.in(PqsEventdetail::getLineid, ids)
.and(wrapper -> wrapper.eq(PqsEventdetail::getLookFlag, 0).or().isNull(PqsEventdetail::getLookFlag));
if (Objects.nonNull(largeScreenCountParam.getEventDeep())) {
if (largeScreenCountParam.getEventDeep() == 0) {
lambdaQueryWrapper.ge(PqsEventdetail::getEventvalue, 0.5).lt(PqsEventdetail::getEventvalue, 0.9);
} else if (largeScreenCountParam.getEventDeep() == 1) {
lambdaQueryWrapper.lt(PqsEventdetail::getEventvalue, 0.5);
}
}
List<PqsEventdetail> eventList = pqsEventdetailService.list(lambdaQueryWrapper);
allList.addAll(eventList);
}
@@ -514,16 +492,8 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
.in(PqsEventdetail::getWavetype,msgEventConfigService.getEventType())
.le(PqsEventdetail::getEventvalue,msgEventConfigService.getEventValue())
.gt(PqsEventdetail::getPersisttime,msgEventConfigService.getEventDuration())
.gt(PqsEventdetail::getPersisttime,msgEventConfigService.getEventDuration())
.in(PqsEventdetail::getLineid, deptslineIds)
.and(wrapper -> wrapper.eq(PqsEventdetail::getLookFlag, 0).or().isNull(PqsEventdetail::getLookFlag));
if (Objects.nonNull(largeScreenCountParam.getEventDeep())) {
if (largeScreenCountParam.getEventDeep() == 0) {
lambdaQueryWrapper.ge(PqsEventdetail::getEventvalue, 0.5).lt(PqsEventdetail::getEventvalue, 0.9);
} else if (largeScreenCountParam.getEventDeep() == 1) {
lambdaQueryWrapper.lt(PqsEventdetail::getEventvalue, 0.5);
}
}
List<PqsEventdetail> eventList = pqsEventdetailService.list(lambdaQueryWrapper);
allList.addAll(eventList);
}
@@ -534,12 +504,18 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
List<LedgerBaseInfoDTO> pqLineList = pqLineService.getBaseLineInfo(ids);
Map<Integer, LedgerBaseInfoDTO> ledgerBaseInfoDTOMap = pqLineList.stream().collect(Collectors.toMap(LedgerBaseInfoDTO::getLineId, Function.identity()));
Map<String,PqUserLedgerPO> userMap;
Map<Integer,List<PqUserLineAssPO>> assMap;
List<PqUserLineAssPO> assList = pqUserLineAssMapper.selectList(new LambdaQueryWrapper<PqUserLineAssPO>().in(PqUserLineAssPO::getLineIndex,ids));
List<String> userIds = assList.stream().map(PqUserLineAssPO::getUserIndex).distinct().collect(Collectors.toList());
List<PqUserLedgerPO> poList = pqUserLedgerMapper.selectList(new LambdaQueryWrapper<PqUserLedgerPO>().in(PqUserLedgerPO::getId,userIds));
Map<String,PqUserLedgerPO> userMap = poList.stream().collect(Collectors.toMap(PqUserLedgerPO::getId,Function.identity()));
Map<Integer,List<PqUserLineAssPO>> assMap = assList.stream().collect(Collectors.groupingBy(PqUserLineAssPO::getLineIndex));
if (CollUtil.isNotEmpty(assList)) {
List<String> userIds = assList.stream().map(PqUserLineAssPO::getUserIndex).distinct().collect(Collectors.toList());
List<PqUserLedgerPO> poList = pqUserLedgerMapper.selectList(new LambdaQueryWrapper<PqUserLedgerPO>().in(PqUserLedgerPO::getId,userIds));
userMap = poList.stream().collect(Collectors.toMap(PqUserLedgerPO::getId,Function.identity()));
assMap = assList.stream().collect(Collectors.groupingBy(PqUserLineAssPO::getLineIndex));
}else {
userMap = new HashMap<>();
assMap = new HashMap<>();
}
for(PqsEventdetail it : allList){
EventDetailVO eventDetailVO = new EventDetailVO();
@@ -991,12 +967,13 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
List<Integer> devIndexs = collect.stream().map(PqLine::getDevIndex).collect(Collectors.toList());
List<PqDevice> tempDeviceList = pqDeviceList.stream().filter(pqDevice -> devIndexs.contains(pqDevice.getDevIndex())).collect(Collectors.toList());
//在运总数
long onLine = tempDeviceList.stream().filter(pqDevice -> Objects.equals(pqDevice.getStatus(), 1)).count();
long Offline = tempDeviceList.stream().filter(pqDevice ->Objects.equals(pqDevice.getStatus(), 0)).count();
//TODO 零时调整
//long onLine = tempDeviceList.stream().filter(pqDevice -> Objects.equals(pqDevice.getStatus(), 1)).count();
//long Offline = tempDeviceList.stream().filter(pqDevice ->Objects.equals(pqDevice.getStatus(), 0)).count();
regionDevCountVO.setAllCount(tempDeviceList.size());
regionDevCountVO.setOnLine((int) onLine);
regionDevCountVO.setOffLine((int) Offline);
regionDevCountVO.setOnLine((int) tempDeviceList.size());
regionDevCountVO.setOffLine((int) 0);
result.add(regionDevCountVO);
});
return result;
@@ -1101,10 +1078,24 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
subStationCountVO.setStationId(k);
subStationCountVO.setStationName(ledgerBaseInfoDTO.getStationName());
subStationCountVO.setGdName(ledgerBaseInfoDTO.getGdName());
PqsStationMap pqsStationMap = stationMapMap.get(k.longValue());
subStationCountVO.setLongitude(pqsStationMap.getLongItude());
subStationCountVO.setLatitude(pqsStationMap.getLatItude());
if(stationMapMap.containsKey(k.longValue())){
PqsStationMap pqsStationMap = stationMapMap.get(k.longValue());
if(Objects.nonNull(pqsStationMap.getLongItude())){
subStationCountVO.setLongitude(pqsStationMap.getLongItude());
}else {
subStationCountVO.setLongitude(0);
}
if(Objects.nonNull(pqsStationMap.getLatItude())){
subStationCountVO.setLatitude(pqsStationMap.getLatItude());
}else {
subStationCountVO.setLatitude(0);
}
}else {
subStationCountVO.setLongitude(0);
subStationCountVO.setLatitude(0);
}
List<Integer> tempLineIds = v.stream().map(LedgerBaseInfoDTO::getLineId).collect(Collectors.toList());
subStationCountVO.setLineCount(tempLineIds.size());
List<PqsEventdetail> tempEventList = eventdetails.stream().filter(temp -> tempLineIds.contains(temp.getLineid())).collect(Collectors.toList());
@@ -1270,7 +1261,10 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
LambdaQueryWrapper<PqDevice> lambdaQueryWrapper = new LambdaQueryWrapper<>();
if(StrUtil.isNotBlank(largeScreenCountParam.getState())){
// lambdaQueryWrapper.eq(PqDevice::getStatus,Integer.valueOf(largeScreenCountParam.getState()));
if(largeScreenCountParam.getState().equals("0")){
return new Page<>();
}
}
if(StrUtil.isNotBlank(largeScreenCountParam.getDevName())){
lambdaQueryWrapper.like(StrUtil.isNotEmpty(largeScreenCountParam.getDevName()),PqDevice::getName,largeScreenCountParam.getDevName());

View File

@@ -17,6 +17,13 @@
<property name="log.pattern"
value="|-%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%level} ${log.projectName} -- %t %logger{100}.%M ==> %m%n${Log_EXCEPTION_CONVERSION_WORD:-%ec}}}"/>
<property name="log.maxHistory" value="30"/>
<!-- 控制台输出(可选) -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<charset>UTF-8</charset> <!-- 控制台也建议指定 -->
<pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<!--客户端输出日志-->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">