|
|
@ -972,7 +972,6 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu |
|
|
|
* @param formDTO |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
public void abandonGrid(AbandonGridFormDTO formDTO) { |
|
|
|
//未处理的事件
|
|
|
@ -989,16 +988,8 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "存在未关闭的议题", "该网格存在未关闭的议题,请处理完再操作"); |
|
|
|
} |
|
|
|
|
|
|
|
//可以弃用、处理数据 todo
|
|
|
|
// ....
|
|
|
|
// ....
|
|
|
|
//可以弃用、处理数据(网格工作人员所属关系(网格工作人员人数), 删除正在审核中的徽章认证)
|
|
|
|
this.abandonGridForDealBizData(formDTO.getGridId()); |
|
|
|
|
|
|
|
//处理成功,隐藏网格
|
|
|
|
LambdaUpdateWrapper<CustomerGridEntity> updateGrid=new LambdaUpdateWrapper<>(); |
|
|
|
updateGrid.set(CustomerGridEntity::getAbandonFlag,true); |
|
|
|
updateGrid.eq(CustomerGridEntity::getId,formDTO.getGridId()); |
|
|
|
baseDao.update(null,updateGrid); |
|
|
|
CustomerOrgRedis.delGridInfo(formDTO.getGridId()); |
|
|
|
} |
|
|
|
|
|
|
@ -1014,24 +1005,28 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu |
|
|
|
logger.debug("abandonGridForDealBizData staffList:{}", JSON.toJSONString(staffList)); |
|
|
|
List<StaffOrgRelationEntity> updateList = new ArrayList<>(); |
|
|
|
staffList.forEach(staffOrg->{ |
|
|
|
if(OrgTypeEnum.GRID.getCode().equals(staffOrg.getOrgType())){ |
|
|
|
StaffOrgRelationEntity entity = new StaffOrgRelationEntity(); |
|
|
|
entity.setId(staffOrg.getId()); |
|
|
|
entity.setOrgType(OrgTypeEnum.AGENCY.getCode()); |
|
|
|
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(staffOrg.getOrgId()); |
|
|
|
if (gridInfo == null || StringUtils.isBlank(gridInfo.getPid())){ |
|
|
|
log.error("abandonGridForDealBizData agencyId:{} is not exist",gridInfo.getPid()); |
|
|
|
return; |
|
|
|
} |
|
|
|
entity.setOrgId(gridInfo.getPid()); |
|
|
|
updateList.add(entity); |
|
|
|
//只有工作人员是网格添加的才处理
|
|
|
|
if(!OrgTypeEnum.GRID.getCode().equals(staffOrg.getOrgType())) { |
|
|
|
return; |
|
|
|
} |
|
|
|
StaffOrgRelationEntity entity = new StaffOrgRelationEntity(); |
|
|
|
entity.setId(staffOrg.getId()); |
|
|
|
entity.setOrgType(OrgTypeEnum.AGENCY.getCode()); |
|
|
|
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(staffOrg.getOrgId()); |
|
|
|
if (gridInfo == null || StringUtils.isBlank(gridInfo.getPid())) { |
|
|
|
assert gridInfo != null; |
|
|
|
log.error("abandonGridForDealBizData grid:{} pid is not exist", JSON.toJSONString(gridInfo)); |
|
|
|
return; |
|
|
|
} |
|
|
|
entity.setOrgId(gridInfo.getPid()); |
|
|
|
updateList.add(entity); |
|
|
|
}); |
|
|
|
//更新工作人员组织关系
|
|
|
|
String customerId = staffList.get(NumConstant.ZERO).getCustomerId(); |
|
|
|
updateGridStaff2Agency(customerId,gridId, staffList, updateList); |
|
|
|
//清空工作人员缓存
|
|
|
|
staffList.forEach(staff->CustomerStaffRedis.delStaffInfoFormCache(customerId,staff.getStaffId())); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
log.error("abandonGridForDealBizData exception", e); |
|
|
|
throw e; |
|
|
@ -1051,11 +1046,18 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu |
|
|
|
//网格对应的人数减少
|
|
|
|
long reduceCount = NumConstant.ZERO - staffList.stream().map(StaffOrgRelationDTO::getStaffId).distinct().count(); |
|
|
|
log.debug("updateGridStaff2Agency gridId:{} reduceCount:{}",gridId, reduceCount); |
|
|
|
int effectRow = customerGridDao.updateTotalUser(gridId, reduceCount); |
|
|
|
customerGridDao.updateTotalUser(gridId, reduceCount); |
|
|
|
//删除正在审核中的徽章认证
|
|
|
|
Result<Integer> badgeResult = epmetUserFeignClient.deleteBadgeCertificateAuditing(customerId,gridId); |
|
|
|
if (badgeResult == null || !badgeResult.success()){ |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"删除未审核徽章失败,请稍后重试"); |
|
|
|
} |
|
|
|
|
|
|
|
//处理成功,隐藏网格
|
|
|
|
LambdaUpdateWrapper<CustomerGridEntity> updateGrid=new LambdaUpdateWrapper<>(); |
|
|
|
updateGrid.set(CustomerGridEntity::getAbandonFlag,true); |
|
|
|
updateGrid.eq(CustomerGridEntity::getId,gridId); |
|
|
|
baseDao.update(null,updateGrid); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|