|
@@ -1,5 +1,6 @@
|
|
|
package com.kmall.api.api;
|
|
|
|
|
|
+import com.google.common.collect.Maps;
|
|
|
import com.kmall.api.annotation.IgnoreAuth;
|
|
|
import com.kmall.api.annotation.LoginUser;
|
|
|
import com.kmall.api.entity.*;
|
|
@@ -77,7 +78,7 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
@GetMapping("index")
|
|
|
public Object index(@LoginUser UserVo loginUser) {
|
|
|
//
|
|
|
- Map param = new HashMap();
|
|
|
+ Map param = Maps.newHashMap();
|
|
|
List<GoodsVo> goodsList = goodsService.queryList(param);
|
|
|
//
|
|
|
return toResponsSuccess(goodsList);
|
|
@@ -89,13 +90,13 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
@IgnoreAuth
|
|
|
@GetMapping("sku")
|
|
|
public Object sku(@LoginUser UserVo loginUser, Long goodsId) {
|
|
|
- Map<String, Object> resultObj = new HashMap();
|
|
|
+ Map<String, Object> resultObj = Maps.newHashMap();
|
|
|
//
|
|
|
GoodsVo goodsVo = goodsService.queryObjectByStoreId(goodsId, getStoreId());
|
|
|
//
|
|
|
List<Map> goodsSpecificationEntityList = goodsSpecificationService.queryByGoodsIdGroupByNames(goodsId);
|
|
|
//
|
|
|
- Map param = new HashMap();
|
|
|
+ Map param = Maps.newHashMap();
|
|
|
param.put("goods_id", goodsId);
|
|
|
param.put("store_id", getStoreId());
|
|
|
List<ProductVo> productEntityList = productService.queryList(param);
|
|
@@ -118,7 +119,7 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
@IgnoreAuth
|
|
|
@GetMapping("goodsGallery")
|
|
|
public Object goodsGallery(Integer goods_id) {
|
|
|
- Map param = new HashMap();
|
|
|
+ Map param = Maps.newHashMap();
|
|
|
param.put("goods_id", goods_id);
|
|
|
List<GoodsGalleryVo> gallery = goodsGalleryService.queryList(param);
|
|
|
return toResponsSuccess(gallery);
|
|
@@ -129,7 +130,7 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
* */
|
|
|
@GetMapping("detail")
|
|
|
public Object detail(Long id, Long referrer,String merchSn) {
|
|
|
- Map<String, Object> resultObj = new HashMap();
|
|
|
+ Map<String, Object> resultObj = Maps.newHashMap();
|
|
|
//
|
|
|
Long userId = getUserId();
|
|
|
Long storeId = getStoreId();
|
|
@@ -140,7 +141,7 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
BrandVo brand = apiBrandService.queryObject(info.getBrand_id());
|
|
|
resultObj.put("brand", brand);
|
|
|
|
|
|
- Map param = new HashMap();
|
|
|
+ Map param = Maps.newHashMap();
|
|
|
param.put("goods_id", id);
|
|
|
param.put("store_id", getStoreId());
|
|
|
List<Map> specificationList = goodsSpecificationService.queryByGoodsIdGroupByNames(id);
|
|
@@ -150,14 +151,14 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
List<GoodsGalleryVo> gallery = goodsGalleryService.queryList(param);
|
|
|
resultObj.put("gallery", gallery);
|
|
|
|
|
|
- Map ngaParam = new HashMap();
|
|
|
+ Map ngaParam = Maps.newHashMap();
|
|
|
ngaParam.put("fields", "nga.value, na.name");
|
|
|
ngaParam.put("sidx", "nga.id");
|
|
|
ngaParam.put("order", "asc");
|
|
|
ngaParam.put("goods_id", id);
|
|
|
List<AttributeVo> attribute = attributeService.queryList(ngaParam);
|
|
|
//
|
|
|
- Map issueParam = new HashMap();
|
|
|
+ Map issueParam = Maps.newHashMap();
|
|
|
issueParam.put("merch_sn", merchSn);
|
|
|
List<GoodsIssueVo> issue = goodsIssueService.queryList(issueParam);
|
|
|
//
|
|
@@ -165,23 +166,23 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
param.put("type_id", 0);
|
|
|
Integer commentCount = commentService.queryTotal(param);
|
|
|
List<CommentVo> hotComment = commentService.queryList(param);
|
|
|
- Map commentInfo = new HashMap();
|
|
|
+ Map commentInfo = Maps.newHashMap();
|
|
|
if (null != hotComment && hotComment.size() > 0) {
|
|
|
UserVo commentUser = userService.queryObject(hotComment.get(0).getUserId());
|
|
|
commentInfo.put("content", hotComment.get(0).getContent());
|
|
|
commentInfo.put("add_time", DateUtils.timeToStr(hotComment.get(0).getAddTime(), DateUtils.PATTERN_YYYY_MM_DD_HH_MM));
|
|
|
commentInfo.put("nickname", commentUser.getNickname());
|
|
|
commentInfo.put("avatar", commentUser.getAvatar());
|
|
|
- Map paramPicture = new HashMap();
|
|
|
+ Map paramPicture = Maps.newHashMap();
|
|
|
paramPicture.put("comment_id", hotComment.get(0).getId());
|
|
|
List<CommentPictureVo> commentPictureEntities = commentPictureService.queryList(paramPicture);
|
|
|
commentInfo.put("pic_list", commentPictureEntities);
|
|
|
}
|
|
|
- Map comment = new HashMap();
|
|
|
+ Map comment = Maps.newHashMap();
|
|
|
comment.put("count", commentCount);
|
|
|
comment.put("data", commentInfo);
|
|
|
//当前用户是否收藏
|
|
|
- Map collectParam = new HashMap();
|
|
|
+ Map collectParam = Maps.newHashMap();
|
|
|
collectParam.put("user_id", getUserId());
|
|
|
collectParam.put("value_id", id);
|
|
|
collectParam.put("type_id", 0);
|
|
@@ -205,7 +206,7 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
}
|
|
|
footprintService.save(footprintEntity);
|
|
|
|
|
|
- Map cartMap= new HashMap();
|
|
|
+ Map cartMap= Maps.newHashMap();
|
|
|
cartMap.put("user_id",userId);
|
|
|
cartMap.put("goods_id",info.getId());
|
|
|
List<CartVo> cartVoList = cartService.queryList(cartMap);
|
|
@@ -233,12 +234,12 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
@IgnoreAuth
|
|
|
@GetMapping("transferCoupon")
|
|
|
public Object transferCoupon(@LoginUser UserVo loginUser, Long goods_id, Integer send_type, Long referrer) {
|
|
|
- Map<String, Object> resultObj = new HashMap();
|
|
|
+ Map<String, Object> resultObj = Maps.newHashMap();
|
|
|
// 记录推荐人是否可以领取红包,用户登录时校验
|
|
|
Long userId = getUserId();
|
|
|
try {
|
|
|
// 是否已经有可用的转发红包
|
|
|
- Map params = new HashMap();
|
|
|
+ Map params = Maps.newHashMap();
|
|
|
params.put("user_id", userId);
|
|
|
params.put("send_type", send_type);
|
|
|
params.put("unUsed", true);
|
|
@@ -246,14 +247,14 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
if ((null == enabledCouponVos || enabledCouponVos.size() == 0)
|
|
|
&& null != referrer && null != userId) {
|
|
|
// 获取优惠信息提示
|
|
|
- Map couponParam = new HashMap();
|
|
|
+ Map couponParam = Maps.newHashMap();
|
|
|
couponParam.put("enabled", true);
|
|
|
Integer[] send_types = new Integer[]{CouponTypeEnum.COUPONTYPE2.getIndex()};
|
|
|
couponParam.put("send_types", send_types);
|
|
|
List<CouponVo> couponVos = apiCouponService.queryList(couponParam);
|
|
|
if (null != couponVos && couponVos.size() > 0) {
|
|
|
CouponVo couponVo = couponVos.get(0);
|
|
|
- Map footprintParam = new HashMap();
|
|
|
+ Map footprintParam = Maps.newHashMap();
|
|
|
footprintParam.put("goods_id", goods_id);
|
|
|
footprintParam.put("referrer", referrer);
|
|
|
Integer footprintNum = footprintService.queryTotal(footprintParam);
|
|
@@ -275,12 +276,12 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
@IgnoreAuth
|
|
|
@GetMapping("category")
|
|
|
public Object category(@LoginUser UserVo loginUser, Integer id) {
|
|
|
- Map<String, Object> resultObj = new HashMap();
|
|
|
+ Map<String, Object> resultObj = Maps.newHashMap();
|
|
|
//
|
|
|
CategoryVo currentCategory = categoryService.queryObject(id);
|
|
|
//
|
|
|
CategoryVo parentCategory = categoryService.queryObject(currentCategory.getParent_id());
|
|
|
- Map params = new HashMap();
|
|
|
+ Map params = Maps.newHashMap();
|
|
|
params.put("parent_id", currentCategory.getParent_id());
|
|
|
List<CategoryVo> brotherCategory = categoryService.queryList(params);
|
|
|
//
|
|
@@ -296,12 +297,12 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
@IgnoreAuth
|
|
|
@GetMapping("brand")
|
|
|
public Object brand(@LoginUser UserVo loginUser, Integer id) {
|
|
|
- Map<String, Object> resultObj = new HashMap();
|
|
|
+ Map<String, Object> resultObj = Maps.newHashMap();
|
|
|
//
|
|
|
BrandVo currentBrand = apiBrandService.queryObject(id);
|
|
|
//
|
|
|
CategoryVo parentCategory = categoryService.queryObject(currentBrand.getCategoryId());
|
|
|
- Map params = new HashMap();
|
|
|
+ Map params = Maps.newHashMap();
|
|
|
params.put("categoryId", currentBrand.getCategoryId());
|
|
|
List<BrandVo> brandList = apiBrandService.queryList(params);
|
|
|
//
|
|
@@ -319,7 +320,7 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
@RequestParam(value = "page", defaultValue = "1") Integer
|
|
|
page, @RequestParam(value = "size", defaultValue = "10") Integer size,
|
|
|
String sort, String order) {
|
|
|
- Map params = new HashMap();
|
|
|
+ Map params = Maps.newHashMap();
|
|
|
if(org.apache.commons.lang3.StringUtils.isNotEmpty(keyword)){
|
|
|
try{
|
|
|
keyword = new String(keyword.getBytes("iso-8859-1"),"utf-8");
|
|
@@ -376,7 +377,7 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
}
|
|
|
}
|
|
|
//查找二级分类的parent_id
|
|
|
- Map categoryParam = new HashMap();
|
|
|
+ Map categoryParam = Maps.newHashMap();
|
|
|
categoryParam.put("ids", categoryIds);
|
|
|
categoryParam.put("fields", "parent_id");
|
|
|
List<CategoryVo> parentCategoryList = categoryService.queryList(categoryParam);
|
|
@@ -386,7 +387,7 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
parentIds.add(categoryEntity.getParent_id());
|
|
|
}
|
|
|
//一级分类
|
|
|
- categoryParam = new HashMap();
|
|
|
+ categoryParam = Maps.newHashMap();
|
|
|
categoryParam.put("fields", "id,name");
|
|
|
categoryParam.put("order", "asc");
|
|
|
categoryParam.put("sidx", "sort_order");
|
|
@@ -422,10 +423,10 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
@GetMapping("hotGoodsList")
|
|
|
public Object hotGoodsList(@LoginUser UserVo loginUser, Integer categoryId,
|
|
|
String sort, String order) {
|
|
|
- Map reusltObj = new HashMap();
|
|
|
+ Map reusltObj = Maps.newHashMap();
|
|
|
//
|
|
|
Long store_id = getStoreId();
|
|
|
- Map params = new HashMap();
|
|
|
+ Map params = Maps.newHashMap();
|
|
|
//筛选的分类
|
|
|
List<CategoryVo> filterCategory = new ArrayList();
|
|
|
CategoryVo rootCategory = new CategoryVo();
|
|
@@ -449,7 +450,7 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
categoryIds.add(goodsVo.getCategory_id());
|
|
|
}
|
|
|
//查找二级分类的parent_id
|
|
|
- Map categoryParam = new HashMap();
|
|
|
+ Map categoryParam = Maps.newHashMap();
|
|
|
categoryParam.put("ids", categoryIds);
|
|
|
categoryParam.put("fields", "parent_id");
|
|
|
List<CategoryVo> parentCategoryList = categoryService.queryList(categoryParam);
|
|
@@ -459,7 +460,7 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
parentIds.add(categoryEntity.getParent_id());
|
|
|
}
|
|
|
//一级分类
|
|
|
- categoryParam = new HashMap();
|
|
|
+ categoryParam = Maps.newHashMap();
|
|
|
categoryParam.put("fields", "id,name");
|
|
|
categoryParam.put("order", "asc");
|
|
|
categoryParam.put("sidx", "sort_order");
|
|
@@ -495,8 +496,8 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
@IgnoreAuth
|
|
|
@GetMapping("new")
|
|
|
public Object newAction(@LoginUser UserVo loginUser) {
|
|
|
- Map<String, Object> resultObj = new HashMap();
|
|
|
- Map bannerInfo = new HashMap();
|
|
|
+ Map<String, Object> resultObj = Maps.newHashMap();
|
|
|
+ Map bannerInfo = Maps.newHashMap();
|
|
|
bannerInfo.put("url", "");
|
|
|
bannerInfo.put("name", "坚持初心,为你寻觅世间好物");
|
|
|
bannerInfo.put("img_url", "http://yanxuan.nosdn.127.net/8976116db321744084774643a933c5ce.png");
|
|
@@ -510,19 +511,19 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
@IgnoreAuth
|
|
|
@GetMapping("hot")
|
|
|
public Object hot(@LoginUser UserVo loginUser) {
|
|
|
- Map<String, Object> resultObj = new HashMap();
|
|
|
+ Map<String, Object> resultObj = Maps.newHashMap();
|
|
|
//
|
|
|
- Map param = new HashMap();
|
|
|
+ Map param = Maps.newHashMap();
|
|
|
param.put("ad_position_id", 4);
|
|
|
List<AdVo> adVoList = apiAdService.queryList(param);
|
|
|
if (null != adVoList && adVoList.size() > 0) {
|
|
|
- Map bannerInfo = new HashMap();
|
|
|
+ Map bannerInfo = Maps.newHashMap();
|
|
|
bannerInfo.put("url", "");
|
|
|
bannerInfo.put("name", adVoList.get(0).getName());
|
|
|
bannerInfo.put("img_url", adVoList.get(0).getImageUrl());
|
|
|
resultObj.put("bannerInfo", bannerInfo);
|
|
|
} else {
|
|
|
- Map bannerInfo = new HashMap();
|
|
|
+ Map bannerInfo = Maps.newHashMap();
|
|
|
bannerInfo.put("url", "");
|
|
|
bannerInfo.put("name", "大家都在商城选好物");
|
|
|
bannerInfo.put("img_url", "https://platform-wxmall.oss-cn-beijing.aliyuncs.com/upload/20180807/1057182334dfb2.png");
|
|
@@ -537,8 +538,8 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
@IgnoreAuth
|
|
|
@GetMapping("related")
|
|
|
public Object related(@LoginUser UserVo loginUser, Long id) {
|
|
|
- Map<String, Object> resultObj = new HashMap();
|
|
|
- Map param = new HashMap();
|
|
|
+ Map<String, Object> resultObj = Maps.newHashMap();
|
|
|
+ Map param = Maps.newHashMap();
|
|
|
param.put("goods_id", id);
|
|
|
param.put("fields", "related_goods_id");
|
|
|
List<RelatedGoodsVo> relatedGoodsEntityList = relatedGoodsService.queryList(param);
|
|
@@ -552,7 +553,7 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
//查找同分类下的商品
|
|
|
GoodsVo goodsCategory = goodsService.queryObjectByStoreId(id, getStoreId());
|
|
|
if (null != goodsCategory) {
|
|
|
- Map paramRelated = new HashMap();
|
|
|
+ Map paramRelated = Maps.newHashMap();
|
|
|
paramRelated.put("store_id", getStoreId());
|
|
|
paramRelated.put("notGoodsBizType", true);
|
|
|
paramRelated.put("fields", "a.id, a.name, a.list_pic_url, psr1.retail_price,b.id as product_id");
|
|
@@ -560,7 +561,7 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
relatedGoods = goodsService.queryList(paramRelated);
|
|
|
}
|
|
|
} else {
|
|
|
- Map paramRelated = new HashMap();
|
|
|
+ Map paramRelated = Maps.newHashMap();
|
|
|
paramRelated.put("store_id", getStoreId());
|
|
|
paramRelated.put("notGoodsBizType", true);
|
|
|
paramRelated.put("goods_ids", relatedGoodsIds);
|
|
@@ -577,8 +578,8 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
@IgnoreAuth
|
|
|
@GetMapping("count")
|
|
|
public Object count(@LoginUser UserVo loginUser) {
|
|
|
- Map<String, Object> resultObj = new HashMap();
|
|
|
- Map param = new HashMap();
|
|
|
+ Map<String, Object> resultObj = Maps.newHashMap();
|
|
|
+ Map param = Maps.newHashMap();
|
|
|
param.put("storeId", getStoreId());
|
|
|
param.put("notGoodsBizType", true);
|
|
|
param.put("is_delete", 0);
|
|
@@ -598,7 +599,7 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
@RequestParam(value = "page", defaultValue = "1") Integer
|
|
|
page, @RequestParam(value = "size", defaultValue = "10") Integer size,
|
|
|
String sort, String order) {
|
|
|
- Map params = new HashMap();
|
|
|
+ Map params = Maps.newHashMap();
|
|
|
params.put("is_new", isNew);
|
|
|
params.put("page", page);
|
|
|
params.put("limit", size);
|
|
@@ -640,7 +641,7 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
|
if (null != getUserId()) {
|
|
|
Long storeId = getStoreId();
|
|
|
//查询列表数据
|
|
|
- Map cartParam = new HashMap();
|
|
|
+ Map cartParam = Maps.newHashMap();
|
|
|
cartParam.put("user_id", getUserId());
|
|
|
cartParam.put("store_id", storeId);
|
|
|
cartList = cartService.queryList(cartParam);
|