整理代码

This commit is contained in:
caozehui
2025-03-26 10:01:56 +08:00
parent 4ef5c982de
commit 9a7d841d9c
29 changed files with 174 additions and 513 deletions

View File

@@ -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;
}
}

View File

@@ -31,6 +31,7 @@ import com.njcn.gather.device.pojo.vo.ProvinceDevExcel;
import com.njcn.gather.device.service.IPqDevService; import com.njcn.gather.device.service.IPqDevService;
import com.njcn.gather.monitor.pojo.po.PqMonitor; import com.njcn.gather.monitor.pojo.po.PqMonitor;
import com.njcn.gather.monitor.service.IPqMonitorService; 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.storage.service.DetectionDataDealService;
import com.njcn.gather.system.cfg.pojo.enums.SceneEnum; import com.njcn.gather.system.cfg.pojo.enums.SceneEnum;
import com.njcn.gather.system.cfg.pojo.po.SysTestConfig; 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.setSeries(EncryptionUtil.encodeString(1, pqDev.getSeries()));
pqDev.setDevKey(EncryptionUtil.encodeString(1, pqDev.getDevKey())); pqDev.setDevKey(EncryptionUtil.encodeString(1, pqDev.getDevKey()));
} else { } else {
throw new BusinessException(DevResponseEnum.SERIES_AND_DEVKEY_NOT_BLANK); throw new BusinessException(DetectionResponseEnum.SERIES_AND_DEVKEY_NOT_BLANK);
} }
} }
if ("1".equals(sysTestConfigService.getCurrrentScene())) { 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.setSeries(EncryptionUtil.encodeString(1, pqDev.getSeries()));
pqDev.setDevKey(EncryptionUtil.encodeString(1, pqDev.getDevKey())); pqDev.setDevKey(EncryptionUtil.encodeString(1, pqDev.getDevKey()));
} else { } 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())) { if (PatternEnum.CONTRAST.getValue().equals(dictDataService.getDictDataById(param.getPattern()).getCode())) {
for (String id : param.getIds()) { for (String id : param.getIds()) {
if (ObjectUtils.isEmpty(pqMonitorService.listPqMonitorByDevId(id))) { 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; str = null;
} }
if (ObjectUtil.isNotNull(str)) { 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(); 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) { public List<PreDetection> getDevInfo(List<String> devIds) {
List<PreDetection> preDetections = this.baseMapper.selectDevInfo(devIds); List<PreDetection> preDetections = this.baseMapper.selectDevInfo(devIds);
if (devIds.size() != preDetections.size()) { if (devIds.size() != preDetections.size()) {
throw new BusinessException(DevResponseEnum.DEVICE_DIS_ERROR); throw new BusinessException(DetectionResponseEnum.DEVICE_DIS_ERROR);
} }
for (PreDetection preDetection : preDetections) { for (PreDetection preDetection : preDetections) {
@@ -463,10 +464,10 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
PqDev pqDev = this.getById(id); PqDev pqDev = this.getById(id);
if (ObjectUtil.isNotNull(pqDev)) { if (ObjectUtil.isNotNull(pqDev)) {
if (!pqDev.getCheckState().equals(CheckStateEnum.CHECKED.getValue())) { 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())) { 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() boolean update = this.lambdaUpdate()
.set(PqDev::getCheckState, CheckStateEnum.DOCUMENTED.getValue()) .set(PqDev::getCheckState, CheckStateEnum.DOCUMENTED.getValue())
@@ -486,7 +487,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
} }
} }
} else { } 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(); cnDevExcelList = excelImportResult.getList();
} }
} catch (Exception e) { } catch (Exception e) {
throw new BusinessException(DevResponseEnum.IMPORT_DATA_FAIL); throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FAIL);
} }
this.importCNDev(cnDevExcelList, patternId, planId); 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.setSeries(EncryptionUtil.encodeString(1, pqDev.getSeries()));
pqDev.setDevKey(EncryptionUtil.encodeString(1, pqDev.getDevKey())); pqDev.setDevKey(EncryptionUtil.encodeString(1, pqDev.getDevKey()));
} else { } 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 { } else {
throw new BusinessException(DevResponseEnum.IMPORT_DATA_FORMAT_FAIL); throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FORMAT_FAIL);
} }
} else { } else {
param.setName(pqDev.getName()); param.setName(pqDev.getName());
@@ -765,7 +766,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
} }
int count = this.count(queryWrapper); int count = this.count(queryWrapper);
if (count > 0) { 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(); cnDevExcelList = excelImportResult.getList();
} }
} catch (Exception e) { } catch (Exception e) {
throw new BusinessException(DevResponseEnum.IMPORT_DATA_FAIL); throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FAIL);
} }
this.importProvinceDev(cnDevExcelList, patternId, planId); 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.setSeries(EncryptionUtil.encodeString(1, pqDev.getSeries()));
pqDev.setDevKey(EncryptionUtil.encodeString(1, pqDev.getDevKey())); pqDev.setDevKey(EncryptionUtil.encodeString(1, pqDev.getDevKey()));
} else { } 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 { } else {
throw new BusinessException(DevResponseEnum.IMPORT_DATA_FORMAT_FAIL); throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FORMAT_FAIL);
} }
} else { } else {
param.setName(pqDev.getName()); param.setName(pqDev.getName());

View File

@@ -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;
}
}

View File

@@ -8,9 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum; import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException; 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.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.PqErrSysDtlsParam;
import com.njcn.gather.err.pojo.param.PqErrSysParam; import com.njcn.gather.err.pojo.param.PqErrSysParam;
import com.njcn.gather.err.pojo.po.PqErrSys; 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.pojo.vo.PqErrSysDtlsVO;
import com.njcn.gather.err.service.IPqErrSysDtlsService; import com.njcn.gather.err.service.IPqErrSysDtlsService;
import com.njcn.gather.err.service.IPqErrSysService; 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.DictData;
import com.njcn.gather.system.dictionary.pojo.po.DictTree; import com.njcn.gather.system.dictionary.pojo.po.DictTree;
import com.njcn.gather.system.dictionary.service.IDictDataService; 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) { public boolean deletePqErrSys(List<String> ids) {
Integer count = this.baseMapper.getCountBoundByIds(ids); Integer count = this.baseMapper.getCountBoundByIds(ids);
if (count > 0) { if (count > 0) {
throw new BusinessException(ErrResponseEnum.ERR_SYS_BOUND_NOT_DELETE); throw new BusinessException(DetectionResponseEnum.ERR_SYS_BOUND_NOT_DELETE);
} }
pqErrSysDtlsService.deletePqErrSysDtlsByPqErrSysId(ids); pqErrSysDtlsService.deletePqErrSysDtlsByPqErrSysId(ids);
this.lambdaUpdate().in(PqErrSys::getId, ids).set(PqErrSys::getState, DataStateEnum.DELETED.getCode()).update(); 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)) { if (ObjectUtil.isNotNull(devLevelDictData)) {
return param.getStandardName() + "-" + param.getStandardTime() + "-" + devLevelDictData.getName(); 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 @Override
@@ -213,6 +212,6 @@ public class PqErrSysServiceImpl extends ServiceImpl<PqErrSysMapper, PqErrSys> i
if (ObjectUtils.allNotNull(param.getStandardName(), param.getStandardTime(), devLevel)) { if (ObjectUtils.allNotNull(param.getStandardName(), param.getStandardTime(), devLevel)) {
return param.getStandardName() + "-" + param.getStandardTime() + "-" + devLevel.getName(); 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);
} }
} }

View File

@@ -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;
}
}

View File

@@ -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.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.gather.icd.mapper.PqIcdPathMapper; 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.param.PqIcdPathParam;
import com.njcn.gather.icd.pojo.po.PqIcdPath; import com.njcn.gather.icd.pojo.po.PqIcdPath;
import com.njcn.gather.icd.service.IPqIcdPathService; 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 com.njcn.web.factory.PageFactory;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -81,7 +80,7 @@ public class PqIcdPathServiceImpl extends ServiceImpl<PqIcdPathMapper, PqIcdPath
} }
int count = this.count(wrapper); int count = this.count(wrapper);
if (count > 0) { if (count > 0) {
throw new BusinessException(IcdPathResponseEnum.ICD_PATH_NAME_REPEAT); throw new BusinessException(DetectionResponseEnum.ICD_PATH_NAME_REPEAT);
} }
} }
} }

View File

@@ -1,9 +1,5 @@
package com.njcn.gather.plan.controller; 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 cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo; 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.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.LogUtil; 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.param.AdPlanParam;
import com.njcn.gather.plan.pojo.vo.AdPlanExcel;
import com.njcn.gather.plan.pojo.vo.AdPlanVO; import com.njcn.gather.plan.pojo.vo.AdPlanVO;
import com.njcn.gather.plan.service.IAdPlanService; import com.njcn.gather.plan.service.IAdPlanService;
import com.njcn.web.controller.BaseController; import com.njcn.web.controller.BaseController;
import com.njcn.web.utils.FileUtil; import com.njcn.web.utils.FileUtil;
import com.njcn.web.utils.HttpResultUtil; import com.njcn.web.utils.HttpResultUtil;
import com.njcn.web.utils.PoiUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;

View File

@@ -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;
}
}

View File

@@ -29,7 +29,6 @@ import com.njcn.gather.err.service.IPqErrSysService;
import com.njcn.gather.plan.mapper.AdPlanMapper; import com.njcn.gather.plan.mapper.AdPlanMapper;
import com.njcn.gather.plan.pojo.enums.DataSourceEnum; import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
import com.njcn.gather.plan.pojo.enums.PlanReportStateEnum; 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.param.AdPlanParam;
import com.njcn.gather.plan.pojo.po.AdPlan; import com.njcn.gather.plan.pojo.po.AdPlan;
import com.njcn.gather.plan.pojo.vo.AdPlanVO; 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.pojo.vo.ProvincePlanExcel;
import com.njcn.gather.plan.service.IAdPlanService; import com.njcn.gather.plan.service.IAdPlanService;
import com.njcn.gather.plan.service.IAdPlanSourceService; 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.report.pojo.po.PqReport;
import com.njcn.gather.script.pojo.po.PqScriptDtls; import com.njcn.gather.script.pojo.po.PqScriptDtls;
import com.njcn.gather.script.service.IPqScriptDtlsService; 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]); String reportId = this.baseMapper.getReportIdByNameAndVersion(split[0], split[1]);
if (plan1.getTestState() != CheckStateEnum.UNCHECKED.getValue()) { if (plan1.getTestState() != CheckStateEnum.UNCHECKED.getValue()) {
if (!reportId.equals(plan1.getReportTemplateId())) { 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)) { if (StrUtil.isNotBlank(reportId)) {
@@ -204,13 +204,13 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
if (plan1.getTestState() != CheckStateEnum.UNCHECKED.getValue()) { if (plan1.getTestState() != CheckStateEnum.UNCHECKED.getValue()) {
if (!plan1.getScriptId().equals(param.getScriptId())) { 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())) { 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()) { 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(); PqDevParam.QueryParam queryParam = new PqDevParam.QueryParam();
queryParam.setPlanId(id); queryParam.setPlanId(id);
if (ObjectUtils.isNotEmpty(pqDevService.listByPlanId(queryParam))) { 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<>(); List<Map<String, String>> result = new ArrayList<>();
AdPlan adPlan = this.getById(planId); AdPlan adPlan = this.getById(planId);
if (ObjectUtil.isNull(adPlan)) { if (ObjectUtil.isNull(adPlan)) {
throw new BusinessException(PlanResponseEnum.PLAN_NOT_EXIST); throw new BusinessException(DetectionResponseEnum.PLAN_NOT_EXIST);
} }
String scriptId = adPlan.getScriptId(); String scriptId = adPlan.getScriptId();
@@ -345,7 +345,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
map.put("code", dictTree.getCode()); map.put("code", dictTree.getCode());
map.put("scriptName", dictTree.getName()); map.put("scriptName", dictTree.getName());
} else { } else {
throw new BusinessException(PlanResponseEnum.SCRIPT_RELATE_DICT_NOT_EXIST); throw new BusinessException(DetectionResponseEnum.SCRIPT_RELATE_DICT_NOT_EXIST);
} }
result.add(map); result.add(map);
}); });
@@ -408,7 +408,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
planList.forEach(plan -> { planList.forEach(plan -> {
if (!CheckStateEnum.CHECKED.getValue().equals(plan.getTestState())) { 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(); planExcelList = excelImportResult.getList();
} }
} catch (Exception e) { } catch (Exception e) {
throw new BusinessException(DevResponseEnum.IMPORT_DATA_FAIL); throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FAIL);
} }
if (ObjectUtil.isNotEmpty(planExcelList)) { if (ObjectUtil.isNotEmpty(planExcelList)) {
this.importCNPlan(planExcelList, patternId); this.importCNPlan(planExcelList, patternId);
@@ -614,14 +614,14 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
String[] sourceNames = source.split(StrUtil.COMMA); String[] sourceNames = source.split(StrUtil.COMMA);
// 若非比对模式检测源、数据源有2个以上时不导入 // 若非比对模式检测源、数据源有2个以上时不导入
if (!PatternEnum.CONTRAST.getValue().equals(patternCode) && sourceNames.length > 1) { 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 datasource = planExcel.getDatasourceId();
String[] datasourceIds = datasource.split(StrUtil.COMMA); String[] datasourceIds = datasource.split(StrUtil.COMMA);
// 若非比对模式数据源有2个以上时不导入 // 若非比对模式数据源有2个以上时不导入
if (!PatternEnum.CONTRAST.getValue().equals(patternCode) && datasourceIds.length > 1) { 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); List<String> sourceIds = pqSourceService.listPqSourceIdByName(sourceNames);
@@ -654,7 +654,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
planExcelList = excelImportResult.getList(); planExcelList = excelImportResult.getList();
} }
} catch (Exception e) { } catch (Exception e) {
throw new BusinessException(DevResponseEnum.IMPORT_DATA_FAIL); throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FAIL);
} }
if (ObjectUtil.isNotEmpty(planExcelList)) { if (ObjectUtil.isNotEmpty(planExcelList)) {
this.importProvincePlan(planExcelList, patternId); this.importProvincePlan(planExcelList, patternId);
@@ -691,14 +691,14 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
String[] sourceNames = source.split(StrUtil.COMMA); String[] sourceNames = source.split(StrUtil.COMMA);
// 若非比对模式检测源、数据源有2个以上时不导入 // 若非比对模式检测源、数据源有2个以上时不导入
if (!PatternEnum.CONTRAST.getValue().equals(patternCode) && sourceNames.length > 1) { 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 datasource = planExcel.getDatasourceId();
String[] datasourceIds = datasource.split(StrUtil.COMMA); String[] datasourceIds = datasource.split(StrUtil.COMMA);
// 若非比对模式数据源有2个以上时不导入 // 若非比对模式数据源有2个以上时不导入
if (!PatternEnum.CONTRAST.getValue().equals(patternCode) && datasourceIds.length > 1) { 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); List<String> sourceIds = pqSourceService.listPqSourceIdByName(sourceNames);
@@ -864,7 +864,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
} }
int count = this.count(queryWrapper); int count = this.count(queryWrapper);
if (count > 0) { if (count > 0) {
throw new BusinessException(PlanResponseEnum.PLAN_REPEATED); throw new BusinessException(DetectionResponseEnum.PLAN_REPEATED);
} }
} }

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -17,7 +17,7 @@ import com.njcn.gather.detection.service.impl.DetectionServiceImpl;
import com.njcn.gather.device.service.IPqDevService; import com.njcn.gather.device.service.IPqDevService;
import com.njcn.gather.plan.pojo.po.AdPlan; import com.njcn.gather.plan.pojo.po.AdPlan;
import com.njcn.gather.plan.service.IAdPlanService; 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.enums.ResultUnitEnum;
import com.njcn.gather.result.pojo.param.ResultParam; import com.njcn.gather.result.pojo.param.ResultParam;
import com.njcn.gather.result.pojo.vo.FormContentVO; import com.njcn.gather.result.pojo.vo.FormContentVO;
@@ -888,7 +888,7 @@ public class ResultServiceImpl implements IResultService {
}); });
ExcelUtil.exportExcel("原始数据.xlsx", sheetsList); ExcelUtil.exportExcel("原始数据.xlsx", sheetsList);
} else { } else {
throw new BusinessException(ResultResponseEnum.RAW_DATA_NOT_EXIST); throw new BusinessException(DetectionResponseEnum.RAW_DATA_NOT_EXIST);
} }
} }

View File

@@ -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;
}
}

View File

@@ -8,10 +8,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum; import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.gather.plan.pojo.po.AdPlan; import com.njcn.gather.pojo.enums.DetectionResponseEnum;
import com.njcn.gather.plan.service.IAdPlanService;
import com.njcn.gather.script.mapper.PqScriptMapper; 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.param.PqScriptParam;
import com.njcn.gather.script.pojo.po.PqScript; import com.njcn.gather.script.pojo.po.PqScript;
import com.njcn.gather.script.service.IPqScriptDtlsService; 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) { public boolean deletePqScript(List<String> ids) {
Integer count = this.baseMapper.getBoundCountByScriptIds(ids); Integer count = this.baseMapper.getBoundCountByScriptIds(ids);
if (count > 0) { if (count > 0) {
throw new BusinessException(ScriptResponseEnum.SCRIPT_BOUND_NOT_DELETE); throw new BusinessException(DetectionResponseEnum.SCRIPT_BOUND_NOT_DELETE);
} }
//删除对应的脚本详情 //删除对应的脚本详情
pqScriptDtlsService.deletePqScriptDtlsByScriptId(ids); pqScriptDtlsService.deletePqScriptDtlsByScriptId(ids);

View File

@@ -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;
}
}

View File

@@ -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.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.gather.device.pojo.enums.CommonEnum; 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.mapper.PqSourceMapper;
import com.njcn.gather.source.pojo.enums.SourceResponseEnum;
import com.njcn.gather.source.pojo.param.PqSourceParam; import com.njcn.gather.source.pojo.param.PqSourceParam;
import com.njcn.gather.source.pojo.po.PqSource; import com.njcn.gather.source.pojo.po.PqSource;
import com.njcn.gather.source.pojo.po.SourceInitialize; import com.njcn.gather.source.pojo.po.SourceInitialize;
import com.njcn.gather.source.pojo.po.SourceParam; import com.njcn.gather.source.pojo.po.SourceParam;
import com.njcn.gather.source.service.IPqSourceService; 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.pojo.po.DictData;
import com.njcn.gather.system.dictionary.service.IDictDataService; import com.njcn.gather.system.dictionary.service.IDictDataService;
import com.njcn.gather.type.service.IDevTypeService;
import com.njcn.web.factory.PageFactory; import com.njcn.web.factory.PageFactory;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; 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; import java.util.stream.Collectors;
/** /**
@@ -88,7 +89,7 @@ public class PqSourceServiceImpl extends ServiceImpl<PqSourceMapper, PqSource> i
public boolean deletePqSource(List<String> ids) { public boolean deletePqSource(List<String> ids) {
Integer count = this.baseMapper.getCountBoundByIds(ids); Integer count = this.baseMapper.getCountBoundByIds(ids);
if (count > 0) { if (count > 0) {
throw new BusinessException(SourceResponseEnum.SOURCE_BOUND_NOT_DELETE); throw new BusinessException(DetectionResponseEnum.SOURCE_BOUND_NOT_DELETE);
} }
return this.lambdaUpdate().in(PqSource::getId, ids).set(PqSource::getState, DataStateEnum.DELETED.getCode()).update(); return this.lambdaUpdate().in(PqSource::getId, ids).set(PqSource::getState, DataStateEnum.DELETED.getCode()).update();
} }
@@ -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);
} }
} }

View File

@@ -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;
}
}

View File

@@ -7,10 +7,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum; import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException; 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.pojo.po.DictData;
import com.njcn.gather.system.dictionary.service.IDictDataService; import com.njcn.gather.system.dictionary.service.IDictDataService;
import com.njcn.gather.type.mapper.DevTypeMapper; 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.param.DevTypeParam;
import com.njcn.gather.type.pojo.po.DevType; import com.njcn.gather.type.pojo.po.DevType;
import com.njcn.gather.type.service.IDevTypeService; import com.njcn.gather.type.service.IDevTypeService;
@@ -115,7 +115,7 @@ public class DevTypeServiceImpl extends ServiceImpl<DevTypeMapper, DevType> impl
} }
int count = this.count(wrapper); int count = this.count(wrapper);
if (count > 0) { if (count > 0) {
throw new BusinessException(DevTypeResponseEnum.DEV_TYPE_NAME_REPEAT); throw new BusinessException(DetectionResponseEnum.DEV_TYPE_NAME_REPEAT);
} }
} }
} }

View File

@@ -42,21 +42,6 @@ public class SysTestConfigController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, sysTestConfig, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, sysTestConfig, methodDescribe);
} }
// @OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
// @PostMapping("/add")
// @ApiOperation("新增检测相关配置信息")
// @ApiImplicitParam(name = "sysTestConfig", value = "检测相关配置信息", required = true)
// public HttpResult<Boolean> add(@RequestBody @Validated SysTestConfigParam param) {
// String methodDescribe = getMethodDescribe("add");
// LogUtil.njcnDebug(log, "{}", methodDescribe);
// boolean result = sysTestConfigService.addTestConfig(param);
// if (result) {
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
// } else {
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
// }
// }
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.UPDATE) @OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.UPDATE)
@PostMapping("/update") @PostMapping("/update")
@ApiOperation("修改检测相关配置信息") @ApiOperation("修改检测相关配置信息")
@@ -66,9 +51,9 @@ public class SysTestConfigController extends BaseController {
LogUtil.njcnDebug(log, "{}", methodDescribe); LogUtil.njcnDebug(log, "{}", methodDescribe);
boolean result = sysTestConfigService.updateTestConfig(sysTestConfig); boolean result = sysTestConfigService.updateTestConfig(sysTestConfig);
if (result) { if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
} else { } else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
} }
} }

View File

@@ -63,14 +63,14 @@ public class DictDataController extends BaseController {
@PostMapping("/add") @PostMapping("/add")
@ApiOperation("新增字典数据") @ApiOperation("新增字典数据")
@ApiImplicitParam(name = "dictDataParam", value = "字典数据", required = true) @ApiImplicitParam(name = "dictDataParam", value = "字典数据", required = true)
public HttpResult<Object> add(@RequestBody @Validated DictDataParam dictDataParam) { public HttpResult<Boolean> add(@RequestBody @Validated DictDataParam dictDataParam) {
String methodDescribe = getMethodDescribe("add"); String methodDescribe = getMethodDescribe("add");
LogUtil.njcnDebug(log, "{},字典数据为:{}", methodDescribe, dictDataParam); LogUtil.njcnDebug(log, "{},字典数据为:{}", methodDescribe, dictDataParam);
boolean result = dictDataService.addDictData(dictDataParam); boolean result = dictDataService.addDictData(dictDataParam);
if (result) { if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
} else { } else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
} }
} }
@@ -81,14 +81,14 @@ public class DictDataController extends BaseController {
@PostMapping("/update") @PostMapping("/update")
@ApiOperation("修改字典数据") @ApiOperation("修改字典数据")
@ApiImplicitParam(name = "updateParam", value = "字典数据", required = true) @ApiImplicitParam(name = "updateParam", value = "字典数据", required = true)
public HttpResult<Object> update(@RequestBody @Validated DictDataParam.UpdateParam updateParam) { public HttpResult<Boolean> update(@RequestBody @Validated DictDataParam.UpdateParam updateParam) {
String methodDescribe = getMethodDescribe("update"); String methodDescribe = getMethodDescribe("update");
LogUtil.njcnDebug(log, "{},字典数据为:{}", methodDescribe, updateParam); LogUtil.njcnDebug(log, "{},字典数据为:{}", methodDescribe, updateParam);
boolean result = dictDataService.updateDictData(updateParam); boolean result = dictDataService.updateDictData(updateParam);
if (result) { if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
} else { } else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
} }
} }
@@ -99,14 +99,14 @@ public class DictDataController extends BaseController {
@PostMapping("/delete") @PostMapping("/delete")
@ApiOperation("删除字典数据") @ApiOperation("删除字典数据")
@ApiImplicitParam(name = "ids", value = "字典索引", required = true, dataTypeClass = List.class) @ApiImplicitParam(name = "ids", value = "字典索引", required = true, dataTypeClass = List.class)
public HttpResult<Object> delete(@RequestBody List<String> ids) { public HttpResult<Boolean> delete(@RequestBody List<String> ids) {
String methodDescribe = getMethodDescribe("delete"); String methodDescribe = getMethodDescribe("delete");
LogUtil.njcnDebug(log, "{}字典ID数据为{}", methodDescribe, String.join(StrUtil.COMMA, ids)); LogUtil.njcnDebug(log, "{}字典ID数据为{}", methodDescribe, String.join(StrUtil.COMMA, ids));
boolean result = dictDataService.deleteDictData(ids); boolean result = dictDataService.deleteDictData(ids);
if (result) { if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
} else { } else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
} }
} }

View File

@@ -50,14 +50,14 @@ public class DictPqController extends BaseController {
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD) @OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
@PostMapping("/add") @PostMapping("/add")
@ApiOperation("新增电能质量指标字典") @ApiOperation("新增电能质量指标字典")
public HttpResult<Object> add(@RequestBody @Validated DictPqParam dictPqParam) { public HttpResult<Boolean> add(@RequestBody @Validated DictPqParam dictPqParam) {
String methodDescribe = getMethodDescribe("add"); String methodDescribe = getMethodDescribe("add");
LogUtil.njcnDebug(log, "{},新增数据为:{}", methodDescribe, dictPqParam); LogUtil.njcnDebug(log, "{},新增数据为:{}", methodDescribe, dictPqParam);
boolean result = dictPqService.addDictPq(dictPqParam); boolean result = dictPqService.addDictPq(dictPqParam);
if (result) { if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
} else { } else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
} }
} }
@@ -65,14 +65,14 @@ public class DictPqController extends BaseController {
@PostMapping("/update") @PostMapping("/update")
@ApiOperation("更新电能质量指标字典") @ApiOperation("更新电能质量指标字典")
@ApiImplicitParam(name = "updateParam", value = "更新参数", required = true) @ApiImplicitParam(name = "updateParam", value = "更新参数", required = true)
public HttpResult<Object> update(@RequestBody @Validated DictPqParam.UpdateParam updateParam) { public HttpResult<Boolean> update(@RequestBody @Validated DictPqParam.UpdateParam updateParam) {
String methodDescribe = getMethodDescribe("update"); String methodDescribe = getMethodDescribe("update");
LogUtil.njcnDebug(log, "{},更新数据为:{}", methodDescribe, updateParam); LogUtil.njcnDebug(log, "{},更新数据为:{}", methodDescribe, updateParam);
boolean result = dictPqService.updateDictPq(updateParam); boolean result = dictPqService.updateDictPq(updateParam);
if (result) { if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
} else { } else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
} }
} }
@@ -80,14 +80,14 @@ public class DictPqController extends BaseController {
@PostMapping("/delete") @PostMapping("/delete")
@ApiOperation("删除电能质量指标字典") @ApiOperation("删除电能质量指标字典")
@ApiImplicitParam(name = "ids", value = "字典索引", required = true) @ApiImplicitParam(name = "ids", value = "字典索引", required = true)
public HttpResult<Object> delete(@RequestBody List<String> ids) { public HttpResult<Boolean> delete(@RequestBody List<String> ids) {
String methodDescribe = getMethodDescribe("delete"); String methodDescribe = getMethodDescribe("delete");
LogUtil.njcnDebug(log, "{}删除ID数据为{}", methodDescribe, String.join(StrUtil.COMMA, ids)); LogUtil.njcnDebug(log, "{}删除ID数据为{}", methodDescribe, String.join(StrUtil.COMMA, ids));
boolean result = dictPqService.deleteDictPq(ids); boolean result = dictPqService.deleteDictPq(ids);
if (result) { if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
} else { } else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
} }
} }
} }

View File

@@ -68,14 +68,14 @@ public class DictTreeController extends BaseController {
@PostMapping("/add") @PostMapping("/add")
@ApiOperation("新增字典树数据") @ApiOperation("新增字典树数据")
@ApiImplicitParam(name = "dictTreeParam", value = "字典数据", required = true) @ApiImplicitParam(name = "dictTreeParam", value = "字典数据", required = true)
public HttpResult<Object> add(@RequestBody @Validated DictTreeParam dictTreeParam) { public HttpResult<Boolean> add(@RequestBody @Validated DictTreeParam dictTreeParam) {
String methodDescribe = getMethodDescribe("add"); String methodDescribe = getMethodDescribe("add");
LogUtil.njcnDebug(log, "{},字典数据为:{}", methodDescribe, dictTreeParam); LogUtil.njcnDebug(log, "{},字典数据为:{}", methodDescribe, dictTreeParam);
boolean result = dictTreeService.addDictTree(dictTreeParam); boolean result = dictTreeService.addDictTree(dictTreeParam);
if (result) { if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
} else { } else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
} }
} }
@@ -118,55 +118,6 @@ public class DictTreeController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
} }
} }
// @OperateInfo(info = LogEnum.SYSTEM_COMMON)
// @GetMapping("/getById")
// @ApiOperation("根据id查询数据")
// public HttpResult<DictTree> getById(@RequestParam("id") String id) {
// String methodDescribe = getMethodDescribe("getById");
// LogUtil.njcnDebug(log, "{},字典数据为:{}", methodDescribe, id);
// DictTree result = dictTreeService.queryById(id);
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
// }
// @OperateInfo(info = LogEnum.SYSTEM_COMMON)
// @GetMapping("/getByPid")
// @ApiOperation("根据pid查询字典树")
// public HttpResult<List<DictTreeVO>> getByPid(@RequestParam("pid") String pid) {
// String methodDescribe = getMethodDescribe("getByPid");
// LogUtil.njcnDebug(log, "{},字典数据为:{}", methodDescribe, pid);
// List<DictTreeVO> result = dictTreeService.queryByPid(pid);
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
// }
// @OperateInfo(info = LogEnum.SYSTEM_COMMON)
// @PostMapping("/queryLastLevelById")
// @ApiOperation("根据id查询字典树最底层")
// public HttpResult<List<DictTreeVO>> queryLastLevelById(@RequestParam("id") String id) {
// String methodDescribe = getMethodDescribe("queryLastLevelById");
// LogUtil.njcnDebug(log, "{},字典数据为:{}", methodDescribe, id);
// List<DictTreeVO> result = dictTreeService.queryLastLevelById(id);
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
// }
// @OperateInfo(info = LogEnum.SYSTEM_COMMON)
// @GetMapping("/queryAll")
// @ApiOperation("查询所有树形字典")
// public HttpResult<List<DictTree>> queryAll() {
// String methodDescribe = getMethodDescribe("queryAll");
// List<DictTree> result = dictTreeService.queryAll();
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
// }
//
// @OperateInfo(info = LogEnum.SYSTEM_COMMON)
// @GetMapping("/queryAllByType")
// @ApiOperation("分类查询所有树形字典")
// public HttpResult<List<DictTree>> queryAllByType(@RequestParam("type")Integer type) {
// String methodDescribe = getMethodDescribe("queryAll");
// List<DictTree> result = dictTreeService.queryAllByType(type);
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
// }
} }

View File

@@ -65,14 +65,14 @@ public class DictTypeController extends BaseController {
@PostMapping("/add") @PostMapping("/add")
@ApiOperation("新增字典类型") @ApiOperation("新增字典类型")
@ApiImplicitParam(name = "dictTypeParam", value = "字典类型数据", required = true) @ApiImplicitParam(name = "dictTypeParam", value = "字典类型数据", required = true)
public HttpResult<Object> add(@RequestBody @Validated DictTypeParam dictTypeParam) { public HttpResult<Boolean> add(@RequestBody @Validated DictTypeParam dictTypeParam) {
String methodDescribe = getMethodDescribe("add"); String methodDescribe = getMethodDescribe("add");
LogUtil.njcnDebug(log, "{},字典类型数据为:{}", methodDescribe, dictTypeParam); LogUtil.njcnDebug(log, "{},字典类型数据为:{}", methodDescribe, dictTypeParam);
boolean result = dictTypeService.addDictType(dictTypeParam); boolean result = dictTypeService.addDictType(dictTypeParam);
if (result) { if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
} else { } else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
} }
} }
@@ -80,14 +80,14 @@ public class DictTypeController extends BaseController {
@PostMapping("/update") @PostMapping("/update")
@ApiOperation("修改字典类型") @ApiOperation("修改字典类型")
@ApiImplicitParam(name = "updateParam", value = "字典类型数据", required = true) @ApiImplicitParam(name = "updateParam", value = "字典类型数据", required = true)
public HttpResult<Object> update(@RequestBody @Validated DictTypeParam.UpdateParam updateParam) { public HttpResult<Boolean> update(@RequestBody @Validated DictTypeParam.UpdateParam updateParam) {
String methodDescribe = getMethodDescribe("update"); String methodDescribe = getMethodDescribe("update");
LogUtil.njcnDebug(log, "{},字典类型数据为:{}", methodDescribe, updateParam); LogUtil.njcnDebug(log, "{},字典类型数据为:{}", methodDescribe, updateParam);
boolean result = dictTypeService.updateDictType(updateParam); boolean result = dictTypeService.updateDictType(updateParam);
if (result) { if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
} else { } else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
} }
} }
@@ -95,14 +95,14 @@ public class DictTypeController extends BaseController {
@PostMapping("/delete") @PostMapping("/delete")
@ApiOperation("删除字典类型") @ApiOperation("删除字典类型")
@ApiImplicitParam(name = "ids", value = "字典索引", required = true) @ApiImplicitParam(name = "ids", value = "字典索引", required = true)
public HttpResult<Object> delete(@RequestBody List<String> ids) { public HttpResult<Boolean> delete(@RequestBody List<String> ids) {
String methodDescribe = getMethodDescribe("delete"); String methodDescribe = getMethodDescribe("delete");
LogUtil.njcnDebug(log, "{}字典ID数据为{}", methodDescribe, String.join(StrUtil.COMMA, ids)); LogUtil.njcnDebug(log, "{}字典ID数据为{}", methodDescribe, String.join(StrUtil.COMMA, ids));
boolean result = dictTypeService.deleteDictType(ids); boolean result = dictTypeService.deleteDictType(ids);
if (result) { if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
} else { } else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
} }
} }

View File

@@ -15,11 +15,6 @@ import java.util.List;
*/ */
public interface IDictTreeService extends IService<DictTree> { public interface IDictTreeService extends IService<DictTree> {
/**
* 初始化缓存设备树
*/
//void refreshDictTreeCache();
/** /**
* 根据code查询字典树 * 根据code查询字典树
* *
@@ -49,32 +44,16 @@ public interface IDictTreeService extends IService<DictTree> {
*/ */
DictTree queryById(String id); DictTree queryById(String id);
//DictTreeVO queryByCode(String code); /**
* 查询所有字典树
//List<DictTreeVO> queryByPid(String pid); *
* @return
//List<DictTreeVO> queryLastLevelById(String id); */
List<DictTree> queryTree(); List<DictTree> queryTree();
/** /**
* 查询所有树形字典 * 根据字典树id查询字典
* *
* @author cdf
* @date 2023/12/18
*/
//List<DictTree> queryAll();
/**
* 分类查询所有树形字典
*
* @author cdf
* @date 2023/12/18
*/
//List<DictTree> queryAllByType(Integer type);
/**
* 根据字典树
* @param ids * @param ids
* @return * @return
*/ */

View File

@@ -34,15 +34,6 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor @RequiredArgsConstructor
public class DictTreeServiceImpl extends ServiceImpl<DictTreeMapper, DictTree> implements IDictTreeService { public class DictTreeServiceImpl extends ServiceImpl<DictTreeMapper, DictTree> implements IDictTreeService {
//private final RedisUtil redisUtil;
// @Override
// public void refreshDictTreeCache () {
// LambdaQueryWrapper<DictTree> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.eq(DictTree::getState, DictConst.ENABLE);
// List<DictTree> list = this.list(queryWrapper);
// redisUtil.saveByKey(AppRedisKey.DICT_TREE, list);
// }
@Override @Override
public List<DictTree> getTreeByCode(String code) { public List<DictTree> getTreeByCode(String code) {
@@ -52,7 +43,6 @@ public class DictTreeServiceImpl extends ServiceImpl<DictTreeMapper, DictTree> i
dictTree = dictTree.stream().filter(item -> item.getCode().equals(code)).collect(Collectors.toList()); dictTree = dictTree.stream().filter(item -> item.getCode().equals(code)).collect(Collectors.toList());
} }
//this.filterTreeByName(dictTree, keyword);
return dictTree; return dictTree;
} }
@@ -83,9 +73,6 @@ public class DictTreeServiceImpl extends ServiceImpl<DictTreeMapper, DictTree> i
} }
dictTree.setState(DictConst.ENABLE); dictTree.setState(DictConst.ENABLE);
result = this.save(dictTree); result = this.save(dictTree);
// if (result) {
// refreshDictTreeCache();
// }
return result; return result;
} }
@@ -99,9 +86,6 @@ public class DictTreeServiceImpl extends ServiceImpl<DictTreeMapper, DictTree> i
checkRepeat(param, true); checkRepeat(param, true);
DictTree copyDictTree = new DictTree(); DictTree copyDictTree = new DictTree();
BeanUtils.copyProperties(param, copyDictTree); BeanUtils.copyProperties(param, copyDictTree);
// if (result) {
// refreshDictTreeCache();
// }
return this.updateById(copyDictTree); return this.updateById(copyDictTree);
} }
@@ -117,9 +101,6 @@ public class DictTreeServiceImpl extends ServiceImpl<DictTreeMapper, DictTree> i
List<DictTree> childrenList = this.lambdaQuery().eq(DictTree::getState, DictConst.ENABLE).eq(DictTree::getPid, id).list(); List<DictTree> childrenList = this.lambdaQuery().eq(DictTree::getState, DictConst.ENABLE).eq(DictTree::getPid, id).list();
if (CollectionUtils.isEmpty(childrenList)) { if (CollectionUtils.isEmpty(childrenList)) {
result = this.lambdaUpdate().set(DictTree::getState, DictConst.DELETE).in(DictTree::getId, id).update(); result = this.lambdaUpdate().set(DictTree::getState, DictConst.DELETE).in(DictTree::getId, id).update();
// if (result) {
// refreshRolesFunctionsCache();
// }
} else { } else {
throw new BusinessException(SystemResponseEnum.EXISTS_CHILDREN_NOT_DELETE); throw new BusinessException(SystemResponseEnum.EXISTS_CHILDREN_NOT_DELETE);
} }
@@ -131,43 +112,6 @@ public class DictTreeServiceImpl extends ServiceImpl<DictTreeMapper, DictTree> i
return this.lambdaQuery().eq(DictTree::getId, id).eq(DictTree::getState, DictConst.ENABLE).one(); return this.lambdaQuery().eq(DictTree::getId, id).eq(DictTree::getState, DictConst.ENABLE).one();
} }
// @Override
// public DictTreeVO queryByCode(String code) {
// LambdaQueryWrapper<DictTree> query = new LambdaQueryWrapper<>();
// query.clear();
// query.eq(DictTree::getCode, code).eq(DictTree::getState, DictConst.ENABLE);
// DictTree result = this.getOne(query);
// if (result != null) {
// DictTreeVO resultVO = new DictTreeVO();
// BeanUtils.copyProperties(result, resultVO);
// return resultVO;
// }
// return null;
// }
// @Override
// public List<DictTreeVO> queryByPid(String pid) {
// List<DictTreeVO> collect = new ArrayList<>();
// LambdaQueryWrapper<DictTree> query = new LambdaQueryWrapper<>();
// query.eq(DictTree::getPid, pid).eq(DictTree::getState, DictConst.ENABLE).orderByDesc(DictTree::getSort);
// List<DictTree> resultList = this.list(query);
// DictTree byId = this.getById(pid);
// if (CollUtil.isNotEmpty(resultList)) {
// collect = resultList.stream().map(temp -> {
// DictTreeVO resultVO = new DictTreeVO();
// BeanUtils.copyProperties(temp, resultVO);
// resultVO.setPname(Objects.nonNull(byId) ? byId.getName() : "最高级");
// return resultVO;
// }).collect(Collectors.toList());
// }
// return collect;
// }
// @Override
// public List<DictTreeVO> queryLastLevelById(String id) {
// return this.baseMapper.queryLastLevelById(id);
// }
@Override @Override
public List<DictTree> queryTree() { public List<DictTree> queryTree() {
LambdaQueryWrapper<DictTree> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<DictTree> lambdaQueryWrapper = new LambdaQueryWrapper<>();
@@ -193,19 +137,6 @@ public class DictTreeServiceImpl extends ServiceImpl<DictTreeMapper, DictTree> i
); );
} }
// @Override
// public List<DictTree> queryAll() {
// LambdaQueryWrapper<DictTree> lambdaQueryWrapper = new LambdaQueryWrapper<>();
// lambdaQueryWrapper.eq(DictTree::getState, DictConst.ENABLE);
// return this.list(lambdaQueryWrapper);
// }
// @Override
// public List<DictTree> queryAllByType(Integer type) {
// LambdaQueryWrapper<DictTree> lambdaQueryWrapper = new LambdaQueryWrapper<>();
// lambdaQueryWrapper.eq(DictTree::getState, DictConst.ENABLE).eq(DictTree::getType, type);
// return this.list(lambdaQueryWrapper);
// }
private void checkRepeat(DictTreeParam dictTreeParam, boolean isExcludeSelf) { private void checkRepeat(DictTreeParam dictTreeParam, boolean isExcludeSelf) {
LambdaQueryWrapper<DictTree> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<DictTree> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(DictTree::getPid, dictTreeParam.getPid()) // 同一父节点下不能有相同的code wrapper.eq(DictTree::getPid, dictTreeParam.getPid()) // 同一父节点下不能有相同的code

View File

@@ -12,62 +12,15 @@ public enum SystemResponseEnum {
/** /**
* 系统模块异常响应码的范围: * 系统模块异常响应码的范围:
* A00350 ~ A00449 * A01000 ~ A01
*/ */
SYSTEM_COMMON_ERROR("A00350", "系统模块异常"), DICT_TYPE_REPEAT("A01000", "字典类型名称或编码重复"),
DICT_TYPE_REPEAT("A00351", "字典类型名称或编码重复"), DICT_DATA_REPEAT("A01002", "字典数据名称或编码重复"),
DICT_DATA_REPEAT("A00352", "字典数据名称或编码重复"), DICT_PQ_NAME_EXIST("A01003", "当前数据模型及相别下已存在相同名称"),
AREA_CODE_REPEAT("A00353", "行政区域编码重复"), EXISTS_CHILDREN_NOT_DELETE("A01004", "当前字典下存在子字典,不能删除"),
LOAD_TYPE_EMPTY("A00354", "用能负荷数据为空"), CODE_REPEAT("A01005", "该层级下已存在相同的编码"),
LINE_MARK_EMPTY("A00355", "字典监测点评分等级数据为空"), CAN_NOT_DELETE_USED_DICT("A01006", "字典在使用中,不能删除"),
VOLTAGE_EMPTY("A00356", "查询字典电压等级数据为空"), CAN_NOT_UPDATE_USED_DICT("A01007", "该字典在使用中,不能修改");
INTERFERENCE_EMPTY("A00356", "查询字典干扰源类型数据为空"),
BUSINESS_EMPTY("A00356", "查询字典行业类型数据为空"),
SYSTEM_TYPE_EMPTY("A00356", "查询字典系统类型数据为空"),
DEV_TYPE_EMPTY("A00357", "查询字典设备类型数据为空"),
MANUFACTURER("A00358", "查询字典终端厂家数据为空"),
DEV_VARIETY("A00359", "查询字典终端类型数据为空"),
/*pms*/
LINE_TYPE_VARIETY_EMPTY("A00360", "查询字典监测点类型数据为空"),
LINE_STATE_EMPTY("A00361", "查询字典监测点状态为空"),
LINE_TYPE_EMPTY("A00362", "查询字典监测点类型状态为空"),
POTENTIAL_TYPE_EMPTY("A00363", "查询字典电压互感器类型为空"),
Neutral_Mode_EMPTY("A00364", "查询字典中性点接地方式为空"),
MONITOR_TAG_EMPTY("A00365", "查询字典监测点标签类型为空"),
MONITORY_TYPE_EMPTY("A00366", "查询字典监测对象类型为空"),
TERMINAL_WIRING_EMPTY("A00367", "查询字典监测终端接线方式为空"),
MONITOR_TYPE_EMPTY("A00368", "查询字典监测点类别为空"),
ACTIVATED_STATE("A00369", "必须存在一个已激活的系统类型"),
ADVANCE_REASON("A00370", "查询字典暂降原因为空"),
EFFECT_STATUS_EMPTY("A00370", "查询字典实施状态为空"),
EVENT_REPORT_REPEAT("A00361", "暂态报告模板重复"),
NOT_EXISTED("A00361", "您查询的该条记录不存在"),
TIMER_NO_CLASS("A00361", "请检查定时任务是否添加"),
/**
* 定时任务执行类不存在
*/
TIMER_NOT_EXISTED("A00361", "定时任务执行类不存在"),
EXE_EMPTY_PARAM("A00361", "请检查定时器的id定时器cron表达式定时任务是否为空"),
DICT_PQ_NAME_EXIST("A00389", "当前数据模型及相别下已存在相同名称"),
EXISTS_CHILDREN_NOT_DELETE("A00390", "当前字典下存在子字典,不能删除"),
/**
* 审计日志模块异常响应
*/
NOT_FIND_FILE("A0300", "文件未备份或者备份文件为空,请先备份文件"),
LOG_EXCEPTION("A0301", "导入旧日志文件异常"),
LOG_EXCEPTION_TIME("A0302", "导入旧日志文件异常:缺少时间范围"),
DELETE_DATA("A0303", "导入旧日志文件异常:删除数据失败"),
MULTIPLE_CLICKS_LOG_FILE_WRITER("A0304", "当前文件备份数据未结束,请勿多次点击"),
MULTIPLE_CLICKS_RECOVER_LOG_FILE("A0303", "当前文件恢复数据未结束,请勿多次点击"),
CODE_REPEAT("A0305", "该层级下已存在相同的编码"),
CAN_NOT_DELETE_USED_DICT("A0306", "该字典在使用中,不能删除"),
CAN_NOT_UPDATE_USED_DICT("A0307", "该字典在使用中,不能修改");
private final String code; private final String code;

View File

@@ -158,7 +158,11 @@ public class SysFunctionController extends BaseController {
String methodDescribe = getMethodDescribe("assignFunctionByRoleId"); String methodDescribe = getMethodDescribe("assignFunctionByRoleId");
LogUtil.njcnDebug(log, "{},传入的角色id和资源id集合为{}", methodDescribe, param); LogUtil.njcnDebug(log, "{},传入的角色id和资源id集合为{}", methodDescribe, param);
boolean result = sysRoleFunctionService.updateRoleFunction(param.getRoleId(), param.getFunctionIds()); boolean result = sysRoleFunctionService.updateRoleFunction(param.getRoleId(), param.getFunctionIds());
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
} else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
}
} }
} }

