admin
2019-11-08 ae6bf015031bd6579cc719ee7689d8160e3d92d2
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/BanLiShopController.java
@@ -11,6 +11,7 @@
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;
@@ -97,10 +98,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));
@@ -192,7 +218,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, "微信支付创建失败")));