Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3f47b0f008 | |||
|
|
cb431b5af1 | ||
|
|
153428b24f | ||
|
|
d92544f7c4 | ||
|
|
3f1ae1886a | ||
|
|
af4863af65 | ||
|
|
4b7c1259a7 | ||
|
|
de1496389e | ||
| 79003cd0f4 | |||
|
|
c3443fcc91 | ||
|
|
5105e77823 | ||
|
|
eb068b76a4 | ||
| 2012221b73 | |||
|
|
f4df52dd1c | ||
| 41c557118c | |||
| 6596a572d6 | |||
|
|
786bd5d660 | ||
|
|
21d2c2b7a7 | ||
|
|
48fa4c2390 | ||
|
|
9d15351fba | ||
|
|
2339a006ec | ||
|
|
7fd904ab79 | ||
|
|
40cb153656 | ||
|
|
f922ee97aa | ||
|
|
26c5e933f5 | ||
|
|
c7d8fc3168 | ||
|
|
bb22857fc9 | ||
|
|
6ef908ff60 | ||
|
|
7461801657 |
@@ -120,7 +120,7 @@ public class SocketContrastResponseService {
|
|||||||
// private SysRegRes contrastRegRes = null;
|
// private SysRegRes contrastRegRes = null;
|
||||||
|
|
||||||
|
|
||||||
@Value("${log.homeDir}")
|
@Value("${report.reportDir}")
|
||||||
private String alignDataFilePath;
|
private String alignDataFilePath;
|
||||||
|
|
||||||
public static final Map<String, List<String>> testItemCodeMap = new HashMap() {{
|
public static final Map<String, List<String>> testItemCodeMap = new HashMap() {{
|
||||||
@@ -182,8 +182,8 @@ public class SocketContrastResponseService {
|
|||||||
FormalTestManager.pstDataType = null;
|
FormalTestManager.pstDataType = null;
|
||||||
FormalTestManager.isPstData = false;
|
FormalTestManager.isPstData = false;
|
||||||
FormalTestManager.isWaveCheck = false;
|
FormalTestManager.isWaveCheck = false;
|
||||||
// FormalTestManager.isXu = param.getPhaseCheck() == 1 ? true : false;
|
FormalTestManager.isXu = param.getPhaseCheck() == 1 ? true : false;
|
||||||
FormalTestManager.isXu = true;
|
// FormalTestManager.isXu = true;
|
||||||
FormalTestManager.nonWaveDataSourceEnum = null;
|
FormalTestManager.nonWaveDataSourceEnum = null;
|
||||||
|
|
||||||
String[] datasourceIds = FormalTestManager.currentTestPlan.getDatasourceId().split(",");
|
String[] datasourceIds = FormalTestManager.currentTestPlan.getDatasourceId().split(",");
|
||||||
@@ -1230,39 +1230,6 @@ public class SocketContrastResponseService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.setScheduler(targetCount, param.getUserPageId(), requestOperateCode, quitOperateCode);
|
this.setScheduler(targetCount, param.getUserPageId(), requestOperateCode, quitOperateCode);
|
||||||
// if (Objects.isNull(FormalTestManager.scheduler)) {
|
|
||||||
// FormalTestManager.scheduler = Executors.newScheduledThreadPool(1);
|
|
||||||
// long delay = this.getDelay(targetCount);
|
|
||||||
// FormalTestManager.scheduledFuture = FormalTestManager.scheduler.schedule(() -> {
|
|
||||||
// if (!checkResult) {
|
|
||||||
// System.out.println("正式检测-" + delay + "s内收集数据不完整!");
|
|
||||||
// // 断开与设备的连接,但是不要将Socket移除
|
|
||||||
// if (FormalTestManager.statisticsProtocol && quitOperateCode == SourceOperateCodeEnum.QUIT_INIT_02) {
|
|
||||||
// CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_01, false);
|
|
||||||
// }
|
|
||||||
// if (FormalTestManager.voltageProtocol) {
|
|
||||||
// CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, false);
|
|
||||||
// }
|
|
||||||
// CnSocketUtil.contrastSendquit(param.getUserPageId(), quitOperateCode, false);
|
|
||||||
// FormalTestManager.isTesting = false;
|
|
||||||
//
|
|
||||||
// this.clearData();
|
|
||||||
//
|
|
||||||
// Collection<String> disjunction = CollectionUtil.disjunction(FormalTestManager.pairsIpMap.keySet(), successPair.keySet());
|
|
||||||
// // 向前端推送收集数据不完整的配对项
|
|
||||||
// for (String key : disjunction) {
|
|
||||||
// webSend.setCode(SourceResponseCodeEnum.FAIL.getCode());
|
|
||||||
// webSend.setData(MsgUtil.getPairStr(key, FormalTestManager.pairsIpMap.inverse().get(key), FormalTestManager.devNameMapComm) + " 数据收集不完整!");
|
|
||||||
// WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSend));
|
|
||||||
// }
|
|
||||||
// // 推送最终失败结果
|
|
||||||
// webSend.setCode(SourceResponseCodeEnum.ALL_FAIL.getCode());//最终错误推送
|
|
||||||
// WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSend));
|
|
||||||
// }
|
|
||||||
// FormalTestManager.scheduler.shutdown();
|
|
||||||
// FormalTestManager.scheduler = null;
|
|
||||||
// }, delay, TimeUnit.SECONDS);
|
|
||||||
// }
|
|
||||||
|
|
||||||
String monitorId1 = devData.getId();
|
String monitorId1 = devData.getId();
|
||||||
String devMonitorId = monitorId1;
|
String devMonitorId = monitorId1;
|
||||||
@@ -2149,7 +2116,7 @@ public class SocketContrastResponseService {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
ExcelUtil.saveExcel(alignDataFilePath, "实时数据.xlsx", sheetsList);
|
ExcelUtil.saveExcel(alignDataFilePath, "对齐数据.xlsx", sheetsList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -809,6 +809,9 @@ public class DetectionServiceImpl {
|
|||||||
))
|
))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
DetectionData a = setDetectionData(isQualified, dataRule, mag, fData, dur, magErrList, channelTypeAList, TYPE_A, scale);
|
DetectionData a = setDetectionData(isQualified, dataRule, mag, fData, dur, magErrList, channelTypeAList, TYPE_A, scale);
|
||||||
|
if (CollUtil.isEmpty(mag.get(TYPE_A))) {
|
||||||
|
a.setIsData(2);
|
||||||
|
}
|
||||||
result.setAValue(JSON.toJSONString(a));
|
result.setAValue(JSON.toJSONString(a));
|
||||||
result.setTValue(JSON.toJSONString(a));
|
result.setTValue(JSON.toJSONString(a));
|
||||||
result.setResultFlag(a.getIsData());
|
result.setResultFlag(a.getIsData());
|
||||||
@@ -2206,32 +2209,32 @@ public class DetectionServiceImpl {
|
|||||||
switch (dataRule) {
|
switch (dataRule) {
|
||||||
case SECTION_VALUE:
|
case SECTION_VALUE:
|
||||||
if (aStandardDev.size() > 2) {
|
if (aStandardDev.size() > 2) {
|
||||||
aStandardDev.remove(aIdxs.get(0));
|
aStandardDev.remove(0);
|
||||||
aStandardDev.remove(aIdxs.get(aIdxs.size() - 1));
|
aStandardDev.remove(aStandardDev.size() - 1);
|
||||||
List<Double> newArray = DetectionUtil.getNewArray(aDev, aIdxs.subList(1, aIdxs.size() - 1));
|
List<Double> newArray = DetectionUtil.getNewArray(aDev, aIdxs.subList(1, aIdxs.size() - 1));
|
||||||
aDev.clear();
|
aDev.clear();
|
||||||
aDev.addAll(newArray);
|
aDev.addAll(newArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bStandardDev.size() > 2) {
|
if (bStandardDev.size() > 2) {
|
||||||
bStandardDev.remove(bIdxs.get(0));
|
bStandardDev.remove(0);
|
||||||
bStandardDev.remove(bIdxs.get(bIdxs.size() - 1));
|
bStandardDev.remove(bStandardDev.size() - 1);
|
||||||
List<Double> newArray = DetectionUtil.getNewArray(bDev, bIdxs.subList(1, bIdxs.size() - 1));
|
List<Double> newArray = DetectionUtil.getNewArray(bDev, bIdxs.subList(1, bIdxs.size() - 1));
|
||||||
bDev.clear();
|
bDev.clear();
|
||||||
bDev.addAll(newArray);
|
bDev.addAll(newArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cStandardDev.size() > 2) {
|
if (cStandardDev.size() > 2) {
|
||||||
cStandardDev.remove(cIdxs.get(0));
|
cStandardDev.remove(0);
|
||||||
cStandardDev.remove(cIdxs.get(cIdxs.size() - 1));
|
cStandardDev.remove(cStandardDev.size() - 1);
|
||||||
List<Double> newArray = DetectionUtil.getNewArray(cDev, cIdxs.subList(1, cIdxs.size() - 1));
|
List<Double> newArray = DetectionUtil.getNewArray(cDev, cIdxs.subList(1, cIdxs.size() - 1));
|
||||||
cDev.clear();
|
cDev.clear();
|
||||||
cDev.addAll(newArray);
|
cDev.addAll(newArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tStandardDev.size() > 2) {
|
if (tStandardDev.size() > 2) {
|
||||||
tStandardDev.remove(tIdxs.get(0));
|
tStandardDev.remove(0);
|
||||||
tStandardDev.remove(tIdxs.get(tIdxs.size() - 1));
|
tStandardDev.remove(tStandardDev.size() - 1);
|
||||||
List<Double> newArray = DetectionUtil.getNewArray(tDev, tIdxs.subList(1, tIdxs.size() - 1));
|
List<Double> newArray = DetectionUtil.getNewArray(tDev, tIdxs.subList(1, tIdxs.size() - 1));
|
||||||
tDev.clear();
|
tDev.clear();
|
||||||
tDev.addAll(newArray);
|
tDev.addAll(newArray);
|
||||||
@@ -2407,8 +2410,8 @@ public class DetectionServiceImpl {
|
|||||||
switch (dataRule) {
|
switch (dataRule) {
|
||||||
case SECTION_VALUE:
|
case SECTION_VALUE:
|
||||||
if (value.size() > 2) {
|
if (value.size() > 2) {
|
||||||
value.remove(idx.get(0));
|
value.remove(0);
|
||||||
value.remove(idx.get(idx.size() - 1));
|
value.remove(value.size() - 1);
|
||||||
List<Double> newArray = DetectionUtil.getNewArray(devMap.get(typeKey).get(key), idx.subList(1, idx.size() - 1));
|
List<Double> newArray = DetectionUtil.getNewArray(devMap.get(typeKey).get(key), idx.subList(1, idx.size() - 1));
|
||||||
devMap.get(typeKey).get(key).clear();
|
devMap.get(typeKey).get(key).clear();
|
||||||
devMap.get(typeKey).get(key).addAll(newArray);
|
devMap.get(typeKey).get(key).addAll(newArray);
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
|||||||
private final IPqScriptCheckDataService iPqScriptCheckDataService;
|
private final IPqScriptCheckDataService iPqScriptCheckDataService;
|
||||||
private final SocketManager socketManager;
|
private final SocketManager socketManager;
|
||||||
|
|
||||||
@Value("${log.homeDir}")
|
@Value("${report.reportDir}")
|
||||||
private String alignDataFilePath;
|
private String alignDataFilePath;
|
||||||
|
|
||||||
|
|
||||||
@@ -337,7 +337,7 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exportAlignData() {
|
public void exportAlignData() {
|
||||||
String fileName = "实时数据.xlsx";
|
String fileName = "对齐数据.xlsx";
|
||||||
HttpServletResponse response = HttpServletUtil.getResponse();
|
HttpServletResponse response = HttpServletUtil.getResponse();
|
||||||
response.reset();
|
response.reset();
|
||||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
|
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ public class NettyDevClientHandler extends SimpleChannelInboundHandler<String> {
|
|||||||
devLineTestResult.setDeviceName(dev.getDevName());
|
devLineTestResult.setDeviceName(dev.getDevName());
|
||||||
|
|
||||||
Integer[] resultFlags = dev.getMonitorList().stream()
|
Integer[] resultFlags = dev.getMonitorList().stream()
|
||||||
.map(monitor -> ResultEnum.NETWORK_TIMEOUT)
|
.map(monitor -> ResultEnum.NETWORK_TIMEOUT.getValue())
|
||||||
.toArray(Integer[]::new);
|
.toArray(Integer[]::new);
|
||||||
devLineTestResult.setChnResult(resultFlags);
|
devLineTestResult.setChnResult(resultFlags);
|
||||||
|
|
||||||
|
|||||||
@@ -137,6 +137,10 @@ public class PqIcdPathServiceImpl extends ServiceImpl<PqIcdPathMapper, PqIcdPath
|
|||||||
// String workDir = "D:\\program\\CN_Gather";
|
// String workDir = "D:\\program\\CN_Gather";
|
||||||
// 获取映射文件存放文件夹
|
// 获取映射文件存放文件夹
|
||||||
String dirPath = workDir + "\\9100";
|
String dirPath = workDir + "\\9100";
|
||||||
|
int index = workDir.indexOf("\\resources\\extraResources\\java");
|
||||||
|
if (index != -1) {
|
||||||
|
dirPath = workDir.substring(0, workDir.indexOf("\\resources\\extraResources\\java")) + "\\9100";
|
||||||
|
}
|
||||||
return dirPath;
|
return dirPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,6 +194,17 @@ public class PqIcdPathServiceImpl extends ServiceImpl<PqIcdPathMapper, PqIcdPath
|
|||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public boolean deleteIcd(List<String> ids) {
|
public boolean deleteIcd(List<String> ids) {
|
||||||
|
List<PqIcdPath> pqIcdPaths = this.listByIds(ids);
|
||||||
|
String commInstallPath = this.getCommInstallPath();
|
||||||
|
pqIcdPaths.forEach(pqIcdPath -> {
|
||||||
|
String mappingFilePath = commInstallPath + "\\DeviceControl\\Config\\" + pqIcdPath.getName() + ".txt";
|
||||||
|
Path path = Paths.get(mappingFilePath);
|
||||||
|
File file = path.toFile();
|
||||||
|
if (file.exists()) {
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return this.lambdaUpdate().in(PqIcdPath::getId, ids).set(PqIcdPath::getState, DataStateEnum.DELETED.getCode()).update();
|
return this.lambdaUpdate().in(PqIcdPath::getId, ids).set(PqIcdPath::getState, DataStateEnum.DELETED.getCode()).update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -554,6 +554,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
child.put("pid", adPlan.getFatherPlanId());
|
child.put("pid", adPlan.getFatherPlanId());
|
||||||
child.put("name", adPlan.getName());
|
child.put("name", adPlan.getName());
|
||||||
child.put("timeCheck", adPlan.getTimeCheck());
|
child.put("timeCheck", adPlan.getTimeCheck());
|
||||||
|
child.put("dataRule", adPlan.getDataRule());
|
||||||
|
|
||||||
List<PqStandardDev> pqStandardDevs = adPlanStandardDevMapper.listByPlanId(Collections.singletonList(adPlan.getId()));
|
List<PqStandardDev> pqStandardDevs = adPlanStandardDevMapper.listByPlanId(Collections.singletonList(adPlan.getId()));
|
||||||
List<String> devTypeIdList = pqStandardDevs.stream().map(PqStandardDev::getDevType).collect(Collectors.toList());
|
List<String> devTypeIdList = pqStandardDevs.stream().map(PqStandardDev::getDevType).collect(Collectors.toList());
|
||||||
@@ -1721,8 +1722,8 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
String zipFileName = URLEncoder.encode(subPlan.getName() + ".zip", "UTF-8");
|
String zipFileName = URLEncoder.encode(subPlan.getName() + ".zip", "UTF-8");
|
||||||
File zipFile = FileUtil.file(tempDir, zipFileName);
|
File zipFile = FileUtil.file(tempDir, zipFileName);
|
||||||
|
|
||||||
// 先将json文件添加到zip中
|
// 先将json文件添加到zip中(使用UTF-8编码)
|
||||||
ZipUtil.zip(jsonFile.getAbsolutePath(), zipFile.getAbsolutePath());
|
ZipUtil.zip(zipFile, CharsetUtil.CHARSET_UTF_8, false, jsonFile);
|
||||||
|
|
||||||
|
|
||||||
// 创建一个临时目录存放两个文件
|
// 创建一个临时目录存放两个文件
|
||||||
@@ -1744,8 +1745,8 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 重新创建zip文件,包含所有文件
|
// 重新创建zip文件,包含所有文件,使用UTF-8编码
|
||||||
ZipUtil.zip(tempZipDir.getAbsolutePath(), zipFile.getAbsolutePath());
|
ZipUtil.zip(zipFile, CharsetUtil.CHARSET_UTF_8, false, FileUtil.file(tempZipDir));
|
||||||
|
|
||||||
// 删除临时目录
|
// 删除临时目录
|
||||||
FileUtil.del(tempZipDir);
|
FileUtil.del(tempZipDir);
|
||||||
@@ -1779,9 +1780,9 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
File zipFile = FileUtil.file(tempDir, file.getOriginalFilename());
|
File zipFile = FileUtil.file(tempDir, file.getOriginalFilename());
|
||||||
file.transferTo(zipFile);
|
file.transferTo(zipFile);
|
||||||
|
|
||||||
// 解压zip文件
|
// 解压zip文件,使用UTF-8编码
|
||||||
File unzipDir = FileUtil.mkdir(FileUtil.file(tempDir, "unzip"));
|
File unzipDir = FileUtil.mkdir(FileUtil.file(tempDir, "unzip"));
|
||||||
ZipUtil.unzip(zipFile.getAbsolutePath(), unzipDir.getAbsolutePath());
|
ZipUtil.unzip(zipFile, unzipDir, CharsetUtil.CHARSET_UTF_8);
|
||||||
|
|
||||||
// 查找解压目录中的json文件
|
// 查找解压目录中的json文件
|
||||||
File[] files = unzipDir.listFiles();
|
File[] files = unzipDir.listFiles();
|
||||||
@@ -2099,8 +2100,8 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重新创建zip文件,包含所有文件
|
// 重新创建zip文件,包含所有文件,使用UTF-8编码
|
||||||
ZipUtil.zip(tempZipDir.getAbsolutePath(), zipFile.getAbsolutePath());
|
ZipUtil.zip(zipFile, CharsetUtil.CHARSET_UTF_8, false, FileUtil.file(tempZipDir));
|
||||||
|
|
||||||
// 删除临时目录
|
// 删除临时目录
|
||||||
FileUtil.del(tempZipDir);
|
FileUtil.del(tempZipDir);
|
||||||
|
|||||||
@@ -39,7 +39,10 @@ public enum BaseReportKeyEnum {
|
|||||||
CREATE_DATE("createDate","生产日期"),
|
CREATE_DATE("createDate","生产日期"),
|
||||||
TEMPERATURE("temp","温度"),
|
TEMPERATURE("temp","温度"),
|
||||||
HUMIDITY("hum","相对湿度"),
|
HUMIDITY("hum","相对湿度"),
|
||||||
DELEGATE("delegate","委托方");
|
DELEGATE("delegate","委托方"),
|
||||||
|
CREATEDATE("createDate","出厂日期"),
|
||||||
|
HW_VERSION("hardwareVersion","硬件版本"),
|
||||||
|
SW_VERSION("softwareVersion","软件版本");
|
||||||
|
|
||||||
private String key;
|
private String key;
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ import com.njcn.gather.report.service.IPqReportService;
|
|||||||
import com.njcn.gather.result.service.IResultService;
|
import com.njcn.gather.result.service.IResultService;
|
||||||
import com.njcn.gather.script.pojo.vo.PqScriptDtlDataVO;
|
import com.njcn.gather.script.pojo.vo.PqScriptDtlDataVO;
|
||||||
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||||
|
import com.njcn.gather.storage.pojo.param.SingleNonHarmParam;
|
||||||
import com.njcn.gather.storage.pojo.po.SimAndDigHarmonicResult;
|
import com.njcn.gather.storage.pojo.po.SimAndDigHarmonicResult;
|
||||||
import com.njcn.gather.storage.pojo.po.SimAndDigNonHarmonicResult;
|
import com.njcn.gather.storage.pojo.po.SimAndDigNonHarmonicResult;
|
||||||
import com.njcn.gather.storage.service.SimAndDigHarmonicService;
|
import com.njcn.gather.storage.service.SimAndDigHarmonicService;
|
||||||
@@ -88,6 +89,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.net.ftp.FTPClient;
|
import org.apache.commons.net.ftp.FTPClient;
|
||||||
import org.apache.commons.net.ftp.FTPReply;
|
import org.apache.commons.net.ftp.FTPReply;
|
||||||
|
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||||
import org.docx4j.jaxb.Context;
|
import org.docx4j.jaxb.Context;
|
||||||
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
|
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
|
||||||
import org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart;
|
import org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart;
|
||||||
@@ -115,6 +117,7 @@ import java.nio.file.NoSuchFileException;
|
|||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
@@ -164,6 +167,8 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
@Value("${qr.gcDev.path}")
|
@Value("${qr.gcDev.path}")
|
||||||
private String gcDevPath;
|
private String gcDevPath;
|
||||||
|
|
||||||
|
@Value("${report.dateFormat}")
|
||||||
|
private String dateFormat;
|
||||||
|
|
||||||
private final IPqDevService iPqDevService;
|
private final IPqDevService iPqDevService;
|
||||||
private final PqDevMapper pqDevMapper;
|
private final PqDevMapper pqDevMapper;
|
||||||
@@ -310,7 +315,8 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
private void uploadFile(ReportParam reportParam, PqReport pqReport, boolean isAdd) {
|
private void uploadFile(ReportParam reportParam, PqReport pqReport, boolean isAdd) {
|
||||||
MultipartFile baseFile = reportParam.getBaseFile();
|
MultipartFile baseFile = reportParam.getBaseFile();
|
||||||
MultipartFile detailFile = reportParam.getDetailFile();
|
MultipartFile detailFile = reportParam.getDetailFile();
|
||||||
String newDir = templatePath + File.separator + reportParam.getName() + File.separator + reportParam.getVersion() + File.separator;
|
String relativePath = reportParam.getName() + File.separator + reportParam.getVersion() + File.separator;
|
||||||
|
String newDir = templatePath + File.separator + relativePath;
|
||||||
|
|
||||||
long FILE_SIZE_LIMIT = 5 * 1024 * 1024;
|
long FILE_SIZE_LIMIT = 5 * 1024 * 1024;
|
||||||
if (isAdd) {
|
if (isAdd) {
|
||||||
@@ -329,13 +335,13 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
throw new BusinessException(ReportResponseEnum.FILE_SIZE_ERROR);
|
throw new BusinessException(ReportResponseEnum.FILE_SIZE_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
pqReport.setBasePath(newDir + baseOriginalFilename);
|
pqReport.setBasePath(relativePath + baseOriginalFilename);
|
||||||
pqReport.setDetailPath(newDir + detailOriginalFilename);
|
pqReport.setDetailPath(relativePath + detailOriginalFilename);
|
||||||
|
|
||||||
this.createDirectory(newDir);
|
this.createDirectory(newDir);
|
||||||
this.clearDirectory(newDir);
|
this.clearDirectory(newDir);
|
||||||
this.uploadFile(baseFile, pqReport.getBasePath());
|
this.uploadFile(baseFile, newDir + baseOriginalFilename);
|
||||||
this.uploadFile(detailFile, pqReport.getDetailPath());
|
this.uploadFile(detailFile, newDir + detailOriginalFilename);
|
||||||
} else {
|
} else {
|
||||||
throw new BusinessException(ReportResponseEnum.FILE_NOT_NULL);
|
throw new BusinessException(ReportResponseEnum.FILE_NOT_NULL);
|
||||||
}
|
}
|
||||||
@@ -383,34 +389,34 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
|
|
||||||
//若修改了文件名称、版本号,则需要重命名文件
|
//若修改了文件名称、版本号,则需要重命名文件
|
||||||
this.createDirectory(newDir);
|
this.createDirectory(newDir);
|
||||||
if (!oldDir.equals(newDir)) {
|
if (!oldDir.equals(relativePath)) {
|
||||||
// 文件夹重命名
|
// 文件夹重命名
|
||||||
String oldBasePathStr = oldPqReport.getBasePath();
|
String oldBasePathStr = oldPqReport.getBasePath();
|
||||||
String baseName = oldBasePathStr.substring(oldBasePathStr.lastIndexOf(File.separator) + 1);
|
String baseName = oldBasePathStr.substring(oldBasePathStr.lastIndexOf(File.separator) + 1);
|
||||||
Path oldBasePath = Paths.get(oldBasePathStr);
|
Path oldBasePath = Paths.get(templatePath + File.separator + oldBasePathStr);
|
||||||
Path newBasePath = Paths.get(newDir + baseName);
|
Path newBasePath = Paths.get(newDir + baseName);
|
||||||
pqReport.setBasePath(newDir + baseName);
|
pqReport.setBasePath(relativePath + baseName);
|
||||||
|
|
||||||
String oldDetailPathStr = oldPqReport.getDetailPath();
|
String oldDetailPathStr = oldPqReport.getDetailPath();
|
||||||
String detailName = oldDetailPathStr.substring(oldDetailPathStr.lastIndexOf(File.separator) + 1);
|
String detailName = oldDetailPathStr.substring(oldDetailPathStr.lastIndexOf(File.separator) + 1);
|
||||||
Path oldDetailPath = Paths.get(oldDetailPathStr);
|
Path oldDetailPath = Paths.get(templatePath + File.separator + oldDetailPathStr);
|
||||||
Path newDetailPath = Paths.get(newDir + detailName);
|
Path newDetailPath = Paths.get(newDir + detailName);
|
||||||
pqReport.setDetailPath(newDir + detailName);
|
pqReport.setDetailPath(relativePath + detailName);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// windows下文件夹名称不区分大小写
|
// windows下文件夹名称不区分大小写
|
||||||
if (!oldDir.equalsIgnoreCase(newDir)) {
|
if (!oldDir.equalsIgnoreCase(relativePath)) {
|
||||||
this.clearDirectory(newDir);
|
this.clearDirectory(newDir);
|
||||||
Files.move(oldBasePath, newBasePath);
|
Files.move(oldBasePath, newBasePath);
|
||||||
Files.move(oldDetailPath, newDetailPath);
|
Files.move(oldDetailPath, newDetailPath);
|
||||||
if (!oldPqReport.getName().equals(reportParam.getName()) && !this.existSameName(pqReport.getId(), oldPqReport.getName())) {
|
if (!oldPqReport.getName().equals(reportParam.getName()) && !this.existSameName(pqReport.getId(), oldPqReport.getName())) {
|
||||||
this.recursionDeleteDirectory(templatePath + File.separator + oldPqReport.getName());
|
this.recursionDeleteDirectory(templatePath + File.separator + oldPqReport.getName());
|
||||||
} else {
|
} else {
|
||||||
Paths.get(oldDir).toFile().delete();
|
Paths.get(templatePath + oldDir).toFile().delete();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 文件夹重命名
|
// 文件夹重命名
|
||||||
Paths.get(oldDir).toFile().renameTo(Paths.get(newDir).toFile());
|
Paths.get(templatePath + oldDir).toFile().renameTo(Paths.get(newDir).toFile());
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new BusinessException(ReportResponseEnum.FILE_RENAME_FAILED);
|
throw new BusinessException(ReportResponseEnum.FILE_RENAME_FAILED);
|
||||||
@@ -418,16 +424,16 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!baseFileOriginalFilename.isEmpty()) {
|
if (!baseFileOriginalFilename.isEmpty()) {
|
||||||
pqReport.setBasePath(newDir + baseFileOriginalFilename);
|
pqReport.setBasePath(relativePath + baseFileOriginalFilename);
|
||||||
Paths.get(oldPqReport.getBasePath()).toFile().delete();
|
Paths.get(templatePath + File.separator + oldPqReport.getBasePath()).toFile().delete();
|
||||||
Paths.get(newDir + oldPqReport.getBasePath().substring(oldPqReport.getBasePath().lastIndexOf(File.separator) + 1)).toFile().delete();
|
Paths.get(newDir + oldPqReport.getBasePath().substring(oldPqReport.getBasePath().lastIndexOf(File.separator) + 1)).toFile().delete();
|
||||||
this.uploadFile(baseFile, pqReport.getBasePath());
|
this.uploadFile(baseFile, newDir + baseFileOriginalFilename);
|
||||||
}
|
}
|
||||||
if (!detailFileOriginalFilename.isEmpty()) {
|
if (!detailFileOriginalFilename.isEmpty()) {
|
||||||
pqReport.setDetailPath(newDir + detailFileOriginalFilename);
|
pqReport.setDetailPath(relativePath + detailFileOriginalFilename);
|
||||||
Paths.get(oldPqReport.getDetailPath()).toFile().delete();
|
Paths.get(templatePath + File.separator + oldPqReport.getDetailPath()).toFile().delete();
|
||||||
Paths.get(newDir + oldPqReport.getDetailPath().substring(oldPqReport.getDetailPath().lastIndexOf(File.separator) + 1)).toFile().delete();
|
Paths.get(newDir + oldPqReport.getDetailPath().substring(oldPqReport.getDetailPath().lastIndexOf(File.separator) + 1)).toFile().delete();
|
||||||
this.uploadFile(detailFile, pqReport.getDetailPath());
|
this.uploadFile(detailFile, newDir + detailFileOriginalFilename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -800,8 +806,8 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
if (Objects.isNull(report)) {
|
if (Objects.isNull(report)) {
|
||||||
throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST);
|
throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST);
|
||||||
}
|
}
|
||||||
Path basePath = Paths.get(report.getBasePath());
|
Path basePath = Paths.get(templatePath + File.separator + report.getBasePath());
|
||||||
Path detailPath = Paths.get(report.getDetailPath());
|
Path detailPath = Paths.get(templatePath + File.separator + report.getDetailPath());
|
||||||
try (InputStream baseInputStream = Files.newInputStream(basePath);
|
try (InputStream baseInputStream = Files.newInputStream(basePath);
|
||||||
InputStream detailInputStream = Files.newInputStream(detailPath)) {
|
InputStream detailInputStream = Files.newInputStream(detailPath)) {
|
||||||
WordprocessingMLPackage detailModelDocument = WordprocessingMLPackage.load(detailInputStream);
|
WordprocessingMLPackage detailModelDocument = WordprocessingMLPackage.load(detailInputStream);
|
||||||
@@ -877,8 +883,8 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
if (Objects.isNull(report)) {
|
if (Objects.isNull(report)) {
|
||||||
throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST);
|
throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST);
|
||||||
}
|
}
|
||||||
Path basePath = Paths.get(report.getBasePath());
|
Path basePath = Paths.get(templatePath + File.separator + report.getBasePath());
|
||||||
Path detailPath = Paths.get(report.getDetailPath());
|
Path detailPath = Paths.get(templatePath + File.separator + report.getDetailPath());
|
||||||
try (InputStream baseInputStream = Files.newInputStream(basePath);
|
try (InputStream baseInputStream = Files.newInputStream(basePath);
|
||||||
InputStream detailInputStream = Files.newInputStream(detailPath)) {
|
InputStream detailInputStream = Files.newInputStream(detailPath)) {
|
||||||
WordprocessingMLPackage detailModelDocument = WordprocessingMLPackage.load(detailInputStream);
|
WordprocessingMLPackage detailModelDocument = WordprocessingMLPackage.load(detailInputStream);
|
||||||
@@ -2019,6 +2025,18 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
baseModelMap.put(BaseReportKeyEnum.DEV_TYPE.getKey(), devType.getName());
|
baseModelMap.put(BaseReportKeyEnum.DEV_TYPE.getKey(), devType.getName());
|
||||||
// 检测员
|
// 检测员
|
||||||
baseModelMap.put(BaseReportKeyEnum.INSPECTOR.getKey(), pqDevVO.getCheckBy() + "");
|
baseModelMap.put(BaseReportKeyEnum.INSPECTOR.getKey(), pqDevVO.getCheckBy() + "");
|
||||||
|
baseModelMap.put(BaseReportKeyEnum.INSPECTOR.getKey(), pqDevVO.getCheckBy() + "");
|
||||||
|
String datePattern = DatePattern.NORM_DATE_PATTERN;
|
||||||
|
if (DatePattern.CHINESE_DATE_PATTERN.equals(dateFormat)) {
|
||||||
|
datePattern = DatePattern.CHINESE_DATE_PATTERN;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 出厂日期
|
||||||
|
baseModelMap.put(BaseReportKeyEnum.CREATEDATE.getKey(), pqDevVO.getCreateDate().format(DateTimeFormatter.ofPattern(datePattern)));
|
||||||
|
// 硬件版本
|
||||||
|
baseModelMap.put(BaseReportKeyEnum.HW_VERSION.getKey(), StrUtil.isNotBlank(pqDevVO.getHardwareVersion()) ? pqDevVO.getHardwareVersion() : StrUtil.EMPTY);
|
||||||
|
// 软件版本
|
||||||
|
baseModelMap.put(BaseReportKeyEnum.SW_VERSION.getKey(), StrUtil.isNotBlank(pqDevVO.getSoftwareVersion()) ? pqDevVO.getSoftwareVersion() : StrUtil.EMPTY);
|
||||||
// 调试日期
|
// 调试日期
|
||||||
if (pqDevVO.getCheckTime() != null) {
|
if (pqDevVO.getCheckTime() != null) {
|
||||||
baseModelMap.put(BaseReportKeyEnum.TEST_DATE.getKey(), DateUtil.format(pqDevVO.getCheckTime(), DatePattern.CHINESE_DATE_PATTERN));
|
baseModelMap.put(BaseReportKeyEnum.TEST_DATE.getKey(), DateUtil.format(pqDevVO.getCheckTime(), DatePattern.CHINESE_DATE_PATTERN));
|
||||||
@@ -2159,7 +2177,19 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
private void dealDataModel(List<InputStream> wordFileInputStreams, DevReportParam devReportParam, PqDevVO pqDevVO) throws Exception {
|
private void dealDataModel(List<InputStream> wordFileInputStreams, DevReportParam devReportParam, PqDevVO pqDevVO) throws Exception {
|
||||||
Integer devChns = pqDevVO.getDevChns();
|
Integer devChns = pqDevVO.getDevChns();
|
||||||
for (int i = 1; i <= devChns; i++) {
|
for (int i = 1; i <= devChns; i++) {
|
||||||
ClassPathResource resource = new ClassPathResource("/model/report_table.docx");
|
String path = "/model/report_table.docx";
|
||||||
|
DevType devType = devTypeService.getById(pqDevVO.getDevType());
|
||||||
|
if (devType.getName().equals("PQ-COM")) {
|
||||||
|
path = "/model/report_table - PQ-COM.docx";
|
||||||
|
}
|
||||||
|
ClassPathResource resource = new ClassPathResource(path);
|
||||||
|
XWPFDocument dataModelDocumentTemp = new XWPFDocument(resource.getInputStream());
|
||||||
|
|
||||||
|
SingleNonHarmParam singleNonHarmParam = new SingleNonHarmParam();
|
||||||
|
singleNonHarmParam.setPlanCode(devReportParam.getPlanCode());
|
||||||
|
singleNonHarmParam.setDevId(pqDevVO.getId());
|
||||||
|
singleNonHarmParam.setChannelNo(i);
|
||||||
|
|
||||||
// 获取数据
|
// 获取数据
|
||||||
Map<String, String> dataModelMap = new HashMap<>(16);
|
Map<String, String> dataModelMap = new HashMap<>(16);
|
||||||
// 读取模板文件中的占位符
|
// 读取模板文件中的占位符
|
||||||
@@ -2177,11 +2207,20 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
List<SimAndDigHarmonicResult> adHarmonicResultList = adHarmonicService.listAllResultData(devReportParam.getScriptId(), devReportParam.getPlanCode(), devReportParam.getDevId() + "_" + i);
|
List<SimAndDigHarmonicResult> adHarmonicResultList = adHarmonicService.listAllResultData(devReportParam.getScriptId(), devReportParam.getPlanCode(), devReportParam.getDevId() + "_" + i);
|
||||||
|
|
||||||
// 填充数据
|
// 填充数据
|
||||||
|
int finalI = i;
|
||||||
indexKeysMap.forEach((index, keys) -> {
|
indexKeysMap.forEach((index, keys) -> {
|
||||||
String s1 = keys.stream().findFirst().get();
|
String s1 = keys.stream().findFirst().get();
|
||||||
// 谐波类
|
// 谐波类
|
||||||
if (DetectionCodeEnum.V2_50.getCode().equals(s1) || DetectionCodeEnum.I2_50.getCode().equals(s1) || DetectionCodeEnum.SV_1_49.getCode().equals(s1) || DetectionCodeEnum.SI_1_49.getCode().equals(s1)) {
|
if (DetectionCodeEnum.V2_50.getCode().equals(s1) || DetectionCodeEnum.I2_50.getCode().equals(s1) || DetectionCodeEnum.SV_1_49.getCode().equals(s1) || DetectionCodeEnum.SI_1_49.getCode().equals(s1)) {
|
||||||
fillMapValueHarm(adHarmonicResultList, dataModelMap, keys, index);
|
// 查找一下U1
|
||||||
|
double u1 = 57.74;
|
||||||
|
List<SimAndDigHarmonicResult> rawData = adHarmonicService.listAllRawData(devReportParam.getScriptId(), devReportParam.getPlanCode(), devReportParam.getDevId() + "_" + finalI);
|
||||||
|
SimAndDigHarmonicResult adHarmonicResult = rawData.stream().filter(obj -> obj.getAdType().equals(DetectionCodeEnum.V2_50.getCode())).sorted((obj1, obj2) -> obj2.getTimeId().compareTo(obj1.getTimeId())).findFirst().orElse(null);
|
||||||
|
if (ObjectUtil.isNotNull(adHarmonicResult)) {
|
||||||
|
String aValue1 = adHarmonicResult.getAValue1();
|
||||||
|
u1 = Double.parseDouble(aValue1);
|
||||||
|
}
|
||||||
|
fillMapValueHarm(adHarmonicResultList, dataModelMap, keys, index, u1);
|
||||||
} else {
|
} else {
|
||||||
// 非谐波类
|
// 非谐波类
|
||||||
if (DetectionCodeEnum.V_UNBAN.getCode().equals(s1) || DetectionCodeEnum.FREQ.getCode().equals(s1)) {
|
if (DetectionCodeEnum.V_UNBAN.getCode().equals(s1) || DetectionCodeEnum.FREQ.getCode().equals(s1)) {
|
||||||
@@ -2249,14 +2288,14 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
* @param keys key
|
* @param keys key
|
||||||
* @param index index
|
* @param index index
|
||||||
*/
|
*/
|
||||||
private void fillMapValueHarm(List<SimAndDigHarmonicResult> allHarmonicResultList, Map<String, String> dataModelMap, Set<String> keys, String index) {
|
private void fillMapValueHarm(List<SimAndDigHarmonicResult> allHarmonicResultList, Map<String, String> dataModelMap, Set<String> keys, String index, double baseValue) {
|
||||||
keys.forEach(key -> {
|
keys.forEach(key -> {
|
||||||
List<SimAndDigHarmonicResult> resultList = allHarmonicResultList.stream().filter(obj -> obj.getAdType().equals(key) && obj.getSort().toString().equals(index)).collect(Collectors.toList());
|
List<SimAndDigHarmonicResult> resultList = allHarmonicResultList.stream().filter(obj -> obj.getAdType().equals(key) && obj.getSort().toString().equals(index)).collect(Collectors.toList());
|
||||||
if (CollectionUtil.isNotEmpty(resultList)) {
|
if (CollectionUtil.isNotEmpty(resultList)) {
|
||||||
SimAndDigHarmonicResult adHarmonicResult = resultList.get(0);
|
SimAndDigHarmonicResult adHarmonicResult = resultList.get(0);
|
||||||
if (Objects.nonNull(adHarmonicResult)) {
|
if (Objects.nonNull(adHarmonicResult)) {
|
||||||
if (DetectionCodeEnum.V2_50.getCode().equals(key) || DetectionCodeEnum.SV_1_49.getCode().equals(key)) {
|
if (DetectionCodeEnum.V2_50.getCode().equals(key) || DetectionCodeEnum.SV_1_49.getCode().equals(key)) {
|
||||||
fillHarm(dataModelMap, adHarmonicResult, index, key, 57.74, 100);
|
fillHarm(dataModelMap, adHarmonicResult, index, key, baseValue, 100);
|
||||||
}
|
}
|
||||||
if (DetectionCodeEnum.I2_50.getCode().equals(key) || DetectionCodeEnum.SI_1_49.getCode().equals(key)) {
|
if (DetectionCodeEnum.I2_50.getCode().equals(key) || DetectionCodeEnum.SI_1_49.getCode().equals(key)) {
|
||||||
fillHarm(dataModelMap, adHarmonicResult, index, key, 1, 1);
|
fillHarm(dataModelMap, adHarmonicResult, index, key, 1, 1);
|
||||||
|
|||||||
@@ -75,6 +75,8 @@ public class ResultParam {
|
|||||||
|
|
||||||
// 模式id
|
// 模式id
|
||||||
private String patternId;
|
private String patternId;
|
||||||
|
|
||||||
|
private String code;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -104,5 +106,8 @@ public class ResultParam {
|
|||||||
|
|
||||||
@ApiModelProperty(value = "通道号", required = true)
|
@ApiModelProperty(value = "通道号", required = true)
|
||||||
private String chnNum;
|
private String chnNum;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "数据处理原则", required = true)
|
||||||
|
private String dataRuleId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,11 +146,11 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
formContentVO.setErrorSysId(plan.getErrorSysId());
|
formContentVO.setErrorSysId(plan.getErrorSysId());
|
||||||
String scriptId = null;
|
String scriptId = null;
|
||||||
if (ObjectUtil.isNotNull(plan)) {
|
if (ObjectUtil.isNotNull(plan)) {
|
||||||
|
formContentVO.setDataRule(plan.getDataRule());
|
||||||
scriptId = plan.getScriptId();
|
scriptId = plan.getScriptId();
|
||||||
adPlanService.visualize(Collections.singletonList(plan));
|
adPlanService.visualize(Collections.singletonList(plan));
|
||||||
}
|
|
||||||
formContentVO.setScriptName(plan.getScriptId());
|
formContentVO.setScriptName(plan.getScriptId());
|
||||||
formContentVO.setDataRule(plan.getDataRule());
|
}
|
||||||
formContentVO.setDeviceName(pqDevService.getById(queryParam.getDeviceId()).getName());
|
formContentVO.setDeviceName(pqDevService.getById(queryParam.getDeviceId()).getName());
|
||||||
|
|
||||||
List<Map<String, String>> chnList = new ArrayList<>();
|
List<Map<String, String>> chnList = new ArrayList<>();
|
||||||
@@ -983,10 +983,10 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
DictData dictData = dictDataService.getDictDataById(param.getPatternId());
|
DictData dictData = dictDataService.getDictDataById(param.getPatternId());
|
||||||
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
|
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
|
||||||
this.createTempResultTable(param.getCode() + "_temp", true);
|
this.createTempResultTable(param.getCode() + "_temp", true);
|
||||||
this.contrastCalculateResult(param.getPlanId(), param.getCode() + "_temp", param.getErrorSysId(), param.getDeviceId(), param.getChnNum());
|
this.contrastCalculateResult(param.getPlanId(), param.getCode() + "_temp", param.getErrorSysId(), param.getDeviceId(), false, param.getDataRuleId());
|
||||||
} else {
|
} else {
|
||||||
this.createTempResultTable(param.getCode() + "_temp", false);
|
this.createTempResultTable(param.getCode() + "_temp", false);
|
||||||
this.simAndDigCalculateResult(param.getPlanId(), param.getScriptId(), param.getCode() + "_temp", param.getErrorSysId(), param.getDeviceId());
|
this.simAndDigCalculateResult(param.getPlanId(), param.getScriptId(), param.getCode() + "_temp", param.getErrorSysId(), param.getDeviceId(), param.getDataRuleId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1000,9 +1000,9 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
public void reCalculate(ResultParam.ChangeErrorSystemParam param) {
|
public void reCalculate(ResultParam.ChangeErrorSystemParam param) {
|
||||||
DictData dictData = dictDataService.getDictDataById(param.getPatternId());
|
DictData dictData = dictDataService.getDictDataById(param.getPatternId());
|
||||||
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
|
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
|
||||||
this.contrastCalculateResult(param.getPlanId(), param.getCode(), param.getErrorSysId(), param.getDeviceId(), param.getChnNum());
|
this.contrastCalculateResult(param.getPlanId(), param.getCode(), param.getErrorSysId(), param.getDeviceId(), true, param.getDataRuleId());
|
||||||
} else {
|
} else {
|
||||||
this.simAndDigCalculateResult(param.getPlanId(), param.getScriptId(), param.getCode(), param.getErrorSysId(), param.getDeviceId());
|
this.simAndDigCalculateResult(param.getPlanId(), param.getScriptId(), param.getCode(), param.getErrorSysId(), param.getDeviceId(), param.getDataRuleId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1533,8 +1533,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
|
|
||||||
AdPlan plan = adPlanService.getById(queryParam.getPlanId());
|
AdPlan plan = adPlanService.getById(queryParam.getPlanId());
|
||||||
PqDev dev = pqDevService.getById(queryParam.getDeviceId());
|
PqDev dev = pqDevService.getById(queryParam.getDeviceId());
|
||||||
DictData dictData = dictDataService.getById(plan.getDataRule());
|
formContentVO.setDataRule(plan.getDataRule());
|
||||||
formContentVO.setDataRule(dictData.getName());
|
|
||||||
formContentVO.setDeviceName(dev.getName());
|
formContentVO.setDeviceName(dev.getName());
|
||||||
formContentVO.setErrorSysId(plan.getErrorSysId());
|
formContentVO.setErrorSysId(plan.getErrorSysId());
|
||||||
|
|
||||||
@@ -1581,8 +1580,6 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
public ContrastResultVO getContrastResult(ResultParam.QueryParam queryParam) {
|
public ContrastResultVO getContrastResult(ResultParam.QueryParam queryParam) {
|
||||||
ContrastResultVO contrastResultVO = new ContrastResultVO();
|
ContrastResultVO contrastResultVO = new ContrastResultVO();
|
||||||
|
|
||||||
AdPlan plan = adPlanService.getById(queryParam.getPlanId());
|
|
||||||
|
|
||||||
List<DictTree> dictTreeList = dictTreeService.getDictTreeById(Collections.singletonList(queryParam.getScriptType()));
|
List<DictTree> dictTreeList = dictTreeService.getDictTreeById(Collections.singletonList(queryParam.getScriptType()));
|
||||||
|
|
||||||
List<String> fatherIdList = dictTreeList.stream().map(DictTree::getId).collect(Collectors.toList());
|
List<String> fatherIdList = dictTreeList.stream().map(DictTree::getId).collect(Collectors.toList());
|
||||||
@@ -1604,8 +1601,8 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
contrastResultVO.setResultMap(this.getResultMap(dictTree, adTypeList, queryParam.getDeviceId() + CnSocketUtil.SPLIT_TAG + queryParam.getChnNum(), unit, queryParam.getNum(), queryParam.getWaveNum(), queryParam.getIsWave(), String.valueOf(plan.getCode())));
|
contrastResultVO.setResultMap(this.getResultMap(dictTree, adTypeList, queryParam.getDeviceId() + CnSocketUtil.SPLIT_TAG + queryParam.getChnNum(), unit, queryParam.getNum(), queryParam.getWaveNum(), queryParam.getIsWave(), queryParam.getCode()));
|
||||||
contrastResultVO.setRawDataMap(this.getRawDataMap(dictTree, adTypeList, queryParam.getDeviceId() + CnSocketUtil.SPLIT_TAG + queryParam.getChnNum(), unit, queryParam.getNum(), queryParam.getWaveNum(), queryParam.getIsWave(), String.valueOf(plan.getCode()), contrastResultVO.getResultMap().keySet().stream().collect(Collectors.toList())));
|
contrastResultVO.setRawDataMap(this.getRawDataMap(dictTree, adTypeList, queryParam.getDeviceId() + CnSocketUtil.SPLIT_TAG + queryParam.getChnNum(), unit, queryParam.getNum(), queryParam.getWaveNum(), queryParam.getIsWave(), queryParam.getCode(), contrastResultVO.getResultMap().keySet().stream().collect(Collectors.toList())));
|
||||||
return contrastResultVO;
|
return contrastResultVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3067,7 +3064,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
* @param errorSysId
|
* @param errorSysId
|
||||||
* @param devId
|
* @param devId
|
||||||
*/
|
*/
|
||||||
private void simAndDigCalculateResult(String planId, String scriptId, String code, String errorSysId, String devId) {
|
private void simAndDigCalculateResult(String planId, String scriptId, String code, String errorSysId, String devId, String dataRuleId) {
|
||||||
String oldCode = code.replace("_temp", "");
|
String oldCode = code.replace("_temp", "");
|
||||||
PreDetectionParam param = new PreDetectionParam();
|
PreDetectionParam param = new PreDetectionParam();
|
||||||
param.setCode(code);
|
param.setCode(code);
|
||||||
@@ -3085,8 +3082,8 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
// } else {
|
// } else {
|
||||||
// dataRule = DictDataEnum.SECTION_VALUE;
|
// dataRule = DictDataEnum.SECTION_VALUE;
|
||||||
// }
|
// }
|
||||||
AdPlan plan = adPlanService.getById(planId);
|
// AdPlan plan = adPlanService.getById(planId);
|
||||||
DictData dictData = dictDataService.getDictDataById(plan.getDataRule());
|
DictData dictData = dictDataService.getDictDataById(dataRuleId);
|
||||||
if (ObjectUtil.isNotNull(dictData)) {
|
if (ObjectUtil.isNotNull(dictData)) {
|
||||||
dataRule = DictDataEnum.getDictDataEnumByCode(dictData.getCode());
|
dataRule = DictDataEnum.getDictDataEnumByCode(dictData.getCode());
|
||||||
} else {
|
} else {
|
||||||
@@ -3144,9 +3141,9 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
* @param code
|
* @param code
|
||||||
* @param errorSysId
|
* @param errorSysId
|
||||||
* @param deviceId
|
* @param deviceId
|
||||||
* @param chnNum
|
* @param updateResult
|
||||||
*/
|
*/
|
||||||
private void contrastCalculateResult(String planId, String code, String errorSysId, String deviceId, String chnNum) {
|
private void contrastCalculateResult(String planId, String code, String errorSysId, String deviceId, boolean updateResult, String dataRuleId) {
|
||||||
String oldCode = code.replace("_temp", "");
|
String oldCode = code.replace("_temp", "");
|
||||||
|
|
||||||
Map<String, String> devIdMapComm = new HashMap<>();
|
Map<String, String> devIdMapComm = new HashMap<>();
|
||||||
@@ -3189,13 +3186,14 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DictDataEnum dataRule;
|
DictDataEnum dataRule;
|
||||||
DictData dictData = dictDataService.getDictDataById(plan.getDataRule());
|
DictData dictData = dictDataService.getDictDataById(dataRuleId);
|
||||||
if (ObjectUtil.isNotNull(dictData)) {
|
if (ObjectUtil.isNotNull(dictData)) {
|
||||||
dataRule = DictDataEnum.getDictDataEnumByCode(dictData.getCode());
|
dataRule = DictDataEnum.getDictDataEnumByCode(dictData.getCode());
|
||||||
} else {
|
} else {
|
||||||
dataRule = DictDataEnum.SECTION_VALUE;
|
dataRule = DictDataEnum.SECTION_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (updateResult) {
|
||||||
pqMonitorService.lambdaUpdate().set(PqMonitor::getRecordedResult, null)
|
pqMonitorService.lambdaUpdate().set(PqMonitor::getRecordedResult, null)
|
||||||
.set(PqMonitor::getRealtimeNum, null)
|
.set(PqMonitor::getRealtimeNum, null)
|
||||||
.set(PqMonitor::getRecordedResult, null)
|
.set(PqMonitor::getRecordedResult, null)
|
||||||
@@ -3205,11 +3203,13 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
.set(PqMonitor::getResultType, null)
|
.set(PqMonitor::getResultType, null)
|
||||||
.set(PqMonitor::getQualifiedNum, 0)
|
.set(PqMonitor::getQualifiedNum, 0)
|
||||||
.eq(PqMonitor::getDevId, deviceId)
|
.eq(PqMonitor::getDevId, deviceId)
|
||||||
.eq(PqMonitor::getNum, Integer.parseInt(chnNum))
|
//.eq(PqMonitor::getNum, Integer.parseInt(chnNum))
|
||||||
.eq(PqMonitor::getCheckFlag, 1)
|
.eq(PqMonitor::getCheckFlag, 1)
|
||||||
.update();
|
.update();
|
||||||
String monitorId = deviceId + CnSocketUtil.SPLIT_TAG + chnNum;
|
}
|
||||||
List<AdPair> adPairList = adPairService.listByDevIds(Arrays.asList(monitorId));
|
|
||||||
|
//String monitorId = deviceId + CnSocketUtil.SPLIT_TAG + chnNum;
|
||||||
|
List<AdPair> adPairList = adPairService.listByDevIds(Arrays.asList(deviceId));
|
||||||
Map<Integer, List<AdPair>> numAdPairsMap = adPairList.stream().collect(Collectors.groupingBy(AdPair::getNum, Collectors.toList()));
|
Map<Integer, List<AdPair>> numAdPairsMap = adPairList.stream().collect(Collectors.groupingBy(AdPair::getNum, Collectors.toList()));
|
||||||
|
|
||||||
numAdPairsMap.forEach((num, pairList) -> {
|
numAdPairsMap.forEach((num, pairList) -> {
|
||||||
@@ -3228,12 +3228,11 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
numMap.put(devMonitorId, num);
|
numMap.put(devMonitorId, num);
|
||||||
numMap.put(adPair.getStdDevMonitorId(), num);
|
numMap.put(adPair.getStdDevMonitorId(), num);
|
||||||
devIdMapComm.put(standardDev.getIp(), standardDev.getId());
|
devIdMapComm.put(standardDev.getIp(), standardDev.getId());
|
||||||
});
|
|
||||||
|
|
||||||
List<ContrastNonHarmonicResult> devNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, null, false, null, 0, monitorId, null);
|
List<ContrastNonHarmonicResult> devNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, null, false, null, 0, devMonitorId, null);
|
||||||
List<ContrastNonHarmonicResult> stdDevNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, null, false, null, 1, monitorId, null);
|
List<ContrastNonHarmonicResult> stdDevNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, null, false, null, 1, devMonitorId, null);
|
||||||
List<ContrastHarmonicResult> devHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, null, false, null, 0, monitorId, null);
|
List<ContrastHarmonicResult> devHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, null, false, null, 0, devMonitorId, null);
|
||||||
List<ContrastHarmonicResult> stdDevHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, null, false, null, 1, monitorId, null);
|
List<ContrastHarmonicResult> stdDevHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, null, false, null, 1, devMonitorId, null);
|
||||||
|
|
||||||
List<DevData> devData = contrastToList(devNonHarmonicRawDataList, devHarmonicRawDataList, testItemMap, 0);
|
List<DevData> devData = contrastToList(devNonHarmonicRawDataList, devHarmonicRawDataList, testItemMap, 0);
|
||||||
List<DevData> standardDevData = contrastToList(stdDevNonHarmonicRawDataList, stdDevHarmonicRawDataList, testItemMap, 1);
|
List<DevData> standardDevData = contrastToList(stdDevNonHarmonicRawDataList, stdDevHarmonicRawDataList, testItemMap, 1);
|
||||||
@@ -3241,29 +3240,28 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
if (CollUtil.isNotEmpty(devData) && CollUtil.isNotEmpty(standardDevData)) {
|
if (CollUtil.isNotEmpty(devData) && CollUtil.isNotEmpty(standardDevData)) {
|
||||||
detectionServiceImpl.processing(devData, standardDevData, parsIp, devIdMapComm, testItemMap.keySet().stream().collect(Collectors.toList()), errorSysId, dataRule, numMap, code, null, finalNonWaveDataSourceEnum);
|
detectionServiceImpl.processing(devData, standardDevData, parsIp, devIdMapComm, testItemMap.keySet().stream().collect(Collectors.toList()), errorSysId, dataRule, numMap, code, null, finalNonWaveDataSourceEnum);
|
||||||
|
|
||||||
parsId.forEach((devMonitorId, stdDevMonitorId) -> {
|
if (updateResult) {
|
||||||
String[] split = devMonitorId.split(CnSocketUtil.SPLIT_TAG);
|
|
||||||
pqMonitorService.updateMonitorResult(devMonitorId, null, finalNonWaveDataSourceEnum, num, null, oldCode);
|
pqMonitorService.updateMonitorResult(devMonitorId, null, finalNonWaveDataSourceEnum, num, null, oldCode);
|
||||||
pqDevService.updateResult(split[0], null);
|
pqDevService.updateResult(split1[0], null);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AdPlanTestConfig adPlanTestConfig = adPlanTestConfigService.getByPlanId(planId);
|
AdPlanTestConfig adPlanTestConfig = adPlanTestConfigService.getByPlanId(planId);
|
||||||
for (int i = 1; i <= adPlanTestConfig.getWaveRecord(); i++) {
|
for (int i = 1; i <= adPlanTestConfig.getWaveRecord(); i++) {
|
||||||
devNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, i, true, null, 0, monitorId, null);
|
devNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, i, true, null, 0, devMonitorId, null);
|
||||||
stdDevNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, i, true, null, 1, monitorId, null);
|
stdDevNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, i, true, null, 1, devMonitorId, null);
|
||||||
devHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, i, true, null, 0, monitorId, null);
|
devHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, i, true, null, 0, devMonitorId, null);
|
||||||
stdDevHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, i, true, null, 1, monitorId, null);
|
stdDevHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, i, true, null, 1, devMonitorId, null);
|
||||||
|
|
||||||
devData = contrastToList(devNonHarmonicRawDataList, devHarmonicRawDataList, testItemMap, 0);
|
devData = contrastToList(devNonHarmonicRawDataList, devHarmonicRawDataList, testItemMap, 0);
|
||||||
standardDevData = contrastToList(stdDevNonHarmonicRawDataList, stdDevHarmonicRawDataList, testItemMap, 1);
|
standardDevData = contrastToList(stdDevNonHarmonicRawDataList, stdDevHarmonicRawDataList, testItemMap, 1);
|
||||||
detectionServiceImpl.processing(devData, standardDevData, parsIp, devIdMapComm, testItemMap.keySet().stream().collect(Collectors.toList()), errorSysId, dataRule, numMap, oldCode, i, DataSourceEnum.WAVE_DATA);
|
detectionServiceImpl.processing(devData, standardDevData, parsIp, devIdMapComm, testItemMap.keySet().stream().collect(Collectors.toList()), errorSysId, dataRule, numMap, oldCode, i, DataSourceEnum.WAVE_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
parsId.forEach((devMonitorId, stdDevMonitorId) -> {
|
if (updateResult) {
|
||||||
String[] split = devMonitorId.split(CnSocketUtil.SPLIT_TAG);
|
|
||||||
pqMonitorService.updateMonitorResult(devMonitorId, null, WAVE_DATA, num, adPlanTestConfig.getWaveRecord(), oldCode);
|
pqMonitorService.updateMonitorResult(devMonitorId, null, WAVE_DATA, num, adPlanTestConfig.getWaveRecord(), oldCode);
|
||||||
pqDevService.updateResult(split[0], null);
|
pqDevService.updateResult(split1[0], null);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ log:
|
|||||||
report:
|
report:
|
||||||
template: D:\template
|
template: D:\template
|
||||||
reportDir: D:\report
|
reportDir: D:\report
|
||||||
|
dateFormat: yyyy年MM月dd日
|
||||||
data:
|
data:
|
||||||
homeDir: D:\data
|
homeDir: D:\data
|
||||||
qr:
|
qr:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<!-- 直接使用固定配置,避免Spring配置解析时机问题 -->
|
<!-- 直接使用固定配置,避免Spring配置解析时机问题 -->
|
||||||
<property name="log.projectName" value="entrance"/>
|
<property name="log.projectName" value="entrance"/>
|
||||||
<property name="logCommonLevel" value="info"/>
|
<property name="logCommonLevel" value="info"/>
|
||||||
<property name="logHomeDir" value="D:\logs"/>
|
<property name="logHomeDir" value="${logHomeDir:-D:\logs}"/>
|
||||||
|
|
||||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
|
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
|
||||||
<conversionRule conversionWord="wex"
|
<conversionRule conversionWord="wex"
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
entrance/src/main/resources/model/report_table - PQ-COM.docx
Normal file
BIN
entrance/src/main/resources/model/report_table - PQ-COM.docx
Normal file
Binary file not shown.
1
license.key
Normal file
1
license.key
Normal file
@@ -0,0 +1 @@
|
|||||||
|
AoNUHvLQag9nPPxWDsf5EwwBqifh5wnoFjrU01w+kIA7TPdRl0AQDBSA3IU7AY28Liubt6Rl8CsDtxEDrz8L5m0FqQrmZ1TmIJtZWbBR16NxXRgf8izM5JurYEY6ZbjU021yCu0fitxB0DJZ8LB8zfUDsV1MFGHl+yPjh4ZQrYDffID4rk/mRe/EE6F7bS19upStSOnQxVQVJSXwCVVHgsuFXqiuagM21OmxpYNjqaPnvAKoHRXTTxXn9BrSgZBocxuHB/IE+a0a+Q2eQo4RZa2IQpneEA/QIKEqezqsABxmM33duQ4eKt17hAttISV1J0R1cKpwZ4tYuSoHCuMONA==
|
||||||
Reference in New Issue
Block a user