dd

<td class="chk">									
   <input type="hidden" th:name="${#strings.concat('listBean[').concat(status.index).concat('].commodityId')}" th:value="${cartsInfo.commodityId}"/>
<input type="checkbox" th:name="${#strings.concat('listBean[').concat(status.index).concat('].checkArray')}" /></td>
									<td>
在alipay	controller.java
	@RequestMapping(value = "initPayResult", method = RequestMethod.GET)
	public String initPayResult(Model model, HttpSession session, ReturnForm returnForm, Device device) {
		log.info("支付宝处理完毕后返回商户网站");
		UVO uvo = (UVO)session.getAttribute("UVO");
		CartForm cartForm = new CartForm();
		if (uvo != null) {
			cartForm.setGuestId(uvo.getGuestId());
		} else {
			uvo = new UVO();
			session.setAttribute("UVO", uvo);
		}
    	
    	model.addAttribute("cartList", cartService.searchCartList(cartForm));
		if (device.isNormal()) {
			model.addAttribute("returnForm", returnForm);
			return "shop/cart/cart-3";
		} else {
			return "mobile/alipay/payResult";
		}
	}
在cart-3.html
  <div class="buySuccess tc">
					<i class="ico-succ"></i>
					<h4 class="regTips yh">恭喜您,购买成功!</h4>
					<p class="yh">您的订单编号为:<i class="red" th:text="${returnForm.out_trade_no}"></i></p>
				</div>
				<!-- 购买成功 -->

修改cart-2

<form name="alipayForm" action="alipaysubmit" th:object="${alipayForm}" method="post" class="form-horizontal form-address mt20">
			    <input type="hidden" name="outTradeNo" value="" th:value="${alipayForm.outTradeNo}"/>
									<input type="hidden" name="subject" value="" th:value="${alipayForm.subject}"/>
									<input type="hidden" name="body" value="" th:value="${alipayForm.body}"/>
									<input type="hidden" name="price" value="" th:value="${alipayForm.price}"/>
									<input type="hidden" name="showUrl" value="" th:value="${alipayForm.showUrl}"/>
									<input type="hidden" name="receiveName" value="" th:value="${alipayForm.receiveName}"/>
									<input type="hidden" name="receiveAddress" value="" th:value="${alipayForm.receiveAddress}"/>
									<input type="hidden" name="receiveZip" value="" th:value="${alipayForm.receiveZip}"/>
									<input type="hidden" name="receivePhone" value="" th:value="${alipayForm.receivePhone}"/>
									<input type="hidden" name="receiveMobile" value="" th:value="${alipayForm.receiveMobile}"/>
	<td class="chk"><input type="radio" class="vm"/> <span th:text="${alipayForm.receiveName}"></span></td>
					           	<td><span th:text="${alipayForm.receiveAddress}"></span></td>
					           	<td><span th:text="${alipayForm.receiveZip}"></span></td>
					           	<td><span th:text="${alipayForm.receivePhone}"></span></td>
					           	<td>
 @RequestMapping(value = "alipayConfirm", method = RequestMethod.POST)
    public String alipayConfirm(Model model, HttpSession session, Device device) {
		GoodsForm goodsForm=new GoodsForm();
//		goodsForm.setType("粮食");
//		model.addAttribute("goodsForm", goodsForm);
		List<GoodsForm> commodityType = goodsService.getType();
    	goodsForm.setCommodityTypeId(commodityType.get(0).getCommodityTypeId());
    	model.addAttribute("goodsForm", goodsForm);
    	model.addAttribute("commodityType", commodityType);
    	log.info("确认支付");
    	CartForm cartForm = new CartForm();
    	UVO uvo = (UVO)session.getAttribute("UVO");
    	if (uvo == null || StringUtils.isEmpty(uvo.getGuestId())) {
    		return "redirect:/initGuestLogin";
    	}
    	cartForm.setGuestId(uvo.getGuestId());
    	List<CartForm> list = cartService.searchCartList(cartForm);
    	AlipayForm alipayForm = new AlipayForm();
    	String body = "您购买的商品如下:";
    	Double price = 0d;
    	for (CartForm item : list) {
    		body = body + "品名:" + item.getCommodityName() +", 数量:"+ item.getCount() +", 总价:"+ String.valueOf(Double.valueOf(item.getCount())*Double.valueOf(item.getRetailPrice())) +";";
    		price = price + Double.valueOf(item.getCount())*Double.valueOf(item.getRetailPrice());
    	}
    	alipayForm.setBody(body);
    	alipayForm.setOutTradeNo(list.get(0).getCartId());
    	// 不满88元加8元邮费
    	if(price < 88) {
    		price = price + 8;
    		body = body + "(由于本次订单未满88元,加收您邮费8元)";
    	}
    	alipayForm.setPrice(price.toString());
    	alipayForm.setReceiveAddress(uvo.getAddress());
    	alipayForm.setReceiveMobile(uvo.getMobile());
    	alipayForm.setReceiveName(uvo.getGuestName());
    	alipayForm.setReceivePhone(uvo.getPhone());
    	alipayForm.setReceiveZip(uvo.getZip());
    	String host = env.getProperty("host.web");
    	alipayForm.setShowUrl(host + "/initCart");
    	alipayForm.setSubject(body);
    	model.addAttribute("alipayForm", alipayForm);
    	cartForm.setGuestId(uvo.getGuestId());
    	model.addAttribute("cartList", cartService.searchCartList(cartForm));
        if(device.isNormal()) {
    		return "shop/cart/cart-2";
    	} else {
    		return "mobile/alipay/alipayConfirm";
    	}
    }


你可能感兴趣的:(dd)