|
|
@ -19,11 +19,16 @@ package com.epmet.service.impl; |
|
|
|
|
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.dto.result.OptionResultDTO; |
|
|
|
import com.epmet.commons.tools.enums.DictTypeEnum; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.dao.IcPlaceOrgDao; |
|
|
@ -80,10 +85,16 @@ public class IcPlaceOrgServiceImpl extends BaseServiceImpl<IcPlaceOrgDao, IcPlac |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void edit(EditPlaceOrgFormDTO formDTO) { |
|
|
|
CustomerStaffInfoCacheResult staffInfo=CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(),formDTO.getCurrentStaffId()); |
|
|
|
IcPlaceOrgEntity entity = baseDao.selectById(formDTO.getPlaceOrgId()); |
|
|
|
if (null == entity) { |
|
|
|
throw new RenException(String.format("修改九小场所下场所信息失败,场所不存在,场所Id->%s", formDTO.getPlaceOrgId())); |
|
|
|
} |
|
|
|
if (!staffInfo.getAgencyId().equals(entity.getAgencyId())) { |
|
|
|
AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(entity.getAgencyId()); |
|
|
|
String agencyName = null != agencyInfoCache ? agencyInfoCache.getOrganizationName() : StrConstant.EPMETY_STR; |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "", String.format("当前九小场所属于%s,您无权编辑", agencyName)); |
|
|
|
} |
|
|
|
entity = ConvertUtils.sourceToTarget(formDTO, IcPlaceOrgEntity.class); |
|
|
|
entity.setId(formDTO.getPlaceOrgId()); |
|
|
|
baseDao.updateById(entity); |
|
|
|