Browse Source

Merge branch 'dev_abandon_grid' of http://git.elinkit.com.cn:7070/r/epmet-cloud into develop

dev
jianjun 3 years ago
parent
commit
dfd1710154
  1. 29
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonGovOrgFeignClient.java
  2. 23
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonGovOrgFeignClientFallBackFactory.java
  3. 11
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java
  4. 2
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerGridDTO.java
  5. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerGridEntity.java
  6. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java

29
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonGovOrgFeignClient.java

@ -0,0 +1,29 @@
package com.epmet.commons.tools.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.feign.fallback.CommonAggFeignClientFallBackFactory;
import com.epmet.commons.tools.feign.fallback.CommonGovOrgFeignClientFallBackFactory;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @Author zxc
* @DateTime 2022/3/17 1:42 下午
* @DESC
*/
@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallbackFactory = CommonGovOrgFeignClientFallBackFactory.class)
public interface CommonGovOrgFeignClient {
/**
* @Description 查询网格信息
* @param gridId
* @author zxc
* @date 2021/11/5 2:54 下午
*/
@PostMapping("/gov/org/grid/getbaseinfo")
Result<GridInfoCache> getGridInfo(@RequestParam("gridId")String gridId);
}

23
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonGovOrgFeignClientFallBackFactory.java

@ -0,0 +1,23 @@
package com.epmet.commons.tools.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.feign.CommonGovOrgFeignClient;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import org.springframework.stereotype.Component;
/**
* @Author zxc
* @DateTime 2022/3/17 1:46 下午
* @DESC
*/
@Component
public class CommonGovOrgFeignClientFallBackFactory implements CommonGovOrgFeignClient {
@Override
public Result<GridInfoCache> getGridInfo(String gridId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridInfo", gridId);
}
}

11
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java

@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.CommonAggFeignClient;
import com.epmet.commons.tools.feign.CommonGovOrgFeignClient;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
@ -32,6 +33,8 @@ public class CustomerOrgRedis {
@Autowired
private CommonAggFeignClient commonAggFeignClient;
@Autowired
private CommonGovOrgFeignClient govOrgFeignClient;
private static CustomerOrgRedis customerOrgRedis;
@ -41,6 +44,7 @@ public class CustomerOrgRedis {
customerOrgRedis = this;
customerOrgRedis.redisUtils = this.redisUtils;
customerOrgRedis.commonAggFeignClient = this.commonAggFeignClient;
customerOrgRedis.govOrgFeignClient = this.govOrgFeignClient;
}
/**
@ -56,7 +60,7 @@ public class CustomerOrgRedis {
if (!CollectionUtils.isEmpty(grid)) {
return ConvertUtils.mapToEntity(grid, GridInfoCache.class);
}
Result<GridInfoCache> gridInfoResult = customerOrgRedis.commonAggFeignClient.getGridInfo(gridId);
Result<GridInfoCache> gridInfoResult = customerOrgRedis.govOrgFeignClient.getGridInfo(gridId);
if (!gridInfoResult.success()){
throw new RenException("查询网格信息失败...");
}
@ -64,9 +68,10 @@ public class CustomerOrgRedis {
//throw new RenException("没有此网格信息...");
return null;
}
log.info("select grid info is {}", JSON.toJSONString(gridInfoResult.getData()));
// feign 方法中已经放缓存
/*log.info("select grid info is {}", JSON.toJSONString(gridInfoResult.getData()));
Map<String, Object> map = BeanUtil.beanToMap(gridInfoResult.getData(), false, true);
customerOrgRedis.redisUtils.hMSet(key, map);
customerOrgRedis.redisUtils.hMSet(key, map);*/
return gridInfoResult.getData();
}

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

@ -154,5 +154,5 @@ public class CustomerGridDTO implements Serializable {
/**
* 弃用1正常使用0
*/
private Boolean abandonFlag;
private Integer abandonFlag;
}

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerGridEntity.java

@ -113,5 +113,5 @@ public class CustomerGridEntity extends BaseEpmetEntity {
/**
* 弃用1正常使用0
*/
private Boolean abandonFlag;
private Integer abandonFlag;
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java

@ -1015,7 +1015,7 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
});
//更新工作人员组织关系
String customerId = staffList.get(NumConstant.ZERO).getCustomerId();
updateGridStaff2Agency(customerId,gridId, staffList, updateList);
dealBizDataForAbandon(customerId,gridId, staffList, updateList);
//清空工作人员缓存
staffList.forEach(staff->CustomerStaffRedis.delStaffInfoFormCache(customerId,staff.getStaffId()));
@ -1026,7 +1026,7 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
}
@Transactional
public void updateGridStaff2Agency(String customerId, String gridId, List<StaffOrgRelationDTO> staffList, List<StaffOrgRelationEntity> updateList) {
public void dealBizDataForAbandon(String customerId, String gridId, List<StaffOrgRelationDTO> staffList, List<StaffOrgRelationEntity> updateList) {
//1.删除工作人员与网格的关系
LambdaQueryWrapper<CustomerStaffGridEntity> updateWrapper = new LambdaQueryWrapper<>();
updateWrapper.eq(CustomerStaffGridEntity::getGridId,gridId);
@ -1037,7 +1037,7 @@ 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);
log.debug("dealBizDataForAbandon gridId:{} reduceCount:{}",gridId, reduceCount);
customerGridDao.updateTotalUser(gridId, reduceCount);
//删除正在审核中的徽章认证
Result<Integer> badgeResult = epmetUserFeignClient.deleteBadgeCertificateAuditing(customerId,gridId);
@ -1047,7 +1047,7 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
//处理成功,隐藏网格
LambdaUpdateWrapper<CustomerGridEntity> updateGrid=new LambdaUpdateWrapper<>();
updateGrid.set(CustomerGridEntity::getAbandonFlag,true);
updateGrid.set(CustomerGridEntity::getAbandonFlag,NumConstant.ZERO);
updateGrid.eq(CustomerGridEntity::getId,gridId);
baseDao.update(null,updateGrid);
}

Loading…
Cancel
Save