This commit is contained in:
caozehui
2025-03-24 15:43:20 +08:00
parent 0e1fb0e254
commit ebc52eb8ba
26 changed files with 126 additions and 194 deletions

View File

@@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.njcn.gather.detection.pojo.dto.DevXiNumData;
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
import com.njcn.gather.detection.pojo.enums.SourceResponseCodeEnum;
import com.njcn.gather.detection.pojo.param.DevPhaseSequenceParam;
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
import com.njcn.gather.detection.pojo.po.DevData;
import com.njcn.gather.detection.pojo.po.SourceCompareDev;
@@ -30,8 +29,8 @@ import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
import com.njcn.gather.storage.service.AdHarmonicService;
import com.njcn.gather.storage.service.DetectionDataDealService;
import com.njcn.gather.system.config.pojo.po.SysTestConfig;
import com.njcn.gather.system.config.service.ISysTestConfigService;
import com.njcn.gather.system.cfg.pojo.po.SysTestConfig;
import com.njcn.gather.system.cfg.service.ISysTestConfigService;
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
import com.njcn.gather.system.pojo.enums.DicDataEnum;
import com.njcn.gather.system.reg.service.ISysRegResService;

View File

@@ -32,8 +32,8 @@ import com.njcn.gather.device.service.IPqDevService;
import com.njcn.gather.monitor.pojo.po.PqMonitor;
import com.njcn.gather.monitor.service.IPqMonitorService;
import com.njcn.gather.storage.service.DetectionDataDealService;
import com.njcn.gather.system.config.pojo.po.SysTestConfig;
import com.njcn.gather.system.config.service.ISysTestConfigService;
import com.njcn.gather.system.cfg.pojo.po.SysTestConfig;
import com.njcn.gather.system.cfg.service.ISysTestConfigService;
import com.njcn.gather.system.dictionary.pojo.po.DictData;
import com.njcn.gather.system.dictionary.pojo.po.DictType;
import com.njcn.gather.system.dictionary.service.IDictDataService;

View File

@@ -68,9 +68,6 @@ public class AdPlanParam {
@ApiModelProperty(value = "报告模板名称")
private String reportTemplateName;
@ApiModelProperty(value = "报告模板版本")
private String reportTemplateVersion;
/**
* 分页查询实体
*/

View File

@@ -108,9 +108,4 @@ public class AdPlanVO {
* 报告模板名称
*/
private String reportTemplateName;
/**
* 报告模板版本号
*/
private String reportTemplateVersion;
}

View File

@@ -41,8 +41,8 @@ import com.njcn.gather.source.service.IPqSourceService;
import com.njcn.gather.storage.pojo.param.StorageParam;
import com.njcn.gather.storage.service.AdHarmonicService;
import com.njcn.gather.storage.service.TableGenService;
import com.njcn.gather.system.config.pojo.po.SysTestConfig;
import com.njcn.gather.system.config.service.ISysTestConfigService;
import com.njcn.gather.system.cfg.pojo.po.SysTestConfig;
import com.njcn.gather.system.cfg.service.ISysTestConfigService;
import com.njcn.gather.system.dictionary.pojo.po.DictData;
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
import com.njcn.gather.system.dictionary.pojo.po.DictType;
@@ -107,8 +107,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
adPlanVO.setDatasourceIds(Arrays.asList(adPlan.getDatasourceId().split(StrUtil.COMMA)));
if (StrUtil.isNotBlank(adPlan.getReportTemplateId())) {
PqReport report = this.baseMapper.getPqReportById(adPlan.getReportTemplateId());
adPlanVO.setReportTemplateName(report.getName());
adPlanVO.setReportTemplateVersion(report.getVersion());
adPlanVO.setReportTemplateName(report.getName()+"_" + report.getVersion());
}
return adPlanVO;
}).collect(Collectors.toList());
@@ -149,7 +148,9 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
adPlan.setCode(this.generateCode());
if (param.getAssociateReport() == 1) {
String reportId = this.baseMapper.getReportIdByNameAndVersion(param.getReportTemplateName(), param.getReportTemplateVersion());
String reportTemplateName = param.getReportTemplateName();
String[] split = reportTemplateName.split("_");
String reportId = this.baseMapper.getReportIdByNameAndVersion(split[0], split[1]);
if (StrUtil.isNotBlank(reportId)) {
adPlan.setReportTemplateId(reportId);
}
@@ -180,7 +181,14 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
AdPlan plan2 = new AdPlan();
if (param.getAssociateReport() == 1) {
String reportId = this.baseMapper.getReportIdByNameAndVersion(param.getReportTemplateName(), param.getReportTemplateVersion());
String reportTemplateName = param.getReportTemplateName();
String[] split = reportTemplateName.split("_");
String reportId = this.baseMapper.getReportIdByNameAndVersion(split[0], split[1]);
if (plan1.getTestState() != CheckStateEnum.UNCHECKED.getValue()) {
if (!reportId.equals(plan1.getReportTemplateId())) {
throw new BusinessException(PlanResponseEnum.CANNOT_CHANGE_REPORT_WHEN_CHECKING);
}
}
if (StrUtil.isNotBlank(reportId)) {
plan2.setReportTemplateId(reportId);
}
@@ -196,15 +204,6 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
if (param.getAssociateReport() != plan1.getAssociateReport()) {
throw new BusinessException(PlanResponseEnum.CANNOT_CHANGE_REPORT_WHEN_CHECKING);
}
if (param.getAssociateReport() != plan1.getAssociateReport()) {
throw new BusinessException(PlanResponseEnum.CANNOT_CHANGE_REPORT_WHEN_CHECKING);
}
if (param.getAssociateReport() == 1) {
String reportId = this.baseMapper.getReportIdByNameAndVersion(param.getReportTemplateName(), param.getReportTemplateVersion());
if (!reportId.equals(plan1.getReportTemplateId())) {
throw new BusinessException(PlanResponseEnum.CANNOT_CHANGE_REPORT_WHEN_CHECKING);
}
}
}
BeanUtil.copyProperties(param, plan2);
@@ -352,7 +351,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
QueryWrapper<AdPlan> queryWrapper = new QueryWrapper<>();
if (ObjectUtil.isNotNull(queryParam)) {
queryWrapper.eq(StrUtil.isNotBlank(queryParam.getPattern()), "ad_plan.pattern", queryParam.getPattern())
.eq(StrUtil.isNotBlank(queryParam.getName()), "ad_plan.name", queryParam.getName())
.like(StrUtil.isNotBlank(queryParam.getName()), "ad_plan.name", queryParam.getName())
.eq(ObjectUtil.isNotNull(queryParam.getTestState()), "ad_plan.Test_State", queryParam.getTestState())
.eq(ObjectUtil.isNotNull(queryParam.getReportState()), "ad_plan.Report_State", queryParam.getReportState())
.eq(ObjectUtil.isNotNull(queryParam.getResult()), "ad_plan.result", queryParam.getResult());

View File

@@ -136,14 +136,4 @@ public class ReportController extends BaseController {
String methodDescribe = getMethodDescribe("listAllName");
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqReportService.listAllName(), methodDescribe);
}
@OperateInfo
@GetMapping("/listAllVersion")
@ApiOperation("根据名称查询指定报告模板的所有版本")
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
public HttpResult<List<String>> listAllVersion(@RequestParam String name) {
String methodDescribe = getMethodDescribe("listAllVersion");
LogUtil.njcnDebug(log, "{},查询参数为:{}", methodDescribe, name);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqReportService.listAllVersion(name), methodDescribe);
}
}

