二次版本提交

This commit is contained in:
hzj
2025-07-28 14:34:36 +08:00
parent 46a2e2068b
commit ba2fec5ac0
14 changed files with 224 additions and 17 deletions

View File

@@ -0,0 +1,48 @@
package com.njcn.gather.event.devcie.config;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.njcn.gather.event.devcie.mapper.PqLineMapper;
import com.njcn.gather.event.devcie.pojo.po.PqLine;
import com.njcn.redis.utils.RedisUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.util.List;
import java.util.Set;
/**
* Description:
* Date: 2025/07/28 上午 9:32【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Component
@Slf4j
public class PqlineCache {
@Autowired
private PqLineMapper pqLineMapper;
@Autowired
private RedisUtil redisUtil;
@PostConstruct
public void init() {
log.info("系统启动中。。。加载pqline");
List<PqLine> pqLines = pqLineMapper.selectList(null);
redisUtil.saveByKey("pqLineList",pqLines);
}
@PreDestroy
public void destroy() {
log.info("系统运行结束");
redisUtil.delete("pqLineList");
}
}

View File

@@ -35,6 +35,7 @@
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

View File

@@ -25,4 +25,6 @@ public class DeviceDTO {
private String ip;
//通讯状态
private Integer runFlag=0;
//装置通讯状态0中断1正常
private Integer status;
}

View File

@@ -51,7 +51,7 @@ public class PqDevice {
* 靠靠靠(0:靠;1:靠)
*/
@TableField(value = "\"STATUS\"")
private Short status;
private Integer status;
/**
* (靠縋QS_Dicdata)靠靠Guid
@@ -87,7 +87,7 @@ public class PqDevice {
* 靠靠(0:靠;1:靠;2:靠)
*/
@TableField(value = "DEVFLAG")
private Short devflag;
private Integer devflag;
/**
* 靠靠?靠3ds靠
@@ -111,17 +111,17 @@ public class PqDevice {
* 靠靠(0:靠靠;1:靠靠)
*/
@TableField(value = "DEVMODEL")
private Short devmodel;
private Integer devmodel;
/**
* 靠靠?
*/
@TableField(value = "CALLFLAG")
private Short callflag;
private Integer callflag;
/**
* 靠靠(0:靠靠;1:靠靠;2:靠靠)
*/
@TableField(value = "DATATYPE")
private Short datatype;
private Integer datatype;
}

View File

@@ -110,7 +110,7 @@ public class PqLine {
* 靠?靠靠靠靠靠靠?
*/
@TableField(value = "SUBV_NO")
private Short subvNo;
private Integer subvNo;
/**
* (靠PQS_Dictionary?靠靠Guid

View File

@@ -5,6 +5,7 @@ import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO;
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.MsgEventInfo;
@@ -180,5 +181,35 @@ public class LargeScreenCountController extends BaseController {
}
@OperateInfo
@PostMapping("/devFlagCount")
@ApiOperation("终端运行统计")
@ApiImplicitParam(name = "largeScreenCountParam", value = "查询参数", required = true)
public HttpResult<DeviceCountVO> devFlagCount(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("devFlagCount");
DeviceCountVO deviceCountVO = largeScreenCountService.devFlagCount(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, deviceCountVO, methodDescribe);
}
@OperateInfo
@PostMapping("/devDetail")
@ApiOperation("终端运行统计")
@ApiImplicitParam(name = "largeScreenCountParam", value = "查询参数", required = true)
public HttpResult<List<DeviceDTO>> devDetail(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("devDetail");
List<DeviceDTO> deviceDTOList = largeScreenCountService.devDetail(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, deviceDTOList, methodDescribe);
}
@OperateInfo
@PostMapping("/regionDevCount")
@ApiOperation("区域终端统计")
@ApiImplicitParam(name = "largeScreenCountParam", value = "查询参数", required = true)
public HttpResult<List<RegionDevCountVO>> regionDevCount(@RequestBody LargeScreenCountParam largeScreenCountParam) {
String methodDescribe = getMethodDescribe("regionDevCount");
List<RegionDevCountVO> result = largeScreenCountService.regionDevCount(largeScreenCountParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
}

View File

@@ -39,7 +39,7 @@ public class PqDevicedetail {
* 靠靠(0:靠 1:靠)
*/
@TableField(value = "CHECKFLAG")
private Short checkflag;
private Integer checkflag;
/**
* 靠靠靠
@@ -66,10 +66,10 @@ public class PqDevicedetail {
private Integer newtraffic;
@TableField(value = "ELECTROPLATE")
private Short electroplate;
private Integer electroplate;
@TableField(value = "ONTIME")
private Short ontime;
private Integer ontime;
/**
* 合同

View File

@@ -39,7 +39,7 @@ public class PqsDepts {
* 排序
*/
@TableField(value = "DEPTS_DESC")
private Short deptsDesc;
private Integer deptsDesc;
/**
* 关联表PQS_User用户表Guid
@@ -63,7 +63,7 @@ public class PqsDepts {
* 角色状态0删除1正常
*/
@TableField(value = "\"STATE\"")
private Short state;
private Integer state;
/**
* 行政区域
@@ -72,7 +72,7 @@ public class PqsDepts {
private String area;
@TableField(value = "CUSTOM_DEPT")
private Short customDept;
private Integer customDept;
@TableField(value = "PARENTNODEID")
private String parentnodeid;

View File

@@ -65,13 +65,13 @@ public class PqsEventdetail {
private LocalDateTime dealtime;
@TableField(value = "DEALFLAG")
private Short dealflag;
private Integer dealflag;
@TableField(value = "NUM")
private BigDecimal num;
@TableField(value = "FILEFLAG")
private Short fileflag;
private Integer fileflag;
@TableField(value = "FIRSTTIME")
private LocalDateTime firsttime;

View File

@@ -0,0 +1,18 @@
package com.njcn.gather.event.transientes.pojo.vo;
import lombok.Data;
/**
* Description:
* Date: 2025/07/28 上午 8:50【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Data
public class DeviceCountVO {
private Integer allCount;
private Integer onLine;
private Integer offLine;
}

View File

@@ -0,0 +1,30 @@
package com.njcn.gather.event.transientes.pojo.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
/**
* Description:
* Date: 2025/07/28 上午 10:26【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Data
public class RegionDevCountVO {
/**
* 部门表Guid
*/
private String deptsIndex;
/**
* 部门名称
*/
private String deptsname;
private Integer allCount;
private Integer onLine;
private Integer offLine;
}

View File

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

View File

@@ -1,6 +1,7 @@
package com.njcn.gather.event.transientes.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO;
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.MsgEventInfo;
@@ -48,4 +49,9 @@ public interface LargeScreenCountService {
Page<EventDetailVO> eventTablePage(LargeScreenCountParam largeScreenCountParam);
DeviceCountVO devFlagCount(LargeScreenCountParam largeScreenCountParam);
List<DeviceDTO> devDetail(LargeScreenCountParam largeScreenCountParam);
List<RegionDevCountVO> regionDevCount(LargeScreenCountParam largeScreenCountParam);
}

View File

