Commit c2350679 by xiaoer.li@freemud.com

Merge remote-tracking branch 'origin/develop' into develop

parents 4d74b4c6 f5132f7f
package cn.freemud.entities;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class Active {
@JSONField(
name = "ActiveId"
)
private Integer ActiveId;
@JSONField(
name = "EBCode"
)
private String EBCode;
@JSONField(
name = "Type"
)
private Integer Type;
@JSONField(
name = "PartnerID"
)
private Integer PartnerID;
@JSONField(
name = "PlatformItemId"
)
private String PlatformItemId;
@JSONField(
name = "State"
)
private Integer State;
@JSONField(
name = "CreateUser"
)
private String CreateUser;
@JSONField(
name = "CreateDate"
)
private String CreateDate;
@JSONField(
name = "LastEditUser"
)
private String LastEditUser;
@JSONField(
name = "LastEditDate"
)
private String LastEditDate;
@JSONField(
name = "ActiveCode"
)
private String ActiveCode;
@JSONField(
name = "ActiveName"
)
private String ActiveName;
@JSONField(
name = "StartDate"
)
private String StartDate;
@JSONField(
name = "EndDate"
)
private String EndDate;
@JSONField(
name = "ShouldRedeemAll"
)
private Boolean ShouldRedeemAll;
@JSONField(
name = "PromotionType"
)
private String PromotionType;
@JSONField(
name = "Exclusive"
)
private Boolean Exclusive;
@JSONField(
name = "MinAmount"
)
private BigDecimal MinAmount;
@JSONField(
name = "MaxRedeemTimes"
)
private Integer MaxRedeemTimes;
@JSONField(
name = "MaxSendOut"
)
private Integer MaxSendOut;
@JSONField(
name = "Cost"
)
private BigDecimal Cost;
@JSONField(
name = "BusinessID"
)
private Integer BusinessID;
@JSONField(
name = "ActiveDesc"
)
private String ActiveDesc;
@JSONField(
name = "Percentage"
)
private Double percentage;
@JSONField(
name = "Inventory"
)
private Integer inventory;
@JSONField(
name = "PercentDiscount"
)
private BigDecimal PercentDiscount;
@JSONField(
name = "MaxDiscount"
)
private Integer MaxDiscount;
@JSONField(
name = "AppId"
)
private String AppId;
@JSONField(
name = "FromDayEffective"
)
private Integer FromDayEffective;
@JSONField(
name = "Effective"
)
private Integer Effective;
@JSONField(
name = "EffectiveStart"
)
private Date EffectiveStart;
@JSONField(
name = "EffectiveEnd"
)
private Date EffectiveEnd;
@JSONField(
name = "RedeemChannel"
)
private String RedeemChannel;
@JSONField(
name = "MerchantDiscountPrice"
)
private BigDecimal MerchantDiscountPrice;
@JSONField(
name = "PlatformDiscountPrice"
)
private BigDecimal PlatformDiscountPrice;
@JSONField(
name = "OtherDiscountPrice"
)
private BigDecimal OtherDiscountPrice;
@JSONField(
name = "salePrice"
)
private Integer salePrice;
@JSONField(
name = "voucherFaceValue"
)
private Integer voucherFaceValue;
}
package cn.freemud.entities;
import java.util.List;
public class BatchQueryActivityInfoResponse {
/**
* 状态码
*/
private String statusCode;
/**
* 状态码描述
*/
private String msg;
private List<Active> activities;
}
package cn.freemud.entities.dto;
import com.freemud.card.sdk.vo.coupon.Active;
import cn.freemud.entities.Active;
import lombok.Data;
import java.util.List;
......
......@@ -31,5 +31,4 @@ public class NgsSellCouponCreateOrderVo {
// @NotEmpty(message = "version 版本号不能为空")
private String version;
}
......@@ -13,6 +13,8 @@
package cn.freemud.service;
import cn.freemud.entities.dto.BatchQueryActivityInfoRequestDto;
import cn.freemud.entities.dto.BatchQueryActivityInfoResponseDto;
import cn.freemud.entities.dto.GetCouponDetailResponseDto;
import cn.freemud.entities.dto.promotion.ShoppingCartGoodsResponse;
import cn.freemud.entities.vo.ActivityClassifyCouponBean;
......@@ -31,6 +33,9 @@ public interface CouponService {
*/
GetCouponDetailResponseDto getMemberCoupon(GetMemberCouponRequestVo requestVo);
BatchQueryActivityInfoResponseDto batchQueryActivityInfo(BatchQueryActivityInfoRequestDto requestDto);
/**
* 获取卡券服务商户密钥
*/
......
......@@ -156,6 +156,24 @@ public class CouponServiceImpl implements CouponService {
return null;
}
@Override
public BatchQueryActivityInfoResponseDto batchQueryActivityInfo(BatchQueryActivityInfoRequestDto requestDto) {
String appSecret = this.getAppSecret(String.valueOf(requestDto.getPartnerId()));
// requestDto.setActiveCode(calActiveCodes);
// 书写逻辑
// requestDto.setPartnerId(Integer.valueOf(partnerId));
String sign = SignUtil.createMD5Sign(requestDto, appSecret);
requestDto.setSign(sign);
BatchQueryActivityInfoResponseDto batchQueryActivityInfoResponseDto = cardBinClient.batchQueryActivityInfo(requestDto);
if (Objects.equals(batchQueryActivityInfoResponseDto.getStatusCode(), ResponseCodeConstant.RESPONSE_SUCCESS_0_STR)
&& CollectionUtils.isNotEmpty(batchQueryActivityInfoResponseDto.getActivities())) {
return batchQueryActivityInfoResponseDto;
}
return null;
}
/**
* 获取会员服务的优惠券列表
*
......
......@@ -5,9 +5,8 @@ import cn.freemud.adapter.OrderAdapter;
import cn.freemud.base.entity.BaseResponse;
import cn.freemud.base.util.DateUtil;
import cn.freemud.constant.CommonRedisKeyConstant;
import cn.freemud.entities.dto.ConfirmOrderDto;
import cn.freemud.entities.dto.GetCouponDetailResponseDto;
import cn.freemud.entities.dto.QueryOrdersResponseDto;
import cn.freemud.entities.Active;
import cn.freemud.entities.dto.*;
import cn.freemud.entities.dto.order.CreatePrepayRequestDto;
import cn.freemud.entities.vo.GetMemberCouponRequestVo;
import cn.freemud.entities.vo.NgsSellCouponCreateOrderVo;
......@@ -532,11 +531,12 @@ public class SellCouponOrderServiceImpl {
// TODO 商品信息 从券码查
// TODO 通过活动号查询金额
String activityCode = requestVo.getActivityCode();
BatchQueryActivityInfoRequestDto queryActivityInfoRequestDto = new BatchQueryActivityInfoRequestDto();
queryActivityInfoRequestDto.setActiveCode(Arrays.asList(activityCode));
queryActivityInfoRequestDto.setPartnerId(Integer.valueOf(partnerId));
BatchQueryActivityInfoResponseDto batchQueryActivityInfoResponseDto = couponService.batchQueryActivityInfo(queryActivityInfoRequestDto);
Active active = batchQueryActivityInfoResponseDto.getActivities().get(0);
GetCouponDetailResponseDto memberCoupon = couponService.getMemberCoupon(GetMemberCouponRequestVo.builder()
.partnerId(partnerId)
.couponCode(activityCode).build());
GetCouponDetailResponseDto.Active active = memberCoupon.getDetails().get(0).getActive();
// GetMenuCategoryInfoResponse.RootNodeBean.ChildrenBeanFirst.ChildrenBeanSecond.ProductBean productBean = productInfosResponse.getProducts().get(0);
//订单原始金额,单位分
//用户在界面上看到的支付金额
......@@ -545,13 +545,13 @@ public class SellCouponOrderServiceImpl {
request.setSettlementAmount(active.getSalePrice().longValue());
//实际支付现金金额,扣除支付自生优惠,单位分`
request.setActualPayAmount(active.getSalePrice().longValue());
request.setOriginalAmount(active.getOriginalPrice().longValue());
request.setOriginalAmount(active.getVoucherFaceValue().longValue());
request.setOrderType(OrderType.GENERAL_DINE_IN.getIndex());
//商品信息转换
List<OrderItemCreateReq> orderItemList = new ArrayList<>();
OrderItemCreateReq orderItemCreateReq = new OrderItemCreateReq();
orderItemCreateReq.setSalePrice(active.getSalePrice().longValue());
orderItemCreateReq.setProductPrice(active.getOriginalPrice().longValue());
orderItemCreateReq.setProductPrice(active.getVoucherFaceValue().longValue());
orderItemCreateReq.setSettlementPrice(active.getSalePrice().longValue());
orderItemCreateReq.setPartnerId(partnerId);
......@@ -566,11 +566,10 @@ public class SellCouponOrderServiceImpl {
OrderProductAddInfoDto orderProductAddInfoDto = new OrderProductAddInfoDto();
List<ProductBindingCouponType> productBindingCoupons = new ArrayList<>();
GetCouponDetailResponseDto.Details detail = memberCoupon.getDetails().get(0);
ProductBindingCouponType productBindingCouponType2 = new ProductBindingCouponType();
productBindingCouponType2.setActivityCode(detail.getActiveCode());
productBindingCouponType2.setActivityCode(active.getActiveCode());
productBindingCouponType2.setNum(1);
productBindingCouponType2.setActivityName(detail.getActive().getActiveName());
productBindingCouponType2.setActivityName(active.getActiveName());
productBindingCoupons.add(productBindingCouponType2);
orderProductAddInfoDto.setProductBindingCoupons(productBindingCoupons);
orderItemCreateReq.setExtInfo(JSONObject.toJSONString(orderProductAddInfoDto));
......
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