bug--修复商品单规格价格、销量等读取不了
This commit is contained in:
@ -132,14 +132,41 @@ public class StoreCombinationController {
|
|||||||
productDto.setAttrs(productFormatDtos);
|
productDto.setAttrs(productFormatDtos);
|
||||||
productDto.setItems(result.getObject("attr",ArrayList.class));
|
productDto.setItems(result.getObject("attr",ArrayList.class));
|
||||||
}else{
|
}else{
|
||||||
|
productFormat(productDto, result);
|
||||||
productDto.setAttr(productFormatDtos.get(0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
map.put("productInfo",productDto);
|
map.put("productInfo",productDto);
|
||||||
|
|
||||||
return new ResponseEntity<>(map,HttpStatus.OK);
|
return new ResponseEntity<>(map,HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取商品属性
|
||||||
|
* @param productDto
|
||||||
|
* @param result
|
||||||
|
*/
|
||||||
|
private void productFormat(YxStoreCombinationDto productDto, JSONObject result) {
|
||||||
|
Map<String,Object> mapAttr = (Map<String,Object>) result.getObject("value",ArrayList.class).get(0);
|
||||||
|
ProductFormatDto productFormatDto = ProductFormatDto.builder()
|
||||||
|
.pic(mapAttr.get("pic").toString())
|
||||||
|
.price(Double.valueOf(mapAttr.get("price").toString()))
|
||||||
|
.cost(Double.valueOf(mapAttr.get("cost").toString()))
|
||||||
|
.otPrice(Double.valueOf(mapAttr.get("otPrice").toString()))
|
||||||
|
.stock(Integer.valueOf(mapAttr.get("stock").toString()))
|
||||||
|
.barCode(mapAttr.get("barCode").toString())
|
||||||
|
.weight(Double.valueOf(mapAttr.get("weight").toString()))
|
||||||
|
.volume(Double.valueOf(mapAttr.get("volume").toString()))
|
||||||
|
.value1(mapAttr.get("value1").toString())
|
||||||
|
.brokerage(Double.valueOf(mapAttr.get("brokerage").toString()))
|
||||||
|
.brokerageTwo(Double.valueOf(mapAttr.get("brokerageTwo").toString()))
|
||||||
|
.pinkPrice(Double.valueOf(mapAttr.get("pinkPrice").toString()))
|
||||||
|
.pinkStock(Integer.valueOf(mapAttr.get("pinkStock").toString()))
|
||||||
|
.seckillPrice(Double.valueOf(mapAttr.get("seckillPrice").toString()))
|
||||||
|
.seckillStock(Integer.valueOf(mapAttr.get("seckillStock").toString()))
|
||||||
|
.build();
|
||||||
|
productDto.setAttr(productFormatDto);
|
||||||
|
}
|
||||||
|
|
||||||
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true)
|
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true)
|
||||||
@Log("修改拼团")
|
@Log("修改拼团")
|
||||||
@ApiOperation(value = "新增/修改拼团")
|
@ApiOperation(value = "新增/修改拼团")
|
||||||
|
@ -148,7 +148,7 @@ public class StoreSeckillController {
|
|||||||
productDto.setAttrs(productFormatDtos);
|
productDto.setAttrs(productFormatDtos);
|
||||||
productDto.setItems(result.getObject("attr",ArrayList.class));
|
productDto.setItems(result.getObject("attr",ArrayList.class));
|
||||||
}else{
|
}else{
|
||||||
productDto.setAttr(productFormatDtos.get(0));
|
productFormat(productDto, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -156,4 +156,31 @@ public class StoreSeckillController {
|
|||||||
|
|
||||||
return new ResponseEntity<>(map,HttpStatus.OK);
|
return new ResponseEntity<>(map,HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取商品属性
|
||||||
|
* @param productDto
|
||||||
|
* @param result
|
||||||
|
*/
|
||||||
|
private void productFormat(YxStoreSeckillDto productDto, JSONObject result) {
|
||||||
|
Map<String,Object> mapAttr = (Map<String,Object>) result.getObject("value",ArrayList.class).get(0);
|
||||||
|
ProductFormatDto productFormatDto = ProductFormatDto.builder()
|
||||||
|
.pic(mapAttr.get("pic").toString())
|
||||||
|
.price(Double.valueOf(mapAttr.get("price").toString()))
|
||||||
|
.cost(Double.valueOf(mapAttr.get("cost").toString()))
|
||||||
|
.otPrice(Double.valueOf(mapAttr.get("otPrice").toString()))
|
||||||
|
.stock(Integer.valueOf(mapAttr.get("stock").toString()))
|
||||||
|
.barCode(mapAttr.get("barCode").toString())
|
||||||
|
.weight(Double.valueOf(mapAttr.get("weight").toString()))
|
||||||
|
.volume(Double.valueOf(mapAttr.get("volume").toString()))
|
||||||
|
.value1(mapAttr.get("value1").toString())
|
||||||
|
.brokerage(Double.valueOf(mapAttr.get("brokerage").toString()))
|
||||||
|
.brokerageTwo(Double.valueOf(mapAttr.get("brokerageTwo").toString()))
|
||||||
|
.pinkPrice(Double.valueOf(mapAttr.get("pinkPrice").toString()))
|
||||||
|
.pinkStock(Integer.valueOf(mapAttr.get("pinkStock").toString()))
|
||||||
|
.seckillPrice(Double.valueOf(mapAttr.get("seckillPrice").toString()))
|
||||||
|
.seckillStock(Integer.valueOf(mapAttr.get("seckillStock").toString()))
|
||||||
|
.build();
|
||||||
|
productDto.setAttr(productFormatDto);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ public class StoreProductController {
|
|||||||
productDto.setItems(result.getObject("attr",ArrayList.class));
|
productDto.setItems(result.getObject("attr",ArrayList.class));
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
productDto.setAttr(productFormatDtos.get(0));
|
productFromat(productDto, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
map.put("productInfo",productDto);
|
map.put("productInfo",productDto);
|
||||||
@ -208,6 +208,33 @@ public class StoreProductController {
|
|||||||
return new ResponseEntity<>(map,HttpStatus.OK);
|
return new ResponseEntity<>(map,HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取商品属性
|
||||||
|
* @param productDto
|
||||||
|
* @param result
|
||||||
|
*/
|
||||||
|
private void productFromat(ProductDto productDto, JSONObject result) {
|
||||||
|
Map<String,Object> mapAttr = (Map<String,Object>) result.getObject("value",ArrayList.class).get(0);
|
||||||
|
ProductFormatDto productFormatDto = ProductFormatDto.builder()
|
||||||
|
.pic(mapAttr.get("pic").toString())
|
||||||
|
.price(Double.valueOf(mapAttr.get("price").toString()))
|
||||||
|
.cost(Double.valueOf(mapAttr.get("cost").toString()))
|
||||||
|
.otPrice(Double.valueOf(mapAttr.get("otPrice").toString()))
|
||||||
|
.stock(Integer.valueOf(mapAttr.get("stock").toString()))
|
||||||
|
.barCode(mapAttr.get("barCode").toString())
|
||||||
|
.weight(Double.valueOf(mapAttr.get("weight").toString()))
|
||||||
|
.volume(Double.valueOf(mapAttr.get("volume").toString()))
|
||||||
|
.value1(mapAttr.get("value1").toString())
|
||||||
|
.brokerage(Double.valueOf(mapAttr.get("brokerage").toString()))
|
||||||
|
.brokerageTwo(Double.valueOf(mapAttr.get("brokerageTwo").toString()))
|
||||||
|
.pinkPrice(Double.valueOf(mapAttr.get("pinkPrice").toString()))
|
||||||
|
.pinkStock(Integer.valueOf(mapAttr.get("pinkStock").toString()))
|
||||||
|
.seckillPrice(Double.valueOf(mapAttr.get("seckillPrice").toString()))
|
||||||
|
.seckillStock(Integer.valueOf(mapAttr.get("seckillStock").toString()))
|
||||||
|
.build();
|
||||||
|
productDto.setAttr(productFormatDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分类递归
|
* 分类递归
|
||||||
|
Reference in New Issue
Block a user