Эх сурвалжийг харах

Merge remote-tracking branch 'origin/dev' into dev

dongbw 8 жил өмнө
parent
commit
8e64058abe

+ 1 - 1
donate-console/src/main/resources/dev/account.properties

@@ -13,7 +13,7 @@ sso.cookie.secure=false
 #sso.login.url=http://account.xyz.hjq:8090/account/sso/login
 
 ąžľŘ
-sso.cookie.domain=http://hejq.ubtob.com:8899/index
+sso.cookie.domain=index
 sso.login.url=http://hejq.ubtob.com:8090/account/sso/login
 
 ### account center config,

+ 1 - 1
donate-console/src/main/resources/prod/account.properties

@@ -5,7 +5,7 @@ sso.secretkey=0taQcW073Z7G628g5H
 sso.cookie.secure=false
 
 #ŐýĘ˝
-sso.cookie.domain=.ubtob.com
+sso.cookie.domain=ubtob.com
 sso.login.url=https://account.ubtob.com/sso/login
 
 ### account center config,

+ 82 - 51
donate-service/src/main/java/com/uas/service/donate/controller/AlipayController.java

@@ -5,11 +5,11 @@ import com.alipay.api.AlipayApiException;
 import com.alipay.api.AlipayClient;
 import com.alipay.api.DefaultAlipayClient;
 import com.alipay.api.domain.AlipayTradeAppPayModel;
-import com.alipay.api.domain.AlipayTradePagePayModel;
 import com.alipay.api.domain.AlipayTradeWapPayModel;
 import com.alipay.api.internal.util.AlipaySignature;
 import com.alipay.api.request.AlipaySystemOauthTokenRequest;
 import com.alipay.api.request.AlipayTradeAppPayRequest;
+import com.alipay.api.request.AlipayTradePagePayRequest;
 import com.alipay.api.request.AlipayUserInfoShareRequest;
 import com.alipay.api.response.AlipaySystemOauthTokenResponse;
 import com.alipay.api.response.AlipayTradeAppPayResponse;
@@ -25,7 +25,6 @@ import com.uas.service.donate.model.ProjectRecode;
 import com.uas.service.donate.service.AlipayOrderService;
 import com.uas.service.donate.service.AlipayUserService;
 import com.uas.service.donate.service.ProjectRecodeService;
