|
|
|
@ -1,14 +1,16 @@
|
|
|
|
|
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.core.SignInAccountService;
|
|
|
|
|
import au.com.royalpay.payment.manage.signin.core.SignInStatusManager;
|
|
|
|
|
import au.com.royalpay.payment.tools.connections.mpsupport.WechatAppApi;
|
|
|
|
|
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
|
|
|
|
|
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 com.alibaba.fastjson.JSONObject;
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang.RandomStringUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
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.web.servlet.ModelAndView;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Created by yixian on 2016-06-29.
|
|
|
|
|
*/
|
|
|
|
@ -67,7 +70,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
|
|
|
|
|
public String partnerSignIn(LoginInfo loginInfo) {
|
|
|
|
|
JSONObject account = signInAccountService.clientLoginCheck(loginInfo);
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -206,7 +209,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
|
|
|
|
|
public void clientQRCodeSignIn(String codeId, String openid, ModelAndView view) {
|
|
|
|
|
JSONObject account = signInAccountService.clientWechatSignIn(openid);
|
|
|
|
|
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);
|
|
|
|
|
JSONObject res = new JSONObject();
|
|
|
|
|
res.put("notitle", true);
|
|
|
|
@ -240,7 +243,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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.put("sign_key", statusKey);
|
|
|
|
|
account.put("app_openid", openId);
|
|
|
|
@ -251,7 +254,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
|
|
|
|
|
public String clientWechatSignIn(String openid) {
|
|
|
|
|
JSONObject account = signInAccountService.clientWechatSignIn(openid);
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -283,7 +286,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
|
|
|
|
|
if (account == null || account.size() <= 0) {
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -297,7 +300,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
|
|
|
|
|
if (account == null || account.size() <= 0) {
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|