Commit 7ece3c7d by xiehongfei

Merge branch 'feature/20250618-erqian' into developer

parents 7789b096 d227321e
...@@ -12,6 +12,9 @@ import java.util.stream.Collectors; ...@@ -12,6 +12,9 @@ import java.util.stream.Collectors;
import javax.servlet.http.Cookie; import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.gic.enterprise.api.dto.EnterpriseSettingDTO;
import com.gic.enterprise.api.dto.StoreWidgetDTO;
import com.gic.enterprise.api.service.StoreWidgetService;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -88,6 +91,8 @@ public class LoginController extends WebBaseController { ...@@ -88,6 +91,8 @@ public class LoginController extends WebBaseController {
private HaobanUserApiService haobanUserApiService; private HaobanUserApiService haobanUserApiService;
@Autowired @Autowired
private RightService rightService ; private RightService rightService ;
@Autowired
private StoreWidgetService storeWidgetService;
/** /**
* 企微后台登录 * 企微后台登录
...@@ -445,9 +450,38 @@ public class LoginController extends WebBaseController { ...@@ -445,9 +450,38 @@ public class LoginController extends WebBaseController {
} }
String gicHost = this.getGicHost(); String gicHost = this.getGicHost();
vo.setGicHost(gicHost); vo.setGicHost(gicHost);
String clerkId = loginUser.getClerkId();
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId);
vo.setHasAllStorePermission(0);
if (null != clerkDTO) {
vo.setHasAllStorePermission(isAdminAuthStore(loginUser.getEnterpriseId(), clerkDTO) ? 1:0);
}
return this.success(vo); return this.success(vo);
} }
private boolean isAdminAuthStore(String enterpriseId, ClerkDTO clerkDTO) {
if (!isAuthEnterprise(enterpriseId)) {
return true;
}
boolean isAdmin = clerkDTO.getSuperAdmin() != null && clerkDTO.getSuperAdmin() == 1;
return isAdmin || StringUtils.isBlank(clerkDTO.getStoreWidgetId()) || isAllAuth(clerkDTO.getStoreWidgetId());
}
private boolean isAuthEnterprise(String enterpriseId) {
EnterpriseSettingDTO enterpriseSettingDTO = enterpriseService.getEnterpriseSettingByEnterpriseId(enterpriseId);
Integer enableAccessControl = enterpriseSettingDTO.getEnableAccessControl();
//是否开启权限控制
boolean isEnableAccessControl = enableAccessControl != null && enableAccessControl.intValue() == 1;
return isEnableAccessControl;
}
private boolean isAllAuth(String key) {
StoreWidgetDTO storeWidgetDTO = storeWidgetService.getStoreWidgetBykey(key);
return storeWidgetDTO != null && storeWidgetDTO.getSelectType().intValue() == 0;
}
@RequestMapping("get-login-session") @RequestMapping("get-login-session")
@IgnoreLogin @IgnoreLogin
public HaobanResponse getLoginSession() { public HaobanResponse getLoginSession() {
......
...@@ -36,6 +36,11 @@ public class WebLoginVO implements Serializable { ...@@ -36,6 +36,11 @@ public class WebLoginVO implements Serializable {
private String cliqueId ; private String cliqueId ;
//登录用户关联的企业是否是集团:1是0否 //登录用户关联的企业是否是集团:1是0否
private Integer isClique ; private Integer isClique ;
/**
* 是否有所有门店权限,1:是,0:否
*/
private Integer hasAllStorePermission;
public String getCliqueId() { public String getCliqueId() {
return cliqueId; return cliqueId;
...@@ -183,4 +188,12 @@ public class WebLoginVO implements Serializable { ...@@ -183,4 +188,12 @@ public class WebLoginVO implements Serializable {
this.clerkPhone = clerkPhone; this.clerkPhone = clerkPhone;
return this; return this;
} }
public Integer getHasAllStorePermission() {
return hasAllStorePermission;
}
public void setHasAllStorePermission(Integer hasAllStorePermission) {
this.hasAllStorePermission = hasAllStorePermission;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment