diff --git a/detection/src/main/java/com/njcn/gather/device/pojo/enums/DevResponseEnum.java b/detection/src/main/java/com/njcn/gather/device/pojo/enums/DevResponseEnum.java deleted file mode 100644 index 70060542..00000000 --- a/detection/src/main/java/com/njcn/gather/device/pojo/enums/DevResponseEnum.java +++ /dev/null @@ -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; - } -} diff --git a/detection/src/main/java/com/njcn/gather/device/service/impl/PqDevServiceImpl.java b/detection/src/main/java/com/njcn/gather/device/service/impl/PqDevServiceImpl.java index d4993d86..b414655a 100644 --- a/detection/src/main/java/com/njcn/gather/device/service/impl/PqDevServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/device/service/impl/PqDevServiceImpl.java @@ -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 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 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 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 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 implements public List getDevInfo(List devIds) { List 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 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 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 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 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 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 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 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 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 implements } } } else { - throw new BusinessException(DevResponseEnum.IMPORT_DATA_FORMAT_FAIL); + throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FORMAT_FAIL); } } else { param.setName(pqDev.getName()); diff --git a/detection/src/main/java/com/njcn/gather/err/pojo/enums/ErrResponseEnum.java b/detection/src/main/java/com/njcn/gather/err/pojo/enums/ErrResponseEnum.java deleted file mode 100644 index 6058c322..00000000 --- a/detection/src/main/java/com/njcn/gather/err/pojo/enums/ErrResponseEnum.java +++ /dev/null @@ -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; - } -} diff --git a/detection/src/main/java/com/njcn/gather/err/service/impl/PqErrSysServiceImpl.java b/detection/src/main/java/com/njcn/gather/err/service/impl/PqErrSysServiceImpl.java index 197134c8..311bdd03 100644 --- a/detection/src/main/java/com/njcn/gather/err/service/impl/PqErrSysServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/err/service/impl/PqErrSysServiceImpl.java @@ -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 i public boolean deletePqErrSys(List 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 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 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); } } diff --git a/detection/src/main/java/com/njcn/gather/icd/pojo/enums/IcdPathResponseEnum.java b/detection/src/main/java/com/njcn/gather/icd/pojo/enums/IcdPathResponseEnum.java deleted file mode 100644 index baac3918..00000000 --- a/detection/src/main/java/com/njcn/gather/icd/pojo/enums/IcdPathResponseEnum.java +++ /dev/null @@ -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; - } -} diff --git a/detection/src/main/java/com/njcn/gather/icd/service/impl/PqIcdPathServiceImpl.java b/detection/src/main/java/com/njcn/gather/icd/service/impl/PqIcdPathServiceImpl.java index 3c719381..84cfbe69 100644 --- a/detection/src/main/java/com/njcn/gather/icd/service/impl/PqIcdPathServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/icd/service/impl/PqIcdPathServiceImpl.java @@ -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 0) { - throw new BusinessException(IcdPathResponseEnum.ICD_PATH_NAME_REPEAT); + throw new BusinessException(DetectionResponseEnum.ICD_PATH_NAME_REPEAT); } } } diff --git a/detection/src/main/java/com/njcn/gather/plan/controller/AdPlanController.java b/detection/src/main/java/com/njcn/gather/plan/controller/AdPlanController.java index ca344811..d6d6dc93 100644 --- a/detection/src/main/java/com/njcn/gather/plan/controller/AdPlanController.java +++ b/detection/src/main/java/com/njcn/gather/plan/controller/AdPlanController.java @@ -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; diff --git a/detection/src/main/java/com/njcn/gather/plan/pojo/enums/PlanResponseEnum.java b/detection/src/main/java/com/njcn/gather/plan/pojo/enums/PlanResponseEnum.java deleted file mode 100644 index b8549cd3..00000000 --- a/detection/src/main/java/com/njcn/gather/plan/pojo/enums/PlanResponseEnum.java +++ /dev/null @@ -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; - } -} diff --git a/detection/src/main/java/com/njcn/gather/plan/service/impl/AdPlanServiceImpl.java b/detection/src/main/java/com/njcn/gather/plan/service/impl/AdPlanServiceImpl.java index d34592f2..c84c1cec 100644 --- a/detection/src/main/java/com/njcn/gather/plan/service/impl/AdPlanServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/plan/service/impl/AdPlanServiceImpl.java @@ -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 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 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 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 impleme List> 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 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 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 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 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 sourceIds = pqSourceService.listPqSourceIdByName(sourceNames); @@ -654,7 +654,7 @@ public class AdPlanServiceImpl extends ServiceImpl 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 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 sourceIds = pqSourceService.listPqSourceIdByName(sourceNames); @@ -864,7 +864,7 @@ public class AdPlanServiceImpl extends ServiceImpl impleme } int count = this.count(queryWrapper); if (count > 0) { - throw new BusinessException(PlanResponseEnum.PLAN_REPEATED); + throw new BusinessException(DetectionResponseEnum.PLAN_REPEATED); } } diff --git a/detection/src/main/java/com/njcn/gather/pojo/enums/DetectionResponseEnum.java b/detection/src/main/java/com/njcn/gather/pojo/enums/DetectionResponseEnum.java new file mode 100644 index 00000000..90430808 --- /dev/null +++ b/detection/src/main/java/com/njcn/gather/pojo/enums/DetectionResponseEnum.java @@ -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; + } +} diff --git a/detection/src/main/java/com/njcn/gather/result/pojo/enums/ResultResponseEnum.java b/detection/src/main/java/com/njcn/gather/result/pojo/enums/ResultResponseEnum.java deleted file mode 100644 index 67552ee5..00000000 --- a/detection/src/main/java/com/njcn/gather/result/pojo/enums/ResultResponseEnum.java +++ /dev/null @@ -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; - } -} diff --git a/detection/src/main/java/com/njcn/gather/result/service/impl/ResultServiceImpl.java b/detection/src/main/java/com/njcn/gather/result/service/impl/ResultServiceImpl.java index 71ba5d95..8c6fa627 100644 --- a/detection/src/main/java/com/njcn/gather/result/service/impl/ResultServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/result/service/impl/ResultServiceImpl.java @@ -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); } } diff --git a/detection/src/main/java/com/njcn/gather/script/pojo/enums/ScriptResponseEnum.java b/detection/src/main/java/com/njcn/gather/script/pojo/enums/ScriptResponseEnum.java deleted file mode 100644 index e5effde6..00000000 --- a/detection/src/main/java/com/njcn/gather/script/pojo/enums/ScriptResponseEnum.java +++ /dev/null @@ -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; - } -} diff --git a/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptServiceImpl.java b/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptServiceImpl.java index 3140de71..00b82b54 100644 --- a/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptServiceImpl.java @@ -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 i public boolean deletePqScript(List 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); diff --git a/detection/src/main/java/com/njcn/gather/source/pojo/enums/SourceResponseEnum.java b/detection/src/main/java/com/njcn/gather/source/pojo/enums/SourceResponseEnum.java deleted file mode 100644 index 16dd50a9..00000000 --- a/detection/src/main/java/com/njcn/gather/source/pojo/enums/SourceResponseEnum.java +++ /dev/null @@ -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; - } -} diff --git a/detection/src/main/java/com/njcn/gather/source/service/impl/PqSourceServiceImpl.java b/detection/src/main/java/com/njcn/gather/source/service/impl/PqSourceServiceImpl.java index ab7cc391..c4e6f007 100644 --- a/detection/src/main/java/com/njcn/gather/source/service/impl/PqSourceServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/source/service/impl/PqSourceServiceImpl.java @@ -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 i @Transactional public boolean deletePqSource(List 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 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 i } } } - throw new BusinessException(DevResponseEnum.PQ_SOURCE_GEN_NAME_ERROR); + throw new BusinessException(DetectionResponseEnum.PQ_SOURCE_GEN_NAME_ERROR); } } diff --git a/detection/src/main/java/com/njcn/gather/type/pojo/enums/DevTypeResponseEnum.java b/detection/src/main/java/com/njcn/gather/type/pojo/enums/DevTypeResponseEnum.java deleted file mode 100644 index 3b4b1951..00000000 --- a/detection/src/main/java/com/njcn/gather/type/pojo/enums/DevTypeResponseEnum.java +++ /dev/null @@ -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; - } -} diff --git a/detection/src/main/java/com/njcn/gather/type/service/impl/DevTypeServiceImpl.java b/detection/src/main/java/com/njcn/gather/type/service/impl/DevTypeServiceImpl.java index b511dafc..96d37ed3 100644 --- a/detection/src/main/java/com/njcn/gather/type/service/impl/DevTypeServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/type/service/impl/DevTypeServiceImpl.java @@ -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 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); } } } diff --git a/system/src/main/java/com/njcn/gather/system/cfg/controller/SysTestConfigController.java b/system/src/main/java/com/njcn/gather/system/cfg/controller/SysTestConfigController.java index 9051c38e..b5855a5c 100644 --- a/system/src/main/java/com/njcn/gather/system/cfg/controller/SysTestConfigController.java +++ b/system/src/main/java/com/njcn/gather/system/cfg/controller/SysTestConfigController.java @@ -42,21 +42,6 @@ public class SysTestConfigController extends BaseController { 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 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) @PostMapping("/update") @ApiOperation("修改检测相关配置信息") @@ -66,9 +51,9 @@ public class SysTestConfigController extends BaseController { LogUtil.njcnDebug(log, "{}", methodDescribe); boolean result = sysTestConfigService.updateTestConfig(sysTestConfig); if (result) { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe); } else { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe); } } diff --git a/system/src/main/java/com/njcn/gather/system/dictionary/controller/DictDataController.java b/system/src/main/java/com/njcn/gather/system/dictionary/controller/DictDataController.java index 2681c1d0..56ee5906 100644 --- a/system/src/main/java/com/njcn/gather/system/dictionary/controller/DictDataController.java +++ b/system/src/main/java/com/njcn/gather/system/dictionary/controller/DictDataController.java @@ -63,14 +63,14 @@ public class DictDataController extends BaseController { @PostMapping("/add") @ApiOperation("新增字典数据") @ApiImplicitParam(name = "dictDataParam", value = "字典数据", required = true) - public HttpResult add(@RequestBody @Validated DictDataParam dictDataParam) { + public HttpResult add(@RequestBody @Validated DictDataParam dictDataParam) { String methodDescribe = getMethodDescribe("add"); LogUtil.njcnDebug(log, "{},字典数据为:{}", methodDescribe, dictDataParam); boolean result = dictDataService.addDictData(dictDataParam); if (result) { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe); } 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") @ApiOperation("修改字典数据") @ApiImplicitParam(name = "updateParam", value = "字典数据", required = true) - public HttpResult update(@RequestBody @Validated DictDataParam.UpdateParam updateParam) { + public HttpResult update(@RequestBody @Validated DictDataParam.UpdateParam updateParam) { String methodDescribe = getMethodDescribe("update"); LogUtil.njcnDebug(log, "{},字典数据为:{}", methodDescribe, updateParam); boolean result = dictDataService.updateDictData(updateParam); if (result) { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe); } 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") @ApiOperation("删除字典数据") @ApiImplicitParam(name = "ids", value = "字典索引", required = true, dataTypeClass = List.class) - public HttpResult delete(@RequestBody List ids) { + public HttpResult delete(@RequestBody List ids) { String methodDescribe = getMethodDescribe("delete"); LogUtil.njcnDebug(log, "{},字典ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids)); boolean result = dictDataService.deleteDictData(ids); if (result) { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe); } else { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe); } } diff --git a/system/src/main/java/com/njcn/gather/system/dictionary/controller/DictPqController.java b/system/src/main/java/com/njcn/gather/system/dictionary/controller/DictPqController.java index 6586c8c2..b7367a08 100644 --- a/system/src/main/java/com/njcn/gather/system/dictionary/controller/DictPqController.java +++ b/system/src/main/java/com/njcn/gather/system/dictionary/controller/DictPqController.java @@ -50,14 +50,14 @@ public class DictPqController extends BaseController { @OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD) @PostMapping("/add") @ApiOperation("新增电能质量指标字典") - public HttpResult add(@RequestBody @Validated DictPqParam dictPqParam) { + public HttpResult add(@RequestBody @Validated DictPqParam dictPqParam) { String methodDescribe = getMethodDescribe("add"); LogUtil.njcnDebug(log, "{},新增数据为:{}", methodDescribe, dictPqParam); boolean result = dictPqService.addDictPq(dictPqParam); if (result) { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe); } 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") @ApiOperation("更新电能质量指标字典") @ApiImplicitParam(name = "updateParam", value = "更新参数", required = true) - public HttpResult update(@RequestBody @Validated DictPqParam.UpdateParam updateParam) { + public HttpResult update(@RequestBody @Validated DictPqParam.UpdateParam updateParam) { String methodDescribe = getMethodDescribe("update"); LogUtil.njcnDebug(log, "{},更新数据为:{}", methodDescribe, updateParam); boolean result = dictPqService.updateDictPq(updateParam); if (result) { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe); } 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") @ApiOperation("删除电能质量指标字典") @ApiImplicitParam(name = "ids", value = "字典索引", required = true) - public HttpResult delete(@RequestBody List ids) { + public HttpResult delete(@RequestBody List ids) { String methodDescribe = getMethodDescribe("delete"); LogUtil.njcnDebug(log, "{},删除ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids)); boolean result = dictPqService.deleteDictPq(ids); if (result) { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe); } else { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe); } } } diff --git a/system/src/main/java/com/njcn/gather/system/dictionary/controller/DictTreeController.java b/system/src/main/java/com/njcn/gather/system/dictionary/controller/DictTreeController.java index 76c53c0a..8bff4205 100644 --- a/system/src/main/java/com/njcn/gather/system/dictionary/controller/DictTreeController.java +++ b/system/src/main/java/com/njcn/gather/system/dictionary/controller/DictTreeController.java @@ -68,14 +68,14 @@ public class DictTreeController extends BaseController { @PostMapping("/add") @ApiOperation("新增字典树数据") @ApiImplicitParam(name = "dictTreeParam", value = "字典数据", required = true) - public HttpResult add(@RequestBody @Validated DictTreeParam dictTreeParam) { + public HttpResult add(@RequestBody @Validated DictTreeParam dictTreeParam) { String methodDescribe = getMethodDescribe("add"); LogUtil.njcnDebug(log, "{},字典数据为:{}", methodDescribe, dictTreeParam); boolean result = dictTreeService.addDictTree(dictTreeParam); if (result) { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe); } 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); } } - -// @OperateInfo(info = LogEnum.SYSTEM_COMMON) -// @GetMapping("/getById") -// @ApiOperation("根据id查询数据") -// public HttpResult 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> getByPid(@RequestParam("pid") String pid) { -// String methodDescribe = getMethodDescribe("getByPid"); -// LogUtil.njcnDebug(log, "{},字典数据为:{}", methodDescribe, pid); -// List result = dictTreeService.queryByPid(pid); -// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); -// } - - -// @OperateInfo(info = LogEnum.SYSTEM_COMMON) -// @PostMapping("/queryLastLevelById") -// @ApiOperation("根据id查询字典树最底层") -// public HttpResult> queryLastLevelById(@RequestParam("id") String id) { -// String methodDescribe = getMethodDescribe("queryLastLevelById"); -// LogUtil.njcnDebug(log, "{},字典数据为:{}", methodDescribe, id); -// List result = dictTreeService.queryLastLevelById(id); -// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); -// } - -// @OperateInfo(info = LogEnum.SYSTEM_COMMON) -// @GetMapping("/queryAll") -// @ApiOperation("查询所有树形字典") -// public HttpResult> queryAll() { -// String methodDescribe = getMethodDescribe("queryAll"); -// List result = dictTreeService.queryAll(); -// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); -// } -// -// @OperateInfo(info = LogEnum.SYSTEM_COMMON) -// @GetMapping("/queryAllByType") -// @ApiOperation("分类查询所有树形字典") -// public HttpResult> queryAllByType(@RequestParam("type")Integer type) { -// String methodDescribe = getMethodDescribe("queryAll"); -// List result = dictTreeService.queryAllByType(type); -// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); -// } } diff --git a/system/src/main/java/com/njcn/gather/system/dictionary/controller/DictTypeController.java b/system/src/main/java/com/njcn/gather/system/dictionary/controller/DictTypeController.java index ab5f0923..3de62a9e 100644 --- a/system/src/main/java/com/njcn/gather/system/dictionary/controller/DictTypeController.java +++ b/system/src/main/java/com/njcn/gather/system/dictionary/controller/DictTypeController.java @@ -65,14 +65,14 @@ public class DictTypeController extends BaseController { @PostMapping("/add") @ApiOperation("新增字典类型") @ApiImplicitParam(name = "dictTypeParam", value = "字典类型数据", required = true) - public HttpResult add(@RequestBody @Validated DictTypeParam dictTypeParam) { + public HttpResult add(@RequestBody @Validated DictTypeParam dictTypeParam) { String methodDescribe = getMethodDescribe("add"); LogUtil.njcnDebug(log, "{},字典类型数据为:{}", methodDescribe, dictTypeParam); boolean result = dictTypeService.addDictType(dictTypeParam); if (result) { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe); } 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") @ApiOperation("修改字典类型") @ApiImplicitParam(name = "updateParam", value = "字典类型数据", required = true) - public HttpResult update(@RequestBody @Validated DictTypeParam.UpdateParam updateParam) { + public HttpResult update(@RequestBody @Validated DictTypeParam.UpdateParam updateParam) { String methodDescribe = getMethodDescribe("update"); LogUtil.njcnDebug(log, "{},字典类型数据为:{}", methodDescribe, updateParam); boolean result = dictTypeService.updateDictType(updateParam); if (result) { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe); } 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") @ApiOperation("删除字典类型") @ApiImplicitParam(name = "ids", value = "字典索引", required = true) - public HttpResult delete(@RequestBody List ids) { + public HttpResult delete(@RequestBody List ids) { String methodDescribe = getMethodDescribe("delete"); LogUtil.njcnDebug(log, "{},字典ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids)); boolean result = dictTypeService.deleteDictType(ids); if (result) { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe); } else { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe); } } diff --git a/system/src/main/java/com/njcn/gather/system/dictionary/service/IDictTreeService.java b/system/src/main/java/com/njcn/gather/system/dictionary/service/IDictTreeService.java index d271d0f3..156b7cf6 100644 --- a/system/src/main/java/com/njcn/gather/system/dictionary/service/IDictTreeService.java +++ b/system/src/main/java/com/njcn/gather/system/dictionary/service/IDictTreeService.java @@ -15,11 +15,6 @@ import java.util.List; */ public interface IDictTreeService extends IService { - /** - * 初始化缓存设备树 - */ - //void refreshDictTreeCache(); - /** * 根据code查询字典树 * @@ -49,32 +44,16 @@ public interface IDictTreeService extends IService { */ DictTree queryById(String id); - //DictTreeVO queryByCode(String code); - - //List queryByPid(String pid); - - //List queryLastLevelById(String id); - + /** + * 查询所有字典树 + * + * @return + */ List queryTree(); /** - * 查询所有树形字典 + * 根据字典树id查询字典树 * - * @author cdf - * @date 2023/12/18 - */ - //List queryAll(); - - /** - * 分类查询所有树形字典 - * - * @author cdf - * @date 2023/12/18 - */ - //List queryAllByType(Integer type); - - /** - * 根据字典树 * @param ids * @return */ diff --git a/system/src/main/java/com/njcn/gather/system/dictionary/service/impl/DictTreeServiceImpl.java b/system/src/main/java/com/njcn/gather/system/dictionary/service/impl/DictTreeServiceImpl.java index 18f427ed..d5961683 100644 --- a/system/src/main/java/com/njcn/gather/system/dictionary/service/impl/DictTreeServiceImpl.java +++ b/system/src/main/java/com/njcn/gather/system/dictionary/service/impl/DictTreeServiceImpl.java @@ -34,15 +34,6 @@ import java.util.stream.Collectors; @RequiredArgsConstructor public class DictTreeServiceImpl extends ServiceImpl implements IDictTreeService { - //private final RedisUtil redisUtil; - -// @Override -// public void refreshDictTreeCache () { -// LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); -// queryWrapper.eq(DictTree::getState, DictConst.ENABLE); -// List list = this.list(queryWrapper); -// redisUtil.saveByKey(AppRedisKey.DICT_TREE, list); -// } @Override public List getTreeByCode(String code) { @@ -52,7 +43,6 @@ public class DictTreeServiceImpl extends ServiceImpl i dictTree = dictTree.stream().filter(item -> item.getCode().equals(code)).collect(Collectors.toList()); } - //this.filterTreeByName(dictTree, keyword); return dictTree; } @@ -83,9 +73,6 @@ public class DictTreeServiceImpl extends ServiceImpl i } dictTree.setState(DictConst.ENABLE); result = this.save(dictTree); -// if (result) { -// refreshDictTreeCache(); -// } return result; } @@ -99,9 +86,6 @@ public class DictTreeServiceImpl extends ServiceImpl i checkRepeat(param, true); DictTree copyDictTree = new DictTree(); BeanUtils.copyProperties(param, copyDictTree); -// if (result) { -// refreshDictTreeCache(); -// } return this.updateById(copyDictTree); } @@ -117,9 +101,6 @@ public class DictTreeServiceImpl extends ServiceImpl i List childrenList = this.lambdaQuery().eq(DictTree::getState, DictConst.ENABLE).eq(DictTree::getPid, id).list(); if (CollectionUtils.isEmpty(childrenList)) { result = this.lambdaUpdate().set(DictTree::getState, DictConst.DELETE).in(DictTree::getId, id).update(); -// if (result) { -// refreshRolesFunctionsCache(); -// } } else { throw new BusinessException(SystemResponseEnum.EXISTS_CHILDREN_NOT_DELETE); } @@ -131,43 +112,6 @@ public class DictTreeServiceImpl extends ServiceImpl i return this.lambdaQuery().eq(DictTree::getId, id).eq(DictTree::getState, DictConst.ENABLE).one(); } -// @Override -// public DictTreeVO queryByCode(String code) { -// LambdaQueryWrapper 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 queryByPid(String pid) { -// List collect = new ArrayList<>(); -// LambdaQueryWrapper query = new LambdaQueryWrapper<>(); -// query.eq(DictTree::getPid, pid).eq(DictTree::getState, DictConst.ENABLE).orderByDesc(DictTree::getSort); -// List 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 queryLastLevelById(String id) { -// return this.baseMapper.queryLastLevelById(id); -// } - @Override public List queryTree() { LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); @@ -193,19 +137,6 @@ public class DictTreeServiceImpl extends ServiceImpl i ); } - // @Override -// public List queryAll() { -// LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); -// lambdaQueryWrapper.eq(DictTree::getState, DictConst.ENABLE); -// return this.list(lambdaQueryWrapper); -// } - - // @Override -// public List queryAllByType(Integer type) { -// LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); -// lambdaQueryWrapper.eq(DictTree::getState, DictConst.ENABLE).eq(DictTree::getType, type); -// return this.list(lambdaQueryWrapper); -// } private void checkRepeat(DictTreeParam dictTreeParam, boolean isExcludeSelf) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(DictTree::getPid, dictTreeParam.getPid()) // 同一父节点下不能有相同的code diff --git a/system/src/main/java/com/njcn/gather/system/pojo/enums/SystemResponseEnum.java b/system/src/main/java/com/njcn/gather/system/pojo/enums/SystemResponseEnum.java index 3866463d..aabe8233 100644 --- a/system/src/main/java/com/njcn/gather/system/pojo/enums/SystemResponseEnum.java +++ b/system/src/main/java/com/njcn/gather/system/pojo/enums/SystemResponseEnum.java @@ -12,62 +12,15 @@ public enum SystemResponseEnum { /** * 系统模块异常响应码的范围: - * A00350 ~ A00449 + * A01000 ~ A01 */ - SYSTEM_COMMON_ERROR("A00350", "系统模块异常"), - DICT_TYPE_REPEAT("A00351", "字典类型名称或编码重复"), - DICT_DATA_REPEAT("A00352", "字典数据名称或编码重复"), - AREA_CODE_REPEAT("A00353", "行政区域编码重复"), - LOAD_TYPE_EMPTY("A00354", "用能负荷数据为空"), - LINE_MARK_EMPTY("A00355", "字典监测点评分等级数据为空"), - VOLTAGE_EMPTY("A00356", "查询字典电压等级数据为空"), - - 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", "该字典在使用中,不能修改"); + DICT_TYPE_REPEAT("A01000", "字典类型名称或编码重复"), + DICT_DATA_REPEAT("A01002", "字典数据名称或编码重复"), + DICT_PQ_NAME_EXIST("A01003", "当前数据模型及相别下已存在相同名称"), + EXISTS_CHILDREN_NOT_DELETE("A01004", "当前字典下存在子字典,不能删除"), + CODE_REPEAT("A01005", "该层级下已存在相同的编码"), + CAN_NOT_DELETE_USED_DICT("A01006", "该字典在使用中,不能删除"), + CAN_NOT_UPDATE_USED_DICT("A01007", "该字典在使用中,不能修改"); private final String code; diff --git a/user/src/main/java/com/njcn/gather/user/user/controller/SysFunctionController.java b/user/src/main/java/com/njcn/gather/user/user/controller/SysFunctionController.java index 041814ae..64870d96 100644 --- a/user/src/main/java/com/njcn/gather/user/user/controller/SysFunctionController.java +++ b/user/src/main/java/com/njcn/gather/user/user/controller/SysFunctionController.java @@ -158,7 +158,11 @@ public class SysFunctionController extends BaseController { String methodDescribe = getMethodDescribe("assignFunctionByRoleId"); LogUtil.njcnDebug(log, "{},传入的角色id和资源id集合为:{}", methodDescribe, param); 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); + } } } diff --git a/user/src/main/java/com/njcn/gather/user/user/controller/SysRoleController.java b/user/src/main/java/com/njcn/gather/user/user/controller/SysRoleController.java index 36700c57..4406513c 100644 --- a/user/src/main/java/com/njcn/gather/user/user/controller/SysRoleController.java +++ b/user/src/main/java/com/njcn/gather/user/user/controller/SysRoleController.java @@ -50,14 +50,14 @@ public class SysRoleController extends BaseController { @PostMapping("/add") @ApiOperation("新增角色信息") @ApiImplicitParam(name = "roleParam", value = "角色信息", required = true) - public HttpResult add(@RequestBody @Validated SysRoleParam sysRoleParam) { + public HttpResult add(@RequestBody @Validated SysRoleParam sysRoleParam) { String methodDescribe = getMethodDescribe("add"); LogUtil.njcnDebug(log, "{},角色信息数据为:{}", methodDescribe, sysRoleParam); boolean result = sysRoleService.addRole(sysRoleParam); if (result) { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe); } 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") @ApiOperation("修改角色信息") @ApiImplicitParam(name = "updateParam", value = "角色信息", required = true) - public HttpResult update(@RequestBody @Validated SysRoleParam.UpdateParam updateParam) { + public HttpResult update(@RequestBody @Validated SysRoleParam.UpdateParam updateParam) { String methodDescribe = getMethodDescribe("update"); LogUtil.njcnDebug(log, "{},角色信息数据为:{}", methodDescribe, updateParam); boolean result = sysRoleService.updateRole(updateParam); if (result) { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe); } 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") @ApiOperation("删除角色信息") @ApiImplicitParam(name = "ids", value = "角色id集合", required = true) - public HttpResult delete(@RequestBody List ids) { + public HttpResult delete(@RequestBody List ids) { String methodDescribe = getMethodDescribe("delete"); LogUtil.njcnDebug(log, "{},角色信息数据为:{}", methodDescribe, ids); boolean result = sysRoleService.deleteRole(ids); if (result) { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe); } else { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe); } } diff --git a/user/src/main/java/com/njcn/gather/user/user/controller/SysUserController.java b/user/src/main/java/com/njcn/gather/user/user/controller/SysUserController.java index 488a22f0..54ea1d9d 100644 --- a/user/src/main/java/com/njcn/gather/user/user/controller/SysUserController.java +++ b/user/src/main/java/com/njcn/gather/user/user/controller/SysUserController.java @@ -112,14 +112,14 @@ public class SysUserController extends BaseController { @ApiImplicitParam(name = "oldPassword", value = "旧密码", required = true), @ApiImplicitParam(name = "newPassword", value = "新密码", required = true) }) - public HttpResult updatePassword(@RequestBody @Validated SysUserParam.SysUserUpdatePasswordParam param) { + public HttpResult updatePassword(@RequestBody @Validated SysUserParam.SysUserUpdatePasswordParam param) { String methodDescribe = getMethodDescribe("updatePassword"); LogUtil.njcnDebug(log, "{},用户id:{},用户旧密码:{},新密码:{}", methodDescribe, param.getId(), param.getOldPassword(), param.getNewPassword()); boolean result = sysUserService.updatePassword(param); - if (!result) { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe); - } else { + if (result) { return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe); + } else { + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe); } } }