View File

@@ -8,4 +8,6 @@ public interface ReportValidMessage {
String NAME_NOT_BLANK = "报告模板名称不能为空";
String VERSION_NOT_BLANK = "报告模板版本号不能为空";
String ENABLE_NOT_NULL = "报告模板的启用状态不能为空";
String NAME_PATTERN_NOT_MATCH = "报告模板名称格式不正确";
String VERSION_PATTERN_NOT_MATCH = "报告模板版本号格式不正确";
}

View File

@@ -1,5 +1,6 @@
package com.njcn.gather.report.pojo.param;
import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.gather.report.pojo.constant.ReportValidMessage;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty;
@@ -9,6 +10,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
/**
* @author caozehui
@@ -19,10 +21,12 @@ public class ReportParam {
@ApiModelProperty(value = "报告模板名称", required = true)
@NotBlank(message = ReportValidMessage.NAME_NOT_BLANK)
@Pattern(regexp = PatternRegex.REPORT_NAME_REGEX, message = ReportValidMessage.NAME_PATTERN_NOT_MATCH)
private String name;
@ApiModelProperty(value = "版本号", required = true)
@NotBlank(message = ReportValidMessage.VERSION_NOT_BLANK)
@Pattern(regexp = PatternRegex.REPORT_VERSION_REGEX, message = ReportValidMessage.VERSION_PATTERN_NOT_MATCH)
private String version;
@ApiModelProperty(value = "描述信息", required = true)

View File

@@ -63,14 +63,6 @@ public interface IPqReportService extends IService<PqReport> {
*/
List<String> listAllName();
/**
* 根据报告name查询改模板的所有版本号
*
* @param name
* @return
*/
List<String> listAllVersion(String name);
void generateReport(DevReportParam devReportParam);
void downloadReport(DevReportParam devReportParam, HttpServletResponse response);

View File

@@ -214,17 +214,10 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
@Override
public List<String> listAllName() {
List<String> result = this.lambdaQuery()
.eq(PqReport::getState, DataStateEnum.ENABLE.getCode()).list().stream().map(PqReport::getName).distinct().collect(Collectors.toList());
return result;
}
@Override
public List<String> listAllVersion(String name) {
List<String> result = this.lambdaQuery().eq(PqReport::getName, name)
.eq(PqReport::getState, DataStateEnum.ENABLE.getCode())
.list().stream().map(PqReport::getVersion).collect(Collectors.toList());
return result;
List<PqReport> reportList = this.lambdaQuery()
.eq(PqReport::getState, DataStateEnum.ENABLE.getCode()).list();
List<String> collect = reportList.stream().map(pqReport -> pqReport.getName() + "_" + pqReport.getVersion()).collect(Collectors.toList());
return collect;
}
/**
@@ -1108,7 +1101,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
* @param enumByCode
* @return
*/
private XWPFTable generateTableBodyZJ(XWPFTable table,List<RawResultDataVO> rawResultDataVOS, DicDataEnum enumByCode) {
private XWPFTable generateTableBodyZJ(XWPFTable table, List<RawResultDataVO> rawResultDataVOS, DicDataEnum enumByCode) {
// 组装数据
getTableBodyDataZJ(rawResultDataVOS, enumByCode);
return table;

View File

@@ -41,8 +41,8 @@ import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
import com.njcn.gather.storage.pojo.vo.RawDataVO;
import com.njcn.gather.storage.service.AdHarmonicService;
import com.njcn.gather.storage.service.AdNonHarmonicService;
import com.njcn.gather.system.config.pojo.po.SysTestConfig;
import com.njcn.gather.system.config.service.ISysTestConfigService;
import com.njcn.gather.system.cfg.pojo.po.SysTestConfig;
import com.njcn.gather.system.cfg.service.ISysTestConfigService;
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
import com.njcn.gather.system.dictionary.service.IDictTreeService;