| | |
| | | package com.ruoyi.app.task.controller; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.ruoyi.alarm.steal.domain.ArdAlarmStealelec; |
| | | import com.ruoyi.app.task.domain.AppParam; |
| | | import com.ruoyi.app.task.domain.ArdAppTaskDetail; |
| | | import com.ruoyi.app.task.domain.WellParam; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.app.task.domain.*; |
| | | import com.ruoyi.common.core.domain.DeptUserTree; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.ruoyi.utils.pagehelper.JpaPageHelper; |
| | | import com.ruoyi.utils.pagehelper.JpaPageInfo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.catalina.security.SecurityUtil; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.app.task.domain.ArdAppTask; |
| | | import com.ruoyi.app.task.service.IArdAppTaskService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | /** |
| | | * app任务管理Controller |
| | |
| | | public class ArdAppTaskController extends BaseController { |
| | | @Autowired |
| | | private IArdAppTaskService ardAppTaskService; |
| | | @Autowired |
| | | private ISysUserService sysUserService; |
| | | |
| | | @Autowired |
| | | private ISysDeptService sysDeptService; |
| | | |
| | | |
| | | /** |
| | |
| | | return success(ardAppTaskService.likeWell(wellParam)); |
| | | } |
| | | |
| | | @ApiOperation("指挥端-查询树形组织架构") |
| | | @PostMapping(value = "/treeDept") |
| | | public AjaxResult treeDept() { |
| | | //查询用户ID |
| | | String usersId = SecurityUtils.getUserId(); |
| | | //根据userId查询部门Id |
| | | SysUser sysUser = sysUserService.selectUserById(usersId); |
| | | //根据当前deptId或者当前及所属下级的所有deptId |
| | | List<Long> deptList = sysDeptService.deptIdBySub(sysUser.getDeptId()); |
| | | //查询所有部门信息 |
| | | List<SysDept> sysDeptList = sysDeptService.allByUser(deptList); |
| | | List<DeptUserTree> deptUserTrees = new ArrayList<>(); |
| | | for (int i = 0; i < sysDeptList.size(); i++) { |
| | | SysDept sysDept = sysDeptList.get(i); |
| | | DeptUserTree deptUserTree = new DeptUserTree(); |
| | | deptUserTree.setAncestors(sysDept.getAncestors()); |
| | | deptUserTree.setDeptId(sysDept.getDeptId()); |
| | | deptUserTree.setDeptName(sysDept.getDeptName()); |
| | | deptUserTree.setParentId(sysDept.getParentId()); |
| | | deptUserTrees.add(deptUserTree); |
| | | QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("dept_id",sysDept.getDeptId()); |
| | | List<SysUser> users = sysUserService.userByDept(sysDept.getDeptId()); |
| | | for (int j = 0; j < users.size(); j++) { |
| | | SysUser user = users.get(j); |
| | | DeptUserTree deptUserTree1 = new DeptUserTree(); |
| | | deptUserTree1.setDeptId(user.getDeptId()); |
| | | deptUserTree1.setUserId(user.getUserId()); |
| | | deptUserTree1.setNickName(user.getNickName()); |
| | | deptUserTree1.setParentId(sysDept.getParentId()); |
| | | deptUserTrees.add(deptUserTree1); |
| | | } |
| | | } |
| | | return success(sysDeptService.deptUserTree(deptUserTrees)); |
| | | } |
| | | |
| | | } |