提交 c78a70c7 作者: 典文龙

根据看板系统当天再投号,增加权限

上级 6b5fc61e
......@@ -11,7 +11,15 @@ import java.util.Set;
@Mapper
public interface AuthorizerTokenMapper extends BaseMapper<AuthorizerToken> {
AuthorizerToken findByAppid(@Param("appid")String appid);
AuthorizerToken findByAppid(@Param("appid") String appid);
List<AuthorizerToken> findByAppidIn(@Param("appidList") Set<String> appidList);
}
\ No newline at end of file
/**
* 查看权限等级
*
* @param userId
* @return
*/
Integer getUserRoleLevel(@Param("userId") Long userId);
}
......@@ -3,6 +3,7 @@ package com.yaoyaozw.customer.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.yaoyaozw.customer.entity.CrowdPackageCondition;
import com.yaoyaozw.customer.vo.AuthInfoVO;
import com.yaoyaozw.customer.vo.kanban.AccountSetupVO;
import com.yaoyaozw.customer.vo.kanban.CommonCostSetupVo;
import com.yaoyaozw.customer.vo.kanban.CommonOptionResponseVO;
import org.apache.ibatis.annotations.Param;
......@@ -61,4 +62,6 @@ public interface KanbanCommonMapper {
* @return {@link List}<{@link AuthInfoVO}>
*/
List<AuthInfoVO> getAllStoreList();
List<AccountSetupVO> getRole(@Param("userId") Long userId, @Param("appIds") List<String> appIds);
}
......@@ -19,6 +19,7 @@ import com.yaoyaozw.customer.entity.CommonReferralBody;
import com.yaoyaozw.customer.entity.AuthorizerInfo;
import com.yaoyaozw.customer.entity.CustomerGraphicsDelay;
import com.yaoyaozw.customer.entity.ReferralEntity;
import com.yaoyaozw.customer.mapper.AuthorizerTokenMapper;
import com.yaoyaozw.customer.mapper.CustomerGraphicsDelayMapper;
import com.yaoyaozw.customer.mapper.KanbanCommonMapper;
import com.yaoyaozw.customer.mapper.MaterialCommonMapper;
......@@ -26,6 +27,7 @@ import com.yaoyaozw.customer.service.AuthorizerInfoService;
import com.yaoyaozw.customer.service.CustomerGraphicsDelayService;
import com.yaoyaozw.customer.service.ReferralEntityService;
import com.yaoyaozw.customer.vo.AuthInfoVO;
import com.yaoyaozw.customer.vo.kanban.AccountSetupVO;
import com.yaoyaozw.customer.vo.kanban.CommonOptionResponseVO;
import com.yaoyaozw.customer.vo.customer.CustomerDelayGraphicsDetailVO;
import com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO;
......@@ -39,6 +41,7 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.security.acl.Acl;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.function.Function;
......@@ -74,12 +77,14 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
private MaterialCommonMapper materialCommonMapper;
@Autowired
private RedisTemplate<String, Object> redisTemplate;
@Autowired
private AuthorizerTokenMapper authorizerTokenMapper;
@Override
public List<CustomerDelayItemVO> findAllDelayCustomerSort(Set<String> appidList,Integer maxSortRange) {
public List<CustomerDelayItemVO> findAllDelayCustomerSort(Set<String> appidList, Integer maxSortRange) {
return baseMapper.findDelayCustomerMessageByRange(appidList,maxSortRange);
return baseMapper.findDelayCustomerMessageByRange(appidList, maxSortRange);
}
......@@ -323,6 +328,20 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
}
List<AuthInfoVO> authList = super.baseMapper.getAuthList(keyword, keywordList, storeType, appId);
if (ObjectUtil.isNotNull(appId)) {
Long userId = tokenManager.getUserIdFromToken();
Integer userRoleLevel = authorizerTokenMapper.getUserRoleLevel(userId);
if (userRoleLevel <= 3) {
//获取看板系统再投的数据
List<String> appIds = authList.stream().map(AuthInfoVO::getAppId).collect(Collectors.toList());
List<AccountSetupVO> accountSetupVOList = kanbanCommonMapper.getRole(userId, appIds);
if (!accountSetupVOList.isEmpty()) {
List<String> appIdList = accountSetupVOList.stream().map(AccountSetupVO::getAppId).collect(Collectors.toList());
authList = authList.stream().filter(item -> appIdList.contains(item.getAppId())).collect(Collectors.toList());
}
}
}
Map<Object, Object> entries = redisTemplate.opsForHash().entries(STORE_NAME_REDIS_KEY);
if (CollectionUtil.isNotEmpty(entries)) {
Map<String, String> map = new HashMap<>(entries.size());
......
package com.yaoyaozw.customer.vo.kanban;
import lombok.Data;
/**
* @Author: Dwl
* @Date: 2024/05/28/10:28
* @ClassName: AccountSetupVO
* @Version: V3.2.0
* @Description:
*/
@Data
public class AccountSetupVO {
private String appId;
private Long accountId;
private String nickName;
}
......@@ -30,4 +30,12 @@
</foreach>
</select>
</mapper>
\ No newline at end of file
<select id="getUserRoleLevel" resultType="java.lang.Integer">
select max(role.role_level)
from acl_user_role aur
left join acl_role role
on aur.role_id = role.id
where aur.user_id = #{userId}
</select>
</mapper>
......@@ -58,4 +58,18 @@
from store_entity
where is_deleted = 0 and pct_type = 'PROFIT_PCT'
</select>
</mapper>
\ No newline at end of file
<select id="getRole" resultType="com.yaoyaozw.customer.vo.kanban.AccountSetupVO">
SELECT ae.nick_name,
ae.app_id,
acs.account_id,
acs.sales_user
FROM account_entity ae
LEFT JOIN account_cost_setup acs ON acs.account_id = ae.id
WHERE acs.cost_date = CURRENT_DATE
AND acs.sales_user = #{userId}
AND acs.app_id in
<foreach collection="appIds" item="appId" open="(" close=")" separator=",">
#{appId}
</foreach>
</select>
</mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论