1.数据单位管理
2.谐波模块-excel和word报告数据单位调整 3.监测点权重管理
This commit is contained in:
@@ -4,15 +4,22 @@ package com.njcn.harmonic.controller;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.device.pms.api.MonitorClient;
|
||||
import com.njcn.device.pms.pojo.po.Monitor;
|
||||
import com.njcn.device.pq.api.DeviceUnitClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.pq.pojo.po.PqsDeviceUnit;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.event.enums.EventResponseEnum;
|
||||
import com.njcn.harmonic.pojo.param.ReportQueryParam;
|
||||
import com.njcn.harmonic.pojo.po.ExcelRptTemp;
|
||||
import com.njcn.harmonic.pojo.po.report.EnumPass;
|
||||
import com.njcn.harmonic.pojo.po.report.OverLimitInfo;
|
||||
import com.njcn.harmonic.pojo.po.report.Pass;
|
||||
@@ -22,6 +29,9 @@ import com.njcn.harmonic.service.ReportService;
|
||||
import com.njcn.harmonic.utils.WordUtil2;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.api.ThemeFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.system.pojo.po.Theme;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -37,6 +47,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@@ -46,8 +57,6 @@ import java.util.*;
|
||||
@AllArgsConstructor
|
||||
public class ExportModelController extends BaseController {
|
||||
|
||||
|
||||
|
||||
// 非谐波数据
|
||||
List<ReportTarget> listVirtual;
|
||||
List<ReportTarget> listPower;
|
||||
@@ -67,14 +76,15 @@ public class ExportModelController extends BaseController {
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
private final ThemeFeignClient themeFeignClient;
|
||||
private final ReportService reportService;
|
||||
private final DeviceUnitClient deviceUnitClient;
|
||||
|
||||
@PostMapping("/exportModel")
|
||||
@ApiOperation("word报告")
|
||||
public String exportworld(HttpServletResponse response,
|
||||
String startTime, String endTime, Integer type, String lineIndex,
|
||||
String name, String reportNumber, String crmName,
|
||||
MultipartFile file) throws IOException {
|
||||
|
||||
public HttpResult<String> exportWorld(HttpServletResponse response,
|
||||
String startTime, String endTime, Integer type, String lineIndex,
|
||||
String name, String reportNumber, String crmName,
|
||||
MultipartFile file) throws IOException {
|
||||
String methodDescribe = getMethodDescribe("exportWorld");
|
||||
//获取监测点信息
|
||||
String bdname = "";
|
||||
Integer pttype = 0;
|
||||
@@ -152,7 +162,7 @@ public class ExportModelController extends BaseController {
|
||||
|
||||
|
||||
if (0 == overLimitData.getOverLimitRate().size()) {
|
||||
return "datafail";
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, "dataFail", methodDescribe);
|
||||
}
|
||||
|
||||
String rtfPath = "";
|
||||
@@ -188,15 +198,17 @@ public class ExportModelController extends BaseController {
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
flagPath = false;
|
||||
return "readerror";
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, "readError", methodDescribe);
|
||||
} finally {
|
||||
if (ins != null) {
|
||||
ins.close();
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> reportmap = new HashMap<String, Object>();// 报告Map
|
||||
|
||||
Map<String, Object> reportmap = new HashMap<>();// 报告Map
|
||||
//数据单位
|
||||
PqsDeviceUnit deviceUnit = deviceUnitClient.lineUnitDetail(lineIndex).getData();
|
||||
reportmap.putAll(unitMap(deviceUnit));
|
||||
reportmap.put("$atype$", atype);
|
||||
reportmap.put("$btype$", btype);
|
||||
reportmap.put("$ctype$", ctype);
|
||||
@@ -356,9 +368,9 @@ public class ExportModelController extends BaseController {
|
||||
iCount++;
|
||||
}
|
||||
// 假如所有的数据都为null,则返回(所选的时间段内未找到数据)
|
||||
if (iCount == reportmap.size())
|
||||
return "exportworld";// 未找到数据
|
||||
|
||||
if (iCount == reportmap.size()){
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, "exportWorld", methodDescribe);
|
||||
}
|
||||
// 基本数据判断
|
||||
for (int i = 0; i < 3; i++) {
|
||||
String tmpstrMap = "A";
|
||||
@@ -637,16 +649,16 @@ public class ExportModelController extends BaseController {
|
||||
}
|
||||
|
||||
if (maxValue > limit) {
|
||||
tmpstrResultFre += "最大值为:" + valueOfFreValue.getFmaxValue().toString() + "Hz";
|
||||
tmpstrResultFre += "最大值为:" + valueOfFreValue.getFmaxValue().toString() + deviceUnit.getUnitFrequencyDev();
|
||||
}
|
||||
if (minValue > limit) {
|
||||
tmpstrResultFre += "最小值为:" + valueOfFreValue.getMinValue().toString() + "Hz";
|
||||
tmpstrResultFre += "最小值为:" + valueOfFreValue.getMinValue().toString() + deviceUnit.getUnitFrequencyDev();
|
||||
}
|
||||
if (aveValue > limit) {
|
||||
tmpstrResultFre += "平均值为:" + valueOfFreValue.getMeanValue().toString() + "Hz";
|
||||
tmpstrResultFre += "平均值为:" + valueOfFreValue.getMeanValue().toString() + deviceUnit.getUnitFrequencyDev();
|
||||
}
|
||||
if (cp95Value > limit) {
|
||||
tmpstrResultFre += "95%概率值为:" + valueOfFreValue.getCp95Value().toString() + "Hz";
|
||||
tmpstrResultFre += "95%概率值为:" + valueOfFreValue.getCp95Value().toString() + deviceUnit.getUnitFrequencyDev();
|
||||
}
|
||||
|
||||
if (!(maxValue >= minValue && maxValue >= aveValue && maxValue >= cp95Value)) {
|
||||
@@ -662,12 +674,12 @@ public class ExportModelController extends BaseController {
|
||||
|
||||
if ("".equals(tmpstrResultFre)) {
|
||||
reportmap.put("$FV0R$", "合格");// 三张大表取值
|
||||
strResultFre += "从上表中可以看出" + strLineBaseName + "频率偏差均满足国标限值(±" + valueOfFreLimit + "Hz)的要求。";
|
||||
strResultFre += "从上表中可以看出" + strLineBaseName + "频率偏差均满足国标限值(±" + valueOfFreLimit + deviceUnit.getUnitFrequencyDev()+")的要求。";
|
||||
} else {
|
||||
reportmap.put("$FV0R$", "不合格");// 三张大表取值
|
||||
strAnalysis += tmpstrResultFre + ",均不满足国标限值(±" + valueOfFreLimit + "Hz)的要求。";
|
||||
strAnalysis += tmpstrResultFre + ",均不满足国标限值(±" + valueOfFreLimit + deviceUnit.getUnitFrequencyDev()+")的要求。";
|
||||
strResultFre += "从上表中可以看出" + strLineBaseName + "频率偏差" + tmpstrResultFre + ",均不满足国标限值(±" + valueOfFreLimit
|
||||
+ "Hz)的要求。";
|
||||
+ deviceUnit.getUnitFrequencyDev()+")的要求。";
|
||||
}
|
||||
|
||||
reportmap.put("$ResultFre$", strResultFre);
|
||||
@@ -1194,10 +1206,65 @@ public class ExportModelController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
log.error("获取报告发生异常,异常是" + e.getMessage());
|
||||
}
|
||||
|
||||
return "success";
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据单位信息 重组
|
||||
* @param deviceUnit 数据单位对象
|
||||
* @return
|
||||
*/
|
||||
private Map<String,String> unitMap(PqsDeviceUnit deviceUnit){
|
||||
List<DictData> dictData = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEVICE_UNIT.getCode()).getData();
|
||||
Map<String,String> unit=new HashMap<>();
|
||||
List<String> list = dictData.stream().map(DictData::getCode).collect(Collectors.toList());
|
||||
for (String s : list) {
|
||||
//有效值
|
||||
if(s.equals(DicDataEnum.EFFECTIVE.getCode())){
|
||||
unit.put("$"+s+"_i$",deviceUnit.getIeffective());
|
||||
unit.put("$"+s+"_v$",deviceUnit.getLineVoltage());
|
||||
}
|
||||
//功率
|
||||
if(s.equals(DicDataEnum.POWER.getCode())){
|
||||
unit.put("$"+s+"_p$",deviceUnit.getTotalActiveP());
|
||||
unit.put("$"+s+"_q$",deviceUnit.getTotalNoP());
|
||||
unit.put("$"+s+"_s$",deviceUnit.getTotalViewP());
|
||||
}
|
||||
//畸变率
|
||||
if(s.equals(DicDataEnum.DISTORTION.getCode())){
|
||||
unit.put("$"+s+"_v$",deviceUnit.getVdistortion());
|
||||
}
|
||||
//电压偏差
|
||||
if(s.equals(DicDataEnum.VOLTAGE.getCode())){
|
||||
unit.put("$"+s+"_v$",deviceUnit.getVoltageDev());
|
||||
}
|
||||
//频率
|
||||
if(s.equals(DicDataEnum.UNIT_FREQUENCY.getCode())){
|
||||
unit.put("$"+s+"_freq$",deviceUnit.getUnitFrequency());
|
||||
unit.put("$"+s+"_freqDev$",deviceUnit.getUnitFrequencyDev());
|
||||
}
|
||||
//三项不平衡度
|
||||
if(s.equals(DicDataEnum.UNBALANCE.getCode())){
|
||||
unit.put("$"+s+"_v$","%");
|
||||
unit.put("$"+s+"_vPos$",deviceUnit.getPositiveV());
|
||||
unit.put("$"+s+"_vNeg$",deviceUnit.getNoPositiveV());
|
||||
unit.put("$"+s+"_vZero$",deviceUnit.getNoPositiveV());
|
||||
unit.put("$"+s+"_i$","%");
|
||||
unit.put("$"+s+"_iPos$","A");
|
||||
unit.put("$"+s+"_iNeg$","A");
|
||||
unit.put("$"+s+"_iZero$","A");
|
||||
}
|
||||
//基波
|
||||
if(s.equals(DicDataEnum.FUND.getCode())){
|
||||
unit.put("$"+s+"_i$",deviceUnit.getIfund());
|
||||
unit.put("$"+s+"_v$",deviceUnit.getVfundEffective());
|
||||
|
||||
}
|
||||
}
|
||||
return unit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 解析base64,返回图片所在路径
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user