Commit 13e40bcb authored by zhangfeng's avatar zhangfeng

feat-596: 订单V值首单逻辑修改

parent b15ab262
...@@ -212,8 +212,8 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy { ...@@ -212,8 +212,8 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
userId = 0L; userId = 0L;
} }
} }
// 校验首单 // 校验首单:发货和收货都算首单,按客户查,只有发货人收货人都是首单才算首单
if (!isFirstOrderValid(userId, extraInfo)) { if (!isFirstOrderValid(consignorId, consigneeId, extraInfo)) {
return null; return null;
} }
// 校验积分上限,添加加分用户列表 // 校验积分上限,添加加分用户列表
...@@ -260,14 +260,14 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy { ...@@ -260,14 +260,14 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
/** /**
* 校验是否为首单且首单是否有效 * 校验是否为首单且首单是否有效
*/ */
private boolean isFirstOrderValid(Long userId, ScoreRuleOrderVExtraVO extraInfo) { private boolean isFirstOrderValid(Long consignorId, Long consigneeId, ScoreRuleOrderVExtraVO extraInfo) {
if (extraInfo.getFirstOrder() == YesOrNoTypeEnum.YES.ordinal()) { if (extraInfo.getFirstOrder() == YesOrNoTypeEnum.YES.ordinal()) {
if (userId == null || userId <= 0) { if (!orderApi.isFirstOrder(consignorId)) {
log.info("Order in shipping listener: The user is not member,userId:{}", userId); log.info("Order in shipping listener: consignor not first order,consignorId:{}", consignorId);
return false; return false;
} }
if (!orderApi.isFirstOrder(userId)) { if (!orderApi.isFirstOrder(consigneeId)) {
log.info("Order in shipping listener: Not first order,userId:{}", userId); log.info("Order in shipping listener: consignee not first order,consigneeId:{}", consigneeId);
return false; return false;
} }
} }
......
...@@ -14,9 +14,9 @@ public interface OrderApi { ...@@ -14,9 +14,9 @@ public interface OrderApi {
*/ */
OrderRespDTO getOrder(Long id, String orderNo); OrderRespDTO getOrder(Long id, String orderNo);
/** /**
* 判断是否用户首单 * 判断客户是否首单
*/ */
boolean isFirstOrder(Long userId); boolean isFirstOrder(Long customerId);
/** /**
* 根据订单id获取所有订单项 * 根据订单id获取所有订单项
*/ */
......
...@@ -87,9 +87,9 @@ public class OrderApiImpl implements OrderApi { ...@@ -87,9 +87,9 @@ public class OrderApiImpl implements OrderApi {
} }
@Override @Override
public boolean isFirstOrder(Long userId) { public boolean isFirstOrder(Long customerId) {
Long count = orderService.selectCount(new LambdaQueryWrapper<OrderDO>().eq(OrderDO::getUserId, userId)); // 只要发过货或者收过货都不算首单
return count <= 0; return orderConsignorService.selectCount("customer_id", customerId) <= 1 && orderConsigneeService.selectCount("customer_id", customerId) <= 1;
} }
@Override @Override
......
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