Compare commits
No commits in common. "4e77bd61b8e809d6be7fdb8297630743bc81e933" and "6dfadcec943ac3ffffa5af80f6aa37d19076b79c" have entirely different histories.
4e77bd61b8
...
6dfadcec94
@ -190,11 +190,4 @@ public class ShopProductBaseController extends BaseControllerImpl {
|
|||||||
shopProductBaseService.exportFile(response, shopProductBase, Convert.toList(Integer.class, product_ids));
|
shopProductBaseService.exportFile(response, shopProductBase, Convert.toList(Integer.class, product_ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "根据条形码查询商品信息", notes = "根据条形码查询商品信息")
|
|
||||||
@RequestMapping(value = "/getProductByProductNumber", method = RequestMethod.GET)
|
|
||||||
public CommonResult getProductByProductNumber(@RequestParam(name = "productNumber") String productNumber) {
|
|
||||||
return CommonResult.success(shopProductBaseService.getProductByProductNumber(productNumber));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -304,6 +304,4 @@ public interface ShopProductBaseService extends IBaseService<ShopProductBase> {
|
|||||||
int countFindMapping(Integer store_id);
|
int countFindMapping(Integer store_id);
|
||||||
|
|
||||||
List<ShopProductBase> findPageMapping(Integer store_id, Integer pageNum, Integer pageSize);
|
List<ShopProductBase> findPageMapping(Integer store_id, Integer pageNum, Integer pageSize);
|
||||||
|
|
||||||
Map getProductByProductNumber(String productNumber);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,7 +45,10 @@ import com.suisung.mall.common.pojo.dto.BaiduAiBriefDTO;
|
|||||||
import com.suisung.mall.common.pojo.dto.ProductRecommendDTO;
|
import com.suisung.mall.common.pojo.dto.ProductRecommendDTO;
|
||||||
import com.suisung.mall.common.pojo.dto.ProductSearchDTO;
|
import com.suisung.mall.common.pojo.dto.ProductSearchDTO;
|
||||||
import com.suisung.mall.common.service.MessageService;
|
import com.suisung.mall.common.service.MessageService;
|
||||||
import com.suisung.mall.common.utils.*;
|
import com.suisung.mall.common.utils.CSVUtils;
|
||||||
|
import com.suisung.mall.common.utils.CheckUtil;
|
||||||
|
import com.suisung.mall.common.utils.CommonUtil;
|
||||||
|
import com.suisung.mall.common.utils.I18nUtil;
|
||||||
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||||
import com.suisung.mall.shop.activity.service.ShopActivityGroupbookingService;
|
import com.suisung.mall.shop.activity.service.ShopActivityGroupbookingService;
|
||||||
import com.suisung.mall.shop.base.service.*;
|
import com.suisung.mall.shop.base.service.*;
|
||||||
@ -6457,99 +6460,5 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
|||||||
return shopProductBaseMapper.findPageMapping(store_id,(pageNum-1)*pageSize,pageSize);
|
return shopProductBaseMapper.findPageMapping(store_id,(pageNum-1)*pageSize,pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map getProductByProductNumber(String productNumber) {
|
|
||||||
UserDto userDto= ContextUtil.getCurrentUser();
|
|
||||||
String store_id=userDto.getStore_id();
|
|
||||||
Map data = new HashMap();
|
|
||||||
|
|
||||||
QueryWrapper<ShopProductIndex> cond_row = new QueryWrapper<>();
|
|
||||||
if (StrUtil.isNotBlank(productNumber)) {
|
|
||||||
cond_row.eq("product_number", productNumber);
|
|
||||||
}
|
|
||||||
cond_row.eq("store_id",store_id);
|
|
||||||
List<ShopProductIndex> lists = shopProductIndexService.list(cond_row);
|
|
||||||
if(lists.isEmpty()){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
ShopProductIndex shopProductIndexFind=lists.get(0);
|
|
||||||
// todo lc
|
|
||||||
// data.put("productBase",shopProductIndexFind);
|
|
||||||
|
|
||||||
//判断是否为商家,且开启供应商,判断是否已经加入分销中
|
|
||||||
Long productId= shopProductIndexFind.getProduct_id();
|
|
||||||
List<Integer> product_ids= Collections.singletonList(Math.toIntExact(productId));
|
|
||||||
data.put("baseInfo", getProduct(product_ids));
|
|
||||||
List<Map> baseInfo = (List<Map>) data.get("baseInfo");
|
|
||||||
|
|
||||||
baseInfo.forEach(s -> {
|
|
||||||
String str_product_spec = (String) s.get("product_spec");
|
|
||||||
if (StrUtil.isNotBlank(str_product_spec) && StrUtil.equals(str_product_spec, "[]")) {
|
|
||||||
s.put("product_spec", JSONUtil.parseArray(str_product_spec));
|
|
||||||
}
|
|
||||||
|
|
||||||
String str_product_assist = (String) s.get("product_assist");
|
|
||||||
if (StrUtil.isNotBlank(str_product_assist) && StrUtil.equals(str_product_assist, "{}")) {
|
|
||||||
s.put("product_assist", JSONUtil.parseObj(str_product_assist));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
QueryWrapper<ShopProductItem> itemQueryWrapper = new QueryWrapper<>();
|
|
||||||
itemQueryWrapper.eq("product_id", productId);
|
|
||||||
List<ShopProductItem> productItems = shopProductItemService.find(itemQueryWrapper);
|
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(productItems)) {
|
|
||||||
for (Map item : baseInfo) {
|
|
||||||
List<ShopProductItem> shopProductItems = productItems.stream().filter(s -> ObjectUtil.equal(s.getProduct_id(), productId)).collect(Collectors.toList());
|
|
||||||
if (CollectionUtil.isNotEmpty(shopProductItems)) {
|
|
||||||
BigDecimal product_advice_price = shopProductItems.stream().map(ShopProductItem::getItem_advice_price).min(BigDecimal::compareTo).get();
|
|
||||||
item.put("product_advice_price", product_advice_price);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
List<ShopProductItem> productItemS = productItems.stream().filter(distinctByKey(o -> o.getProduct_id())).collect(Collectors.toList());
|
|
||||||
data.put("items",productItemS);//商品规格列表
|
|
||||||
// shop_product_info
|
|
||||||
ShopProductInfo shopProductInfo = shopProductInfoService.get(productId);
|
|
||||||
// shop_product_detail
|
|
||||||
ShopProductDetail shopProductDetail = shopProductDetailService.get(productId);
|
|
||||||
// shop_product_index
|
|
||||||
ShopProductIndex shopProductIndex = shopProductIndexService.get(productId);
|
|
||||||
// shop_product_image
|
|
||||||
QueryWrapper<ShopProductImage> imageQueryWrapper = new QueryWrapper<>();
|
|
||||||
imageQueryWrapper.eq("product_id", productId);
|
|
||||||
List<ShopProductImage> shopProductImages = shopProductImageService.find(imageQueryWrapper);
|
|
||||||
// shop_product_assist_index
|
|
||||||
QueryWrapper<ShopProductAssistIndex> indexQueryWrapper = new QueryWrapper<>();
|
|
||||||
indexQueryWrapper.eq("product_id", productId);
|
|
||||||
List<ShopProductAssistIndex> assistIndexList = assistIndexService.find(indexQueryWrapper);
|
|
||||||
|
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
|
||||||
if(com.suisung.mall.common.utils.StringUtils.isEmpty(shopProductInfo.getProduct_spec())){
|
|
||||||
shopProductInfo.setProduct_spec("[]");
|
|
||||||
}
|
|
||||||
map.put("shop_product_info", shopProductInfo);
|
|
||||||
map.put("shop_product_image", shopProductImages);
|
|
||||||
map.put("shop_product_detail", shopProductDetail);
|
|
||||||
map.put("shop_product_index", shopProductIndex);
|
|
||||||
map.put("shop_product_assist_index", assistIndexList);
|
|
||||||
|
|
||||||
// 虚拟商品信息表
|
|
||||||
Integer kind_id = shopProductIndex.getKind_id();
|
|
||||||
if (ObjectUtil.equal(kind_id, StateCode.PRODUCT_KIND_FUWU)) {
|
|
||||||
ShopProductValidPeriod validPeriod = shopProductValidPeriodService.get(productId);
|
|
||||||
map.put("shop_product_valid_period", validPeriod);
|
|
||||||
}
|
|
||||||
data.put("productInfo",map);
|
|
||||||
Integer category_id=productItems.get(0).getCategory_id();
|
|
||||||
ShopBaseProductCategory shopBaseProductCategory= shopBaseProductCategoryService.get(category_id);
|
|
||||||
data.put("category",shopBaseProductCategory);
|
|
||||||
Integer typeId=shopBaseProductCategory.getType_id();
|
|
||||||
data.put("shopBaseProductType",shopBaseProductTypeService.getType(String.valueOf(typeId), productId)) ;
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
INSERT INTO `admin_base_protocol` (`ctl`, `met`, `db`, `rights_id`, `log`, `path`,`comment`) VALUES ('/admin/shop/shop-product-base/getProductByProductNumber', 'index', 'master', '', '0', '/admin/shop/shop-product-base/getProductByProductNumber','根据条形码获取商品详情');
|
|
||||||
Loading…
Reference in New Issue
Block a user