Authored by mali

Merge branch 'hotfix' into test6.9.9

... ... @@ -22,7 +22,9 @@ import org.springframework.web.bind.annotation.RestController;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
public class DepositController {
... ... @@ -149,4 +151,55 @@ public class DepositController {
depositService.clearCacheByDepositCode(uid, depositCode);
return new ApiResponse(200, "缓存清除成功!", Boolean.TRUE);
}
/**
* 仓库管理详情,几个尺码 几个库存接口
* @param uid
* @param productId
* @return
*/
@RequestMapping(params = "method=ufo.deposit.queryUserDopositProduct")
@Cachable(expire = 180, pageArgs = {2,3})
public ApiResponse queryUserDopositingEx(@RequestParam("uid") Integer uid , @RequestParam("productId") Integer productId) {
LOG.info("method queryUserDopositingEx in, uid is {}, productId is {}", uid, productId);
DepositProductBo countBo = depositService.queryUserDepositProductCountInfo(uid, productId);
Map<String, Object> result = new HashMap<>();
result.put("product", countBo);
LOG.info("end queryUserDopositingEx uid is {}, productId is {} result: {}", uid, productId, result);
return new ApiResponse.ApiResponseBuilder().code(200).data(result).build();
}
/**
* 查询 到期和不到期的 库存
* @param uid
* @param productId
* @param page
* @param limit
* @param sort
* @return
*/
@RequestMapping(params = "method=ufo.deposit.queryUserDopositingSort")
@Cachable(expire = 180, pageArgs = {2,3})
public ApiResponse queryUserDopositingSort(@RequestParam("uid") Integer uid
, @RequestParam("productId") Integer productId
, @RequestParam(value = "page", required = false, defaultValue = "1") Integer page
, @RequestParam(value = "limit", required = false, defaultValue = "10") Integer limit,
@RequestParam(value = "sort") Integer sort ) {
if (uid == null || uid < 1) {
LOG.warn("queryUserDopositing failed, invalid uid: {}", uid);
return new ApiResponse.ApiResponseBuilder().code(500).message("查询失败").build();
}
if (productId == null || productId < 1) {
LOG.warn("queryUserDopositing failed, invalid productId: {}", productId);
return new ApiResponse.ApiResponseBuilder().code(500).message("查询失败").build();
}
PageResp<List<DepositDetailBo>> depositDetailBoList = depositService.queryUserProductDopositingDetail(uid, productId, page, limit);
DepositProductBo countBo = depositService.queryUserDepositProductCountInfo(uid, productId);
JSONObject result = new JSONObject();
result.put("product", countBo);
result.put("items", depositDetailBoList);
LOG.info("queryUserDopositing result: {}", result);
return new ApiResponse.ApiResponseBuilder().code(200).data(result).build();
}
}
... ...
package com.yohoufo.order.service.impl;
import com.yoho.core.dal.datasource.annotation.Database;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.bo.ButtonShowBo;
import com.yohobuy.ufo.model.order.bo.DepositDetailBo;
import com.yohobuy.ufo.model.order.bo.DepositProductBo;
... ... @@ -219,6 +220,9 @@ public class DepositServiceImpl implements DepositService {
}
public DepositProductBo queryUserDepositProductCountInfo(Integer uid, Integer productId) {
checkUid(uid, "queryUserDepositProductCountInfo failed, invalid uid: {}");
checkProductId(productId, "queryUserDepositProductCountInfo failed, invalid productId: {}");
List<StorageDepositCount> countInfoList = storageDepositMapper.queryUserDepositProduct(uid, Arrays.asList(productId));
if (countInfoList.isEmpty()) {
return null;
... ... @@ -237,6 +241,20 @@ public class DepositServiceImpl implements DepositService {
return bo;
}
private void checkProductId(Integer productId, String format) {
if (productId == null || productId < 1) {
LOGGER.warn(format, productId);
throw new UfoServiceException(500, "参数非法");
}
}
private void checkUid(Integer uid, String format) {
if (uid == null || uid < 1) {
LOGGER.warn(format, uid);
throw new UfoServiceException(500, "参数非法");
}
}
// 上架
@Override
... ...