Commit 606d786f authored by 张永's avatar 张永

需求 #16747

parent 445f36ef
...@@ -84,7 +84,7 @@ public class CartController { ...@@ -84,7 +84,7 @@ public class CartController {
@ApiOperation("加入购物车(JSON格式)") @ApiOperation("加入购物车(JSON格式)")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "orgNo", dataType = "String", required = true), @ApiImplicitParam(paramType = "query", name = "orgNo", dataType = "String", required = true),
@ApiImplicitParam(paramType = "query", name = "data", dataType = "String", required = false, value = "JSON格式", defaultValue = "{\"shopNO\": \"00029975\",\"cartList\": [{\"goodsID\": \"30771\",\"goodsTypeID\": 0,\"saleQty\": \"24\",\"saleUnit\": \"单位\", \"setPrice\": \"10.5\",\"agentContractNO\": \"600327002\",\"promoGroupNO\":\"\",\"promoPaperNO\":\"00001810100007\"}]}"), @ApiImplicitParam(paramType = "query", name = "data", dataType = "String", required = false, value = "JSON格式", defaultValue = "{\"shopNO\": \"00029975\",\"cartList\": [{\"goodsID\": \"30771\",\"goodsTypeID\": 0,\"saleQty\": \"24\",\"saleUnit\": \"单位\",\"saleBigQty\": \"虚拟的大单位销售数量\", \"setPrice\": \"10.5\",\"agentContractNO\": \"600327002\",\"promoGroupNO\":\"\",\"promoPaperNO\":\"00001810100007\"}]}"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端标识", defaultValue = "wechat"), @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 = "langID", dataType = "String", required = true, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
...@@ -127,7 +127,7 @@ public class CartController { ...@@ -127,7 +127,7 @@ public class CartController {
@ApiOperation("修改数量(JSON格式)") @ApiOperation("修改数量(JSON格式)")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "orgNo", dataType = "String", required = true), @ApiImplicitParam(paramType = "query", name = "orgNo", dataType = "String", required = true),
@ApiImplicitParam(paramType = "query", name = "data", dataType = "String", required = false, value = "JSON格式", defaultValue = "{\"shopNO\": \"00029975\", \"idx\": 2,\"saleQty\": \"23\",\"saleUnit\": \"单位\"}"), @ApiImplicitParam(paramType = "query", name = "data", dataType = "String", required = false, value = "JSON格式", defaultValue = "{\"shopNO\": \"00029975\", \"idx\": 2,\"saleQty\": \"23\",\"saleUnit\": \"单位\",\"saleBigQty\": \"虚拟的大单位销售数量\"}"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "") @ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
......
...@@ -79,6 +79,9 @@ public class CartServiceImpl implements CartService { ...@@ -79,6 +79,9 @@ public class CartServiceImpl implements CartService {
String sPromoPaperNO = Util.objTo(cartObj.get("promoPaperNO"), String.class, null); String sPromoPaperNO = Util.objTo(cartObj.get("promoPaperNO"), String.class, null);
String sPromoGroupNO = Util.objTo(cartObj.get("promoGroupNO"), String.class, null); String sPromoGroupNO = Util.objTo(cartObj.get("promoGroupNO"), String.class, null);
String sSaleUnit = Util.objTo(cartObj.get("saleUnit"),String.class,null); String sSaleUnit = Util.objTo(cartObj.get("saleUnit"),String.class,null);
Integer saleBigQty = Util.objTo(cartObj.get("saleBigQty"), Integer.class, 0);
if(StringUtil.isNotBlank(sPromoPaperNO)) { if(StringUtil.isNotBlank(sPromoPaperNO)) {
jdbcTemplate.executeUpdate("update tCart set sPromoPaperNO = ?, sPromoGroupNO = ? where sOrgNO = ? and sShopNO = ? and sAgentContractNO = ? and nGoodsID = ? and nTag = ? and sSaleUnit = ? and (sPromoPaperNO is null or sPromoPaperNO = '')",sPromoPaperNO, sPromoGroupNO, orgNo, shopNO, sAgentContractNO, nGoodsID, nGoodsTypeID,sSaleUnit); jdbcTemplate.executeUpdate("update tCart set sPromoPaperNO = ?, sPromoGroupNO = ? where sOrgNO = ? and sShopNO = ? and sAgentContractNO = ? and nGoodsID = ? and nTag = ? and sSaleUnit = ? and (sPromoPaperNO is null or sPromoPaperNO = '')",sPromoPaperNO, sPromoGroupNO, orgNo, shopNO, sAgentContractNO, nGoodsID, nGoodsTypeID,sSaleUnit);
} }
...@@ -101,12 +104,12 @@ public class CartServiceImpl implements CartService { ...@@ -101,12 +104,12 @@ public class CartServiceImpl implements CartService {
} }
List<Map<String, Object>> list = jdbcTemplate.queryForList("select nIdx, nSaleQty, sPromoPaperNO from tCart" + StringUtil.join(" and ", " where ", "", strs)); List<Map<String, Object>> list = jdbcTemplate.queryForList("select nIdx, nSaleQty, sPromoPaperNO from tCart" + StringUtil.join(" and ", " where ", "", strs));
if(list.size() == 0) { if(list.size() == 0) {
Object[] args = new Object[]{shopNO, orgNo, ++nMaxIdx, nGoodsTypeID, sAgentContractNO, nGoodsID, nSaleQty, nSetPrice, sPromoPaperNO, sPromoGroupNO,sSaleUnit}; Object[] args = new Object[]{shopNO, orgNo, ++nMaxIdx, nGoodsTypeID, sAgentContractNO, nGoodsID, nSaleQty, nSetPrice, sPromoPaperNO, sPromoGroupNO,sSaleUnit,saleBigQty};
jdbcTemplate.executeUpdate("insert into tCart (sShopNO, sOrgNO, nIdx, nTag, sAgentContractNO, nGoodsID, nSaleQty, nSetPrice, dLastUpdateTime, sPromoPaperNO, sPromoGroupNO,sSaleUnit) values (?, ?, ?, ?, ?, ?, ?, ?, getdate(), ?, ?,?)", args); jdbcTemplate.executeUpdate("insert into tCart (sShopNO, sOrgNO, nIdx, nTag, sAgentContractNO, nGoodsID, nSaleQty, nSetPrice, dLastUpdateTime, sPromoPaperNO, sPromoGroupNO,sSaleUnit,nSaleBigQty) values (?, ?, ?, ?, ?, ?, ?, ?, getdate(), ?, ?,?,?)", args);
} else { } else {
Integer nIdx = Util.objTo(list.get(0).get("nIdx"), Integer.class); Integer nIdx = Util.objTo(list.get(0).get("nIdx"), Integer.class);
Double nQty = Util.objTo(list.get(0).get("nSaleQty"), Double.class); Double nQty = Util.objTo(list.get(0).get("nSaleQty"), Double.class);
jdbcTemplate.executeUpdate("update tCart set nSaleQty = " + (nSaleQty + nQty) + ", nSetPrice = ? ,sSaleUnit = ? where sOrgNO = ? and sShopNO = ? and nIdx = ?", nSetPrice,sSaleUnit, orgNo, shopNO, nIdx); jdbcTemplate.executeUpdate("update tCart set nSaleQty = " + (nSaleQty + nQty) + ", nSetPrice = ? ,sSaleUnit = ?,nSaleBigQty =? where sOrgNO = ? and sShopNO = ? and nIdx = ?", nSetPrice,sSaleUnit,saleBigQty, orgNo, shopNO, nIdx);
} }
} }
...@@ -186,6 +189,7 @@ public class CartServiceImpl implements CartService { ...@@ -186,6 +189,7 @@ public class CartServiceImpl implements CartService {
String orgNo = obj.getString("orgNo"); String orgNo = obj.getString("orgNo");
String shopNO = obj.getString("shopNO"); String shopNO = obj.getString("shopNO");
Integer idx = obj.getInteger("idx"); Integer idx = obj.getInteger("idx");
Integer saleBigQty = Util.objTo(obj.get("saleBigQty"), Integer.class, 0);
BigDecimal saleQty = obj.getBigDecimal("saleQty"); BigDecimal saleQty = obj.getBigDecimal("saleQty");
String langID = obj.getString("langID"); String langID = obj.getString("langID");
String saleUnit = obj.getString("saleUnit"); String saleUnit = obj.getString("saleUnit");
...@@ -200,8 +204,8 @@ public class CartServiceImpl implements CartService { ...@@ -200,8 +204,8 @@ public class CartServiceImpl implements CartService {
System.out.println(removeObj); System.out.println(removeObj);
this.remove(removeObj,terminal); this.remove(removeObj,terminal);
} else { } else {
String sql = "update tCart set nSaleQty = ?,sSaleUnit = ? where sOrgNO = ? and sShopNO = ? and nIdx = ?"; String sql = "update tCart set nSaleQty = ?,sSaleUnit = ?,nSaleBigQty = ? where sOrgNO = ? and sShopNO = ? and nIdx = ?";
jdbcTemplate.executeUpdate(sql, saleQty,saleUnit, orgNo, shopNO, idx); jdbcTemplate.executeUpdate(sql, saleQty,saleUnit,saleBigQty, orgNo, shopNO, idx);
} }
Map<String, Object> rmap = this.CartToCartTempItem(shopNO); Map<String, Object> rmap = this.CartToCartTempItem(shopNO);
return Rjx.jsonOk().set("count", count(orgNo, shopNO)).setData(rmap).toJson(); return Rjx.jsonOk().set("count", count(orgNo, shopNO)).setData(rmap).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