From ebf61c187fdd2614cea048c4ad0ed7c6246cb0fb Mon Sep 17 00:00:00 2001 From: kira <164851225@qq.com> Date: Fri, 14 Sep 2018 19:48:46 +0800 Subject: [PATCH 01/26] add rpay --- .../core/impls/ClientManagerImpl.java | 14 +- .../resources/application-rpay.properties | 6 +- src/main/ui/static/images/rpay_horizental.png | Bin 0 -> 8157 bytes .../templates/partner_bankaccounts.html | 1 + .../ui/static/templates/payment/payment.css | 7 + .../static/templates/payment/v1/payment.css | 4 + .../templates/rpay/v1/bill_retail_jsapi.js | 79 +++ .../static/templates/rpay/v1/gateway_jsapi.js | 139 ++++++ .../ui/static/templates/rpay/v1/payment.js | 465 ++++++++++++++++++ .../static/templates/rpay/v1/retail_jsapi.js | 97 ++++ 10 files changed, 804 insertions(+), 8 deletions(-) create mode 100644 src/main/ui/static/images/rpay_horizental.png create mode 100644 src/main/ui/static/templates/rpay/v1/bill_retail_jsapi.js create mode 100644 src/main/ui/static/templates/rpay/v1/gateway_jsapi.js create mode 100644 src/main/ui/static/templates/rpay/v1/payment.js create mode 100644 src/main/ui/static/templates/rpay/v1/retail_jsapi.js diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index a9aa50311..8747d6b01 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -1,15 +1,13 @@ package au.com.royalpay.payment.manage.merchants.core.impls; -import au.com.royalpay.payment.channels.jd.runtime.RpayApi; -import au.com.royalpay.payment.channels.jd.runtime.beans.SubRpayMerchantInfo; +import au.com.royalpay.payment.channels.rpay.runtime.RpayApi; +import au.com.royalpay.payment.channels.rpay.runtime.beans.SubRpayMerchantInfo; import au.com.royalpay.payment.channels.wechat.config.WeChatPayConfig; import au.com.royalpay.payment.channels.wechat.config.WechatPayEnvironment; import au.com.royalpay.payment.channels.wechat.runtime.MpPaymentApi; import au.com.royalpay.payment.channels.wechat.runtime.WxPayClient; import au.com.royalpay.payment.channels.wechat.runtime.beans.SubMerchantInfo; - import au.com.royalpay.payment.core.PaymentChannelApi; -import au.com.royalpay.payment.core.beans.PayChannel; import au.com.royalpay.payment.core.exceptions.EmailException; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.core.utils.OrderExpiryRuleResolver; @@ -158,8 +156,14 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.net.URISyntaxException; import java.net.URL; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashSet; import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.TimeZone; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import java.util.zip.ZipEntry; diff --git a/src/main/resources/application-rpay.properties b/src/main/resources/application-rpay.properties index e39b8bf00..1b361a41f 100644 --- a/src/main/resources/application-rpay.properties +++ b/src/main/resources/application-rpay.properties @@ -1,3 +1,3 @@ -app.privateKey=MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAKikZJwvKZ3dj5QsRy6xN/cPinAZa3leg8X40YzGrMEYWc2nmZY/EczYPq/kUp1uL2uikweDO35fuVpA4rALmJwXhHzsZyhVk4lEjHaqH8rNpVpmrwKP9rMmbFD23Mfvvt+BkKWan2T2dAMbSdjPY0+DTS4sN1ZrqzycRFxKFpohAgMBAAECgYBoO0Mb7WJxehFV6ZANYedPQkG0S2HL4AjeAY2yztDTf/NxUpdw74ZW74i/OgV93C5e/lqVmBzbXNq418XEPUaSohOqbcv+QRlEdlTAtn82aAUp/c9oSogPiHWs2VKiGoutejwVXQ6V9BAGMMegLwVphUu9dgrPC4dnfGO11fvLiQJBANt0VPmdqdG52rNVllKhF5+d+dIamOOQewWZf7HnkW0uYt9kWSbZCYyey4nP7NlONL7NEdUxn9exg/DYzegB99sCQQDEudve+jV2Ay6gbOS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Updw74ZW74i/OgV93C5e/lqVmBzbXNq418XEPUaSohOqbcv+QRlEdlTAtn82aAUp/c9oSogPiHWs2VKiGoutejwVXQ6V9BAGMMegLwVphUu9dgrPC4dnfGO11fvLiQJBANt0VPmdqdG52rNVllKhF5+d+dIamOOQewWZf7HnkW0uYt9kWSbZCYyey4nP7NlONL7NEdUxn9exg/DYzegB99sCQQDEudve+jV2Ay6gbOS+ylHoCxSroF6jlkBQ0q7LIsWAAzIVLOuo5skC+wJmHzKXDoQBLXcFerP/T/iUSzisKqSzAkEAmjRVXY02/gLttWQnm+pMckGMgOFlm0oz18xzmSwR2TlmCnk12AFcH26ZsT3kvRGiKIxqwnb7TZIUF1IQ5b00TwJALD7xKNF1vLkyf3p+aDrw+ROk7oT/RCPDC2qXTbDgYs5VMVYNGsvtYfI6s+VIZ5koL2ueXWkfmsjNy+yvLmnY6QJADV9xlAa1+mWN2TfzAugd3L0fNLqPJPHBKQS5/bBKcoZlwfXwByrcCceKaCntJRZ056eQ7IeqkJfxjkEo/kgaRg== +app.rpay.rpay-public-key=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAw4QOJdajtax5/EQ/Tm65tLnaRB3LXrac3jhdOGp+PsQL1tQyRnvKfWDD5qJ2VZ+rSsLUGg//7ubHtuQHFgH8N9BfSDf9PSZLXsgdA0ikAj6/0P+D7VsSAGsw97plXElh3jx1OvKIW46ZFtPgXuotTx1B+4plafhv5JMHMcVYwOGghaDH9Yoh4vaVU6JNw7IWATaycrmAwEns5VVN6uvz2aTYsH8Rb4j2PA8oKW+7ckcF+sCTNJhFK29iHcvLwzGTXrUTaOfk3ZXNhB9g1ou9aolDszUKvj1R7gSoyoq05w6ICno/d0Fu6Oj0H1N36k7OjUt3wX2lm40yu6ymEV6U0QIDAQAB +app.rpay.app-id=ae8c8000-d774-42ad-8008-810b55c96aa9 \ No newline at end of file diff --git a/src/main/ui/static/images/rpay_horizental.png b/src/main/ui/static/images/rpay_horizental.png new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ao z*W>-D1v*N(!8ryi*LF3|k7+&rzl9%`h2g&?Z_!s|net|YxZFW_cks)do-2iEYbEvc z%B<_1>#2B;R}M=th~~y-otVaS(SS>o!4E^6Re=nYZRr7Z1@ruTTF#5rdrUGD(D%Ssu~2e z5RefK2T)vhEL7gtDm0=*QJD31g;sS<;C}xiYGc*q9gW`+5jd#IwN56{AW#$p;tX%{ znt^$(CS@eaBCRN;cEZs(Dq#tRs{R+<<&FXG0kk%TaU2s20tNwB1Q_S?=!c3@l#%Ru z<0Qh77_j~^2KvWlf6j6g;=PQ}WG6SV27z9V0M2$g1jm+qRll0@sy=P>C?lgNo!P&- z@uy=p_y>UbSl0n)vDFK3XY?M2k=P(mBn0C2EhtHE5xrWIIjFQpGZYD>&SJ`5QA+K2 z>>iMDR5xxMl;fVAlDl6hi_!#xfI%P&0#Y~rM6&G@vLtzo;@5cooQiT8SJq>cIOBN? z*3d1&800lRl%!hSv!~Qg*xTb%H`xpV6@!4YIz((|t*UmVh1Aix6&1=_QBqCce`!Ar zv5i%!4W1$FjR;`JPk*cqc?^ccF8cMu29=r`y`y9G3oSWic`M58WAAGtBottvTDw$3 zXb>n%1h5ff5K+rx=x)^o6!7UN`WFaTXKax#dGJnZi9AFK>J?FrNrAD1Svs{IVvlOtJPOHE9i*K_IdSz~zM`{hA!5%n@wZRrJ@)i`CiPAc>yF;oVDf*|0m?yzMyIAqxkt3wV%_xe=Y z)^a!sgAt_T?IMSm%(I*W<8mbT_UQ6glsgVvK^s}?g1)CwNXaty6P_>-NPu3+{GB$$S`L7+Sl;EmX;{U@T>OjB6zRjMkg z#u?aR`#+7%=50l<)XG_JQtkMS(3t-HOp0-kQS|3!3M>r*Ov>T4I check + \ No newline at end of file diff --git a/src/main/ui/static/templates/payment/payment.css b/src/main/ui/static/templates/payment/payment.css index e32c60cf9..9d13e26d0 100644 --- a/src/main/ui/static/templates/payment/payment.css +++ b/src/main/ui/static/templates/payment/payment.css @@ -433,6 +433,9 @@ input.value:focus { .keyboard-grids .key.paynow.alipay { background: #108ee9; } +.keyboard-grids .key.paynow.rpay { + background: #FF2D55; +} .alipay { color: #108ee9; @@ -442,6 +445,10 @@ input.value:focus { color: #09bb07; } +.rpay { + color: #FF2D55; +} + .keyboard-grids .key.paynow > .label { display: block; position: absolute; diff --git a/src/main/ui/static/templates/payment/v1/payment.css b/src/main/ui/static/templates/payment/v1/payment.css index c61863f70..5c535ec04 100644 --- a/src/main/ui/static/templates/payment/v1/payment.css +++ b/src/main/ui/static/templates/payment/v1/payment.css @@ -366,6 +366,10 @@ input.value:focus { background-color: #108ee9; } +.button_sp_area.alipay .paynow { + background-color: #FF2D55; +} + .button_sp_area .remark-btn { width: 35%; background: #20C1ED diff --git a/src/main/ui/static/templates/rpay/v1/bill_retail_jsapi.js b/src/main/ui/static/templates/rpay/v1/bill_retail_jsapi.js new file mode 100644 index 000000000..7e7290d52 --- /dev/null +++ b/src/main/ui/static/templates/rpay/v1/bill_retail_jsapi.js @@ -0,0 +1,79 @@ +/** + * Created by yixian on 2016-07-15. + */ +$(document).ready(function () { + 'use strict'; + decode(); + function decode() { + var redirect = window.redirect; + while(redirect.indexOf('://')<0){ + redirect = decodeURIComponent(redirect); + if(redirect==window.redirect){ + break; + } + window.redirect = redirect; + } + } + var dataCache = {paying: false}; + $('#key_P').bind('touchstart', startPay); + function startPay() { + $('#wdiv').show(); + if (dataCache.paying) { + return; + } + dataCache.paying = true; + + $.ajax({ + url: '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/'+window.order_id+'/order_params', + method: 'GET', + dataType: 'json', + success: function (pay) { + if (pay.direct_paid) { + location.href = window.redirect; + return; + } + if (window.AlipayJSBridge) { + callPayment(); + } else { + // 如果没有注入则监听注入的事件 + document.addEventListener('AlipayJSBridgeReady', callPayment, false); + } + + function callPayment() { + try { + AlipayJSBridge.call('tradePay', { + tradeNO: pay.trade_no + }, function (res) { + dataCache.paying = false; + if (res.resultCode == '9000') { + AlipayJSBridge.call('startApp', { + appId: '20000056', + param: { + actionType: 'showSuccPage', + payResult: res.result + }, + closeCurrentApp: false + }); + location.href = window.redirect; + } else { + alert(res.memo); + } + $('#wdiv').hide(); + }) + } catch (err) { + alert(err); + $('#wdiv').hide(); + } + } + }, + error: function (jqXhr) { + alert(jqXhr.responseJSON.message); + $('#wdiv').hide(); + dataCache.paying = false; + } + }) + + + } + +}); \ No newline at end of file diff --git a/src/main/ui/static/templates/rpay/v1/gateway_jsapi.js b/src/main/ui/static/templates/rpay/v1/gateway_jsapi.js new file mode 100644 index 000000000..9f876394f --- /dev/null +++ b/src/main/ui/static/templates/rpay/v1/gateway_jsapi.js @@ -0,0 +1,139 @@ +/** + * Created by yixian on 2016-07-15. + */ +$(document).ready(function () { + 'use strict'; + decode(); + + function decode() { + if (window.client_moniker == 'PINE') { + alert('debug:origin redirect:' + window.redirect); + } + var redirect = window.redirect; + while (redirect.indexOf('://') < 0) { + redirect = decodeURIComponent(redirect); + if (redirect == window.redirect) { + break; + } + window.redirect = redirect; + } + + } + + var dataCache = {paying: false}; + $('#key_P').bind('touchstart', startPay); + if (window.tradeNo) { + + if (window.AlipayJSBridge) { + callPayment(window.tradeNo); + } else { + // 如果没有注入则监听注入的事件 + document.addEventListener('AlipayJSBridgeReady', function () { + callPayment(window.tradeNo); + }, false); + } + } + + function startPay() { + $('#wdiv').show(); + if (dataCache.paying) { + return; + } + dataCache.paying = true; + + $.ajax({ + url: './preorder', + method: 'GET', + dataType: 'json', + success: function (pay) { + if (pay.direct_paid) { + location.href = window.redirect + (window.redirect.indexOf('?') < 0 ? '?' : '&') + 'success=true'; + return; + } + if (window.AlipayJSBridge) { + callPayment(pay.trade_no); + } else { + // 如果没有注入则监听注入的事件 + document.addEventListener('AlipayJSBridgeReady', function () { + callPayment(pay.trade_no); + }, false); + } + + }, + error: function (jqXhr) { + alert(jqXhr.responseJSON.message); + $('#wdiv').hide(); + dataCache.paying = false; + } + }) + + + } + + function callPayment(tradeNo) { + try { + if (window.client_moniker == 'PINE') { + alert('debug:trade no=' + tradeNo) + } + AlipayJSBridge.call('tradePay', { + tradeNO: tradeNo + }, function (res) { + dataCache.paying = false; + if (res.resultCode == '9000') { + AlipayJSBridge.call('startApp', { + appId: '20000056', + param: { + actionType: 'showSuccPage', + payResult: res.result + }, + closeCurrentApp: false + }); + startCheckOrder(window.client_moniker, window.merchant_orderid); + } else { + alert(res.memo); + if (window.tradeNo) { + location.href = window.redirect + (window.redirect.indexOf('?') < 0 ? '?' : '&') + 'success=false'; + } + } + $('#wdiv').hide(); + }) + } catch (err) { + alert(err); + $('#wdiv').hide(); + } + } + + function startCheckOrder(clientMoniker, merchantOrderId) { + function checkOrderStd() { + $.ajax({ + url: '/api/v1.0/payment/clients/' + clientMoniker + '/orders/' + merchantOrderId + '/status', + method: 'GET', + dataType: 'json', + success: function (res) { + if (res.paid) { + location.href = window.redirect + (window.redirect.indexOf('?') < 0 ? '?' : '&') + 'success=true'; + } else { + setTimeout(checkOrderStd, 500); + } + } + }) + } + + checkOrderStd(); + } + + function waitForPaymentSuccess(orderId) { + var sock = new SockJS('/register'); + var client = Stomp.over(sock); + client.connect({}, function () { + client.subscribe('/app/payment/orders/' + orderId, function (msg) { + var json = JSON.parse(msg.body); + var concat = '?'; + if (window.redirect.indexOf('?') > 0) { + concat = '&'; + } + location.href = window.redirect + concat + 'time=' + json.time + '&nonce_str=' + json.nonce_str + '&sign=' + json.sign + '&success=true'; + }) + }) + } +}); \ No newline at end of file diff --git a/src/main/ui/static/templates/rpay/v1/payment.js b/src/main/ui/static/templates/rpay/v1/payment.js new file mode 100644 index 000000000..0f34739ab --- /dev/null +++ b/src/main/ui/static/templates/rpay/v1/payment.js @@ -0,0 +1,465 @@ +/** + * Created by yixian on 2017-05-08 + */ +$(function () { + 'use strict'; + // document.querySelector('body').addEventListener('touchmove', function (e) { + // if (!document.querySelector('.coupons').contains(e.target)) { + // e.preventDefault(); + // } + // }) + var dataCache = {price: '0', coupons: [], coupon_groups: {}}; + var exchangeRate = parseFloat(window.exchange_rate); + + // if (window.AlipayJSBridge) { + // AlipayJSBridge.call('hideOptionMenu'); + // } else { + // document.addEventListener('AlipayJSBridgeReady', function () { + // AlipayJSBridge.call('hideOptionMenu'); + // }, false); + // } + dataCache.paying = false; + var ctrl = {}; + + $('.ff.key').bind('touchstart', function () { + if (dataCache.paying) { + return; + } + var char = $(this).attr('data-char'); + appendChar(char); + }); + + $('.coupons .use-check').click(function () { + if ($(this).hasClass('disabled')) { + return; + } + var couponId = $(this).attr('data-coupon-id'); + var couponGroup = $(this).attr('data-coupon-group'); + if (couponGroup) { + var prevCouponId = dataCache.coupon_groups[couponGroup]; + if (prevCouponId) { + var prevIdx = dataCache.coupons.indexOf(prevCouponId); + if (prevIdx >= 0) { + dataCache.coupons.splice(prevIdx, 1); + } + if (prevCouponId != couponId) { + $('.coupons .use-check[data-coupon-id="' + prevCouponId + '"]').removeClass('checked').addClass('unchecked'); + dataCache.coupon_groups[couponGroup] = couponId; + } else { + dataCache.coupon_groups[couponGroup] = null; + } + } else { + dataCache.coupon_groups[couponGroup] = couponId; + } + + } + + if ($(this).is('.checked')) { + $(this).removeClass('checked').addClass('unchecked'); + } else { + $(this).removeClass('unchecked').addClass('checked'); + } + var checked = $(this).is('.checked'); + if (checked) { + dataCache.coupons.push(couponId); + updatePrice(); + } else { + var idx = dataCache.coupons.indexOf(couponId); + dataCache.coupons.splice(idx, 1); + updatePrice(); + } + }); + + $('#key_B').bind('touchstart', function () { + backspace(); + }); + + function updatePoundage(price) { + if (window.extensions.indexOf('customerrate') >= 0 && window.rateValue != null) { + if (window.use_customised_rate) { + var rate = new Decimal(100).plus(window.rateValue).div(100); + var poundageValue = new Decimal(dataCache.price).mul(rate).sub(dataCache.price); + } else { + var rateRemain = new Decimal(100).sub(window.rateValue).div(100); + poundageValue = new Decimal(dataCache.price).div(rateRemain).sub(dataCache.price); + } + dataCache.poundageValue = poundageValue.toFixed(2, Decimal.ROUND_HALF_UP); + return poundageValue.plus(price).toFixed(2, Decimal.ROUND_HALF_UP); + } + return price; + } + + function updatePrice() { + $('#audVal').html(dataCache.price); + var realPrice = dataCache.price; + $('#audValReal').html(realPrice); + var surchargeData = calculateSurcharge(realPrice); + + var price = surchargeData.newPrice || realPrice; + var priceBeforeDiscount = price; + dataCache.discounts = []; + dataCache.tax = surchargeData.tax; + dataCache.surcharge = surchargeData.surcharge; + + $(window.coupons).each(function () { + price = this.handleDiscount(price, dataCache.price, dataCache.discounts, dataCache.coupons); + }); + dataCache.customSurcharge = new Decimal(price).sub(realPrice).toFixed(2,Decimal.ROUND_HALF_UP); + dataCache.finalPrice = new Decimal(price).toFixed(2, Decimal.ROUND_FLOOR); + var rate = 'CNY' == window.currency ? 1 : exchangeRate; + var cnyVal = Decimal.mul(price, rate).toFixed(2, Decimal.ROUND_HALF_UP); + $('#cnyVal').html(cnyVal); + dataCache.currencyPrice = 'CNY' == window.currency ? Decimal.div(priceBeforeDiscount, exchangeRate).toFixed(2, Decimal.ROUND_FLOOR) : priceBeforeDiscount; + } + + function updatePoundageStatus() { + $(window.coupons).each(function () { + var coupon = this; + var couponId = coupon.couponId(); + if (coupon.isEnable(dataCache.currencyPrice || 0)) { + $('.coupons .use-check[data-coupon-id=' + couponId + ']').removeClass('disabled'); + } else { + var dom = $('.coupons .use-check[data-coupon-id=' + couponId + ']').addClass('disabled'); + var couponGroup = dom.attr('data-coupon-group'); + if (couponGroup) { + if (dataCache.coupon_groups[couponGroup] == couponId) { + dataCache.coupon_groups[couponGroup] = null; + } + } + var idx = dataCache.coupons.indexOf(couponId); + if (idx >= 0) { + dataCache.coupons.splice(idx, 1); + } + dom.removeClass('checked').addClass('unchecked'); + } + }) + } + + updatePoundageStatus(); + + function backspace() { + dataCache.price = dataCache.price.substring(0, dataCache.price.length - 1); + if (dataCache.price.length == 0) { + dataCache.price = '0'; + } + updatePrice(); + updatePoundageStatus(); + } + + function appendChar(char) { + var pointLocation = dataCache.price.indexOf('.'); + if (pointLocation >= 0 || char == '.' || dataCache.price.length < 5) { + if (pointLocation >= 0 && char == '.') { + return; + } + if (pointLocation >= 0 && pointLocation <= dataCache.price.length - 3) { + return; + } + if (dataCache.price == '0' && char != '.') { + dataCache.price = ''; + } + dataCache.price += char; + updatePrice(); + updatePoundageStatus(); + } + } + + $('#coupon-box-toggle').click(function () { + $('.coupons-container').addClass('show'); + }); + $('.coupons-container>.coupons-mask,.coupons-container #close-coupon-box').click(function () { + $(this).parents('.coupons-container').removeClass('show'); + }); + + + $('.remark-btn').click(function () { + var cfg = { + title: '备注 Remark', + template: '', + initialize: function (dialog) { + $('').addClass('remark-input').attr('name', 'remark').val(dataCache.remark || '').appendTo($('.weui_dialog_bd', dialog)); + }, + confirm: function (dialog, chosen) { + if (chosen) { + var remark = $('textarea[name="remark"]', dialog).val(); + if (remark) { + $('#remark-box').text('备注:' + remark).show() + } else { + $('#remark-box').text('').hide(); + } + dataCache.remark = remark; + } + + } + }; + showWeuiDialog(cfg); + }); + + $('.paydetail').click(function () { + var config = { + title: 'Payment Detail', + template: '', + initialize: function (dialog) { + var bd = $('.weui_dialog_bd', dialog); + var currencySymbol = window.currency == 'AUD' ? '$' : '¥'; + $('

