Commit c713182f by huluobin

1、支持前端参数过滤空

2、初始化接口
parent 6548a974
......@@ -56,8 +56,12 @@ public interface MarketService {
/**
*
* @param orderId
*/
void achievementReCalc(Integer orderId);
/**
* @param orderId
*/
void orderAmountReCalc(Integer orderId);
}
......@@ -646,6 +646,333 @@ public class MarketServiceImpl implements MarketService {
}
@Override
public void orderAmountReCalc(Integer orderId) {
//订单使用的内部券
List<CouponCustomerRelevance> innerCouponCustomerRelevanceServiceList = couponCustomerRelevanceService
.list(new LambdaQueryWrapper<CouponCustomerRelevance>()
.eq(CouponCustomerRelevance::getOrderId, orderId)
.eq(CouponCustomerRelevance::getState, CouponCustomerRelevance.STATE_USED)
.eq(CouponCustomerRelevance::getSourceType, 0));
//订单使用的外部券
List<CouponCustomerRelevance> outerCouponCustomerRelevanceServiceList = couponCustomerRelevanceService
.list(new LambdaQueryWrapper<CouponCustomerRelevance>()
.eq(CouponCustomerRelevance::getOrderId, orderId)
.eq(CouponCustomerRelevance::getState, CouponCustomerRelevance.STATE_USED)
.eq(CouponCustomerRelevance::getSourceType, 1));
//订单使用的次卡
List<TimesCardUsedRecord> timesCardUsedRecordList = timesCardUsedRecordService
.list(new LambdaQueryWrapper<TimesCardUsedRecord>()
.eq(TimesCardUsedRecord::getOrderId, orderId)
.eq(TimesCardUsedRecord::getStatus, TimesCardUsedRecord.STATUS_USED));
//查询订单聚合
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、改价结算
//总支付金额等于 总价格+总改价
orderManage.setTotalPaymentAmount(orderManage.getTotalPrice().add(orderManage.getChangePrice()));
//总折扣金额
orderManage.setDiscountPrice(BigDecimal.ZERO);
orderManage.getListOrderServer().forEach(orderServe -> {
//服务实际支付金额=服务价格+服务改价
orderServe.setPayPrice(orderServe.getPrice().add(orderServe.getServeChangePrice()));
//服务折金额=0
orderServe.setDiscountPrice(BigDecimal.ZERO);
//如果是贵族会员免费手部基础护理 或者 特级会员免费修手 业绩为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());
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);
}
/**
* 更新订单 使用次卡 使用外部券 使用内部券之后需要调用这个方法
......@@ -661,21 +988,21 @@ public class MarketServiceImpl implements MarketService {
List<CouponCustomerRelevance> innerCouponCustomerRelevanceServiceList = couponCustomerRelevanceService
.list(new LambdaQueryWrapper<CouponCustomerRelevance>()
.eq(CouponCustomerRelevance::getOrderId, orderId)
.eq(CouponCustomerRelevance::getState, 1)
.eq(CouponCustomerRelevance::getState, CouponCustomerRelevance.STATE_CHOSE)
.eq(CouponCustomerRelevance::getSourceType, 0));
//订单使用的外部券
List<CouponCustomerRelevance> outerCouponCustomerRelevanceServiceList = couponCustomerRelevanceService
.list(new LambdaQueryWrapper<CouponCustomerRelevance>()
.eq(CouponCustomerRelevance::getOrderId, orderId)
.eq(CouponCustomerRelevance::getState, 1)
.eq(CouponCustomerRelevance::getState, CouponCustomerRelevance.STATE_CHOSE)
.eq(CouponCustomerRelevance::getSourceType, 1));
//订单使用的次卡
List<TimesCardUsedRecord> timesCardUsedRecordList = timesCardUsedRecordService
.list(new LambdaQueryWrapper<TimesCardUsedRecord>()
.eq(TimesCardUsedRecord::getOrderId, orderId)
.eq(TimesCardUsedRecord::getStatus, 1));
.eq(TimesCardUsedRecord::getStatus, TimesCardUsedRecord.STATUS_CHOSE));
//查询订单聚合
OrderManage orderManage = orderManageMapper.selectById(orderId);
......
......@@ -2,8 +2,11 @@ package com.gogirl.application.order.serve;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gogirl.domain.order.serve.OwnProduce;
import com.gogirl.domain.product.serve.TechniqueSku;
import com.gogirl.shared.order.OwnProduceCommand;
import java.util.List;
/**
* <p>
* 服务类
......@@ -21,4 +24,10 @@ public interface IOwnProduceService extends IService<OwnProduce> {
*/
OwnProduce saveOrUpdateOwnProduce(OwnProduceCommand command);
/**
* 查询已经选择的技法sku
* @param ownProduceId
* @return
*/
List<TechniqueSku> getByOwnProduceId(Integer ownProduceId);
}
......@@ -7,9 +7,7 @@ import com.gogirl.application.order.serve.IOwnProduceTechniqueSkuService;
import com.gogirl.domain.order.serve.OwnProduce;
import com.gogirl.domain.order.serve.OwnProduceTechniqueSku;
import com.gogirl.domain.product.serve.TechniqueSku;
import com.gogirl.infrastructure.mapper.order.serve.OrderServeMapper;
import com.gogirl.infrastructure.mapper.order.serve.OwnProduceMapper;
import com.gogirl.infrastructure.mapper.order.serve.ScheduleServeMapper;
import com.gogirl.infrastructure.mapper.product.serve.TechniqueSkuMapper;
import com.gogirl.shared.order.OwnProduceCommand;
import lombok.extern.slf4j.Slf4j;
......@@ -19,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
......@@ -38,15 +37,18 @@ public class OwnProduceServiceImpl extends ServiceImpl<OwnProduceMapper, OwnProd
@Resource
TechniqueSkuMapper techniqueSkuMapper;
@Resource
ScheduleServeMapper scheduleServeMapper;
@Resource
OrderServeMapper orderServeMapper;
OwnProduceMapper ownProduceMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public OwnProduce saveOrUpdateOwnProduce(OwnProduceCommand command) {
command.setOwnProduceTechniqueSkuCommandList(command.getOwnProduceTechniqueSkuCommandList()
.stream().filter(Objects::nonNull)
.filter(obj -> obj.getTechniqueSkuId() != null)
.collect(Collectors.toList()));
OwnProduce ownProduce;
if (command.getOwnProduceId() == null) {
......@@ -96,4 +98,9 @@ public class OwnProduceServiceImpl extends ServiceImpl<OwnProduceMapper, OwnProd
return ownProduce;
}
@Override
public List<TechniqueSku> getByOwnProduceId(Integer ownProduceId) {
return ownProduceMapper.getByOwnProduceId(ownProduceId);
}
}
......@@ -72,5 +72,8 @@ public class TechniqueSku implements Serializable {
@TableField(exist = false)
private String techniqueCategoryName;
@ApiModelProperty(value = "")
@TableField(exist = false)
private Integer quantity;
}
......@@ -2,6 +2,9 @@ package com.gogirl.infrastructure.mapper.order.serve;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gogirl.domain.order.serve.OwnProduce;
import com.gogirl.domain.product.serve.TechniqueSku;
import java.util.List;
/**
* <p>
......@@ -13,4 +16,10 @@ import com.gogirl.domain.order.serve.OwnProduce;
*/
public interface OwnProduceMapper extends BaseMapper<OwnProduce> {
/**
*
* @param ownProduceId
* @return
*/
List<TechniqueSku> getByOwnProduceId(Integer ownProduceId);
}
......@@ -3,15 +3,15 @@ package com.gogirl.interfaces.order.serve;
import com.gogirl.application.order.serve.IOwnProduceService;
import com.gogirl.domain.order.serve.OwnProduce;
import com.gogirl.domain.product.serve.TechniqueSku;
import com.gogirl.infrastructure.common.base.JsonResult;
import com.gogirl.shared.order.OwnProduceCommand;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* <p>
......@@ -35,4 +35,11 @@ public class OwnProduceController {
return JsonResult.success(ownProduce);
}
@ApiOperation("查询已经选择的技法sku")
@GetMapping("/getByOwnProduceId")
public JsonResult<List<TechniqueSku>> getByOwnProduceId(@RequestParam Integer ownProduceId) {
List<TechniqueSku> list = ownProduceService.getByOwnProduceId(ownProduceId);
return JsonResult.success(list);
}
}
......@@ -2,4 +2,11 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gogirl.infrastructure.mapper.order.serve.OwnProduceMapper">
<select id="getByOwnProduceId" resultType="com.gogirl.domain.product.serve.TechniqueSku">
SELECT t2.quantity, t3.*
from own_produce t1
LEFT JOIN own_produce_technique_sku t2 on t1.id = t2.own_produce_id
LEFT JOIN technique_sku t3 on t2.technique_sku_id = t3.id
where t1.id = #{ownProduceId}
</select>
</mapper>
......@@ -19,7 +19,6 @@ import com.gogirl.domain.order.serve.OrderManage;
import com.gogirl.domain.order.serve.OrderServe;
import com.gogirl.domain.product.purchase.PurchaseStock;
import com.gogirl.domain.product.purchase.PurchaseStockRecord;
import com.gogirl.domain.product.serve.BaseProduce;
import com.gogirl.domain.store.complaint.ComplaintDetailed;
import com.gogirl.domain.store.complaint.ComplaintDetailedTechnician;
import com.gogirl.domain.store.complaint.ComplaintMain;
......@@ -57,7 +56,6 @@ import com.gogirl.infrastructure.mapper.xcx.TimeNodeMapper;
import com.gogirl.infrastructure.mapper.xcx.WeekConfigMapper;
import com.gogirl.infrastructure.schedule.Schedule;
import com.gogirl.infrastructure.service.mail.MailService;
import com.gogirl.shared.product.CalcServiceDuration;
import com.gogirl.shared.product.PurchaseSkuPOI;
import lombok.extern.slf4j.Slf4j;
import org.assertj.core.util.Lists;
......@@ -655,7 +653,6 @@ public class Test {
@org.junit.Test
public void reCalcOrderDataIntegrity() {
List<OrderManage> orderManageList = orderManageMapper.selectList(new LambdaQueryWrapper<OrderManage>()
.gt(OrderManage::getCreateTime, "2020-01-01"));
......@@ -702,19 +699,8 @@ public class Test {
BaseProduceMapper baseProduceMapper;
@org.junit.Test
public void syncProduceServiceDuration() {
List<CalcServiceDuration> calcServiceDurationList = baseProduceMapper.queryProduceServiceDuration();
calcServiceDurationList.stream().collect(Collectors.groupingBy(CalcServiceDuration::getId))
.forEach((key, value) -> {
BaseProduce baseProduce = baseProduceMapper.selectById(key);
Integer sumServiceDuration = value.stream().map(calcServiceDuration -> calcServiceDuration.getDuration() * calcServiceDuration.getQuantity()).mapToInt(Integer::intValue).sum();
baseProduce.setServiceDuration(sumServiceDuration);
baseProduceMapper.updateById(baseProduce);
});
public void calcOrderAmount() {
marketService.orderAmountReCalc(13659);
}
}
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