|
@@ -10,7 +10,6 @@ import com.caimei365.commodity.utils.AppletsLinkUtil;
|
|
|
import com.caimei365.commodity.utils.ImageUtils;
|
|
|
import com.caimei365.commodity.utils.MathUtil;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
-import com.github.pagehelper.PageInfo;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -104,12 +103,6 @@ public class HeheServiceImpl implements HeheService {
|
|
|
}
|
|
|
// 来源:小程序
|
|
|
Integer source = 2;
|
|
|
- //轮播图设置链接类型
|
|
|
- if (StringUtils.isNotBlank(page.getHeadLink())) {
|
|
|
- Integer linkType = AppletsLinkUtil.getLinkType(page.getHeadLink());
|
|
|
- page.setLinkType(linkType);
|
|
|
- page.setLinkParam(AppletsLinkUtil.getLinkParam(linkType, page.getHeadLink()));
|
|
|
- }
|
|
|
List<PageFloorVo> floorList = pageMapper.getFloorByPageId(page.getId(), source);
|
|
|
ListIterator<PageFloorVo> iterator = floorList.listIterator();
|
|
|
while (iterator.hasNext()) {
|
|
@@ -118,7 +111,7 @@ public class HeheServiceImpl implements HeheService {
|
|
|
if (null == floorContent) {
|
|
|
iterator.remove();
|
|
|
} else {
|
|
|
- pageService.setFloorLinkType(floorContent);
|
|
|
+ setFloorLinkType(floorContent);
|
|
|
Integer limitNum = 6;
|
|
|
String templateType = floorContent.getTemplateType();
|
|
|
if ("5".equals(templateType) || "9".equals(templateType)) {
|
|
@@ -178,16 +171,11 @@ public class HeheServiceImpl implements HeheService {
|
|
|
product.setParametersList(parametersList);
|
|
|
// 商城活动id
|
|
|
Integer activityId = heheMapper.getActivityIdByProductId(product.getProductId());
|
|
|
- // 内部优惠折扣
|
|
|
- Integer discount = heheMapper.getProductDiscount(product.getProductId(), userId);
|
|
|
//税费
|
|
|
boolean addTaxFlag = ("0".equals(product.getIncludedTax()) && ("1".equals(product.getInvoiceType()) || "2".equals(product.getInvoiceType())));
|
|
|
if (activityId != null && activityId > 0) {
|
|
|
//活动阶梯
|
|
|
List<LadderPriceVo> ladderList = heheMapper.getActivityLadderList(activityId, product.getProductId());
|
|
|
- if (null != discount && discount > 0 && null != ladderList && ladderList.size() > 0) {
|
|
|
- ladderList.forEach(ladder -> ladder.setBuyPrice(MathUtil.div(MathUtil.mul(ladder.getBuyPrice(), discount), 100).doubleValue()));
|
|
|
- }
|
|
|
if (addTaxFlag && null != ladderList && ladderList.size() > 0) {
|
|
|
ladderList.forEach(ladder->{
|
|
|
BigDecimal addedValueTax = MathUtil.div(MathUtil.mul(ladder.getBuyPrice(), product.getClubTaxPoint()), BigDecimal.valueOf(100), 2);
|
|
@@ -203,8 +191,8 @@ public class HeheServiceImpl implements HeheService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ResponseJson<List<ImageLinkVo>> getHomeCarousel() {
|
|
|
- List<ImageLinkVo> imageList = heheMapper.getHomeCarousel();
|
|
|
+ public ResponseJson<List<HeHeImageVo>> getHomeCarousel() {
|
|
|
+ List<HeHeImageVo> imageList = heheMapper.getHomeCarousel();
|
|
|
return ResponseJson.success(imageList);
|
|
|
}
|
|
|
|
|
@@ -216,6 +204,8 @@ public class HeheServiceImpl implements HeheService {
|
|
|
HeheCollageProductPo collageProduct = heheMapper.getCollageProduct(product.getProductId());
|
|
|
// 限时特价
|
|
|
HeheDiscountPricePo discountPrice = heheMapper.getDiscountPrice(product.getProductId());
|
|
|
+ // 内部优惠折扣
|
|
|
+ HeHeDiscountVo discount = heheMapper.getProductDiscount(product.getProductId(), userId);
|
|
|
if (activityId != null && activityId > 0) {
|
|
|
product.setActiveStatus(1);
|
|
|
//活动阶梯
|
|
@@ -235,12 +225,18 @@ public class HeheServiceImpl implements HeheService {
|
|
|
product.setPrice(discountPrice.getDiscountPrice());
|
|
|
product.setDiscountStatus(1);
|
|
|
product.setDiscountEndTime(discountPrice.getOfflineTime());
|
|
|
- }
|
|
|
- // 内部优惠折扣
|
|
|
- Integer discount = heheMapper.getProductDiscount(product.getProductId(), userId);
|
|
|
- if (null != discount && discount > 0) {
|
|
|
- product.setPrice(MathUtil.div(MathUtil.mul(product.getPrice(), discount), 100));
|
|
|
- product.setNormalPrice(MathUtil.div(MathUtil.mul(product.getNormalPrice(), discount), 100));
|
|
|
+ } else if (discount != null) {
|
|
|
+ BigDecimal price = product.getPrice();
|
|
|
+ // 折扣价
|
|
|
+ BigDecimal disPrice = discount.getDiscountPrice();
|
|
|
+ // 折扣率
|
|
|
+ Integer dis = discount.getDiscount();
|
|
|
+ if (null != disPrice && disPrice.compareTo(BigDecimal.ZERO)>0) {
|
|
|
+ price = disPrice;
|
|
|
+ } else if (null != dis && dis > 0) {
|
|
|
+ price = MathUtil.div(MathUtil.mul(product.getPrice(), dis), 100);
|
|
|
+ }
|
|
|
+ product.setPrice(price);
|
|
|
}
|
|
|
//税费
|
|
|
boolean addTaxFlag = ("0".equals(product.getIncludedTax()) && ("1".equals(product.getInvoiceType()) || "2".equals(product.getInvoiceType())));
|
|
@@ -320,10 +316,6 @@ public class HeheServiceImpl implements HeheService {
|
|
|
Iterator<FloorImageVo> iterator = floorImageList.iterator();
|
|
|
while (iterator.hasNext()) {
|
|
|
FloorImageVo image = iterator.next();
|
|
|
- Integer linkType = AppletsLinkUtil.getLinkType(image.getLink());
|
|
|
- Map<String, Object> linkParam = AppletsLinkUtil.getLinkParam(linkType, image.getLink());
|
|
|
- image.setLinkType(linkType);
|
|
|
- image.setLinkParam(linkParam);
|
|
|
if (image.getProductId() != null) {
|
|
|
// 获取商品及价格
|
|
|
HeheProductVo product = heheMapper.getProduct(image.getProductId());
|
|
@@ -339,4 +331,38 @@ public class HeheServiceImpl implements HeheService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 设置跳转参数
|
|
|
+ * @param floorContent
|
|
|
+ */
|
|
|
+ private void setFloorLinkType(FloorContentVo floorContent) {
|
|
|
+ if (floorContent != null) {
|
|
|
+ if (null != floorContent.getJumpType1() && 1 == floorContent.getJumpType1() && StringUtils.isNotBlank(floorContent.getAdsLink1())) {
|
|
|
+ Integer linkType1 = AppletsLinkUtil.getLinkType(floorContent.getAdsLink1());
|
|
|
+ floorContent.setLinkType1(linkType1);
|
|
|
+ floorContent.setLinkParam1(AppletsLinkUtil.getLinkParam(linkType1, floorContent.getAdsLink1()));
|
|
|
+ }
|
|
|
+ if (null != floorContent.getJumpType2() && 1 == floorContent.getJumpType2() && StringUtils.isNotBlank(floorContent.getAdsLink2())) {
|
|
|
+ Integer linkType2 = AppletsLinkUtil.getLinkType(floorContent.getAdsLink2());
|
|
|
+ floorContent.setLinkType2(linkType2);
|
|
|
+ floorContent.setLinkParam2(AppletsLinkUtil.getLinkParam(linkType2, floorContent.getAdsLink2()));
|
|
|
+ }
|
|
|
+ if (null != floorContent.getJumpType3() && 1 == floorContent.getJumpType3() && StringUtils.isNotBlank(floorContent.getAdsLink3())) {
|
|
|
+ Integer linkType3 = AppletsLinkUtil.getLinkType(floorContent.getAdsLink3());
|
|
|
+ floorContent.setLinkType3(linkType3);
|
|
|
+ floorContent.setLinkParam3(AppletsLinkUtil.getLinkParam(linkType3, floorContent.getAdsLink3()));
|
|
|
+ }
|
|
|
+ if (null != floorContent.getJumpType4() && 1 == floorContent.getJumpType4() && StringUtils.isNotBlank(floorContent.getAdsLink4())) {
|
|
|
+ Integer linkType4 = AppletsLinkUtil.getLinkType(floorContent.getAdsLink4());
|
|
|
+ floorContent.setLinkType4(linkType4);
|
|
|
+ floorContent.setLinkParam4(AppletsLinkUtil.getLinkParam(linkType4, floorContent.getAdsLink4()));
|
|
|
+ }
|
|
|
+ if (null != floorContent.getJumpType5() && 1 == floorContent.getJumpType5() && StringUtils.isNotBlank(floorContent.getAdsLink5())) {
|
|
|
+ Integer linkType3 = AppletsLinkUtil.getLinkType(floorContent.getAdsLink3());
|
|
|
+ floorContent.setLinkType3(linkType3);
|
|
|
+ floorContent.setLinkParam3(AppletsLinkUtil.getLinkParam(linkType3, floorContent.getAdsLink3()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|