Commit c42fa157 authored by Quxl's avatar Quxl

x

parent d14cfab1
......@@ -194,10 +194,8 @@ public class GoodsController {
@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 = "goodsId", dataType = "String", required = true, value = "商品编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "contractNo", dataType = "String", required = false, 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 = ""),
......@@ -205,24 +203,19 @@ public class GoodsController {
})
@RequestMapping(value = "/goodsDetail",method=RequestMethod.GET)
public String goodsDetail(HttpServletRequest request, HttpServletResponse response) {
public String goodsDetail(String goodsId, String contractNo, String terminal, String langID, 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"));
params.put("goodsId", goodsId);
params.put("contractNo", contractNo);
params.put("langID", langID);
params.put("terminal", 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) {
......
......@@ -28,7 +28,6 @@ import com.egolm.shop.service.GoodsService;
import com.egolm.shop.service.SolrGoodsService;
import com.egolm.shop.service.UserService;
import com.egolm.shop.util.I18NUtils;
import com.egolm.shop.util.ShopContstrant;
@Service
public class GoodsServiceImpl implements GoodsService {
private static final Log logger = LogFactory.getLog(GoodsServiceImpl.class);
......@@ -368,26 +367,12 @@ public class GoodsServiceImpl implements GoodsService {
*/
@Override
public String goodsDetail(Map<String, Object> map) {
String custNO=(String) map.get("custNO");
String shopNO=(String) map.get("shopNO");
String terminal=(String) map.get("terminal");
String goodsID=(String) map.get("goodsID");
String contractNO=(String) map.get("contractNO");
TCustomer customer = userService.getCustomer(custNO,shopNO);
String goodsInfoSql = GoodsSql.goodsInfoSql(customer,map);
jdbcTemplate.setDialect(new SqlServerDialect());
//正式用户保存浏览记录
if(!customer.getsCustLeveTypeID().equals(ShopContstrant.GUEST_LEVEL_TYPE_ID)) {
commonService.saveViewHistory(customer.gettShops().get(0).getsOrgNO(), terminal, shopNO, "1", goodsID);
}
Map<String,Object> goodsDetailMap = jdbcTemplate.queryForMap(goodsInfoSql);
//获取商品图片
List<Map<String,Object>> picList = goodsPicList(goodsID, contractNO);
return Rjx.jsonOk().set("goodsDetail", goodsDetailMap).set("imgGroup", picList).toJson();
String goodsId=(String) map.get("goodsId");
String contractNo=(String) map.get("contractNo");
String sql = "select * from tAgentContractGoods where sContractNO = ? and nGoodsID = ?";
Map<String, Object> detail = jdbcTemplate.queryForMap(sql, contractNo, goodsId);
List<Map<String,Object>> picList = goodsPicList(goodsId, contractNo);
return Rjx.jsonOk().set("goodsDetail", detail).set("imgGroup", picList).toJson();
}
......
......@@ -9,95 +9,6 @@ import com.egolm.shop.util.ShopContstrant;
public class GoodsSql {
/**
* 查询商品详情
* @Title: goodsInfoSql
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param: @param customer
* @param: @param shop
* @param: @param goodsID
* @param: @return
* @return: String
* @throws
*/
public static String goodsInfoSql(TCustomer customer,Map<String, Object> map) {
String goodsID=(String) map.get("goodsID");
String contractNO=(String) map.get("contractNO");
TShop tshop = customer.gettShops().get(0);
String goodInfoSql = "";
if(customer.getsCustLeveTypeID().equals(ShopContstrant.GUEST_LEVEL_TYPE_ID)) { //游客
goodInfoSql="SELECT TOP 1 "
+ " goodsID = g.nGoodsID, "
+ " goodsNO = g.sGoodsNO, "
+ " goodsName = g.sGoodsDesc, "
+ " contractNO = g.sAgentContractNO, "
+ " agentName=g.sAgentName,"
+ " categoryID = g.sCategoryNO, "
+ " tag=g.nTag, "
+ " barcode = g.sMainBarcode, "
+ " brandID = g.sBrandID, "
+ " brand = g.sBrand, "
+ " spec = g.sSpec, "
+ " minSaleQty = g.nMinSaleQty, "
+ " saleUnits = g.nSaleUnits, "
+ " orderUnits = g.nSaleUnits, "
+ " goodsUnit = g.sMarketUnit, "
+ " agentUnit = g.sUnit, "
+ " marketPrice = g.nMarketPrice, "
+ " salePrice = g.nSalePrice, "
+ " realSalePrice =g.nRealSalePrice, "
+ " DCPriority = g.nDCPriority, "
+ " stock = g.nStockQty, "
+ " imgPath = g.sURL, "
+ " flavor = g.Flavor,"
+ " caseUnits=g.nCaseUnits"
+ " FROM "
+ " V_DistrictGoods g "
+ " WHERE "
+ " g.nGoodsID = " + goodsID + " "
+ " AND g.sDistrictID='"+tshop.getsDistrictID()+"' AND (g.sOrgNO='"+tshop.getsOrgNO()+"' or g.sOrgNO='china') "
+ " AND g.nTag&1=0 "
;
}else {
goodInfoSql="SELECT TOP 1 "
+ " goodsID = g.nGoodsID, "
+ " goodsNO = g.sGoodsNO, "
+ " goodsName = g.sGoodsDesc, "
+ " contractNO = g.sAgentContractNO, "
+ " agentName=g.sAgentName,"
+ " categoryID = g.sCategoryNO, "
+ " tag=g.nTag, "
+ " barcode = g.sMainBarcode, "
+ " brandID = g.sBrandID, "
+ " brand = g.sBrand, "
+ " spec = g.sSpec, "
+ " minSaleQty = g.nMinSaleQty, "
+ " saleUnits = g.nSaleUnits, "
+ " orderUnits = g.nSaleUnits, "
+ " goodsUnit = g.sMarketUnit, "
+ " agentUnit = g.sUnit, "
+ " marketPrice = g.nMarketPrice, "
+ " salePrice = g.nSalePrice, "
+ " realSalePrice =g.nRealSalePrice, "
+ " DCPriority = g.nDCPriority, "
+ " stock = g.nStockQty, "
+ " imgPath = g.sURL, "
+ " flavor = g.Flavor,"
+ " caseUnits=g.nCaseUnits"
+ " FROM "
+ " V_CategoryGoods g "
+ " WHERE "
+ " g.nGoodsID = " + goodsID + " "
+ " AND g.sShopNO = '" + tshop.getsShopNO() + "' "
+ " AND g.nTag&1=0 "
;
}
if(StringUtil.isNotEmpty(contractNO)){
goodInfoSql += " AND g.sAgentContractNO='"+contractNO+"' ";
}
return goodInfoSql;
}
/**
* 商品价格SQL
......
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