@@ -35,11 +35,13 @@ import com.njcn.gather.event.devcie.service.*;
import com.njcn.gather.event.transientes.service.*;
import com.njcn.gather.event.devcie.service.PqsDeptslineService;
import com.njcn.gather.event.transientes.utils.JwtUtil;
import com.njcn.redis.utils.RedisUtil;
import com.njcn.web.factory.PageFactory;
import io.swagger.models.auth.In;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -82,7 +84,7 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
private final PqsUsersetService pqsUsersetService;
private final PqsUserService pqsUserService;
private final PqLinedetailMapper pqLinedetailMapper;
private final RedisUtil redisUtil;
@Value("${SYS_TYPE_ZT}")
private String sysTypeZt;
@@ -868,6 +870,75 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
return result;
}
@Override
public DeviceCountVO devFlagCount(LargeScreenCountParam largeScreenCountParam) {
DeviceCountVO deviceCountVO = new DeviceCountVO();
List<PqLine> pqLineList = (List<PqLine>) redisUtil.getObjectByKey("pqLineList");
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());
pqLineList = pqLineList.stream().filter(temp->deptslineIds.contains(temp.getLineIndex())).collect(Collectors.toList());
List<Integer> devIndexs = pqLineList.stream().map(PqLine::getDevIndex).collect(Collectors.toList());
//在运总数
List<PqDevice> list = pqDeviceService.lambdaQuery().in(PqDevice::getDevIndex, devIndexs).eq(PqDevice::getDevflag, 0).list();
long onLine = list.stream().filter(temp -> Objects.equals(temp.getStatus(), 1)).count();
long Offline = list.stream().filter(temp -> Objects.equals(temp.getStatus(), 0)).count();
deviceCountVO.setAllCount(list.size());
deviceCountVO.setOnLine((int) onLine);
deviceCountVO.setOffLine((int) Offline);
return deviceCountVO;
}
@Override
public List<DeviceDTO> devDetail(LargeScreenCountParam largeScreenCountParam) {
DeviceCountVO deviceCountVO = new DeviceCountVO();
List<PqLine> pqLineList = (List<PqLine>) redisUtil.getObjectByKey("pqLineList");
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());
pqLineList = pqLineList.stream().filter(temp->deptslineIds.contains(temp.getLineIndex())).collect(Collectors.toList());
List<Integer> devIndexs = pqLineList.stream().map(PqLine::getDevIndex).collect(Collectors.toList());
List<DeviceDTO> deviceDTOList = pqDeviceService.queryListByIds(devIndexs);
deviceDTOList = deviceDTOList.stream().filter(temp->Objects.equals(temp.getDevFlag(),0)).collect(Collectors.toList());
return deviceDTOList;
}
@Override
public List<RegionDevCountVO> regionDevCount(LargeScreenCountParam largeScreenCountParam) {
List<RegionDevCountVO> result = new ArrayList<>();
List<PqLine> pqLineList = (List<PqLine>) redisUtil.getObjectByKey("pqLineList");
List<String> deptAndChildren = pqsDeptsService.findDeptAndChildren(largeScreenCountParam.getDeptId());
if(deptAndChildren.size()>1){
deptAndChildren.remove(largeScreenCountParam.getDeptId());
}
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.forEach(temp->{
RegionDevCountVO regionDevCountVO = new RegionDevCountVO();
regionDevCountVO.setDeptsIndex(temp.getDeptsIndex());
regionDevCountVO.setDeptsname(temp.getDeptsname());
List<Integer> deptslineIds = deptslines.stream().filter(deptsline->Objects.equals(deptsline.getDeptsIndex(),temp.getDeptsIndex())).map(PqsDeptsline::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<PqDevice> pqDeviceList = pqDeviceService.lambdaQuery().in(PqDevice::getDevIndex, devIndexs).eq(PqDevice::getDevflag, 0).list();
long onLine = pqDeviceList.stream().filter(pqDevice -> Objects.equals(pqDevice.getStatus(), 1)).count();
long Offline = pqDeviceList.stream().filter(pqDevice -> Objects.equals(pqDevice.getStatus(), 0)).count();
regionDevCountVO.setAllCount(pqDeviceList.size());
regionDevCountVO.setOnLine((int) onLine);
regionDevCountVO.setOffLine((int) Offline);
result.add(regionDevCountVO);
});
return result;
}
private List<EventDetailVO> change(List<PqsEventdetail> list,List<MsgEventInfo> handleMsg){
List<EventDetailVO> result = new ArrayList<>();
if(CollectionUtils.isEmpty(list)){