Commit 87647a66 authored by 张永's avatar 张永
parents 118d4b21 da5ac907
......@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject;
import com.egolm.common.bean.Rjx;
import com.egolm.shop.service.CartService;
import io.swagger.annotations.Api;
......@@ -27,6 +28,22 @@ public class CartController {
@Autowired
private CartService cartService;
@ApiOperation("购物车商品种类数量")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "orgNo", dataType = "String", required = true),
@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 = "/getCartCount",method=RequestMethod.GET)
public String cartQuery(String orgNo, String shopNo) {
Integer count = cartService.count(orgNo, shopNo);
return Rjx.jsonOk().set("count", count).toJson();
}
@ApiOperation("购物车信息")
@ApiImplicitParams({
......
......@@ -225,8 +225,8 @@ public class UserController {
@ApiOperation("修改认证信息")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", dataType = "int", name = "shopId", value = "店铺ID"),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "shopName", value = "店铺名称"),
@ApiImplicitParam(paramType = "query", dataType = "int", name = "shopId", value = "店铺ID", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "shopName", value = "店铺名称", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "provinceId", value = "省ID"),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "cityId", value = "市ID"),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "districtId", value = "区ID"),
......
......@@ -13,4 +13,6 @@ public interface CartService {
public String updateQty (JSONObject obj,String terminal);
public String query (Map<String,Object> params);
public Integer count(String orgNo, String shopNO);
}
......@@ -815,7 +815,6 @@ public class CartRedisServiceImpl implements CartRedisService {
Double MinOrderAmt = Util.objTo(goodsFirst.get("nMinDCAmount"), Double.class); // 最小配送金额
String WMSInfo = (String) goodsFirst.get("sWarehouseName"); // 物流名称
String sWarehouseNO = (String) goodsFirst.get("sWarehouseNO"); // 物流名称
String sOrgNO = (String) goodsFirst.get("wOrgNO"); // 物流名称
for (Map<String, Object> goods : GoodsList) {
BigDecimal goodsAmount = (BigDecimal) goods.get("nRealSalePrice"); // 当前销售价格
BigDecimal nSaleQty = (BigDecimal) goods.get("nSaleQty"); // 购物车商品数量
......@@ -830,7 +829,6 @@ public class CartRedisServiceImpl implements CartRedisService {
zoneGoods.put("warehouseNo", sWarehouseNO);
zoneGoods.put("minOrderAmt", MinOrderAmt);
zoneGoods.put("totalAmount", TotalAmount);
zoneGoods.put("orgNo", sOrgNO);
zoneGoods.put("goodsIdList", pidlist);
wmsList.add(zoneGoods);
TotalCount += GoodsList.size();
......@@ -839,18 +837,27 @@ public class CartRedisServiceImpl implements CartRedisService {
}
private List<Map<String, Object>> getGoodsList(String orgNo, String shopNo, String terminal) {
String sqlPromoTag = "" + "SELECT " + "c.sPromoPaperNO, " + "p.nTag, " + "p.dPromoBeginDate, "
+ "p.dPromoEndDate " + "FROM " + "tCart c "
+ "LEFT JOIN tYWPromoMain p ON p.sPromoPaperNO = c.sPromoPaperNO " + "WHERE " + "c.sShopNO = '" + shopNo
+ "'";
String sqlClearPromoNo = "" + "SELECT " + "pn.sPromoPaperNO " + "FROM " + "(" + sqlPromoTag + ") pn " + "WHERE "
+ "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 " + "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 sqlPromoTag =
"SELECT "
+ "c.sPromoPaperNO, "
+ "p.nTag, "
+ "p.dPromoBeginDate, "
+ "p.dPromoEndDate "
+ "FROM "
+ "tCart c "
+ "LEFT JOIN tYWPromoMain p ON p.sPromoPaperNO = c.sPromoPaperNO "
+ "WHERE "
+ "c.sShopNO = '" + shopNo + "'";
String sqlClearPromoNo =
"SELECT "
+ "pn.sPromoPaperNO "
+ "FROM "
+ "(" + sqlPromoTag + ") pn "
+ "WHERE 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 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 sqlACart = "select * from V_Cart where sOrgNO = '" + orgNo + "' and sShopNO = '" + shopNo + "' order by nIdx";
String sqlp = ""
......@@ -921,8 +928,7 @@ public class CartRedisServiceImpl implements CartRedisService {
+ " GROUP BY "
+ " sPromoPaperNO ";
ResultMutil resultMutil = jdbcTemplate
.executeMutil(sqlClear + Util.LINE_SEPARATOR + sqlACart + sqlp + Util.LINE_SEPARATOR);
ResultMutil resultMutil = jdbcTemplate.executeMutil(sqlClear + Util.LINE_SEPARATOR + sqlACart + (sqlp.replaceAll("\\s+", " ")) + Util.LINE_SEPARATOR);
List<Map<String, Object>> datas = resultMutil.getDatas().get(0);
List<Map<String, Object>> pds = resultMutil.getDatas().get(1);
......
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