临时调整
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
package com.njcn.gather.event.devcie.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqLine;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.security.core.parameters.P;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -12,4 +17,6 @@ import com.njcn.gather.event.devcie.pojo.po.PqLine;
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface PqLineMapper extends BaseMapper<PqLine> {
|
||||
|
||||
List<LedgerBaseInfoDTO> getBaseLineInfo(@Param("ids")List<Integer> ids);
|
||||
}
|
||||
@@ -27,4 +27,28 @@
|
||||
LINE_INDEX, GD_INDEX, SUB_INDEX, SUBV_INDEX, DEV_INDEX, "NAME", PT1, PT2, CT1, CT2,
|
||||
DEVCMP, DLCMP, JZCMP, XYCMP, SUBV_NO, "SCALE", SUBV_NAME
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="getBaseLineInfo" resultType="com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO">
|
||||
select
|
||||
pq_line.line_index lineId,
|
||||
pq_line.name lineName,
|
||||
PQ_LINEDETAIL.objname objName,
|
||||
PQ_SUBVOLTAGE.SUBV_INDEX busBarId,
|
||||
PQ_SUBVOLTAGE.name busBarName,
|
||||
pq_device.dev_index devId,
|
||||
pq_device.name devName,
|
||||
PQ_SUBSTATION.sub_index stationId,
|
||||
PQ_SUBSTATION.name stationName
|
||||
from
|
||||
pq_line,
|
||||
PQ_LINEDETAIL,
|
||||
PQ_SUBVOLTAGE,
|
||||
pq_device,
|
||||
PQ_SUBSTATION
|
||||
where pq_line.line_index = PQ_LINEDETAIL.line_index
|
||||
and pq_line.SUBV_INDEX = PQ_SUBVOLTAGE.SUBV_INDEX
|
||||
and PQ_SUBVOLTAGE.DEV_INDEX = pq_device.DEV_INDEX
|
||||
and pq_device.SUB_INDEX = PQ_SUBSTATION.SUB_INDEX
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.njcn.gather.event.devcie.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-06-25
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
public class LedgerBaseInfoDTO {
|
||||
|
||||
private Integer lineId;
|
||||
|
||||
private String lineName;
|
||||
|
||||
private Integer busBarId;
|
||||
|
||||
private String busBarName;
|
||||
|
||||
private Integer devId;
|
||||
|
||||
private String devName;
|
||||
|
||||
private String objName;
|
||||
|
||||
private Integer stationId;
|
||||
|
||||
private String stationName;
|
||||
}
|
||||
@@ -83,11 +83,11 @@ public class LargeScreenCountController extends BaseController {
|
||||
|
||||
@OperateInfo
|
||||
@PostMapping("/noDealEventList")
|
||||
@ApiOperation("暂降事件列表")
|
||||
@ApiOperation("未处理暂降事件列表")
|
||||
@ApiImplicitParam(name = "largeScreenCountParam", value = "查询参数", required = true)
|
||||
public HttpResult<List<EventDetailVO>> noDealEventList(@RequestBody LargeScreenCountParam largeScreenCountParam) {
|
||||
String methodDescribe = getMethodDescribe("noDealEventList");
|
||||
List<EventDetailVO> result = largeScreenCountService.eventList(largeScreenCountParam);
|
||||
List<EventDetailVO> result = largeScreenCountService.noDealEventList(largeScreenCountParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public class JwtRequestFilter extends OncePerRequestFilter {
|
||||
throws ServletException, IOException {
|
||||
|
||||
System.out.println("请求路径"+request.getRequestURI());
|
||||
final String authorizationHeader = request.getHeader("Authorization");
|
||||
/* final String authorizationHeader = request.getHeader("Authorization");
|
||||
String username = null;
|
||||
String jwt = null;
|
||||
if (authorizationHeader != null && authorizationHeader.startsWith("Bearer ")) {
|
||||
@@ -65,7 +65,7 @@ public class JwtRequestFilter extends OncePerRequestFilter {
|
||||
usernamePasswordAuthenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
|
||||
SecurityContextHolder.getContext().setAuthentication(usernamePasswordAuthenticationToken);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,5 +26,6 @@
|
||||
FROM PQS_DEPTS
|
||||
START WITH DEPTS_INDEX = #{deptId}
|
||||
CONNECT BY PRIOR DEPTS_INDEX = PARENTNODEID
|
||||
and state = 1
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -25,7 +25,7 @@ public class PqsEventdetail {
|
||||
private String eventdetailIndex;
|
||||
|
||||
@TableField(value = "LINEID")
|
||||
private BigDecimal lineid;
|
||||
private Integer lineid;
|
||||
|
||||
@TableField(value = "TIMEID")
|
||||
private LocalDateTime timeid;
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.njcn.gather.event.transientes.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2025/06/20 下午 2:50【需求编号】
|
||||
@@ -11,4 +14,25 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class EventDetailVO {
|
||||
|
||||
private String eventdetailIndex;
|
||||
|
||||
private LocalDateTime timeid;
|
||||
|
||||
private BigDecimal ms;
|
||||
|
||||
private Short wavetype;
|
||||
|
||||
private Double eventvalue;
|
||||
|
||||
private Integer lookFlag;
|
||||
|
||||
private Integer noticeFlag;
|
||||
|
||||
private String lineName;
|
||||
|
||||
|
||||
private String stationName;
|
||||
|
||||
private String objName;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,11 @@ public class MyUserDetailsService implements UserDetailsService {
|
||||
String encodedPassword = passwordEncoder.encode("@#001njcnpqs");
|
||||
return new User("screen", encodedPassword,
|
||||
new ArrayList<>());
|
||||
} else if("test".equals(username)){
|
||||
PasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||
String encodedPassword = passwordEncoder.encode("@#001njcnpqs");
|
||||
return new User("test", encodedPassword,
|
||||
new ArrayList<>());
|
||||
}else {
|
||||
throw new UsernameNotFoundException("User not found with username: " + username);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http.csrf().disable()
|
||||
.authorizeRequests()
|
||||
.antMatchers("/cn_authenticate","/ws/**").permitAll() // 允许访问认证接口
|
||||
// .antMatchers("/cn_authenticate","/ws/**").permitAll() // 允许访问认证接口
|
||||
.antMatchers("/**").permitAll() // 允许访问认证接口
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
.sessionManagement()
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.njcn.gather.event.transientes.service;
|
||||
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqsDeptsline;
|
||||
import com.njcn.gather.event.devcie.service.PqsDeptslineService;
|
||||
import com.njcn.gather.event.transientes.pojo.param.LargeScreenCountParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-06-25
|
||||
* @Description:
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CommGeneralService {
|
||||
@Value("${SYS_TYPE_ZT}")
|
||||
private String sysTypeZt;
|
||||
|
||||
private final PqsDeptslineService pqsDeptslineService;
|
||||
private final PqsDeptsService pqsDeptsService;
|
||||
|
||||
|
||||
public List<Integer> getLineIdsByDept(LargeScreenCountParam largeScreenCountParam){
|
||||
List<String> deptAndChildren = pqsDeptsService.findDeptAndChildren(largeScreenCountParam.getDeptId());
|
||||
List<PqsDeptsline> deptslines = pqsDeptslineService.lambdaQuery().in(PqsDeptsline::getDeptsIndex, deptAndChildren).eq(PqsDeptsline::getSystype, sysTypeZt).list();
|
||||
List<Integer> deptslineIds = deptslines.stream().map(PqsDeptsline::getLineIndex).collect(Collectors.toList());
|
||||
return deptslineIds;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,10 +1,18 @@
|
||||
package com.njcn.gather.event.transientes.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.yulichang.wrapper.segments.Fun;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.gather.event.devcie.mapper.PqLineMapper;
|
||||
import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO;
|
||||
import com.njcn.gather.event.transientes.pojo.param.LargeScreenCountParam;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqDevice;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqLine;
|
||||
@@ -25,7 +33,9 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -44,6 +54,7 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
||||
private final PqLineService pqLineService;
|
||||
private final PqDeviceService pqDeviceService;
|
||||
private final PqsEventdetailService pqsEventdetailService;
|
||||
private final PqLineMapper pqLineMapper;
|
||||
@Value("${SYS_TYPE_ZT}")
|
||||
private String sysTypeZt;
|
||||
@Override
|
||||
@@ -186,16 +197,45 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
||||
|
||||
@Override
|
||||
public List<EventDetailVO> noDealEventList(LargeScreenCountParam largeScreenCountParam) {
|
||||
List<EventDetailVO> result = new ArrayList<>();
|
||||
|
||||
if(Objects.isNull(largeScreenCountParam.getEventDeep())){
|
||||
|
||||
DateTime end = DateUtil.endOfDay(DateTime.now());
|
||||
DateTime start = DateUtil.beginOfMonth(DateTime.now());
|
||||
//根据用户获取当前部门及子部门id
|
||||
List<String> deptAndChildren = pqsDeptsService.findDeptAndChildren( largeScreenCountParam.getDeptId());
|
||||
//获取对应监测点id
|
||||
List<PqsDeptsline> deptslines = pqsDeptslineService.lambdaQuery().in(PqsDeptsline::getDeptsIndex, deptAndChildren).eq(PqsDeptsline::getSystype, sysTypeZt).list();
|
||||
List<Integer> deptslineIds = deptslines.stream().map(PqsDeptsline::getLineIndex).distinct().collect(Collectors.toList());
|
||||
if(CollUtil.isEmpty(deptslineIds)){
|
||||
return result;
|
||||
}
|
||||
/* eventdetails = pqsEventdetailService.lambdaQuery()
|
||||
.between(PqsEventdetail::getTimeid, startTime, endTime)
|
||||
LambdaQueryWrapper<PqsEventdetail> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.between(PqsEventdetail::getTimeid, start, end)
|
||||
.in(PqsEventdetail::getLineid,deptslineIds)
|
||||
.eq(PqsEventdetail::getLookFlag,largeScreenCountParam.getEventtype()).list();*/
|
||||
|
||||
return null;
|
||||
.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::getEventtype,0.9);
|
||||
}else if(largeScreenCountParam.getEventDeep() == 1){
|
||||
lambdaQueryWrapper.lt(PqsEventdetail::getEventvalue,0.5);
|
||||
}
|
||||
}
|
||||
List<PqsEventdetail> eventList = pqsEventdetailService.list(lambdaQueryWrapper);
|
||||
if(CollUtil.isNotEmpty(eventList)){
|
||||
List<LedgerBaseInfoDTO> pqLineList = pqLineMapper.getBaseLineInfo(deptslineIds);
|
||||
Map<Integer,LedgerBaseInfoDTO> ledgerBaseInfoDTOMap = pqLineList.stream().collect(Collectors.toMap(LedgerBaseInfoDTO::getLineId, Function.identity()));
|
||||
eventList.forEach(it->{
|
||||
EventDetailVO eventDetailVO = new EventDetailVO();
|
||||
BeanUtil.copyProperties(it,eventDetailVO);
|
||||
if(ledgerBaseInfoDTOMap.containsKey(it.getLineid())){
|
||||
LedgerBaseInfoDTO ledgerBaseInfoDTO = ledgerBaseInfoDTOMap.get(it.getLineid());
|
||||
eventDetailVO.setLineName(ledgerBaseInfoDTO.getLineName());
|
||||
eventDetailVO.setStationName(ledgerBaseInfoDTO.getStationName());
|
||||
}
|
||||
result.add(eventDetailVO);
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -100,17 +100,21 @@ public class WebSocketServer {
|
||||
}
|
||||
}
|
||||
|
||||
private final Object lock = new Object();
|
||||
|
||||
public void sendMessageToAll(String message) {
|
||||
|
||||
sessions.forEach((userId, session) -> {
|
||||
System.out.println("给用户推送消息" + userId);
|
||||
if (session.isOpen()) {
|
||||
synchronized (lock) {
|
||||
try {
|
||||
session.getBasicRemote().sendText(message);
|
||||
} catch (IOException e) {
|
||||
System.out.println("发送消息给用户 " + userId + " 失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user