微调
This commit is contained in:
@@ -2,6 +2,7 @@ package com.njcn.gather.plan.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||
import com.njcn.gather.report.pojo.po.PqReport;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
@@ -9,5 +10,21 @@ import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||
*/
|
||||
public interface AdPlanMapper extends MPJBaseMapper<AdPlan> {
|
||||
|
||||
/**
|
||||
* 根据名称和版本获取报告id
|
||||
*
|
||||
* @param name
|
||||
* @param version
|
||||
* @return
|
||||
*/
|
||||
String getReportIdByNameAndVersion(String name, String version);
|
||||
|
||||
/**
|
||||
* 根据id获取报告模板
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
PqReport getPqReportById(String id);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,5 +3,19 @@
|
||||
<mapper namespace="com.njcn.gather.plan.mapper.AdPlanMapper">
|
||||
|
||||
|
||||
<select id="getReportIdByNameAndVersion" resultType="java.lang.String">
|
||||
SELECT id
|
||||
FROM pq_report
|
||||
WHERE name = #{name}
|
||||
AND version = #{version}
|
||||
and enable !=0
|
||||
</select>
|
||||
|
||||
<select id="getPqReportById" resultType="com.njcn.gather.report.pojo.po.PqReport">
|
||||
SELECT *
|
||||
FROM pq_report
|
||||
WHERE id = #{id}
|
||||
and enable !=0
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@ public enum PlanResponseEnum {
|
||||
SCRIPT_RELATE_DICT_NOT_EXIST("A003016","脚本关联的字典不存在"),
|
||||
NOT_CHECKED_PLAN_CANNOT_ANALYSE("A003017","只有检测状态为检测完成的计划才能进行统计分析" ),
|
||||
CANNOT_CHANGE_SCRIPT_WHEN_CHECKING("A003018","只有检测状态为未检时,才能修改检测脚本" ),
|
||||
CANNOT_CHANGE_ERROR_SYS_WHEN_CHECKING("A003019","只有检测状态为未检时,才能修改误差体系" );
|
||||
CANNOT_CHANGE_ERROR_SYS_WHEN_CHECKING("A003019","只有检测状态为未检时,才能修改误差体系" ),
|
||||
CANNOT_CHANGE_REPORT_WHEN_CHECKING("A003020","只有检测状态为未检时,才能修改绑定报告模板");
|
||||
|
||||
private final String message;
|
||||
private final String code;
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.gather.device.pojo.constant.DevValidMessage;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@@ -60,6 +61,15 @@ public class AdPlanParam {
|
||||
@NotNull(message = DevValidMessage.PQ_DEV_IDS_NOT_NULL)
|
||||
private List<String> devIds;
|
||||
|
||||
@ApiModelProperty(value = "是否关联报告")
|
||||
private Integer associateReport;
|
||||
|
||||
@ApiModelProperty(value = "报告模板名称")
|
||||
private String reportName;
|
||||
|
||||
@ApiModelProperty(value = "报告模板版本")
|
||||
private String reportVersion;
|
||||
|
||||
/**
|
||||
* 分页查询实体
|
||||
*/
|
||||
|
||||
@@ -78,6 +78,16 @@ public class AdPlan extends BaseEntity implements Serializable {
|
||||
*/
|
||||
private Integer code;
|
||||
|
||||
/**
|
||||
* 是否关联报告,0-不关联 1-关联
|
||||
*/
|
||||
private Integer associateReport;
|
||||
|
||||
/**
|
||||
* 报告模板ID,关联PQ_Report表
|
||||
*/
|
||||
private String reportTemplateId;
|
||||
|
||||
/**
|
||||
* 状态:0-删除 1-正常
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.gather.plan.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@@ -97,4 +98,19 @@ public class AdPlanVO {
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 是否关联报告,0-不关联 1-关联
|
||||
*/
|
||||
private Integer associateReport;
|
||||
|
||||
/**
|
||||
* 报告模板名称
|
||||
*/
|
||||
private String reportTemplateName;
|
||||
|
||||
/**
|
||||
* 报告模板版本号
|
||||
*/
|
||||
private String reportTemplateVersion;
|
||||
}
|
||||
|
||||
@@ -32,15 +32,14 @@ import com.njcn.gather.plan.pojo.vo.AdPlanExcel;
|
||||
import com.njcn.gather.plan.pojo.vo.AdPlanVO;
|
||||
import com.njcn.gather.plan.service.IAdPlanService;
|
||||
import com.njcn.gather.plan.service.IAdPlanSourceService;
|
||||
import com.njcn.gather.report.pojo.po.PqReport;
|
||||
import com.njcn.gather.script.pojo.po.PqScriptDtls;
|
||||
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||
import com.njcn.gather.script.service.IPqScriptService;
|
||||
import com.njcn.gather.source.pojo.po.PqSource;
|
||||
import com.njcn.gather.source.service.IPqSourceService;
|
||||
import com.njcn.gather.storage.mapper.DetectionDataDealMapper;
|
||||
import com.njcn.gather.storage.pojo.param.StorageParam;
|
||||
import com.njcn.gather.storage.service.AdHarmonicService;
|
||||
import com.njcn.gather.storage.service.AdNonHarmonicService;
|
||||
import com.njcn.gather.storage.service.TableGenService;
|
||||
import com.njcn.gather.system.config.pojo.po.SysTestConfig;
|
||||
import com.njcn.gather.system.config.service.ISysTestConfigService;
|
||||
@@ -106,6 +105,11 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
BeanUtil.copyProperties(adPlan, adPlanVO);
|
||||
adPlanVO.setCreateTime(adPlanVO.getCreateTime().replace("T", " "));
|
||||
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());
|
||||
}
|
||||
return adPlanVO;
|
||||
}).collect(Collectors.toList());
|
||||
adPlanVOList.forEach(adPlanVO -> {
|
||||
@@ -144,6 +148,13 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
adPlan.setResult(CheckResultEnum.UNCHECKED.getValue());
|
||||
adPlan.setCode(this.generateCode());
|
||||
|
||||
if (param.getAssociateReport() == 1) {
|
||||
String reportId = this.baseMapper.getReportIdByNameAndVersion(param.getReportName(), param.getReportVersion());
|
||||
if (StrUtil.isNotBlank(reportId)) {
|
||||
adPlan.setReportTemplateId(reportId);
|
||||
}
|
||||
}
|
||||
|
||||
// 新增检测计划、检测源关联
|
||||
adPlanSourceService.addAdPlanSource(planId, param.getSourceIds());
|
||||
if (ObjectUtil.isNotEmpty(param.getDevIds())) {
|
||||
@@ -167,6 +178,14 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
this.checkRepeat(param, true);
|
||||
AdPlan plan1 = this.getById(param.getId());
|
||||
AdPlan plan2 = new AdPlan();
|
||||
|
||||
if (param.getAssociateReport() == 1) {
|
||||
String reportId = this.baseMapper.getReportIdByNameAndVersion(param.getReportName(), param.getReportVersion());
|
||||
if (StrUtil.isNotBlank(reportId)) {
|
||||
plan2.setReportTemplateId(reportId);
|
||||
}
|
||||
}
|
||||
|
||||
if (plan1.getTestState() != CheckStateEnum.UNCHECKED.getValue()) {
|
||||
if (!plan1.getScriptId().equals(param.getScriptId())) {
|
||||
throw new BusinessException(PlanResponseEnum.CANNOT_CHANGE_SCRIPT_WHEN_CHECKING);
|
||||
@@ -379,7 +398,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
// scriptDtlsList = scriptDtlsList.stream().filter(obj -> !sortSet.contains(obj.getScriptIndex())).collect(Collectors.toList());
|
||||
// }
|
||||
StorageParam storageParam = new StorageParam();
|
||||
storageParam.setCode(adPlan.getCode()+"");
|
||||
storageParam.setCode(adPlan.getCode() + "");
|
||||
storageParam.setScriptId(adPlan.getScriptId());
|
||||
List<Integer> indexes = adHarmonicService.getIndex(storageParam, true);
|
||||
scriptDtlsList = scriptDtlsList.stream().filter(obj -> indexes.contains(obj.getScriptIndex())).collect(Collectors.toList());
|
||||
|
||||
Reference in New Issue
Block a user