| | |
| | | package com.yeshi.fanli.controller;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.manger.alipay.UserCloudAlipayManager;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | /**
|
| | | * |
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Controller
|
| | | @RequestMapping("client/v1/cloud/callback")
|
| | | public class CloudCallBackController2 {
|
| | | @Resource
|
| | | private UserCloudAlipayManager userCloudAlipayManager;
|
| | | |
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | | |
| | |
|
| | | /**
|
| | | * 支付链接
|
| | | * @param response
|
| | | * @param request
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "payUrl")
|
| | | public void payUrl(String key, HttpServletResponse response, PrintWriter out) {
|
| | | if (StringUtil.isNullOrEmpty(key)) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "请传递正确的参数"));
|
| | | return;
|
| | | }
|
| | | try {
|
| | | // 取值
|
| | | String content = redisManager.getCommonString(key);
|
| | | if (StringUtil.isNullOrEmpty(content)) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "支付信息已失效"));
|
| | | return;
|
| | | }
|
| | | response.setContentType("text/html;charset=utf-8");
|
| | | response.getWriter().print(content);
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "支付信息已失效"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 支付完成
|
| | | * |
| | | * @param id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "payEnd")
|
| | | public void payEnd(Long id, PrintWriter out) {
|
| | | if (id == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "参数信息缺失"));
|
| | | return;
|
| | | }
|
| | | try {
|
| | | userCloudAlipayManager.tradeQueryByOrderId(id);
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "检测失败"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | | }
|
| | | package com.yeshi.fanli.controller; |
| | | |
| | | import java.io.PrintWriter; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.yeshi.utils.JsonUtil; |
| | | |
| | | import com.yeshi.fanli.log.LogHelper; |
| | | import com.yeshi.fanli.service.manger.alipay.UserCloudAlipayManager; |
| | | import com.yeshi.fanli.util.RedisManager; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | |
| | | /** |
| | | * |
| | | * |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | @Controller |
| | | @RequestMapping("client/v1/cloud/callback") |
| | | public class CloudCallBackController2 { |
| | | @Resource |
| | | private UserCloudAlipayManager userCloudAlipayManager; |
| | | |
| | | @Resource |
| | | private RedisManager redisManager; |
| | | |
| | | |
| | | /** |
| | | * 支付链接 |
| | | * @param response |
| | | * @param request |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "payUrl") |
| | | public void payUrl(String key, HttpServletResponse response, PrintWriter out) { |
| | | if (StringUtil.isNullOrEmpty(key)) { |
| | | out.print(JsonUtil.loadFalseResult(1, "请传递正确的参数")); |
| | | return; |
| | | } |
| | | try { |
| | | // 取值 |
| | | String content = redisManager.getCommonString(key); |
| | | if (StringUtil.isNullOrEmpty(content)) { |
| | | out.print(JsonUtil.loadFalseResult(1, "支付信息已失效")); |
| | | return; |
| | | } |
| | | response.setContentType("text/html;charset=utf-8"); |
| | | response.getWriter().print(content); |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadFalseResult(1, "支付信息已失效")); |
| | | LogHelper.errorDetailInfo(e); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 支付完成 |
| | | * |
| | | * @param id |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "payEnd") |
| | | public void payEnd(Long id, PrintWriter out) { |
| | | if (id == null) { |
| | | out.print(JsonUtil.loadFalseResult(1, "参数信息缺失")); |
| | | return; |
| | | } |
| | | try { |
| | | userCloudAlipayManager.tradeQueryByOrderId(id); |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadFalseResult(1, "检测失败")); |
| | | LogHelper.errorDetailInfo(e); |
| | | } |
| | | } |
| | | } |