From 886d66653c5d617be5bc8c87e2d9139ad103e020 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 20 十一月 2019 14:41:58 +0800
Subject: [PATCH] 订单到账消息根据订单号再次分发
---
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/BanLiShopController.java | 48 ++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 44 insertions(+), 4 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/BanLiShopController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/BanLiShopController.java
index ca35c54..fecef80 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/BanLiShopController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/BanLiShopController.java
@@ -11,9 +11,11 @@
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.yeshi.utils.JsonUtil;
+import org.yeshi.utils.exception.WXOrderException;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
+import com.yeshi.fanli.entity.redpack.RedPackBalance;
import com.yeshi.fanli.entity.shop.BanLiShopGoods;
import com.yeshi.fanli.entity.shop.BanLiShopGoodsSets;
import com.yeshi.fanli.entity.shop.BanLiShopGoodsSetsPay;
@@ -75,7 +77,7 @@
* @param out
*/
@RequestMapping(value = "goodsList")
- public void goodsList(AcceptData acceptData, int page, String callback, PrintWriter out) {
+ public void goodsList(AcceptData acceptData, int page,Long uid, String callback, PrintWriter out) {
if (page <= 0)
page = 1;
List<BanLiShopGoods> goodsList = banLiShopGoodsService.listGoods(null, BanLiShopGoods.STATE_ONLINE, page,
@@ -90,6 +92,14 @@
}
data.put("data", goodsList);
data.put("count", count);
+
+ RedPackBalance redPackBalance = redPackBalanceService.selectByPrimaryKey(uid);
+ if (redPackBalance != null && redPackBalance.getState() == RedPackBalance.STATE_LOCKED) {
+ data.put("redPackLock", true);
+ } else {
+ data.put("redPackLock", false);
+ }
+
if (!StringUtil.isNullOrEmpty(callback))
out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
else
@@ -97,10 +107,35 @@
}
@RequestMapping(value = "orderList")
- public void orderList(AcceptData acceptData, Long uid, int page, String callback, PrintWriter out) {
+ public void orderList(AcceptData acceptData, Long uid, int page, String callback, String from, PrintWriter out) {
if (page <= 0)
page = 1;
List<BanLiShopOrder> orderList = banLiShopOrderService.listByUid(uid, page, Constant.PAGE_SIZE);
+ if (!StringUtil.isNullOrEmpty("from") && from.equalsIgnoreCase("pay")) {// 浠庢敮浠樼晫闈㈣繃鏉�
+ // 鍒ゆ柇绗竴涓鍗曟槸鍚︽敮浠樻垚鍔�
+ if (orderList.size() > 0) {
+ BanLiShopOrder latestOrder = orderList.get(0);
+ if (latestOrder.getMoneyPayment() != null
+ && latestOrder.getMoneyPayment().compareTo(new BigDecimal(0)) > 0) {
+ // 鍒ゆ柇寰俊鏀粯鏄惁鎴愬姛
+ try {
+ boolean isPaySuccess = BanLiShopWXPayUtil.isPaySuccess(latestOrder.getOrderNo());
+ if (isPaySuccess) {
+ try {
+ banLiShopOrderPayService.payOrderByMoney(latestOrder.getId(),
+ latestOrder.getMoneyPayment());
+ orderList = banLiShopOrderService.listByUid(uid, page, Constant.PAGE_SIZE);
+ } catch (BanLiShopOrderException e) {
+ e.printStackTrace();
+ }
+ }
+ } catch (WXOrderException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
List<BanLiShopOrderVO> voList = new ArrayList<>();
for (BanLiShopOrder order : orderList) {
voList.add(BanLiShopOrderGoodsVOFactory.create(order));
@@ -148,7 +183,12 @@
pay.setName(getPayName(pay.getPayType()));
}
}
- BigDecimal money = redPackBalanceService.getBalance(uid);
+ BigDecimal money = new BigDecimal(0);
+ try {
+ money = redPackBalanceService.getBalance(uid);
+ } catch (RedPackBalanceException e) {
+ e.printStackTrace();
+ }
JSONObject data = new JSONObject();
data.put("goods", goods);
data.put("hongBaoBalance", money);
@@ -192,7 +232,7 @@
if (order.getMoneyPayment() != null && order.getMoneyPayment().compareTo(new BigDecimal(0)) > 0) {
// 璧板井淇℃敮浠�
String payUrl = BanLiShopWXPayUtil.getWXH5PayUrl(order.getOrderNo(), request.getRemoteAddr(),
- order.getOrderGoods().getGoodsName(), order.getMoneyPayment());
+ order.getOrderGoods().getGoodsName(), order.getMoneyPayment(), acceptData.getPlatform());
if (StringUtil.isNullOrEmpty(payUrl)) {
if (!StringUtil.isNullOrEmpty(callback))
out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(102, "寰俊鏀粯鍒涘缓澶辫触")));
--
Gitblit v1.8.0