Authored by chenchao

declare api req and resp

... ... @@ -99,5 +99,9 @@
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.ufo.model</groupId>
<artifactId>promotion-ufo-model</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
... ...
... ... @@ -12,6 +12,7 @@ import com.yohoufo.common.exception.UfoServiceException;
import com.yohoufo.common.utils.BigDecimalHelper;
import com.yohoufo.order.charge.coupon.CouponService;
import com.yohoufo.order.charge.model.*;
import com.yohoufo.order.charge.promotion.PromotionService;
import com.yohoufo.order.service.support.DeliveryWayCostSupport;
import com.yohoufo.order.service.support.ShoppingSupport;
import com.yohoufo.order.utils.LoggerUtils;
... ... @@ -46,6 +47,8 @@ public class ChargeService {
@Autowired
private CouponService couponService;
@Autowired
private PromotionService promotionService;
/**
* 算费
... ... @@ -66,6 +69,8 @@ public class ChargeService {
calculateStorageManagementAmount(chargeContext);
//4.计算优惠券
calculateCouponIfNeed(chargeContext);
//5.calculate promotion
promotionService.caculatePromotions(chargeContext);
}
private void initCharge(ChargeContext chargeContext) {
... ...
package com.yohoufo.order.charge.promotion;
import com.yohoufo.order.charge.ChargeContext;
import org.springframework.stereotype.Service;
@Service
public class PromotionService {
public void caculatePromotions(ChargeContext context){
}
}
... ...
... ... @@ -105,6 +105,7 @@ public class ShoppingController {
@RequestParam(name = "user_activity_id", required = false, defaultValue = "0") int userActivityId,
@RequestParam(name = "activity_type", required = false, defaultValue = "0") int activityType,
@RequestParam(name="depositRequirement", required = false, defaultValue = OrderConstant.N_STR)String depositRequirement,
@RequestParam(name="promotionId", required = false)Integer promotionId,
//接口版本,控制不同的动作
@RequestParam(name = "api_version", required = false, defaultValue = "0") int apiVersion,
@RequestParam(value = "app_version", required = false)String appVersion) {
... ... @@ -120,6 +121,7 @@ public class ShoppingController {
.appVersion(appVersion)
.depositRequirement(depositRequirement)
.apiVersion(apiVersion)
.promotionId(promotionId)
.build();
logger.info("in ufo.order.compute, req {}", req);
ComputeResponse resp = buyerOrderService.compute(req);
... ... @@ -141,6 +143,7 @@ public class ShoppingController {
@RequestParam(name = "user_activity_id", required = false, defaultValue = "0") int userActivityId,
@RequestParam(name = "activity_type", required = false, defaultValue = "0") int activityType,
@RequestParam(name="depositRequirement", required = false, defaultValue = OrderConstant.N_STR)String depositRequirement,
@RequestParam(name="promotionId", required = false)Integer promotionId,
@RequestParam(name = "client_type", required = false) String clientType){
if(StringUtils.isBlank(channelNo)){
channelNo = "2919";
... ... @@ -154,6 +157,7 @@ public class ShoppingController {
.channelNo(channelNo).clientType(clientType).addressId(addressId)
.userActivityId(userActivityId).activityType(activityTypeEnum)
.depositRequirement(depositRequirement)
.promotionId(promotionId)
.build();
logger.info("in ufo.order.submit, req {}", request);
OrderSubmitResponse submitResponse = buyerOrderService.submit(request);
... ... @@ -180,17 +184,18 @@ public class ShoppingController {
/**
* 券列表
*
* 推荐的券列表
* Deprecated from v6.9.11
* @return
*/
@Deprecated
@RequestMapping(params = "method=ufo.order.autoRecommendedCoupon")
public ApiResponse autoRecommendedCoupon(@RequestParam(name = "uid") int uid,
@RequestParam(name = "skup") int skup,
@RequestParam(name = "addressId") String addressId,
@RequestParam(name="depositRequirement", defaultValue = OrderConstant.N_STR)String depositRequirement) {
//活动类型
ActivityTypeEnum activityTypeEnum = ActivityTypeEnum.find(0);
ActivityTypeEnum activityTypeEnum = ActivityTypeEnum.COMMON;
ShoppingRequest req = ShoppingRequest.builder()
.uid(uid).skup(skup)
.userActivityId(0).activityType(activityTypeEnum)
... ...
... ... @@ -71,4 +71,9 @@ public class ShoppingRequest {
* 是否需要寄存
*/
private String depositRequirement;
/**
* 促销
*/
private Integer promotionId;
}
... ...
... ... @@ -22,6 +22,12 @@ public class ComputeResponse {
*/
List<PromotionFormula> promotionFormulaList;
private List<ShoppingCoupon> couponList;
private List<ShoppingPromotion> promotionList;
private ShoppingPromotionTips promotionTips;
/**
* 待支付金额
... ...
... ... @@ -53,6 +53,13 @@ public class PaymentResponse {
String specialTips;
private List<ShoppingCoupon> couponList;
private List<ShoppingPromotion> promotionList;
private ShoppingPromotionTips promotionTips;
@Data
@ToString
public static class PaymentWay{
... ...
package com.yohoufo.order.model.response;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ShoppingPromotion {
private Integer promotionId;
private String promotionName;
private String startTime;
private String endTime;
//是否选中 Y选中
private String selected;
}
... ...
package com.yohoufo.order.model.response;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ShoppingPromotionTips {
private String title;
private String amount;
}
... ...
package com.yohoufo.order.service.proxy;
import com.yohobuy.ufo.model.promotion.response.promotionActivity.PromotionActivityRspBo;
import com.yohoufo.order.utils.LoggerUtils;
import org.slf4j.Logger;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class PromotionProxyService {
private final Logger logger = LoggerUtils.getBuyerOrderLogger();
public List<PromotionActivityRspBo> findUseablePromotions(Integer productId){
logger.info("in PromotionProxyService.findUseablePromotions productId {}", productId);
List<PromotionActivityRspBo> promotions = null;
return promotions;
}
}
... ...