北京暂降平台调整
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package com.njcn.gather.event.devcie.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.gather.event.devcie.pojo.dto.SubstationDTO;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqGdCompany;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqSubstation;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2025/06/19 下午 1:48【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface PqGdCompanyMapper extends BaseMapper<PqGdCompany> {
|
||||
|
||||
}
|
||||
@@ -60,4 +60,6 @@ where 1=1
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -40,4 +40,5 @@ public class DeviceDTO {
|
||||
//装置通讯状态(0:中断;1:正常)
|
||||
private Integer status;
|
||||
private double onLineRate=0.00;
|
||||
private double integrityRate = 0.00;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* CN_Gather
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2025/8/9
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "PQ_GDINFORMATION")
|
||||
public class PqGdCompany {
|
||||
|
||||
@TableId
|
||||
@TableField(value="GD_INDEX")
|
||||
private Long gdIndex;
|
||||
|
||||
@TableField(value="NAME")
|
||||
private String name;
|
||||
|
||||
@TableField(value="PROVINCE_INDEX")
|
||||
private Long provinceIndex;
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -123,4 +124,7 @@ public class PqLine {
|
||||
*/
|
||||
@TableField(value = "SUBV_NAME")
|
||||
private String subvName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String subName;
|
||||
}
|
||||
@@ -112,8 +112,8 @@ public class EventGateController extends BaseController {
|
||||
String str ="/";
|
||||
if(CollUtil.isNotEmpty(assList)){
|
||||
List<String> userIds = assList.stream().map(PqUserLineAssPO::getUserIndex).distinct().collect(Collectors.toList());
|
||||
List<PqUserLedgerPO> poList = pqUserLedgerMapper.selectList(new LambdaQueryWrapper<PqUserLedgerPO>().select(PqUserLedgerPO::getId,PqUserLedgerPO::getProjectName).in(PqUserLedgerPO::getId,userIds));
|
||||
str = poList.stream().map(PqUserLedgerPO::getProjectName).collect(Collectors.joining(StrUtil.COMMA));
|
||||
List<PqUserLedgerPO> poList = pqUserLedgerMapper.selectList(new LambdaQueryWrapper<PqUserLedgerPO>().select(PqUserLedgerPO::getId,PqUserLedgerPO::getCustomerName).in(PqUserLedgerPO::getId,userIds));
|
||||
str = poList.stream().map(PqUserLedgerPO::getCustomerName).collect(Collectors.joining(StrUtil.COMMA));
|
||||
}
|
||||
|
||||
List<PqsDepts> deptsList = (List<PqsDepts>)redisUtil.getObjectByKey(REDIS_DEPT_INDEX+ StrUtil.DASHED+"AllDept");
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||
import com.njcn.gather.event.devcie.mapper.PqLineMapper;
|
||||
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.PqGdCompany;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqLine;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqsDeptsline;
|
||||
import com.njcn.gather.event.devcie.service.PqsDeptslineService;
|
||||
@@ -99,8 +100,16 @@ public class EventRightController extends BaseController {
|
||||
@ApiImplicitParam(name = "largeScreenCountParam", value = "", required = true)
|
||||
public HttpResult<Object> rightEventDevOpen(@RequestBody LargeScreenCountParam largeScreenCountParam) {
|
||||
String methodDescribe = getMethodDescribe("rightEventDevOpen");
|
||||
Page<DeviceDTO> page = eventRightService.rightEventDevOpen(largeScreenCountParam);
|
||||
Page<PqUserLedgerPO> page = eventRightService.rightEventDevOpen(largeScreenCountParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("gdSelect")
|
||||
public HttpResult<List<PqGdCompany>> gdSelect() {
|
||||
String methodDescribe = getMethodDescribe("gdSelect");
|
||||
List<PqGdCompany> list = eventRightService.gdSelect();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.gather.event.transientes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.gather.event.transientes.pojo.po.PqsIntegrity;
|
||||
import com.njcn.gather.event.transientes.pojo.po.PqsOnlinerate;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2025/07/29 下午 6:40【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface PqsIntegrityMapper extends BaseMapper<PqsIntegrity> {
|
||||
}
|
||||
@@ -44,4 +44,6 @@ public class LargeScreenCountParam extends BaseParam {
|
||||
private String smallObjType;
|
||||
|
||||
private List<String> eventIds;
|
||||
|
||||
private Integer gdIndex;
|
||||
}
|
||||
|
||||
@@ -29,10 +29,6 @@ public class PqUserLedgerPO implements Serializable {
|
||||
@TableField(value = "CUSTOMER_NAME")
|
||||
private String customerName;
|
||||
|
||||
|
||||
@TableField(value = "PROJECT_NAME")
|
||||
private String projectName;
|
||||
|
||||
@TableField(value = "ELECTRICITY_ADDRESS")
|
||||
private String electricityAddress;
|
||||
|
||||
@@ -88,4 +84,10 @@ public class PqUserLedgerPO implements Serializable {
|
||||
@TableField(value = "IS_SHOW")
|
||||
private Integer isShow;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer eventCount = 0;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String info;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.njcn.gather.event.transientes.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* CN_Gather
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2025/8/9
|
||||
*/
|
||||
|
||||
|
||||
@TableName(value="PQS_INTEGRITY")
|
||||
@Data
|
||||
public class PqsIntegrity {
|
||||
|
||||
@TableField(value="TIMEID")
|
||||
private LocalDate timeID;
|
||||
|
||||
@TableField(value="Line_index")
|
||||
private Integer lineIndex;
|
||||
|
||||
@TableField(value="due")
|
||||
private Integer due;
|
||||
|
||||
@TableField(value="real")
|
||||
private Integer real;
|
||||
|
||||
|
||||
}
|
||||
@@ -38,6 +38,7 @@ public class EventDetailVO {
|
||||
private String pointname;
|
||||
private String gdName;
|
||||
private String busName;
|
||||
private String devName;
|
||||
|
||||
private String persisttime;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.njcn.gather.event.transientes.service;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||
import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqGdCompany;
|
||||
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.param.PqUserLedgerParam;
|
||||
@@ -21,8 +22,13 @@ public interface EventRightService {
|
||||
Page<EventDetailVO> rightEventOpen(LargeScreenCountParam param);
|
||||
|
||||
|
||||
Page<DeviceDTO> rightEventDevOpen(LargeScreenCountParam param);
|
||||
Page<PqUserLedgerPO> rightEventDevOpen(LargeScreenCountParam param);
|
||||
|
||||
|
||||
|
||||
|
||||
List<UserLedgerStatisticVO.Inner> rightImportUser(LargeScreenCountParam param);
|
||||
|
||||
|
||||
List<PqGdCompany> gdSelect();
|
||||
}
|
||||
|
||||
@@ -10,10 +10,14 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.gather.event.devcie.mapper.PqDeviceMapper;
|
||||
import com.njcn.gather.event.devcie.mapper.PqGdCompanyMapper;
|
||||
import com.njcn.gather.event.devcie.mapper.PqSubstationMapper;
|
||||
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.PqGdCompany;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqLine;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqSubstation;
|
||||
import com.njcn.gather.event.devcie.service.PqLineService;
|
||||
import com.njcn.gather.event.transientes.mapper.PqUserLedgerMapper;
|
||||
import com.njcn.gather.event.transientes.mapper.PqUserLineAssMapper;
|
||||
@@ -27,6 +31,7 @@ import com.njcn.gather.event.transientes.pojo.vo.UserLedgerStatisticVO;
|
||||
import com.njcn.gather.event.transientes.service.*;
|
||||
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.stereotype.Service;
|
||||
@@ -62,14 +67,11 @@ public class EventRightServiceImpl implements EventRightService {
|
||||
private final MsgEventConfigService msgEventConfigService;
|
||||
|
||||
private final PqLineService pqLineService;
|
||||
|
||||
private final PqSubstationMapper pqSubstationMapper;
|
||||
private final CommGeneralService commGeneralService;
|
||||
|
||||
private final RedisUtil redisUtil;
|
||||
private final PqsOnlinerateService pqsOnlinerateService;
|
||||
|
||||
|
||||
private final static String NAME_KEY = "LineCache:";
|
||||
private final PqDeviceMapper pqDeviceMapper;
|
||||
private final PqGdCompanyMapper pqGdCompanyMapper;
|
||||
|
||||
|
||||
|
||||
@@ -113,7 +115,7 @@ public class EventRightServiceImpl implements EventRightService {
|
||||
.collect(Collectors.groupingBy(PqUserLedgerPO::getBigObjType));
|
||||
|
||||
// 7. 构建结果
|
||||
buildResult(result, treeMap, userMap, assList, events, lines);
|
||||
buildResult(result, treeMap, userMap, assList, events, lines,dicTreeList);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -199,6 +201,9 @@ public class EventRightServiceImpl implements EventRightService {
|
||||
//对象大类不为空
|
||||
userWrapper.eq(PqUserLedgerPO::getSmallObjType,param.getSmallObjType());
|
||||
}
|
||||
if(Objects.nonNull(param.getGdIndex())){
|
||||
userWrapper.eq(PqUserLedgerPO::getPowerSupplyArea,param.getGdIndex());
|
||||
}
|
||||
}
|
||||
return pqUserLedgerMapper.selectList(userWrapper);
|
||||
}
|
||||
@@ -219,8 +224,10 @@ public class EventRightServiceImpl implements EventRightService {
|
||||
}
|
||||
|
||||
|
||||
private void buildResult(UserLedgerStatisticVO result,Map<String, PqsDicTreePO> treeMap,Map<String, List<PqUserLedgerPO>> userMap,List<PqUserLineAssPO> assList,List<PqsEventdetail> eventdetailList, List<PqLine> lineList){
|
||||
private void buildResult(UserLedgerStatisticVO result,Map<String, PqsDicTreePO> treeMap,Map<String, List<PqUserLedgerPO>> userMap,List<PqUserLineAssPO> assList,List<PqsEventdetail> eventdetailList, List<PqLine> lineList,List<PqsDicTreePO> dicTreePOList){
|
||||
List<UserLedgerStatisticVO.Inner> innerList = new ArrayList<>();
|
||||
Map<String,PqsDicTreePO> allTreeMap = dicTreePOList.stream().collect(Collectors.toMap(PqsDicTreePO::getId,dept->dept));
|
||||
|
||||
treeMap.forEach((tree, obj) -> {
|
||||
//获取对象大类的用户
|
||||
List<PqUserLedgerPO> oneList = userMap.get(obj.getId());
|
||||
@@ -253,7 +260,7 @@ public class EventRightServiceImpl implements EventRightService {
|
||||
item.setCount(count[0]);
|
||||
item.setTreeId(key);
|
||||
item.setParentId(obj.getId());
|
||||
item.setName(treeMap.containsKey(key) ? treeMap.get(key).getName() : "/");
|
||||
item.setName(allTreeMap.containsKey(key) ? allTreeMap.get(key).getName() : "/");
|
||||
childrenList.add(item);
|
||||
});
|
||||
inner.setChildren(childrenList);
|
||||
@@ -316,6 +323,9 @@ public class EventRightServiceImpl implements EventRightService {
|
||||
}
|
||||
//获取用户监测点关系符合部门监测点的
|
||||
List<PqUserLineAssPO> assList = getUserLineAssociations(deptLineIds);
|
||||
if(CollUtil.isEmpty(assList)){
|
||||
return result;
|
||||
}
|
||||
List<String> userIds = assList.stream().map(PqUserLineAssPO::getUserIndex).distinct().collect(Collectors.toList());
|
||||
if(CollUtil.isEmpty(userIds)){
|
||||
return result;
|
||||
@@ -362,7 +372,7 @@ public class EventRightServiceImpl implements EventRightService {
|
||||
EventDetailVO eventDetailVO = new EventDetailVO();
|
||||
BeanUtil.copyProperties(pqsEventdetail,eventDetailVO);
|
||||
List<String> userTemIds = temMap.get(pqsEventdetail.getLineid());
|
||||
String objName = userTemIds.stream().map(it->pqMap.get(it).getProjectName()).collect(Collectors.joining("; "));
|
||||
String objName = userTemIds.stream().map(it->pqMap.get(it).getCustomerName()).collect(Collectors.joining("; "));
|
||||
eventDetailVO.setObjName(objName);
|
||||
LedgerBaseInfoDTO dto = lineMap.get(pqsEventdetail.getLineid());
|
||||
eventDetailVO.setBdname(dto.getStationName());
|
||||
@@ -371,6 +381,8 @@ public class EventRightServiceImpl implements EventRightService {
|
||||
eventDetailVO.setLineid(dto.getLineId());
|
||||
eventDetailVO.setPointname(dto.getLineName());
|
||||
eventDetailVO.setEventdetail_index(pqsEventdetail.getEventdetailIndex());
|
||||
eventDetailVO.setDevName(dto.getDevName());
|
||||
|
||||
resultList.add(eventDetailVO);
|
||||
}
|
||||
result.setTotal(page.getTotal());
|
||||
@@ -379,19 +391,18 @@ public class EventRightServiceImpl implements EventRightService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<DeviceDTO> rightEventDevOpen(LargeScreenCountParam param) {
|
||||
DateTime startTime = DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime(), DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
|
||||
DateTime endTime = DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime(), DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
|
||||
|
||||
Page<DeviceDTO> result = new Page<>(PageFactory.getPageNum(param),PageFactory.getPageSize(param));
|
||||
public Page<PqUserLedgerPO> rightEventDevOpen(LargeScreenCountParam param) {
|
||||
Page<PqUserLedgerPO> result = new Page<>(PageFactory.getPageNum(param),PageFactory.getPageSize(param));
|
||||
List<Integer> lineIds = commGeneralService.getLineIdsByRedis(param.getDeptId());
|
||||
|
||||
if(CollUtil.isEmpty(lineIds)){
|
||||
return result;
|
||||
}
|
||||
List<PqUserLineAssPO> assPOList =getUserLineAssociations(lineIds);
|
||||
if(CollUtil.isEmpty(assPOList)){
|
||||
return result;
|
||||
}
|
||||
|
||||
List<String> userIds = assPOList.stream().map(PqUserLineAssPO::getUserIndex).collect(Collectors.toList());
|
||||
List<String> userIds = assPOList.stream().map(PqUserLineAssPO::getUserIndex).distinct().collect(Collectors.toList());
|
||||
LambdaQueryWrapper<PqUserLedgerPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
if(userIds.size() > 1000){
|
||||
@@ -414,38 +425,57 @@ public class EventRightServiceImpl implements EventRightService {
|
||||
lambdaQueryWrapper.eq(PqUserLedgerPO::getSmallObjType,param.getSmallObjType());
|
||||
}
|
||||
|
||||
if(StrUtil.isNotBlank(param.getBigObjType()) || StrUtil.isNotBlank(param.getSmallObjType())){
|
||||
List<PqUserLedgerPO> pqUserLedgerPOList = pqUserLedgerMapper.selectList(lambdaQueryWrapper);
|
||||
List<String> lastIds = pqUserLedgerPOList.stream().map(PqUserLedgerPO::getId).collect(Collectors.toList());
|
||||
List<Integer> ids = assPOList.stream().filter(it->lastIds.contains(it.getUserIndex())).map(PqUserLineAssPO::getLineIndex).collect(Collectors.toList());
|
||||
if(CollUtil.isEmpty(ids)){
|
||||
return result;
|
||||
}
|
||||
result = pqDeviceMapper.queryListByLineIds(new Page<DeviceDTO>(PageFactory.getPageNum(param),PageFactory.getPageSize(param)),param.getSearchValue(),ids);
|
||||
|
||||
}else {
|
||||
//查询条件都为空直接拿取所有测点匹配装置
|
||||
List<Integer> lineAssIds = assPOList.stream().map(PqUserLineAssPO::getLineIndex).distinct().collect(Collectors.toList());
|
||||
result = pqDeviceMapper.queryListByLineIds(new Page<DeviceDTO>(PageFactory.getPageNum(param),PageFactory.getPageSize(param)),param.getSearchValue(),lineAssIds);
|
||||
|
||||
if(Objects.nonNull(param.getGdIndex())){
|
||||
lambdaQueryWrapper.eq(PqUserLedgerPO::getPowerSupplyArea,param.getGdIndex());
|
||||
}
|
||||
List<Integer> devList = result.getRecords().stream().map(DeviceDTO::getDevId).collect(Collectors.toList());
|
||||
|
||||
List<PqsOnlinerate> list = pqsOnlinerateService.lambdaQuery().in(PqsOnlinerate::getDevIndex,devList).between(PqsOnlinerate::getTimeid, startTime, endTime).list();
|
||||
if(!CollectionUtils.isEmpty(list)){
|
||||
for (DeviceDTO record : result.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()*100) / (temp.getOfflinemin() + temp.getOnlinemin());
|
||||
}).average().getAsDouble();
|
||||
record.setOnLineRate(new BigDecimal(asDouble).setScale(2, RoundingMode.UP).doubleValue());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
List<PqUserLedgerPO> userList = pqUserLedgerMapper.selectList(lambdaQueryWrapper);
|
||||
if(CollUtil.isEmpty(userList)){
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
List<String> userTemIds = userList.stream().map(PqUserLedgerPO::getId).collect(Collectors.toList());
|
||||
|
||||
List<PqUserLineAssPO> aassList = assPOList.stream().filter(it->userTemIds.contains(it.getUserIndex())).collect(Collectors.toList());
|
||||
List<Integer> ids = aassList.stream().map(PqUserLineAssPO::getLineIndex).distinct().collect(Collectors.toList());
|
||||
List<PqsEventdetail> eventdetailList = getEventsInTimeRange(param,ids);
|
||||
if(CollUtil.isEmpty(eventdetailList)){
|
||||
return result;
|
||||
}
|
||||
List<Integer> temLineIds = eventdetailList.stream().map(PqsEventdetail::getLineid).distinct().collect(Collectors.toList());
|
||||
List<String> lastUserList = aassList.stream().filter(it->temLineIds.contains(it.getLineIndex())).map(PqUserLineAssPO::getUserIndex).distinct().collect(Collectors.toList());
|
||||
|
||||
Page<PqUserLedgerPO> page = pqUserLedgerMapper.selectPage(new Page<>(PageFactory.getPageNum(param),PageFactory.getPageSize(param)),new LambdaQueryWrapper<PqUserLedgerPO>().in(PqUserLedgerPO::getId,lastUserList));
|
||||
if(CollUtil.isEmpty(page.getRecords())){
|
||||
return page;
|
||||
}
|
||||
|
||||
List<String> lastIds = page.getRecords().stream().map(PqUserLedgerPO::getId).collect(Collectors.toList());
|
||||
List<PqUserLineAssPO> lastAssList = aassList.stream().filter(it->lastIds.contains(it.getUserIndex())).collect(Collectors.toList());
|
||||
|
||||
List<Integer> monitorIds = lastAssList.stream().map(PqUserLineAssPO::getLineIndex).distinct().collect(Collectors.toList());
|
||||
List<PqLine> pqLineList = pqLineService.list(new LambdaQueryWrapper<PqLine>().in(PqLine::getLineIndex,monitorIds));
|
||||
|
||||
List<PqSubstation> pqSubstationList = pqSubstationMapper.selectList(new LambdaQueryWrapper<PqSubstation>().in(PqSubstation::getSubIndex,pqLineList.stream().map(PqLine::getSubIndex).collect(Collectors.toList())));
|
||||
Map<Integer,PqSubstation> subMap = pqSubstationList.stream().collect(Collectors.toMap(PqSubstation::getSubIndex,sub->sub));
|
||||
pqLineList.forEach(it->it.setSubName(subMap.get(it.getSubIndex()).getName()));
|
||||
|
||||
Map<String,List<Integer>> objMap = lastAssList.stream().collect(Collectors.groupingBy(PqUserLineAssPO::getUserIndex,Collectors.mapping(PqUserLineAssPO::getLineIndex,Collectors.toList())));
|
||||
Map<String,List<PqLine>> lastMap = new HashMap<>();
|
||||
objMap.forEach((k,vList)->{
|
||||
lastMap.put(k,pqLineList.stream().filter(it->vList.contains(it.getLineIndex())).collect(Collectors.toList()));
|
||||
});
|
||||
page.getRecords().forEach(item-> {
|
||||
if(objMap.containsKey(item.getId())){
|
||||
long count = eventdetailList.stream().filter(it->objMap.get(item.getId()).contains(it.getLineid())).count();
|
||||
item.setEventCount((int)count);;
|
||||
}
|
||||
if(lastMap.containsKey(item.getId())){
|
||||
List<PqLine> abList = lastMap.get(item.getId());
|
||||
item.setSubstationName(abList.stream().map(PqLine::getSubName).distinct().collect(Collectors.joining(StrUtil.COMMA)));
|
||||
item.setInfo(abList.stream().map(items->items.getSubName()+"_"+items.getSubvName()).distinct().collect(Collectors.joining("; ")));
|
||||
}
|
||||
});
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
@@ -490,12 +520,12 @@ public class EventRightServiceImpl implements EventRightService {
|
||||
List<PqsEventdetail> eventList = pqsEventdetailService.lambdaQuery().
|
||||
in(PqsEventdetail::getLineid,lineIds)
|
||||
.in(PqsEventdetail::getWavetype,msgEventConfigService.getEventType())
|
||||
.between(PqsEventdetail::getTimeid,DateUtil.parse(param.getSearchBeginTime()),DateUtil.parse(param.getSearchEndTime())).list();
|
||||
.between(PqsEventdetail::getTimeid,DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())),DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime()))).list();
|
||||
if(CollUtil.isEmpty(eventList)){
|
||||
poList.forEach(item->{
|
||||
UserLedgerStatisticVO.Inner inner = new UserLedgerStatisticVO.Inner();
|
||||
inner.setCustomId(item.getId());
|
||||
inner.setName(item.getProjectName());
|
||||
inner.setName(item.getCustomerName());
|
||||
inner.setCount(0);
|
||||
result.add(inner);
|
||||
});
|
||||
@@ -506,7 +536,7 @@ public class EventRightServiceImpl implements EventRightService {
|
||||
poList.forEach(item->{
|
||||
UserLedgerStatisticVO.Inner inner = new UserLedgerStatisticVO.Inner();
|
||||
inner.setCustomId(item.getId());
|
||||
inner.setName(item.getProjectName());
|
||||
inner.setName(item.getCustomerName());
|
||||
List<Integer> LIds = assMap.get(item.getId());
|
||||
List<String> eventIds = eventList.stream().filter(it -> LIds.contains(it.getLineid())).map(PqsEventdetail::getEventdetailIndex).collect(Collectors.toList());
|
||||
inner.setEventList(eventIds);
|
||||
@@ -516,6 +546,11 @@ public class EventRightServiceImpl implements EventRightService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PqGdCompany> gdSelect() {
|
||||
return pqGdCompanyMapper.selectList(null);
|
||||
}
|
||||
|
||||
private Integer[] getEventCount(List<PqUserLedgerPO> oneList, List<PqUserLineAssPO> assList, List<PqsEventdetail> pqsEventdetailList, List<PqLine> lineList,boolean devFlag) {
|
||||
Integer[] count = new Integer[]{0, 0};
|
||||
//用户的id
|
||||
@@ -524,31 +559,18 @@ public class EventRightServiceImpl implements EventRightService {
|
||||
//获取用户关联监测点
|
||||
List<Integer> lineTemIds = assList.stream().filter(it -> userIds.contains(it.getUserIndex())).map(PqUserLineAssPO::getLineIndex).distinct().collect(Collectors.toList());
|
||||
//用户的暂降事件次数
|
||||
long eventCount = pqsEventdetailList.stream().filter(it -> lineTemIds.contains(it.getLineid())).count();
|
||||
count[0] = (int) eventCount;
|
||||
List<PqsEventdetail> eventdetailList = pqsEventdetailList.stream().filter(it -> lineTemIds.contains(it.getLineid())).collect(Collectors.toList());
|
||||
count[0] = eventdetailList.size();
|
||||
if(devFlag) {
|
||||
long devCount = lineList.stream().filter(it -> lineTemIds.contains(it.getLineIndex())).map(PqLine::getDevIndex).distinct().count();
|
||||
List<Integer> lastLineIds = eventdetailList.stream().map(PqsEventdetail::getLineid).distinct().collect(Collectors.toList());
|
||||
List<String> userLastIds = assList.stream().filter(it->lastLineIds.contains(it.getLineIndex())).map(PqUserLineAssPO::getUserIndex).distinct().collect(Collectors.toList());
|
||||
long devCount = oneList.stream().filter(it->userLastIds.contains(it.getId())).count();
|
||||
count[1] = (int) devCount;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
private <T, ID> List<T> batchQuery(List<ID> ids, Function<List<ID>, List<T>> queryFunc, int batchSize) {
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
if (ids.size() <= batchSize) {
|
||||
return queryFunc.apply(ids);
|
||||
}
|
||||
|
||||
List<T> result = new ArrayList<>();
|
||||
List<List<ID>> batches = CollUtil.split(ids, batchSize);
|
||||
for (List<ID> batch : batches) {
|
||||
result.addAll(queryFunc.apply(batch));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ import com.njcn.gather.event.devcie.pojo.dto.SubstationDTO;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqLinedetail;
|
||||
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.pojo.param.LargeScreenCountParam;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqDevice;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqLine;
|
||||
@@ -91,6 +93,8 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
||||
private final RedisUtil redisUtil;
|
||||
private final PqsOnlinerateService pqsOnlinerateService;
|
||||
|
||||
private final PqsIntegrityMapper pqsIntegrityMapper;
|
||||
|
||||
private final PqUserLedgerMapper pqUserLedgerMapper;
|
||||
|
||||
private final PqUserLineAssMapper pqUserLineAssMapper;
|
||||
@@ -538,7 +542,7 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
||||
}
|
||||
if(assMap.containsKey(eventDetailVO.getLineid())) {
|
||||
List<String> temList = assMap.get(eventDetailVO.getLineid()).stream().map(PqUserLineAssPO::getUserIndex).collect(Collectors.toList());
|
||||
String str = temList.stream().map(its -> userMap.containsKey(its)?userMap.get(its).getProjectName() + "; ":"/").collect(Collectors.joining());
|
||||
String str = temList.stream().map(its -> userMap.containsKey(its)?userMap.get(its).getCustomerName() + "; ":"/").collect(Collectors.joining());
|
||||
eventDetailVO.setObjName(str);
|
||||
}
|
||||
result.add(eventDetailVO);
|
||||
@@ -1109,16 +1113,38 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
||||
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());
|
||||
if(Objects.isNull(largeScreenCountParam.getGdIndex())){
|
||||
pqLineList = pqLineList.stream().filter(temp->deptslineIds.contains(temp.getLineIndex())).collect(Collectors.toList());
|
||||
}else {
|
||||
pqLineList = pqLineList.stream().filter(temp->deptslineIds.contains(temp.getLineIndex()) && Objects.equals(temp.getGdIndex(),largeScreenCountParam.getGdIndex())).collect(Collectors.toList());
|
||||
}
|
||||
if(CollUtil.isEmpty(pqLineList)){
|
||||
return new Page<>();
|
||||
}
|
||||
|
||||
List<Integer> devIndexs = pqLineList.stream().map(PqLine::getDevIndex).distinct().collect(Collectors.toList());
|
||||
//在运总数
|
||||
List<PqDevice> pqDeviceList = pqDeviceService.lambdaQuery().in(PqDevice::getDevIndex, devIndexs).eq(PqDevice::getDevflag, 0).list();
|
||||
List<Integer> runDevList = pqDeviceList.stream().map(PqDevice::getDevIndex).collect(Collectors.toList());
|
||||
List<PqsOnlinerate> list = pqsOnlinerateService.lambdaQuery().in(PqsOnlinerate::getDevIndex,runDevList).between(PqsOnlinerate::getTimeid, startTime, endTime).list();
|
||||
|
||||
pqsEventdetailPage = pqDeviceService.selectDeviceDTOPage(pqsEventdetailPage,largeScreenCountParam.getSearchValue(),runDevList,largeScreenCountParam.getState());
|
||||
if(!CollectionUtils.isEmpty(list)){
|
||||
List<DeviceDTO> deviceDTOList = pqsEventdetailPage.getRecords();
|
||||
if(!CollectionUtils.isEmpty(deviceDTOList)){
|
||||
List<Integer> devIds = deviceDTOList.stream().map(DeviceDTO::getDevId).collect(Collectors.toList());
|
||||
List<PqsOnlinerate> list = pqsOnlinerateService.lambdaQuery().in(PqsOnlinerate::getDevIndex,devIds).between(PqsOnlinerate::getTimeid, startTime, endTime).list();
|
||||
|
||||
List<PqLine> inteList = pqLineList.stream().filter(it->devIds.contains(it.getDevIndex())).collect(Collectors.toList());
|
||||
Map<Integer,List<Integer>> lineMap = inteList.stream().collect(Collectors.groupingBy(PqLine::getDevIndex,Collectors.mapping(PqLine::getLineIndex,Collectors.toList())));
|
||||
List<Integer> inteIds = inteList.stream().map(PqLine::getLineIndex).collect(Collectors.toList());
|
||||
|
||||
Map<Integer,Double> inteDevMap = new HashMap<>();
|
||||
List<PqsIntegrity> pqsIntegrityList = pqsIntegrityMapper.selectList(new LambdaQueryWrapper<PqsIntegrity>().in(PqsIntegrity::getLineIndex,inteIds));
|
||||
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);
|
||||
inteDevMap.put(dev,rate);
|
||||
});
|
||||
|
||||
|
||||
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)){
|
||||
@@ -1126,7 +1152,7 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
53
event_smart/src/main/resources/application-dev.yml
Normal file
53
event_smart/src/main/resources/application-dev.yml
Normal file
@@ -0,0 +1,53 @@
|
||||
spring:
|
||||
application:
|
||||
name: event_smart
|
||||
|
||||
datasource:
|
||||
dynamic:
|
||||
primary: master
|
||||
strict: false # 是否严格匹配数据源,默认false
|
||||
druid: # 如果使用Druid连接池
|
||||
validation-query: SELECT 1 FROM DUAL # 达梦专用校验SQL
|
||||
initial-size: 10
|
||||
# 初始化大小,最小,最大
|
||||
min-idle: 20
|
||||
maxActive: 500
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
testWhileIdle: true
|
||||
testOnBorrow: true
|
||||
testOnReturn: false
|
||||
# 打开PSCache,并且指定每个连接上PSCache的大小
|
||||
poolPreparedStatements: true
|
||||
maxPoolPreparedStatementPerConnectionSize: 20
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:oracle:thin:@192.168.1.51:1521:pqsbase
|
||||
username: pqsadmin_bj
|
||||
password: pqsadmin
|
||||
driver-class-name: oracle.jdbc.OracleDriver
|
||||
# salve:
|
||||
# driver-class-name: dm.jdbc.driver.DmDriver
|
||||
# url: jdbc:dm://192.168.1.21:5236/PQSADMIN?useUnicode=true&characterEncoding=utf-8
|
||||
# username: PQSADMINLN
|
||||
# password: Pqsadmin123
|
||||
|
||||
|
||||
|
||||
redis:
|
||||
database: 10
|
||||
host: localhost
|
||||
port: 6379
|
||||
timeout: 5000
|
||||
lettuce:
|
||||
pool:
|
||||
max-active: 8
|
||||
max-wait: -1
|
||||
max-idle: 8
|
||||
min-idle: 0
|
||||
|
||||
|
||||
55
event_smart/src/main/resources/application-prod.yml
Normal file
55
event_smart/src/main/resources/application-prod.yml
Normal file
@@ -0,0 +1,55 @@
|
||||
server:
|
||||
port: 18093
|
||||
spring:
|
||||
application:
|
||||
name: event_smart
|
||||
datasource:
|
||||
dynamic:
|
||||
primary: master
|
||||
strict: false # 是否严格匹配数据源,默认false
|
||||
druid: # 如果使用Druid连接池
|
||||
validation-query: SELECT 1 FROM DUAL # 达梦专用校验SQL
|
||||
initial-size: 10
|
||||
# 初始化大小,最小,最大
|
||||
min-idle: 20
|
||||
maxActive: 500
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
testWhileIdle: true
|
||||
testOnBorrow: true
|
||||
testOnReturn: false
|
||||
# 打开PSCache,并且指定每个连接上PSCache的大小
|
||||
poolPreparedStatements: true
|
||||
maxPoolPreparedStatementPerConnectionSize: 20
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:oracle:thin:@192.168.10.34:11521:pqsbase
|
||||
username: pqsadmin
|
||||
password: Pqsadmin_123
|
||||
driver-class-name: oracle.jdbc.OracleDriver
|
||||
# salve:
|
||||
# driver-class-name: dm.jdbc.driver.DmDriver
|
||||
# url: jdbc:dm://192.168.1.21:5236/PQSADMIN?useUnicode=true&characterEncoding=utf-8
|
||||
# username: PQSADMINLN
|
||||
# password: Pqsadmin123
|
||||
|
||||
|
||||
|
||||
redis:
|
||||
database: 10
|
||||
host: localhost
|
||||
port: 16379
|
||||
password: "Pqsadmin@#1qaz"
|
||||
timeout: 5000
|
||||
lettuce:
|
||||
pool:
|
||||
max-active: 20
|
||||
max-wait: 5000
|
||||
max-idle: 8
|
||||
min-idle: 0
|
||||
|
||||
|
||||
@@ -7,56 +7,8 @@ server:
|
||||
spring:
|
||||
application:
|
||||
name: event_smart
|
||||
datasource:
|
||||
dynamic:
|
||||
primary: master
|
||||
strict: false # 是否严格匹配数据源,默认false
|
||||
druid: # 如果使用Druid连接池
|
||||
validation-query: SELECT 1 FROM DUAL # 达梦专用校验SQL
|
||||
initial-size: 10
|
||||
# 初始化大小,最小,最大
|
||||
min-idle: 20
|
||||
maxActive: 500
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
testWhileIdle: true
|
||||
testOnBorrow: true
|
||||
testOnReturn: false
|
||||
# 打开PSCache,并且指定每个连接上PSCache的大小
|
||||
poolPreparedStatements: true
|
||||
maxPoolPreparedStatementPerConnectionSize: 20
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:oracle:thin:@192.168.1.51:1521:pqsbase
|
||||
username: pqsadmin_bj
|
||||
password: pqsadmin
|
||||
#url: jdbc:oracle:thin:@192.168.10.34:11521:pqsbase
|
||||
#username: pqsadmin
|
||||
#password: Pqsadmin_123
|
||||
driver-class-name: oracle.jdbc.OracleDriver
|
||||
# salve:
|
||||
# driver-class-name: dm.jdbc.driver.DmDriver
|
||||
# url: jdbc:dm://192.168.1.21:5236/PQSADMIN?useUnicode=true&characterEncoding=utf-8
|
||||
# username: PQSADMINLN
|
||||
# password: Pqsadmin123
|
||||
|
||||
|
||||
|
||||
redis:
|
||||
database: 10
|
||||
host: localhost
|
||||
port: 6379
|
||||
timeout: 5000
|
||||
lettuce:
|
||||
pool:
|
||||
max-active: 8
|
||||
max-wait: -1
|
||||
max-idle: 8
|
||||
min-idle: 0
|
||||
profiles:
|
||||
active: dev
|
||||
|
||||
|
||||
#mybatis配置信息
|
||||
|
||||
Reference in New Issue
Block a user