').html('Input Price 输入金额:' + currencySymbol + dataCache.price).appendTo(bd); + if (parseFloat(dataCache.customSurcharge) > 0) { + $('

').html('Surcharge 手续费(' + window.rateValue + '%):+' + currencySymbol + dataCache.customSurcharge).appendTo(bd); + } + $(dataCache.discounts).each(function () { + $('

').html(this.title + ':-' + currencySymbol + this.amount).appendTo(bd); + }); + $('

').addClass('final').html('Final 支付金额:' + currencySymbol + (dataCache.finalPrice || 0)).appendTo(bd); + } + }; + showWeuiDialog(config); + }); + + $('#key_P').click(function () { + if (window.requireRemark) { + if (!dataCache.remark) { + var config = { + title: '请先输入备注', + template: '' + }; + showWeuiDialog(config); + } + + } + }); + + $('#key_P').bind('touchstart', function () { + if (window.requireRemark) { + if (!dataCache.remark) { + return; + } + } + $('#key_P').addClass('hidden'); + $('#key_Loading').removeClass('hidden'); + if (dataCache.paying) { + return; + } + dataCache.paying = true; + var data = {price: dataCache.price + '', original_number: true, currency: window.currency}; + if (dataCache.remark) { + data.description = dataCache.remark; + } + if (window.extensions.indexOf('preauthorize') >= 0) { + data.preauthorize = true; + } + if (window.extensions.indexOf('qrcodemode') >= 0) { + data.qrmode = true; + } + if (window.extensions.indexOf('customerrate') >= 0) { + data.customerrate = true; + } + data.coupons = dataCache.coupons; + data.qrcodeVersion = window.qrcodeVersion; + + dataCache.remark = ''; + $.ajax({ + url: '/api/v1.0/rpay/partners/' + window.client_moniker + '/orders', + method: 'POST', + data: JSON.stringify(data), + contentType: 'application/json', + dataType: 'json', + success: function (resp) { + pay(resp); + if (resp.direct_paid) { + location.href = '/api/v1.0/rpay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'; + return; + } + // if (window.AlipayJSBridge) { + // callPayment(); + // } else { + // // 如果没有注入则监听注入的事件 + // document.addEventListener('AlipayJSBridgeReady', callPayment, false); + // } + // + // function callPayment() { + // try { + // AlipayJSBridge.call('tradePay', { + // tradeNO: pay.trade_no + // }, function (res) { + // dataCache.paying = false; + // if (res.resultCode == '9000') { + // AlipayJSBridge.call('startApp', { + // appId: '20000056', + // param: { + // actionType: 'showSuccPage', + // payResult: res.result + // }, + // closeCurrentApp: false + // }); + // startCheckOrder(pay.order_id, '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'); + // } else if (res.resultCode == '6001') { + // //do nothing + // } else { + // if (res.memo) { + // weuiAlert(res.memo); + // } + // } + // $('#key_P').removeClass('hidden'); + // $('#key_Loading').addClass('hidden'); + // }) + // } catch (err) { + // weuiAlert(err) + // } + // } + }, + error: function (jqXhr) { + weuiAlert(jqXhr.responseJSON.message); + $('#key_P').removeClass('hidden'); + $('#key_Loading').addClass('hidden'); + dataCache.paying = false; + } + }) + }); + + function startCheckOrder(orderId, url) { + function checkOrderStd() { + $.ajax({ + url: '/api/v1.0/payment/orders/' + orderId + '/status', + method: 'GET', + dataType: 'json', + success: function (res) { + if (res.paid) { + location.href = url; + } else { + setTimeout(checkOrderStd, 500); + } + } + }) + } + + checkOrderStd(); + } + + function weuiAlert(msg) { + var config = { + template: msg + }; + showWeuiDialog(config); + } + + function showWeuiDialog(config) { + if (config.templateUrl) { + $.ajax({ + url: config.templateUrl, + dataType: 'html', + success: function (template) { + buildDialog(template); + } + }); + } else { + buildDialog(config.template); + } + + + function buildDialog(template) { + var defaultConfig = {backdrop: true}; + config = $.extend({}, defaultConfig, config); + var dialog = $("
", {class: 'weui_dialog_confirm'}); + var mask = $('
', {class: 'weui_mask'}).appendTo(dialog); + if (config.backdrop) { + mask.click(function () { + dialog.remove(); + if ($.isFunction(config.dismiss)) { + config.dismiss(); + } + }) + } + var dialogBox = $("
", {class: 'weui_dialog'}).appendTo(dialog); + if (config.title) { + $('
', {class: 'weui_dialog_hd'}).append($('', {class: 'weui_dialog_title'}).html(config.title)).appendTo(dialogBox); + } + var dialogBody = $("
", {class: 'weui_dialog_bd'}).appendTo(dialogBox); + if (template) { + dialogBody.append(template); + } + if ($.isFunction(config.initialize)) { + config.initialize(dialog); + } + var ft = $('
').appendTo(dialogBox); + if ($.isFunction(config.confirm)) { + var yes = $('', { + class: 'weui_btn_dialog primary', + text: 'OK', + style: 'background: #108ee9;color: #fff;' + }).appendTo(ft); + yes.click(function () { + config.confirm(dialog, true); + dialog.remove(); + }); + var no = $('', {class: 'weui_btn_dialog default', text: 'Cancel'}).appendTo(ft); + no.click(function () { + config.confirm(dialog, false); + dialog.remove(); + }) + } else { + var ok = $('', { + class: 'weui_btn_dialog primary', + text: 'OK', + style: 'background: #108ee9;color: #fff;' + }).appendTo(ft); + ok.click(function () { + dialog.remove(); + }) + } + dialog.appendTo($('body')); + } + + } + + + function getUserId(){ + window.RPayPlus.send("getUserId", null, function(data){ + alert(data); + }); + } + + function pay(param){ + var order={ + nonce_str:param.nonce_str, + rpay_order_id:param.rpay_order_id, + mch_order_id:param.mch_order_id + }; + alert("rpay_order_info: nonce_str:"+param.nonce_str+"rpay_order_id:"+param.rpay_order_id+"mch_order_id:"+param.mch_order_id); + window.RPayPlus.send('pay', order, function(data){ + alert('this is callback from native and data='+JSON.stringify(data)); + }); + } + + function back(){ + window.RPayPlus.send("back", null, null); + } + + function jsInvoke(){ + window.RPayPlus.send("jsInvoke", 'Native Test', null); + } + + function createOrder(msg){ + alert('create order information='+JSON.stringify(msg)); + } + + function queryOrder(msg){ + alert('query order information='+JSON.stringify(msg)); + + var order={ + orderId:'00001', + amount:'$10.98', + title:'Balance Top-UP' + }; + setTimeout("window.RPayPlus.onResult("+JSON.stringify(order)+");", 1500); + } + + function registerJs(){ + window.RPayPlus.register('createOrder', function(data){ + createOrder(data); + }); + window.RPayPlus.register('queryOrder', function(data){ + queryOrder(data); + }); + } + getUserId(); +}); \ No newline at end of file diff --git a/src/main/ui/static/templates/rpay/v1/retail_jsapi.js b/src/main/ui/static/templates/rpay/v1/retail_jsapi.js new file mode 100644 index 000000000..6b74c75cf --- /dev/null +++ b/src/main/ui/static/templates/rpay/v1/retail_jsapi.js @@ -0,0 +1,97 @@ +/** + * Created by yixian on 2016-07-15. + */ +$(document).ready(function () { + 'use strict'; + decode(); + function decode() { + var redirect = window.redirect; + while(redirect.indexOf('://')<0){ + redirect = decodeURIComponent(redirect); + if(redirect==window.redirect){ + break; + } + window.redirect = redirect; + } + } + var dataCache = {paying: false}; + $('#key_P').bind('touchstart', startPay); + function startPay() { + $('#wdiv').show(); + if (dataCache.paying) { + return; + } + dataCache.paying = true; + + $.ajax({ + url: '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/'+window.order_id+'/order_params', + method: 'GET', + dataType: 'json', + success: function (pay) { + if (pay.direct_paid) { + location.href = window.redirect; + return; + } + if (window.AlipayJSBridge) { + callPayment(); + } else { + // 如果没有注入则监听注入的事件 + document.addEventListener('AlipayJSBridgeReady', callPayment, false); + } + + function callPayment() { + try { + AlipayJSBridge.call('tradePay', { + tradeNO: pay.trade_no + }, function (res) { + dataCache.paying = false; + if (res.resultCode == '9000') { + AlipayJSBridge.call('startApp', { + appId: '20000056', + param: { + actionType: 'showSuccPage', + payResult: res.result + }, + closeCurrentApp: false + }); + startCheckOrder(window.order_id, window.redirect); + } else { + alert(res.memo); + } + $('#wdiv').hide(); + }) + } catch (err) { + alert(err); + $('#wdiv').hide(); + } + } + }, + error: function (jqXhr) { + alert(jqXhr.responseJSON.message); + $('#wdiv').hide(); + dataCache.paying = false; + } + }) + + + } + + function startCheckOrder(orderId, url) { + function checkOrderStd() { + $.ajax({ + url: '/api/v1.0/payment/orders/' + orderId + '/status', + method: 'GET', + dataType: 'json', + success: function (res) { + if (res.paid) { + location.href = url; + } else { + setTimeout(checkOrderStd, 500); + } + } + }) + } + + checkOrderStd(); + } +}); \ No newline at end of file From 7ec5f960872b29fee262698f86d3e46ca8ea2d05 Mon Sep 17 00:00:00 2001 From: luoyang Date: Fri, 14 Sep 2018 19:49:17 +0800 Subject: [PATCH 02/26] rollback --- .../manage/merchants/core/impls/ClientManagerImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index a9aa50311..7b5c0631a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -1,7 +1,7 @@ package au.com.royalpay.payment.manage.merchants.core.impls; -import au.com.royalpay.payment.channels.jd.runtime.RpayApi; -import au.com.royalpay.payment.channels.jd.runtime.beans.SubRpayMerchantInfo; +import au.com.royalpay.payment.channels.rpay.runtime.RpayApi; +import au.com.royalpay.payment.channels.rpay.runtime.beans.SubRpayMerchantInfo; import au.com.royalpay.payment.channels.wechat.config.WeChatPayConfig; import au.com.royalpay.payment.channels.wechat.config.WechatPayEnvironment; import au.com.royalpay.payment.channels.wechat.runtime.MpPaymentApi; @@ -170,6 +170,7 @@ import javax.annotation.Resource; import javax.imageio.ImageIO; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; import cn.yixblog.platform.http.HttpRequestGenerator; import cn.yixblog.platform.http.HttpRequestResult; @@ -3544,6 +3545,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid checkOrgPermission(manager, client); SubRpayMerchantInfo subRpayMerchantInfo = JSONObject.toJavaObject(client, SubRpayMerchantInfo.class); + subRpayMerchantInfo.CheckEmpty(); rpayApi.registerMerchant(client.getIntValue("client_id"), subRpayMerchantInfo); logger.debug("访问成功,返回的信息是: " ); From dd6392c625e09203dff5fc61ed4676ce7e5679d5 Mon Sep 17 00:00:00 2001 From: kira <164851225@qq.com> Date: Fri, 14 Sep 2018 20:19:38 +0800 Subject: [PATCH 03/26] update --- src/main/resources/application-rpay.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/application-rpay.properties b/src/main/resources/application-rpay.properties index 1b361a41f..603d8f0e1 100644 --- a/src/main/resources/application-rpay.properties +++ b/src/main/resources/application-rpay.properties @@ -1,3 +1,3 @@ -app.rpay.private-key=MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAKikZJwvKZ3dj5QsRy6xN/cPinAZa3leg8X40YzGrMEYWc2nmZY/EczYPq/kUp1uL2uikweDO35fuVpA4rALmJwXhHzsZyhVk4lEjHaqH8rNpVpmrwKP9rMmbFD23Mfvvt+BkKWan2T2dAMbSdjPY0+DTS4sN1ZrqzycRFxKFpohAgMBAAECgYBoO0Mb7WJxehFV6ZANYedPQkG0S2HL4AjeAY2yztDTf/NxUpdw74ZW74i/OgV93C5e/lqVmBzbXNq418XEPUaSohOqbcv+QRlEdlTAtn82aAUp/c9oSogPiHWs2VKiGoutejwVXQ6V9BAGMMegLwVphUu9dgrPC4dnfGO11fvLiQJBANt0VPmdqdG52rNVllKhF5+d+dIamOOQewWZf7HnkW0uYt9kWSbZCYyey4nP7NlONL7NEdUxn9exg/DYzegB99sCQQDEudve+jV2Ay6gbOS+ylHoCxSroF6jlkBQ0q7LIsWAAzIVLOuo5skC+wJmHzKXDoQBLXcFerP/T/iUSzisKqSzAkEAmjRVXY02/gLttWQnm+pMckGMgOFlm0oz18xzmSwR2TlmCnk12AFcH26ZsT3kvRGiKIxqwnb7TZIUF1IQ5b00TwJALD7xKNF1vLkyf3p+aDrw+ROk7oT/RCPDC2qXTbDgYs5VMVYNGsvtYfI6s+VIZ5koL2ueXWkfmsjNy+yvLmnY6QJADV9xlAa1+mWN2TfzAugd3L0fNLqPJPHBKQS5/bBKcoZlwfXwByrcCceKaCntJRZ056eQ7IeqkJfxjkEo/kgaRg== -app.rpay.rpay-public-key=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAw4QOJdajtax5/EQ/Tm65tLnaRB3LXrac3jhdOGp+PsQL1tQyRnvKfWDD5qJ2VZ+rSsLUGg//7ubHtuQHFgH8N9BfSDf9PSZLXsgdA0ikAj6/0P+D7VsSAGsw97plXElh3jx1OvKIW46ZFtPgXuotTx1B+4plafhv5JMHMcVYwOGghaDH9Yoh4vaVU6JNw7IWATaycrmAwEns5VVN6uvz2aTYsH8Rb4j2PA8oKW+7ckcF+sCTNJhFK29iHcvLwzGTXrUTaOfk3ZXNhB9g1ou9aolDszUKvj1R7gSoyoq05w6ICno/d0Fu6Oj0H1N36k7OjUt3wX2lm40yu6ymEV6U0QIDAQAB -app.rpay.app-id=ae8c8000-d774-42ad-8008-810b55c96aa9 \ No newline at end of file +app.rpay.privateKey=MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAKikZJwvKZ3dj5QsRy6xN/cPinAZa3leg8X40YzGrMEYWc2nmZY/EczYPq/kUp1uL2uikweDO35fuVpA4rALmJwXhHzsZyhVk4lEjHaqH8rNpVpmrwKP9rMmbFD23Mfvvt+B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rpay.appId=ae8c8000-d774-42ad-8008-810b55c96aa9 \ No newline at end of file From 8eb861edf39c5104a242322e0ebe2dc3d8413a45 Mon Sep 17 00:00:00 2001 From: luoyang Date: Mon, 17 Sep 2018 11:57:54 +0800 Subject: [PATCH 04/26] update rpay html --- src/main/ui/static/lib/rpay/rpay_jssdk.js | 2 +- src/main/ui/static/templates/payment/v2/payment.css | 3 +++ src/main/ui/static/templates/rpay/v1/payment.js | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/ui/static/lib/rpay/rpay_jssdk.js b/src/main/ui/static/lib/rpay/rpay_jssdk.js index e3f48ea99..4bc92ae54 100644 --- a/src/main/ui/static/lib/rpay/rpay_jssdk.js +++ b/src/main/ui/static/lib/rpay/rpay_jssdk.js @@ -21,7 +21,7 @@ $(function (){ if(isiOS){ window.webkit.messageHandlers.rpayplus.postMessage(msg); } else{ - rpayplus.send(msg); + //rpayplus.send(msg); } }, diff --git a/src/main/ui/static/templates/payment/v2/payment.css b/src/main/ui/static/templates/payment/v2/payment.css index e2b39f2b5..9564c3027 100644 --- a/src/main/ui/static/templates/payment/v2/payment.css +++ b/src/main/ui/static/templates/payment/v2/payment.css @@ -431,6 +431,9 @@ input.value:focus { .keyboard-grids .key.paynow.alipay { background: #108ee9; } +.keyboard-grids .key.paynow.rpay { + background: #FF2D55; +} .alipay { color: #108ee9; diff --git a/src/main/ui/static/templates/rpay/v1/payment.js b/src/main/ui/static/templates/rpay/v1/payment.js index 0f34739ab..316fc80c3 100644 --- a/src/main/ui/static/templates/rpay/v1/payment.js +++ b/src/main/ui/static/templates/rpay/v1/payment.js @@ -385,7 +385,7 @@ $(function () { var yes = $('', { class: 'weui_btn_dialog primary', text: 'OK', - style: 'background: #108ee9;color: #fff;' + style: 'background: #FF2D55;color: #fff;' }).appendTo(ft); yes.click(function () { config.confirm(dialog, true); @@ -400,7 +400,7 @@ $(function () { var ok = $('', { class: 'weui_btn_dialog primary', text: 'OK', - style: 'background: #108ee9;color: #fff;' + style: 'background: #FF2D55;color: #fff;' }).appendTo(ft); ok.click(function () { dialog.remove(); From d416b2265f0239a260035ea903d6bc6c009feba3 Mon Sep 17 00:00:00 2001 From: kira <164851225@qq.com> Date: Mon, 17 Sep 2018 13:59:39 +0800 Subject: [PATCH 05/26] tmp --- .../ui/static/templates/rpay/v1/payment.js | 43 ++++--------------- 1 file changed, 9 insertions(+), 34 deletions(-) diff --git a/src/main/ui/static/templates/rpay/v1/payment.js b/src/main/ui/static/templates/rpay/v1/payment.js index 316fc80c3..c42004284 100644 --- a/src/main/ui/static/templates/rpay/v1/payment.js +++ b/src/main/ui/static/templates/rpay/v1/payment.js @@ -62,11 +62,9 @@ $(function () { var checked = $(this).is('.checked'); if (checked) { dataCache.coupons.push(couponId); - updatePrice(); } else { var idx = dataCache.coupons.indexOf(couponId); dataCache.coupons.splice(idx, 1); - updatePrice(); } }); @@ -89,29 +87,6 @@ $(function () { return price; } - function updatePrice() { - $('#audVal').html(dataCache.price); - var realPrice = dataCache.price; - $('#audValReal').html(realPrice); - var surchargeData = calculateSurcharge(realPrice); - - var price = surchargeData.newPrice || realPrice; - var priceBeforeDiscount = price; - dataCache.discounts = []; - dataCache.tax = surchargeData.tax; - dataCache.surcharge = surchargeData.surcharge; - - $(window.coupons).each(function () { - price = this.handleDiscount(price, dataCache.price, dataCache.discounts, dataCache.coupons); - }); - dataCache.customSurcharge = new Decimal(price).sub(realPrice).toFixed(2,Decimal.ROUND_HALF_UP); - dataCache.finalPrice = new Decimal(price).toFixed(2, Decimal.ROUND_FLOOR); - var rate = 'CNY' == window.currency ? 1 : exchangeRate; - var cnyVal = Decimal.mul(price, rate).toFixed(2, Decimal.ROUND_HALF_UP); - $('#cnyVal').html(cnyVal); - dataCache.currencyPrice = 'CNY' == window.currency ? Decimal.div(priceBeforeDiscount, exchangeRate).toFixed(2, Decimal.ROUND_FLOOR) : priceBeforeDiscount; - } - function updatePoundageStatus() { $(window.coupons).each(function () { var coupon = this; @@ -142,7 +117,6 @@ $(function () { if (dataCache.price.length == 0) { dataCache.price = '0'; } - updatePrice(); updatePoundageStatus(); } @@ -159,7 +133,6 @@ $(function () { dataCache.price = ''; } dataCache.price += char; - updatePrice(); updatePoundageStatus(); } } @@ -257,6 +230,9 @@ $(function () { data.qrcodeVersion = window.qrcodeVersion; dataCache.remark = ''; + + window.RPayPlus.send("showLoading", null, null); + $.ajax({ url: '/api/v1.0/rpay/partners/' + window.client_moniker + '/orders', method: 'POST', @@ -264,7 +240,8 @@ $(function () { contentType: 'application/json', dataType: 'json', success: function (resp) { - pay(resp); + window.RPayPlus.send("closeLoading", null, null); + // pay(resp); if (resp.direct_paid) { location.href = '/api/v1.0/rpay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'; return; @@ -308,6 +285,7 @@ $(function () { // } }, error: function (jqXhr) { + window.RPayPlus.send("closeLoading", null, null); weuiAlert(jqXhr.responseJSON.message); $('#key_P').removeClass('hidden'); $('#key_Loading').addClass('hidden'); @@ -412,9 +390,8 @@ $(function () { } - function getUserId(){ + /* function getUserId(){ window.RPayPlus.send("getUserId", null, function(data){ - alert(data); }); } @@ -425,9 +402,7 @@ $(function () { mch_order_id:param.mch_order_id }; alert("rpay_order_info: nonce_str:"+param.nonce_str+"rpay_order_id:"+param.rpay_order_id+"mch_order_id:"+param.mch_order_id); - window.RPayPlus.send('pay', order, function(data){ - alert('this is callback from native and data='+JSON.stringify(data)); - }); + window.RPayPlus.send('pay', order, null); } function back(){ @@ -461,5 +436,5 @@ $(function () { queryOrder(data); }); } - getUserId(); + getUserId();*/ }); \ No newline at end of file From 1987cc09f80c130cbeaf8233876fa1b1487a3f92 Mon Sep 17 00:00:00 2001 From: luoyang Date: Mon, 17 Sep 2018 16:13:21 +0800 Subject: [PATCH 06/26] update merchant --- .../system/SysRpayMerchantApplyMapper.java | 26 +++++ .../manage/merchants/core/ClientManager.java | 5 + .../core/impls/ClientManagerImpl.java | 104 ++++++++++++------ .../web/PartnerManageController.java | 10 ++ .../static/payment/partner/partner-manage.js | 17 ++- .../templates/partner_payment_info.html | 8 ++ .../templates/sub_merchant_id_apply.html | 74 ++++++++++--- 7 files changed, 199 insertions(+), 45 deletions(-) create mode 100644 src/main/java/au/com/royalpay/payment/manage/mappers/system/SysRpayMerchantApplyMapper.java diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysRpayMerchantApplyMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysRpayMerchantApplyMapper.java new file mode 100644 index 000000000..9aa1cdbff --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysRpayMerchantApplyMapper.java @@ -0,0 +1,26 @@ +package au.com.royalpay.payment.manage.mappers.system; + +import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; +import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; +import cn.yixblog.support.mybatis.autosql.annotations.SqlType; +import com.alibaba.fastjson.JSONObject; +import com.github.miemiedev.mybatis.paginator.domain.PageBounds; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * Created by yangluo on 2017-03-14. + */ +@AutoMapper(tablename = "sys_rpay_merchant_apply",pkName = "merchant_app_id") +public interface SysRpayMerchantApplyMapper { + @AutoSql(type = SqlType.SELECT) + List listRpayMerchantApplices(@Param("client_id") int client_id, PageBounds pageBounds); + + @AutoSql(type = SqlType.INSERT) + void insertRpayMerchantApply(JSONObject params); + + @AutoSql(type = SqlType.SELECT) + List selectByShortName(@Param("client_id") int client_id,@Param("merchant_shortname") String shortName); + +} diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java index 7c0e982ea..0604c11e3 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java @@ -60,6 +60,9 @@ public interface ClientManager { @Transactional void updateClientPaymentConfig(JSONObject manager, String clientMoniker, JSONObject subMerchantInfo); + @Transactional + void updateClientRpayPaymentConfig(JSONObject manager, String clientMoniker, JSONObject rpaySubMerchantInfo); + @Transactional void updateAliSubMerchantId(JSONObject manager, String clientMoniker, JSONObject aliSubMerchantInfo); @@ -296,6 +299,8 @@ public interface ClientManager { List listSubMerchantIdApplys(JSONObject manager, String clientMoniker); + List listRpaySubMerchantIdApplys(JSONObject manager, String clientMoniker); + String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply,JSONObject manager); List listMerchantIds(String clientMoniker,JSONObject manager); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index 7a853e253..4defc9826 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -25,24 +25,7 @@ import au.com.royalpay.payment.manage.mappers.log.LogSettleMailMapper; import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; import au.com.royalpay.payment.manage.mappers.redpack.ActClientInvitationCodeMapper; import au.com.royalpay.payment.manage.mappers.risk.RiskAttentionMerchantsMapper; -import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper; -import au.com.royalpay.payment.manage.mappers.system.ClientApplyMapper; -import au.com.royalpay.payment.manage.mappers.system.ClientAuditProcessMapper; -import au.com.royalpay.payment.manage.mappers.system.ClientBDMapper; -import au.com.royalpay.payment.manage.mappers.system.ClientBankAccountMapper; -import au.com.royalpay.payment.manage.mappers.system.ClientConfigMapper; -import au.com.royalpay.payment.manage.mappers.system.ClientDeviceMapper; -import au.com.royalpay.payment.manage.mappers.system.ClientFilesMapper; -import au.com.royalpay.payment.manage.mappers.system.ClientMapper; -import au.com.royalpay.payment.manage.mappers.system.ClientRateMapper; -import au.com.royalpay.payment.manage.mappers.system.ClientsContractMapper; -import au.com.royalpay.payment.manage.mappers.system.CommoditiesMapper; -import au.com.royalpay.payment.manage.mappers.system.MailSendMapper; -import au.com.royalpay.payment.manage.mappers.system.MailUnsubMapper; -import au.com.royalpay.payment.manage.mappers.system.ManagerMapper; -import au.com.royalpay.payment.manage.mappers.system.OrgMapper; -import au.com.royalpay.payment.manage.mappers.system.PermissionPartnerModuleMapper; -import au.com.royalpay.payment.manage.mappers.system.SysWxMerchantApplyMapper; +import au.com.royalpay.payment.manage.mappers.system.*; import au.com.royalpay.payment.manage.merchants.beans.ActivityPosterBuilder; import au.com.royalpay.payment.manage.merchants.beans.BankAccountInfo; import au.com.royalpay.payment.manage.merchants.beans.ClientAuthFilesInfo; @@ -262,6 +245,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Resource private SysWxMerchantApplyMapper sysWxMerchantApplyMapper; @Resource + private SysRpayMerchantApplyMapper sysRpayMerchantApplyMapper; + @Resource private SpringTemplateEngine thymeleaf; @Resource private DeviceManager deviceManager; @@ -770,6 +755,40 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clientInfoCacheSupport.clearClientCache(clientId); } + @Override + public void updateClientRpayPaymentConfig(JSONObject manager, String clientMoniker, JSONObject rpaySubMerchantInfo) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + checkOrgPermission(manager, client); + JSONObject update = new JSONObject(); + int clientId = client.getIntValue("client_id"); + String originSubMerchantId = client.getString("rpay_enterprise_id"); + update.put("client_id", clientId); + String subMerchantId = rpaySubMerchantInfo.getString("rpay_enterprise_id"); + update.put("rpay_enterprise_id", subMerchantId); + try { + recordSubMerchantLog(client, rpaySubMerchantInfo, manager); + } catch (Exception e) { + logger.error("记录log_client_sub_merchant_id失败", e); + } + clientMapper.update(update); + List children = clientMapper.listChildClients(clientId); + for (JSONObject child : children) { + if (Objects.equals(child.getString("rpay_enterprise_id"), originSubMerchantId)) { + update.put("client_id", child.getIntValue("client_id")); + try { + recordSubMerchantLog(child, rpaySubMerchantInfo, manager); + } catch (Exception e) { + logger.error("记录log_client_sub_merchant_id失败", e); + } + clientMapper.update(update); + } + } + clientInfoCacheSupport.clearClientCache(clientId); + } + @Override public void updateAliSubMerchantId(JSONObject manager, String clientMoniker, JSONObject aliSubMerchantInfo) { JSONObject client = getClientInfoByMoniker(clientMoniker); @@ -3513,6 +3532,21 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid return null; } + @Override + public List listRpaySubMerchantIdApplys(JSONObject manager, String clientMoniker) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + checkOrgPermission(manager, client); + List applices = sysRpayMerchantApplyMapper.listRpayMerchantApplices(client.getInteger("client_id"), + new PageBounds(Order.formString("create_time.desc"))); + if (!applices.isEmpty()) { + return applices; + } + return null; + } + @Override @CacheEvict(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker") public String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply, JSONObject manager) { @@ -3548,22 +3582,30 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } checkOrgPermission(manager, client); - SubRpayMerchantInfo subRpayMerchantInfo = JSONObject.toJavaObject(client, SubRpayMerchantInfo.class); - subRpayMerchantInfo.CheckEmpty(); - rpayApi.registerMerchant(client.getIntValue("client_id"), subRpayMerchantInfo); - - logger.debug("访问成功,返回的信息是: " ); - - - - // String sub_merchant_id = elem.elementText("sub_mch_id"); -/* if (StringUtils.isNotEmpty(sub_merchant_id)) { - + List selectByshortName = sysRpayMerchantApplyMapper.selectByShortName(client.getIntValue("client_id"),client.getString("short_name")); + if (selectByshortName.size()>0) { + throw new BadRequestException("请修改【" + clientMoniker + "】的Company shortName信息(请避免和Rpay+商务号列表内的Company Short Name重复)"); + } - } else { + SubRpayMerchantInfo subRpayMerchantInfo = JSONObject.toJavaObject(client, SubRpayMerchantInfo.class); + subRpayMerchantInfo.CheckEmpty(); + JSONObject rpayMerchantInfo = rpayApi.registerMerchant(client.getIntValue("client_id"), subRpayMerchantInfo); + + if (rpayMerchantInfo != null) { + JSONObject merchantApply = new JSONObject(); + merchantApply.put("merchant_id", rpayMerchantInfo.getString("rpay_order_id")); + merchantApply.put("client_id", client.getString("client_id")); + merchantApply.put("create_time", new Date()); + merchantApply.put("operator", manager.getString("display_name")); + merchantApply.put("sub_merchant_id", rpayMerchantInfo.getString("merchantId")); + merchantApply.put("business_category", client.getString("royalpayindustry")); + merchantApply.put("merchant_shortname", client.getString("short_name")); + sysRpayMerchantApplyMapper.insertRpayMerchantApply(merchantApply); + }else { throw new BadRequestException("请求失败"); - }*/ + } + return null; } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java index aa40c3310..c228f5995 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java @@ -155,6 +155,11 @@ public class PartnerManageController { clientManager.updateClientPaymentConfig(manager, clientMoniker, subMerchantInfo); } + @ManagerMapping(value = "/{clientMoniker}/rpay_payment_config", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.BD_USER}) + public void updatePartnerRpayPaymentConfig(@PathVariable String clientMoniker, @RequestBody JSONObject rpaySubMerchantInfo, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + clientManager.updateClientRpayPaymentConfig(manager, clientMoniker, rpaySubMerchantInfo); + } + @ManagerMapping(value = "/{clientMoniker}/ali_sub_merchant_id", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR}) public void updateAliSubMerchantId(@PathVariable String clientMoniker, @RequestBody JSONObject aliSubMerchantInfo, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { clientManager.updateAliSubMerchantId(manager, clientMoniker, aliSubMerchantInfo); @@ -518,6 +523,11 @@ public class PartnerManageController { return clientManager.listSubMerchantIdApplys(manager, clientMoniker); } + @ManagerMapping(value = "/{clientMoniker}/list_rpay_sub_applices", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) + public List listRpaySubMerchantIdApplys(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + return clientManager.listRpaySubMerchantIdApplys(manager, clientMoniker); + } + @ManagerMapping(value = "/{clientMoniker}/sub_apply", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) public String subMerchantApplication(@PathVariable String clientMoniker, @RequestBody SubMerchantIdApply subMerchantIdApply, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { return clientManager.subMerchantApplication(clientMoniker, subMerchantIdApply, manager); diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index 63c39ada0..b855dae98 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -3084,6 +3084,9 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $http.get('/sys/partners/' + $scope.partner.client_moniker + '/list_sub_applices', {params: {}}).then(function (resp) { $scope.subMerchantInfos = resp.data; }); + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/list_rpay_sub_applices', {params: {}}).then(function (resp) { + $scope.subRpayMerchantInfos = resp.data; + }); }; $scope.useSubMerchantId = function (sub_merchant_id) { $http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_config', {sub_merchant_id: sub_merchant_id}).then(function (resp) { @@ -3097,6 +3100,18 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) }); } + $scope.useRpaySubMerchantId = function (sub_merchant_id) { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/rpay_payment_config', {rpay_enterprise_id: sub_merchant_id}).then(function (resp) { + commonDialog.alert({ + title: 'Success', + content: 'Modify Rpay+ Sub Merchant ID successfully', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + }); + } $scope.applyWxSubMerchantId = function () { $uibModal.open({ templateUrl: '/static/payment/partner/templates/apply_wx_sub_merchant_id.html', @@ -3117,7 +3132,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $http.post('/sys/partners/' + $scope.partner.client_moniker + '/registRpaySubMerchantId').then(function (resp) { commonDialog.alert({ title: 'Success', - content: 'Modify Wechat Sub Merchant ID successfully', + content: 'Modify Rpay+ Sub Merchant ID successfully', type: 'success' }); $state.reload(); diff --git a/src/main/ui/static/payment/partner/templates/partner_payment_info.html b/src/main/ui/static/payment/partner/templates/partner_payment_info.html index 6e6499a34..804ab968b 100644 --- a/src/main/ui/static/payment/partner/templates/partner_payment_info.html +++ b/src/main/ui/static/payment/partner/templates/partner_payment_info.html @@ -48,6 +48,14 @@

