feat:数据隔离

This commit is contained in:
苏竹红
2024-09-23 15:28:17 +08:00
parent 5a0996ed17
commit 4ffb211b48
8 changed files with 49 additions and 10 deletions

View File

@@ -247,8 +247,10 @@ public class ShopStageInfoDAO {
} }
public List<ShopStageInfoDO> getSpecialShopStageInfo(List<Long> shopIds, Integer shopSubStage, public List<ShopStageInfoDO> getSpecialShopStageInfo(List<Long> shopIds, Integer shopSubStage,
List<Integer> shopSubStageStatusList,String investmentUserId){ List<Integer> shopSubStageStatusList,
return shopStageInfoMapper.getSpecialShopStageInfo( shopIds, shopSubStage, shopSubStageStatusList,investmentUserId); String investmentUserId,
List<String> authRegionIds){
return shopStageInfoMapper.getSpecialShopStageInfo( shopIds, shopSubStage, shopSubStageStatusList,investmentUserId,authRegionIds);
} }
/** /**
* @Auther: wangshuo * @Auther: wangshuo

View File

@@ -130,7 +130,7 @@ public interface ShopStageInfoMapper extends Mapper<ShopStageInfoDO> {
List<ShopStageInfoDO> getSpecialShopStageInfo(@Param("shopIds") List<Long> shopIds, List<ShopStageInfoDO> getSpecialShopStageInfo(@Param("shopIds") List<Long> shopIds,
@Param("shopSubStage") Integer shopSubStage, @Param("shopSubStage") Integer shopSubStage,
@Param("shopSubStageStatusList") List<Integer> shopSubStageStatusList, @Param("shopSubStageStatusList") List<Integer> shopSubStageStatusList,
@Param("investmentUserId") String investmentUserId); @Param("investmentUserId") String investmentUserId, @Param("authRegionIds") List<String> authRegionIds);
List<ShopStageInfoDO> getSubStageList(@Param("shopIds") List<Long> shopIds,@Param("shopSubStage") Integer shopSubStage); List<ShopStageInfoDO> getSubStageList(@Param("shopIds") List<Long> shopIds,@Param("shopSubStage") Integer shopSubStage);
/** /**

View File

@@ -74,6 +74,12 @@
#{regionId} #{regionId}
</foreach> </foreach>
</if> </if>
<if test="request.authRegionIds != null and request.authRegionIds.size() > 0">
and si.region_id in
<foreach collection="request.authRegionIds" item="regionId" index="index" open="(" separator="," close=")">
#{regionId}
</foreach>
</if>
</select> </select>

View File

@@ -237,6 +237,9 @@
<if test="investmentUserId!=null and investmentUserId!=''"> <if test="investmentUserId!=null and investmentUserId!=''">
left join xfsg_line_info b on a.line_id = b.id left join xfsg_line_info b on a.line_id = b.id
</if> </if>
<if test="authRegionIds != null and authRegionIds.size() > 0">
left join xfsg_shop_info si on a.shop_id = si.id
</if>
<where> <where>
<if test="shopIds != null and shopIds.size() > 0"> <if test="shopIds != null and shopIds.size() > 0">
and a.shop_id in and a.shop_id in
@@ -256,6 +259,12 @@
<if test="investmentUserId!=null and investmentUserId!=''"> <if test="investmentUserId!=null and investmentUserId!=''">
and b.investment_manager = #{investmentUserId} and b.investment_manager = #{investmentUserId}
</if> </if>
<if test="authRegionIds != null and authRegionIds.size() > 0">
and si.region_id in
<foreach collection="authRegionIds" item="regionId" index="index" open="(" separator="," close=")">
#{regionId}
</foreach>
</if>
</where> </where>
</select> </select>

View File

@@ -31,4 +31,9 @@ public class PlanListRequest {
@ApiModelProperty ("分页大小") @ApiModelProperty ("分页大小")
private Integer pageSize; private Integer pageSize;
@ApiModelProperty(value = "当前登录用户", hidden = true)
private String curUserId;
@ApiModelProperty(value = "管辖区域",hidden = true)
private List<String> authRegionIds;
} }

View File

@@ -17,6 +17,8 @@ import com.cool.store.mapper.IntentAgreementMapper;
import com.cool.store.mapper.TrainingExperienceMapper; import com.cool.store.mapper.TrainingExperienceMapper;
import com.cool.store.service.DeskService; import com.cool.store.service.DeskService;
import com.cool.store.service.RegionService; import com.cool.store.service.RegionService;
import com.cool.store.service.SysRoleService;
import com.cool.store.service.UserAuthMappingService;
import com.cool.store.utils.StringUtil; import com.cool.store.utils.StringUtil;
import com.cool.store.utils.poi.DateUtils; import com.cool.store.utils.poi.DateUtils;
import com.cool.store.utils.poi.constant.Constants; import com.cool.store.utils.poi.constant.Constants;
@@ -62,6 +64,10 @@ public class DeskServiceImpl implements DeskService {
EnterpriseUserDAO enterpriseUserDAO; EnterpriseUserDAO enterpriseUserDAO;
@Resource @Resource
RegionService regionService; RegionService regionService;
@Resource
SysRoleService sysRoleService;
@Resource
UserAuthMappingService userAuthMappingService;
@Override @Override
public PageInfo<IntendPendingVO> intendPendingList(Integer pageNum, Integer pageSize,String userId) { public PageInfo<IntendPendingVO> intendPendingList(Integer pageNum, Integer pageSize,String userId) {
@@ -333,18 +339,18 @@ public class DeskServiceImpl implements DeskService {
@Override @Override
public PageInfo<PreparationCommonPendingVO> payFranchiseFeesPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) { public PageInfo<PreparationCommonPendingVO> payFranchiseFeesPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) {
return commonPendingVOPageInfo(pageNum, pageSize, user, ShopSubStageEnum.SHOP_STAGE_7, return commonPendingVOPageInfo(pageNum, pageSize, user, ShopSubStageEnum.SHOP_STAGE_7,
Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_70.getShopSubStageStatus(),ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_72.getShopSubStageStatus()), Constants.ZERO_INTEGER); Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_70.getShopSubStageStatus(),ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_72.getShopSubStageStatus()), Boolean.FALSE);
} }
@Override @Override
public PageInfo<PreparationCommonPendingVO> signingOfFranchiseContractPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) { public PageInfo<PreparationCommonPendingVO> signingOfFranchiseContractPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) {
return commonPendingVOPageInfo(pageNum, pageSize, null, ShopSubStageEnum.SHOP_STAGE_8, return commonPendingVOPageInfo(pageNum, pageSize, user, ShopSubStageEnum.SHOP_STAGE_8,
Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_80.getShopSubStageStatus(),ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_85.getShopSubStageStatus()), Constants.ZERO_INTEGER); Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_80.getShopSubStageStatus(),ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_85.getShopSubStageStatus()), Boolean.TRUE);
} }
@Override @Override
public PageInfo<PreparationCommonPendingVO> openingAndOperationPlanPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) { public PageInfo<PreparationCommonPendingVO> openingAndOperationPlanPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) {
return commonPendingVOPageInfo(pageNum, pageSize, user, ShopSubStageEnum.SHOP_STAGE_14, Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_140.getShopSubStageStatus()), Constants.ONE_INTEGER); return commonPendingVOPageInfo(pageNum, pageSize, user, ShopSubStageEnum.SHOP_STAGE_14, Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_140.getShopSubStageStatus()), Boolean.FALSE);
} }
@Override @Override
@@ -362,11 +368,17 @@ public class DeskServiceImpl implements DeskService {
* @param subStageStatusList * @param subStageStatusList
* @return * @return
*/ */
private PageInfo<PreparationCommonPendingVO> commonPendingVOPageInfo(Integer pageNum, Integer pageSize, LoginUserInfo user,ShopSubStageEnum shopSubStageEnum,List<Integer> subStageStatusList,Integer type){ private PageInfo<PreparationCommonPendingVO> commonPendingVOPageInfo(Integer pageNum, Integer pageSize, LoginUserInfo user,ShopSubStageEnum shopSubStageEnum,List<Integer> subStageStatusList,Boolean filterFlag){
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
//user.getJobNumber() //user.getJobNumber()
List<String> authRegionIds = new ArrayList<>();
if (filterFlag){
if (!sysRoleService.checkIsAdmin(user.getUserId())) {
authRegionIds = userAuthMappingService.getAuthRegionIdAndSubRegionIdByUserId(user.getUserId());
}
}
List<ShopStageInfoDO> specialShopStageInfo = shopStageInfoDAO.getSpecialShopStageInfo(null, shopSubStageEnum.getShopSubStage(), List<ShopStageInfoDO> specialShopStageInfo = shopStageInfoDAO.getSpecialShopStageInfo(null, shopSubStageEnum.getShopSubStage(),
subStageStatusList, user==null?null:user.getUserId()); subStageStatusList, user==null?null:user.getUserId(),authRegionIds);
PageInfo result = new PageInfo<>(specialShopStageInfo); PageInfo result = new PageInfo<>(specialShopStageInfo);
List<Long> shopIds = specialShopStageInfo.stream().map(ShopStageInfoDO::getShopId).collect(Collectors.toList()); List<Long> shopIds = specialShopStageInfo.stream().map(ShopStageInfoDO::getShopId).collect(Collectors.toList());
List<Long> lineIds = specialShopStageInfo.stream().map(ShopStageInfoDO::getLineId).collect(Collectors.toList()); List<Long> lineIds = specialShopStageInfo.stream().map(ShopStageInfoDO::getLineId).collect(Collectors.toList());

View File

@@ -65,6 +65,8 @@ public class OpeningOperationPlanImpl implements OpeningOperationPlanService {
@Resource @Resource
UserAuthMappingService userAuthMappingService; UserAuthMappingService userAuthMappingService;
@Resource
SysRoleService sysRoleService;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@@ -147,6 +149,9 @@ public class OpeningOperationPlanImpl implements OpeningOperationPlanService {
@Override @Override
public PageInfo<OpeningOperationPlanListVO> getPlanListPage(PlanListRequest request) { public PageInfo<OpeningOperationPlanListVO> getPlanListPage(PlanListRequest request) {
log.info("getPlanListPage request:{}", JSONObject.toJSONString(request)); log.info("getPlanListPage request:{}", JSONObject.toJSONString(request));
if (!sysRoleService.checkIsAdmin(request.getCurUserId())) {
request.setAuthRegionIds(userAuthMappingService.getAuthRegionIdAndSubRegionIdByUserId(request.getCurUserId()));
}
PageHelper.startPage(request.getPageNumber(), request.getPageSize()); PageHelper.startPage(request.getPageNumber(), request.getPageSize());
//不指定时间为3个月数据 去shop_info表查询店铺名字店铺code开店负责人id督导id区域idopen_plan,提交时间,审核状态 //不指定时间为3个月数据 去shop_info表查询店铺名字店铺code开店负责人id督导id区域idopen_plan,提交时间,审核状态
List<OpenPlanShopInfoDTO> openPlanShopInfoDTOS = openingOperationPlanDAO.getOpenPlanShopListByCondition(request); List<OpenPlanShopInfoDTO> openPlanShopInfoDTOS = openingOperationPlanDAO.getOpenPlanShopListByCondition(request);

View File

@@ -73,7 +73,7 @@ public class PCOpenPreparationController {
@PostMapping("/openingOperationPlan/planList") @PostMapping("/openingOperationPlan/planList")
@ApiOperation("查询运营方案列表") @ApiOperation("查询运营方案列表")
public ResponseResult<PageInfo<OpeningOperationPlanListVO>> planList(@RequestBody PlanListRequest request) { public ResponseResult<PageInfo<OpeningOperationPlanListVO>> planList(@RequestBody PlanListRequest request) {
request.setCurUserId(CurrentUserHolder.getUserId());
return ResponseResult.success(openingOperationPlanService.getPlanListPage(request)); return ResponseResult.success(openingOperationPlanService.getPlanListPage(request));
} }
@PostMapping("/openingOperationPlan/audit") @PostMapping("/openingOperationPlan/audit")