Commit 45260e49 by 杨伟程
parents 600ea9f9 25e385c5
Showing with 488 additions and 606 deletions
package com.makeit.controller.plat; package com.makeit.controller.plat;
import com.makeit.common.dto.BaseBatchIdDTO;
import com.makeit.common.dto.BaseIdDTO; import com.makeit.common.dto.BaseIdDTO;
import com.makeit.common.dto.StatusDTO; import com.makeit.common.dto.StatusDTO;
import com.makeit.common.page.PageReqDTO; import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO; import com.makeit.common.page.PageVO;
import com.makeit.common.response.ApiResponseEntity; import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils; import com.makeit.common.response.ApiResponseUtils;
import com.makeit.common.vo.ExcelImportVo;
import com.makeit.exception.BusinessException;
import com.makeit.global.annotation.Action; import com.makeit.global.annotation.Action;
import com.makeit.module.admin.dto.plat.PlatUserDTOVO; import com.makeit.module.admin.dto.plat.PlatUserDTOVO;
import com.makeit.module.admin.dto.plat.PlatUserQueryDTO; import com.makeit.module.admin.dto.plat.PlatUserQueryDTO;
...@@ -20,7 +23,9 @@ import org.springframework.validation.annotation.Validated; ...@@ -20,7 +23,9 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
...@@ -111,6 +116,14 @@ public class PlatUserController { ...@@ -111,6 +116,14 @@ public class PlatUserController {
return ApiResponseUtils.success(); return ApiResponseUtils.success();
} }
@Action(module = "平台端-人员", name = "批量删除", code = "plat:user:del")
@ApiOperation("批量删除")
@PostMapping("delBatch")
public ApiResponseEntity<Void> delBatch(@RequestBody BaseBatchIdDTO dto) {
platUserService.delBatch(dto.getIdList());
return ApiResponseUtils.success();
}
@Action(module = "平台端-人员", name = "改变状态", code = "plat:user:changeStatus") @Action(module = "平台端-人员", name = "改变状态", code = "plat:user:changeStatus")
@ApiOperation("改变状态") @ApiOperation("改变状态")
@PostMapping("changeStatus") @PostMapping("changeStatus")
...@@ -143,5 +156,15 @@ public class PlatUserController { ...@@ -143,5 +156,15 @@ public class PlatUserController {
return ApiResponseUtils.success(platUserService.getUserDetail()); return ApiResponseUtils.success(platUserService.getUserDetail());
} }
@Action(module = "平台端-人员", name = "批量导入", code = "plat:user:import")
@ApiOperation("批量导入")
@PostMapping("import")
public ApiResponseEntity<ExcelImportVo> importExcel(@RequestParam(value = "excelFile", required = false) MultipartFile excelFile) throws Exception {
if(excelFile == null ){
throw new BusinessException("请上传excel");
}
ExcelImportVo excelImportVo = platUserService.importExcel(excelFile);
return ApiResponseUtils.success(excelImportVo);
}
} }
...@@ -46,7 +46,7 @@ public class SaasUserController { ...@@ -46,7 +46,7 @@ public class SaasUserController {
return ApiResponseUtils.success(saasUserService.page(page)); return ApiResponseUtils.success(saasUserService.page(page));
} }
@ApiOperation("分页列表") @ApiOperation("分页列表-免登录")
@PostMapping("pageAuthIgnore") @PostMapping("pageAuthIgnore")
public ApiResponseEntity<PageVO<SaasUserDTOVO>> pageAuthIgnore(@RequestBody PageReqDTO<SaasUserQueryDTO> page){ public ApiResponseEntity<PageVO<SaasUserDTOVO>> pageAuthIgnore(@RequestBody PageReqDTO<SaasUserQueryDTO> page){
return ApiResponseUtils.success(saasUserService.page(page)); return ApiResponseUtils.success(saasUserService.page(page));
......
...@@ -4,8 +4,11 @@ import com.makeit.utils.data.locale.LocaleUtil; ...@@ -4,8 +4,11 @@ import com.makeit.utils.data.locale.LocaleUtil;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
import java.util.Objects;
@Data @Data
@ApiModel("excel导入错误信息VO") @ApiModel("excel导入错误信息VO")
...@@ -41,4 +44,17 @@ public class ExcelErrorVo implements Serializable { ...@@ -41,4 +44,17 @@ public class ExcelErrorVo implements Serializable {
public ExcelErrorVo() { public ExcelErrorVo() {
} }
public static void isNotNull(String value,List<ExcelErrorVo> errorVoList, int i, String title) {
if(StringUtils.isBlank(value)) {
errorVoList.add(new ExcelErrorVo(i, title, "数据不为空"));
}
}
public static void notExists(Object object,List<ExcelErrorVo> errorVoList,int i,String title){
if(Objects.isNull(object)){
errorVoList.add(new ExcelErrorVo(i,title,"数据库数据不存在"));
}
}
} }
...@@ -94,6 +94,9 @@ public enum CodeMessageEnum { ...@@ -94,6 +94,9 @@ public enum CodeMessageEnum {
PLATFORM_ERROR_ELDER_CERTIFICATENUMBER_DUPLICATE(500, "PLATFORM.ERROR.ELDER.CERTIFICATENUMBER.DUPLICATE"), PLATFORM_ERROR_ELDER_CERTIFICATENUMBER_DUPLICATE(500, "PLATFORM.ERROR.ELDER.CERTIFICATENUMBER.DUPLICATE"),
PLATFORM_ERROR_SPACE_NAME_DUPLICATE(500,"PLATFORM.ERROR.SPACE.NAME.DUPLICATE"),
......
...@@ -32,20 +32,20 @@ public class PlatUserQueryDTO extends BaseOrgDTO { ...@@ -32,20 +32,20 @@ public class PlatUserQueryDTO extends BaseOrgDTO {
@ApiModelProperty(value = "要排除的角色id roleId和notRoleId只能用一个") @ApiModelProperty(value = "要排除的角色id roleId和notRoleId只能用一个")
private String notRoleId; private String notRoleId;
@ApiModelProperty(value = "关键词 用来搜姓名或者工号") // @ApiModelProperty(value = "关键词 用来搜姓名或者工号")
private String keyword; // private String keyword;
//
@ApiModelProperty(value = "职级") // @ApiModelProperty(value = "职级")
private Integer postLevel; // private Integer postLevel;
//
@ApiModelProperty(value = "是否从酒店开始 0否 1是") // @ApiModelProperty(value = "是否从酒店开始 0否 1是")
private String fromHotel; // private String fromHotel;
//
@ApiModelProperty(value = "是否常用人员 0否 1是") // @ApiModelProperty(value = "是否常用人员 0否 1是")
private String isFrequent; // private String isFrequent;
//
@ApiModelProperty(value = "标签id") // @ApiModelProperty(value = "标签id")
private String labelId; // private String labelId;
@ApiModelProperty(value = "用户工号集合") @ApiModelProperty(value = "用户工号集合")
private List<String> accountList; private List<String> accountList;
......
...@@ -88,3 +88,6 @@ SYSTEM.ERROR.SMS.CODE.NOT.EXIST=验证码已过期 ...@@ -88,3 +88,6 @@ SYSTEM.ERROR.SMS.CODE.NOT.EXIST=验证码已过期
SYSTEM.ERROR.SMS.CODE.NOT.CORRECT=验证码不正确 SYSTEM.ERROR.SMS.CODE.NOT.CORRECT=验证码不正确
PLATFORM.ERROR.ELDER.CERTIFICATENUMBER.DUPLICATE=证件号不能重复 PLATFORM.ERROR.ELDER.CERTIFICATENUMBER.DUPLICATE=证件号不能重复
PLATFORM.ERROR.SPACE.NAME.DUPLICATE=同一层级,空间名称不能重复
\ No newline at end of file
package com.makeit.module.controller.space;
import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils;
import com.makeit.dto.platform.space.PlatSpaceAddDTO;
import com.makeit.service.platform.space.PlatSpaceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author:lzy
* @Date:2023/9/4 16:52
* @Describe:
*/
@Api(tags = "空间管理")
@RestController
@RequestMapping("/plat/space")
public class PlatSpaceController {
@Autowired
private PlatSpaceService spaceService;
@ApiOperation("新增")
@PostMapping("add")
public ApiResponseEntity<?> add(@Validated @RequestBody PlatSpaceAddDTO dto) {
spaceService.add(dto);
return ApiResponseUtils.success();
}
}
package com.makeit.dto.platform.auth;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
@Data
public class PlatUserImportDTO {
private static final String headDesc = "导入说明:\n" +
"\n" +
"1.带*号为必填项\n" +
"\n" +
"2.手机号和邮箱不可重复\n" +
"\n" +
"3.角色必须为【角色管理】处维护的角色名称\n" +
"\n" +
"4.导入人员默认登录密码为:888888";
@ExcelProperty(value = "姓名*")
private String username;
@ExcelProperty(value = "手机号*")
private String mobile;
@ExcelProperty(value = "邮箱")
private String email;
@ExcelProperty(value = "所属组织*")
private String orgName;
@ExcelProperty(value = "角色*")
private String roleName;
@ExcelProperty(value = "备注")
private String remark;
@ExcelIgnore
private String password = "888888";
}
package com.makeit.dto.platform.space;
import com.makeit.common.dto.BaseTenantDTO;
import com.makeit.enums.platform.space.PlatSpaceEnum;
import com.makeit.global.validator.DictEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
/**
* @Author:lzy
* @Date:2023/9/5 9:50
* @Describe:
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "PlatSpaceAddDTO对象", description = "空间添加")
public class PlatSpaceAddDTO extends BaseTenantDTO {
@NotBlank(message = "空间名称不能为空")
@Size(max = 50, message = "空间名称最长为50个字符")
@ApiModelProperty(value = "空间名称")
private String name;
@DictEnum(em = PlatSpaceEnum.TypeEnum.class, message = "空间类型可选值为{m}")
@ApiModelProperty(value = "空间类型 数据字典 1:小区/社区/街道 2:楼栋 3:单元 4 楼层")
private String type;
@ApiModelProperty(value = "上级空间")
private String parentId;
@ApiModelProperty(value = "地址")
private String address;
@ApiModelProperty(value = "经度")
private String longitude;
@ApiModelProperty(value = "纬度")
private String latitude;
}
...@@ -14,7 +14,7 @@ import lombok.EqualsAndHashCode; ...@@ -14,7 +14,7 @@ import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value = "Bed对象", description = "床位管理") @ApiModel(value = "Bed对象", description = "床位管理")
public class Bed extends BaseBusEntity { public class PlatBed extends BaseBusEntity {
@ApiModelProperty(value = "名称") @ApiModelProperty(value = "名称")
private String name; private String name;
......
...@@ -14,7 +14,7 @@ import lombok.EqualsAndHashCode; ...@@ -14,7 +14,7 @@ import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value = "RegionSetting对象", description = "区域设置") @ApiModel(value = "RegionSetting对象", description = "区域设置")
public class RegionSetting extends BaseBusEntity { public class PlatRegionSetting extends BaseBusEntity {
@ApiModelProperty(value = "区域名称") @ApiModelProperty(value = "区域名称")
private String name; private String name;
......
...@@ -14,7 +14,7 @@ import lombok.EqualsAndHashCode; ...@@ -14,7 +14,7 @@ import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value = "RegionSettingLocation对象", description = "区域设置定位") @ApiModel(value = "RegionSettingLocation对象", description = "区域设置定位")
public class RegionSettingLocation extends BaseBusEntity { public class PlatRegionSettingLocation extends BaseBusEntity {
@ApiModelProperty("区域设置Id") @ApiModelProperty("区域设置Id")
private String regionSettingId; private String regionSettingId;
......
...@@ -14,7 +14,7 @@ import lombok.EqualsAndHashCode; ...@@ -14,7 +14,7 @@ import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value = "Room对象", description = "房间管理") @ApiModel(value = "Room对象", description = "房间管理")
public class Room extends BaseBusEntity { public class PlatRoom extends BaseBusEntity {
@ApiModelProperty(value = "名称") @ApiModelProperty(value = "名称")
......
...@@ -14,7 +14,7 @@ import lombok.EqualsAndHashCode; ...@@ -14,7 +14,7 @@ import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value = "Space对象", description = "空间管理") @ApiModel(value = "Space对象", description = "空间管理")
public class Space extends BaseBusEntity { public class PlatSpace extends BaseBusEntity {
@ApiModelProperty(value = "名称") @ApiModelProperty(value = "名称")
private String name; private String name;
......
package com.makeit.enums.platform.space;
import com.makeit.enums.BaseEnum;
import com.makeit.utils.sys.SysDictUtil;
/**
* @Author:lzy
* @Date:2023/9/4 17:57
* @Describe:
*/
public class PlatSpaceEnum {
public enum TypeEnum implements BaseEnum {
//community 小区/社区/街道
//building 楼栋
//unit 单元
//floor 楼层
COMMUNITY("space.type.community"),
BUILDING("space.type.building"),
UNIT("space.type.unit"),
FLOOR("space.type.floor");
private String code;
TypeEnum(String code) {
this.code = code;
}
@Override
public String getValue() {
return SysDictUtil.getValue(code);
}
}
}
package com.makeit.mapper.platform.space; package com.makeit.mapper.platform.space;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.makeit.entity.platform.space.Bed; import com.makeit.entity.platform.space.PlatBed;
/** /**
* @Author:lzy * @Author:lzy
* @Date:2023/8/31 11:58 * @Date:2023/8/31 11:58
* @Describe: * @Describe:
*/ */
public interface BedMapper extends BaseMapper<Bed> { public interface PlatBedMapper extends BaseMapper<PlatBed> {
} }
package com.makeit.mapper.platform.space; package com.makeit.mapper.platform.space;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.makeit.entity.platform.space.RegionSettingLocation; import com.makeit.entity.platform.space.PlatRegionSettingLocation;
/** /**
* @Author:lzy * @Author:lzy
* @Date:2023/8/31 11:59 * @Date:2023/8/31 11:59
* @Describe: * @Describe:
*/ */
public interface RegionSettingLocationMapper extends BaseMapper<RegionSettingLocation> { public interface PlatRegionSettingLocationMapper extends BaseMapper<PlatRegionSettingLocation> {
} }
package com.makeit.mapper.platform.space; package com.makeit.mapper.platform.space;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.makeit.entity.platform.space.RegionSetting; import com.makeit.entity.platform.space.PlatRegionSetting;
/** /**
* @Author:lzy * @Author:lzy
* @Date:2023/8/31 11:59 * @Date:2023/8/31 11:59
* @Describe: * @Describe:
*/ */
public interface RegionSettingMapper extends BaseMapper<RegionSetting> { public interface PlatRegionSettingMapper extends BaseMapper<PlatRegionSetting> {
} }
package com.makeit.mapper.platform.space; package com.makeit.mapper.platform.space;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.makeit.entity.platform.space.Room; import com.makeit.entity.platform.space.PlatRoom;
/** /**
* @Author:lzy * @Author:lzy
* @Date:2023/8/31 12:00 * @Date:2023/8/31 12:00
* @Describe: * @Describe:
*/ */
public interface RoomMapper extends BaseMapper<Room> { public interface PlatRoomMapper extends BaseMapper<PlatRoom> {
} }
package com.makeit.mapper.platform.space; package com.makeit.mapper.platform.space;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.makeit.entity.platform.space.Space; import com.makeit.entity.platform.space.PlatSpace;
/** /**
* @Author:lzy * @Author:lzy
* @Date:2023/8/31 12:01 * @Date:2023/8/31 12:01
* @Describe: * @Describe:
*/ */
public interface SpaceMapper extends BaseMapper<Space> { public interface PlatSpaceMapper extends BaseMapper<PlatSpace> {
} }
...@@ -6,6 +6,7 @@ import com.makeit.common.dto.LoginDTO; ...@@ -6,6 +6,7 @@ import com.makeit.common.dto.LoginDTO;
import com.makeit.common.dto.StatusDTO; import com.makeit.common.dto.StatusDTO;
import com.makeit.common.page.PageReqDTO; import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO; import com.makeit.common.page.PageVO;
import com.makeit.common.vo.ExcelImportVo;
import com.makeit.entity.platform.auth.PlatOrg; import com.makeit.entity.platform.auth.PlatOrg;
import com.makeit.entity.platform.auth.PlatRole; import com.makeit.entity.platform.auth.PlatRole;
import com.makeit.entity.platform.auth.PlatUser; import com.makeit.entity.platform.auth.PlatUser;
...@@ -16,6 +17,7 @@ import com.makeit.module.admin.dto.plat.PlatUserQueryDTO; ...@@ -16,6 +17,7 @@ import com.makeit.module.admin.dto.plat.PlatUserQueryDTO;
import com.makeit.module.admin.vo.plat.PlatUserLoginVO; import com.makeit.module.admin.vo.plat.PlatUserLoginVO;
import com.makeit.vo.platform.auth.PlatPersonDTOVO; import com.makeit.vo.platform.auth.PlatPersonDTOVO;
import com.makeit.vo.platform.auth.PlatUserCountVO; import com.makeit.vo.platform.auth.PlatUserCountVO;
import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -56,14 +58,10 @@ public interface PlatUserService extends IService<PlatUser> { ...@@ -56,14 +58,10 @@ public interface PlatUserService extends IService<PlatUser> {
PlatUserLoginVO getRoleAndMenuList2(); PlatUserLoginVO getRoleAndMenuList2();
// PlatUserLoginVO getWechatMenuList();
PlatUserLoginVO getUserVO(); PlatUserLoginVO getUserVO();
PlatPersonDTOVO getUserDetail(); PlatPersonDTOVO getUserDetail();
// List<String> getCustomGroupNameList();
List<PlatRole> getRoleList(String userId); List<PlatRole> getRoleList(String userId);
...@@ -86,10 +84,6 @@ public interface PlatUserService extends IService<PlatUser> { ...@@ -86,10 +84,6 @@ public interface PlatUserService extends IService<PlatUser> {
PlatPersonDTOVO viewPerson(String id); PlatPersonDTOVO viewPerson(String id);
// void changeDeptMessage(PlatUser tntUser, String oldDeptId, String newDeptId);
//void leaveMessage(PlatUser tntUser);
List<PlatRole> getRoleListWithTag(String userId); List<PlatRole> getRoleListWithTag(String userId);
PlatRole getMaxRole(String userId); PlatRole getMaxRole(String userId);
...@@ -114,11 +108,6 @@ public interface PlatUserService extends IService<PlatUser> { ...@@ -114,11 +108,6 @@ public interface PlatUserService extends IService<PlatUser> {
List<PlatOrg> getCandidateDeptList(); List<PlatOrg> getCandidateDeptList();
// List<String> getCustomGroupNameList(String userId);
//
// List<String> getCustomGroupIdList(String userId);
List<PlatMenu> getMenuListByUserId(String userId); List<PlatMenu> getMenuListByUserId(String userId);
/** /**
...@@ -137,4 +126,8 @@ public interface PlatUserService extends IService<PlatUser> { ...@@ -137,4 +126,8 @@ public interface PlatUserService extends IService<PlatUser> {
* @param platUserId * @param platUserId
*/ */
void updatePlatUserTenantId(String tenantId,String platUserId); void updatePlatUserTenantId(String tenantId,String platUserId);
void delBatch(List<String> idList);
ExcelImportVo importExcel(MultipartFile excelFile) throws Exception;
} }
...@@ -17,8 +17,6 @@ import com.makeit.enums.CommonEnum; ...@@ -17,8 +17,6 @@ import com.makeit.enums.CommonEnum;
import com.makeit.enums.id.TreeConst; import com.makeit.enums.id.TreeConst;
import com.makeit.global.aspect.tenant.TenantIdUtil; import com.makeit.global.aspect.tenant.TenantIdUtil;
import com.makeit.mapper.platform.auth.PlatOrgMapper; import com.makeit.mapper.platform.auth.PlatOrgMapper;
import com.makeit.module.admin.dto.plat.PlatUserQueryDTO;
import com.makeit.module.system.service.SysConfigCategoryService;
import com.makeit.service.platform.auth.PlatOrgService; import com.makeit.service.platform.auth.PlatOrgService;
import com.makeit.service.platform.auth.PlatRoleOrgService; import com.makeit.service.platform.auth.PlatRoleOrgService;
import com.makeit.service.platform.auth.PlatRoleService; import com.makeit.service.platform.auth.PlatRoleService;
...@@ -29,7 +27,6 @@ import com.makeit.utils.data.convert.StreamUtil; ...@@ -29,7 +27,6 @@ import com.makeit.utils.data.convert.StreamUtil;
import com.makeit.utils.user.plat.PlatUserUtil; import com.makeit.utils.user.plat.PlatUserUtil;
import com.makeit.utils.user.plat.PlatUserVO; import com.makeit.utils.user.plat.PlatUserVO;
import com.makeit.vo.platform.auth.PlatOrgQueryDTO; import com.makeit.vo.platform.auth.PlatOrgQueryDTO;
import com.makeit.vo.platform.auth.PlatUserCountVO;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -58,16 +55,11 @@ import java.util.stream.Stream; ...@@ -58,16 +55,11 @@ import java.util.stream.Stream;
@Service @Service
public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
implements PlatOrgService { implements PlatOrgService {
// @Autowired
// private TntAsyncCommonService tntAsyncCommonService;
@Autowired @Autowired
private PlatUserService platUserService; private PlatUserService platUserService;
@Autowired @Autowired
private SysConfigCategoryService sysConfigCategoryService;
@Autowired
private PlatUserRoleService platUserRoleService; private PlatUserRoleService platUserRoleService;
@Autowired @Autowired
private PlatRoleOrgService platRoleOrgService; private PlatRoleOrgService platRoleOrgService;
...@@ -98,19 +90,11 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -98,19 +90,11 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
List<PlatOrg> deptList = list(new QueryWrapper<PlatOrg>().lambda() List<PlatOrg> deptList = list(new QueryWrapper<PlatOrg>().lambda()
.eq(StringUtils.isNotBlank(dto.getType()),PlatOrg::getType,dto.getType()) .eq(StringUtils.isNotBlank(dto.getType()), PlatOrg::getType, dto.getType())
); );
deptList.forEach(e -> {
// e.setCanTap(CommonEnum.YES.getValue());
});
List<PlatOrg> tntDeptList = this.getDeptSelfAndChildren(dto.getOrgId()); List<PlatOrg> tntDeptList = this.getDeptSelfAndChildren(dto.getOrgId());
// if (CommonEnum.YES.getValue().equals(dto.getFromHotel())) {
// tntDeptList = StreamUtil.filter(tntDeptList, e -> DeptEnum.DeptTagEnum.HOTEL.getValue().equals(e.getTag()));
// }
List<String> idList = StreamUtil.map(tntDeptList, PlatOrg::getId); List<String> idList = StreamUtil.map(tntDeptList, PlatOrg::getId);
if (StringUtils.isNotBlank(dto.getOrgId())) {//左上方可点击的 和 左下方中的任意 if (StringUtils.isNotBlank(dto.getOrgId())) {//左上方可点击的 和 左下方中的任意
idList.add(dto.getOrgId()); idList.add(dto.getOrgId());
...@@ -122,9 +106,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -122,9 +106,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
List<PlatOrg> newList = new ArrayList<>(10); List<PlatOrg> newList = new ArrayList<>(10);
flat(topList, newList); flat(topList, newList);
newList.forEach(e -> { newList.forEach(e -> e.setChildren(null));
e.setChildren(null);
});
tntDeptList = newList; tntDeptList = newList;
tntDeptList = filter(tntDeptList, dto); tntDeptList = filter(tntDeptList, dto);
...@@ -135,7 +117,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -135,7 +117,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
private List<PlatOrg> tree(List<PlatOrg> tntDeptList, List<String> deptIdList) { private List<PlatOrg> tree(List<PlatOrg> tntDeptList, List<String> deptIdList) {
Map<String, PlatOrg> map = StreamUtil.toMap(tntDeptList, PlatOrg::getId); Map<String, PlatOrg> map = StreamUtil.toMap(tntDeptList, PlatOrg::getId);
List<PlatOrg> topList = deptIdList.stream().map(e -> map.get(e)).filter(Objects::nonNull).collect(Collectors.toList()); List<PlatOrg> topList = deptIdList.stream().map(map::get).filter(Objects::nonNull).collect(Collectors.toList());
tntDeptList.forEach(e -> { tntDeptList.forEach(e -> {
PlatOrg parent = map.get(e.getParentId()); PlatOrg parent = map.get(e.getParentId());
if (parent != null) { if (parent != null) {
...@@ -156,7 +138,6 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -156,7 +138,6 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
public List<PlatOrg> tree(List<PlatOrg> tntDeptList) { public List<PlatOrg> tree(List<PlatOrg> tntDeptList) {
Map<String, PlatOrg> map = StreamUtil.toMap(tntDeptList, PlatOrg::getId); Map<String, PlatOrg> map = StreamUtil.toMap(tntDeptList, PlatOrg::getId);
//List<PlatOrg> topList = StreamUtil.filter(tntDeptList, e -> TreeConst.TOP_LEVEL.equals(e.getParentId()));
List<PlatOrg> topList = new ArrayList<>(10); List<PlatOrg> topList = new ArrayList<>(10);
tntDeptList.forEach(e -> { tntDeptList.forEach(e -> {
PlatOrg parent = map.get(e.getParentId()); PlatOrg parent = map.get(e.getParentId());
...@@ -245,9 +226,9 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -245,9 +226,9 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
//获取对应部门名称的部门数据 //获取对应部门名称的部门数据
List<PlatOrg> tntDepts = StreamUtil.filter(selfAndChildren, e -> deptName.equals(e.getName())); List<PlatOrg> tntDepts = StreamUtil.filter(selfAndChildren, e -> deptName.equals(e.getName()));
if (CollectionUtils.isNotEmpty(tntDepts)) { if (CollectionUtils.isNotEmpty(tntDepts)) {
List<PlatOrg> PlatOrgFilterByName = tree(selfAndChildren, Arrays.asList(tntDepts.get(0).getId())); List<PlatOrg> platOrgFilterByName = tree(selfAndChildren, Arrays.asList(tntDepts.get(0).getId()));
List<PlatOrg> tntDeptArrayList = new ArrayList<>(10); List<PlatOrg> tntDeptArrayList = new ArrayList<>(10);
flat(PlatOrgFilterByName, tntDeptArrayList); flat(platOrgFilterByName, tntDeptArrayList);
return tntDeptArrayList; return tntDeptArrayList;
} }
} }
...@@ -316,9 +297,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -316,9 +297,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
public void flat(List<PlatOrg> oldList, List<PlatOrg> newList) { public void flat(List<PlatOrg> oldList, List<PlatOrg> newList) {
if (oldList != null) { if (oldList != null) {
newList.addAll(oldList); newList.addAll(oldList);
oldList.forEach(e -> { oldList.forEach(e -> flat(e.getChildren(), newList));
flat(e.getChildren(), newList);
});
} }
} }
...@@ -326,9 +305,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -326,9 +305,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
public void flatChildren(PlatOrg old, List<PlatOrg> newList) { public void flatChildren(PlatOrg old, List<PlatOrg> newList) {
if (old != null && old.getChildren() != null) { if (old != null && old.getChildren() != null) {
newList.addAll(old.getChildren()); newList.addAll(old.getChildren());
old.getChildren().forEach(e -> { old.getChildren().forEach(e -> flatChildren(e, newList));
flatChildren(e, newList);
});
} }
} }
...@@ -364,14 +341,6 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -364,14 +341,6 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
List<PlatOrg> list = list(dto); List<PlatOrg> list = list(dto);
List<PlatOrg> tree = tree(list); List<PlatOrg> tree = tree(list);
// list = new ArrayList<>(10);
// flat(tree,list);
//System.out.println(tntUserService.listCount(new TntUserQueryDTO()));
List<PlatUserCountVO> countVOList = platUserService.listCount(new PlatUserQueryDTO());
Map<String, Integer> countVOMap = countVOList.stream().collect(Collectors.toMap(PlatUserCountVO::getOrgId, PlatUserCountVO::getCount));
Map<PlatOrg, List<PlatOrg>> deptMap = new HashMap<>(16); Map<PlatOrg, List<PlatOrg>> deptMap = new HashMap<>(16);
List<PlatOrg> deptList = new ArrayList<>(tree); List<PlatOrg> deptList = new ArrayList<>(tree);
...@@ -399,23 +368,19 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -399,23 +368,19 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
return tree; return tree;
} }
private void check(PlatOrg dto) {
}
@Transactional @Transactional
@Override @Override
public String add(PlatOrg dto) { public String add(PlatOrg dto) {
check(dto);
dto.setTenantId(TenantIdUtil.getTenantId()); dto.setTenantId(TenantIdUtil.getTenantId());
if(StringUtils.isBlank(dto.getParentId())){ if (StringUtils.isBlank(dto.getParentId())) {
String tenantId = TenantIdUtil.getTenantId(); String tenantId = TenantIdUtil.getTenantId();
dto.setParentId(tenantId); dto.setParentId(tenantId);
dto.setPath(tenantId); dto.setPath(tenantId);
}else { } else {
PlatOrg parent = getById(dto.getParentId()); PlatOrg parent = getById(dto.getParentId());
dto.setPath(parent.getPath()+","+parent.getId()); dto.setPath(parent.getPath() + "," + parent.getId());
} }
save(dto); save(dto);
return dto.getId(); return dto.getId();
...@@ -424,15 +389,14 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -424,15 +389,14 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
@Transactional @Transactional
@Override @Override
public void edit(PlatOrg dto) { public void edit(PlatOrg dto) {
check(dto);
if(StringUtils.isBlank(dto.getParentId())){ if (StringUtils.isBlank(dto.getParentId())) {
String tenantId = TenantIdUtil.getTenantId(); String tenantId = TenantIdUtil.getTenantId();
dto.setParentId(tenantId); dto.setParentId(tenantId);
dto.setPath(tenantId); dto.setPath(tenantId);
}else { } else {
PlatOrg parent = getById(dto.getParentId()); PlatOrg parent = getById(dto.getParentId());
dto.setPath(parent.getPath()+","+parent.getId()); dto.setPath(parent.getPath() + "," + parent.getId());
} }
updateById(dto); updateById(dto);
...@@ -472,13 +436,12 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -472,13 +436,12 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
@Override @Override
public List<PlatOrg> listWithoutDept() { public List<PlatOrg> listWithoutDept() {
List<PlatOrg> deptList = list(new QueryWrapper<PlatOrg>().lambda()
return list(new QueryWrapper<PlatOrg>().lambda()
.eq(PlatOrg::getStatus, CommonEnum.YES.getValue()) .eq(PlatOrg::getStatus, CommonEnum.YES.getValue())
.orderByAsc(PlatOrg::getSort) .orderByAsc(PlatOrg::getSort)
.orderByAsc(PlatOrg::getCreateDate) .orderByAsc(PlatOrg::getCreateDate)
); );
return deptList;
} }
...@@ -490,11 +453,10 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -490,11 +453,10 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
@Override @Override
public List<PlatOrg> getDeptSelfAndChildren(String deptId) {//给筛选列表用 包含自己 public List<PlatOrg> getDeptSelfAndChildren(String deptId) {//给筛选列表用 包含自己
List<PlatOrg> newList =platUserService. getDeptList(); List<PlatOrg> newList = platUserService.getDeptList();
if (StringUtils.isBlank(deptId)) { if (StringUtils.isBlank(deptId)) {
return newList; return newList;
} else { } else {
List<PlatOrg> treeList = this.tree(newList);
List<PlatOrg> deptList = StreamUtil.filter(newList, e -> e.getId().equals(deptId)); List<PlatOrg> deptList = StreamUtil.filter(newList, e -> e.getId().equals(deptId));
if (!deptList.isEmpty()) { if (!deptList.isEmpty()) {
this.flat(deptList.get(0).getChildren(), deptList); this.flat(deptList.get(0).getChildren(), deptList);
...@@ -507,6 +469,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -507,6 +469,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
/** /**
* 获取权限范围树 * 获取权限范围树
* 当前账号所属角色的权限级别,可查看某一级或者某一级及其下级 * 当前账号所属角色的权限级别,可查看某一级或者某一级及其下级
*
* @return * @return
*/ */
@Override @Override
...@@ -514,15 +477,15 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -514,15 +477,15 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
PlatUserVO userVO = PlatUserUtil.getUserVO(); PlatUserVO userVO = PlatUserUtil.getUserVO();
String isTenant = userVO.getIsTenant(); String isTenant = userVO.getIsTenant();
//如果是租户账号 则有所有权限 //如果是租户账号 则有所有权限
if(StringUtils.equals(isTenant,CommonEnum.YES.getValue())){ if (StringUtils.equals(isTenant, CommonEnum.YES.getValue())) {
List<PlatOrg> orgList = this.list(new LambdaQueryWrapper<PlatOrg>().eq(PlatOrg::getStatus,CommonEnum.YES.getValue())); List<PlatOrg> orgList = this.list(new LambdaQueryWrapper<PlatOrg>().eq(PlatOrg::getStatus, CommonEnum.YES.getValue()));
return getOrgTree(orgList); return getOrgTree(orgList);
} }
//平台账号 //平台账号
Set<String> orgIdList = getOrgIdListByUserId(userVO.getId()); Set<String> orgIdList = getOrgIdListByUserId(userVO.getId());
List<PlatOrg> orgList = this.list(new LambdaQueryWrapper<PlatOrg>().in(BaseEntity::getId,orgIdList).eq(PlatOrg::getStatus,CommonEnum.YES.getValue())); List<PlatOrg> orgList = this.list(new LambdaQueryWrapper<PlatOrg>().in(BaseEntity::getId, orgIdList).eq(PlatOrg::getStatus, CommonEnum.YES.getValue()));
if(CollectionUtils.isEmpty(orgList)){ if (CollectionUtils.isEmpty(orgList)) {
return new ArrayList<>(); return new ArrayList<>();
} }
Set<String> allOrgIdSet = orgList.stream().flatMap(vo -> { Set<String> allOrgIdSet = orgList.stream().flatMap(vo -> {
...@@ -530,7 +493,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -530,7 +493,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
String[] split = StringUtils.split(path, ","); String[] split = StringUtils.split(path, ",");
return Stream.of(split); return Stream.of(split);
}).collect(Collectors.toSet()); }).collect(Collectors.toSet());
List<PlatOrg> allOrgList = this.list(new LambdaQueryWrapper<PlatOrg>().in(BaseEntity::getId,allOrgIdSet).eq(PlatOrg::getStatus,CommonEnum.YES.getValue())); List<PlatOrg> allOrgList = this.list(new LambdaQueryWrapper<PlatOrg>().in(BaseEntity::getId, allOrgIdSet).eq(PlatOrg::getStatus, CommonEnum.YES.getValue()));
orgList.addAll(allOrgList); orgList.addAll(allOrgList);
return getOrgTree(orgList); return getOrgTree(orgList);
} }
...@@ -543,25 +506,30 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -543,25 +506,30 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
*/ */
@Override @Override
public Set<String> getOrgIdListByUserId(String userId) { public Set<String> getOrgIdListByUserId(String userId) {
List<PlatUserRole> userRoleList =platUserRoleService.getByUserId(userId); List<PlatUserRole> userRoleList = platUserRoleService.getByUserId(userId);
if(CollectionUtils.isEmpty(userRoleList)){ if (CollectionUtils.isEmpty(userRoleList)) {
return new HashSet<>(); return new HashSet<>();
} }
List<PlatRoleOrg> roleOrgList = platRoleOrgService.getByRoleIds(userRoleList.stream().map(PlatUserRole::getRoleId).collect(Collectors.toSet())); List<PlatRoleOrg> roleOrgList = platRoleOrgService.getByRoleIds(userRoleList.stream().map(PlatUserRole::getRoleId).collect(Collectors.toSet()));
if(CollectionUtils.isEmpty(roleOrgList)){ if (CollectionUtils.isEmpty(roleOrgList)) {
return new HashSet<>(); return new HashSet<>();
} }
List<PlatRole> roleList = platRoleService.listByIds(roleOrgList.stream().map(PlatRoleOrg::getRoleId).collect(Collectors.toList())); List<PlatRole> roleList = platRoleService.listByIds(roleOrgList.stream().map(PlatRoleOrg::getRoleId).collect(Collectors.toList()));
return roleList.stream().flatMap(vo-> Stream.of(vo.getDataScope().split(","))).collect(Collectors.toSet()); return roleList.stream().flatMap(vo -> Stream.of(vo.getDataScope().split(","))).collect(Collectors.toSet());
} }
/**
* 从租户开始的组织树
* @param orgList
* @return
*/
private List<PlatOrg> getOrgTree(List<PlatOrg> orgList) { private List<PlatOrg> getOrgTree(List<PlatOrg> orgList) {
Map<String, List<PlatOrg>> parentIdMap = orgList.stream().collect(Collectors.groupingBy(PlatOrg::getParentId)); Map<String, List<PlatOrg>> parentIdMap = orgList.stream().collect(Collectors.groupingBy(PlatOrg::getParentId));
orgList.forEach(vo->{ orgList.forEach(vo -> {
List<PlatOrg> childList = parentIdMap.get(vo.getId()); List<PlatOrg> childList = parentIdMap.get(vo.getId());
vo.setChildren(childList); vo.setChildren(childList);
}); });
return orgList.stream().filter(vo -> StringUtils.equals(vo.getTenantId(), vo.getParentId())).collect(Collectors.toList()); return orgList.stream().filter(vo -> StringUtils.equals(vo.getTenantId(), vo.getId())).collect(Collectors.toList());
} }
/** /**
...@@ -585,10 +553,10 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -585,10 +553,10 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
Page<PlatOrg> p = PageUtil.toMpPage(pageReqDTO); Page<PlatOrg> p = PageUtil.toMpPage(pageReqDTO);
LambdaQueryWrapper<PlatOrg> queryWrapper = getLambdaQueryWrapper(dto); LambdaQueryWrapper<PlatOrg> queryWrapper = getLambdaQueryWrapper(dto);
queryWrapper.eq(BaseEntity::getId,tenantId); queryWrapper.eq(BaseEntity::getId, tenantId);
Page<PlatOrg> pageList = page(p, queryWrapper); Page<PlatOrg> pageList = page(p, queryWrapper);
List<PlatOrg> records = pageList.getRecords(); List<PlatOrg> records = pageList.getRecords();
records.forEach(vo->{ records.forEach(vo -> {
dto.setParentId(tenantId); dto.setParentId(tenantId);
List<PlatOrg> subOrgList = subOrgList(dto); List<PlatOrg> subOrgList = subOrgList(dto);
vo.setChildren(subOrgList); vo.setChildren(subOrgList);
......
...@@ -68,9 +68,6 @@ implements PlatRoleService { ...@@ -68,9 +68,6 @@ implements PlatRoleService {
@Autowired @Autowired
private PlatMenuService platMenuService; private PlatMenuService platMenuService;
// @Autowired
// private PlatRoleWechatMenuService tntRoleWechatMenuService;
@Autowired @Autowired
private PlatRoleOrgService platRoleOrgService; private PlatRoleOrgService platRoleOrgService;
...@@ -90,9 +87,7 @@ implements PlatRoleService { ...@@ -90,9 +87,7 @@ implements PlatRoleService {
List<PlatRole> tntRoleList = list(listWrapper(dto)); List<PlatRole> tntRoleList = list(listWrapper(dto));
List<PlatRoleDTOVO> rolVOList = BeanDtoVoUtils.listVo(tntRoleList, PlatRoleDTOVO.class); List<PlatRoleDTOVO> rolVOList = BeanDtoVoUtils.listVo(tntRoleList, PlatRoleDTOVO.class);
JoinUtil.join(rolVOList, platOrgService, PlatRoleDTOVO::getOrgId, PlatOrg::getId, (r, e) -> { JoinUtil.join(rolVOList, platOrgService, PlatRoleDTOVO::getOrgId, PlatOrg::getId, (r, e) -> r.setDeptName(e.getName()));
r.setDeptName(e.getName());
});
return BeanDtoVoUtils.listVo(tntRoleList, PlatRoleDTOVO.class); return BeanDtoVoUtils.listVo(tntRoleList, PlatRoleDTOVO.class);
} }
...@@ -107,9 +102,7 @@ implements PlatRoleService { ...@@ -107,9 +102,7 @@ implements PlatRoleService {
List<PlatRoleDTOVO> tntUserVOList = BeanDtoVoUtils.listVo(pageList.getRecords(), PlatRoleDTOVO.class); List<PlatRoleDTOVO> tntUserVOList = BeanDtoVoUtils.listVo(pageList.getRecords(), PlatRoleDTOVO.class);
JoinUtil.join(tntUserVOList, platOrgService, PlatRoleDTOVO::getOrgId, PlatOrg::getId, (r, e) -> { JoinUtil.join(tntUserVOList, platOrgService, PlatRoleDTOVO::getOrgId, PlatOrg::getId, (r, e) -> r.setDeptName(e.getName()));
r.setDeptName(e.getName());
});
return PageUtil.toPageVO(tntUserVOList, pageList); return PageUtil.toPageVO(tntUserVOList, pageList);
...@@ -184,9 +177,7 @@ implements PlatRoleService { ...@@ -184,9 +177,7 @@ implements PlatRoleService {
PlatRoleDTOVO vo = BeanDtoVoUtils.convert(getById(id), PlatRoleDTOVO.class); PlatRoleDTOVO vo = BeanDtoVoUtils.convert(getById(id), PlatRoleDTOVO.class);
JoinUtil.join(Arrays.asList(vo), platOrgService, PlatRoleDTOVO::getOrgId, PlatOrg::getId, (r, e) -> { JoinUtil.join(Arrays.asList(vo), platOrgService, PlatRoleDTOVO::getOrgId, PlatOrg::getId, (r, e) -> r.setDeptName(e.getName()));
r.setDeptName(e.getName());
});
return vo; return vo;
} }
...@@ -238,152 +229,9 @@ implements PlatRoleService { ...@@ -238,152 +229,9 @@ implements PlatRoleService {
}); });
} }
// @Override
// public void exportTemplate(HttpServletResponse response) {
// ExcelUtil.exportTemplate(response, "用户角色关联.xls", "用户角色关联\n以英文逗号分割多个角色名称", PlatUserRoleImportDTO.class);
// }
// @Override
// public ExcelImportVo importExcel(String deptId, String hotelId, MultipartFile excelFile) throws Exception{
// return ExcelUtil.importExcel(deptId, excelFile, PlatUserRoleImportDTO.class, c -> {
//
// List<PlatUserRoleImportDTO> l = c.getList();
//
// List<ExcelErrorVo> excelErrorVoList = new ArrayList<>(10);
//
// List<String> accountList = new ArrayList<>(10);
//
// List<String> roleNameList = new ArrayList<>(10);
//
// Map<String, Set<Integer>> userAccountIndexMap = new HashMap<>(16);
// for (int i = 0; i < l.size(); i++) {
// PlatUserRoleImportDTO userRoleImportDTO = l.get(i);
//
// userAccountIndexMap.computeIfAbsent(userRoleImportDTO.getUserAccount(), k -> new HashSet<>(10)).add(i + 1);
//
// accountList.add(userRoleImportDTO.getUserAccount());
//
// roleNameList.addAll(Arrays.asList(userRoleImportDTO.getRoleName().split(",")));
// }
//
// accountList.add(-1 + "");
//
// PlatUserQueryDTO userQueryDTO = new PlatUserQueryDTO();
// userQueryDTO.setOrgId(deptId);
// userQueryDTO.setAccountList(accountList);
// List<PlatPersonDTOVO> userList = tntUserService.list(userQueryDTO);
// Map<String, PlatPersonDTOVO> userMap = StreamUtil.toMap(userList, PlatPersonDTOVO::getAccount);
//
// roleNameList = StreamUtil.filter(roleNameList, StringUtils::isNotBlank);
// roleNameList.add(-1 + "");
//
// PlatRoleDTOVO tntRoleDTOVO = new PlatRoleDTOVO();
// tntRoleDTOVO.setOrgId(deptId);
// tntRoleDTOVO.setNameList(roleNameList);
// List<PlatRoleDTOVO> roleList = list(tntRoleDTOVO);
//
// Map<String, PlatRoleDTOVO> roleMap = StreamUtil.toMap(roleList, PlatRoleDTOVO::getName);
//
// int start = 3;
//
// int successCount = 0;
//
// for (int i = 0; i < l.size(); i++) {
// PlatUserRoleImportDTO userRoleImportDTO = l.get(i);
//
// boolean isImport = true;
//
// if (StringUtils.isBlank(userRoleImportDTO.getUserAccount())) {
// excelErrorVoList.add(new ExcelErrorVo(i + start, "用户工号", "用户工号为空"));
// isImport = false;
// } else {
//
// Set<Integer> set = userAccountIndexMap.get(userRoleImportDTO.getUserAccount());
// if (set.size() != 1) {
// excelErrorVoList.add(new ExcelErrorVo(i + start, "用户工号", "导入的数据存在重复的用户工号"));
// isImport = false;
// }
//
// PlatPersonDTOVO p = userMap.get(userRoleImportDTO.getUserAccount());
// if (p == null) {
// excelErrorVoList.add(new ExcelErrorVo(i + start, "用户工号", "数据库不存在该工号的用户"));
// isImport = false;
// }
// }
//
// if (StringUtils.isBlank(userRoleImportDTO.getRoleName())) {
// excelErrorVoList.add(new ExcelErrorVo(i + start, "角色名称", "角色名称为空"));
// isImport = false;
// } else {
// List<String> rList = StreamUtil.filter(Arrays.asList(userRoleImportDTO.getRoleName().split(",")), StringUtils::isNotBlank);
// Set<String> rSet = new HashSet<>(rList);
// if (rSet.size() < rList.size()) {
// excelErrorVoList.add(new ExcelErrorVo(i + start, "角色名称", "角色名称存在重复值"));
// isImport = false;
// }
//
// for (String e : rSet) {
// PlatRoleDTOVO r = roleMap.get(e);
// if (r == null) {
// excelErrorVoList.add(new ExcelErrorVo(i + start, "角色名称", e + "数据库不存在"));
// isImport = false;
// }
// }
// }
//
// if (isImport) {
// successCount++;
// }
//
// }
//
// if (excelErrorVoList.size() == 0) {
// List<PlatUserRole> userRoleList = new ArrayList<>(10);
//
// List<String> userIdList = new ArrayList<>(10);
// l.forEach(e -> {
// PlatPersonDTOVO p = userMap.get(e.getUserAccount());
//
// userIdList.add(p.getId());
//
// List<String> rList = StreamUtil.filter(Arrays.asList(e.getRoleName().split(",")), StringUtils::isNotBlank);
// List<PlatRoleDTOVO> r = StreamUtil.map(rList, roleMap::get);
// userRoleList.addAll(StreamUtil.map(r, rr -> {
// PlatUserRole tntUserRole = new PlatUserRole();
// tntUserRole.setUserId(p.getId());
// tntUserRole.setRoleId(rr.getId());
//
// return tntUserRole;
// }));
// });
//
// tntUserRoleService.remove(new QueryWrapper<PlatUserRole>().lambda()
// .in(PlatUserRole::getUserId, userIdList));
//
// tntUserRoleService.saveBatch(userRoleList);
// }
//
// //return excelErrorVoList;
//
// ExcelImportVo excelImportVo = new ExcelImportVo();
// excelImportVo.setTotalCount(l.size());
// excelImportVo.setErrorCount(excelErrorVoList.size());
// //excelImportVo.setSuccessCount(list.size() - excelErrorVoList.size());
// excelImportVo.setSuccessCount(successCount);
// excelImportVo.setList(excelErrorVoList);
//
// return excelImportVo;
//
//
// }, c -> {
//
// });
// }
@Transactional @Transactional
@Override @Override
public void assignMenuList(PlatRoleMenuDTO roleMenuDTO) { public void assignMenuList(PlatRoleMenuDTO roleMenuDTO) {
//removeAssignMenuList(roleMenuDTOList);
adminRoleCantDo(roleMenuDTO.getRoleId()); adminRoleCantDo(roleMenuDTO.getRoleId());
...@@ -427,41 +275,9 @@ implements PlatRoleService { ...@@ -427,41 +275,9 @@ implements PlatRoleService {
return newList; return newList;
} }
// @Transactional
// @Override
// public void assignWechatMenuList(PlatRoleMenuDTO roleMenuDTO) {
// //removeAssignWechatMenuList(roleMenuDTOList);
//
// adminRoleCantDo(roleMenuDTO.getRoleId());
//
// tntRoleWechatMenuService.remove(new QueryWrapper<PlatRoleWechatMenu>().lambda()
// .eq(PlatRoleWechatMenu::getRoleId, roleMenuDTO.getRoleId()));
//
// List<PlatRoleWechatMenu> roleMenuList = StreamUtil.map(roleMenuDTO.getMenuIdList(), e -> {
// PlatRoleWechatMenu tntRoleMenu = new PlatRoleWechatMenu();
// tntRoleMenu.setRoleId(roleMenuDTO.getRoleId());
// tntRoleMenu.setMenuId(e);
// tntRoleMenu.setTenantId(roleMenuDTO.getTenantId());
//
// return tntRoleMenu;
// });
//
// tntRoleWechatMenuService.saveBatch(roleMenuList);
// }
// @Override
// public List<PlatRoleWechatMenu> getWechatMenuListByRoleId(String roleId) {
// List<PlatRoleWechatMenu> roleWechatMenuList = tntRoleWechatMenuService.list(new QueryWrapper<PlatRoleWechatMenu>().lambda()
// .eq(PlatRoleWechatMenu::getRoleId, roleId));
// return roleWechatMenuList;
// }
@Transactional @Transactional
@Override @Override
public void assignDeptList(PlatRoleDeptDTOVO tntRoleDeptDTO) { public void assignDeptList(PlatRoleDeptDTOVO tntRoleDeptDTO) {
//removeAssignDeptList(roleDeptDTOList);
adminRoleCantDo(tntRoleDeptDTO.getRoleId()); adminRoleCantDo(tntRoleDeptDTO.getRoleId());
...@@ -482,9 +298,8 @@ implements PlatRoleService { ...@@ -482,9 +298,8 @@ implements PlatRoleService {
@Override @Override
public List<PlatRoleOrg> getDeptListByRoleId(String roleId) { public List<PlatRoleOrg> getDeptListByRoleId(String roleId) {
List<PlatRoleOrg> roleDeptList = platRoleOrgService.list(new QueryWrapper<PlatRoleOrg>().lambda() return platRoleOrgService.list(new QueryWrapper<PlatRoleOrg>().lambda()
.eq(PlatRoleOrg::getRoleId, roleId)); .eq(PlatRoleOrg::getRoleId, roleId));
return roleDeptList;
} }
public static String getNewName(String name) { public static String getNewName(String name) {
...@@ -497,7 +312,6 @@ implements PlatRoleService { ...@@ -497,7 +312,6 @@ implements PlatRoleService {
PlatRole newRole = BeanDtoVoUtils.convert(tntRole, PlatRole.class); PlatRole newRole = BeanDtoVoUtils.convert(tntRole, PlatRole.class);
newRole.setName(getNewName(tntRole.getName())); newRole.setName(getNewName(tntRole.getName()));
newRole.setId(null); newRole.setId(null);
// newRole.setIsAdmin(CommonEnum.NO.getValue());
save(newRole); save(newRole);
...@@ -519,15 +333,6 @@ implements PlatRoleService { ...@@ -519,15 +333,6 @@ implements PlatRoleService {
}); });
platRoleMenuService.saveBatch(roleMenuListNew); platRoleMenuService.saveBatch(roleMenuListNew);
// List<PlatRoleWechatMenu> wechatMenuList = tntRoleWechatMenuService.list(new QueryWrapper<PlatRoleWechatMenu>().lambda()
// .eq(PlatRoleWechatMenu::getRoleId, roleId));
// wechatMenuList.forEach(e -> {
// e.setId(null);
// e.setRoleId(newRole.getId());
// });
// tntRoleWechatMenuService.saveBatch(wechatMenuList);
List<PlatRoleOrg> roleDeptList = platRoleOrgService.list(new QueryWrapper<PlatRoleOrg>().lambda() List<PlatRoleOrg> roleDeptList = platRoleOrgService.list(new QueryWrapper<PlatRoleOrg>().lambda()
.eq(PlatRoleOrg::getRoleId, roleId)); .eq(PlatRoleOrg::getRoleId, roleId));
roleDeptList.forEach(e -> { roleDeptList.forEach(e -> {
...@@ -545,9 +350,7 @@ implements PlatRoleService { ...@@ -545,9 +350,7 @@ implements PlatRoleService {
queryWrapper.eq(StringUtils.isNotBlank(dto.getOrgId()), PlatRole::getOrgId, dto.getOrgId()); queryWrapper.eq(StringUtils.isNotBlank(dto.getOrgId()), PlatRole::getOrgId, dto.getOrgId());
List<PlatRole> platRoleList = list(queryWrapper); List<PlatRole> platRoleList = list(queryWrapper);
List<PlatRoleDTOVO> rolVOList = BeanDtoVoUtils.listVo(platRoleList, PlatRoleDTOVO.class); List<PlatRoleDTOVO> rolVOList = BeanDtoVoUtils.listVo(platRoleList, PlatRoleDTOVO.class);
JoinUtil.join(rolVOList, platOrgService, PlatRoleDTOVO::getOrgId, PlatOrg::getId, (r, e) -> { JoinUtil.join(rolVOList, platOrgService, PlatRoleDTOVO::getOrgId, PlatOrg::getId, (r, e) -> r.setDeptName(e.getName()));
r.setDeptName(e.getName());
});
return BeanDtoVoUtils.listVo(platRoleList, PlatRoleDTOVO.class); return BeanDtoVoUtils.listVo(platRoleList, PlatRoleDTOVO.class);
} }
...@@ -563,9 +366,8 @@ implements PlatRoleService { ...@@ -563,9 +366,8 @@ implements PlatRoleService {
public List<PlatRole> belongTo(BaseIdDTO baseIdDTO) { public List<PlatRole> belongTo(BaseIdDTO baseIdDTO) {
PlatUserVO userVO = PlatUserUtil.getUserVO(); PlatUserVO userVO = PlatUserUtil.getUserVO();
if(StringUtils.equals(userVO.getIsTenant(),CommonEnum.YES.getValue())){ if(StringUtils.equals(userVO.getIsTenant(),CommonEnum.YES.getValue())){
List<PlatRole> roleList = this.list(new LambdaQueryWrapper<PlatRole>().orderByDesc(BaseEntity::getUpdateDate)); return this.list(new LambdaQueryWrapper<PlatRole>().orderByDesc(BaseEntity::getUpdateDate));
return roleList;
} }
return null; return new ArrayList<>();
} }
} }
...@@ -13,6 +13,9 @@ import com.makeit.common.entity.BaseBusEntity; ...@@ -13,6 +13,9 @@ import com.makeit.common.entity.BaseBusEntity;
import com.makeit.common.entity.BaseEntity; import com.makeit.common.entity.BaseEntity;
import com.makeit.common.page.PageReqDTO; import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO; import com.makeit.common.page.PageVO;
import com.makeit.common.vo.ExcelErrorVo;
import com.makeit.common.vo.ExcelImportVo;
import com.makeit.dto.platform.auth.PlatUserImportDTO;
import com.makeit.entity.platform.auth.PlatOrg; import com.makeit.entity.platform.auth.PlatOrg;
import com.makeit.entity.platform.auth.PlatRole; import com.makeit.entity.platform.auth.PlatRole;
import com.makeit.entity.platform.auth.PlatRoleMenu; import com.makeit.entity.platform.auth.PlatRoleMenu;
...@@ -26,7 +29,6 @@ import com.makeit.enums.CodeMessageEnum; ...@@ -26,7 +29,6 @@ import com.makeit.enums.CodeMessageEnum;
import com.makeit.enums.CommonEnum; import com.makeit.enums.CommonEnum;
import com.makeit.enums.IsTenantAccountEnum; import com.makeit.enums.IsTenantAccountEnum;
import com.makeit.enums.biz.auth.SysEnum; import com.makeit.enums.biz.auth.SysEnum;
import com.makeit.enums.biz.sys.SysDictCategoryConst;
import com.makeit.exception.BusinessException; import com.makeit.exception.BusinessException;
import com.makeit.global.aspect.tenant.TenantIdUtil; import com.makeit.global.aspect.tenant.TenantIdUtil;
import com.makeit.mapper.platform.auth.PlatUserMapper; import com.makeit.mapper.platform.auth.PlatUserMapper;
...@@ -52,6 +54,8 @@ import com.makeit.utils.data.convert.BeanDtoVoUtils; ...@@ -52,6 +54,8 @@ import com.makeit.utils.data.convert.BeanDtoVoUtils;
import com.makeit.utils.data.convert.JsonUtil; import com.makeit.utils.data.convert.JsonUtil;
import com.makeit.utils.data.convert.PageUtil; import com.makeit.utils.data.convert.PageUtil;
import com.makeit.utils.data.convert.StreamUtil; import com.makeit.utils.data.convert.StreamUtil;
import com.makeit.utils.data.excel.ExcelUtil;
import com.makeit.utils.data.excel.ExcelValidatorUtil;
import com.makeit.utils.data.id.IdGen; import com.makeit.utils.data.id.IdGen;
import com.makeit.utils.sql.groupby.DynamicQuery; import com.makeit.utils.sql.groupby.DynamicQuery;
import com.makeit.utils.sql.groupby.SqlUtil; import com.makeit.utils.sql.groupby.SqlUtil;
...@@ -70,6 +74,7 @@ import org.slf4j.LoggerFactory; ...@@ -70,6 +74,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
...@@ -119,10 +124,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -119,10 +124,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
private static final Logger logger = LoggerFactory.getLogger(PlatUserServiceImpl.class); private static final Logger logger = LoggerFactory.getLogger(PlatUserServiceImpl.class);
// @Lazy
// @Autowired
// private TntAsyncMessageService tntAsyncMessageService;
private LambdaQueryWrapper<PlatUser> listTenantLambdaQueryWrapper(PlatUserQueryDTO dto, Consumer<LambdaQueryWrapper<PlatUser>> consumer) { private LambdaQueryWrapper<PlatUser> listTenantLambdaQueryWrapper(PlatUserQueryDTO dto, Consumer<LambdaQueryWrapper<PlatUser>> consumer) {
LambdaQueryWrapper<PlatUser> lambdaQueryWrapper = new QueryWrapper<PlatUser>().lambda() LambdaQueryWrapper<PlatUser> lambdaQueryWrapper = new QueryWrapper<PlatUser>().lambda()
...@@ -163,9 +164,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -163,9 +164,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
Page<PlatUser> p = PageUtil.toMpPage(page); Page<PlatUser> p = PageUtil.toMpPage(page);
Page<PlatUser> pageList = page(p, listTenantLambdaQueryWrapper(dto, qw -> { Page<PlatUser> pageList = page(p, listTenantLambdaQueryWrapper(dto, qw -> qw.eq(PlatUser::getIsTenant, IsTenantAccountEnum.YES.getValue())));
qw.eq(PlatUser::getIsTenant, IsTenantAccountEnum.YES.getValue());
}));
List<PlatUserDTOVO> tntUserDTOVOList = BeanDtoVoUtils.listVo(pageList.getRecords(), PlatUserDTOVO.class); List<PlatUserDTOVO> tntUserDTOVOList = BeanDtoVoUtils.listVo(pageList.getRecords(), PlatUserDTOVO.class);
fillTenant(tntUserDTOVOList); fillTenant(tntUserDTOVOList);
...@@ -176,9 +175,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -176,9 +175,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
@Override @Override
public List<PlatUserDTOVO> listTenant(PlatUserQueryDTO dto) { public List<PlatUserDTOVO> listTenant(PlatUserQueryDTO dto) {
return BeanDtoVoUtils.listVo( return BeanDtoVoUtils.listVo(
list(listTenantLambdaQueryWrapper(dto, qw -> { list(listTenantLambdaQueryWrapper(dto, qw -> qw.eq(PlatUser::getIsTenant, IsTenantAccountEnum.YES.getValue()))),
qw.eq(PlatUser::getIsTenant, IsTenantAccountEnum.YES.getValue());
})),
PlatUserDTOVO.class); PlatUserDTOVO.class);
} }
...@@ -186,11 +183,9 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -186,11 +183,9 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
List<PlatUser> userList = list( List<PlatUser> userList = list(
new QueryWrapper<PlatUser>().lambda() new QueryWrapper<PlatUser>().lambda()
//.eq(TntUser::getIsTenant, IsTenantAccountEnum.YES.getValue()) //.eq(TntUser::getIsTenant, IsTenantAccountEnum.YES.getValue())
.and(qw -> { .and(qw -> qw.eq(PlatUser::getAccount, dto.getAccount())
qw.eq(PlatUser::getAccount, dto.getAccount())
.or() .or()
.eq(PlatUser::getMobile, dto.getMobile()); .eq(PlatUser::getMobile, dto.getMobile()))
})
); );
...@@ -209,11 +204,9 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -209,11 +204,9 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
List<PlatUser> userList = list( List<PlatUser> userList = list(
new QueryWrapper<PlatUser>().lambda() new QueryWrapper<PlatUser>().lambda()
.eq(PlatUser::getIsTenant, IsTenantAccountEnum.NO.getValue()) .eq(PlatUser::getIsTenant, IsTenantAccountEnum.NO.getValue())
.and(qw -> { .and(qw -> qw.eq(PlatUser::getAccount, dto.getAccount())
qw.eq(PlatUser::getAccount, dto.getAccount())
.or() .or()
.eq(PlatUser::getMobile, dto.getMobile()); .eq(PlatUser::getMobile, dto.getMobile()))
})
); );
...@@ -247,7 +240,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -247,7 +240,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_USER_PASSWORD_NOT_BLANK); throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_USER_PASSWORD_NOT_BLANK);
} }
setPassword(user); setPassword(user);
user.setAccount(dto.getMobile());
save(user); save(user);
dto.setId(user.getId()); dto.setId(user.getId());
} }
...@@ -278,8 +271,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -278,8 +271,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
@Override @Override
public PlatUserDTOVO view(String id) { public PlatUserDTOVO view(String id) {
PlatUserDTOVO userVO = BeanDtoVoUtils.convert(getById(id), PlatUserDTOVO.class); return BeanDtoVoUtils.convert(getById(id), PlatUserDTOVO.class);
return userVO;
} }
@Transactional @Transactional
...@@ -332,14 +324,13 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -332,14 +324,13 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
@Override @Override
public List<PlatTenant> setTenantList(PlatUser tntUser) { public List<PlatTenant> setTenantList(PlatUser tntUser) {
if (IsTenantAccountEnum.YES.getValue().equals(tntUser.getIsTenant())) { if (IsTenantAccountEnum.YES.getValue().equals(tntUser.getIsTenant())) {
List<PlatTenant> tntTenantList = platTenantService.list(new QueryWrapper<PlatTenant>().lambda() return platTenantService.list(new QueryWrapper<PlatTenant>().lambda()
.eq(PlatTenant::getStatus, CommonEnum.YES.getValue()) .eq(PlatTenant::getStatus, CommonEnum.YES.getValue())
.eq(PlatTenant::getPlatUserId, tntUser.getId()) .eq(PlatTenant::getPlatUserId, tntUser.getId())
.orderByAsc(PlatTenant::getCreateDate) .orderByAsc(PlatTenant::getCreateDate)
); );
return tntTenantList;
} }
return null; return new ArrayList<>();
} }
@Override @Override
...@@ -411,10 +402,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -411,10 +402,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
private void fillMenuList(List<PlatMenu> menuList, PlatUserLoginVO userLoginVO) { private void fillMenuList(List<PlatMenu> menuList, PlatUserLoginVO userLoginVO) {
// List<TntMenu> buttonList = StreamUtil.filter(menuList, e -> SysEnum.MenuTypeEnum.MENU.getValue().equals(e.getCategory()) || SysEnum.MenuTypeEnum.BUTTON.getValue().equals(e.getCategory()));
//
// List<TntMenu> nonButtonList = StreamUtil.filter(menuList, e -> SysEnum.MenuTypeEnum.CATALOGUE.getValue().equals(e.getCategory()) || SysEnum.MenuTypeEnum.MENU.getValue().equals(e.getCategory()));
List<PlatMenu> buttonList = new ArrayList<>(10); List<PlatMenu> buttonList = new ArrayList<>(10);
List<PlatMenu> nonButtonList = new ArrayList<>(10); List<PlatMenu> nonButtonList = new ArrayList<>(10);
...@@ -453,14 +440,12 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -453,14 +440,12 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
List<String> menuIdList = StreamUtil.map(tntTenantMenuList, PlatTenantMenu::getMenuId); List<String> menuIdList = StreamUtil.map(tntTenantMenuList, PlatTenantMenu::getMenuId);
menuIdList.add(-1 + ""); menuIdList.add(-1 + "");
List<PlatMenu> menuList = platMenuService.list(new QueryWrapper<PlatMenu>().lambda() return platMenuService.list(new QueryWrapper<PlatMenu>().lambda()
.in(PlatMenu::getId, menuIdList) .in(PlatMenu::getId, menuIdList)
.eq(PlatMenu::getStatus, CommonEnum.YES.getValue()) .eq(PlatMenu::getStatus, CommonEnum.YES.getValue())
.orderByAsc(PlatMenu::getSort) .orderByAsc(PlatMenu::getSort)
.orderByAsc(PlatMenu::getCreateDate) .orderByAsc(PlatMenu::getCreateDate)
); );
return menuList;
} }
private void supperRoleMenuList(PlatUserLoginVO userLoginVO) { private void supperRoleMenuList(PlatUserLoginVO userLoginVO) {
...@@ -498,11 +483,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -498,11 +483,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
return tntPersonDTOVO; return tntPersonDTOVO;
} }
// @Override
// public List<String> getCustomGroupNameList() {
// return getCustomGroupNameList(PlatUserUtil.getUserId());
// }
@Override @Override
public List<PlatRole> getRoleList(String userId) { public List<PlatRole> getRoleList(String userId) {
List<PlatUserRole> userRoleList = platUserRoleService.list(new QueryWrapper<PlatUserRole>().lambda() List<PlatUserRole> userRoleList = platUserRoleService.list(new QueryWrapper<PlatUserRole>().lambda()
...@@ -510,11 +490,9 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -510,11 +490,9 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
List<String> roleIdList = StreamUtil.map(userRoleList, PlatUserRole::getRoleId); List<String> roleIdList = StreamUtil.map(userRoleList, PlatUserRole::getRoleId);
roleIdList.add(-1 + ""); roleIdList.add(-1 + "");
List<PlatRole> roleList = platRoleService.list(new QueryWrapper<PlatRole>().lambda() return platRoleService.list(new QueryWrapper<PlatRole>().lambda()
.in(PlatRole::getId, roleIdList) .in(PlatRole::getId, roleIdList)
); );
return roleList;
} }
private List<PlatMenu> getMenuListByUserId(PlatUserLoginVO userLoginVO) { private List<PlatMenu> getMenuListByUserId(PlatUserLoginVO userLoginVO) {
...@@ -536,9 +514,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -536,9 +514,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
.orderByAsc(PlatMenu::getCreateDate) .orderByAsc(PlatMenu::getCreateDate)
); );
// List<TntMenu> menuList = getMenuListByUserId(userLoginVO.getId());
// menuList = new ArrayList<>(new HashSet<>(menuList));
userLoginVO.setRoleList(BeanDtoVoUtils.listVo(roleList, PlatRoleDTOVO.class)); userLoginVO.setRoleList(BeanDtoVoUtils.listVo(roleList, PlatRoleDTOVO.class));
if (StringUtils.isNotBlank(userLoginVO.getTenantId())) { if (StringUtils.isNotBlank(userLoginVO.getTenantId())) {
...@@ -553,8 +528,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -553,8 +528,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
public PlatUserLoginVO getRoleAndMenuList() { public PlatUserLoginVO getRoleAndMenuList() {
//TODO 用join做 //TODO 用join做
//TODO 只返回必要字段 菜单和角色 //TODO 只返回必要字段 菜单和角色
long s = System.currentTimeMillis();
String tenantId = TenantIdUtil.getTenantId(); String tenantId = TenantIdUtil.getTenantId();
if (StringUtils.isBlank(tenantId)) { if (StringUtils.isBlank(tenantId)) {
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_TENANT_ID_NOT_BLANK); throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_TENANT_ID_NOT_BLANK);
...@@ -566,8 +539,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -566,8 +539,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
PlatUserLoginVO userLoginVO = BeanDtoVoUtils.convert(tntUserVO, PlatUserLoginVO.class); PlatUserLoginVO userLoginVO = BeanDtoVoUtils.convert(tntUserVO, PlatUserLoginVO.class);
//tntLoginLogService.addTenant(null, null);
if (IsTenantAccountEnum.YES.getValue().equals(tntUserVO.getIsTenant())) { if (IsTenantAccountEnum.YES.getValue().equals(tntUserVO.getIsTenant())) {
userLoginVO.setTenantId(tenantId); userLoginVO.setTenantId(tenantId);
...@@ -610,38 +581,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -610,38 +581,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
return userLoginVO; return userLoginVO;
} }
private void supperWechatMenuList(PlatUserLoginVO userLoginVO) {
userLoginVO.setWechatMenuCodeList(sysDictionaryCategoryService.getCodeListByPrefix(SysDictCategoryConst.WECHAT_MENU_PREFIX));
}
// @Override
// public PlatUserLoginVO getWechatMenuList() {
// //TODO 用join做
// //TODO 只返回必要字段 菜单和角色
//
// PlatUserVO tntUserVO = PlatUserUtil.getUserVO();
//
// PlatUserLoginVO userLoginVO = BeanDtoVoUtils.convert(tntUserVO, PlatUserLoginVO.class);
//
// if (IsTenantAccountEnum.YES.getValue().equals(userLoginVO.getIsTenant())) {
//
// supperWechatMenuList(userLoginVO);
// return userLoginVO;
// }
//
// List<PlatRole> roleList = getRoleList(userLoginVO.getId());
// List<String> roleIdList = StreamUtil.map(roleList, PlatRole::getId);
// roleIdList.add(-1 + "");
//
// List<PlatRoleWechatMenu> roleWechatMenuList = tntRoleWechatMenuService.list(new QueryWrapper<PlatRoleWechatMenu>().lambda()
// .in(PlatRoleWechatMenu::getRoleId, roleIdList));
//
// userLoginVO.setWechatMenuCodeList(StreamUtil.map(roleWechatMenuList, PlatRoleWechatMenu::getMenuId));
//
//
// return userLoginVO;
// }
@Override @Override
public void logout() { public void logout() {
...@@ -686,11 +625,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -686,11 +625,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
.like(StringUtils.isNotBlank(dto.getMobile()), PlatUser::getMobile, dto.getMobile()) .like(StringUtils.isNotBlank(dto.getMobile()), PlatUser::getMobile, dto.getMobile())
.eq(StringUtils.isNotBlank(dto.getStatus()), PlatUser::getStatus, dto.getStatus()) .eq(StringUtils.isNotBlank(dto.getStatus()), PlatUser::getStatus, dto.getStatus())
.eq(PlatUser::getTenantId, TenantIdUtil.getTenantId()) .eq(PlatUser::getTenantId, TenantIdUtil.getTenantId())
.and(StringUtils.isNotBlank(dto.getKeyword()), qw -> { ;
qw.like(StringUtils.isNotBlank(dto.getKeyword()), PlatUser::getUsername, dto.getKeyword())
.or()
.like(StringUtils.isNotBlank(dto.getKeyword()), PlatUser::getAccount, dto.getKeyword());
});
roleIdFilter(lambdaQueryWrapper, dto); roleIdFilter(lambdaQueryWrapper, dto);
...@@ -709,9 +644,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -709,9 +644,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
private void fillDept(List<PlatPersonDTOVO> tntUserDTOVOList) { private void fillDept(List<PlatPersonDTOVO> tntUserDTOVOList) {
JoinUtil.join(tntUserDTOVOList, platOrgService, PlatPersonDTOVO::getOrgId, PlatOrg::getId, (p, d) -> { JoinUtil.join(tntUserDTOVOList, platOrgService, PlatPersonDTOVO::getOrgId, PlatOrg::getId, (p, d) -> p.setOrgName(d.getName()));
p.setOrgName(d.getName());
});
} }
...@@ -752,10 +685,8 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -752,10 +685,8 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
.groupBy(PlatUser.Fields.orgId) .groupBy(PlatUser.Fields.orgId)
); );
List<PlatUserCountVO> voList = JsonUtil.mapToBean(tntUserList, new TypeReference<List<PlatUserCountVO>>() { return JsonUtil.mapToBean(tntUserList, new TypeReference<List<PlatUserCountVO>>() {
}); });
return voList;
} }
@Override @Override
...@@ -781,25 +712,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -781,25 +712,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
return PageUtil.toPageVO(tntUserDTOVOList, pageList); return PageUtil.toPageVO(tntUserDTOVOList, pageList);
} }
private void frequentUser(LambdaQueryWrapper<PlatUser> lambdaQueryWrapper, PlatUserQueryDTO dto) {
if (CommonEnum.YES.getValue().equals(dto.getIsFrequent())) {
List<String> frequentUserIdList = new ArrayList<>(10);
frequentUserIdList.add(-1 + "");
// frequentUserIdList.addAll(
// StreamUtil.map(
// tntFrequentUserService.list(new QueryWrapper<PlatFrequentUser>().lambda()
// .eq(PlatFrequentUser::getPlatUserId, PlatUserUtil.getUserId())
// ),
// PlatFrequentUser::getFrequentUserId)
// );
lambdaQueryWrapper.in(CommonEnum.YES.getValue().equals(dto.getIsFrequent()), PlatUser::getId, frequentUserIdList);
}
}
private void roleIdList(LambdaQueryWrapper<PlatUser> lambdaQueryWrapper, PlatUserQueryDTO dto) { private void roleIdList(LambdaQueryWrapper<PlatUser> lambdaQueryWrapper, PlatUserQueryDTO dto) {
if (CollectionUtils.isNotEmpty(dto.getRoleIdList())) { if (CollectionUtils.isNotEmpty(dto.getRoleIdList())) {
dto.getRoleIdList().add(-1 + ""); dto.getRoleIdList().add(-1 + "");
...@@ -822,11 +734,8 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -822,11 +734,8 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
.like(StringUtils.isNotBlank(dto.getUsername()), PlatUser::getUsername, dto.getUsername()) .like(StringUtils.isNotBlank(dto.getUsername()), PlatUser::getUsername, dto.getUsername())
.like(StringUtils.isNotBlank(dto.getMobile()), PlatUser::getMobile, dto.getMobile()) .like(StringUtils.isNotBlank(dto.getMobile()), PlatUser::getMobile, dto.getMobile())
.eq(StringUtils.isNotBlank(dto.getStatus()), PlatUser::getStatus, dto.getStatus()) .eq(StringUtils.isNotBlank(dto.getStatus()), PlatUser::getStatus, dto.getStatus())
//.eq(dto.getPostLevel() != null, PlatUser::getPostLevel, dto.getPostLevel())
.eq(PlatUser::getTenantId, TenantIdUtil.getTenantId()); .eq(PlatUser::getTenantId, TenantIdUtil.getTenantId());
frequentUser(lambdaQueryWrapper, dto);
roleIdList(lambdaQueryWrapper, dto); roleIdList(lambdaQueryWrapper, dto);
lambdaQueryWrapper.orderByDesc(PlatUser::getCreateDate); lambdaQueryWrapper.orderByDesc(PlatUser::getCreateDate);
...@@ -869,8 +778,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -869,8 +778,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
user.setStatus(CommonEnum.YES.getValue()); user.setStatus(CommonEnum.YES.getValue());
//user.setEmpStatus(CommonEnum.YES.getValue()); user.setAccount(dto.getMobile());
save(user); save(user);
dto.setId(user.getId()); dto.setId(user.getId());
setRoleList(dto); setRoleList(dto);
...@@ -882,25 +790,11 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -882,25 +790,11 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
@Transactional @Transactional
@Override @Override
public void editPerson(PlatPersonDTOVO dto) { public void editPerson(PlatPersonDTOVO dto) {
//dto.setAccount(null);
checkPerson(BeanDtoVoUtils.convert(dto, PlatUserDTOVO.class)); checkPerson(BeanDtoVoUtils.convert(dto, PlatUserDTOVO.class));
PlatUser tntUser = getById(dto.getId());
// if (StringUtils.isNotBlank(tntUser.getOrgId()) && StringUtils.isNotBlank(dto.getDeptId()) && !tntUser.getOrgId().equals(dto.getDeptId())) {
// changeDeptMessage(tntUser, tntUser.getOrgId(), dto.getDeptId());
// }
// if (CommonEnum.YES.getValue().equals(tntUser.getEmpStatus()) && CommonEnum.NO.getValue().equals(dto.getEmpStatus())) {
// leaveMessage(tntUser);
// }
PlatUser user = BeanDtoVoUtils.convert(dto, PlatUser.class); PlatUser user = BeanDtoVoUtils.convert(dto, PlatUser.class);
user.setIsTenant(CommonEnum.NO.getValue()); user.setIsTenant(CommonEnum.NO.getValue());
// if (!CommonEnum.YES.getValue().equals(user.getEmpStatus())) {
// user.setStatus(CommonEnum.NO.getValue());
// }
setPassword(user); setPassword(user);
updateById(user); updateById(user);
...@@ -938,58 +832,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -938,58 +832,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
return userVO; return userVO;
} }
// @Override
// public void changeDeptMessage(PlatUser tntUser, String oldDeptId, String newDeptId) {
// PlatOrg oldDept = platOrgService.getById(oldDeptId);
// PlatOrg newDept = platOrgService.getById(newDeptId);
//
// List<PlatCustomGroup> groupList = CustomGroupUtil.getGroupByUserId(tntUser.getId());
//
// PlatDept hotel = DeptUtil.getHotel(tntUser.getDeptId());
//
// List<ChangeDeptMessageDTO> dtoList = StreamUtil.map(groupList, e -> {
// ChangeDeptMessageDTO changeDeptMessageDTO = new ChangeDeptMessageDTO();
//
// changeDeptMessageDTO.setGroupId(e.getId());
//
// changeDeptMessageDTO.setUserName(tntUser.getName());
// if (oldDept != null) {
// changeDeptMessageDTO.setOldDeptName(oldDept.getName());
// } else {
// changeDeptMessageDTO.setOldDeptName("");
// }
// changeDeptMessageDTO.setNewDeptName(newDept.getName());
// changeDeptMessageDTO.setGroupAdminUserId(e.getTntUserId());
//
// return changeDeptMessageDTO;
// });
//
// tntAsyncMessageService.addChangeDeptMessage(hotel, dtoList);
//
// }
// @Override
// public void leaveMessage(TntUser tntUser) {
//
// List<TntCustomGroup> groupList = CustomGroupUtil.getGroupByUserId(tntUser.getId());
//
// TntDept hotel = DeptUtil.getHotel(tntUser.getDeptId());
//
// List<ChangeDeptMessageDTO> dtoList = StreamUtil.map(groupList, e -> {
// ChangeDeptMessageDTO changeDeptMessageDTO = new ChangeDeptMessageDTO();
//
// changeDeptMessageDTO.setGroupId(e.getId());
//
// changeDeptMessageDTO.setUserName(tntUser.getName());
// changeDeptMessageDTO.setGroupAdminUserId(e.getTntUserId());
//
// return changeDeptMessageDTO;
// });
//
// tntAsyncMessageService.addLeaveMessage(hotel, dtoList);
//
// }
@Override @Override
public List<PlatRole> getRoleListWithTag(String userId) { public List<PlatRole> getRoleListWithTag(String userId) {
...@@ -1002,14 +844,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -1002,14 +844,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
.eq(PlatOrg::getStatus, CommonEnum.YES.getValue()) .eq(PlatOrg::getStatus, CommonEnum.YES.getValue())
); );
Map<String, PlatOrg> deptMap = StreamUtil.toMap(deptList, PlatOrg::getId);
// roleList.forEach(e -> {
// PlatOrg dept = deptMap.get(e.PlatOrg());
// if (dept != null) {
// e.setTag(dept.getTag());
// }
// });
return roleList; return roleList;
} }
...@@ -1034,9 +868,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -1034,9 +868,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
if (IsTenantAccountEnum.YES.getValue().equals(PlatUserUtil.getUserVO().getIsTenant())) { if (IsTenantAccountEnum.YES.getValue().equals(PlatUserUtil.getUserVO().getIsTenant())) {
newList.addAll(tntDeptList); newList.addAll(tntDeptList);
// newList.forEach(e -> {
// e.setCanTap(CommonEnum.YES.getValue());
// });
} else { } else {
...@@ -1049,21 +880,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -1049,21 +880,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
.in(PlatRoleOrg::getRoleId, roleIdList)); .in(PlatRoleOrg::getRoleId, roleIdList));
newList = roleDeptList.stream().map(e -> map.get(e.getOrgId())).filter(Objects::nonNull).collect(Collectors.toList()); newList = roleDeptList.stream().map(e -> map.get(e.getOrgId())).filter(Objects::nonNull).collect(Collectors.toList());
// newList.forEach(e -> {
// e.setCanTap(CommonEnum.YES.getValue());
// });
// tntRoleList.forEach(e -> {
// TntDept tntDept = map.get(e.getDeptId());
// if (tntDept != null) {
// tntDept.setCanTap(CommonEnum.YES.getValue());
// }
// });
PlatOrg userDept = map.get(PlatUserUtil.getUserVO().getOrgId());
// if (userDept != null) {
// userDept.setCanTap(CommonEnum.YES.getValue());
// }
Set<PlatOrg> set = new HashSet<>(newList); Set<PlatOrg> set = new HashSet<>(newList);
...@@ -1128,7 +944,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -1128,7 +944,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
@Override @Override
public List<PlatOrg> getDeptSelfAndChildrenCanTap(String deptId) {//给筛选列表用 包含自己 public List<PlatOrg> getDeptSelfAndChildrenCanTap(String deptId) {//给筛选列表用 包含自己
// return StreamUtil.filter(platOrgService.getDeptSelfAndChildren(deptId), e -> CommonEnum.YES.getValue().equals(e.getCanTap()));
return platOrgService.getDeptSelfAndChildren(deptId); return platOrgService.getDeptSelfAndChildren(deptId);
} }
...@@ -1137,9 +952,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -1137,9 +952,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
List<PlatOrg> newList = getDeptList(); List<PlatOrg> newList = getDeptList();
if (StringUtils.isBlank(deptId)) { if (StringUtils.isBlank(deptId)) {
return newList; return newList;
//return newList;
} else { } else {
List<PlatOrg> treeList = platOrgService.tree(newList);
List<PlatOrg> matchList = StreamUtil.filter(newList, e -> e.getId().equals(deptId)); List<PlatOrg> matchList = StreamUtil.filter(newList, e -> e.getId().equals(deptId));
if (matchList.isEmpty()) { if (matchList.isEmpty()) {
...@@ -1148,15 +961,8 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -1148,15 +961,8 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
List<PlatOrg> deptList = new ArrayList<>(10); List<PlatOrg> deptList = new ArrayList<>(10);
// if (DeptEnum.DeptTagEnum.HOTEL.getValue().equals(matchList.get(0).getTag())) {
// deptList.add(matchList.get(0));
// }
platOrgService.flat(matchList.get(0).getChildren(), matchList); platOrgService.flat(matchList.get(0).getChildren(), matchList);
deptList.forEach(e -> { deptList.forEach(e -> e.setChildren(null));
e.setChildren(null);
});
//return StreamUtil.filter(deptList, e -> DeptEnum.DeptTagEnum.HOTEL.getValue().equals(e.getTag()));
return matchList; return matchList;
} }
} }
...@@ -1164,29 +970,9 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -1164,29 +970,9 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
@Override @Override
public List<PlatOrg> getCandidateDeptList() {//新增编辑角色 那边的管理范围 //不包含自己 public List<PlatOrg> getCandidateDeptList() {//新增编辑角色 那边的管理范围 //不包含自己
List<PlatOrg> newList = getDeptList(); List<PlatOrg> newList = getDeptList();
// newList.forEach(e -> {
// e.setCanTap(null);
// });
// newList.forEach(e -> {
// if (DeptEnum.DeptTagEnum.HOTEL.getValue().equals(e.getTag())) {
// e.setCanTap(CommonEnum.YES.getValue());
// }
// });
return platOrgService.tree(newList); return platOrgService.tree(newList);
} }
// @Override
// public List<String> getCustomGroupNameList(String userId) {
// List<TntCustomGroup> customGroupList = CustomGroupUtil.getGroupByUserId(userId);
// return StreamUtil.map(customGroupList, TntCustomGroup::getName);
// }
//
// @Override
// public List<String> getCustomGroupIdList(String userId) {
// List<TntCustomGroup> customGroupList = CustomGroupUtil.getGroupByUserId(userId);
// return StreamUtil.map(customGroupList, TntCustomGroup::getId);
// }
@Override @Override
public List<PlatMenu> getMenuListByUserId(String userId) { public List<PlatMenu> getMenuListByUserId(String userId) {
return getBaseMapper().getMenuListByUserId(userId); return getBaseMapper().getMenuListByUserId(userId);
...@@ -1224,4 +1010,64 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -1224,4 +1010,64 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
.eq(BaseEntity::getId, platUserId); .eq(BaseEntity::getId, platUserId);
this.update(updateWrapper); this.update(updateWrapper);
} }
@Override
@Transactional
public void delBatch(List<String> idList) {
this.removeByIds(idList);
}
/**
* 导入人员
* @param excelFile
*/
@Override
public ExcelImportVo importExcel(MultipartFile excelFile) throws Exception {
List<PlatUserImportDTO> platUserImportDTOS = ExcelUtil.importExcel(null, 3, excelFile, PlatUserImportDTO.class);
LambdaQueryWrapper<PlatOrg> orgLambdaQueryWrapper = new LambdaQueryWrapper<>();
orgLambdaQueryWrapper.select(BaseEntity::getId,PlatOrg::getName);
List<PlatOrg> orgList = platOrgService.list(orgLambdaQueryWrapper);
LambdaQueryWrapper<PlatRole> roleLambdaQueryWrapper = new LambdaQueryWrapper<>();
roleLambdaQueryWrapper.select(BaseEntity::getId,PlatRole::getName);
List<PlatRole> roleList = platRoleService.list(roleLambdaQueryWrapper);
Map<String, String> orgNameMap = orgList.stream().collect(Collectors.toMap(PlatOrg::getName, BaseEntity::getId, (a, b) -> a));
Map<String, String> roleNameMap = roleList.stream().collect(Collectors.toMap(PlatRole::getName, BaseEntity::getId, (a, b) -> a));
LambdaQueryWrapper<PlatUser> userLambdaQueryWrapper = new LambdaQueryWrapper<>();
userLambdaQueryWrapper.select(PlatUser::getMobile,PlatUser::getEmail,BaseEntity::getId);
List<PlatUser> userList = this.list(userLambdaQueryWrapper);
Map<String, String> mobileMap = userList.stream().collect(Collectors.toMap(PlatUser::getMobile, BaseEntity::getId, (a, b) -> a));
Map<String, String> emailMap = userList.stream().collect(Collectors.toMap(PlatUser::getEmail, BaseEntity::getId, (a, b) -> a));
return ExcelValidatorUtil.validate( platUserImportDTOS, list -> {
List<ExcelErrorVo> errorVoList = new ArrayList<>();
int start = 3;
for (int i = 0; i < list.size(); i++) {
PlatUserImportDTO dto = list.get(i);
ExcelErrorVo.isNotNull(dto.getUsername(),errorVoList, start+i,"姓名*");
ExcelErrorVo.isNotNull(dto.getMobile(),errorVoList,start+i,"手机号*");
ExcelErrorVo.isNotNull(dto.getRoleName(),errorVoList,start+i,"角色*");
ExcelErrorVo.isNotNull(dto.getRoleName(),errorVoList,start+i,"所属组织*");
ExcelErrorVo.notExists(orgNameMap.get(dto.getOrgName()),errorVoList,start+i,"所属组织*");
ExcelErrorVo.notExists(roleNameMap.get(dto.getRoleName()),errorVoList,start+i,"角色*");
ExcelErrorVo.notExists(mobileMap.get(dto.getMobile()),errorVoList,start+i,"手机号*");
ExcelErrorVo.notExists(emailMap.get(dto.getEmail()),errorVoList,start+i,"邮箱");
}
if(errorVoList.isEmpty()){
List<PlatUser> platUsers = new ArrayList<>();
list.forEach(vo->{
PlatUser platUser = BeanDtoVoUtils.convert(vo, PlatUser.class);
setPassword(platUser);
platUsers.add(platUser);
});
saveBatch(platUsers);
}
return errorVoList;
},null);
}
} }
package com.makeit.service.platform.space; package com.makeit.service.platform.space;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.makeit.entity.platform.space.Bed; import com.makeit.entity.platform.space.PlatBed;
/** /**
* @Author:lzy * @Author:lzy
* @Date:2023/8/31 15:08 * @Date:2023/8/31 15:08
* @Describe: * @Describe:
*/ */
public interface BedService extends IService<Bed> { public interface PlatBedService extends IService<PlatBed> {
} }
package com.makeit.service.platform.space; package com.makeit.service.platform.space;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.makeit.entity.platform.space.RegionSettingLocation; import com.makeit.entity.platform.space.PlatRegionSettingLocation;
/** /**
* @Author:lzy * @Author:lzy
* @Date:2023/8/31 16:10 * @Date:2023/8/31 16:10
* @Describe: * @Describe:
*/ */
public interface RegionSettingLocationService extends IService<RegionSettingLocation> { public interface PlatRegionSettingLocationService extends IService<PlatRegionSettingLocation> {
} }
package com.makeit.service.platform.space; package com.makeit.service.platform.space;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.makeit.entity.platform.space.RegionSetting; import com.makeit.entity.platform.space.PlatRegionSetting;
/** /**
* @Author:lzy * @Author:lzy
* @Date:2023/8/31 16:13 * @Date:2023/8/31 16:13
* @Describe: * @Describe:
*/ */
public interface RegionSettingService extends IService<RegionSetting> { public interface PlatRegionSettingService extends IService<PlatRegionSetting> {
} }
package com.makeit.service.platform.space; package com.makeit.service.platform.space;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.makeit.entity.platform.space.Room; import com.makeit.entity.platform.space.PlatRoom;
/** /**
* @Author:lzy * @Author:lzy
* @Date:2023/8/31 16:15 * @Date:2023/8/31 16:15
* @Describe: * @Describe:
*/ */
public interface RoomService extends IService<Room> { public interface PlatRoomService extends IService<PlatRoom> {
} }
package com.makeit.service.platform.space;
import com.baomidou.mybatisplus.extension.service.IService;
import com.makeit.dto.platform.space.PlatSpaceAddDTO;
import com.makeit.entity.platform.space.PlatSpace;
/**
* @Author:lzy
* @Date:2023/8/31 16:17
* @Describe:
*/
public interface PlatSpaceService extends IService<PlatSpace> {
/**
* 添加
* @param dto
*/
void add(PlatSpaceAddDTO dto);
/**
* 编辑
* @param dto
*/
void edit(PlatSpaceAddDTO dto);
/**
* 删除
* @param id
*/
void del(String id);
}
package com.makeit.service.platform.space;
import com.baomidou.mybatisplus.extension.service.IService;
import com.makeit.entity.platform.space.Space;
/**
* @Author:lzy
* @Date:2023/8/31 16:17
* @Describe:
*/
public interface SpaceService extends IService<Space> {
}
package com.makeit.service.platform.space.impl; package com.makeit.service.platform.space.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.makeit.entity.platform.space.Bed; import com.makeit.entity.platform.space.PlatBed;
import com.makeit.mapper.platform.space.BedMapper; import com.makeit.mapper.platform.space.PlatBedMapper;
import com.makeit.service.platform.space.BedService; import com.makeit.service.platform.space.PlatBedService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
...@@ -12,5 +12,5 @@ import org.springframework.stereotype.Service; ...@@ -12,5 +12,5 @@ import org.springframework.stereotype.Service;
* @Describe: * @Describe:
*/ */
@Service @Service
public class BedServiceImpl extends ServiceImpl<BedMapper, Bed> implements BedService { public class PlatBedServiceImpl extends ServiceImpl<PlatBedMapper, PlatBed> implements PlatBedService {
} }
package com.makeit.service.platform.space.impl; package com.makeit.service.platform.space.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.makeit.entity.platform.space.RegionSettingLocation; import com.makeit.entity.platform.space.PlatRegionSettingLocation;
import com.makeit.mapper.platform.space.RegionSettingLocationMapper; import com.makeit.mapper.platform.space.PlatRegionSettingLocationMapper;
import com.makeit.service.platform.space.RegionSettingLocationService; import com.makeit.service.platform.space.PlatRegionSettingLocationService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
...@@ -12,5 +12,5 @@ import org.springframework.stereotype.Service; ...@@ -12,5 +12,5 @@ import org.springframework.stereotype.Service;
* @Describe: * @Describe:
*/ */
@Service @Service
public class RegionSettingLocationServiceImpl extends ServiceImpl<RegionSettingLocationMapper, RegionSettingLocation> implements RegionSettingLocationService { public class PlatRegionSettingLocationServiceImpl extends ServiceImpl<PlatRegionSettingLocationMapper, PlatRegionSettingLocation> implements PlatRegionSettingLocationService {
} }
package com.makeit.service.platform.space.impl; package com.makeit.service.platform.space.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.makeit.entity.platform.space.RegionSetting; import com.makeit.entity.platform.space.PlatRegionSetting;
import com.makeit.mapper.platform.space.RegionSettingMapper; import com.makeit.mapper.platform.space.PlatRegionSettingMapper;
import com.makeit.service.platform.space.RegionSettingService; import com.makeit.service.platform.space.PlatRegionSettingService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
...@@ -12,5 +12,5 @@ import org.springframework.stereotype.Service; ...@@ -12,5 +12,5 @@ import org.springframework.stereotype.Service;
* @Describe: * @Describe:
*/ */
@Service @Service
public class RegionSettingServiceImpl extends ServiceImpl<RegionSettingMapper, RegionSetting> implements RegionSettingService { public class PlatRegionSettingServiceImpl extends ServiceImpl<PlatRegionSettingMapper, PlatRegionSetting> implements PlatRegionSettingService {
} }
package com.makeit.service.platform.space.impl; package com.makeit.service.platform.space.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.makeit.entity.platform.space.Room; import com.makeit.entity.platform.space.PlatRoom;
import com.makeit.mapper.platform.space.RoomMapper; import com.makeit.mapper.platform.space.PlatRoomMapper;
import com.makeit.service.platform.space.RoomService; import com.makeit.service.platform.space.PlatRoomService;
/** /**
* @Author:lzy * @Author:lzy
* @Date:2023/8/31 16:15 * @Date:2023/8/31 16:15
* @Describe: * @Describe:
*/ */
public class RoomServiceImpl extends ServiceImpl<RoomMapper, Room> implements RoomService { public class PlatRoomServiceImpl extends ServiceImpl<PlatRoomMapper, PlatRoom> implements PlatRoomService {
} }
package com.makeit.service.platform.space.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.makeit.dto.platform.space.PlatSpaceAddDTO;
import com.makeit.entity.platform.space.PlatSpace;
import com.makeit.enums.CodeMessageEnum;
import com.makeit.exception.BusinessException;
import com.makeit.mapper.platform.space.PlatSpaceMapper;
import com.makeit.service.platform.space.PlatSpaceService;
import com.makeit.utils.data.convert.BeanDtoVoUtils;
import jodd.util.StringUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* @Author:lzy
* @Date:2023/8/31 16:17
* @Describe:
*/
@Service
public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace> implements PlatSpaceService {
private void check(PlatSpaceAddDTO dto){
LambdaQueryWrapper<PlatSpace> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PlatSpace::getParentId,dto.getParentId());
queryWrapper.eq(PlatSpace::getName,dto.getName());
queryWrapper.ne(StringUtil.isNotEmpty(dto.getId()), PlatSpace::getId,dto.getId());
if(this.count(queryWrapper) > 0){
throw new BusinessException(CodeMessageEnum.PLATFORM_ERROR_SPACE_NAME_DUPLICATE);
}
}
@Override
@Transactional
public void add(PlatSpaceAddDTO dto) {
check(dto);
PlatSpace space = BeanDtoVoUtils.convert(dto, PlatSpace.class);
save(space);
}
@Override
@Transactional
public void edit(PlatSpaceAddDTO dto) {
check(dto);
PlatSpace space = this.getById(dto.getId());
space.setName(dto.getName());
space.setType(dto.getType());
space.setAddress(dto.getAddress());
space.setLatitude(dto.getLatitude());
space.setLongitude(dto.getLongitude());
space.setParentId(dto.getParentId());
this.updateById(space);
}
@Override
public void del(String id) {
this.removeById(id);
}
}
package com.makeit.service.platform.space.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.makeit.entity.platform.space.Space;
import com.makeit.mapper.platform.space.SpaceMapper;
import com.makeit.service.platform.space.SpaceService;
import org.springframework.stereotype.Service;
/**
* @Author:lzy
* @Date:2023/8/31 16:17
* @Describe:
*/
@Service
public class SpaceServiceImpl extends ServiceImpl<SpaceMapper, Space> implements SpaceService {
}
...@@ -128,7 +128,7 @@ implements PlatTenantService { ...@@ -128,7 +128,7 @@ implements PlatTenantService {
TntUserJoinUtil.join(platUserService,voList,qw->qw.eq(PlatUser::getIsTenant, IsTenantAccountEnum.YES.getValue()), TntUserJoinUtil.join(platUserService,voList,qw->qw.eq(PlatUser::getIsTenant, IsTenantAccountEnum.YES.getValue()),
PlatTenantVO::getTntUserId,(t, u) -> { PlatTenantVO::getTntUserId,(t, u) -> {
t.setUserAccount(u.getAccount()); t.setUserAccount(u.getMobile());
t.setUserName(u.getUsername()); t.setUserName(u.getUsername());
}, BaseEntity::getId); }, BaseEntity::getId);
...@@ -202,7 +202,7 @@ implements PlatTenantService { ...@@ -202,7 +202,7 @@ implements PlatTenantService {
//组织表增加一条数据 //组织表增加一条数据
PlatOrg platOrg = convertToPlatOrg(tntTenant); PlatOrg platOrg = convertToPlatOrg(tntTenant);
platOrgService.add(platOrg); platOrgService.save(platOrg);
return tntTenant.getId(); return tntTenant.getId();
} }
...@@ -236,6 +236,8 @@ implements PlatTenantService { ...@@ -236,6 +236,8 @@ implements PlatTenantService {
platOrg.setName(platTenant.getName()); platOrg.setName(platTenant.getName());
platOrg.setStatus(platTenant.getStatus()); platOrg.setStatus(platTenant.getStatus());
platOrg.setId(platTenant.getId()); platOrg.setId(platTenant.getId());
//租户没有父级
platOrg.setParentId("1");
return platOrg; return platOrg;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment