|
|
@ -2,6 +2,7 @@ package com.qs.serve.modules.tbs.service.impl; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.qs.serve.common.util.CollectionUtil; |
|
|
|
import com.qs.serve.modules.tbs.entity.*; |
|
|
|
import com.qs.serve.modules.tbs.entity.vo.TbsBudgetMatchMsgVo; |
|
|
|
import com.qs.serve.modules.tbs.mapper.*; |
|
|
@ -33,8 +34,32 @@ public class TbsBudgetManagerServiceImpl implements TbsBudgetManagerService { |
|
|
|
private final TbsBudgetConditionMapper budgetConditionMapper; |
|
|
|
private final TbsScheduleItemBudgetMapper scheduleItemBudgetMapper; |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<Long> listBudgetIdsByActivityId(List<Long> activityIds) { |
|
|
|
//加载基础数据
|
|
|
|
QueryWrapper acgLqw = new QueryWrapper<>(); |
|
|
|
acgLqw.in("activity_id",activityIds); |
|
|
|
List<TbsActivityCenter> allCenterList = activityCenterMapper.selectList(acgLqw); |
|
|
|
List<String> centerComboList = allCenterList.stream().map(a->a.getCenterType()+"_"+a.getCenterId()).distinct().collect(Collectors.toList()); |
|
|
|
List<TbsActivitySubject> allSubjectList = activitySubjectMapper.selectList(acgLqw); |
|
|
|
List<Long> subjectIds = allSubjectList.stream().map(TbsActivitySubject::getSubjectId).distinct().collect(Collectors.toList()); |
|
|
|
subjectIds.add(0L); |
|
|
|
LambdaQueryWrapper<TbsBudget> lqw = new LambdaQueryWrapper<>(); |
|
|
|
lqw.and(a->{ |
|
|
|
a.eq(TbsBudget::getSubjectId,0) |
|
|
|
.or().in(TbsBudget::getSubjectId,subjectIds); |
|
|
|
|
|
|
|
}).in(TbsBudget::getCenterCombo,centerComboList) |
|
|
|
.select(TbsBudget::getId); |
|
|
|
List<TbsBudget> budgetList = budgetMapper.selectList(lqw); |
|
|
|
return budgetList.stream().map(TbsBudget::getId).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<TbsBudgetMatchMsgVo> compare(List<Long> activityIds, List<Long> budgetIds) { |
|
|
|
if(CollectionUtil.isEmpty(activityIds)||CollectionUtil.isEmpty(budgetIds)){ |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
//加载基础数据
|
|
|
|
QueryWrapper acgLqw = new QueryWrapper<>(); |
|
|
|
acgLqw.in("activity_id",activityIds); |
|
|
|