记得上下班打卡 | git大法好,push需谨慎

Commit 07002ca1 authored by 张国柄's avatar 张国柄

~api:根据条码获得商品详情:参数逻辑调整;

parent 32a40cd9
...@@ -87,10 +87,10 @@ public class GoblinFrontController { ...@@ -87,10 +87,10 @@ public class GoblinFrontController {
@GetMapping("getGoodsDetail/scanner") @GetMapping("getGoodsDetail/scanner")
@ApiOperation(value = "获得商品详情/条形码识别", notes = "条码识别SKU时使用") @ApiOperation(value = "获得商品详情/条形码识别", notes = "条码识别SKU时使用")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "skuCode", value = "SKU条码"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "barCode", value = "SKU条码"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "marketId", value = "活动id"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "marketId", value = "活动id"),
}) })
public ResponseDto<GoblinFrontGoodDetailVo> getGoodsDetailByScanner(@RequestParam String skuCode, @RequestParam("marketId") String marketId) { public ResponseDto<GoblinFrontGoodDetailVo> getGoodsDetailByScanner(@RequestParam String barCode, @RequestParam("marketId") String marketId) {
String currentUid = CurrentUtil.getCurrentUid(); String currentUid = CurrentUtil.getCurrentUid();
GoblinStoreInfoVo storeInfoVo = goblinRedisUtils.getStoreInfoVoByUid(currentUid); GoblinStoreInfoVo storeInfoVo = goblinRedisUtils.getStoreInfoVoByUid(currentUid);
if (storeInfoVo == null) { if (storeInfoVo == null) {
...@@ -98,14 +98,14 @@ public class GoblinFrontController { ...@@ -98,14 +98,14 @@ public class GoblinFrontController {
} }
GoblinFrontGoodDetailVo vo; GoblinFrontGoodDetailVo vo;
try { try {
vo = goblinFrontService.getGoodsDetailByScanner(skuCode, storeInfoVo.getStoreId(), marketId); vo = goblinFrontService.getGoodsDetailByScanner(barCode, storeInfoVo.getStoreId(), marketId);
if (vo == null) { if (vo == null) {
return ResponseDto.failure("商品不存在"); return ResponseDto.failure("商品不存在");
} }
} catch (LiquidnetServiceException e) { } catch (LiquidnetServiceException e) {
return ResponseDto.failure(e.getMessage()); return ResponseDto.failure(e.getMessage());
} catch (Exception e) { } catch (Exception e) {
log.error("Ex.扫条码识别商品:发生异常[skuCode={},marketId={}]", skuCode, marketId, e); log.error("Ex.扫条码识别商品:发生异常[barCode={},marketId={}]", barCode, marketId, e);
return ResponseDto.failure("识别失败"); return ResponseDto.failure("识别失败");
} }
return ResponseDto.success(vo); return ResponseDto.success(vo);
......
...@@ -351,8 +351,8 @@ public class GoblinFrontServiceImpl implements GoblinFrontService { ...@@ -351,8 +351,8 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
/** /**
* 根据条码获得商品详情 * 根据条码获得商品详情
*/ */
public GoblinFrontGoodDetailVo getGoodsDetailByScanner(String skuCode, String storeId, String marketId) { public GoblinFrontGoodDetailVo getGoodsDetailByScanner(String barCode, String storeId, String marketId) {
Criteria skuCriteria = Criteria.where("delFlg").is("0").and("storeId").is(storeId).and("skuNo").is(skuCode); Criteria skuCriteria = Criteria.where("delFlg").is("0").and("storeId").is(storeId).and("skuBarCode").is(barCode);
Query skuQuery = Query.query(skuCriteria); Query skuQuery = Query.query(skuCriteria);
skuQuery.fields().include("spuId").include("skuId"); skuQuery.fields().include("spuId").include("skuId");
List<GoblinGoodsSkuInfoVo> skuQueryResultList = mongoTemplate.find(skuQuery, GoblinGoodsSkuInfoVo.class, GoblinGoodsSkuInfoVo.class.getSimpleName()); List<GoblinGoodsSkuInfoVo> skuQueryResultList = mongoTemplate.find(skuQuery, GoblinGoodsSkuInfoVo.class, GoblinGoodsSkuInfoVo.class.getSimpleName());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment