Authored by Lixiaodi

页码默认值

... ... @@ -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;
... ... @@ -32,7 +33,7 @@ public class DepositController {
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();
}
... ... @@ -47,7 +48,7 @@ public class DepositController {
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();
}
... ... @@ -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);
... ...
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) {
... ...