Commit 3c8965d8 authored by Quxl's avatar Quxl

x

parent fe16a0ab
...@@ -70,7 +70,7 @@ public class CartController { ...@@ -70,7 +70,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\",\"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\", \"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 = ""),
......
...@@ -102,58 +102,4 @@ public class PromoController { ...@@ -102,58 +102,4 @@ public class PromoController {
return Rjx.jsonOk().set("data", promoMap).set("list", list).set("DLPicList", DLPicList).set("BNPicList", BNPicList).toJson(); return Rjx.jsonOk().set("data", promoMap).set("list", list).set("DLPicList", DLPicList).set("BNPicList", BNPicList).toJson();
} }
@ApiOperation("获取秒杀促销列表")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "shopNo", dataType = "String", required = true, defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "orgNo", dataType = "String", required = true, defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, 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 = "")
})
@GetMapping("getFlashSaleList")
public Object getFlashSaleList(String orgNo, String shopNo, Long index, Long limit) {
index = index == null ? 1 : index;
limit = limit == null ? 20 : limit;
Page page = new Page(index, limit);
List<Map<String, Object>> list = service.getFlashSaleList(orgNo, shopNo, page);
return Rjx.jsonOk().set("list", list).set("page",page).toJson();
}
@ApiOperation("获取限时购促销列表")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "shopNo", dataType = "String", required = true, defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "orgNo", dataType = "String", required = true, defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, 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 = "")
})
@GetMapping("getTimeLimitList")
public Object getTimeLimitList(String orgNo, String shopNo, Long index, Long limit) {
index = index == null ? 1 : index;
limit = limit == null ? 20 : limit;
Page page = new Page(index, limit);
List<Map<String, Object>> list = null;
return Rjx.jsonOk().set("list", list).set("page",page).toJson();
}
@ApiOperation("获取砍价促销列表")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "shopNo", dataType = "String", required = true, defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "orgNo", dataType = "String", required = true, defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, 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 = "")
})
@GetMapping("getBargainList")
public Object getBargainList(String orgNo, String shopNo, Long index, Long limit) {
index = index == null ? 1 : index;
limit = limit == null ? 20 : limit;
Page page = new Page(index, limit);
List<Map<String, Object>> list = null;
return Rjx.jsonOk().set("list", list).set("page",page).toJson();
}
} }
...@@ -15,6 +15,4 @@ public interface PromoService { ...@@ -15,6 +15,4 @@ public interface PromoService {
Map<String, Object> getPromoDetail(String promoPaperNO); Map<String, Object> getPromoDetail(String promoPaperNO);
List<Map<String, Object>> getFlashSaleList(String orgNo, String shopNo, Page page);
} }
...@@ -25,6 +25,10 @@ public class CartServiceImpl implements CartService { ...@@ -25,6 +25,10 @@ public class CartServiceImpl implements CartService {
@Autowired @Autowired
private CartQueryService cartRedisService; private CartQueryService cartRedisService;
public static void main(String[] args) {
System.out.println(Util.objTo("190.0999", BigDecimal.class, null));
}
public String append(JSONObject obj,String terminal) { public String append(JSONObject obj,String terminal) {
String shopNO = obj.getString("shopNO"); String shopNO = obj.getString("shopNO");
String orgNo = obj.getString("orgNo"); String orgNo = obj.getString("orgNo");
...@@ -41,6 +45,7 @@ public class CartServiceImpl implements CartService { ...@@ -41,6 +45,7 @@ public class CartServiceImpl implements CartService {
Integer nGoodsTypeID = Util.objTo(cartObj.get("goodsTypeID"), Integer.class, 0); Integer nGoodsTypeID = Util.objTo(cartObj.get("goodsTypeID"), Integer.class, 0);
Integer nSaleQty = Util.objTo(cartObj.get("saleQty"), Integer.class, null); Integer nSaleQty = Util.objTo(cartObj.get("saleQty"), Integer.class, null);
BigDecimal nSetPrice = Util.objTo(cartObj.get("setPrice"), BigDecimal.class, null);
Integer nGoodsID = Util.objTo(cartObj.get("goodsID"), Integer.class, null); Integer nGoodsID = Util.objTo(cartObj.get("goodsID"), Integer.class, null);
String sAgentContractNO = Util.objTo(cartObj.get("agentContractNO"), String.class); String sAgentContractNO = Util.objTo(cartObj.get("agentContractNO"), String.class);
String sPromoPaperNO = Util.objTo(cartObj.get("promoPaperNO"), String.class, null); String sPromoPaperNO = Util.objTo(cartObj.get("promoPaperNO"), String.class, null);
...@@ -49,32 +54,32 @@ public class CartServiceImpl implements CartService { ...@@ -49,32 +54,32 @@ public class CartServiceImpl implements CartService {
if(StringUtil.isNotBlank(sPromoPaperNO) && StringUtil.isNotBlank(sPromoGroupNO)) { if(StringUtil.isNotBlank(sPromoPaperNO) && StringUtil.isNotBlank(sPromoGroupNO)) {
} else { } else {
List<String> strs = new ArrayList<String>(); List<String> strs = new ArrayList<String>();
strs.add("sOrgNO = '" + orgNo + "'"); strs.add("sOrgNO = '" + orgNo + "'");
strs.add("sShopNO = '" + shopNO + "'"); strs.add("sShopNO = '" + shopNO + "'");
strs.add("nTag = " + nGoodsTypeID); strs.add("nTag = " + nGoodsTypeID);
strs.add("sAgentContractNO = '" + sAgentContractNO + "'"); strs.add("sAgentContractNO = '" + sAgentContractNO + "'");
strs.add("nGoodsID = " + nGoodsID); strs.add("nGoodsID = " + nGoodsID);
if(StringUtil.isNotBlank(sPromoPaperNO)) { if(StringUtil.isNotBlank(sPromoPaperNO)) {
strs.add("sPromoPaperNO = '" + sPromoPaperNO + "'"); strs.add("sPromoPaperNO = '" + sPromoPaperNO + "'");
} else { } else {
strs.add("(sPromoPaperNO = '' or sPromoPaperNO is null)"); strs.add("(sPromoPaperNO = '' or sPromoPaperNO is null)");
} }
if(StringUtil.isNotBlank(sPromoGroupNO)) { if(StringUtil.isNotBlank(sPromoGroupNO)) {
strs.add("sPromoGroupNO = '" + sPromoGroupNO + "'"); strs.add("sPromoGroupNO = '" + sPromoGroupNO + "'");
} else { } else {
strs.add("(sPromoGroupNO = '' or sPromoGroupNO is null)"); 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)); 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, sPromoPaperNO, sPromoGroupNO}; Object[] args = new Object[]{shopNO, orgNo, ++nMaxIdx, nGoodsTypeID, sAgentContractNO, nGoodsID, nSaleQty, nSetPrice, sPromoPaperNO, sPromoGroupNO};
jdbcTemplate.executeUpdate("insert into tCart (sShopNO, sOrgNO, nIdx, nTag, sAgentContractNO, nGoodsID, nSaleQty, dLastUpdateTime, sPromoPaperNO, sPromoGroupNO) values (?, ?, ?, ?, ?, ?, ?, getdate(), ?, ?)", args); jdbcTemplate.executeUpdate("insert into tCart (sShopNO, sOrgNO, nIdx, nTag, sAgentContractNO, nGoodsID, nSaleQty, nSetPrice, dLastUpdateTime, sPromoPaperNO, sPromoGroupNO) 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) + " where sOrgNO = '" + orgNo + "' and sShopNO = '" + shopNO + "' and nIdx = " + nIdx); 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(); return Rjx.jsonOk().set("count", count(orgNo, shopNO)).toJson();
......
...@@ -113,10 +113,4 @@ public class PromoServiceImpl implements PromoService { ...@@ -113,10 +113,4 @@ public class PromoServiceImpl implements PromoService {
return jdbcTemplate.queryForMap("select * from tPromo where sPromoPaperNO = ? and nTag&3 = 2", promoPaperNO); return jdbcTemplate.queryForMap("select * from tPromo where sPromoPaperNO = ? and nTag&3 = 2", promoPaperNO);
} }
@Override
public List<Map<String, Object>> getFlashSaleList(String orgNo, String shopNo, Page page) {
return null;
}
} }
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