|
|
@@ -203,7 +203,7 @@ public class LoginService {
|
|
|
}
|
|
|
|
|
|
public JSONObject createLoginQrCode() throws Exception {
|
|
|
- String uuid = NumberUtils.getUUID();
|
|
|
+ String uuid = "4dkankan_"+NumberUtils.getUUID();
|
|
|
String filePath = QrCodeFilePath.LOGIN_QR_CODE_PATH + uuid + ".png";
|
|
|
File file = new File(QrCodeFilePath.LOGO_IMAGE_LOCAL);
|
|
|
if(!file.exists()){
|
|
|
@@ -217,7 +217,7 @@ public class LoginService {
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
- public JSONObject sendUserInfo(String uuid) {
|
|
|
+ public Object sendUserInfo(String uuid) {
|
|
|
if (StringUtils.isEmpty(uuid)){
|
|
|
throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
|
|
|
}
|
|
|
@@ -229,28 +229,15 @@ public class LoginService {
|
|
|
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){
|
|
|
+
|
|
|
+ String userName = redisUtil.get(uuid);
|
|
|
+ User user = userService.getByUserName(userName);
|
|
|
+ if(user == 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;
|
|
|
+ return this.login(userService.getByUserName(userName));
|
|
|
}
|
|
|
|
|
|
|