From d2b5923c958d67c1b87960c4cd70ad88cfa56f43 Mon Sep 17 00:00:00 2001 From: "james.zhao" Date: Wed, 12 Jun 2019 15:13:47 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E4=B8=BB=E8=BF=9B=E4=BB=B6=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beans/ClientPreApplyStep1Bean.java | 9 +++ .../core/SimpleClientApplyService.java | 3 +- .../impls/SimpleClientApplyServiceImpl.java | 15 ++-- .../web/SimpleClientApplyController.java | 5 +- src/main/ui/merchant_application.html | 23 +++++- .../ui/static/data/rp_customer_channel.json | 49 ++++++++++++ .../ui/static/data/rp_industry_apply.json | 74 +++++++++---------- .../merchant_application.js | 15 +++- .../SimpleClientApplyServiceImplTest.java | 4 +- 9 files changed, 147 insertions(+), 50 deletions(-) create mode 100644 src/main/ui/static/data/rp_customer_channel.json diff --git a/src/main/java/au/com/royalpay/payment/manage/application/beans/ClientPreApplyStep1Bean.java b/src/main/java/au/com/royalpay/payment/manage/application/beans/ClientPreApplyStep1Bean.java index 9d1dfd0c1..ca14416cc 100644 --- a/src/main/java/au/com/royalpay/payment/manage/application/beans/ClientPreApplyStep1Bean.java +++ b/src/main/java/au/com/royalpay/payment/manage/application/beans/ClientPreApplyStep1Bean.java @@ -22,6 +22,7 @@ public class ClientPreApplyStep1Bean { @NotEmpty(message = "phoneCodeKey can't be null") private String phoneCodeKey; private String apply_source = "pc"; + private int channel; public JSONObject insertObject() { @@ -84,4 +85,12 @@ public class ClientPreApplyStep1Bean { public void setApply_source(String apply_source) { this.apply_source = apply_source; } + + public int getChannel() { + return channel; + } + + public void setChannel(int channel) { + this.channel = channel; + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/application/core/SimpleClientApplyService.java b/src/main/java/au/com/royalpay/payment/manage/application/core/SimpleClientApplyService.java index e47105ef4..d3a877528 100644 --- a/src/main/java/au/com/royalpay/payment/manage/application/core/SimpleClientApplyService.java +++ b/src/main/java/au/com/royalpay/payment/manage/application/core/SimpleClientApplyService.java @@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.application.core; import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean; import com.alibaba.fastjson.JSONObject; +import org.apache.catalina.servlet4preview.http.HttpServletRequest; public interface SimpleClientApplyService { void verifyRegisterSMSCode(String codeKey, String phoneNumber); @@ -11,7 +12,7 @@ public interface SimpleClientApplyService { String partnerSignIn(JSONObject account); - String getAndSendSmsCode(String phoneNumber, String nationCode); + String getAndSendSmsCode(String phoneNumber, String nationCode, HttpServletRequest request); String checkOrGenerateRegisterProcessKey(String accountName, String codeKey); diff --git a/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java index e61854e5f..2abaa88ee 100644 --- a/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java @@ -28,6 +28,7 @@ import au.com.royalpay.payment.tools.utils.PasswordUtils; import com.alibaba.fastjson.JSONObject; import com.github.qcloudsms.SmsSingleSender; +import org.apache.catalina.servlet4preview.http.HttpServletRequest; import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateFormatUtils; @@ -43,10 +44,7 @@ import org.thymeleaf.spring4.SpringTemplateEngine; import java.io.IOException; import java.net.URISyntaxException; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Random; +import java.util.*; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; @@ -103,6 +101,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { @Resource private StringRedisTemplate stringRedisTemplate; private final int REGISTER_CLIENT_TEMPLID = 126978; + private final int REGISTER_CLIENT_TEMPLID_ENGLISH = 346078; private final String REGISTER_CLIENT_PREFIX = "REGISTER_CLIENT"; private final String REGISTER_CLIENT_PROCESS_PREFIX = "REGISTER_CLIENT_PROCESS"; private final String VERIFY_MAIL_PREFIX = "VERIFY_MAIL"; @@ -134,7 +133,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { } @Override - public String getAndSendSmsCode(String phoneNumber, String nationCode) { + public String getAndSendSmsCode(String phoneNumber, String nationCode, HttpServletRequest request) { String reidsCheckCodeKey = getRegisterClientRedisKey(phoneNumber); String value = stringRedisTemplate.boundValueOps(reidsCheckCodeKey).get(); if (StringUtils.isNotEmpty(value)) { @@ -147,7 +146,11 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { String expireMin = "3"; param.add(expireMin); try { - smsSender.getSender().sendWithParam(nationCode.trim(), phoneNumber, REGISTER_CLIENT_TEMPLID, param, "RoyalPay", "", ""); + if(request.getLocales().nextElement().equals(Locale.CHINESE)|| request.getLocales().nextElement().equals(Locale.SIMPLIFIED_CHINESE)){ + smsSender.getSender().sendWithParam(nationCode.trim(), phoneNumber, REGISTER_CLIENT_TEMPLID, param, "RoyalPay", "", ""); + }else{ + smsSender.getSender().sendWithParam(nationCode.trim(), phoneNumber, REGISTER_CLIENT_TEMPLID_ENGLISH, param, "RoyalPay", "", ""); + } } catch (Exception e) { e.printStackTrace(); throw new ServerErrorException("Phone number is wrong Please try again"); diff --git a/src/main/java/au/com/royalpay/payment/manage/application/web/SimpleClientApplyController.java b/src/main/java/au/com/royalpay/payment/manage/application/web/SimpleClientApplyController.java index 339c1fd20..354ee5d21 100644 --- a/src/main/java/au/com/royalpay/payment/manage/application/web/SimpleClientApplyController.java +++ b/src/main/java/au/com/royalpay/payment/manage/application/web/SimpleClientApplyController.java @@ -7,6 +7,7 @@ import au.com.royalpay.payment.tools.env.SysConfigManager; import com.alibaba.fastjson.JSONObject; +import org.apache.catalina.servlet4preview.http.HttpServletRequest; import org.apache.commons.lang3.StringUtils; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; @@ -64,8 +65,8 @@ public class SimpleClientApplyController { @RequestMapping(value = "/info/phone/{phone_number}/verify", method = RequestMethod.POST) @ResponseBody - public void getAndSendSmsCode(@PathVariable String phone_number, @RequestParam String nation_code) { - simpleClientApplyService.getAndSendSmsCode(phone_number, nation_code); + public void getAndSendSmsCode(@PathVariable String phone_number, @RequestParam String nation_code, HttpServletRequest request) { + simpleClientApplyService.getAndSendSmsCode(phone_number, nation_code, request); } @RequestMapping(value = "/info/update/{username}", method = RequestMethod.POST) diff --git a/src/main/ui/merchant_application.html b/src/main/ui/merchant_application.html index 6842c7812..fada2f2b6 100644 --- a/src/main/ui/merchant_application.html +++ b/src/main/ui/merchant_application.html @@ -323,6 +323,27 @@ minlength="6" maxlength="12" name="rePassword"> +
+
+ +
+
+
- \ No newline at end of file + diff --git a/src/main/ui/static/data/rp_customer_channel.json b/src/main/ui/static/data/rp_customer_channel.json new file mode 100644 index 000000000..f17cc1094 --- /dev/null +++ b/src/main/ui/static/data/rp_customer_channel.json @@ -0,0 +1,49 @@ +[ + { + "children": [ + { + "children": [], + "label": "谷歌|Google", + "mccCode": "10001" + }, + { + "children": [], + "label": "领英|LinkedIn", + "mccCode": "10002" + }, + { + "children": [], + "label": "微信|Wechat", + "mccCode": "10003" + }, + { + "children": [], + "label": "传单手册|Flyer Manual", + "mccCode": "10004" + }, + { + "children": [], + "label": "其他媒体|Other Media", + "mccCode": "10005" + } + ], + "label": "媒体宣传|Media", + "mccCode": "1" + }, + { + "label": "线下使用体验|Offline Experience", + "mccCode": "2" + }, + { + "label": "朋友介绍|Friend Introduction", + "mccCode": "3" + }, + { + "label": "商户推荐|Merchant Recommendation", + "mccCode": "4" + }, + { + "label": "销售推荐|Sales Recommendation", + "mccCode": "5" + } +] diff --git a/src/main/ui/static/data/rp_industry_apply.json b/src/main/ui/static/data/rp_industry_apply.json index c4d2a917c..07b6ea032 100644 --- a/src/main/ui/static/data/rp_industry_apply.json +++ b/src/main/ui/static/data/rp_industry_apply.json @@ -3,187 +3,187 @@ "children": [ { "children": [], - "label": "机票", + "label": "机票|Air Tickets", "mccCode": "10001" }, { "children": [], - "label": "旅游行业", + "label": "旅游行业|Tourism Industry", "mccCode": "10002" }, { "children": [], - "label": "私人定制旅游", + "label": "私人定制旅游|Private Custom Tour", "mccCode": "10003" }, { "children": [], - "label": "租车", + "label": "租车|Car rental", "mccCode": "10004" }, { "children": [], - "label": "巴士", + "label": "巴士|Bus", "mccCode": "10005" } ], - "label": "旅游出行", + "label": "旅游出行|Travel", "mccCode": "1" }, { "children": [ { "children": [], - "label": "饭店", + "label": "饭店|Restaurant", "mccCode": "20001" }, { "children": [], - "label": "奶茶店", + "label": "奶茶店|Tea Shop", "mccCode": "20002" }, { "children": [], - "label": "烧烤", + "label": "烧烤|Barbecue", "mccCode": "20003" }, { "children": [], - "label": "火锅", + "label": "火锅|Hot Pot", "mccCode": "20004" }, { "children": [], - "label": "Coffee", + "label": "咖啡|Coffee", "mccCode": "20005" }, { "children": [], - "label": "酒吧", + "label": "酒吧|Bar", "mccCode": "20006" } ], - "label": "餐饮", + "label": "餐饮|Food", "mccCode": "2" }, { "children": [ { "children": [], - "label": "公众号服务商", + "label": "公众号服务商|Public Service Provider", "mccCode": "50001" }, { "children": [], - "label": "各种媒体类宣传", + "label": "各种媒体类宣传|Various Media Promotion", "mccCode": "50002" } ], - "label": "传媒", + "label": "传媒|Media", "mccCode": "5", "value": "{\"category\":\"SERVICE\",\"code\":\"7542\",\"description\":\"Car Washes\",\"parentCode\":\"S10\"}" }, { "children": [ { - "label": "超市", + "label": "超市|Supermarket", "mccCode": "70001" }, { "children": [], - "label": "服装店", + "label": "服装店|Clothing Store", "mccCode": "70002" }, { "children": [], - "label": "鞋店", + "label": "鞋店|Shoe Store", "mccCode": "70003" },{ "children": [], - "label": "箱包", + "label": "箱包|Luggage", "mccCode": "70005" } ], - "label": "零售", + "label": "零售|Retail", "mccCode": "7" }, { "children": [ { "children": [], - "label": "桌游吧", + "label": "桌游吧|Board Game", "mccCode": "80001" }, { "children": [], - "label": "网吧", + "label": "网吧|Internet Cafe", "mccCode": "80007" } ], - "label": "休闲娱乐", + "label": "休闲娱乐|Leisure and entertainment", "mccCode": "8" }, { "children": [ { "children": [], - "label": "摄影", + "label": "摄影|Photography", "mccCode": "90001" }, { "children": [], - "label": "通讯运营商", + "label": "通讯运营商|Communication Carrier", "mccCode": "90003" }, { "children:":[], - "label":"软件服务", + "label":"软件服务|Software Service", "mccCode":"90005" } ], - "label": "其他服务类", + "label": "其他服务类|Other Service Classes", "mccCode": "9" }, { "children": [ { "children": [], - "label": "Hotel", + "label": "旅馆|Hotel", "mccCode": "100001" }, { "children": [], - "label": "Motel", + "label": "汽车旅馆|Motel", "mccCode": "100002" } ], - "label": "酒店", + "label": "酒店|Hotel", "mccCode": "10" }, { "children": [ { "children": [], - "label": "代购", + "label": "代购|Purchasing", "mccCode": "110001" }, { "children": [], - "label": "物流(大宗出口贸易)", + "label": "物流(大宗出口贸易)|Logistics (Bulk Export Trade)", "mccCode": "110002" }, { "children": [], - "label": "红酒出口", + "label": "红酒出口|Wine Export", "mccCode": "110003" }, { "children": [], - "label": "综合电商", + "label": "综合电商|Integrated E-Commerce", "mccCode": "110004" } ], - "label": "出口贸易", + "label": "出口贸易|Export Trade", "mccCode": "11" } -] \ No newline at end of file +] diff --git a/src/main/ui/static/merchantapplication/merchant_application.js b/src/main/ui/static/merchantapplication/merchant_application.js index f35115004..cae37b47d 100644 --- a/src/main/ui/static/merchantapplication/merchant_application.js +++ b/src/main/ui/static/merchantapplication/merchant_application.js @@ -71,6 +71,13 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl', }; $scope.loadRoyalpayindustry(); + $scope.loadCustomerChannel = function () { + $http.get('/static/data/rp_customer_channel.json').then(function (resp) { + $scope.customerchannel = resp.data; + }) + }; + $scope.loadCustomerChannel(); + $scope.checkParams = function () { if($scope.partner.contact_phone && $scope.partner.nation_code){ @@ -173,6 +180,12 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl', $scope.partner.industry = industry.mccCode; $scope.industryLable = industry.label; }; + + $scope.chooseChannel = function (channel) { + $scope.partner.channel = channel.mccCode; + $scope.channelLable = channel.label; + }; + $scope.searchBankInfo = function (bsb_no) { $scope.initErrorMsg(); if (bsb_no != null && bsb_no != "") { @@ -404,4 +417,4 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl', $scope.resError = ''; } -}]); \ No newline at end of file +}]); diff --git a/src/test/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImplTest.java b/src/test/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImplTest.java index 255fad75f..3099e1e35 100644 --- a/src/test/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImplTest.java +++ b/src/test/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImplTest.java @@ -33,7 +33,7 @@ public class SimpleClientApplyServiceImplTest { @Test public void getAndSendSmsCode() { - simpleClientApplyService.getAndSendSmsCode("0451120326","61"); + simpleClientApplyService.getAndSendSmsCode("0451120326","61",null); } @Test @@ -57,4 +57,4 @@ public class SimpleClientApplyServiceImplTest { @Test public void deleteVerifyMailKey() { } -} \ No newline at end of file +}