二次版本提交

This commit is contained in:
hzj
2025-07-29 19:22:19 +08:00
parent 9d701ad55e
commit 3ceb73d601
16 changed files with 214 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
package com.njcn.gather.event.devcie.mapper; package com.njcn.gather.event.devcie.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO; import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO;
import com.njcn.gather.event.devcie.pojo.po.PqDevice; import com.njcn.gather.event.devcie.pojo.po.PqDevice;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@@ -17,4 +18,6 @@ import java.util.List;
*/ */
public interface PqDeviceMapper extends BaseMapper<PqDevice> { public interface PqDeviceMapper extends BaseMapper<PqDevice> {
List<DeviceDTO> queryListByIds(@Param("ids") List<Integer> ids); 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") Integer state);
} }

View File

@@ -51,4 +51,39 @@
#{item} #{item}
</foreach> </foreach>
</select> </select>
<select id="selectDeviceDTOPage" resultType="com.njcn.gather.event.devcie.pojo.dto.DeviceDTO">
select
pq_device.dev_index devId,
pq_device.name devName,
pq_device.UpdateTime updateTime,
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
from
pq_device,
PQ_SUBSTATION,
PQ_GDINFORMATION
where
pq_device.SUB_INDEX = PQ_SUBSTATION.SUB_INDEX
and pq_device.GD_INDEX =PQ_GDINFORMATION.GD_INDEX
<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
<foreach collection="devIndexs" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
order by pq_device.updatetime
</select>
</mapper> </mapper>

View File

@@ -27,4 +27,5 @@ public class DeviceDTO {
private Integer runFlag=0; private Integer runFlag=0;
//装置通讯状态0中断1正常 //装置通讯状态0中断1正常
private Integer status; private Integer status;
private double onLineRate=0.00;
} }

View File

@@ -0,0 +1,73 @@
package com.njcn.gather.event.devcie.pojo.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.time.LocalDateTime;
/**
* Description:
* Date: 2025/07/29 下午 3:15【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Data
public class PqsDeptDTO {
/**
* 部门表Guid
*/
private String deptsIndex;
/**
* 部门名称
*/
private String deptsname;
/**
* 排序
*/
private Integer deptsDesc;
/**
* 关联表PQS_User用户表Guid
*/
private String userIndex;
/**
* 更新时间
*/
private LocalDateTime updatetime;
/**
* 部门描述
*/
private String deptsDescription;
/**
* 角色状态0删除1正常
*/
private Integer state;
/**
* 行政区域
*/
private String area;
private String areaName;
private Integer customDept;
private String parentnodeid;
}

View File

@@ -1,7 +1,7 @@
package com.njcn.gather.event.devcie.service; package com.njcn.gather.event.devcie.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO; import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO;
import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO;
import com.njcn.gather.event.devcie.pojo.po.PqDevice; import com.njcn.gather.event.devcie.pojo.po.PqDevice;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
@@ -18,4 +18,6 @@ import java.util.List;
public interface PqDeviceService extends IService<PqDevice>{ public interface PqDeviceService extends IService<PqDevice>{
List<DeviceDTO> queryListByIds(List<Integer> lineIds); List<DeviceDTO> queryListByIds(List<Integer> lineIds);
Page<DeviceDTO> selectDeviceDTOPage(Page<DeviceDTO> pqsEventdetailPage, String searchValue, List<Integer> devIndexs, Integer state);
} }

View File

@@ -1,8 +1,9 @@
package com.njcn.gather.event.devcie.service.impl; package com.njcn.gather.event.devcie.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO; import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.gather.event.devcie.pojo.po.PqDevice; import com.njcn.gather.event.devcie.pojo.po.PqDevice;
@@ -23,4 +24,9 @@ public class PqDeviceServiceImpl extends ServiceImpl<PqDeviceMapper, PqDevice> i
public List<DeviceDTO> queryListByIds(List<Integer> lineIds) { public List<DeviceDTO> queryListByIds(List<Integer> lineIds) {
return this.baseMapper.queryListByIds(lineIds); return this.baseMapper.queryListByIds(lineIds);
} }
@Override
public Page<DeviceDTO> selectDeviceDTOPage(Page<DeviceDTO> pqsEventdetailPage, String searchValue, List<Integer> devIndexs, Integer state) {
return this.baseMapper.selectDeviceDTOPage(pqsEventdetailPage,searchValue,devIndexs,state);
}
} }

View File

@@ -242,5 +242,14 @@ public class LargeScreenCountController extends BaseController {
Page<EventDetailVO> result = largeScreenCountService.eventPage(largeScreenCountParam); Page<EventDetailVO> result = largeScreenCountService.eventPage(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
} }
@OperateInfo
@PostMapping("/devicePage")
@ApiOperation("终端分页查询")
@ApiImplicitParam(name = "largeScreenCountParam", value = "查询参数", required = true)
public HttpResult<Page<DeviceDTO>> devicePage(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("devicePage");
Page<DeviceDTO> result = largeScreenCountService.devicePage(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
} }

View File

@@ -1,6 +1,7 @@
package com.njcn.gather.event.transientes.mapper; package com.njcn.gather.event.transientes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.gather.event.devcie.pojo.dto.PqsDeptDTO;
import com.njcn.gather.event.transientes.pojo.po.PqsDepts; import com.njcn.gather.event.transientes.pojo.po.PqsDepts;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@@ -16,4 +17,6 @@ import java.util.List;
*/ */
public interface PqsDeptsMapper extends BaseMapper<PqsDepts> { public interface PqsDeptsMapper extends BaseMapper<PqsDepts> {
List<String> findDeptAndChildren(@Param("deptId") String deptId); List<String> findDeptAndChildren(@Param("deptId") String deptId);
List<PqsDeptDTO> getDeptList(@Param("deptIds") List<String> deptIds);
} }

View File

@@ -28,4 +28,29 @@
CONNECT BY PRIOR DEPTS_INDEX = PARENTNODEID CONNECT BY PRIOR DEPTS_INDEX = PARENTNODEID
and state = 1 and state = 1
</select> </select>
<select id="getDeptList" resultType="com.njcn.gather.event.devcie.pojo.dto.PqsDeptDTO">
SELECT
a.DEPTS_INDEX ,
a.DEPTSNAME ,
a.DEPTS_DESC ,
a.USER_INDEX ,
a.UPDATETIME ,
a.DEPTS_DESCRIPTION ,
a."STATE",
a.AREA,
a.CUSTOM_DEPT,
a.PARENTNODEID,
b.dic_name areaName
FROM
PQS_DEPTS a
LEFT JOIN PQS_DICDATA b ON a.AREA = b.DIC_INDEX
where a.STATE= 1
<if test="deptIds!= null and deptIds.size!=0">
and a.DEPTS_INDEX in
<foreach collection="deptIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if >
</select>
</mapper> </mapper>

View File

@@ -27,6 +27,9 @@ public class LargeScreenCountParam extends BaseParam {
@ApiModelProperty(name="eventDeep",value="0.普通事件 1.严重事件 null.全部事件") @ApiModelProperty(name="eventDeep",value="0.普通事件 1.严重事件 null.全部事件")
private Integer eventDeep; private Integer eventDeep;
@ApiModelProperty(name="t通讯状态",value="0.离线 1.在线")
private Integer state;
private Integer sendResult; private Integer sendResult;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime startTime; private LocalDateTime startTime;

View File

@@ -24,6 +24,7 @@ public class RegionDevCountVO {
* 部门名称 * 部门名称
*/ */
private String deptsname; private String deptsname;
private String areaName;
private Integer allCount; private Integer allCount;
private Integer onLine; private Integer onLine;
private Integer offLine; private Integer offLine;

View File

@@ -43,7 +43,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.sessionManagement() .sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS); // 使用无状态会话 .sessionCreationPolicy(SessionCreationPolicy.STATELESS); // 使用无状态会话
http.addFilterBefore(jwtRequestFilter, UsernamePasswordAuthenticationFilter.class); // http.addFilterBefore(jwtRequestFilter, UsernamePasswordAuthenticationFilter.class);
} }
@Bean @Bean

View File

