|
@@ -119,7 +119,12 @@ public class HeheServiceImpl implements HeheService {
|
|
|
iterator.remove();
|
|
|
} else {
|
|
|
pageService.setFloorLinkType(floorContent);
|
|
|
- List<FloorImageVo> floorImageList = pageMapper.getFloorImageByCentreId(floor.getId(), source);
|
|
|
+ Integer limitNum = 6;
|
|
|
+ String templateType = floorContent.getTemplateType();
|
|
|
+ if ("5".equals(templateType) || "9".equals(templateType)) {
|
|
|
+ limitNum = null;
|
|
|
+ }
|
|
|
+ List<FloorImageVo> floorImageList = pageMapper.getFloorImageByCentreId(floor.getId(), source, limitNum);
|
|
|
setFloorImageProduct(userId, floorImageList);
|
|
|
floor.setFloorImageList(floorImageList);
|
|
|
floor.setFloorContent(floorContent);
|
|
@@ -197,6 +202,12 @@ public class HeheServiceImpl implements HeheService {
|
|
|
return ResponseJson.success(product);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public ResponseJson<List<ImageLinkVo>> getHomeCarousel() {
|
|
|
+ List<ImageLinkVo> imageList = heheMapper.getHomeCarousel();
|
|
|
+ return ResponseJson.success(imageList);
|
|
|
+ }
|
|
|
+
|
|
|
private void setProductInfo(HeheProductVo product, Integer userId) {
|
|
|
product.setMainImage(ImageUtils.getImageURL("product", product.getMainImage(), 0, domain));
|
|
|
// 活动id
|
|
@@ -234,23 +245,24 @@ public class HeheServiceImpl implements HeheService {
|
|
|
//税费
|
|
|
boolean addTaxFlag = ("0".equals(product.getIncludedTax()) && ("1".equals(product.getInvoiceType()) || "2".equals(product.getInvoiceType())));
|
|
|
if (addTaxFlag) {
|
|
|
+ // 售价税费
|
|
|
BigDecimal addedValueTax = MathUtil.div(MathUtil.mul(product.getPrice(), product.getClubTaxPoint()), BigDecimal.valueOf(100), 2);
|
|
|
BigDecimal price = MathUtil.add(product.getPrice(), addedValueTax);
|
|
|
product.setPrice(price);
|
|
|
- if (null != product.getNormalPrice()) {
|
|
|
- addedValueTax = MathUtil.div(MathUtil.mul(product.getNormalPrice(), product.getClubTaxPoint()), BigDecimal.valueOf(100), 2);
|
|
|
- price = MathUtil.add(product.getNormalPrice(), addedValueTax);
|
|
|
- product.setNormalPrice(price);
|
|
|
- }
|
|
|
+ // 原价税费
|
|
|
+ addedValueTax = MathUtil.div(MathUtil.mul(product.getNormalPrice(), product.getClubTaxPoint()), BigDecimal.valueOf(100), 2);
|
|
|
+ price = MathUtil.add(product.getNormalPrice(), addedValueTax);
|
|
|
+ product.setNormalPrice(price);
|
|
|
}
|
|
|
// 查询用户的注册时间
|
|
|
Date registerTime = heheMapper.getUserRegisterTime(userId);
|
|
|
String[] productIdArr = {product.getProductId().toString()};
|
|
|
// 用户在该商品上可领取的优惠券列表
|
|
|
List<HeheCouponVo> couponList = heheMapper.getCouponList(userId, productIdArr, registerTime, null);
|
|
|
+ List<HeheCouponVo> receiveCouponList = new ArrayList<>();
|
|
|
if (null != userId) {
|
|
|
// 用户在该商品上已领取未使用的优惠券列表
|
|
|
- List<HeheCouponVo> receiveCouponList = heheMapper.getReceiveCouponList(userId, productIdArr, null, 1);
|
|
|
+ receiveCouponList = heheMapper.getReceiveCouponList(userId, productIdArr, null, 1);
|
|
|
couponList.addAll(receiveCouponList);
|
|
|
}
|
|
|
// 单价满足优惠条件的优惠券列表
|
|
@@ -260,7 +272,7 @@ public class HeheServiceImpl implements HeheService {
|
|
|
if (couponList.size() > 0) {
|
|
|
// 有可用优惠券
|
|
|
couponList.forEach(coupon->{
|
|
|
- if (1 == coupon.getNoThresholdFlag() || MathUtil.compare(product.getPrice(), coupon.getTouchPrice()) > 0) {
|
|
|
+ if (1 == coupon.getNoThresholdFlag() || MathUtil.compare(product.getPrice(), coupon.getTouchPrice()) >= 0) {
|
|
|
ableCouponList.add(coupon);
|
|
|
} else {
|
|
|
unableCouponList.add(coupon);
|
|
@@ -274,8 +286,10 @@ public class HeheServiceImpl implements HeheService {
|
|
|
product.setCouponPrice(MathUtil.sub(product.getPrice(), biggestCoupon.getCouponAmount()));
|
|
|
// 原价-最大优惠金额=原价券后价
|
|
|
product.setNormalCouponPrice(MathUtil.sub(product.getNormalPrice(), biggestCoupon.getCouponAmount()));
|
|
|
- // 优惠券id
|
|
|
- product.setCouponId(biggestCoupon.getCouponId());
|
|
|
+ //这张优惠券未领取才返回优惠券id显示领券购买
|
|
|
+ if (null != biggestCoupon.getUseStatus() && 0 == biggestCoupon.getUseStatus()) {
|
|
|
+ product.setCouponId(biggestCoupon.getCouponId());
|
|
|
+ }
|
|
|
// 券后价标签
|
|
|
product.setCouponStatus(1);
|
|
|
} else {
|
|
@@ -287,6 +301,15 @@ public class HeheServiceImpl implements HeheService {
|
|
|
product.setCouponInfo("券|满" + smallestCoupon.getTouchPrice() + "元减" + smallestCoupon.getCouponAmount());
|
|
|
}
|
|
|
}
|
|
|
+ if (1 == product.getActiveStatus() || 1 == product.getCollageStatus() || 1 == product.getDiscountStatus()) {
|
|
|
+ if (1 != product.getCollageStatus() && product.getPrice().compareTo(product.getNormalPrice()) == 0) {
|
|
|
+ // 原价与售价相同,不显示原价
|
|
|
+ product.setNormalPrice(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ } else if (product.getCouponPrice().compareTo(BigDecimal.ZERO) == 0) {
|
|
|
+ // 不参与任何活动且未使用优惠券,不显示原价
|
|
|
+ product.setNormalPrice(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|