Commit d522661c authored by 张永's avatar 张永

需求 #15254

parent c9eb80f9
...@@ -135,6 +135,26 @@ public class CartController { ...@@ -135,6 +135,26 @@ public class CartController {
return cartService.updateQty(jsonObj,terminal); return cartService.updateQty(jsonObj,terminal);
} }
@ApiOperation("增加可选择商品去结算(JSON格式)")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "orgNo", dataType = "String", required = true),
@ApiImplicitParam(paramType = "query", name = "data", dataType = "String", required = false, value = "JSON格式", defaultValue = "{\"shopNO\": \"00029975\",\"idxs\": [1,2,3]}"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/updateSelected",method=RequestMethod.POST)
public String updateSelected(String orgNo, HttpServletRequest request, HttpServletResponse response) {
String reqJson = request.getParameter("data");
JSONObject jsonObj = JSONObject.parseObject(reqJson);
jsonObj.put("orgNo", orgNo);
System.out.println("updateSelected-------"+reqJson);
String terminal = request.getParameter("terminal");
return cartService.updateSelected(jsonObj,terminal);
}
@ApiOperation("修改价格(JSON格式)") @ApiOperation("修改价格(JSON格式)")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "orgNo", dataType = "String", required = true), @ApiImplicitParam(paramType = "query", name = "orgNo", dataType = "String", required = true),
......
package com.egolm.shop.api.service; package com.egolm.shop.api.service;
import java.util.Map; import java.util.Map;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
public interface CartService { public interface CartService {
public String append(JSONObject obj,String terminal); public String append(JSONObject obj,String terminal);
public String remove(JSONObject obj,String terminal); public String remove(JSONObject obj,String terminal);
public String updateQty (JSONObject obj,String terminal); public String updateQty (JSONObject obj,String terminal);
public String query (Map<String,Object> params); public String updateSelected (JSONObject obj,String terminal);
public Map<String, Object> count(String orgNo, String shopNO); public String query (Map<String,Object> params);
public void clear(String orgNo, String shopNo); public Map<String, Object> count(String orgNo, String shopNO);
public String setPrice(JSONObject jsonObj, String terminal); public void clear(String orgNo, String shopNo);
}
public String setPrice(JSONObject jsonObj, String terminal);
}
...@@ -192,6 +192,40 @@ public class CartServiceImpl implements CartService { ...@@ -192,6 +192,40 @@ public class CartServiceImpl implements CartService {
return Rjx.jsonOk().set("count", count(orgNo, shopNO)).toJson(); return Rjx.jsonOk().set("count", count(orgNo, shopNO)).toJson();
} }
/**
* 需求 #15254
* @Title: updateSelected
* @Description: 修改购物车页面:加入商品选择勾选框、购物车数据表加入商品选择标记、调整所有购物车的促销以及金额计算逻辑,只计算有选中标记的商品、订单提交页面和订单展示页面加入品牌
* @param @param obj
* @param @param terminal
* @param @return 设定文件
* @return 返回类型
* @throws
*/
public String updateSelected (JSONObject obj,String terminal) {
String orgNo = obj.getString("orgNo");
String shopNO = obj.getString("shopNO");
JSONArray idxArray = obj.getJSONArray("idxs");
System.out.println("idxArray----"+idxArray);
List<String> nIdx = new ArrayList<String>();
if(idxArray == null) {
nIdx.add("0");
}else {
for(int i = 0;i<idxArray.size();i++) {
nIdx.add(idxArray.get(i)+"");
}
}
jdbcTemplate.executeUpdate("update tCart set nIsSelected= 0 where sOrgNO = '" + orgNo + "' and sShopNO = '" + shopNO + "'" );
jdbcTemplate.executeUpdate("update tCart set nIsSelected= 1 where sOrgNO = '" + orgNo + "' and sShopNO = '" + shopNO + "'" + StringUtil.join(", ", " and nIdx in (", ")", nIdx));
return Rjx.jsonOk().set("count", count(orgNo, shopNO)).toJson();
}
@Override @Override
public String setPrice(JSONObject obj, String terminal) { public String setPrice(JSONObject obj, String terminal) {
......
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