|
|
@@ -19,7 +19,7 @@ import com.cyksj.mapper.GiftCardGoodsSkuMapper;
|
|
|
import com.cyksj.mapper.GoodsDonSkuMapper;
|
|
|
import com.cyksj.mapper.OrderDonMapper;
|
|
|
import com.cyksj.mapper.RegisterOrderDonMapper;
|
|
|
-import com.cyksj.mapper.manage.distribute.UserDistributeSharedMapper;
|
|
|
+import com.cyksj.mapper.manage.coupon.CouponUserMapper;
|
|
|
import com.cyksj.mapper.shop.YhShopGoodsSkuMapper;
|
|
|
import com.cyksj.mapper.sys.SysConfigMapper;
|
|
|
import com.cyksj.model.entity.*;
|
|
|
@@ -82,7 +82,7 @@ public class GoodsDonController {
|
|
|
|
|
|
private final UserService userService;
|
|
|
|
|
|
- private final UserDistributeSharedMapper userDistributeSharedMapper;
|
|
|
+ private final CouponUserMapper couponUserMapper;
|
|
|
|
|
|
private final GoodsDonFrontService goodsDonFrontService;
|
|
|
|
|
|
@@ -447,12 +447,13 @@ public class GoodsDonController {
|
|
|
// });
|
|
|
// }
|
|
|
// }
|
|
|
+ //设置规格优惠后的价格
|
|
|
+ setUserCouponSkuMoney(fUid, sku);
|
|
|
return true;
|
|
|
}).collect(Collectors.toList()));
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(views);
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
+ /**
|
|
|
* 获取商品推荐平台
|
|
|
*/
|
|
|
@GetMapping("/get/recommend/{id}")
|
|
|
@@ -1071,6 +1072,8 @@ public class GoodsDonController {
|
|
|
}
|
|
|
//设置特定价格
|
|
|
setGcSpecificPrice(data, fUid, dsUserId.get());
|
|
|
+ //设置用户存在优惠券的优惠商品价格
|
|
|
+ setUserCouponGoodsMoney(fUid, data);
|
|
|
return true;
|
|
|
}).collect(Collectors.toList());
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(goodsFrontListViews);
|
|
|
@@ -1363,5 +1366,36 @@ public class GoodsDonController {
|
|
|
return Integer.parseInt(soldObj.toString());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 设置平台优惠价格
|
|
|
+ */
|
|
|
+ private void setUserCouponGoodsMoney(Long userId, GoodsFrontListCategoryView data) {
|
|
|
+ //登录后
|
|
|
+ if (userId != null) {
|
|
|
+ //寻找对应最低规格的优惠券
|
|
|
+ Coupon coupon = couponUserMapper.selectUserCouponByGidAndPrice(userId, data.getId(), data.getPrice());
|
|
|
+ if (coupon != null) {
|
|
|
+ data.setDiscount(coupon.getDiscount());
|
|
|
+ data.setReduceMoney(coupon.getReduceMoney());
|
|
|
+ data.setDiscountPrice(data.getPrice().subtract(coupon.getCouponMoney()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置平台规格优惠价格
|
|
|
+ */
|
|
|
+ private void setUserCouponSkuMoney(Long userId, GoodsDonSkuFrontView sku) {
|
|
|
+ //登录后
|
|
|
+ if (userId != null) {
|
|
|
+ //寻找对应最低规格的优惠券
|
|
|
+ Coupon coupon = couponUserMapper.selectUserCouponBySkuId(userId, sku.getId());
|
|
|
+ if (coupon != null) {
|
|
|
+ sku.setDiscount(coupon.getDiscount());
|
|
|
+ sku.setReduceMoney(coupon.getReduceMoney());
|
|
|
+ sku.setDiscountPrice(sku.getPrice().subtract(coupon.getCouponMoney()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
}
|