增加团购券核销接口
This commit is contained in:
@ -0,0 +1,20 @@
|
||||
package com.sczx.order.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author: 张黎
|
||||
* @Date: 2024/03/08/17:42
|
||||
* @Description: 支付方式枚举
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum CouponTypeEnum {
|
||||
MT("MT", "美团"),
|
||||
DY("DY", "抖音"),
|
||||
;
|
||||
private final String code;
|
||||
|
||||
private final String msg;
|
||||
}
|
||||
@ -2,6 +2,7 @@ package com.sczx.order.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.sczx.order.common.Result;
|
||||
import com.sczx.order.dto.VerifyGroupBuyCouponsReq;
|
||||
import com.sczx.order.dto.OrderDetailDTO;
|
||||
import com.sczx.order.dto.OrderDistribDTO;
|
||||
import com.sczx.order.dto.OrderDistribQueryReq;
|
||||
@ -12,6 +13,8 @@ import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* @Author: 张黎
|
||||
* @Date: 2025/07/25/16:42
|
||||
@ -49,4 +52,10 @@ public class PubOrderController {
|
||||
orderDistribService.saveOrderDistrib(orderNo);
|
||||
return Result.ok(true);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "团购券核销")
|
||||
@PostMapping("/verifyGroupBuyCoupons")
|
||||
public Result<OrderDetailDTO> verifyGroupBuyCoupons(@Valid @RequestBody VerifyGroupBuyCouponsReq req){
|
||||
return Result.ok(orderService.verifyGroupBuyCoupons( req));
|
||||
}
|
||||
}
|
||||
|
||||
38
src/main/java/com/sczx/order/dto/GroupBuyOrderInfoDto.java
Normal file
38
src/main/java/com/sczx/order/dto/GroupBuyOrderInfoDto.java
Normal file
@ -0,0 +1,38 @@
|
||||
package com.sczx.order.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 团购订单必须信息
|
||||
* @Author: 张黎
|
||||
* @Date: 2025/10/27/20:42
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
public class GroupBuyOrderInfoDto {
|
||||
|
||||
@ApiModelProperty(value = "门店id")
|
||||
@NotNull(message = "门店id不能为空")
|
||||
private Long storeId;
|
||||
|
||||
@ApiModelProperty(value = "客户id")
|
||||
private Long customerId;
|
||||
|
||||
@ApiModelProperty("车型ID")
|
||||
@NotNull(message = "车型ID不能为空")
|
||||
private Long carModelId;
|
||||
|
||||
@ApiModelProperty(value = "租车套餐id")
|
||||
@NotNull(message = "租车套餐id不能为空")
|
||||
private Long rentCarRuleId;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "租电套餐id")
|
||||
private Long rentBatteyRuleId;
|
||||
|
||||
@ApiModelProperty(value = "团购券类型")
|
||||
private String couponType;
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.sczx.order.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @Author: 张黎
|
||||
* @Date: 2025/10/27/19:13
|
||||
* @Description:
|
||||
*/
|
||||
@ApiModel(value = "团购券核销请求参数")
|
||||
@Data
|
||||
public class VerifyGroupBuyCouponsReq {
|
||||
|
||||
@NotEmpty(message = "券码类型不能为空")
|
||||
@ApiModelProperty(value = "券码类型:美团MT,抖音DY")
|
||||
private String couponType;
|
||||
|
||||
@NotEmpty(message = "券码不能为空")
|
||||
@ApiModelProperty(value = "券码")
|
||||
private String couponCode;
|
||||
|
||||
@NotNull(message = "门店id不能为空")
|
||||
@ApiModelProperty(value = "门店id")
|
||||
private Long storeId;
|
||||
|
||||
@NotEmpty(message = "用户手机号不能为空")
|
||||
@ApiModelProperty(value = "用户完整手机号")
|
||||
private String mobile;
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.sczx.order.service;
|
||||
|
||||
import com.sczx.order.dto.GroupBuyOrderInfoDto;
|
||||
|
||||
/** 团购券服务
|
||||
* @Author: 张黎
|
||||
* @Date: 2025/10/27/20:30
|
||||
* @Description:
|
||||
*/
|
||||
public interface GroupBuyCouponService {
|
||||
/**
|
||||
* 获取团购券下单信息
|
||||
* @param couponCode 团购券码
|
||||
* @param couponType 团购券类型
|
||||
* @param mobile 手机号
|
||||
* @return
|
||||
*/
|
||||
GroupBuyOrderInfoDto getGroupBuyOrderInfoDto(String couponCode, String couponType, String mobile);
|
||||
|
||||
/**
|
||||
* 校验团购券码
|
||||
* @param couponCode 团购券码
|
||||
* @param couponType 团购券类型
|
||||
* @return
|
||||
*/
|
||||
boolean checkCouponCode(String couponCode, String couponType);
|
||||
}
|
||||
@ -15,6 +15,13 @@ public interface OrderService {
|
||||
*/
|
||||
OrderMainPO queryOrderMainPoByOrderNo(String orderNo, String delFlag);
|
||||
|
||||
/**
|
||||
* 团购券核销
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
OrderDetailDTO verifyGroupBuyCoupons(VerifyGroupBuyCouponsReq req);
|
||||
|
||||
/**
|
||||
* 提交租车订单
|
||||
* @param rentCarOrderReq
|
||||
|
||||
@ -0,0 +1,49 @@
|
||||
package com.sczx.order.service.impl;
|
||||
|
||||
import com.sczx.order.common.enums.CouponTypeEnum;
|
||||
import com.sczx.order.dto.GroupBuyOrderInfoDto;
|
||||
import com.sczx.order.dto.SimpleUserInfoDTO;
|
||||
import com.sczx.order.exception.BizException;
|
||||
import com.sczx.order.service.GroupBuyCouponService;
|
||||
import com.sczx.order.service.MeiTuanService;
|
||||
import com.sczx.order.thirdpart.integration.UserInteg;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author: 张黎
|
||||
* @Date: 2025/10/27/20:48
|
||||
* @Description:
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class GroupBuyCouponServiceImpl implements GroupBuyCouponService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private UserInteg userInteg;
|
||||
|
||||
@Autowired
|
||||
private MeiTuanService meiTuanService;
|
||||
|
||||
@Override
|
||||
public GroupBuyOrderInfoDto getGroupBuyOrderInfoDto(String couponCode, String couponType, String mobile) {
|
||||
SimpleUserInfoDTO userInfoDTO = userInteg.getUInfoByMobile(mobile);
|
||||
if(userInfoDTO==null){
|
||||
throw new BizException("用户不存在");
|
||||
}
|
||||
if(userInfoDTO.getAuthed()==0){
|
||||
throw new BizException("用户未实名认证");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkCouponCode(String couponCode, String couponType) {
|
||||
if(CouponTypeEnum.MT.getCode().equals(couponType)){
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -13,15 +13,13 @@ import com.sczx.order.exception.BizException;
|
||||
import com.sczx.order.exception.InnerException;
|
||||
import com.sczx.order.po.*;
|
||||
import com.sczx.order.repository.*;
|
||||
import com.sczx.order.service.GroupBuyCouponService;
|
||||
import com.sczx.order.service.OrderDistribService;
|
||||
import com.sczx.order.service.OrderService;
|
||||
import com.sczx.order.service.PayService;
|
||||
import com.sczx.order.thirdpart.dto.*;
|
||||
import com.sczx.order.thirdpart.dto.req.*;
|
||||
import com.sczx.order.thirdpart.integration.CarInteg;
|
||||
import com.sczx.order.thirdpart.integration.PayInteg;
|
||||
import com.sczx.order.thirdpart.integration.StoreInteg;
|
||||
import com.sczx.order.thirdpart.integration.SyncInteg;
|
||||
import com.sczx.order.thirdpart.integration.*;
|
||||
import com.sczx.order.utils.JwtUtil;
|
||||
import com.sczx.order.utils.OrderUtil;
|
||||
import com.sczx.order.utils.RedisUtil;
|
||||
@ -84,6 +82,9 @@ public class OrderServiceImpl implements OrderService {
|
||||
@Autowired
|
||||
private SyncInteg syncInteg;
|
||||
|
||||
@Autowired
|
||||
private GroupBuyCouponService groupBuyCouponService;
|
||||
|
||||
@Override
|
||||
public OrderMainPO queryOrderMainPoByOrderNo(String orderNo, String delFlag) {
|
||||
LambdaQueryWrapper<OrderMainPO> currentOrderWrapper = new LambdaQueryWrapper<>();
|
||||
@ -92,6 +93,14 @@ public class OrderServiceImpl implements OrderService {
|
||||
return orderMainRepo.getOne(currentOrderWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderDetailDTO verifyGroupBuyCoupons(VerifyGroupBuyCouponsReq req) {
|
||||
//校验用户是否存在,是否实名认证
|
||||
GroupBuyOrderInfoDto groupBuyOrderInfoDTO = groupBuyCouponService.getGroupBuyOrderInfoDto(req.getCouponCode(), req.getCouponType(), req.getMobile());
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public RentCarOrderResultDTO submitRentCarOrder(RentCarOrderReq rentCarOrderReq) {
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.sczx.order.thirdpart.facade;
|
||||
|
||||
import com.sczx.order.common.Result;
|
||||
import com.sczx.order.dto.SimpleUserInfoDTO;
|
||||
import com.sczx.order.thirdpart.dto.BaseUserReferralDTO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -11,4 +12,7 @@ public interface UserFacade {
|
||||
|
||||
@GetMapping("/referral/getUserReferralByUserId")
|
||||
Result<BaseUserReferralDTO> getUserReferralByUserId(@RequestParam("userId") Long userId);
|
||||
|
||||
@GetMapping("/auth/getUInfoByMobile")
|
||||
Result<SimpleUserInfoDTO> getUInfoByMobile(@RequestParam("mobile") String mobile);
|
||||
}
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
package com.sczx.order.thirdpart.integration;
|
||||
|
||||
import com.sczx.order.common.Result;
|
||||
import com.sczx.order.dto.SimpleUserInfoDTO;
|
||||
import com.sczx.order.exception.InnerException;
|
||||
import com.sczx.order.thirdpart.dto.BaseUserReferralDTO;
|
||||
import com.sczx.order.thirdpart.facade.UserFacade;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@ -27,4 +29,17 @@ public class UserInteg {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public SimpleUserInfoDTO getUInfoByMobile(String mobile){
|
||||
try{
|
||||
Result<SimpleUserInfoDTO> result = userFacade.getUInfoByMobile(mobile);
|
||||
if(result.isSuccess()){
|
||||
return result.getData();
|
||||
}
|
||||
} catch (Exception e){
|
||||
log.error("获取用户信息失败",e);
|
||||
throw new InnerException("获取用户信息失败");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user