|
@ -226,67 +226,67 @@ public class BirBudgetTargetServiceImpl extends ServiceImpl<BirBudgetTargetMappe |
|
|
return vo; |
|
|
return vo; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
// @Override
|
|
|
public List<BirBudgetTargetVo> listVo(BirBudgetTargetSo query) { |
|
|
// public List<BirBudgetTargetVo> listVo(BirBudgetTargetSo query) {
|
|
|
query.setLoadType(query.getLoadType()-1); |
|
|
// query.setLoadType(query.getLoadType()-1);
|
|
|
LocalDateTime endMonth = query.getYearMonthEnd(); |
|
|
// LocalDateTime endMonth = query.getYearMonthEnd();
|
|
|
LocalDateTime startMonth = query.getYearMonthStart(); |
|
|
// LocalDateTime startMonth = query.getYearMonthStart();
|
|
|
//格式化
|
|
|
// //格式化
|
|
|
startMonth = startMonth.withDayOfMonth(1).toLocalDate().atTime(0,0,0); |
|
|
// startMonth = startMonth.withDayOfMonth(1).toLocalDate().atTime(0,0,0);
|
|
|
endMonth = endMonth.with(TemporalAdjusters.lastDayOfMonth()).toLocalDate().atTime(23,59,59); |
|
|
// endMonth = endMonth.with(TemporalAdjusters.lastDayOfMonth()).toLocalDate().atTime(23,59,59);
|
|
|
query.setYearMonthStart(startMonth); |
|
|
// query.setYearMonthStart(startMonth);
|
|
|
query.setYearMonthEnd(endMonth); |
|
|
// query.setYearMonthEnd(endMonth);
|
|
|
|
|
|
//
|
|
|
query.setYearStart(startMonth.getYear()); |
|
|
// query.setYearStart(startMonth.getYear());
|
|
|
query.setYearEnd(endMonth.getYear()); |
|
|
// query.setYearEnd(endMonth.getYear());
|
|
|
query.setMonthStart(startMonth.getMonthValue()); |
|
|
// query.setMonthStart(startMonth.getMonthValue());
|
|
|
query.setMonthEnd(endMonth.getMonthValue()); |
|
|
// query.setMonthEnd(endMonth.getMonthValue());
|
|
|
|
|
|
//
|
|
|
|
|
|
//
|
|
|
query.setSelectCenterFlag(0); |
|
|
// query.setSelectCenterFlag(0);
|
|
|
if(CollUtil.isNotEmpty(query.getCenterList())){ |
|
|
// if(CollUtil.isNotEmpty(query.getCenterList())){
|
|
|
query.setSelectCenterFlag(1); |
|
|
// query.setSelectCenterFlag(1);
|
|
|
} |
|
|
// }
|
|
|
|
|
|
//
|
|
|
BmsSupplier supplier = bmsSupplierService.getById(query.getSupplierId()); |
|
|
// BmsSupplier supplier = bmsSupplierService.getById(query.getSupplierId());
|
|
|
|
|
|
//
|
|
|
if(query.getLoadType()==1){ |
|
|
// if(query.getLoadType()==1){
|
|
|
query.setBizRegionIds(Arrays.asList(supplier.getRegion2Second())); |
|
|
// query.setBizRegionIds(Arrays.asList(supplier.getRegion2Second()));
|
|
|
}else if(query.getLoadType()==2){ |
|
|
// }else if(query.getLoadType()==2){
|
|
|
query.setSaleRegionIds(Arrays.asList(supplier.getRegionSecond())); |
|
|
// query.setSaleRegionIds(Arrays.asList(supplier.getRegionSecond()));
|
|
|
}else if(query.getLoadType()==3){ |
|
|
// }else if(query.getLoadType()==3){
|
|
|
query.setSaleRegionIds(Arrays.asList(supplier.getRegionFirst())); |
|
|
// query.setSaleRegionIds(Arrays.asList(supplier.getRegionFirst()));
|
|
|
} |
|
|
// }
|
|
|
|
|
|
//
|
|
|
List<BirBudgetTarget> birBudgetTargets = baseMapper.selectBirBudgetTargetList(query); |
|
|
// List<BirBudgetTarget> birBudgetTargets = baseMapper.selectBirBudgetTargetList(query);
|
|
|
|
|
|
//
|
|
|
query.setLoadType(0); |
|
|
// query.setLoadType(0);
|
|
|
List<BirBudgetTarget> birSupplierBudgetTargets = baseMapper.selectBirBudgetTargetList(query); |
|
|
// List<BirBudgetTarget> birSupplierBudgetTargets = baseMapper.selectBirBudgetTargetList(query);
|
|
|
|
|
|
//
|
|
|
Map<String,List<BirBudgetTarget>> listMap = birBudgetTargets.stream() |
|
|
// Map<String,List<BirBudgetTarget>> listMap = birBudgetTargets.stream()
|
|
|
.collect(Collectors.groupingBy(obj->obj.getYearNum()+"_"+obj.getMonthNum())); |
|
|
// .collect(Collectors.groupingBy(obj->obj.getYearNum()+"_"+obj.getMonthNum()));
|
|
|
Map<String,List<BirBudgetTarget>> listSupplierMap = birSupplierBudgetTargets.stream() |
|
|
// Map<String,List<BirBudgetTarget>> listSupplierMap = birSupplierBudgetTargets.stream()
|
|
|
.collect(Collectors.groupingBy(obj->obj.getYearNum()+"_"+obj.getMonthNum())); |
|
|
// .collect(Collectors.groupingBy(obj->obj.getYearNum()+"_"+obj.getMonthNum()));
|
|
|
|
|
|
//
|
|
|
List<BirBudgetTargetVo> budgetTargetVoList = new ArrayList<>(); |
|
|
// List<BirBudgetTargetVo> budgetTargetVoList = new ArrayList<>();
|
|
|
|
|
|
//
|
|
|
|
|
|
//
|
|
|
//12个月
|
|
|
// //12个月
|
|
|
final int TOTAL_MONTH = 12; |
|
|
// final int TOTAL_MONTH = 12;
|
|
|
for (int y = startMonth.getYear(); y <= endMonth.getYear(); y++) { |
|
|
// for (int y = startMonth.getYear(); y <= endMonth.getYear(); y++) {
|
|
|
for (int m = 1; m <= TOTAL_MONTH; m++) { |
|
|
// for (int m = 1; m <= TOTAL_MONTH; m++) {
|
|
|
//防止多空白行
|
|
|
// //防止多空白行
|
|
|
if(y == startMonth.getYear() && m < startMonth.getMonthValue()){ |
|
|
// if(y == startMonth.getYear() && m < startMonth.getMonthValue()){
|
|
|
continue; |
|
|
// continue;
|
|
|
} |
|
|
// }
|
|
|
if(y == endMonth.getYear() && m > endMonth.getMonthValue()){ |
|
|
// if(y == endMonth.getYear() && m > endMonth.getMonthValue()){
|
|
|
continue; |
|
|
// continue;
|
|
|
} |
|
|
// }
|
|
|
budgetTargetVoList.add(getBudgetTargetVo(listMap,listSupplierMap, m, y)); |
|
|
// budgetTargetVoList.add(getBudgetTargetVo(listMap,listSupplierMap, m, y));
|
|
|
} |
|
|
// }
|
|
|
} |
|
|
// }
|
|
|
return budgetTargetVoList; |
|
|
// return budgetTargetVoList;
|
|
|
} |
|
|
// }
|
|
|
|
|
|
|
|
|
private BirBudgetTargetVo getBudgetTargetVo(Map<String, List<BirBudgetTarget>> listMap,Map<String, List<BirBudgetTarget>> listSupplierMap, int month, int year) { |
|
|
private BirBudgetTargetVo getBudgetTargetVo(Map<String, List<BirBudgetTarget>> listMap,Map<String, List<BirBudgetTarget>> listSupplierMap, int month, int year) { |
|
|
List<BirBudgetTarget> mList = listMap.get(year +"_"+ month); |
|
|
List<BirBudgetTarget> mList = listMap.get(year +"_"+ month); |
|
|