|
@@ -21,6 +21,7 @@ import com.jeeplus.core.excel.ExportMode;
|
|
import com.jeeplus.core.excel.utils.EasyPoiUtil;
|
|
import com.jeeplus.core.excel.utils.EasyPoiUtil;
|
|
import com.jeeplus.core.query.QueryWrapperGenerator;
|
|
import com.jeeplus.core.query.QueryWrapperGenerator;
|
|
import com.jeeplus.security.util.SecurityUtils;
|
|
import com.jeeplus.security.util.SecurityUtils;
|
|
|
|
+import com.jeeplus.sys.constant.CommonConstants;
|
|
import com.jeeplus.sys.domain.User;
|
|
import com.jeeplus.sys.domain.User;
|
|
import com.jeeplus.sys.service.OfficeService;
|
|
import com.jeeplus.sys.service.OfficeService;
|
|
import com.jeeplus.sys.service.RoleService;
|
|
import com.jeeplus.sys.service.RoleService;
|
|
@@ -28,6 +29,7 @@ import com.jeeplus.sys.service.UserService;
|
|
import com.jeeplus.sys.service.dto.OfficeDTO;
|
|
import com.jeeplus.sys.service.dto.OfficeDTO;
|
|
import com.jeeplus.sys.service.dto.RoleDTO;
|
|
import com.jeeplus.sys.service.dto.RoleDTO;
|
|
import com.jeeplus.sys.service.dto.UserDTO;
|
|
import com.jeeplus.sys.service.dto.UserDTO;
|
|
|
|
+import com.jeeplus.sys.service.mapstruct.OfficeWrapper;
|
|
import com.jeeplus.sys.service.mapstruct.UserWrapper;
|
|
import com.jeeplus.sys.service.mapstruct.UserWrapper;
|
|
import com.jeeplus.sys.utils.*;
|
|
import com.jeeplus.sys.utils.*;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
@@ -76,6 +78,9 @@ public class UserController {
|
|
@Autowired
|
|
@Autowired
|
|
private RoleService roleService;
|
|
private RoleService roleService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private OfficeWrapper officeWrapper;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 根据id查询用户
|
|
* 根据id查询用户
|
|
*
|
|
*
|
|
@@ -422,5 +427,108 @@ public class UserController {
|
|
return ResponseEntity.ok ( res );
|
|
return ResponseEntity.ok ( res );
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 获取机构JSON数据。
|
|
|
|
+ *
|
|
|
|
+ * @param extId 排除的ID
|
|
|
|
+ * @param type 类型(1:公司;2:部门)
|
|
|
|
+ * @param showAll 是否显示不可用数据 1 显示 0 隐藏
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @ApiLog("获取部门用户数据")
|
|
|
|
+ @GetMapping("treeUserData")
|
|
|
|
+ public ResponseEntity treeUserData(@RequestParam(required = false) String extId, @RequestParam(required = false) String type, @RequestParam(required = false, defaultValue = CommonConstants.NO) String showAll) {
|
|
|
|
+ List<OfficeDTO> list = officeWrapper.toDTO (officeService.list ());
|
|
|
|
+ for (OfficeDTO info :
|
|
|
|
+ list) {
|
|
|
|
+ info.setTypeFlag(true);
|
|
|
|
+ }
|
|
|
|
+ //根据部门查询对应部门下的所有数据
|
|
|
|
+ List<OfficeDTO> officeDTOList = userService.disposeUserOffice(list,type);
|
|
|
|
+ list.addAll(officeDTOList);
|
|
|
|
+ List rootTree = officeService.getRootTree (list, extId, type, showAll);
|
|
|
|
+ return ResponseEntity.ok (rootTree);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取机构JSON数据。
|
|
|
|
+ *
|
|
|
|
+ * @param officeName 部门名称
|
|
|
|
+ * @param extId 排除的ID
|
|
|
|
+ * @param type 类型(1:公司;2:部门)
|
|
|
|
+ * @param showAll 是否显示不可用数据 1 显示 0 隐藏
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @ApiLog("获取部门用户数据")
|
|
|
|
+ @GetMapping("treeUserDataAllOffice")
|
|
|
|
+ public ResponseEntity treeUserDataAllOffice(@RequestParam(required = false) String officeName,@RequestParam(required = false) String extId, @RequestParam(required = false) String type, @RequestParam(required = false, defaultValue = CommonConstants.NO) String showAll) {
|
|
|
|
+ List<OfficeDTO> list = officeService.getOfficeAllByOfficeName (officeName);
|
|
|
|
+ if(list.size()>0){
|
|
|
|
+ List<String> officeIds = Lists.newArrayList();
|
|
|
|
+ for (OfficeDTO info :
|
|
|
|
+ list) {
|
|
|
|
+ info.setTypeFlag(true);
|
|
|
|
+ officeIds.add(info.getId());
|
|
|
|
+ }
|
|
|
|
+ //根据部门查询对应部门下的所有数据
|
|
|
|
+ List<OfficeDTO> officeDTOList = userService.getUserByOffice(officeIds,type);
|
|
|
|
+ list.addAll(officeDTOList);
|
|
|
|
+ }
|
|
|
|
+ List rootTree = officeService.getRootTree (list, extId, type, showAll);
|
|
|
|
+ return ResponseEntity.ok (rootTree);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取机构JSON数据。
|
|
|
|
+ *
|
|
|
|
+ * @param officeName 部门名称
|
|
|
|
+ * @param extId 排除的ID
|
|
|
|
+ * @param type 类型(1:公司;2:部门)
|
|
|
|
+ * @param showAll 是否显示不可用数据 1 显示 0 隐藏
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @ApiLog("获取部门用户数据")
|
|
|
|
+ @GetMapping("treeUserDataByOfficeName")
|
|
|
|
+ public ResponseEntity treeUserDataByOfficeName(@RequestParam(required = false) String officeName,@RequestParam(required = false) String extId, @RequestParam(required = false) String type, @RequestParam(required = false, defaultValue = CommonConstants.NO) String showAll) {
|
|
|
|
+ List<OfficeDTO> list = officeService.getOfficeAllByOfficeName (officeName);
|
|
|
|
+ if(list.size()>0){
|
|
|
|
+ List<String> officeIds = Lists.newArrayList();
|
|
|
|
+ for (OfficeDTO info :
|
|
|
|
+ list) {
|
|
|
|
+ info.setTypeFlag(true);
|
|
|
|
+ officeIds.add(info.getId());
|
|
|
|
+ }
|
|
|
|
+ //根据部门查询对应部门下的所有数据
|
|
|
|
+ List<OfficeDTO> officeDTOList = userService.getUserByOffice(officeIds,type);
|
|
|
|
+ list.addAll(officeDTOList);
|
|
|
|
+ }
|
|
|
|
+ List rootTree = officeService.getofficeUserTree (officeName,list, extId, type, showAll);
|
|
|
|
+ return ResponseEntity.ok (rootTree);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取机构JSON数据。
|
|
|
|
+ *
|
|
|
|
+ * @param officeName 部门名称
|
|
|
|
+ * @param extId 排除的ID
|
|
|
|
+ * @param type 类型(1:公司;2:部门)
|
|
|
|
+ * @param showAll 是否显示不可用数据 1 显示 0 隐藏
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @ApiLog("获取部门信息")
|
|
|
|
+ @GetMapping("treeUserDataByOfficeList")
|
|
|
|
+ public ResponseEntity treeUserDataByOfficeList(@RequestParam(required = false) String officeName,@RequestParam(required = false) String extId, @RequestParam(required = false) String type, @RequestParam(required = false, defaultValue = CommonConstants.NO) String showAll) {
|
|
|
|
+ List<OfficeDTO> list = officeService.getOfficeAllByOfficeName (officeName);
|
|
|
|
+ if(list.size()>0){
|
|
|
|
+ List<String> officeIds = Lists.newArrayList();
|
|
|
|
+ for (OfficeDTO info :
|
|
|
|
+ list) {
|
|
|
|
+ officeIds.add(info.getId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ List rootTree = officeService.getofficeUserTree (officeName,list, extId, type, showAll);
|
|
|
|
+ return ResponseEntity.ok (rootTree);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|