调整检测计划导入、导出功能
This commit is contained in:
@@ -14,13 +14,11 @@ import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.gather.device.pojo.enums.DevResponseEnum;
|
||||
import com.njcn.gather.device.pojo.vo.CNDevExcel;
|
||||
import com.njcn.gather.plan.pojo.param.AdPlanParam;
|
||||
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.web.controller.BaseController;
|
||||
import com.njcn.web.utils.ExcelUtil;
|
||||
import com.njcn.web.utils.FileUtil;
|
||||
import com.njcn.web.utils.HttpResultUtil;
|
||||
import com.njcn.web.utils.PoiUtil;
|
||||
@@ -121,43 +119,32 @@ public class AdPlanController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 二楼检测计划导出
|
||||
*
|
||||
* @param queryParam
|
||||
*/
|
||||
@OperateInfo(operateType = OperateType.DOWNLOAD)
|
||||
@PostMapping("/exportCNPlan")
|
||||
@ApiOperation("二楼导出检测计划")
|
||||
@PostMapping("/export")
|
||||
@ApiOperation("导出检测计划")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public void exportCNPlan(@RequestBody @Validated AdPlanParam.QueryParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("export");
|
||||
public void exportPlan(@RequestBody @Validated AdPlanParam.QueryParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("exportPlan");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||
|
||||
adPlanService.exportCNPlan(queryParam);
|
||||
adPlanService.exportPlan(queryParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 二楼检测计划导出模板
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||
@PostMapping("/downloadCNPlanTemplate")
|
||||
@PostMapping("/downloadTemplate")
|
||||
@ApiOperation("下载二楼检测计划导出模板")
|
||||
public void downloadCNPlanTemplate() {
|
||||
adPlanService.downloadCNPlanTemplate();
|
||||
public void downloadTemplate() {
|
||||
adPlanService.downloadTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
* 二楼检测计划导入
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
|
||||
@PostMapping(value = "/importCNPlan")
|
||||
@ApiOperation("二楼导入检测计划数据")
|
||||
@PostMapping(value = "/import")
|
||||
@ApiOperation("导入检测计划数据")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "file", value = "检测计划数据文件", required = true),
|
||||
@ApiImplicitParam(name = "pattern", value = "模式Id", required = true)
|
||||
})
|
||||
public HttpResult<String> importCNPlan(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, HttpServletResponse response) {
|
||||
public HttpResult<String> importPlan(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, HttpServletResponse response) {
|
||||
String methodDescribe = getMethodDescribe("importCNPlan");
|
||||
LogUtil.njcnDebug(log, "{},上传文件为:{}", methodDescribe, file.getOriginalFilename());
|
||||
|
||||
@@ -165,86 +152,10 @@ public class AdPlanController extends BaseController {
|
||||
if (!fileType) {
|
||||
throw new BusinessException(CommonResponseEnum.FILE_XLSX_ERROR);
|
||||
}
|
||||
|
||||
ImportParams params = new ImportParams();
|
||||
params.setStartSheetIndex(0);
|
||||
params.setSheetNum(1);
|
||||
params.setHeadRows(2);
|
||||
params.setNeedVerify(true);
|
||||
|
||||
List<AdPlanExcel> planExcelList;
|
||||
try {
|
||||
ExcelImportResult<AdPlanExcel> excelImportResult = ExcelImportUtil.importExcelMore(file.getInputStream(), AdPlanExcel.class, params);
|
||||
if (excelImportResult.isVerifyFail()) {
|
||||
// 此处前端要做特殊处理,具体可以参考技术监督的数据导入
|
||||
Workbook failWorkbook = excelImportResult.getFailWorkbook();
|
||||
PoiUtil.exportFileByWorkbook(failWorkbook, "非法检测计划数据.xlsx", response);
|
||||
// throw new BusinessException(DevResponseEnum.IMPORT_DATA_FORMAT_FAIL);
|
||||
return null;
|
||||
} else {
|
||||
planExcelList = excelImportResult.getList();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(DevResponseEnum.IMPORT_DATA_FAIL);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(planExcelList)) {
|
||||
adPlanService.importCNPlan(planExcelList, patternId);
|
||||
}
|
||||
adPlanService.importPlan(file, patternId, response);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
//
|
||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
|
||||
// @PostMapping(value = "/import")
|
||||
// @ApiOperation("批量导入检测计划数据")
|
||||
// @ApiImplicitParams({
|
||||
// @ApiImplicitParam(name = "file", value = "检测计划数据文件", required = true),
|
||||
// @ApiImplicitParam(name = "pattern", value = "模式Id", required = true)
|
||||
// })
|
||||
// public HttpResult<String> importData(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, HttpServletResponse response) {
|
||||
// String methodDescribe = getMethodDescribe("importData");
|
||||
// LogUtil.njcnDebug(log, "{},上传文件为:{}, 模式Id为:{}", methodDescribe, file.getOriginalFilename(), patternId);
|
||||
//
|
||||
// boolean fileType = FileUtil.judgeFileIsExcel(file.getOriginalFilename());
|
||||
// if (!fileType) {
|
||||
// throw new BusinessException(CommonResponseEnum.FILE_XLSX_ERROR);
|
||||
// }
|
||||
// ImportParams params = new ImportParams();
|
||||
// params.setHeadRows(2);
|
||||
// params.setNeedVerify(true);
|
||||
// params.setStartSheetIndex(0);
|
||||
// params.setSheetNum(1);
|
||||
//
|
||||
// List<AdPlanExcel.ImportData> adPlanExcelList = null;
|
||||
// try {
|
||||
// ExcelImportResult<AdPlanExcel.ImportData> adPlanExcelResult = ExcelImportUtil.importExcelMore(file.getInputStream(), AdPlanExcel.ImportData.class, params);
|
||||
// if (adPlanExcelResult.isVerifyFail()) {
|
||||
// // 此处前端要做特殊处理,具体可以参考技术监督的数据导入
|
||||
// PoiUtil.exportFileByWorkbook(adPlanExcelResult.getFailWorkbook(), "非法检测计划数据.xlsx", response);
|
||||
// return null;
|
||||
// } else {
|
||||
// adPlanExcelList = adPlanExcelResult.getList();
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// throw new BusinessException(DevResponseEnum.IMPORT_DATA_FAIL, e.getMessage());
|
||||
// }
|
||||
// if (ObjectUtil.isNotEmpty(adPlanExcelList)) {
|
||||
// adPlanService.importData(patternId, adPlanExcelList);
|
||||
// }
|
||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
// }
|
||||
|
||||
// @OperateInfo
|
||||
// @GetMapping("/getPieData")
|
||||
// @ApiOperation("获取饼状图数据")
|
||||
// @ApiImplicitParam(name = "id", value = "检测计划id", required = true)
|
||||
// public HttpResult<List<List<Map<String, Object>>>> getPieData(@RequestParam("planId") String planId) {
|
||||
// String methodDescribe = getMethodDescribe("getPieData");
|
||||
// LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, planId);
|
||||
// List<List<Map<String, Object>>> result = pqDevService.getPieData(planId);
|
||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
// }
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getBigTestItem")
|
||||
@ApiOperation("获取检测大项数据")
|
||||
@@ -252,7 +163,7 @@ public class AdPlanController extends BaseController {
|
||||
public HttpResult<List<Map<String, String>>> getBigTestItem(@RequestBody AdPlanParam.CheckParam checkParam) {
|
||||
String methodDescribe = getMethodDescribe("getBigTestItem");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, checkParam);
|
||||
List<Map<String, String>> result = adPlanService.getBigTestItem(checkParam.getReCheckType(),checkParam.getPlanId(),checkParam.getDevId());
|
||||
List<Map<String, String>> result = adPlanService.getBigTestItem(checkParam.getReCheckType(), checkParam.getPlanId(), checkParam.getDevId());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import lombok.Getter;
|
||||
*/
|
||||
@Getter
|
||||
public enum DataSourceEnum {
|
||||
THREE_SENSE_ACTUAL_TIME_DATA("0", "3秒实时数据"),
|
||||
THREE_SENSE_ACTUAL_TIME_DATA("0", "3s实时数据"),
|
||||
|
||||
MINUTE_STATISTICS_MAX("1", "分钟统计数据-最大"),
|
||||
MINUTE_STATISTICS_MIN("2", "分钟统计数据-最小"),
|
||||
|
||||
@@ -62,7 +62,6 @@ public class AdPlanParam {
|
||||
private List<String> devIds;
|
||||
|
||||
@ApiModelProperty(value = "是否关联报告")
|
||||
@NotNull(message = DevValidMessage.ASSOCIATE_REPORT_NOT_NULL)
|
||||
private Integer associateReport;
|
||||
|
||||
@ApiModelProperty(value = "报告模板名称")
|
||||
|
||||
@@ -34,7 +34,7 @@ public class AdPlanExcel {
|
||||
@NotBlank(message = DevValidMessage.DATASOURCE_NOT_BLANK)
|
||||
private String datasourceId;
|
||||
|
||||
@Excel(name = "脚本*", width = 50, needMerge = true, orderNum = "3")
|
||||
@Excel(name = "脚本*", width = 100, needMerge = true, orderNum = "3")
|
||||
@NotBlank(message = DevValidMessage.SCRIPT_NOT_BLANK)
|
||||
private String scriptId;
|
||||
|
||||
@@ -57,7 +57,4 @@ public class AdPlanExcel {
|
||||
@Excel(name = "检测结果*", width = 10, replace = {"不符合_0", "符合_1", "未检_2"}, needMerge = true, orderNum = "8")
|
||||
@NotNull(message = DevValidMessage.CHECK_RESULT_STATE_NOT_NULL)
|
||||
private Integer result;
|
||||
|
||||
@ExcelCollection(name = "绑定的设备", orderNum = "9")
|
||||
private List<CNDevExcel> devices;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.njcn.gather.plan.pojo.vo;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
|
||||
import com.njcn.gather.device.pojo.vo.CNDevExcel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2025-03-25
|
||||
*/
|
||||
@Data
|
||||
public class CNPlanExcel extends AdPlanExcel {
|
||||
|
||||
|
||||
@ExcelCollection(name = "绑定的设备", orderNum = "9")
|
||||
private List<CNDevExcel> devices;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.njcn.gather.plan.pojo.vo;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
|
||||
import com.njcn.gather.device.pojo.vo.ProvinceDevExcel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2025-03-25
|
||||
*/
|
||||
@Data
|
||||
public class ProvincePlanExcel extends AdPlanExcel {
|
||||
|
||||
@ExcelCollection(name = "绑定的设备", orderNum = "9")
|
||||
private List<ProvinceDevExcel> devices;
|
||||
}
|
||||
@@ -6,7 +6,9 @@ import com.njcn.gather.plan.pojo.param.AdPlanParam;
|
||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||
import com.njcn.gather.plan.pojo.vo.AdPlanExcel;
|
||||
import com.njcn.gather.plan.pojo.vo.AdPlanVO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -56,26 +58,6 @@ public interface IAdPlanService extends IService<AdPlan> {
|
||||
*/
|
||||
List<Map<String, Object>> listByPattern(String pattern);
|
||||
|
||||
/**
|
||||
* 二楼下载检测计划模板
|
||||
*/
|
||||
void downloadCNPlanTemplate();
|
||||
|
||||
/**
|
||||
* 二楼导出检测计划数据
|
||||
*
|
||||
* @param queryParam 查询参数
|
||||
*/
|
||||
void exportCNPlan(AdPlanParam.QueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 二楼导入检测计划
|
||||
*
|
||||
* @param planExcelList
|
||||
* @param patternId
|
||||
*/
|
||||
void importCNPlan(List<AdPlanExcel> planExcelList, String patternId);
|
||||
|
||||
/**
|
||||
* 可视化
|
||||
*
|
||||
@@ -119,4 +101,25 @@ public interface IAdPlanService extends IService<AdPlan> {
|
||||
* @param ids
|
||||
*/
|
||||
void analyse(List<String> ids);
|
||||
|
||||
/**
|
||||
* 导出检测计划数据
|
||||
*
|
||||
* @param queryParam
|
||||
*/
|
||||
void exportPlan(AdPlanParam.QueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 下载检测计划模板
|
||||
*/
|
||||
void downloadTemplate();
|
||||
|
||||
/**
|
||||
* 导入检测计划数据
|
||||
*
|
||||
* @param file
|
||||
* @param patternId
|
||||
* @param response
|
||||
*/
|
||||
void importPlan(MultipartFile file, String patternId, HttpServletResponse response);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.njcn.gather.plan.service.impl;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
@@ -19,6 +22,7 @@ import com.njcn.gather.device.pojo.enums.*;
|
||||
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.pojo.vo.CNDevExcel;
|
||||
import com.njcn.gather.device.pojo.vo.ProvinceDevExcel;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.err.pojo.po.PqErrSys;
|
||||
import com.njcn.gather.err.service.IPqErrSysService;
|
||||
@@ -28,8 +32,9 @@ import com.njcn.gather.plan.pojo.enums.PlanReportStateEnum;
|
||||
import com.njcn.gather.plan.pojo.enums.PlanResponseEnum;
|
||||
import com.njcn.gather.plan.pojo.param.AdPlanParam;
|
||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||
import com.njcn.gather.plan.pojo.vo.AdPlanExcel;
|
||||
import com.njcn.gather.plan.pojo.vo.AdPlanVO;
|
||||
import com.njcn.gather.plan.pojo.vo.CNPlanExcel;
|
||||
import com.njcn.gather.plan.pojo.vo.ProvincePlanExcel;
|
||||
import com.njcn.gather.plan.service.IAdPlanService;
|
||||
import com.njcn.gather.plan.service.IAdPlanSourceService;
|
||||
import com.njcn.gather.report.pojo.po.PqReport;
|
||||
@@ -41,6 +46,7 @@ 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.cfg.pojo.enums.SceneEnum;
|
||||
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;
|
||||
@@ -54,6 +60,7 @@ import com.njcn.gather.type.service.IDevTypeService;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.ExcelUtil;
|
||||
import com.njcn.web.utils.HttpServletUtil;
|
||||
import com.njcn.web.utils.PoiUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
@@ -65,6 +72,7 @@ import org.openxmlformats.schemas.drawingml.x2006.chart.CTBarSer;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -107,7 +115,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()+"_" + report.getVersion());
|
||||
adPlanVO.setReportTemplateName(report.getName() + "_" + report.getVersion());
|
||||
}
|
||||
return adPlanVO;
|
||||
}).collect(Collectors.toList());
|
||||
@@ -129,7 +137,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean addAdPlan(AdPlanParam param) {
|
||||
this.checkRepeat(param, false);
|
||||
AdPlan adPlan = new AdPlan();
|
||||
@@ -147,7 +155,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
adPlan.setResult(CheckResultEnum.UNCHECKED.getValue());
|
||||
adPlan.setCode(this.generateCode());
|
||||
|
||||
if (param.getAssociateReport() == 1) {
|
||||
if (param.getAssociateReport() != null && param.getAssociateReport() == 1) {
|
||||
String reportTemplateName = param.getReportTemplateName();
|
||||
String[] split = reportTemplateName.split("_");
|
||||
String reportId = this.baseMapper.getReportIdByNameAndVersion(split[0], split[1]);
|
||||
@@ -174,13 +182,13 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean updateAdPlan(AdPlanParam.UpdateParam param) {
|
||||
this.checkRepeat(param, true);
|
||||
AdPlan plan1 = this.getById(param.getId());
|
||||
AdPlan plan2 = new AdPlan();
|
||||
|
||||
if (param.getAssociateReport() == 1) {
|
||||
if (param.getAssociateReport() != null && param.getAssociateReport() == 1) {
|
||||
String reportTemplateName = param.getReportTemplateName();
|
||||
String[] split = reportTemplateName.split("_");
|
||||
String reportId = this.baseMapper.getReportIdByNameAndVersion(split[0], split[1]);
|
||||
@@ -201,7 +209,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
if (!plan1.getErrorSysId().equals(param.getErrorSysId())) {
|
||||
throw new BusinessException(PlanResponseEnum.CANNOT_CHANGE_ERROR_SYS_WHEN_CHECKING);
|
||||
}
|
||||
if (param.getAssociateReport() != plan1.getAssociateReport()) {
|
||||
if (param.getAssociateReport() != null && param.getAssociateReport() != plan1.getAssociateReport()) {
|
||||
throw new BusinessException(PlanResponseEnum.CANNOT_CHANGE_REPORT_WHEN_CHECKING);
|
||||
}
|
||||
}
|
||||
@@ -216,7 +224,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean deleteAdPlan(List<String> ids) {
|
||||
for (String id : ids) {
|
||||
PqDevParam.QueryParam queryParam = new PqDevParam.QueryParam();
|
||||
@@ -270,96 +278,6 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadCNPlanTemplate() {
|
||||
ExcelUtil.exportExcelPullDown(new ExportParams(), "检测计划模板.xlsx", 2, this.getPullDownList(), AdPlanExcel.class, Collections.emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportCNPlan(AdPlanParam.QueryParam queryParam) {
|
||||
List<AdPlan> planList = this.list(this.getQueryWrapper(queryParam));
|
||||
this.visualize(planList);
|
||||
List<AdPlanExcel> planExcelList = BeanUtil.copyToList(planList, AdPlanExcel.class);
|
||||
for (int i = 0; i < planList.size(); i++) {
|
||||
List<PqSource> pqSources = adPlanSourceService.listPqSourceByPlanId(planList.get(i).getId());
|
||||
planExcelList.get(i).setSource(pqSources.stream().map(PqSource::getName).collect(Collectors.joining(StrUtil.COMMA)));
|
||||
|
||||
PqDevParam.QueryParam queryParam1 = new PqDevParam.QueryParam();
|
||||
queryParam1.setPlanId(planList.get(i).getId());
|
||||
List<PqDev> pqDevs = pqDevService.listByPlanId(queryParam1);
|
||||
pqDevService.visualizeCNDev(pqDevs);
|
||||
List<CNDevExcel> deviceExportData = BeanUtil.copyToList(pqDevs, CNDevExcel.class);
|
||||
planExcelList.get(i).setDevices(deviceExportData);
|
||||
}
|
||||
ExcelUtil.exportExcelPullDown(new ExportParams(), "检测计划导出数据.xlsx", 2, this.getPullDownList(), AdPlanExcel.class, planExcelList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importCNPlan(List<AdPlanExcel> planExcelList, String patternId) {
|
||||
List<AdPlan> adPlans = BeanUtil.copyToList(planExcelList, AdPlan.class);
|
||||
|
||||
String patternCode = dictDataService.getDictDataById(patternId).getCode();
|
||||
for (int i = 0; i < adPlans.size(); i++) {
|
||||
AdPlanExcel adPlanExcel = planExcelList.get(i);
|
||||
AdPlanParam adPlanParam = new AdPlanParam();
|
||||
adPlanParam.setName(adPlanExcel.getName());
|
||||
adPlanParam.setPattern(patternId);
|
||||
checkRepeat(adPlanParam, false);
|
||||
|
||||
String planId = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
adPlans.get(i).setId(planId);
|
||||
adPlans.get(i).setPattern(patternId);
|
||||
Integer code = this.generateCode();
|
||||
adPlans.get(i).setCode(code);
|
||||
|
||||
tableGenService.deleteTable(Arrays.asList(code.toString()));
|
||||
tableGenService.genAdNonHarmonicTable(code.toString());
|
||||
|
||||
String source = adPlanExcel.getSource();
|
||||
String[] sourceNames = source.split(StrUtil.COMMA);
|
||||
// 若非比对模式,检测源、数据源有2个以上时,不导入
|
||||
if (!PatternEnum.CONTRAST.getValue().equals(patternCode) && sourceNames.length > 1) {
|
||||
throw new BusinessException(DevResponseEnum.IMPORT_SOURCE_ERROR);
|
||||
}
|
||||
|
||||
String datasource = adPlanExcel.getDatasourceId();
|
||||
String[] datasourceIds = datasource.split(StrUtil.COMMA);
|
||||
// 若非比对模式,数据源有2个以上时,不导入
|
||||
if (!PatternEnum.CONTRAST.getValue().equals(patternCode) && datasourceIds.length > 1) {
|
||||
throw new BusinessException(DevResponseEnum.IMPORT_DATASOURCE_ERROR);
|
||||
}
|
||||
|
||||
List<String> sourceIds = pqSourceService.listPqSourceIdByName(sourceNames);
|
||||
adPlanSourceService.addAdPlanSource(planId, sourceIds);
|
||||
|
||||
List<CNDevExcel> cnDevExcelList = adPlanExcel.getDevices();
|
||||
pqDevService.importCNDev(cnDevExcelList, patternId, planId);
|
||||
}
|
||||
// 逆向可视化
|
||||
this.reverseVisualize(adPlans);
|
||||
this.saveBatch(adPlans);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取查询条件wrapper
|
||||
*
|
||||
* @param queryParam 查询条件
|
||||
* @return
|
||||
*/
|
||||
private Wrapper getQueryWrapper(AdPlanParam.QueryParam queryParam) {
|
||||
QueryWrapper<AdPlan> queryWrapper = new QueryWrapper<>();
|
||||
if (ObjectUtil.isNotNull(queryParam)) {
|
||||
queryWrapper.eq(StrUtil.isNotBlank(queryParam.getPattern()), "ad_plan.pattern", queryParam.getPattern())
|
||||
.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());
|
||||
}
|
||||
queryWrapper.eq("ad_plan.state", DataStateEnum.ENABLE.getCode()).orderByDesc("Create_Time");
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visualize(List<AdPlan> planList) {
|
||||
planList.forEach(adPlan -> {
|
||||
@@ -539,6 +457,279 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportPlan(AdPlanParam.QueryParam queryParam) {
|
||||
String currrentScene = sysTestConfigService.getCurrrentScene();
|
||||
SceneEnum sceneEnum = SceneEnum.getSceneEnum(currrentScene);
|
||||
switch (sceneEnum) {
|
||||
case PROVINCE_PLATFORM:
|
||||
this.exportProvincePlan(queryParam);
|
||||
break;
|
||||
case LEAVE_FACTORY_TEST:
|
||||
this.exportCNPlan(queryParam);
|
||||
break;
|
||||
case SELF_TEST:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadTemplate() {
|
||||
String currrentScene = sysTestConfigService.getCurrrentScene();
|
||||
SceneEnum sceneEnum = SceneEnum.getSceneEnum(currrentScene);
|
||||
switch (sceneEnum) {
|
||||
case PROVINCE_PLATFORM:
|
||||
ExcelUtil.exportExcelPullDown(new ExportParams(), "检测计划模板.xlsx", 2, this.getPullDownList(SceneEnum.PROVINCE_PLATFORM), ProvincePlanExcel.class, Collections.emptyList());
|
||||
break;
|
||||
case LEAVE_FACTORY_TEST:
|
||||
ExcelUtil.exportExcelPullDown(new ExportParams(), "检测计划模板.xlsx", 2, this.getPullDownList(SceneEnum.LEAVE_FACTORY_TEST), CNPlanExcel.class, Collections.emptyList());
|
||||
break;
|
||||
case SELF_TEST:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void importPlan(MultipartFile file, String patternId, HttpServletResponse response) {
|
||||
String currrentScene = sysTestConfigService.getCurrrentScene();
|
||||
SceneEnum sceneEnum = SceneEnum.getSceneEnum(currrentScene);
|
||||
switch (sceneEnum) {
|
||||
case PROVINCE_PLATFORM:
|
||||
this.importProvincePlan(file, patternId, response);
|
||||
break;
|
||||
case LEAVE_FACTORY_TEST:
|
||||
this.importCNPlan(file, patternId, response);
|
||||
break;
|
||||
case SELF_TEST:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 省级平台导出检测计划数据
|
||||
*
|
||||
* @param queryParam
|
||||
*/
|
||||
private void exportProvincePlan(AdPlanParam.QueryParam queryParam) {
|
||||
List<AdPlan> planList = this.list(this.getQueryWrapper(queryParam));
|
||||
this.visualize(planList);
|
||||
List<ProvincePlanExcel> planExcelList = BeanUtil.copyToList(planList, ProvincePlanExcel.class);
|
||||
for (int i = 0; i < planList.size(); i++) {
|
||||
List<PqSource> pqSources = adPlanSourceService.listPqSourceByPlanId(planList.get(i).getId());
|
||||
planExcelList.get(i).setSource(pqSources.stream().map(PqSource::getName).collect(Collectors.joining(StrUtil.COMMA)));
|
||||
|
||||
PqDevParam.QueryParam queryParam1 = new PqDevParam.QueryParam();
|
||||
queryParam1.setPlanId(planList.get(i).getId());
|
||||
List<PqDev> pqDevs = pqDevService.listByPlanId(queryParam1);
|
||||
pqDevService.visualizeProvinceDev(pqDevs);
|
||||
List<ProvinceDevExcel> deviceExportData = BeanUtil.copyToList(pqDevs, ProvinceDevExcel.class);
|
||||
planExcelList.get(i).setDevices(deviceExportData);
|
||||
}
|
||||
ExcelUtil.exportExcelPullDown(new ExportParams(), "检测计划导出数据.xlsx", 2, this.getPullDownList(SceneEnum.PROVINCE_PLATFORM), ProvincePlanExcel.class, planExcelList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 二楼导出检测计划数据
|
||||
*
|
||||
* @param queryParam 查询参数
|
||||
*/
|
||||
private void exportCNPlan(AdPlanParam.QueryParam queryParam) {
|
||||
List<AdPlan> planList = this.list(this.getQueryWrapper(queryParam));
|
||||
this.visualize(planList);
|
||||
List<CNPlanExcel> planExcelList = BeanUtil.copyToList(planList, CNPlanExcel.class);
|
||||
for (int i = 0; i < planList.size(); i++) {
|
||||
List<PqSource> pqSources = adPlanSourceService.listPqSourceByPlanId(planList.get(i).getId());
|
||||
planExcelList.get(i).setSource(pqSources.stream().map(PqSource::getName).collect(Collectors.joining(StrUtil.COMMA)));
|
||||
|
||||
PqDevParam.QueryParam queryParam1 = new PqDevParam.QueryParam();
|
||||
queryParam1.setPlanId(planList.get(i).getId());
|
||||
List<PqDev> pqDevs = pqDevService.listByPlanId(queryParam1);
|
||||
pqDevService.visualizeCNDev(pqDevs);
|
||||
List<CNDevExcel> deviceExportData = BeanUtil.copyToList(pqDevs, CNDevExcel.class);
|
||||
planExcelList.get(i).setDevices(deviceExportData);
|
||||
}
|
||||
ExcelUtil.exportExcelPullDown(new ExportParams(), "检测计划导出数据.xlsx", 2, this.getPullDownList(SceneEnum.LEAVE_FACTORY_TEST), CNPlanExcel.class, planExcelList);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void importCNPlan(MultipartFile file, String patternId, HttpServletResponse response) {
|
||||
ImportParams params = new ImportParams();
|
||||
params.setStartSheetIndex(0);
|
||||
params.setSheetNum(1);
|
||||
params.setHeadRows(2);
|
||||
params.setNeedVerify(true);
|
||||
|
||||
List<CNPlanExcel> planExcelList = null;
|
||||
try {
|
||||
ExcelImportResult<CNPlanExcel> excelImportResult = ExcelImportUtil.importExcelMore(file.getInputStream(), CNPlanExcel.class, params);
|
||||
if (excelImportResult.isVerifyFail()) {
|
||||
// 此处前端要做特殊处理,具体可以参考技术监督的数据导入
|
||||
Workbook failWorkbook = excelImportResult.getFailWorkbook();
|
||||
PoiUtil.exportFileByWorkbook(failWorkbook, "非法检测计划数据.xlsx", response);
|
||||
} else {
|
||||
planExcelList = excelImportResult.getList();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(DevResponseEnum.IMPORT_DATA_FAIL);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(planExcelList)) {
|
||||
this.importCNPlan(planExcelList, patternId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 二楼导入检测计划
|
||||
*
|
||||
* @param planExcelList
|
||||
* @param patternId
|
||||
*/
|
||||
@Transactional
|
||||
public void importCNPlan(List<CNPlanExcel> planExcelList, String patternId) {
|
||||
List<AdPlan> adPlans = BeanUtil.copyToList(planExcelList, AdPlan.class);
|
||||
|
||||
String patternCode = dictDataService.getDictDataById(patternId).getCode();
|
||||
for (int i = 0; i < adPlans.size(); i++) {
|
||||
CNPlanExcel planExcel = planExcelList.get(i);
|
||||
AdPlanParam adPlanParam = new AdPlanParam();
|
||||
adPlanParam.setName(planExcel.getName());
|
||||
adPlanParam.setPattern(patternId);
|
||||
checkRepeat(adPlanParam, false);
|
||||
|
||||
String planId = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
adPlans.get(i).setId(planId);
|
||||
adPlans.get(i).setPattern(patternId);
|
||||
Integer code = this.generateCode();
|
||||
adPlans.get(i).setCode(code);
|
||||
|
||||
tableGenService.deleteTable(Arrays.asList(code.toString()));
|
||||
tableGenService.genAdNonHarmonicTable(code.toString());
|
||||
|
||||
String source = planExcel.getSource();
|
||||
String[] sourceNames = source.split(StrUtil.COMMA);
|
||||
// 若非比对模式,检测源、数据源有2个以上时,不导入
|
||||
if (!PatternEnum.CONTRAST.getValue().equals(patternCode) && sourceNames.length > 1) {
|
||||
throw new BusinessException(DevResponseEnum.IMPORT_SOURCE_ERROR);
|
||||
}
|
||||
|
||||
String datasource = planExcel.getDatasourceId();
|
||||
String[] datasourceIds = datasource.split(StrUtil.COMMA);
|
||||
// 若非比对模式,数据源有2个以上时,不导入
|
||||
if (!PatternEnum.CONTRAST.getValue().equals(patternCode) && datasourceIds.length > 1) {
|
||||
throw new BusinessException(DevResponseEnum.IMPORT_DATASOURCE_ERROR);
|
||||
}
|
||||
|
||||
List<String> sourceIds = pqSourceService.listPqSourceIdByName(sourceNames);
|
||||
adPlanSourceService.addAdPlanSource(planId, sourceIds);
|
||||
|
||||
List<CNDevExcel> cnDevExcelList = planExcel.getDevices();
|
||||
pqDevService.importCNDev(cnDevExcelList, patternId, planId);
|
||||
}
|
||||
// 逆向可视化
|
||||
this.reverseVisualize(adPlans);
|
||||
this.saveBatch(adPlans);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void importProvincePlan(MultipartFile file, String patternId, HttpServletResponse response) {
|
||||
ImportParams params = new ImportParams();
|
||||
params.setStartSheetIndex(0);
|
||||
params.setSheetNum(1);
|
||||
params.setHeadRows(2);
|
||||
params.setNeedVerify(true);
|
||||
|
||||
List<ProvincePlanExcel> planExcelList = null;
|
||||
try {
|
||||
ExcelImportResult<ProvincePlanExcel> excelImportResult = ExcelImportUtil.importExcelMore(file.getInputStream(), ProvincePlanExcel.class, params);
|
||||
if (excelImportResult.isVerifyFail()) {
|
||||
// 此处前端要做特殊处理,具体可以参考技术监督的数据导入
|
||||
Workbook failWorkbook = excelImportResult.getFailWorkbook();
|
||||
PoiUtil.exportFileByWorkbook(failWorkbook, "非法检测计划数据.xlsx", response);
|
||||
} else {
|
||||
planExcelList = excelImportResult.getList();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(DevResponseEnum.IMPORT_DATA_FAIL);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(planExcelList)) {
|
||||
this.importProvincePlan(planExcelList, patternId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 省级平台导入检测计划
|
||||
*
|
||||
* @param planExcelList
|
||||
* @param patternId
|
||||
*/
|
||||
public void importProvincePlan(List<ProvincePlanExcel> planExcelList, String patternId) {
|
||||
List<AdPlan> adPlans = BeanUtil.copyToList(planExcelList, AdPlan.class);
|
||||
|
||||
String patternCode = dictDataService.getDictDataById(patternId).getCode();
|
||||
for (int i = 0; i < adPlans.size(); i++) {
|
||||
ProvincePlanExcel planExcel = planExcelList.get(i);
|
||||
AdPlanParam adPlanParam = new AdPlanParam();
|
||||
adPlanParam.setName(planExcel.getName());
|
||||
adPlanParam.setPattern(patternId);
|
||||
checkRepeat(adPlanParam, false);
|
||||
|
||||
String planId = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
adPlans.get(i).setId(planId);
|
||||
adPlans.get(i).setPattern(patternId);
|
||||
Integer code = this.generateCode();
|
||||
adPlans.get(i).setCode(code);
|
||||
|
||||
tableGenService.deleteTable(Arrays.asList(code.toString()));
|
||||
tableGenService.genAdNonHarmonicTable(code.toString());
|
||||
|
||||
String source = planExcel.getSource();
|
||||
String[] sourceNames = source.split(StrUtil.COMMA);
|
||||
// 若非比对模式,检测源、数据源有2个以上时,不导入
|
||||
if (!PatternEnum.CONTRAST.getValue().equals(patternCode) && sourceNames.length > 1) {
|
||||
throw new BusinessException(DevResponseEnum.IMPORT_SOURCE_ERROR);
|
||||
}
|
||||
|
||||
String datasource = planExcel.getDatasourceId();
|
||||
String[] datasourceIds = datasource.split(StrUtil.COMMA);
|
||||
// 若非比对模式,数据源有2个以上时,不导入
|
||||
if (!PatternEnum.CONTRAST.getValue().equals(patternCode) && datasourceIds.length > 1) {
|
||||
throw new BusinessException(DevResponseEnum.IMPORT_DATASOURCE_ERROR);
|
||||
}
|
||||
|
||||
List<String> sourceIds = pqSourceService.listPqSourceIdByName(sourceNames);
|
||||
adPlanSourceService.addAdPlanSource(planId, sourceIds);
|
||||
|
||||
List<ProvinceDevExcel> cnDevExcelList = planExcel.getDevices();
|
||||
pqDevService.importProvinceDev(cnDevExcelList, patternId, planId);
|
||||
}
|
||||
// 逆向可视化
|
||||
this.reverseVisualize(adPlans);
|
||||
this.saveBatch(adPlans);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取查询条件wrapper
|
||||
*
|
||||
* @param queryParam 查询条件
|
||||
* @return
|
||||
*/
|
||||
private Wrapper getQueryWrapper(AdPlanParam.QueryParam queryParam) {
|
||||
QueryWrapper<AdPlan> queryWrapper = new QueryWrapper<>();
|
||||
if (ObjectUtil.isNotNull(queryParam)) {
|
||||
queryWrapper.eq(StrUtil.isNotBlank(queryParam.getPattern()), "ad_plan.pattern", queryParam.getPattern())
|
||||
.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());
|
||||
}
|
||||
queryWrapper.eq("ad_plan.state", DataStateEnum.ENABLE.getCode()).orderByDesc("Create_Time");
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取备注信息
|
||||
@@ -828,10 +1019,22 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
}
|
||||
}
|
||||
|
||||
private List<PullDown> getPullDownList() {
|
||||
private List<PullDown> getPullDownList(SceneEnum scene) {
|
||||
List<PullDown> pullDowns = new ArrayList<>();
|
||||
|
||||
PullDown pullDown = null;
|
||||
// 数据源
|
||||
DictType dictType = dictTypeService.getByCode("Datasource");
|
||||
if (ObjectUtil.isNotNull(dictType)) {
|
||||
List<DictData> dictDataList = dictDataService.getDictDataByTypeId(dictType.getId());
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(2);
|
||||
pullDown.setLastCol(2);
|
||||
pullDown.setStrings(dictDataList.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
}
|
||||
|
||||
// 检测脚本
|
||||
List<Map<String, Object>> maps1 = pqScriptService.listAllPqScript(null);
|
||||
List<String> scriptNameList = maps1.stream().map(m -> (String) m.get("name")).collect(Collectors.toList());
|
||||
@@ -877,56 +1080,20 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
pullDown.setStrings(Arrays.asList(CheckResultEnum.UNCHECKED.getMsg(), CheckResultEnum.ACCORD.getMsg(), CheckResultEnum.UNCHECKED.getMsg()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
// 预投计划
|
||||
List<DictData> dictDataList = null;
|
||||
pullDown = new PullDown();
|
||||
|
||||
DictType dictType = dictTypeService.getByCode("Preinvestment_Plan");
|
||||
if (ObjectUtil.isNotNull(dictType)) {
|
||||
dictDataList = dictDataService.getDictDataByTypeId(dictType.getId());
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(9);
|
||||
pullDown.setLastCol(9);
|
||||
pullDown.setStrings(dictDataList.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
switch (scene) {
|
||||
case PROVINCE_PLATFORM:
|
||||
List<PullDown> provinceDevPullDownList = pqDevService.getProvinceDevPullDownList(9);
|
||||
pullDowns.addAll(provinceDevPullDownList);
|
||||
break;
|
||||
case LEAVE_FACTORY_TEST:
|
||||
List<PullDown> cnDevPullDownList = pqDevService.getCNDevPullDownList(9);
|
||||
pullDowns.addAll(cnDevPullDownList);
|
||||
break;
|
||||
case SELF_TEST:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// 设备类型
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(11);
|
||||
pullDown.setLastCol(11);
|
||||
pullDown.setStrings(devTypeService.listAll().stream().map(DevType::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
// 通讯协议
|
||||
dictType = dictTypeService.getByCode("Protocol");
|
||||
if (ObjectUtil.isNotNull(dictType)) {
|
||||
dictDataList = dictDataService.getDictDataByTypeId(dictType.getId());
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(12);
|
||||
pullDown.setLastCol(12);
|
||||
pullDown.setStrings(dictDataList.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
}
|
||||
|
||||
// 是否为加密版本
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(13);
|
||||
pullDown.setLastCol(13);
|
||||
pullDown.setStrings(Arrays.asList("是", "否"));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
|
||||
// 是否支持系数校准
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(16);
|
||||
pullDown.setLastCol(16);
|
||||
pullDown.setStrings(Arrays.asList("是", "否"));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
|
||||
return pullDowns;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class AdPlanSourceServiceImpl extends ServiceImpl<AdPlanSourceMapper, AdP
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean addAdPlanSource(String planId, List<String> sourceIds) {
|
||||
List<AdPlanSource> adPlanSourceList = new ArrayList<>();
|
||||
for (String sourceId : sourceIds) {
|
||||
@@ -42,7 +42,7 @@ public class AdPlanSourceServiceImpl extends ServiceImpl<AdPlanSourceMapper, AdP
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean deleteAdPlanSourceByPlanIds(List<String> planIds) {
|
||||
QueryWrapper<AdPlanSource> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("ad_plan_source.Plan_Id", planIds);
|
||||
@@ -50,7 +50,7 @@ public class AdPlanSourceServiceImpl extends ServiceImpl<AdPlanSourceMapper, AdP
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean updateAdPlanSource(String planId, List<String> sourceIds) {
|
||||
this.deleteAdPlanSourceByPlanIds(Collections.singletonList(planId));
|
||||
this.addAdPlanSource(planId, sourceIds);
|
||||
|
||||
Reference in New Issue
Block a user