@@ -58,4 +58,6 @@ public interface LargeScreenCountService {
List<SubStationCountVO> substationCount(LargeScreenCountParam largeScreenCountParam); List<SubStationCountVO> substationCount(LargeScreenCountParam largeScreenCountParam);
Page<EventDetailVO> eventPage(LargeScreenCountParam largeScreenCountParam); Page<EventDetailVO> eventPage(LargeScreenCountParam largeScreenCountParam);
Page<DeviceDTO> devicePage(LargeScreenCountParam largeScreenCountParam);
} }

View File

@@ -1,5 +1,6 @@
package com.njcn.gather.event.transientes.service; package com.njcn.gather.event.transientes.service;
import com.njcn.gather.event.devcie.pojo.dto.PqsDeptDTO;
import com.njcn.gather.event.transientes.pojo.po.PqsDepts; import com.njcn.gather.event.transientes.pojo.po.PqsDepts;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@@ -17,5 +18,8 @@ import java.util.List;
public interface PqsDeptsService extends IService<PqsDepts>{ public interface PqsDeptsService extends IService<PqsDepts>{
List<String> findDeptAndChildren(@Param("deptId") String deptId); List<String> findDeptAndChildren( String deptId);
List<PqsDeptDTO> getDeptList( List<String> deptIds);
} }

View File

