Commit 9d5d3d2f authored by 张永's avatar 张永

需求 #14165

parent f57785b0
......@@ -138,6 +138,7 @@ public class GoodsController {
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "orgNO", dataType = "String", required = true, value = "区域编号", defaultValue = "SHBS"),
@ApiImplicitParam(paramType = "query", name = "shopNO", dataType = "String", required = false, value = "店铺编号", defaultValue = "00029997"),
@ApiImplicitParam(paramType = "query", name = "agentID", dataType = "String", required = true),
@ApiImplicitParam(paramType = "query", name = "index", dataType = "String", required = false, value = "第几页", defaultValue = "1"),
@ApiImplicitParam(paramType = "query", name = "limit", dataType = "String", required = false, value = "每页数量", defaultValue = "20"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
......@@ -147,9 +148,12 @@ public class GoodsController {
})
@RequestMapping(value = "/hotSearchKey",method=RequestMethod.GET)
public String hotSearchKey(HttpServletRequest request, HttpServletResponse response) {
String agentID= request.getParameter("agentID");
XException.assertNotBlank(agentID, "agentID标识不能为空");
List<Map<String,Object>> listMap;
Map<String,Object> params=new HashMap<>();
params.put("orgNO", request.getParameter("orgNO"));
params.put("orgNO", request.getParameter("orgNO"));
params.put("agentID", agentID);
params.put("shopNO", request.getParameter("shopNO")==null?"":request.getParameter("shopNO"));
Page page=new Page();
page.setIndex(Long.valueOf(request.getParameter("index")==null?"1":request.getParameter("index")));
......@@ -162,6 +166,7 @@ public class GoodsController {
@ApiOperation("商品详情")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "orgNo", dataType = "String", required = true),
@ApiImplicitParam(paramType = "query", name = "agentID", dataType = "String", required = true),
@ApiImplicitParam(paramType = "query", name = "goodsId", dataType = "String", required = true, value = "商品编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "contractNo", dataType = "String", required = true, value = "合同编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "custTypeId", dataType = "String", required = false, value = "合同编号", defaultValue = ""),
......@@ -172,14 +177,17 @@ public class GoodsController {
})
@RequestMapping(value = "/goodsDetail",method=RequestMethod.GET)
public String goodsDetail(String orgNo, String goodsId, String contractNo, String custTypeId, String terminal, String langID, HttpServletRequest request, HttpServletResponse response) {
Map<String,Object> params=new HashMap<>();
public String goodsDetail(String orgNo, String goodsId, String contractNo, String custTypeId, String terminal, String langID,String agentID, HttpServletRequest request, HttpServletResponse response) {
XException.assertNotBlank(agentID, "agentID标识不能为空");
Map<String,Object> params=new HashMap<>();
params.put("orgNo", orgNo);
params.put("goodsId", goodsId);
params.put("contractNo", contractNo);
params.put("custTypeId", custTypeId);
params.put("langID", langID);
params.put("terminal", terminal);
params.put("agentID", agentID);
return goodsService.goodsDetail(params);
}
......@@ -187,18 +195,20 @@ public class GoodsController {
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "uid", dataType = "String", required = true, value = "商品唯一标识"),
@ApiImplicitParam(paramType = "query", name = "shopNo", dataType = "String", required = true),
@ApiImplicitParam(paramType = "query", name = "orgNo", dataType = "String", required = true),
@ApiImplicitParam(paramType = "query", name = "orgNo", dataType = "String", required = true),
@ApiImplicitParam(paramType = "query", name = "agentID", dataType = "String", required = true),
@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 = "/queryStockPrice",method=RequestMethod.GET)
public String queryStockPrice(String uid, String shopNo, String orgNo) {
public String queryStockPrice(String uid, String shopNo, String orgNo,String agentID) {
XException.assertNotBlank(uid, "商品唯一标识不能为空");
XException.assertNotBlank(agentID, "agentID标识不能为空");
uid = uid.replaceAll("\\s+", "");
String[] uidAry = uid.split(",");
Map<String, Map<String, Object>> map = goodsService.queryStockPrice(orgNo, shopNo, uidAry);
Map<String, Map<String, Object>> map = goodsService.queryStockPrice(orgNo, shopNo, uidAry,agentID);
return Rjx.jsonOk().setData(map).toJson();
}
......
......@@ -33,6 +33,7 @@ public class PageController {
@ApiOperation("查询banner")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "custNo", dataType = "String", required = false),
@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 = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = ""),
......@@ -43,16 +44,18 @@ public class PageController {
})
@RequestMapping(value = "/queryBanner",method=RequestMethod.GET)
public String queryBanner(HttpServletRequest request) {
String custNo = request.getParameter("custNo");
String orgNO = request.getParameter("orgNo");
String adTypeID = request.getParameter("adTypeID");
String index = request.getParameter("index");
String limit = request.getParameter("limit");
if(!StringUtil.isNotEmpty(orgNO,adTypeID,index,limit)) {
if(!StringUtil.isNotEmpty(orgNO,adTypeID,custNo,index,limit)) {
return Rjx.json().setCode(-1).setMessage(I18NUtils.getMessage(orgNO,adTypeID, "Msg_Parameter_empty")).toJson();
}
Map<String,Object> params = new HashMap<String,Object>();
params.put("orgNO", orgNO);
params.put("adTypeID", adTypeID);
params.put("custNo", custNo);
Page page = new Page();
page.setIndex(Long.valueOf(index));
......@@ -71,6 +74,7 @@ public class PageController {
@ApiOperation("查询快报")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "agentID", dataType = "String", required = true),
@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 = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = ""),
......@@ -85,12 +89,14 @@ public class PageController {
String msgTypeID = request.getParameter("msgTypeID");
String index = request.getParameter("index");
String limit = request.getParameter("limit");
if(!StringUtil.isNotEmpty(orgNO,msgTypeID,index,limit)) {
return Rjx.json().setCode(-1).setMessage(I18NUtils.getMessage(orgNO,msgTypeID, "Msg_Parameter_empty")).toJson();
String agentID = request.getParameter("agentID");
if(!StringUtil.isNotEmpty(orgNO,msgTypeID,index,limit,agentID)) {
return Rjx.json().setCode(-1).setMessage(I18NUtils.getMessage(orgNO,msgTypeID,agentID, "Msg_Parameter_empty")).toJson();
}
Map<String,Object> params = new HashMap<String,Object>();
params.put("orgNO", orgNO);
params.put("msgTypeID", msgTypeID);
params.put("agentID", agentID);
Page page = new Page();
page.setIndex(Long.valueOf(index));
......
package com.egolm.shop.api;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page;
import com.egolm.shop.api.service.PromoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@Api(tags={"促销接口"})
@RestController
@RequestMapping("promo")
public class PromoController {
@Autowired
PromoService service;
@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("getGroupList")
public Object getGroupList(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.getGroupList(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 = "promoPaperNO", dataType = "String", required = true, defaultValue = "", value="活动单号"),
@ApiImplicitParam(paramType = "query", name = "promoGroupNO", dataType = "String", required = true, defaultValue = "", value="组合编号"),
@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("getGroupGoodsDetail")
public Object getGroupGoodsDetail(String orgNo, String shopNo, String promoPaperNO, String promoGroupNO) {
Integer status = 0;
String statusDesc = "正常活动";
Date now = new Date();
Map<String, Object> promoMap = service.getPromoDetail(promoPaperNO);
Date dPromoBeginDate = (Date)promoMap.get("dPromoBeginDate");
Date dPromoEndDate = (Date)promoMap.get("dPromoEndDate");
Integer nTag = ((Number)promoMap.get("nTag")).intValue();
if(now.compareTo(dPromoBeginDate) < 0) {
status = 1;
statusDesc = "活动未开始";
} else if(now.compareTo(dPromoEndDate) > 0) {
status = 2;
statusDesc = "活动已结束";
} else if((nTag&2) != 2) {
status = 3;
statusDesc = "活动未审核";
} else if((nTag&1) == 1) {
status = 4;
statusDesc = "活动已删除";
}
List<Map<String, Object>> list = service.getGroupGoodsDetail(orgNo, shopNo, promoPaperNO, promoGroupNO);
BigDecimal nTotalRealAmount = BigDecimal.ZERO;
BigDecimal nTotalPayAmount = BigDecimal.ZERO;
BigDecimal nTotalQty = BigDecimal.ZERO;
for(Map<String, Object> map : list) {
BigDecimal nMeetQty = (BigDecimal)map.get("nMeetQty");
BigDecimal nRealSalePrice = (BigDecimal)map.get("nRealSalePrice");
BigDecimal nDisPrice = (BigDecimal)map.get("nDisPrice");
nTotalRealAmount = nTotalRealAmount.add(nMeetQty.multiply(nRealSalePrice));
nTotalPayAmount = nTotalPayAmount.add(nMeetQty.multiply(nDisPrice));
nTotalQty = nTotalQty.add(nMeetQty);
}
promoMap.put("nTotalRealAmount", nTotalRealAmount);
promoMap.put("nTotalPayAmount", nTotalPayAmount);
promoMap.put("nTotalQty", nTotalQty);
promoMap.put("status", status);
promoMap.put("statusDesc", statusDesc);
promoMap.put("sPromoGrouoNO", promoGroupNO);
List<Map<String, Object>> DLPicList = service.getGroupPicList("DL", promoPaperNO, promoGroupNO);
List<Map<String, Object>> BNPicList = service.getGroupPicList("BN", promoPaperNO, promoGroupNO);
return Rjx.jsonOk().set("data", promoMap).set("list", list).set("DLPicList", DLPicList).set("BNPicList", BNPicList).toJson();
}
}
package com.egolm.shop.api;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page;
import com.egolm.shop.api.service.PromoService;
import com.egolm.shop.common.XException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@Api(tags={"促销接口"})
@RestController
@RequestMapping("promo")
public class PromoController {
@Autowired
PromoService service;
@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("getGroupList")
public Object getGroupList(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.getGroupList(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 = "agentID", dataType = "String", required = true),
@ApiImplicitParam(paramType = "query", name = "promoPaperNO", dataType = "String", required = true, defaultValue = "", value="活动单号"),
@ApiImplicitParam(paramType = "query", name = "promoGroupNO", dataType = "String", required = true, defaultValue = "", value="组合编号"),
@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("getGroupGoodsDetail")
public Object getGroupGoodsDetail(String orgNo, String shopNo, String promoPaperNO, String promoGroupNO,String agentID) {
XException.assertNotBlank(agentID, "agentID标识不能为空");
Integer status = 0;
String statusDesc = "正常活动";
Date now = new Date();
Map<String, Object> promoMap = service.getPromoDetail(promoPaperNO,agentID);
Date dPromoBeginDate = (Date)promoMap.get("dPromoBeginDate");
Date dPromoEndDate = (Date)promoMap.get("dPromoEndDate");
Integer nTag = ((Number)promoMap.get("nTag")).intValue();
if(now.compareTo(dPromoBeginDate) < 0) {
status = 1;
statusDesc = "活动未开始";
} else if(now.compareTo(dPromoEndDate) > 0) {
status = 2;
statusDesc = "活动已结束";
} else if((nTag&2) != 2) {
status = 3;
statusDesc = "活动未审核";
} else if((nTag&1) == 1) {
status = 4;
statusDesc = "活动已删除";
}
List<Map<String, Object>> list = service.getGroupGoodsDetail(orgNo, shopNo, promoPaperNO, promoGroupNO,agentID);
BigDecimal nTotalRealAmount = BigDecimal.ZERO;
BigDecimal nTotalPayAmount = BigDecimal.ZERO;
BigDecimal nTotalQty = BigDecimal.ZERO;
for(Map<String, Object> map : list) {
BigDecimal nMeetQty = (BigDecimal)map.get("nMeetQty");
BigDecimal nRealSalePrice = (BigDecimal)map.get("nRealSalePrice");
BigDecimal nDisPrice = (BigDecimal)map.get("nDisPrice");
nTotalRealAmount = nTotalRealAmount.add(nMeetQty.multiply(nRealSalePrice));
nTotalPayAmount = nTotalPayAmount.add(nMeetQty.multiply(nDisPrice));
nTotalQty = nTotalQty.add(nMeetQty);
}
promoMap.put("nTotalRealAmount", nTotalRealAmount);
promoMap.put("nTotalPayAmount", nTotalPayAmount);
promoMap.put("nTotalQty", nTotalQty);
promoMap.put("status", status);
promoMap.put("statusDesc", statusDesc);
promoMap.put("sPromoGrouoNO", promoGroupNO);
List<Map<String, Object>> DLPicList = service.getGroupPicList("DL", promoPaperNO, promoGroupNO);
List<Map<String, Object>> BNPicList = service.getGroupPicList("BN", promoPaperNO, promoGroupNO);
return Rjx.jsonOk().set("data", promoMap).set("list", list).set("DLPicList", DLPicList).set("BNPicList", BNPicList).toJson();
}
}
......@@ -316,6 +316,7 @@ public class UserController {
break;
}
}
customerMap.put("AgentID", customerMap.get("nAgentID"));
customerMap.put("nShopID", shopList.get(0).get("nShopID"));
customerMap.put("sEmail", shopList.get(0).get("sEmail"));
customerMap.put("sShopName", shopList.get(0).get("sShopName"));
......
package com.egolm.shop.api.service;
import java.util.List;
import java.util.Map;
import com.egolm.common.jdbc.Page;
public interface GoodsService {
public List<Map<String,Object>> listThinkLike(Map<String,Object> params, Page page);
public List<Map<String,Object>> getHotSaleGoods(Map<String,Object> map, Page page);
public List<Map<String,Object>> GetCategoryGoods (Map<String,Object> map, Page page);
List<Map<String, Object>> hotSearchKey(Map<String, Object> map, Page page);
String goodsDetail(Map<String, Object> map);
/**
* 查询商品图片
* @Title: goodsPicList
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param: @param goodsID
* @param: @param agentContractNO
* @param: @return
* @return: List<Map<String,Object>>
* @throws
*/
public Map<String, List<Map<String, Object>>> goodsPicList(String goodsID,String agentContractNO );
/**
* 收藏及取消收藏
* @Title: updateFlavor
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param: @param params
* @param: @return
* @return: String
* @throws
*/
public String updateFlavor(Map<String,Object> params);
public Map<String, Map<String, Object>> queryStockPrice(String orgNo, String shopNo, String[] uid);
}
package com.egolm.shop.api.service;
import java.util.List;
import java.util.Map;
import com.egolm.common.jdbc.Page;
public interface GoodsService {
public List<Map<String,Object>> listThinkLike(Map<String,Object> params, Page page);
public List<Map<String,Object>> getHotSaleGoods(Map<String,Object> map, Page page);
public List<Map<String,Object>> GetCategoryGoods (Map<String,Object> map, Page page);
List<Map<String, Object>> hotSearchKey(Map<String, Object> map, Page page);
String goodsDetail(Map<String, Object> map);
/**
* 查询商品图片
* @Title: goodsPicList
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param: @param goodsID
* @param: @param agentContractNO
* @param: @return
* @return: List<Map<String,Object>>
* @throws
*/
public Map<String, List<Map<String, Object>>> goodsPicList(String goodsID,String agentContractNO );
/**
* 收藏及取消收藏
* @Title: updateFlavor
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param: @param params
* @param: @return
* @return: String
* @throws
*/
public String updateFlavor(Map<String,Object> params);
public Map<String, Map<String, Object>> queryStockPrice(String orgNo, String shopNo, String[] uid,String agentID);
}
package com.egolm.shop.api.service;
import java.util.List;
import java.util.Map;
import com.egolm.common.jdbc.Page;
public interface PromoService {
List<Map<String, Object>> getGroupList(String orgNo, String shopNo, Page page);
List<Map<String, Object>> getGroupGoodsDetail(String orgNo, String shopNo, String sPromoPaperNO, String sPromoGroupNO);
List<Map<String, Object>> getGroupPicList(String sPictureTypeID, String sPromoPaperNO, String sPromoGroupNO);
Map<String, Object> getPromoDetail(String promoPaperNO);
}
package com.egolm.shop.api.service;
import java.util.List;
import java.util.Map;
import com.egolm.common.jdbc.Page;
public interface PromoService {
List<Map<String, Object>> getGroupList(String orgNo, String shopNo, Page page);
List<Map<String, Object>> getGroupGoodsDetail(String orgNo, String shopNo, String sPromoPaperNO, String sPromoGroupNO,String agentID);
List<Map<String, Object>> getGroupPicList(String sPictureTypeID, String sPromoPaperNO, String sPromoGroupNO);
Map<String, Object> getPromoDetail(String promoPaperNO,String agentID);
}
......@@ -161,11 +161,12 @@ public class GoodsServiceImpl implements GoodsService {
String goodsId=(String) map.get("goodsId");
String contractNo=(String) map.get("contractNo");
String custTypeId=(String) map.get("custTypeId");
String agentID = map.get("agentID")+"";
String gSql = "select t.*, ap.nRealSalePrice nApSalePrice from V_OrgGoods t left join tAgentCustTypePrice ap on ap.sCustTypeID = ? and ap.sAgentContractNO = t.sAgentContractNO and ap.nGoodsID = t.nGoodsID where t.sOrgNO = ? and t.sAgentContractNO = ? and t.nGoodsID = ?";
String gSql = "select t.*, ap.nRealSalePrice nApSalePrice from V_OrgGoods t left join tAgentCustTypePrice ap on ap.sCustTypeID = ? and ap.sAgentContractNO = t.sAgentContractNO and ap.nGoodsID = t.nGoodsID where t.sOrgNO = ? and t.sAgentContractNO = ? and t.nGoodsID = ? and t.nAgentID = ? ";
Map<String, Object> detail = null;
try {
detail = jdbcTemplate.queryForMap(gSql, custTypeId, orgNo, contractNo, goodsId);
detail = jdbcTemplate.queryForMap(gSql, custTypeId, orgNo, contractNo, goodsId,agentID);
BigDecimal nApSalePrice = (BigDecimal) detail.get("nApSalePrice");
if(nApSalePrice != null) {
detail.put("nRealSalePrice", nApSalePrice);
......@@ -173,8 +174,8 @@ public class GoodsServiceImpl implements GoodsService {
} catch (EmptyResultDataAccessException e) {
throw new XException("商品已下架");
}
String sql = "select t.nGoodsID, t.sSubCode, t.nParentID, t.sSpecName, t.sSpec, isnull(ap.nRealSalePrice, og.nRealSalePrice) nRealSalePrice, nStockQty = og.nRealStockQty, og.nLockedQty from tGoodsSubCode t left join V_OrgGoods og on og.sOrgNO = ? and og.sAgentContractNO = ? and og.nGoodsID = t.nGoodsID left join tAgentCustTypePrice ap on ap.sCustTypeID = ? and ap.sAgentContractNO = og.sAgentContractNO and ap.nGoodsID = og.nGoodsID where t.nParentID = ? and t.nTag&1 = 0";
List<Map<String, Object>> specList = jdbcTemplate.queryForList(sql, orgNo, contractNo, custTypeId, goodsId);
String sql = "select t.nGoodsID, t.sSubCode, t.nParentID, t.sSpecName, t.sSpec, isnull(ap.nRealSalePrice, og.nRealSalePrice) nRealSalePrice, nStockQty = og.nRealStockQty, og.nLockedQty from tGoodsSubCode t left join V_OrgGoods og on og.sOrgNO = ? and og.sAgentContractNO = ? and og.nGoodsID = t.nGoodsID left join tAgentCustTypePrice ap on ap.sCustTypeID = ? and ap.sAgentContractNO = og.sAgentContractNO and ap.nGoodsID = og.nGoodsID where t.nParentID = ? and t.nTag&1 = 0 and og.nAgentID = ? ";
List<Map<String, Object>> specList = jdbcTemplate.queryForList(sql, orgNo, contractNo, custTypeId, goodsId,agentID);
Map<String, Map<String, Object>> specMap = Util.listToMM(specList, ";", "sSpecName", "sSpec");
Set<String> specNames = specList.stream().map(o -> (String)o.get("sSpecName")).collect(Collectors.toSet());
Set<String> specs = specList.stream().map(o -> (String)o.get("sSpec")).collect(Collectors.toSet());
......@@ -186,8 +187,8 @@ public class GoodsServiceImpl implements GoodsService {
}
detail.put("nProfitMargin", nProfitMargin);
Map<String, List<Map<String, Object>>> picList = goodsPicList(goodsId, contractNo);
String promoSql = "select pm.* from tYWPromoMain pm, tYWPromoDtl pd, tPromoCustBWList bw where pm.sPromoPaperNO = bw.sPromoPaperNO and bw.sShopNO = ? and pm.sPromoActionTypeID != '3' and pm.sOrgNO = ? and pm.sPromoPaperNO = pd.sPromoPaperNO and pm.nTag&3 = 2 and (pd.sAgentContractNO = ?) and (pd.nGoodsID = ?)";
Object[] args = new Object[] {custTypeId, orgNo, contractNo, goodsId};
String promoSql = "select pm.* from tYWPromoMain pm, tYWPromoDtl pd, tPromoCustBWList bw ,tAgentContract ac where pd.sAgentContractNO = ac.sAgentContractNO and ac.nTag&3 = 2 and pm.sPromoPaperNO = bw.sPromoPaperNO and bw.sShopNO = ? and pm.sPromoActionTypeID != '3' and pm.sOrgNO = ? and pm.sPromoPaperNO = pd.sPromoPaperNO and pm.nTag&3 = 2 and (pd.sAgentContractNO = ?) and (pd.nGoodsID = ?) and ac.nAgentID = ? ";
Object[] args = new Object[] {custTypeId, orgNo, contractNo, goodsId,agentID};
List<Map<String, Object>> promoList = jdbcTemplate.queryForList(promoSql, args);
detail.put("promoList", promoList);
Rjx rjx = Rjx.jsonOk().set("goodsDetail", detail).set("specList", specList).set("specMap", specMap).set("specNames", specNames).set("specs", specs);
......@@ -259,7 +260,7 @@ public class GoodsServiceImpl implements GoodsService {
}
@Override
public Map<String, Map<String, Object>> queryStockPrice(String orgNo, String shopNo, String[] uidAry) {
public Map<String, Map<String, Object>> queryStockPrice(String orgNo, String shopNo, String[] uidAry,String agentID) {
List<String> args = new ArrayList<String>();
for(String uid : uidAry) {
if(StringUtil.isBlank(uid)) {
......@@ -271,15 +272,15 @@ public class GoodsServiceImpl implements GoodsService {
}
String sCustTypeID = "99999999999999";
try {
sCustTypeID = jdbcTemplate.queryForString("select c.sCustTypeID from tCustomer c, tShop s where c.sCustNO = s.sCustNO and s.sShopNO = ?", shopNo);
sCustTypeID = jdbcTemplate.queryForString("select c.sCustTypeID from tCustomer c, tShop s where c.sCustNO = s.sCustNO and s.sShopNO = ? and c.nAgentID = ? ", shopNo,agentID);
} catch (Exception e) {
//shopNo为空,没有登陆
}
String sql = "select t.sAgentContractNO, t.nGoodsID, nStockQty = t.nRealStockQty, t.nDefaultPrice, isnull(ap.nRealSalePrice, t.nRealSalePrice) nRealSalePrice from V_OrgGoods t left join tAgentCustTypePrice ap on ap.sCustTypeID = '" + sCustTypeID + "' and t.sAgentContractNO = ap.sAgentContractNO and t.nGoodsID = ap.nGoodsID where t.sOrgNO = '" + orgNo + "' " + StringUtil.join(" OR ", " and (", ")", " and (1 = 0) ", args);
String sql = "select t.sAgentContractNO, t.nGoodsID, nStockQty = t.nRealStockQty, t.nDefaultPrice, isnull(ap.nRealSalePrice, t.nRealSalePrice) nRealSalePrice from V_OrgGoods t left join tAgentCustTypePrice ap on ap.sCustTypeID = '" + sCustTypeID + "' and t.sAgentContractNO = ap.sAgentContractNO and t.nGoodsID = ap.nGoodsID where t.nAgentID = "+agentID+" and t.sOrgNO = '" + orgNo + "' " + StringUtil.join(" OR ", " and (", ")", " and (1 = 0) ", args);
List<Map<String, Object>> datas = jdbcTemplate.queryForList(sql);
Map<String, Map<String, Object>> mm = Util.listToMM(datas, ":", "sAgentContractNO", "nGoodsID");
String sql1 = "select t.sAgentContractNO, t.nGoodsID, p.sPromoTheme, p.sPromoName, p.sPromoPaperNO, p.sPromoActionTypeID, t.sGroupNO sPromoGroupNO from tYWPromoDtl t, tYWPromoMain p where p.sPromoActionTypeID != '3' and t.sPromoPaperNO = p.sPromoPaperNO and p.nTag&3 = 2 and p.sOrgNO = '" + orgNo + "' " + StringUtil.join(" OR ", " and (", ")", " and (1 = 0) ", args) + " group by t.sAgentContractNO, t.nGoodsID, p.sPromoTheme, p.sPromoName, p.sPromoPaperNO, p.sPromoActionTypeID, t.sGroupNO";
String sql1 = "select t.sAgentContractNO, t.nGoodsID, p.sPromoTheme, p.sPromoName, p.sPromoPaperNO, p.sPromoActionTypeID, t.sGroupNO sPromoGroupNO from tYWPromoDtl t, tYWPromoMain p,tAgentContract a where t.sAgentContractNO = a.sAgentContractNO and a.nTag&3 = 2 and a.nAgentID = "+agentID+" and p.sPromoActionTypeID != '3' and t.sPromoPaperNO = p.sPromoPaperNO and p.nTag&3 = 2 and p.sOrgNO = '" + orgNo + "' " + StringUtil.join(" OR ", " and (", ")", " and (1 = 0) ", args) + " group by t.sAgentContractNO, t.nGoodsID, p.sPromoTheme, p.sPromoName, p.sPromoPaperNO, p.sPromoActionTypeID, t.sGroupNO";
List<Map<String, Object>> plist = jdbcTemplate.queryForList(sql1);
Map<String, List<Map<String, Object>>> pmm = Util.listToML(plist, ":", "sAgentContractNO", "nGoodsID");
for(String key : mm.keySet()) {
......
......@@ -64,15 +64,16 @@ public class PageServiceImpl implements PageService {
public List<Map<String, Object>> queryBanner(Map<String, Object> params, Page page) {
String orgNO = params.get("orgNO")+"";
String adTypeID = params.get("adTypeID")+"";
String custNo = params.get("custNo")+"";
jdbcTemplate.setDialect(new SqlServerDialect());
String sql = "SELECT BannerAdNO = b.sBannerAdNO, BannerAdTitle = b.sBannerAdTitle,OrgNO = b.sOrgNO,AdPostionTypeID = b.sAdPositionTypeID,AdPostionType = b.sAdPositionType,"
+ " LayoutTypeID = b.sLayoutTypeID,LayoutType = b.sLayoutType,JumpTypeID = b.sJumpTypeID,JumpType = b.sJumpType,JumpList = b.sJumpList,Idx = b.nIdx,ImagePath = b.sImagePath,"
+ " LinkPath = b.sLinkPath "
+ " from tBannerAd b "
+ " WHERE sOrgNO = ? AND sAdPositionTypeID = ? AND b.dStartTime <=getdate() AND b.dEndTime >= getdate() AND b.nTag&2 = 2";
+ " from tBannerAd b , tCustomer c "
+ " WHERE sOrgNO = ? AND sAdPositionTypeID = ? AND b.dStartTime <=getdate() AND b.dEndTime >= getdate() AND b.nTag&2 = 2 and b.nAgentID = c.nAgentID and c.nTag&2 = 2 and c.sCustNO = ? ";
return jdbcTemplate.limit(sql, page, orgNO, adTypeID);
return jdbcTemplate.limit(sql, page, orgNO, adTypeID,custNo);
}
/**
......@@ -88,13 +89,14 @@ public class PageServiceImpl implements PageService {
public List<Map<String, Object>> queryNews(Map<String, Object> params, Page page) {
String orgNO = params.get("orgNO")+"";
String msgTypeID = params.get("msgTypeID")+"";
String agentID = params.get("agentID")+"";
jdbcTemplate.setDialect(new SqlServerDialect());
String sql = "SELECT BillBoardID = b.nBillboardID, MsgTypeID = b.sMsgTypeID,MsgType = b.sMsgType,Title = b.sTitle,Content = b.sText,Sort = b.nSort,TradeDate = b.dTradeDate"
+ " FROM tBillboard b "
+ " WHERE b.nTag&2=2 AND b.sMsgTypeID = ? and b.sOrgNO = ?";
+ " WHERE b.nTag&2=2 AND b.sMsgTypeID = ? and b.sOrgNO = ? and b.nAgentID = ? ";
return jdbcTemplate.limit(sql, page, msgTypeID, orgNO);
return jdbcTemplate.limit(sql, page, msgTypeID, orgNO,agentID);
}
......
package com.egolm.shop.api.service.impl;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
import com.egolm.shop.api.service.PromoService;
@Service
public class PromoServiceImpl implements PromoService {
@Autowired
JdbcTemplate jdbcTemplate;
@Override
public List<Map<String, Object>> getGroupList(String orgNo, String shopNo, Page page) {
page.setLimitKey("dCreateDate desc");
Map<String, Object> custMap = jdbcTemplate.queryForMap("select c.* from tCustomer c, tShop s where c.sCustNO = s.sCustNO and s.sShopNO = ? and s.sOrgNO = ?", shopNo, orgNo);
String sCustTypeID = (String)custMap.get("sCustTypeID");
String sql = "" +
" SELECT DISTINCT " +
" sPromoPaperNO = a.sPromoPaperNO," +
" sPromoGroupNO = b.sPromoGroupNO, " +
" sPromoGroupName = b.sPromoGroupName," +
" sPromoName = a.sPromoName, " +
" dCreateDate = a.dCreateDate, " +
" sURL = (SELECT TOP 1 sURL FROM tPromoPicture WHERE sPromoPaperNO = a.sPromoPaperNO AND sPictureTypeID = 'BN' ORDER BY nItem)" +
" FROM tPromo a, tPromoRuleGoods b, tPromoCustBWList c " +
" WHERE a.sPromoPaperNO = b.sPromoPaperNO " +
" AND a.sPromoPaperNO = b.sPromoPaperNO " +
" AND a.sPromoActionTypeID = '3'" +
" AND a.nTag&3=2" +
" AND b.nTag&3=2" +
" AND getdate() BETWEEN a.dPromoBeginDate AND a.dPromoEndDate " +
" AND CASE WHEN nUseCycle&1 = 1 THEN '1,' ELSE '' END +" +
" CASE WHEN nUseCycle&2 = 2 THEN '2,' ELSE '' END +" +
" CASE WHEN nUseCycle&4 = 4 THEN '3,' ELSE '' END +" +
" CASE WHEN nUseCycle&8 = 8 THEN '4,' ELSE '' END +" +
" CASE WHEN nUseCycle&16 = 16 THEN '5,' ELSE '' END +" +
" CASE WHEN nUseCycle&32 = 32 THEN '6,' ELSE '' END +" +
" CASE WHEN nUseCycle&64 = 64 THEN '7' ELSE '' END LIKE '%' + convert(VARCHAR,datepart(weekday,getdate())) + '%' " +
" AND c.sShopNO = ?";
List<Map<String, Object>> list = jdbcTemplate.limit(sql.replaceAll("\\s+", " "), page, sCustTypeID);
return list;
}
@Override
public List<Map<String, Object>> getGroupGoodsDetail(String orgNo, String shopNo, String sPromoPaperNO, String sPromoGroupNO) {
String sql = "" +
" SELECT DISTINCT " +
" nGoodsID = b.nGoodsID, " +
" sGoodsNO = ag.sGoodsNO, " +
" sGoodsDesc = ag.sGoodsDesc, " +
" sPromoPaperNO = a.sPromoPaperNO, " +
" sPromoGroupNO = b.sPromoGroupNO, " +
" sPromoGroupName = b.sPromoGroupName, " +
" sPromoName = a.sPromoName, " +
" nAgentID = ag.nAgentID, " +
" sAgentNO = at.sAgentNO, " +
" sAgentName = at.sAgentName, " +
" sAgentContractNO = b.sAgentContractNO," +
" sMainBarcode = ag.sMainBarcode, " +
" sSpec = ag.sSpec, " +
" sUnit = ag.sUnit, " +
" nSaleUnits = ag.nSaleUnits, " +
" nSalePrice = ag.nSalePrice, " +
" nRealSalePrice = ag.nRealSalePrice, " +
" nMeetQty = b.nMeetQty, " +
" nDisPrice = b.nPrice " +
" FROM tPromo a, tPromoRuleGoods b, tPromoCustBWList c, tAgent at, tAgentContractGoods ag " +
" WHERE a.sPromoPaperNO = b.sPromoPaperNO " +
" AND a.sPromoPaperNO = b.sPromoPaperNO " +
" AND b.sAgentContractNO = ag.sAgentContractNO " +
" AND ag.nAgentID = at.nAgentID " +
" AND b.nGoodsID = ag.nGoodsID " +
" AND a.sPromoActionTypeID = '3' " +
// " AND a.nTag&3=2 " +
// " AND b.nTag&3=2 " +
// " AND getdate() BETWEEN a.dPromoBeginDate AND a.dPromoEndDate " +
// " AND CASE WHEN nUseCycle&1 = 1 THEN '1,' ELSE '' END + " +
// " CASE WHEN nUseCycle&2 = 2 THEN '2,' ELSE '' END + " +
// " CASE WHEN nUseCycle&4 = 4 THEN '3,' ELSE '' END + " +
// " CASE WHEN nUseCycle&8 = 8 THEN '4,' ELSE '' END + " +
// " CASE WHEN nUseCycle&16 = 16 THEN '5,' ELSE '' END + " +
// " CASE WHEN nUseCycle&32 = 32 THEN '6,' ELSE '' END + " +
// " CASE WHEN nUseCycle&64 = 64 THEN '7' ELSE '' END LIKE '%' + convert(VARCHAR,datepart(weekday,getdate())) + '%' " +
" AND a.sPromoPaperNO = ? " +
" AND b.sPromoGroupNO = ? ";
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql.replaceAll("\\s+", " "), sPromoPaperNO, sPromoGroupNO);
return list;
}
@Override
public List<Map<String, Object>> getGroupPicList(String sPictureTypeID, String sPromoPaperNO, String sPromoGroupNO) {
String sql = "" +
" SELECT sURL = sURL " +
" FROM tPromoPicture " +
" WHERE sPictureTypeID = ? " +
" AND nTag&3=2 " +
" AND sPromoPaperNO = ? " +
" AND sPromoGroupNO = ? " +
" ORDER BY nItem";
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql.replaceAll("\\s+", " "), sPictureTypeID, sPromoPaperNO, sPromoGroupNO);
return list;
}
@Override
public Map<String, Object> getPromoDetail(String promoPaperNO) {
return jdbcTemplate.queryForMap("select * from tPromo where sPromoPaperNO = ? and nTag&3 = 2", promoPaperNO);
}
}
package com.egolm.shop.api.service.impl;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
import com.egolm.shop.api.service.PromoService;
@Service
public class PromoServiceImpl implements PromoService {
@Autowired
JdbcTemplate jdbcTemplate;
@Override
public List<Map<String, Object>> getGroupList(String orgNo, String shopNo, Page page) {
page.setLimitKey("dCreateDate desc");
Map<String, Object> custMap = jdbcTemplate.queryForMap("select c.* from tCustomer c, tShop s where c.sCustNO = s.sCustNO and s.sShopNO = ? and s.sOrgNO = ?", shopNo, orgNo);
String sCustTypeID = (String)custMap.get("sCustTypeID");
String sql = "" +
" SELECT DISTINCT " +
" sPromoPaperNO = a.sPromoPaperNO," +
" sPromoGroupNO = b.sPromoGroupNO, " +
" sPromoGroupName = b.sPromoGroupName," +
" sPromoName = a.sPromoName, " +
" dCreateDate = a.dCreateDate, " +
" sURL = (SELECT TOP 1 sURL FROM tPromoPicture WHERE sPromoPaperNO = a.sPromoPaperNO AND sPictureTypeID = 'BN' ORDER BY nItem)" +
" FROM tPromo a, tPromoRuleGoods b, tPromoCustBWList c " +
" WHERE a.sPromoPaperNO = b.sPromoPaperNO " +
" AND a.sPromoPaperNO = b.sPromoPaperNO " +
" AND a.sPromoActionTypeID = '3'" +
" AND a.nTag&3=2" +
" AND b.nTag&3=2" +
" AND getdate() BETWEEN a.dPromoBeginDate AND a.dPromoEndDate " +
" AND CASE WHEN nUseCycle&1 = 1 THEN '1,' ELSE '' END +" +
" CASE WHEN nUseCycle&2 = 2 THEN '2,' ELSE '' END +" +
" CASE WHEN nUseCycle&4 = 4 THEN '3,' ELSE '' END +" +
" CASE WHEN nUseCycle&8 = 8 THEN '4,' ELSE '' END +" +
" CASE WHEN nUseCycle&16 = 16 THEN '5,' ELSE '' END +" +
" CASE WHEN nUseCycle&32 = 32 THEN '6,' ELSE '' END +" +
" CASE WHEN nUseCycle&64 = 64 THEN '7' ELSE '' END LIKE '%' + convert(VARCHAR,datepart(weekday,getdate())) + '%' " +
" AND c.sShopNO = ?";
List<Map<String, Object>> list = jdbcTemplate.limit(sql.replaceAll("\\s+", " "), page, sCustTypeID);
return list;
}
@Override
public List<Map<String, Object>> getGroupGoodsDetail(String orgNo, String shopNo, String sPromoPaperNO, String sPromoGroupNO,String agentID) {
String sql = "" +
" SELECT DISTINCT " +
" nGoodsID = b.nGoodsID, " +
" sGoodsNO = ag.sGoodsNO, " +
" sGoodsDesc = ag.sGoodsDesc, " +
" sPromoPaperNO = a.sPromoPaperNO, " +
" sPromoGroupNO = b.sPromoGroupNO, " +
" sPromoGroupName = b.sPromoGroupName, " +
" sPromoName = a.sPromoName, " +
" nAgentID = ag.nAgentID, " +
" sAgentNO = at.sAgentNO, " +
" sAgentName = at.sAgentName, " +
" sAgentContractNO = b.sAgentContractNO," +
" sMainBarcode = ag.sMainBarcode, " +
" sSpec = ag.sSpec, " +
" sUnit = ag.sUnit, " +
" nSaleUnits = ag.nSaleUnits, " +
" nSalePrice = ag.nSalePrice, " +
" nRealSalePrice = ag.nRealSalePrice, " +
" nMeetQty = b.nMeetQty, " +
" nDisPrice = b.nPrice " +
" FROM tPromo a, tPromoRuleGoods b, tPromoCustBWList c, tAgent at, tAgentContractGoods ag " +
" WHERE a.sPromoPaperNO = b.sPromoPaperNO " +
" AND a.sPromoPaperNO = b.sPromoPaperNO " +
" AND b.sAgentContractNO = ag.sAgentContractNO " +
" AND ag.nAgentID = at.nAgentID " +
" AND b.nGoodsID = ag.nGoodsID " +
" AND a.sPromoActionTypeID = '3' " +
" AND at.nAgentID = ? " +
// " AND a.nTag&3=2 " +
// " AND b.nTag&3=2 " +
// " AND getdate() BETWEEN a.dPromoBeginDate AND a.dPromoEndDate " +
// " AND CASE WHEN nUseCycle&1 = 1 THEN '1,' ELSE '' END + " +
// " CASE WHEN nUseCycle&2 = 2 THEN '2,' ELSE '' END + " +
// " CASE WHEN nUseCycle&4 = 4 THEN '3,' ELSE '' END + " +
// " CASE WHEN nUseCycle&8 = 8 THEN '4,' ELSE '' END + " +
// " CASE WHEN nUseCycle&16 = 16 THEN '5,' ELSE '' END + " +
// " CASE WHEN nUseCycle&32 = 32 THEN '6,' ELSE '' END + " +
// " CASE WHEN nUseCycle&64 = 64 THEN '7' ELSE '' END LIKE '%' + convert(VARCHAR,datepart(weekday,getdate())) + '%' " +
" AND a.sPromoPaperNO = ? " +
" AND b.sPromoGroupNO = ? ";
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql.replaceAll("\\s+", " "), agentID,sPromoPaperNO, sPromoGroupNO);
return list;
}
@Override
public List<Map<String, Object>> getGroupPicList(String sPictureTypeID, String sPromoPaperNO, String sPromoGroupNO) {
String sql = "" +
" SELECT sURL = sURL " +
" FROM tPromoPicture " +
" WHERE sPictureTypeID = ? " +
" AND nTag&3=2 " +
" AND sPromoPaperNO = ? " +
" AND sPromoGroupNO = ? " +
" ORDER BY nItem";
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql.replaceAll("\\s+", " "), sPictureTypeID, sPromoPaperNO, sPromoGroupNO);
return list;
}
@Override
public Map<String, Object> getPromoDetail(String promoPaperNO,String agentID) {
return jdbcTemplate.queryForMap("select * from tPromo where sPromoPaperNO = ? and nTag&3 = 2 and nAgentID = ? ", promoPaperNO,agentID);
}
}
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