Merge remote-tracking branch 'origin/master'

master
liuxinxin 5 years ago
commit 568f58d151

@ -8,10 +8,8 @@
<version>1.1.5</version> <version>1.1.5</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId> <artifactId>manage</artifactId>
<version>1.2.56</version> <version>1.2.72</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>1.6.1</jib-maven-plugin.version> <jib-maven-plugin.version>1.6.1</jib-maven-plugin.version>

@ -189,7 +189,9 @@ public interface RetailAppService {
void updateAccountEmail(JSONObject device, JSONObject codekey); void updateAccountEmail(JSONObject device, JSONObject codekey);
void bindAccountPhone(JSONObject device, JSONObject phone); void sendBindAccountPhone(JSONObject device,JSONObject phone);
void sendUnbindAccountPhone(JSONObject device);
JSONObject updateAccountPhone(JSONObject device,JSONObject codekey); JSONObject updateAccountPhone(JSONObject device,JSONObject codekey);

@ -38,6 +38,8 @@ import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -52,6 +54,7 @@ import java.util.stream.Collectors;
@Service @Service
public class ManageAppServiceImp implements ManageAppService { public class ManageAppServiceImp implements ManageAppService {
private Logger logger = LoggerFactory.getLogger(getClass());
@Resource @Resource
private ManageDeviceSupport manageDeviceSupport; private ManageDeviceSupport manageDeviceSupport;
@ -470,6 +473,7 @@ public class ManageAppServiceImp implements ManageAppService {
throw new BadRequestException("Captcha has been sent.Please check your email or try again in 5 minutes."); throw new BadRequestException("Captcha has been sent.Please check your email or try again in 5 minutes.");
} }
String codeKeyValue = RandomStringUtils.random(6, false, true); String codeKeyValue = RandomStringUtils.random(6, false, true);
logger.debug("send sms code : {} ", codeKeyValue);
Context ctx = new Context(); Context ctx = new Context();
JSONObject manager = managerMapper.findById(device.getString("manager_id")); JSONObject manager = managerMapper.findById(device.getString("manager_id"));
ctx.setVariable("account",manager); ctx.setVariable("account",manager);
@ -512,6 +516,7 @@ public class ManageAppServiceImp implements ManageAppService {
throw new BadRequestException("Captcha has been sent.Please check your phone or try again in 5 minutes."); throw new BadRequestException("Captcha has been sent.Please check your phone or try again in 5 minutes.");
} }
String codeKeyValue = RandomStringUtils.random(6, false, true); String codeKeyValue = RandomStringUtils.random(6, false, true);
logger.debug("send sms code : {} ", codeKeyValue);
String nationCode = phone.getString("nation_code"); String nationCode = phone.getString("nation_code");
String phoneNumber = phone.getString("contact_phone"); String phoneNumber = phone.getString("contact_phone");
ArrayList<String> param = new ArrayList<>(); ArrayList<String> param = new ArrayList<>();

@ -2098,6 +2098,7 @@ public class RetailAppServiceImp implements RetailAppService {
throw new BadRequestException("Captcha has been sent.Please check your email or try again in 5 minutes."); throw new BadRequestException("Captcha has been sent.Please check your email or try again in 5 minutes.");
} }
String codeKeyValue = RandomStringUtils.random(6, false, true); String codeKeyValue = RandomStringUtils.random(6, false, true);
logger.debug("send sms code : {} ", codeKeyValue);
Context ctx = new Context(); Context ctx = new Context();
JSONObject account = clientAccountMapper.findById(device.getString("account_id")); JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
ctx.setVariable("account", account); ctx.setVariable("account", account);
@ -2133,13 +2134,14 @@ public class RetailAppServiceImp implements RetailAppService {
} }
@Override @Override
public void bindAccountPhone(JSONObject device, JSONObject phone) { public void sendBindAccountPhone(JSONObject device, JSONObject phone) {
String codeKey = device.getString("account_id"); String codeKey = device.getString("account_id");
String codeKeyValueRedis = stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(codeKey)).get(); String codeKeyValueRedis = stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(codeKey)).get();
if (StringUtils.isNotEmpty(codeKeyValueRedis)) { if (StringUtils.isNotEmpty(codeKeyValueRedis)) {
throw new BadRequestException("Captcha has been sent.Please check your phone or try again in 1 minutes."); throw new BadRequestException("Captcha has been sent.Please check your phone or try again in 1 minutes.");
} }
String codeKeyValue = RandomStringUtils.random(6, false, true); String codeKeyValue = RandomStringUtils.random(6, false, true);
logger.debug("send sms code : {} ", codeKeyValue);
String nationCode = phone.getString("nation_code").contains("+")?phone.getString("nation_code").substring(1):phone.getString("nation_code"); String nationCode = phone.getString("nation_code").contains("+")?phone.getString("nation_code").substring(1):phone.getString("nation_code");
String phoneNumber = phone.getString("contact_phone"); String phoneNumber = phone.getString("contact_phone");
ArrayList<String> param = new ArrayList<>(); ArrayList<String> param = new ArrayList<>();
@ -2155,6 +2157,30 @@ public class RetailAppServiceImp implements RetailAppService {
} }
stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(codeKey)).set(codeKeyValue + "&" + nationCode + "&" + phoneNumber, Long.parseLong(expireMin), TimeUnit.MINUTES); stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(codeKey)).set(codeKeyValue + "&" + nationCode + "&" + phoneNumber, Long.parseLong(expireMin), TimeUnit.MINUTES);
} }
@Override
public void sendUnbindAccountPhone(JSONObject device) {
String codeKey = device.getString("account_id");
String codeKeyValueRedis = stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(codeKey)).get();
if (StringUtils.isNotEmpty(codeKeyValueRedis)) {
throw new BadRequestException("Captcha has been sent.Please check your phone or try again in 1 minutes.");
}
JSONObject client = clientAccountMapper.findById(device.getString("account_id"));
String codeKeyValue = RandomStringUtils.random(6, false, true);
String nationCode = client.getString("nation_code").contains("+")?client.getString("nation_code").substring(1):client.getString("nation_code");
String phoneNumber = client.getString("contact_phone");
ArrayList<String> param = new ArrayList<>();
param.add("解綁绑定手机号");
param.add(codeKeyValue);
String expireMin = "1";
param.add(expireMin);
try {
smsSender.getSender().sendWithParam(nationCode.trim(), phoneNumber, BIND_PHONE_TEMPLID, param, "RoyalPay", "", "");
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new BadRequestException("Phone number is wrong.Please try again.");
}
stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(codeKey)).set(codeKeyValue + "&" + nationCode + "&" + phoneNumber, Long.parseLong(expireMin), TimeUnit.MINUTES);
}
@Override @Override
public JSONObject updateAccountPhone(JSONObject device, JSONObject params) { public JSONObject updateAccountPhone(JSONObject device, JSONObject params) {
@ -2169,7 +2195,7 @@ public class RetailAppServiceImp implements RetailAppService {
if (!StringUtils.equals(captcha, params.getString("captcha"))) { if (!StringUtils.equals(captcha, params.getString("captcha"))) {
throw new BadRequestException("Verification code is wrong"); throw new BadRequestException("Verification code is wrong");
} }
JSONObject account = clientAccountMapper.findByPhone(contactPhone, "+" + nationCode); List<JSONObject> account = clientAccountMapper.findByPhone(contactPhone, "+" + nationCode);
if (account != null) { if (account != null) {
throw new BadRequestException("Mobile phone number has been bound to other users, please unbind it before binding"); throw new BadRequestException("Mobile phone number has been bound to other users, please unbind it before binding");
} }
@ -2270,7 +2296,7 @@ public class RetailAppServiceImp implements RetailAppService {
result.put("contact_phone",account.getString("contact_phone")); result.put("contact_phone",account.getString("contact_phone"));
String contact_phone = account.getString("contact_phone").replaceAll("(\\d{3})\\d{4}(\\d{4})","$1****$2"); String contact_phone = account.getString("contact_phone").replaceAll("(\\d{3})\\d{4}(\\d{4})","$1****$2");
result.put("remark_contact_phone",contact_phone); result.put("remark_contact_phone",contact_phone);
result.put("naticon_code",account.getString("nation_code")); result.put("nation_code",account.getString("nation_code"));
} }
result.put("wechat_bind_status",account.containsKey("wechat_openid")); result.put("wechat_bind_status",account.containsKey("wechat_openid"));
if(account.containsKey("wechat_openid")){ if(account.containsKey("wechat_openid")){

@ -728,9 +728,21 @@ public class RetailAppController {
* @param phone contact_phone * @param phone contact_phone
* @throws Exception * @throws Exception
*/ */
@PutMapping("/account/phone") @PutMapping("/account/phone_verify/bind")
public JSONObject bindAccountPhone(@ModelAttribute(RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject phone) throws Exception { public JSONObject sendBindAccountPhone(@ModelAttribute(RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject phone) throws Exception {
retailAppService.bindAccountPhone(device, phone); retailAppService.sendBindAccountPhone(device, phone);
return new JSONObject();
}
/**
*
*
* @param device
* @throws Exception
*/
@PutMapping("/account/phone_verify/unbind")
public JSONObject unBindAccountPhone(@ModelAttribute(RETAIL_DEVICE) JSONObject device) throws Exception {
retailAppService.sendUnbindAccountPhone(device);
return new JSONObject(); return new JSONObject();
} }

@ -208,7 +208,7 @@ public class RetailValidationController implements ApplicationEventPublisherAwar
HttpUtils.handleValidErrors(errors); HttpUtils.handleValidErrors(errors);
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
simpleClientApplyService.verifyLoginSMSCode(params.getString("verify_code"), contactPhone); simpleClientApplyService.verifyLoginSMSCode(params.getString("verify_code"), contactPhone);
String signKey = signInStatusManager.getClientInfoByPhoneStatusKey(contactPhone, nationCode,RequestEnvironment.getClientIp()); String signKey = signInStatusManager.getClientInfoByPhoneStatusKey(contactPhone, nationCode);
if(signKey!=null){ if(signKey!=null){
JSONObject account = signInStatusManager.getCurrentClient(signKey); JSONObject account = signInStatusManager.getCurrentClient(signKey);
account = JSON.parseObject(account.toJSONString()); account = JSON.parseObject(account.toJSONString());
@ -247,7 +247,7 @@ public class RetailValidationController implements ApplicationEventPublisherAwar
loginInfo.setLoginId(params.getString("loginId")); loginInfo.setLoginId(params.getString("loginId"));
loginInfo.setPassword(params.getString("password")); loginInfo.setPassword(params.getString("password"));
String signKey = signInStatusManager.verifyClientAccountLogin(loginInfo,"phone"); String signKey = signInStatusManager.verifyClientAccountLogin(loginInfo,"phone");
signInStatusManager.verifyClientLoginPhoneBindCode(contactPhone,nationCode,RequestEnvironment.getClientIp()); signInStatusManager.verifyClientLoginPhoneBindCode(contactPhone,nationCode);
JSONObject account = signInStatusManager.getCurrentClient(signKey); JSONObject account = signInStatusManager.getCurrentClient(signKey);
retailAppService.updateLoginClientAccountPhone(account, contactPhone,nationCode); retailAppService.updateLoginClientAccountPhone(account, contactPhone,nationCode);
account.put("sign_key", signKey); account.put("sign_key", signKey);
@ -271,7 +271,7 @@ public class RetailValidationController implements ApplicationEventPublisherAwar
public JSONObject clientAppWechatSignIn(@RequestBody JSONObject params, public JSONObject clientAppWechatSignIn(@RequestBody JSONObject params,
Errors errors) { Errors errors) {
HttpUtils.handleValidErrors(errors); HttpUtils.handleValidErrors(errors);
JSONObject account = signInStatusManager.clientAppWechatSignIn(params.getString("code"),RequestEnvironment.getClientIp()); JSONObject account = signInStatusManager.clientAppWechatSignIn(params.getString("code"));
if(!account.getBoolean("bind_status")){ if(!account.getBoolean("bind_status")){
deviceSupport.validDeviceWithClient(account, params.getString("app_openid")); deviceSupport.validDeviceWithClient(account, params.getString("app_openid"));
return account; return account;
@ -287,11 +287,11 @@ public class RetailValidationController implements ApplicationEventPublisherAwar
*/ */
@PostMapping("/login/wechat_bind") @PostMapping("/login/wechat_bind")
public JSONObject wechatLoginBind(@RequestBody JSONObject params){ public JSONObject wechatLoginBind(@RequestBody JSONObject params){
JSONObject wechatInfo = signInStatusManager.verifyClientLoginWechatBindCode(params.getString("wechat_openid"),RequestEnvironment.getClientIp());
LoginInfo loginInfo = new LoginInfo(); LoginInfo loginInfo = new LoginInfo();
loginInfo.setLoginId(params.getString("loginId")); loginInfo.setLoginId(params.getString("loginId"));
loginInfo.setPassword(params.getString("password")); loginInfo.setPassword(params.getString("password"));
String signKey = signInStatusManager.verifyClientAccountLogin(loginInfo,"wechat"); String signKey = signInStatusManager.verifyClientAccountLogin(loginInfo,"wechat");
JSONObject wechatInfo = signInStatusManager.verifyClientLoginWechatBindCode(params.getString("wechat_openid"));
JSONObject account = signInStatusManager.getCurrentClient(signKey); JSONObject account = signInStatusManager.getCurrentClient(signKey);
params.put("nick_name",wechatInfo.getString("nick_name")); params.put("nick_name",wechatInfo.getString("nick_name"));
params.put("union_id",wechatInfo.getString("union_id")); params.put("union_id",wechatInfo.getString("union_id"));

@ -170,6 +170,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
param.add(registerClientCode); param.add(registerClientCode);
String expireMin = "3"; String expireMin = "3";
param.add(expireMin); param.add(expireMin);
logger.debug("send sms code : {} ", registerClientCode);
try { try {
if(request.getLocales().nextElement().equals(Locale.CHINESE)|| request.getLocales().nextElement().equals(Locale.SIMPLIFIED_CHINESE)){ 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", "", ""); smsSender.getSender().sendWithParam(nationCode.trim(), phoneNumber, REGISTER_CLIENT_TEMPLID, param, "RoyalPay", "", "");
@ -279,7 +280,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
if (!nation_code.startsWith("+")) { if (!nation_code.startsWith("+")) {
nation_code = "+" + nation_code; nation_code = "+" + nation_code;
} }
JSONObject account = clientAccountMapper.findByPhone(contact_phone, nation_code); List<JSONObject> account = clientAccountMapper.findByPhone(contact_phone, nation_code);
if (account != null) { if (account != null) {
throw new ForbiddenException("用户名已被注册"); throw new ForbiddenException("用户名已被注册");
} }
@ -597,7 +598,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
} }
JSONObject apply = sysClientPreMapperMapper.findByUserName(username); JSONObject apply = sysClientPreMapperMapper.findByUserName(username);
JSONObject account = clientAccountMapper.findByPhone(apply.getString("contact_phone"), "+61"); List<JSONObject> account = clientAccountMapper.findByPhone(apply.getString("contact_phone"), "+61");
if (account != null) { if (account != null) {
throw new ForbiddenException("The user name has been registered"); throw new ForbiddenException("The user name has been registered");
} }
@ -769,7 +770,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
Runnable task2 = () -> { Runnable task2 = () -> {
try { try {
if (signInfo != null) { if (signInfo != null) {
clientManager.registerClientApplyGMS(clientMoniker, sysAccount.getString("account_id")); // clientManager.registerClientApplyGMS(clientMoniker, sysAccount.getString("account_id"));
}else { }else {
clientManager.getNewAggregateAgreeFile(clientMoniker, null, true); clientManager.getNewAggregateAgreeFile(clientMoniker, null, true);
} }
@ -872,6 +873,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
param.add("RoyalPay"); param.add("RoyalPay");
param.add(registerClientCode); param.add(registerClientCode);
String expireMin = "1"; String expireMin = "1";
logger.debug("{} phone sms send code :{}",phoneNumber,registerClientCode);
param.add(expireMin); param.add(expireMin);
try { try {
if(request.getLocales().nextElement().equals(Locale.CHINESE)|| request.getLocales().nextElement().equals(Locale.SIMPLIFIED_CHINESE)){ if(request.getLocales().nextElement().equals(Locale.CHINESE)|| request.getLocales().nextElement().equals(Locale.SIMPLIFIED_CHINESE)){

@ -28,7 +28,7 @@ public interface ClientAccountMapper {
@AutoSql(type = SqlType.SELECT) @AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1") @AdvanceSelect(addonWhereClause = "is_valid=1")
JSONObject findByPhone(@Param("contact_phone") String contact_phone,@Param("nation_code")String nation_code); List<JSONObject> findByPhone(@Param("contact_phone") String contact_phone,@Param("nation_code")String nation_code);
@AutoSql(type = SqlType.SELECT) @AutoSql(type = SqlType.SELECT)
JSONObject findDetail(@Param("account_id") String accountId); JSONObject findDetail(@Param("account_id") String accountId);

@ -100,12 +100,12 @@ public class SubMerchantIdApply {
this.merchant_name = merchant_name; this.merchant_name = merchant_name;
} }
public String getMerchant_shortname() { public String getMerchant_storename() {
return this.merchant_storename; return this.merchant_storename;
} }
public void setMerchant_shortname(String merchant_shortname) { public void setMerchant_storename(String merchant_storename) {
this.merchant_storename = merchant_shortname; this.merchant_storename = merchant_storename;
} }
public String getOffice_phone() { public String getOffice_phone() {

@ -420,15 +420,13 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
client.put("temp_sub_merchant", checkSubMerchantIdInCommonPool(subMerchantId)); client.put("temp_sub_merchant", checkSubMerchantIdInCommonPool(subMerchantId));
} }
} }
if (client.getIntValue("approve_result") == 1
|| (client.getIntValue("approve_result") == 2 && (client.getIntValue("source") == 1 || client.getIntValue("source") == 2))) {
try { try {
JSONObject activeRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Wechat"); JSONObject activeRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Wechat");
if (activeRate != null) { if (activeRate != null) {
client.put("rate_value", activeRate.getDouble("rate_value")); client.put("rate_value", activeRate.getDouble("rate_value"));
} }
} catch (Exception ignore) { } catch (Exception ignore) {
}
} }
client.put("max_customer_surcharge_rate", PlatformEnvironment.getEnv().getMaxCustomerSurchargeRate()); client.put("max_customer_surcharge_rate", PlatformEnvironment.getEnv().getMaxCustomerSurchargeRate());
if (client.getBigDecimal("rate_value") != null) { if (client.getBigDecimal("rate_value") != null) {
@ -522,6 +520,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override @Override
public void exportClients(JSONObject manager, PartnerQuery query, HttpServletResponse resp) { public void exportClients(JSONObject manager, PartnerQuery query, HttpServletResponse resp) {
JSONObject params = prepareListClientsParameter(manager, query); JSONObject params = prepareListClientsParameter(manager, query);
logger.info("exporting_clients:--->{}", params);
JSONObject retResp = serverlessFunctionTrigger.triggerFunction("export_merchants", params); JSONObject retResp = serverlessFunctionTrigger.triggerFunction("export_merchants", params);
String contentB64 = retResp.getString("content"); String contentB64 = retResp.getString("content");
resp.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); resp.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
@ -1556,7 +1555,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
checkOrgPermission(manager, client); checkOrgPermission(manager, client);
if (StringUtils.isNotBlank(account.getContactPhone())) {
checkPhoneAndWechatExist(account); checkPhoneAndWechatExist(account);
}
JSONObject accountJson = account.toJson(); JSONObject accountJson = account.toJson();
JSONObject accountCheck = clientAccountMapper.findByUsernameForDuplicate(accountJson.getString("username")); JSONObject accountCheck = clientAccountMapper.findByUsernameForDuplicate(accountJson.getString("username"));
if (accountCheck != null) { if (accountCheck != null) {
@ -1578,10 +1579,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
private void checkPhoneAndWechatExist(NewAccountBean account) { private void checkPhoneAndWechatExist(NewAccountBean account) {
if (clientAccountMapper.findByPhone(account.getContactPhone(), "+" + account.getNation_code()) != null) { if (clientAccountMapper.findByPhone(account.getContactPhone(), account.getNation_code().startsWith("+")?account.getNation_code():"+"+account.getNation_code()) != null) {
throw new BadRequestException("Mobile phone number has been bound to other accounts"); throw new BadRequestException("Mobile phone number has been bound to other accounts");
} }
;
} }
@Override @Override
@ -3615,7 +3615,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
Date endDate = TimeZoneUtils.nextYearByCurrDay(); Date endDate = TimeZoneUtils.nextYearByCurrDay();
String end_date = DateFormatUtils.format(endDate, "dd/MM/yyyy"); String end_date = DateFormatUtils.format(endDate, "dd/MM/yyyy");
client.put("end_date", end_date); client.put("end_date", end_date);
client.put("full_name", URLDecoder.decode(file.getOriginalFilename(),"UTF-8")); client.put("full_name", URLDecoder.decode(file.getOriginalFilename(), "UTF-8"));
BufferedImage img = ImageIO.read(file.getInputStream()); BufferedImage img = ImageIO.read(file.getInputStream());
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();
ImageIO.write(img, "png", out); ImageIO.write(img, "png", out);
@ -4976,11 +4976,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
String[] payType = clientConfig.getString("client_pay_type").split(","); String[] payType = clientConfig.getString("client_pay_type").split(",");
if (Arrays.asList(payType).contains("1")) { if (Arrays.asList(payType).contains("1")) {
registerAlipayOnlineGms(clientMoniker, null); registerAlipayOnlineGms(clientMoniker, null);
switchChannelPermission(account, clientMoniker, "Alipay", true); enableGatewayAlipayOnline(account, clientMoniker, true);
} }
if (Arrays.asList(payType).contains("2")) { if (Arrays.asList(payType).contains("2")) {
registerAlipayGms(clientMoniker, null); registerAlipayGms(clientMoniker, null);
enableGatewayAlipayOnline(account, clientMoniker, true); switchChannelPermission(account, clientMoniker, "Alipay", true);
} }
} }
} }
@ -5293,12 +5293,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new BadRequestException("The Partner's Bank Account is not config!"); throw new BadRequestException("The Partner's Bank Account is not config!");
} }
JSONObject representativeInfo = sysClientLegalPersonMapper.findRepresentativeInfo(client.getIntValue("client_id")); JSONObject representativeInfo = sysClientLegalPersonMapper.findRepresentativeInfo(client.getIntValue("client_id"));
for(String str:representativeInfo.keySet()){ for (String str : representativeInfo.keySet()) {
if(representativeInfo.getString(str) == null || !(representativeInfo.getString(str).length()>0)|| !(client.getString("contact_job")!=null && client.getString("contact_job").length()>0)) { if (representativeInfo.getString(str) == null || !(representativeInfo.getString(str).length() > 0) || !(client.getString("contact_job") != null && client.getString("contact_job").length() > 0)) {
throw new BadRequestException("The LegalPersonInfo is not config!Please upgrade the RoyalPay App version"); throw new BadRequestException("The LegalPersonInfo is not config!Please upgrade the RoyalPay App version");
} }
} }
if ( !(StringUtils.isNotBlank(client.getString("client_pay_type"))) || !(StringUtils.isNotBlank(client.getString("client_pay_desc"))) ) { if (!(StringUtils.isNotBlank(client.getString("client_pay_type"))) || !(StringUtils.isNotBlank(client.getString("client_pay_desc")))) {
throw new BadRequestException("Merchant Payment Scenario is not config!"); throw new BadRequestException("Merchant Payment Scenario is not config!");
} }

@ -73,7 +73,7 @@ public interface SignInStatusManager {
* @param code * @param code
* @return * @return
*/ */
JSONObject clientAppWechatSignIn(String code,String ip); JSONObject clientAppWechatSignIn(String code);
/** /**
* *
@ -81,7 +81,7 @@ public interface SignInStatusManager {
* @param nationCode * @param nationCode
* @return * @return
*/ */
String getClientInfoByPhoneStatusKey(String phone,String nationCode,String ip); String getClientInfoByPhoneStatusKey(String phone,String nationCode);
/** /**
* *
@ -93,17 +93,15 @@ public interface SignInStatusManager {
/** /**
* openId * openId
* @param codeId * @param codeId
* @param ip
* @return * @return
*/ */
JSONObject verifyClientLoginWechatBindCode (String codeId,String ip); JSONObject verifyClientLoginWechatBindCode (String codeId);
/** /**
* *
* @param phone * @param phone
* @param nationCode * @param nationCode
* @param ip
* @return * @return
*/ */
void verifyClientLoginPhoneBindCode (String phone,String nationCode,String ip); void verifyClientLoginPhoneBindCode (String phone,String nationCode);
} }

@ -82,12 +82,12 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
} }
@Override @Override
public String getClientInfoByPhoneStatusKey(String phone, String nationCode,String ip) { public String getClientInfoByPhoneStatusKey(String phone, String nationCode) {
String statusKey = newStatusKey(); String statusKey = newStatusKey();
JSONObject account = clientAccountMapper.findOneByPhoneAndCreateTimeDesc(phone, "+" + nationCode); JSONObject account = clientAccountMapper.findOneByPhoneAndCreateTimeDesc(phone, "+" + nationCode);
if (account == null) { if (account == null) {
String expireMin = "5"; String expireMin = "5";
stringRedisTemplate.boundValueOps(getClientLoginPhoneBindRedisKey(phone,nationCode,ip)).set(phone, Long.parseLong(expireMin), TimeUnit.MINUTES); stringRedisTemplate.boundValueOps(getClientLoginPhoneBindRedisKey(phone,nationCode)).set(phone, Long.parseLong(expireMin), TimeUnit.MINUTES);
return null; return null;
} }
stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getString("account_id") + "", 30, TimeUnit.MINUTES); stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getString("account_id") + "", 30, TimeUnit.MINUTES);
@ -380,7 +380,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
} }
@Override @Override
public JSONObject clientAppWechatSignIn(String code,String ip) { public JSONObject clientAppWechatSignIn(String code) {
JSONObject user = mpClientAppWechatApiProvider.getApi("merchant-app").appLoginUser(code); JSONObject user = mpClientAppWechatApiProvider.getApi("merchant-app").appLoginUser(code);
if(user==null){ if(user==null){
throw new BadRequestException("WeChat users do not exist"); throw new BadRequestException("WeChat users do not exist");
@ -396,7 +396,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
res.put("app_openid", openId); res.put("app_openid", openId);
res.put("status", "success"); res.put("status", "success");
String expireMin = "5"; String expireMin = "5";
stringRedisTemplate.boundValueOps(getClientLoginWechatBindRedisKey(openId,ip)).set(openId+"&"+nickName+"&"+unionId, Long.parseLong(expireMin), TimeUnit.MINUTES); stringRedisTemplate.boundValueOps(getClientLoginWechatBindRedisKey(openId)).set(openId+"&"+nickName+"&"+unionId, Long.parseLong(expireMin), TimeUnit.MINUTES);
return res; return res;
} }
String statusKey = newStatusKey(); String statusKey = newStatusKey();
@ -411,14 +411,14 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
return result; return result;
} }
private String getClientLoginWechatBindRedisKey(String openId,String ip){ private String getClientLoginWechatBindRedisKey(String openId){
return "login:"+":"+CLIENT_LOGIN_WECHAT_BIND_PREFIX + "&"+openId+"&"+ip; return "login:"+":"+CLIENT_LOGIN_WECHAT_BIND_PREFIX + "&"+openId;
} }
@Override @Override
public JSONObject verifyClientLoginWechatBindCode(String openId,String ip){ public JSONObject verifyClientLoginWechatBindCode(String openId){
String rediskey = getClientLoginWechatBindRedisKey(openId,ip); String rediskey = getClientLoginWechatBindRedisKey(openId);
String codeValue = stringRedisTemplate.boundValueOps(rediskey).get(); String codeValue = stringRedisTemplate.boundValueOps(rediskey).get();
if (codeValue == null || !codeValue.split("&")[0].equals(openId)) { if (codeValue == null || !codeValue.split("&")[0].equals(openId)) {
throw new BadRequestException("The WeChat ID does not apply for binding"); throw new BadRequestException("The WeChat ID does not apply for binding");
@ -432,12 +432,12 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
}}; }};
} }
private String getClientLoginPhoneBindRedisKey(String phone,String nationCode,String ip){ private String getClientLoginPhoneBindRedisKey(String phone,String nationCode){
return "login:"+CLIENT_LOGIN_PHONE_BIND_PREFIX + "&"+nationCode+"&"+phone+"&"+ip; return "login:"+CLIENT_LOGIN_PHONE_BIND_PREFIX + "&"+nationCode+"&"+phone;
} }
public void verifyClientLoginPhoneBindCode(String phone,String nationCode,String ip){ public void verifyClientLoginPhoneBindCode(String phone,String nationCode){
String rediskey = getClientLoginPhoneBindRedisKey(phone,nationCode,ip); String rediskey = getClientLoginPhoneBindRedisKey(phone,nationCode);
String codeValue = stringRedisTemplate.boundValueOps(rediskey).get(); String codeValue = stringRedisTemplate.boundValueOps(rediskey).get();
if (codeValue == null || !codeValue.equals(phone)) { if (codeValue == null || !codeValue.equals(phone)) {
throw new BadRequestException("The phone number is for application binding"); throw new BadRequestException("The phone number is for application binding");

Loading…
Cancel
Save