|
@@ -42,6 +42,8 @@ public class SceneApiController {
|
|
@Autowired
|
|
@Autowired
|
|
IScenePlusService scenePlusService;
|
|
IScenePlusService scenePlusService;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ IScenePlusExtService scenePlusExtService;
|
|
|
|
+ @Autowired
|
|
IUserService userService;
|
|
IUserService userService;
|
|
@Autowired
|
|
@Autowired
|
|
LoginService loginService;
|
|
LoginService loginService;
|
|
@@ -86,6 +88,8 @@ public class SceneApiController {
|
|
String childName = request.getParameter("childName");
|
|
String childName = request.getParameter("childName");
|
|
String lang = request.getParameter("lang");
|
|
String lang = request.getParameter("lang");
|
|
String vlog = request.getParameter("vlog");
|
|
String vlog = request.getParameter("vlog");
|
|
|
|
+ log.info("goEditScenePage---param--phoneNum:{},password:{},sceneNum:{},childName:{},lang:{},vlog:{}",
|
|
|
|
+ phoneNum,password,sceneNum,childName,lang,vlog);
|
|
|
|
|
|
ScenePro scene = sceneProService.getByNum(sceneNum);
|
|
ScenePro scene = sceneProService.getByNum(sceneNum);
|
|
ScenePlus scenePlus = null;
|
|
ScenePlus scenePlus = null;
|
|
@@ -97,6 +101,8 @@ public class SceneApiController {
|
|
}
|
|
}
|
|
Long userId = scene == null ? scenePlus.getUserId() : scene.getUserId();
|
|
Long userId = scene == null ? scenePlus.getUserId() : scene.getUserId();
|
|
|
|
|
|
|
|
+ String webSite = scene == null ? scenePlusExtService.getByPlusId(scenePlus.getId()).getWebSite() : scene.getWebSite();
|
|
|
|
+
|
|
if(StringUtils.isNotEmpty(childName)){
|
|
if(StringUtils.isNotEmpty(childName)){
|
|
Camera cameraEntity = cameraService.getByChildName(childName);
|
|
Camera cameraEntity = cameraService.getByChildName(childName);
|
|
if(cameraEntity != null){
|
|
if(cameraEntity != null){
|
|
@@ -114,31 +120,7 @@ public class SceneApiController {
|
|
BeanUtils.copyProperties(dbUser,user);
|
|
BeanUtils.copyProperties(dbUser,user);
|
|
}
|
|
}
|
|
|
|
|
|
- String token = JwtUtil.createJWT(-1, user.getUserName(),"user");
|
|
|
|
- loginService.redisLogin(user.getUserName(), JSONObject.toJSONString(user));
|
|
|
|
-
|
|
|
|
- //登录成功
|
|
|
|
- if(scene.getWebSite().contains(sceneProUrl)){
|
|
|
|
- response.sendRedirect(mainUrl + sceneProUrl.replace("show", "edit").replace("PC", "Mobile") +
|
|
|
|
- sceneNum + "&t=" +System.currentTimeMillis() + "&token=" + token + "&app" +
|
|
|
|
- (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if(scene.getIsUpgrade() != null && scene.getIsUpgrade() == 1){
|
|
|
|
- if(scene.getWebSite().contains(sceneProV4Url)){
|
|
|
|
- response.sendRedirect(mainUrl + sceneProV4Url.replace("s", "e") +
|
|
|
|
- sceneNum + "&t=" +System.currentTimeMillis() + "&token=" + token + "&app" +
|
|
|
|
- (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog));
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if(scene.getWebSite().contains(sceneProNewUrl)){
|
|
|
|
- response.sendRedirect(mainUrl + sceneProNewUrl.replace("s", "e") +
|
|
|
|
- sceneNum + "&t=" +System.currentTimeMillis() + "&token=" + token + "&app" +
|
|
|
|
- (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog));
|
|
|
|
- }
|
|
|
|
- return;
|
|
|
|
|
|
+ sendResponse(user,webSite, response,sceneNum,lang,vlog);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -150,7 +132,6 @@ public class SceneApiController {
|
|
if(userId == null) {
|
|
if(userId == null) {
|
|
throw new BusinessException(SceneConstant.FAILURE_CODE_5013, SceneConstant.FAILURE_MSG_5013);
|
|
throw new BusinessException(SceneConstant.FAILURE_CODE_5013, SceneConstant.FAILURE_MSG_5013);
|
|
}
|
|
}
|
|
-
|
|
|
|
User user = userService.getByUserName(phoneNum);
|
|
User user = userService.getByUserName(phoneNum);
|
|
if(user == null){
|
|
if(user == null){
|
|
throw new BusinessException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015);
|
|
throw new BusinessException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015);
|
|
@@ -170,34 +151,43 @@ public class SceneApiController {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- if(!SecurityUtil.MD5(password).equals(ssoUser.getPassword()))
|
|
|
|
- {
|
|
|
|
|
|
+ if(!SecurityUtil.MD5(password).equals(ssoUser.getPassword())) {
|
|
throw new BusinessException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015);
|
|
throw new BusinessException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015);
|
|
}
|
|
}
|
|
|
|
+ sendResponse(ssoUser,webSite, response,sceneNum,lang,vlog);
|
|
|
|
|
|
- String token = JwtUtil.createJWT(-1, ssoUser.getUserName(),"user");
|
|
|
|
- loginService.redisLogin(ssoUser.getUserName(),JSONObject.toJSONString(ssoUser));
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void sendResponse(UserVo user, String webSite,
|
|
|
|
+ HttpServletResponse response, String sceneNum, String lang, String vlog) {
|
|
|
|
+ String token = loginService.redisLogin(user.getUserName(),JSONObject.toJSONString(user));
|
|
//登录成功
|
|
//登录成功
|
|
- if(scene.getWebSite().contains(sceneProUrl)){
|
|
|
|
- response.sendRedirect(mainUrl + sceneProUrl.replace("show", "edit").replace("PC", "Mobile") +
|
|
|
|
- sceneNum + "&t=" +System.currentTimeMillis() + "&token=" + token + "&app" +
|
|
|
|
- (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog));
|
|
|
|
- }
|
|
|
|
|
|
+ try {
|
|
|
|
+ String redirect = null;
|
|
|
|
+ if(webSite.contains(sceneProUrl)){
|
|
|
|
+ redirect = mainUrl + sceneProUrl.replace("show", "edit").replace("PC", "Mobile") +
|
|
|
|
+ sceneNum + "&t=" +System.currentTimeMillis() + "&token=" + token + "&app" +
|
|
|
|
+ (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog);
|
|
|
|
+ }
|
|
|
|
|
|
- if(scene.getIsUpgrade() != null && scene.getIsUpgrade() == 1){
|
|
|
|
- if(scene.getWebSite().contains(sceneProV4Url)){
|
|
|
|
- response.sendRedirect(mainUrl + sceneProV4Url.replace("s", "e") +
|
|
|
|
|
|
+ if(webSite.contains(sceneProV4Url)){
|
|
|
|
+ redirect = mainUrl + sceneProV4Url.replace("s", "e") +
|
|
sceneNum + "&t=" +System.currentTimeMillis() + "&token=" + token + "&app" +
|
|
sceneNum + "&t=" +System.currentTimeMillis() + "&token=" + token + "&app" +
|
|
- (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog));
|
|
|
|
- return;
|
|
|
|
|
|
+ (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog);
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- if(scene.getWebSite().contains(sceneProNewUrl)) {
|
|
|
|
- response.sendRedirect(mainUrl + sceneProNewUrl.replace("s", "e") +
|
|
|
|
- sceneNum + "&t=" + System.currentTimeMillis() + "&token=" + token + "&app" +
|
|
|
|
- (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog));
|
|
|
|
|
|
+ if(webSite.contains(sceneProNewUrl)) {
|
|
|
|
+ redirect = mainUrl + sceneProNewUrl.replace("s", "e") +
|
|
|
|
+ sceneNum + "&t=" + System.currentTimeMillis() + "&token=" + token + "&app" +
|
|
|
|
+ (lang == null ? "" : "&lang=" + lang) + (vlog == null ? "" : "&vlog=" + vlog);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ log.info("goEditScenePage---response--website:{},redirect:{}", webSite,redirect);
|
|
|
|
+ response.sendRedirect(redirect);
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
//app调用 跳转到官网消费页面
|
|
//app调用 跳转到官网消费页面
|