|
@@ -7,6 +7,7 @@ import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
+import io.netty.util.internal.StringUtil;
|
|
import org.apache.shiro.SecurityUtils;
|
|
import org.apache.shiro.SecurityUtils;
|
|
import org.apache.shiro.authz.annotation.RequiresRoles;
|
|
import org.apache.shiro.authz.annotation.RequiresRoles;
|
|
import org.jeecg.common.api.vo.Result;
|
|
import org.jeecg.common.api.vo.Result;
|
|
@@ -19,12 +20,10 @@ import org.jeecg.common.util.ImportExcelUtil;
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
import org.jeecg.modules.system.entity.SysDepart;
|
|
import org.jeecg.modules.system.entity.SysDepart;
|
|
import org.jeecg.modules.system.entity.SysUser;
|
|
import org.jeecg.modules.system.entity.SysUser;
|
|
|
|
+import org.jeecg.modules.system.entity.SysUserRole;
|
|
import org.jeecg.modules.system.model.DepartIdModel;
|
|
import org.jeecg.modules.system.model.DepartIdModel;
|
|
import org.jeecg.modules.system.model.SysDepartTreeModel;
|
|
import org.jeecg.modules.system.model.SysDepartTreeModel;
|
|
-import org.jeecg.modules.system.service.ISysDepartService;
|
|
|
|
-import org.jeecg.modules.system.service.ISysPositionService;
|
|
|
|
-import org.jeecg.modules.system.service.ISysUserDepartService;
|
|
|
|
-import org.jeecg.modules.system.service.ISysUserService;
|
|
|
|
|
|
+import org.jeecg.modules.system.service.*;
|
|
import org.jeecg.modules.system.util.FindsDepartsChildrenUtil;
|
|
import org.jeecg.modules.system.util.FindsDepartsChildrenUtil;
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
@@ -65,6 +64,9 @@ public class SysDepartController {
|
|
private ISysUserService sysUserService;
|
|
private ISysUserService sysUserService;
|
|
@Autowired
|
|
@Autowired
|
|
private ISysUserDepartService sysUserDepartService;
|
|
private ISysUserDepartService sysUserDepartService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ISysUserRoleService iSysUserRoleService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 查询数据 查出我的部门,并以树结构数据格式响应给前端
|
|
* 查询数据 查出我的部门,并以树结构数据格式响应给前端
|
|
*
|
|
*
|
|
@@ -125,16 +127,46 @@ public class SysDepartController {
|
|
Result<List<SysDepartTreeModel>> result = new Result<>();
|
|
Result<List<SysDepartTreeModel>> result = new Result<>();
|
|
try {
|
|
try {
|
|
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
+ List<SysUserRole> userRole = iSysUserRoleService.list(new QueryWrapper<SysUserRole>().lambda().eq(SysUserRole::getUserId, user.getId()));
|
|
|
|
+ String orgId = null;
|
|
|
|
+ String orgCode = null;
|
|
|
|
|
|
- if(oConvertUtils.isNotEmpty(user.getUserIdentity()) && user.getUserIdentity().equals( CommonConstant.USER_IDENTITY_2 )){
|
|
|
|
- List<SysDepartTreeModel> list = sysDepartService.queryTreeList2(viewDate);
|
|
|
|
|
|
+ if(userRole.size() > 0){
|
|
|
|
+ String roleId = userRole.get(0).getRoleId();
|
|
|
|
+ if(roleId.equals("1462659329857978370")){//部门负责人
|
|
|
|
+ String dept = user.getDepartIds();
|
|
|
|
+ if(!StringUtil.isNullOrEmpty(dept)){
|
|
|
|
+ String[] deptArr = dept.split(",");
|
|
|
|
+ if(deptArr.length > 0){
|
|
|
|
+ orgId = deptArr[0];
|
|
|
|
+ orgCode = user.getOrgCode();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }else if(roleId.equals("1473241527673765890")){//普通用户
|
|
|
|
+ result.setMessage(CommonConstant.USER_IDENTITY_1.toString());
|
|
|
|
+ result.setSuccess(true);
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<SysDepartTreeModel> list = sysDepartService.queryTreeList2(viewDate, orgId, orgCode);
|
|
result.setResult(list);
|
|
result.setResult(list);
|
|
result.setMessage(CommonConstant.USER_IDENTITY_2.toString());
|
|
result.setMessage(CommonConstant.USER_IDENTITY_2.toString());
|
|
- result.setSuccess(true);
|
|
|
|
|
|
+
|
|
}else{
|
|
}else{
|
|
result.setMessage(CommonConstant.USER_IDENTITY_1.toString());
|
|
result.setMessage(CommonConstant.USER_IDENTITY_1.toString());
|
|
- result.setSuccess(true);
|
|
|
|
}
|
|
}
|
|
|
|
+ result.setSuccess(true);
|
|
|
|
+
|
|
|
|
+// if(oConvertUtils.isNotEmpty(user.getUserIdentity()) && user.getUserIdentity().equals( CommonConstant.USER_IDENTITY_2 )){
|
|
|
|
+// List<SysDepartTreeModel> list = sysDepartService.queryTreeList2(viewDate,user.getOrgCode());
|
|
|
|
+// result.setResult(list);
|
|
|
|
+// result.setMessage(CommonConstant.USER_IDENTITY_2.toString());
|
|
|
|
+// result.setSuccess(true);
|
|
|
|
+// }else{
|
|
|
|
+// result.setMessage(CommonConstant.USER_IDENTITY_1.toString());
|
|
|
|
+// result.setSuccess(true);
|
|
|
|
+// }
|
|
|
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error(e.getMessage(),e);
|
|
log.error(e.getMessage(),e);
|