提交 62430bb0 作者: xiaowang

地址管理根据id查询

上级 82c317e3
......@@ -27,6 +27,8 @@ public interface PmsAppApi {
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);
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);
}
......@@ -44,4 +44,10 @@ public class PmsAppApiHystrix implements PmsAppApi {
log.info("熔断:MallGoodsClientHystrix.feignGetUnitPriceByTag==error==>param:{}",specId,tagId);
return null;
}
@Override
public Integer feignLeaseGoodsInfoByAddressId(Integer id) {
log.info("熔断:PmsAppApiHystrix.feignLeaseGoodsInfoByAddressId==error==>param:{}",id);
return null;
}
}
......@@ -3,6 +3,7 @@ package com.mmc.oms.service.Impl;
import com.mmc.oms.common.result.ResultBody;
import com.mmc.oms.dao.UserAddressDao;
import com.mmc.oms.entity.mall.UserAddressDO;
import com.mmc.oms.feign.PmsAppApi;
import com.mmc.oms.model.dto.mall.UserAddressDTO;
import com.mmc.oms.model.dto.user.BaseAccountDTO;
import com.mmc.oms.model.qo.mall.UserAddressQO;
......@@ -12,6 +13,7 @@ import com.mmc.oms.util.BeanCopyUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
......@@ -23,7 +25,8 @@ import java.util.stream.Collectors;
public class UserAddressServiceImpl implements UserAddressService {
@Autowired
private UserAddressDao userAddressDao;
@Resource
private PmsAppApi pmsAppApi;
@Override
public ResultBody insert(UserAddressVO param, BaseAccountDTO currentAccount) {
// 如果之前有默认的话,就要修改为非默认
......@@ -54,6 +57,13 @@ public class UserAddressServiceImpl implements UserAddressService {
@Override
public ResultBody deleteById(Integer id) {
Integer count = pmsAppApi.feignLeaseGoodsInfoByAddressId(id);
if (count == null) {
return ResultBody.error("服务器异常,请稍后重试!");
}
if (count > 0) {
return ResultBody.error("有商品绑定该地址,不可删除!");
}
userAddressDao.removeById(id);
return ResultBody.success();
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论