Authored by mali

Merge branch 'hotfix' into test6.9.9

@@ -22,7 +22,9 @@ import org.springframework.web.bind.annotation.RestController; @@ -22,7 +22,9 @@ import org.springframework.web.bind.annotation.RestController;
22 22
23 import java.lang.reflect.Method; 23 import java.lang.reflect.Method;
24 import java.util.Collection; 24 import java.util.Collection;
  25 +import java.util.HashMap;
25 import java.util.List; 26 import java.util.List;
  27 +import java.util.Map;
26 28
27 @RestController 29 @RestController
28 public class DepositController { 30 public class DepositController {
@@ -149,4 +151,55 @@ public class DepositController { @@ -149,4 +151,55 @@ public class DepositController {
149 depositService.clearCacheByDepositCode(uid, depositCode); 151 depositService.clearCacheByDepositCode(uid, depositCode);
150 return new ApiResponse(200, "缓存清除成功!", Boolean.TRUE); 152 return new ApiResponse(200, "缓存清除成功!", Boolean.TRUE);
151 } 153 }
  154 +
  155 + /**
  156 + * 仓库管理详情,几个尺码 几个库存接口
  157 + * @param uid
  158 + * @param productId
  159 + * @return
  160 + */
  161 + @RequestMapping(params = "method=ufo.deposit.queryUserDopositProduct")
  162 + @Cachable(expire = 180, pageArgs = {2,3})
  163 + public ApiResponse queryUserDopositingEx(@RequestParam("uid") Integer uid , @RequestParam("productId") Integer productId) {
  164 + LOG.info("method queryUserDopositingEx in, uid is {}, productId is {}", uid, productId);
  165 + DepositProductBo countBo = depositService.queryUserDepositProductCountInfo(uid, productId);
  166 + Map<String, Object> result = new HashMap<>();
  167 + result.put("product", countBo);
  168 + LOG.info("end queryUserDopositingEx uid is {}, productId is {} result: {}", uid, productId, result);
  169 + return new ApiResponse.ApiResponseBuilder().code(200).data(result).build();
  170 + }
  171 +
  172 + /**
  173 + * 查询 到期和不到期的 库存
  174 + * @param uid
  175 + * @param productId
  176 + * @param page
  177 + * @param limit
  178 + * @param sort
  179 + * @return
  180 + */
  181 + @RequestMapping(params = "method=ufo.deposit.queryUserDopositingSort")
  182 + @Cachable(expire = 180, pageArgs = {2,3})
  183 + public ApiResponse queryUserDopositingSort(@RequestParam("uid") Integer uid
  184 + , @RequestParam("productId") Integer productId
  185 + , @RequestParam(value = "page", required = false, defaultValue = "1") Integer page
  186 + , @RequestParam(value = "limit", required = false, defaultValue = "10") Integer limit,
  187 + @RequestParam(value = "sort") Integer sort ) {
  188 + if (uid == null || uid < 1) {
  189 + LOG.warn("queryUserDopositing failed, invalid uid: {}", uid);
  190 + return new ApiResponse.ApiResponseBuilder().code(500).message("查询失败").build();
  191 + }
  192 + if (productId == null || productId < 1) {
  193 + LOG.warn("queryUserDopositing failed, invalid productId: {}", productId);
  194 + return new ApiResponse.ApiResponseBuilder().code(500).message("查询失败").build();
  195 + }
  196 +
  197 + PageResp<List<DepositDetailBo>> depositDetailBoList = depositService.queryUserProductDopositingDetail(uid, productId, page, limit);
  198 + DepositProductBo countBo = depositService.queryUserDepositProductCountInfo(uid, productId);
  199 + JSONObject result = new JSONObject();
  200 + result.put("product", countBo);
  201 + result.put("items", depositDetailBoList);
  202 + LOG.info("queryUserDopositing result: {}", result);
  203 + return new ApiResponse.ApiResponseBuilder().code(200).data(result).build();
  204 + }
152 } 205 }
1 package com.yohoufo.order.service.impl; 1 package com.yohoufo.order.service.impl;
2 2
3 import com.yoho.core.dal.datasource.annotation.Database; 3 import com.yoho.core.dal.datasource.annotation.Database;
  4 +import com.yoho.error.exception.ServiceException;
4 import com.yohobuy.ufo.model.order.bo.ButtonShowBo; 5 import com.yohobuy.ufo.model.order.bo.ButtonShowBo;
5 import com.yohobuy.ufo.model.order.bo.DepositDetailBo; 6 import com.yohobuy.ufo.model.order.bo.DepositDetailBo;
6 import com.yohobuy.ufo.model.order.bo.DepositProductBo; 7 import com.yohobuy.ufo.model.order.bo.DepositProductBo;
@@ -219,6 +220,9 @@ public class DepositServiceImpl implements DepositService { @@ -219,6 +220,9 @@ public class DepositServiceImpl implements DepositService {
219 } 220 }
220 221
221 public DepositProductBo queryUserDepositProductCountInfo(Integer uid, Integer productId) { 222 public DepositProductBo queryUserDepositProductCountInfo(Integer uid, Integer productId) {
  223 + checkUid(uid, "queryUserDepositProductCountInfo failed, invalid uid: {}");
  224 + checkProductId(productId, "queryUserDepositProductCountInfo failed, invalid productId: {}");
  225 +
222 List<StorageDepositCount> countInfoList = storageDepositMapper.queryUserDepositProduct(uid, Arrays.asList(productId)); 226 List<StorageDepositCount> countInfoList = storageDepositMapper.queryUserDepositProduct(uid, Arrays.asList(productId));
223 if (countInfoList.isEmpty()) { 227 if (countInfoList.isEmpty()) {
224 return null; 228 return null;
@@ -237,6 +241,20 @@ public class DepositServiceImpl implements DepositService { @@ -237,6 +241,20 @@ public class DepositServiceImpl implements DepositService {
237 return bo; 241 return bo;
238 } 242 }
239 243
  244 + private void checkProductId(Integer productId, String format) {
  245 + if (productId == null || productId < 1) {
  246 + LOGGER.warn(format, productId);
  247 + throw new UfoServiceException(500, "参数非法");
  248 + }
  249 + }
  250 +
  251 + private void checkUid(Integer uid, String format) {
  252 + if (uid == null || uid < 1) {
  253 + LOGGER.warn(format, uid);
  254 + throw new UfoServiceException(500, "参数非法");
  255 + }
  256 + }
  257 +
240 258
241 // 上架 259 // 上架
242 @Override 260 @Override