|
@@ -8,21 +8,27 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.util.SpringContextUtils;
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
|
+import org.jeecg.modules.basedata.entity.FdPersonnel;
|
|
|
+import org.jeecg.modules.basedata.service.IFdPersonnelService;
|
|
|
import org.jeecg.modules.ngalain.service.NgAlainService;
|
|
|
+import org.jeecg.modules.system.entity.SysDepart;
|
|
|
import org.jeecg.modules.system.entity.SysDict;
|
|
|
import org.jeecg.modules.system.entity.SysUser;
|
|
|
import org.jeecg.modules.system.entity.SysUserRole;
|
|
|
import org.jeecg.modules.system.model.SysDictTree;
|
|
|
+import org.jeecg.modules.system.service.ISysDepartService;
|
|
|
import org.jeecg.modules.system.service.ISysDictService;
|
|
|
import org.jeecg.modules.system.service.ISysUserRoleService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpSession;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -39,11 +45,17 @@ public class NgAlainController {
|
|
|
@Autowired
|
|
|
private ISysUserRoleService sysUserRoleService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IFdPersonnelService iFdPersonnelService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISysDepartService iSysDepartService;
|
|
|
+
|
|
|
@RequestMapping(value = "/getAppData")
|
|
|
@ResponseBody
|
|
|
@ApiOperation(value = "登陆之后获取菜单/用户/app信息" ,httpMethod = "POST",notes = "登陆之后获取菜单/用户/app信息", produces = "application/json")
|
|
|
- public Result<JSONObject> getAppData(HttpServletRequest request) throws Exception {
|
|
|
- String token=request.getHeader("X-Access-Token");
|
|
|
+ public Result<JSONObject> getAppData(HttpServletRequest request,String orgId) throws Exception {
|
|
|
+ String token=request.getHeader("X-Access-Token");
|
|
|
JSONObject j = new JSONObject();
|
|
|
SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
JSONObject userObjcet = new JSONObject();
|
|
@@ -53,6 +65,33 @@ public class NgAlainController {
|
|
|
userObjcet.put("email", user.getEmail());
|
|
|
userObjcet.put("token", token);
|
|
|
userObjcet.put("personnelId", user.getPersonnelId());
|
|
|
+ List<SysDepart> sysDeparts=iSysDepartService.getByType("1");
|
|
|
+
|
|
|
+ if(StringUtils.isNotBlank(orgId)&&!orgId.equals("null")){
|
|
|
+
|
|
|
+
|
|
|
+ userObjcet.put("pkOrg", orgId);
|
|
|
+ }else{
|
|
|
+
|
|
|
+
|
|
|
+ if(StringUtils.isNotBlank(user.getPersonnelId())&&!user.getPersonnelId().equals("123")){
|
|
|
+ FdPersonnel fdPersonnel=iFdPersonnelService.getById(user.getPersonnelId());
|
|
|
+ orgId=fdPersonnel.getPkOrg();
|
|
|
+ userObjcet.put("pkOrg", orgId);
|
|
|
+ }else{
|
|
|
+
|
|
|
+
|
|
|
+ orgId=sysDeparts.get(0).getPkOrg();
|
|
|
+ userObjcet.put("pkOrg", orgId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for(SysDepart sysDepart:sysDeparts){
|
|
|
+ if(sysDepart.getId().equals(orgId)){
|
|
|
+ userObjcet.put("pkOrgName", sysDepart.getDepartName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
userObjcet.put("realname",user.getRealname());
|
|
|
|
|
|
List<SysUserRole> userRole = sysUserRoleService.list(new QueryWrapper<SysUserRole>().lambda().eq(SysUserRole::getUserId, user.getId()));
|
|
@@ -63,13 +102,15 @@ public class NgAlainController {
|
|
|
}
|
|
|
|
|
|
j.put("user", userObjcet);
|
|
|
- j.put("menu",ngAlainService.getMenu(user.getUsername()));
|
|
|
+
|
|
|
+ j.put("menu",ngAlainService.getMenuByOrg(user.getUsername(),orgId));
|
|
|
JSONObject app = new JSONObject();
|
|
|
app.put("name", "jeecg-boot-angular");
|
|
|
app.put("description", "jeecg+ng-alain整合版本");
|
|
|
j.put("app", app);
|
|
|
|
|
|
- j.put("perms",ngAlainService.queryPermsByUser(user.getUsername()));
|
|
|
+
|
|
|
+ j.put("perms",ngAlainService.queryPermsByUserAndPkorg(user.getUsername(),orgId));
|
|
|
Result<JSONObject> result = new Result<JSONObject>();
|
|
|
result.setSuccess(true);
|
|
|
result.setResult(j);
|