Merge remote-tracking branch 'origin/cc_20230520_partner' into cc_20230520_partner
This commit is contained in:
@@ -114,8 +114,8 @@ public class HyPartnerLineInfoDAO {
|
||||
}
|
||||
|
||||
|
||||
public List<PartnerBlackListDTO> getBlackList( String userNameKeyword,String phoneKeyword, String intentArea , Integer acceptAdjustType){
|
||||
return hyPartnerLineInfoMapper.getBlackList(userNameKeyword,phoneKeyword,intentArea,acceptAdjustType);
|
||||
public List<PartnerBlackListDTO> getBlackList( String userNameKeyword,String phoneKeyword, String intentAreaName , Integer acceptAdjustType){
|
||||
return hyPartnerLineInfoMapper.getBlackList(userNameKeyword,phoneKeyword,intentAreaName,acceptAdjustType);
|
||||
}
|
||||
|
||||
|
||||
@@ -126,14 +126,14 @@ public class HyPartnerLineInfoDAO {
|
||||
return hyPartnerLineInfoMapper.joinAndRemoveBlack(lineId,status,joinReason,removeReason);
|
||||
}
|
||||
|
||||
public List<PublicSeaLineDTO> getPublicSeaLineList( String userNameKeyword, String phoneKeyword, String intentArea, Integer acceptAdjustType, String updateStartTime, String updateEndTime, List<String> userIdList){
|
||||
return hyPartnerLineInfoMapper.getPublicSeaLineList(userNameKeyword,phoneKeyword,intentArea,acceptAdjustType,updateStartTime,updateEndTime,userIdList);
|
||||
public List<PublicSeaLineDTO> getPublicSeaLineList( String userNameKeyword, String phoneKeyword, String intentAreaName, Integer acceptAdjustType, String updateStartTime, String updateEndTime, List<String> userIdList){
|
||||
return hyPartnerLineInfoMapper.getPublicSeaLineList(userNameKeyword,phoneKeyword,intentAreaName,acceptAdjustType,updateStartTime,updateEndTime,userIdList);
|
||||
}
|
||||
|
||||
public List<PrivateSeaLineDTO> getPrivateSeaLineList(String keyword, String keywordType, String workflowStage, String workflowStatus, Date deadlineStart, Date deadlineEnd,
|
||||
String intentArea, Integer acceptAdjustType, String storeKeyword, String storeKeywordType, List<String> userIdList,List<String> developmentManagerList){
|
||||
String intentAreaName, Integer acceptAdjustType, String storeKeyword, String storeKeywordType, List<String> userIdList,List<String> developmentManagerList){
|
||||
return hyPartnerLineInfoMapper.getPrivateSeaLineList( keyword, keywordType, workflowStage, workflowStatus, deadlineStart, deadlineEnd,
|
||||
intentArea, acceptAdjustType, storeKeyword, storeKeywordType, userIdList,developmentManagerList);
|
||||
intentAreaName, acceptAdjustType, storeKeyword, storeKeywordType, userIdList,developmentManagerList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
package com.cool.store.dao;
|
||||
|
||||
import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils;
|
||||
import com.cool.store.entity.SysRoleMenuDO;
|
||||
import com.cool.store.mapper.SysRoleMenuMapper;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @date 2023-05-19 03:01
|
||||
@@ -9,4 +17,20 @@ import org.springframework.stereotype.Repository;
|
||||
@Repository
|
||||
public class SysRoleMenuDAO {
|
||||
|
||||
@Resource
|
||||
private SysRoleMenuMapper sysRoleMenuMapper;
|
||||
|
||||
/**
|
||||
* 获取菜单
|
||||
* @param roleId
|
||||
* @param platform
|
||||
* @return
|
||||
*/
|
||||
public List<SysRoleMenuDO> getRoleMenuByRoleId(String roleId, String platform){
|
||||
if(Objects.isNull(roleId) || StringUtils.isBlank(platform)){
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return sysRoleMenuMapper.getRoleMenuByRoleId(roleId, platform);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -118,7 +118,7 @@ public interface HyPartnerLineInfoMapper {
|
||||
*/
|
||||
List<PartnerBlackListDTO> getBlackList(@Param("userNameKeyword") String userNameKeyword,
|
||||
@Param("phoneKeyword") String phoneKeyword,
|
||||
@Param("intentArea") String intentArea ,
|
||||
@Param("intentAreaName") String intentAreaName ,
|
||||
@Param("acceptAdjustType") Integer acceptAdjustType);
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ public interface HyPartnerLineInfoMapper {
|
||||
*/
|
||||
List<PublicSeaLineDTO> getPublicSeaLineList(@Param("userNameKeyword") String userNameKeyword,
|
||||
@Param("phoneKeyword") String phoneKeyword,
|
||||
@Param("intentArea") String intentArea,
|
||||
@Param("intentAreaName") String intentAreaName,
|
||||
@Param("acceptAdjustType") Integer acceptAdjustType,
|
||||
@Param("updateStartTime") String updateStartTime,
|
||||
@Param("updateEndTime") String updateEndTime,
|
||||
@@ -169,7 +169,7 @@ public interface HyPartnerLineInfoMapper {
|
||||
@Param("workflowStatus") String workflowStatus,
|
||||
@Param("deadlineStart") Date deadlineStart,
|
||||
@Param("deadlineEnd") Date deadlineEnd,
|
||||
@Param("intentArea") String intentArea,
|
||||
@Param("intentAreaName") String intentAreaName,
|
||||
@Param("acceptAdjustType") Integer acceptAdjustType,
|
||||
@Param("storeKeyword") String storeKeyword,
|
||||
@Param("storeKeywordType") String storeKeywordType,
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.cool.store.mapper;
|
||||
import com.cool.store.entity.SysRoleMenuDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @date 2023-05-19 03:01
|
||||
@@ -22,4 +24,12 @@ public interface SysRoleMenuMapper {
|
||||
* dateTime:2023-05-19 03:01
|
||||
*/
|
||||
int updateByPrimaryKeySelective(@Param("record") SysRoleMenuDO record);
|
||||
|
||||
/**
|
||||
* 根据角色获取菜单
|
||||
* @param roleId
|
||||
* @param platform
|
||||
* @return
|
||||
*/
|
||||
List<SysRoleMenuDO> getRoleMenuByRoleId(@Param("roleId")String roleId, @Param("platform")String platform);
|
||||
}
|
||||
@@ -388,8 +388,8 @@
|
||||
<if test="phoneKeyword!=null and phoneKeyword !=''">
|
||||
and b.mobile like concat('%', #{phoneKeyword}, '%')
|
||||
</if>
|
||||
<if test="intentArea!=null and intentArea!=''">
|
||||
and b.want_shop_area = #{intentArea}
|
||||
<if test="intentAreaName!=null and intentAreaName!=''">
|
||||
and b.want_shop_area like concat('%/',#{intentAreaName},'/%')
|
||||
</if>
|
||||
<if test="acceptAdjustType!=null">
|
||||
and b.accept_adjust_type =#{acceptAdjustType}
|
||||
@@ -437,8 +437,8 @@
|
||||
<if test="phoneKeyword!=null and phoneKeyword!=''">
|
||||
and b.mobile like concat('%',#{phoneKeyword},'%')
|
||||
</if>
|
||||
<if test="intentArea!=null and intentArea!=''">
|
||||
and b.want_shop_area = #{intentArea}
|
||||
<if test="intentAreaName!=null and intentAreaName!=''">
|
||||
and b.want_shop_area like concat('%/',#{intentAreaName},'/%')
|
||||
</if>
|
||||
<if test="acceptAdjustType!=null">
|
||||
and b.accept_adjust_type = #{acceptAdjustType}
|
||||
@@ -473,6 +473,7 @@
|
||||
hpuinfo.shop_name as storeName,
|
||||
hpuinfo.recommend_partner_name as recommendPartnerName,
|
||||
eu.name as investmentManagerName,
|
||||
eu.mobile as investmentManagerMobile,
|
||||
hpip.id as interviewPlanId,
|
||||
hpip.start_time as startTime
|
||||
FROM
|
||||
@@ -497,8 +498,8 @@
|
||||
<if test="deadlineStart!=null and deadlineEnd!=null">
|
||||
AND hpli.deadline BETWEEN #{deadlineStart} and #{deadlineStart}
|
||||
</if>
|
||||
<if test="intentArea!=null and intentArea!=''">
|
||||
AND hpuinfo.want_shop_area = #{intentArea}
|
||||
<if test="intentAreaName!=null and intentAreaName!=''">
|
||||
and b.want_shop_area like concat('%/',#{intentAreaName},'/%')
|
||||
</if>
|
||||
<if test="acceptAdjustType!=null">
|
||||
AND hpuinfo.accept_adjust_type = #{acceptAdjustType}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.SysRoleMenuDO">
|
||||
<id column="id" jdbcType="BIGINT" property="id"/>
|
||||
<result column="menu_id" jdbcType="BIGINT" property="menuId"/>
|
||||
<result column="role_id" jdbcType="BIGINT" property="roleId"/>
|
||||
<result column="role_id" jdbcType="VARCHAR" property="roleId"/>
|
||||
<result column="platform" jdbcType="VARCHAR" property="platform"/>
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
@@ -50,4 +50,13 @@
|
||||
</set>
|
||||
where id = #{record.id}
|
||||
</update>
|
||||
|
||||
<select id="getRoleMenuByRoleId" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from
|
||||
sys_role_menu
|
||||
where
|
||||
role_id=#{roleId} and platform=#{platform}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -73,4 +73,6 @@ public class PrivateSeaLineDTO {
|
||||
|
||||
private Date startTime;
|
||||
|
||||
private String investmentManagerMobile;
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public class SysRoleMenuDO implements Serializable {
|
||||
private Long menuId;
|
||||
|
||||
@ApiModelProperty("角色id")
|
||||
private Long roleId;
|
||||
private String roleId;
|
||||
|
||||
@ApiModelProperty("菜单类型")
|
||||
private String platform;
|
||||
|
||||
@@ -87,6 +87,8 @@ public class PrivateSeaLineListVo {
|
||||
|
||||
private Date startTime;
|
||||
|
||||
private String investmentManagerMobile;
|
||||
|
||||
|
||||
public static List<PrivateSeaLineListVo> convertList(List<PrivateSeaLineDTO> list, Map<String, String> finalDevManagerMap, Map<String, String> wantShopAreaNameMap){
|
||||
List<PrivateSeaLineListVo> resultList = new ArrayList<>();
|
||||
@@ -105,11 +107,11 @@ public class PrivateSeaLineListVo {
|
||||
privateSeaLineListVo.setDevelopmentManager(x.getDevelopmentManager());
|
||||
privateSeaLineListVo.setInvestmentManagerName(x.getInvestmentManagerName());
|
||||
privateSeaLineListVo.setStoreCode(x.getStoreCode());
|
||||
privateSeaLineListVo.setInvestmentManagerMobile(x.getInvestmentManagerMobile());
|
||||
privateSeaLineListVo.setStoreName(x.getStoreName());
|
||||
String updateTime = DateUtil.format(x.getUpdateTime(), CoolDateUtils.DATE_FORMAT_SEC_2);
|
||||
privateSeaLineListVo.setUpdateTime(updateTime);
|
||||
privateSeaLineListVo.setRecommendPartnerId(x.getRecommendPartnerId());
|
||||
privateSeaLineListVo.setAcceptAdjustType(x.getAcceptAdjustType());
|
||||
privateSeaLineListVo.setWantShopArea(x.getWantShopArea());
|
||||
privateSeaLineListVo.setWantShopAreaName(wantShopAreaNameMap.get(x.getWantShopArea()));
|
||||
privateSeaLineListVo.setInvestmentManager(x.getInvestmentManager());
|
||||
|
||||
@@ -63,18 +63,18 @@ public class JobHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@XxlJob("updateAbsentInterview")
|
||||
public void updateAbsentInterview(){
|
||||
try {
|
||||
log.info("面试缺席定时任务开始");
|
||||
hyPartnerInterviewPlanService.updateAbsentInterview();
|
||||
log.info("面试缺席定时任务结束");
|
||||
XxlJobHelper.handleSuccess();
|
||||
}catch (Exception e){
|
||||
log.error("面试缺席定时任务异常",e);
|
||||
XxlJobHelper.log("面试缺席定时任务异常"+e.getMessage());
|
||||
}
|
||||
}
|
||||
// @XxlJob("updateAbsentInterview")
|
||||
// public void updateAbsentInterview(){
|
||||
// try {
|
||||
// log.info("面试缺席定时任务开始");
|
||||
// hyPartnerInterviewPlanService.updateAbsentInterview();
|
||||
// log.info("面试缺席定时任务结束");
|
||||
// XxlJobHelper.handleSuccess();
|
||||
// }catch (Exception e){
|
||||
// log.error("面试缺席定时任务异常",e);
|
||||
// XxlJobHelper.log("面试缺席定时任务异常"+e.getMessage());
|
||||
// }
|
||||
// }
|
||||
|
||||
@XxlJob("approvalReminder")
|
||||
public void approvalReminder(){
|
||||
|
||||
@@ -150,7 +150,7 @@ public class HyPartnerIntentInfoServiceImpl implements HyPartnerIntentInfoServic
|
||||
partnerIntentInfoVO.setWorkflowStatus(hyPartnerLineInfoDO.getWorkflowStatus());
|
||||
partnerIntentInfoVO.setPartnerUserPhone(hyPartnerUserInfoDO.getMobile());
|
||||
HyOpenAreaInfoDO hyOpenAreaInfoDO = hyOpenAreaInfoDAO.selectById(Long.valueOf(hyPartnerUserInfoDO.getWantShopArea()));
|
||||
partnerIntentInfoVO.setWantShopAreaName(hyOpenAreaInfoDO.getAreaName());
|
||||
partnerIntentInfoVO.setWantShopAreaName(hyOpenAreaInfoDO.getAreaPath().replace("/"," "));
|
||||
return partnerIntentInfoVO;
|
||||
}
|
||||
|
||||
|
||||
@@ -179,11 +179,14 @@ public class HyPartnerInterviewPlanServiceImpl implements HyPartnerInterviewPlan
|
||||
return;
|
||||
}
|
||||
List<Long> lineIds = overTimeReserveLineList.stream().map(o -> o.getId()).collect(Collectors.toList());
|
||||
List<HyPartnerInterviewDO> interviewBaseInfoList = hyPartnerInterviewMapper.getInterviewBaseInfoListByLineIds(lineIds);
|
||||
if(CollectionUtils.isEmpty(interviewBaseInfoList)){
|
||||
return;
|
||||
for (Long lineId : lineIds) {
|
||||
CloseFollowRequest closeFollowRequest = new CloseFollowRequest();
|
||||
closeFollowRequest.setRejectPublicReason("超时未预约");
|
||||
closeFollowRequest.setRejectRealReason("超时未预约");
|
||||
closeFollowRequest.setLineId(lineId);
|
||||
closeFollowRequest.setType("overtime_interview");
|
||||
hyPartnerLineInfoService.closeOrPassFollow(null,closeFollowRequest);
|
||||
}
|
||||
handleOverTimeInterview(interviewBaseInfoList,"超时未预约");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -192,7 +195,7 @@ public class HyPartnerInterviewPlanServiceImpl implements HyPartnerInterviewPlan
|
||||
//更新会议开始时间为5分钟之内的房间状态为开启,会议状态变为已开始
|
||||
Date startTime = new Date();
|
||||
|
||||
List<HyPartnerLineInfoDO> waitForOpenInterviewLineList = hyPartnerLineInfoMapper.getWaitForOpenInterviewLineList(startTime, DateUtil.offsetMinute(startTime, 5));
|
||||
List<HyPartnerLineInfoDO> waitForOpenInterviewLineList = hyPartnerLineInfoMapper.getWaitForOpenInterviewLineList(DateUtil.offsetDay(startTime,-2), DateUtil.offsetMinute(startTime, 5));
|
||||
if(CollectionUtils.isEmpty(waitForOpenInterviewLineList)){
|
||||
return;
|
||||
}
|
||||
@@ -248,6 +251,7 @@ public class HyPartnerInterviewPlanServiceImpl implements HyPartnerInterviewPlan
|
||||
for (Long lineId : lineIds) {
|
||||
CloseFollowRequest closeFollowRequest = new CloseFollowRequest();
|
||||
closeFollowRequest.setRejectPublicReason(rejectPublicReason);
|
||||
closeFollowRequest.setRejectRealReason(rejectPublicReason);
|
||||
closeFollowRequest.setLineId(lineId);
|
||||
closeFollowRequest.setType("overtime_interview");
|
||||
hyPartnerLineInfoService.closeOrPassFollow(null,closeFollowRequest);
|
||||
|
||||
@@ -107,7 +107,7 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
|
||||
}
|
||||
if (StringUtils.isNotEmpty(partnerLineInfoAndBaseInfoDTO.getWantShopArea())){
|
||||
HyOpenAreaInfoDO hyOpenAreaInfoDO = hyOpenAreaInfoDAO.selectById(Long.valueOf(partnerLineInfoAndBaseInfoDTO.getWantShopArea()));
|
||||
partnerLineInfoAndBaseInfoVO.setWantShopAreaName(hyOpenAreaInfoDO.getAreaName());
|
||||
partnerLineInfoAndBaseInfoVO.setWantShopAreaName(hyOpenAreaInfoDO.getAreaPath().replace("/"," "));
|
||||
}
|
||||
EnterpriseUserDO investmentManager = enterpriseUserDAO.getUserInfoById(partnerLineInfoAndBaseInfoVO.getInvestmentManager());
|
||||
if (investmentManager!=null){
|
||||
@@ -224,8 +224,9 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
|
||||
|
||||
@Override
|
||||
public PageInfo<BlackListVO> getBlackList(LineRequest LineRequest) {
|
||||
String intentAreaName = getIntentAreaName(LineRequest.getIntentArea());
|
||||
PageHelper.startPage(LineRequest.getPageNum(),LineRequest.getPageSize());
|
||||
PageInfo blackListDTOPageInfo = new PageInfo(hyPartnerLineInfoDAO.getBlackList(LineRequest.getUserNameKeyword(), LineRequest.getPhoneKeyword(),LineRequest.getIntentArea(), LineRequest.getAcceptAdjustType()));
|
||||
PageInfo blackListDTOPageInfo = new PageInfo(hyPartnerLineInfoDAO.getBlackList(LineRequest.getUserNameKeyword(), LineRequest.getPhoneKeyword(),intentAreaName, LineRequest.getAcceptAdjustType()));
|
||||
List<PartnerBlackListDTO> list = blackListDTOPageInfo.getList();
|
||||
List<String> closeUserIdList = list.stream().map(PartnerBlackListDTO::getCloseUserId).collect(Collectors.toList());
|
||||
Map<String, String> userPhoneMap = enterpriseUserDAO.getUserNameAndMobile(closeUserIdList);
|
||||
@@ -417,9 +418,10 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
|
||||
// }else {
|
||||
// userIds = Arrays.asList(userId);
|
||||
// }
|
||||
String intentAreaName = getIntentAreaName(lineRequest.getIntentArea());
|
||||
PageHelper.startPage(lineRequest.getPageNum(),lineRequest.getPageSize());
|
||||
PageInfo publicSeaLineList = new PageInfo(hyPartnerLineInfoDAO.getPublicSeaLineList(lineRequest.getUserNameKeyword(), lineRequest.getPhoneKeyword(),
|
||||
lineRequest.getIntentArea(), lineRequest.getAcceptAdjustType(), lineRequest.getUpdateStartTime(), lineRequest.getUpdateEndTime(), null));
|
||||
intentAreaName, lineRequest.getAcceptAdjustType(), lineRequest.getUpdateStartTime(), lineRequest.getUpdateEndTime(), null));
|
||||
|
||||
List<PublicSeaLineDTO> list = publicSeaLineList.getList();
|
||||
if (CollectionUtils.isEmpty(list)){
|
||||
@@ -468,13 +470,15 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public PageInfo<PrivateSeaLineListVo> privateSeaLineList(String userId, PrivateSeaLineListRequest request) {
|
||||
UserPositionAndUserScopeDTO userIdsByScope = enterpriseUserService.getUserIdsByScope(userId);
|
||||
String intentAreaName = getIntentAreaName(request.getIntentArea());
|
||||
PageHelper.startPage(request.getPageNum(),request.getPageSize());
|
||||
PageInfo privateLineList = new PageInfo(hyPartnerLineInfoDAO.getPrivateSeaLineList(request.getKeyword(), request.getKeywordType(), request.getWorkflowStage(),
|
||||
request.getWorkflowStatus(), request.getDeadlineStart(), request.getDeadlineEnd(),
|
||||
request.getIntentArea(), request.getAcceptAdjustType(), request.getStoreKeyword(),
|
||||
intentAreaName, request.getAcceptAdjustType(), request.getStoreKeyword(),
|
||||
request.getStoreKeywordType(), userIdsByScope.getInvestmentUserIds(),userIdsByScope.getDevelopmentUserIds()));
|
||||
List<PrivateSeaLineDTO> list = privateLineList.getList();
|
||||
if (CollectionUtils.isEmpty(list)){
|
||||
@@ -758,4 +762,18 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
|
||||
return stageCountVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* getIntentAreaName
|
||||
* @param intentArea
|
||||
* @return
|
||||
*/
|
||||
private String getIntentAreaName(String intentArea){
|
||||
String intentAreaName = null;
|
||||
if (StringUtils.isNotEmpty(intentArea)){
|
||||
HyOpenAreaInfoDO hyOpenAreaInfoDO = hyOpenAreaInfoDAO.selectById(Long.valueOf(intentArea));
|
||||
intentAreaName = hyOpenAreaInfoDO.getAreaName();
|
||||
}
|
||||
return intentAreaName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,14 +2,20 @@ package com.cool.store.service.impl;
|
||||
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.dao.SysMenuDAO;
|
||||
import com.cool.store.dao.SysRoleMenuDAO;
|
||||
import com.cool.store.entity.SysMenuDO;
|
||||
import com.cool.store.entity.SysRoleMenuDO;
|
||||
import com.cool.store.enums.MenuTypeEnum;
|
||||
import com.cool.store.enums.PlatFormTypeEnum;
|
||||
import com.cool.store.service.MenuService;
|
||||
import com.cool.store.vo.menu.MenuTreeVO;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
@@ -22,11 +28,35 @@ public class MenuServiceImpl implements MenuService {
|
||||
|
||||
@Resource
|
||||
private SysMenuDAO sysMenuDAO;
|
||||
@Resource
|
||||
private SysRoleMenuDAO sysRoleMenuDAO;
|
||||
|
||||
@Override
|
||||
public List<MenuTreeVO> getUserMenus(String userId, String roleId) {
|
||||
List<SysMenuDO> menuList= sysMenuDAO.selectMenuAll(null, PlatFormTypeEnum.PC.getCode());
|
||||
List<SysRoleMenuDO> roleMenuList = sysRoleMenuDAO.getRoleMenuByRoleId(roleId, PlatFormTypeEnum.PC.getCode());
|
||||
List<Long> anthMenuIdList = menuList.stream().filter(o -> MenuTypeEnum.AUTH.getCode().equals(o.getMenuType())).map(SysMenuDO::getId).collect(Collectors.toList());
|
||||
List<Long> roleMenuIdList = roleMenuList.stream().map(SysRoleMenuDO::getMenuId).filter(anthMenuIdList::contains).collect(Collectors.toList());
|
||||
Set<Long> authMenuSet = new HashSet<>();
|
||||
//1倒推菜单列表 2.转换成树`
|
||||
if (CollectionUtils.isEmpty(roleMenuIdList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
authMenuSet.addAll(roleMenuIdList);
|
||||
Map<Long, Long> idMap = menuList.stream().filter(a -> a.getId() != null && a.getParentId() != null).collect(Collectors.toMap(SysMenuDO::getId, SysMenuDO::getParentId));
|
||||
for (Long menuId : roleMenuIdList) {
|
||||
getParentNode(menuId, idMap, authMenuSet);
|
||||
}
|
||||
menuList = menuList.stream().filter(data -> authMenuSet.contains(data.getId())).collect(Collectors.toList());
|
||||
//根据角色获取菜单
|
||||
return MenuTreeVO.dealMenuTree(CommonConstants.ZERO_LONG, menuList);
|
||||
}
|
||||
|
||||
private void getParentNode(Long menuId, Map<Long, Long> idMap, Set<Long> authMenuList) {
|
||||
Long parentId = idMap.get(menuId);
|
||||
authMenuList.add(parentId);
|
||||
if (parentId!=null&&parentId != 0) {
|
||||
getParentNode(parentId, idMap, authMenuList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user