mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-13 05:12:07 +08:00
组织导出、用户导出添加字段
This commit is contained in:
+7
@@ -3,6 +3,7 @@ package com.cf.imes.module.system.api.user;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.util.collection.CollectionUtils;
|
||||
import com.cf.imes.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import com.cf.imes.module.system.api.user.dto.OrganAdminUserRespDTO;
|
||||
import com.cf.imes.module.system.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -67,4 +68,10 @@ public interface AdminUserApi {
|
||||
})
|
||||
CommonResult<AdminUserRespDTO> validateUser(@RequestParam("name") String name, @RequestParam("organId") Long organId);
|
||||
|
||||
|
||||
@GetMapping(PREFIX + "/getOrganAdminByOrganIds")
|
||||
@Operation(summary = "通过组织 ID 查询组织管理员用户列表")
|
||||
@Parameter(name = "organIds", description = "组织id列表", example = "1,3", required = true)
|
||||
CommonResult<List<OrganAdminUserRespDTO>> getOrganAdminByOrganIds(@RequestParam("id") Collection<Long> organIds);
|
||||
|
||||
}
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.cf.imes.module.system.api.user.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author Beal
|
||||
* 组织管理员用户信息
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class OrganAdminUserRespDTO {
|
||||
@Schema(description = "组织id")
|
||||
private Long organId;
|
||||
@Schema(description = "用户id")
|
||||
private Long userId;
|
||||
@Schema(description = "用户昵称")
|
||||
private String nickname;
|
||||
@Schema(description = "用户账号")
|
||||
private String username;
|
||||
}
|
||||
+6
@@ -3,6 +3,7 @@ package com.cf.imes.module.system.api.user;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import com.cf.imes.module.system.api.user.dto.OrganAdminUserRespDTO;
|
||||
import com.cf.imes.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import com.cf.imes.module.system.service.user.AdminUserService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -58,5 +59,10 @@ public class AdminUserApiImpl implements AdminUserApi {
|
||||
return success(BeanUtils.toBean(user, AdminUserRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<OrganAdminUserRespDTO>> getOrganAdminByOrganIds(Collection<Long> organIds) {
|
||||
return success(userService.getOrganAdminByOrganIds(organIds));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class MachineAuth {
|
||||
@Schema(description = "机台模板id")
|
||||
@Schema(description = "机台id")
|
||||
private Long machineId;
|
||||
@Schema(description ="加工模式 开料机加工模式 默认true,显示开料机工作模式(是否排钻/造型,sc)配置")
|
||||
private Boolean showPriorFacing;
|
||||
|
||||
+35
-6
@@ -8,12 +8,13 @@ import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.excel.core.util.ExcelUtils;
|
||||
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.cf.imes.module.system.controller.admin.organ.vo.organ.OrganPageReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.organ.vo.organ.OrganRespVO;
|
||||
import com.cf.imes.module.system.controller.admin.organ.vo.organ.OrganSaveReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.organ.vo.organ.OrganSimpleRespVO;
|
||||
import com.cf.imes.module.system.api.user.dto.OrganAdminUserRespDTO;
|
||||
import com.cf.imes.module.system.controller.admin.organ.vo.organ.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.organ.OrganizationDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.organ.TenantPackageDO;
|
||||
import com.cf.imes.module.system.dal.mysql.organ.TenantPackageMapper;
|
||||
import com.cf.imes.module.system.service.organ.OrganService;
|
||||
import com.cf.imes.module.system.service.user.AdminUserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -27,6 +28,9 @@ import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertList;
|
||||
@@ -40,6 +44,12 @@ public class OrganController {
|
||||
@Resource
|
||||
private OrganService organService;
|
||||
|
||||
@Resource
|
||||
private TenantPackageMapper tenantPackageMapper;
|
||||
|
||||
@Resource
|
||||
private AdminUserService adminUserService;
|
||||
|
||||
@GetMapping("/get-id-by-name")
|
||||
@PermitAll
|
||||
@Operation(summary = "使用组织名,获得组织编号", description = "登录界面,根据用户的组织名,获得组织编号")
|
||||
@@ -107,9 +117,28 @@ public class OrganController {
|
||||
HttpServletResponse response) throws IOException {
|
||||
exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<OrganizationDO> list = organService.getOrganPage(exportReqVO).getList();
|
||||
Set<Long> organIds = list.stream().map(OrganizationDO::getId).collect(Collectors.toSet());
|
||||
Set<Long> packageIds = list.stream().map(OrganizationDO::getPackageId).collect(Collectors.toSet());
|
||||
List<TenantPackageDO> tenantPackageDOS = tenantPackageMapper.selectBatchIds(packageIds);
|
||||
List<OrganExportRespVO> organExportRespVOS = BeanUtils.toBean(list, OrganExportRespVO.class);
|
||||
List<OrganAdminUserRespDTO> organAdminUserRespDTOS = adminUserService.getOrganAdminByOrganIds(organIds);
|
||||
|
||||
organExportRespVOS.forEach(e->{
|
||||
e.setPackageName(tenantPackageDOS.stream()
|
||||
.filter(f-> Objects.equals(e.getPackageId(),f.getId()))
|
||||
.map(TenantPackageDO::getName)
|
||||
.findAny()
|
||||
.orElse(null));
|
||||
e.setLargeStr(e.getLarge()? "是":"否");
|
||||
e.setUsernames(organAdminUserRespDTOS.stream()
|
||||
.filter(f->Objects.equals(e.getId(), f.getOrganId()))
|
||||
.map(OrganAdminUserRespDTO::getUsername)
|
||||
.reduce("", (a,b)-> a + " " + b)
|
||||
);
|
||||
});
|
||||
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "组织.xls", "数据", OrganRespVO.class,
|
||||
BeanUtils.toBean(list, OrganRespVO.class));
|
||||
ExcelUtils.write(response, "组织.xls", "数据", OrganExportRespVO.class, organExportRespVOS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
package com.cf.imes.module.system.controller.admin.organ.vo.organ;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.cf.imes.framework.excel.core.annotations.DictFormat;
|
||||
import com.cf.imes.framework.excel.core.convert.DictConvert;
|
||||
import com.cf.imes.module.system.enums.DictTypeConstants;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* @author Beal
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@Builder
|
||||
public class OrganExportRespVO {
|
||||
@Schema(description = "组织编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@ExcelProperty("组织编号")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "组织名", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
|
||||
@ExcelProperty("组织名")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "联系人", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
|
||||
@ExcelProperty("联系人")
|
||||
private String contactName;
|
||||
|
||||
@Schema(description = "联系手机", example = "15601691300")
|
||||
@ExcelProperty("联系手机")
|
||||
private String contactMobile;
|
||||
|
||||
@Schema(description = "组织状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty(value = "状态", converter = DictConvert.class)
|
||||
@DictFormat(DictTypeConstants.COMMON_STATUS)
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "绑定域名", example = "https://www.cf.com")
|
||||
@ExcelProperty("绑定域名")
|
||||
private String website;
|
||||
|
||||
@Schema(description = "组织套餐编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Long packageId;
|
||||
|
||||
@Schema(description = "组织套餐", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@ExcelProperty("组织套餐")
|
||||
private String packageName;
|
||||
|
||||
@Schema(description = "管理员账号")
|
||||
@ExcelProperty("管理员账号")
|
||||
private String usernames;
|
||||
|
||||
@ExcelProperty("账号数量")
|
||||
private Integer accountCount;
|
||||
|
||||
@Schema(description = "过期时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("过期时间")
|
||||
private LocalDateTime expireTime;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "地址")
|
||||
@ExcelProperty("地址")
|
||||
private String address;
|
||||
|
||||
@Schema(description = "是否大型数据库")
|
||||
private Boolean large;
|
||||
|
||||
@Schema(description = "是否大型数据库")
|
||||
@ExcelProperty("是否大型数据库")
|
||||
private String largeStr;
|
||||
}
|
||||
+29
-2
@@ -7,7 +7,9 @@ import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.excel.core.util.ExcelUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.cf.imes.module.system.controller.admin.user.vo.user.*;
|
||||
import com.cf.imes.module.system.controller.admin.user.vo.user.UserImportExcelVO;
|
||||
@@ -20,9 +22,14 @@ import com.cf.imes.module.system.controller.admin.user.vo.user.UserUpdatePasswor
|
||||
import com.cf.imes.module.system.controller.admin.user.vo.user.UserUpdateStatusReqVO;
|
||||
import com.cf.imes.module.system.convert.user.UserConvert;
|
||||
import com.cf.imes.module.system.dal.dataobject.dept.DeptDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.dept.PostDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.dept.UserPostDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import com.cf.imes.module.system.dal.mysql.dept.PostMapper;
|
||||
import com.cf.imes.module.system.dal.mysql.dept.UserPostMapper;
|
||||
import com.cf.imes.module.system.enums.common.SexEnum;
|
||||
import com.cf.imes.module.system.service.dept.DeptService;
|
||||
import com.cf.imes.module.system.service.dept.PostService;
|
||||
import com.cf.imes.module.system.service.user.AdminUserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@@ -40,6 +47,8 @@ import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertList;
|
||||
@@ -55,6 +64,8 @@ public class UserController {
|
||||
private AdminUserService userService;
|
||||
@Resource
|
||||
private DeptService deptService;
|
||||
@Resource
|
||||
private PostMapper postMapper;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "新增用户")
|
||||
@@ -142,11 +153,27 @@ public class UserController {
|
||||
HttpServletResponse response) throws IOException {
|
||||
exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<AdminUserDO> list = userService.getUserPage(exportReqVO).getList();
|
||||
List<UserPostDTO> userPostDTOS = postMapper.selectJoinList(UserPostDTO.class, new MPJLambdaWrapperX<PostDO>()
|
||||
.select(PostDO::getName)
|
||||
.leftJoin(UserPostDO.class, UserPostDO::getPostId, PostDO::getId)
|
||||
.select(UserPostDO::getPostId,UserPostDO::getUserId)
|
||||
.in(UserPostDO::getUserId, list.stream().map(AdminUserDO::getId).collect(Collectors.toSet()))
|
||||
);
|
||||
Map<Long, List<UserPostDTO>> listMap = userPostDTOS.stream().collect(Collectors.groupingBy(UserPostDTO::getUserId));
|
||||
|
||||
// 输出 Excel
|
||||
Map<Long, DeptDO> deptMap = deptService.getDeptMap(
|
||||
convertList(list, AdminUserDO::getDeptId));
|
||||
ExcelUtils.write(response, "用户数据.xls", "数据", UserRespVO.class,
|
||||
UserConvert.INSTANCE.convertList(list, deptMap));
|
||||
List<UserExportRespVO> userRespVOS = UserConvert.INSTANCE.convertExportList(list, deptMap);
|
||||
userRespVOS.forEach(e-> {
|
||||
List<UserPostDTO> userPostDTOS1 = listMap.get(e.getId());
|
||||
if(CollUtil.isNotEmpty(userPostDTOS1)) {
|
||||
e.setPostName(userPostDTOS1.stream().map(UserPostDTO::getName).reduce("",(a, b) -> a + " " +b));
|
||||
}else{
|
||||
e.setPostName("");
|
||||
}
|
||||
});
|
||||
ExcelUtils.write(response, "用户数据.xls", "数据", UserExportRespVO.class, userRespVOS);
|
||||
}
|
||||
|
||||
@GetMapping("/get-import-template")
|
||||
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
package com.cf.imes.module.system.controller.admin.user.vo.user;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.cf.imes.framework.excel.core.annotations.DictFormat;
|
||||
import com.cf.imes.framework.excel.core.convert.DictConvert;
|
||||
import com.cf.imes.module.system.enums.DictTypeConstants;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Beal
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ExcelIgnoreUnannotated
|
||||
public class UserExportRespVO {
|
||||
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("用户编号")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "chenfeng")
|
||||
@ExcelProperty("用户名称")
|
||||
private String username;
|
||||
|
||||
@Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
|
||||
@ExcelProperty("用户昵称")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "备注", example = "我是一个用户")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "部门ID", example = "我是一个用户")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "部门名称", example = "IT 部")
|
||||
@ExcelProperty("部门名称")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "岗位")
|
||||
@ExcelProperty("岗位")
|
||||
private String postName;
|
||||
|
||||
@Schema(description = "岗位编号数组", example = "1")
|
||||
private Set<Long> postIds;
|
||||
|
||||
@Schema(description = "用户邮箱", example = "chenfeng@cf.com")
|
||||
@ExcelProperty("用户邮箱")
|
||||
private String email;
|
||||
|
||||
@Schema(description = "手机号码", example = "15601691300")
|
||||
@ExcelProperty("手机号码")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "用户性别,参见 SexEnum 枚举类", example = "1")
|
||||
@ExcelProperty(value = "用户性别", converter = DictConvert.class)
|
||||
@DictFormat(DictTypeConstants.USER_SEX)
|
||||
private Integer sex;
|
||||
|
||||
@Schema(description = "用户头像", example = "https://www.cf.com/xxx.png")
|
||||
private String avatar;
|
||||
|
||||
@Schema(description = "状态,参见 CommonStatusEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty(value = "帐号状态", converter = DictConvert.class)
|
||||
@DictFormat(DictTypeConstants.COMMON_STATUS)
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "最后登录 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "192.168.1.1")
|
||||
@ExcelProperty("最后登录IP")
|
||||
private String loginIp;
|
||||
|
||||
@Schema(description = "最后登录时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式")
|
||||
@ExcelProperty("最后登录时间")
|
||||
private LocalDateTime loginDate;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private Long organId;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.cf.imes.module.system.controller.admin.user.vo.user;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Beal
|
||||
*/
|
||||
@Data
|
||||
public class UserPostDTO {
|
||||
private Long userId;
|
||||
private Long postId;
|
||||
private String name;
|
||||
}
|
||||
+14
@@ -7,6 +7,7 @@ import com.cf.imes.module.system.controller.admin.dept.vo.dept.DeptSimpleRespVO;
|
||||
import com.cf.imes.module.system.controller.admin.dept.vo.post.PostSimpleRespVO;
|
||||
import com.cf.imes.module.system.controller.admin.permission.vo.role.RoleSimpleRespVO;
|
||||
import com.cf.imes.module.system.controller.admin.user.vo.profile.UserProfileRespVO;
|
||||
import com.cf.imes.module.system.controller.admin.user.vo.user.UserExportRespVO;
|
||||
import com.cf.imes.module.system.controller.admin.user.vo.user.UserRespVO;
|
||||
import com.cf.imes.module.system.controller.admin.user.vo.user.UserSimpleRespVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.dept.DeptDO;
|
||||
@@ -37,6 +38,19 @@ public interface UserConvert {
|
||||
return userVO;
|
||||
}
|
||||
|
||||
default List<UserExportRespVO> convertExportList(List<AdminUserDO> list, Map<Long, DeptDO> deptMap) {
|
||||
return CollectionUtils.convertList(list, user -> convertExport(user, deptMap.get(user.getDeptId())));
|
||||
}
|
||||
|
||||
default UserExportRespVO convertExport(AdminUserDO user, DeptDO dept) {
|
||||
UserExportRespVO userVO = BeanUtils.toBean(user, UserExportRespVO.class);
|
||||
if (dept != null) {
|
||||
userVO.setDeptName(dept.getName());
|
||||
}
|
||||
return userVO;
|
||||
}
|
||||
|
||||
|
||||
default List<UserSimpleRespVO> convertSimpleList(List<AdminUserDO> list, Map<Long, DeptDO> deptMap) {
|
||||
return CollectionUtils.convertList(list, user -> {
|
||||
UserSimpleRespVO userVO = BeanUtils.toBean(user, UserSimpleRespVO.class);
|
||||
|
||||
+2
-2
@@ -80,9 +80,9 @@ public class OrganServiceImpl implements OrganService {
|
||||
@Resource
|
||||
private PermissionService permissionService;
|
||||
//组织管理员角色id
|
||||
private static final Long ORGAN_ADMIN_ROLE_ID = 165L;
|
||||
public static final Long ORGAN_ADMIN_ROLE_ID = 165L;
|
||||
//组织员工角色id
|
||||
private static final Long ORGAN_STAFF_ROLE_ID = 166L;
|
||||
public static final Long ORGAN_STAFF_ROLE_ID = 166L;
|
||||
|
||||
@Value("${chenfeng.organ.use-data-code:imes_prod}")
|
||||
private String useDataCode;
|
||||
|
||||
+7
@@ -3,6 +3,7 @@ package com.cf.imes.module.system.service.user;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.collection.CollectionUtils;
|
||||
import com.cf.imes.module.system.api.user.dto.OrganAdminUserRespDTO;
|
||||
import com.cf.imes.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.user.vo.user.UserImportExcelVO;
|
||||
@@ -216,4 +217,10 @@ public interface AdminUserService {
|
||||
*/
|
||||
List<AdminUserDO> getUserListByTerms(Integer status , String name);
|
||||
|
||||
/**
|
||||
* 通过组织 ID 查询组织管理员用户列表
|
||||
* @param organIds 组织id列表
|
||||
* @return 用户列表
|
||||
*/
|
||||
List<OrganAdminUserRespDTO> getOrganAdminByOrganIds(Collection<Long> organIds);
|
||||
}
|
||||
|
||||
+37
@@ -12,8 +12,12 @@ import com.cf.imes.framework.common.util.collection.CollectionUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.common.util.pinyin.PinYinUtils;
|
||||
import com.cf.imes.framework.datapermission.core.util.DataPermissionUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||
import com.cf.imes.framework.organ.core.aop.OrganIgnore;
|
||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.cf.imes.module.infra.api.file.FileApi;
|
||||
import com.cf.imes.module.system.api.user.dto.OrganAdminUserRespDTO;
|
||||
import com.cf.imes.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.user.vo.user.UserImportExcelVO;
|
||||
@@ -22,6 +26,7 @@ import com.cf.imes.module.system.controller.admin.user.vo.user.UserPageReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.user.vo.user.UserSaveReqVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.dept.DeptDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.dept.UserPostDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.permission.UserRoleDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import com.cf.imes.module.system.dal.mysql.dept.UserPostMapper;
|
||||
import com.cf.imes.module.system.dal.mysql.user.AdminUserMapper;
|
||||
@@ -42,10 +47,12 @@ import javax.annotation.Resource;
|
||||
import java.io.InputStream;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertList;
|
||||
import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
import static com.cf.imes.module.system.service.organ.OrganServiceImpl.ORGAN_ADMIN_ROLE_ID;
|
||||
|
||||
/**
|
||||
* 后台用户 Service 实现类
|
||||
@@ -486,6 +493,36 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
return userMapper.selectListByTerms(status, namePyAll, namePyFirstChar, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
@OrganIgnore
|
||||
public List<OrganAdminUserRespDTO> getOrganAdminByOrganIds(Collection<Long> organIds) {
|
||||
if(CollectionUtil.isEmpty(organIds)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
MPJLambdaWrapperX<AdminUserDO> wrapperX = new MPJLambdaWrapperX<>();
|
||||
wrapperX.leftJoin(UserRoleDO.class, UserRoleDO::getUserId, AdminUserDO::getId)
|
||||
.eq(UserRoleDO::getRoleId, ORGAN_ADMIN_ROLE_ID)
|
||||
;
|
||||
List<OrganAdminUserRespDTO> organAdminUserRespDTOS = userMapper.selectJoinList(OrganAdminUserRespDTO.class, wrapperX);
|
||||
return organAdminUserRespDTOS;
|
||||
|
||||
/*List<AdminUserDO> adminUserDOS = userMapper.selectList(new LambdaQueryWrapperX<AdminUserDO>()
|
||||
.in(AdminUserDO::getOrganId, organIds)
|
||||
);
|
||||
if(CollectionUtil.isNotEmpty(adminUserDOS)) {
|
||||
return adminUserDOS.stream().map(e->
|
||||
OrganAdminUserRespDTO.builder()
|
||||
.organId(e.getOrganId())
|
||||
.userId(e.getId())
|
||||
.nickname(e.getNickname())
|
||||
.username(e.getUsername())
|
||||
.build()
|
||||
|
||||
).toList();
|
||||
}*/
|
||||
// return new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 对密码进行加密
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user