|
@@ -9,17 +9,18 @@ import com.huimv.farm.musk.common.utils.*;
|
|
|
import com.huimv.farm.musk.entity.SysAccountMultilevel;
|
|
|
import com.huimv.farm.musk.service.ILoginService;
|
|
|
import com.huimv.farm.musk.service.ISysAccountMultilevelService;
|
|
|
+import com.huimv.farm.musk.service.ISysCameraService;
|
|
|
import com.huimv.farm.musk.session.AccessToken;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import javax.servlet.ServletOutputStream;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
@RestController
|
|
@@ -31,6 +32,8 @@ public class LoginController {
|
|
|
ILoginService iLoginService;
|
|
|
@Autowired
|
|
|
private ISysAccountMultilevelService accountMultilevelService;
|
|
|
+ @Autowired
|
|
|
+ private ISysCameraService sysCameraService;
|
|
|
|
|
|
@RequestMapping("/test")
|
|
|
public String logout() {
|
|
@@ -91,7 +94,12 @@ public class LoginController {
|
|
|
accessToken.setFarmId(accountEntity.getFarmIds());
|
|
|
String token = TokenSign.sign(accountName, id, accountEntity.getFarmIds());
|
|
|
accessToken.setToken(token);
|
|
|
- accessToken.setCameraIds(accountEntity.getCameraIds());
|
|
|
+ if (id !=1){
|
|
|
+ accessToken.setCameraIds(accountEntity.getCameraIds());
|
|
|
+ }else {
|
|
|
+ accessToken.setCameraIds(String.join(",",sysCameraService.listIds()));
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
accessToken.setId(id);
|
|
|
accessToken.setLoginIp(remoteHost);
|
|
@@ -107,6 +115,8 @@ public class LoginController {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
//测试-token
|
|
|
@PostMapping(value = "/getToken")
|
|
|
public String getToken(HttpServletRequest req) {
|