Commit f4fe53dd by ping.wu

Merge branches 'develop' and 'feature/20200522_买券订单创建_wuping' of…

Merge branches 'develop' and 'feature/20200522_买券订单创建_wuping' of http://gitlab.freemud.com/order-group-application/order-group into develop
parents 79f5b505 afd126bb
......@@ -51,4 +51,9 @@ public class OrderProductAddInfoDto extends BaseConfig {
/** 是否主食 **/
private Integer stapleFood;
/**
* 商品绑定的券活动(买券虚拟订单才有)
*/
private List<ProductBindingCouponType> productBindingCoupons;
}
package com.freemud.sdk.api.assortment.order.request.order;
import lombok.Data;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @version V1.0
* @Title: ProductBindingCouponType
* @Package com.freemud.sdk.api.assortment.order.request.order
* @Description:
* @author: ping1.wu
* @date: 2020/5/26 14:26
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
public class ProductBindingCouponType {
/**
* 优惠券CODE
*/
private String activityCode;
/**
* 数量
*/
private int num;
/**
* 排序
*/
private int sequence;
}
......@@ -56,7 +56,7 @@ public class SellCouponCreateOrderVo {
/**
* 版本号
*/
@NotEmpty(message = "version 版本号不能为空")
// @NotEmpty(message = "version 版本号不能为空")
private String version;
}
......@@ -77,6 +77,8 @@ public class OrderAdapterServiceImpl implements OrderAdapterService {
private OrderAdapter orderAdapter;
@Autowired
private OrderCommonService orderCommonService;
@Autowired
private SellCouponOrderServiceImpl sellCouponOrderService;
@Override
......@@ -184,6 +186,10 @@ public class OrderAdapterServiceImpl implements OrderAdapterService {
if(OrderSourceType.APP.getCode().equals(orderBean.getSource())) {
return appOrderService.paySuccessCallback(message, confirmOrderDto, orderBeans);
}
//买券虚拟订单
if(orderBean.getBizType() == 6) {
return sellCouponOrderService.paySuccessCallback(message, confirmOrderDto, orderBeans);
}
/**
* 默认点餐处理
*/
......
......@@ -3,8 +3,12 @@ package cn.freemud.service.impl;
import cn.freemud.adapter.OrderAdapter;
import cn.freemud.base.entity.BaseResponse;
import cn.freemud.base.util.DateUtil;
import cn.freemud.entities.dto.ConfirmOrderDto;
import cn.freemud.entities.dto.QueryOrdersResponseDto;
import cn.freemud.entities.dto.order.CreatePrepayRequestDto;
import cn.freemud.entities.vo.PaysuccessNoticeMessage;
import cn.freemud.entities.vo.SellCouponCreateOrderVo;
import cn.freemud.enums.OrderBeanType;
import cn.freemud.enums.ResponseResult;
import cn.freemud.enums.UserLoginChannelEnum;
import cn.freemud.interceptor.ServiceException;
......@@ -24,8 +28,10 @@ import com.freemud.application.sdk.api.couponcenter.online.response.CouponDetail
import com.freemud.application.sdk.api.couponcenter.online.service.FMActiveSdkService;
import com.freemud.application.sdk.api.couponcenter.online.service.OnlineCouponSdkService;
import com.freemud.application.sdk.api.log.LogThreadLocal;
import com.freemud.application.sdk.api.ordercenter.enums.NewOrderStatus;
import com.freemud.application.sdk.api.ordercenter.enums.OrderClientType;
import com.freemud.application.sdk.api.ordercenter.enums.OrderType;
import com.freemud.application.sdk.api.ordercenter.request.OrderChangeStateReq;
import com.freemud.application.sdk.api.ordercenter.request.OrderExtInfoDto;
import com.freemud.application.sdk.api.ordercenter.request.create.*;
import com.freemud.application.sdk.api.ordercenter.response.orderInfo.OrderInfoReqs;
......@@ -39,8 +45,11 @@ 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.OrderProductAddInfoDto;
import com.freemud.sdk.api.assortment.order.request.order.ProductBindingCouponType;
import com.freemud.sdk.api.assortment.order.response.order.CreateOrderResponse;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
......@@ -69,21 +78,16 @@ public class SellCouponOrderServiceImpl {
@Autowired
private CheckOrder checkOrder;
@Autowired
private MenuService menuService;
@Autowired
private OrderSdkService orderSdkService;
@Autowired
private OrderServiceImpl orderservice;
@Autowired
private StoreCenterService storeCenterService;
@Autowired
private OrderAdapter orderAdapter;
@Autowired
private OrderSdkAdapter orderSdkAdapter;
......@@ -93,7 +97,7 @@ public class SellCouponOrderServiceImpl {
@Value("${coupon.app.id}")
private String appId;
String SUCCESS = "100";
private final String SUCCESS = "100";
/**
* 卖券订单创建
......@@ -136,10 +140,16 @@ public class SellCouponOrderServiceImpl {
}
List<ActiveDetailVO> activeDetailVOS = batchQueryActivityInfo(partnerId, activityCodes, trackingNo);
if(activeDetailVOS == null){
return ResponseUtil.error(ResponseResult.STORE_ITEM_CHECK_INVAILD);
}
CreateOrderRequest createOrderRequest = convent2NEWCreateOrderRequest(requestVo,userLoginInfoDto,productInfosByIds.getData(),activeDetailVOS,storeResponse.getBizVO());
com.freemud.application.sdk.api.ordercenter.response.BaseResponse<OrderInfoReqs> orderInfoReqsBaseResponse = orderSdkService.createOrder(createOrderRequest, trackingNo);
CreateOrderResponse createOrderResponse = orderSdkAdapter.convent2NEWOrderInfoReqs(orderInfoReqsBaseResponse);
if(createOrderResponse == null || createOrderResponse.getErrcode() != 100){
return ResponseUtil.error(ResponseResult.ORDER_CREATE_ERROR);
}
//创建支付
CreatePrepayRequestDto createPrepayRequestDto = new CreatePrepayRequestDto();
createPrepayRequestDto.setPartnerId(partnerId);
......@@ -155,8 +165,6 @@ public class SellCouponOrderServiceImpl {
createPrepayRequestDto.setCardAmount(0);
OrderExtInfoDto orderExtInfoDto = new OrderExtInfoDto();
String deliveryHoursDayStart = "";
String deliveryHoursDayEnd = "";
if (StringUtils.isNotBlank(storeResponseDto.getDeliveryHoursDay())) {
......@@ -314,9 +322,17 @@ public class SellCouponOrderServiceImpl {
orderItemCreateReq.setThirdProductId(productBean.getCustomerCode());
orderItemCreateReq.setProductQuantity(1);
Map<String,List<GetMenuCategoryInfoResponse.RootNodeBean.ChildrenBeanFirst.ChildrenBeanSecond.ProductBean.ProductBindingCouponType>> map = new HashMap<>();
map.put("productBindingCoupons",productBean.getProductBindingCouponTypes());
orderItemCreateReq.setExtInfo(JSONObject.toJSONString(map));
OrderProductAddInfoDto orderProductAddInfoDto = new OrderProductAddInfoDto();
List<ProductBindingCouponType> productBindingCoupons = new ArrayList<>();
for (GetMenuCategoryInfoResponse.RootNodeBean.ChildrenBeanFirst.ChildrenBeanSecond.ProductBean.ProductBindingCouponType productBindingCouponType : productBean.getProductBindingCouponTypes()){
ProductBindingCouponType productBindingCouponType2 = new ProductBindingCouponType();
productBindingCouponType2.setActivityCode(productBindingCouponType.getActivityCode());
productBindingCouponType2.setNum(productBindingCouponType.getNum());
productBindingCouponType2.setSequence(productBindingCouponType.getSequence());
productBindingCoupons.add(productBindingCouponType2);
}
orderProductAddInfoDto.setProductBindingCoupons(productBindingCoupons);
orderItemCreateReq.setExtInfo(JSONObject.toJSONString(orderProductAddInfoDto));
orderItemList.add(orderItemCreateReq);
//商品信息赋值
......@@ -348,6 +364,31 @@ public class SellCouponOrderServiceImpl {
/**
*
* @param message
* @param confirmOrderDto
* @param orderBeans
* @return
*/
public String paySuccessCallback(PaysuccessNoticeMessage message, ConfirmOrderDto confirmOrderDto, Map<String, QueryOrdersResponseDto.DataBean.OrderBean> orderBeans) {
QueryOrdersResponseDto.DataBean.OrderBean orderBean = orderBeans.get(OrderBeanType.SAASORDER.getCode());
OrderChangeStateReq request = new OrderChangeStateReq();
request.setOrderCode(orderBean.getOid());
request.setOrderState(NewOrderStatus.COMPLETE.getIndex());
request.setOperator(orderBean.getUserName());
request.setRemark("已完成");
com.freemud.application.sdk.api.ordercenter.response.BaseResponse updateOrderStateResp = orderSdkService.updateOrderState(request, LogThreadLocal.getTrackingNo());
orderSdkAdapter.convent2BaseOrderResponse(updateOrderStateResp);
Map<String, Object> map = Maps.newTreeMap();
map.put("code", 100);
map.put("message", "success");
return JSONObject.toJSONString(map);
}
/**
* 查询券详情
*
* @param partnerId
......
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