1.电能质量在线监测需求调整
2.变电站台账功能(待完善)
This commit is contained in:
@@ -38,6 +38,7 @@ import com.njcn.supervision.enums.ProblemTypeEnum;
|
||||
import com.njcn.supervision.mapper.device.LineWarningMapper;
|
||||
import com.njcn.supervision.pojo.param.device.OnlineParam;
|
||||
import com.njcn.supervision.pojo.po.device.LineWarning;
|
||||
import com.njcn.supervision.pojo.po.leaflet.WarningLeaflet;
|
||||
import com.njcn.supervision.pojo.vo.device.LineLimitDetailVo;
|
||||
import com.njcn.supervision.pojo.vo.device.OnlineVo;
|
||||
import com.njcn.supervision.service.device.ILineWarningService;
|
||||
@@ -60,7 +61,10 @@ import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.TemporalAdjusters;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Function;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -247,10 +251,15 @@ public class LineWarningServiceImpl extends MppServiceImpl<LineWarningMapper, Li
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void startReport(OnlineParam.ReportParam param) {
|
||||
List<LineWarning> allLineWarnings = new ArrayList<>();
|
||||
//获取年份
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
LocalDate date = LocalDate.parse(param.getSearchBeginTime(), formatter);
|
||||
int year = date.getYear();
|
||||
param.setYear(String.valueOf(year));
|
||||
param.setNumber(getNumber(year));
|
||||
//获取部门名称
|
||||
String deptName = deptFeignClient.getDeptById(param.getDeptId()).getData().getName();
|
||||
param.setDeptName(deptName);
|
||||
|
||||
String inputUrl = "file/warningReport.docx";
|
||||
String alarmType = param.getType() == 1 ? "预" : "告";
|
||||
String fileName = "电能["+alarmType+"]"+param.getYear()+"年"+param.getNumber()+"号-"+param.getDeptName()+"地市 电能质量技术监督"+alarmType+"警单.docx";
|
||||
@@ -800,6 +809,34 @@ public class LineWarningServiceImpl extends MppServiceImpl<LineWarningMapper, Li
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询库里面的编号
|
||||
*/
|
||||
public String getNumber(Integer year) {
|
||||
LocalDate firstDayOfYear = LocalDate.of(year, 1, 1);
|
||||
LocalDate lastDayOfYear = LocalDate.of(year + 1, 1, 1).minusDays(1);
|
||||
LambdaQueryWrapper<WarningLeaflet> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(WarningLeaflet::getState, 1)
|
||||
.eq(WarningLeaflet::getProblemType, 2)
|
||||
.between(WarningLeaflet::getCreateTime, firstDayOfYear, lastDayOfYear);
|
||||
List<WarningLeaflet> list = warningLeafletService.list(lambdaQueryWrapper);
|
||||
if (list.isEmpty()) {
|
||||
return "1";
|
||||
}
|
||||
// 编译正则表达式,用于匹配文件中的编号
|
||||
Pattern pattern = Pattern.compile("年(\\d+)号");
|
||||
int maxNumber = 0;
|
||||
for (WarningLeaflet leaflet : list) {
|
||||
String filePath = leaflet.getFilePath();
|
||||
Matcher matcher = pattern.matcher(filePath);
|
||||
if (matcher.find()) {
|
||||
int number = Integer.parseInt(matcher.group(1));
|
||||
maxNumber = Math.max(maxNumber, number);
|
||||
}
|
||||
}
|
||||
return String.valueOf(maxNumber + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取频率偏差-日最大值-最大值
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user