整理代码
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
package com.njcn.gather.device.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum DevResponseEnum {
|
||||
//NAME_REPEAT("A001001", "名称重复"),
|
||||
|
||||
IMPORT_DATA_FAIL("A001002", "导入数据失败"),
|
||||
SERIES_AND_DEVKEY_NOT_BLANK("A001003", "当为加密设备时,加密设备的序列号和设备密钥不能为空"),
|
||||
PQ_SOURCE_GEN_NAME_ERROR("A001004", "检测源生成名称出错"),
|
||||
ERR_SOURCE_GEN_NAME_ERROR("A001005", "误差体系生成名称出错"),
|
||||
PQ_ERRSYS_GEN_NAME_ERROR("A001005", "误差体系生成名称出错"),
|
||||
PLAN_HAS_DEVICE_BIND("A001006", "检测计划下已绑定设备,请先解绑设备"),
|
||||
PQ_DEV_REPEAT("A001007", "重复的被检设备"),
|
||||
PQ_DEV_HAS_MONITOR("A001008", "该设备下关联有监测点,请先移除监测点"),
|
||||
HAS_NOT_UNCHECKED_DEVICE("A001009", "设备在检测中或已被检测过,请勿解除绑定"),
|
||||
IMPORT_PLAN_DATA_FAIL("A001010", "导入的检测计划为空"),
|
||||
IMPORT_DATA_FORMAT_FAIL("A001011", "导入数据格式错误"),
|
||||
IMPORT_SOURCE_ERROR("A001012","当前模式下一个检测计划只能有一个检测源" ),
|
||||
IMPORT_DATASOURCE_ERROR("A001013","当前模式下一个检测计划只能有一个数据源" ),
|
||||
DEV_UN_CHECKED("A001013","装置还未检测完成!" ),
|
||||
DEV_UN_REPORT("A001013","装置报告未生成!" ),
|
||||
DEVICE_DIS_ERROR("A001014","装置配置异常" ),
|
||||
DEVICE_DELETE("A001015","设备无法删除,已绑定计划!" )
|
||||
|
||||
;
|
||||
|
||||
private final String message;
|
||||
private final String code;
|
||||
|
||||
|
||||
DevResponseEnum(String code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import com.njcn.gather.device.pojo.vo.ProvinceDevExcel;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||
import com.njcn.gather.monitor.service.IPqMonitorService;
|
||||
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
||||
import com.njcn.gather.storage.service.DetectionDataDealService;
|
||||
import com.njcn.gather.system.cfg.pojo.enums.SceneEnum;
|
||||
import com.njcn.gather.system.cfg.pojo.po.SysTestConfig;
|
||||
@@ -113,7 +114,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
pqDev.setSeries(EncryptionUtil.encodeString(1, pqDev.getSeries()));
|
||||
pqDev.setDevKey(EncryptionUtil.encodeString(1, pqDev.getDevKey()));
|
||||
} else {
|
||||
throw new BusinessException(DevResponseEnum.SERIES_AND_DEVKEY_NOT_BLANK);
|
||||
throw new BusinessException(DetectionResponseEnum.SERIES_AND_DEVKEY_NOT_BLANK);
|
||||
}
|
||||
}
|
||||
if ("1".equals(sysTestConfigService.getCurrrentScene())) {
|
||||
@@ -150,7 +151,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
pqDev.setSeries(EncryptionUtil.encodeString(1, pqDev.getSeries()));
|
||||
pqDev.setDevKey(EncryptionUtil.encodeString(1, pqDev.getDevKey()));
|
||||
} else {
|
||||
throw new BusinessException(DevResponseEnum.SERIES_AND_DEVKEY_NOT_BLANK);
|
||||
throw new BusinessException(DetectionResponseEnum.SERIES_AND_DEVKEY_NOT_BLANK);
|
||||
}
|
||||
}
|
||||
// 比对式设备修改监测点
|
||||
@@ -168,7 +169,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
if (PatternEnum.CONTRAST.getValue().equals(dictDataService.getDictDataById(param.getPattern()).getCode())) {
|
||||
for (String id : param.getIds()) {
|
||||
if (ObjectUtils.isEmpty(pqMonitorService.listPqMonitorByDevId(id))) {
|
||||
throw new BusinessException(DevResponseEnum.PQ_DEV_HAS_MONITOR);
|
||||
throw new BusinessException(DetectionResponseEnum.PQ_DEV_HAS_MONITOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -200,7 +201,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
str = null;
|
||||
}
|
||||
if (ObjectUtil.isNotNull(str)) {
|
||||
throw new BusinessException(DevResponseEnum.DEVICE_DELETE, str.toString());
|
||||
throw new BusinessException(DetectionResponseEnum.DEVICE_DELETE, str.toString());
|
||||
}
|
||||
return this.lambdaUpdate().set(PqDev::getState, DataStateEnum.DELETED.getCode()).in(PqDev::getId, param.getIds()).update();
|
||||
}
|
||||
@@ -433,7 +434,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
public List<PreDetection> getDevInfo(List<String> devIds) {
|
||||
List<PreDetection> preDetections = this.baseMapper.selectDevInfo(devIds);
|
||||
if (devIds.size() != preDetections.size()) {
|
||||
throw new BusinessException(DevResponseEnum.DEVICE_DIS_ERROR);
|
||||
throw new BusinessException(DetectionResponseEnum.DEVICE_DIS_ERROR);
|
||||
}
|
||||
|
||||
for (PreDetection preDetection : preDetections) {
|
||||
@@ -463,10 +464,10 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
PqDev pqDev = this.getById(id);
|
||||
if (ObjectUtil.isNotNull(pqDev)) {
|
||||
if (!pqDev.getCheckState().equals(CheckStateEnum.CHECKED.getValue())) {
|
||||
throw new BusinessException(DevResponseEnum.DEV_UN_CHECKED);
|
||||
throw new BusinessException(DetectionResponseEnum.DEV_UN_CHECKED);
|
||||
}
|
||||
if (!pqDev.getReportState().equals(DevReportStateEnum.GENERATED.getValue())) {
|
||||
throw new BusinessException(DevResponseEnum.DEV_UN_REPORT);
|
||||
throw new BusinessException(DetectionResponseEnum.DEV_UN_REPORT);
|
||||
}
|
||||
boolean update = this.lambdaUpdate()
|
||||
.set(PqDev::getCheckState, CheckStateEnum.DOCUMENTED.getValue())
|
||||
@@ -486,7 +487,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new BusinessException(DevResponseEnum.DEV_UN_CHECKED);
|
||||
throw new BusinessException(DetectionResponseEnum.DEV_UN_CHECKED);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -664,7 +665,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
cnDevExcelList = excelImportResult.getList();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(DevResponseEnum.IMPORT_DATA_FAIL);
|
||||
throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FAIL);
|
||||
}
|
||||
this.importCNDev(cnDevExcelList, patternId, planId);
|
||||
}
|
||||
@@ -687,7 +688,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
pqDev.setSeries(EncryptionUtil.encodeString(1, pqDev.getSeries()));
|
||||
pqDev.setDevKey(EncryptionUtil.encodeString(1, pqDev.getDevKey()));
|
||||
} else {
|
||||
throw new BusinessException(DevResponseEnum.SERIES_AND_DEVKEY_NOT_BLANK);
|
||||
throw new BusinessException(DetectionResponseEnum.SERIES_AND_DEVKEY_NOT_BLANK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -722,7 +723,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new BusinessException(DevResponseEnum.IMPORT_DATA_FORMAT_FAIL);
|
||||
throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FORMAT_FAIL);
|
||||
}
|
||||
} else {
|
||||
param.setName(pqDev.getName());
|
||||
@@ -765,7 +766,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
}
|
||||
int count = this.count(queryWrapper);
|
||||
if (count > 0) {
|
||||
throw new BusinessException(DevResponseEnum.PQ_DEV_REPEAT);
|
||||
throw new BusinessException(DetectionResponseEnum.PQ_DEV_REPEAT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -986,7 +987,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
cnDevExcelList = excelImportResult.getList();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(DevResponseEnum.IMPORT_DATA_FAIL);
|
||||
throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FAIL);
|
||||
}
|
||||
this.importProvinceDev(cnDevExcelList, patternId, planId);
|
||||
}
|
||||
@@ -1009,7 +1010,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
pqDev.setSeries(EncryptionUtil.encodeString(1, pqDev.getSeries()));
|
||||
pqDev.setDevKey(EncryptionUtil.encodeString(1, pqDev.getDevKey()));
|
||||
} else {
|
||||
throw new BusinessException(DevResponseEnum.SERIES_AND_DEVKEY_NOT_BLANK);
|
||||
throw new BusinessException(DetectionResponseEnum.SERIES_AND_DEVKEY_NOT_BLANK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1044,7 +1045,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new BusinessException(DevResponseEnum.IMPORT_DATA_FORMAT_FAIL);
|
||||
throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FORMAT_FAIL);
|
||||
}
|
||||
} else {
|
||||
param.setName(pqDev.getName());
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.njcn.gather.err.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2025-03-10
|
||||
*/
|
||||
@Getter
|
||||
public enum ErrResponseEnum {
|
||||
ERR_SYS_BOUND_NOT_DELETE("A100001","误差体系已被计划所绑定,无法删除!");
|
||||
|
||||
private String code;
|
||||
private String message;
|
||||
|
||||
ErrResponseEnum(String code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -8,9 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.gather.device.pojo.enums.DevResponseEnum;
|
||||
import com.njcn.gather.err.mapper.PqErrSysMapper;
|
||||
import com.njcn.gather.err.pojo.enums.ErrResponseEnum;
|
||||
import com.njcn.gather.err.pojo.param.PqErrSysDtlsParam;
|
||||
import com.njcn.gather.err.pojo.param.PqErrSysParam;
|
||||
import com.njcn.gather.err.pojo.po.PqErrSys;
|
||||
@@ -18,6 +16,7 @@ import com.njcn.gather.err.pojo.po.PqErrSysDtls;
|
||||
import com.njcn.gather.err.pojo.vo.PqErrSysDtlsVO;
|
||||
import com.njcn.gather.err.service.IPqErrSysDtlsService;
|
||||
import com.njcn.gather.err.service.IPqErrSysService;
|
||||
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||
@@ -98,7 +97,7 @@ public class PqErrSysServiceImpl extends ServiceImpl<PqErrSysMapper, PqErrSys> i
|
||||
public boolean deletePqErrSys(List<String> ids) {
|
||||
Integer count = this.baseMapper.getCountBoundByIds(ids);
|
||||
if (count > 0) {
|
||||
throw new BusinessException(ErrResponseEnum.ERR_SYS_BOUND_NOT_DELETE);
|
||||
throw new BusinessException(DetectionResponseEnum.ERR_SYS_BOUND_NOT_DELETE);
|
||||
}
|
||||
pqErrSysDtlsService.deletePqErrSysDtlsByPqErrSysId(ids);
|
||||
this.lambdaUpdate().in(PqErrSys::getId, ids).set(PqErrSys::getState, DataStateEnum.DELETED.getCode()).update();
|
||||
@@ -188,7 +187,7 @@ public class PqErrSysServiceImpl extends ServiceImpl<PqErrSysMapper, PqErrSys> i
|
||||
if (ObjectUtil.isNotNull(devLevelDictData)) {
|
||||
return param.getStandardName() + "-" + param.getStandardTime() + "-" + devLevelDictData.getName();
|
||||
}
|
||||
throw new BusinessException(DevResponseEnum.PQ_ERRSYS_GEN_NAME_ERROR);
|
||||
throw new BusinessException(DetectionResponseEnum.PQ_ERRSYS_GEN_NAME_ERROR);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -213,6 +212,6 @@ public class PqErrSysServiceImpl extends ServiceImpl<PqErrSysMapper, PqErrSys> i
|
||||
if (ObjectUtils.allNotNull(param.getStandardName(), param.getStandardTime(), devLevel)) {
|
||||
return param.getStandardName() + "-" + param.getStandardTime() + "-" + devLevel.getName();
|
||||
}
|
||||
throw new BusinessException(DevResponseEnum.ERR_SOURCE_GEN_NAME_ERROR);
|
||||
throw new BusinessException(DetectionResponseEnum.ERR_SOURCE_GEN_NAME_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.njcn.gather.icd.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2025-02-11
|
||||
*/
|
||||
@Getter
|
||||
public enum IcdPathResponseEnum {
|
||||
|
||||
ICD_PATH_NAME_REPEAT("A004007", "icd名称重复");
|
||||
|
||||
private final String code;
|
||||
private final String message;
|
||||
|
||||
IcdPathResponseEnum(String code, String message) {
|
||||
this.message = message;
|
||||
this.code = code;
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.gather.icd.mapper.PqIcdPathMapper;
|
||||
import com.njcn.gather.icd.pojo.enums.IcdPathResponseEnum;
|
||||
import com.njcn.gather.icd.pojo.param.PqIcdPathParam;
|
||||
import com.njcn.gather.icd.pojo.po.PqIcdPath;
|
||||
import com.njcn.gather.icd.service.IPqIcdPathService;
|
||||
import com.njcn.gather.type.pojo.po.DevType;
|
||||
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -81,7 +80,7 @@ public class PqIcdPathServiceImpl extends ServiceImpl<PqIcdPathMapper, PqIcdPath
|
||||
}
|
||||
int count = this.count(wrapper);
|
||||
if (count > 0) {
|
||||
throw new BusinessException(IcdPathResponseEnum.ICD_PATH_NAME_REPEAT);
|
||||
throw new BusinessException(DetectionResponseEnum.ICD_PATH_NAME_REPEAT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
package com.njcn.gather.plan.controller;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
@@ -13,22 +9,18 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
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.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.FileUtil;
|
||||
import com.njcn.web.utils.HttpResultUtil;
|
||||
import com.njcn.web.utils.PoiUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.njcn.gather.plan.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2025-01-16
|
||||
*/
|
||||
@Getter
|
||||
public enum PlanResponseEnum {
|
||||
PLAN_REPEATED("A003014", "当前模式下,该计划已存在"),
|
||||
PLAN_NOT_EXIST("A003015", "该计划不存在"),
|
||||
SCRIPT_RELATE_DICT_NOT_EXIST("A003016","脚本关联的字典不存在"),
|
||||
NOT_CHECKED_PLAN_CANNOT_ANALYSE("A003017","只有检测状态为检测完成的计划才能进行统计分析" ),
|
||||
CANNOT_CHANGE_SCRIPT_WHEN_CHECKING("A003018","只有检测状态为未检时,才能修改检测脚本" ),
|
||||
CANNOT_CHANGE_ERROR_SYS_WHEN_CHECKING("A003019","只有检测状态为未检时,才能修改误差体系" ),
|
||||
CANNOT_CHANGE_REPORT_WHEN_CHECKING("A003020","只有检测状态为未检时,才能修改绑定报告模板");
|
||||
|
||||
private final String message;
|
||||
private final String code;
|
||||
|
||||
|
||||
PlanResponseEnum(String code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,6 @@ import com.njcn.gather.err.service.IPqErrSysService;
|
||||
import com.njcn.gather.plan.mapper.AdPlanMapper;
|
||||
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
|
||||
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.AdPlanVO;
|
||||
@@ -37,6 +36,7 @@ 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.pojo.enums.DetectionResponseEnum;
|
||||
import com.njcn.gather.report.pojo.po.PqReport;
|
||||
import com.njcn.gather.script.pojo.po.PqScriptDtls;
|
||||
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||
@@ -194,7 +194,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
String reportId = this.baseMapper.getReportIdByNameAndVersion(split[0], split[1]);
|
||||
if (plan1.getTestState() != CheckStateEnum.UNCHECKED.getValue()) {
|
||||
if (!reportId.equals(plan1.getReportTemplateId())) {
|
||||
throw new BusinessException(PlanResponseEnum.CANNOT_CHANGE_REPORT_WHEN_CHECKING);
|
||||
throw new BusinessException(DetectionResponseEnum.CANNOT_CHANGE_REPORT_WHEN_CHECKING);
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(reportId)) {
|
||||
@@ -204,13 +204,13 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
|
||||
if (plan1.getTestState() != CheckStateEnum.UNCHECKED.getValue()) {
|
||||
if (!plan1.getScriptId().equals(param.getScriptId())) {
|
||||
throw new BusinessException(PlanResponseEnum.CANNOT_CHANGE_SCRIPT_WHEN_CHECKING);
|
||||
throw new BusinessException(DetectionResponseEnum.CANNOT_CHANGE_SCRIPT_WHEN_CHECKING);
|
||||
}
|
||||
if (!plan1.getErrorSysId().equals(param.getErrorSysId())) {
|
||||
throw new BusinessException(PlanResponseEnum.CANNOT_CHANGE_ERROR_SYS_WHEN_CHECKING);
|
||||
throw new BusinessException(DetectionResponseEnum.CANNOT_CHANGE_ERROR_SYS_WHEN_CHECKING);
|
||||
}
|
||||
if (param.getAssociateReport() != null && param.getAssociateReport() != plan1.getAssociateReport()) {
|
||||
throw new BusinessException(PlanResponseEnum.CANNOT_CHANGE_REPORT_WHEN_CHECKING);
|
||||
throw new BusinessException(DetectionResponseEnum.CANNOT_CHANGE_REPORT_WHEN_CHECKING);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
PqDevParam.QueryParam queryParam = new PqDevParam.QueryParam();
|
||||
queryParam.setPlanId(id);
|
||||
if (ObjectUtils.isNotEmpty(pqDevService.listByPlanId(queryParam))) {
|
||||
throw new BusinessException(DevResponseEnum.PLAN_HAS_DEVICE_BIND);
|
||||
throw new BusinessException(DetectionResponseEnum.PLAN_HAS_DEVICE_BIND);
|
||||
}
|
||||
}
|
||||
// 删除检测计划、检测源关联
|
||||
@@ -308,7 +308,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
List<Map<String, String>> result = new ArrayList<>();
|
||||
AdPlan adPlan = this.getById(planId);
|
||||
if (ObjectUtil.isNull(adPlan)) {
|
||||
throw new BusinessException(PlanResponseEnum.PLAN_NOT_EXIST);
|
||||
throw new BusinessException(DetectionResponseEnum.PLAN_NOT_EXIST);
|
||||
}
|
||||
String scriptId = adPlan.getScriptId();
|
||||
|
||||
@@ -345,7 +345,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
map.put("code", dictTree.getCode());
|
||||
map.put("scriptName", dictTree.getName());
|
||||
} else {
|
||||
throw new BusinessException(PlanResponseEnum.SCRIPT_RELATE_DICT_NOT_EXIST);
|
||||
throw new BusinessException(DetectionResponseEnum.SCRIPT_RELATE_DICT_NOT_EXIST);
|
||||
}
|
||||
result.add(map);
|
||||
});
|
||||
@@ -408,7 +408,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
|
||||
planList.forEach(plan -> {
|
||||
if (!CheckStateEnum.CHECKED.getValue().equals(plan.getTestState())) {
|
||||
throw new BusinessException(PlanResponseEnum.NOT_CHECKED_PLAN_CANNOT_ANALYSE);
|
||||
throw new BusinessException(DetectionResponseEnum.NOT_CHECKED_PLAN_CANNOT_ANALYSE);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -576,7 +576,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
planExcelList = excelImportResult.getList();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(DevResponseEnum.IMPORT_DATA_FAIL);
|
||||
throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FAIL);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(planExcelList)) {
|
||||
this.importCNPlan(planExcelList, patternId);
|
||||
@@ -614,14 +614,14 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
String[] sourceNames = source.split(StrUtil.COMMA);
|
||||
// 若非比对模式,检测源、数据源有2个以上时,不导入
|
||||
if (!PatternEnum.CONTRAST.getValue().equals(patternCode) && sourceNames.length > 1) {
|
||||
throw new BusinessException(DevResponseEnum.IMPORT_SOURCE_ERROR);
|
||||
throw new BusinessException(DetectionResponseEnum.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);
|
||||
throw new BusinessException(DetectionResponseEnum.IMPORT_DATASOURCE_ERROR);
|
||||
}
|
||||
|
||||
List<String> sourceIds = pqSourceService.listPqSourceIdByName(sourceNames);
|
||||
@@ -654,7 +654,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
planExcelList = excelImportResult.getList();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(DevResponseEnum.IMPORT_DATA_FAIL);
|
||||
throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FAIL);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(planExcelList)) {
|
||||
this.importProvincePlan(planExcelList, patternId);
|
||||
@@ -691,14 +691,14 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
String[] sourceNames = source.split(StrUtil.COMMA);
|
||||
// 若非比对模式,检测源、数据源有2个以上时,不导入
|
||||
if (!PatternEnum.CONTRAST.getValue().equals(patternCode) && sourceNames.length > 1) {
|
||||
throw new BusinessException(DevResponseEnum.IMPORT_SOURCE_ERROR);
|
||||
throw new BusinessException(DetectionResponseEnum.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);
|
||||
throw new BusinessException(DetectionResponseEnum.IMPORT_DATASOURCE_ERROR);
|
||||
}
|
||||
|
||||
List<String> sourceIds = pqSourceService.listPqSourceIdByName(sourceNames);
|
||||
@@ -864,7 +864,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
}
|
||||
int count = this.count(queryWrapper);
|
||||
if (count > 0) {
|
||||
throw new BusinessException(PlanResponseEnum.PLAN_REPEATED);
|
||||
throw new BusinessException(DetectionResponseEnum.PLAN_REPEATED);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.njcn.gather.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2025-03-26
|
||||
*/
|
||||
@Getter
|
||||
public enum DetectionResponseEnum {
|
||||
/**
|
||||
* 检测模块异常响应码的范围:
|
||||
* A02000 ~ A02
|
||||
*/
|
||||
DEV_TYPE_NAME_REPEAT("A02000", "设备类型名称重复"),
|
||||
SOURCE_BOUND_NOT_DELETE("A02001", "源已被计划所绑定,无法删除!"),
|
||||
SCRIPT_BOUND_NOT_DELETE("A02003", "脚本已被计划所绑定,无法删除!"),
|
||||
RAW_DATA_NOT_EXIST("A02004", "原始数据不存在"),
|
||||
PLAN_REPEATED("A02005", "当前模式下,该计划已存在"),
|
||||
PLAN_NOT_EXIST("A02006", "该计划不存在"),
|
||||
SCRIPT_RELATE_DICT_NOT_EXIST("A02007","脚本关联的字典不存在"),
|
||||
NOT_CHECKED_PLAN_CANNOT_ANALYSE("A02008","只有检测状态为检测完成的计划才能进行统计分析" ),
|
||||
CANNOT_CHANGE_SCRIPT_WHEN_CHECKING("A02009","只有检测状态为未检时,才能修改检测脚本" ),
|
||||
CANNOT_CHANGE_ERROR_SYS_WHEN_CHECKING("A02010","只有检测状态为未检时,才能修改误差体系" ),
|
||||
CANNOT_CHANGE_REPORT_WHEN_CHECKING("A02011","只有检测状态为未检时,才能修改绑定报告模板"),
|
||||
ICD_PATH_NAME_REPEAT("A02012", "icd名称重复"),
|
||||
ERR_SYS_BOUND_NOT_DELETE("A02013","误差体系已被计划所绑定,无法删除!"),
|
||||
|
||||
|
||||
IMPORT_DATA_FAIL("A02014", "导入数据失败"),
|
||||
SERIES_AND_DEVKEY_NOT_BLANK("A02015", "当为加密设备时,加密设备的序列号和设备密钥不能为空"),
|
||||
PQ_SOURCE_GEN_NAME_ERROR("A02016", "检测源生成名称出错"),
|
||||
ERR_SOURCE_GEN_NAME_ERROR("A02017", "误差体系生成名称出错"),
|
||||
PQ_ERRSYS_GEN_NAME_ERROR("A02018", "误差体系生成名称出错"),
|
||||
PLAN_HAS_DEVICE_BIND("A02019", "检测计划下已绑定设备,请先解绑设备"),
|
||||
PQ_DEV_REPEAT("A02020", "重复的被检设备"),
|
||||
PQ_DEV_HAS_MONITOR("A02021", "该设备下关联有监测点,请先移除监测点"),
|
||||
HAS_NOT_UNCHECKED_DEVICE("A02022", "设备在检测中或已被检测过,请勿解除绑定"),
|
||||
IMPORT_PLAN_DATA_FAIL("A02023", "导入的检测计划为空"),
|
||||
IMPORT_DATA_FORMAT_FAIL("A02024", "导入数据格式错误"),
|
||||
IMPORT_SOURCE_ERROR("A02025","当前模式下一个检测计划只能有一个检测源" ),
|
||||
IMPORT_DATASOURCE_ERROR("A02026","当前模式下一个检测计划只能有一个数据源" ),
|
||||
DEV_UN_CHECKED("A02027","装置还未检测完成!" ),
|
||||
DEV_UN_REPORT("A02028","装置报告未生成!" ),
|
||||
DEVICE_DIS_ERROR("A02029","装置配置异常" ),
|
||||
DEVICE_DELETE("A02030","设备无法删除,已绑定计划!" );
|
||||
|
||||
private final String code;
|
||||
|
||||
private final String message;
|
||||
|
||||
DetectionResponseEnum(String code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.njcn.gather.result.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2025-01-16
|
||||
*/
|
||||
@Getter
|
||||
public enum ResultResponseEnum {
|
||||
|
||||
RAW_DATA_NOT_EXIST("原始数据不存在!", "A001014");
|
||||
|
||||
private final String message;
|
||||
private final String code;
|
||||
|
||||
ResultResponseEnum(String code,String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ import com.njcn.gather.detection.service.impl.DetectionServiceImpl;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||
import com.njcn.gather.plan.service.IAdPlanService;
|
||||
import com.njcn.gather.result.pojo.enums.ResultResponseEnum;
|
||||
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
||||
import com.njcn.gather.result.pojo.enums.ResultUnitEnum;
|
||||
import com.njcn.gather.result.pojo.param.ResultParam;
|
||||
import com.njcn.gather.result.pojo.vo.FormContentVO;
|
||||
@@ -888,7 +888,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
});
|
||||
ExcelUtil.exportExcel("原始数据.xlsx", sheetsList);
|
||||
} else {
|
||||
throw new BusinessException(ResultResponseEnum.RAW_DATA_NOT_EXIST);
|
||||
throw new BusinessException(DetectionResponseEnum.RAW_DATA_NOT_EXIST);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.njcn.gather.script.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2025-03-10
|
||||
*/
|
||||
@Getter
|
||||
public enum ScriptResponseEnum {
|
||||
SCRIPT_BOUND_NOT_DELETE("A020001", "脚本已被计划所绑定,无法删除!");
|
||||
|
||||
private String code;
|
||||
private String message;
|
||||
|
||||
ScriptResponseEnum(String code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -8,10 +8,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||
import com.njcn.gather.plan.service.IAdPlanService;
|
||||
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
||||
import com.njcn.gather.script.mapper.PqScriptMapper;
|
||||
import com.njcn.gather.script.pojo.enums.ScriptResponseEnum;
|
||||
import com.njcn.gather.script.pojo.param.PqScriptParam;
|
||||
import com.njcn.gather.script.pojo.po.PqScript;
|
||||
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||
@@ -84,7 +82,7 @@ public class PqScriptServiceImpl extends ServiceImpl<PqScriptMapper, PqScript> i
|
||||
public boolean deletePqScript(List<String> ids) {
|
||||
Integer count = this.baseMapper.getBoundCountByScriptIds(ids);
|
||||
if (count > 0) {
|
||||
throw new BusinessException(ScriptResponseEnum.SCRIPT_BOUND_NOT_DELETE);
|
||||
throw new BusinessException(DetectionResponseEnum.SCRIPT_BOUND_NOT_DELETE);
|
||||
}
|
||||
//删除对应的脚本详情
|
||||
pqScriptDtlsService.deletePqScriptDtlsByScriptId(ids);
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.njcn.gather.source.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2025-03-10
|
||||
*/
|
||||
@Getter
|
||||
public enum SourceResponseEnum {
|
||||
SOURCE_BOUND_NOT_DELETE("A030001", "源已被计划所绑定,无法删除!");
|
||||
|
||||
private String code;
|
||||
private String message;
|
||||
|
||||
SourceResponseEnum(String code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -11,25 +11,26 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.gather.device.pojo.enums.CommonEnum;
|
||||
import com.njcn.gather.device.pojo.enums.DevResponseEnum;
|
||||
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
||||
import com.njcn.gather.source.mapper.PqSourceMapper;
|
||||
import com.njcn.gather.source.pojo.enums.SourceResponseEnum;
|
||||
import com.njcn.gather.source.pojo.param.PqSourceParam;
|
||||
import com.njcn.gather.source.pojo.po.PqSource;
|
||||
import com.njcn.gather.source.pojo.po.SourceInitialize;
|
||||
import com.njcn.gather.source.pojo.po.SourceParam;
|
||||
import com.njcn.gather.source.service.IPqSourceService;
|
||||
import com.njcn.gather.type.pojo.po.DevType;
|
||||
import com.njcn.gather.type.service.IDevTypeService;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||
import com.njcn.gather.type.service.IDevTypeService;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -87,8 +88,8 @@ public class PqSourceServiceImpl extends ServiceImpl<PqSourceMapper, PqSource> i
|
||||
@Transactional
|
||||
public boolean deletePqSource(List<String> ids) {
|
||||
Integer count = this.baseMapper.getCountBoundByIds(ids);
|
||||
if(count > 0){
|
||||
throw new BusinessException(SourceResponseEnum.SOURCE_BOUND_NOT_DELETE);
|
||||
if (count > 0) {
|
||||
throw new BusinessException(DetectionResponseEnum.SOURCE_BOUND_NOT_DELETE);
|
||||
}
|
||||
return this.lambdaUpdate().in(PqSource::getId, ids).set(PqSource::getState, DataStateEnum.DELETED.getCode()).update();
|
||||
}
|
||||
@@ -133,7 +134,7 @@ public class PqSourceServiceImpl extends ServiceImpl<PqSourceMapper, PqSource> i
|
||||
.peek(p -> p.setChildren(getInitializeChildren(p, list)))
|
||||
.sorted(Comparator.comparingInt(SourceInitialize.Initialize::getSort))
|
||||
.collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(sourceParams)){
|
||||
if (CollUtil.isNotEmpty(sourceParams)) {
|
||||
SourceInitialize initialize = new SourceInitialize();
|
||||
SourceInitialize.Initialize source = sourceParams.get(0);
|
||||
initialize.setSourceId(source.getValue());
|
||||
@@ -194,6 +195,6 @@ public class PqSourceServiceImpl extends ServiceImpl<PqSourceMapper, PqSource> i
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new BusinessException(DevResponseEnum.PQ_SOURCE_GEN_NAME_ERROR);
|
||||
throw new BusinessException(DetectionResponseEnum.PQ_SOURCE_GEN_NAME_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.njcn.gather.type.pojo.enums;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2025-02-10
|
||||
*/
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum DevTypeResponseEnum {
|
||||
|
||||
DEV_TYPE_NAME_REPEAT("A003007", "设备类型名称重复");
|
||||
|
||||
private final String code;
|
||||
private final String message;
|
||||
|
||||
DevTypeResponseEnum(String code, String message) {
|
||||
this.message = message;
|
||||
this.code = code;
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||
import com.njcn.gather.type.mapper.DevTypeMapper;
|
||||
import com.njcn.gather.type.pojo.enums.DevTypeResponseEnum;
|
||||
import com.njcn.gather.type.pojo.param.DevTypeParam;
|
||||
import com.njcn.gather.type.pojo.po.DevType;
|
||||
import com.njcn.gather.type.service.IDevTypeService;
|
||||
@@ -115,7 +115,7 @@ public class DevTypeServiceImpl extends ServiceImpl<DevTypeMapper, DevType> impl
|
||||
}
|
||||
int count = this.count(wrapper);
|
||||
if (count > 0) {
|
||||
throw new BusinessException(DevTypeResponseEnum.DEV_TYPE_NAME_REPEAT);
|
||||
throw new BusinessException(DetectionResponseEnum.DEV_TYPE_NAME_REPEAT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user