Browse Source

九小场所列表展示本机及下级,返回agencyId;5big

feature/teamB_zz_wgh
yinzuomei 3 years ago
parent
commit
9408da29ef
  1. 3
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditPlaceOrgFormDTO.java
  2. 2
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PlaceOrgDetailResultDTO.java
  3. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlaceOrgController.java
  4. 11
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlaceOrgServiceImpl.java
  5. 3
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlaceOrgDao.xml

3
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditPlaceOrgFormDTO.java

@ -79,6 +79,7 @@ public class EditPlaceOrgFormDTO implements Serializable {
public interface Del { } public interface Del { }
public interface Detail { } public interface Detail { }
private String currentStaffId;
private String customerId;
} }

2
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PlaceOrgDetailResultDTO.java

@ -18,6 +18,8 @@ public class PlaceOrgDetailResultDTO implements Serializable {
private String gridId; private String gridId;
//场所区域名称 //场所区域名称
private String gridName; private String gridName;
private String agencyId;
//场所地址 //场所地址
private String address; private String address;
//场所类型名称[九小场所Value值] //场所类型名称[九小场所Value值]

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlaceOrgController.java

@ -66,6 +66,8 @@ public class IcPlaceOrgController {
**/ **/
@PostMapping("edit") @PostMapping("edit")
public Result edit(@LoginUser TokenDto tokenDto, @RequestBody EditPlaceOrgFormDTO formDTO) { public Result edit(@LoginUser TokenDto tokenDto, @RequestBody EditPlaceOrgFormDTO formDTO) {
formDTO.setCurrentStaffId(tokenDto.getUserId());
formDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(formDTO, EditPlaceOrgFormDTO.Edit.class); ValidatorUtils.validateEntity(formDTO, EditPlaceOrgFormDTO.Edit.class);
placeOrgService.edit(formDTO); placeOrgService.edit(formDTO);
return new Result(); return new Result();

11
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlaceOrgServiceImpl.java

@ -19,11 +19,16 @@ package com.epmet.service.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant; 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.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.enums.DictTypeEnum; 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.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.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IcPlaceOrgDao; import com.epmet.dao.IcPlaceOrgDao;
@ -80,10 +85,16 @@ public class IcPlaceOrgServiceImpl extends BaseServiceImpl<IcPlaceOrgDao, IcPlac
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void edit(EditPlaceOrgFormDTO formDTO) { public void edit(EditPlaceOrgFormDTO formDTO) {
CustomerStaffInfoCacheResult staffInfo=CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(),formDTO.getCurrentStaffId());
IcPlaceOrgEntity entity = baseDao.selectById(formDTO.getPlaceOrgId()); IcPlaceOrgEntity entity = baseDao.selectById(formDTO.getPlaceOrgId());
if (null == entity) { if (null == entity) {
throw new RenException(String.format("修改九小场所下场所信息失败,场所不存在,场所Id->%s", formDTO.getPlaceOrgId())); 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 = ConvertUtils.sourceToTarget(formDTO, IcPlaceOrgEntity.class);
entity.setId(formDTO.getPlaceOrgId()); entity.setId(formDTO.getPlaceOrgId());
baseDao.updateById(entity); baseDao.updateById(entity);

3
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlaceOrgDao.xml

@ -13,7 +13,8 @@
a.address address, a.address address,
a.scale scale, a.scale scale,
a.person_in_charge personInCharge, a.person_in_charge personInCharge,
a.mobile mobile a.mobile mobile,
a.AGENCY_ID as agencyId
FROM FROM
ic_place_org a ic_place_org a
LEFT JOIN customer_grid b ON a.GRID_ID = b.ID LEFT JOIN customer_grid b ON a.GRID_ID = b.ID

Loading…
Cancel
Save