|
|
@ -1,16 +1,23 @@ |
|
|
|
package com.qs.serve.modules.tbs.controller; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.qs.serve.common.model.annotation.LimitSubmit; |
|
|
|
import com.qs.serve.common.model.annotation.SysLog; |
|
|
|
import com.qs.serve.common.model.dto.PageVo; |
|
|
|
import com.qs.serve.common.model.dto.R; |
|
|
|
import com.qs.serve.common.model.enums.BizType; |
|
|
|
import com.qs.serve.common.model.enums.BudgetLogOptFlag; |
|
|
|
import com.qs.serve.common.model.enums.SystemModule; |
|
|
|
import com.qs.serve.common.util.CollectionUtil; |
|
|
|
import com.qs.serve.common.util.PageUtil; |
|
|
|
import com.qs.serve.common.util.CopierUtil; |
|
|
|
import com.qs.serve.modules.tbs.entity.TbsBudget; |
|
|
|
import com.qs.serve.modules.tbs.entity.TbsScheduleItemBudget; |
|
|
|
import com.qs.serve.modules.tbs.entity.so.TbsBudgetSo; |
|
|
|
import com.qs.serve.modules.tbs.entity.vo.TbsBudgetVo; |
|
|
|
import com.qs.serve.modules.tbs.mapper.TbsBudgetLogMapper; |
|
|
|
import com.qs.serve.modules.tbs.mapper.TbsBudgetMapper; |
|
|
|
import com.qs.serve.modules.tbs.service.TbsBudgetService; |
|
|
|
import com.qs.serve.modules.tbs.service.TbsScheduleItemBudgetService; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
@ -22,8 +29,11 @@ import com.qs.serve.modules.tbs.entity.TbsBudgetLog; |
|
|
|
import com.qs.serve.modules.tbs.service.TbsBudgetLogService; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Optional; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* 预算 预算日志 |
|
|
@ -37,7 +47,9 @@ import java.util.Optional; |
|
|
|
public class TbsBudgetLogController { |
|
|
|
|
|
|
|
private TbsBudgetLogService tbsBudgetLogService; |
|
|
|
private TbsBudgetService tbsBudgetService; |
|
|
|
private TbsBudgetLogMapper tbsBudgetLogMapper; |
|
|
|
private final TbsBudgetMapper tbsBudgetMapper; |
|
|
|
private TbsScheduleItemBudgetService tbsScheduleItemBudgetService; |
|
|
|
private TbsBudgetLogService budgetLogService; |
|
|
|
|
|
|
@ -55,6 +67,45 @@ public class TbsBudgetLogController { |
|
|
|
return R.byPageHelperList(list); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 列表 |
|
|
|
* @param param |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@GetMapping("/list") |
|
|
|
public R<List<TbsBudgetLog>> getList(TbsBudgetLogSo param){ |
|
|
|
TbsBudgetLog entity = CopierUtil.copy(param,new TbsBudgetLog()); |
|
|
|
LambdaQueryWrapper<TbsBudgetLog> lqw = new LambdaQueryWrapper<>(entity); |
|
|
|
List<TbsBudgetLog> list = tbsBudgetLogService.list(lqw); |
|
|
|
return R.ok(list); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 导出使用明细 |
|
|
|
* @param param |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@LimitSubmit(interval = 3000) |
|
|
|
@GetMapping("/export") |
|
|
|
public R<List<TbsBudgetVo>> getExport(TbsBudgetSo param){ |
|
|
|
List<Long> budgetIds = tbsBudgetMapper.selectBudgetId(param); |
|
|
|
List<TbsBudgetVo> budgetVoList = new ArrayList<>(); |
|
|
|
if(CollectionUtil.isNotEmpty(budgetIds)){ |
|
|
|
TbsBudget param4Query = new TbsBudget(); |
|
|
|
param4Query.setSelectBudgetIds(budgetIds); |
|
|
|
List<TbsBudget> budgetList = tbsBudgetMapper.selectBatchIds(budgetIds); |
|
|
|
List<TbsScheduleItemBudget> scheduleItemBudgets = tbsBudgetService.getEntityForExcel(param4Query).getScheduleItemBudgets(); |
|
|
|
Map<Long,List<TbsScheduleItemBudget>> map = scheduleItemBudgets.stream().collect(Collectors.groupingBy(TbsScheduleItemBudget::getBudgetId)); |
|
|
|
for (TbsBudget budget : budgetList) { |
|
|
|
TbsBudgetVo budgetVo = CopierUtil.copy(budget,new TbsBudgetVo()); |
|
|
|
List<TbsScheduleItemBudget> tmp = map.get(budget.getId()); |
|
|
|
budgetVo.setScheduleItemBudgets(tmp); |
|
|
|
budgetVoList.add(budgetVo); |
|
|
|
} |
|
|
|
} |
|
|
|
return R.ok(budgetVoList); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取统计金额 |
|
|
|
* @param budgetId |
|
|
|