|
|
@@ -217,7 +217,43 @@ public class LoginService {
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
- public Object sendUserInfo(String uuid) {
|
|
|
+ public JSONObject sendUserInfo(String uuid) {
|
|
|
+ if (StringUtils.isEmpty(uuid)){
|
|
|
+ throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
|
|
|
+ }
|
|
|
+ //二维码失效,清除本地文件二维码
|
|
|
+ if(!redisUtil.hasKey(RedisKeyUtil.QRCODE +uuid)){
|
|
|
+ FileUtils.delFile(QrCodeFilePath.LOGIN_QR_CODE_PATH + uuid + ".png");
|
|
|
+ throw new BusinessException(LoginConstant.FAILURE_CODE_3035, LoginConstant.FAILURE_MSG_3035);
|
|
|
+ }
|
|
|
+ if(!redisUtil.hasKey(uuid)){
|
|
|
+ throw new BusinessException(LoginConstant.FAILURE_CODE_3004, LoginConstant.FAILURE_MSG_3004);
|
|
|
+ }
|
|
|
+ String childName = redisUtil.get(uuid);
|
|
|
+ Camera camera = cameraService.getBySnCode(childName);
|
|
|
+ if(camera == null){
|
|
|
+ throw new BusinessException(LoginConstant.FAILURE_CODE_3004, LoginConstant.FAILURE_MSG_3004);
|
|
|
+ }
|
|
|
+ CameraDetail cameraDetail = cameraDetailService.getByCameraId(camera.getId());
|
|
|
+ if(cameraDetail == null){
|
|
|
+ throw new BusinessException(LoginConstant.FAILURE_CODE_3004, LoginConstant.FAILURE_MSG_3004);
|
|
|
+ }
|
|
|
+ UserVo userVo = new UserVo();
|
|
|
+ userVo.setUserName(childName);
|
|
|
+ userVo.setId(cameraDetail.getUserId());
|
|
|
+ userVo.setCameraId(camera.getId());
|
|
|
+ userVo.setCameraLogin(1);
|
|
|
+ String token = this.redisLogin(childName,JSONObject.toJSONString(userVo),"camera");
|
|
|
+ JSONObject obj = new JSONObject();
|
|
|
+ obj.put("token",token);
|
|
|
+ obj.put("childName",childName);
|
|
|
+ obj.put("to",1);
|
|
|
+ redisUtil.del(uuid);
|
|
|
+ FileUtils.deleteFile(QrCodeFilePath.LOGIN_QR_CODE_PATH +uuid +".png");
|
|
|
+ return obj;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Object sendUserInfo2(String uuid) {
|
|
|
if (StringUtils.isEmpty(uuid)){
|
|
|
throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
|
|
|
}
|
|
|
@@ -242,6 +278,7 @@ public class LoginService {
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
public void getEmailAuthCode(String email, String country) throws Exception {
|
|
|
if(StringUtils.isEmpty(email) || StringUtils.isEmpty(country)){
|
|
|
throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
|