北京暂降平台调整

This commit is contained in:
cdf
2025-08-13 10:07:21 +08:00
parent ac31267eb9
commit c91b3bdc51
23 changed files with 456 additions and 209 deletions

View File

@@ -1,5 +1,6 @@
package com.njcn.gather.event.devcie.config;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.njcn.gather.event.devcie.mapper.PqLineMapper;
@@ -17,6 +18,7 @@ import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@@ -53,7 +55,20 @@ public class PqlineCache {
List<String> deptAndChildren = pqsDeptsService.findDeptAndChildren(pqsDepts.getDeptsIndex());
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());
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+pqsDepts.getDeptsIndex(),deptslineIds);
List<Integer> result = new ArrayList<>();
if(CollUtil.isNotEmpty(deptslineIds)){
if(deptslineIds.size()> 1000 ){
List<List<Integer>> listList = CollUtil.split(deptslineIds,1000);
for(List<Integer> li : listList){
List<Integer> temList = pqLineMapper.getRunMonitorIds(li);
result.addAll(temList);
}
}else {
result= pqLineMapper.getRunMonitorIds(deptslineIds);
}
}
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+pqsDepts.getDeptsIndex(),result);
}
List<PqsDepts> deptsList = pqsDeptsService.lambdaQuery().eq(PqsDepts::getState,1).list();

View File

@@ -1,6 +1,8 @@
package com.njcn.gather.event.devcie.job;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.njcn.gather.event.devcie.mapper.PqDeviceMapper;
import com.njcn.gather.event.devcie.mapper.PqLineMapper;
import com.njcn.gather.event.devcie.pojo.po.PqLine;
import com.njcn.gather.event.devcie.pojo.po.PqsDeptsline;
@@ -15,6 +17,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@@ -35,8 +38,11 @@ public class LineCacheJob {
@Autowired
private PqsDeptslineService pqsDeptslineService;
@Autowired
private PqsDeptsService pqsDeptsService;
@Autowired
private PqDeviceMapper pqDeviceMapper;
private final static String NAME_KEY = "LineCache:";
@Value("${SYS_TYPE_ZT}")
private String sysTypeZt;
@@ -51,7 +57,20 @@ public class LineCacheJob {
List<String> deptAndChildren = pqsDeptsService.findDeptAndChildren(pqsDepts.getDeptsIndex());
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());
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+pqsDepts.getDeptsIndex(),deptslineIds);
List<Integer> result = new ArrayList<>();
if(CollUtil.isNotEmpty(deptslineIds)){
if(deptslineIds.size()> 1000 ){
List<List<Integer>> listList = CollUtil.split(deptslineIds,1000);
for(List<Integer> li : listList){
List<Integer> temList = pqLineMapper.getRunMonitorIds(li);
result.addAll(temList);
}
}else {
result= pqLineMapper.getRunMonitorIds(deptslineIds);
}
}
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+pqsDepts.getDeptsIndex(),result);
}
List<PqsDepts> deptsList = pqsDeptsService.lambdaQuery().eq(PqsDepts::getState,1).list();

View File

@@ -0,0 +1,13 @@
package com.njcn.gather.event.devcie.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.gather.event.devcie.pojo.po.PqDeviceDetail;
/**
* CN_Gather
*
* @author cdf
* @date 2025/8/12
*/
public interface PqDeviceDetailMapper extends BaseMapper<PqDeviceDetail> {
}

View File

@@ -10,7 +10,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
*
* Description:
* Date: 2025/06/19 下午 1:47【需求编号】
*
@@ -20,10 +20,10 @@ import java.util.List;
public interface PqDeviceMapper extends BaseMapper<PqDevice> {
List<DeviceDTO> queryListByIds(@Param("ids") List<Integer> ids);
Page<DeviceDTO> selectDeviceDTOPage(Page<DeviceDTO> pqsEventdetailPage, @Param("searchValue") String searchValue,@Param("devIndexs") List<Integer> devIndexs, @Param("state") String state);
Page<DeviceDTO> selectDeviceDTOPage(Page<DeviceDTO> pqsEventdetailPage, @Param("searchValue") String searchValue,@Param("devIndexs") List<Integer> devIndexs);
Page<DeviceDTO> queryListByLineIds(Page<DeviceDTO> pqsEventdetailPage, @Param("searchValue") String searchValue,@Param("lineIds") List<Integer> lineIds);
List<DeviceDeptDTO> selectDeviceDept();
}
}

View File

@@ -22,4 +22,7 @@ public interface PqLineMapper extends BaseMapper<PqLine> {
List<LedgerBaseInfoDTO> getBaseLedger(@Param("ids")List<Integer> ids);
List<Integer> getRunMonitorIds(@Param("ids")List<Integer> ids);
}

View File

@@ -24,7 +24,7 @@
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
DEV_INDEX, GD_INDEX, SUB_INDEX, "NAME", "STATUS", DEVTYPE, LOGONTIME, UPDATETIME,
DEV_INDEX, GD_INDEX, SUB_INDEX, "NAME", "STATUS", DEVTYPE, LOGONTIME, UPDATETIME,
NODE_INDEX, PORTID, DEVFLAG, DEV_SERIES, DEV_KEY, IP, DEVMODEL, CALLFLAG, DATATYPE
</sql>
@@ -61,35 +61,20 @@
pq_device.DevFlag devFlag,
pq_device.IP ip,
pq_device.status status,
PQ_SUBSTATION.sub_index stationId,
PQ_SUBSTATION.name stationName,
PQ_GDINFORMATION.Name gdName,
PQS_DICDATA.DIC_Name MANUFACTURER_Name,
PQ_DEVICEDETAIL.ThisTimeCheck thisTimeCheck,
PQ_DEVICEDETAIL.NextTimeCheck nextTimeCheck,
pq_device.LogonTime logonTime
pq_device.LogonTime logonTime,
PQ_DEVICEDETAIL.MANUFACTURER
FROM
pq_device
LEFT JOIN PQ_SUBSTATION ON pq_device.SUB_INDEX = PQ_SUBSTATION.SUB_INDEX
LEFT JOIN PQ_GDINFORMATION ON pq_device.GD_INDEX = PQ_GDINFORMATION.GD_INDEX
LEFT JOIN PQ_DEVICEDETAIL ON PQ_DEVICEDETAIL.dev_index = pq_device.dev_index
LEFT JOIN PQS_DICDATA on PQ_DEVICEDETAIL.MANUFACTURER = PQS_DICDATA.DIC_INDEX
where 1=1
<if test="searchValue!= null and searchValue!= ''">
AND (
pq_device.name LIKE '%' || #{searchValue} || '%'
OR PQ_SUBSTATION.name LIKE '%' || #{searchValue} || '%'
OR PQ_GDINFORMATION.Name LIKE '%' || #{searchValue} || '%'
)
</if>
<if test="state!= null and state!= ''">
and pq_device.status = #{state}
</if>
and pq_device.DEV_INDEX in
inner JOIN PQ_DEVICEDETAIL ON PQ_DEVICEDETAIL.dev_index = pq_device.dev_index
<where>
pq_device.DEV_INDEX in
<foreach collection="devIndexs" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
order by pq_device.updatetime
</where>
</select>
<!-- <select id="selectDeviceDTOPage" resultType="com.njcn.gather.event.devcie.pojo.dto.DeviceDTO">-->
@@ -193,4 +178,4 @@
AND PQS_DEPTS.DEPTS_INDEX = PQS_DEPTSLINE.DEPTS_INDEX
</select>
</mapper>
</mapper>

View File

@@ -87,5 +87,14 @@ where 1=1
</foreach>
</select>
<select id="getRunMonitorIds" resultType="integer">
select DISTINCT pq_line.line_index from pq_line inner join pq_device on pq_line.DEV_INDEX = pq_device.DEV_INDEX
where pq_line.line_index in
<foreach collection="ids" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
and pq_device.DEVFLAG = 0
</select>
</mapper>

View File

@@ -3,6 +3,7 @@ package com.njcn.gather.event.devcie.pojo.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
@@ -25,11 +26,11 @@ public class DeviceDTO {
private String ip;
private String manufacturerName;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime thisTimeCheck;
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate thisTimeCheck;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime nextTimeCheck;
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate nextTimeCheck;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime logonTime;

View File

@@ -0,0 +1,72 @@
package com.njcn.gather.event.devcie.pojo.po;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.Date;
/**
* CN_Gather
*
* @author cdf
* @date 2025/8/12
*/
@TableName(value = "PQ_DEVICEDETAIL")
@Data
public class PqDeviceDetail {
@TableId
@TableField(value = "DEV_INDEX")
private Long devIndex;
@TableField(value = "Manufacturer")
private String manufacturer;
@TableField(value = "CheckFlag")
private Long checkFlag;
@TableField(value="ThisTimeCheck")
private LocalDate ThisTimeCheck;
@TableField(value="NextTimeCheck")
private LocalDate NextTimeCheck;
@TableField(value="DATAPLAN")
private Long dataplan;
@TableField(value="NEWTRAFFIC")
private Long newtraffic;
@TableField(value = "electroplate")
private Integer electroplate = 0;
@TableField(value = "ONTIME")
private Integer ontime;
@TableField(value = "contract")
private String contract;
@TableField(value = "DEV_CATENA")
private String devCatnea;
@TableField(value = "SIM")
private String sim;
@TableField(value = "DEV_NO")
private String devNo;
@TableField(value = "DEV_LOCATION")
private String devLocation;
@TableField(value = "IS_ALARM")
private Integer isAlarm;
}

View File

@@ -127,4 +127,7 @@ public class PqLine {
@TableField(exist = false)
private String subName;
@TableField(exist = false)
private String deptName;
}

View File

@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
*
*
* Description:
* Date: 2025/06/19 下午 1:47【需求编号】
*
@@ -20,7 +20,7 @@ public interface PqDeviceService extends IService<PqDevice>{
List<DeviceDTO> queryListByIds(List<Integer> lineIds);
Page<DeviceDTO> selectDeviceDTOPage(Page<DeviceDTO> pqsEventdetailPage, String searchValue, List<Integer> devIndexs, String state);
Page<DeviceDTO> selectDeviceDTOPage(Page<DeviceDTO> pqsEventdetailPage, String searchValue, List<Integer> devIndexs);
List<DeviceDeptDTO> selectDeviceDept();
}

View File

@@ -11,7 +11,7 @@ import com.njcn.gather.event.devcie.pojo.po.PqDevice;
import com.njcn.gather.event.devcie.mapper.PqDeviceMapper;
import com.njcn.gather.event.devcie.service.PqDeviceService;
/**
*
*
* Description:
* Date: 2025/06/19 下午 1:47【需求编号】
*
@@ -27,8 +27,8 @@ public class PqDeviceServiceImpl extends ServiceImpl<PqDeviceMapper, PqDevice> i
}
@Override
public Page<DeviceDTO> selectDeviceDTOPage(Page<DeviceDTO> pqsEventdetailPage, String searchValue, List<Integer> devIndexs, String state) {
return this.baseMapper.selectDeviceDTOPage(pqsEventdetailPage,searchValue,devIndexs,state);
public Page<DeviceDTO> selectDeviceDTOPage(Page<DeviceDTO> pqsEventdetailPage, String searchValue, List<Integer> devIndexs) {
return this.baseMapper.selectDeviceDTOPage(pqsEventdetailPage,searchValue,devIndexs);
}
@Override

View File

@@ -36,35 +36,35 @@ public class JwtRequestFilter extends OncePerRequestFilter {
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
throws ServletException, IOException {
/* final String authorizationHeader = request.getHeader("Authorization");
String username = null;
String jwt = null;
if (authorizationHeader != null && authorizationHeader.startsWith("Bearer ")) {
jwt = authorizationHeader.substring(7);
try {
username = jwtUtil.extractUsername(jwt);
} catch (ExpiredJwtException e) {
log.error(e.getMessage());
sendErrorResponse(response,CommonResponseEnum.TOKEN_EXPIRE_JWT);
return;
} catch (Exception e) {
log.error(e.getMessage());
sendErrorResponse(response,CommonResponseEnum.PARSE_TOKEN_ERROR);
return;
}
}
if (username != null && SecurityContextHolder.getContext().getAuthentication() == null) {
UserDetails userDetails = this.userDetailsService.loadUserByUsername(username);
if (jwtUtil.validateToken(jwt, userDetails)) {
UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken =
new UsernamePasswordAuthenticationToken(
userDetails, null, userDetails.getAuthorities());
usernamePasswordAuthenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
SecurityContextHolder.getContext().setAuthentication(usernamePasswordAuthenticationToken);
}
}*/
// final String authorizationHeader = request.getHeader("Authorization");
// String username = null;
// String jwt = null;
// if (authorizationHeader != null && authorizationHeader.startsWith("Bearer ")) {
// jwt = authorizationHeader.substring(7);
// try {
// username = jwtUtil.extractUsername(jwt);
// } catch (ExpiredJwtException e) {
// log.error(e.getMessage());
// sendErrorResponse(response,CommonResponseEnum.TOKEN_EXPIRE_JWT);
// return;
// } catch (Exception e) {
// log.error(e.getMessage());
// sendErrorResponse(response,CommonResponseEnum.PARSE_TOKEN_ERROR);
// return;
// }
// }
//
// if (username != null && SecurityContextHolder.getContext().getAuthentication() == null) {
// UserDetails userDetails = this.userDetailsService.loadUserByUsername(username);
//
// if (jwtUtil.validateToken(jwt, userDetails)) {
// UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken =
// new UsernamePasswordAuthenticationToken(
// userDetails, null, userDetails.getAuthorities());
// usernamePasswordAuthenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
// SecurityContextHolder.getContext().setAuthentication(usernamePasswordAuthenticationToken);
// }
// }
chain.doFilter(request, response);
}

View File

@@ -1,15 +1,15 @@
package com.njcn.gather.event.transientes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.gather.event.transientes.pojo.po.PqDevicedetail;
import com.njcn.gather.event.devcie.pojo.po.PqDeviceDetail;
/**
*
*
* Description:
* Date: 2025/06/19 下午 1:47【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface PqDevicedetailMapper extends BaseMapper<PqDevicedetail> {
}
public interface PqDevicedetailMapper extends BaseMapper<PqDeviceDetail> {
}

View File

@@ -0,0 +1,14 @@
package com.njcn.gather.event.transientes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.gather.event.transientes.pojo.po.PqsDicData;
import com.njcn.gather.event.transientes.pojo.po.PqsDicTreePO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface PqsDicDataMapper extends BaseMapper<PqsDicData> {
}

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.gather.event.transientes.mapper.PqDevicedetailMapper">
<resultMap id="BaseResultMap" type="com.njcn.gather.event.transientes.pojo.po.PqDevicedetail">
<resultMap id="BaseResultMap" type="com.njcn.gather.event.devcie.pojo.po.PqDeviceDetail">
<!--@mbg.generated-->
<!--@Table PQ_DEVICEDETAIL-->
<id column="DEV_INDEX" jdbcType="DECIMAL" property="devIndex" />
@@ -22,7 +22,7 @@
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
DEV_INDEX, MANUFACTURER, CHECKFLAG, THISTIMECHECK, NEXTTIMECHECK, ONLINERATETJ, DATAPLAN,
DEV_INDEX, MANUFACTURER, CHECKFLAG, THISTIMECHECK, NEXTTIMECHECK, ONLINERATETJ, DATAPLAN,
NEWTRAFFIC, ELECTROPLATE, ONTIME, CONTRACT, SIM, DEV_CATENA, DEV_LOCATION, DEV_NO
</sql>
</mapper>
</mapper>

View File

@@ -1,94 +0,0 @@
package com.njcn.gather.event.transientes.pojo.po;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
* Description:
* Date: 2025/06/19 下午 1:47【需求编号】
*
* @author clam
* @version V1.0.0
*/
/**
* 靠靠靠?
*/
@Data
@NoArgsConstructor
@TableName(value = "PQ_DEVICEDETAIL")
public class PqDevicedetail {
/**
* 靠靠
*/
@TableId(value = "DEV_INDEX", type = IdType.INPUT)
private Integer devIndex;
/**
* (靠PQS_Dicdata)靠靠縂uid
*/
@TableField(value = "MANUFACTURER")
private String manufacturer;
/**
* 靠靠(0:靠 1:靠)
*/
@TableField(value = "CHECKFLAG")
private Integer checkflag;
/**
* 靠靠靠
*/
@TableField(value = "THISTIMECHECK")
private LocalDateTime thistimecheck;
/**
* 靠靠靠(靠靠靠靠靠3靠靠靠靠靠靠靠)
*/
@TableField(value = "NEXTTIMECHECK")
private LocalDateTime nexttimecheck;
/**
* 靠靠靠?
*/
@TableField(value = "ONLINERATETJ")
private Integer onlineratetj;
@TableField(value = "DATAPLAN")
private Integer dataplan;
@TableField(value = "NEWTRAFFIC")
private Integer newtraffic;
@TableField(value = "ELECTROPLATE")
private Integer electroplate;
@TableField(value = "ONTIME")
private Integer ontime;
/**
* 合同
*/
@TableField(value = "CONTRACT")
private String contract;
/**
* sim卡号
*/
@TableField(value = "SIM")
private String sim;
@TableField(value = "DEV_CATENA")
private String devCatena;
@TableField(value = "DEV_LOCATION")
private String devLocation;
@TableField(value = "DEV_NO")
private String devNo;
}

View File

