Commit fa24b17c authored by 韩旭's avatar 韩旭

订单明细增加了PromoSalePrice(促销价),RealSaleAmount(实际销售金额),ISGift(是否是赠品)字段输出

parent 7e22e9a8
...@@ -176,7 +176,9 @@ public class OrderServiceImpl implements OrderService { ...@@ -176,7 +176,9 @@ public class OrderServiceImpl implements OrderService {
List<Map<String, Object>> orderList = jdbcTemplate.limit(sql, page); List<Map<String, Object>> orderList = jdbcTemplate.limit(sql, page);
if(orderList.size() > 0) { if(orderList.size() > 0) {
List<String> orderIds = orderList.stream().map(o-> (String)o.get("sSalesOrderID")).collect(Collectors.toList()); List<String> orderIds = orderList.stream().map(o-> (String)o.get("sSalesOrderID")).collect(Collectors.toList());
String sql2 = "select sod.*, agp.sURL from tSalesOrderDtl sod left join V_GetminAgentGoodsPic agp on agp.nAgentID = sod.nAgentID and agp.nGoodsID = sod.nGoodsID and agp.sPicTypeID = 1 where sod.sSalesOrderID in (" + StringUtil.join("', '", "'", "'", orderIds) + ")"; String sql2 = "select sod.*,PromoSalePrice=CONVERT(NUMERIC(12,2),ROUND((sod.nSaleAmount-sod.nDisAmount)/sod.nSaleQty,2)),RealSaleAmount=sod.nSaleAmount-sod.nDisAmount,ISGift = sod.nTag&1,agp.sURL "
+ " from tSalesOrderDtl sod left join V_GetminAgentGoodsPic agp on agp.nAgentID = sod.nAgentID and agp.nGoodsID = sod.nGoodsID and agp.sPicTypeID = 1 "
+ " where sod.sSalesOrderID in (" + StringUtil.join("', '", "'", "'", orderIds) + ")";
List<Map<String, Object>> orderDtlList = jdbcTemplate.queryForList(sql2); List<Map<String, Object>> orderDtlList = jdbcTemplate.queryForList(sql2);
Map<String, List<Map<String, Object>>> dtlML = Util.listToML(orderDtlList, "sSalesOrderID"); Map<String, List<Map<String, Object>>> dtlML = Util.listToML(orderDtlList, "sSalesOrderID");
for(Map<String, Object> orderMap : orderList) { for(Map<String, Object> orderMap : orderList) {
...@@ -188,7 +190,9 @@ public class OrderServiceImpl implements OrderService { ...@@ -188,7 +190,9 @@ public class OrderServiceImpl implements OrderService {
List<Map<String, Object>> subList = jdbcTemplate.queryForList(sql3); List<Map<String, Object>> subList = jdbcTemplate.queryForList(sql3);
if(subList.size() > 0) { if(subList.size() > 0) {
List<String> subIds = subList.stream().map(o-> (String)o.get("sSubOrderID")).collect(Collectors.toList()); List<String> subIds = subList.stream().map(o-> (String)o.get("sSubOrderID")).collect(Collectors.toList());
String sql4 = "select sosd.*, agp.sURL from tSalesOrderSubDtl sosd left join V_GetminAgentGoodsPic agp on agp.nAgentID = sosd.nAgentID and agp.nGoodsID = sosd.nGoodsID and agp.sPicTypeID = 1 where sosd.sSubOrderID in (" + StringUtil.join("', '", "'", "'", subIds) + ")"; String sql4 = "select sosd.*,PromoSalePrice=CONVERT(NUMERIC(12,2),ROUND((sosd.nSaleAmount-sosd.nDisAmount)/sosd.nSaleQty,2)),RealSaleAmount=sosd.nSaleAmount-sosd.nDisAmount,ISGift = sosd.nTag&1,"
+ " agp.sURL from tSalesOrderSubDtl sosd left join V_GetminAgentGoodsPic agp on agp.nAgentID = sosd.nAgentID and agp.nGoodsID = sosd.nGoodsID and agp.sPicTypeID = 1"
+ " where sosd.sSubOrderID in (" + StringUtil.join("', '", "'", "'", subIds) + ")";
List<Map<String, Object>> subDtlList = jdbcTemplate.queryForList(sql4); List<Map<String, Object>> subDtlList = jdbcTemplate.queryForList(sql4);
Map<String, List<Map<String, Object>>> subDtlML = Util.listToML(subDtlList, "sSubOrderID"); Map<String, List<Map<String, Object>>> subDtlML = Util.listToML(subDtlList, "sSubOrderID");
for(Map<String, Object> subMap : subList) { for(Map<String, Object> subMap : subList) {
...@@ -217,7 +221,8 @@ public class OrderServiceImpl implements OrderService { ...@@ -217,7 +221,8 @@ public class OrderServiceImpl implements OrderService {
} }
List<Map<String, Object>> orderDtlList = new ArrayList<Map<String, Object>>(); List<Map<String, Object>> orderDtlList = new ArrayList<Map<String, Object>>();
if(orderMap.size() > 0) { if(orderMap.size() > 0) {
String sql2 = "select sod.*,sos.nSendQty, agp.sURL, pm.sPromoTheme, pm.sPromoActionType sPromoType, pm.sPromoActionTypeID sPromoTypeID " String sql2 = "select sod.*,sos.nSendQty, PromoSalePrice=CONVERT(NUMERIC(12,2),ROUND((sod.nSaleAmount-sod.nDisAmount)/sod.nSaleQty,2)),RealSaleAmount=sod.nSaleAmount-sod.nDisAmount,ISGift = sod.nTag&1,"
+ " agp.sURL, pm.sPromoTheme, pm.sPromoActionType sPromoType, pm.sPromoActionTypeID sPromoTypeID "
+ " from tSalesOrderDtl sod left join tYWPromoMain pm on pm.sPromoPaperNO = sod.sPromoPaperNO " + " from tSalesOrderDtl sod left join tYWPromoMain pm on pm.sPromoPaperNO = sod.sPromoPaperNO "
+ " left join V_GetminAgentGoodsPic agp on agp.nAgentID = sod.nAgentID and agp.nGoodsID = sod.nGoodsID and agp.sPicTypeID = 1" + " left join V_GetminAgentGoodsPic agp on agp.nAgentID = sod.nAgentID and agp.nGoodsID = sod.nGoodsID and agp.sPicTypeID = 1"
+ " left join tSalesOrderSubDtl sos on sos.sSalesOrderID = sod.sSalesOrderID and sos.nGoodsID = sod.nGoodsID " + " left join tSalesOrderSubDtl sos on sos.sSalesOrderID = sod.sSalesOrderID and sos.nGoodsID = sod.nGoodsID "
...@@ -317,7 +322,10 @@ public class OrderServiceImpl implements OrderService { ...@@ -317,7 +322,10 @@ public class OrderServiceImpl implements OrderService {
List<Map<String, Object>> subList = jdbcTemplate.queryForList(sql, salesOrderId); List<Map<String, Object>> subList = jdbcTemplate.queryForList(sql, salesOrderId);
if(subList.size() > 0) { if(subList.size() > 0) {
List<String> subIds = subList.stream().map(o-> (String)o.get("sSubOrderID")).collect(Collectors.toList()); List<String> subIds = subList.stream().map(o-> (String)o.get("sSubOrderID")).collect(Collectors.toList());
String sql2 = "select sosd.*, agp.sURL, pm.sPromoTheme, pm.sPromoActionType sPromoType, pm.sPromoActionTypeID sPromoTypeID from tSalesOrderSubDtl sosd left join tYWPromoMain pm on pm.sPromoPaperNO = sosd.sPromoPaperNO left join V_GetminAgentGoodsPic agp on agp.nAgentID = sosd.nAgentID and agp.nGoodsID = sosd.nGoodsID and agp.sPicTypeID = 1 where sosd.sSubOrderID in (" + StringUtil.join("', '", "'", "'", subIds) + ")"; String sql2 = "select sosd.*,PromoSalePrice=CONVERT(NUMERIC(12,2),ROUND((sosd.nSaleAmount-sosd.nDisAmount)/sosd.nSaleQty,2)),RealSaleAmount=sosd.nSaleAmount-sosd.nDisAmount,ISGift = sosd.nTag&1," +
+ " agp.sURL, pm.sPromoTheme, pm.sPromoActionType sPromoType, pm.sPromoActionTypeID sPromoTypeID "
+ " from tSalesOrderSubDtl sosd left join tYWPromoMain pm on pm.sPromoPaperNO = sosd.sPromoPaperNO left join V_GetminAgentGoodsPic agp on agp.nAgentID = sosd.nAgentID and agp.nGoodsID = sosd.nGoodsID and agp.sPicTypeID = 1"
+ " where sosd.sSubOrderID in (" + StringUtil.join("', '", "'", "'", subIds) + ")";
List<Map<String, Object>> subDtlList = jdbcTemplate.queryForList(sql2); List<Map<String, Object>> subDtlList = jdbcTemplate.queryForList(sql2);
Map<String, List<Map<String, Object>>> subDtlML = Util.listToML(subDtlList, "sSalesOrderID"); Map<String, List<Map<String, Object>>> subDtlML = Util.listToML(subDtlList, "sSalesOrderID");
for(Map<String, Object> subMap : subList) { for(Map<String, Object> subMap : subList) {
...@@ -396,7 +404,8 @@ public class OrderServiceImpl implements OrderService { ...@@ -396,7 +404,8 @@ public class OrderServiceImpl implements OrderService {
+ "from tSalesOrder so where so.sSalesOrderID = ?", subOrderMap.get("sSalesOrderID")); + "from tSalesOrder so where so.sSalesOrderID = ?", subOrderMap.get("sSalesOrderID"));
String sql = "" String sql = ""
+ "select " + "select "
+ "sosd.*, sosd.nSendQty - isnull(sosd.nReturnQty,0) LeftReturnQty, ag.nSaleUnits SaleMulti, ag.sSpec sSpec," + "sosd.*, PromoSalePrice=CONVERT(NUMERIC(12,2),ROUND((sosd.nSaleAmount-sosd.nDisAmount)/sosd.nSaleQty,2)),RealSaleAmount=sosd.nSaleAmount-sosd.nDisAmount,ISGift = sosd.nTag&1, "
+ "sosd.nSendQty - isnull(sosd.nReturnQty,0) LeftReturnQty, ag.nSaleUnits SaleMulti, ag.sSpec sSpec,"
+ "ag.sGoodTypeID GoodTypeID, " + "ag.sGoodTypeID GoodTypeID, "
+ "agp.sURL, " + "agp.sURL, "
+ "pm.sPromoTheme, " + "pm.sPromoTheme, "
...@@ -1098,6 +1107,9 @@ public class OrderServiceImpl implements OrderService { ...@@ -1098,6 +1107,9 @@ public class OrderServiceImpl implements OrderService {
" RealSalePrice = ag.nRealSalePrice," + " RealSalePrice = ag.nRealSalePrice," +
" SaleAmount = case when b.sSalesOrderTypeID = '0' then a.nSaleAmount else 0 end," + " SaleAmount = case when b.sSalesOrderTypeID = '0' then a.nSaleAmount else 0 end," +
" DisAmount = case when b.sSalesOrderTypeID = '0' then a.nDisAmount else 0 end," + " DisAmount = case when b.sSalesOrderTypeID = '0' then a.nDisAmount else 0 end," +
" PromoSalePrice = CONVERT(NUMERIC(12,2),ROUND((a.nSaleAmount-a.nDisAmount)/a.nSaleQty,2))," +
" RealSaleAmount = a.nSaleAmount-a.nDisAmount," +
" ISGift = a.nTag&1" +
" PromoPaperNO = a.sPromoPaperNO," + " PromoPaperNO = a.sPromoPaperNO," +
" PromoActionTypeID = a.sPromoActionTypeID," + " PromoActionTypeID = a.sPromoActionTypeID," +
" ReturnQty = case when b.sSalesOrderTypeID = '0' then isnull(a.nReturnQty,0) else abs(a.nSendQty) end," + " ReturnQty = case when b.sSalesOrderTypeID = '0' then isnull(a.nReturnQty,0) else abs(a.nSendQty) end," +
......
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