二次版本提交
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.njcn.gather.event.devcie.mapper;
|
||||
|
||||
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.po.PqDevice;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -17,4 +18,6 @@ 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") Integer state);
|
||||
}
|
||||
@@ -51,4 +51,39 @@
|
||||
#{item}
|
||||
</foreach>
|
||||
</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>
|
||||
@@ -27,4 +27,5 @@ public class DeviceDTO {
|
||||
private Integer runFlag=0;
|
||||
//装置通讯状态(0:中断;1:正常)
|
||||
private Integer status;
|
||||
private double onLineRate=0.00;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
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.LedgerBaseInfoDTO;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqDevice;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
@@ -18,4 +18,6 @@ import java.util.List;
|
||||
public interface PqDeviceService extends IService<PqDevice>{
|
||||
|
||||
List<DeviceDTO> queryListByIds(List<Integer> lineIds);
|
||||
|
||||
Page<DeviceDTO> selectDeviceDTOPage(Page<DeviceDTO> pqsEventdetailPage, String searchValue, List<Integer> devIndexs, Integer state);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
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 org.springframework.stereotype.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,5 +242,14 @@ public class LargeScreenCountController extends BaseController {
|
||||
Page<EventDetailVO> result = largeScreenCountService.eventPage(largeScreenCountParam);
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.gather.event.transientes.mapper;
|
||||
|
||||
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 org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -16,4 +17,6 @@ import java.util.List;
|
||||
*/
|
||||
public interface PqsDeptsMapper extends BaseMapper<PqsDepts> {
|
||||
List<String> findDeptAndChildren(@Param("deptId") String deptId);
|
||||
|
||||
List<PqsDeptDTO> getDeptList(@Param("deptIds") List<String> deptIds);
|
||||
}
|
||||
@@ -28,4 +28,29 @@
|
||||
CONNECT BY PRIOR DEPTS_INDEX = PARENTNODEID
|
||||
and state = 1
|
||||
</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>
|
||||
@@ -27,6 +27,9 @@ public class LargeScreenCountParam extends BaseParam {
|
||||
@ApiModelProperty(name="eventDeep",value="0.普通事件 1.严重事件 null.全部事件")
|
||||
private Integer eventDeep;
|
||||
|
||||
@ApiModelProperty(name="t通讯状态",value="0.离线 1.在线")
|
||||
private Integer state;
|
||||
|
||||
private Integer sendResult;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
@@ -24,6 +24,7 @@ public class RegionDevCountVO {
|
||||
* 部门名称
|
||||
*/
|
||||
private String deptsname;
|
||||
private String areaName;
|
||||
private Integer allCount;
|
||||
private Integer onLine;
|
||||
private Integer offLine;
|
||||
|
||||
@@ -43,7 +43,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
.sessionManagement()
|
||||
.sessionCreationPolicy(SessionCreationPolicy.STATELESS); // 使用无状态会话
|
||||
|
||||
http.addFilterBefore(jwtRequestFilter, UsernamePasswordAuthenticationFilter.class);
|
||||
// http.addFilterBefore(jwtRequestFilter, UsernamePasswordAuthenticationFilter.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -58,4 +58,6 @@ public interface LargeScreenCountService {
|
||||
List<SubStationCountVO> substationCount(LargeScreenCountParam largeScreenCountParam);
|
||||
|
||||
Page<EventDetailVO> eventPage(LargeScreenCountParam largeScreenCountParam);
|
||||
|
||||
Page<DeviceDTO> devicePage(LargeScreenCountParam largeScreenCountParam);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
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.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -17,5 +18,8 @@ import java.util.List;
|
||||
public interface PqsDeptsService extends IService<PqsDepts>{
|
||||
|
||||
|
||||
List<String> findDeptAndChildren(@Param("deptId") String deptId);
|
||||
List<String> findDeptAndChildren( String deptId);
|
||||
|
||||
List<PqsDeptDTO> getDeptList( List<String> deptIds);
|
||||
|
||||
}
|
||||
|
||||
@@ -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.pojo.dto.DeviceDTO;
|
||||
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.po.PqLinedetail;
|
||||
import com.njcn.gather.event.transientes.pojo.param.LargeScreenCountParam;
|
||||
@@ -86,6 +87,7 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
||||
private final PqsUserService pqsUserService;
|
||||
private final PqLinedetailMapper pqLinedetailMapper;
|
||||
private final RedisUtil redisUtil;
|
||||
private final PqsOnlinerateService pqsOnlinerateService;
|
||||
@Value("${SYS_TYPE_ZT}")
|
||||
private String sysTypeZt;
|
||||
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<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->{
|
||||
RegionDevCountVO regionDevCountVO = new RegionDevCountVO();
|
||||
regionDevCountVO.setDeptsIndex(temp.getDeptsIndex());
|
||||
regionDevCountVO.setDeptsname(temp.getDeptsname());
|
||||
regionDevCountVO.setAreaName(temp.getAreaName());
|
||||
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<Integer> devIndexs = collect.stream().map(PqLine::getDevIndex).collect(Collectors.toList());
|
||||
@@ -1069,6 +1072,38 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
||||
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){
|
||||
List<EventDetailVO> result = new ArrayList<>();
|
||||
if(CollectionUtils.isEmpty(list)){
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.gather.event.transientes.service.impl;
|
||||
|
||||
import com.njcn.gather.event.devcie.pojo.dto.PqsDeptDTO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@@ -22,4 +23,10 @@ public class PqsDeptsServiceImpl extends ServiceImpl<PqsDeptsMapper, PqsDepts> i
|
||||
public List<String> findDeptAndChildren(String deptId) {
|
||||
return this.getBaseMapper().findDeptAndChildren(deptId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PqsDeptDTO> getDeptList(List<String> deptIds) {
|
||||
return this.getBaseMapper().getDeptList(deptIds);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user