Showing
1 changed file
with
6 additions
and
3 deletions
@@ -14,6 +14,7 @@ import org.slf4j.LoggerFactory; | @@ -14,6 +14,7 @@ import org.slf4j.LoggerFactory; | ||
14 | import org.springframework.beans.factory.annotation.Autowired; | 14 | import org.springframework.beans.factory.annotation.Autowired; |
15 | import org.springframework.stereotype.Service; | 15 | import org.springframework.stereotype.Service; |
16 | 16 | ||
17 | +import java.math.BigDecimal; | ||
17 | import java.util.*; | 18 | import java.util.*; |
18 | 19 | ||
19 | /** | 20 | /** |
@@ -51,7 +52,7 @@ public class PanshiServiceImpl implements IOrderPushService { | @@ -51,7 +52,7 @@ public class PanshiServiceImpl implements IOrderPushService { | ||
51 | param.put("orTime",DateUtil.date2String(new Date((long)orderInfo.getOrderTime() * 1000), "yyyy-MM-dd HH:mm:ss")); | 52 | param.put("orTime",DateUtil.date2String(new Date((long)orderInfo.getOrderTime() * 1000), "yyyy-MM-dd HH:mm:ss")); |
52 | param.put("code", orderInfo.getTrackingCode()); | 53 | param.put("code", orderInfo.getTrackingCode()); |
53 | // param.put("code", "1|2|3|4|5|6"); 测试时code | 54 | // param.put("code", "1|2|3|4|5|6"); 测试时code |
54 | - param.put("orMoney", orderInfo.getOrderAmount()); | 55 | + BigDecimal orMoney = new BigDecimal(0); |
55 | if(orderInfo.getPayment().equals("2")){ | 56 | if(orderInfo.getPayment().equals("2")){ |
56 | param.put("psy","b"); //2=银联支付 | 57 | param.put("psy","b"); //2=银联支付 |
57 | }else if(orderInfo.getPayment().equals("3")){ | 58 | }else if(orderInfo.getPayment().equals("3")){ |
@@ -75,6 +76,7 @@ public class PanshiServiceImpl implements IOrderPushService { | @@ -75,6 +76,7 @@ public class PanshiServiceImpl implements IOrderPushService { | ||
75 | param.put("proName", good.getProductName()); | 76 | param.put("proName", good.getProductName()); |
76 | param.put("proCat", good.getSortName()); | 77 | param.put("proCat", good.getSortName()); |
77 | param.put("commRate", COMMRATE); | 78 | param.put("commRate", COMMRATE); |
79 | + orMoney = good.getRealPayFee().multiply(new BigDecimal(good.getBuyNumber())).setScale(2, BigDecimal.ROUND_HALF_UP); | ||
78 | } else { | 80 | } else { |
79 | StringBuffer skns = new StringBuffer(); | 81 | StringBuffer skns = new StringBuffer(); |
80 | StringBuffer prices = new StringBuffer(); | 82 | StringBuffer prices = new StringBuffer(); |
@@ -84,13 +86,13 @@ public class PanshiServiceImpl implements IOrderPushService { | @@ -84,13 +86,13 @@ public class PanshiServiceImpl implements IOrderPushService { | ||
84 | StringBuffer rates = new StringBuffer(); | 86 | StringBuffer rates = new StringBuffer(); |
85 | for (int i = 0; i < goods.size(); i++) { | 87 | for (int i = 0; i < goods.size(); i++) { |
86 | skns.append(goods.get(i).getProductSkn() + "|"); | 88 | skns.append(goods.get(i).getProductSkn() + "|"); |
87 | - prices.append(goods.get(i).getRealPayFee() + "|"); | 89 | + prices.append(goods.get(i).getRealPayFee().setScale(2, BigDecimal.ROUND_HALF_UP) + "|"); |
88 | nums.append(goods.get(i).getBuyNumber() + "|"); | 90 | nums.append(goods.get(i).getBuyNumber() + "|"); |
89 | names.append(goods.get(i).getProductName() + "|"); | 91 | names.append(goods.get(i).getProductName() + "|"); |
90 | cats.append(goods.get(i).getSortName() + "|"); | 92 | cats.append(goods.get(i).getSortName() + "|"); |
91 | rates.append(COMMRATE + "|"); | 93 | rates.append(COMMRATE + "|"); |
94 | + orMoney = orMoney.add(goods.get(i).getRealPayFee().multiply(new BigDecimal(goods.get(i).getBuyNumber()))).setScale(2, BigDecimal.ROUND_HALF_UP); | ||
92 | } | 95 | } |
93 | - | ||
94 | param.put("proNo", skns.substring(0, skns.length() - 1)); | 96 | param.put("proNo", skns.substring(0, skns.length() - 1)); |
95 | param.put("proPrice", prices.substring(0, prices.length() - 1)); | 97 | param.put("proPrice", prices.substring(0, prices.length() - 1)); |
96 | param.put("proNum", nums.substring(0, nums.length() - 1)); | 98 | param.put("proNum", nums.substring(0, nums.length() - 1)); |
@@ -98,6 +100,7 @@ public class PanshiServiceImpl implements IOrderPushService { | @@ -98,6 +100,7 @@ public class PanshiServiceImpl implements IOrderPushService { | ||
98 | param.put("proCat", cats.substring(0, cats.length() - 1)); | 100 | param.put("proCat", cats.substring(0, cats.length() - 1)); |
99 | param.put("commRate", rates.substring(0, rates.length() - 1)); | 101 | param.put("commRate", rates.substring(0, rates.length() - 1)); |
100 | } | 102 | } |
103 | + param.put("orMoney",orMoney.doubleValue()); | ||
101 | Pair<Integer, String> pair = null; | 104 | Pair<Integer, String> pair = null; |
102 | try { | 105 | try { |
103 | pair = HttpUtils.httpPost(URL, param); | 106 | pair = HttpUtils.httpPost(URL, param); |
-
Please register or login to post a comment