Authored by mali

Merge branch 'test6.9.8' of http://git.yoho.cn/ufo/yohoufo-fore into test6.9.8

... ... @@ -2,11 +2,13 @@ package com.yohoufo.order.charge;
import com.google.common.collect.Lists;
import com.yohobuy.ufo.model.order.constants.RegionEnum;
import com.yohobuy.ufo.model.order.constants.SkupType;
import com.yohobuy.ufo.model.promotion.UserCouponsBo;
import com.yohobuy.ufo.model.promotion.constant.CouponProductLimitTypeEnum;
import com.yohobuy.ufo.model.promotion.constant.CouponUseLimitTypeEnum;
import com.yohoufo.order.charge.model.ChargeGoods;
import com.yohoufo.order.charge.model.CouponMatchResult;
import com.yohoufo.order.utils.BuyerOrderUtils;
import com.yohoufo.order.utils.LoggerUtils;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
... ... @@ -155,13 +157,23 @@ public class CouponRuleMatcher {
@Override
public boolean match(ChargeGoods chargeGoods, UserCouponsBo couponsBo) {
// 闪购寄存不可以用券 TODO 后台可控制
if (chargeGoods.getSkupType() == SkupType.QUICK_DELIVER && chargeGoods.isDepositRequirement()) {
return false;
}
if (couponsBo.getSkupForbidType() == null){
return true;
}
if (Arrays.asList(couponsBo.getSkupForbidType().split(",")).contains(String.valueOf(chargeGoods.getAttributes()))){
return false;
}
return true;
}
}
... ...
... ... @@ -3,6 +3,7 @@ package com.yohoufo.order.controller;
import com.alibaba.fastjson.JSONObject;
import com.yohobuy.ufo.model.order.bo.DepositDetailBo;
import com.yohobuy.ufo.model.order.bo.DepositProductBo;
import com.yohobuy.ufo.model.order.resp.PageResp;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.order.service.DepositService;
import org.slf4j.Logger;
... ... @@ -24,30 +25,30 @@ public class DepositController {
@RequestMapping(params = "method=ufo.deposit.queryUserDoposit")
public ApiResponse queryUserDoposit(@RequestParam("uid") Integer uid
, @RequestParam(value = "limit", required = false) Integer limit
, @RequestParam(value = "page", required = false) Integer page
, @RequestParam(value = "limit", required = false, defaultValue = "10") Integer limit
, @RequestParam(value = "page", required = false, defaultValue = "1") Integer page
) {
if (uid == null || uid < 1) {
LOG.warn("queryUserDoposit failed, invalid uid: {}", uid);
return new ApiResponse.ApiResponseBuilder().code(500).message("查询失败").build();
}
List<DepositProductBo> depositProductBoList = depositService.queryUserDoposit(uid, page, limit);
PageResp<List<DepositProductBo>> depositProductBoList = depositService.queryUserDoposit(uid, page, limit);
LOG.info("queryStoreInfoById result: {}", depositProductBoList);
return new ApiResponse.ApiResponseBuilder().code(200).data(depositProductBoList).build();
}
@RequestMapping(params = "method=ufo.deposit.queryUserDopositBackDetail")
public ApiResponse queryUserDopositBackDetail(@RequestParam("uid") Integer uid
, @RequestParam(value = "limit", required = false) Integer limit
, @RequestParam(value = "page", required = false) Integer page
, @RequestParam(value = "limit", required = false, defaultValue = "10") Integer limit
, @RequestParam(value = "page", required = false, defaultValue = "1") Integer page
) {
if (uid == null || uid < 1) {
LOG.warn("queryUserDopositBackDetail failed, invalid uid: {}", uid);
return new ApiResponse.ApiResponseBuilder().code(500).message("查询失败").build();
}
List<DepositDetailBo> depositDetailBoList = depositService.queryUserDopositBackDetail(uid, page, limit);
PageResp<List<DepositDetailBo>> depositDetailBoList = depositService.queryUserDopositBackDetail(uid, page, limit);
LOG.info("queryUserDopositBackDetail result: {}", depositDetailBoList);
return new ApiResponse.ApiResponseBuilder().code(200).data(depositDetailBoList).build();
}
... ... @@ -55,8 +56,8 @@ public class DepositController {
@RequestMapping(params = "method=ufo.deposit.queryUserDopositing")
public ApiResponse queryUserDopositing(@RequestParam("uid") Integer uid
, @RequestParam("productId") Integer productId
, @RequestParam(value = "limit", required = false) Integer limit
, @RequestParam(value = "page", required = false) Integer page
, @RequestParam(value = "limit", required = false, defaultValue = "10") Integer limit
, @RequestParam(value = "page", required = false, defaultValue = "1") Integer page
) {
if (uid == null || uid < 1) {
LOG.warn("queryUserDopositing failed, invalid uid: {}", uid);
... ... @@ -67,7 +68,7 @@ public class DepositController {
return new ApiResponse.ApiResponseBuilder().code(500).message("查询失败").build();
}
List<DepositDetailBo> depositDetailBoList = depositService.queryUserProductDopositingDetail(uid, productId, page, limit);
PageResp<List<DepositDetailBo>> depositDetailBoList = depositService.queryUserProductDopositingDetail(uid, productId, page, limit);
DepositProductBo countBo = depositService.queryUserDepositProductCountInfo(uid, productId);
JSONObject result = new JSONObject();
result.put("product", countBo);
... ...
... ... @@ -4,6 +4,7 @@ package com.yohoufo.order.service;
import com.yohobuy.ufo.model.order.bo.DepositDetailBo;
import com.yohobuy.ufo.model.order.bo.DepositProductBo;
import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum;
import com.yohobuy.ufo.model.order.resp.PageResp;
import com.yohoufo.common.exception.UfoServiceException;
import com.yohoufo.dal.order.model.StorageDeposit;
... ... @@ -12,11 +13,11 @@ import java.util.List;
public interface DepositService {
List<DepositProductBo> queryUserDoposit(Integer uid, Integer page, Integer limit);
PageResp<List<DepositProductBo>> queryUserDoposit(Integer uid, Integer page, Integer limit);
List<DepositDetailBo> queryUserDopositBackDetail(Integer uid, Integer page, Integer limit);
PageResp<List<DepositDetailBo>> queryUserDopositBackDetail(Integer uid, Integer page, Integer limit);
List<DepositDetailBo> queryUserProductDopositingDetail(Integer uid, Integer productId, Integer page, Integer limit);
PageResp<List<DepositDetailBo>> queryUserProductDopositingDetail(Integer uid, Integer productId, Integer page, Integer limit);
DepositProductBo queryUserDepositProductCountInfo(Integer uid, Integer productId);
... ...
... ... @@ -207,7 +207,7 @@ public class AppraiseService {
throw new ServiceException(ServiceError.ORDER_NULL);
}
// 寄存订单
if(BuyerOrderUtils.isDeposit(buyerOrder.getAttributes())){
if(BuyerOrderUtils.isDeposit(buyerOrder)){
deliveryDepositGoodsToBuyer(appraiseExpressInfoBo, buyerOrder);
} else {
deliveryNonDepositGoodsToBuyer(appraiseExpressInfoBo, buyerOrder);
... ... @@ -1175,7 +1175,7 @@ public class AppraiseService {
throw new ServiceException(ServiceError.ORDER_NULL);
}
final OrderStatus expectOrderStatus = OrderStatus.PLATFORM_RECEIVE;
final OrderStatus targetOrderStatus = OrderStatus.JUDGE_PASS;
final OrderStatus targetOrderStatus = BuyerOrderUtils.isDeposit(buyerOrder) ? OrderStatus.JUDGE_PASS_WAIT_WAREHOUSE : OrderStatus.JUDGE_PASS;
if (buyerOrder.getStatus() != expectOrderStatus.getCode()) {
LOGGER.warn("in judgeCenterPass, buyer Order orderCode {} status {}, expect Order Status is {} ", expectOrderStatus,
... ...
package com.yohoufo.order.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.yohobuy.ufo.model.order.bo.ButtonShowBo;
import com.yohobuy.ufo.model.order.bo.DepositDetailBo;
import com.yohobuy.ufo.model.order.bo.DepositProductBo;
import com.yohobuy.ufo.model.order.resp.PageResp;
import com.yohoufo.common.exception.UfoServiceException;
import com.yohoufo.dal.order.SellerOrderGoodsMapper;
import com.yohoufo.dal.order.StorageDepositMapper;
... ... @@ -43,10 +45,10 @@ public class DepositServiceImpl implements DepositService {
@Override
public List<DepositProductBo> queryUserDoposit(Integer uid, Integer page, Integer limit) {
public PageResp<List<DepositProductBo>> queryUserDoposit(Integer uid, Integer page, Integer limit) {
int count = storageDepositMapper.queryUserDepositProductCount(uid);
if (count == 0) {
return new ArrayList<>();
return new PageResp<>();
}
List<Integer> productIdList = storageDepositMapper.queryUserDepositProductId(uid, (page - 1) * limit, limit);
LOGGER.info("productIdList is {}", productIdList);
... ... @@ -75,14 +77,20 @@ public class DepositServiceImpl implements DepositService {
}
result.add(bo);
}
return result;
PageResp resp = new PageResp();
resp.setData(result);
resp.setPage(page);
resp.setPageSize(limit);
resp.setPagetotal((int) Math.ceil(count * 1.0 / limit));
resp.setTotal(count);
return resp;
}
@Override
public List<DepositDetailBo> queryUserDopositBackDetail(Integer uid, Integer page, Integer limit) {
public PageResp<List<DepositDetailBo>> queryUserDopositBackDetail(Integer uid, Integer page, Integer limit) {
int count = storageDepositMapper.queryUserDopositBackCount(uid);
if (count == 0) {
return new ArrayList<>();
return new PageResp<>();
}
// 召回或者到期退回的
List<StorageDeposit> depositList = storageDepositMapper.queryUserDopositBack(uid, (page - 1) * limit, limit);
... ... @@ -105,15 +113,21 @@ public class DepositServiceImpl implements DepositService {
bo.setButtons(Arrays.asList(ButtonShowBo.detail()));
result.add(bo);
}
return result;
PageResp resp = new PageResp();
resp.setData(result);
resp.setPage(page);
resp.setPageSize(limit);
resp.setPagetotal((int) Math.ceil(count * 1.0 / limit));
resp.setTotal(count);
return resp;
}
// 寄存中
@Override
public List<DepositDetailBo> queryUserProductDopositingDetail(Integer uid, Integer productId, Integer page, Integer limit) {
public PageResp<List<DepositDetailBo>> queryUserProductDopositingDetail(Integer uid, Integer productId, Integer page, Integer limit) {
int count = storageDepositMapper.queryUserProductDopositingCount(uid, productId);
if (count == 0) {
return new ArrayList<>();
return new PageResp<>();
}
List<StorageDeposit> depositList = storageDepositMapper.queryUserProductDopositing(uid, productId, (page - 1) * limit, limit);
List<Integer> skupList = depositList.stream().map(StorageDeposit::getSkup).collect(Collectors.toList());
... ... @@ -140,7 +154,13 @@ public class DepositServiceImpl implements DepositService {
bo.setButtons(Arrays.asList(ButtonShowBo.back(), ButtonShowBo.addDepositDays(), depo.getOrderStatus() == 0 ? ButtonShowBo.grounding() : ButtonShowBo.detail("详情")));
result.add(bo);
}
return result;
PageResp resp = new PageResp();
resp.setData(result);
resp.setPage(page);
resp.setPageSize(limit);
resp.setPagetotal((int) Math.ceil(count * 1.0 / limit));
resp.setTotal(count);
return resp;
}
public DepositProductBo queryUserDepositProductCountInfo(Integer uid, Integer productId) {
... ...
... ... @@ -3,6 +3,7 @@ package com.yohoufo.order.utils;
import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohobuy.ufo.model.order.common.OrderAttributes;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohoufo.dal.order.model.BuyerOrder;
public class BuyerOrderUtils {
... ... @@ -49,4 +50,11 @@ public class BuyerOrderUtils {
public static boolean isDeposit(Integer attributes) {
return OrderAttributes.getOrderAttributes(attributes) == OrderAttributes.DEPOSITE;
}
/**
* 是否寄存订单
*/
public static boolean isDeposit(BuyerOrder buyerOrder) {
return isDeposit(buyerOrder.getAttributes());
}
}
... ...