|
@@ -76,6 +76,11 @@ public class AuthServiceImpl implements IAuthService {
|
|
|
|
|
|
|
|
/*司机端*/
|
|
/*司机端*/
|
|
|
if (loginBase.getSystemType() == SystemTypeEnum.DRIVER.getCode()) {
|
|
if (loginBase.getSystemType() == SystemTypeEnum.DRIVER.getCode()) {
|
|
|
|
|
+ KwsUserResDto kwsUserResDto = systemService.queryByAccount(loginBase.getAccount());
|
|
|
|
|
+ if (Objects.nonNull(kwsUserResDto)) {
|
|
|
|
|
+ loginBase.setSystemType(SystemTypeEnum.COMPANY.getCode());
|
|
|
|
|
+ return this.commonAuth(loginBase);
|
|
|
|
|
+ }
|
|
|
return this.driverAuth(loginBase);
|
|
return this.driverAuth(loginBase);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -162,6 +167,10 @@ public class AuthServiceImpl implements IAuthService {
|
|
|
loginRes.setClientType(loginBase.getClientType());
|
|
loginRes.setClientType(loginBase.getClientType());
|
|
|
loginRes.setSystemType(loginBase.getSystemType());
|
|
loginRes.setSystemType(loginBase.getSystemType());
|
|
|
loginRes.setToken(token);
|
|
loginRes.setToken(token);
|
|
|
|
|
+ List<LoginResVo1.TabBarItem> tabBar = buildAppTabBar(loginBase, null);
|
|
|
|
|
+ if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(tabBar)) {
|
|
|
|
|
+ loginRes.setTabBar(tabBar);
|
|
|
|
|
+ }
|
|
|
loginRes.setRefreshToken(refreshToken);
|
|
loginRes.setRefreshToken(refreshToken);
|
|
|
return HttpResult.ok(loginRes);
|
|
return HttpResult.ok(loginRes);
|
|
|
}
|
|
}
|
|
@@ -226,6 +235,7 @@ public class AuthServiceImpl implements IAuthService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/*数据组装**/
|
|
/*数据组装**/
|
|
|
|
|
+
|
|
|
LoginResVo1 loginRes = new LoginResVo1();
|
|
LoginResVo1 loginRes = new LoginResVo1();
|
|
|
loginRes.setId(user.getId());
|
|
loginRes.setId(user.getId());
|
|
|
loginRes.setName(user.getName());
|
|
loginRes.setName(user.getName());
|
|
@@ -249,6 +259,10 @@ public class AuthServiceImpl implements IAuthService {
|
|
|
loginRes.setRoleId(user.getRoleId());
|
|
loginRes.setRoleId(user.getRoleId());
|
|
|
loginRes.setRoleName(user.getRoleName());
|
|
loginRes.setRoleName(user.getRoleName());
|
|
|
loginRes.setRoleList(user.getRoleInfoDto());
|
|
loginRes.setRoleList(user.getRoleInfoDto());
|
|
|
|
|
+ List<LoginResVo1.TabBarItem> tabBar = buildAppTabBar(loginBase, user.getRoleName());
|
|
|
|
|
+ if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(tabBar)) {
|
|
|
|
|
+ loginRes.setTabBar(tabBar);
|
|
|
|
|
+ }
|
|
|
if (user.getSystemType().equals(SystemTypeEnum.MANAGE.getCode())) {
|
|
if (user.getSystemType().equals(SystemTypeEnum.MANAGE.getCode())) {
|
|
|
loginRes.setValid(true);
|
|
loginRes.setValid(true);
|
|
|
} else {
|
|
} else {
|
|
@@ -785,6 +799,90 @@ public class AuthServiceImpl implements IAuthService {
|
|
|
return loginRes;
|
|
return loginRes;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private boolean isAppLogin(LoginBase loginBase) {
|
|
|
|
|
+ String clientType = loginBase.getClientType();
|
|
|
|
|
+ return Objects.equals(clientType, ClientTypeEnum.app.getValue())
|
|
|
|
|
+ || Objects.equals(clientType, ClientTypeEnum.ios.getValue())
|
|
|
|
|
+ || Objects.equals(clientType, ClientTypeEnum.android.getValue())
|
|
|
|
|
+ || Objects.equals(clientType, ClientTypeEnum.mobile.getValue());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private List<LoginResVo1.TabBarItem> buildAppTabBar(LoginBase loginBase, String roleName) {
|
|
|
|
|
+ if (!isAppLogin(loginBase)) {
|
|
|
|
|
+ return List.of();
|
|
|
|
|
+ }
|
|
|
|
|
+ boolean isDoorKeeper = StringUtils.isNotBlank(roleName) && roleName.contains("门卫");
|
|
|
|
|
+ boolean isForkliftDriver = StringUtils.isNotBlank(roleName) && roleName.contains("铲车司机");
|
|
|
|
|
+ if (isDoorKeeper) {
|
|
|
|
|
+ return buildDoorKeeperTabBar();
|
|
|
|
|
+ }
|
|
|
|
|
+ if (isForkliftDriver) {
|
|
|
|
|
+ return buildForkliftDriverTabBar();
|
|
|
|
|
+ }
|
|
|
|
|
+ return buildDefaultDriverTabBar();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private List<LoginResVo1.TabBarItem> buildDoorKeeperTabBar() {
|
|
|
|
|
+ List<LoginResVo1.TabBarItem> items = new ArrayList<>();
|
|
|
|
|
+ items.add(buildTabBarItem(
|
|
|
|
|
+ "往来车辆",
|
|
|
|
|
+ "/static/tabbar/car_select.png",
|
|
|
|
|
+ "/static/tabbar/car.png",
|
|
|
|
|
+ "/pages/doorkeeper/index"
|
|
|
|
|
+ ));
|
|
|
|
|
+ items.add(buildTabBarItem(
|
|
|
|
|
+ "个人中心",
|
|
|
|
|
+ "/static/tabbar/my_select.png",
|
|
|
|
|
+ "/static/tabbar/my.png",
|
|
|
|
|
+ "/pages/doorkeeper/my"
|
|
|
|
|
+ ));
|
|
|
|
|
+ return items;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private List<LoginResVo1.TabBarItem> buildForkliftDriverTabBar() {
|
|
|
|
|
+ List<LoginResVo1.TabBarItem> items = new ArrayList<>();
|
|
|
|
|
+ items.add(buildTabBarItem(
|
|
|
|
|
+ "任务",
|
|
|
|
|
+ "/static/tabbar/task_select.png",
|
|
|
|
|
+ "/static/tabbar/task.png",
|
|
|
|
|
+ "/pages/forklift/index"
|
|
|
|
|
+ ));
|
|
|
|
|
+ items.add(buildTabBarItem(
|
|
|
|
|
+ "个人中心",
|
|
|
|
|
+ "/static/tabbar/my_select.png",
|
|
|
|
|
+ "/static/tabbar/my.png",
|
|
|
|
|
+ "/pages/forklift/my"
|
|
|
|
|
+ ));
|
|
|
|
|
+ return items;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private List<LoginResVo1.TabBarItem> buildDefaultDriverTabBar() {
|
|
|
|
|
+ List<LoginResVo1.TabBarItem> items = new ArrayList<>();
|
|
|
|
|
+ items.add(buildTabBarItem(
|
|
|
|
|
+ "任务",
|
|
|
|
|
+ "/static/tabbar/task_select.png",
|
|
|
|
|
+ "/static/tabbar/task.png",
|
|
|
|
|
+ "/pages/index/index"
|
|
|
|
|
+ ));
|
|
|
|
|
+ items.add(buildTabBarItem(
|
|
|
|
|
+ "管理",
|
|
|
|
|
+ "/static/tabbar/manage_select.png",
|
|
|
|
|
+ "/static/tabbar/manage.png",
|
|
|
|
|
+ "/pages/manage/index"
|
|
|
|
|
+ ));
|
|
|
|
|
+ return items;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private LoginResVo1.TabBarItem buildTabBarItem(String text, String iconPath, String notSelectedIconPath, String pagePath) {
|
|
|
|
|
+ LoginResVo1.TabBarItem item = new LoginResVo1.TabBarItem();
|
|
|
|
|
+ item.setText(text);
|
|
|
|
|
+ item.setIconPath(iconPath);
|
|
|
|
|
+ item.setNotSelectedIconPath(notSelectedIconPath);
|
|
|
|
|
+ item.setPagePath(pagePath);
|
|
|
|
|
+ item.setCount(0);
|
|
|
|
|
+ return item;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
static class AsyncProcess implements Runnable {
|
|
static class AsyncProcess implements Runnable {
|
|
|
private final LoginBase loginBase;
|
|
private final LoginBase loginBase;
|
|
|
|
|
|