+
+ +
+

+ {{paymentInfo.rpay_enterprise_id||'初始化'}} +

+
+
diff --git a/src/main/ui/static/payment/partner/templates/sub_merchant_id_apply.html b/src/main/ui/static/payment/partner/templates/sub_merchant_id_apply.html index 03309be2c..40fc8c119 100644 --- a/src/main/ui/static/payment/partner/templates/sub_merchant_id_apply.html +++ b/src/main/ui/static/payment/partner/templates/sub_merchant_id_apply.html @@ -41,19 +41,6 @@
-
-
-

- Rpay+ Sub Merchant Id : {{partner.sub_merchant_id}} - -

- -
-

List of Sub Merchant Id

@@ -101,4 +88,65 @@
+ +
+
+
+
+
+
+

+ Rpay+ Sub Merchant Id : {{partner.rpay_enterprise_id}} + +

+ +
+
+
+
+

List of Sub Merchant Id

+
+
+
    +
  • + Sub Merchant Id + (当前使用){{id_apply.sub_merchant_id}} +
  • +
  • + Apply Time + +
  • +
  • + Company Short Name + {{id_apply.merchant_shortname | cut:true:20:' ...'}} +
  • +
  • + Business Category + {{id_apply.business_category | partner_royalpay_industry}} +
  • +
  • + Operator + +
  • +
+
+
+ +
+
+
+
+
+
+
+
\ No newline at end of file From d6c4a5aafb0f33b603555397dc67dec1db0ba0cc Mon Sep 17 00:00:00 2001 From: luoyang Date: Mon, 17 Sep 2018 16:17:41 +0800 Subject: [PATCH 07/26] update modify.sql --- src/db/modify.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/db/modify.sql b/src/db/modify.sql index 50f6f75c6..929d90dc1 100644 --- a/src/db/modify.sql +++ b/src/db/modify.sql @@ -1,3 +1,14 @@ +CREATE TABLE `sys_rpay_merchant_apply` ( + `merchant_app_id` varchar(50) NOT NULL, + `client_id` int(11) NOT NULL, + `merchant_shortname` varchar(20) NOT NULL, + `business_category` varchar(20) NOT NULL, + `sub_merchant_id` varchar(20) DEFAULT NULL, + `create_time` datetime NOT NULL, + `operator` varchar(50) DEFAULT NULL, + PRIMARY KEY (`merchant_app_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AVG_ROW_LENGTH=244; + ALTER TABLE `pmt_refunds` MODIFY COLUMN `refund_id` varchar(50) NOT NULL COMMENT '退款编号' FIRST ; From 4d1e4b3aa1568854f645b9113e3a7380eba426d6 Mon Sep 17 00:00:00 2001 From: luoyang Date: Mon, 17 Sep 2018 18:33:58 +0800 Subject: [PATCH 08/26] update revert partner --- .../manage/merchants/core/ClientManager.java | 2 ++ .../merchants/core/impls/ClientManagerImpl.java | 7 +++++++ .../merchants/web/PartnerManageController.java | 5 +++++ .../ui/static/payment/partner/partner-manage.js | 13 +++++++++++++ .../payment/partner/templates/partner_detail.html | 1 + 5 files changed, 28 insertions(+) diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java index 368785663..5e3dd5e9a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java @@ -222,6 +222,8 @@ public interface ClientManager { void disableClient(String clientMoniker, JSONObject manager); + void revertClient(String clientMoniker, JSONObject manager); + JSONObject getAuthFiles(JSONObject manager, String clientMoniker); void uploadAuthFiles(JSONObject manager, String clientMoniker, ClientAuthFilesInfo filesInfo); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index 7364f74c3..04b08a2ff 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -2636,6 +2636,13 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clientModifySupport.processClientModify(new DisableModify(manager, clientMoniker, false)); } + @Override + public void revertClient(String clientMoniker, JSONObject manager) { + JSONObject client = clientDetail(manager, clientMoniker); + Assert.notEmpty(client); + clientModifySupport.processClientModify(new DisableModify(manager, clientMoniker, true)); + } + @Override public void checkTodo(JSONObject manager, List notices) { if (ManagerRole.OPERATOR.hasRole(manager.getIntValue("role"))) { diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java index 66a0af5a9..084fcfa6b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java @@ -66,6 +66,11 @@ public class PartnerManageController { clientManager.disableClient(clientMoniker, manager); } + @ManagerMapping(value = "/{clientMoniker}/revert", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) + public void revertClient(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + clientManager.revertClient(clientMoniker, manager); + } + @ManagerMapping(value = "/{clientMoniker}/qrcode", method = RequestMethod.GET) public JSONObject getQrCodeImg(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, QRCodeConfig config) { return clientManager.getQRCode(manager, clientMoniker, config); diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index 8aced4d4e..fe5586f13 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -763,6 +763,19 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }) }) }; + $scope.revertClient = function () { + commonDialog.confirm({ + title: 'Revert Partner', + content: 'Are you sure to Revert ' + $scope.partner.company_name + '?' + }).then(function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/revert').then(function () { + $state.go('^'); + commonDialog.alert({title: 'Revert', content: 'Partner Already Revert', type: 'success'}); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + }) + }; $scope.commitToCompliance = function () { commonDialog.confirm({ diff --git a/src/main/ui/static/payment/partner/templates/partner_detail.html b/src/main/ui/static/payment/partner/templates/partner_detail.html index 61739d5fc..74d5997c0 100644 --- a/src/main/ui/static/payment/partner/templates/partner_detail.html +++ b/src/main/ui/static/payment/partner/templates/partner_detail.html @@ -78,6 +78,7 @@ (已禁用) +
From deebb88a2ca914b49748f93ec6a3cde24177ccb0 Mon Sep 17 00:00:00 2001 From: kira <164851225@qq.com> Date: Mon, 17 Sep 2018 20:42:31 +0800 Subject: [PATCH 09/26] update --- src/main/ui/static/lib/rpay/rpay_jssdk.js | 2 +- .../ui/static/templates/rpay/v1/payment.js | 70 ++++++++++++------- 2 files changed, 46 insertions(+), 26 deletions(-) diff --git a/src/main/ui/static/lib/rpay/rpay_jssdk.js b/src/main/ui/static/lib/rpay/rpay_jssdk.js index 4bc92ae54..e3f48ea99 100644 --- a/src/main/ui/static/lib/rpay/rpay_jssdk.js +++ b/src/main/ui/static/lib/rpay/rpay_jssdk.js @@ -21,7 +21,7 @@ $(function (){ if(isiOS){ window.webkit.messageHandlers.rpayplus.postMessage(msg); } else{ - //rpayplus.send(msg); + rpayplus.send(msg); } }, diff --git a/src/main/ui/static/templates/rpay/v1/payment.js b/src/main/ui/static/templates/rpay/v1/payment.js index c42004284..8df8657e5 100644 --- a/src/main/ui/static/templates/rpay/v1/payment.js +++ b/src/main/ui/static/templates/rpay/v1/payment.js @@ -3,21 +3,21 @@ */ $(function () { 'use strict'; - // document.querySelector('body').addEventListener('touchmove', function (e) { - // if (!document.querySelector('.coupons').contains(e.target)) { - // e.preventDefault(); - // } - // }) + document.querySelector('body').addEventListener('touchmove', function (e) { + if (!document.querySelector('.coupons').contains(e.target)) { + e.preventDefault(); + } + }) var dataCache = {price: '0', coupons: [], coupon_groups: {}}; var exchangeRate = parseFloat(window.exchange_rate); - // if (window.AlipayJSBridge) { - // AlipayJSBridge.call('hideOptionMenu'); - // } else { - // document.addEventListener('AlipayJSBridgeReady', function () { - // AlipayJSBridge.call('hideOptionMenu'); - // }, false); - // } + if (window.AlipayJSBridge) { + AlipayJSBridge.call('hideOptionMenu'); + } else { + document.addEventListener('AlipayJSBridgeReady', function () { + AlipayJSBridge.call('hideOptionMenu'); + }, false); + } dataCache.paying = false; var ctrl = {}; @@ -62,9 +62,11 @@ $(function () { var checked = $(this).is('.checked'); if (checked) { dataCache.coupons.push(couponId); + updatePrice(); } else { var idx = dataCache.coupons.indexOf(couponId); dataCache.coupons.splice(idx, 1); + } }); @@ -87,6 +89,29 @@ $(function () { return price; } + function updatePrice() { + $('#audVal').html(dataCache.price); + var realPrice = dataCache.price; + $('#audValReal').html(realPrice); + var surchargeData = calculateSurcharge(realPrice); + + var price = surchargeData.newPrice || realPrice; + var priceBeforeDiscount = price; + dataCache.discounts = []; + dataCache.tax = surchargeData.tax; + dataCache.surcharge = surchargeData.surcharge; + + $(window.coupons).each(function () { + price = this.handleDiscount(price, dataCache.price, dataCache.discounts, dataCache.coupons); + }); + dataCache.customSurcharge = new Decimal(price).sub(realPrice).toFixed(2,Decimal.ROUND_HALF_UP); + dataCache.finalPrice = new Decimal(price).toFixed(2, Decimal.ROUND_FLOOR); + var rate = 'CNY' == window.currency ? 1 : exchangeRate; + var cnyVal = Decimal.mul(price, rate).toFixed(2, Decimal.ROUND_HALF_UP); + $('#cnyVal').html(cnyVal); + dataCache.currencyPrice = 'CNY' == window.currency ? Decimal.div(priceBeforeDiscount, exchangeRate).toFixed(2, Decimal.ROUND_FLOOR) : priceBeforeDiscount; + } + function updatePoundageStatus() { $(window.coupons).each(function () { var coupon = this; @@ -117,6 +142,7 @@ $(function () { if (dataCache.price.length == 0) { dataCache.price = '0'; } + updatePrice(); updatePoundageStatus(); } @@ -133,6 +159,7 @@ $(function () { dataCache.price = ''; } dataCache.price += char; + updatePrice(); updatePoundageStatus(); } } @@ -232,7 +259,6 @@ $(function () { dataCache.remark = ''; window.RPayPlus.send("showLoading", null, null); - $.ajax({ url: '/api/v1.0/rpay/partners/' + window.client_moniker + '/orders', method: 'POST', @@ -241,11 +267,7 @@ $(function () { dataType: 'json', success: function (resp) { window.RPayPlus.send("closeLoading", null, null); - // pay(resp); - if (resp.direct_paid) { - location.href = '/api/v1.0/rpay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'; - return; - } + pay(resp,location.href = '/api/v1.0/rpay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'); // if (window.AlipayJSBridge) { // callPayment(); // } else { @@ -287,8 +309,6 @@ $(function () { error: function (jqXhr) { window.RPayPlus.send("closeLoading", null, null); weuiAlert(jqXhr.responseJSON.message); - $('#key_P').removeClass('hidden'); - $('#key_Loading').addClass('hidden'); dataCache.paying = false; } }) @@ -390,19 +410,19 @@ $(function () { } - /* function getUserId(){ + function getUserId(){ window.RPayPlus.send("getUserId", null, function(data){ + window.Rpay.userInfo = data; }); } - function pay(param){ + function pay(param,callback){ var order={ nonce_str:param.nonce_str, rpay_order_id:param.rpay_order_id, mch_order_id:param.mch_order_id }; - alert("rpay_order_info: nonce_str:"+param.nonce_str+"rpay_order_id:"+param.rpay_order_id+"mch_order_id:"+param.mch_order_id); - window.RPayPlus.send('pay', order, null); + window.RPayPlus.send('pay', order, callback); } function back(){ @@ -436,5 +456,5 @@ $(function () { queryOrder(data); }); } - getUserId();*/ + getUserId(); }); \ No newline at end of file From 43ab6507d68b30a147db06050ca68c384e2c4c31 Mon Sep 17 00:00:00 2001 From: kira <164851225@qq.com> Date: Tue, 18 Sep 2018 10:09:33 +0800 Subject: [PATCH 10/26] tmp --- src/main/ui/static/templates/rpay/v1/payment.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/ui/static/templates/rpay/v1/payment.js b/src/main/ui/static/templates/rpay/v1/payment.js index 8df8657e5..ba7f27829 100644 --- a/src/main/ui/static/templates/rpay/v1/payment.js +++ b/src/main/ui/static/templates/rpay/v1/payment.js @@ -267,7 +267,15 @@ $(function () { dataType: 'json', success: function (resp) { window.RPayPlus.send("closeLoading", null, null); - pay(resp,location.href = '/api/v1.0/rpay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'); + + pay(resp,function(data){ + alert(data); + if(data == 'success'){ + location.href = '/api/v1.0/rpay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result' + }else { + alert('Oops,Network fluctuation,please try again later...'); + } + }); // if (window.AlipayJSBridge) { // callPayment(); // } else { From 10a0a6f0ce0e3820fc5021e3a66279cb14684ae7 Mon Sep 17 00:00:00 2001 From: kira <164851225@qq.com> Date: Tue, 18 Sep 2018 10:39:28 +0800 Subject: [PATCH 11/26] add rpay --- src/main/ui/static/templates/rpay/v1/payment.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/ui/static/templates/rpay/v1/payment.js b/src/main/ui/static/templates/rpay/v1/payment.js index ba7f27829..74397a9c1 100644 --- a/src/main/ui/static/templates/rpay/v1/payment.js +++ b/src/main/ui/static/templates/rpay/v1/payment.js @@ -267,14 +267,16 @@ $(function () { dataType: 'json', success: function (resp) { window.RPayPlus.send("closeLoading", null, null); - pay(resp,function(data){ - alert(data); if(data == 'success'){ - location.href = '/api/v1.0/rpay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result' - }else { + location.href = '/api/v1.0/rpay/partners/' + window.client_moniker + '/orders/' + resp.mch_order_id + '/result' + }else if(data == 'fail'){ alert('Oops,Network fluctuation,please try again later...'); } + $('#key_P').removeClass('hidden'); + $('#key_Loading').addClass('hidden'); + dataCache.paying = false; + }); // if (window.AlipayJSBridge) { // callPayment(); @@ -318,6 +320,8 @@ $(function () { window.RPayPlus.send("closeLoading", null, null); weuiAlert(jqXhr.responseJSON.message); dataCache.paying = false; + $('#key_P').removeClass('hidden'); + $('#key_Loading').addClass('hidden'); } }) }); From 2ebe5a2eb7db7c5087e52e213d35c65e54bb7974 Mon Sep 17 00:00:00 2001 From: "taylor.dang" Date: Tue, 18 Sep 2018 10:55:27 +0800 Subject: [PATCH 12/26] =?UTF-8?q?[Y]=20=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E5=95=86=E6=88=B7=E5=9C=B0=E7=90=86=E4=BD=8D=E7=BD=AE=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dev/core/MerchantLocationService.java | 2 + .../impl/MerchantLocationServiceImpl.java | 87 +++++++++++++++++++ .../dev/web/ClientLocationsController.java | 5 ++ 3 files changed, 94 insertions(+) diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/core/MerchantLocationService.java b/src/main/java/au/com/royalpay/payment/manage/dev/core/MerchantLocationService.java index 61b31104f..56482064a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/dev/core/MerchantLocationService.java +++ b/src/main/java/au/com/royalpay/payment/manage/dev/core/MerchantLocationService.java @@ -8,6 +8,8 @@ public interface MerchantLocationService { List listMerchantsLocations(PartnerQuery query); + void initClientLocations() throws InterruptedException; + JSONObject getMerchantLocationByMoniker(String clientMoniker); void updateMerchantLocation(JSONObject manager, String clientMoniker, JSONObject geoData); diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/MerchantLocationServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/MerchantLocationServiceImpl.java index d51cf3041..24ca4aad1 100644 --- a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/MerchantLocationServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/MerchantLocationServiceImpl.java @@ -5,12 +5,29 @@ import au.com.royalpay.payment.manage.dev.core.MerchantLocationService; import au.com.royalpay.payment.manage.mappers.system.ClientLocationsMapper; import au.com.royalpay.payment.manage.merchants.beans.PartnerQuery; import au.com.royalpay.payment.manage.merchants.core.ClientManager; +import cn.yixblog.platform.http.HttpRequestGenerator; +import cn.yixblog.platform.http.HttpRequestResult; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import io.netty.util.internal.ConcurrentSet; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Service; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.util.UriComponentsBuilder; import javax.annotation.Resource; +import java.io.IOException; +import java.net.URISyntaxException; import java.util.Date; import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; @Service public class MerchantLocationServiceImpl implements MerchantLocationService { @@ -28,6 +45,76 @@ public class MerchantLocationServiceImpl implements MerchantLocationService { return clientLocationsMapper.getAllMerchantsLocations(params); } + private Logger logger = LoggerFactory.getLogger(getClass()); + + private static final String GOOGLE_MAPS_API = "https://maps.googleapis.com/maps/api/geocode/json"; + + // private static final String GOOGLE_API_KEY = "AIzaSyBbt7XV5PdXqB2aZeVFAZIzOTO0W6gn_YY"; + private static final String GOOGLE_API_KEY = "AIzaSyDUu6qXRV-j24rSdbPOMfVdTN1-2OfC2o8"; + + private ThreadPoolExecutor pool = new ThreadPoolExecutor(5, 100, 5, TimeUnit.SECONDS, new LinkedBlockingQueue()); + private Set failureSet = new ConcurrentSet<>(); + + @Resource + private JdbcTemplate jdbcTemplate; + + @Override + public void initClientLocations() throws InterruptedException { + List> clients = jdbcTemplate.queryForList("select client_id, CONCAT(IFNULL(address,''),' ',IFNULL(suburb,''),' ',IFNULL(state,''),' ',IFNULL(country,'')) as 'address' from royalpay_production.sys_clients where client_id not in (select client_id from royalpay_production.sys_clients_locations) AND client_moniker in ('CUEC','SEA8','SEA0','SEA2','SEA7','HUNT','HLSY','RIMO','TONY','SUCS','SUEM','SUSO','NEW2','NEW1','NEW3','SABO','TSRE','AQSY','JUSC','YMKP','ETAS','EASW','MEET','TDBR','DOUB','NOON','H2GR','LKST','ASON','JSMS','HIDA','DAFR','XANY','VEJE','LUTI','CNHJ','EHPL','YIFA','MRMA','NGMT','BJKC','FORU','CHED','GSAP','ASQI','OMPL','XAMC','HMJC','MGPL','6PHD','MTCS','AIND','KOTN','FDWK','NHKP','GFIT','GHCA','OGPL','RTCB','HOTT','MCRE','YBDW','WPX1','SFPT','WPXM','HOFT','AUID','SUBX','GBTK','PERA','TDCS','DUMP','QJF2','LBWD','HUGG','YINI','CALA','XHJJ','BLUS','SSSS','HEND')"); + final int totalLen = clients.size(); + logger.info("total length:" + totalLen); + for (int i = 0; i < totalLen; i++) { + Map client = clients.get(i); + final JSONObject clientObj = new JSONObject(client); + final int idx = i; + pool.execute(new Runnable() { + @Override + public void run() { + try { + processClient(clientObj, idx, totalLen); + } catch (URISyntaxException e) { + failureSet.add(clientObj.getIntValue("client_id")); + } + } + }); + Thread.sleep(120); + + } + pool.shutdown(); + pool.awaitTermination(5, TimeUnit.HOURS); + System.err.println("Failed clients:" + StringUtils.join(failureSet, ",")); + } + + private void processClient(JSONObject client, int idx, int totalLen) throws URISyntaxException { + String url = UriComponentsBuilder.fromHttpUrl(GOOGLE_MAPS_API) + .queryParam("key", GOOGLE_API_KEY) + .queryParam("address", client.get("address")).toUriString(); + HttpRequestGenerator gen = new HttpRequestGenerator(url, RequestMethod.GET); + int clientId = client.getIntValue("client_id"); + logger.info("start processing index " + idx + "/" + totalLen + ",client_id=" + clientId); + HttpRequestResult result = gen.execute(); + if (result.isSuccess()) { + try { + JSONObject address = result.getResponseContentJSONObj(); + System.err.println(address); + JSONArray array1 = address.getJSONArray("results"); + JSONObject aarray2 = (JSONObject) array1.get(0); + JSONObject location = aarray2.getJSONObject("geometry").getJSONObject("location"); + String longitude = location.getString("lng"); + String latitude = location.getString("lat"); + String sql = "INSERT royalpay_production.sys_clients_locations values(replace(uuid(),'-','')," + clientId + ",'" + client.getString("address") + "','" + latitude + "','" + longitude + "','System Init',now())"; + jdbcTemplate.update(sql); + } catch (Exception e) { + logger.error(e.getMessage(), e); + failureSet.add(clientId); + } + } else { + System.err.print(result.getStatusCode()); + failureSet.add(clientId); + } + logger.info("finished index " + idx + "/" + totalLen + ",client_id=" + clientId); + } + @Override public JSONObject getMerchantLocationByMoniker(String clientMoniker) { return clientLocationsMapper.findTheLocationByMerchantCode(clientMoniker); diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/web/ClientLocationsController.java b/src/main/java/au/com/royalpay/payment/manage/dev/web/ClientLocationsController.java index 390fbc040..ec2c600b0 100644 --- a/src/main/java/au/com/royalpay/payment/manage/dev/web/ClientLocationsController.java +++ b/src/main/java/au/com/royalpay/payment/manage/dev/web/ClientLocationsController.java @@ -22,4 +22,9 @@ public class ClientLocationsController { public List getClientsLocations(PartnerQuery query) { return merchantLocationService.listMerchantsLocations(query); } + + @RequestMapping(value = "/init") + public void initClientLocations() throws InterruptedException { + merchantLocationService.initClientLocations(); + } } From ee0854002e0af22dd353da6fce12fc44cdcee6db Mon Sep 17 00:00:00 2001 From: "taylor.dang" Date: Tue, 18 Sep 2018 11:12:05 +0800 Subject: [PATCH 13/26] =?UTF-8?q?[Y]=20=E5=95=86=E6=88=B7=E5=9C=B0?= =?UTF-8?q?=E7=90=86=E4=BD=8D=E7=BD=AE=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/MerchantLocationServiceImpl.java | 23 ++++++------ .../manage/task/initClientLocationTask.java | 35 +++++++++++++++++++ 2 files changed, 45 insertions(+), 13 deletions(-) create mode 100644 src/main/java/au/com/royalpay/payment/manage/task/initClientLocationTask.java diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/MerchantLocationServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/MerchantLocationServiceImpl.java index 24ca4aad1..8ddac5def 100644 --- a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/MerchantLocationServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/MerchantLocationServiceImpl.java @@ -19,7 +19,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.util.UriComponentsBuilder; import javax.annotation.Resource; -import java.io.IOException; import java.net.URISyntaxException; import java.util.Date; import java.util.List; @@ -31,10 +30,18 @@ import java.util.concurrent.TimeUnit; @Service public class MerchantLocationServiceImpl implements MerchantLocationService { + private Logger logger = LoggerFactory.getLogger(getClass()); + + private static final String GOOGLE_MAPS_API = "https://maps.googleapis.com/maps/api/geocode/json"; + + private static final String GOOGLE_API_KEY = "AIzaSyDUu6qXRV-j24rSdbPOMfVdTN1-2OfC2o8"; + + private ThreadPoolExecutor pool = new ThreadPoolExecutor(5, 100, 5, TimeUnit.SECONDS, new LinkedBlockingQueue()); + + private Set failureSet = new ConcurrentSet<>(); @Resource private ClientLocationsMapper clientLocationsMapper; - @Resource private ClientManager clientManager; @@ -45,22 +52,12 @@ public class MerchantLocationServiceImpl implements MerchantLocationService { return clientLocationsMapper.getAllMerchantsLocations(params); } - private Logger logger = LoggerFactory.getLogger(getClass()); - - private static final String GOOGLE_MAPS_API = "https://maps.googleapis.com/maps/api/geocode/json"; - - // private static final String GOOGLE_API_KEY = "AIzaSyBbt7XV5PdXqB2aZeVFAZIzOTO0W6gn_YY"; - private static final String GOOGLE_API_KEY = "AIzaSyDUu6qXRV-j24rSdbPOMfVdTN1-2OfC2o8"; - - private ThreadPoolExecutor pool = new ThreadPoolExecutor(5, 100, 5, TimeUnit.SECONDS, new LinkedBlockingQueue()); - private Set failureSet = new ConcurrentSet<>(); - @Resource private JdbcTemplate jdbcTemplate; @Override public void initClientLocations() throws InterruptedException { - List> clients = jdbcTemplate.queryForList("select client_id, CONCAT(IFNULL(address,''),' ',IFNULL(suburb,''),' ',IFNULL(state,''),' ',IFNULL(country,'')) as 'address' from royalpay_production.sys_clients where client_id not in (select client_id from royalpay_production.sys_clients_locations) AND client_moniker in ('CUEC','SEA8','SEA0','SEA2','SEA7','HUNT','HLSY','RIMO','TONY','SUCS','SUEM','SUSO','NEW2','NEW1','NEW3','SABO','TSRE','AQSY','JUSC','YMKP','ETAS','EASW','MEET','TDBR','DOUB','NOON','H2GR','LKST','ASON','JSMS','HIDA','DAFR','XANY','VEJE','LUTI','CNHJ','EHPL','YIFA','MRMA','NGMT','BJKC','FORU','CHED','GSAP','ASQI','OMPL','XAMC','HMJC','MGPL','6PHD','MTCS','AIND','KOTN','FDWK','NHKP','GFIT','GHCA','OGPL','RTCB','HOTT','MCRE','YBDW','WPX1','SFPT','WPXM','HOFT','AUID','SUBX','GBTK','PERA','TDCS','DUMP','QJF2','LBWD','HUGG','YINI','CALA','XHJJ','BLUS','SSSS','HEND')"); + List> clients = jdbcTemplate.queryForList("select client_id, CONCAT(IFNULL(address,''),' ',IFNULL(suburb,''),' ',IFNULL(state,''),' ',IFNULL(country,'')) as 'address' from royalpay_production.sys_clients where client_id not in (select client_id from royalpay_production.sys_clients_locations) "); final int totalLen = clients.size(); logger.info("total length:" + totalLen); for (int i = 0; i < totalLen; i++) { diff --git a/src/main/java/au/com/royalpay/payment/manage/task/initClientLocationTask.java b/src/main/java/au/com/royalpay/payment/manage/task/initClientLocationTask.java new file mode 100644 index 000000000..f7b23547c --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/task/initClientLocationTask.java @@ -0,0 +1,35 @@ +package au.com.royalpay.payment.manage.task; + +import au.com.royalpay.payment.manage.dev.core.MerchantLocationService; +import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +/** + * Created by wangning on 2018/1/2. + */ +@Component +@ConditionalOnProperty(value = "app.run-tasks", havingValue = "true") +public class initClientLocationTask { + @Resource + private MerchantLocationService merchantLocationService; + @Resource + private SynchronizedScheduler synchronizedScheduler; + + @Scheduled(cron = "0 0 5 * * *") + public void checkBillOrderCheck() { + synchronizedScheduler.executeProcess("manage_task:initClientLocation", 120_000, () -> { + try { + merchantLocationService.initClientLocations(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + }); + + } +} From 09755b167c722d33d1a4a02c37c407f0c3121880 Mon Sep 17 00:00:00 2001 From: kira <164851225@qq.com> Date: Tue, 18 Sep 2018 13:45:15 +0800 Subject: [PATCH 14/26] modify --- src/main/resources/application-rpay.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/application-rpay.properties b/src/main/resources/application-rpay.properties index 603d8f0e1..5d75a4c07 100644 --- a/src/main/resources/application-rpay.properties +++ b/src/main/resources/application-rpay.properties @@ -1,3 +1,3 @@ app.rpay.privateKey=MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAKikZJwvKZ3dj5QsRy6xN/cPinAZa3leg8X40YzGrMEYWc2nmZY/EczYPq/kUp1uL2uikweDO35fuVpA4rALmJwXhHzsZyhVk4lEjHaqH8rNpVpmrwKP9rMmbFD23Mfvvt+BkKW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.appId=ae8c8000-d774-42ad-8008-810b55c96aa9 \ No newline at end of file +app.rpay.rpayPublicKey=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxRx80vX64kSu5nrHbwPX/3SctyFIGrjBEJ9NEBOQPP4KHRQ49QyhVZ1fu7NvtD98n+PGR0ULUrK6S4KsYw6Huaga2RwbSVVkYPFGEFZ70XvjlGSzBG7fkbU8nscWAPOP+k5STD5sOZ35+9ko2H7IBz5RAclREoyB4/JaorQiBrEqS8RmX2TCjtx2lgi9TTcLinMDmULcg5qz44xpn08RwjuVpwRXyWFraxSaF0AcnpqstHON9AEyYanBjpQzR7yvj1IUGPMVNKpu/f4Z0ABvGZ9iAe3lyYESkkZ93ajy4vylY3YQvQsgHAsgazVsg2b25TC6TvAp9xPcaO0U8aoLLQIDAQAB +app.rpay.appId=8850afd2-6183-4cff-83af-9be5ca916e16 \ No newline at end of file From ce3e896e89c074df71ab82a1e02461dd781fc2d2 Mon Sep 17 00:00:00 2001 From: kira <164851225@qq.com> Date: Tue, 18 Sep 2018 14:30:00 +0800 Subject: [PATCH 15/26] add rpay merchant --- pom.xml | 4 +++ .../manage/merchants/core/ClientManager.java | 2 ++ .../core/impls/ClientManagerImpl.java | 6 ++-- .../web/PartnerManageController.java | 29 +++++++++++++++---- 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 1e0300dc8..cfb6e206d 100644 --- a/pom.xml +++ b/pom.xml @@ -36,6 +36,10 @@ au.com.royalpay.payment jd-core + + au.com.royalpay.payment + rpay-core + com.github.stuxuhai jpinyin diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java index 0fdaf643b..7808c732b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java @@ -336,5 +336,7 @@ public interface ClientManager { void sendHfEmailNotice(JSONObject order); + String subRpayMerchantApplication(String clientMoniker, JSONObject manager); + void updateAllPartnerPassword(String clientMoniker, List emails); } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index 24df591c3..9636537e8 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -7,9 +7,7 @@ import au.com.royalpay.payment.channels.wechat.config.WechatPayEnvironment; import au.com.royalpay.payment.channels.wechat.runtime.MpPaymentApi; import au.com.royalpay.payment.channels.wechat.runtime.WxPayClient; import au.com.royalpay.payment.channels.wechat.runtime.beans.SubMerchantInfo; - import au.com.royalpay.payment.core.PaymentChannelApi; -import au.com.royalpay.payment.core.beans.PayChannel; import au.com.royalpay.payment.core.exceptions.EmailException; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.core.utils.OrderExpiryRuleResolver; @@ -44,6 +42,7 @@ import au.com.royalpay.payment.manage.mappers.system.MailUnsubMapper; import au.com.royalpay.payment.manage.mappers.system.ManagerMapper; import au.com.royalpay.payment.manage.mappers.system.OrgMapper; import au.com.royalpay.payment.manage.mappers.system.PermissionPartnerModuleMapper; +import au.com.royalpay.payment.manage.mappers.system.SysRpayMerchantApplyMapper; import au.com.royalpay.payment.manage.mappers.system.SysWxMerchantApplyMapper; import au.com.royalpay.payment.manage.merchants.beans.ActivityPosterBuilder; import au.com.royalpay.payment.manage.merchants.beans.BankAccountInfo; @@ -176,7 +175,6 @@ import javax.annotation.Resource; import javax.imageio.ImageIO; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; -import javax.validation.Valid; import cn.yixblog.platform.http.HttpRequestGenerator; import cn.yixblog.platform.http.HttpRequestResult; @@ -284,6 +282,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Resource private ClientInfoCacheSupport clientInfoCacheSupport; + @Resource + private RpayApi rpayApi; @Resource private SimpleClientApplyService simpleClientApplyService; @Resource diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java index d8ba3cd61..768b1ebcb 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java @@ -1,7 +1,13 @@ package au.com.royalpay.payment.manage.merchants.web; import au.com.royalpay.payment.manage.dev.core.MerchantLocationService; -import au.com.royalpay.payment.manage.merchants.beans.*; +import au.com.royalpay.payment.manage.merchants.beans.BankAccountInfo; +import au.com.royalpay.payment.manage.merchants.beans.ClientAuthFilesInfo; +import au.com.royalpay.payment.manage.merchants.beans.ClientRateConfig; +import au.com.royalpay.payment.manage.merchants.beans.ClientRegisterInfo; +import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean; +import au.com.royalpay.payment.manage.merchants.beans.PartnerQuery; +import au.com.royalpay.payment.manage.merchants.beans.SubMerchantIdApply; import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; import au.com.royalpay.payment.manage.permission.manager.RequireManager; @@ -11,17 +17,26 @@ import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.http.HttpUtils; import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; + import com.alibaba.fastjson.JSONObject; + import org.springframework.validation.Errors; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import javax.validation.Valid; import java.io.IOException; import java.io.OutputStream; import java.util.List; +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + /** * Created by yixian on 2016-06-27. */ @@ -566,5 +581,9 @@ public class PartnerManageController { public void switchHfEmailNotice(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { clientManager.switchPermission(manager, clientMoniker, "enable_hf_email_notice", pass.getBooleanValue("allow")); } + @ManagerMapping(value = "/{clientMoniker}/registRpaySubMerchantId", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) + public String subRpayMerchantApplication(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + return clientManager.subRpayMerchantApplication(clientMoniker, manager); + } } From ea3ba4a5e06301722187497a664414a77043123a Mon Sep 17 00:00:00 2001 From: "taylor.dang" Date: Tue, 18 Sep 2018 14:31:03 +0800 Subject: [PATCH 16/26] fix --- src/main/resources/mybatis-config.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/resources/mybatis-config.xml b/src/main/resources/mybatis-config.xml index e662da9d5..5849c55f3 100644 --- a/src/main/resources/mybatis-config.xml +++ b/src/main/resources/mybatis-config.xml @@ -3,7 +3,6 @@ - From 7ba97fe686a2d9b0b93c016b14c12b1aedf1604d Mon Sep 17 00:00:00 2001 From: luoyang Date: Tue, 18 Sep 2018 14:54:22 +0800 Subject: [PATCH 17/26] fix properties +rpay --- src/main/resources/application.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 4b9da4527..f1575e412 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,6 +1,6 @@ server.port=5000 -spring.profiles.active=dev,alipay,bestpay,jd,wechat +spring.profiles.active=dev,alipay,bestpay,jd,wechat,rpay env.company=RoyalPay From 962fb6c1926c10082060240c60df6f14dab57077 Mon Sep 17 00:00:00 2001 From: luoyang Date: Tue, 18 Sep 2018 14:56:46 +0800 Subject: [PATCH 18/26] fix rpay merchant Id displayname --- .../ui/static/payment/partner/templates/partner_detail.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/ui/static/payment/partner/templates/partner_detail.html b/src/main/ui/static/payment/partner/templates/partner_detail.html index 74d5997c0..91275cb48 100644 --- a/src/main/ui/static/payment/partner/templates/partner_detail.html +++ b/src/main/ui/static/payment/partner/templates/partner_detail.html @@ -256,7 +256,7 @@ Product
  • - Wechat Merchant Id Applicaitons + Merchant Id Applicaitons
  • Permissions From d215a7fa8af86de7b63e381ff09951a66a066401 Mon Sep 17 00:00:00 2001 From: kira <164851225@qq.com> Date: Tue, 18 Sep 2018 16:10:42 +0800 Subject: [PATCH 19/26] fix --- .../static/payment/partner/templates/partner_bankaccounts.html | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/ui/static/payment/partner/templates/partner_bankaccounts.html b/src/main/ui/static/payment/partner/templates/partner_bankaccounts.html index 49679a2f3..f1e00b160 100644 --- a/src/main/ui/static/payment/partner/templates/partner_bankaccounts.html +++ b/src/main/ui/static/payment/partner/templates/partner_bankaccounts.html @@ -171,6 +171,7 @@
  • Bestpay
  • JDpay
  • HFpay
  • +
  • Rpay+
  • From 8667dbee0ef602fc70b79114638a0268c00841f3 Mon Sep 17 00:00:00 2001 From: luoyang Date: Tue, 18 Sep 2018 16:20:59 +0800 Subject: [PATCH 20/26] fix rpay clearing html --- .../partner/templates/partner_new_rate.html | 24 +++++++++++++++++++ .../templates/sub_merchant_id_apply.html | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/main/ui/static/payment/partner/templates/partner_new_rate.html b/src/main/ui/static/payment/partner/templates/partner_new_rate.html index 02f7c1875..ee45ccec7 100644 --- a/src/main/ui/static/payment/partner/templates/partner_new_rate.html +++ b/src/main/ui/static/payment/partner/templates/partner_new_rate.html @@ -160,6 +160,30 @@ +
    + +
    +
    + +
    %
    +
    +
    +
    + No more than 2.2% +
    +
    + No less than 0.6% +
    +
    + Required Field +
    +
    + +
    +
    +
    diff --git a/src/main/ui/static/payment/partner/templates/sub_merchant_id_apply.html b/src/main/ui/static/payment/partner/templates/sub_merchant_id_apply.html index 40fc8c119..95381f8dd 100644 --- a/src/main/ui/static/payment/partner/templates/sub_merchant_id_apply.html +++ b/src/main/ui/static/payment/partner/templates/sub_merchant_id_apply.html @@ -95,7 +95,7 @@
    -

    +

    Rpay+ Sub Merchant Id : {{partner.rpay_enterprise_id}}

    From 6929fa2ebbbe32acecd7615a25fe64c01b34dbc6 Mon Sep 17 00:00:00 2001 From: luoyang Date: Tue, 18 Sep 2018 16:34:03 +0800 Subject: [PATCH 21/26] fix rpay clearing html --- .../static/payment/partner/templates/sub_merchant_id_apply.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/ui/static/payment/partner/templates/sub_merchant_id_apply.html b/src/main/ui/static/payment/partner/templates/sub_merchant_id_apply.html index 95381f8dd..66ebd8403 100644 --- a/src/main/ui/static/payment/partner/templates/sub_merchant_id_apply.html +++ b/src/main/ui/static/payment/partner/templates/sub_merchant_id_apply.html @@ -95,7 +95,7 @@
    -

    +

    Rpay+ Sub Merchant Id : {{partner.rpay_enterprise_id}}

    From 6a368f7b658d4fc9fac2ebdb5d54e4e3d1bc3cf4 Mon Sep 17 00:00:00 2001 From: kira <164851225@qq.com> Date: Tue, 18 Sep 2018 17:48:59 +0800 Subject: [PATCH 22/26] add customerId --- src/main/ui/static/templates/rpay/v1/payment.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/ui/static/templates/rpay/v1/payment.js b/src/main/ui/static/templates/rpay/v1/payment.js index 74397a9c1..dfc96b138 100644 --- a/src/main/ui/static/templates/rpay/v1/payment.js +++ b/src/main/ui/static/templates/rpay/v1/payment.js @@ -255,6 +255,7 @@ $(function () { } data.coupons = dataCache.coupons; data.qrcodeVersion = window.qrcodeVersion; + data.customerId = window.customerId; dataCache.remark = ''; @@ -424,7 +425,7 @@ $(function () { function getUserId(){ window.RPayPlus.send("getUserId", null, function(data){ - window.Rpay.userInfo = data; + window.customerId = data; }); } From de55f0b10c85d3debc883d280f201900a12b6d72 Mon Sep 17 00:00:00 2001 From: luoyang Date: Tue, 18 Sep 2018 18:31:43 +0800 Subject: [PATCH 23/26] fix merchant --- .../payment/manage/mappers/system/ClientMapper.java | 3 +++ .../mappers/system/SysRpayMerchantApplyMapper.java | 2 +- .../payment/manage/merchants/core/ClientManager.java | 2 +- .../manage/merchants/core/impls/ClientManagerImpl.java | 9 ++++----- .../manage/merchants/web/PartnerManageController.java | 4 ++-- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java index da095448a..f42b842c5 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java @@ -99,4 +99,7 @@ public interface ClientMapper { List findByhfPayUrlNotNull(); + @AutoSql(type = SqlType.UPDATE) + void updateRpayEnterpriseId(@Param("client_id") int clientId, @Param("rpay_enterprise_id") String rpayEnterpriseId); + } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysRpayMerchantApplyMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysRpayMerchantApplyMapper.java index 9aa1cdbff..06664dc14 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysRpayMerchantApplyMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysRpayMerchantApplyMapper.java @@ -21,6 +21,6 @@ public interface SysRpayMerchantApplyMapper { void insertRpayMerchantApply(JSONObject params); @AutoSql(type = SqlType.SELECT) - List selectByShortName(@Param("client_id") int client_id,@Param("merchant_shortname") String shortName); + List listByShortName(@Param("client_id") int client_id,@Param("merchant_shortname") String shortName); } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java index 7808c732b..3e03074d9 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java @@ -336,7 +336,7 @@ public interface ClientManager { void sendHfEmailNotice(JSONObject order); - String subRpayMerchantApplication(String clientMoniker, JSONObject manager); + void subRpayMerchantApplication(String clientMoniker, JSONObject manager); void updateAllPartnerPassword(String clientMoniker, List emails); } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index 9636537e8..01d570fc5 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -3598,16 +3598,16 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public String subRpayMerchantApplication(String clientMoniker, JSONObject manager) { + public void subRpayMerchantApplication(String clientMoniker, JSONObject manager) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); } checkOrgPermission(manager, client); - List selectByshortName = sysRpayMerchantApplyMapper.selectByShortName(client.getIntValue("client_id"),client.getString("short_name")); + List listByshortName = sysRpayMerchantApplyMapper.listByShortName(client.getIntValue("client_id"),client.getString("short_name")); - if (selectByshortName.size()>0) { + if (listByshortName.size()>0) { throw new BadRequestException("请修改【" + clientMoniker + "】的Company shortName信息(请避免和Rpay+商务号列表内的Company Short Name重复)"); } @@ -3625,11 +3625,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid merchantApply.put("business_category", client.getString("royalpayindustry")); merchantApply.put("merchant_shortname", client.getString("short_name")); sysRpayMerchantApplyMapper.insertRpayMerchantApply(merchantApply); + clientMapper.updateRpayEnterpriseId(client.getIntValue("client_id"), rpayMerchantInfo.getString("merchantId")); }else { throw new BadRequestException("请求失败"); } - - return null; } @Override diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java index 768b1ebcb..6d186abbe 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java @@ -582,8 +582,8 @@ public class PartnerManageController { clientManager.switchPermission(manager, clientMoniker, "enable_hf_email_notice", pass.getBooleanValue("allow")); } @ManagerMapping(value = "/{clientMoniker}/registRpaySubMerchantId", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) - public String subRpayMerchantApplication(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { - return clientManager.subRpayMerchantApplication(clientMoniker, manager); + public void subRpayMerchantApplication(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + clientManager.subRpayMerchantApplication(clientMoniker, manager); } } From 0b70366c7ef1964cef3e90cf28ce67fcf175d17d Mon Sep 17 00:00:00 2001 From: yangkai Date: Tue, 18 Sep 2018 18:44:46 +0800 Subject: [PATCH 24/26] =?UTF-8?q?=E6=B7=BB=E5=8A=A0app=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../support/cms/core/AppStyleService.java | 15 ++ .../cms/core/Impl/AppStyleServiceImpl.java | 101 ++++++++ .../support/cms/web/AppStyleController.java | 42 ++++ src/main/ui/static/cms/cms.js | 233 +++++++++++++++++- .../ui/static/cms/templates/app_style.html | 65 +++++ .../cms/templates/app_style_config.html | 67 +++++ .../cms/templates/app_style_preview.html | 46 ++++ .../ui/static/cms/templates/cms_root.html | 3 + .../risk/templates/attention_merchants.html | 2 +- 9 files changed, 572 insertions(+), 2 deletions(-) create mode 100644 src/main/java/au/com/royalpay/payment/manage/support/cms/core/AppStyleService.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/support/cms/core/Impl/AppStyleServiceImpl.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/support/cms/web/AppStyleController.java create mode 100644 src/main/ui/static/cms/templates/app_style.html create mode 100644 src/main/ui/static/cms/templates/app_style_config.html create mode 100644 src/main/ui/static/cms/templates/app_style_preview.html diff --git a/src/main/java/au/com/royalpay/payment/manage/support/cms/core/AppStyleService.java b/src/main/java/au/com/royalpay/payment/manage/support/cms/core/AppStyleService.java new file mode 100644 index 000000000..3b83a79f5 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/support/cms/core/AppStyleService.java @@ -0,0 +1,15 @@ +package au.com.royalpay.payment.manage.support.cms.core; + +import com.alibaba.fastjson.JSONObject; + +public interface AppStyleService { + JSONObject listAppStyleGroup(int page, int limit); + + JSONObject getAppStyleByStyleId(String style_id); + + void switchGroupByStyleId(String style_id); + + void addAppStyle(String style_id, JSONObject appStyleGroup); + + void updateAppStyleByStyleId(String style_id, String originStyleId, JSONObject appStyleGroup); +} diff --git a/src/main/java/au/com/royalpay/payment/manage/support/cms/core/Impl/AppStyleServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/support/cms/core/Impl/AppStyleServiceImpl.java new file mode 100644 index 000000000..60aa24644 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/support/cms/core/Impl/AppStyleServiceImpl.java @@ -0,0 +1,101 @@ +package au.com.royalpay.payment.manage.support.cms.core.Impl; + +import au.com.royalpay.payment.manage.support.cms.core.AppStyleService; +import au.com.royalpay.payment.tools.exceptions.ServerErrorException; +import cn.yixblog.platform.http.HttpRequestGenerator; +import cn.yixblog.platform.http.HttpRequestResult; +import com.alibaba.fastjson.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.web.bind.annotation.RequestMethod; + +import java.io.IOException; +import java.net.URISyntaxException; + +@Service +public class AppStyleServiceImpl implements AppStyleService { + + @Value("http://127.0.0.1:9533") + private String cmsHost; + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Override + public JSONObject listAppStyleGroup(int page, int limit) { + String url = concatUrl("/app/style_group"); + HttpRequestGenerator gen = new HttpRequestGenerator(url, RequestMethod.GET).addQueryString("page", page + "").addQueryString("limit", limit + ""); + try { + HttpRequestResult res = gen.execute(); + if (res.isSuccess()) { + return res.getResponseContentJSONObj(); + } + } catch (URISyntaxException | IOException e) { + logger.error(e.getMessage(), e); + } + throw new ServerErrorException("Failed to request CMS"); + } + + @Override + public JSONObject getAppStyleByStyleId(String style_id) { + String url = concatUrl("/app/style_group/" + style_id); + HttpRequestGenerator gen = new HttpRequestGenerator(url, RequestMethod.GET); + try { + HttpRequestResult res = gen.execute(); + if (res.isSuccess()) { + return res.getResponseContentJSONObj(); + } + } catch (URISyntaxException | IOException e) { + logger.error(e.getMessage(), e); + } + throw new ServerErrorException("Failed to request CMS"); + } + + @Override + public void switchGroupByStyleId(String style_id) { + String url = concatUrl("/app/style_group/" + style_id); + try { + HttpRequestResult res = new HttpRequestGenerator(url, RequestMethod.PUT).execute(); + if (res.isSuccess()) { + return; + } + } catch (URISyntaxException e) { + logger.error(e.getMessage(), e); + } + throw new ServerErrorException("Failed to request CMS"); + } + + @Override + public void addAppStyle(String style_id, JSONObject appStyleGroup) { + String url = concatUrl("/app/style_group"); + try { + HttpRequestResult gen = new HttpRequestGenerator(url, RequestMethod.POST).addQueryString("style_id", style_id).setJSONEntity(appStyleGroup).execute(); + if (gen.isSuccess()) { + return; + } + } catch (URISyntaxException e) { + logger.error(e.getMessage(), e); + } + throw new ServerErrorException("Failed to request CMS"); + } + + @Override + public void updateAppStyleByStyleId(String style_id, String originStyleId, JSONObject appStyleGroup) { + String url = concatUrl("/app/style_group/" + style_id + "/style"); + try { + HttpRequestResult gen = new HttpRequestGenerator(url, RequestMethod.PUT).addQueryString("originStyleId", originStyleId).setJSONEntity(appStyleGroup).execute(); + if (gen.isSuccess()) { + return; + } + } catch (URISyntaxException e) { + logger.error(e.getMessage(), e); + } + throw new ServerErrorException("Failed to request CMS"); + } + + private String concatUrl(String uri) { + String host = cmsHost.endsWith("/") ? cmsHost.substring(0, cmsHost.length() - 1) : cmsHost; + uri = uri.startsWith("/") ? uri.substring(1) : uri; + return host + "/" + uri; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/support/cms/web/AppStyleController.java b/src/main/java/au/com/royalpay/payment/manage/support/cms/web/AppStyleController.java new file mode 100644 index 000000000..2ea0a87e0 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/support/cms/web/AppStyleController.java @@ -0,0 +1,42 @@ +package au.com.royalpay.payment.manage.support.cms.web; + + +import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; +import au.com.royalpay.payment.manage.support.cms.core.AppStyleService; +import au.com.royalpay.payment.tools.permission.enums.ManagerRole; +import com.alibaba.fastjson.JSONObject; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +@RestController +@ManagerMapping(value = "/app/cms/app_style", role = {ManagerRole.SITE_MANAGER}) +public class AppStyleController { + @Resource + private AppStyleService appStyleService; + + @RequestMapping(value = "/style_group", method = RequestMethod.GET) + public JSONObject listAppStyleGroup(@RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int limit) { + return appStyleService.listAppStyleGroup(page, limit); + } + + @RequestMapping(value = "/style_group/{style_id}", method = RequestMethod.GET) + public JSONObject getAppStyleByStyleId(@PathVariable String style_id) { + return appStyleService.getAppStyleByStyleId(style_id); + } + + @RequestMapping(value = "/style_group/{style_id}", method = RequestMethod.PUT) + public void switchGroupByStyleId(@PathVariable String style_id) { + appStyleService.switchGroupByStyleId(style_id); + } + + @RequestMapping(value = "/style_group", method = RequestMethod.POST) + public void addOneGroupAppStyle(@RequestParam String style_id, @RequestBody JSONObject appStyleGroup) { + appStyleService.addAppStyle(style_id, appStyleGroup); + } + + @RequestMapping(value = "/style_group/{style_id}/style", method = RequestMethod.PUT) + public void updateAppStyleByStyleId(@PathVariable String style_id,@RequestParam String originStyleId, @RequestBody JSONObject appStyleGroup) { + appStyleService.updateAppStyleByStyleId(style_id, originStyleId, appStyleGroup); + } +} diff --git a/src/main/ui/static/cms/cms.js b/src/main/ui/static/cms/cms.js index 3ab730034..156cda39b 100644 --- a/src/main/ui/static/cms/cms.js +++ b/src/main/ui/static/cms/cms.js @@ -4,6 +4,67 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angular) { 'use strict'; var app = angular.module('cms', ['ui.router','ng.uditor']); + var style = [ + { + "style_key":"settlement", + "style_value":"" + }, + { + "style_key":"home_select", + "style_value":"" + }, + { + "style_key":"activity_gray", + "style_value":"" + }, + { + "style_key":"activity_select", + "style_value":"" + }, + { + "style_key":"mess_gray", + "style_value":"" + }, + { + "style_key":"mess_select", + "style_value":"" + }, + { + "style_key":"my_select", + "style_value":"" + }, + { + "style_key":"transaction", + "style_value":"" + }, + { + "style_key":"statistics", + "style_value":"" + }, + { + "style_key":"marketing_account", + "style_value":"" + }, + { + "style_key":"usergroup", + "style_value":"" + }, + { + "style_key":"coupon", + "style_value":"" + }, + { + "style_key":"rpbill", + "style_value":"" + }, + { + "style_key":"invoice_assistant", + "style_value":"" + }, + { + "style_key":"home_gray", + "style_value":"" + }]; app.config(['$stateProvider', function ($stateProvider) { $stateProvider.state('cms', { url: '/cms', @@ -38,7 +99,41 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu }).state('cms.phone_top_up', { url: '/phone_top_up', controller: 'CmsPhonetopupCtrl', - templateUrl: '/static/cms/templates/phone_top_up.html' + templateUrl: '/static/cms/templates/phone_top_up.html', + }).state('cms.app_style',{ + url: '/app_style', + controller: 'cmsAppStyleListCtrl', + templateUrl: '/static/cms/templates/app_style.html', + }).state('cms.app_style.app_style_preview',{ + url: '/{style_id}/preview', + controller: 'cmsAppStylePreviewCtrl', + templateUrl: '/static/cms/templates/app_style_preview.html', + resolve: { + appStyles: ['$http', '$stateParams', function ($http, $stateParams) { + return $http.get('/app/cms/app_style/style_group/' + $stateParams.style_id); + }] + } + }).state('cms.app_style.app_style_save',{ + url: '/save', + controller: 'cmsAppStyleSaveCtrl', + templateUrl: '/static/cms/templates/app_style_config.html', + resolve: { + style: function () { + return angular.copy(style); + } + } + }).state('cms.app_style.app_style_edit',{ + url: '/{style_id}/edit', + controller: 'cmsAppStyleEditCtrl', + templateUrl: '/static/cms/templates/app_style_config.html', + resolve: { + appStyles: ['$http', '$stateParams', function ($http, $stateParams) { + return $http.get('/app/cms/app_style/style_group/' + $stateParams.style_id); + }], + style: function () { + return angular.copy(style); + } + } }) }]); app.controller('cmsRootCtrl', ['$scope', function ($scope) { @@ -140,6 +235,142 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu $scope.article = article.data; }]); + app.controller('cmsAppStyleListCtrl', ['$scope', '$http', '$uibModal', function ($scope, $http, $uibModal) { + $scope.pagination = {}; + $scope.appStyleGroupList = function (page) { + var params = $scope.queryParams || {}; + params.page = page || $scope.pagination.page || 1; + $http.get('/app/cms/app_style/style_group', {params: params}).then(function (resp) { + $scope.appStyleGroups = resp.data.data; + $scope.pagination = resp.data.pagination; + }) + }; + $scope.appStyleGroupList(1); + }]); + + app.controller('cmsAppStylePreviewCtrl', ['$scope', '$http', 'appStyles', function ($scope, $http, appStyles) { + $scope.appStyles = appStyles.data.data; + }]); + + app.controller('cmsAppStyleEditCtrl', ['$scope', '$http', '$state','commonDialog', 'appStyles', 'style', function ($scope, $http, $state, commonDialog, appStyles, style) { + $scope.ctrl = {sending: false, flag: false, originStyleId: angular.copy(appStyles.data.data[0].style_id)}; + $scope.entity={}; + $scope.style = angular.copy(style); + $scope.entity.appStyle = angular.copy(appStyles.data.data); + $scope.params = {style_id: angular.copy(appStyles.data.data[0].style_id)}; + $scope.appStyleList = function() { + var styleKeyStr = ""; + $scope.entity.appStyle.forEach(function(item){ + styleKeyStr += item.style_key + ","; + }); + $scope.style.forEach(function(item){ + if (styleKeyStr.indexOf(item.style_key) < 0) { + $scope.entity.appStyle.push({"style_key": item.style_key,"style_value":""}); + } + }) + }; + $scope.appStyleList(); + $scope.addSpecOption = function() { + $scope.entity.appStyle.push({}); + + }; + + // 删除规格选项 + $scope.delSpecOption = function(index) { + $scope.entity.appStyle.splice(index, 1); + + }; + + $scope.saveOneGroupAppStyle = function() { + if ($scope.params.style_id == "" || $scope.params.style_id == null) { + $scope.errmsg = "title不能为空"; + return; + } + var item = ""; + for (var i=0;i<$scope.entity.appStyle.length;i++) { + item = $scope.entity.appStyle[i]; + if (item.style_value == "" || item.style_value == null) { + $scope.errmsg = "value不能为空"; + return; + } + if (item.style_value.substr(0,4).toLowerCase() != "http" && + item.style_value.substr(0,5).toLowerCase() != "https") { + $scope.errmsg = "value必须以http或者https开头"; + return; + } + + } + $scope.ctrl.sending = true; + $http.put('/app/cms/app_style/style_group/' + $scope.params.style_id + '/style?originStyleId=' + $scope.ctrl.originStyleId, $scope.entity).then(function(){ + $scope.ctrl.sending = false; + $state.go('cms.app_style.app_style_preview',{style_id: $scope.params.style_id}); + }, function (resp) { + $scope.ctrl.sending = false; + $scope.errmsg = resp.data.message; + }) + } + $scope.toggleAppStyleIsValid = function(styleId) { + if (styleId) { + commonDialog.confirm({ + title: '确认操作', + content: '当前操作将发布title为:' +styleId +"的app图标,是否确认?" + }).then(function () { + $http.put('/app/cms/app_style/style_group/' + styleId).then(function () { + $state.reload(); + }) + }) + } + } + }]); + app.controller('cmsAppStyleSaveCtrl', ['$scope', '$http', '$state', 'style', function ($scope, $http, $state, style) { + $scope.ctrl = {sending: false, flag: true}; + $scope.entity={}; + $scope.entity.appStyle = angular.copy(style); + $scope.params = {style_id: ""}; + $scope.addSpecOption = function() { + $scope.entity.appStyle.push({}); + + }; + + // 删除规格选项 + $scope.delSpecOption = function(index) { + console.log(index) + $scope.entity.appStyle.splice(index, 1); + + }; + + $scope.saveOneGroupAppStyle = function() { + if ($scope.params.style_id == "" || $scope.params.style_id == null) { + $scope.errmsg = "title不能为空"; + return; + } + var item = ""; + for (var i=0;i<$scope.entity.appStyle.length;i++) { + item = $scope.entity.appStyle[i]; + if (item.style_value == "" || item.style_value == null) { + $scope.errmsg = "value不能为空"; + return; + } + if (item.style_value.substr(0,4).toLowerCase() != "http" && + item.style_value.substr(0,5).toLowerCase() != "https") { + $scope.errmsg = "value必须以http或者https开头"; + return; + } + + } + $scope.ctrl.sending = true; + $http.post('/app/cms/app_style/style_group?style_id=' + $scope.params.style_id, $scope.entity).then(function(){ + $scope.ctrl.sending = false; + $state.go('cms.app_style.app_style_preview', {style_id: $scope.params.style_id}); + }, function (resp) { + $scope.ctrl.sending = false; + $scope.errmsg = resp.data.message; + }) + }; + $scope.checkStyleValue = function () { + + } + }]); app.filter('topUpType', function () { return function (status) { switch (status + '') { diff --git a/src/main/ui/static/cms/templates/app_style.html b/src/main/ui/static/cms/templates/app_style.html new file mode 100644 index 000000000..613b0f19d --- /dev/null +++ b/src/main/ui/static/cms/templates/app_style.html @@ -0,0 +1,65 @@ +
    +
    +

    APP_STYLE

    + +
    +
    +
    + +
    +
    +
    +
    + + + + + + + + + + + + + + +
    TitlePublishedOperation
    + + + + + + +
    +
    + +
    + +
    \ No newline at end of file diff --git a/src/main/ui/static/cms/templates/app_style_config.html b/src/main/ui/static/cms/templates/app_style_config.html new file mode 100644 index 000000000..694d761c9 --- /dev/null +++ b/src/main/ui/static/cms/templates/app_style_config.html @@ -0,0 +1,67 @@ +
    +
    +

    APP_STYLE

    + +
    +
    +
    +
    +
    +
    +
    + + +
    + +
    +
    + + + + + +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    + + + +
    +
    + +
    +
    +
    \ No newline at end of file diff --git a/src/main/ui/static/cms/templates/app_style_preview.html b/src/main/ui/static/cms/templates/app_style_preview.html new file mode 100644 index 000000000..7ab0f756a --- /dev/null +++ b/src/main/ui/static/cms/templates/app_style_preview.html @@ -0,0 +1,46 @@ +
    +
    +

    APP_STYLE

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + +
    TitleStyle_KeyStyle_Value
    +
    +
    +
    +
    \ No newline at end of file diff --git a/src/main/ui/static/cms/templates/cms_root.html b/src/main/ui/static/cms/templates/cms_root.html index 69e7b8911..0040caa6b 100644 --- a/src/main/ui/static/cms/templates/cms_root.html +++ b/src/main/ui/static/cms/templates/cms_root.html @@ -26,6 +26,9 @@ +
    + App图标 +
    diff --git a/src/main/ui/static/risk/templates/attention_merchants.html b/src/main/ui/static/risk/templates/attention_merchants.html index b618f4f6b..d3ddfdf66 100644 --- a/src/main/ui/static/risk/templates/attention_merchants.html +++ b/src/main/ui/static/risk/templates/attention_merchants.html @@ -67,7 +67,7 @@ {{client.bank_account_no}} {{client.contact_person}} {{client.contact_phone}} - {{client.last_update_date}} + {{client.creation_date}} {{client.remark}} Date: Tue, 18 Sep 2018 18:48:09 +0800 Subject: [PATCH 25/26] =?UTF-8?q?app=E5=9B=BE=E6=A0=87cmsHost=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/support/cms/core/Impl/AppStyleServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/support/cms/core/Impl/AppStyleServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/support/cms/core/Impl/AppStyleServiceImpl.java index 60aa24644..dee97a580 100644 --- a/src/main/java/au/com/royalpay/payment/manage/support/cms/core/Impl/AppStyleServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/support/cms/core/Impl/AppStyleServiceImpl.java @@ -17,7 +17,7 @@ import java.net.URISyntaxException; @Service public class AppStyleServiceImpl implements AppStyleService { - @Value("http://127.0.0.1:9533") + @Value("${app.cms.host}") private String cmsHost; private Logger logger = LoggerFactory.getLogger(getClass()); From f826867191f879c5692544597daaf44ea281e262 Mon Sep 17 00:00:00 2001 From: yangkai Date: Tue, 18 Sep 2018 20:46:56 +0800 Subject: [PATCH 26/26] =?UTF-8?q?=E7=BC=A9=E5=B0=8F=E6=8A=BD=E5=A5=96?= =?UTF-8?q?=E5=A5=96=E5=8A=B1=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/ui/static/templates/payment/success.css | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/ui/static/templates/payment/success.css b/src/main/ui/static/templates/payment/success.css index ab5abda7a..5dc8ef94b 100644 --- a/src/main/ui/static/templates/payment/success.css +++ b/src/main/ui/static/templates/payment/success.css @@ -351,10 +351,10 @@ } .points-dialog .dialog-content{ margin: auto; - width: 90%; + width: 80%; display: block; position: relative; - margin-top: 130px; + margin-top: 100px; padding-top: 25px; padding-bottom: 19px; border-radius: 5px; @@ -386,8 +386,8 @@ } .points-content .coin{ - width: 100px; - height: 100px; + width: 80px; + height: 80px; position: relative; background: url(/static/images/star.png) no-repeat; background-size: contain;