提交 0ecf0b7d 作者: xiaowang

地址管理根据id查询

上级 fd47bc61
......@@ -2,8 +2,10 @@ package com.mmc.oms;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableFeignClients(basePackages = "com.mmc.oms.feign")
public class OmsApplication {
public static void main(String[] args) {
......
package com.mmc.oms.feign;
import com.mmc.oms.common.result.ResultBody;
import com.mmc.oms.feign.hystrix.PmsAppApiHystrix;
import com.mmc.oms.model.dto.mall.*;
import com.mmc.oms.model.qo.mall.MallOrderGoodsInfoQO;
import com.mmc.oms.model.qo.mall.ProductSpecPriceQO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author: zj
* @Date: 2023/6/5 15:18
*/
@FeignClient(url = "${pms.url}", name = "pms-svc", fallback = PmsAppApiHystrix.class)
public interface PmsAppApi {
@PostMapping("/pms/goods/fillGoodsInfo")
List<MallGoodsShopCarDTO> fillGoodsInfo(@RequestBody List<MallGoodsShopCarDTO> param, @RequestHeader("token") String token);
@PostMapping("/pms/goods/feignListProdGoodsSkuInfo")
List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(@RequestBody MallOrderGoodsInfoQO mallOrderGoodsInfoQO, @RequestHeader("token") String token);
@PostMapping("/pms/goods/feignListIndstGoodsSkuInfo")
List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(@RequestBody MallOrderGoodsInfoQO mallOrderGoodsInfoQO, @RequestHeader("token") String token);
@PostMapping("/pms/goods/feignListProductSpecPrice")
List<MallProductSpecPriceDTO> feignListProductSpecPrice(@RequestBody ProductSpecPriceQO productSpecPriceQO, @RequestHeader("token") String token);
@GetMapping("/pms/goods/feignGetUnitPriceByTag")
public ProductSpecPriceDTO feignGetUnitPriceByTag(@RequestParam(value = "specId") Integer specId,
@RequestParam(value = "tagId") Integer tagId, @RequestHeader("token") String token);
@GetMapping("/pms/lease/goods/feignLeaseGoodsInfoByAddressId")
public Integer feignLeaseGoodsInfoByAddressId(@RequestParam Integer id);
@GetMapping("lease/goods/feignLeaseGoodsInfoByAddressId")
public ResultBody feignLeaseGoodsInfoByAddressId(@RequestParam Integer id);
}
......@@ -14,7 +14,7 @@ import org.springframework.context.annotation.Configuration;
public class FeignConfiguration {
@Bean(name = "pmsAppApiHystrix")
public PmsAppApiHystrix workServiceHystrixApi() {
public PmsAppApiHystrix PmsAppApi() {
return new PmsAppApiHystrix();
}
......
package com.mmc.oms.feign.hystrix;
import com.alibaba.fastjson.JSONObject;
import com.mmc.oms.common.result.ResultBody;
import com.mmc.oms.feign.PmsAppApi;
import com.mmc.oms.model.dto.mall.*;
import com.mmc.oms.model.qo.mall.MallOrderGoodsInfoQO;
import com.mmc.oms.model.qo.mall.ProductSpecPriceQO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
......@@ -16,37 +14,7 @@ import java.util.List;
@Slf4j
public class PmsAppApiHystrix implements PmsAppApi {
@Override
public List<MallGoodsShopCarDTO> fillGoodsInfo(List<MallGoodsShopCarDTO> param, String token) {
log.info("熔断:MallGoodsClientHystrix.fillGoodsInfo==error==>param:{}", JSONObject.toJSONString(param));
return null;
}
@Override
public List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO, String token) {
log.info("熔断:MallGoodsClientHystrix.feignListProdGoodsSkuInfo==error==>param:{}", JSONObject.toJSONString(mallOrderGoodsInfoQO));
return null;
}
@Override
public List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO, String token) {
log.info("熔断:MallGoodsClientHystrix.feignListIndstGoodsSkuInfo==error==>param:{}", JSONObject.toJSONString(mallOrderGoodsInfoQO));
return null;
}
@Override
public List<MallProductSpecPriceDTO> feignListProductSpecPrice(ProductSpecPriceQO productSpecPriceQO, String token) {
log.info("熔断:MallGoodsClientHystrix.feignListProductSpecPrice==error==>param:{}", JSONObject.toJSONString(productSpecPriceQO));
return null;
}
@Override
public ProductSpecPriceDTO feignGetUnitPriceByTag(Integer specId, Integer tagId, String token) {
log.info("熔断:MallGoodsClientHystrix.feignGetUnitPriceByTag==error==>param:{}",specId,tagId);
return null;
}
@Override
public Integer feignLeaseGoodsInfoByAddressId(Integer id) {
public ResultBody feignLeaseGoodsInfoByAddressId(Integer id) {
log.info("熔断:PmsAppApiHystrix.feignLeaseGoodsInfoByAddressId==error==>param:{}",id);
return null;
}
......
......@@ -10,6 +10,7 @@ import com.mmc.oms.model.qo.mall.UserAddressQO;
import com.mmc.oms.model.vo.mall.UserAddressVO;
import com.mmc.oms.service.UserAddressService;
import com.mmc.oms.util.BeanCopyUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -22,6 +23,7 @@ import java.util.stream.Collectors;
* @Date: 2023/6/7 10:15
*/
@Service
@Slf4j
public class UserAddressServiceImpl implements UserAddressService {
@Autowired
private UserAddressDao userAddressDao;
......@@ -57,10 +59,12 @@ public class UserAddressServiceImpl implements UserAddressService {
@Override
public ResultBody deleteById(Integer id) {
Integer count = pmsAppApi.feignLeaseGoodsInfoByAddressId(id);
if (count == null) {
ResultBody resultBody = pmsAppApi.feignLeaseGoodsInfoByAddressId(id);
if (resultBody == null || !resultBody.getCode().equals("200")) {
log.error("远程调用失败:返回数据为null=====>UserAddressServiceImpl.deleteById=====>param{}",id);
return ResultBody.error("服务器异常,请稍后重试!");
}
int count = (int)resultBody.getResult();
if (count > 0) {
return ResultBody.error("有商品绑定该地址,不可删除!");
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论