Commit 5702d44a by box

Merge branch 'feature/box/查卡包链路优化' into qa

parents 49f780ca 9007e5a0
package cn.freemud.entities.dto.coupon;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* © All rights Reserved
*
* @author wénkǎi.zhāng 2023-12-08
* @since 1.0
*/
@Data
public class AvailableCouponDto {
/**
* 券信息
*/
private CouponInfoDto couponInfo;
}
package cn.freemud.entities.dto.coupon;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.List;
/**
* © All rights Reserved
*
* @author wénkǎi.zhāng 2023-12-08
* @since 1.0
*/
@Data
public class CouponAvailabilityQueryRequest {
/**
* 商户号
*/
@NotEmpty(message = "商户号不能为空")
private String partnerId;
/**
* 会员ID
*/
@NotNull(message = "memberId不能为空")
private String memberId;
/**
* 券类型列表
* <p>
* 根据类型列表查询指定类型的券,为空则查询全部
*/
private List<Integer> types;
/**
* 所属门店
*/
@NotNull(message = "门店编号不能为空")
private String storeId;
/**
* 门店所属渠道
*/
private List<String> storeChannels;
/**
* 当前小程序appid
*/
private String appId;
/**
* 核销场景
*/
private String scene;
@ApiModelProperty("门店餐段配置")
private List<MealSectionTimePeriod> mealSectionTimePeriods;
/**
* 购物车信息
*/
@Valid
private ShoppingCardInfo shoppingCardInfo;
@Data
public static class ShoppingCardInfo {
/**
* 商品列表
*/
@Valid
@Size(min = 1, message = "购物车商品不能为空")
private List<Product> products;
/**
* 总金额
*/
private Integer totalAmount;
}
/**
* 商品信息
*/
@Data
public static class Product {
/**
* 商品编号
* sku
*/
@NotNull(message = "商品代码不能为空")
private String productCode;
/**
* 券号
* <p>
* 如果是商品券、换购券、买M免N则存在券号
*/
private String couponCode;
/**
* 商品原价
*/
private Integer originalPrice;
/**
* 商品优惠价
*/
private Integer preferentialPrice;
}
@Data
public static class MealSectionTimePeriod {
@NotNull(message = "餐段类型不能为空")
private Integer sectionType;
@ApiModelProperty(value = "餐段开始时间,单位:秒,1代表当天0点0分1秒", required = true, allowableValues = "range[0, 86398]", example = "0")
@NotNull(message = "餐段开始时间为不能为空")
@Min(value = 0, message = "餐段结束时间取值范围[0,86398]")
@Max(value = 86398, message = "餐段结束时间取值范围[0,86398]")
private Integer beginTime;
@ApiModelProperty(value = "餐段结束时间,单位:秒,86399代表当天23点59分59秒", required = true, allowableValues = "range[1, 86399]", example = "86399")
@NotNull(message = "餐段结束时间为不能为空")
@Min(value = 1, message = "结束时间取值范围[1,86399]")
@Max(value = 86399, message = "餐段结束时间取值范围[1,86399]")
private Integer endTime;
}
}
package cn.freemud.entities.dto.coupon;
import lombok.Data;
import java.util.List;
/**
* &copy; All rights Reserved
*
* @author wénkǎi.zhāng 2023-12-08
* @since 1.0
*/
@Data
public class CouponAvailabilityQueryResponse {
private List<AvailableCouponDto> availableCoupons;
private List<UnAvailableCouponDto> unAvailableCoupons;
}
package cn.freemud.entities.dto.coupon;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* &copy; All rights Reserved
*
* @author wénkǎi.zhāng 2023-12-11
* @since 1.0
*/
@Data
public class CouponInfoDto {
/**
* 券主键ID
* <p>
* 冗余字段,方便查询
*/
private Long id;
/**
* 券名称
*/
private String name;
/**
* 券号
*/
private String code;
/**
* 类型
*/
private Integer type;
/**
* 状态
*/
private Integer state;
/**
* 开始时间
*/
private String startTime;
/**
* 结束时间
*/
private String endTime;
/**
* 所有券类型通用的券面值
* 该字段不为null时,取该字段作为面值,金额单位为分,100代表1元,如果是折扣,60代表6折.如果字段为null,按照老券处理,不同券从不同的地方取值
*/
private Integer faceValue;
/**
* 启用金额
*/
private Integer minAmount;
/**
* 模板ID
*/
private String templateId;
/**
* 模板编号
*/
private String templateCode;
/**
* 券Logo
*/
private String logo;
/**
* 所属门店
* <p>
* 发券时指定门店特有
*/
private String storeId;
/**
* 是否优惠同享
* <p>
* 0 否 1 是
*/
private Integer promotionSharing;
/**
* 核销次数限制类型
* <p>
* 1:不限,2:每日,3:每周,4:每月
*/
private Integer redeemNumLimitType;
/**
* 最大可用次数
*/
private Integer configMaxRedeemNums;
/**
* 每日最大可用次数
*/
private Integer configDayMaxRedeemNums;
/**
* 当前剩余的可用次数
*/
private Integer leftAvailableNums;
/**
* 最大剩余可用次数
*/
private Integer leftMaxAvailableNums;
/**
* 不可用原因
*/
private String unAvailableReason;
/**
* 不可用错误码
*/
private String unAvailableCode;
@JsonIgnore
private boolean hasRedeemNumLimitType = false;
/**
* 次数统计周期过期时间
*/
@JsonIgnore
private Date redeemCycleExpiredTime;
/**
* 周期内已核销次数
*/
@JsonIgnore
private Integer redeemCycleNum;
/**
* 全局已核销次数
*/
@JsonIgnore
private Integer redeemMaxNum;
/**
* 券可用的小程序ID
*/
private List<String> appIds;
@ApiModelProperty(value = "发码来源类型")
private Integer sourceOrigin;
/**
* 发码来源类型id
*/
@ApiModelProperty(value = "发码来源类型id", notes = "来源ID最大长度未64位")
private String sourceOriginId;
private Integer exemptionRule;
@ApiModelProperty(value = "活动商品类别描述,买A赠B必传", example = "主食")
private String activityProductDesc;
@ApiModelProperty(value = "赠送商品描述,买A赠B必传", example = "小吃")
private String giftDesc;
@ApiModelProperty("券主页图片-使用券时,页面的图片")
private String couponHomePicture;
@ApiModelProperty("商家实收金额(分)")
private Integer receivedAmount;
}
package cn.freemud.entities.dto.coupon;
import com.fasterxml.jackson.annotation.JsonAlias;
import lombok.Data;
/**
......@@ -17,6 +18,7 @@ public class CouponResponseDTO<T> {
*/
private String msg;
@JsonAlias("data")
private T result;
}
......@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @author : xh.Z
......@@ -68,4 +69,39 @@ public class FastTemplateInfoResponseVO {
@ApiModelProperty("活动状态:0未启用、 1启用、2开始、 3结束、 4暂停、5作废、6禁用")
private Integer status;
@ApiModelProperty(value = "核销方式限制,pickup:自提,delivery:外送,sassmall:微商城", required = true)
private List<String> redeemScene;
@ApiModelProperty("商品适用范围文案说明")
private String productScopeDesc;
@ApiModelProperty("门店适用范围文案说明")
private String storeScopeDesc;
@ApiModelProperty("最大可核销次数,大于1时为频次券")
private Integer maxRedeemTimes;
@ApiModelProperty("核销次数限制类型对应的可核销次数,频次券时有效")
private Integer limitedRedeemTimes;
@ApiModelProperty("核销次数限制类型,频次券时有效,1:不限,2:每日,3:每周,4:每月")
private Integer redeemTimesLimitType;
/**
* 0 全部 1 部分白 2 黑
*/
private Integer checkStoreLimitType;
/**
* 0 全部 1 部分白 2 黑
*/
private Integer checkProductLimitType;
/**
* 减免规则 1-20:运费券规则,21开始为买M免N券规则。
* 1:免配送费,2:部分减免
* 21:免最低价格,22:免最高价格
*/
private Integer exemptionRule;
}
package cn.freemud.entities.dto.coupon;
import lombok.Data;
import java.util.List;
/**
* &copy; All rights Reserved
*
* @author wénkǎi.zhāng 2023-12-11
* @since 1.0
*/
@Data
public class UnAvailableCouponDto {
/**
* 券信息
*/
private CouponInfoDto couponInfo;
/**
* 不可用原因
*/
private String unAvailableReason;
/**
* 不可用错误码
*/
private String unAvailableCode;
}
......@@ -178,7 +178,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
private CalculationSharingValidatorService calculationSharingValidatorService;
@Autowired
private CustomerExtendClient customerExtendClient;
private CouponQueryClient couponQueryClient;
@Autowired
private MemberPropertyService memberPropertyService;
......@@ -3112,7 +3112,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
public GetMemberCouponListResponseDto.Result getMemberCouponList(GetMemberCouponListRequestDto getMemberCouponListRequestDto) {
GetMemberCouponListResponseDto getMemberCouponListResponseDto = null;
try {
getMemberCouponListResponseDto = customerExtendClient.getMemberCouponListRequestDto(getMemberCouponListRequestDto);
getMemberCouponListResponseDto = couponQueryClient.getMemberCouponListRequestDto(getMemberCouponListRequestDto);
} catch (Exception ex) {
ErrorLog.errorConvertJson(this.getClass(), "会员服务优惠券接口调用失败", ex);
}
......
package cn.freemud.service.impl.mcoffee.calculation;
import cn.freemud.adapter.CouponAdapter;
import cn.freemud.base.entity.BaseResponse;
import cn.freemud.base.util.DateUtil;
import cn.freemud.constant.ApplicationConstant;
import cn.freemud.entities.dto.*;
import cn.freemud.entities.dto.activity.ActivityDiscountsDto;
import cn.freemud.entities.dto.calculate.*;
......@@ -15,7 +13,7 @@ import cn.freemud.service.CommonService;
import cn.freemud.service.impl.ItemServiceImpl;
import cn.freemud.service.impl.mcoffee.entity.*;
import cn.freemud.service.thirdparty.CouponClient;
import cn.freemud.service.thirdparty.CustomerExtendClient;
import cn.freemud.service.thirdparty.CouponQueryClient;
import cn.freemud.utils.BarcodeUtil;
import cn.freemud.utils.ExceptionUtils;
import com.alibaba.fastjson.JSON;
......@@ -52,7 +50,7 @@ import java.util.stream.Collectors;
public class CouponDiscountCalculation {
@Autowired
private CustomerExtendClient customerExtendClient;
private CouponQueryClient couponQueryClient;
@Autowired
private ItemServiceImpl itemService;
......@@ -502,7 +500,7 @@ public class CouponDiscountCalculation {
public GetMemberCouponListResponseDto.Result getMemberCouponList(GetMemberCouponListRequestDto getMemberCouponListRequestDto) {
GetMemberCouponListResponseDto getMemberCouponListResponseDto = null;
try {
getMemberCouponListResponseDto = customerExtendClient.getMemberCouponListRequestDto(getMemberCouponListRequestDto);
getMemberCouponListResponseDto = couponQueryClient.getMemberCouponListRequestDto(getMemberCouponListRequestDto);
} catch (Exception ex) {
ErrorLog.errorConvertJson(this.getClass(),"会员服务优惠券接口调用失败",ex);
}
......
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title: CustomerExtendClient
* @Title: CouponQueryClient
* @Package cn.freemud.service.thirdparty
* @Description:
* @author: song.cai
......@@ -18,18 +18,32 @@ import cn.freemud.constant.ResponseCodeConstant;
import cn.freemud.constant.ResponseCodeKeyConstant;
import cn.freemud.entities.dto.GetMemberCouponListRequestDto;
import cn.freemud.entities.dto.GetMemberCouponListResponseDto;
import cn.freemud.entities.dto.coupon.CouponAvailabilityQueryRequest;
import cn.freemud.entities.dto.coupon.CouponAvailabilityQueryResponse;
import cn.freemud.entities.dto.coupon.CouponResponseDTO;
import feign.HeaderMap;
import feign.Headers;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@FeignClient(name = "customer-extend-service", url = "${saas.customerextendclient.feign.url}")
@FeignClient(name = "OPEN-STORE-COUPON-QUERY-SERVICE", url = "${saas.coupon-query-service.feign.url:}")
@RequestMapping(produces = {"application/json;charset=UTF-8"})
public interface CustomerExtendClient {
public interface CouponQueryClient {
/**
* 会员优惠券列表
*/
@IgnoreFeignLogAnnotation(logMessage = "getMemberCouponListRequestDto",excludeStatusCodes = {ResponseCodeConstant.RESPONSE_SUCCESS_STR},statusCodeFieldName= ResponseCodeKeyConstant.STATUS_CODE,messageFieldName=ResponseCodeKeyConstant.MSG)
@PostMapping(value = "/customerextendservice/coupon/getCoupons")
GetMemberCouponListResponseDto getMemberCouponListRequestDto(@RequestBody GetMemberCouponListRequestDto getMemberCouponListRequestDto);
/**
* 查询并校验券
* <pre></pre>
* @param request
* @return
*/
@PostMapping(value = "coupon/query/availability", headers = "API-VERSION=2")
CouponResponseDTO<CouponAvailabilityQueryResponse> availability(CouponAvailabilityQueryRequest request);
}
......@@ -2,7 +2,7 @@ package cn.freemud.client;
import cn.freemud.entities.dto.GetMemberCouponListRequestDto;
import cn.freemud.entities.dto.GetMemberCouponListResponseDto;
import cn.freemud.service.thirdparty.CustomerExtendClient;
import cn.freemud.service.thirdparty.CouponQueryClient;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -19,9 +19,9 @@ import java.util.ArrayList;
@EnableDiscoveryClient
@EnableFeignClients
@EnableAutoConfiguration
public class CustomerExtendClientTest {
public class CouponQueryClientTest {
@Autowired
private CustomerExtendClient customerExtendClient;
private CouponQueryClient couponQueryClient;
@Test
public void getUserInfo() {
GetMemberCouponListRequestDto requestDto=new GetMemberCouponListRequestDto("1864","115417276085674268");
......@@ -30,6 +30,6 @@ public class CustomerExtendClientTest {
requestDto.setStatusFlags(new ArrayList<>(0));
requestDto.setIsProduct(1);
requestDto.setCouponType(0);
GetMemberCouponListResponseDto responseDto=customerExtendClient.getMemberCouponListRequestDto(requestDto);
GetMemberCouponListResponseDto responseDto= couponQueryClient.getMemberCouponListRequestDto(requestDto);
}
}
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