## 活动列表报单赠送添加权限过滤;
This commit is contained in:
parent
9410a83091
commit
e44338285e
|
|
@ -1,7 +1,10 @@
|
|||
package com.hzs.activity.base.controller.api;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.hzs.activity.base.param.ActivityParam;
|
||||
import com.hzs.activity.base.service.IAcBaseAuthorityService;
|
||||
import com.hzs.activity.base.service.IAcBaseConfigService;
|
||||
import com.hzs.common.core.enums.EActType;
|
||||
import com.hzs.common.core.web.controller.BaseController;
|
||||
import com.hzs.common.core.web.page.TableDataInfo;
|
||||
import com.hzs.common.domain.activity.base.AcBaseConfig;
|
||||
|
|
@ -14,44 +17,51 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description: 查询活动列表
|
||||
* @author: sui q
|
||||
* @time: 2023/4/27 09:15
|
||||
* @classname: ApiActivityController
|
||||
* @package_name: com.hzs.activity.base.controller.api
|
||||
* version 1.0.0
|
||||
* 查询活动列表
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/base")
|
||||
public class ApiActivityController extends BaseController {
|
||||
|
||||
private IAcBaseConfigService baseConfigService;
|
||||
|
||||
@Autowired
|
||||
public void setBaseConfigService(IAcBaseConfigService baseConfigService) {
|
||||
this.baseConfigService = baseConfigService;
|
||||
}
|
||||
private IAcBaseConfigService iAcBaseConfigService;
|
||||
@Autowired
|
||||
private IAcBaseAuthorityService iAcBaseAuthorityService;
|
||||
|
||||
/*
|
||||
* @description: 查询活动列表
|
||||
* @author: sui q
|
||||
* @date: 2023/4/21 17:33
|
||||
* @param: null null
|
||||
* 查询活动列表
|
||||
**/
|
||||
@GetMapping("/activity-list")
|
||||
public TableDataInfo activityList() {
|
||||
return getDataTable(baseConfigService.queryBaseConfigList(SecurityUtils.getPkCountry(), SecurityUtils.getUserId()));
|
||||
Long pkMember = SecurityUtils.getUserId();
|
||||
String memberCode = SecurityUtils.getMemberCode();
|
||||
|
||||
List<AcBaseConfigExt> resultList = new ArrayList<>();
|
||||
|
||||
List<AcBaseConfigExt> list = iAcBaseConfigService.queryBaseConfigList(SecurityUtils.getPkCountry(), SecurityUtils.getUserId());
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
for (AcBaseConfigExt acBaseConfigExt : list) {
|
||||
if (EActType.DECLARATION_GIFT.getValue() == acBaseConfigExt.getActType()) {
|
||||
// 报单赠送,需要处理权限
|
||||
if (!iAcBaseAuthorityService.checkAuthority(pkMember, memberCode, acBaseConfigExt.getPkId())) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
resultList.add(acBaseConfigExt);
|
||||
}
|
||||
}
|
||||
|
||||
TableDataInfo tableDataInfo = getDataTable(list);
|
||||
tableDataInfo.setRows(resultList);
|
||||
return tableDataInfo;
|
||||
}
|
||||
|
||||
/*
|
||||
* @description: 查询活动列表
|
||||
* @author: sui q
|
||||
* @date: 2023/4/21 17:33
|
||||
* @param: null null
|
||||
* 查询活动列表
|
||||
**/
|
||||
@PostMapping("/activity-detail")
|
||||
public TableDataInfo activityDetail(@RequestBody ActivityParam activityParam) {
|
||||
AcBaseConfigExt acBaseConfig = baseConfigService.queryBaseConfigDetail(activityParam.getPkId(), SecurityUtils.getPkCountry());
|
||||
AcBaseConfigExt acBaseConfig = iAcBaseConfigService.queryBaseConfigDetail(activityParam.getPkId(), SecurityUtils.getPkCountry());
|
||||
List<AcBaseConfig> acBaseConfigList = new ArrayList<>();
|
||||
acBaseConfigList.add(acBaseConfig);
|
||||
return getDataTable(acBaseConfigList);
|
||||
|
|
|
|||
|
|
@ -5,12 +5,10 @@ import com.hzs.common.domain.activity.base.AcBaseAuthority;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 活动基础权限表 Mapper 接口
|
||||
*
|
||||
* @author hzs
|
||||
* @since 2025-02-18
|
||||
*/
|
||||
public interface AcBaseAuthorityMapper extends BaseMapper<AcBaseAuthority> {
|
||||
|
||||
|
|
@ -40,4 +38,14 @@ public interface AcBaseAuthorityMapper extends BaseMapper<AcBaseAuthority> {
|
|||
*/
|
||||
List<AcBaseAuthority> listAuthority(@Param("pkBaseId") Long pkBaseId);
|
||||
|
||||
/**
|
||||
* 批量查询会员是否在血缘伞下
|
||||
*/
|
||||
Set<Long> queryBlood(@Param("paramList") Set<String> paramList, @Param("pkMember") Long pkMember);
|
||||
|
||||
/**
|
||||
* 批量查询会员是否在安置伞下
|
||||
*/
|
||||
Set<Long> queryPlace(@Param("paramList") Set<String> paramList, @Param("pkMember") Long pkMember);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,9 +7,6 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* 活动基础权限表 服务类
|
||||
*
|
||||
* @author hzs
|
||||
* @since 2025-02-18
|
||||
*/
|
||||
public interface IAcBaseAuthorityService extends IService<AcBaseAuthority> {
|
||||
|
||||
|
|
@ -39,4 +36,9 @@ public interface IAcBaseAuthorityService extends IService<AcBaseAuthority> {
|
|||
*/
|
||||
List<AcBaseAuthority> listAuthority(Long pkBaseId);
|
||||
|
||||
/**
|
||||
* 校验权限
|
||||
*/
|
||||
boolean checkAuthority(Long pkMember, String memberCode, Long pkBaseId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,19 @@
|
|||
package com.hzs.activity.base.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.hzs.activity.base.mapper.AcBaseAuthorityMapper;
|
||||
import com.hzs.activity.base.service.IAcBaseAuthorityService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.hzs.common.core.enums.EWaresPermissionType;
|
||||
import com.hzs.common.domain.activity.base.AcBaseAuthority;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 活动基础权限表 服务实现类
|
||||
*
|
||||
* @author hzs
|
||||
* @since 2025-02-18
|
||||
*/
|
||||
@Service
|
||||
public class AcBaseAuthorityServiceImpl extends ServiceImpl<AcBaseAuthorityMapper, AcBaseAuthority> implements IAcBaseAuthorityService {
|
||||
|
|
@ -32,4 +33,59 @@ public class AcBaseAuthorityServiceImpl extends ServiceImpl<AcBaseAuthorityMappe
|
|||
return baseMapper.listAuthority(pkBaseId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkAuthority(Long pkMember, String memberCode, Long pkBaseId) {
|
||||
List<AcBaseAuthority> authorityList = baseMapper.listAuthority(pkBaseId);
|
||||
if (CollectionUtil.isNotEmpty(authorityList)) {
|
||||
// 血缘查询
|
||||
Set<String> authorityParentSet = new HashSet<>();
|
||||
// 安置查询
|
||||
Set<String> authorityPlaceSet = new HashSet<>();
|
||||
|
||||
for (AcBaseAuthority acBaseAuthority : authorityList) {
|
||||
if (EWaresPermissionType.MEMBER.getValue() == acBaseAuthority.getAuthorityType()) {
|
||||
// 指定会员
|
||||
if (acBaseAuthority.getMemberCode().equals(memberCode)) {
|
||||
return true;
|
||||
}
|
||||
} else if (EWaresPermissionType.BLOOD_ALLOW.getValue() == acBaseAuthority.getAuthorityType()
|
||||
|| EWaresPermissionType.BLOOD_STOP.getValue() == acBaseAuthority.getAuthorityType()) {
|
||||
// 血缘关系
|
||||
authorityParentSet.add(acBaseAuthority.getMemberCode());
|
||||
} else if (EWaresPermissionType.PLACE_ALLWO.getValue() == acBaseAuthority.getAuthorityType()
|
||||
|| EWaresPermissionType.PLACE_STOP.getValue() == acBaseAuthority.getAuthorityType()) {
|
||||
// 安置关系
|
||||
authorityPlaceSet.add(acBaseAuthority.getMemberCode());
|
||||
}
|
||||
}
|
||||
|
||||
// 查询血缘
|
||||
Set<Long> authParentList = new HashSet<>();
|
||||
if (authorityParentSet.size() > 0) {
|
||||
authParentList = baseMapper.queryBlood(authorityParentSet, pkMember);
|
||||
}
|
||||
// 查询安置
|
||||
Set<Long> authPlaceList = new HashSet<>();
|
||||
if (authorityPlaceSet.size() > 0) {
|
||||
authPlaceList = baseMapper.queryPlace(authorityPlaceSet, pkMember);
|
||||
}
|
||||
|
||||
for (AcBaseAuthority acBaseAuthority : authorityList) {
|
||||
if (acBaseAuthority.getAuthorityType() == EWaresPermissionType.BLOOD_STOP.getValue()) {
|
||||
// 血缘禁止
|
||||
if (authParentList.contains(pkMember)) {
|
||||
return false;
|
||||
}
|
||||
} else if (acBaseAuthority.getAuthorityType() == EWaresPermissionType.PLACE_STOP.getValue()) {
|
||||
// 安置禁止
|
||||
if (authPlaceList.contains(pkMember)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,4 +36,26 @@
|
|||
and aba.pk_base_id = #{pkBaseId}
|
||||
</select>
|
||||
|
||||
<select id="queryBlood" resultType="long">
|
||||
<foreach collection="paramList" item="item" separator=" union ">
|
||||
select ${pkMember}
|
||||
from cu_member cm
|
||||
where cm.del_flag = 0
|
||||
and cm.member_code = #{item}
|
||||
start with cm.pk_id = #{pkMember}
|
||||
connect by cm.pk_id = prior cm.pk_parent
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="queryPlace" resultType="long">
|
||||
<foreach collection="paramList" item="item" separator=" union ">
|
||||
select ${pkMember}
|
||||
from cu_member cm
|
||||
where cm.del_flag = 0
|
||||
and cm.member_code = #{item}
|
||||
start with cm.pk_id = #{pkMember}
|
||||
connect by cm.pk_id = prior cm.pk_place_parent
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -56,25 +56,14 @@
|
|||
when act_end_date < sysdate then 2
|
||||
else 1 end) ACT_STATUS,
|
||||
ac.act_explain,
|
||||
nvl(draw.exist_draw_num, 1) exist_draw_num,
|
||||
pk_new_people,
|
||||
nvl(people.exist_new_people_gift, 1) exist_new_people_gift
|
||||
nvl(draw.exist_draw_num, 1) exist_draw_num
|
||||
from ac_base_config ac
|
||||
left join (
|
||||
select pk_base_id, 0 exist_draw_num
|
||||
from ac_draw_reward_num
|
||||
where del_flag = 0
|
||||
and pk_member = #{pkMember}
|
||||
and (total_surplus_num + available_surplus_num) > 0) draw
|
||||
on ac.pk_id = draw.pk_base_id
|
||||
left join (
|
||||
select distinct pk_base_id, pk_new_people, 0 exist_new_people_gift
|
||||
from ac_people_service
|
||||
where del_flag = 0
|
||||
and pk_member = #{pkMember}
|
||||
and plan_state = 0
|
||||
) people
|
||||
on ac.pk_id = people.pk_base_id
|
||||
and (total_surplus_num + available_surplus_num) > 0) draw on ac.pk_id = draw.pk_base_id
|
||||
where ac.del_flag = 0
|
||||
and ac.pk_country = #{pkCountry}
|
||||
and ac.dis_start_date <= sysdate
|
||||
|
|
|
|||
|
|
@ -9,9 +9,6 @@ import java.io.Serializable;
|
|||
|
||||
/**
|
||||
* 活动基础权限表
|
||||
*
|
||||
* @author hzs
|
||||
* @since 2025-02-18
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
|
|
|
|||
Loading…
Reference in New Issue