右上角接口
This commit is contained in:
@@ -60,7 +60,7 @@ public class EventRightController extends BaseController {
|
|||||||
|
|
||||||
@OperateInfo
|
@OperateInfo
|
||||||
@PostMapping("/rightEvent")
|
@PostMapping("/rightEvent")
|
||||||
@ApiOperation("接收远程推送的暂态事件")
|
@ApiOperation("右侧表头")
|
||||||
@ApiImplicitParam(name = "largeScreenCountParam", value = "", required = true)
|
@ApiImplicitParam(name = "largeScreenCountParam", value = "", required = true)
|
||||||
public HttpResult<Object> rightEvent(@RequestBody LargeScreenCountParam largeScreenCountParam) {
|
public HttpResult<Object> rightEvent(@RequestBody LargeScreenCountParam largeScreenCountParam) {
|
||||||
String methodDescribe = getMethodDescribe("rightEvent");
|
String methodDescribe = getMethodDescribe("rightEvent");
|
||||||
@@ -69,4 +69,14 @@ public class EventRightController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@OperateInfo
|
||||||
|
@PostMapping("/rightImportUser")
|
||||||
|
@ApiOperation("右侧重要用户")
|
||||||
|
@ApiImplicitParam(name = "largeScreenCountParam", value = "", required = true)
|
||||||
|
public HttpResult<Object> rightImportUser(@RequestBody LargeScreenCountParam largeScreenCountParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("rightImportUser");
|
||||||
|
List<UserLedgerStatisticVO.Inner> result = eventRightService.rightImportUser(largeScreenCountParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package com.njcn.gather.event.transientes.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.njcn.gather.event.transientes.pojo.param.PqUserLedgerParam;
|
||||||
|
import com.njcn.gather.event.transientes.pojo.po.PqUserLedgerPO;
|
||||||
|
import com.njcn.gather.event.transientes.service.PqUserLedgerService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: cdf
|
||||||
|
* @CreateTime: 2025-07-28
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/pqUser/ledger")
|
||||||
|
public class PqUserLedgerController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PqUserLedgerService pqUserLedgerService;
|
||||||
|
|
||||||
|
// 添加记录
|
||||||
|
@PostMapping("addLedger")
|
||||||
|
public boolean addLedger(@RequestBody PqUserLedgerParam ledgerParam) {
|
||||||
|
return pqUserLedgerService.addLedger(ledgerParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新记录
|
||||||
|
@PostMapping("updateLedger")
|
||||||
|
public boolean updateLedger(@RequestBody PqUserLedgerParam ledgerParam) {
|
||||||
|
return pqUserLedgerService.updateLedger(ledgerParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除记录
|
||||||
|
@PostMapping("deleteLedger")
|
||||||
|
public boolean deleteLedger(@RequestBody List<String> ids) {
|
||||||
|
return pqUserLedgerService.deleteLedger(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询单条记录
|
||||||
|
@GetMapping("/getLedgerById")
|
||||||
|
public PqUserLedgerPO getLedgerById(@PathVariable String id) {
|
||||||
|
return pqUserLedgerService.getLedgerById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询所有记录
|
||||||
|
@GetMapping
|
||||||
|
public Page<PqUserLedgerPO> pageList(@RequestBody PqUserLedgerParam ledgerParam) {
|
||||||
|
return pqUserLedgerService.pageList(ledgerParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.njcn.gather.event.transientes.pojo.param;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: cdf
|
||||||
|
* @CreateTime: 2025-07-28
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PqUserLedgerParam extends BaseParam {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private String powerSupplyArea;
|
||||||
|
|
||||||
|
private String customerName;
|
||||||
|
|
||||||
|
private String electricityAddress;
|
||||||
|
|
||||||
|
private String industryType;
|
||||||
|
|
||||||
|
private String voltageLevel;
|
||||||
|
|
||||||
|
private String importantLevel;
|
||||||
|
|
||||||
|
private String substationName;
|
||||||
|
|
||||||
|
private String busbarName;
|
||||||
|
|
||||||
|
private String operationUnit;
|
||||||
|
|
||||||
|
private String manufacturer;
|
||||||
|
|
||||||
|
private String bigObjType;
|
||||||
|
|
||||||
|
private String smallObjType;
|
||||||
|
|
||||||
|
private Integer isShow;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -81,4 +81,7 @@ public class PqUserLedgerPO implements Serializable {
|
|||||||
@TableField(value = "UPDATE_TIME")
|
@TableField(value = "UPDATE_TIME")
|
||||||
private LocalDateTime updateTime;
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
@TableField(value = "IS_SHOW")
|
||||||
|
private Integer isShow;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,4 +11,7 @@ public interface EventRightService {
|
|||||||
|
|
||||||
|
|
||||||
UserLedgerStatisticVO userLedgerStatistic(LargeScreenCountParam param);
|
UserLedgerStatisticVO userLedgerStatistic(LargeScreenCountParam param);
|
||||||
|
|
||||||
|
|
||||||
|
List<UserLedgerStatisticVO.Inner> rightImportUser(LargeScreenCountParam param);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.njcn.gather.event.transientes.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.gather.event.transientes.pojo.param.PqUserLedgerParam;
|
||||||
|
import com.njcn.gather.event.transientes.pojo.po.PqUserLedgerPO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface PqUserLedgerService extends IService<PqUserLedgerPO> {
|
||||||
|
// 添加记录
|
||||||
|
boolean addLedger(PqUserLedgerParam ledgerParam);
|
||||||
|
|
||||||
|
// 更新记录
|
||||||
|
boolean updateLedger(PqUserLedgerParam ledgerParam);
|
||||||
|
|
||||||
|
// 删除记录(物理删除)
|
||||||
|
boolean deleteLedger(List<String> ids);
|
||||||
|
|
||||||
|
// 查询单条记录
|
||||||
|
PqUserLedgerPO getLedgerById(String id);
|
||||||
|
|
||||||
|
// 查询所有记录
|
||||||
|
Page<PqUserLedgerPO> pageList(PqUserLedgerParam param);
|
||||||
|
}
|
||||||
@@ -2,25 +2,14 @@ package com.njcn.gather.event.transientes.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
|
||||||
import com.njcn.event.file.component.WaveFileComponent;
|
|
||||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
|
||||||
import com.njcn.event.file.pojo.enums.WaveFileResponseEnum;
|
|
||||||
import com.njcn.gather.event.devcie.mapper.PqLinedetailMapper;
|
|
||||||
import com.njcn.gather.event.devcie.pojo.po.PqDevice;
|
|
||||||
import com.njcn.gather.event.devcie.pojo.po.PqLine;
|
import com.njcn.gather.event.devcie.pojo.po.PqLine;
|
||||||
import com.njcn.gather.event.devcie.pojo.po.PqLinedetail;
|
|
||||||
import com.njcn.gather.event.devcie.pojo.po.PqsDeptsline;
|
|
||||||
import com.njcn.gather.event.devcie.service.PqDeviceService;
|
|
||||||
import com.njcn.gather.event.devcie.service.PqLineService;
|
import com.njcn.gather.event.devcie.service.PqLineService;
|
||||||
import com.njcn.gather.event.transientes.mapper.PqUserLedgerMapper;
|
import com.njcn.gather.event.transientes.mapper.PqUserLedgerMapper;
|
||||||
import com.njcn.gather.event.transientes.mapper.PqUserLineAssMapper;
|
import com.njcn.gather.event.transientes.mapper.PqUserLineAssMapper;
|
||||||
import com.njcn.gather.event.transientes.mapper.PqsDicTreeMapper;
|
import com.njcn.gather.event.transientes.mapper.PqsDicTreeMapper;
|
||||||
import com.njcn.gather.event.transientes.pojo.DicTreeEnum;
|
import com.njcn.gather.event.transientes.pojo.DicTreeEnum;
|
||||||
import com.njcn.gather.event.transientes.pojo.param.LargeScreenCountParam;
|
import com.njcn.gather.event.transientes.pojo.param.LargeScreenCountParam;
|
||||||
import com.njcn.gather.event.transientes.pojo.param.MonitorTerminalParam;
|
|
||||||
import com.njcn.gather.event.transientes.pojo.po.PqUserLedgerPO;
|
import com.njcn.gather.event.transientes.pojo.po.PqUserLedgerPO;
|
||||||
import com.njcn.gather.event.transientes.pojo.po.PqUserLineAssPO;
|
import com.njcn.gather.event.transientes.pojo.po.PqUserLineAssPO;
|
||||||
import com.njcn.gather.event.transientes.pojo.po.PqsDicTreePO;
|
import com.njcn.gather.event.transientes.pojo.po.PqsDicTreePO;
|
||||||
@@ -29,10 +18,8 @@ import com.njcn.gather.event.transientes.pojo.vo.UserLedgerStatisticVO;
|
|||||||
import com.njcn.gather.event.transientes.service.*;
|
import com.njcn.gather.event.transientes.service.*;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -84,7 +71,7 @@ public class EventRightServiceImpl implements EventRightService {
|
|||||||
|
|
||||||
//查询时间段的暂降事件
|
//查询时间段的暂降事件
|
||||||
LambdaQueryWrapper<PqsEventdetail> eventQuery = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<PqsEventdetail> eventQuery = new LambdaQueryWrapper<>();
|
||||||
eventQuery.between(PqsEventdetail::getTimeid, DateUtil.parse(param.getSearchBeginTime()), DateUtil.parse(param.getSearchBeginTime()))
|
eventQuery.between(PqsEventdetail::getTimeid, DateUtil.parse(param.getSearchBeginTime()), DateUtil.endOfDay(DateUtil.parse(param.getSearchBeginTime())))
|
||||||
.in(PqsEventdetail::getWavetype, msgEventConfigService.getEventType());
|
.in(PqsEventdetail::getWavetype, msgEventConfigService.getEventType());
|
||||||
|
|
||||||
LambdaQueryWrapper<PqLine> lineQuery = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<PqLine> lineQuery = new LambdaQueryWrapper<>();
|
||||||
@@ -102,7 +89,6 @@ public class EventRightServiceImpl implements EventRightService {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
eventQuery.in(PqsEventdetail::getLineid, lineIds);
|
eventQuery.in(PqsEventdetail::getLineid, lineIds);
|
||||||
|
|
||||||
lineQuery.in(PqLine::getLineIndex, lineIds);
|
lineQuery.in(PqLine::getLineIndex, lineIds);
|
||||||
}
|
}
|
||||||
List<PqsEventdetail> eventdetailList = pqsEventdetailService.list(eventQuery);
|
List<PqsEventdetail> eventdetailList = pqsEventdetailService.list(eventQuery);
|
||||||
@@ -140,7 +126,7 @@ public class EventRightServiceImpl implements EventRightService {
|
|||||||
smallMap.forEach((key, userList) -> {
|
smallMap.forEach((key, userList) -> {
|
||||||
UserLedgerStatisticVO.Inner item = new UserLedgerStatisticVO.Inner();
|
UserLedgerStatisticVO.Inner item = new UserLedgerStatisticVO.Inner();
|
||||||
Integer[] count = getEventCount(userList, assList, eventdetailList, lineList, false);
|
Integer[] count = getEventCount(userList, assList, eventdetailList, lineList, false);
|
||||||
item.setCount(count[1]);
|
item.setCount(count[0]);
|
||||||
item.setName(dicTreeMap.containsKey(key) ? dicTreeMap.get(key).getName() : "/");
|
item.setName(dicTreeMap.containsKey(key) ? dicTreeMap.get(key).getName() : "/");
|
||||||
childrenList.add(item);
|
childrenList.add(item);
|
||||||
});
|
});
|
||||||
@@ -153,6 +139,51 @@ public class EventRightServiceImpl implements EventRightService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserLedgerStatisticVO.Inner> rightImportUser(LargeScreenCountParam param) {
|
||||||
|
List<UserLedgerStatisticVO.Inner> result = new ArrayList<>();
|
||||||
|
|
||||||
|
List<Integer> deptLineIds = commGeneralService.getLineIdsByDept(param);
|
||||||
|
|
||||||
|
List<PqUserLedgerPO> poList = pqUserLedgerMapper.selectList(new LambdaQueryWrapper<PqUserLedgerPO>().eq(PqUserLedgerPO::getIsShow,1));
|
||||||
|
if(CollUtil.isEmpty(poList)){
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
List<String> ids = poList.stream().map(PqUserLedgerPO::getId).collect(Collectors.toList());
|
||||||
|
List<PqUserLineAssPO> assPOList = pqUserLineAssMapper.selectList(new LambdaQueryWrapper<PqUserLineAssPO>().in(PqUserLineAssPO::getUserIndex,ids));
|
||||||
|
if(CollUtil.isEmpty(assPOList)){
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> userIds = assPOList.stream().map(PqUserLineAssPO::getUserIndex).distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
|
poList = poList.stream().filter(it->userIds.contains(it.getId())).collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<Integer> lineIds = assPOList.stream().map(PqUserLineAssPO::getLineIndex).distinct().collect(Collectors.toList());
|
||||||
|
List<PqsEventdetail> eventList = pqsEventdetailService.lambdaQuery().in(PqsEventdetail::getLineid,lineIds).between(PqsEventdetail::getTimeid,DateUtil.parse(param.getSearchBeginTime()),DateUtil.parse(param.getSearchEndTime())).list();
|
||||||
|
|
||||||
|
if(CollUtil.isEmpty(eventList)){
|
||||||
|
poList.forEach(item->{
|
||||||
|
UserLedgerStatisticVO.Inner inner = new UserLedgerStatisticVO.Inner();
|
||||||
|
inner.setName(item.getCustomerName());
|
||||||
|
inner.setCount(0);
|
||||||
|
result.add(inner);
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String,List<Integer>> assMap = assPOList.stream().collect(Collectors.groupingBy(PqUserLineAssPO::getUserIndex,Collectors.mapping(PqUserLineAssPO::getLineIndex,Collectors.toList())));
|
||||||
|
poList.forEach(item->{
|
||||||
|
UserLedgerStatisticVO.Inner inner = new UserLedgerStatisticVO.Inner();
|
||||||
|
inner.setName(item.getCustomerName());
|
||||||
|
List<Integer> LIds = assMap.get(item.getId());
|
||||||
|
long count = eventList.stream().filter(it->LIds.contains(it.getLineid())).count();
|
||||||
|
inner.setCount((int)count);
|
||||||
|
result.add(inner);
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private Integer[] getEventCount(List<PqUserLedgerPO> oneList, List<PqUserLineAssPO> assList, List<PqsEventdetail> pqsEventdetailList, List<PqLine> lineList,boolean devFlag) {
|
private Integer[] getEventCount(List<PqUserLedgerPO> oneList, List<PqUserLineAssPO> assList, List<PqsEventdetail> pqsEventdetailList, List<PqLine> lineList,boolean devFlag) {
|
||||||
Integer[] count = new Integer[]{0, 0};
|
Integer[] count = new Integer[]{0, 0};
|
||||||
//用户的id
|
//用户的id
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package com.njcn.gather.event.transientes.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.gather.event.transientes.mapper.PqUserLedgerMapper;
|
||||||
|
import com.njcn.gather.event.transientes.pojo.param.PqUserLedgerParam;
|
||||||
|
import com.njcn.gather.event.transientes.pojo.po.PqUserLedgerPO;
|
||||||
|
import com.njcn.gather.event.transientes.service.PqUserLedgerService;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: cdf
|
||||||
|
* @CreateTime: 2025-07-28
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PqUserLedgerServiceImpl extends ServiceImpl<PqUserLedgerMapper, PqUserLedgerPO> implements PqUserLedgerService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PqUserLedgerMapper ledgerMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean addLedger(PqUserLedgerParam ledgerParam) {
|
||||||
|
PqUserLedgerPO ledger = new PqUserLedgerPO();
|
||||||
|
BeanUtil.copyProperties(ledgerParam,ledger);
|
||||||
|
ledger.setId(UUID.randomUUID().toString());
|
||||||
|
ledger.setCreateTime(LocalDateTime.now());
|
||||||
|
ledger.setUpdateTime(LocalDateTime.now());
|
||||||
|
return ledgerMapper.insert(ledger) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateLedger(PqUserLedgerParam ledgerParam) {
|
||||||
|
PqUserLedgerPO ledger = new PqUserLedgerPO();
|
||||||
|
BeanUtil.copyProperties(ledgerParam,ledger);
|
||||||
|
ledger.setUpdateTime(LocalDateTime.now());
|
||||||
|
return ledgerMapper.updateById(ledger) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean deleteLedger(List<String> ids) {
|
||||||
|
// 物理删除(直接删除记录)
|
||||||
|
return ledgerMapper.deleteBatchIds(ids) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PqUserLedgerPO getLedgerById(String id) {
|
||||||
|
return ledgerMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<PqUserLedgerPO> pageList(PqUserLedgerParam param) {
|
||||||
|
Page<PqUserLedgerPO> page = new Page<>();
|
||||||
|
Page pageResult = ledgerMapper.selectPage(page,new LambdaQueryWrapper<PqUserLedgerPO>());
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user