微调
This commit is contained in:
@@ -195,6 +195,9 @@ public class PqDev extends BaseEntity implements Serializable {
|
|||||||
@TableField("Check_Time")
|
@TableField("Check_Time")
|
||||||
private LocalDateTime checkTime;
|
private LocalDateTime checkTime;
|
||||||
|
|
||||||
|
@TableField("Check_By")
|
||||||
|
private String checkBy;
|
||||||
|
|
||||||
@TableField("Preinvestment_Plan")
|
@TableField("Preinvestment_Plan")
|
||||||
private String preinvestmentPlan;
|
private String preinvestmentPlan;
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import com.njcn.gather.type.service.IDevTypeService;
|
|||||||
import com.njcn.web.factory.PageFactory;
|
import com.njcn.web.factory.PageFactory;
|
||||||
import com.njcn.web.utils.ExcelUtil;
|
import com.njcn.web.utils.ExcelUtil;
|
||||||
import com.njcn.web.utils.PoiUtil;
|
import com.njcn.web.utils.PoiUtil;
|
||||||
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
@@ -515,6 +516,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
|||||||
.set(PqDev::getReCheckNum, i)
|
.set(PqDev::getReCheckNum, i)
|
||||||
.set(PqDev::getCheckState, checkState)
|
.set(PqDev::getCheckState, checkState)
|
||||||
.set(PqDev::getCheckResult, result.get(pqDev.getId()))
|
.set(PqDev::getCheckResult, result.get(pqDev.getId()))
|
||||||
|
.set(PqDev::getCheckBy, RequestUtil.getUserName())
|
||||||
.set(PqDev::getCheckTime, LocalDateTime.now())
|
.set(PqDev::getCheckTime, LocalDateTime.now())
|
||||||
.set(PqDev::getReportState, DevReportStateEnum.NOT_GENERATED.getValue())
|
.set(PqDev::getReportState, DevReportStateEnum.NOT_GENERATED.getValue())
|
||||||
.eq(PqDev::getId, pqDev.getId()));
|
.eq(PqDev::getId, pqDev.getId()));
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.njcn.gather.plan.mapper;
|
|||||||
import com.github.yulichang.base.MPJBaseMapper;
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||||
import com.njcn.gather.report.pojo.po.PqReport;
|
import com.njcn.gather.report.pojo.po.PqReport;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author caozehui
|
* @author caozehui
|
||||||
@@ -17,7 +18,7 @@ public interface AdPlanMapper extends MPJBaseMapper<AdPlan> {
|
|||||||
* @param version
|
* @param version
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
String getReportIdByNameAndVersion(String name, String version);
|
String getReportIdByNameAndVersion(@Param("name") String name, @Param("version") String version);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据id获取报告模板
|
* 根据id获取报告模板
|
||||||
|
|||||||
@@ -66,10 +66,10 @@ public class AdPlanParam {
|
|||||||
private Integer associateReport;
|
private Integer associateReport;
|
||||||
|
|
||||||
@ApiModelProperty(value = "报告模板名称")
|
@ApiModelProperty(value = "报告模板名称")
|
||||||
private String reportName;
|
private String reportTemplateName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "报告模板版本")
|
@ApiModelProperty(value = "报告模板版本")
|
||||||
private String reportVersion;
|
private String reportTemplateVersion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询实体
|
* 分页查询实体
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
adPlan.setCode(this.generateCode());
|
adPlan.setCode(this.generateCode());
|
||||||
|
|
||||||
if (param.getAssociateReport() == 1) {
|
if (param.getAssociateReport() == 1) {
|
||||||
String reportId = this.baseMapper.getReportIdByNameAndVersion(param.getReportName(), param.getReportVersion());
|
String reportId = this.baseMapper.getReportIdByNameAndVersion(param.getReportTemplateName(), param.getReportTemplateVersion());
|
||||||
if (StrUtil.isNotBlank(reportId)) {
|
if (StrUtil.isNotBlank(reportId)) {
|
||||||
adPlan.setReportTemplateId(reportId);
|
adPlan.setReportTemplateId(reportId);
|
||||||
}
|
}
|
||||||
@@ -180,7 +180,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
AdPlan plan2 = new AdPlan();
|
AdPlan plan2 = new AdPlan();
|
||||||
|
|
||||||
if (param.getAssociateReport() == 1) {
|
if (param.getAssociateReport() == 1) {
|
||||||
String reportId = this.baseMapper.getReportIdByNameAndVersion(param.getReportName(), param.getReportVersion());
|
String reportId = this.baseMapper.getReportIdByNameAndVersion(param.getReportTemplateName(), param.getReportTemplateVersion());
|
||||||
if (StrUtil.isNotBlank(reportId)) {
|
if (StrUtil.isNotBlank(reportId)) {
|
||||||
plan2.setReportTemplateId(reportId);
|
plan2.setReportTemplateId(reportId);
|
||||||
}
|
}
|
||||||
@@ -200,7 +200,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
throw new BusinessException(PlanResponseEnum.CANNOT_CHANGE_REPORT_WHEN_CHECKING);
|
throw new BusinessException(PlanResponseEnum.CANNOT_CHANGE_REPORT_WHEN_CHECKING);
|
||||||
}
|
}
|
||||||
if (param.getAssociateReport() == 1) {
|
if (param.getAssociateReport() == 1) {
|
||||||
String reportId = this.baseMapper.getReportIdByNameAndVersion(param.getReportName(), param.getReportVersion());
|
String reportId = this.baseMapper.getReportIdByNameAndVersion(param.getReportTemplateName(), param.getReportTemplateVersion());
|
||||||
if (!reportId.equals(plan1.getReportTemplateId())) {
|
if (!reportId.equals(plan1.getReportTemplateId())) {
|
||||||
throw new BusinessException(PlanResponseEnum.CANNOT_CHANGE_REPORT_WHEN_CHECKING);
|
throw new BusinessException(PlanResponseEnum.CANNOT_CHANGE_REPORT_WHEN_CHECKING);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,16 @@ public class DevReportParam implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String planId;
|
private String planId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计划所对应的表code
|
||||||
|
*/
|
||||||
|
private String planCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 脚本ID
|
||||||
|
*/
|
||||||
|
private String scriptId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 被检设备ID
|
* 被检设备ID
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -14,7 +14,11 @@ public enum ReportResponseEnum {
|
|||||||
REPORT_REPEATED("A012003", "已存在相同版本、相同名称的报告"),
|
REPORT_REPEATED("A012003", "已存在相同版本、相同名称的报告"),
|
||||||
FILE_NOT_NULL("A012004", "上传的文件不能为空"),
|
FILE_NOT_NULL("A012004", "上传的文件不能为空"),
|
||||||
DELETE_BOUND_REPORT_ERROR("A012005", "已被计划绑定模板的报告不能删除"),
|
DELETE_BOUND_REPORT_ERROR("A012005", "已被计划绑定模板的报告不能删除"),
|
||||||
FILE_NAME_SAME_ERROR("A012006", "文件名不能相同");
|
FILE_NAME_SAME_ERROR("A012006", "文件名不能相同"),
|
||||||
|
DEVICE_NOT_EXIST("A012007", "请检查装置是否存在!"),
|
||||||
|
DEVICE_TYPE_NOT_EXIST("A012008", "设备类型缺失,请联系管理员!"),
|
||||||
|
REPORT_TEMPLATE_NOT_EXIST("A012009", "报告模板缺失,请联系管理员!"),
|
||||||
|
NO_CHECK_DATA("A012010", "没有检测数据,无法生成报告!");
|
||||||
|
|
||||||
private String code;
|
private String code;
|
||||||
private String message;
|
private String message;
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.njcn.gather.report.pojo.po;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2025-03-21
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class CellEntity {
|
||||||
|
|
||||||
|
private String cellValue;
|
||||||
|
|
||||||
|
private String width;
|
||||||
|
|
||||||
|
private int rowSpan;
|
||||||
|
|
||||||
|
private int colSpan;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -46,7 +46,7 @@ public class PqReportVO {
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class FileVO{
|
public static class FileVO{
|
||||||
private String fileName;
|
private String name;
|
||||||
|
|
||||||
private String url;
|
private String url;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import com.njcn.gather.detection.pojo.vo.DetectionData;
|
|||||||
import com.njcn.gather.device.pojo.enums.DevReportStateEnum;
|
import com.njcn.gather.device.pojo.enums.DevReportStateEnum;
|
||||||
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
||||||
import com.njcn.gather.device.service.IPqDevService;
|
import com.njcn.gather.device.service.IPqDevService;
|
||||||
|
import com.njcn.gather.err.service.IPqErrSysDtlsService;
|
||||||
import com.njcn.gather.plan.pojo.enums.PlanReportStateEnum;
|
import com.njcn.gather.plan.pojo.enums.PlanReportStateEnum;
|
||||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||||
import com.njcn.gather.plan.service.IAdPlanService;
|
import com.njcn.gather.plan.service.IAdPlanService;
|
||||||
@@ -26,28 +27,37 @@ import com.njcn.gather.report.mapper.PqReportMapper;
|
|||||||
import com.njcn.gather.report.pojo.DevReportParam;
|
import com.njcn.gather.report.pojo.DevReportParam;
|
||||||
import com.njcn.gather.report.pojo.enums.ReportResponseEnum;
|
import com.njcn.gather.report.pojo.enums.ReportResponseEnum;
|
||||||
import com.njcn.gather.report.pojo.param.ReportParam;
|
import com.njcn.gather.report.pojo.param.ReportParam;
|
||||||
|
import com.njcn.gather.report.pojo.po.CellEntity;
|
||||||
import com.njcn.gather.report.pojo.po.PqReport;
|
import com.njcn.gather.report.pojo.po.PqReport;
|
||||||
import com.njcn.gather.report.pojo.vo.PqReportVO;
|
import com.njcn.gather.report.pojo.vo.PqReportVO;
|
||||||
import com.njcn.gather.report.service.IPqReportService;
|
import com.njcn.gather.report.service.IPqReportService;
|
||||||
import com.njcn.gather.report.utils.WordUtil;
|
import com.njcn.gather.report.utils.WordUtil;
|
||||||
|
import com.njcn.gather.result.pojo.param.ResultParam;
|
||||||
|
import com.njcn.gather.result.pojo.vo.ResultVO;
|
||||||
|
import com.njcn.gather.result.service.IResultService;
|
||||||
import com.njcn.gather.script.pojo.po.PqScriptCheckData;
|
import com.njcn.gather.script.pojo.po.PqScriptCheckData;
|
||||||
import com.njcn.gather.script.pojo.po.PqScriptDtls;
|
import com.njcn.gather.script.pojo.po.PqScriptDtls;
|
||||||
import com.njcn.gather.script.service.IPqScriptCheckDataService;
|
import com.njcn.gather.script.service.IPqScriptCheckDataService;
|
||||||
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.param.SingleNonHarmParam;
|
||||||
|
import com.njcn.gather.storage.pojo.po.AdBaseResult;
|
||||||
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
||||||
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
||||||
|
import com.njcn.gather.storage.pojo.vo.RawResultDataVO;
|
||||||
import com.njcn.gather.storage.service.AdHarmonicService;
|
import com.njcn.gather.storage.service.AdHarmonicService;
|
||||||
import com.njcn.gather.storage.service.AdNonHarmonicService;
|
import com.njcn.gather.storage.service.AdNonHarmonicService;
|
||||||
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
||||||
|
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
||||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||||
|
import com.njcn.gather.system.dictionary.service.IDictTreeService;
|
||||||
|
import com.njcn.gather.system.pojo.enums.DicDataEnum;
|
||||||
import com.njcn.gather.type.pojo.po.DevType;
|
import com.njcn.gather.type.pojo.po.DevType;
|
||||||
import com.njcn.gather.type.service.IDevTypeService;
|
import com.njcn.gather.type.service.IDevTypeService;
|
||||||
import com.njcn.web.factory.PageFactory;
|
import com.njcn.web.factory.PageFactory;
|
||||||
import com.njcn.web.utils.RequestUtil;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
import org.apache.poi.xwpf.usermodel.*;
|
||||||
|
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
@@ -65,6 +75,7 @@ import java.nio.file.Path;
|
|||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author makejava
|
* @author makejava
|
||||||
@@ -75,6 +86,7 @@ import java.util.stream.Collectors;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> implements IPqReportService {
|
public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> implements IPqReportService {
|
||||||
|
|
||||||
|
private static final int TWIPS_PER_INCH = 1440;
|
||||||
|
|
||||||
@Value("${report.template:D:\\template}")
|
@Value("${report.template:D:\\template}")
|
||||||
private String templatePath;
|
private String templatePath;
|
||||||
@@ -98,6 +110,12 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
|
|
||||||
private final IDevTypeService devTypeService;
|
private final IDevTypeService devTypeService;
|
||||||
|
|
||||||
|
private final IDictTreeService dictTreeService;
|
||||||
|
|
||||||
|
private final IPqErrSysDtlsService pqErrSysDtlsService;
|
||||||
|
|
||||||
|
private final IResultService resultService;
|
||||||
|
|
||||||
@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<>();
|
||||||
@@ -111,12 +129,12 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
BeanUtils.copyProperties(pqReport, pqReportVO);
|
BeanUtils.copyProperties(pqReport, pqReportVO);
|
||||||
|
|
||||||
PqReportVO.FileVO baseFileVo = new PqReportVO.FileVO();
|
PqReportVO.FileVO baseFileVo = new PqReportVO.FileVO();
|
||||||
baseFileVo.setFileName(pqReport.getBasePath().substring(pqReport.getBasePath().lastIndexOf(File.separator) + 1));
|
baseFileVo.setName(pqReport.getBasePath().substring(pqReport.getBasePath().lastIndexOf(File.separator) + 1));
|
||||||
baseFileVo.setUrl(pqReport.getBasePath());
|
baseFileVo.setUrl(pqReport.getBasePath());
|
||||||
pqReportVO.setBaseFileVO(baseFileVo);
|
pqReportVO.setBaseFileVO(baseFileVo);
|
||||||
|
|
||||||
PqReportVO.FileVO detailFileVo = new PqReportVO.FileVO();
|
PqReportVO.FileVO detailFileVo = new PqReportVO.FileVO();
|
||||||
detailFileVo.setFileName(pqReport.getBasePath().substring(pqReport.getBasePath().lastIndexOf(File.separator) + 1));
|
detailFileVo.setName(pqReport.getBasePath().substring(pqReport.getBasePath().lastIndexOf(File.separator) + 1));
|
||||||
detailFileVo.setUrl(pqReport.getBasePath());
|
detailFileVo.setUrl(pqReport.getBasePath());
|
||||||
pqReportVO.setDetailFileVO(detailFileVo);
|
pqReportVO.setDetailFileVO(detailFileVo);
|
||||||
|
|
||||||
@@ -138,12 +156,12 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
BeanUtils.copyProperties(pqReport, pqReportVO);
|
BeanUtils.copyProperties(pqReport, pqReportVO);
|
||||||
|
|
||||||
PqReportVO.FileVO baseFileVo = new PqReportVO.FileVO();
|
PqReportVO.FileVO baseFileVo = new PqReportVO.FileVO();
|
||||||
baseFileVo.setFileName(pqReport.getBasePath().substring(pqReport.getBasePath().lastIndexOf(File.separator) + 1));
|
baseFileVo.setName(pqReport.getBasePath().substring(pqReport.getBasePath().lastIndexOf(File.separator) + 1));
|
||||||
baseFileVo.setUrl(pqReport.getBasePath());
|
baseFileVo.setUrl(pqReport.getBasePath());
|
||||||
pqReportVO.setBaseFileVO(baseFileVo);
|
pqReportVO.setBaseFileVO(baseFileVo);
|
||||||
|
|
||||||
PqReportVO.FileVO detailFileVo = new PqReportVO.FileVO();
|
PqReportVO.FileVO detailFileVo = new PqReportVO.FileVO();
|
||||||
detailFileVo.setFileName(pqReport.getDetailPath().substring(pqReport.getDetailPath().lastIndexOf(File.separator) + 1));
|
detailFileVo.setName(pqReport.getDetailPath().substring(pqReport.getDetailPath().lastIndexOf(File.separator) + 1));
|
||||||
detailFileVo.setUrl(pqReport.getDetailPath());
|
detailFileVo.setUrl(pqReport.getDetailPath());
|
||||||
pqReportVO.setDetailFileVO(detailFileVo);
|
pqReportVO.setDetailFileVO(detailFileVo);
|
||||||
|
|
||||||
@@ -159,7 +177,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
pqReport.setState(DataStateEnum.ENABLE.getCode());
|
pqReport.setState(DataStateEnum.ENABLE.getCode());
|
||||||
|
|
||||||
// 上传文件
|
// 上传文件
|
||||||
this.uploadFile(reportParam, pqReport);
|
this.uploadFile(reportParam, pqReport, true);
|
||||||
return this.save(pqReport);
|
return this.save(pqReport);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +189,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
BeanUtils.copyProperties(reportParam, pqReport);
|
BeanUtils.copyProperties(reportParam, pqReport);
|
||||||
|
|
||||||
// 上传文件
|
// 上传文件
|
||||||
this.uploadFile(reportParam, pqReport);
|
this.uploadFile(reportParam, pqReport, false);
|
||||||
return this.updateById(pqReport);
|
return this.updateById(pqReport);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,7 +211,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
@Override
|
@Override
|
||||||
public List<String> listAllName() {
|
public List<String> listAllName() {
|
||||||
List<String> result = this.lambdaQuery()
|
List<String> result = this.lambdaQuery()
|
||||||
.eq(PqReport::getState, DataStateEnum.ENABLE.getCode()).list().stream().map(PqReport::getName).collect(Collectors.toList());
|
.eq(PqReport::getState, DataStateEnum.ENABLE.getCode()).list().stream().map(PqReport::getName).distinct().collect(Collectors.toList());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,8 +228,9 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
*
|
*
|
||||||
* @param reportParam
|
* @param reportParam
|
||||||
* @param pqReport
|
* @param pqReport
|
||||||
|
* @param isAdd
|
||||||
*/
|
*/
|
||||||
private void uploadFile(ReportParam reportParam, PqReport pqReport) {
|
private void uploadFile(ReportParam reportParam, PqReport pqReport, Boolean isAdd) {
|
||||||
String uploadDir = templatePath + File.separator + reportParam.getName() + File.separator + reportParam.getVersion() + File.separator;
|
String uploadDir = templatePath + File.separator + reportParam.getName() + File.separator + reportParam.getVersion() + File.separator;
|
||||||
|
|
||||||
//校验文件后缀
|
//校验文件后缀
|
||||||
@@ -268,9 +287,11 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
throw new BusinessException(ReportResponseEnum.FILE_UPLOAD_FAILED);
|
throw new BusinessException(ReportResponseEnum.FILE_UPLOAD_FAILED);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (isAdd) {
|
||||||
throw new BusinessException(ReportResponseEnum.FILE_NOT_NULL);
|
throw new BusinessException(ReportResponseEnum.FILE_NOT_NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据id删除已有的文件
|
* 根据id删除已有的文件
|
||||||
@@ -306,7 +327,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
@Override
|
@Override
|
||||||
public void generateReport(DevReportParam devReportParam) {
|
public void generateReport(DevReportParam devReportParam) {
|
||||||
AdPlan plan = adPlanService.getById(devReportParam.getPlanId());
|
AdPlan plan = adPlanService.getById(devReportParam.getPlanId());
|
||||||
if (ObjectUtil.isNotNull(plan.getReportTemplateId())) {
|
if (StrUtil.isNotBlank(plan.getReportTemplateId())) {
|
||||||
this.generateReportByPlan(plan, devReportParam);
|
this.generateReportByPlan(plan, devReportParam);
|
||||||
} else {
|
} else {
|
||||||
// 根据设备类型找到报告模板
|
// 根据设备类型找到报告模板
|
||||||
@@ -364,16 +385,16 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
// 根据设备类型找到报告模板
|
// 根据设备类型找到报告模板
|
||||||
PqDevVO pqDevVO = iPqDevService.getPqDevById(devReportParam.getDevId());
|
PqDevVO pqDevVO = iPqDevService.getPqDevById(devReportParam.getDevId());
|
||||||
if (Objects.isNull(pqDevVO)) {
|
if (Objects.isNull(pqDevVO)) {
|
||||||
throw new BusinessException("请检查装置是否存在!");
|
throw new BusinessException(ReportResponseEnum.DEVICE_NOT_EXIST);
|
||||||
}
|
}
|
||||||
// 获取设备型号
|
// 获取设备型号
|
||||||
DevType devType = devTypeService.getById(pqDevVO.getDevType());
|
DevType devType = devTypeService.getById(pqDevVO.getDevType());
|
||||||
if (Objects.isNull(devType)) {
|
if (Objects.isNull(devType)) {
|
||||||
throw new BusinessException("设备类型缺失,请联系管理员!");
|
throw new BusinessException(ReportResponseEnum.DEVICE_TYPE_NOT_EXIST);
|
||||||
}
|
}
|
||||||
PqReport report = this.lambdaQuery().eq(PqReport::getId, plan.getAssociateReport()).eq(PqReport::getState, DataStateEnum.ENABLE.getCode()).one();
|
PqReport report = this.lambdaQuery().eq(PqReport::getId, plan.getReportTemplateId()).eq(PqReport::getState, DataStateEnum.ENABLE.getCode()).one();
|
||||||
if (Objects.isNull(report)) {
|
if (Objects.isNull(report)) {
|
||||||
throw new BusinessException("报告模板缺失,请联系管理员!");
|
throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSystemResource resource = new FileSystemResource(report.getBasePath());
|
FileSystemResource resource = new FileSystemResource(report.getBasePath());
|
||||||
@@ -383,7 +404,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
// 处理基础模版中的信息
|
// 处理基础模版中的信息
|
||||||
dealBaseModel(baseModelDocument, pqDevVO, devType);
|
dealBaseModel(baseModelDocument, pqDevVO, devType);
|
||||||
// 处理数据页中的信息
|
// 处理数据页中的信息
|
||||||
dealDataModel(baseModelDocument, devReportParam, pqDevVO);
|
dealDataModelZJ(baseModelDocument, devReportParam, pqDevVO);
|
||||||
// 处理需要输出的目录地址 基础路径+设备类型+装置编号.docx
|
// 处理需要输出的目录地址 基础路径+设备类型+装置编号.docx
|
||||||
// 最终文件输出的路径
|
// 最终文件输出的路径
|
||||||
String dirPath = reportPath.concat(File.separator).concat(devType.getName());
|
String dirPath = reportPath.concat(File.separator).concat(devType.getName());
|
||||||
@@ -422,7 +443,6 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
adPlanService.update(updateWrapper);
|
adPlanService.update(updateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void downloadReport(DevReportParam devReportParam, HttpServletResponse response) {
|
public void downloadReport(DevReportParam devReportParam, HttpServletResponse response) {
|
||||||
PqDevVO pqDevVO = iPqDevService.getPqDevById(devReportParam.getDevId());
|
PqDevVO pqDevVO = iPqDevService.getPqDevById(devReportParam.getDevId());
|
||||||
@@ -476,9 +496,10 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
Map<String, String> baseModelMap = new HashMap<>(16);
|
Map<String, String> baseModelMap = new HashMap<>(16);
|
||||||
// 获取设备型号
|
// 获取设备型号
|
||||||
baseModelMap.put("${devType}", devType.getName());
|
baseModelMap.put("${devType}", devType.getName());
|
||||||
|
baseModelMap.put("${device_type}", devType.getName());
|
||||||
// 调试人员,todo... 待咨询曹泽辉如何获取当前用户信息,目前先写死
|
// 调试人员,todo... 待咨询曹泽辉如何获取当前用户信息,目前先写死
|
||||||
String userName = RequestUtil.getUserName();
|
//String userName = RequestUtil.getUserName();
|
||||||
baseModelMap.put("${userName}", userName);
|
baseModelMap.put("${userName}", pqDevVO.getCheckBy());
|
||||||
// 调试日期
|
// 调试日期
|
||||||
if (pqDevVO.getCheckTime() != null) {
|
if (pqDevVO.getCheckTime() != null) {
|
||||||
baseModelMap.put("${testDate}", DateUtil.format(pqDevVO.getCheckTime(), DatePattern.CHINESE_DATE_PATTERN));
|
baseModelMap.put("${testDate}", DateUtil.format(pqDevVO.getCheckTime(), DatePattern.CHINESE_DATE_PATTERN));
|
||||||
@@ -503,6 +524,17 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
|
|
||||||
baseModelMap.put("${count}", pqDevVO.getDevChns().toString());
|
baseModelMap.put("${count}", pqDevVO.getDevChns().toString());
|
||||||
|
|
||||||
|
DictData dictData = dictDataService.getDictDataById(pqDevVO.getManufacturer());
|
||||||
|
if (ObjectUtil.isNotNull(dictData)) {
|
||||||
|
baseModelMap.put("${manufacturer}", dictData.getName());
|
||||||
|
} else {
|
||||||
|
baseModelMap.put("${manufacturer}", "未知");
|
||||||
|
}
|
||||||
|
baseModelMap.put("${sample_id}", pqDevVO.getSampleId());
|
||||||
|
baseModelMap.put("${arrived_date}", String.valueOf(pqDevVO.getArrivedDate()));
|
||||||
|
baseModelMap.put("${check_date}", String.valueOf(pqDevVO.getCheckTime()).substring(0, 10));
|
||||||
|
baseModelMap.put("${tested_by}", pqDevVO.getCheckBy());
|
||||||
|
|
||||||
// 替换模板中的信息,避免信息丢失,段落和表格均参与替换
|
// 替换模板中的信息,避免信息丢失,段落和表格均参与替换
|
||||||
WordUtil.replacePlaceholdersInParagraphs(baseModelDocument, baseModelMap);
|
WordUtil.replacePlaceholdersInParagraphs(baseModelDocument, baseModelMap);
|
||||||
WordUtil.replacePlaceholdersInTables(baseModelDocument, baseModelMap);
|
WordUtil.replacePlaceholdersInTables(baseModelDocument, baseModelMap);
|
||||||
@@ -516,15 +548,15 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
* @param devReportParam 查询参数
|
* @param devReportParam 查询参数
|
||||||
*/
|
*/
|
||||||
private void dealDataModel(XWPFDocument baseModelDocument, DevReportParam devReportParam, PqDevVO pqDevVO) throws IOException {
|
private void dealDataModel(XWPFDocument baseModelDocument, DevReportParam devReportParam, PqDevVO pqDevVO) throws IOException {
|
||||||
AdPlan adPlan = adPlanService.getById(devReportParam.getPlanId());
|
//AdPlan adPlan = adPlanService.getById(devReportParam.getPlanId());
|
||||||
String scriptId = adPlan.getScriptId();
|
//String scriptId = adPlan.getScriptId();
|
||||||
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");
|
ClassPathResource resource = new ClassPathResource("/model/report_table.docx");
|
||||||
XWPFDocument dataModelDocumentTemp = new XWPFDocument(resource.getInputStream());
|
XWPFDocument dataModelDocumentTemp = new XWPFDocument(resource.getInputStream());
|
||||||
|
|
||||||
SingleNonHarmParam singleNonHarmParam = new SingleNonHarmParam();
|
SingleNonHarmParam singleNonHarmParam = new SingleNonHarmParam();
|
||||||
singleNonHarmParam.setPlanCode(adPlan.getCode());
|
singleNonHarmParam.setPlanCode(Integer.valueOf(devReportParam.getPlanCode()));
|
||||||
singleNonHarmParam.setDevId(pqDevVO.getId());
|
singleNonHarmParam.setDevId(pqDevVO.getId());
|
||||||
singleNonHarmParam.setChannelNo(i);
|
singleNonHarmParam.setChannelNo(i);
|
||||||
|
|
||||||
@@ -678,6 +710,490 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void dealDataModelZJ(XWPFDocument baseModelDocument, DevReportParam devReportParam, PqDevVO pqDevVO) {
|
||||||
|
List<AdBaseResult> nonHarmonicResultList = adNonHarmonicService.get(devReportParam.getScriptId(), null, devReportParam.getDevId(), "-1", devReportParam.getPlanCode());
|
||||||
|
List<AdBaseResult> harmonicResultList = adHarmonicService.get(devReportParam.getScriptId(), null, devReportParam.getDevId(), "-1", devReportParam.getPlanCode());
|
||||||
|
if (CollectionUtil.isEmpty(nonHarmonicResultList) && CollectionUtil.isEmpty(harmonicResultList)) {
|
||||||
|
throw new BusinessException(ReportResponseEnum.NO_CHECK_DATA);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<AdBaseResult> allBaseResultList = Stream.concat(nonHarmonicResultList.stream(), harmonicResultList.stream())
|
||||||
|
.sorted(Comparator.comparing(AdBaseResult::getSort)).collect(Collectors.toList());
|
||||||
|
LinkedHashMap<String, List<AdBaseResult>> chnResultMap = allBaseResultList.stream().sorted(Comparator.comparing(AdBaseResult::getSort))
|
||||||
|
.collect(Collectors.groupingBy(
|
||||||
|
(obj) -> obj.getMonitorId().substring(obj.getMonitorId().lastIndexOf("_") + 1),
|
||||||
|
LinkedHashMap::new,
|
||||||
|
Collectors.toList()));
|
||||||
|
|
||||||
|
for (int i = 1; i <= pqDevVO.getDevChns(); i++) {
|
||||||
|
XWPFParagraph paragraph = baseModelDocument.createParagraph();
|
||||||
|
paragraph.setAlignment(ParagraphAlignment.LEFT);
|
||||||
|
XWPFRun run = paragraph.createRun();
|
||||||
|
run.setFontFamily("宋体");
|
||||||
|
run.setBold(true);
|
||||||
|
run.setFontSize(14);
|
||||||
|
run.setText("测量回路" + i);
|
||||||
|
|
||||||
|
List<AdBaseResult> chnResultList = chnResultMap.get(String.valueOf(i));
|
||||||
|
|
||||||
|
// // 排除电压相角、电压偏差、电流相角
|
||||||
|
// list1 = list1.stream().filter(obj -> !"e8bbfaad7a3fa343d3c46d345fb45fa3".equals(obj.getAdType()))
|
||||||
|
// .filter(obj -> !"148faabd2630aaac0b70be8609075f69".equals(obj.getAdType()))
|
||||||
|
// .filter(obj -> !"fdffc6b5dfdc8751b9fde9b599b8ea51".equals(obj.getAdType())).collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, Set<Integer>> checkMap = this.getCheckMap(chnResultList);
|
||||||
|
for (String key : checkMap.keySet()) {
|
||||||
|
Set<Integer> indexSet = checkMap.get(key);
|
||||||
|
generateTitleAndTableZJ(baseModelDocument, String.valueOf(i), key, devReportParam, indexSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//generateNonHarmABCTableHeaderZJ(baseModelDocument);
|
||||||
|
XWPFTable table = baseModelDocument.getTables().get(2);
|
||||||
|
for (int i = 1; i <= 3; i++) {
|
||||||
|
XWPFTableRow row = table.createRow();
|
||||||
|
for (int j = 0; j < 8; j++) {
|
||||||
|
row.getCell(j).setText("1.00");
|
||||||
|
row.getCell(j).setWidth("12.5%");
|
||||||
|
row.getCell(j).setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER);
|
||||||
|
row.getCell(j).getParagraphs().get(0).setAlignment(ParagraphAlignment.CENTER);
|
||||||
|
if (j == 0) {
|
||||||
|
row.getCell(j).setWidth("15.0%");
|
||||||
|
}
|
||||||
|
if (j == 7) {
|
||||||
|
row.getCell(j).setWidth("10.0%");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取map。 key为 检测大项code_大项ID ,value为大检测项下的所有index。
|
||||||
|
*
|
||||||
|
* @param list
|
||||||
|
*/
|
||||||
|
private Map<String, Set<Integer>> getCheckMap(List<AdBaseResult> list) {
|
||||||
|
Map<String, Set<Integer>> checkMap = new LinkedHashMap<>();
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
AdBaseResult adBaseResult = list.get(i);
|
||||||
|
DictTree dictTree = dictTreeService.getById(adBaseResult.getAdType());
|
||||||
|
DictTree parentDictTree = dictTreeService.getById(dictTree.getPid());
|
||||||
|
if (ObjectUtil.isNotNull(parentDictTree)) {
|
||||||
|
String key = parentDictTree.getCode();
|
||||||
|
checkMap.putIfAbsent(key + "_" + parentDictTree.getId(), new TreeSet<>());
|
||||||
|
checkMap.get(key + "_" + parentDictTree.getId()).add(adBaseResult.getSort());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return checkMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 浙江电科院版-动态生成标题和表格
|
||||||
|
*
|
||||||
|
* @param baseModelDocument
|
||||||
|
* @param devNum
|
||||||
|
* @param key
|
||||||
|
* @param devReportParam
|
||||||
|
* @param indexSet
|
||||||
|
*/
|
||||||
|
private void generateTitleAndTableZJ(XWPFDocument baseModelDocument, String devNum, String key, DevReportParam devReportParam, Set<Integer> indexSet) {
|
||||||
|
boolean isHarm = key.contains(DicDataEnum.HV.getCode()) || key.contains(DicDataEnum.HI.getCode()) || key.contains(DicDataEnum.HSV.getCode()) || key.contains(DicDataEnum.HSV.getCode());
|
||||||
|
Map<String, List<RawResultDataVO>> radiusMap = getRadiusMap(devNum, key, devReportParam, indexSet, isHarm);
|
||||||
|
|
||||||
|
for (String radius : radiusMap.keySet()) {
|
||||||
|
XWPFParagraph paragraph = baseModelDocument.createParagraph();
|
||||||
|
paragraph.setAlignment(ParagraphAlignment.LEFT);
|
||||||
|
XWPFRun run = paragraph.createRun();
|
||||||
|
run.setFontFamily("宋体");
|
||||||
|
run.setBold(true);
|
||||||
|
run.setFontSize(12);
|
||||||
|
if (isHarm) {
|
||||||
|
run.setText(key.split("_")[0] + "测量准确度(最大允许误差:±" + radius.split("_")[1] + ")");
|
||||||
|
} else {
|
||||||
|
run.setText(key.split("_")[0] + "测量准确度(最大允许误差:±" + radius + ")");
|
||||||
|
}
|
||||||
|
XWPFTable table = generateTableHeaderZJ(baseModelDocument, DicDataEnum.getEnumByCode(key.split("_")[0]));
|
||||||
|
|
||||||
|
// 填写数据
|
||||||
|
// for (RawResultDataVO rawResultDataVO : radiusMap.get(radius)) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取同一个检测大项下不同的误差范围,及其检测结果
|
||||||
|
*
|
||||||
|
* @param devNum
|
||||||
|
* @param key
|
||||||
|
* @param devReportParam
|
||||||
|
* @param indexSet
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Map<String, List<RawResultDataVO>> getRadiusMap(String devNum, String key, DevReportParam devReportParam, Set<Integer> indexSet, boolean isHarm) {
|
||||||
|
Map<String, List<RawResultDataVO>> raiusMap = new LinkedHashMap<>();
|
||||||
|
ResultParam param = new ResultParam();
|
||||||
|
param.setScriptId(devReportParam.getScriptId());
|
||||||
|
param.setDevId(devReportParam.getDevId());
|
||||||
|
param.setDevNum(devNum);
|
||||||
|
param.setCode(devReportParam.getPlanCode());
|
||||||
|
String[] split = key.split("_");
|
||||||
|
param.setScriptType(split[1]);
|
||||||
|
for (Integer index : indexSet) {
|
||||||
|
param.setIndex(index);
|
||||||
|
ResultVO resultVO = resultService.resultDataForReport(param);
|
||||||
|
Map<String, RawResultDataVO> resultData = resultVO.getResultData();
|
||||||
|
if (CollectionUtil.isNotEmpty(resultData)) {
|
||||||
|
if (DicDataEnum.V.getCode().equals(split[0]) || DicDataEnum.I.getCode().equals(split[0])) {
|
||||||
|
// 排除电压相角、电压偏差、电流相角
|
||||||
|
resultData.remove("电压相角");
|
||||||
|
resultData.remove("电压偏差");
|
||||||
|
resultData.remove("电流相角");
|
||||||
|
}
|
||||||
|
resultData.values().stream().findFirst().ifPresent(obj -> {
|
||||||
|
String radius = obj.getRadius();
|
||||||
|
String unit = obj.getUnit();
|
||||||
|
if (StrUtil.isNotBlank(radius)) {
|
||||||
|
if (isHarm) {
|
||||||
|
raiusMap.put(index + "_" + radius.split("~")[1] + unit, resultData.values().stream().collect(Collectors.toList()));
|
||||||
|
} else {
|
||||||
|
raiusMap.put(radius.split("~")[1] + unit, resultData.values().stream().collect(Collectors.toList()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return raiusMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 浙江电科院版-生成表格头部
|
||||||
|
*
|
||||||
|
* @param doc
|
||||||
|
* @param checkItem 区分不同的表头
|
||||||
|
* @return 生成的表格
|
||||||
|
*/
|
||||||
|
private XWPFTable generateTableHeaderZJ(XWPFDocument doc, DicDataEnum checkItem) {
|
||||||
|
List<List<CellEntity>> rows = new ArrayList<>();
|
||||||
|
List<CellEntity> row = null;
|
||||||
|
switch (checkItem) {
|
||||||
|
case FREQ: // 用于 频率
|
||||||
|
row = new ArrayList<>();
|
||||||
|
row.add(new CellEntity("给定值(HZ)", "25.0%", 1, 1));
|
||||||
|
row.add(new CellEntity("测试值(HZ)", "25.0%", 1, 1));
|
||||||
|
row.add(new CellEntity("误差(HZ)", "25.0%", 1, 1));
|
||||||
|
row.add(new CellEntity("结论", "25.0%", 1, 1));
|
||||||
|
rows.add(row);
|
||||||
|
break;
|
||||||
|
case V: // 用于 电压
|
||||||
|
row = new ArrayList<>();
|
||||||
|
row.add(new CellEntity("给定值(V)", "15.0%", 2, 1));
|
||||||
|
row.add(new CellEntity("测试值(V)", "12.5%", 1, 3));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("误差(%)", "12.5%", 1, 3));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("结论", "10.0%", 2, 1));
|
||||||
|
rows.add(row);
|
||||||
|
|
||||||
|
row = new ArrayList<>();
|
||||||
|
row.add(new CellEntity("", "15.0%", 1, 1));
|
||||||
|
row.add(new CellEntity("L1", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L2", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L3", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L1", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L2", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L3", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("", "10.0%", 1, 1));
|
||||||
|
rows.add(row);
|
||||||
|
break;
|
||||||
|
case I: // 用于 电流
|
||||||
|
row = new ArrayList<>();
|
||||||
|
row.add(new CellEntity("给定值(A)", "15.0%", 2, 1));
|
||||||
|
row.add(new CellEntity("测试值(A)", "12.5%", 1, 3));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("误差(%)", "12.5%", 1, 3));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("结论", "10.0%", 2, 1));
|
||||||
|
rows.add(row);
|
||||||
|
|
||||||
|
row = new ArrayList<>();
|
||||||
|
row.add(new CellEntity("", "15.0%", 1, 1));
|
||||||
|
row.add(new CellEntity("L1", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L2", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L3", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L1", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L2", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L3", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("", "10.0%", 1, 1));
|
||||||
|
rows.add(row);
|
||||||
|
break;
|
||||||
|
case IMBV:// 用于 负序电压不平衡度、负序电流不平衡度
|
||||||
|
case IMBA:
|
||||||
|
row = new ArrayList<>();
|
||||||
|
row.add(new CellEntity("给定值(%)", "25.0%", 1, 1));
|
||||||
|
row.add(new CellEntity("测试值(%)", "25.0%", 1, 1));
|
||||||
|
row.add(new CellEntity("误差(%)", "25.0%", 1, 1));
|
||||||
|
row.add(new CellEntity("结论", "25.0%", 1, 1));
|
||||||
|
rows.add(row);
|
||||||
|
break;
|
||||||
|
case F: // 用于 短时闪变
|
||||||
|
row = new ArrayList<>();
|
||||||
|
row.add(new CellEntity("给定值", "15.0%", 2, 1));
|
||||||
|
row.add(new CellEntity("测试值", "12.5%", 1, 3));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("误差(%)", "12.5%", 1, 3));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("结论", "10.0%", 2, 1));
|
||||||
|
rows.add(row);
|
||||||
|
|
||||||
|
row = new ArrayList<>();
|
||||||
|
row.add(new CellEntity("", "15.0%", 1, 1));
|
||||||
|
row.add(new CellEntity("L1", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L2", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L3", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L1", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L2", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L3", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("", "10.0%", 1, 1));
|
||||||
|
rows.add(row);
|
||||||
|
break;
|
||||||
|
case HV: // 用于 谐波电压
|
||||||
|
row = new ArrayList<>();
|
||||||
|
row.add(new CellEntity("谐波次数", "7.0%", 2, 1));
|
||||||
|
row.add(new CellEntity("谐波电压给定值(%)", "10.0%", 2, 1));
|
||||||
|
row.add(new CellEntity("测试值(%)", "12.5%", 1, 3));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("误差(%)", "12.5%", 1, 3));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("结论", "8.0%", 2, 1));
|
||||||
|
rows.add(row);
|
||||||
|
|
||||||
|
row = new ArrayList<>();
|
||||||
|
row.add(new CellEntity("", "7.0%", 1, 1));
|
||||||
|
row.add(new CellEntity("", "10.0%", 1, 1));
|
||||||
|
row.add(new CellEntity("L1", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L2", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L3", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L1", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L2", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L3", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("", "8.0%", 1, 1));
|
||||||
|
rows.add(row);
|
||||||
|
break;
|
||||||
|
case HI: // 用于 谐波电流
|
||||||
|
row = new ArrayList<>();
|
||||||
|
row.add(new CellEntity("谐波次数", "8.0%", 2, 1));
|
||||||
|
row.add(new CellEntity("谐波电流给定值(A)", "10.0%", 2, 1));
|
||||||
|
row.add(new CellEntity("测试值(A)", "12.5%", 1, 3));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("误差(%)", "12.5%", 1, 3));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("结论", "7.0%", 2, 1));
|
||||||
|
rows.add(row);
|
||||||
|
|
||||||
|
row = new ArrayList<>();
|
||||||
|
row.add(new CellEntity("", "8.0%", 1, 1));
|
||||||
|
row.add(new CellEntity("", "10.0%", 1, 1));
|
||||||
|
row.add(new CellEntity("L1", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L2", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L3", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L1", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L2", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L3", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("", "7.0%", 1, 1));
|
||||||
|
rows.add(row);
|
||||||
|
break;
|
||||||
|
case HSV: // 用于 间谐波电压
|
||||||
|
row = new ArrayList<>();
|
||||||
|
row.add(new CellEntity("间谐波次数", "8.0%", 2, 1));
|
||||||
|
row.add(new CellEntity("间谐波电压给定值(%)", "10.0%", 2, 1));
|
||||||
|
row.add(new CellEntity("测试值(%)", "12.5%", 1, 3));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("误差(%)", "12.5%", 1, 3));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("结论", "7.0%", 2, 1));
|
||||||
|
rows.add(row);
|
||||||
|
|
||||||
|
row = new ArrayList<>();
|
||||||
|
row.add(new CellEntity("", "8.0%", 1, 1));
|
||||||
|
row.add(new CellEntity("", "10.0%", 1, 1));
|
||||||
|
row.add(new CellEntity("L1", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L2", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L3", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L1", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L2", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L3", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("", "7.0%", 1, 1));
|
||||||
|
rows.add(row);
|
||||||
|
break;
|
||||||
|
case HSI: // 用于 间谐波电流
|
||||||
|
row = new ArrayList<>();
|
||||||
|
row.add(new CellEntity("间谐波次数", "8.0%", 2, 1));
|
||||||
|
row.add(new CellEntity("间谐波电流给定值(A)", "10.0%", 2, 1));
|
||||||
|
row.add(new CellEntity("测试值(A)", "12.5%", 1, 3));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("误差(%)", "12.5%", 1, 3));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("结论", "7.0%", 2, 1));
|
||||||
|
rows.add(row);
|
||||||
|
|
||||||
|
row = new ArrayList<>();
|
||||||
|
row.add(new CellEntity("", "8.0%", 1, 1));
|
||||||
|
row.add(new CellEntity("", "10.0%", 1, 1));
|
||||||
|
row.add(new CellEntity("L1", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L2", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L3", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L1", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L2", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("L3", "12.5%", 1, 1));
|
||||||
|
row.add(new CellEntity("", "7.0%", 1, 1));
|
||||||
|
rows.add(row);
|
||||||
|
break;
|
||||||
|
case VOLTAGE: // 用于 电压暂降、暂升及短时中断
|
||||||
|
row = new ArrayList<>();
|
||||||
|
row.add(new CellEntity("给定值", "16.0%", 1, 2));
|
||||||
|
row.add(new CellEntity("", "16.0%", 1, 1));
|
||||||
|
row.add(new CellEntity("测试值", "16.0%", 1, 2));
|
||||||
|
row.add(new CellEntity("", "16.0%", 1, 1));
|
||||||
|
row.add(new CellEntity("误差", "16.0%", 1, 2));
|
||||||
|
row.add(new CellEntity("", "16.0%", 1, 1));
|
||||||
|
rows.add(row);
|
||||||
|
|
||||||
|
row = new ArrayList<>();
|
||||||
|
row.add(new CellEntity("特征幅值(%)", "16.0%", 1, 1));
|
||||||
|
row.add(new CellEntity("持续时间(ms)", "16.0%", 1, 1));
|
||||||
|
row.add(new CellEntity("特征幅值(%)", "16.0%", 1, 1));
|
||||||
|
row.add(new CellEntity("持续时间(ms)", "16.0%", 1, 1));
|
||||||
|
row.add(new CellEntity("特征幅值(%)", "16.0%", 1, 1));
|
||||||
|
row.add(new CellEntity("持续时间(ms)", "16.0%", 1, 1));
|
||||||
|
rows.add(row);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return generateTableHeader(doc, rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动态生成表格头部
|
||||||
|
*
|
||||||
|
* @param doc
|
||||||
|
* @param rows 表头数据
|
||||||
|
* @return 生成的表格
|
||||||
|
*/
|
||||||
|
private XWPFTable generateTableHeader(XWPFDocument doc, List<List<CellEntity>> rows) {
|
||||||
|
XWPFTable table = doc.createTable(rows.size(), rows.get(0).size());
|
||||||
|
table.setTableAlignment(TableRowAlign.CENTER);
|
||||||
|
table.setWidth("100%");
|
||||||
|
|
||||||
|
CTTblGrid grid = table.getCTTbl().addNewTblGrid();
|
||||||
|
for (int i = 0; i < rows.get(0).size(); i++) {
|
||||||
|
grid.addNewGridCol();
|
||||||
|
}
|
||||||
|
for (int i = 0; i < rows.size(); i++) {
|
||||||
|
XWPFTableRow row = table.getRow(i);
|
||||||
|
row.setHeight((int) (1 / 2.54 * TWIPS_PER_INCH));
|
||||||
|
|
||||||
|
for (int j = 0; j < rows.get(i).size(); j++) {
|
||||||
|
CellEntity cellEntity = rows.get(i).get(j);
|
||||||
|
row.getCell(j).setText(cellEntity.getCellValue());
|
||||||
|
row.getCell(j).setWidth(cellEntity.getWidth());
|
||||||
|
setHeaderCellStyle(row.getCell(j));
|
||||||
|
|
||||||
|
if (cellEntity.getColSpan() > 1) {
|
||||||
|
mergeCellsHorizontal(table, i, j, j + cellEntity.getColSpan() - 1);
|
||||||
|
}
|
||||||
|
if (cellEntity.getRowSpan() > 1) {
|
||||||
|
mergeCellsVertically(table, j, i, i + cellEntity.getRowSpan() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return table;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CTTcPr getTcPr(XWPFTableCell cell) {
|
||||||
|
return cell.getCTTc().isSetTcPr() ? cell.getCTTc().getTcPr() : cell.getCTTc().addNewTcPr();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* word单元格列合并(合并列)
|
||||||
|
*
|
||||||
|
* @param table
|
||||||
|
* @param row
|
||||||
|
* @param fromCol
|
||||||
|
* @param toCol
|
||||||
|
*/
|
||||||
|
public void mergeCellsHorizontal(XWPFTable table, int row, int fromCol, int toCol) {
|
||||||
|
for (int colIndex = fromCol; colIndex <= toCol; colIndex++) {
|
||||||
|
XWPFTableCell cell = table.getRow(row).getCell(colIndex);
|
||||||
|
CTTcPr tcPr = getTcPr(cell);
|
||||||
|
CTHMerge hMerge = tcPr.addNewHMerge();
|
||||||
|
if (colIndex == fromCol) {
|
||||||
|
hMerge.setVal(STMerge.RESTART);
|
||||||
|
} else {
|
||||||
|
hMerge.setVal(STMerge.CONTINUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* word单元格行合并(合并行)
|
||||||
|
*
|
||||||
|
* @param table
|
||||||
|
* @param col
|
||||||
|
* @param fromRow
|
||||||
|
* @param toRow
|
||||||
|
*/
|
||||||
|
public void mergeCellsVertically(XWPFTable table, int col, int fromRow, int toRow) {
|
||||||
|
for (int rowIndex = fromRow; rowIndex <= toRow; rowIndex++) {
|
||||||
|
XWPFTableCell cell = table.getRow(rowIndex).getCell(col);
|
||||||
|
CTTcPr tcPr = getTcPr(cell);
|
||||||
|
CTVMerge vMerge = tcPr.addNewVMerge();
|
||||||
|
if (rowIndex == fromRow) {
|
||||||
|
vMerge.setVal(STMerge.RESTART);
|
||||||
|
} else {
|
||||||
|
vMerge.setVal(STMerge.CONTINUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeaderCellStyle(XWPFTableCell cell) {
|
||||||
|
cell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER);
|
||||||
|
XWPFParagraph xwpfParagraph = cell.getParagraphs().get(0);
|
||||||
|
xwpfParagraph.setAlignment(ParagraphAlignment.CENTER);
|
||||||
|
// System.out.println("Paragraph text: " + xwpfParagraph.getText());
|
||||||
|
// List<XWPFRun> runs = xwpfParagraph.getRuns();
|
||||||
|
// runs.get(0).setBold(true);
|
||||||
|
// runs.get(0).setFontSize(10);
|
||||||
|
// String text = runs.get(0).getText(0);
|
||||||
|
// if (StrUtil.isNotBlank(text) && Pattern.matches("^[A-Za-z0-9]+$", text)) {
|
||||||
|
// runs.get(0).setFontFamily("Arial");
|
||||||
|
// } else {
|
||||||
|
// runs.get(0).setFontFamily("宋体");
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void specialDealVoltage(Map<String, String> dataModelMap, String symbol) {
|
private void specialDealVoltage(Map<String, String> dataModelMap, String symbol) {
|
||||||
String value = dataModelMap.get(symbol);
|
String value = dataModelMap.get(symbol);
|
||||||
if (Objects.nonNull(value) && !value.equals("/")) {
|
if (Objects.nonNull(value) && !value.equals("/")) {
|
||||||
|
|||||||
@@ -39,6 +39,14 @@ public interface IResultService {
|
|||||||
*/
|
*/
|
||||||
ResultVO resultData(ResultParam param);
|
ResultVO resultData(ResultParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 展示结果数据(用于生成报告)
|
||||||
|
*
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ResultVO resultDataForReport(ResultParam param);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出原始数据
|
* 导出原始数据
|
||||||
|
|||||||
@@ -807,6 +807,37 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
return resultVO;
|
return resultVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResultVO resultDataForReport(ResultParam param) {
|
||||||
|
StorageParam storage = new StorageParam();
|
||||||
|
storage.setIndex(param.getIndex());
|
||||||
|
storage.setScriptId(param.getScriptId());
|
||||||
|
storage.setDevId(param.getDevId());
|
||||||
|
storage.setDevNum(param.getDevNum());
|
||||||
|
storage.setCode(param.getCode());
|
||||||
|
DictTree dictTree = dictTreeService.getById(param.getScriptType());
|
||||||
|
List<Double> harmNum = new ArrayList<>();
|
||||||
|
if (HARMONIC_TYPE_CODE.contains(dictTree.getCode())) {
|
||||||
|
List<PqScriptCheckData> list = pqScriptCheckDataService.list(new MPJLambdaWrapper<PqScriptCheckData>()
|
||||||
|
.distinct()
|
||||||
|
.select(PqScriptCheckData::getHarmNum)
|
||||||
|
.eq(PqScriptCheckData::getScriptId, param.getScriptId())
|
||||||
|
.isNotNull(PqScriptCheckData::getHarmNum)
|
||||||
|
.eq(PqScriptCheckData::getScriptIndex, param.getIndex())
|
||||||
|
);
|
||||||
|
harmNum = list.stream().sorted(Comparator.comparing(PqScriptCheckData::getHarmNum))
|
||||||
|
.map(PqScriptCheckData::getHarmNum).distinct().collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
ResultVO resultVO = new ResultVO();
|
||||||
|
if (CollUtil.isEmpty(harmNum)) {
|
||||||
|
resultVO.setResultData(adNonHarmonicService.listNonHarmResultData(storage));
|
||||||
|
} else {
|
||||||
|
storage.setHarmNum(harmNum);
|
||||||
|
resultVO.setResultData(adHarmonicService.listHarmResultData(storage));
|
||||||
|
}
|
||||||
|
return resultVO;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exportRawData(ResultParam param) {
|
public void exportRawData(ResultParam param) {
|
||||||
StorageParam storage = new StorageParam();
|
StorageParam storage = new StorageParam();
|
||||||
@@ -977,10 +1008,10 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
dataRule = DictDataEnum.AT_WILL_VALUE;
|
dataRule = DictDataEnum.AT_WILL_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<AdNonHarmonicResult> allNonHarmonicRawData = adNonHarmonicService.listAll(oldCode, devId);
|
List<AdNonHarmonicResult> allNonHarmonicRawData = adNonHarmonicService.listAll(scriptId, oldCode, devId);
|
||||||
LinkedHashMap<Integer, List<AdNonHarmonicResult>> nonHarmonicMap = allNonHarmonicRawData.stream().sorted(Comparator.comparing(AdNonHarmonicResult::getSort))
|
LinkedHashMap<Integer, List<AdNonHarmonicResult>> nonHarmonicMap = allNonHarmonicRawData.stream().sorted(Comparator.comparing(AdNonHarmonicResult::getSort))
|
||||||
.collect(Collectors.groupingBy(AdNonHarmonicResult::getSort, LinkedHashMap::new, Collectors.toList()));
|
.collect(Collectors.groupingBy(AdNonHarmonicResult::getSort, LinkedHashMap::new, Collectors.toList()));
|
||||||
List<AdHarmonicResult> allHarmonicRawData = adHarmonicService.lisAll(oldCode, devId);
|
List<AdHarmonicResult> allHarmonicRawData = adHarmonicService.listAll(scriptId, oldCode, devId);
|
||||||
LinkedHashMap<Integer, List<AdHarmonicResult>> harmonicMap = allHarmonicRawData.stream().sorted(Comparator.comparing(AdHarmonicResult::getSort))
|
LinkedHashMap<Integer, List<AdHarmonicResult>> harmonicMap = allHarmonicRawData.stream().sorted(Comparator.comparing(AdHarmonicResult::getSort))
|
||||||
.collect(Collectors.groupingBy(AdHarmonicResult::getSort, LinkedHashMap::new, Collectors.toList()));
|
.collect(Collectors.groupingBy(AdHarmonicResult::getSort, LinkedHashMap::new, Collectors.toList()));
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
package com.njcn.gather.storage.pojo.param;
|
package com.njcn.gather.storage.pojo.param;
|
||||||
|
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hongawen
|
* @author hongawen
|
||||||
@@ -39,4 +41,6 @@ public class SingleNonHarmParam implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|
||||||
|
private List<Integer> sortList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,4 +27,9 @@ public class AdBaseResult {
|
|||||||
* 0.不合格 1.合格
|
* 0.不合格 1.合格
|
||||||
*/
|
*/
|
||||||
private Integer resultFlag;
|
private Integer resultFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测指标,字典表
|
||||||
|
*/
|
||||||
|
private String adType;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ public interface AdHarmonicService extends IService<AdHarmonicResult> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询结果数据
|
* 查询结果数据
|
||||||
|
*
|
||||||
* @param param
|
* @param param
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -45,6 +46,7 @@ public interface AdHarmonicService extends IService<AdHarmonicResult> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取索引
|
* 获取索引
|
||||||
|
*
|
||||||
* @param param
|
* @param param
|
||||||
* @param isExculdePhaseAngle 是否排除电压相角、电流相角
|
* @param isExculdePhaseAngle 是否排除电压相角、电流相角
|
||||||
* @return
|
* @return
|
||||||
@@ -56,9 +58,10 @@ public interface AdHarmonicService extends IService<AdHarmonicResult> {
|
|||||||
/**
|
/**
|
||||||
* 获取所有谐波原始数据
|
* 获取所有谐波原始数据
|
||||||
*
|
*
|
||||||
|
* @param scriptId
|
||||||
* @param code
|
* @param code
|
||||||
* @param devId 设备ID
|
* @param devId 设备ID
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<AdHarmonicResult> lisAll(String code, String devId);
|
List<AdHarmonicResult> listAll(String scriptId, String code, String devId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,9 +49,10 @@ public interface AdNonHarmonicService extends IService<AdNonHarmonicResult> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有原始数据
|
* 获取所有原始数据
|
||||||
|
* @param scriptId
|
||||||
* @param code
|
* @param code
|
||||||
* @param devId
|
* @param devId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<AdNonHarmonicResult> listAll(String code,String devId);
|
List<AdNonHarmonicResult> listAll(String scriptId,String code,String devId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -239,11 +239,11 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AdHarmonicResult> lisAll(String code, String devId) {
|
public List<AdHarmonicResult> listAll(String scriptId, String code, String devId) {
|
||||||
String prefix = "ad_harmonic_" + code;
|
String prefix = "ad_harmonic_" + code;
|
||||||
DynamicTableNameHandler.setTableName(prefix);
|
DynamicTableNameHandler.setTableName(prefix);
|
||||||
MPJLambdaWrapper<AdHarmonicResult> wrapper = new MPJLambdaWrapper<>();
|
MPJLambdaWrapper<AdHarmonicResult> wrapper = new MPJLambdaWrapper<>();
|
||||||
wrapper.likeRight(AdHarmonicResult::getMonitorId, devId);
|
wrapper.eq(AdHarmonicResult::getScriptId, scriptId).likeRight(AdHarmonicResult::getMonitorId, devId);
|
||||||
List<AdHarmonicResult> results = this.getBaseMapper().selectJoinList(AdHarmonicResult.class, wrapper);
|
List<AdHarmonicResult> results = this.getBaseMapper().selectJoinList(AdHarmonicResult.class, wrapper);
|
||||||
DynamicTableNameHandler.remove();
|
DynamicTableNameHandler.remove();
|
||||||
return results;
|
return results;
|
||||||
|
|||||||
@@ -154,11 +154,12 @@ public class AdNonHarmonicServiceImpl extends ServiceImpl<AdNonHarmonicMapper, A
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AdNonHarmonicResult> listAll(String code, String devId) {
|
public List<AdNonHarmonicResult> listAll(String scriptId, String code, String devId) {
|
||||||
String prefix = "ad_non_harmonic_" + code;
|
String prefix = "ad_non_harmonic_" + code;
|
||||||
DynamicTableNameHandler.setTableName(prefix);
|
DynamicTableNameHandler.setTableName(prefix);
|
||||||
MPJLambdaWrapper<AdNonHarmonicResult> wrapper = new MPJLambdaWrapper<>();
|
MPJLambdaWrapper<AdNonHarmonicResult> wrapper = new MPJLambdaWrapper<>();
|
||||||
wrapper.likeRight(AdNonHarmonicResult::getMonitorId, devId);
|
wrapper.eq(AdNonHarmonicResult::getScriptId, scriptId)
|
||||||
|
.likeRight(AdNonHarmonicResult::getMonitorId, devId);
|
||||||
List<AdNonHarmonicResult> results = this.getBaseMapper().selectJoinList(AdNonHarmonicResult.class, wrapper);
|
List<AdNonHarmonicResult> results = this.getBaseMapper().selectJoinList(AdNonHarmonicResult.class, wrapper);
|
||||||
DynamicTableNameHandler.remove();
|
DynamicTableNameHandler.remove();
|
||||||
return results;
|
return results;
|
||||||
|
|||||||
@@ -37,4 +37,13 @@ public enum DicDataEnum {
|
|||||||
this.code = code;
|
this.code = code;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static DicDataEnum getEnumByCode(String code) {
|
||||||
|
for (DicDataEnum e : DicDataEnum.values()) {
|
||||||
|
if (e.getCode().equals(code)) {
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user