-import com.uas.service.donate.util.NumberGenerator;
 import com.uas.service.donate.util.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -76,31 +75,32 @@ public class AlipayController {
      * 手机 wap支付
      */
     @ResponseBody
-    @RequestMapping("/wapPay")
-    public void wapPay() {
+    @RequestMapping(value = "/wapPay", method = RequestMethod.GET)
+    public void wapPay(@RequestParam String jsonStr, HttpServletRequest request, HttpServletResponse response) throws IOException {
+        ProjectRecode projectRecode= null;
         try {
-            String timeoutExpress = "30m";
-            //String sellerId = "2088102171369624";
-            String body = "移动端网页支付";
-            String subject = "Wap支付测试";
-            String totalAmount = "0.01";
-            String passbackParams = URLEncoder.encode("1","UTF-8");//回传参数  附加消息 参数必须进行UrlEncode之后才可以发送给支付宝
-            String returnUrl = AlipayConfig.RETURN_URL;
-            String notifyUrl = AlipayConfig.NOTIFY_URL;
+            projectRecode = this.createProjectRecode(jsonStr);
+        } catch (Exception e) {
+            response.getWriter().write(e.getMessage());
+            return;
+        }
+
+        try {
+            String passbackParams = URLEncoder.encode("1",AlipayConfig.CHARSET);//回传参数  附加消息 参数必须进行UrlEncode之后才可以发送给支付宝
 
             AlipayTradeWapPayModel model = new AlipayTradeWapPayModel();
-            model.setTimeoutExpress(timeoutExpress);//该笔订单允许的最晚付款时间,逾期将关闭交易。取值范围:1m~15d。该参数数值不接受小数点, 如 1.5h,可转换为 90m。
-            //model.setSellerId(sellerId);
-            model.setBody(body);
-            model.setSubject(subject);
-            model.setTotalAmount(totalAmount);
+            model.setTimeoutExpress("30m");//该笔订单允许的最晚付款时间,逾期将关闭交易。取值范围:1m~15d。该参数数值不接受小数点, 如 1.5h,可转换为 90m。
+            //model.setSellerId("2088102171369624");
+            model.setBody("移动端网页支付");
+            model.setSubject(projectRecode.getProjectName());
+            model.setTotalAmount(projectRecode.getAmount().toString());
             model.setPassbackParams(passbackParams);
-            String outTradeNo = NumberGenerator.generateId();
-            model.setOutTradeNo(outTradeNo);
+            model.setOutTradeNo(projectRecode.getId().toString());
             model.setProductCode("QUICK_WAP_PAY");
 
-            AlipayApi.wapPay(response,model,alipayClient,notifyUrl,returnUrl);
+            AlipayApi.wapPay(response, model, alipayClient, AlipayConfig.NOTIFY_URL, AlipayConfig.RETURN_URL);
         } catch (Exception e) {
+            response.getWriter().write(e.getMessage());
             e.printStackTrace();
         }
     }
@@ -109,30 +109,60 @@ public class AlipayController {
      * PC支付
      */
     @ResponseBody
-    @RequestMapping("/pcPay")
-    public void pcPay(HttpServletRequest request, HttpServletResponse response){
+    @RequestMapping(value = "/pcPay", method = RequestMethod.GET)
+    public void pcPay(@RequestParam String jsonStr, HttpServletRequest request, HttpServletResponse response) throws IOException {
+        ProjectRecode projectRecode= null;
         try {
-            String totalAmount = "0.01";
-            String outTradeNo = NumberGenerator.generateId();
-
-            String returnUrl = AlipayConfig.RETURN_URL;
-            String notifyUrl = AlipayConfig.NOTIFY_URL;
-            AlipayTradePagePayModel model = new AlipayTradePagePayModel();
-
-
-            model.setTimeoutExpress("5m");//该笔订单允许的最晚付款时间,逾期将关闭交易。取值范围:1m~15d。该参数数值不接受小数点, 如 1.5h,可转换为 90m。
-            //model.setSellerId("2088102171369624");
-            model.setOutTradeNo(outTradeNo);
-            model.setProductCode("FAST_INSTANT_TRADE_PAY");
-            model.setTotalAmount(totalAmount);
-            model.setSubject("PC支付测试");
-            model.setBody("PC支付测试body");
-            model.setPassbackParams(URLEncoder.encode("附加消息", "UTF-8"));
-
-            AlipayApi.tradePage(response,model,alipayClient,notifyUrl,returnUrl);
+            projectRecode = this.createProjectRecode(jsonStr);
         } catch (Exception e) {
+            response.getWriter().write(e.getMessage());
+            return;
+        }
+
+        AlipayTradePagePayRequest alipayRequest = new AlipayTradePagePayRequest();//创建API对应的request
+        alipayRequest.setReturnUrl(AlipayConfig.RETURN_URL);
+        alipayRequest.setNotifyUrl(AlipayConfig.NOTIFY_URL);//在公共参数中设置回跳和通知地址
+        alipayRequest.setBizContent("{" +
+                "    \"out_trade_no\":" + projectRecode.getId().toString() + "," +
+                "    \"product_code\":\"FAST_INSTANT_TRADE_PAY\"," +
+                "    \"total_amount\":" + projectRecode.getAmount().toString() + "," +
+                "    \"subject\":" + "不晓得填什么" + "," +
+                "    \"body\":" + projectRecode.getProjectName() + "," +
+                "    \"passback_params\":\"merchantBizType%3d3C%26merchantBizNo%3d2016010101111\"," +
+                "  }");//填充业务参数
+        String form="";
+        try {
+            form = alipayClient.pageExecute(alipayRequest).getBody(); //调用SDK生成表单
+        } catch (AlipayApiException e) {
             e.printStackTrace();
         }
+        response.setContentType("text/html;charset=" + AlipayConfig.CHARSET);
+        response.getWriter().write(form);//直接将完整的表单html输出到页面
+        response.getWriter().flush();
+        response.getWriter().close();
+
+//        try {
+//            String totalAmount = "0.01";
+//            String outTradeNo = NumberGenerator.generateId();
+//
+//            String returnUrl = AlipayConfig.RETURN_URL;
+//            String notifyUrl = AlipayConfig.NOTIFY_URL;
+//            AlipayTradePagePayModel model = new AlipayTradePagePayModel();
+//
+//
+//            model.setTimeoutExpress("5m");//该笔订单允许的最晚付款时间,逾期将关闭交易。取值范围:1m~15d。该参数数值不接受小数点, 如 1.5h,可转换为 90m。
+//            //model.setSellerId("2088102171369624");
+//            model.setOutTradeNo(outTradeNo);
+//            model.setProductCode("FAST_INSTANT_TRADE_PAY");
+//            model.setTotalAmount(totalAmount);
+//            model.setSubject("PC支付测试");
+//            model.setBody("PC支付测试body");
+//            model.setPassbackParams(URLEncoder.encode("附加消息", "UTF-8"));
+//
+//            AlipayApi.tradePage(response,model,alipayClient,notifyUrl,returnUrl);
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        }
 
     }
 
@@ -141,19 +171,13 @@ public class AlipayController {
      */
     @ResponseBody
     @RequestMapping(value = "/appPay", method = RequestMethod.GET)
-    public void appPay(@RequestParam String jsonStr , HttpServletRequest request, HttpServletResponse response){
-        ProjectRecode projectRecode= JSONObject.parseObject(jsonStr,ProjectRecode.class);
-        projectRecode.setTime(new Date());
-        ProjectRecode newProjectRecode = null;
+    public void appPay(@RequestParam String jsonStr, HttpServletRequest request, HttpServletResponse response) throws IOException {
+        ProjectRecode newProjectRecode= null;
         try {
-            newProjectRecode = projectRecodeService.join(projectRecode);
+            newProjectRecode = this.createProjectRecode(jsonStr);
         } catch (Exception e) {
-            try {
-                response.getWriter().write(e.getMessage());
-                return;
-            } catch (IOException e1) {
-                e1.printStackTrace();
-            }
+            response.getWriter().write(e.getMessage());
+            return;
         }
 
         //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay
@@ -463,4 +487,11 @@ public class AlipayController {
         }
         alipayOrderService.save(alipayOrder);
     }
+
+    private ProjectRecode createProjectRecode(String jsonStr) throws Exception {
+        ProjectRecode projectRecode= JSONObject.parseObject(jsonStr,ProjectRecode.class);
+        projectRecode.setTime(new Date());
+        ProjectRecode newProjectRecode = projectRecodeService.join(projectRecode);
+        return newProjectRecode;
+    }
 }

+ 15 - 0
donate-service/src/main/java/com/uas/service/donate/model/ProjectRecode.java

@@ -62,6 +62,13 @@ public class ProjectRecode {
     @Column(name = "pr_org_name")
     private String orgName;
 
+    /**
+     * 捐款方式
+     * @return
+     */
+    @Column(name = "pr_way")
+    private String way;
+
     /**
      * 支付状态(1:待支付,2:已支付,3:异常情况)
      * @return
@@ -140,6 +147,14 @@ public class ProjectRecode {
         this.orgName = orgName;
     }
 
+    public String getWay() {
+        return way;
+    }
+
+    public void setWay(String way) {
+        this.way = way;
+    }
+
     public short getStatus() {
         return status;
     }

+ 82 - 49
donate-service/src/main/resources/templates/index.ftl

@@ -412,16 +412,12 @@
         /*我要捐款弹出窗*/
         .pop{
             margin: 0 auto;
-            width: 510px;
-            height: 410px;
+            width: 480px;
+            /*height: 330px;*/
             text-align: center;
+            border: 1px solid #e1e1e1;
             display: none;
         }
-
-        .pop .modal-dialog .modal-content{
-            width: 510px;
-            height: 410px;
-        }
         .pop .header{
             padding: 0 20px;
             width: 100%;
@@ -520,8 +516,8 @@
         }
         .pop .body .choose .pay .item{
             float: left;
-            margin-right: 10px;
-            width: 110px;
+            margin-right: 16px;
+            width: 100px;
             height: 34px;
             line-height: 34px;
             text-align: center;
@@ -560,13 +556,46 @@
         .pop .body button:hover{
             background: #be3b1b;
         }
-        .modal-open .modal {
+
+        #hover-background .x-floating-wrap {
+            position: fixed;
+            z-index: 99998;
+            background: #000;
+            top: 0;
+            left: 0;
             width: 100%;
             height: 100%;
+            opacity: 0.3;
         }
-        .modal-open .modal .modal-dialog{
-            width: 510px;
-            height: 410px;
+        #hover-background{
+            display:table; overflow:hidden; margin-left:50px; _position:relative;  width: 1200px;height: 700px;
+            position: fixed;
+            top: 50%;
+            margin-top: -300px;
+            left: 50%;
+            margin-left: -600px;
+            z-index: 2000;
+        }
+        #hover-background .x-floating{
+            vertical-align:middle !important;
+            display:table-cell;
+            text-align:center;
+            _position:absolute;
+            _top:50%; _left:50%;
+            top: inherit !important;
+            left: inherit !important;
+        }
+        #hover-background .x-floating .modal{
+            margin: auto auto;
+            max-width: 970px !important;
+            max-height: 600px !important;
+            -webkit-user-select: none;
+            -moz-user-select: none;
+            -ms-user-select: none;
+            user-select: none;
+        }
+        #hover-background .x-floating-wrap{
+            z-index: 1000000 !important;
         }
         /*切换*/
         .buttons{
@@ -702,47 +731,51 @@
 <#--                <input type="button" onclick="donate()" class="fr donation">-->
                 <!--弹出窗-->
                 <div class="pop">
-                    <div class="modal-dialog">
-                        <div class="modal-content">
-                            <div class="header modal-header clearfix">
-                                <p class="fl">${project.name!''}</p>
-                                <p>${project.id!''}</p>
-                                <div class="close fr" data-dismiss="modal">&times;</div>
+                    <div class="header clearfix">
+                        <p class="fl">${project.name!''}</p>
+                        <#--<p>${project.id!''}</p>-->
+                        <div class="close fr" data-dismiss="modal">&times;</div>
+                    </div>
+                    <div class="body">
+                        <div class="choose clearfix">
+                            <span class="fl">捐款金额:</span>
+                            <div class="fl">
+                                <ul>
+                                    <li class="active">1元</li>
+                                    <li>50元</li>
+                                    <li>100元</li>
+                                    <li>200元</li>
+                                </ul>
+                                <div class="write"><input type="text" placeholder="其他金额" class="form-control"/><em>元</em></div>
                             </div>
-                            <div class="body modal-body">
-                                <div class="choose clearfix">
-                                    <span class="fl">捐款金额:</span>
-                                    <div class="fl">
-                                        <ul>
-                                            <li class="active">1元</li>
-                                            <li>50元</li>
-                                            <li>100元</li>
-                                            <li>200元</li>
-                                        </ul>
-                                        <div class="write"><input type="text" placeholder="其他金额" class="form-control"/><em>元</em></div>
-                                    </div>
-                                </div>
-                                <div class="choose clearfix">
-                                    <span class="fl">支付方式:</span>
-                                    <div class="fl pay">
-                                        <div class="item active"><a href=""><img src="static/images/zfb.png" alt=""/>支付宝</a></div>
-                                        <div class="item"><a href=""><img src="static/images/wx.png" alt=""/>微信支付</a></div>
-                                        <div class="item"><a href=""><img src="static/images/bank.png" alt=""/>网银支付</a></div>
-                                    </div>
-                                </div>
-                                <div class="choose clearfix">
-                                    <span class="fl best">我的祝福:</span>
-                                    <textarea name="" id="" cols="30" rows="10" class="fl form-control"></textarea>
-                                    <div class="fl agree clearfix">
-                                        <input type="checkbox" class="fl"><span class="fl"><a href="">同意并接受《优软一元捐用户协议》</a></span>
-                                    </div>
-                                </div>
-                                <a href="donationsOver"> <button>确认捐款</button></a>
+                        </div>
+                        <div class="choose clearfix">
+                            <span class="fl">支付方式:</span>
+                            <div class="fl pay">
+                                <div class="item active"><a href=""><img src="static/images/zfb.png" alt=""/>支付宝</a></div>
+                                <div class="item"><a href=""><img src="static/images/wx.png" alt=""/>微信支付</a></div>
+                                <div class="item"><a href=""><img src="static/images/bank.png" alt=""/>网银支付</a></div>
+                            </div>
+                        </div>
+                        <div class="choose clearfix">
+                            <span class="fl best">我的祝福:</span>
+                            <textarea name="" id="" cols="30" rows="10" class="fl form-control"></textarea>
+                            <div class="fl agree clearfix">
+                                <input type="checkbox" class="fl"><span class="fl"><a href="">同意并接受《优软一元捐用户协议》</a></span>
                             </div>
                         </div>
+                        <a href="donationsOver"> <button>确认捐款</button></a>
+                    </div>
+                </div>
+                <div id="hover-background" style="display: none">
+                    <div class="x-floating-wrap"></div>
+                    <div class="x-floating">
+                        <div id="item-content">
+                            <div class="x-close-wrap"><a href="javascript:void(0);">&times;</a></div>
+                            <div class="modal"></div>
+                        </div>
                     </div>
                 </div>
-            </div>
             </#list>
             </#if>
            <#-- 分页按钮-->