修复商品管理单规格显示问题

This commit is contained in:
hupeng committed 2023-12-27 22:20:58 +08:00
1 parent e9422cd6a5
commit c86430e397
1 file changed
+19 -19
@@ -538,7 +538,7 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductMapper,Stor
productDto.setAttrs(productFormatDtos);
productDto.setItems(result.getObject("attr",ArrayList.class));
}else{
this.productFromat(productDto, result);
this.productFromat(productDto, attrValues.get(0));
}
map.put("productInfo",productDto);
@@ -569,25 +569,25 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductMapper,Stor
* @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);
private void productFromat(ProductDto productDto, StoreProductAttrValueDO 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())
.integral(mapAttr.get("integral") !=null ? Integer.valueOf(mapAttr.get("integral").toString()) : 0)
.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()))
.pic(result.getImage())
.price(result.getPrice().doubleValue())
.cost(result.getCost().doubleValue())
.otPrice(result.getOtPrice().doubleValue())
.stock(result.getStock())
.barCode(result.getBarCode())
.weight(result.getWeight().doubleValue())
.volume(result.getVolume().doubleValue())
.value1("规格")
.integral(result.getIntegral())
.brokerage(result.getBrokerage().doubleValue())
.brokerageTwo(result.getBrokerageTwo().doubleValue())
.pinkPrice(result.getPinkPrice().doubleValue())
.pinkStock(result.getPinkStock())
.seckillPrice(result.getSeckillPrice().doubleValue())
.seckillStock(result.getSeckillStock())
.build();
productDto.setAttr(productFormatDto);
}