@@ -0,0 +1,94 @@
//package com.njcn.gather.event.transientes.pojo.po;
//
//import com.baomidou.mybatisplus.annotation.IdType;
//import com.baomidou.mybatisplus.annotation.TableField;
//import com.baomidou.mybatisplus.annotation.TableId;
//import com.baomidou.mybatisplus.annotation.TableName;
//import java.time.LocalDateTime;
//import lombok.Data;
//import lombok.NoArgsConstructor;
//
///**
// *
// * Description:
// * Date: 2025/06/19 下午 1:47【需求编号】
// *
// * @author clam
// * @version V1.0.0
// */
///**
// * 靠靠靠?
// */
//@Data
//@NoArgsConstructor
//@TableName(value = "PQ_DEVICEDETAIL")
//public class PqDevicedetail {
// /**
// * 靠靠
// */
// @TableId(value = "DEV_INDEX", type = IdType.INPUT)
// private Integer devIndex;
//
// /**
// * (靠PQS_Dicdata)靠靠縂uid
// */
// @TableField(value = "MANUFACTURER")
// private String manufacturer;
//
// /**
// * 靠靠(0:靠 1:靠)
// */
// @TableField(value = "CHECKFLAG")
// private Integer checkflag;
//
// /**
// * 靠靠靠
// */
// @TableField(value = "THISTIMECHECK")
// private LocalDateTime thistimecheck;
//
// /**
// * 靠靠靠(靠靠靠靠靠3靠靠靠靠靠靠靠)
// */
// @TableField(value = "NEXTTIMECHECK")
// private LocalDateTime nexttimecheck;
//
// /**
// * 靠靠靠?
// */
// @TableField(value = "ONLINERATETJ")
// private Integer onlineratetj;
//
// @TableField(value = "DATAPLAN")
// private Integer dataplan;
//
// @TableField(value = "NEWTRAFFIC")
// private Integer newtraffic;
//
// @TableField(value = "ELECTROPLATE")
// private Integer electroplate;
//
// @TableField(value = "ONTIME")
// private Integer ontime;
//
// /**
// * 合同
// */
// @TableField(value = "CONTRACT")
// private String contract;
//
// /**
// * sim卡号
// */
// @TableField(value = "SIM")
// private String sim;
//
// @TableField(value = "DEV_CATENA")
// private String devCatena;
//
// @TableField(value = "DEV_LOCATION")
// private String devLocation;
//
// @TableField(value = "DEV_NO")
// private String devNo;
//}

View File

@@ -0,0 +1,49 @@
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 lombok.Data;
import java.util.Date;
/**
* CN_Gather
*
* @author cdf
* @date 2025/8/12
*/
@TableName(value = "PQS_DICDATA")
@Data
public class PqsDicData {
@TableId
@TableField(value = "DIC_INDEX")
private String dicIndex;
@TableField(value = "DIC_NAME")
private String dicName;
@TableField(value = "DIC_TYPE")
private String dicType;
@TableField(value = "DIC_NUMBER")
private Integer dicNumber;
@TableField(value = "UPDATETIME")
private Date updateTime;
@TableField(value = "USER_INDEX")
private String userIndex;
//事件等级
@TableField(value = "DIC_LEAVE")
private Integer dicLeave;
@TableField(value = "STATE")
private Integer state;
@TableField(value = "TRIPHASE")
private Integer triphase;
@TableField(value = "BACK_UP")
private String backUp;}

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("/cn_authenticate","/ws/**","/accept/testEvent").permitAll() // 允许访问认证接口
.antMatchers("/**").permitAll() // 允许访问认证接口
.anyRequest().authenticated()
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS); // 使用无状态会话
//http.addFilterBefore(jwtRequestFilter, UsernamePasswordAuthenticationFilter.class);
// http.addFilterBefore(jwtRequestFilter, UsernamePasswordAuthenticationFilter.class);
}
@Bean

View File

