Commit 83cc15d3 by huluobin

update

parent e25b6a15
...@@ -78,14 +78,14 @@ public class CouponCustomerRelevanceServiceImpl extends ServiceImpl<CouponCustom ...@@ -78,14 +78,14 @@ public class CouponCustomerRelevanceServiceImpl extends ServiceImpl<CouponCustom
List<Integer> freeCouponIds = discountConfigMapper.selectList(new LambdaQueryWrapper<>()).stream().map(DiscountConfig::getCouponId).filter(Objects::nonNull).collect(Collectors.toList()); List<Integer> freeCouponIds = discountConfigMapper.selectList(new LambdaQueryWrapper<>()).stream().map(DiscountConfig::getCouponId).filter(Objects::nonNull).collect(Collectors.toList());
if (freeCouponIds.contains(couponCustomerRelevance.getCouponId())) { if (freeCouponIds.contains(couponCustomerRelevance.getCouponId())) {
canUserServeIds.retainAll(orderServeList.stream() canUserServeIds.retainAll(orderServeList.stream()
.filter(orderServe -> orderServe.getBindCoupon() == 2) .filter(orderServe -> orderServe.getBindOuterCoupon() == 2)
.filter(orderServe -> orderServe.getBindTimesCard() == 2)
.map(OrderServe::getServeId) .map(OrderServe::getServeId)
.collect(Collectors.toList())); .collect(Collectors.toList()));
} else { } else {
canUserServeIds.retainAll(orderServeList.stream() canUserServeIds.retainAll(orderServeList.stream()
.filter(orderServe -> { .filter(orderServe -> orderServe.getBindOuterCoupon() == 2)
return orderServe.getBindCoupon() == 2; .filter(orderServe -> orderServe.getBindTimesCard() == 2)
})
//不是活动价格 //不是活动价格
.filter(orderServe -> !orderServe.isActivity()) .filter(orderServe -> !orderServe.isActivity())
.map(OrderServe::getServeId) .map(OrderServe::getServeId)
......
...@@ -224,7 +224,7 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> impleme ...@@ -224,7 +224,7 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> impleme
.peek(coupon -> { .peek(coupon -> {
List<Integer> canUserServeIds = couponCustomerRelevanceMapper.queryCouponCustomerServeRelevance(coupon.getId()); List<Integer> canUserServeIds = couponCustomerRelevanceMapper.queryCouponCustomerServeRelevance(coupon.getId());
canUserServeIds.retainAll(orderServeList.stream() canUserServeIds.retainAll(orderServeList.stream()
.filter(orderServe -> orderServe.getBindCoupon() == 2) .filter(orderServe -> orderServe.getBindInnerCoupon() == 2)
.filter(orderServe -> !orderServe.isActivity()) .filter(orderServe -> !orderServe.isActivity())
.map(OrderServe::getServeId) .map(OrderServe::getServeId)
.collect(Collectors.toList())); .collect(Collectors.toList()));
......
...@@ -290,7 +290,7 @@ public class MarketServiceImpl implements MarketService { ...@@ -290,7 +290,7 @@ public class MarketServiceImpl implements MarketService {
OrderManage orderManage = orderManageMapper.selectById(orderId); OrderManage orderManage = orderManageMapper.selectById(orderId);
List<OrderServe> orderServeList = orderServeMapper.selectList(new LambdaQueryWrapper<OrderServe>().eq(OrderServe::getOrderId, orderId)); List<OrderServe> orderServeList = orderServeMapper.selectList(new LambdaQueryWrapper<OrderServe>().eq(OrderServe::getOrderId, orderId));
orderManage.setListOrderServer(orderServeList); orderManage.setListOrderServer(orderServeList);
orderServeList.forEach(orderServe -> orderServe.setBindCoupon(2)); // orderServeList.forEach(orderServe -> orderServe.setBindCoupon(2));
//1.改价结算 //1.改价结算
//总支付金额等于 总价格+总改价 //总支付金额等于 总价格+总改价
...@@ -368,7 +368,7 @@ public class MarketServiceImpl implements MarketService { ...@@ -368,7 +368,7 @@ public class MarketServiceImpl implements MarketService {
timesCardOrderServeDetailMapper.insert(timesCardOrderServeDetail); timesCardOrderServeDetailMapper.insert(timesCardOrderServeDetail);
//订单折扣金额更新 //订单折扣金额更新
orderServe.setBindCoupon(1); orderServe.setBindTimesCard(1);
orderServe.addDiscountPrice(actualDiscountAmount); orderServe.addDiscountPrice(actualDiscountAmount);
orderManage.addDiscountPrice(actualDiscountAmount); orderManage.addDiscountPrice(actualDiscountAmount);
// 在从服务上折扣的钱 // 在从服务上折扣的钱
...@@ -465,7 +465,7 @@ public class MarketServiceImpl implements MarketService { ...@@ -465,7 +465,7 @@ public class MarketServiceImpl implements MarketService {
} }
orderServe.addDiscountPrice(actualDiscountAmount); orderServe.addDiscountPrice(actualDiscountAmount);
orderManage.addDiscountPrice(actualDiscountAmount); orderManage.addDiscountPrice(actualDiscountAmount);
orderServe.setBindCoupon(1); orderServe.setBindOuterCoupon(1);
couponOrderRelevanceService.save(couponOrderRelevance); couponOrderRelevanceService.save(couponOrderRelevance);
//在从服务上折扣的钱 //在从服务上折扣的钱
// BigDecimal leftServeDiscountAmount = couponCustomerRelevance.getDiscountAmount().subtract(actualDiscountAmount); // BigDecimal leftServeDiscountAmount = couponCustomerRelevance.getDiscountAmount().subtract(actualDiscountAmount);
...@@ -579,7 +579,7 @@ public class MarketServiceImpl implements MarketService { ...@@ -579,7 +579,7 @@ public class MarketServiceImpl implements MarketService {
orderServe.addDiscountPrice(actualDiscountAmount); orderServe.addDiscountPrice(actualDiscountAmount);
orderManage.addDiscountPrice(actualDiscountAmount); orderManage.addDiscountPrice(actualDiscountAmount);
orderServe.setBindCoupon(1); orderServe.setBindInnerCoupon(1);
discountCalc = discountCalc.add(discountAmount); discountCalc = discountCalc.add(discountAmount);
payCalc = payCalc.add(payAmount); payCalc = payCalc.add(payAmount);
} }
...@@ -611,7 +611,9 @@ public class MarketServiceImpl implements MarketService { ...@@ -611,7 +611,9 @@ public class MarketServiceImpl implements MarketService {
"加种睫毛", "加彩色睫毛", "下睫毛"); "加种睫毛", "加彩色睫毛", "下睫毛");
OrderServe maxOrderServe = orderManage.getListOrderServer() OrderServe maxOrderServe = orderManage.getListOrderServer()
.stream() .stream()
.filter(orderServe -> orderServe.getBindCoupon() == 2) .filter(orderServe -> orderServe.getBindInnerCoupon() == 2)
.filter(orderServe -> orderServe.getBindTimesCard() == 2)
.filter(orderServe -> orderServe.getBindOuterCoupon() == 2)
.filter(orderServe -> serveIds.contains(orderServe.getServeId())) .filter(orderServe -> serveIds.contains(orderServe.getServeId()))
.max(Comparator.comparing(OrderServe::getPayPrice)) .max(Comparator.comparing(OrderServe::getPayPrice))
.orElse(null); .orElse(null);
...@@ -642,8 +644,9 @@ public class MarketServiceImpl implements MarketService { ...@@ -642,8 +644,9 @@ public class MarketServiceImpl implements MarketService {
} }
return true; return true;
}) })
.filter(orderServe -> orderServe.getBindCoupon() == 2) .filter(orderServe -> orderServe.getBindTimesCard() == 2)
.filter(Objects::nonNull) .filter(orderServe -> orderServe.getBindTimesCard() == 2)
.filter(orderServe -> orderServe.getBindOuterCoupon() == 2)
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
...@@ -672,7 +675,9 @@ public class MarketServiceImpl implements MarketService { ...@@ -672,7 +675,9 @@ public class MarketServiceImpl implements MarketService {
} }
return true; return true;
}) })
.filter(orderServe -> orderServe.getBindCoupon() == 2) .filter(orderServe -> orderServe.getBindInnerCoupon() == 2)
.filter(orderServe -> orderServe.getBindOuterCoupon() == 2)
.filter(orderServe -> orderServe.getBindTimesCard() == 2)
.max(Comparator.comparing(OrderServe::getPayPrice)) .max(Comparator.comparing(OrderServe::getPayPrice))
.orElse(null); .orElse(null);
} }
......
...@@ -196,8 +196,12 @@ public class OrderServe implements Serializable { ...@@ -196,8 +196,12 @@ public class OrderServe implements Serializable {
@TableField(strategy = FieldStrategy.IGNORED) @TableField(strategy = FieldStrategy.IGNORED)
private Integer serveDuration; private Integer serveDuration;
@ApiModelProperty("是否已经被卡券或者次卡折扣过 1-已经绑定了次卡或者优惠券 2-未绑定") // @ApiModelProperty("是否已经被卡券或者次卡折扣过 1-已经绑定了次卡或者优惠券 2-未绑定")
private Integer bindCoupon = 2; // private Integer bindCoupon = 2;
private Integer bindInnerCoupon;
private Integer bindOuterCoupon;
private Integer bindTimesCard;
@TableField(strategy = FieldStrategy.IGNORED) @TableField(strategy = FieldStrategy.IGNORED)
private BigDecimal promotionPrice; private BigDecimal promotionPrice;
......
package com.gogirl.infrastructure.interceptor; package com.gogirl.infrastructure.interceptor;
import com.gogirl.application.user.customer.CustomerService;
import com.gogirl.application.xcx.GogirlTokenService; import com.gogirl.application.xcx.GogirlTokenService;
import com.gogirl.domain.store.store.StoreManage; import com.gogirl.domain.store.store.StoreManage;
import com.gogirl.domain.user.customer.Customer;
import com.gogirl.domain.xcx.GogirlToken; import com.gogirl.domain.xcx.GogirlToken;
import com.gogirl.infrastructure.common.exception.RRException; import com.gogirl.infrastructure.common.exception.RRException;
import com.gogirl.infrastructure.common.util.ListUtil; import com.gogirl.infrastructure.common.util.ListUtil;
import com.gogirl.infrastructure.common.util.StringUtils;
import com.gogirl.infrastructure.mapper.store.store.StoreManageMapper; import com.gogirl.infrastructure.mapper.store.store.StoreManageMapper;
import com.gogirl.infrastructure.mapper.store.store.StoreTechnicianMapper; import com.gogirl.infrastructure.mapper.user.customer.CustomerMapper;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -24,6 +25,7 @@ public class LoginHandlerInterceptor implements HandlerInterceptor { ...@@ -24,6 +25,7 @@ public class LoginHandlerInterceptor implements HandlerInterceptor {
private final GogirlTokenService gogirlTokenService; private final GogirlTokenService gogirlTokenService;
private final StoreManageMapper storeManageMapper; private final StoreManageMapper storeManageMapper;
private final CustomerMapper customerMapper;
@Override @Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
...@@ -42,6 +44,11 @@ public class LoginHandlerInterceptor implements HandlerInterceptor { ...@@ -42,6 +44,11 @@ public class LoginHandlerInterceptor implements HandlerInterceptor {
GogirlToken gogirlToken = gogirlTokenService.getByToken(token); GogirlToken gogirlToken = gogirlTokenService.getByToken(token);
if (gogirlToken == null) { if (gogirlToken == null) {
throw new RRException(2000, "token失效,请重新登陆"); throw new RRException(2000, "token失效,请重新登陆");
} else {
Customer customer = customerMapper.selectById(gogirlToken.getCustomerId());
if (customer != null && StringUtils.isEmpty(customer.getPhone())) {
throw new RRException(1001, "请授权手机号码");
}
} }
} }
if (sourceFrom.equals("technician")) { if (sourceFrom.equals("technician")) {
......
...@@ -182,7 +182,8 @@ public class TimesCardController { ...@@ -182,7 +182,8 @@ public class TimesCardController {
List<Integer> canUserServeIds = timesCardCustomerRelevanceMapper.queryTimesCardServeIds(timesCardCustomerRelevance.getCardTypeId()); List<Integer> canUserServeIds = timesCardCustomerRelevanceMapper.queryTimesCardServeIds(timesCardCustomerRelevance.getCardTypeId());
canUserServeIds.retainAll(orderServeList.stream() canUserServeIds.retainAll(orderServeList.stream()
.filter(orderServe -> orderServe.getBindCoupon() == 2) .filter(orderServe -> orderServe.getBindOuterCoupon() == 2)
.filter(orderServe -> orderServe.getBindInnerCoupon() == 2)
.filter(orderServe -> !orderServe.isActivity()) .filter(orderServe -> !orderServe.isActivity())
.map(OrderServe::getServeId) .map(OrderServe::getServeId)
.collect(Collectors.toList())); .collect(Collectors.toList()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment