Commit b5dbad42 by ping.wu

买券下单支付成功调整

parent afd126bb
......@@ -22,6 +22,8 @@ public class ProductBindingCouponType {
*/
private String activityCode;
private String activityName;
/**
* 数量
*/
......@@ -30,6 +32,6 @@ public class ProductBindingCouponType {
/**
* 排序
*/
private int sequence;
// private int sequence;
}
......@@ -1051,6 +1051,11 @@ public class OrderAdapter {
if (OrderStatus.TAKE_ORDER.getCode().equals(ordersBean.getStatus()) && PayStatus.HAVE_PAID.getCode().equals(ordersBean.getPayStatus())) {
responseVo.setEnableRefund(true);
}
responseVo.setBizType(ordersBean.getBizType());
//6:卖券虚拟商品 暂不能申请退款
if(ordersBean.getBizType() == 6){
responseVo.setButtonRefund(false);
}
List<Integer> enableRefundCodes = Lists.newArrayList(Arrays.asList(
OrderStatus.RECEIPT.getCode(), OrderStatus.COMPLETE_MAKE.getCode()));
if (enableRefundCodes.contains(ordersBean.getStatus()) && PayStatus.HAVE_PAID.getCode().equals(ordersBean.getPayStatus())) {
......@@ -1643,13 +1648,27 @@ public class OrderAdapter {
productVo.setSequence(productBean.getSequence());
productVo.setQty(productBean.getNumber());
productVo.setSpecification("");
List<InventedParentActivityVo> inventedParentActivityVos = new ArrayList<>();
String attributeNames = "";
if (StringUtils.isNotBlank(productBean.getAddInfo()) && productBean.getAddInfo().contains("attributeNames")) {
if (StringUtils.isNotBlank(productBean.getAddInfo())) {
OrderProductAddInfo orderProductAddInfo = gson.fromJson(productBean.getAddInfo(), OrderProductAddInfo.class);
if(productBean.getAddInfo().contains("attributeNames")){
attributeNames = orderProductAddInfo.getAttributeNames();
productVo.setAttributeNames(attributeNames);
productVo.setSpecification(attributeNames);
}
if(CollectionUtils.isNotEmpty(orderProductAddInfo.getProductBindingCoupons())){
for (ProductBindingCouponType productBindingCouponType : orderProductAddInfo.getProductBindingCoupons()){
InventedParentActivityVo inventedParentActivityVo = new InventedParentActivityVo();
// inventedParentActivityVo.setActivityCode(productBindingCouponType.getActivityCode());
inventedParentActivityVo.setActivityName(productBindingCouponType.getActivityName());
inventedParentActivityVo.setNum(productBindingCouponType.getNum());
inventedParentActivityVos.add(inventedParentActivityVo);
}
productVo.setInventedParentActivitiesVo(inventedParentActivityVos);
}
}
productVo.setOriginalPrice(productBean.getPrice());
productVo.setFinalPrice(productBean.getSalePrice());
productVo.setExtras(shoppingCartAdapter.getExtraName(productBean.getSpecificationName(), attributeNames));
......
package cn.freemud.entities.dto;
import com.freemud.sdk.api.assortment.order.request.order.ProductBindingCouponType;
import lombok.Builder;
import lombok.Data;
import java.util.List;
@Data
@Builder
public class OrderProductAddInfo {
......@@ -16,6 +19,11 @@ public class OrderProductAddInfo {
*/
private ActivityProduct activityProduct;
/**
* 商品绑定的券活动(买券虚拟订单才有)
*/
private List<ProductBindingCouponType> productBindingCoupons;
@Data
@Builder
public static class ActivityProduct {
......
package cn.freemud.entities.vo;
import lombok.Data;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @version V1.0
* @Title: InventedParentActivityVo
* @Package cn.freemud.entities.vo
* @Description:
* @author: ping1.wu
* @date: 2020/5/28 17:01
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
public class InventedParentActivityVo {
// private String activityCode;
private String activityName;
private int num;
}
......@@ -150,4 +150,6 @@ public class ProductVo {
*/
private List<ProductVo> setMealProducts;
private List<InventedParentActivityVo> InventedParentActivitiesVo;
}
......@@ -333,6 +333,11 @@ public class QueryOrderResponseVo {
*/
private String receiveRegion;
/**
* 订单业务类型 1:普通订单 2:虚拟订单 3:会员订单 4:积分商城订单 5:储值卡订单 6:卖券虚拟商品
*/
private Integer bizType;
@Data
public static class OrderStatusFlow {
/**
......
package cn.freemud.service.impl;
import cn.freemud.adapter.LightApplicationConvertToAssortmentSdkAdapter;
import cn.freemud.adapter.OrderAdapter;
import cn.freemud.base.entity.BaseResponse;
import cn.freemud.base.util.DateUtil;
......@@ -13,6 +14,7 @@ import cn.freemud.enums.ResponseResult;
import cn.freemud.enums.UserLoginChannelEnum;
import cn.freemud.interceptor.ServiceException;
import cn.freemud.redis.RedisCache;
import cn.freemud.utils.LogUtil;
import cn.freemud.utils.ResponseUtil;
import com.alibaba.fastjson.JSONObject;
import com.freemud.api.assortment.datamanager.entity.vo.AssortmentCustomerInfoVo;
......@@ -45,9 +47,12 @@ import com.freemud.application.sdk.api.storecenter.request.vo.GetOrgTreeListRequ
import com.freemud.application.sdk.api.storecenter.response.StoreResponse;
import com.freemud.application.sdk.api.storecenter.service.StoreCenterService;
import com.freemud.sdk.api.assortment.order.adapter.OrderSdkAdapter;
import com.freemud.sdk.api.assortment.order.request.order.ConfirmOrderRequest;
import com.freemud.sdk.api.assortment.order.request.order.OrderProductAddInfoDto;
import com.freemud.sdk.api.assortment.order.request.order.ProductBindingCouponType;
import com.freemud.sdk.api.assortment.order.response.order.CreateOrderResponse;
import com.freemud.sdk.api.assortment.order.response.order.PayAccessResponse;
import com.freemud.sdk.api.assortment.order.service.OrderCenterSdkService;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
......@@ -82,6 +87,9 @@ public class SellCouponOrderServiceImpl {
private MenuService menuService;
@Autowired
private OrderSdkService orderSdkService;
//聚合订单服务
@Autowired
private OrderCenterSdkService orderCenterSdkService;
@Autowired
private OrderServiceImpl orderservice;
@Autowired
......@@ -325,11 +333,16 @@ public class SellCouponOrderServiceImpl {
OrderProductAddInfoDto orderProductAddInfoDto = new OrderProductAddInfoDto();
List<ProductBindingCouponType> productBindingCoupons = new ArrayList<>();
for (GetMenuCategoryInfoResponse.RootNodeBean.ChildrenBeanFirst.ChildrenBeanSecond.ProductBean.ProductBindingCouponType productBindingCouponType : productBean.getProductBindingCouponTypes()){
for (ActiveDetailVO activeDetailVO : activeDetailVOS){
if(productBindingCouponType.getActivityCode().equals(activeDetailVO.getActiveCode())){
ProductBindingCouponType productBindingCouponType2 = new ProductBindingCouponType();
productBindingCouponType2.setActivityCode(productBindingCouponType.getActivityCode());
productBindingCouponType2.setActivityName(activeDetailVO.getActiveName());
productBindingCouponType2.setNum(productBindingCouponType.getNum());
productBindingCouponType2.setSequence(productBindingCouponType.getSequence());
productBindingCoupons.add(productBindingCouponType2);
break;
}
}
}
orderProductAddInfoDto.setProductBindingCoupons(productBindingCoupons);
orderItemCreateReq.setExtInfo(JSONObject.toJSONString(orderProductAddInfoDto));
......@@ -372,6 +385,26 @@ public class SellCouponOrderServiceImpl {
*/
public String paySuccessCallback(PaysuccessNoticeMessage message, ConfirmOrderDto confirmOrderDto, Map<String, QueryOrdersResponseDto.DataBean.OrderBean> orderBeans) {
QueryOrdersResponseDto.DataBean.OrderBean orderBean = orderBeans.get(OrderBeanType.SAASORDER.getCode());
ConfirmOrderRequest var1 = LightApplicationConvertToAssortmentSdkAdapter.confirmOrderDtoConvertToConfirmOrderRequest(confirmOrderDto, orderBeans.get(OrderBeanType.MERMBERORDER.getCode()));
var1.setPartnerId(orderBean.getCompanyId());
var1.setStoreId(orderBean.getShopId());
var1.setOrderType(orderBean.getType());
var1.setProductOrderCode(orderBean.getOid());
var1.setPayDate(DateUtil.convert2String(new Date(), "yyyy-MM-dd HH:mm:ss"));
var1.setPayTransId(message.getOut_trade_no());
var1.setOperator(orderBean.getUserName());
var1.setEndTransId(message.getEndTransId());
if(orderBean.getGmtExpect() != null && orderBean.getGmtExpect() != 0){
var1.setExpectTime(DateUtil.convert2String(new Date(orderBean.getGmtExpect()),DateUtil.FORMAT_YYYY_MM_DD_HHMMSS));
}
try {
// 订单支付成功
PayAccessResponse payAccessResponse = orderCenterSdkService.payAccess(var1);
}catch (Exception e){
LogUtil.error(LogThreadLocal.getTrackingNo(),"sdkPayAccessError",JSONObject.toJSONString(var1),null,e);
}
//支付成功直接完成
OrderChangeStateReq request = new OrderChangeStateReq();
request.setOrderCode(orderBean.getOid());
request.setOrderState(NewOrderStatus.COMPLETE.getIndex());
......
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