@@ -1,16 +1,16 @@
package com.njcn.gather.event.transientes.service;
import com.njcn.gather.event.transientes.pojo.po.PqDevicedetail;
import com.njcn.gather.event.devcie.pojo.po.PqDeviceDetail;
import com.baomidou.mybatisplus.extension.service.IService;
/**
*
*
* Description:
* Date: 2025/06/19 下午 1:47【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface PqDevicedetailService extends IService<PqDevicedetail>{
public interface PqDevicedetailService extends IService<PqDeviceDetail>{
}

View File

@@ -15,15 +15,10 @@ import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.gather.event.devcie.config.PqlineCache;
import com.njcn.gather.event.devcie.mapper.PqLineMapper;
import com.njcn.gather.event.devcie.mapper.PqLinedetailMapper;
import com.njcn.gather.event.devcie.mapper.PqsStationMapMapper;
import com.njcn.gather.event.devcie.mapper.*;
import com.njcn.gather.event.devcie.pojo.dto.*;
import com.njcn.gather.event.devcie.pojo.po.*;
import com.njcn.gather.event.transientes.mapper.PqUserLedgerMapper;
import com.njcn.gather.event.transientes.mapper.PqUserLineAssMapper;
import com.njcn.gather.event.transientes.mapper.PqsIntegrityMapper;
import com.njcn.gather.event.transientes.mapper.PqsOnlinerateMapper;
import com.njcn.gather.event.transientes.mapper.*;
import com.njcn.gather.event.transientes.pojo.param.LargeScreenCountParam;
import com.njcn.gather.event.transientes.pojo.param.MessageEventFeedbackParam;
import com.njcn.gather.event.transientes.pojo.po.PqsDepts;
@@ -96,6 +91,14 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
private final PqsStationMapMapper pqsStationMapMapper;
private final PqsDicDataMapper pqsDicDataMapper;
private final PqGdCompanyMapper pqGdCompanyMapper;
private final PqSubstationMapper pqSubstationMapper;
private final PqDeviceDetailMapper pqDeviceDetailMapper;
@Value("${SYS_TYPE_ZT}")
private String sysTypeZt;
private final static String NAME_KEY = "LineCache:";
@@ -1182,29 +1185,48 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
List<Integer> devIndexs = pqLineList.stream().map(PqLine::getDevIndex).distinct().collect(Collectors.toList());
log.info("完成从redis获取信息"+timeInterval.intervalMs()+"ms; "+timeInterval.intervalSecond()+"s");
//在运总数
List<PqDevice> pqDeviceList = pqDeviceService.lambdaQuery().in(PqDevice::getDevIndex, devIndexs)
.eq(PqDevice::getDevflag, 0).list();
LambdaQueryWrapper<PqDevice> lambdaQueryWrapper = new LambdaQueryWrapper<>();
if(StrUtil.isNotBlank(largeScreenCountParam.getState())){
lambdaQueryWrapper.eq(PqDevice::getStatus,Integer.valueOf(largeScreenCountParam.getState()));
}
if(StrUtil.isNotBlank(largeScreenCountParam.getSearchValue())){
lambdaQueryWrapper.eq(StrUtil.isNotEmpty(largeScreenCountParam.getSearchValue()),PqDevice::getName,largeScreenCountParam.getSearchValue());
}
lambdaQueryWrapper.in(PqDevice::getDevIndex, devIndexs);
List<PqDevice> pqDeviceList = pqDeviceService.list(lambdaQueryWrapper);
log.info("完成设备查询sql"+timeInterval.intervalMs()+"ms; "+timeInterval.intervalSecond()+"s");
List<Integer> runDevList = pqDeviceList.stream().map(PqDevice::getDevIndex).collect(Collectors.toList());
List<DeviceDeptDTO> deviceDeptDTOS= pqDeviceService.selectDeviceDept();
Map<Integer, String> deviceDeptMap = deviceDeptDTOS.stream()
.collect(Collectors.toMap(
DeviceDeptDTO::getDevId, // key mapper
DeviceDeptDTO::getDeptName, // value mapper
(value1, value2 )->{
return value2;
}
));
List<PqsDicData> pqsDicDataList = pqsDicDataMapper.selectList(new LambdaQueryWrapper<PqsDicData>().eq(PqsDicData::getDicType,"cbb2de8a-87da-4ae9-a35c-aaab999c7bc7"));
Map<String,PqsDicData> pqsDicDataMap = pqsDicDataList.stream().collect(Collectors.toMap(PqsDicData::getDicIndex,Function.identity()));
List<Long> gdList = new ArrayList<>();
List<Integer> bdList = new ArrayList<>();
if(StrUtil.isNotBlank(largeScreenCountParam.getSearchValue())){
List<PqGdCompany> pqGdCompanyList = pqGdCompanyMapper.selectList(new LambdaQueryWrapper<PqGdCompany>().like(PqGdCompany::getName,largeScreenCountParam.getSearchValue()));
gdList = pqGdCompanyList.stream().map(PqGdCompany::getGdIndex).collect(Collectors.toList());
List<PqSubstation> substationList = pqSubstationMapper.selectList(new LambdaQueryWrapper<PqSubstation>().like(PqSubstation::getName,largeScreenCountParam.getSearchValue()));
bdList = substationList.stream().map(PqSubstation::getSubIndex).collect(Collectors.toList());
}
if(CollUtil.isNotEmpty(runDevList)||CollUtil.isNotEmpty(gdList)||CollUtil.isNotEmpty(bdList)){
return new Page<>();
}
Page<PqDevice> page = pqDeviceService.lambdaQuery().in(PqDevice::getGdIndex,gdList).in(PqDevice::getSubIndex,bdList)
.in(PqDevice::getDevIndex,runDevList).page(new Page<>(PageFactory.getPageNum(largeScreenCountParam),PageFactory.getPageSize(largeScreenCountParam)));
log.info("完成设备部门查询:"+timeInterval.intervalMs()+"ms; "+timeInterval.intervalSecond()+"s");
pqsEventdetailPage = pqDeviceService.selectDeviceDTOPage(pqsEventdetailPage,largeScreenCountParam.getSearchValue(),runDevList,largeScreenCountParam.getState());
// pqsEventdetailPage = pqDeviceService.selectDeviceDTOPage(pqsEventdetailPage,largeScreenCountParam.getSearchValue(),runDevList);
log.info("完成设备分页查询sql"+timeInterval.intervalMs()+"ms; "+timeInterval.intervalSecond()+"s");
List<DeviceDTO> deviceDTOList = pqsEventdetailPage.getRecords();
List<PqDevice> deviceDTOList = page.getRecords();
if(!CollectionUtils.isEmpty(deviceDTOList)){
List<Integer> devIds = deviceDTOList.stream().map(DeviceDTO::getDevId).collect(Collectors.toList());
List<Integer> devIds = deviceDTOList.stream().map(PqDevice::getDevIndex).collect(Collectors.toList());
log.info("在线率查询sql开始"+timeInterval.intervalMs()+"ms; "+timeInterval.intervalSecond()+"s");
List<PqsOnlinerate> list = pqsOnlinerateService.lambdaQuery().in(PqsOnlinerate::getDevIndex,devIds).between(PqsOnlinerate::getTimeid, startTime, endTime).list();
List<PqsOnlinerate> onlineList = pqsOnlinerateService.lambdaQuery().in(PqsOnlinerate::getDevIndex,devIds).between(PqsOnlinerate::getTimeid, startTime, endTime).list();
log.info("在线率查询sql结束"+timeInterval.intervalMs()+"ms; "+timeInterval.intervalSecond()+"s");
List<PqLine> inteList = pqLineList.stream().filter(it->devIds.contains(it.getDevIndex())).collect(Collectors.toList());
@@ -1215,29 +1237,71 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
log.info("完整性查询sql开始"+timeInterval.intervalMs()+"ms; "+timeInterval.intervalSecond()+"s");
List<PqsIntegrity> pqsIntegrityList = pqsIntegrityMapper.selectList(new LambdaQueryWrapper<PqsIntegrity>().in(PqsIntegrity::getLineIndex,inteIds).between(PqsIntegrity::getTimeID, startTime, endTime));
log.info("完整性查询sql结束"+timeInterval.intervalMs()+"ms; "+timeInterval.intervalSecond()+"s");
lineMap.forEach((dev,lineList)->{
double rate = pqsIntegrityList.stream().filter(it->lineList.contains(it.getLineIndex())).mapToDouble(it->it.getReal()*1.0/(it.getDue()+it.getReal())).average().orElse(0.0);
double rate = pqsIntegrityList.stream().filter(it->lineList.contains(it.getLineIndex())).mapToDouble(it->it.getReal()*1.0/(it.getDue())).average().orElse(0.0);
inteDevMap.put(dev,rate);
});
List<PqDeviceDetail> deviceDetailList = pqDeviceDetailMapper.selectList(new LambdaQueryWrapper<PqDeviceDetail>().in(PqDeviceDetail::getDevIndex,devIds));
Map<Long,PqDeviceDetail> devMap = deviceDetailList.stream().collect(Collectors.toMap(PqDeviceDetail::getDevIndex,Function.identity()));
for (DeviceDTO record : pqsEventdetailPage.getRecords()) {
record.setDeptName(deviceDeptMap.get(record.getDevId()));
List<PqsOnlinerate> tempList = list.stream().filter(temp -> Objects.equals(temp.getDevIndex(), record.getDevId())).collect(Collectors.toList());
List<Integer> gdIds = deviceDTOList.stream().map(PqDevice::getGdIndex).collect(Collectors.toList());
List<PqGdCompany> pqGdCompanyList = pqGdCompanyMapper.selectList(new LambdaQueryWrapper<PqGdCompany>().in(PqGdCompany::getGdIndex,gdIds));
Map<Long,PqGdCompany> gdMap = pqGdCompanyList.stream().collect(Collectors.toMap(PqGdCompany::getGdIndex,Function.identity()));
List<Integer> bdIds = deviceDTOList.stream().map(PqDevice::getSubIndex).collect(Collectors.toList());
List<PqSubstation> substationList = pqSubstationMapper.selectList(new LambdaQueryWrapper<PqSubstation>().in(PqSubstation::getSubIndex,bdIds));
Map<Integer,PqSubstation> bdMap = substationList.stream().collect(Collectors.toMap(PqSubstation::getSubIndex,Function.identity()));
List<PqLine> lineList = pqLineList.stream().filter(it->devIds.contains(it.getDevIndex())).collect(Collectors.toList());
List<PqsDeptsline> deptslineList = pqsDeptslineService.lambdaQuery().in(PqsDeptsline::getLineIndex,lineList.stream().map(PqLine::getLineIndex).collect(Collectors.toList())).eq(PqsDeptsline::getSystype,sysTypeZt).list();
Map<String,PqsDepts> pqsDeptsMap = pqsDeptsService.lambdaQuery().eq(PqsDepts::getState,1).list().stream().collect(Collectors.toMap(PqsDepts::getDeptsIndex,Function.identity()));
Map<Integer,PqsDeptsline> map = deptslineList.stream().collect(Collectors.toMap(PqsDeptsline::getLineIndex,Function.identity()));
Map<Integer,String> temMap = new HashMap<>();
map.forEach((lineId,deptline)->{
String deptName = pqsDeptsMap.get(deptline.getDeptsIndex()).getDeptsname();
temMap.put(lineId,deptName);
});
lineList.forEach(it->it.setDeptName(temMap.get(it.getLineIndex())));
Map<Integer,List<PqLine>> pqLineMap = lineList.stream().collect(Collectors.groupingBy(PqLine::getDevIndex));
List<DeviceDTO> result = new ArrayList<>();
for(PqDevice pqDevice : deviceDTOList){
DeviceDTO dto = new DeviceDTO();
dto.setDevId(pqDevice.getDevIndex());
dto.setDevName(pqDevice.getName());
dto.setIp(pqDevice.getIp());
List<PqsOnlinerate> tempList = onlineList.stream().filter(temp -> Objects.equals(temp.getDevIndex(), pqDevice.getDevIndex())).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(tempList)){
double asDouble = tempList.stream().mapToDouble(temp -> {
return Double.valueOf(temp.getOnlinemin()*100) / (temp.getOfflinemin() + temp.getOnlinemin());
}).average().getAsDouble();
record.setOnLineRate(new BigDecimal(asDouble).setScale(2, RoundingMode.UP).doubleValue());
record.setIntegrityRate(inteDevMap.containsKey(record.getDevId())? new BigDecimal(inteDevMap.get(record.getDevId())*100).setScale(2,RoundingMode.UP).doubleValue():0);
double asDouble = tempList.stream().mapToDouble(temp -> (double) (temp.getOnlinemin() * 100) / (temp.getOfflinemin() + temp.getOnlinemin())).average().getAsDouble();
dto.setOnLineRate(new BigDecimal(asDouble).setScale(2, RoundingMode.UP).doubleValue());
}
dto.setIntegrityRate(inteDevMap.containsKey(pqDevice.getDevIndex())? BigDecimal.valueOf(inteDevMap.get(pqDevice.getDevIndex()) * 100).setScale(2,RoundingMode.UP).doubleValue():0);
PqDeviceDetail pqDeviceDetail = devMap.get(pqDevice.getDevIndex().longValue());
dto.setManufacturerName(pqDeviceDetail.getManufacturer());
dto.setStatus(pqDevice.getStatus());
dto.setRunFlag(pqDevice.getStatus());
dto.setThisTimeCheck(pqDeviceDetail.getThisTimeCheck());
dto.setNextTimeCheck(pqDeviceDetail.getNextTimeCheck());
dto.setUpdateTime(pqDevice.getUpdatetime());
dto.setGdName(gdMap.get(pqDevice.getGdIndex().longValue()).getName());
dto.setStationName(bdMap.get(pqDevice.getSubIndex()).getName());
dto.setLogonTime(pqDevice.getLogontime());
dto.setDeptName(pqLineMap.get(pqDevice.getDevIndex()).get(0).getDeptName());
dto.setManufacturerName(pqsDicDataMap.get(pqDeviceDetail.getManufacturer()).getDicName());
result.add(dto);
}
pqsEventdetailPage.setRecords(result);
pqsEventdetailPage.setTotal(page.getTotal());
}
log.info("所有程序结束:"+timeInterval.intervalMs()+"ms; "+timeInterval.intervalSecond()+"s");
return pqsEventdetailPage;
}
/* @Override

View File

@@ -1,12 +1,12 @@
package com.njcn.gather.event.transientes.service.impl;
import com.njcn.gather.event.devcie.pojo.po.PqDeviceDetail;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.gather.event.transientes.pojo.po.PqDevicedetail;
import com.njcn.gather.event.transientes.mapper.PqDevicedetailMapper;
import com.njcn.gather.event.transientes.service.PqDevicedetailService;
/**
*
*
* Description:
* Date: 2025/06/19 下午 1:47【需求编号】
*
@@ -14,6 +14,6 @@ import com.njcn.gather.event.transientes.service.PqDevicedetailService;
* @version V1.0.0
*/
@Service
public class PqDevicedetailServiceImpl extends ServiceImpl<PqDevicedetailMapper, PqDevicedetail> implements PqDevicedetailService{
public class PqDevicedetailServiceImpl extends ServiceImpl<PqDevicedetailMapper, PqDeviceDetail> implements PqDevicedetailService{
}