Commit 53f155dd by 缪晖

Merge branch 'feature/20201208_collageOrder_miaohui' into develop

parents 40537610 54482871
......@@ -1205,6 +1205,7 @@ public class OrderSdkAdapter {
data.setExpressChannelName(orderInfoReqs.getExpressChannelName());
//发票信息
data.setOrderInvoice(orderInfoReqs.getOrderInvoice());
data.setPayChannelType(orderInfoReqs.getPayChannelType());
// 买一赠一寄件信息
data.setOrderSendCouponRespList(orderInfoReqs.getOrderSendCouponRespList()); data.setPayChannelType(orderInfoReqs.getPayChannelType());
data.setPickUpGoodsNo(orderInfoReqs.getPickUpGoodsNo());
......@@ -1213,6 +1214,7 @@ public class OrderSdkAdapter {
data.setOrderPayItem(this.getOrderItemPayList(orderInfoReqs.getOrderPayItemCreateReqList()));
}
data.setPayChannelType(orderInfoReqs.getPayChannelType());
//订单类型回传
if (orderInfoReqs.getMarketingType() != null) {
data.setMarketingType(ClassUtils.toByte(orderInfoReqs.getMarketingType()));
......
......@@ -12,6 +12,7 @@ import com.freemud.sdk.api.assortment.shoppingcart.service.CollageOrderBaseServi
import com.freemud.sdk.api.assortment.shoppingcart.util.CartResponseUtil;
import com.freemud.sdk.api.assortment.shoppingcart.util.DateTimeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
......@@ -43,6 +44,12 @@ public class CollageOrderBaseServiceImpl implements CollageOrderBaseService {
@Autowired
private RedisTemplate redisTemplate;
@Value("${collage.complete.delay.minute}")
private int completeDelayMinute = 1;
@Value("${collage.cancel.delay.minute}")
private int cancelDelayMinute = 1;
/**
* 查询拼单订单
* 根据createCollageUserId查询,先根据key查询,若不存在去商户旗下拼单列表查询,若存在则返回
......@@ -192,11 +199,11 @@ public class CollageOrderBaseServiceImpl implements CollageOrderBaseService {
// 获取当前拼单剩余缓存时间
long expireSeconds = this.getCollageBashHashExpireSeconds(collageBaseHashKey);
// 若状态更新为已完成 则将失效时间改为5分钟
// 若状态更新为已完成 则将失效时间改为N分钟
if (CollageOrderStatus.COMPLETE.getValue().equals(collageOrderDto.getStatus())) {
expireSeconds = 1 * 60L;
expireSeconds = completeDelayMinute * 60L;
} else if (CollageOrderStatus.CANCEL.getValue().equals(collageOrderDto.getStatus())) {
expireSeconds = 1 * 60L;
expireSeconds = cancelDelayMinute * 60L;
}
// 修改拼单主信息失效时间
......
......@@ -143,6 +143,7 @@ import com.freemud.sdk.api.assortment.payment.service.StandardPaymentService;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.gson.Gson;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.ObjectUtils;
......@@ -1894,6 +1895,7 @@ public class OrderServiceImpl implements Orderservice {
* @param orderRefundVo
* @param orderBean
*/
@SneakyThrows
private BaseResponse partnerNoTakeOrder(OrderRefundVo orderRefundVo, OrderBean orderBean, String fatherOrderId, AfterSalesType afterSalesType, Boolean isRefundDeliveryFee) {
com.freemud.application.sdk.api.base.BaseResponse<OrderRefundResponse> response = null;
Long refundId = System.currentTimeMillis();
......
package cn.freemud.management.adapter;
import com.alibaba.fastjson.JSONObject;
import com.freemud.application.sdk.api.base.SDKCommonBaseContextWare;
import com.freemud.application.sdk.api.ordercenter.request.OrderExtInfoDto;
import com.freemud.sdk.api.assortment.order.request.order.MultiOrderRefundRequest;
import com.freemud.sdk.api.assortment.order.response.order.QueryOrdersResponse;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
......@@ -43,6 +43,7 @@ public class PaymentSdkAdapter {
return refundRequestDTO;
}
@SneakyThrows
public MultiOrderRefundRequest getMultiOrderPayRefundRequest(QueryOrdersResponse.DataBean.OrderBean orderBean, BigDecimal refundAmount) {
MultiOrderRefundRequest multiQueryRequest = new MultiOrderRefundRequest();
multiQueryRequest.setStationId("1");
......@@ -50,7 +51,7 @@ public class PaymentSdkAdapter {
multiQueryRequest.setStoreId(orderBean.getShopId());
multiQueryRequest.setFmId("");
multiQueryRequest.setRefundAmount(Long.valueOf(String.valueOf(refundAmount)));
multiQueryRequest.setRefundTradeNo(getRefundSerialNo().toString());
multiQueryRequest.setRefundTradeNo(String.valueOf(getRefundSerialNo()));
multiQueryRequest.setStoreId(orderBean.getShopId());
multiQueryRequest.setNotifyUrl(refundNotifyCallback);
multiQueryRequest.setVer("V1");
......
......@@ -31,6 +31,9 @@
| 1.3.16.RELEASE | 麦咖啡多规格 | 徐康 | 2020-10-09 |
| 1.3.17.RELEASE | 集点推送改造 | 梁崇福 | 2020-10-28 |
| 1.3.18.RELEASE | 麦咖啡加料 | 徐康 | 2020-10-30 |
| 1.3.20.RELEASE | 麦咖啡权益卡金额入机 | 徐康 | 2020-11-23 |
| 1.3.21.RELEASE | 混支付 | 徐康 | 2020-11-26 |
| 1.3.22.RELEASE | 农工商撤单 | 张志恒 | 2020-12-07 |
| 1.6.3-SNAPSHOT | Add#PayChannelType | lixiaoer | 2020-11-09 |
| 1.6.4-SNAPSHOT | 麦咖啡买三赠一 | 徐康 | 2020-11-16 |
| 1.6.5-SNAPSHOT | 混合支付 | 徐康 | 2020-11-16 |
......
......@@ -127,6 +127,21 @@ public class ShoppingCartCollageResponseVo extends ShoppingCartGoodsBaseResponse
private Integer deliveryFeeZeroReason;
/**
* 代金券
*/
private String couponCode;
/**
* 运费券
*/
private String freightCouponCode;
/**
* svc卡支付金额
*/
private String svcPayAmount;
/**
* 购物车版本号
*/
private Integer carVer;
......
......@@ -144,14 +144,14 @@ public class ShoppingCartGoodsResponseVo extends ShoppingCartGoodsBaseResponseV
*/
private Long payCardFee;
/**
* 购物车版本号
* svc卡支付金额
*/
private Integer carVer;
private String svcPayAmount;
/**
* 支付金额
* 购物车版本号
*/
private Integer svcPayAmount;
private Integer carVer;
/**
* 总的优惠信息集合
......
......@@ -17,6 +17,7 @@ import cn.freemud.interceptor.ServiceException;
import cn.freemud.redis.RedisCache;
import cn.freemud.service.*;
import cn.freemud.service.thirdparty.ActivityClient;
import cn.freemud.service.thirdparty.SvcComPayClient;
import cn.freemud.utils.PropertyConvertUtil;
import cn.freemud.utils.RedisLock;
import cn.freemud.utils.ResponseUtil;
......@@ -103,6 +104,9 @@ public class ShoppingCartCollageServiceImpl extends AbstractShoppingCartImpl imp
@Autowired
private PaymentNewService paymentNewService;
@Autowired
private SvcComPayClient svcComPayClient;
@Override
public BaseResponse addGoodsByCard(AddGoodsByWeixinCardRequestVo request) {
......@@ -1261,20 +1265,73 @@ public class ShoppingCartCollageServiceImpl extends AbstractShoppingCartImpl imp
if (response.getData() == null || response.getData().getData() == null || response.getData().getData().getCardSimpleInfos().size() > 1) {
throw new ServiceException(ResponseResult.USER_SVC_CARD_ERROR);
}
//获取实际配送费
if (StringUtils.isNotBlank(receiveId) && shoppingCartGoodsResponseVo.getDiscountDeliveryAmount() != null) {
// Integer deliveryAmount = getDeliveryAmount(receiveId, partnerId, storeId);
Integer deliveryAmount = shoppingCartGoodsResponseVo.getDiscountDeliveryAmount().intValue();
orderAmount += deliveryAmount;
}
Integer amount1 = response.getData().getData().getCardSimpleInfos().get(0).getAmount();
Integer vamount = response.getData().getData().getCardSimpleInfos().get(0).getVamount();
if (orderAmount > amount1 + vamount) {
throw new ServiceException(ResponseResult.USER_SVC_CARD_AMOUNT_DEFICIENCY);
}
BigDecimal bigDecimal = new BigDecimal(orderAmount);
String amountStr = bigDecimal.divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP).toString();
shoppingCartGoodsResponseVo.setTotalAmount(0L);
shoppingCartGoodsResponseVo.setSvcDiscountDesc("储值卡支付¥" + amountStr);
boolean check = this.checkSvcComPay(partnerId, storeId);
if (check) {
//混合支付无需校验svc卡余额,但是配送和包装费不计算在svc卡支付
Integer amount1 = response.getData().getData().getCardSimpleInfos().get(0).getAmount();
Integer vamount = response.getData().getData().getCardSimpleInfos().get(0).getVamount();
Integer svcTotalAmount = amount1+vamount;
//获取实际配送费
Integer deliveryAmount = 0;
Integer svcPayAmount = 0;
if (StringUtils.isNotBlank(receiveId) && shoppingCartGoodsResponseVo.getDiscountDeliveryAmount() != null) {
//Integer deliveryAmount = getDeliveryAmount(receiveId, partnerId, storeId);
deliveryAmount = shoppingCartGoodsResponseVo.getDiscountDeliveryAmount().intValue();
orderAmount += deliveryAmount;
}
if (svcTotalAmount>0 && svcTotalAmount>orderAmount) {
svcPayAmount = orderAmount;
shoppingCartGoodsResponseVo.setTotalAmount(0L);
}
else if (svcTotalAmount>0 && svcTotalAmount<=orderAmount) {
svcPayAmount = svcTotalAmount;
shoppingCartGoodsResponseVo.setTotalAmount((orderAmount.longValue()-svcPayAmount.longValue()));
}
BigDecimal bigDecimal = new BigDecimal(svcPayAmount);
String amountStr = bigDecimal.divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP).toString();
shoppingCartGoodsResponseVo.setSvcPayAmount(amountStr);
shoppingCartGoodsResponseVo.setSvcDiscountDesc("储值卡支付¥" + amountStr);
}
else {
//获取实际配送费
if (StringUtils.isNotBlank(receiveId) && shoppingCartGoodsResponseVo.getDiscountDeliveryAmount() != null) {
Integer deliveryAmount = shoppingCartGoodsResponseVo.getDiscountDeliveryAmount().intValue();
orderAmount += deliveryAmount;
}
Integer amount1 = response.getData().getData().getCardSimpleInfos().get(0).getAmount();
Integer vamount = response.getData().getData().getCardSimpleInfos().get(0).getVamount();
if (orderAmount > amount1 + vamount) {
throw new ServiceException(ResponseResult.USER_SVC_CARD_AMOUNT_DEFICIENCY);
}
BigDecimal bigDecimal = new BigDecimal(orderAmount);
String amountStr = bigDecimal.divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP).toString();
shoppingCartGoodsResponseVo.setTotalAmount(0L);
shoppingCartGoodsResponseVo.setSvcDiscountDesc("储值卡支付¥" + amountStr);
}
}
/**
* 获取混合支付是否开启
* @param partnerId
* @return
*/
private boolean checkSvcComPay(String partnerId,String storeId) {
SvcComPayRequestDto requestDto = new SvcComPayRequestDto();
requestDto.setPartnerId(partnerId);
requestDto.setStoreId(storeId);
SvcComPayResponseDto query = null;
for (int i=0;i<3;i++) {
query = svcComPayClient.query(requestDto);
if (query!=null) break;
}
if (query==null || !ResponseResult.SUCCESS.getCode().equals(query.getCode())) {
return false;
}
if (query.getResult()!=null && query.getResult().getValue()) {
return true;
}
else {
return false;
}
}
}
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