distributorAlipayConfirm.htmlhtml
<div class="col-md-10 ceterR"> <ul class="progressBar cf mt15"> <li class="curr"><i class="yh">1</i>個人購物車</li> <li class="curr"><i class="yh">2</i>填寫收貨地址並支付</li> <li><i class="yh">3</i>下單成功</li> </ul> <h3><span class="fb" style="font-size: 20px">訂單信息</span></h3> <div> <span class="fb f14"><label>商品信息:</label></span> <span class="f12" th:text="${alipayForm.body}"></span> </div> <div> <span class="fb f14"><label>價格:</label></span> <span class="f12" th:text="${alipayForm.price}"></span> </div> <div class="table-responsive mt20"> <h1 class="red formInfo" > <span style="font-size: medium">該頁面來自您朋友<span th:text="${alipayForm.distributorName}"></span>的推薦,請認真填寫如下每項內容以保證商品可以順利到達您的手中。 </span> </h1> </div> <form name="alipayForm" action="distributorAlipaySubmit" th:object="${alipayForm}" method="post" class="form-horizontal form-address mt20"> <input name="outTradeNo" type="hidden" th:value="${alipayForm.outTradeNo}" /> <input name="subject" type="hidden" th:value="${alipayForm.subject}" /> <input name="body" type="hidden" th:value="${alipayForm.body}" /> <input name="price" type="hidden" th:value="${alipayForm.price}" /> <input name="showUrl" type="hidden" th:value="${alipayForm.showUrl}" /> <input name="commodityId" type="hidden" th:value="${alipayForm.commodityId}" /> <input name="guestId" type="hidden" th:value="${alipayForm.guestId}" /> <input type="hidden" name="distributorPriceId" th:value="${alipayForm.distributorPriceId}"/> <table> <tr style="border:solid 15px;border-color:white"> <td><i class="red">*</i> <span style="font-size: medium">收貨人姓名:</span></td> <td><input name="receiveName" type="text" class="form-control" th:value="${alipayForm.receiveName}"/></td> <td><i class="red formInfo" ><span style="font-size: medium" th:errors="${alipayForm.receiveName}"></span></i></td> </tr> <tr style="border:solid 15px;border-color:white"> <td><i class="red">*</i><span style="font-size: medium"> 所在地區:</span></td> <td><input name="receiveAddress" type="text" class="form-control" th:value="${alipayForm.receiveAddress}"/></td> <td><i class="red formInfo"><span style="font-size: medium" th:errors="${alipayForm.receiveAddress}"></span></i></td> </tr> <tr style="border:solid 15px;border-color:white"> <td><i class="red">*</i><span style="font-size: medium"> 郵政編碼:</span></td> <td><input name="receiveZip" type="tel" class="form-control" th:value="${alipayForm.receiveZip}"/></td> <td><i class="red formInfo"><span style="font-size: medium" th:errors="${alipayForm.receiveZip}"></span></i></td> </tr> <tr style="border:solid 15px;border-color:white"> <td><i class="red">*</i> <span style="font-size: medium">電話號碼:</span></td> <td><input name="receivePhone" type="tel" class="form-control" th:value="${alipayForm.receivePhone}"/></td> <td><i class="red formInfo"><span style="font-size: medium" th:errors="${alipayForm.receivePhone}"></span></i></td> </tr> <tr style="border:solid 15px;border-color:white"> <td><i class="red">*</i> <span style="font-size: medium">手機號碼:</span></td> <td><input name="receiveMobile" type="tel" class="form-control" th:value="${alipayForm.receiveMobile}"/></td> <td><i class="red formInfo"><span style="font-size: medium" th:errors="${alipayForm.receiveMobile}"></span></i></td> </tr> </table> <p class="tr mt20"><button class="btnBlue yh" >登陸支付寶結帳</button></p> </form> <!-- 填寫收貨地址並支付 over --> </div>
AlipayController.javajava
@RequestMapping(value = "distributorAlipaySubmit", method = RequestMethod.POST) public String executeDistributorAlipaySubmit(Model model,@Valid @ModelAttribute("alipayForm") AlipayForm alipayForm, BindingResult results,Device device) throws SQLException { log.info("由分銷商直接推薦的商品向支付寶發起支付請求。"); GoodsForm goodsForm = new GoodsForm(); List<GoodsForm> commodityType = goodsService.getType(); int sum=commodityType.size();//用來顯示menu上的圖標三句 for(int i=1;i<=sum;i++){ commodityType.get(i-1).setPh("ico-nav"+" "+"ico-nav-"+(i%7+1)); } model.addAttribute("goodsForm", goodsForm); model.addAttribute("alipayForm", alipayForm); model.addAttribute("commodityType", commodityType); if (results.hasErrors()) { log.info("內容驗證出錯"); model.addAttribute("message", "該畫面全部項目都是必填項,請認真填寫!"); if(device.isNormal()) { return "mobile/alipay/distributorAlipayConfirm"; } else { return "mobile/alipay/distributorAlipayConfirm"; } } alipayForm.setUpdateUser(alipayForm.getGuestId()); Date date = new Date(); SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); alipayForm.setUpdateTime(dateformat.format(date)); boolean hisResult = cartService.addAlipayHistory(alipayForm); if(!hisResult) { throw new SQLException("添加支付寶帳單失敗!"); } alipayForm.setCount("1"); boolean result = alipayService.editStock(alipayForm); if(!result) { model.addAttribute("message", "該商品爲促銷打折商品,目前已經賣完了,請關注咱們下次活動,謝謝您的參與!"); model.addAttribute("alipayForm", alipayService.searchAlipay(alipayForm)); return "mobile/alipay/distributorAlipayConfirm"; } model.addAttribute("sHtmlText", alipayRequestMobile(alipayForm)); return "manager/charge/alipay"; }