## 活动列表报单赠送添加权限过滤;
This commit is contained in:
parent
9410a83091
commit
e44338285e
|
|
@ -1,7 +1,10 @@
|
||||||
package com.hzs.activity.base.controller.api;
|
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.param.ActivityParam;
|
||||||
|
import com.hzs.activity.base.service.IAcBaseAuthorityService;
|
||||||
import com.hzs.activity.base.service.IAcBaseConfigService;
|
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.controller.BaseController;
|
||||||
import com.hzs.common.core.web.page.TableDataInfo;
|
import com.hzs.common.core.web.page.TableDataInfo;
|
||||||
import com.hzs.common.domain.activity.base.AcBaseConfig;
|
import com.hzs.common.domain.activity.base.AcBaseConfig;
|
||||||
|
|
@ -14,44 +17,51 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
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
|
@RestController
|
||||||
@RequestMapping("/api/base")
|
@RequestMapping("/api/base")
|
||||||
public class ApiActivityController extends BaseController {
|
public class ApiActivityController extends BaseController {
|
||||||
|
|
||||||
private IAcBaseConfigService baseConfigService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public void setBaseConfigService(IAcBaseConfigService baseConfigService) {
|
private IAcBaseConfigService iAcBaseConfigService;
|
||||||
this.baseConfigService = baseConfigService;
|
@Autowired
|
||||||
}
|
private IAcBaseAuthorityService iAcBaseAuthorityService;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @description: 查询活动列表
|
* 查询活动列表
|
||||||
* @author: sui q
|
|
||||||
* @date: 2023/4/21 17:33
|
|
||||||
* @param: null null
|
|
||||||
**/
|
**/
|
||||||
@GetMapping("/activity-list")
|
@GetMapping("/activity-list")
|
||||||
public TableDataInfo activityList() {
|
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")
|
@PostMapping("/activity-detail")
|
||||||
public TableDataInfo activityDetail(@RequestBody ActivityParam activityParam) {
|
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<>();
|
List<AcBaseConfig> acBaseConfigList = new ArrayList<>();
|
||||||
acBaseConfigList.add(acBaseConfig);
|
acBaseConfigList.add(acBaseConfig);
|
||||||
return getDataTable(acBaseConfigList);
|
return getDataTable(acBaseConfigList);
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,10 @@ import com.hzs.common.domain.activity.base.AcBaseAuthority;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 活动基础权限表 Mapper 接口
|
* 活动基础权限表 Mapper 接口
|
||||||
*
|
|
||||||
* @author hzs
|
|
||||||
* @since 2025-02-18
|
|
||||||
*/
|
*/
|
||||||
public interface AcBaseAuthorityMapper extends BaseMapper<AcBaseAuthority> {
|
public interface AcBaseAuthorityMapper extends BaseMapper<AcBaseAuthority> {
|
||||||
|
|
||||||
|
|
@ -40,4 +38,14 @@ public interface AcBaseAuthorityMapper extends BaseMapper<AcBaseAuthority> {
|
||||||
*/
|
*/
|
||||||
List<AcBaseAuthority> listAuthority(@Param("pkBaseId") Long pkBaseId);
|
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> {
|
public interface IAcBaseAuthorityService extends IService<AcBaseAuthority> {
|
||||||
|
|
||||||
|
|
@ -39,4 +36,9 @@ public interface IAcBaseAuthorityService extends IService<AcBaseAuthority> {
|
||||||
*/
|
*/
|
||||||
List<AcBaseAuthority> listAuthority(Long pkBaseId);
|
List<AcBaseAuthority> listAuthority(Long pkBaseId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验权限
|
||||||
|
*/
|
||||||
|
boolean checkAuthority(Long pkMember, String memberCode, Long pkBaseId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,19 @@
|
||||||
package com.hzs.activity.base.service.impl;
|
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.mapper.AcBaseAuthorityMapper;
|
||||||
import com.hzs.activity.base.service.IAcBaseAuthorityService;
|
import com.hzs.activity.base.service.IAcBaseAuthorityService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.hzs.common.core.enums.EWaresPermissionType;
|
||||||
import com.hzs.common.domain.activity.base.AcBaseAuthority;
|
import com.hzs.common.domain.activity.base.AcBaseAuthority;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 活动基础权限表 服务实现类
|
* 活动基础权限表 服务实现类
|
||||||
*
|
|
||||||
* @author hzs
|
|
||||||
* @since 2025-02-18
|
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class AcBaseAuthorityServiceImpl extends ServiceImpl<AcBaseAuthorityMapper, AcBaseAuthority> implements IAcBaseAuthorityService {
|
public class AcBaseAuthorityServiceImpl extends ServiceImpl<AcBaseAuthorityMapper, AcBaseAuthority> implements IAcBaseAuthorityService {
|
||||||
|
|
@ -32,4 +33,59 @@ public class AcBaseAuthorityServiceImpl extends ServiceImpl<AcBaseAuthorityMappe
|
||||||
return baseMapper.listAuthority(pkBaseId);
|
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}
|
and aba.pk_base_id = #{pkBaseId}
|
||||||
</select>
|
</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>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -56,25 +56,14 @@
|
||||||
when act_end_date < sysdate then 2
|
when act_end_date < sysdate then 2
|
||||||
else 1 end) ACT_STATUS,
|
else 1 end) ACT_STATUS,
|
||||||
ac.act_explain,
|
ac.act_explain,
|
||||||
nvl(draw.exist_draw_num, 1) exist_draw_num,
|
nvl(draw.exist_draw_num, 1) exist_draw_num
|
||||||
pk_new_people,
|
|
||||||
nvl(people.exist_new_people_gift, 1) exist_new_people_gift
|
|
||||||
from ac_base_config ac
|
from ac_base_config ac
|
||||||
left join (
|
left join (
|
||||||
select pk_base_id, 0 exist_draw_num
|
select pk_base_id, 0 exist_draw_num
|
||||||
from ac_draw_reward_num
|
from ac_draw_reward_num
|
||||||
where del_flag = 0
|
where del_flag = 0
|
||||||
and pk_member = #{pkMember}
|
and pk_member = #{pkMember}
|
||||||
and (total_surplus_num + available_surplus_num) > 0) draw
|
and (total_surplus_num + available_surplus_num) > 0) draw on ac.pk_id = draw.pk_base_id
|
||||||
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
|
|
||||||
where ac.del_flag = 0
|
where ac.del_flag = 0
|
||||||
and ac.pk_country = #{pkCountry}
|
and ac.pk_country = #{pkCountry}
|
||||||
and ac.dis_start_date <= sysdate
|
and ac.dis_start_date <= sysdate
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,6 @@ import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 活动基础权限表
|
* 活动基础权限表
|
||||||
*
|
|
||||||
* @author hzs
|
|
||||||
* @since 2025-02-18
|
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue