Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 79003cd0f4 | |||
|
|
c3443fcc91 | ||
|
|
5105e77823 | ||
|
|
eb068b76a4 |
@@ -120,7 +120,7 @@ public class SocketContrastResponseService {
|
||||
// private SysRegRes contrastRegRes = null;
|
||||
|
||||
|
||||
@Value("${log.homeDir}")
|
||||
@Value("${report.reportDir}")
|
||||
private String alignDataFilePath;
|
||||
|
||||
public static final Map<String, List<String>> testItemCodeMap = new HashMap() {{
|
||||
@@ -182,8 +182,8 @@ public class SocketContrastResponseService {
|
||||
FormalTestManager.pstDataType = null;
|
||||
FormalTestManager.isPstData = false;
|
||||
FormalTestManager.isWaveCheck = false;
|
||||
// FormalTestManager.isXu = param.getPhaseCheck() == 1 ? true : false;
|
||||
FormalTestManager.isXu = true;
|
||||
FormalTestManager.isXu = param.getPhaseCheck() == 1 ? true : false;
|
||||
// FormalTestManager.isXu = true;
|
||||
FormalTestManager.nonWaveDataSourceEnum = null;
|
||||
|
||||
String[] datasourceIds = FormalTestManager.currentTestPlan.getDatasourceId().split(",");
|
||||
@@ -1230,39 +1230,6 @@ public class SocketContrastResponseService {
|
||||
}
|
||||
}
|
||||
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 devMonitorId = monitorId1;
|
||||
@@ -2149,7 +2116,7 @@ public class SocketContrastResponseService {
|
||||
});
|
||||
});
|
||||
|
||||
ExcelUtil.saveExcel(alignDataFilePath, "实时数据.xlsx", sheetsList);
|
||||
ExcelUtil.saveExcel(alignDataFilePath, "对齐数据.xlsx", sheetsList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -76,7 +76,7 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
||||
private final IPqScriptCheckDataService iPqScriptCheckDataService;
|
||||
private final SocketManager socketManager;
|
||||
|
||||
@Value("${log.homeDir}")
|
||||
@Value("${report.reportDir}")
|
||||
private String alignDataFilePath;
|
||||
|
||||
|
||||
@@ -337,7 +337,7 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
||||
|
||||
@Override
|
||||
public void exportAlignData() {
|
||||
String fileName = "实时数据.xlsx";
|
||||
String fileName = "对齐数据.xlsx";
|
||||
HttpServletResponse response = HttpServletUtil.getResponse();
|
||||
response.reset();
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
|
||||
|
||||
@@ -554,6 +554,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
child.put("pid", adPlan.getFatherPlanId());
|
||||
child.put("name", adPlan.getName());
|
||||
child.put("timeCheck", adPlan.getTimeCheck());
|
||||
child.put("dataRule", adPlan.getDataRule());
|
||||
|
||||
List<PqStandardDev> pqStandardDevs = adPlanStandardDevMapper.listByPlanId(Collections.singletonList(adPlan.getId()));
|
||||
List<String> devTypeIdList = pqStandardDevs.stream().map(PqStandardDev::getDevType).collect(Collectors.toList());
|
||||
|
||||
@@ -310,7 +310,8 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
private void uploadFile(ReportParam reportParam, PqReport pqReport, boolean isAdd) {
|
||||
MultipartFile baseFile = reportParam.getBaseFile();
|
||||
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;
|
||||
if (isAdd) {
|
||||
@@ -329,13 +330,13 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
throw new BusinessException(ReportResponseEnum.FILE_SIZE_ERROR);
|
||||
}
|
||||
|
||||
pqReport.setBasePath(newDir + baseOriginalFilename);
|
||||
pqReport.setDetailPath(newDir + detailOriginalFilename);
|
||||
pqReport.setBasePath(relativePath + baseOriginalFilename);
|
||||
pqReport.setDetailPath(relativePath + detailOriginalFilename);
|
||||
|
||||
this.createDirectory(newDir);
|
||||
this.clearDirectory(newDir);
|
||||
this.uploadFile(baseFile, pqReport.getBasePath());
|
||||
this.uploadFile(detailFile, pqReport.getDetailPath());
|
||||
this.uploadFile(baseFile, newDir + baseOriginalFilename);
|
||||
this.uploadFile(detailFile, newDir + detailOriginalFilename);
|
||||
} else {
|
||||
throw new BusinessException(ReportResponseEnum.FILE_NOT_NULL);
|
||||
}
|
||||
@@ -383,34 +384,34 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
|
||||
//若修改了文件名称、版本号,则需要重命名文件
|
||||
this.createDirectory(newDir);
|
||||
if (!oldDir.equals(newDir)) {
|
||||
if (!oldDir.equals(relativePath)) {
|
||||
// 文件夹重命名
|
||||
String oldBasePathStr = oldPqReport.getBasePath();
|
||||
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);
|
||||
pqReport.setBasePath(newDir + baseName);
|
||||
pqReport.setBasePath(relativePath + baseName);
|
||||
|
||||
String oldDetailPathStr = oldPqReport.getDetailPath();
|
||||
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);
|
||||
pqReport.setDetailPath(newDir + detailName);
|
||||
pqReport.setDetailPath(relativePath + detailName);
|
||||
|
||||
try {
|
||||
// windows下文件夹名称不区分大小写
|
||||
if (!oldDir.equalsIgnoreCase(newDir)) {
|
||||
if (!oldDir.equalsIgnoreCase(relativePath)) {
|
||||
this.clearDirectory(newDir);
|
||||
Files.move(oldBasePath, newBasePath);
|
||||
Files.move(oldDetailPath, newDetailPath);
|
||||
if (!oldPqReport.getName().equals(reportParam.getName()) && !this.existSameName(pqReport.getId(), oldPqReport.getName())) {
|
||||
this.recursionDeleteDirectory(templatePath + File.separator + oldPqReport.getName());
|
||||
} else {
|
||||
Paths.get(oldDir).toFile().delete();
|
||||
Paths.get(templatePath + oldDir).toFile().delete();
|
||||
}
|
||||
} else {
|
||||
// 文件夹重命名
|
||||
Paths.get(oldDir).toFile().renameTo(Paths.get(newDir).toFile());
|
||||
Paths.get(templatePath + oldDir).toFile().renameTo(Paths.get(newDir).toFile());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new BusinessException(ReportResponseEnum.FILE_RENAME_FAILED);
|
||||
@@ -418,16 +419,16 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
}
|
||||
|
||||
if (!baseFileOriginalFilename.isEmpty()) {
|
||||
pqReport.setBasePath(newDir + baseFileOriginalFilename);
|
||||
Paths.get(oldPqReport.getBasePath()).toFile().delete();
|
||||
pqReport.setBasePath(relativePath + baseFileOriginalFilename);
|
||||
Paths.get(templatePath + File.separator + oldPqReport.getBasePath()).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()) {
|
||||
pqReport.setDetailPath(newDir + detailFileOriginalFilename);
|
||||
Paths.get(oldPqReport.getDetailPath()).toFile().delete();
|
||||
pqReport.setDetailPath(relativePath + detailFileOriginalFilename);
|
||||
Paths.get(templatePath + File.separator + oldPqReport.getDetailPath()).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 +801,8 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
if (Objects.isNull(report)) {
|
||||
throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST);
|
||||
}
|
||||
Path basePath = Paths.get(report.getBasePath());
|
||||
Path detailPath = Paths.get(report.getDetailPath());
|
||||
Path basePath = Paths.get(templatePath + File.separator + report.getBasePath());
|
||||
Path detailPath = Paths.get(templatePath + File.separator + report.getDetailPath());
|
||||
try (InputStream baseInputStream = Files.newInputStream(basePath);
|
||||
InputStream detailInputStream = Files.newInputStream(detailPath)) {
|
||||
WordprocessingMLPackage detailModelDocument = WordprocessingMLPackage.load(detailInputStream);
|
||||
@@ -877,8 +878,8 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
if (Objects.isNull(report)) {
|
||||
throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST);
|
||||
}
|
||||
Path basePath = Paths.get(report.getBasePath());
|
||||
Path detailPath = Paths.get(report.getDetailPath());
|
||||
Path basePath = Paths.get(templatePath + File.separator + report.getBasePath());
|
||||
Path detailPath = Paths.get(templatePath + File.separator + report.getDetailPath());
|
||||
try (InputStream baseInputStream = Files.newInputStream(basePath);
|
||||
InputStream detailInputStream = Files.newInputStream(detailPath)) {
|
||||
WordprocessingMLPackage detailModelDocument = WordprocessingMLPackage.load(detailInputStream);
|
||||
|
||||
@@ -75,6 +75,8 @@ public class ResultParam {
|
||||
|
||||
// 模式id
|
||||
private String patternId;
|
||||
|
||||
private String code;
|
||||
}
|
||||
|
||||
@Data
|
||||
@@ -104,5 +106,8 @@ public class ResultParam {
|
||||
|
||||
@ApiModelProperty(value = "通道号", required = true)
|
||||
private String chnNum;
|
||||
|
||||
@ApiModelProperty(value = "数据处理原则", required = true)
|
||||
private String dataRuleId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -983,10 +983,10 @@ public class ResultServiceImpl implements IResultService {
|
||||
DictData dictData = dictDataService.getDictDataById(param.getPatternId());
|
||||
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
|
||||
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(), param.getChnNum(), param.getDataRuleId());
|
||||
} else {
|
||||
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) {
|
||||
DictData dictData = dictDataService.getDictDataById(param.getPatternId());
|
||||
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(), param.getChnNum(), param.getDataRuleId());
|
||||
} 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());
|
||||
PqDev dev = pqDevService.getById(queryParam.getDeviceId());
|
||||
DictData dictData = dictDataService.getById(plan.getDataRule());
|
||||
formContentVO.setDataRule(dictData.getName());
|
||||
formContentVO.setDataRule(plan.getDataRule());
|
||||
formContentVO.setDeviceName(dev.getName());
|
||||
formContentVO.setErrorSysId(plan.getErrorSysId());
|
||||
|
||||
@@ -1581,8 +1580,6 @@ public class ResultServiceImpl implements IResultService {
|
||||
public ContrastResultVO getContrastResult(ResultParam.QueryParam queryParam) {
|
||||
ContrastResultVO contrastResultVO = new ContrastResultVO();
|
||||
|
||||
AdPlan plan = adPlanService.getById(queryParam.getPlanId());
|
||||
|
||||
List<DictTree> dictTreeList = dictTreeService.getDictTreeById(Collections.singletonList(queryParam.getScriptType()));
|
||||
|
||||
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.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.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(), queryParam.getCode(), contrastResultVO.getResultMap().keySet().stream().collect(Collectors.toList())));
|
||||
return contrastResultVO;
|
||||
}
|
||||
|
||||
@@ -3067,7 +3064,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
* @param errorSysId
|
||||
* @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", "");
|
||||
PreDetectionParam param = new PreDetectionParam();
|
||||
param.setCode(code);
|
||||
@@ -3085,8 +3082,8 @@ public class ResultServiceImpl implements IResultService {
|
||||
// } else {
|
||||
// dataRule = DictDataEnum.SECTION_VALUE;
|
||||
// }
|
||||
AdPlan plan = adPlanService.getById(planId);
|
||||
DictData dictData = dictDataService.getDictDataById(plan.getDataRule());
|
||||
// AdPlan plan = adPlanService.getById(planId);
|
||||
DictData dictData = dictDataService.getDictDataById(dataRuleId);
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
dataRule = DictDataEnum.getDictDataEnumByCode(dictData.getCode());
|
||||
} else {
|
||||
@@ -3146,7 +3143,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
* @param deviceId
|
||||
* @param chnNum
|
||||
*/
|
||||
private void contrastCalculateResult(String planId, String code, String errorSysId, String deviceId, String chnNum) {
|
||||
private void contrastCalculateResult(String planId, String code, String errorSysId, String deviceId, String chnNum, String dataRuleId) {
|
||||
String oldCode = code.replace("_temp", "");
|
||||
|
||||
Map<String, String> devIdMapComm = new HashMap<>();
|
||||
@@ -3189,7 +3186,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
}
|
||||
|
||||
DictDataEnum dataRule;
|
||||
DictData dictData = dictDataService.getDictDataById(plan.getDataRule());
|
||||
DictData dictData = dictDataService.getDictDataById(dataRuleId);
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
dataRule = DictDataEnum.getDictDataEnumByCode(dictData.getCode());
|
||||
} else {
|
||||
|
||||
@@ -9,7 +9,7 @@ spring:
|
||||
# url: jdbc:mysql://192.168.1.24:13306/pqs91002?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
|
||||
# username: root
|
||||
# password: njcnpqs
|
||||
url: jdbc:mysql://192.168.1.24:13306/pqs9100_nx?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
|
||||
url: jdbc:mysql://192.168.2.125:3306/pqs9100?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
|
||||
username: root
|
||||
password: njcnpqs
|
||||
#初始化建立物理连接的个数、最小、最大连接数
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<!-- 直接使用固定配置,避免Spring配置解析时机问题 -->
|
||||
<property name="log.projectName" value="entrance"/>
|
||||
<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="wex"
|
||||
|
||||
Reference in New Issue
Block a user