...
|
...
|
@@ -2,12 +2,14 @@ package com.yohoufo.order.controller; |
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.yohoufo.common.ApiResponse;
|
|
|
import com.yohoufo.order.constants.ActivityTypeEnum;
|
|
|
import com.yohoufo.order.annotation.BlackUserType;
|
|
|
import com.yohoufo.order.common.BlackTypeEnum;
|
|
|
import com.yohoufo.order.constants.CouponConstants;
|
|
|
import com.yohoufo.order.model.request.ShoppingRequest;
|
|
|
import com.yohoufo.order.model.response.*;
|
|
|
import com.yohoufo.order.service.IBuyerOrderService;
|
|
|
import com.yohoufo.order.service.IShoppingService;
|
|
|
import com.yohoufo.order.service.impl.SellerOrderService;
|
|
|
import com.yohoufo.order.service.impl.SellerOrderViewService;
|
|
|
import com.yohoufo.order.utils.CouponCodeUtils;
|
|
|
import com.yohoufo.order.utils.LoggerUtils;
|
...
|
...
|
@@ -41,10 +43,17 @@ public class ShoppingController { |
|
|
@RequestMapping(params = "method=ufo.order.payment")
|
|
|
public ApiResponse payment(@RequestParam(name = "uid") int uid,
|
|
|
@RequestParam(name = "skup") int skup,
|
|
|
@RequestParam(name = "user_activity_id", required = false, defaultValue = "0") int userActivityId,
|
|
|
@RequestParam(name = "activity_type", required = false, defaultValue = "0") int activityType,
|
|
|
@RequestParam(value = "app_version", required = false)String appVersion){
|
|
|
|
|
|
//活动类型
|
|
|
ActivityTypeEnum activityTypeEnum = ActivityTypeEnum.find(activityType);
|
|
|
|
|
|
//AUTO 自动匹配
|
|
|
ShoppingRequest req = ShoppingRequest.builder().uid(uid).skup(skup)
|
|
|
.couponCodes(CouponConstants.AUTO_RECOMMENDED_COUPON_CODES)
|
|
|
.couponCodes(activityTypeEnum.isCouponFlag() ? CouponConstants.AUTO_RECOMMENDED_COUPON_CODES : null)
|
|
|
.userActivityId(userActivityId).activityType(activityTypeEnum)
|
|
|
.appVersion(appVersion).build();
|
|
|
logger.info("in ufo.order.payment, req {}", req);
|
|
|
PaymentResponse paymentResponse = buyerOrderService.payment(req);
|
...
|
...
|
@@ -80,12 +89,18 @@ public class ShoppingController { |
|
|
@RequestParam(name = "skup") int skup,
|
|
|
@RequestParam(name = "coupon_code",required = false) String couponCode,
|
|
|
@RequestParam(name = "addressId", required = false) String addressId,
|
|
|
@RequestParam(name = "user_activity_id", required = false, defaultValue = "0") int userActivityId,
|
|
|
@RequestParam(name = "activity_type", required = false, defaultValue = "0") int activityType,
|
|
|
@RequestParam(value = "app_version", required = false)String appVersion) {
|
|
|
|
|
|
//活动类型
|
|
|
ActivityTypeEnum activityTypeEnum = ActivityTypeEnum.find(activityType);
|
|
|
|
|
|
ShoppingRequest req = ShoppingRequest.builder().uid(uid)
|
|
|
.skup(skup)
|
|
|
.couponCodes(CouponCodeUtils.asList(couponCode))
|
|
|
.couponCodes(activityTypeEnum.isCouponFlag() ? CouponCodeUtils.asList(couponCode) : null)
|
|
|
.addressId(addressId)
|
|
|
.userActivityId(userActivityId).activityType(activityTypeEnum)
|
|
|
.appVersion(appVersion)
|
|
|
.build();
|
|
|
logger.info("in ufo.order.compute, req {}", req);
|
...
|
...
|
@@ -99,16 +114,27 @@ public class ShoppingController { |
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(params = "method=ufo.order.submit")
|
|
|
@BlackUserType(blackType = BlackTypeEnum.BUY)
|
|
|
public ApiResponse submit(@RequestParam(name = "uid") int uid,
|
|
|
@RequestParam(name = "skup") int skup,
|
|
|
@RequestParam(name = "coupon_code",required = false) String couponCode,
|
|
|
@RequestParam(name = "channelNo", required = false) String channelNo,
|
|
|
@RequestParam(name = "addressId") String addressId,
|
|
|
@RequestParam(name = "user_activity_id", required = false, defaultValue = "0") int userActivityId,
|
|
|
@RequestParam(name = "activity_type", required = false, defaultValue = "0") int activityType,
|
|
|
@RequestParam(name = "client_type", required = false) String clientType){
|
|
|
if(StringUtils.isBlank(channelNo)){
|
|
|
channelNo = "2919";
|
|
|
}
|
|
|
ShoppingRequest request = ShoppingRequest.builder().uid(uid).skup(skup).couponCodes(CouponCodeUtils.asList(couponCode)).channelNo(channelNo).clientType(clientType).addressId(addressId).build();
|
|
|
|
|
|
//活动类型
|
|
|
ActivityTypeEnum activityTypeEnum = ActivityTypeEnum.find(activityType);
|
|
|
|
|
|
ShoppingRequest request = ShoppingRequest.builder().uid(uid).skup(skup)
|
|
|
.couponCodes(activityTypeEnum.isCouponFlag() ? CouponCodeUtils.asList(couponCode) : null)
|
|
|
.channelNo(channelNo).clientType(clientType).addressId(addressId)
|
|
|
.userActivityId(userActivityId).activityType(activityTypeEnum)
|
|
|
.build();
|
|
|
logger.info("in ufo.order.submit, req {}", request);
|
|
|
OrderSubmitResponse submitResponse = buyerOrderService.submit(request);
|
|
|
logger.info("out ufo.order.submit,resp:{}", submitResponse);
|
...
|
...
|
@@ -131,4 +157,4 @@ public class ShoppingController { |
|
|
|
|
|
return new ApiResponse.ApiResponseBuilder().code(200).data(Lists.newArrayList(orderSummaryResp1, orderSummaryResp2)).message("查询成功").build();
|
|
|
}
|
|
|
} |
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|