Commit c3f96a94 by huluobin

update

parent f294c76a
......@@ -307,21 +307,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, 2)
.eq(CouponCustomerRelevance::getSourceType, 0));
//订单使用的外部券
List<CouponCustomerRelevance> outerCouponCustomerRelevanceServiceList = couponCustomerRelevanceService
.list(new LambdaQueryWrapper<CouponCustomerRelevance>()
.eq(CouponCustomerRelevance::getOrderId, orderId)
.eq(CouponCustomerRelevance::getState, 1)
.eq(CouponCustomerRelevance::getState, 2)
.eq(CouponCustomerRelevance::getSourceType, 1));
//订单使用的次卡
List<TimesCardUsedRecord> timesCardUsedRecordList = timesCardUsedRecordService
.list(new LambdaQueryWrapper<TimesCardUsedRecord>()
.eq(TimesCardUsedRecord::getOrderId, orderId)
.eq(TimesCardUsedRecord::getStatus, 1));
.eq(TimesCardUsedRecord::getStatus, 2));
//查询订单聚合
OrderManage orderManage = orderManageMapper.selectById(orderId);
......@@ -451,6 +451,7 @@ public class MarketServiceImpl implements MarketService {
if (couponCustomerRelevance.getType() == 5) {
discountAmount = orderServe.getPrice().multiply(BigDecimal.ONE.subtract(couponCustomerRelevance.getDiscountPercent()));
}
//实际折扣的金额
BigDecimal actualDiscountAmount = orderServe.getPayPrice().min(discountAmount);
//新增外部券抵扣情况记录
......@@ -481,7 +482,12 @@ public class MarketServiceImpl implements MarketService {
}
//业绩
System.out.println(orderServe.getAchievement());
System.out.println(actualDiscountAmount);
System.out.println(couponCustomerRelevance.getPayAmount());
orderServe.setAchievement(orderServe.getAchievement().subtract(actualDiscountAmount).add(couponCustomerRelevance.getPayAmount()));
System.out.println(orderServe.getAchievement());
orderServe.addDiscountPrice(actualDiscountAmount);
orderManage.addDiscountPrice(actualDiscountAmount);
......@@ -566,10 +572,16 @@ public class MarketServiceImpl implements MarketService {
}
//保存卡券在订单服务上的使用情况
// couponOrderRelevanceService.save(couponOrderRelevance);
System.out.println(orderServe.getAchievement());
//如果不是免单券 业绩就要扣除实际折扣金额
if (!discountConfigListCouponId.contains(couponCustomerRelevance.getCouponId())) {
System.out.println(orderServe.getAchievement());
System.out.println(actualDiscountAmount);
orderServe.setAchievement(orderServe.getAchievement().subtract(actualDiscountAmount));
System.out.println(orderServe.getAchievement());
}
orderServe.addDiscountPrice(actualDiscountAmount);
......
......@@ -60,6 +60,9 @@ public class TakeLeaveEventCmdServiceImpl implements TakeLeaveEventCmdService {
@Override
public void applyTakeLeave(ApplyTakeLeaveCommand cmd) {
if (cmd.getStartTime().compareTo(cmd.getEndTime()) <= 0) {
throw new RRException("申请时间有误");
}
List<TakeLeaveEvent> appliedList = takeLeaveEventRepository.appliedList(cmd.getApplyTechnicianId(), cmd.getStartTime().getTime(), cmd.getEndTime().getTime());
if (ListUtil.isNotEmpty(appliedList)) {
......
......@@ -52,7 +52,16 @@ public interface OrderServeMapper extends BaseMapper<OrderServe> {
@Param("month") String month,
@Param("departmentId") Integer departmentId);
/**
* 同步订单时间
*/
void syncOrderServeTimes();
/**
* 查询需要重算业绩的订单
*
* @return
*/
List<CouponCustomerRelevance> selectReCalc();
}
......@@ -241,8 +241,9 @@
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 t2.create_time like '2020-03%'
and t1.coupon_name like '%免单券%'
and (t2.`status` =3 or t2.`status` =4)
GROUP BY t1.order_id
</select>
</mapper>
......@@ -632,4 +632,10 @@ public class Test {
}
@org.junit.Test
public void oneAchievementReCalc() {
marketService.achievementReCalc(13252);
}
}
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