View File

@@ -50,14 +50,14 @@ public class SysRoleController extends BaseController {
@PostMapping("/add") @PostMapping("/add")
@ApiOperation("新增角色信息") @ApiOperation("新增角色信息")
@ApiImplicitParam(name = "roleParam", value = "角色信息", required = true) @ApiImplicitParam(name = "roleParam", value = "角色信息", required = true)
public HttpResult<Object> add(@RequestBody @Validated SysRoleParam sysRoleParam) { public HttpResult<Boolean> add(@RequestBody @Validated SysRoleParam sysRoleParam) {
String methodDescribe = getMethodDescribe("add"); String methodDescribe = getMethodDescribe("add");
LogUtil.njcnDebug(log, "{},角色信息数据为:{}", methodDescribe, sysRoleParam); LogUtil.njcnDebug(log, "{},角色信息数据为:{}", methodDescribe, sysRoleParam);
boolean result = sysRoleService.addRole(sysRoleParam); boolean result = sysRoleService.addRole(sysRoleParam);
if (result) { if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
} else { } else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
} }
} }
@@ -65,14 +65,14 @@ public class SysRoleController extends BaseController {
@PostMapping("/update") @PostMapping("/update")
@ApiOperation("修改角色信息") @ApiOperation("修改角色信息")
@ApiImplicitParam(name = "updateParam", value = "角色信息", required = true) @ApiImplicitParam(name = "updateParam", value = "角色信息", required = true)
public HttpResult<Object> update(@RequestBody @Validated SysRoleParam.UpdateParam updateParam) { public HttpResult<Boolean> update(@RequestBody @Validated SysRoleParam.UpdateParam updateParam) {
String methodDescribe = getMethodDescribe("update"); String methodDescribe = getMethodDescribe("update");
LogUtil.njcnDebug(log, "{},角色信息数据为:{}", methodDescribe, updateParam); LogUtil.njcnDebug(log, "{},角色信息数据为:{}", methodDescribe, updateParam);
boolean result = sysRoleService.updateRole(updateParam); boolean result = sysRoleService.updateRole(updateParam);
if (result) { if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
} else { } else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
} }
} }
@@ -80,14 +80,14 @@ public class SysRoleController extends BaseController {
@PostMapping("/delete") @PostMapping("/delete")
@ApiOperation("删除角色信息") @ApiOperation("删除角色信息")
@ApiImplicitParam(name = "ids", value = "角色id集合", required = true) @ApiImplicitParam(name = "ids", value = "角色id集合", required = true)
public HttpResult<Object> delete(@RequestBody List<String> ids) { public HttpResult<Boolean> delete(@RequestBody List<String> ids) {
String methodDescribe = getMethodDescribe("delete"); String methodDescribe = getMethodDescribe("delete");
LogUtil.njcnDebug(log, "{},角色信息数据为:{}", methodDescribe, ids); LogUtil.njcnDebug(log, "{},角色信息数据为:{}", methodDescribe, ids);
boolean result = sysRoleService.deleteRole(ids); boolean result = sysRoleService.deleteRole(ids);
if (result) { if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
} else { } else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
} }
} }

View File

@@ -112,14 +112,14 @@ public class SysUserController extends BaseController {
@ApiImplicitParam(name = "oldPassword", value = "旧密码", required = true), @ApiImplicitParam(name = "oldPassword", value = "旧密码", required = true),
@ApiImplicitParam(name = "newPassword", value = "新密码", required = true) @ApiImplicitParam(name = "newPassword", value = "新密码", required = true)
}) })
public HttpResult<Object> updatePassword(@RequestBody @Validated SysUserParam.SysUserUpdatePasswordParam param) { public HttpResult<Boolean> updatePassword(@RequestBody @Validated SysUserParam.SysUserUpdatePasswordParam param) {
String methodDescribe = getMethodDescribe("updatePassword"); String methodDescribe = getMethodDescribe("updatePassword");
LogUtil.njcnDebug(log, "{}用户id:{},用户旧密码:{},新密码:{}", methodDescribe, param.getId(), param.getOldPassword(), param.getNewPassword()); LogUtil.njcnDebug(log, "{}用户id:{},用户旧密码:{},新密码:{}", methodDescribe, param.getId(), param.getOldPassword(), param.getNewPassword());
boolean result = sysUserService.updatePassword(param); boolean result = sysUserService.updatePassword(param);
if (!result) { if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
} else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
} else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
} }
} }
} }