Commit 5d9457a8 authored by 张永's avatar 张永

1

parent bef9b632
package com.egolm.shop.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject;
import com.egolm.common.GsonUtil;
import com.egolm.common.StringUtil;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page;
import com.egolm.common.web.ServletUtil;
import com.egolm.shop.service.GoodsService;
import com.egolm.shop.util.I18NUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@Api(tags={"商品相关接口"})
@RestController
@RequestMapping("goods")
public class GoodsController {
@Autowired
private GoodsService goodsService;
@ApiOperation("猜你喜欢商品")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "orgNO", dataType = "String", required = true, value = "区域编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "userNO", dataType = "String", required = false, value = "用户编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "compNO", dataType = "String", required = true, value = "组件编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/thinkLike",method=RequestMethod.GET)
public String thinkLike(HttpServletRequest request) {
String orgNO = request.getParameter("orgNO");
String compNO = request.getParameter("compNO");
String userNO = "nouserNO";
try {
userNO = request.getParameter("userNO");
if(StringUtil.isEmpty(userNO)) {
userNO = "nouserNO";
}
} catch (Exception e) {
userNO = "nouserNO";
}
String langId = request.getParameter("langID");
String index = "1";
String limit = "10";
if(!StringUtil.isNotEmpty(orgNO,compNO,limit,index)) {
return Rjx.json().setCode(-1).setMessage(I18NUtils.getMessage(langId, "Msg_Parameter_empty")).toJson();
}
Map<String, Object> param = new HashMap<String, Object>();
param.put("orgNO", orgNO);
param.put("compNO", compNO);
param.put("userNO", userNO);
param.put("LangID", langId==""?"936":langId);
Page page = new Page();
page.setIndex(Long.valueOf(index));
page.setLimit(Long.valueOf(limit));
page.setLimitKey("SaleQty desc");
List<Map<String, Object>> detailList = goodsService.listThinkLike(param, page);
return Rjx.jsonOk().set("list", detailList).setPage(page).toString();
}
@ApiOperation("热销商品列表")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "orgNO", dataType = "String", required = true, value = "区域编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "compNO", dataType = "String", required = true, value = "组件编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "index", dataType = "String", required = false, value = "第几页", defaultValue = "1"),
@ApiImplicitParam(paramType = "query", name = "limit", dataType = "String", required = false, value = "每页数量", defaultValue = "20"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/getHotSaleGoods",method=RequestMethod.GET)
public String getHotSaleGoods(HttpServletRequest request, HttpServletResponse response) {
List<Map<String,Object>> listMap;
Map<String,Object> params=new HashMap<>();
params.put("OrgNO", request.getParameter("orgNO"));
params.put("CompNO", request.getParameter("compNO"));
Page page=new Page();
page.setIndex(Long.valueOf(request.getParameter("index")==null?"1":request.getParameter("index")));
page.setLimit(Long.valueOf(request.getParameter("limit")==null?"20":request.getParameter("limit")));
page.setLimitKey("SaleQty desc");
listMap=goodsService.getHotSaleGoods(params,page);
return Rjx.jsonOk().set("list", listMap).set("page",page).toJson();
}
@ApiOperation("分类商品页数据")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "orgNO", dataType = "String", required = true, value = "区域编号", defaultValue = "SHBS"),
@ApiImplicitParam(paramType = "query", name = "shopNO", dataType = "String", required = false, value = "店铺件编号", defaultValue = "00029997"),
@ApiImplicitParam(paramType = "query", name = "categoryNOA", dataType = "String", required = false, value = "一级分类编码", defaultValue = "%"),
@ApiImplicitParam(paramType = "query", name = "categoryNOB", dataType = "String", required = false, value = "二级分类编码", defaultValue = "%"),
@ApiImplicitParam(paramType = "query", name = "index", dataType = "String", required = false, value = "第几页", defaultValue = "1"),
@ApiImplicitParam(paramType = "query", name = "limit", dataType = "String", required = false, value = "每页数量", defaultValue = "20"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/getCategoryGoods",method=RequestMethod.GET)
public String getCategoryGoods(HttpServletRequest request, HttpServletResponse response) {
List<Map<String,Object>> listMap;
Map<String,Object> params=new HashMap<>();
params.put("OrgNO", request.getParameter("orgNO"));
params.put("ShopNO", request.getParameter("shopNO")==null?"":request.getParameter("ShopNO"));
params.put("CategoryNOA", request.getParameter("categoryNOA")==null?"%":request.getParameter("categoryNOA"));
params.put("CategoryNOB", request.getParameter("categoryNOB")==null?"%":request.getParameter("categoryNOB"));
Page page=new Page();
page.setIndex(Long.valueOf(request.getParameter("index")==null?"1":request.getParameter("index")));
page.setLimit(Long.valueOf(request.getParameter("limit")==null?"20":request.getParameter("limit")));
page.setLimitKey("GoodsID desc");
listMap=goodsService.GetCategoryGoods(params,page);
return Rjx.jsonOk().set("list", listMap).set("page",page).toJson();
}
@ApiOperation("热搜词")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "orgNO", dataType = "String", required = true, value = "区域编号", defaultValue = "SHBS"),
@ApiImplicitParam(paramType = "query", name = "shopNO", dataType = "String", required = false, value = "店铺编号", defaultValue = "00029997"),
@ApiImplicitParam(paramType = "query", name = "index", dataType = "String", required = false, value = "第几页", defaultValue = "1"),
@ApiImplicitParam(paramType = "query", name = "limit", dataType = "String", required = false, value = "每页数量", defaultValue = "20"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/hotSearchKey",method=RequestMethod.GET)
public String hotSearchKey(HttpServletRequest request, HttpServletResponse response) {
List<Map<String,Object>> listMap;
Map<String,Object> params=new HashMap<>();
params.put("orgNO", request.getParameter("orgNO"));
params.put("shopNO", request.getParameter("shopNO")==null?"":request.getParameter("shopNO"));
Page page=new Page();
page.setIndex(Long.valueOf(request.getParameter("index")==null?"1":request.getParameter("index")));
page.setLimit(Long.valueOf(request.getParameter("limit")==null?"10":request.getParameter("limit")));
page.setLimitKey(" searchCount desc ");
listMap=goodsService.hotSearchKey(params,page);
return Rjx.jsonOk().set("list", listMap).set("page",page).toJson();
}
@ApiOperation("统一搜索(支持品牌,分类,关键字,仓库等)")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "data", dataType = "String", required = true, value = "JSON参数", defaultValue = "{\"topCategoryNO\":\"01\",\"upCategoryNO\":\"\",\"categoryID\":[\"\"],\"brandID\":[\"\"],\"agentID\":\"\",\"warehouseNO\":\"\",\"scopeTypeID\":\"1\",\"districtID\":\"\",\"keyword\":\"*\",\"index\":1,\"limit\":10,\"userNO\":\"00034\",\"orgNO\":\"XIAN\",\"shopNO\":\"167728271\"}"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = true, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/searchGoods",method=RequestMethod.POST)
public String searchGoods(HttpServletRequest request, HttpServletResponse response) {
String reqJson = request.getParameter("data");
System.out.println("searchGoods-------"+reqJson);
Map<String, Object> argsMap = new HashMap<String,Object>();
argsMap = GsonUtil.toMap(reqJson);
String langID = request.getParameter("langID");
argsMap.put("langID", langID);
try {
if(!argsMap.containsKey("index") || !argsMap.containsKey("limit") || !argsMap.containsKey("userNO") || !argsMap.containsKey("shopNO") || !argsMap.containsKey("orgNO") ) {
return Rjx.jsonErr().setCode(-100).setMessage(I18NUtils.getMessage(langID, "Msg_Parameter_empty")).set("errorMsg", "index,limit,userNO,shopNO,orgNO " +I18NUtils.getMessage(langID, "Msg_Must_enter")).toJson();
}
} catch (Exception e) {
e.printStackTrace();
return Rjx.jsonErr().setCode(-100).setMessage(I18NUtils.getMessage(langID, "Msg_QueryParam_error")).toJson();
}
return goodsService.searchGoods(argsMap);
}
@ApiOperation("商品详情")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "goodsID", dataType = "String", required = true, value = "商品编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "contractNO", dataType = "String", required = false, value = "合同编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "custNO", dataType = "String", required = true, value = "用户账号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "shopNO", dataType = "String", required = true, value = "店铺编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/goodsDetail",method=RequestMethod.GET)
public String goodsDetail(HttpServletRequest request, HttpServletResponse response) {
Map<String,Object> params=new HashMap<>();
params.put("custNO", request.getParameter("custNO"));
params.put("shopNO", request.getParameter("shopNO")==null?"":request.getParameter("shopNO"));
params.put("goodsID", request.getParameter("goodsID")==null?"":request.getParameter("goodsID"));
params.put("contractNO", request.getParameter("contractNO")==null?"":request.getParameter("contractNO"));
params.put("langID", request.getParameter("langID")==null?936:request.getParameter("langID"));
params.put("terminal", request.getParameter("terminal")==null?"":request.getParameter("terminal"));
return goodsService.goodsDetail(params);
}
@ApiOperation("批量查询商品价格 (参数为json对象)")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", dataType = "String", required = false, value = "JSON格式", defaultValue = "{\"goodsList\": [\"10\",\"12\"],\"custNO\": \"15996801133\",\"shopNO\": \"00029975\",\"terminal\": \"wechat\",\"langID\": 936}"),
})
@RequestMapping(value = "/queryGoodsPrice",method=RequestMethod.POST,produces = "application/json")
public String queryGoodsPrice(HttpServletRequest request, HttpServletResponse response) {
String reqJson = ServletUtil.readReqJson(request);
JSONObject jsonObj = JSONObject.parseObject(reqJson);
System.out.println("reqJson-------"+reqJson);
return goodsService.queryGoodsPrice(jsonObj);
}
@ApiOperation("收藏及取消收藏")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "goodsID", dataType = "String", required = true, value = "商品编号", defaultValue = "10"),
@ApiImplicitParam(paramType = "query", name = "shopNO", dataType = "String", required = true, value = "店铺编号", defaultValue = "00029975"),
@ApiImplicitParam(paramType = "query", name = "override", dataType = "String", required = true, value = "收藏状态(1为收藏,0为取消)", defaultValue = "1"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/myFlavor",method=RequestMethod.GET)
public String myFlavor(HttpServletRequest request, HttpServletResponse response) {
String goodsID = request.getParameter("goodsID");
String shopNO = request.getParameter("shopNO");
String override = request.getParameter("override");
String langID = request.getParameter("langID");
Map<String,Object> params=new HashMap<>();
params.put("goodsID", goodsID);
params.put("shopNO", shopNO);
params.put("override", override);
params.put("langID", langID);
return goodsService.updateFlavor(params);
}
}
package com.egolm.shop.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject;
import com.egolm.common.GsonUtil;
import com.egolm.common.StringUtil;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page;
import com.egolm.common.web.ServletUtil;
import com.egolm.shop.service.GoodsService;
import com.egolm.shop.util.I18NUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@Api(tags={"商品相关接口"})
@RestController
@RequestMapping("goods")
public class GoodsController {
@Autowired
private GoodsService goodsService;
@ApiOperation("猜你喜欢商品")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "orgNO", dataType = "String", required = true, value = "区域编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "userNO", dataType = "String", required = false, value = "用户编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "compNO", dataType = "String", required = true, value = "组件编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/thinkLike",method=RequestMethod.GET)
public String thinkLike(HttpServletRequest request) {
String orgNO = request.getParameter("orgNO");
String compNO = request.getParameter("compNO");
String userNO = "nouserNO";
try {
userNO = request.getParameter("userNO");
if(StringUtil.isEmpty(userNO)) {
userNO = "nouserNO";
}
} catch (Exception e) {
userNO = "nouserNO";
}
String langId = request.getParameter("langID");
String index = "1";
String limit = "10";
if(!StringUtil.isNotEmpty(orgNO,compNO,limit,index)) {
return Rjx.json().setCode(-1).setMessage(I18NUtils.getMessage(langId, "Msg_Parameter_empty")).toJson();
}
Map<String, Object> param = new HashMap<String, Object>();
param.put("orgNO", orgNO);
param.put("compNO", compNO);
param.put("userNO", userNO);
param.put("LangID", langId==""?"936":langId);
Page page = new Page();
page.setIndex(Long.valueOf(index));
page.setLimit(Long.valueOf(limit));
page.setLimitKey("SaleQty desc");
List<Map<String, Object>> detailList = goodsService.listThinkLike(param, page);
return Rjx.jsonOk().set("list", detailList).setPage(page).toString();
}
@ApiOperation("热销商品列表")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "orgNO", dataType = "String", required = true, value = "区域编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "compNO", dataType = "String", required = true, value = "组件编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "index", dataType = "String", required = false, value = "第几页", defaultValue = "1"),
@ApiImplicitParam(paramType = "query", name = "limit", dataType = "String", required = false, value = "每页数量", defaultValue = "20"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/getHotSaleGoods",method=RequestMethod.GET)
public String getHotSaleGoods(HttpServletRequest request, HttpServletResponse response) {
List<Map<String,Object>> listMap;
Map<String,Object> params=new HashMap<>();
params.put("OrgNO", request.getParameter("orgNO"));
params.put("CompNO", request.getParameter("compNO"));
Page page=new Page();
page.setIndex(Long.valueOf(request.getParameter("index")==null?"1":request.getParameter("index")));
page.setLimit(Long.valueOf(request.getParameter("limit")==null?"20":request.getParameter("limit")));
page.setLimitKey("SaleQty desc");
listMap=goodsService.getHotSaleGoods(params,page);
return Rjx.jsonOk().set("list", listMap).set("page",page).toJson();
}
@ApiOperation("分类商品页数据")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "orgNO", dataType = "String", required = true, value = "区域编号", defaultValue = "SHBS"),
@ApiImplicitParam(paramType = "query", name = "shopNO", dataType = "String", required = false, value = "店铺件编号", defaultValue = "00029997"),
@ApiImplicitParam(paramType = "query", name = "categoryNOA", dataType = "String", required = false, value = "一级分类编码", defaultValue = "%"),
@ApiImplicitParam(paramType = "query", name = "categoryNOB", dataType = "String", required = false, value = "二级分类编码", defaultValue = "%"),
@ApiImplicitParam(paramType = "query", name = "index", dataType = "String", required = false, value = "第几页", defaultValue = "1"),
@ApiImplicitParam(paramType = "query", name = "limit", dataType = "String", required = false, value = "每页数量", defaultValue = "20"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/getCategoryGoods",method=RequestMethod.GET)
public String getCategoryGoods(HttpServletRequest request, HttpServletResponse response) {
List<Map<String,Object>> listMap;
Map<String,Object> params=new HashMap<>();
params.put("OrgNO", request.getParameter("orgNO"));
params.put("ShopNO", request.getParameter("shopNO")==null?"":request.getParameter("ShopNO"));
params.put("CategoryNOA", request.getParameter("categoryNOA")==null?"%":request.getParameter("categoryNOA"));
params.put("CategoryNOB", request.getParameter("categoryNOB")==null?"%":request.getParameter("categoryNOB"));
Page page=new Page();
page.setIndex(Long.valueOf(request.getParameter("index")==null?"1":request.getParameter("index")));
page.setLimit(Long.valueOf(request.getParameter("limit")==null?"20":request.getParameter("limit")));
page.setLimitKey("GoodsID desc");
listMap=goodsService.GetCategoryGoods(params,page);
return Rjx.jsonOk().set("list", listMap).set("page",page).toJson();
}
@ApiOperation("热搜词")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "orgNO", dataType = "String", required = true, value = "区域编号", defaultValue = "SHBS"),
@ApiImplicitParam(paramType = "query", name = "shopNO", dataType = "String", required = false, value = "店铺编号", defaultValue = "00029997"),
@ApiImplicitParam(paramType = "query", name = "index", dataType = "String", required = false, value = "第几页", defaultValue = "1"),
@ApiImplicitParam(paramType = "query", name = "limit", dataType = "String", required = false, value = "每页数量", defaultValue = "20"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/hotSearchKey",method=RequestMethod.GET)
public String hotSearchKey(HttpServletRequest request, HttpServletResponse response) {
List<Map<String,Object>> listMap;
Map<String,Object> params=new HashMap<>();
params.put("orgNO", request.getParameter("orgNO"));
params.put("shopNO", request.getParameter("shopNO")==null?"":request.getParameter("shopNO"));
Page page=new Page();
page.setIndex(Long.valueOf(request.getParameter("index")==null?"1":request.getParameter("index")));
page.setLimit(Long.valueOf(request.getParameter("limit")==null?"10":request.getParameter("limit")));
page.setLimitKey(" searchCount desc ");
listMap=goodsService.hotSearchKey(params,page);
return Rjx.jsonOk().set("list", listMap).set("page",page).toJson();
}
@ApiOperation("统一搜索(支持品牌,分类,关键字,仓库等)")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "data", dataType = "String", required = true, value = "JSON参数", defaultValue = "{\"topCategoryNO\":\"01\",\"upCategoryNO\":\"\",\"categoryID\":[\"\"],\"brandID\":[\"\"],\"agentID\":\"\",\"warehouseNO\":\"\",\"scopeTypeID\":\"1\",\"districtID\":\"\",\"keyword\":\"*\",\"index\":1,\"limit\":10,\"userNO\":\"00034\",\"orgNO\":\"XIAN\",\"shopNO\":\"167728271\"}"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = true, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/searchGoods",method=RequestMethod.POST)
public String searchGoods(HttpServletRequest request, HttpServletResponse response) {
String reqJson = request.getParameter("data");
System.out.println("searchGoods-------"+reqJson);
Map<String, Object> argsMap = new HashMap<String,Object>();
argsMap = GsonUtil.toMap(reqJson);
String langID = request.getParameter("langID");
argsMap.put("langID", langID);
try {
if(!argsMap.containsKey("index") || !argsMap.containsKey("limit") || !argsMap.containsKey("userNO") || !argsMap.containsKey("shopNO") || !argsMap.containsKey("orgNO") ) {
return Rjx.jsonErr().setCode(-100).setMessage(I18NUtils.getMessage(langID, "Msg_Parameter_empty")).set("errorMsg", "index,limit,userNO,shopNO,orgNO " +I18NUtils.getMessage(langID, "Msg_Must_enter")).toJson();
}
} catch (Exception e) {
e.printStackTrace();
return Rjx.jsonErr().setCode(-100).setMessage(I18NUtils.getMessage(langID, "Msg_QueryParam_error")).toJson();
}
return goodsService.searchGoods(argsMap);
}
@ApiOperation("商品详情")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "goodsID", dataType = "String", required = true, value = "商品编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "contractNO", dataType = "String", required = false, value = "合同编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "custNO", dataType = "String", required = true, value = "用户账号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "shopNO", dataType = "String", required = true, value = "店铺编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/goodsDetail",method=RequestMethod.GET)
public String goodsDetail(HttpServletRequest request, HttpServletResponse response) {
Map<String,Object> params=new HashMap<>();
params.put("custNO", request.getParameter("custNO"));
params.put("shopNO", request.getParameter("shopNO")==null?"":request.getParameter("shopNO"));
params.put("goodsID", request.getParameter("goodsID")==null?"":request.getParameter("goodsID"));
params.put("contractNO", request.getParameter("contractNO")==null?"":request.getParameter("contractNO"));
params.put("langID", request.getParameter("langID")==null?936:request.getParameter("langID"));
params.put("terminal", request.getParameter("terminal")==null?"":request.getParameter("terminal"));
return goodsService.goodsDetail(params);
}
@ApiOperation("批量查询商品价格 (参数为json对象)")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", dataType = "String", required = false, value = "JSON格式", defaultValue = "{\"goodsList\": [\"10\",\"12\"],\"custNO\": \"15996801133\",\"shopNO\": \"00029975\",\"terminal\": \"wechat\",\"langID\": 936}"),
})
@RequestMapping(value = "/queryGoodsPrice",method=RequestMethod.POST,produces = "application/json")
public String queryGoodsPrice(HttpServletRequest request, HttpServletResponse response) {
String reqJson = ServletUtil.readReqJson(request);
JSONObject jsonObj = JSONObject.parseObject(reqJson);
System.out.println("reqJson-------"+reqJson);
return goodsService.queryGoodsPrice(jsonObj);
}
@ApiOperation("收藏及取消收藏")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "goodsID", dataType = "String", required = true, value = "商品编号", defaultValue = "10"),
@ApiImplicitParam(paramType = "query", name = "shopNO", dataType = "String", required = true, value = "店铺编号", defaultValue = "00029975"),
@ApiImplicitParam(paramType = "query", name = "override", dataType = "String", required = true, value = "收藏状态(1为收藏,0为取消)", defaultValue = "1"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/myFlavor",method=RequestMethod.GET)
public String myFlavor(HttpServletRequest request, HttpServletResponse response) {
String goodsID = request.getParameter("goodsID");
String shopNO = request.getParameter("shopNO");
String override = request.getParameter("override");
String langID = request.getParameter("langID");
Map<String,Object> params=new HashMap<>();
params.put("goodsID", goodsID);
params.put("shopNO", shopNO);
params.put("override", override);
params.put("langID", langID);
return goodsService.updateFlavor(params);
}
}
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