Browse Source

Merge remote-tracking branch 'origin/dev_abandon_grid' into dev_abandon_grid

dev
jianjun 3 years ago
parent
commit
8176c4eeb6
  1. 42
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/CustomerGridFormDTO.java
  2. 8
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonGovOrgFeignClient.java
  3. 5
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonGovOrgFeignClientFallBackFactory.java
  4. 5
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java

42
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/CustomerGridFormDTO.java

@ -0,0 +1,42 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.commons.tools.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* epmet-user端调用gov-org端的入参
* @author sun
*/
@Data
public class CustomerGridFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 网格Id
*/
@NotBlank(message = "网格ID不能为空", groups = {Grid.class})
private String gridId;
public interface Grid{}
}

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

@ -1,13 +1,13 @@
package com.epmet.commons.tools.feign; package com.epmet.commons.tools.feign;
import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.feign.fallback.CommonAggFeignClientFallBackFactory; import com.epmet.commons.tools.dto.form.CustomerGridFormDTO;
import com.epmet.commons.tools.feign.fallback.CommonGovOrgFeignClientFallBackFactory; import com.epmet.commons.tools.feign.fallback.CommonGovOrgFeignClientFallBackFactory;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestBody;
/** /**
* @Author zxc * @Author zxc
@ -19,11 +19,11 @@ public interface CommonGovOrgFeignClient {
/** /**
* @Description 查询网格信息 * @Description 查询网格信息
* @param gridId * @param customerGridFormDTO
* @author zxc * @author zxc
* @date 2021/11/5 2:54 下午 * @date 2021/11/5 2:54 下午
*/ */
@PostMapping("/gov/org/grid/getbaseinfo") @PostMapping("/gov/org/grid/getbaseinfo")
Result<GridInfoCache> getGridInfo(@RequestParam("gridId")String gridId); Result<GridInfoCache> getGridInfo(@RequestBody CustomerGridFormDTO customerGridFormDTO);
} }

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

@ -1,6 +1,7 @@
package com.epmet.commons.tools.feign.fallback; package com.epmet.commons.tools.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.form.CustomerGridFormDTO;
import com.epmet.commons.tools.feign.CommonGovOrgFeignClient; import com.epmet.commons.tools.feign.CommonGovOrgFeignClient;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.ModuleUtils;
@ -16,8 +17,8 @@ import org.springframework.stereotype.Component;
public class CommonGovOrgFeignClientFallBackFactory implements CommonGovOrgFeignClient { public class CommonGovOrgFeignClientFallBackFactory implements CommonGovOrgFeignClient {
@Override @Override
public Result<GridInfoCache> getGridInfo(String gridId) { public Result<GridInfoCache> getGridInfo(CustomerGridFormDTO customerGridFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridInfo", gridId); return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridInfo", customerGridFormDTO);
} }
} }

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

@ -2,6 +2,7 @@ package com.epmet.commons.tools.redis.common;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.dto.form.CustomerGridFormDTO;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.CommonAggFeignClient; import com.epmet.commons.tools.feign.CommonAggFeignClient;
import com.epmet.commons.tools.feign.CommonGovOrgFeignClient; import com.epmet.commons.tools.feign.CommonGovOrgFeignClient;
@ -61,7 +62,9 @@ public class CustomerOrgRedis {
if (!CollectionUtils.isEmpty(grid)) { if (!CollectionUtils.isEmpty(grid)) {
return ConvertUtils.mapToEntity(grid, GridInfoCache.class); return ConvertUtils.mapToEntity(grid, GridInfoCache.class);
} }
Result<GridInfoCache> gridInfoResult = customerOrgRedis.govOrgFeignClient.getGridInfo(gridId); CustomerGridFormDTO formDTO = new CustomerGridFormDTO();
formDTO.setGridId(gridId);
Result<GridInfoCache> gridInfoResult = customerOrgRedis.govOrgFeignClient.getGridInfo(formDTO);
if (!gridInfoResult.success()){ if (!gridInfoResult.success()){
throw new RenException("查询网格信息失败..."); throw new RenException("查询网格信息失败...");
} }

Loading…
Cancel
Save