Commit f6da9878 authored by Quxl's avatar Quxl

x

parent 3eab5926
......@@ -42,7 +42,6 @@ public class CartServiceImpl implements CartService {
if(cartList != null && cartList.size() > 0) {
for(int i = 0; i<cartList.size();i++) {
JSONObject cartObj = cartList.getJSONObject(i);
Integer nGoodsTypeID = Util.objTo(cartObj.get("goodsTypeID"), Integer.class, 0);
Integer nSaleQty = Util.objTo(cartObj.get("saleQty"), Integer.class, null);
BigDecimal nSetPrice = Util.objTo(cartObj.get("setPrice"), BigDecimal.class, null);
......@@ -50,16 +49,25 @@ public class CartServiceImpl implements CartService {
String sAgentContractNO = Util.objTo(cartObj.get("agentContractNO"), String.class);
String sPromoPaperNO = Util.objTo(cartObj.get("promoPaperNO"), String.class, null);
String sPromoGroupNO = Util.objTo(cartObj.get("promoGroupNO"), String.class, null);
if(StringUtil.isNotBlank(sPromoPaperNO) && StringUtil.isNotBlank(sPromoGroupNO)) {
} else {
if(StringUtil.isNotBlank(sPromoPaperNO)) {
jdbcTemplate.executeUpdate("update tCart set sPromoPaperNO = ?, sPromoGroupNO = ? where sOrgNO = ? and sShopNO = ? and sAgentContractNO = ? and nGoodsID = ? and nTag = ? and (sPromoPaperNO is null or sPromoPaperNO = '')",sPromoPaperNO, sPromoGroupNO, orgNo, shopNO, sAgentContractNO, nGoodsID, nGoodsTypeID);
}
List<String> strs = new ArrayList<String>();
strs.add("sOrgNO = '" + orgNo + "'");
strs.add("sShopNO = '" + shopNO + "'");
strs.add("nTag = " + nGoodsTypeID);
strs.add("sAgentContractNO = '" + sAgentContractNO + "'");
strs.add("nGoodsID = " + nGoodsID);
if(StringUtil.isNotBlank(sPromoPaperNO)) {
strs.add("sPromoPaperNO = '" + sPromoPaperNO + "'");
} else {
strs.add("(sPromoPaperNO = '' or sPromoPaperNO is null)");
}
if(StringUtil.isNotBlank(sPromoGroupNO)) {
strs.add("sPromoGroupNO = '" + sPromoGroupNO + "'");
} else {
strs.add("(sPromoGroupNO = '' or sPromoGroupNO is null)");
}
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, orgNo, ++nMaxIdx, nGoodsTypeID, sAgentContractNO, nGoodsID, nSaleQty, nSetPrice, sPromoPaperNO, sPromoGroupNO};
......@@ -67,13 +75,9 @@ public class CartServiceImpl implements CartService {
} else {
Integer nIdx = Util.objTo(list.get(0).get("nIdx"), Integer.class);
Double nQty = Util.objTo(list.get(0).get("nSaleQty"), Double.class);
if(StringUtil.isNotBlank(sPromoPaperNO)) {
jdbcTemplate.executeUpdate("update tCart set sPromoPaperNO = ?, sPromoGroupNO = ?, nSaleQty = " + (nSaleQty + nQty) + ", nSetPrice = ? where sOrgNO = ? and sShopNO = ? and nIdx = ?", sPromoPaperNO, sPromoGroupNO, nSetPrice, orgNo, shopNO, nIdx);
} else {
jdbcTemplate.executeUpdate("update tCart set nSaleQty = " + (nSaleQty + nQty) + ", nSetPrice = ? where sOrgNO = ? and sShopNO = ? and nIdx = ?", nSetPrice, orgNo, shopNO, nIdx);
}
}
}
}
}
return Rjx.jsonOk().set("count", count(orgNo, shopNO)).toJson();
......
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