@@ -19,6 +19,7 @@ import com.njcn.gather.event.devcie.mapper.PqLineMapper;
import com.njcn.gather.event.devcie.mapper.PqLinedetailMapper; import com.njcn.gather.event.devcie.mapper.PqLinedetailMapper;
import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO; import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO;
import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO; import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO;
import com.njcn.gather.event.devcie.pojo.dto.PqsDeptDTO;
import com.njcn.gather.event.devcie.pojo.dto.SubstationDTO; import com.njcn.gather.event.devcie.pojo.dto.SubstationDTO;
import com.njcn.gather.event.devcie.pojo.po.PqLinedetail; import com.njcn.gather.event.devcie.pojo.po.PqLinedetail;
import com.njcn.gather.event.transientes.pojo.param.LargeScreenCountParam; import com.njcn.gather.event.transientes.pojo.param.LargeScreenCountParam;
@@ -86,6 +87,7 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
private final PqsUserService pqsUserService; private final PqsUserService pqsUserService;
private final PqLinedetailMapper pqLinedetailMapper; private final PqLinedetailMapper pqLinedetailMapper;
private final RedisUtil redisUtil; private final RedisUtil redisUtil;
private final PqsOnlinerateService pqsOnlinerateService;
@Value("${SYS_TYPE_ZT}") @Value("${SYS_TYPE_ZT}")
private String sysTypeZt; private String sysTypeZt;
private final static String NAME_KEY = "LineCache:"; private final static String NAME_KEY = "LineCache:";
@@ -923,11 +925,12 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
List<PqDevice> pqDeviceList = pqDeviceService.lambdaQuery().eq(PqDevice::getDevflag, 0).list(); List<PqDevice> pqDeviceList = pqDeviceService.lambdaQuery().eq(PqDevice::getDevflag, 0).list();
// List<PqsDeptsline> deptslines = pqsDeptslineService.lambdaQuery().in(PqsDeptsline::getDeptsIndex, deptAndChildren).eq(PqsDeptsline::getSystype, sysTypeZt).list(); // List<PqsDeptsline> deptslines = pqsDeptslineService.lambdaQuery().in(PqsDeptsline::getDeptsIndex, deptAndChildren).eq(PqsDeptsline::getSystype, sysTypeZt).list();
List<PqsDepts> list = pqsDeptsService.lambdaQuery().in(PqsDepts::getDeptsIndex, deptAndChildren).eq(PqsDepts::getState, 1).list(); List<PqsDeptDTO> list = pqsDeptsService.getDeptList(deptAndChildren);
list.forEach(temp->{ list.forEach(temp->{
RegionDevCountVO regionDevCountVO = new RegionDevCountVO(); RegionDevCountVO regionDevCountVO = new RegionDevCountVO();
regionDevCountVO.setDeptsIndex(temp.getDeptsIndex()); regionDevCountVO.setDeptsIndex(temp.getDeptsIndex());
regionDevCountVO.setDeptsname(temp.getDeptsname()); regionDevCountVO.setDeptsname(temp.getDeptsname());
regionDevCountVO.setAreaName(temp.getAreaName());
List<Integer> deptslineIds =(List<Integer>) redisUtil.getObjectByKey( NAME_KEY+ StrUtil.DASHED+temp.getDeptsIndex()); List<Integer> deptslineIds =(List<Integer>) redisUtil.getObjectByKey( NAME_KEY+ StrUtil.DASHED+temp.getDeptsIndex());
List<PqLine> collect = pqLineList.stream().filter(pqLine -> deptslineIds.contains(pqLine.getLineIndex())).collect(Collectors.toList()); List<PqLine> collect = pqLineList.stream().filter(pqLine -> deptslineIds.contains(pqLine.getLineIndex())).collect(Collectors.toList());
List<Integer> devIndexs = collect.stream().map(PqLine::getDevIndex).collect(Collectors.toList()); List<Integer> devIndexs = collect.stream().map(PqLine::getDevIndex).collect(Collectors.toList());
@@ -1069,6 +1072,38 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
return returnpage; return returnpage;
} }
@Override
public Page<DeviceDTO> devicePage(LargeScreenCountParam largeScreenCountParam) {
LocalDateTime startTime = largeScreenCountParam.getStartTime();
LocalDateTime endTime = largeScreenCountParam.getEndTime();
Page<DeviceDTO> pqsEventdetailPage = new Page<>(largeScreenCountParam.getPageNum(), largeScreenCountParam.getPageSize());
List<PqLine> pqLineList = (List<PqLine>) redisUtil.getObjectByKey( NAME_KEY+ StrUtil.DASHED+"pqLineList");
List<Integer> deptslineIds = (List<Integer>) redisUtil.getObjectByKey( NAME_KEY+ StrUtil.DASHED+largeScreenCountParam.getDeptId());
pqLineList = pqLineList.stream().filter(temp->deptslineIds.contains(temp.getLineIndex())).collect(Collectors.toList());
List<Integer> devIndexs = pqLineList.stream().map(PqLine::getDevIndex).collect(Collectors.toList());
List<PqsOnlinerate> list = pqsOnlinerateService.lambdaQuery().in(PqsOnlinerate::getDevIndex,devIndexs).between(PqsOnlinerate::getTimeid, startTime, endTime).list();
pqsEventdetailPage = pqDeviceService.selectDeviceDTOPage(pqsEventdetailPage,largeScreenCountParam.getSearchValue(),devIndexs,largeScreenCountParam.getState());
if(!CollectionUtils.isEmpty(list)){
for (DeviceDTO record : pqsEventdetailPage.getRecords()) {
List<PqsOnlinerate> tempList = list.stream().filter(temp -> Objects.equals(temp.getDevIndex(), record.getDevId())).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(tempList)){
double asDouble = tempList.stream().mapToDouble(temp -> {
return Double.valueOf(temp.getOnlinemin()) / (temp.getOfflinemin() + temp.getOnlinemin());
}).average().getAsDouble();
record.setOnLineRate(new BigDecimal(asDouble).setScale(2, RoundingMode.UP).doubleValue());
}
}
}
return pqsEventdetailPage;
}
private List<EventDetailVO> change(List<PqsEventdetail> list,List<MsgEventInfo> handleMsg){ private List<EventDetailVO> change(List<PqsEventdetail> list,List<MsgEventInfo> handleMsg){
List<EventDetailVO> result = new ArrayList<>(); List<EventDetailVO> result = new ArrayList<>();
if(CollectionUtils.isEmpty(list)){ if(CollectionUtils.isEmpty(list)){

View File

@@ -1,5 +1,6 @@
package com.njcn.gather.event.transientes.service.impl; package com.njcn.gather.event.transientes.service.impl;
import com.njcn.gather.event.devcie.pojo.dto.PqsDeptDTO;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
@@ -22,4 +23,10 @@ public class PqsDeptsServiceImpl extends ServiceImpl<PqsDeptsMapper, PqsDepts> i
public List<String> findDeptAndChildren(String deptId) { public List<String> findDeptAndChildren(String deptId) {
return this.getBaseMapper().findDeptAndChildren(deptId); return this.getBaseMapper().findDeptAndChildren(deptId);
} }
@Override
public List<PqsDeptDTO> getDeptList(List<String> deptIds) {
return this.getBaseMapper().getDeptList(deptIds);
}
} }