功能优化
This commit is contained in:
@@ -20,6 +20,12 @@ public class EventStatisticParam extends BaseParam {
|
||||
@ApiModelProperty("监测点id")
|
||||
private String lineId;
|
||||
|
||||
/**
|
||||
* 暂态事件类型
|
||||
*/
|
||||
@ApiModelProperty("暂态事件类型 0:全部 1:暂降 2:中断 3:暂升")
|
||||
private Integer eventType;
|
||||
|
||||
/**
|
||||
* 安装位置
|
||||
*/
|
||||
|
||||
@@ -59,6 +59,17 @@ public class PqSensitiveUserController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getListByUser")
|
||||
@ApiOperation("根据当前用户获取敏感负荷用户列表")
|
||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||
public HttpResult<List<PqSensitiveUserVo>> getListByUser(@RequestBody BaseParam param) {
|
||||
String methodDescribe = getMethodDescribe("getListByUser");
|
||||
List<PqSensitiveUserVo> result = pqSensitiveUserService.getListByUser(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getListByIds")
|
||||
@ApiOperation("根据id集合获取敏感负荷用户列表")
|
||||
|
||||
@@ -87,7 +87,7 @@ public class WordExportModelController extends BaseController {
|
||||
deviceUnitCommDTO = BeanUtil.copyProperties(pqsDeviceUnit, DeviceUnitCommDTO.class);
|
||||
|
||||
|
||||
monitorHarmonicReportService.exportWorld(response, startTime, endTime, type, lineIndex, name, reportNumber, crmName, isUrl, file, harmLineDetailDataCommDTO, overLimitInfoCommDTO,deviceUnitCommDTO);
|
||||
monitorHarmonicReportService.exportWorld(response, startTime, endTime, type, lineIndex, name, reportNumber, crmName, isUrl, file, harmLineDetailDataCommDTO, overLimitInfoCommDTO,deviceUnitCommDTO,lineDto.getDataLevel());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -125,15 +125,10 @@
|
||||
select DISTINCT b.id id,
|
||||
b.device_id deviceId,b.line_id lineId,b.code code,
|
||||
b.start_time startTime,b.tag tag ,b.wave_path wavePath,b.instant_pics,b.rms_pics , b.type type,b.level level,b.location location,b.cl_did clDid
|
||||
<if test="csEventUserQueryPage!=null and (csEventUserQueryPage.type == 0 or csEventUserQueryPage.type == 1 )">
|
||||
,d.name lineName
|
||||
</if>
|
||||
from cs_event b
|
||||
<if test="csEventUserQueryPage!=null and (csEventUserQueryPage.type == 0 or csEventUserQueryPage.type == 1 )">
|
||||
inner join cs_line d on d.line_id=b.line_id
|
||||
</if>
|
||||
left join cs_line d on d.line_id=b.line_id
|
||||
where 1=1
|
||||
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.endTime != null and csEventUserQueryPage.endTime !=''">
|
||||
AND DATE(b.start_time) <= DATE(#{csEventUserQueryPage.endTime})
|
||||
</if>
|
||||
|
||||
@@ -7,6 +7,8 @@ import com.njcn.csharmonic.pojo.po.PqSensitiveUser;
|
||||
import com.njcn.csharmonic.pojo.vo.PqSensitiveUserVo;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
@@ -19,6 +21,8 @@ public interface IPqSensitiveUserService extends IService<PqSensitiveUser> {
|
||||
|
||||
Page<PqSensitiveUserVo> getList(BaseParam param);
|
||||
|
||||
List<PqSensitiveUserVo> getListByUser(BaseParam param);
|
||||
|
||||
boolean save(PqSensitiveUserParam pqSensitiveUserParam);
|
||||
|
||||
boolean update(PqSensitiveUserParam.UpdatePqSensitiveUserParam pqSensitiveUserParam);
|
||||
|
||||
@@ -192,24 +192,50 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
||||
Page<DataGroupEventVO> result = new Page<>(PageFactory.getPageNum(baseParam),PageFactory.getPageSize(baseParam));
|
||||
DateTime begin = DateUtil.beginOfDay(DateUtil.parse(baseParam.getSearchBeginTime(), DatePattern.NORM_DATE_PATTERN));
|
||||
DateTime end = DateUtil.endOfDay(DateUtil.parse(baseParam.getSearchEndTime(), DatePattern.NORM_DATE_PATTERN));
|
||||
//暂态类型
|
||||
final List<String> EVENT_TAGS;
|
||||
if (Objects.isNull(baseParam.getEventType())) {
|
||||
EVENT_TAGS = Arrays.asList(
|
||||
EVT_SYS_DIPSTR.getCode(),
|
||||
EVT_SYS_INTRSTR.getCode(),
|
||||
EVT_SYS_SWLSTR.getCode()
|
||||
);
|
||||
} else {
|
||||
switch (baseParam.getEventType()) {
|
||||
case 1:
|
||||
EVENT_TAGS = Collections.singletonList(EVT_SYS_DIPSTR.getCode());
|
||||
break;
|
||||
case 2:
|
||||
EVENT_TAGS = Collections.singletonList(EVT_SYS_INTRSTR.getCode());
|
||||
break;
|
||||
case 3:
|
||||
EVENT_TAGS = Collections.singletonList(EVT_SYS_SWLSTR.getCode());
|
||||
break;
|
||||
default:
|
||||
EVENT_TAGS = Arrays.asList(
|
||||
EVT_SYS_DIPSTR.getCode(),
|
||||
EVT_SYS_INTRSTR.getCode(),
|
||||
EVT_SYS_SWLSTR.getCode()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
List<String> EVENT_TAGS = Arrays.asList(
|
||||
EVT_SYS_DIPSTR.getCode(),
|
||||
EVT_SYS_INTRSTR.getCode(),
|
||||
EVT_SYS_SWLSTR.getCode()
|
||||
);
|
||||
//监测点
|
||||
List<CsLinePO> csLinePOList = csLineFeignClient.getSimpleLine().getData();
|
||||
if (CollUtil.isEmpty(csLinePOList)) {
|
||||
return result;
|
||||
}
|
||||
List<String> lineIds = csLinePOList.stream().map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
||||
|
||||
LambdaQueryWrapper<CsEventPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(StrUtil.isNotBlank(baseParam.getLineId()),CsEventPO::getLineId,baseParam.getLineId())
|
||||
.eq(CsEventPO::getType, CsEventEnum.EVENT_TYPE.getCode())
|
||||
.in(CsEventPO::getTag, EVENT_TAGS)
|
||||
.in(CsEventPO::getLineId,lineIds)
|
||||
.between(CsEventPO::getStartTime,begin,end)
|
||||
.orderByDesc(CsEventPO::getStartTime);
|
||||
Page<CsEventPO> page = this.page(new Page<>(PageFactory.getPageNum(baseParam),PageFactory.getPageSize(baseParam)),lambdaQueryWrapper);
|
||||
if(CollUtil.isNotEmpty(page.getRecords())){
|
||||
|
||||
List<String> ids = page.getRecords().stream().map(CsEventPO::getLineId).distinct().collect(Collectors.toList());
|
||||
List<CsLinePO> csLinePOList = csLineFeignClient.queryLineById(ids).getData();
|
||||
Map<String,String> linePOMap = csLinePOList.stream().collect(Collectors.toMap(CsLinePO::getLineId, CsLinePO::getName));
|
||||
|
||||
List<DataGroupEventVO> dataGroupEventVOList = BeanUtil.copyToList(page.getRecords(),DataGroupEventVO.class);
|
||||
@@ -402,7 +428,7 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
||||
rmpEventDetailPO.setMeasurementPointId(param.getMonitorId());
|
||||
rmpEventDetailPO.setStartTime(time);
|
||||
rmpEventDetailPO.setEventType(getEventType(param.getEventType()));
|
||||
rmpEventDetailPO.setFeatureAmplitude(param.getAmplitude() * 100);
|
||||
rmpEventDetailPO.setFeatureAmplitude(param.getAmplitude());
|
||||
rmpEventDetailPO.setDuration(param.getDuration());
|
||||
rmpEventDetailPO.setEventDescribe(getTag(param.getEventType()));
|
||||
rmpEventDetailPO.setPhase(param.getPhase());
|
||||
|
||||
@@ -14,6 +14,7 @@ import cn.hutool.json.*;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.SqlRunner;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
@@ -428,14 +429,17 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
if (!nowDate.isAfter(startDate)) {
|
||||
startDate = LocalDate.now();
|
||||
}
|
||||
String startTime = LocalDateTimeUtil.format(startDate, DatePattern.NORM_DATE_PATTERN) + InfluxDbSqlConstant.START_TIME;
|
||||
// String startTime = LocalDateTimeUtil.format(startDate, DatePattern.NORM_DATE_PATTERN) + InfluxDbSqlConstant.START_TIME;
|
||||
String startTime = LocalDateTimeUtil.format(startDate, DatePattern.NORM_DATE_PATTERN);
|
||||
//如时间是大于当前时间则用当前时间
|
||||
String localTime = InfluxDbSqlConstant.END_TIME;
|
||||
LocalDate endDate = LocalDateTimeUtil.parseDate(queryParam.getEndTime(), DatePattern.NORM_DATE_PATTERN);
|
||||
if (nowDate.isAfter(endDate)) {
|
||||
localTime = " " + LocalTime.now().format(DatePattern.NORM_TIME_FORMATTER);
|
||||
}
|
||||
String endTime = queryParam.getEndTime() + localTime;
|
||||
// String endTime = queryParam.getEndTime() + localTime;
|
||||
//报表结束时间是当前日的前一天
|
||||
String endTime = LocalDate.parse(queryParam.getEndTime(), DatePattern.NORM_DATE_FORMATTER).minusDays(1).format(DatePattern.NORM_DATE_FORMATTER);
|
||||
String val = v.replace(STR_THREE, "").replace("start_time", startTime).replace("end_time", endTime);
|
||||
son.putOpt(V, val);
|
||||
|
||||
@@ -2141,7 +2145,13 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
} else {
|
||||
phase = PHASE_MAPPING.get(item.getPhase());
|
||||
}
|
||||
tMap.put((item.getOtherName() + phase + item.getResourcesId()).toUpperCase(), item.getPrimaryFormula());
|
||||
if (ObjectUtils.isNotNull(item.getHarmStart()) && ObjectUtils.isNotNull(item.getHarmEnd())) {
|
||||
for (int i = item.getHarmStart(); i <= item.getHarmEnd() + 1; i++) {
|
||||
tMap.put((item.getOtherName() + "_" + i + phase + item.getResourcesId()).toUpperCase(), item.getPrimaryFormula());
|
||||
}
|
||||
} else {
|
||||
tMap.put((item.getOtherName() + phase + item.getResourcesId()).toUpperCase(), item.getPrimaryFormula());
|
||||
}
|
||||
});
|
||||
//pt
|
||||
double pt = safeDivide(linePO.getPtRatio(), linePO.getPt2Ratio());
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.csharmonic.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -86,6 +87,48 @@ public class PqSensitiveUserServiceImpl extends ServiceImpl<PqSensitiveUserMappe
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PqSensitiveUserVo> getListByUser(BaseParam param) {
|
||||
List<PqSensitiveUserVo> result = new ArrayList<>();
|
||||
//现根据用户获取监测点
|
||||
List<CsLinePO> poList = csLineFeignClient.getSimpleLine().getData();
|
||||
//获取敏感用户集合
|
||||
List<String> monitorUsers = poList.stream()
|
||||
.map(CsLinePO::getMonitorUser)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isEmpty(monitorUsers)) {
|
||||
return result;
|
||||
}
|
||||
//根据敏感用户进行监测点分组
|
||||
Map<String,List<CsLinePO>> map = poList.stream()
|
||||
.filter(po -> po.getMonitorUser() != null)
|
||||
.collect(Collectors.groupingBy(CsLinePO::getMonitorUser));
|
||||
//查询敏感用户信息集合
|
||||
LambdaQueryWrapper<PqSensitiveUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(PqSensitiveUser::getId,monitorUsers).orderByAsc(PqSensitiveUser::getSort);
|
||||
if (StrUtil.isNotBlank(param.getSearchValue())) {
|
||||
lambdaQueryWrapper.like(PqSensitiveUser::getName, param.getSearchValue());
|
||||
}
|
||||
List<PqSensitiveUser> sensitiveUserList = this.list(lambdaQueryWrapper);
|
||||
sensitiveUserList.forEach(item->{
|
||||
PqSensitiveUserVo vo = new PqSensitiveUserVo();
|
||||
BeanUtil.copyProperties(item,vo);
|
||||
if (map.containsKey(item.getId())) {
|
||||
vo.setIsMonitor("是");
|
||||
List<CsLinePO> list = map.get(item.getId());
|
||||
boolean hasGoverned = list.stream().anyMatch(item2 -> item2.getGovern() == 1);
|
||||
vo.setIsGovern(hasGoverned ? "是" : "否");
|
||||
} else {
|
||||
vo.setIsMonitor("否");
|
||||
vo.setIsGovern("否");
|
||||
}
|
||||
result.add(vo);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean save(PqSensitiveUserParam pqSensitiveUserParam) {
|
||||
checkParam(pqSensitiveUserParam,false);
|
||||
|
||||
@@ -159,11 +159,11 @@ public class RStatLimitRateDServiceImpl extends ServiceImpl<RStatLimitRateDMappe
|
||||
if (CollUtil.isEmpty(lineList)) {
|
||||
return result;
|
||||
}
|
||||
keywordsLineIds = lineList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||
keywordsLineIds = lineList.stream().filter(po -> po.getIsImportant() != null && po.getIsImportant() == 1).map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||
} else {
|
||||
List<CsLinePO> poList = csLineFeignClient.getSimpleLine().getData();
|
||||
if (CollUtil.isNotEmpty(poList)) {
|
||||
keywordsLineIds = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||
keywordsLineIds = poList.stream().filter(po -> po.getIsImportant() != null && po.getIsImportant() == 1).map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
if (CollUtil.isEmpty(keywordsLineIds)) {
|
||||
|
||||
@@ -51,7 +51,7 @@ public class RStatLimitRateDetailDServiceImpl extends ServiceImpl<RStatLimitRate
|
||||
static List<List<Integer>> extentPeriodList = new ArrayList<>();
|
||||
|
||||
static {
|
||||
indexMap.put("flicker", "闪变");
|
||||
indexMap.put("flicker", "长时闪变");
|
||||
indexMap.put("uharm", "谐波电压");
|
||||
indexMap.put("iharm", "谐波电流");
|
||||
indexMap.put("ubalance", "三相电压不平衡度");
|
||||
@@ -296,19 +296,15 @@ public class RStatLimitRateDetailDServiceImpl extends ServiceImpl<RStatLimitRate
|
||||
JSONObject entries = JSONUtil.parseObj(detail);
|
||||
for (Map.Entry<String, Object> dayEntry : entries.entrySet()) {
|
||||
String key = dayEntry.getKey();
|
||||
if (key.endsWith("Overtime") && key.startsWith(indexCode)) {
|
||||
if (shouldProcess(key, indexCode)) {
|
||||
double extentValue = 0;
|
||||
Object data = dayEntry.getValue();
|
||||
// 有数据有越限
|
||||
if (ObjectUtil.isNotEmpty(data)) {
|
||||
if (ObjectUtil.isNotEmpty(data) && overlimitJSON != null) {
|
||||
float maxValue = parseMaxValueFromJsonArray(data);
|
||||
if (overlimitJSON != null) {
|
||||
String itemKey = StrUtil.sub(key, 0, key.length() - 8);
|
||||
double limitValue = overlimitJSON.getDouble(itemKey);
|
||||
if (limitValue != 0) {
|
||||
extentValue = calculatePercentage(maxValue - limitValue, limitValue);
|
||||
|
||||
}
|
||||
String itemKey = StrUtil.sub(key, 0, key.length() - 8);
|
||||
double limitValue = overlimitJSON.getDouble(itemKey);
|
||||
if (limitValue != 0) {
|
||||
extentValue = calculatePercentage(maxValue - limitValue, limitValue);
|
||||
}
|
||||
}
|
||||
extentValuesList.add(extentValue);
|
||||
@@ -327,6 +323,9 @@ public class RStatLimitRateDetailDServiceImpl extends ServiceImpl<RStatLimitRate
|
||||
if (extentValue > start && extentValue <= end) {
|
||||
times++;
|
||||
}
|
||||
if ((i == extentPeriodList.size() - 1) && extentValue > 100.0) {
|
||||
times++;
|
||||
}
|
||||
}
|
||||
grade.put(i, times);
|
||||
extentGrades.add(grade);
|
||||
@@ -337,6 +336,11 @@ public class RStatLimitRateDetailDServiceImpl extends ServiceImpl<RStatLimitRate
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean shouldProcess(String key, String indexCode) {
|
||||
return (key.endsWith("Overtime") && key.startsWith(indexCode)) ||
|
||||
(Objects.equals(indexCode, "uharm") && key.startsWith("uaberrance"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LimitTimeProbabilityVO> limitTimeProbabilityData(LimitProbabilityQueryParam param) {
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.njcn.access.api.CsLineLatestDataFeignClient;
|
||||
import com.njcn.access.pojo.po.CsLineLatestData;
|
||||
import com.njcn.csdevice.api.*;
|
||||
import com.njcn.csdevice.param.IcdBzParam;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.po.RStatIntegrityD;
|
||||
import com.njcn.csdevice.pojo.po.RStatOnlineRateD;
|
||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
||||
import com.njcn.csharmonic.pojo.vo.DataVo;
|
||||
import com.njcn.csharmonic.pojo.vo.HalfMonthReportVO;
|
||||
@@ -110,9 +110,17 @@ public class StatisticsDataDataServiceImpl implements IStatisticsDataDataService
|
||||
List<String> lineList = csLineList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||
List<String> deviceList = csLineList.stream().map(CsLinePO::getDeviceId).collect(Collectors.toList());
|
||||
//获取监测点数据完整性
|
||||
List<RStatIntegrityD> list1 = integrityFeignClient.list(lineList,param.getStartTime(),param.getEndTime()).getData();
|
||||
IcdBzParam param1 = new IcdBzParam();
|
||||
param1.setLineList(lineList);
|
||||
param1.setStartTime(param.getStartTime());
|
||||
param1.setEndTime(param.getEndTime());
|
||||
List<RStatIntegrityD> list1 = integrityFeignClient.list(param1).getData();
|
||||
//获取终端在线率
|
||||
List<RStatOnlineRateD> list2 = onlineRateFeignClient.list(deviceList,param.getStartTime(),param.getEndTime()).getData();
|
||||
IcdBzParam param2 = new IcdBzParam();
|
||||
param2.setLineList(deviceList);
|
||||
param2.setStartTime(param.getStartTime());
|
||||
param2.setEndTime(param.getEndTime());
|
||||
List<RStatOnlineRateD> list2 = onlineRateFeignClient.list(param2).getData();
|
||||
//获取监测点最新数据时间
|
||||
List<CsLineLatestData> list3 = csLineLatestDataFeignClient.listData().getData();
|
||||
equipmentDeliveryList.forEach(dev->{
|
||||
|
||||
Reference in New Issue
Block a user