Commit ad4b8f45 authored by 张永's avatar 张永
parents 7c1fdeba a78c844f
package com.egolm.shop.controller; package com.egolm.shop.controller;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -57,10 +58,22 @@ public class PromoController { ...@@ -57,10 +58,22 @@ public class PromoController {
}) })
@GetMapping("getGroupGoodsDetail") @GetMapping("getGroupGoodsDetail")
public Object getGroupGoodsDetail(String orgNo, String shopNo, String promoPaperNO, String promoGroupNO) { 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); 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>> DLPicList = service.getGroupPicList("DL", promoPaperNO, promoGroupNO);
List<Map<String, Object>> BNPicList = service.getGroupPicList("BN", 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 { ...@@ -13,4 +13,6 @@ public interface PromoService {
List<Map<String, Object>> getGroupPicList(String sPictureTypeID, String sPromoPaperNO, String sPromoGroupNO); 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 { ...@@ -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); 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 sCustTypeID = (String)custMap.get("sCustTypeID");
String sql = "" + String sql = "" +
"SELECT DISTINCT " + " SELECT DISTINCT " +
" sPromoPaperNO = a.sPromoPaperNO," + " sPromoPaperNO = a.sPromoPaperNO," +
" sPromoGroupNO = b.sPromoGroupNO, " + " sPromoGroupNO = b.sPromoGroupNO, " +
" sPromoGroupName = b.sPromoGroupName," + " sPromoGroupName = b.sPromoGroupName," +
...@@ -30,7 +30,7 @@ public class PromoServiceImpl implements PromoService { ...@@ -30,7 +30,7 @@ public class PromoServiceImpl implements PromoService {
" dCreateDate = a.dCreateDate, " + " dCreateDate = a.dCreateDate, " +
" sURL = (SELECT TOP 1 sURL FROM tPromoPicture WHERE sPromoPaperNO = a.sPromoPaperNO AND sPictureTypeID = 'BN' ORDER BY nItem)" + " sURL = (SELECT TOP 1 sURL FROM tPromoPicture WHERE sPromoPaperNO = a.sPromoPaperNO AND sPictureTypeID = 'BN' ORDER BY nItem)" +
" FROM tPromo a, tPromoRuleGoods b, tPromoCustBWList c " + " FROM tPromo a, tPromoRuleGoods b, tPromoCustBWList c " +
"WHERE a.sPromoPaperNO = b.sPromoPaperNO " + " WHERE a.sPromoPaperNO = b.sPromoPaperNO " +
" AND a.sPromoPaperNO = b.sPromoPaperNO " + " AND a.sPromoPaperNO = b.sPromoPaperNO " +
" AND a.sPromoActionTypeID = '3'" + " AND a.sPromoActionTypeID = '3'" +
" AND a.nTag&3=2" + " AND a.nTag&3=2" +
...@@ -44,7 +44,7 @@ public class PromoServiceImpl implements PromoService { ...@@ -44,7 +44,7 @@ public class PromoServiceImpl implements PromoService {
" CASE WHEN nUseCycle&32 = 32 THEN '6,' 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())) + '%' " + " CASE WHEN nUseCycle&64 = 64 THEN '7' ELSE '' END LIKE '%' + convert(VARCHAR,datepart(weekday,getdate())) + '%' " +
" AND c.sShopNO = ?"; " 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; return list;
} }
...@@ -53,7 +53,7 @@ public class PromoServiceImpl implements PromoService { ...@@ -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); 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 sCustTypeID = (String)custMap.get("sCustTypeID");
String sql = "" + String sql = "" +
"SELECT DISTINCT " + " SELECT DISTINCT " +
" nGoodsID = b.nGoodsID, " + " nGoodsID = b.nGoodsID, " +
" sGoodsNO = ag.sGoodsNO, " + " sGoodsNO = ag.sGoodsNO, " +
" sGoodsDesc = ag.sGoodsDesc, " + " sGoodsDesc = ag.sGoodsDesc, " +
...@@ -74,7 +74,7 @@ public class PromoServiceImpl implements PromoService { ...@@ -74,7 +74,7 @@ public class PromoServiceImpl implements PromoService {
" nMeetQty = b.nMeetQty, " + " nMeetQty = b.nMeetQty, " +
" nDisPrice = b.nPrice " + " nDisPrice = b.nPrice " +
" FROM tPromo a, tPromoRuleGoods b, tPromoCustBWList c, tAgent at, tAgentContractGoods ag " + " 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 a.sPromoPaperNO = b.sPromoPaperNO " +
" AND b.sAgentContractNO = ag.sAgentContractNO " + " AND b.sAgentContractNO = ag.sAgentContractNO " +
" AND ag.nAgentID = at.nAgentID " + " AND ag.nAgentID = at.nAgentID " +
...@@ -93,22 +93,27 @@ public class PromoServiceImpl implements PromoService { ...@@ -93,22 +93,27 @@ public class PromoServiceImpl implements PromoService {
" AND a.sPromoPaperNO = ? " + " AND a.sPromoPaperNO = ? " +
" AND b.sPromoGroupNO = ? " + " AND b.sPromoGroupNO = ? " +
" AND c.sShopNO = ? "; " 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; return list;
} }
@Override @Override
public List<Map<String, Object>> getGroupPicList(String sPictureTypeID, String sPromoPaperNO, String sPromoGroupNO) { public List<Map<String, Object>> getGroupPicList(String sPictureTypeID, String sPromoPaperNO, String sPromoGroupNO) {
String sql = "" + String sql = "" +
"SELECT sURL = sURL " + " SELECT sURL = sURL " +
"FROM tPromoPicture " + " FROM tPromoPicture " +
"WHERE sPictureTypeID = ? " + " WHERE sPictureTypeID = ? " +
" AND nTag&3=3 " + " AND nTag&3=2 " +
" AND sPromoPaperNO = ? " + " AND sPromoPaperNO = ? " +
" AND sPromoGroupNO = ? " + " AND sPromoGroupNO = ? " +
"ORDER BY nItem"; " ORDER BY nItem";
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql, sPictureTypeID, sPromoPaperNO, sPromoGroupNO); List<Map<String, Object>> list = jdbcTemplate.queryForList(sql.replaceAll("\\s+", " "), sPictureTypeID, sPromoPaperNO, sPromoGroupNO);
return list; 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