Commit d60b7b86 by huluobin

OrderServe 新增mainOrderServeId 字段

parent dd4191bf
...@@ -53,4 +53,11 @@ public interface MarketService { ...@@ -53,4 +53,11 @@ public interface MarketService {
* @param couponCustomerRelevanceId * @param couponCustomerRelevanceId
*/ */
void asyncAutoSetCoupon(Integer couponCustomerRelevanceId, Integer orderId); void asyncAutoSetCoupon(Integer couponCustomerRelevanceId, Integer orderId);
/**
*
* @param orderId
*/
void achievementReCalc(Integer orderId);
} }
...@@ -33,7 +33,6 @@ import com.gogirl.shared.market.SetUpOuterCouponCommand; ...@@ -33,7 +33,6 @@ import com.gogirl.shared.market.SetUpOuterCouponCommand;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import lombok.Data; import lombok.Data;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -58,7 +57,7 @@ public class MarketServiceImpl implements MarketService { ...@@ -58,7 +57,7 @@ public class MarketServiceImpl implements MarketService {
@Lazy @Lazy
private CouponMapper couponMapper; private CouponMapper couponMapper;
@Autowired @Resource
@Lazy @Lazy
private CouponCustomerRelevanceService couponCustomerRelevanceService; private CouponCustomerRelevanceService couponCustomerRelevanceService;
...@@ -301,6 +300,341 @@ public class MarketServiceImpl implements MarketService { ...@@ -301,6 +300,341 @@ public class MarketServiceImpl implements MarketService {
} }
} }
public void achievementReCalc(Integer orderId) {
//订单使用的内部券
List<CouponCustomerRelevance> innerCouponCustomerRelevanceServiceList = couponCustomerRelevanceService
.list(new LambdaQueryWrapper<CouponCustomerRelevance>()
.eq(CouponCustomerRelevance::getOrderId, orderId)
.eq(CouponCustomerRelevance::getState, 1)
.eq(CouponCustomerRelevance::getSourceType, 0));
//订单使用的外部券
List<CouponCustomerRelevance> outerCouponCustomerRelevanceServiceList = couponCustomerRelevanceService
.list(new LambdaQueryWrapper<CouponCustomerRelevance>()
.eq(CouponCustomerRelevance::getOrderId, orderId)
.eq(CouponCustomerRelevance::getState, 1)
.eq(CouponCustomerRelevance::getSourceType, 1));
//订单使用的次卡
List<TimesCardUsedRecord> timesCardUsedRecordList = timesCardUsedRecordService
.list(new LambdaQueryWrapper<TimesCardUsedRecord>()
.eq(TimesCardUsedRecord::getOrderId, orderId)
.eq(TimesCardUsedRecord::getStatus, 1));
//查询订单聚合
OrderManage orderManage = orderManageMapper.selectById(orderId);
List<OrderServe> orderServeList = orderServeMapper.selectList(new LambdaQueryWrapper<OrderServe>().eq(OrderServe::getOrderId, orderId));
orderManage.setListOrderServer(orderServeList);
//order serve 卡券绑定状态reset
orderServeList.forEach(orderServe -> {
orderServe.setBindInnerCoupon(2);
orderServe.setBindTimesCard(2);
orderServe.setBindOuterCoupon(2);
});
/*1、rest 订单未使用卡券状态*/
//总支付金额等于 总价格+总改价 rest
orderManage.setTotalPaymentAmount(orderManage.getTotalPrice().add(orderManage.getChangePrice()));
//总折扣金额 rest0
orderManage.setDiscountPrice(BigDecimal.ZERO);
orderManage.getListOrderServer().forEach(orderServe -> {
//reset 服务世纪支付金额 服务实际支付金额=服务价格+服务改价
orderServe.setPayPrice(orderServe.getPrice().add(orderServe.getServeChangePrice()));
//reset 服务折金额=0
orderServe.setDiscountPrice(BigDecimal.ZERO);
//reset 业绩 如果是贵族会员免费手部基础护理 或者 特级会员免费修手 业绩为10元 其他的是实际支付金额
if (orderServe.getServeName().equals("贵族会员免费手部基础护理")
|| orderServe.getServeName().equals("特级会员免费修手")) {
orderServe.setAchievement(new BigDecimal(10).add(orderServe.getServeChangePrice()));
} else {
orderServe.setAchievement(orderServe.getPrice().add(orderServe.getServeChangePrice()));
}
});
/*2、次卡*/
if (ListUtil.isNotEmpty(timesCardUsedRecordList)) {
//次卡使用记录
timesCardUsedRecordList.forEach(timesCardUsedRecord -> timesCardUsedRecord.setStatus(TimesCardUsedRecord.STATUS_CHOSE));
timesCardUsedRecordList.stream()
.sorted(Comparator.comparing(TimesCardUsedRecord::getDiscountAmount))
.forEach(timesCardUsedRecord -> {
// timesCardOrderServeDetailMapper.delete(new LambdaQueryWrapper<TimesCardOrderServeDetail>().eq(TimesCardOrderServeDetail::getOrderId, orderId));
//次卡能用的服务id
List<Integer> serveIds = timesCardCustomerRelevanceMapper.queryTimesCardServeIds(timesCardUsedRecord.getCardTypeId());
//抵扣的服务为 作用范围内支付金额最高的服务
OrderServe orderServe = this.queryMaxPayPrice(orderManage, serveIds);
if (orderServe != null) {
BigDecimal actualDiscountAmount = orderServe.getPayPrice().min(timesCardUsedRecord.getDiscountAmount());
//更新次卡记录 已使用
timesCardUsedRecord.setStatus(TimesCardUsedRecord.STATUS_USED);
//次卡对应订单服务的美甲师
timesCardUsedRecord.setTechnicianName(orderServe.getTechnicianName());
//次卡店铺名称
timesCardUsedRecord.setDepartmentName(orderManage.getDepartmentName());
//次卡店铺id
timesCardUsedRecord.setDepartmentId(orderManage.getDepartmentId());
//次卡折扣的
timesCardUsedRecord.setServeName(orderServe.getServeName());
//次卡作用的服务id
timesCardUsedRecord.setOrderServeId(orderServe.getServeId());
//次卡作用的订单id
timesCardUsedRecord.setOrderId(orderId);
//次卡实付金额
timesCardUsedRecord.setActualDiscountAmount(actualDiscountAmount);
// timesCardUsedRecordService.updateById(timesCardUsedRecord);
//在主服务上折扣的钱
TimesCardOrderServeDetail timesCardOrderServeDetail = new TimesCardOrderServeDetail();
timesCardOrderServeDetail.setDiscountAmount(actualDiscountAmount);
timesCardOrderServeDetail.setOrderServeId(orderServe.getId());
timesCardOrderServeDetail.setOrderId(orderId);
timesCardOrderServeDetail.setTimesCardUserRecordId(timesCardUsedRecord.getOrderServeId());
//业绩
timesCardOrderServeDetail.setAchievement(timesCardUsedRecord.getPayAmount());
// timesCardOrderServeDetailMapper.insert(timesCardOrderServeDetail);
//订单折扣金额更新
orderServe.setBindTimesCard(1);
orderServe.addDiscountPrice(actualDiscountAmount);
//业绩
orderServe.setAchievement(orderServe.getAchievement().subtract(actualDiscountAmount).add(timesCardUsedRecord.getPayAmount()));
orderManage.addDiscountPrice(actualDiscountAmount);
//更新使用次数
TimesCardCustomerRelevance timesCardCustomerRelevance = timesCardCustomerRelevanceService.getById(timesCardUsedRecord.getCardRelevanceCustomerId());
timesCardCustomerRelevance.setUsedTimes(timesCardCustomerRelevance.getUsedTimes() + 1);
if (timesCardCustomerRelevance.getUsedTimes().equals(timesCardCustomerRelevance.getSumTimes())) {
//次数用完
timesCardCustomerRelevance.setStatus(2);
}
timesCardCustomerRelevanceService.updateById(timesCardCustomerRelevance);
} else {
throw new RRException("次卡冲突");
}
});
}
//卡券之前删除订单服务和卡券关联
// couponOrderRelevanceService.remove(new LambdaQueryWrapper<CouponOrderRelevance>()
// .eq(CouponOrderRelevance::getOrderId, orderId));
//3、外部券
if (ListUtil.isNotEmpty(outerCouponCustomerRelevanceServiceList)) {
//删除之前的外部券抵扣情况记录
// couponOrderRelevanceService.remove(new LambdaQueryWrapper<CouponOrderRelevance>()
// .eq(CouponOrderRelevance::getOrderId, orderId)
// .in(CouponOrderRelevance::getCouponCustomerRelevanceId, outerCouponCustomerRelevanceServiceList.stream().map(CouponCustomerRelevance::getId).collect(Collectors.toList())));
outerCouponCustomerRelevanceServiceList
.stream()
.sorted(Comparator.comparing(CouponCustomerRelevance::getDiscountAmount).reversed())
.forEach(couponCustomerRelevance -> {
//外部券能用的服务id
List<Integer> serveIds = couponCustomerRelevanceMapper.queryCouponCustomerServeRelevance(couponCustomerRelevance.getCouponId());
//抵扣的服务为 作用范围内支付金额最高的服务
OrderServe orderServe = this.queryMaxPayPrice(orderManage, serveIds);
if (orderServe != null) {
BigDecimal discountAmount = couponCustomerRelevance.getDiscountAmount();
if (couponCustomerRelevance.getType() == 5) {
discountAmount = orderServe.getPrice().multiply(BigDecimal.ONE.subtract(couponCustomerRelevance.getDiscountPercent()));
}
BigDecimal actualDiscountAmount = orderServe.getPayPrice().min(discountAmount);
//新增外部券抵扣情况记录
CouponOrderRelevance couponOrderRelevance = CouponOrderRelevance.builder()
.couponCustomerRelevanceId(couponCustomerRelevance.getId())
.couponId(couponCustomerRelevance.getCouponId())
.couponName(couponCustomerRelevance.getCouponName())
.orderServeId(orderServe.getId())
.serveName(orderServe.getServeName())
.orderId(orderManage.getId())
//支付金额
.payForOrderServe(couponCustomerRelevance.getPayAmount())
//折扣金额
.discountAmount(actualDiscountAmount)
.createTime(new Date())
.confirmTime(new Date())
.message(orderServe.getServeName())
.customerId(orderManage.getOrderUser())
.status(2)
.build();
//如果计算业绩
if (couponCustomerRelevance.getIsCalcAchievement() == 1) {
couponOrderRelevance.setAchievement(couponCustomerRelevance.getPayAmount());
}
//
else {
couponOrderRelevance.setAchievement(couponOrderRelevance.getDiscountAmount());
}
//业绩
orderServe.setAchievement(orderServe.getAchievement().subtract(actualDiscountAmount).add(couponCustomerRelevance.getPayAmount()));
orderServe.addDiscountPrice(actualDiscountAmount);
orderManage.addDiscountPrice(actualDiscountAmount);
orderServe.setBindOuterCoupon(1);
// couponOrderRelevanceService.save(couponOrderRelevance);
} else {
throw new RRException("外部券冲突");
}
});
}
//4、内部券
if (ListUtil.isNotEmpty(innerCouponCustomerRelevanceServiceList)) {
//删除之前的内部券抵扣情况记录
// couponOrderRelevanceService.remove(new LambdaQueryWrapper<CouponOrderRelevance>()
// .eq(CouponOrderRelevance::getOrderId, orderId)
// .in(CouponOrderRelevance::getCouponCustomerRelevanceId, innerCouponCustomerRelevanceServiceList.stream().map(CouponCustomerRelevance::getId).collect(Collectors.toList())));
//免单券Id
List<Integer> discountConfigListCouponId = discountConfigMapper.selectList(new QueryWrapper<>()).stream().map(DiscountConfig::getCouponId).filter(Objects::nonNull).collect(Collectors.toList());
//内部券计算函数
Consumer<CouponCustomerRelevance> couponCustomerRelevanceConsumer = couponCustomerRelevance -> {
//内部券能用的服务id
List<Integer> serveIds = couponCustomerRelevanceMapper.queryCouponCustomerServeRelevance(couponCustomerRelevance.getCouponId());
//作用的服务id
List<OrderServe> canUserOrderServeList = this.queryCanDiscount(orderManage, serveIds, couponCustomerRelevance.getCouponId());
//打折订单项总支付金额
BigDecimal total = canUserOrderServeList.stream().map(OrderServe::getPayPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
if (!total.setScale(2, BigDecimal.ROUND_HALF_UP).equals(BigDecimal.ZERO.setScale(2, BigDecimal.ROUND_HALF_UP))) {
//卡券的总折扣金额
BigDecimal totalCouponDiscount = couponCustomerRelevance.getDiscountAmount();
//折扣券
if (couponCustomerRelevance.getType().equals(CouponCustomerRelevance.TYPE_DISCOUNT)) {
totalCouponDiscount = orderManage.getTotalPaymentAmount().multiply(BigDecimal.ONE.subtract(couponCustomerRelevance.getDiscountPercent()));
}
//卡券总支付金额
BigDecimal totalCouponPay = couponCustomerRelevance.getPayAmount();
//计算参数(最后一个订单服务的折扣金额要用总折扣金额减 防止除法计算精度问题)
BigDecimal discountCalc = BigDecimal.ZERO;
//计算参数(最后一个订单服务的实际支付要用总实际支付金额减 防止除法计算精度问题)
BigDecimal payCalc = BigDecimal.ZERO;
for (OrderServe orderServe : canUserOrderServeList) {
//每个服务的内部券抵扣金额
BigDecimal discountAmount = orderServe.getPayPrice().multiply(totalCouponDiscount).divide(total, 2, BigDecimal.ROUND_HALF_UP);
//每个服务的卡券实际支付金额
BigDecimal payAmount = orderServe.getPayPrice().multiply(totalCouponPay).divide(total, 2, BigDecimal.ROUND_HALF_UP);
//最后一个服务使用总额减法而不是除法
if (canUserOrderServeList.lastIndexOf(orderServe) == canUserOrderServeList.size() - 1) {
discountAmount = totalCouponDiscount.subtract(discountCalc);
payAmount = totalCouponPay.subtract(payCalc);
}
BigDecimal actualDiscountAmount = discountAmount.min(orderServe.getPayPrice());
//卡券在订单服务上的抵扣情况
CouponOrderRelevance couponOrderRelevance = CouponOrderRelevance.builder()
.discountAmount(actualDiscountAmount)
//卡券在这个服务上的实际支付金额
.payForOrderServe(payAmount)
.createTime(new Date())
.orderServeId(orderServe.getId())
.orderId(orderManage.getId())
.couponId(couponCustomerRelevance.getCouponId())
.couponCustomerRelevanceId(couponCustomerRelevance.getId())
.confirmTime(new Date())
.message(orderServe.getServeName())
.customerId(orderManage.getOrderUser())
.status(2)
.build();
//如果计算业绩
if (couponCustomerRelevance.getIsCalcAchievement() == 1) {
couponOrderRelevance.setAchievement(couponCustomerRelevance.getPayAmount());
} else {
couponOrderRelevance.setAchievement(couponOrderRelevance.getDiscountAmount());
}
//保存卡券在订单服务上的使用情况
// couponOrderRelevanceService.save(couponOrderRelevance);
//如果不是免单券 业绩就要扣除实际折扣金额
if (!discountConfigListCouponId.contains(couponCustomerRelevance.getCouponId())) {
orderServe.setAchievement(orderServe.getAchievement().subtract(actualDiscountAmount));
}
orderServe.addDiscountPrice(actualDiscountAmount);
orderManage.addDiscountPrice(actualDiscountAmount);
orderServe.setBindInnerCoupon(1);
discountCalc = discountCalc.add(discountAmount);
payCalc = payCalc.add(payAmount);
}
}
//内部券抵扣不了
else {
throw new RRException("内部券冲突");
}
};
//5、免单券
List<CouponCustomerRelevance> freeInnerCouponCustomerRelevanceServiceList = innerCouponCustomerRelevanceServiceList
.stream()
.filter(couponCustomerRelevance -> discountConfigListCouponId.contains(couponCustomerRelevance.getCouponId()))
.collect(Collectors.toList());
freeInnerCouponCustomerRelevanceServiceList.forEach(couponCustomerRelevanceConsumer);
//6、普通内部券
List<CouponCustomerRelevance> normalInnerCouponCustomerRelevanceServiceList = innerCouponCustomerRelevanceServiceList
.stream()
//不是免单券
.filter(couponCustomerRelevance -> !discountConfigListCouponId.contains(couponCustomerRelevance.getCouponId()))
//不是折扣券
.filter(couponCustomerRelevance -> !couponCustomerRelevance.getType().equals(CouponCustomerRelevance.TYPE_DISCOUNT))
.collect(Collectors.toList());
if (normalInnerCouponCustomerRelevanceServiceList.size() > 1) {
throw new RRException("普通内部券只能用一张");
}
normalInnerCouponCustomerRelevanceServiceList.forEach(couponCustomerRelevanceConsumer);
//6、折扣内部券
List<CouponCustomerRelevance> discountInnerCouponCustomerRelevanceServiceList = innerCouponCustomerRelevanceServiceList
.stream()
//不是免单券
.filter(couponCustomerRelevance -> !discountConfigListCouponId.contains(couponCustomerRelevance.getCouponId()))
//是折扣券
.filter(couponCustomerRelevance -> couponCustomerRelevance.getType().equals(CouponCustomerRelevance.TYPE_DISCOUNT))
.collect(Collectors.toList());
discountInnerCouponCustomerRelevanceServiceList.forEach(couponCustomerRelevanceConsumer);
if (normalInnerCouponCustomerRelevanceServiceList.size() + discountInnerCouponCustomerRelevanceServiceList.size() > 1) {
throw new RRException("普通内部券只能用一张");
}
if (freeInnerCouponCustomerRelevanceServiceList.size() > 1) {
throw new RRException("免单券券只能用一张");
}
}
// orderManageMapper.updateById(orderManage);
// orderServeService.updateBatchById(orderServeList);
orderServeList.forEach(orderServe -> {
OrderServe updateOrderServe = orderServeMapper.selectById(orderServe.getId());
updateOrderServe.setAchievement(orderServe.getAchievement());
orderServeMapper.updateById(updateOrderServe);
});
}
/** /**
* 更新订单 使用次卡 使用外部券 使用内部券之后需要调用这个方法 * 更新订单 使用次卡 使用外部券 使用内部券之后需要调用这个方法
* 结算订单 * 结算订单
...@@ -335,6 +669,8 @@ public class MarketServiceImpl implements MarketService { ...@@ -335,6 +669,8 @@ 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);
//order serve 卡券绑定状态reset
orderServeList.forEach(orderServe -> { orderServeList.forEach(orderServe -> {
orderServe.setBindInnerCoupon(2); orderServe.setBindInnerCoupon(2);
orderServe.setBindTimesCard(2); orderServe.setBindTimesCard(2);
......
...@@ -802,8 +802,9 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper, ...@@ -802,8 +802,9 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
//如果时间节点不可用返回false //如果时间节点不可用返回false
IdleTimeDTO idleTimeDTO = idleTimeDTOList.stream().findAny().orElseThrow(NullPointerException::new); IdleTimeDTO idleTimeDTO = idleTimeDTOList.stream().findAny().orElseThrow(NullPointerException::new);
if (!idleTimeDTO.isStatus()) { if (!idleTimeDTO.isStatus()) {
throw new RRException("预约时间不可用"); throw new RRException("预约时间已过期");
} }
} catch (RRException e) { } catch (RRException e) {
throw e; throw e;
} catch (Exception e) { } catch (Exception e) {
...@@ -1529,8 +1530,19 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper, ...@@ -1529,8 +1530,19 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
//插入订单 //插入订单
orderManageMapper.insert(orderManage); orderManageMapper.insert(orderManage);
orderServeList.forEach(orderServe -> orderServe.setOrderId(orderManage.getId())); orderServeList.forEach(orderServe -> orderServe.setOrderId(orderManage.getId()));
//插入订单相亲 //插入订单详情
orderServeService.saveBatch(orderServeList); orderServeService.saveBatch(orderServeList);
//写入订单详情的mainOrderServeId;
orderServeList.stream().filter(orderServe -> orderServe.getMainServeId() != null)
.forEach(orderServe -> {
Integer mainOrderServeId = orderServeList.stream().filter(val -> val.getServeId().equals(orderServe.getServeId()))
.findAny()
.map(OrderServe::getId)
.orElse(null);
orderServe.setMainOrderServeId(mainOrderServeId);
orderServeService.updateById(orderServe);
});
//更新预约 //更新预约
scheduleManage.setOrderId(orderManage.getId()); scheduleManage.setOrderId(orderManage.getId());
......
...@@ -79,6 +79,9 @@ public class OrderServe implements Serializable { ...@@ -79,6 +79,9 @@ public class OrderServe implements Serializable {
private Integer serveTypeId; private Integer serveTypeId;
private Integer mainServeId; private Integer mainServeId;
private Integer mainOrderServeId;
/** /**
* 预约款式vo * 预约款式vo
*/ */
......
...@@ -3,10 +3,13 @@ package com.gogirl.infrastructure.mapper.order.serve; ...@@ -3,10 +3,13 @@ package com.gogirl.infrastructure.mapper.order.serve;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gogirl.domain.market.coupon.CouponCustomerRelevance;
import com.gogirl.domain.order.serve.OrderServe; import com.gogirl.domain.order.serve.OrderServe;
import com.gogirl.domain.store.store.TechnicianAchieve; import com.gogirl.domain.store.store.TechnicianAchieve;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface OrderServeMapper extends BaseMapper<OrderServe> { public interface OrderServeMapper extends BaseMapper<OrderServe> {
...@@ -50,4 +53,6 @@ public interface OrderServeMapper extends BaseMapper<OrderServe> { ...@@ -50,4 +53,6 @@ public interface OrderServeMapper extends BaseMapper<OrderServe> {
@Param("departmentId") Integer departmentId); @Param("departmentId") Integer departmentId);
void syncOrderServeTimes(); void syncOrderServeTimes();
List<CouponCustomerRelevance> selectReCalc();
} }
...@@ -14,6 +14,8 @@ spring: ...@@ -14,6 +14,8 @@ spring:
mybatis-plus: mybatis-plus:
mapper-locations: mapper-locations:
- classpath:mapper/**/*.xml - classpath:mapper/**/*.xml
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
server: server:
undertow: undertow:
......
...@@ -236,4 +236,13 @@ ...@@ -236,4 +236,13 @@
</if> </if>
order by a.start_time desc order by a.start_time desc
</select> </select>
<select id="selectReCalc" resultType="com.gogirl.domain.market.coupon.CouponCustomerRelevance">
SELECT t1.* from coupon_customer_relevance t1
LEFT JOIN order_manage t2 on t1.order_id =t2.id
where t1.state =2
and t2.create_time like '2020-04%'
and t1.coupon_name like '%免单券%'
GROUP BY t1.order_id
</select>
</mapper> </mapper>
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.gogirl.application.market.coupon.CouponCustomerRelevanceService; import com.gogirl.application.market.coupon.CouponCustomerRelevanceService;
import com.gogirl.application.market.coupon.CouponService; import com.gogirl.application.market.coupon.CouponService;
import com.gogirl.application.market.coupon.MarketService;
import com.gogirl.application.market.timescard.TimesCardCustomerRelevanceService; import com.gogirl.application.market.timescard.TimesCardCustomerRelevanceService;
import com.gogirl.application.market.timescard.TimesCardUsedRecordService; import com.gogirl.application.market.timescard.TimesCardUsedRecordService;
import com.gogirl.application.store.store.StoreTechnicianService; import com.gogirl.application.store.store.StoreTechnicianService;
...@@ -551,4 +552,18 @@ public class Test { ...@@ -551,4 +552,18 @@ public class Test {
System.out.println(customerBalanceRecord.getRefereeId()); System.out.println(customerBalanceRecord.getRefereeId());
} }
@Resource
MarketService marketService;
@org.junit.Test
public void achievementReCalc() {
List<CouponCustomerRelevance> couponCustomerRelevanceList = orderServeMapper.selectReCalc();
couponCustomerRelevanceList.forEach(couponCustomerRelevance -> {
marketService.achievementReCalc(couponCustomerRelevance.getOrderId());
});
}
} }
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