调整检测计划导入、导出功能
This commit is contained in:
@@ -53,21 +53,6 @@ public class PqDevController extends BaseController {
|
||||
private final IPqDevService pqDevService;
|
||||
private final IDevTypeService devTypeService;
|
||||
|
||||
|
||||
@OperateInfo
|
||||
@GetMapping("/aaa")
|
||||
@ApiOperation("分页查询被检设备")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public HttpResult<List<PreDetection>> aaa() {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
List<PreDetection> devInfo = pqDevService.getDevInfo(Arrays.asList("578c142b7e4e4978a35bd6225aa62a23", "393504f55f1f79bce255bfc195cfdb56"));
|
||||
Map<String, List<PreDetection>> map = new HashMap();
|
||||
map.put("deviceList", devInfo);
|
||||
String jsonString = JSON.toJSONString(map);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, devInfo, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo
|
||||
@PostMapping("/list")
|
||||
@ApiOperation("分页查询被检设备")
|
||||
@@ -170,107 +155,6 @@ public class PqDevController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
|
||||
// @PostMapping(value = "/importContrast")
|
||||
// @ApiOperation("批量导入被检设备数据")
|
||||
// @ApiImplicitParam(name = "file", value = "被检设备数据文件", required = true)
|
||||
// public HttpResult<Object> importContrastData(@RequestParam("file") MultipartFile file, HttpServletResponse response) {
|
||||
// String methodDescribe = getMethodDescribe("importContrastData");
|
||||
// LogUtil.njcnDebug(log, "{},上传文件为:{}", methodDescribe, file.getOriginalFilename());
|
||||
// ImportParams params = new ImportParams();
|
||||
// params.setHeadRows(2);
|
||||
// params.setNeedVerify(true);
|
||||
// params.setStartSheetIndex(0);
|
||||
// params.setSheetNum(1);
|
||||
// try {
|
||||
// ExcelImportResult<PqDevExcel.ContrastImportData> excelImportResult = ExcelImportUtil.importExcelMore(file.getInputStream(), PqDevExcel.ContrastImportData.class, params);
|
||||
// //如果存在非法数据,将不合格的数据导出
|
||||
// if (excelImportResult.isVerifyFail()) {
|
||||
// // 此处前端要做特殊处理,具体可以参考技术监督的数据导入
|
||||
// Workbook failWorkbook = excelImportResult.getFailWorkbook();
|
||||
// PoiUtil.exportFileByWorkbook(failWorkbook, "非法被检设备数据.xlsx", response);
|
||||
// } else {
|
||||
// //批量录入数据
|
||||
// List<PqDevExcel.ContrastImportData> list = excelImportResult.getList();
|
||||
// pqDevService.importContrastData(list);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// throw new BusinessException(DevResponseEnum.IMPORT_DATA_FAIL);
|
||||
// }
|
||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 导出灿能二楼设备
|
||||
*
|
||||
* @param queryParam
|
||||
*/
|
||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||
// @PostMapping("/exportCNDev")
|
||||
// @ApiOperation("导出被检设备数据")
|
||||
// @ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
// public void exportCNDev(@RequestBody @Validated PqDevParam.QueryParam queryParam) {
|
||||
// String methodDescribe = getMethodDescribe("exportCNDev");
|
||||
// LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||
//
|
||||
// pqDevService.exportCNDev(queryParam);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 下载灿能二楼设备导入文件模板
|
||||
*/
|
||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||
// @PostMapping("/downloadCNDevTemplate")
|
||||
// @ApiOperation("下载被检设备导入文件模板")
|
||||
// public void downloadCNDevTemplate() {
|
||||
// pqDevService.downloadCNDevTemplate();
|
||||
// }
|
||||
|
||||
/**
|
||||
* 导入灿能二楼设备
|
||||
*/
|
||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
|
||||
// @PostMapping(value = "/importCNDev")
|
||||
// @ApiOperation("批量导入设备数据")
|
||||
// @ApiImplicitParams({
|
||||
// @ApiImplicitParam(name = "file", value = "被检设备数据文件", required = true),
|
||||
// @ApiImplicitParam(name = "patternId", value = "模式id", required = true)
|
||||
// })
|
||||
// public HttpResult<String> importCNDev(@RequestParam("file") MultipartFile file,@RequestParam("patternId") String patternId, HttpServletResponse response) {
|
||||
// String methodDescribe = getMethodDescribe("importCNDev");
|
||||
// LogUtil.njcnDebug(log, "{},上传文件为:{}", methodDescribe, file.getOriginalFilename());
|
||||
//
|
||||
// boolean fileType = FileUtil.judgeFileIsExcel(file.getOriginalFilename());
|
||||
// if (!fileType) {
|
||||
// throw new BusinessException(CommonResponseEnum.FILE_XLSX_ERROR);
|
||||
// }
|
||||
//
|
||||
// ImportParams params = new ImportParams();
|
||||
// params.setStartSheetIndex(0);
|
||||
// params.setSheetNum(1);
|
||||
// params.setHeadRows(1);
|
||||
// params.setNeedVerify(true);
|
||||
//
|
||||
// List<CNDevExcel> cnDevExcelList;
|
||||
// try {
|
||||
// ExcelImportResult<CNDevExcel> excelImportResult = ExcelImportUtil.importExcelMore(file.getInputStream(), CNDevExcel.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 {
|
||||
// cnDevExcelList = excelImportResult.getList();
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// throw new BusinessException(DevResponseEnum.IMPORT_DATA_FAIL);
|
||||
// }
|
||||
// if (ObjectUtil.isNotEmpty(cnDevExcelList)) {
|
||||
// pqDevService.importCNDev(cnDevExcelList, patternId, null);
|
||||
// }
|
||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
// }
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/listUnbound")
|
||||
@ApiOperation("获取指定模式下所有未绑定的设备")
|
||||
|
||||
@@ -36,18 +36,6 @@ public class ProvinceDevExcel implements Serializable {
|
||||
@NotBlank(message = DevValidMessage.DEV_TYPE_NOT_BLANK)
|
||||
private String devType;
|
||||
|
||||
// @Excel(name = "设备通道数", width = 20, orderNum = "4")
|
||||
// @NotNull(message = DevValidMessage.DEV_CHNS_NOT_NULL)
|
||||
// private Integer devChns;
|
||||
//
|
||||
// @Excel(name = "额定电压(V)", width = 15, orderNum = "5")
|
||||
// @NotNull(message = DevValidMessage.DEV_VOLT_NOT_NULL)
|
||||
// private Float devVolt;
|
||||
//
|
||||
// @Excel(name = "额定电流(A)", width = 15, orderNum = "6")
|
||||
// @NotNull(message = DevValidMessage.DEV_CURR_NOT_NULL)
|
||||
// private Float devCurr;
|
||||
|
||||
@Excel(name = "设备厂家*", width = 20, orderNum = "7")
|
||||
@NotBlank(message = DevValidMessage.MANUFACTURER_NOT_BLANK)
|
||||
private String manufacturer;
|
||||
@@ -66,148 +54,26 @@ public class ProvinceDevExcel implements Serializable {
|
||||
@NotBlank(message = DevValidMessage.PROTOCOL_NOT_BLANK)
|
||||
private String protocol;
|
||||
|
||||
@Excel(name = "IP地址*", width = 20, orderNum = "12")
|
||||
@Excel(name = "是否加密*", width = 20, replace = {"否_0", "是_1"}, orderNum = "12")
|
||||
@NotNull(message = DevValidMessage.ENCRYPTION_NOT_NULL)
|
||||
private Integer encryptionFlag;
|
||||
|
||||
@Excel(name = "识别码(当加密时必填)", width = 30, orderNum = "13")
|
||||
private String series;
|
||||
|
||||
@Excel(name = "秘钥(当加密时必填)", width = 30, orderNum = "14")
|
||||
private String devKey;
|
||||
|
||||
@Excel(name = "是否支持系数校准*", width = 25, replace = {"否_0", "是_1"}, orderNum = "15")
|
||||
private Integer factorFlag;
|
||||
|
||||
@Excel(name = "IP地址*", width = 20, orderNum = "16")
|
||||
@NotBlank(message = DevValidMessage.IP_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.IP_REGEX, message = DevValidMessage.IP_FORMAT_ERROR)
|
||||
private String ip;
|
||||
|
||||
@Excel(name = "端口号*", width = 15, orderNum = "13")
|
||||
@Excel(name = "端口号*", width = 15, orderNum = "17")
|
||||
@NotNull(message = DevValidMessage.PORT_NOT_NULL)
|
||||
@Range(min = 1, max = 65535, message = DevValidMessage.PORT_RANGE_ERROR)
|
||||
private Integer port;
|
||||
|
||||
@Excel(name = "是否加密*", width = 20, replace = {"否_0", "是_1"}, orderNum = "14")
|
||||
@NotNull(message = DevValidMessage.ENCRYPTION_NOT_NULL)
|
||||
private Integer encryptionFlag;
|
||||
|
||||
@Excel(name = "识别码(当加密时必填)", width = 30, orderNum = "15")
|
||||
private String series;
|
||||
|
||||
@Excel(name = "秘钥(当加密时必填)", width = 30, orderNum = "16")
|
||||
private String devKey;
|
||||
|
||||
@Excel(name = "是否支持系数校准*", width = 25, replace = {"否_0", "是_1"}, orderNum = "17")
|
||||
private Integer factorFlag;
|
||||
|
||||
// @Excel(name = "所属地市名称", width = 20, orderNum = "19")
|
||||
// private String cityName;
|
||||
//
|
||||
// @Excel(name = "所属供电公司名称", width = 20, orderNum = "20")
|
||||
// private String gdName;
|
||||
//
|
||||
// @Excel(name = "所属电站名称", width = 20, orderNum = "21")
|
||||
// private String subName;
|
||||
//
|
||||
// @Excel(name = "关键信息二维码", width = 20, orderNum = "30")
|
||||
// private String qrCode;
|
||||
//
|
||||
// @Excel(name = "检测次数", width = 15, orderNum = "31")
|
||||
// @NotNull(message = DevValidMessage.RECHECK_NUM_NOT_NULL)
|
||||
// private Integer reCheckNum;
|
||||
|
||||
|
||||
// @Data
|
||||
// @EqualsAndHashCode(callSuper = true)
|
||||
// public static class ExportData extends PqDevExcel {
|
||||
//
|
||||
// @Excel(name = "设备模式", width = 20, orderNum = "1")
|
||||
// @NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK)
|
||||
// private String pattern;
|
||||
//
|
||||
// @Excel(name = "出厂日期(yyyy-MM-dd)", width = 25, format = "yyyy-MM-dd", orderNum = "7")
|
||||
// @NotNull(message = DevValidMessage.CREATEDATETIME_NOT_NULL)
|
||||
// private LocalDate createDate;
|
||||
//
|
||||
// @Excel(name = "是否支持系数校准(否\\是)", width = 15, replace = {"否_0", "是_1"}, orderNum = "22")
|
||||
// private Integer factorFlag;
|
||||
//
|
||||
// @Excel(name = "守时检测结果(不合格\\合格\\/)", replace = {"不合格_0", "合格_1", "/_2"}, width = 15, orderNum = "23")
|
||||
// private Integer timeCheckResult;
|
||||
//
|
||||
// @Excel(name = "系数校准结果(不合格\\合格\\/)", width = 15, replace = {"不合格_0", "合格_1", "/_2"}, orderNum = "24")
|
||||
// private Integer factorCheckResult;
|
||||
//
|
||||
// @Excel(name = "检测状态(未检\\检测中\\检测完成\\归档)", width = 15, replace = {"未检_0", "检测中_1", "检测完成_2", "归档_3"}, orderNum = "25")
|
||||
// private Integer checkState;
|
||||
//
|
||||
// @Excel(name = "检测结果(不符合\\符合\\未检)", width = 15, replace = {"不符合_0", "符合_1", "未检_2"}, orderNum = "26")
|
||||
// private Integer checkResult;
|
||||
//
|
||||
// @Excel(name = "报告状态(未生成\\已生成\\未检)", width = 15, replace = {"未生成_0", "已生成_1", "未检_2"}, orderNum = "27")
|
||||
// private Integer reportState;
|
||||
//
|
||||
//// @Excel(name = "归档状态(未归档\\归档)", width = 15, replace = {"未归档_0", "归档_1"}, orderNum = "28")
|
||||
//// private Integer documentState;
|
||||
//
|
||||
// @Excel(name = "报告路径", width = 20, orderNum = "29")
|
||||
// private String reportPath;
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 模拟式和比对式设备导出数据
|
||||
// */
|
||||
// @Data
|
||||
// @EqualsAndHashCode(callSuper = true)
|
||||
// public static class SimulateOrDigitalExportData extends ExportData {
|
||||
// @Excel(name = "样品编号", width = 40, orderNum = "17")
|
||||
// private String sampleId;
|
||||
//
|
||||
// @Excel(name = "送样日期(yyyy-MM-dd)", width = 25, format = "yyyy-MM-dd", orderNum = "18")
|
||||
// private LocalDate arrivedDate;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 比对式设备导出数据
|
||||
// */
|
||||
// @Data
|
||||
// @EqualsAndHashCode(callSuper = true)
|
||||
// public static class ContrastExportData extends ExportData {
|
||||
// @ExcelCollection(name = "检测点台账", orderNum = "32")
|
||||
// List<PqMonitorExcel.ExportData> monitorList;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 被检设备导入数据
|
||||
// */
|
||||
// @Data
|
||||
// @EqualsAndHashCode(callSuper = true)
|
||||
// public static class ImportData extends PqDevExcel {
|
||||
//
|
||||
// @Excel(name = "出厂日期(yyyy-MM-dd)", width = 25, format = "yyyy-MM-dd", orderNum = "7")
|
||||
// @NotNull(message = DevValidMessage.CREATEDATETIME_NOT_NULL)
|
||||
// @DateTimeStrValid(message = DevValidMessage.CREATEDATETIME_FORMAT_ERROR)
|
||||
// private String createDate;
|
||||
//
|
||||
//
|
||||
// @Excel(name = "是否支持系数校准(否\\是)", width = 15, replace = {"否_0", "是_1"}, orderNum = "22")
|
||||
// @NotBlank(message = DevValidMessage.FACTOR_FLAG_NOT_BLANK)
|
||||
// private String factorFlag;
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 模拟式和比对式设备导入数据
|
||||
// */
|
||||
// @Data
|
||||
// @EqualsAndHashCode(callSuper = true)
|
||||
// public static class SimulateOrDigitalImportData extends ImportData {
|
||||
// @Excel(name = "样品编号", width = 40, orderNum = "17")
|
||||
// private String sampleId;
|
||||
//
|
||||
// @Excel(name = "送样日期(yyyy-MM-dd)", width = 25, format = "yyyy-MM-dd", orderNum = "18")
|
||||
// @DateTimeStrValid(message = DevValidMessage.ARRIVE_DATE_FORMAT_ERROR)
|
||||
// private String arrivedDate;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 对比式设备导入数据
|
||||
// */
|
||||
// @Data
|
||||
// @EqualsAndHashCode(callSuper = true)
|
||||
// public static class ContrastImportData extends ImportData {
|
||||
// @ExcelCollection(name = "检测点台账", orderNum = "32")
|
||||
// List<PqMonitorExcel.ImportData> monitorList;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.gather.device.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.common.pojo.poi.PullDown;
|
||||
import com.njcn.gather.device.pojo.enums.TimeCheckResultEnum;
|
||||
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
@@ -255,4 +256,19 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
* @param patternId 模式Id
|
||||
*/
|
||||
void reverseVisualizeProvinceDev(List<PqDev> pqDevs, String patternId);
|
||||
|
||||
/**
|
||||
* 获取省级平台设备导出、导出文件模板的下拉列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<PullDown> getProvinceDevPullDownList(int startCol);
|
||||
|
||||
/**
|
||||
* 获取灿能二楼设备导出、导出文件模板的下拉列表
|
||||
*
|
||||
* @param startCol 开始列
|
||||
* @return
|
||||
*/
|
||||
List<PullDown> getCNDevPullDownList(int startCol);
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean addPqDev(PqDevParam pqDevParam) {
|
||||
this.checkRepeat(pqDevParam, false);
|
||||
|
||||
@@ -138,7 +138,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean updatePqDev(PqDevParam.UpdateParam updateParam) {
|
||||
this.checkRepeat(updateParam, true);
|
||||
|
||||
@@ -162,7 +162,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean deletePqDev(PqDevParam.DeleteParam param) {
|
||||
if (PatternEnum.CONTRAST.getValue().equals(dictDataService.getDictDataById(param.getPattern()).getCode())) {
|
||||
for (String id : param.getIds()) {
|
||||
@@ -207,7 +207,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean updatePqDevTimeCheckResult(List<String> ids, TimeCheckResultEnum result) {
|
||||
return this.lambdaUpdate().set(PqDev::getTimeCheckResult, result.getValue()).in(PqDev::getId, ids).update();
|
||||
}
|
||||
@@ -244,7 +244,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @Transactional(rollbackFor = {Exception.class})
|
||||
// @Transactional
|
||||
// public void importContrastData(List<PqDevExcel.ContrastImportData> pqDevExcelList) {
|
||||
// List<PqDev> devList = new ArrayList<>();
|
||||
// List<PqMonitor> monitorList = new ArrayList<>();
|
||||
@@ -283,7 +283,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @Transactional(rollbackFor = {Exception.class})
|
||||
// @Transactional
|
||||
// public void importSimulateAndDigitalData(List<PqDevExcel.SimulateOrDigitalImportData> pqDevExcelList) {
|
||||
// List<PqDev> pqDevList = BeanUtil.copyToList(pqDevExcelList, PqDev.class);
|
||||
// //逆向可视化
|
||||
@@ -329,7 +329,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public Integer bind(String planId, List<String> devIds) {
|
||||
//先将这个绑定的计划全部剔除掉
|
||||
this.lambdaUpdate().set(PqDev::getPlanId, null).eq(PqDev::getPlanId, planId).update();
|
||||
@@ -454,7 +454,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean documented(List<String> ids) {
|
||||
if (CollUtil.isNotEmpty(ids)) {
|
||||
for (String id : ids) {
|
||||
@@ -635,7 +635,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Transactional
|
||||
public void importCNDev(MultipartFile file, String patternId, String planId, HttpServletResponse response) {
|
||||
ImportParams params = new ImportParams();
|
||||
params.setStartSheetIndex(0);
|
||||
@@ -660,11 +660,10 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Transactional
|
||||
public void importCNDev(List<CNDevExcel> cnDevExcelList, String patternId, String planId) {
|
||||
if (CollUtil.isNotEmpty(cnDevExcelList)) {
|
||||
|
||||
|
||||
List<PqDev> oldDevList = BeanUtil.copyToList(cnDevExcelList, PqDev.class);
|
||||
//逆向可视化
|
||||
this.reverseVisualizeCNDev(oldDevList, patternId);
|
||||
@@ -773,22 +772,74 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
pqDevExcels = BeanUtil.copyToList(pqDevs, CNDevExcel.class);
|
||||
}
|
||||
|
||||
ExcelUtil.exportExcelPullDown(new ExportParams(), "被检设备导出数据.xlsx", 1, this.getCNDevPullDownList(), CNDevExcel.class, ObjectUtil.isEmpty(pqDevExcels) ? new ArrayList<>() : pqDevExcels);
|
||||
ExcelUtil.exportExcelPullDown(new ExportParams(), "被检设备导出数据.xlsx", 1, this.getCNDevPullDownList(0), CNDevExcel.class, ObjectUtil.isEmpty(pqDevExcels) ? new ArrayList<>() : pqDevExcels);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载灿能二楼设备模板文件
|
||||
*/
|
||||
private void downloadCNDevTemplate() {
|
||||
ExcelUtil.exportExcelPullDown(new ExportParams(), "被检设备模板.xlsx", 1, this.getCNDevPullDownList(), CNDevExcel.class, new ArrayList<>());
|
||||
ExcelUtil.exportExcelPullDown(new ExportParams(), "被检设备模板.xlsx", 1, this.getCNDevPullDownList(0), CNDevExcel.class, new ArrayList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取灿能二楼设备导出、导出文件模板的下拉列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private List<PullDown> getCNDevPullDownList() {
|
||||
|
||||
@Override
|
||||
public List<PullDown> getProvinceDevPullDownList(int startCol) {
|
||||
List<PullDown> pullDowns = new ArrayList<>();
|
||||
List<DictData> dictDataList = null;
|
||||
PullDown pullDown = null;
|
||||
|
||||
// 设备类型
|
||||
List<DevType> devTypeList = devTypeService.listAll();
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(startCol + 2);
|
||||
pullDown.setLastCol(startCol + 2);
|
||||
pullDown.setStrings(devTypeList.stream().map(DevType::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
// 设备厂家
|
||||
DictType dictType = dictTypeService.getByCode("Dev_Manufacturers");
|
||||
if (ObjectUtil.isNotNull(dictType)) {
|
||||
dictDataList = dictDataService.getDictDataByTypeId(dictType.getId());
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(startCol + 3);
|
||||
pullDown.setLastCol(startCol + 3);
|
||||
pullDown.setStrings(dictDataList.stream().map(DictData::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(startCol + 7);
|
||||
pullDown.setLastCol(startCol + 7);
|
||||
pullDown.setStrings(dictDataList.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
}
|
||||
|
||||
// 是否加密
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(startCol + 8);
|
||||
pullDown.setLastCol(startCol + 8);
|
||||
pullDown.setStrings(Arrays.asList("是", "否"));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
// 是否支持系数校准
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(startCol + 11);
|
||||
pullDown.setLastCol(startCol + 11);
|
||||
pullDown.setStrings(Arrays.asList("是", "否"));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
return pullDowns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PullDown> getCNDevPullDownList(int startCol) {
|
||||
List<PullDown> pullDowns = new ArrayList<>();
|
||||
// 预投计划
|
||||
List<DictData> dictDataList = null;
|
||||
@@ -799,8 +850,8 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
dictDataList = dictDataService.getDictDataByTypeId(dictType.getId());
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(0);
|
||||
pullDown.setLastCol(0);
|
||||
pullDown.setFirstCol(startCol);
|
||||
pullDown.setLastCol(startCol);
|
||||
pullDown.setStrings(dictDataList.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
}
|
||||
@@ -808,8 +859,8 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
// 设备类型
|
||||
List<DevType> devTypeList = devTypeService.listAll();
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(2);
|
||||
pullDown.setLastCol(2);
|
||||
pullDown.setFirstCol(startCol + 2);
|
||||
pullDown.setLastCol(startCol + 2);
|
||||
pullDown.setStrings(devTypeList.stream().map(DevType::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
@@ -820,24 +871,24 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
dictDataList = dictDataService.getDictDataByTypeId(dictType.getId());
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(3);
|
||||
pullDown.setLastCol(3);
|
||||
pullDown.setFirstCol(startCol + 3);
|
||||
pullDown.setLastCol(startCol + 3);
|
||||
pullDown.setStrings(dictDataList.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
}
|
||||
|
||||
// 是否加密
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(4);
|
||||
pullDown.setLastCol(4);
|
||||
pullDown.setFirstCol(startCol + 4);
|
||||
pullDown.setLastCol(startCol + 4);
|
||||
pullDown.setStrings(Arrays.asList("是", "否"));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
|
||||
// 是否支持系数校准
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(7);
|
||||
pullDown.setLastCol(7);
|
||||
pullDown.setFirstCol(startCol + 8);
|
||||
pullDown.setLastCol(startCol + 8);
|
||||
pullDown.setStrings(Arrays.asList("是", "否"));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
@@ -894,77 +945,19 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
pqDevExcels = BeanUtil.copyToList(pqDevs, ProvinceDevExcel.class);
|
||||
}
|
||||
|
||||
ExcelUtil.exportExcelPullDown(new ExportParams(), "被检设备导出数据.xlsx", 1, this.getProvinceDevPullDownList(), ProvinceDevExcel.class, ObjectUtil.isEmpty(pqDevExcels) ? new ArrayList<>() : pqDevExcels);
|
||||
ExcelUtil.exportExcelPullDown(new ExportParams(), "被检设备导出数据.xlsx", 1, this.getProvinceDevPullDownList(0), ProvinceDevExcel.class, ObjectUtil.isEmpty(pqDevExcels) ? new ArrayList<>() : pqDevExcels);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载省级平台设备模板文件
|
||||
*/
|
||||
private void downloadProvinceDevTemplate() {
|
||||
ExcelUtil.exportExcelPullDown(new ExportParams(), "被检设备模板.xlsx", 1, this.getProvinceDevPullDownList(), ProvinceDevExcel.class, new ArrayList<>());
|
||||
ExcelUtil.exportExcelPullDown(new ExportParams(), "被检设备模板.xlsx", 1, this.getProvinceDevPullDownList(0), ProvinceDevExcel.class, new ArrayList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取省级平台设备导出、导出文件模板的下拉列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private List<PullDown> getProvinceDevPullDownList() {
|
||||
List<PullDown> pullDowns = new ArrayList<>();
|
||||
List<DictData> dictDataList = null;
|
||||
PullDown pullDown = null;
|
||||
|
||||
// 设备类型
|
||||
List<DevType> devTypeList = devTypeService.listAll();
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(2);
|
||||
pullDown.setLastCol(2);
|
||||
pullDown.setStrings(devTypeList.stream().map(DevType::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
// 设备厂家
|
||||
DictType dictType = dictTypeService.getByCode("Dev_Manufacturers");
|
||||
if (ObjectUtil.isNotNull(dictType)) {
|
||||
dictDataList = dictDataService.getDictDataByTypeId(dictType.getId());
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(3);
|
||||
pullDown.setLastCol(3);
|
||||
pullDown.setStrings(dictDataList.stream().map(DictData::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(7);
|
||||
pullDown.setLastCol(7);
|
||||
pullDown.setStrings(dictDataList.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
}
|
||||
|
||||
// 是否加密
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(10);
|
||||
pullDown.setLastCol(10);
|
||||
pullDown.setStrings(Arrays.asList("是", "否"));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
// 是否支持系数校准
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(13);
|
||||
pullDown.setLastCol(13);
|
||||
pullDown.setStrings(Arrays.asList("是", "否"));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
return pullDowns;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Transactional
|
||||
public void importProvinceDev(MultipartFile file, String patternId, String planId, HttpServletResponse response) {
|
||||
ImportParams params = new ImportParams();
|
||||
params.setStartSheetIndex(0);
|
||||
@@ -989,7 +982,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Transactional
|
||||
public void importProvinceDev(List<ProvinceDevExcel> proviceDevExcelList, String patternId, String planId) {
|
||||
if (CollUtil.isNotEmpty(proviceDevExcelList)) {
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public class PqErrSysDtlsServiceImpl extends ServiceImpl<PqErrSysDtlsMapper, PqE
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean addPqErrSysDtls(String pqErrSysId, List<PqErrSysDtlsParam> list) {
|
||||
List<PqErrSysDtls> data = new ArrayList<>();
|
||||
for (PqErrSysDtlsParam param : list) {
|
||||
@@ -57,7 +57,7 @@ public class PqErrSysDtlsServiceImpl extends ServiceImpl<PqErrSysDtlsMapper, PqE
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean updatePqErrSysDtls(String pqErrSysId, List<PqErrSysDtlsParam> list) {
|
||||
//先按照pqErrSysId全部删除
|
||||
this.deletePqErrSysDtlsByPqErrSysId(Collections.singletonList(pqErrSysId));
|
||||
@@ -67,7 +67,7 @@ public class PqErrSysDtlsServiceImpl extends ServiceImpl<PqErrSysDtlsMapper, PqE
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean deletePqErrSysDtlsByPqErrSysId(List<String> pqErrSysIds) {
|
||||
QueryWrapper<PqErrSysDtls> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("pq_err_sys_dtls.Error_Sys_Id", pqErrSysIds);
|
||||
|
||||
@@ -67,7 +67,7 @@ public class PqErrSysServiceImpl extends ServiceImpl<PqErrSysMapper, PqErrSys> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean addPqErrSys(PqErrSysParam param) {
|
||||
PqErrSys pqErrSys = new PqErrSys();
|
||||
BeanUtils.copyProperties(param, pqErrSys);
|
||||
@@ -82,7 +82,7 @@ public class PqErrSysServiceImpl extends ServiceImpl<PqErrSysMapper, PqErrSys> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean updatePqErrSys(PqErrSysParam.UpdateParam param) {
|
||||
PqErrSys pqErrSys = new PqErrSys();
|
||||
BeanUtils.copyProperties(param, pqErrSys);
|
||||
@@ -94,7 +94,7 @@ public class PqErrSysServiceImpl extends ServiceImpl<PqErrSysMapper, PqErrSys> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean deletePqErrSys(List<String> ids) {
|
||||
Integer count = this.baseMapper.getCountBoundByIds(ids);
|
||||
if (count > 0) {
|
||||
|
||||
@@ -46,7 +46,7 @@ public class PqIcdPathServiceImpl extends ServiceImpl<PqIcdPathMapper, PqIcdPath
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Transactional
|
||||
public boolean addIcd(PqIcdPathParam param) {
|
||||
this.checkRepeat(param, false);
|
||||
PqIcdPath pqIcdPath = new PqIcdPath();
|
||||
@@ -56,7 +56,7 @@ public class PqIcdPathServiceImpl extends ServiceImpl<PqIcdPathMapper, PqIcdPath
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean updateIcd(PqIcdPathParam.UpdateParam param) {
|
||||
this.checkRepeat(param, true);
|
||||
PqIcdPath pqIcdPath = new PqIcdPath();
|
||||
@@ -65,7 +65,7 @@ public class PqIcdPathServiceImpl extends ServiceImpl<PqIcdPathMapper, PqIcdPath
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean deleteIcd(List<String> ids) {
|
||||
return this.lambdaUpdate().in(PqIcdPath::getId, ids).set(PqIcdPath::getState, DataStateEnum.DELETED.getCode()).update();
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class PqMonitorServiceImpl extends ServiceImpl<PqMonitorMapper, PqMonitor
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean addPqMonitorByDevId(String devId, List<PqMonitorParam> pqMonitorParamList) {
|
||||
List<PqMonitor> pqMonitorList = BeanUtil.copyToList(pqMonitorParamList, PqMonitor.class);
|
||||
pqMonitorList.forEach(pqMonitor -> pqMonitor.setDevId(devId));
|
||||
@@ -41,7 +41,7 @@ public class PqMonitorServiceImpl extends ServiceImpl<PqMonitorMapper, PqMonitor
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean deletePqMonitorByDevId(String devId) {
|
||||
QueryWrapper<PqMonitor> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("pq_monitor.Dev_Id", devId);
|
||||
@@ -49,7 +49,7 @@ public class PqMonitorServiceImpl extends ServiceImpl<PqMonitorMapper, PqMonitor
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean updatePqMonitorByDevId(String devId, List<PqMonitorParam> paramList) {
|
||||
// 先删除原有数据
|
||||
this.deletePqMonitorByDevId(devId);
|
||||
|
||||
@@ -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("获取检测大项数据")
|
||||
|
||||
@@ -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;
|
||||
@@ -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);
|
||||
|
||||
@@ -173,7 +173,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Transactional
|
||||
public boolean add(ReportParam reportParam) {
|
||||
this.checkRepeat(reportParam, false);
|
||||
PqReport pqReport = new PqReport();
|
||||
|
||||
@@ -893,7 +893,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Transactional
|
||||
public void changeErrorSystem(ResultParam.ChangeErrorSystemParam param) {
|
||||
this.createTempResultTable(param.getCode() + "_temp");
|
||||
this.calculateResult(param.getPlanId(), param.getScriptId(), param.getCode() + "_temp", param.getErrorSysId(), param.getDeviceId());
|
||||
|
||||
@@ -85,13 +85,13 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
||||
private final IDictTreeService dictTreeService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean savePqScriptDtls(PqScriptDtls pqScriptDtls) {
|
||||
return this.save(pqScriptDtls);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean deletePqScriptDtlsByIds(List<String> ids) {
|
||||
LambdaQueryWrapper<PqScriptDtls> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(PqScriptDtls::getId, ids);
|
||||
@@ -99,7 +99,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean deletePqScriptDtlsByScriptId(List<String> scriptIds) {
|
||||
LambdaQueryWrapper<PqScriptDtls> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(PqScriptDtls::getScriptId, scriptIds);
|
||||
@@ -107,7 +107,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean updatePqScriptDtls(PqScriptDtls pqScriptDtls) {
|
||||
return this.updateById(pqScriptDtls);
|
||||
}
|
||||
@@ -248,7 +248,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public Boolean saveScriptDtls(PqScriptDtlsParam sourceIssue) {
|
||||
List<PqScriptDtls> info = new ArrayList<>();
|
||||
List<PqScriptCheckData> checkList = new ArrayList<>();
|
||||
|
||||
@@ -59,7 +59,7 @@ public class PqScriptServiceImpl extends ServiceImpl<PqScriptMapper, PqScript> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public String addPqScript(PqScriptParam param) {
|
||||
PqScript pqScript = new PqScript();
|
||||
BeanUtils.copyProperties(param, pqScript);
|
||||
@@ -70,7 +70,7 @@ public class PqScriptServiceImpl extends ServiceImpl<PqScriptMapper, PqScript> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean updatePqScript(PqScriptParam.UpdateParam param) {
|
||||
PqScript pqScript = new PqScript();
|
||||
BeanUtils.copyProperties(param, pqScript);
|
||||
@@ -80,7 +80,7 @@ public class PqScriptServiceImpl extends ServiceImpl<PqScriptMapper, PqScript> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean deletePqScript(List<String> ids) {
|
||||
Integer count = this.baseMapper.getBoundCountByScriptIds(ids);
|
||||
if (count > 0) {
|
||||
@@ -95,7 +95,7 @@ public class PqScriptServiceImpl extends ServiceImpl<PqScriptMapper, PqScript> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean upgradeToTemplate(String id) {
|
||||
PqScript pqScript = this.lambdaQuery().eq(PqScript::getId, id).one();
|
||||
if (pqScript != null) {
|
||||
|
||||
@@ -64,7 +64,7 @@ public class PqSourceServiceImpl extends ServiceImpl<PqSourceMapper, PqSource> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean addPqSource(PqSourceParam param) {
|
||||
PqSource pqSource = new PqSource();
|
||||
BeanUtil.copyProperties(param, pqSource);
|
||||
@@ -75,7 +75,7 @@ public class PqSourceServiceImpl extends ServiceImpl<PqSourceMapper, PqSource> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean updatePqSource(PqSourceParam.UpdateParam param) {
|
||||
PqSource pqSource = new PqSource();
|
||||
BeanUtil.copyProperties(param, pqSource);
|
||||
@@ -84,7 +84,7 @@ public class PqSourceServiceImpl extends ServiceImpl<PqSourceMapper, PqSource> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean deletePqSource(List<String> ids) {
|
||||
Integer count = this.baseMapper.getCountBoundByIds(ids);
|
||||
if(count > 0){
|
||||
|
||||
@@ -71,7 +71,7 @@ public class DevTypeServiceImpl extends ServiceImpl<DevTypeMapper, DevType> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean addDevType(DevTypeParam addParam) {
|
||||
this.checkRepeat(addParam, false);
|
||||
DevType devType = new DevType();
|
||||
@@ -81,7 +81,7 @@ public class DevTypeServiceImpl extends ServiceImpl<DevTypeMapper, DevType> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean updateDevType(DevTypeParam.UpdateParam updateParam) {
|
||||
this.checkRepeat(updateParam, true);
|
||||
DevType devType = new DevType();
|
||||
@@ -90,7 +90,7 @@ public class DevTypeServiceImpl extends ServiceImpl<DevTypeMapper, DevType> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean deleteDevType(List<String> ids) {
|
||||
return this.lambdaUpdate().in(DevType::getId, ids).set(DevType::getState, DataStateEnum.DELETED.getCode()).update();
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class DetectionDataServiceImpl extends ReplenishMybatisServiceImpl<Detect
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Transactional
|
||||
public Boolean acceptAdNon(List<AdNonHarmonicResult> adNonHarmonicResultList, String code) {
|
||||
String adNonTable = "ad_non_harmonic_";
|
||||
DynamicTableNameHandler.setTableName(adNonTable + code);
|
||||
@@ -46,7 +46,7 @@ public class DetectionDataServiceImpl extends ReplenishMybatisServiceImpl<Detect
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Transactional
|
||||
public Boolean acceptAd(List<AdHarmonicResult> adHarmonicResultList, String code) {
|
||||
String adTable = "ad_harmonic_";
|
||||
DynamicTableNameHandler.setTableName(adTable + code);
|
||||
@@ -63,7 +63,7 @@ public class DetectionDataServiceImpl extends ReplenishMybatisServiceImpl<Detect
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Transactional
|
||||
public Boolean acceptAdNonResult(List<AdNonHarmonicResult> adNonHarmonicResultList, String code) {
|
||||
String adNonTableResult = "ad_non_harmonic_result_";
|
||||
DynamicTableNameHandler.setTableName(adNonTableResult + code);
|
||||
@@ -79,7 +79,7 @@ public class DetectionDataServiceImpl extends ReplenishMybatisServiceImpl<Detect
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Transactional
|
||||
public Boolean acceptAdResult(List<AdHarmonicResult> adHarmonicResultList, String code) {
|
||||
String adTableResult = "ad_harmonic_result_";
|
||||
DynamicTableNameHandler.setTableName(adTableResult + code);
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.njcn.gather.system.cfg.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2025-03-25
|
||||
*/
|
||||
@Getter
|
||||
public enum SceneEnum {
|
||||
/**
|
||||
* 省级平台
|
||||
*/
|
||||
PROVINCE_PLATFORM("0", "province_platform"),
|
||||
|
||||
/**
|
||||
* 设备出场
|
||||
*/
|
||||
LEAVE_FACTORY_TEST("1", "leave_factory_test"),
|
||||
|
||||
/**
|
||||
* 研发自测
|
||||
*/
|
||||
SELF_TEST("2", "self_test");
|
||||
|
||||
private String value;
|
||||
private String msg;
|
||||
|
||||
SceneEnum(String value, String msg) {
|
||||
this.value = value;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public static SceneEnum getSceneEnum(String value) {
|
||||
for (SceneEnum sceneEnum : SceneEnum.values()) {
|
||||
if (sceneEnum.getValue().equals(value)) {
|
||||
return sceneEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ public class SysTestConfigServiceImpl extends ServiceImpl<SysTestConfigMapper, S
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean addTestConfig(String scene) {
|
||||
SysTestConfig sysTestConfig = new SysTestConfig();
|
||||
sysTestConfig.setAutoGenerate(1);
|
||||
@@ -46,7 +46,7 @@ public class SysTestConfigServiceImpl extends ServiceImpl<SysTestConfigMapper, S
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean updateTestConfig(SysTestConfigParam.UpdateParam param) {
|
||||
SysTestConfig sysTestConfig = new SysTestConfig();
|
||||
BeanUtils.copyProperties(param, sysTestConfig);
|
||||
|
||||
@@ -70,7 +70,7 @@ public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean addDictData(DictDataParam dictDataParam) {
|
||||
checkDicDataName(dictDataParam, false);
|
||||
DictData dictData = new DictData();
|
||||
@@ -82,7 +82,7 @@ public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> i
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean updateDictData(DictDataParam.UpdateParam updateParam) {
|
||||
checkDicDataName(updateParam, true);
|
||||
DictData dictData = new DictData();
|
||||
@@ -91,7 +91,7 @@ public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean deleteDictData(List<String> ids) {
|
||||
return this.lambdaUpdate()
|
||||
.set(DictData::getState, DataStateEnum.DELETED.getCode())
|
||||
@@ -154,7 +154,7 @@ public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public void exportDictData(DictDataParam.QueryParam queryParam) {
|
||||
QueryWrapper<DictData> queryWrapper = new QueryWrapper<>();
|
||||
if (ObjectUtil.isNotNull(queryParam)) {
|
||||
@@ -176,7 +176,7 @@ public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean deleteDictDataByDictTypeId(List<String> ids) {
|
||||
return this.lambdaUpdate().in(DictData::getTypeId, ids).set(DictData::getState, DataStateEnum.DELETED.getCode()).update();
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class DictPqServiceImpl extends ServiceImpl<DictPqMapper, DictPq> impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean addDictPq(DictPqParam dictPqParam) {
|
||||
checkDicPqName(dictPqParam, false);
|
||||
DictPq dictPq = new DictPq();
|
||||
@@ -67,7 +67,7 @@ public class DictPqServiceImpl extends ServiceImpl<DictPqMapper, DictPq> impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean updateDictPq(DictPqParam.UpdateParam updateParam) {
|
||||
checkDicPqName(updateParam, true);
|
||||
DictPq dictPq = new DictPq();
|
||||
@@ -76,7 +76,7 @@ public class DictPqServiceImpl extends ServiceImpl<DictPqMapper, DictPq> impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean deleteDictPq(List<String> ids) {
|
||||
dictDataService.deleteDictDataByDictTypeId(ids);
|
||||
return this.lambdaUpdate()
|
||||
|
||||
@@ -67,7 +67,7 @@ public class DictTreeServiceImpl extends ServiceImpl<DictTreeMapper, DictTree> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean addDictTree(DictTreeParam dictTreeParam) {
|
||||
checkRepeat(dictTreeParam, false);
|
||||
boolean result;
|
||||
@@ -90,7 +90,7 @@ public class DictTreeServiceImpl extends ServiceImpl<DictTreeMapper, DictTree> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean updateDictTree(DictTreeParam.UpdateParam param) {
|
||||
DictTree dictTree = this.getById(param.getId());
|
||||
if("975f63baeb6f653c54fca226a9ae36ca".equals(param.getId()) || dictTree.getPids().contains("975f63baeb6f653c54fca226a9ae36ca")){
|
||||
@@ -106,7 +106,7 @@ public class DictTreeServiceImpl extends ServiceImpl<DictTreeMapper, DictTree> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean deleteDictTree(String id) {
|
||||
boolean result = false;
|
||||
DictTree dictTree = this.getById(id);
|
||||
|
||||
@@ -55,7 +55,7 @@ public class DictTypeServiceImpl extends ServiceImpl<DictTypeMapper, DictType> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean addDictType(DictTypeParam dictTypeParam) {
|
||||
checkDicTypeName(dictTypeParam, false);
|
||||
DictType dictType = new DictType();
|
||||
@@ -66,7 +66,7 @@ public class DictTypeServiceImpl extends ServiceImpl<DictTypeMapper, DictType> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean updateDictType(DictTypeParam.UpdateParam updateParam) {
|
||||
checkDicTypeName(updateParam, true);
|
||||
DictType dictType = new DictType();
|
||||
@@ -75,7 +75,7 @@ public class DictTypeServiceImpl extends ServiceImpl<DictTypeMapper, DictType> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean deleteDictType(List<String> ids) {
|
||||
dictDataService.deleteDictDataByDictTypeId(ids);
|
||||
return this.lambdaUpdate()
|
||||
|
||||
@@ -93,7 +93,7 @@ public class SysRegResServiceImpl extends ServiceImpl<SysRegResMapper, SysRegRes
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean addRegRes(SysRegResParam sysRegResParam) {
|
||||
List<SysRegRes> regResList = new ArrayList<>();
|
||||
|
||||
@@ -155,7 +155,7 @@ public class SysRegResServiceImpl extends ServiceImpl<SysRegResMapper, SysRegRes
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean updateRegRes(SysRegResParam.UpdateParam param) {
|
||||
SysRegRes sysRegRes = new SysRegRes();
|
||||
BeanUtil.copyProperties(param, sysRegRes);
|
||||
|
||||
@@ -72,8 +72,6 @@ public class SysUserController extends BaseController {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
LogUtil.njcnDebug(log, "{},用户数据为:{}", methodDescribe, addUserParam);
|
||||
boolean result = sysUserService.addUser(addUserParam);
|
||||
//更新redis数据
|
||||
//sysUserService.userRoleList();
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} else {
|
||||
@@ -89,8 +87,6 @@ public class SysUserController extends BaseController {
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
LogUtil.njcnDebug(log, "{},用户数据为:{}", methodDescribe, updateUserParam);
|
||||
boolean result = sysUserService.updateUser(updateUserParam);
|
||||
//更新redis数据
|
||||
//userService.userRoleList();
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} else {
|
||||
@@ -106,8 +102,6 @@ public class SysUserController extends BaseController {
|
||||
String methodDescribe = getMethodDescribe("delete");
|
||||
LogUtil.njcnDebug(log, "{},用户id为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
||||
boolean result = sysUserService.deleteUser(ids);
|
||||
//更新redis数据
|
||||
//sysUserService.userRoleList();
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} else {
|
||||
|
||||
@@ -33,12 +33,9 @@ public class SysFunctionParam {
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty("路径")
|
||||
// @NotBlank(message = UserValidMessage.PATH_NOT_BLANK)
|
||||
// @Pattern(regexp = PatternRegex.FUNCTION_URL, message = UserValidMessage.PATH_FORMAT_ERROR)
|
||||
private String path;
|
||||
|
||||
@ApiModelProperty("组件地址")
|
||||
// @NotBlank(message = UserValidMessage.COMPONENT_NOT_BLANK)
|
||||
private String component;
|
||||
|
||||
@ApiModelProperty("图标")
|
||||
@@ -63,10 +60,6 @@ public class SysFunctionParam {
|
||||
@ApiModelProperty("名称")
|
||||
@Pattern(regexp = PatternRegex.FUNCTION_NAME, message = UserValidMessage.NAME_FORMAT_ERROR)
|
||||
private String name;
|
||||
|
||||
// @ApiModelProperty("资源类型")
|
||||
// @Range(min = 0, max = 3, message = UserValidMessage.PARAM_FORMAT_ERROR)
|
||||
// private Integer type;
|
||||
}
|
||||
|
||||
@Data
|
||||
|
||||
@@ -37,18 +37,6 @@ public class SysUserParam {
|
||||
@ApiModelProperty("角色ids")
|
||||
private List<String> roleIds;
|
||||
|
||||
// @ApiModelProperty("最后一次登录时间")
|
||||
// @DateTimeStrValid(format = "yyyy-MM-dd HH:mm:ss")
|
||||
// private String loginTime;
|
||||
|
||||
// @ApiModelProperty("密码错误次数")
|
||||
// @NotNull(message = UserValidMessage.LOGIN_ERROR_TIMES_NOT_NULL)
|
||||
// private Integer loginErrorTimes;
|
||||
|
||||
// @ApiModelProperty("密码错误锁定时间")
|
||||
// @DateTimeStrValid(format = "yyyy-MM-dd HH:mm:ss")
|
||||
// private String lockTime;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class SysUserAddParam extends SysUserParam {
|
||||
|
||||
@@ -46,7 +46,7 @@ public class SysFunctionServiceImpl extends ServiceImpl<SysFunctionMapper, SysFu
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean addFunction(SysFunctionParam functionParam) {
|
||||
checkFunctionParam(functionParam, false);
|
||||
SysFunction function = new SysFunction();
|
||||
@@ -67,7 +67,7 @@ public class SysFunctionServiceImpl extends ServiceImpl<SysFunctionMapper, SysFu
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean updateFunction(SysFunctionParam.UpdateParam param) {
|
||||
boolean result = false;
|
||||
checkFunctionParam(param, true);
|
||||
@@ -84,7 +84,7 @@ public class SysFunctionServiceImpl extends ServiceImpl<SysFunctionMapper, SysFu
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean deleteFunction(String id) {
|
||||
boolean result1 = false;
|
||||
sysRoleFunctionService.deleteRoleFunctionByFunctionIds(Collections.singletonList(id));
|
||||
|
||||
@@ -31,7 +31,7 @@ public class SysRoleFunctionServiceImpl extends ServiceImpl<SysRoleFunctionMappe
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean addRoleFunction(String roleId, List<String> functionIds) {
|
||||
List<SysRoleFunction> roleFunctions = new ArrayList<>();
|
||||
if (!CollectionUtil.isEmpty(functionIds)) {
|
||||
@@ -46,7 +46,7 @@ public class SysRoleFunctionServiceImpl extends ServiceImpl<SysRoleFunctionMappe
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean updateRoleFunction(String roleId, List<String> functionIds) {
|
||||
//删除原有关系
|
||||
this.deleteRoleFunctionByRoleIds(Collections.singletonList(roleId));
|
||||
@@ -62,7 +62,7 @@ public class SysRoleFunctionServiceImpl extends ServiceImpl<SysRoleFunctionMappe
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean deleteRoleFunctionByRoleIds(List<String> roleIds) {
|
||||
LambdaQueryWrapper<SysRoleFunction> lambdaQuery = new LambdaQueryWrapper<>();
|
||||
lambdaQuery.in(SysRoleFunction::getRoleId, roleIds);
|
||||
@@ -70,7 +70,7 @@ public class SysRoleFunctionServiceImpl extends ServiceImpl<SysRoleFunctionMappe
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean deleteRoleFunctionByFunctionIds(List<String> functionIds) {
|
||||
LambdaQueryWrapper<SysRoleFunction> lambdaQuery = new LambdaQueryWrapper<>();
|
||||
lambdaQuery.in(SysRoleFunction::getFunctionId, functionIds);
|
||||
|
||||
@@ -53,7 +53,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean addRole(SysRoleParam sysRoleParam) {
|
||||
checkRepeat(sysRoleParam, false);
|
||||
SysRole role = new SysRole();
|
||||
@@ -64,7 +64,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean updateRole(SysRoleParam.UpdateParam updateParam) {
|
||||
checkRepeat(updateParam, true);
|
||||
//不能修改超级管理员角色
|
||||
@@ -80,7 +80,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean deleteRole(List<String> ids) {
|
||||
//不能删除超级管理员角色
|
||||
Integer count = this.lambdaQuery()
|
||||
|
||||
@@ -31,7 +31,7 @@ public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUs
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean addUserRole(String userId, List<String> roleIds) {
|
||||
List<SysUserRole> userRoles = new ArrayList<>();
|
||||
if (!CollectionUtil.isEmpty(roleIds)) {
|
||||
@@ -46,7 +46,7 @@ public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUs
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean updateUserRole(String userId, List<String> roleIds) {
|
||||
//删除原有关系
|
||||
this.deleteUserRoleByUserIds(Collections.singletonList(userId));
|
||||
@@ -62,7 +62,7 @@ public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUs
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean deleteUserRoleByUserIds(List<String> userIds) {
|
||||
LambdaQueryWrapper<SysUserRole> lambdaQuery = new LambdaQueryWrapper<>();
|
||||
lambdaQuery.in(SysUserRole::getUserId, userIds);
|
||||
@@ -70,7 +70,7 @@ public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUs
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean deleteUserRoleByRoleIds(List<String> roleIds) {
|
||||
LambdaQueryWrapper<SysUserRole> lambdaQuery = new LambdaQueryWrapper<>();
|
||||
lambdaQuery.in(SysUserRole::getRoleId, roleIds);
|
||||
|
||||
@@ -112,7 +112,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean addUser(SysUserParam.SysUserAddParam addUserParam) {
|
||||
if (UserConst.SUPER_ADMIN.equals(addUserParam.getLoginName())) {
|
||||
throw new BusinessException(UserResponseEnum.SUPER_ADMIN_REPEAT);
|
||||
@@ -135,7 +135,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean updateUser(SysUserParam.SysUserUpdateParam updateUserParam) {
|
||||
checkRepeat(updateUserParam, true, updateUserParam.getId());
|
||||
SysUser sysUser = new SysUser();
|
||||
@@ -158,7 +158,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean updatePassword(String userId, String newPassword) {
|
||||
SysUser user = lambdaQuery().ne(SysUser::getState, UserConst.STATE_DELETE).eq(SysUser::getId, userId).one();
|
||||
if (ObjectUtil.isNotNull(user)) {
|
||||
@@ -171,7 +171,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Transactional
|
||||
public boolean deleteUser(List<String> ids) {
|
||||
for (String id : ids) {
|
||||
List<SysRole> sysRoles = sysUserRoleService.listRoleByUserId(id);
|
||||
|
||||
Reference in New Issue
Block a user