Commit 75672463 authored by zhangfeng's avatar zhangfeng

feat(601): 订单V值触发修改

parent 6302496a
...@@ -109,20 +109,12 @@ public interface ScoreRuleService extends IService<ScoreRuleDO> { ...@@ -109,20 +109,12 @@ public interface ScoreRuleService extends IService<ScoreRuleDO> {
ScoreRuleDO getEnabledOrderVScoreRuleByTransportType(Integer transportType); ScoreRuleDO getEnabledOrderVScoreRuleByTransportType(Integer transportType);
/** /**
* 根据类型获取已启用积分规则 * 根据类型获取已启用积分规则(仅推荐和注册)
* @param scoreRuleType * @param scoreRuleType
* @return * @return
*/ */
ScoreRuleDO getEnableScoreRuleByType(ScoreRuleTypeEnum scoreRuleType); ScoreRuleDO getEnableScoreRuleByType(ScoreRuleTypeEnum scoreRuleType);
/**
* 根据类型获取已启用积分规则(带运输类型)
* @param scoreRuleType
* @param transportType
* @return
*/
ScoreRuleDO getEnableScoreRuleByType(ScoreRuleTypeEnum scoreRuleType, TransportTypeEnum transportType);
List<WarehouseTreeRegionSimpleVO> getWarehouseTreeRegionListSimple(); List<WarehouseTreeRegionSimpleVO> getWarehouseTreeRegionListSimple();
/** /**
...@@ -151,4 +143,10 @@ public interface ScoreRuleService extends IService<ScoreRuleDO> { ...@@ -151,4 +143,10 @@ public interface ScoreRuleService extends IService<ScoreRuleDO> {
* @return * @return
*/ */
Boolean setScoreRuleSwitch(SwitchReqVo switchReqVo); Boolean setScoreRuleSwitch(SwitchReqVo switchReqVo);
/**
* 获取当前时间已启用的订单V值规则
* @return
*/
List<ScoreRuleDO> getEnableOrderVRule();
} }
...@@ -31,6 +31,7 @@ import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleRegisterExtraV ...@@ -31,6 +31,7 @@ import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleRegisterExtraV
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleShareExtraVO; import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleShareExtraVO;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRulerRecommendExtraVO; import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRulerRecommendExtraVO;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils; import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -596,28 +597,6 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score ...@@ -596,28 +597,6 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
return enableScoreRule; return enableScoreRule;
} }
@Override
public ScoreRuleDO getEnableScoreRuleByType(ScoreRuleTypeEnum scoreRuleType, TransportTypeEnum transportType) {
ScoreRuleDO enableScoreRule;
switch (scoreRuleType) {
case ORDER_V:
enableScoreRule = scoreRuleRedisDao.getEnableScoreRule(scoreRuleType, transportType);
if (enableScoreRule == null) {
enableScoreRule = getEnabledOrderVScoreRuleByTransportType(transportType.getValue());
if (enableScoreRule == null) {
return null;
}
scoreRuleRedisDao.setEnableScoreRule(enableScoreRule);
}
return enableScoreRule;
case RECOMMEND:
case REGISTER:
return getEnableScoreRuleByType(scoreRuleType);
default:
return null;
}
}
@Override @Override
public List<WarehouseTreeRegionSimpleVO> getWarehouseTreeRegionListSimple() { public List<WarehouseTreeRegionSimpleVO> getWarehouseTreeRegionListSimple() {
List<WarehouseTreeRegionVO> list = ListUtils.sum( List<WarehouseTreeRegionVO> list = ListUtils.sum(
...@@ -726,4 +705,15 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score ...@@ -726,4 +705,15 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
public Boolean setScoreRuleSwitch(SwitchReqVo switchReqVo) { public Boolean setScoreRuleSwitch(SwitchReqVo switchReqVo) {
return scoreRuleRedisDao.setScoreRuleSwitch(switchReqVo.getSwitchState()); return scoreRuleRedisDao.setScoreRuleSwitch(switchReqVo.getSwitchState());
} }
@Override
public List<ScoreRuleDO> getEnableOrderVRule() {
LambdaQueryWrapper<ScoreRuleDO> queryWrapper = new LambdaQuery<ScoreRuleDO>()
.eq(ScoreRuleDO::getType, ScoreRuleTypeEnum.ORDER_V.getValue())
.eq(ScoreRuleDO::getStatus, ScoreRuleStatusEnum.ENABLED.getValue())
.lt(ScoreRuleDO::getStartTime, LocalDateTime.now())
.gt(ScoreRuleDO::getEndTime, LocalDateTime.now());
List<ScoreRuleDO> scoreRuleDOS = scoreRuleMapper.selectList(queryWrapper);
return scoreRuleDOS;
}
} }
package cn.iocoder.boot.module.order.api; package cn.iocoder.boot.module.order.api;
import cn.iocoder.boot.module.order.api.dto.OrderItemRespDTO; import cn.iocoder.boot.module.order.api.dto.OrderItemRespDTO;
import cn.iocoder.boot.module.order.api.dto.OrderOperateLogDTO;
import cn.iocoder.boot.module.order.api.dto.OrderRespDTO; import cn.iocoder.boot.module.order.api.dto.OrderRespDTO;
import java.util.List; import java.util.List;
...@@ -21,6 +22,10 @@ public interface OrderApi { ...@@ -21,6 +22,10 @@ public interface OrderApi {
* 根据订单id获取所有订单项 * 根据订单id获取所有订单项
*/ */
List<OrderItemRespDTO> getOrderItemsByOrderId(Long orderId); List<OrderItemRespDTO> getOrderItemsByOrderId(Long orderId);
/**
* 添加订单操作日志
*/
void createOrderOperateLog(OrderOperateLogDTO orderId);
/** /**
......
package cn.iocoder.boot.module.order.api.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* 订单操作日志 DTO
*/
@Data
public class OrderOperateLogDTO {
@ApiModelProperty(value = "订单ID", required = true)
@NotNull(message = "订单ID不能为空")
private Long orderId;
@ApiModelProperty(value = "变更后订单详情数据")
private String body;
@ApiModelProperty(value = "请求地址")
private String requestUrl;
@ApiModelProperty(value = "变更类型")
private String type;
@ApiModelProperty(value = "变更描述")
private String msg;
@ApiModelProperty(value = "备注说明")
private String note;
@ApiModelProperty(value = "操作人类型:1 会员 2 管理员")
private Integer userType;
@ApiModelProperty(value = "创建者")
private String creator;
@ApiModelProperty(value = "创建者名称")
private String creatorName;
}
package cn.iocoder.boot.module.order.api.dto; package cn.iocoder.boot.module.order.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal; import java.math.BigDecimal;
@Data @Data
......
...@@ -13,6 +13,8 @@ import cn.iocoder.yudao.module.order.dal.dataobject.orderItem.OrderItemDO; ...@@ -13,6 +13,8 @@ import cn.iocoder.yudao.module.order.dal.dataobject.orderItem.OrderItemDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderObjective.OrderObjectiveDO; import cn.iocoder.yudao.module.order.dal.dataobject.orderObjective.OrderObjectiveDO;
import cn.iocoder.yudao.module.order.service.order.*; import cn.iocoder.yudao.module.order.service.order.*;
import cn.iocoder.yudao.module.order.service.order.impl.OrderItemServiceImpl; import cn.iocoder.yudao.module.order.service.order.impl.OrderItemServiceImpl;
import cn.iocoder.yudao.module.order.service.orderOperateLog.OrderOperateLogService;
import cn.iocoder.yudao.module.order.vo.orderOperateLog.OrderOperateLogCreateReqVO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -45,6 +47,8 @@ public class OrderApiImpl implements OrderApi { ...@@ -45,6 +47,8 @@ public class OrderApiImpl implements OrderApi {
private OrderItemServiceImpl orderItemService; private OrderItemServiceImpl orderItemService;
@Resource @Resource
private OrderConsignorService orderConsignorService; private OrderConsignorService orderConsignorService;
@Resource
private OrderOperateLogService orderOperateLogService;
@Override @Override
public OrderRespDTO getOrder(Long id, String orderNo) { public OrderRespDTO getOrder(Long id, String orderNo) {
...@@ -101,6 +105,13 @@ public class OrderApiImpl implements OrderApi { ...@@ -101,6 +105,13 @@ public class OrderApiImpl implements OrderApi {
return null; return null;
} }
@Override
public void createOrderOperateLog(OrderOperateLogDTO orderOperateLogDTO) {
OrderOperateLogCreateReqVO createReqVO = new OrderOperateLogCreateReqVO();
BeanUtils.copyProperties(orderOperateLogDTO, createReqVO);
orderOperateLogService.createOrderAsyncOperateLog(createReqVO);
}
@Override @Override
public boolean mergeOrder(Long customerIdSaved, Long customerIdDeleted) { public boolean mergeOrder(Long customerIdSaved, Long customerIdDeleted) {
......
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