Commit 822ddb26 authored by zhangfeng's avatar zhangfeng

Merge branch 'release-feat-zhangfeng' into 'release'

Release feat zhangfeng

See merge request !26
parents 01aadf5f fc7a9aa2
......@@ -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;
}
}
......
......@@ -72,7 +72,7 @@ public class ScoreRuleShareRecordServiceImpl extends AbstractService<ScoreRuleSh
if (item.getIpAddress().contains("SHARE")) {
String[] split = item.getIpAddress().split("_");
item.setIpAddress(split[split.length - 1]);
} else {
} else if (item.getIpAddress().contains("RECOMMEND")) {
item.setIpAddress("-");
}
item.setTypeZh(DictFrameworkUtils.getDictDataFromCache("score_rule_type", item.getType().toString()).getLabel());
......
......@@ -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
......
......@@ -135,6 +135,13 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
throw exception(REWARD_NOT_EXISTS);
}
RewardDO updateObj = new RewardDO();
// 此处为了兼容前端传值
List<RewardCreateReqVO.NodeAndPoints> nodeIds = updateReqVO.getNodeIds();
if (CollectionUtil.isEmpty(nodeIds)) {
throw exception(REWARD_NODE_AND_POINTS_LIST_ERROR);
}
RewardCreateReqVO.NodeAndPoints nodeAndPoints = nodeIds.get(0);
//未启用可编辑所有内容
if (rewardDO.getStatus() == RewardStatusEnum.DISABLED.getValue()) {
// 校验领取方式
......@@ -150,19 +157,15 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
} else {
throw exception(REWARD_START_OR_END_TIME_NOT_ALLOW);
}
List<RewardUpdateReqVO.NodeAndPoints> nodeIds = updateReqVO.getNodeIds();
if (CollectionUtil.isEmpty(nodeIds)) {
throw exception(REWARD_NODE_AND_POINTS_LIST_ERROR);
}
RewardUpdateReqVO.NodeAndPoints nodeAndPoints = nodeIds.get(0);
updateObj = RewardConvert.INSTANCE.convert(updateReqVO);
updateObj.setPointsRequire(nodeAndPoints.getPoints());
updateObj.setNodeId(nodeAndPoints.getNodeId());
updateObj.setNodeId(nodeAndPoints.getWareHouses().get(0));
updateObj.setQuantityRemain(nodeAndPoints.getQuantityRemain());
//已启用可编辑剩余数量和备注
} else if (rewardDO.getStatus() == RewardStatusEnum.ENABLED.getValue()) {
updateObj.setId(updateReqVO.getId());
updateObj.setQuantityRemain(updateReqVO.getQuantityRemain());
updateObj.setQuantityRemain(nodeAndPoints.getQuantityRemain());
updateObj.setRemarkEn(updateReqVO.getRemarkEn());
updateObj.setRemarkFr(updateReqVO.getRemarkFr());
updateObj.setRemarkZh(updateReqVO.getRemarkZh());
......
......@@ -44,19 +44,9 @@ public class RewardUpdateReqVO {
@ApiModelProperty(value = "法文礼品图片")
private String imgFr;
//@ApiModelProperty(value = "兑换所需积分")
//@Min(value = 0)
//private Integer pointsRequire;
//@ApiModelProperty(value = "兑换网点")
//private Integer nodeId;
@ApiModelProperty(value = "兑换网点和积分列表", required = true)
@NotNull(message = "兑换网点列表不能为空")
private List<RewardUpdateReqVO.NodeAndPoints> nodeIds;
@ApiModelProperty(value = "剩余数量")
@Min(value = 0)
private Integer quantityRemain;
private List<RewardCreateReqVO.NodeAndPoints> nodeIds;
@ApiModelProperty(value = "活动开始时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
......@@ -84,12 +74,4 @@ public class RewardUpdateReqVO {
@ApiModelProperty(value = "法文备注")
@Size(max = 500, message = "法文备注长度不能超过500")
private String remarkFr;
@Data
public static class NodeAndPoints {
@ApiModelProperty(value = "兑换网点")
private Integer nodeId;
@ApiModelProperty(value = "兑换网点对应积分")
private Integer points;
}
}
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