|
|
@ -1,14 +1,16 @@
|
|
|
|
package au.com.royalpay.payment.manage.signin.core.impls;
|
|
|
|
package au.com.royalpay.payment.manage.signin.core.impls;
|
|
|
|
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.manage.signin.beans.LoginInfo;
|
|
|
|
import au.com.royalpay.payment.manage.signin.beans.LoginInfo;
|
|
|
|
import au.com.royalpay.payment.manage.signin.core.SignInAccountService;
|
|
|
|
import au.com.royalpay.payment.manage.signin.core.SignInAccountService;
|
|
|
|
import au.com.royalpay.payment.manage.signin.core.SignInStatusManager;
|
|
|
|
import au.com.royalpay.payment.manage.signin.core.SignInStatusManager;
|
|
|
|
import au.com.royalpay.payment.tools.connections.mpsupport.WechatAppApi;
|
|
|
|
import au.com.royalpay.payment.tools.connections.mpsupport.WechatAppApi;
|
|
|
|
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
|
|
|
|
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
|
|
|
|
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;
|
|
|
|
import au.com.royalpay.payment.tools.utils.QRCodeUtils;
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang.RandomStringUtils;
|
|
|
|
import org.apache.commons.lang.RandomStringUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.data.redis.core.BoundValueOperations;
|
|
|
|
import org.springframework.data.redis.core.BoundValueOperations;
|
|
|
@ -16,9 +18,10 @@ import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Created by yixian on 2016-06-29.
|
|
|
|
* Created by yixian on 2016-06-29.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -67,7 +70,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
|
|
|
|
public String partnerSignIn(LoginInfo loginInfo) {
|
|
|
|
public String partnerSignIn(LoginInfo loginInfo) {
|
|
|
|
JSONObject account = signInAccountService.clientLoginCheck(loginInfo);
|
|
|
|
JSONObject account = signInAccountService.clientLoginCheck(loginInfo);
|
|
|
|
String statusKey = newStatusKey();
|
|
|
|
String statusKey = newStatusKey();
|
|
|
|
stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getIntValue("account_id") + "", 30, TimeUnit.MINUTES);
|
|
|
|
stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getString("account_id") + "", 30, TimeUnit.MINUTES);
|
|
|
|
return statusKey;
|
|
|
|
return statusKey;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -206,7 +209,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
|
|
|
|
public void clientQRCodeSignIn(String codeId, String openid, ModelAndView view) {
|
|
|
|
public void clientQRCodeSignIn(String codeId, String openid, ModelAndView view) {
|
|
|
|
JSONObject account = signInAccountService.clientWechatSignIn(openid);
|
|
|
|
JSONObject account = signInAccountService.clientWechatSignIn(openid);
|
|
|
|
String statusKey = newStatusKey();
|
|
|
|
String statusKey = newStatusKey();
|
|
|
|
stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getIntValue("account_id") + "", 30, TimeUnit.MINUTES);
|
|
|
|
stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getString("account_id") + "", 30, TimeUnit.MINUTES);
|
|
|
|
stringRedisTemplate.boundValueOps(redisPrefix + ":client_qrcode_signin:code:" + codeId).set(statusKey, 1, TimeUnit.MINUTES);
|
|
|
|
stringRedisTemplate.boundValueOps(redisPrefix + ":client_qrcode_signin:code:" + codeId).set(statusKey, 1, TimeUnit.MINUTES);
|
|
|
|
JSONObject res = new JSONObject();
|
|
|
|
JSONObject res = new JSONObject();
|
|
|
|
res.put("notitle", true);
|
|
|
|
res.put("notitle", true);
|
|
|
@ -240,7 +243,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String statusKey = newStatusKey();
|
|
|
|
String statusKey = newStatusKey();
|
|
|
|
stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getIntValue("account_id") + "", 30, TimeUnit.MINUTES);
|
|
|
|
stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getString("account_id") + "", 30, TimeUnit.MINUTES);
|
|
|
|
account = getCurrentClient(statusKey);
|
|
|
|
account = getCurrentClient(statusKey);
|
|
|
|
account.put("sign_key", statusKey);
|
|
|
|
account.put("sign_key", statusKey);
|
|
|
|
account.put("app_openid", openId);
|
|
|
|
account.put("app_openid", openId);
|
|
|
@ -251,7 +254,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
|
|
|
|
public String clientWechatSignIn(String openid) {
|
|
|
|
public String clientWechatSignIn(String openid) {
|
|
|
|
JSONObject account = signInAccountService.clientWechatSignIn(openid);
|
|
|
|
JSONObject account = signInAccountService.clientWechatSignIn(openid);
|
|
|
|
String statusKey = newStatusKey();
|
|
|
|
String statusKey = newStatusKey();
|
|
|
|
stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getIntValue("account_id") + "", 30, TimeUnit.MINUTES);
|
|
|
|
stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getString("account_id") + "", 30, TimeUnit.MINUTES);
|
|
|
|
return statusKey;
|
|
|
|
return statusKey;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -283,7 +286,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
|
|
|
|
if (account == null || account.size() <= 0) {
|
|
|
|
if (account == null || account.size() <= 0) {
|
|
|
|
throw new ForbiddenException("用户不存在或已禁用");
|
|
|
|
throw new ForbiddenException("用户不存在或已禁用");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set("" + account.getIntValue("account_id"), 30, TimeUnit.MINUTES);
|
|
|
|
stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set("" + account.getString("account_id"), 30, TimeUnit.MINUTES);
|
|
|
|
stringRedisTemplate.boundValueOps(redisPrefix + ":app_qrcode_signin:code:" + codeId).set(statusKey, 1, TimeUnit.MINUTES);
|
|
|
|
stringRedisTemplate.boundValueOps(redisPrefix + ":app_qrcode_signin:code:" + codeId).set(statusKey, 1, TimeUnit.MINUTES);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -297,7 +300,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
|
|
|
|
if (account == null || account.size() <= 0) {
|
|
|
|
if (account == null || account.size() <= 0) {
|
|
|
|
throw new ForbiddenException("用户不存在或已禁用");
|
|
|
|
throw new ForbiddenException("用户不存在或已禁用");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set("" + account.getIntValue("account_id"), 30, TimeUnit.MINUTES);
|
|
|
|
stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set("" + account.getString("account_id"), 30, TimeUnit.MINUTES);
|
|
|
|
stringRedisTemplate.boundValueOps(redisPrefix + ":app_qrcode_signin:code:" + codeId).set(statusKey, 1, TimeUnit.MINUTES);
|
|
|
|
stringRedisTemplate.boundValueOps(redisPrefix + ":app_qrcode_signin:code:" + codeId).set(statusKey, 1, TimeUnit.MINUTES);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|