Browse Source

分类预警配置 错误信息修改

dev_shibei_match
jianjun 4 years ago
parent
commit
f96d48a3bf
  1. 7
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 26
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java

7
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -222,7 +222,12 @@ public enum EpmetErrorCode {
ORG_ADD_FAILED(8919,"添加失败"),
ORG_EDIT_FAILED(8920,"编辑失败"),
ORG_DEL_FAILED(8921,"删除失败");
ORG_DEL_FAILED(8921,"删除失败"),
//通用的 错误消息自己定义返回
OPERATION_FAILED(9999,"网络开小差。。。"),
;
private int code;
private String msg;

26
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java

@ -19,15 +19,11 @@ package com.epmet.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.constant.IcResiCategoryStatsConfigConstant;
import com.epmet.dao.IcResiCategoryStatsConfigDao;
@ -36,22 +32,20 @@ import com.epmet.dto.IcResiCategoryStatsConfigDTO;
import com.epmet.dto.IcResiCategoryWarnConfigDTO;
import com.epmet.dto.form.IcResiCategoryStatsConfigFormDTO;
import com.epmet.dto.form.IcResiCategoryStatsConfigSortFormDTO;
import com.epmet.dto.form.UpGovRoleFormDTO;
import com.epmet.dto.result.IcResiCategoryStatsConfigResultDTO;
import com.epmet.entity.IcResiCategoryStatsConfigEntity;
import com.epmet.entity.IcResiCategoryWarnConfigEntity;
import com.epmet.excel.IcResiCategoryStatsConfigExcel;
import com.epmet.service.IcResiCategoryStatsConfigService;
import com.epmet.service.ResiCategoryStatsConfigService;
import com.github.pagehelper.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
@ -63,7 +57,7 @@ import java.util.Map;
@RestController
@RequestMapping("resicategorystatsconfig")
public class ResiCategoryStatsConfigController {
@Autowired
private IcResiCategoryStatsConfigService icResiCategoryStatsConfigService;
@Autowired
@ -96,13 +90,13 @@ public class ResiCategoryStatsConfigController {
if(IcResiCategoryStatsConfigConstant.WARN_YES.equals(formDTO.getWarn())){
//判断level1 和level2 的值
if(null ==level1 || level1==0){
return new Result().error(8001,"等级1阈值需大于0");
return new Result().error(EpmetErrorCode.OPERATION_FAILED.getCode(),"黄色预警阈值需大于0");
}
if(null == level2 || level2==0){
return new Result().error(8001,"等级2阈值需大于0");
return new Result().error(EpmetErrorCode.OPERATION_FAILED.getCode(),"红色预警阈值需大于0");
}
if(level2<=level1){
return new Result().error(8001,"等级2阈值需大于等级1阈值");
return new Result().error(EpmetErrorCode.OPERATION_FAILED.getCode(),"黄色预警阈值需大于红色预警阈值");
}
}
resiCategoryStatsConfigService.update(customerId,formDTO);
@ -170,4 +164,4 @@ public class ResiCategoryStatsConfigController {
}
}
}

Loading…
Cancel
Save