Commit 9d0bdc96 authored by Quxl's avatar Quxl

x

parent 64e51427
......@@ -50,7 +50,7 @@ public class CartController {
@ApiOperation("加入购物车(JSON格式)")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "data", dataType = "String", required = false, value = "JSON格式", defaultValue = "{\"shopNO\": \"00029975\",\"cartList\": [{\"goodsID\": \"30771\",\"goodsTypeID\": 0,\"saleQty\": \"24\",\"agentContractNO\": \"600327002\",\"promoGroupNO\":\"\",\"promoPaperNO\":\"00001810100007\" }]}"),
@ApiImplicitParam(paramType = "query", name = "data", dataType = "String", required = false, value = "JSON格式", defaultValue = "{\"shopNO\": \"00029975\",\"orgNo\": \"1001\",\"cartList\": [{\"goodsID\": \"30771\",\"goodsTypeID\": 0,\"saleQty\": \"24\",\"agentContractNO\": \"600327002\",\"promoGroupNO\":\"\",\"promoPaperNO\":\"00001810100007\" }]}"),
@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 = ""),
......
......@@ -847,33 +847,11 @@ public class CartRedisServiceImpl implements CartRedisService {
+ "pn.nTag&2 != 2 OR pn.nTag&1 = 1 OR GETDATE() < pn.dPromoBeginDate OR GETDATE() >= pn.dPromoEndDate";
String sqlClear = "" + "DELETE mmm FROM tCart mmm WHERE mmm.sShopNO = '" + shopNo
+ "' AND EXISTS ( SELECT NULL FROM tAgentContractGoods nnn WHERE nnn.nGoodsID = mmm.nGoodsID AND nnn.sAgentContractNO = mmm.sAgentContractNO AND (nnn.nTag & 16 = 0 or nnn.nTag & 1 = 1) AND mmm.sShopNO = '"
+ shopNo + "' )" + Util.LINE_SEPARATOR + /*"DELETE mmmm FROM tCart mmmm WHERE mmmm.sShopNO = '" + shopNo
+ "' AND NOT EXISTS ( SELECT NULL FROM tWarehouseDistrict wd, tShop s, tAgentContractWarehouse acw, tAgentContractGoods acg WHERE wd.sDistrictID = s.sDistrictID AND s.sShopNO = '"
+ shopNo
+ "' AND wd.nTag & 1 = 0 AND acw.sWarehouseNO = wd.sWarehouseNO AND acw.nTag & 1 = 0 AND acg.sAgentContractNO = acw.sAgentContractNO AND acg.nGoodsID = mmmm.nGoodsID AND acg.sAgentContractNO = mmmm.sAgentContractNO ) "
+ Util.LINE_SEPARATOR +*/ "DELETE " + "tCart " + "WHERE " + "sShopNO = '" + shopNo + "' " + "AND nTag = 1 "
+ shopNo + "' )" + Util.LINE_SEPARATOR + "DELETE " + "tCart " + "WHERE " + "sShopNO = '" + shopNo + "' " + "AND nTag = 1 "
+ "AND sPromoPaperNO IN (" + sqlClearPromoNo + ")" + Util.LINE_SEPARATOR + "UPDATE tCart SET "
+ "sPromoGroupNO = NULL, " + "sPromoPaperNO = NULL " + "WHERE " + "sShopNO = '" + shopNo + "' "
+ "AND sPromoPaperNO IN (" + sqlClearPromoNo + ")";
String sqlCart = "" + "SELECT " + "distinct og.nGoodsID nGoodsID_G, " + "c.*, " + "p.sPromoActionTypeID, "
+ "p.sPromoName, " + "og.nTag gnTag, " + "og.sWarehouseNO, " + "og.nStockQty, " + "og.sURL, "
+ "og.nAgentID, " + "og.sGoodsDesc, " + "og.sSpec, " + "og.sUnit, " + "og.nMinSaleQty, "
+ "og.nSaleUnits, " + "og.nSalePrice, " + "og.nRealSalePrice, " + "og.nTag nTag_CG, " + "og.sBrand, "
+ "og.sBrandID, " + "og.sCategoryNO ," + "cust.sCustTypeID " + "FROM " + "tCart c "
+ "LEFT JOIN V_CategoryGoods og ON og.sShopNO = '" + shopNo
+ "' AND og.sAgentContractNO = c.sAgentContractNO AND og.nGoodsID = c.nGoodsID "
+ "LEFT JOIN tYWPromoMain p ON p.sPromoPaperNO = c.sPromoPaperNO "
+ "LEFT JOIN tCustomer cust ON cust.sCustNO = (SELECT shop.sCustNO FROM tShop shop WHERE shop.sShopNO = '"
+ shopNo + "')" + "WHERE " + "c.sShopNO = '" + shopNo + "'";
String sqlACart = "" + "SELECT " + "c.*, " + "m.nPartakeNum, " + "m.nPartakeCycle, " + "m.dPromoBeginDate, "
+ "agent.sAgentName, " + "w.sWarehouseName, "
+ "CASE WHEN wcts.nMinOrderAmount is not null THEN wcts.nMinOrderAmount ELSE w.nMinDCAmount END nMinDCAmount, "
+ "CASE w.sWarehouseTypeID WHEN 3 THEN 'china' ELSE '' END wOrgNO " + "FROM " + "(" + sqlCart + ") c "
+ "LEFT JOIN tWarehouse w ON w.sWarehouseNO = c.sWarehouseNO "
+ "LEFT JOIN tWarehouseCustTypeSet wcts ON wcts.nTag = 0 AND wcts.sWarehouseNO = c.sWarehouseNO AND wcts.sCustTypeID = c.sCustTypeID "
+ "LEFT JOIN tAgent agent ON agent.nAgentID = c.nAgentID "
+ "LEFT JOIN tYWPromoMain m ON m.sPromoPaperNO = c.sPromoPaperNO " + "WHERE "
+ "c.nGoodsID_G IS NOT NULL " + "and c.sWarehouseNO IS NOT NULL " + "ORDER BY c.nIdx";
String sqlACart = "select * from V_Cart where sShopNO = '" + shopNo + "' order by nIdx";
String sqlp = ""
+ " SELECT "
......
......@@ -27,30 +27,9 @@ public class CartServiceImpl implements CartService {
@Autowired
private CartRedisService cartRedisService;
/**
* {
"shopNO": "00029975",
"terminal": "wechat",
"langID": "936",
"cartList": [
{
"goodsID": "10",
"goodsTypeID": 0,
"saleQty": "24",
"agentContractNO": "C001201608120004",
"promoGroupNO": "",
"promoPaperNO": ""
}
]
}
* <p>Title: append</p>
* <p>Description:加入购物车 </p>
* @param obj
* @return
* @see com.egolm.shop.service.CartService#append(com.alibaba.fastjson.JSONObject)
*/
public String append(JSONObject obj,String terminal) {
String shopNO = obj.getString("shopNO");
String orgNo = obj.getString("orgNo");
JSONArray cartList = obj.getJSONArray("cartList");
Integer nMaxIdx = jdbcTemplate.queryForInt("select max(nIdx) from tCart where sShopNO = '" + shopNO + "'");
......@@ -70,6 +49,7 @@ public class CartServiceImpl implements CartService {
String sPromoGroupNO = Util.objTo(cartObj.get("promoGroupNO"), String.class, null);
if(StringUtil.isNotBlank(sPromoPaperNO) && StringUtil.isNotBlank(sPromoGroupNO)) {
} else {
List<String> strs = new ArrayList<String>();
strs.add("sShopNO = '" + shopNO + "'");
......@@ -88,8 +68,8 @@ public class CartServiceImpl implements CartService {
}
List<Map<String, Object>> list = jdbcTemplate.queryForList("select nIdx, nSaleQty, sPromoPaperNO from tCart" + StringUtil.join(" and ", " where ", "", strs));
if(list.size() == 0) {
Object[] args = new Object[]{shopNO, ++nMaxIdx, nGoodsTypeID, sAgentContractNO, nGoodsID, nSaleQty, sPromoPaperNO, sPromoGroupNO};
jdbcTemplate.executeUpdate("insert into tCart (sShopNO, nIdx, nTag, sAgentContractNO, nGoodsID, nSaleQty, dLastUpdateTime, sPromoPaperNO, sPromoGroupNO) values (?, ?, ?, ?, ?, ?, getdate(), ?, ?)", args);
Object[] args = new Object[]{shopNO, orgNo, ++nMaxIdx, nGoodsTypeID, sAgentContractNO, nGoodsID, nSaleQty, sPromoPaperNO, sPromoGroupNO};
jdbcTemplate.executeUpdate("insert into tCart (sShopNO, sOrgNO, nIdx, nTag, sAgentContractNO, nGoodsID, nSaleQty, dLastUpdateTime, sPromoPaperNO, sPromoGroupNO) values (?, ?, ?, ?, ?, ?, ?, getdate(), ?, ?)", args);
} else {
Integer nIdx = Util.objTo(list.get(0).get("nIdx"), Integer.class);
Double nQty = Util.objTo(list.get(0).get("nSaleQty"), Double.class);
......
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