Commit ad4b8f45 authored by 张永's avatar 张永
parents 7c1fdeba a78c844f
package com.egolm.shop.controller;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
......@@ -57,10 +58,22 @@ public class PromoController {
})
@GetMapping("getGroupGoodsDetail")
public Object getGroupGoodsDetail(String orgNo, String shopNo, String promoPaperNO, String promoGroupNO) {
Map<String, Object> promoMap = service.getPromoDetail(promoPaperNO);
List<Map<String, Object>> list = service.getGroupGoodsDetail(orgNo, shopNo, promoPaperNO, promoGroupNO);
BigDecimal nTotalRealAmount = BigDecimal.ZERO;
BigDecimal nTotalPayAmount = 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));
}
promoMap.put("nTotalRealAmount", nTotalRealAmount);
promoMap.put("nTotalPayAmount", nTotalPayAmount);
List<Map<String, Object>> DLPicList = service.getGroupPicList("DL", promoPaperNO, promoGroupNO);
List<Map<String, Object>> BNPicList = service.getGroupPicList("BN", promoPaperNO, promoGroupNO);
return Rjx.jsonOk().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();
}
}
......@@ -13,4 +13,6 @@ public interface PromoService {
List<Map<String, Object>> getGroupPicList(String sPictureTypeID, String sPromoPaperNO, String sPromoGroupNO);
Map<String, Object> getPromoDetail(String promoPaperNO);
}
......@@ -22,7 +22,7 @@ public class PromoServiceImpl implements PromoService {
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 " +
" SELECT DISTINCT " +
" sPromoPaperNO = a.sPromoPaperNO," +
" sPromoGroupNO = b.sPromoGroupNO, " +
" sPromoGroupName = b.sPromoGroupName," +
......@@ -30,7 +30,7 @@ public class PromoServiceImpl implements PromoService {
" 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 " +
" WHERE a.sPromoPaperNO = b.sPromoPaperNO " +
" AND a.sPromoPaperNO = b.sPromoPaperNO " +
" AND a.sPromoActionTypeID = '3'" +
" AND a.nTag&3=2" +
......@@ -44,7 +44,7 @@ public class PromoServiceImpl implements PromoService {
" 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, page, sCustTypeID);
List<Map<String, Object>> list = jdbcTemplate.limit(sql.replaceAll("\\s+", " "), page, sCustTypeID);
return list;
}
......@@ -53,7 +53,7 @@ public class PromoServiceImpl implements PromoService {
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 " +
" SELECT DISTINCT " +
" nGoodsID = b.nGoodsID, " +
" sGoodsNO = ag.sGoodsNO, " +
" sGoodsDesc = ag.sGoodsDesc, " +
......@@ -74,7 +74,7 @@ public class PromoServiceImpl implements PromoService {
" nMeetQty = b.nMeetQty, " +
" nDisPrice = b.nPrice " +
" FROM tPromo a, tPromoRuleGoods b, tPromoCustBWList c, tAgent at, tAgentContractGoods ag " +
"WHERE a.sPromoPaperNO = b.sPromoPaperNO " +
" WHERE a.sPromoPaperNO = b.sPromoPaperNO " +
" AND a.sPromoPaperNO = b.sPromoPaperNO " +
" AND b.sAgentContractNO = ag.sAgentContractNO " +
" AND ag.nAgentID = at.nAgentID " +
......@@ -93,22 +93,27 @@ public class PromoServiceImpl implements PromoService {
" AND a.sPromoPaperNO = ? " +
" AND b.sPromoGroupNO = ? " +
" AND c.sShopNO = ? ";
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql, sPromoPaperNO, sPromoGroupNO, sCustTypeID);
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql.replaceAll("\\s+", " "), sPromoPaperNO, sPromoGroupNO, sCustTypeID);
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=3 " +
" 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, sPictureTypeID, sPromoPaperNO, 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 = ?", promoPaperNO);
}
}
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