微调
This commit is contained in:
@@ -983,6 +983,7 @@ public class SocketDevResponseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// key为 检测大项对应的code,value为当前大项的检测结果
|
||||||
Map<String, List<DevLineTestResult>> targetTestMap = new HashMap<>();
|
Map<String, List<DevLineTestResult>> targetTestMap = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1028,6 +1029,7 @@ public class SocketDevResponseService {
|
|||||||
System.out.println(sourceIssue.getType() + sourceIssue.getIndex() + "当前测试大项已经全部结束》》》》》》》》");
|
System.out.println(sourceIssue.getType() + sourceIssue.getIndex() + "当前测试大项已经全部结束》》》》》》》》");
|
||||||
//当residueCount为0则认为大项中的小项已经全部跑完,开始组装信息推送给前端
|
//当residueCount为0则认为大项中的小项已经全部跑完,开始组装信息推送给前端
|
||||||
List<DevLineTestResult> resultList = new ArrayList<>();
|
List<DevLineTestResult> resultList = new ArrayList<>();
|
||||||
|
// 获取当前检测大项的所有设备的检测结果
|
||||||
List<DevLineTestResult> allDevTestList = targetTestMap.get(sourceIssue.getType());
|
List<DevLineTestResult> allDevTestList = targetTestMap.get(sourceIssue.getType());
|
||||||
Map<String, List<DevLineTestResult>> map = allDevTestList.stream().collect(Collectors.groupingBy(DevLineTestResult::getDeviceId));
|
Map<String, List<DevLineTestResult>> map = allDevTestList.stream().collect(Collectors.groupingBy(DevLineTestResult::getDeviceId));
|
||||||
map.forEach((dev, list) -> {
|
map.forEach((dev, list) -> {
|
||||||
@@ -1059,6 +1061,7 @@ public class SocketDevResponseService {
|
|||||||
List<SourceIssue> sourceIssueList = SocketManager.getSourceList();
|
List<SourceIssue> sourceIssueList = SocketManager.getSourceList();
|
||||||
if (CollUtil.isNotEmpty(sourceIssueList)) {
|
if (CollUtil.isNotEmpty(sourceIssueList)) {
|
||||||
SourceIssue sourceIssues = SocketManager.getSourceList().get(0);
|
SourceIssue sourceIssues = SocketManager.getSourceList().get(0);
|
||||||
|
// 如果上一个大项检测完成,则检测下一个大项,并向前端推送消息
|
||||||
if (residueCount == 0) {
|
if (residueCount == 0) {
|
||||||
CnSocketUtil.sendToWebSocket(param.getUserPageId(), sourceIssues.getType() + stepBegin, null, new ArrayList<>(), null);
|
CnSocketUtil.sendToWebSocket(param.getUserPageId(), sourceIssues.getType() + stepBegin, null, new ArrayList<>(), null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -351,7 +351,7 @@ public class SocketSourceResponseService {
|
|||||||
|
|
||||||
String s = param.getUserPageId() + DEV;
|
String s = param.getUserPageId() + DEV;
|
||||||
SourceIssue sourceIssue = SocketManager.getSourceList().get(0);
|
SourceIssue sourceIssue = SocketManager.getSourceList().get(0);
|
||||||
List<String> comm = sourceIssue.getDevValueTypeList();
|
List<String> comm = sourceIssue.getDevValueTypeList(); //形如:类型&小项code这种形式。例如:real$VRMS、real$IRMS
|
||||||
System.out.println("向装置下发的参数>>>>>>>>" + comm);
|
System.out.println("向装置下发的参数>>>>>>>>" + comm);
|
||||||
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + stepTag + sourceIssue.getType());
|
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + stepTag + sourceIssue.getType());
|
||||||
int ignoreCount;
|
int ignoreCount;
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ public enum ReportResponseEnum {
|
|||||||
NO_CHECK_DATA("A012010", "没有检测数据,无法生成报告!"),
|
NO_CHECK_DATA("A012010", "没有检测数据,无法生成报告!"),
|
||||||
FILE_RENAME_FAILED("A012011", "文件重命名失败"),
|
FILE_RENAME_FAILED("A012011", "文件重命名失败"),
|
||||||
REPORT_NAME_PATTERN_ERROR("A012012","报告名称格式错误,可包含中文、字母、数字、中划线,长度不能超过50个字符"),
|
REPORT_NAME_PATTERN_ERROR("A012012","报告名称格式错误,可包含中文、字母、数字、中划线,长度不能超过50个字符"),
|
||||||
REPORT_VERSION_PATTERN_ERROR("A012013","报告版本号格式错误,可包含中文、字母、数字、中划线,点号,长度不能超过50个字符");
|
REPORT_VERSION_PATTERN_ERROR("A012013","报告版本号格式错误,可包含中文、字母、数字、中划线,点号,长度不能超过50个字符"),
|
||||||
|
FILE_SIZE_ERROR("A012014","文件大小不能超过5MB" );
|
||||||
|
|
||||||
private String code;
|
private String code;
|
||||||
private String message;
|
private String message;
|
||||||
|
|||||||
@@ -126,6 +126,8 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
|
|
||||||
private final ISysUserService sysUserService;
|
private final ISysUserService sysUserService;
|
||||||
|
|
||||||
|
private final long FILE_SIZE_LIMIT = 5 * 1024 * 1024;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<PqReportVO> list(ReportParam.QueryParam queryParam) {
|
public Page<PqReportVO> list(ReportParam.QueryParam queryParam) {
|
||||||
QueryWrapper<PqReport> wrapper = new QueryWrapper<>();
|
QueryWrapper<PqReport> wrapper = new QueryWrapper<>();
|
||||||
@@ -263,6 +265,9 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
if (baseOriginalFilename.equals(detailOriginalFilename)) {
|
if (baseOriginalFilename.equals(detailOriginalFilename)) {
|
||||||
throw new BusinessException(ReportResponseEnum.FILE_NAME_SAME_ERROR);
|
throw new BusinessException(ReportResponseEnum.FILE_NAME_SAME_ERROR);
|
||||||
}
|
}
|
||||||
|
if(baseFile.getSize() > FILE_SIZE_LIMIT || detailFile.getSize() > FILE_SIZE_LIMIT){
|
||||||
|
throw new BusinessException(ReportResponseEnum.FILE_SIZE_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
pqReport.setBasePath(newDir + baseOriginalFilename);
|
pqReport.setBasePath(newDir + baseOriginalFilename);
|
||||||
pqReport.setDetailPath(newDir + detailOriginalFilename);
|
pqReport.setDetailPath(newDir + detailOriginalFilename);
|
||||||
@@ -284,6 +289,9 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
if (!baseFileOriginalFilename.endsWith(".docx")) {
|
if (!baseFileOriginalFilename.endsWith(".docx")) {
|
||||||
throw new BusinessException(ReportResponseEnum.FILE_SUFFIX_ERROR);
|
throw new BusinessException(ReportResponseEnum.FILE_SUFFIX_ERROR);
|
||||||
}
|
}
|
||||||
|
if(baseFile.getSize() > FILE_SIZE_LIMIT){
|
||||||
|
throw new BusinessException(ReportResponseEnum.FILE_SIZE_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String detailFileOriginalFilename = "";
|
String detailFileOriginalFilename = "";
|
||||||
@@ -292,6 +300,9 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
if (!detailFileOriginalFilename.endsWith(".docx")) {
|
if (!detailFileOriginalFilename.endsWith(".docx")) {
|
||||||
throw new BusinessException(ReportResponseEnum.FILE_SUFFIX_ERROR);
|
throw new BusinessException(ReportResponseEnum.FILE_SUFFIX_ERROR);
|
||||||
}
|
}
|
||||||
|
if(detailFile.getSize() > FILE_SIZE_LIMIT){
|
||||||
|
throw new BusinessException(ReportResponseEnum.FILE_SIZE_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!"".equals(baseFileOriginalFilename) && !"".equals(detailFileOriginalFilename)) {
|
if (!"".equals(baseFileOriginalFilename) && !"".equals(detailFileOriginalFilename)) {
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
package com.njcn.gather.system.config;
|
|
||||||
|
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
|
||||||
import com.njcn.common.bean.CustomCacheUtil;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author caozehui
|
|
||||||
* @data 2025-03-24
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
public class CustomCacheConfig {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将自定缓存工具类注入到spring容器中
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Bean
|
|
||||||
public CustomCacheUtil customCacheUtil() {
|
|
||||||
CustomCacheUtil customCacheUtil = SpringUtil.getBean(CustomCacheUtil.CACHE_NAME);
|
|
||||||
return customCacheUtil;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.njcn.gather.system.config;
|
||||||
|
|
||||||
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
|
import com.njcn.common.bean.CustomCacheUtil;
|
||||||
|
import org.springframework.boot.web.servlet.MultipartConfigFactory;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.util.unit.DataSize;
|
||||||
|
|
||||||
|
import javax.servlet.MultipartConfigElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2025-03-24
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class WebConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将自定缓存工具类注入到spring容器中
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public CustomCacheUtil customCacheUtil() {
|
||||||
|
CustomCacheUtil customCacheUtil = SpringUtil.getBean(CustomCacheUtil.CACHE_NAME);
|
||||||
|
return customCacheUtil;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置上传文件大小限制
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public MultipartConfigElement multipartConfigElement() {
|
||||||
|
MultipartConfigFactory factory = new MultipartConfigFactory();
|
||||||
|
// 单个文件最大6MB
|
||||||
|
factory.setMaxFileSize(DataSize.ofMegabytes(6));
|
||||||
|
// 整个请求最大12MB
|
||||||
|
factory.setMaxRequestSize(DataSize.ofMegabytes(12));
|
||||||
|
return factory.createMultipartConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user