提交 6f1e7d06 作者: zhenjie

Merge branch 'develop'

......@@ -14,4 +14,4 @@ patches:
images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/oms
newTag: 1a194fd7d926274c664924e84d1ca181726cd9b9
newTag: bf432223baae2ce514ca0c3584c9caf5ff6b4300
......@@ -5,6 +5,7 @@ import com.mmc.oms.feign.hystrix.PmsAppApiHystrix;
import com.mmc.oms.model.dto.uav.UavCartDTO;
import com.mmc.oms.model.qo.uav.PriceStockQO;
import com.mmc.oms.model.vo.lease.LeaseGoodsVO;
import com.mmc.oms.model.vo.uav.MallGoodsVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -27,4 +28,7 @@ public interface PmsAppApi {
@GetMapping("app/lease/leaseGoodsDetails")
ResultBody<LeaseGoodsVO> leaseGoodsDetails(@RequestParam Integer id);
@GetMapping("/app/goods/appMallGoodsDetails")
ResultBody<MallGoodsVO> mallGoodsDetails(@RequestParam Integer id);
}
......@@ -6,6 +6,7 @@ import com.mmc.oms.feign.PmsAppApi;
import com.mmc.oms.model.dto.uav.UavCartDTO;
import com.mmc.oms.model.qo.uav.PriceStockQO;
import com.mmc.oms.model.vo.lease.LeaseGoodsVO;
import com.mmc.oms.model.vo.uav.MallGoodsVO;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
......@@ -33,4 +34,10 @@ public class PmsAppApiHystrix implements PmsAppApi {
log.info("熔断:PmsAppApiHystrix.leaseGoodsDetails==error==>param:{}", id);
return null;
}
@Override
public ResultBody<MallGoodsVO> mallGoodsDetails(Integer mallGoodsId) {
log.info("熔断:PmsAppApiHystrix.mallGoodsDetails==error==>param:{}", mallGoodsId);
return null;
}
}
......@@ -20,6 +20,7 @@ import com.mmc.oms.entity.uav.*;
import com.mmc.oms.enums.UavOrderStatus;
import com.mmc.oms.enums.UavOrderType;
import com.mmc.oms.feign.PaymentAppApi;
import com.mmc.oms.feign.PmsAppApi;
import com.mmc.oms.feign.UserAppApi;
import com.mmc.oms.model.dto.ContractInfoDTO;
import com.mmc.oms.model.dto.kdn.KdnExpDTO;
......@@ -81,7 +82,7 @@ public class UavOrderServiceImpl implements UavOrderService {
private UserAppApi userAppApi;
@Autowired
private PmsClient pmsClient;
private PmsAppApi pmsAppApi;
@Autowired
private PaymentAppApi paymentAppApi;
......@@ -98,12 +99,15 @@ public class UavOrderServiceImpl implements UavOrderService {
return checkRes;
}
MallGoodsVO mallGoodsVO = checkRes.getResult();
if (mallGoodsVO == null) {
return ResultBody.error("访问错误!");
}
String orderNo = CodeUtil.uavOrderCode();
BigDecimal orderTotalAmount = BigDecimal.ZERO;
BigDecimal otherAmount = BigDecimal.ZERO;
for (UavOrderSkuVO skuVO : param.getSkuVOS()) {
// 计算规格金额
BigDecimal skuAmount = BigDecimal.valueOf(skuVO.getOrderNum()).multiply(skuVO.getUnitPrice());
BigDecimal skuAmount = BigDecimal.valueOf(skuVO.getOrderNum()).multiply(skuVO.getSalePrice());
orderTotalAmount = orderTotalAmount.add(skuAmount);
}
otherAmount = otherAmount.add(orderTotalAmount);
......@@ -194,9 +198,9 @@ public class UavOrderServiceImpl implements UavOrderService {
}
private ResultBody<MallGoodsVO> verifyMallGoods(AddUavOrderVO param) {
MallGoodsVO mallGoodsVO = null;
try {
mallGoodsVO = pmsClient.mallGoodsDetails(param.getMallGoodsId());
ResultBody<MallGoodsVO> mallGoodsVORes = pmsAppApi.mallGoodsDetails(param.getMallGoodsId());
MallGoodsVO mallGoodsVO = mallGoodsVORes.getResult();
// 检验商品是否在卖
if (mallGoodsVO == null || !mallGoodsVO.getShelfStatus().equals(1)){
return ResultBody.error("商品已下架");
......@@ -216,11 +220,12 @@ public class UavOrderServiceImpl implements UavOrderService {
return ResultBody.error("选择规格不存在");
}
}
return ResultBody.success(mallGoodsVO);
}catch (Exception e){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
e.printStackTrace();
return ResultBody.error("商品有变动");
}
return ResultBody.success(mallGoodsVO);
}
@Override
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论