Commit 13e40bcb authored by zhangfeng's avatar zhangfeng

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

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