feat:拼团订单集成
parent
d80bf5a368
commit
259807600a
@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.promotion.api.combination;
|
||||
|
||||
import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordReqDTO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 拼团活动 API 接口
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
public interface CombinationApi {
|
||||
|
||||
/**
|
||||
* 创建开团记录
|
||||
*
|
||||
* @param reqDTO 请求 DTO
|
||||
*/
|
||||
void createRecord(@Valid CombinationRecordReqDTO reqDTO);
|
||||
|
||||
/**
|
||||
* 更新开团记录状态
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param orderId 订单编号
|
||||
* @param status 状态值
|
||||
*/
|
||||
void updateRecordStatus(Long userId, Long orderId, Integer status);
|
||||
|
||||
/**
|
||||
* 更新开团记录状态和开始时间
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param orderId 订单编号
|
||||
* @param status 状态值
|
||||
*/
|
||||
void updateRecordStatusAndStartTime(Long userId, Long orderId, Integer status);
|
||||
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.promotion.enums.combination;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 拼团状态枚举
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum CombinationRecordStatusEnum implements IntArrayValuable {
|
||||
NOT_PAY(0, "未付款"),
|
||||
ONGOING(1, "进行中"),
|
||||
SUCCESS(2, "拼团成功"),
|
||||
FAILED(3, "拼团失败");
|
||||
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CombinationRecordStatusEnum::getStatus).toArray();
|
||||
|
||||
/**
|
||||
* 状态值
|
||||
*/
|
||||
private final Integer status;
|
||||
/**
|
||||
* 状态名
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
@Override
|
||||
public int[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package cn.iocoder.yudao.module.promotion.api.combination;
|
||||
|
||||
import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordReqDTO;
|
||||
import cn.iocoder.yudao.module.promotion.service.combination.CombinationActivityService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 拼团活动 API 实现类
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
@Service
|
||||
public class CombinationApiImpl implements CombinationApi {
|
||||
@Resource
|
||||
private CombinationActivityService activityService;
|
||||
|
||||
@Override
|
||||
public void createRecord(CombinationRecordReqDTO reqDTO) {
|
||||
activityService.createRecord(reqDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRecordStatus(Long userId, Long orderId, Integer status) {
|
||||
activityService.updateRecordStatusByUserIdAndOrderId(userId, orderId, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRecordStatusAndStartTime(Long userId, Long orderId, Integer status) {
|
||||
activityService.updateRecordStatusAndStartTimeByUserIdAndOrderId(userId, orderId, status, LocalDateTime.now());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.promotion.dal.mysql.combination.combinationactivity;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.combinationactivity.CombinationRecordDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 拼团记录 Mapper
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
@Mapper
|
||||
public interface CombinationRecordMapper extends BaseMapperX<CombinationRecordDO> {
|
||||
|
||||
default CombinationRecordDO selectRecord(Long userId, Long orderId) {
|
||||
return selectOne(CombinationRecordDO::getUserId, userId, CombinationRecordDO::getOrderId, orderId);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue