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