Browse Source

更新异常提示方式

dev_power_axis
YUJT 3 years ago
parent
commit
a20db6ec62
  1. 12
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructServiceImpl.java
  2. 4
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisTagServiceImpl.java

12
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructServiceImpl.java

@ -9,6 +9,7 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ErrorCode;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ConvertUtils;
@ -131,11 +132,11 @@ public class PowerAxisStructServiceImpl extends BaseServiceImpl<PowerAxisStructD
int structLevel = powerAxisTagService.selectStructLevelByCode(loginUserUtil.getLoginUserCustomerId(), PowerTagCategoryEnum.STRUCT.category(), form.getCategoryCode());
if (PowerTagLevelEnum.ROOT.level() == structLevel) {
if (baseDao.queryCategory(form) > NumConstant.ZERO) {
throw new EpmetException("同一组织下只允许存在一个顶级节点");
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "同一组织下只允许存在一个顶级节点");
}
}
if (baseDao.queryName(form) > NumConstant.ZERO) {
throw new EpmetException("同一组织下不允许存在重名的节点");
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "同一组织下不允许存在重名的节点");
}
this.assembleStruct(form, loginUserUtil.getLoginUserCustomerId());
@ -166,23 +167,24 @@ public class PowerAxisStructServiceImpl extends BaseServiceImpl<PowerAxisStructD
if (PowerTagLevelEnum.ROOT.level() == structLevel) {
pid = NumConstant.ZERO_STR;
} else {
throw new EpmetException("请选择上级节点");
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "请选择上级节点");
}
}
String agencyId = struct.getAgencyId();
if (NumConstant.ZERO_STR.equals(pid) && StringUtils.isBlank(agencyId)) {
throw new EpmetException("请选择绑定组织");
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "请选择绑定组织");
}
if (NumConstant.ZERO_STR.equals(pid)) {
// 新增顶级节点
Result<CustomerAgencyDTO> agencyInfoResult = govOrgOpenFeignClient.getAgencyById(agencyId);
if (!agencyInfoResult.success()) {
throw new EpmetException(agencyInfoResult.getMsg());
throw new EpmetException(agencyInfoResult.getCode(), agencyInfoResult.getMsg());
}
CustomerAgencyDTO agencyInfo = agencyInfoResult.getData();
struct.setAgencyId(agencyInfo.getId());
struct.setAgencyName(agencyInfo.getOrganizationName());
struct.setAgencyType(agencyInfo.getLevel());
struct.setPids(StringUtils.EMPTY);
} else {
// 新增一级节点或二级节点
PowerAxisStructEntity parentStruct = baseDao.selectById(pid);

4
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisTagServiceImpl.java

@ -99,7 +99,7 @@ public class PowerAxisTagServiceImpl extends BaseServiceImpl<PowerAxisTagDao, Po
public List<PowerAxisTagCategoryResultDTO> listSimple(String tagCategory) {
if (StringUtils.isBlank(tagCategory)) {
throw new EpmetException("缺少参数");
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "缺少参数");
}
QueryWrapper<PowerAxisTagEntity> wrapper = new QueryWrapper<>();
@ -126,7 +126,7 @@ public class PowerAxisTagServiceImpl extends BaseServiceImpl<PowerAxisTagDao, Po
.select(PowerAxisTagEntity::getStructLevel);
List<PowerAxisTagEntity> list = baseDao.selectList(lqw);
if (list.size() != NumConstant.ONE) {
throw new EpmetException("动力主轴标签配置出错");
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "动力主轴标签配置出错");
}
return list.get(NumConstant.ZERO).getStructLevel();
}

Loading…
Cancel
Save