Upd:APP用户设置绑定解绑手机、微信

master
duLingLing 5 years ago
commit b315f23776

@ -188,10 +188,13 @@ public interface RetailAppService {
void updateAccountEmail(JSONObject device,JSONObject codekey);
void bindAccountPhone(JSONObject device,JSONObject phone);
JSONObject bindAccountPhone(JSONObject device,JSONObject phone);
void updateAccountPhone(JSONObject device,JSONObject codekey);
JSONObject updateAccountPhone(JSONObject device,JSONObject codekey);
void updateLoginClientAccountPhone(JSONObject account,String contactPhone, String nationCode);
void updateLoginClientAccountOpenId(JSONObject client,JSONObject params);
/**
* 退
*/
@ -226,5 +229,9 @@ public interface RetailAppService {
boolean isSubPartner(JSONObject device, String clientMoniker);
void unbindAccountPhone(JSONObject device, JSONObject params);
JSONObject unbindAccountPhone(JSONObject device, JSONObject params);
void unbindAccountWechat(JSONObject device);
JSONObject bindAccountWechat(JSONObject device, JSONObject params);
}

@ -44,6 +44,7 @@ import au.com.royalpay.payment.manage.tradelog.core.TradeLogService;
import au.com.royalpay.payment.manage.tradelog.refund.RefundService;
import au.com.royalpay.payment.tools.cms.RoyalPayCMSSupport;
import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient;
import au.com.royalpay.payment.tools.connections.mpsupport.MpClientAppWechatApiProvider;
import au.com.royalpay.payment.tools.device.DeviceSupport;
import au.com.royalpay.payment.tools.device.message.AppMessage;
import au.com.royalpay.payment.tools.device.message.AppMsgSender;
@ -203,6 +204,8 @@ public class RetailAppServiceImp implements RetailAppService {
private SysClientLegalPersonMapper sysClientLegalPersonMapper;
@Resource
private StringRedisTemplate stringRedisTemplate;
@Resource
private MpClientAppWechatApiProvider mpClientAppWechatApiProvider;
private final String CBBANK_AGGREGATE_FILE = "https://file.royalpay.com.au/open/2019/08/05/1564972204689_uwZvpTBjtLUMcN8c540xcZvux1Rd3O.pdf";
private final String IMG_AGGREGATE_FILE = "https://file.royalpay.com.au/open/2019/09/06/1567741055646_qeWC7kwqEwsJjRHisJSyAjqnB9nnnh.pdf";
@ -2119,11 +2122,14 @@ public class RetailAppServiceImp implements RetailAppService {
}
@Override
public void bindAccountPhone(JSONObject device, JSONObject phone) {
public JSONObject bindAccountPhone(JSONObject device, JSONObject phone) {
String codeKey = device.getString("account_id");
String codeKeyValueRedis = stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(codeKey)).get();
JSONObject result = new JSONObject();
if (StringUtils.isNotEmpty(codeKeyValueRedis)) {
throw new BadRequestException("Captcha has been sent.Please check your phone or try again in 5 minutes.");
result.put("status","error");
result.put("message","Captcha has been sent.Please check your phone or try again in 5 minutes.");
return result;
}
String codeKeyValue = RandomStringUtils.random(6, false, true);
String nationCode = phone.getString("nation_code");
@ -2134,50 +2140,127 @@ public class RetailAppServiceImp implements RetailAppService {
String expireMin = "5";
param.add(expireMin);
try {
smsSender.getSender().sendWithParam(nationCode.trim(), phoneNumber, BIND_PHONE_TEMPLID, param, "RoyalPay", "", "");
// smsSender.getSender().sendWithParam(nationCode.trim(), phoneNumber, BIND_PHONE_TEMPLID, param, "RoyalPay", "", "");
stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(codeKey)).set(codeKeyValue + "&" + nationCode + "&" + phoneNumber, Long.parseLong(expireMin), TimeUnit.MINUTES);
result.put("status","success");
result.put("code_Key_Value",codeKeyValue);
} catch (Exception e) {
e.printStackTrace();
throw new ServerErrorException("Phone number is wrong.Please try again.");
result.put("status","error");
result.put("message","Phone number is wrong.Please try again.");
}
stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(codeKey)).set(codeKeyValue + "&" + nationCode + "&" + phoneNumber, Long.parseLong(expireMin), TimeUnit.MINUTES);
return result;
}
@Override
public void updateAccountPhone(JSONObject device, JSONObject params) {
public JSONObject updateAccountPhone(JSONObject device, JSONObject params) {
String key = stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(device.getString("account_id"))).get();
JSONObject result = new JSONObject();
if (key == null) {
throw new BadRequestException("Captcha has expired");
result.put("status","error");
result.put("message","Captcha has expired");
return result;
}
String captcha = key.split("&")[0];
String nation_code = key.split("&")[1];
String contact_phone = key.split("&")[2];
if (!StringUtils.equals(captcha, params.getString("captcha"))) {
throw new BadRequestException("Verification code is wrong");
result.put("status","error");
result.put("message","Verification code is wrong");
return result;
}
JSONObject account = new JSONObject();
account.put("account_id", device.getString("account_id"));
account.put("contact_phone", contact_phone);
account.put("nation_code", "+" + nation_code);
clientAccountMapper.update(account);
JSONObject account = clientAccountMapper.findByPhone(contact_phone, "+"+nation_code);
if(account!=null){
result.put("status","error");
result.put("message","Mobile phone number has been bound to other users, please unbind it before binding");
return result;
}
JSONObject updateAccount = new JSONObject();
updateAccount.put("account_id", device.getString("account_id"));
updateAccount.put("contact_phone", contact_phone);
updateAccount.put("nation_code", "+" + nation_code);
clientAccountMapper.update(updateAccount);
deleteAccountPhoneKey(device.getString("account_id"));
result.put("status","success");
return result;
}
@Override
public void updateLoginClientAccountPhone(JSONObject account, String contactPhone, String nationCode){
JSONObject updateAccount = new JSONObject();
updateAccount.put("account_id",account.getString("account_id"));
updateAccount.put("contact_phone",contactPhone);
updateAccount.put("nation_code","+" + nationCode);
clientAccountMapper.update(updateAccount);
}
@Override
public void updateLoginClientAccountOpenId(JSONObject account,JSONObject params){
JSONObject updateAccount = new JSONObject();
JSONObject queryAccount = account.getJSONObject("account");
updateAccount.put("account_id",queryAccount.getString("account_id"));
updateAccount.put("wechat_openid",params.getString("wechat_openid"));
clientAccountMapper.update(updateAccount);
}
@Override
public void unbindAccountPhone(JSONObject device, JSONObject phone) {
String codeKeyValueRedis = stringRedisTemplate.boundValueOps(getUnbindAccountPhoneKey(device.getString("account_id"))).get();
public JSONObject unbindAccountPhone(JSONObject device, JSONObject phone) {
String codeKeyValueRedis = stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(device.getString("account_id"))).get();
JSONObject result = new JSONObject();
if (codeKeyValueRedis == null) {
throw new BadRequestException("Captcha has expired");
result.put("status","error");
result.put("message","Captcha has expired");
return result;
}
String captcha = codeKeyValueRedis.split("&")[0];
if (!StringUtils.equals(captcha, phone.getString("captcha"))) {
throw new BadRequestException("Verification code is wrong");
result.put("status","error");
result.put("message","Verification code is wrong");
return result;
}
JSONObject account = new JSONObject();
account.put("account_id", device.getString("account_id"));
account.put("contact_phone", "");
account.put("nation_code", "");
account.put("contact_phone", null);
account.put("nation_code", null);
clientAccountMapper.update(account);
deleteUnbindAccountPhoneKey(device.getString("account_id"));
deleteAccountPhoneKey(device.getString("account_id"));
result.put("status","success");
return result;
}
@Override
public void unbindAccountWechat(JSONObject device) {
JSONObject account = new JSONObject();
account.put("account_id", device.getString("account_id"));
account.put("wechat_openid", null);
clientAccountMapper.update(account);
}
@Override
public JSONObject bindAccountWechat(JSONObject device, JSONObject params){
JSONObject user = mpClientAppWechatApiProvider.getApi("merchant-app").appLoginUser(params.getString("code"));
JSONObject result = new JSONObject();
if(user==null){
result.put("status","error");
result.put("message","WeChat users do not exist");
return result;
}
String openId = user.getString("openid");
JSONObject account = clientAccountMapper.findByOpenId(openId);
if(account!=null){
result.put("status","error");
result.put("message","WeChat ID has been bound to other accounts, please unbind it before binding");
return result;
}
JSONObject updateAccount = new JSONObject();
updateAccount.put("account_id", device.getString("account_id"));
updateAccount.put("wechat_openid", openId);
clientAccountMapper.update(updateAccount);
result.put("status","success");
return result;
}
@Override
@ -2540,14 +2623,6 @@ public class RetailAppServiceImp implements RetailAppService {
return BIND_ACCOUNT_PHONE_PREFIX + codeKey;
}
private String getUnbindAccountPhoneKey(String codeKey) {
return UNBIND_ACCOUNT_PHONE_PREFIX + codeKey;
}
private void deleteUnbindAccountPhoneKey(String codeKey) {
stringRedisTemplate.delete(getUnbindAccountPhoneKey(codeKey));
}
private JSONObject getBankAccountByClientId(int client_id) {
List<JSONObject> list = clientBankAccountMapper.clientBankAccounts(client_id);
return list.isEmpty() ? new JSONObject() : list.get(0);

@ -57,7 +57,7 @@ import static au.com.royalpay.payment.tools.CommonConsts.RETAIL_DEVICE;
/**
* Created by yishuqian on 28/03/2017.
*/
@AppClientController
@RestController
@RequestMapping("/api/v1.0/retail/app")
public class RetailAppController {
Logger logger = LoggerFactory.getLogger(getClass());
@ -722,8 +722,9 @@ public class RetailAppController {
* @throws Exception
*/
@PutMapping("/account/phone")
public void bindAccountPhone(@ModelAttribute(RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject phone) throws Exception {
retailAppService.bindAccountPhone(device, phone);
public JSONObject bindAccountPhone(@RequestHeader("X-Device-Info") String device, @RequestBody JSONObject phone) throws Exception {
JSONObject deviceInfo = JSONObject.parseObject(device);
return retailAppService.bindAccountPhone(deviceInfo, phone);
}
/**
@ -734,8 +735,10 @@ public class RetailAppController {
* @throws Exception
*/
@PutMapping("/account/phone/bind")
public void updateAccountPhone(@ModelAttribute(RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject params) throws Exception {
retailAppService.updateAccountPhone(device, params);
// @ModelAttribute(RETAIL_DEVICE) JSONObject device,
public JSONObject updateAccountPhone(@RequestHeader("X-Device-Info") String device, @RequestBody JSONObject params) throws Exception {
JSONObject deviceInfo = JSONObject.parseObject(device);
return retailAppService.updateAccountPhone(deviceInfo, params);
}
/**
@ -746,10 +749,37 @@ public class RetailAppController {
* @throws Exception
*/
@PutMapping("/account/phone/unbind")
public void unbindAccountPhone(@ModelAttribute(RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject params) throws Exception {
retailAppService.unbindAccountPhone(device, params);
// @ModelAttribute(RETAIL_DEVICE) JSONObject device,
public JSONObject unbindAccountPhone(@RequestHeader("X-Device-Info") String device, @RequestBody JSONObject params) throws Exception {
JSONObject deviceInfo = JSONObject.parseObject(device);
return retailAppService.unbindAccountPhone(deviceInfo, params);
}
/**
*
* @param device
* @param params
*/
@PutMapping("/account/wechat/bind")
// @ModelAttribute(RETAIL_DEVICE) JSONObject device,
public JSONObject bindAccountWechat(@RequestHeader("X-Device-Info") String device, @RequestBody JSONObject params){
JSONObject deviceInfo = JSONObject.parseObject(device);
return retailAppService.bindAccountWechat(deviceInfo,params);
}
/**
*
* @param device
*/
@PutMapping("/account/wechat/unbind")
// @ModelAttribute(RETAIL_DEVICE) JSONObject device,
public void unbindAccountWechat(@RequestHeader("X-Device-Info") String device){
JSONObject deviceInfo = JSONObject.parseObject(device);
retailAppService.unbindAccountWechat(deviceInfo);
}
/**

@ -1,15 +1,16 @@
package au.com.royalpay.payment.manage.appclient.web;
import au.com.royalpay.payment.manage.appclient.beans.RetailLoginInfo;
import au.com.royalpay.payment.manage.appclient.core.ManageAppService;
import au.com.royalpay.payment.manage.appclient.core.RetailAppService;
import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.signin.beans.LoginInfo;
import au.com.royalpay.payment.manage.signin.core.SignInStatusManager;
import au.com.royalpay.payment.manage.signin.events.ClientLoginEvent;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.device.DeviceSupport;
import au.com.royalpay.payment.tools.device.ManageDeviceSupport;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.env.RequestEnvironment;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.http.HttpUtils;
@ -22,7 +23,6 @@ import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.RandomStringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.validation.Errors;
@ -59,6 +59,8 @@ public class RetailValidationController implements ApplicationEventPublisherAwar
@Resource
private SimpleClientApplyService simpleClientApplyService;
private ApplicationEventPublisher publisher;
@Resource
private ManageAppService manageAppService;
@Override
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
@ -181,10 +183,10 @@ public class RetailValidationController implements ApplicationEventPublisherAwar
* @param request
* @return
*/
@PostMapping("/send/{phoneNumber}/verify_code")
@PostMapping("/send/{phone_number}/verify_code")
@ResponseBody
public String sendLoginMobileVerifyCode(@PathVariable("phoneNumber") @NotEmpty(message = "phone number can't be null") String phoneNumber,
@RequestParam("nationCode") @NotEmpty(message = "nation code can't be null") String nationCode,
public String sendLoginMobileVerifyCode(@PathVariable("phone_number") String phoneNumber,
@RequestParam("nation_code") @NotEmpty(message = "nation code can't be null") String nationCode,
HttpServletRequest request) {
return simpleClientApplyService.getAndSendLoginSmsCode(phoneNumber, nationCode, request);
}
@ -192,45 +194,79 @@ public class RetailValidationController implements ApplicationEventPublisherAwar
/**
*
*
* @param phoneNumber
* @param contactPhone
* @param nationCode
* @param params
*/
@PostMapping("/login/verify/{phoneNumber}/verify_code")
public JSONObject verifyLoginMobileCode(@PathVariable("phoneNumber") @NotEmpty(message = "phone number can't be null") String phoneNumber,
@RequestParam("nationCode") @NotEmpty(message = "nation code can't be null") String nationCode,
@RequestBody JSONObject params) {
if (params.getString("codeKey").isEmpty() && params.getString("codeKey") == null) {
@PostMapping("/login/verify/{contact_phone}/verify_code")
public JSONObject verifyLoginMobileCode(@PathVariable("contact_phone") String contactPhone,
@RequestParam("nation_code") @NotEmpty(message = "nation code can't be null") String nationCode,
@RequestBody JSONObject params,
@ModelAttribute(CommonConsts.MANAGER_DEVICE) JSONObject device,
Errors errors) {
HttpUtils.handleValidErrors(errors);
if (params.getString("verify_code").isEmpty() && params.getString("verify_code") == null) {
throw new BadRequestException("verify code can't be null");
}
simpleClientApplyService.verifyLoginSMSCode(params.getString("codeKey"), phoneNumber);
nationCode = "+"+nationCode;
simpleClientApplyService.verifyLoginSMSCode(params.getString("verify_code"), contactPhone);
nationCode = nationCode;
JSONObject result = new JSONObject();
String signKey = signInStatusManager.getClientInfoByPhoneStatusKey(phoneNumber, nationCode);
JSONObject client = signInStatusManager.getCurrentClient(signKey);
client = JSON.parseObject(client.toJSONString());
if (params.getString("devId") != null) {
deviceSupport.validDeviceWithClient(client, params.getString("devId"));
}
if(client!=null){
result =client;
client.put("sign_key", signKey);
JSONObject signKeyResult = signInStatusManager.getClientInfoByPhoneStatusKey(contactPhone, nationCode);
if(signKeyResult.getBoolean("account_exist")){
JSONObject client = signInStatusManager.getCurrentClient(signKeyResult.getString("status_key"));
client = JSON.parseObject(client.toJSONString());
if (params.getString("devId") != null) {
deviceSupport.validDeviceWithClient(client, params.getString("devId"));
}
result=client;
result.put("sign_key", signKeyResult.getString("status_key"));
result.put("bind_status", true);
this.publisher.publishEvent(new ClientLoginEvent(this, client.getIntValue("client_id"), client.getString("account_id"), RequestEnvironment.getClientIp(), "MOBILE"));
}else{
result.put("bind_status", false);
result.put("contact_phone",contactPhone);
result.put("nation_code",nationCode);
}
return result;
}
/**
* -
* @param contactPhone
* @param nationCode
* @param params
*/
@PostMapping("/login/mobile/{contact_phone}/bind")
public JSONObject mobileLoginBind(@PathVariable("contact_phone")String contactPhone,
@RequestParam("nation_code") @NotEmpty(message = "nation code can't be null") String nationCode,
@RequestBody JSONObject params,
Errors errors){
HttpUtils.handleValidErrors(errors);
LoginInfo loginInfo = new LoginInfo();
loginInfo.setLoginId(params.getString("loginId"));
loginInfo.setPassword(params.getString("password"));
JSONObject signKey = signInStatusManager.verifyClientAccountLogin(loginInfo,"phone");
JSONObject client = signInStatusManager.getCurrentClient(signKey);
retailAppService.updateLoginClientAccountPhone(client, contactPhone,nationCode);
client = JSON.parseObject(client.toJSONString());
if (params.getString("devId") != null) {
deviceSupport.validDeviceWithClient(client, params.getString("devId"));
}
client.put("sign_key", signKey);
client.put("bind_status", true);
this.publisher.publishEvent(new ClientLoginEvent(this, client.getIntValue("client_id"), client.getString("account_id"), RequestEnvironment.getClientIp(), "MOBILE"));
return client;
}
/**
* App
* @param data
* @return
*/
@PostMapping("/client_app_wechat_signin")
public JSONObject clientAppWechatSignIn(@RequestBody JSONObject data) {
public JSONObject clientAppWechatSignIn(@RequestBody JSONObject data,
Errors errors) {
HttpUtils.handleValidErrors(errors);
JSONObject res = signInStatusManager.clientAppWechatSignIn(data.getString("code"));
if (!res.getBooleanValue("not_exists")) {
deviceSupport.validDeviceWithClient(res, res.getString("app_openid"));
@ -239,5 +275,34 @@ public class RetailValidationController implements ApplicationEventPublisherAwar
return res;
}
/**
*
* @param params
* @return
*/
@PostMapping("/login/wechat_bind")
public JSONObject wechatLoginBind(@RequestBody JSONObject params){
LoginInfo loginInfo = new LoginInfo();
loginInfo.setLoginId(params.getString("loginId"));
loginInfo.setPassword(params.getString("password"));
JSONObject signKeyResult = signInStatusManager.verifyClientAccountLogin(loginInfo,"wechat");
if("error".equals(signKeyResult.getString("status"))){
return signKeyResult;
}
JSONObject client = signInStatusManager.getCurrentClient(signKeyResult.getString("status_key"));
if("error".equals(client.getString("status"))){
return client;
}
retailAppService.updateLoginClientAccountOpenId(client,params);
client = JSON.parseObject(client.toJSONString());
if (params.getString("devId") != null) {
deviceSupport.validDeviceWithClient(client, params.getString("devId"));
}
client.put("sign_key", signKeyResult.getString("status_key"));
client.put("bind_status", true);
client.put("status","success");
this.publisher.publishEvent(new ClientLoginEvent(this, client.getIntValue("client_id"), client.getString("account_id"), RequestEnvironment.getClientIp(), "wechat"));
return client;
}
}

@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.application.beans;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField;
import org.apache.commons.lang3.StringUtils;
import javax.validation.constraints.NotEmpty;
@ -76,15 +77,30 @@ public class ClientPreApplyBean {
private String registered_postcode;
@NotEmpty(message = "logo_url can't be null")
private String logo_url;
@NotEmpty(message = "company_website can't be null")
private String company_website;
@NotEmpty(message = "company_photo can't be null")
private String company_photo;
//@NotEmpty(message = "royalpayindustry can't be null")
@NotEmpty(message = "royalpayindustry can't be null")
private String royalpayindustry;
//@NotEmpty(message = "alipayindustry can't be null")
@NotEmpty(message = "alipayindustry can't be null")
private String alipayindustry;
private String store_photo;
private String contract_url;//合同地址
/* private String contact_job;
private String representative_person;
private String representative_phone;
private String representative_email;
private String representative_job_title;
private String registered_address;
private String registered_suburb;
private String registered_state;
private String registered_postcode;
private String logo_url;
private String company_website;
private String company_photo;
private String royalpayindustry;
private String alipayindustry;*/
public JSONObject insertObject() {
JSONObject res = (JSONObject) JSON.toJSON(this);
@ -394,20 +410,4 @@ public class ClientPreApplyBean {
public void setAlipayindustry(String alipayindustry) {
this.alipayindustry = alipayindustry;
}
public String getContract_url() {
return contract_url;
}
public void setContract_url(String contract_url) {
this.contract_url = contract_url;
}
public String getStore_photo() {
return store_photo;
}
public void setStore_photo(String store_photo) {
this.store_photo = store_photo;
}
}

@ -89,8 +89,6 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
private SignInAccountService signInAccountService;
@Resource
private SimpleClientApplyService simpleClientApplyService;
@Resource
private ClientFilesMapper clientFilesMapper;
private Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private ClientAccountMapper clientAccountMapper;
@ -114,8 +112,8 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
@Resource
private ClientBDMapper clientBDMapper;
private ThreadPoolExecutor pool = new ThreadPoolExecutor(1, 10, 5, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
private final String IMG_AGGREGATE_FILE = "https://file.royalpay.com.au/open/2019/09/06/1567741055646_qeWC7kwqEwsJjRHisJSyAjqnB9nnnh.pdf";
private static final String CLIENT_AGREE_FILE = "client_agree_file";
@Resource
private SmsSender smsSender;
@Resource
@ -365,6 +363,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
JSONObject rate = test.getJSONObject("t"+clean_days.trim());
apply.put("wechat_rate",rate.getString("Wechat"));
apply.put("alipay_rate",rate.getString("Alipay"));
apply.put("alipay_online_rate",rate.getString("AlipayOnline"));
@ -402,27 +401,22 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
ImageIO.write(img, "png", out);
apply.put("img","data:image/png;base64," + Base64.encodeBase64String(out.toByteArray()));
return exportImgAggregateFile(apply);
return exportImgAggregateFile(username, apply);
}
private JSONObject exportImgAggregateFile(JSONObject apply) throws IOException{
private JSONObject exportImgAggregateFile(String username, JSONObject apply) throws IOException{
InputStream stream = null;
JSONObject contractInfo = new JSONObject();
try {
PdfUtils pdu = new PdfUtils();
pdu.setTemplatePdfPath(IMG_AGGREGATE_FILE);
pdu.setPdfTemplate(apply);
File file = new File(apply.getString("username") + "_agreement.pdf");
File file = new File(username + "_agreement.pdf");
ByteArrayOutputStream bos = pdu.templetPdfBos(file,"STSong-Light","UniGB-UCS2-H");
stream = new ByteArrayInputStream(bos.toByteArray());
JSONObject fileInfo = attachmentClient.uploadFile(stream, apply.getString("username") + "_" + System.currentTimeMillis() + "_agreement.pdf", false);
contractInfo.put("contract_url",fileInfo.getString("url"));
JSONObject fileInfo = attachmentClient.uploadFile(stream, username + "_" + System.currentTimeMillis() + "_agreement.pdf", false);
JSONObject applyInfo = new JSONObject();
applyInfo.put("client_pre_apply_id", apply.getIntValue("client_pre_apply_id"));
applyInfo.put("update_time", new Date());
applyInfo.put("contract_url",fileInfo.getString("url"));
sysClientPreMapperMapper.update(applyInfo);
contractInfo.put("contract_url",fileInfo.getString("url"));
} catch (Exception e) {
logger.error("合同制作出现问题:", e);
throw new BadRequestException("合同制作出现问题:" + e.getMessage());
@ -482,7 +476,6 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
sysClient.put("logo_url", apply.getString("logo_url"));
sysClient.put("company_website", apply.getString("company_website"));
sysClient.put("company_photo", apply.getString("company_photo"));
sysClient.put("store_photo",apply.getString("store_photo"));
sysClient.put("contact_email", apply.getString("contact_email"));
sysClient.put("contact_phone", "+61"+apply.getString("contact_phone"));
sysClient.put("company_phone", apply.getString("company_phone"));
@ -505,20 +498,6 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
sysClient.put("ali_sub_merchant_id", clientMoniker);
clientMapper.save(sysClient);
JSONObject fileJson = new JSONObject();
fileJson.put("client_id", sysClient.getIntValue("client_id"));
fileJson.put("last_update_date", new Date());
//fileJson.put("last_update_by", manager.getString("display_name"));
fileJson.put("file_name", CLIENT_AGREE_FILE);
fileJson.put("file_value", apply.getString("contact_url"));
fileJson.put("signature_time", new Date());
//fileJson.put("signature_ip", manager.getString("signature_ip"));
//fileJson.put("user_agent", manager.getString("user_agent"));
//fileJson.put("signature_account_id", signatureAccountId);
fileJson.put("status", 0);
fileJson.put("is_valid", 1);
clientFilesMapper.save(fileJson);
JSONObject representativeInfo = new JSONObject();
representativeInfo.put("client_id", sysClient.getIntValue("client_id"));
representativeInfo.put("representative_person", apply.getString("representative_person"));

@ -5,7 +5,6 @@ import au.com.royalpay.payment.manage.application.beans.ClientPreApplyStep1Bean;
import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService;
import au.com.royalpay.payment.manage.permission.manager.PartnerMapping;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient;
import au.com.royalpay.payment.tools.env.SysConfigManager;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
@ -25,8 +24,6 @@ public class SimpleClientApplyController {
private SimpleClientApplyService simpleClientApplyService;
@Resource
private SysConfigManager sysConfigManager;
@Resource
private AttachmentClient attachmentClient;
@GetMapping("/account/check")
public void checkAccountName(@RequestParam String nation_code,@RequestParam String phone) {
@ -86,11 +83,6 @@ public class SimpleClientApplyController {
return simpleClientApplyService.getClientAggregateFile(username, file,clean_days);
}
@PostMapping("/risk/business/upload/files")
public JSONObject uploadImage(@RequestParam MultipartFile file) throws Exception {
return attachmentClient.uploadFile(file, false);
}
@GetMapping("/info/bank/{bsb_no}")
public JSONObject getBankInfo(@PathVariable String bsb_no, @RequestParam String username, @RequestParam String codeKey) {
simpleClientApplyService.checkOrGenerateRegisterProcessKey(username, codeKey);

@ -28,6 +28,8 @@ public interface SignInAccountService {
JSONObject clientLoginCheck(LoginInfo loginInfo);
JSONObject clientAccountCheck(LoginInfo loginInfo);
void changeManagerPassword(JSONObject manager, ChangePwdBean change);
void changeAccountPassword(JSONObject partnerStatus, ChangePwdBean change);
@ -59,4 +61,5 @@ public interface SignInAccountService {
void deleteManagerCodeKey(String codekey);
JSONObject checkAuthFileStatus(JSONObject client);
}

@ -81,7 +81,12 @@ public interface SignInStatusManager {
* @param nationCode
* @return
*/
String getClientInfoByPhoneStatusKey(String phone,String nationCode);
JSONObject getClientInfoByPhoneStatusKey(String phone,String nationCode);
/**
*
* @param loginInfo
* @return
*/
JSONObject verifyClientAccountLogin(LoginInfo loginInfo,String verfiyType);
}

@ -267,6 +267,13 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
return account;
}
@Override
public JSONObject clientAccountCheck(LoginInfo loginInfo) {
JSONObject account = clientAccountMapper.findByUsername(loginInfo.getLoginId());
validLoginInfo(loginInfo, account);
return account;
}
@Override
public void changeManagerPassword(JSONObject manager, ChangePwdBean change) {
manager = managerMapper.findDetail(manager.getString("manager_id"));

@ -6,6 +6,7 @@ import au.com.royalpay.payment.manage.signin.core.SignInAccountService;
import au.com.royalpay.payment.manage.signin.core.SignInStatusManager;
import au.com.royalpay.payment.tools.connections.mpsupport.MpClientAppWechatApiProvider;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.utils.QRCodeUtils;
@ -60,7 +61,22 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
return null;
}
op.expire(30, TimeUnit.MINUTES);
return signInAccountService.getClient(accountId);
JSONObject result = new JSONObject();
try{
JSONObject account = signInAccountService.getClient(accountId);
if(account.containsKey("wechat_openid")){
result.put("status","error");
result.put("account","The account has been bound to WeChat, please unbind it before binding");
}else{
result.put("status","success");
result.put("account",account);
}
}catch (ForbiddenException e){
result.put("status","error");
result.put("message",e.getMessage());
}
return result;
}
private String partnerLoginRedisKey(String statusKey) {
@ -76,17 +92,48 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
}
@Override
public String getClientInfoByPhoneStatusKey(String phone,String nationCode) {
JSONObject account = clientAccountMapper.findByPhone(phone, nationCode);
public JSONObject getClientInfoByPhoneStatusKey(String phone,String nationCode) {
JSONObject result = new JSONObject();
String statusKey = newStatusKey();
stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getString("account_id") + "", 30, TimeUnit.MINUTES);
return statusKey;
JSONObject account = clientAccountMapper.findByPhone(phone, "+"+nationCode);
if(account==null){
result.put("account_exist",false);
return result;
}
result.put("account_exist",true);
result.put("status_key",statusKey);
stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getString("account_id") + "", 30, TimeUnit.MINUTES);
return result;
}
private String newStatusKey() {
return Long.toHexString(System.currentTimeMillis()) + "_" + RandomStringUtils.random(20, true, true);
}
@Override
public JSONObject verifyClientAccountLogin(LoginInfo loginInfo,String verfiyType){
JSONObject account = signInAccountService.clientAccountCheck(loginInfo);
JSONObject result = new JSONObject();
if("phone".equals(verfiyType)){
if(account.containsKey("contact_phone")){
result.put("status","error");
result.put("message","The account has been linked to the phone number!");
return result;
}
}else{
if(account.containsKey("wechat_openid")){
result.put("status","error");
result.put("message","The account has been linked to the wechat!");
return result;
}
}
String statusKey = newStatusKey();
stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set("" + account.getString("account_id"), 30, TimeUnit.MINUTES);
result.put("status","success");
result.put("status_key",statusKey);
return result;
}
@Override
public String managerSignIn(LoginInfo loginInfo) {
JSONObject manager = signInAccountService.managerLoginCheck(loginInfo);
@ -357,21 +404,24 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
String openId = user.getString("openid");
String unionId = user.getString("unionid");
JSONObject account = signInAccountService.clientWechatAppSignIn(openId);
String statusKey = newStatusKey();
if (account == null) {
account = signInAccountService.clientWechatAppSignInByUnionId(unionId);
if (account == null) {
JSONObject res = new JSONObject();
res.put("bind_status", false);
res.put("app_openid", openId);
res.put("status","success");
return res;
}
}
String statusKey = newStatusKey();
stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getString("account_id") + "", 30, TimeUnit.MINUTES);
account = getCurrentClient(statusKey);
account.put("sign_key", statusKey);
account.put("app_openid", openId);
account.put("bind_status",true);
account.put("status","success");
return account;
}

@ -1,6 +1,48 @@
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.schema-name=royalpay_local
spring.datasource.host=192.168.0.50:3306
spring.datasource.url=jdbc:mysql://${spring.datasource.host}/${spring.datasource.schema-name}?useUnicode=true&characterEncoding=utf8&useSSL=false
spring.datasource.username=root
spring.datasource.password=root
#\u591A\u6570\u636E\u6E90\u914D\u7F6E
spring.datasource.type = com.zaxxer.hikari.HikariDataSource
#\u6570\u636E\u6E90master
#\u7EBF\u4E0A
#spring.datasource.master.schema-name=royalpay_production
#spring.datasource.master.host= 119.28.3.196:3310
#spring.datasource.master.username=readonly
#spring.datasource.master.password=read0nly
#33
spring.datasource.master.schema-name=royalpay_20191011
spring.datasource.master.host= 192.168.1.33:3306
spring.datasource.master.username=root
spring.datasource.master.password=root
#\u672C\u5730
#spring.datasource.master.schema-name=royalpay
#spring.datasource.master.host= 127.0.0.1:3306
#spring.datasource.master.username=root
#spring.datasource.master.password=root
spring.datasource.master.jdbc-url=jdbc:mysql://${spring.datasource.master.host}/${spring.datasource.master.schema-name}?useUnicode=true&characterEncoding=utf8&useSSL=false
#\u6570\u636E\u6E90salve
#\u7EBF\u4E0A
#spring.datasource.slave.schema-name=royalpay_production
#spring.datasource.slave.host= 119.28.3.196:3310
#spring.datasource.slave.username=readonly
#spring.datasource.slave.password=read0nly
#33
spring.datasource.slave.schema-name=royalpay_20191011
spring.datasource.slave.host= 192.168.1.33:3306
spring.datasource.slave.username=root
spring.datasource.slave.password=root
#\u672C\u5730
#spring.datasource.slave.schema-name=royalpay
#spring.datasource.slave.host= 127.0.0.1:3306
#spring.datasource.slave.username=root
#spring.datasource.slave.password=root
spring.datasource.slave.jdbc-url=jdbc:mysql://${spring.datasource.slave.host}/${spring.datasource.slave.schema-name}?useUnicode=true&characterEncoding=utf8&useSSL=false

@ -1,4 +1,4 @@
server.port=5000
server.port=5555
spring.profiles.active=dev,alipay,bestpay,jd,wechat,rpay,yeepay
@ -7,14 +7,14 @@ env.company=RoyalPay
multipart.max-file-size=10Mb
spring.datasource.test-while-idle=true
#连接池检测释放周期
#\u8FDE\u63A5\u6C60\u68C0\u6D4B\u91CA\u653E\u5468\u671F
spring.datasource.time-between-eviction-runs-millis=500
spring.datasource.validation-query=select 1
#最大连接数
#\u6700\u5927\u8FDE\u63A5\u6570
spring.datasource.max-active=1000
spring.datasource.max-pool-prepared-statement-per-connection-size=100
spring.datasource.max-idle=150
#建立连接最大等待时间
#\u5EFA\u7ACB\u8FDE\u63A5\u6700\u5927\u7B49\u5F85\u65F6\u95F4
spring.datasource.max-wait=3000
spring.datasource.filters=stat,wall,log4j
@ -44,12 +44,12 @@ stockholder.mails=leo.huang@royalpay.com.au
app.attachment.host=https://file.royalpay.com.au/
app.attachment.source=03
##合同模板
##\u5408\u540C\u6A21\u677F
app.agreetemplate.classic.path=https://file.royalpay.com.au/open/2017/07/10/1499665073802_qV7fpEuS9rdbTnpa4po6rmbW9CSUfE.pdf
##聚合支付合同模板
##\u805A\u5408\u652F\u4ED8\u5408\u540C\u6A21\u677F
#app.agreetemplate.aggregate.path=https://file.royalpay.com.au/open/2017/11/10/1510280089107_D7CMUz4S1iwBI9IPj5P6ItkiGClmPK.pdf
#app.agreetemplate.aggregate.path=https://file.royalpay.com.au/open/2017/11/17/1510890355946_hQt6yGc0NJ8TYeK7XCuuSAnTI31M7v.pdf
#app.agreetemplate.aggregate.path=https://file.royalpay.com.au/open/2019/02/12/1549950518019_vW4tU5t6D6yA0wMSDNBB9G195W3g99.pdf
app.agreetemplate.aggregate.path=https://file.royalpay.com.au/open/2019/09/06/1567741055646_qeWC7kwqEwsJjRHisJSyAjqnB9nnnh.pdf
app.agreetemplate.aggregate.path=https://file.royalpay.com.au/open/2019/02/12/1549950518019_vW4tU5t6D6yA0wMSDNBB9G195W3g99.pdf
#app.host.main=https://mpay.royalpay.com.au/
#app.host.regions.cn=https://mpay-cn.royalpay.com.au/
@ -70,7 +70,7 @@ app.server.ip=127.0.0.1
app.redpack_auth.enable=false
hf.rsa-file=/opt/2000604000101.pfx
##积分商城
##\u79EF\u5206\u5546\u57CE
app.customer.host=https://customer.royalpay.com.au/
customer.app.appid=customer
customer.app.auth-code=xxnpdBRwd4sIaCCI
@ -90,7 +90,7 @@ mail.send.credentialCode=Fd1aRfdjc9
spring.thymeleaf.mode=HTML
app.mpsupport.host=https://mp.royalpay.com.au
app.mpsupport.host=http://192.168.1.22:9905
app.foreign-currency=AUD
app.ofei.md5-key=Khjx6wejblaJzmG0JBWFlPFKAUxhFIXQ
@ -104,7 +104,7 @@ mail.mailgun.default.merchantlist=merchants@mail.royalpay.com.au
##############
##短信key
##\u77ED\u4FE1key
##############
royalpay.sms.appid=1400094878
royalpay.sms.appkey=43390d81e20c5191c278fbf4cd275be2
@ -113,7 +113,7 @@ im.openim.appkey=24986533
im.openim.secret=96e28e7be21a874177211c31834b5174
app.settle.aes-key=EPrfsM2JE69ZPR7BhXn34g==
#清算银行配置
#\u6E05\u7B97\u94F6\u884C\u914D\u7F6E
settle.abafile.default-bank=CBA
settle.abafile.remains-to=ANZ
@ -137,7 +137,7 @@ settle.abafile.bank.NAB.bsb=013006
settle.abafile.bank.NAB.account-no=837022519
settle.abafile.bank.NAB.account-name=Tunnel Show Pty Ltd
# 瀚银Secure
# \u701A\u94F6Secure
app.hanyin-secure.pid=ROYALPAY
app.hanyin-secure.sftp-host=180.168.61.93
app.hanyin-secure.sftp-port=28480
@ -148,7 +148,19 @@ qcloud.secret-id=AKIDlHdjgWzZliPvBauZFfrnW0MaZOyHdTPz
qcloud.secret-key=YswoQDsIZfWEqEAEvMXS8Yic84lFn9Jp
qcloud.scf.region=ap-hongkong
apple.message.apns.file=
spring.aop.proxy-target-class=true
spring.datasource.hikari.minimum-idle=8
spring.datasource.hikari.maximum-pool-size=50
spring.datasource.hikari.auto-commit=true
spring.datasource.hikari.idle-timeout=60000
spring.datasource.hikari.pool-name=DatebookHikariCP
spring.datasource.hikari.max-lifetime=1800000
spring.datasource.hikari.connection-timeout=60000
spring.datasource.hikari.connection-test-query=SELECT 1
spring.datasource.hikari.validation-timeout = 3000
apple.message.apns.password=
android.message.appkey=
android.message.secret=
apple.message.apns.file=/opt
android.message.secret=
app.tax.type=GST
Loading…
Cancel
Save