|
@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
import com.qs.serve.common.util.Assert; |
|
|
import com.qs.serve.common.util.Assert; |
|
|
|
|
|
import com.qs.serve.common.util.BirHttpUtil; |
|
|
import com.qs.serve.common.util.CollectionUtil; |
|
|
import com.qs.serve.common.util.CollectionUtil; |
|
|
import com.qs.serve.modules.bir.entity.BirActivityCenterGoods; |
|
|
import com.qs.serve.modules.bir.entity.BirActivityCenterGoods; |
|
|
import com.qs.serve.modules.bir.entity.so.BirBudgetTargetSo; |
|
|
import com.qs.serve.modules.bir.entity.so.BirBudgetTargetSo; |
|
@ -53,18 +54,9 @@ public class BirBudgetTargetServiceImpl extends ServiceImpl<BirBudgetTargetMappe |
|
|
private BmsRegionService bmsRegionService; |
|
|
private BmsRegionService bmsRegionService; |
|
|
private BirActivityCenterGoodsMapper birActivityCenterGoodsMapper; |
|
|
private BirActivityCenterGoodsMapper birActivityCenterGoodsMapper; |
|
|
|
|
|
|
|
|
@Override |
|
|
private void initQuery(BirBudgetTargetSo query){ |
|
|
public List<BirBaseReportVo> listBaseVo(BirBudgetTargetSo query) { |
|
|
|
|
|
List<BirBaseReportVo> returnList = new ArrayList<>(); |
|
|
|
|
|
query.setLoadType(query.getLoadType()-1); |
|
|
query.setLoadType(query.getLoadType()-1); |
|
|
LocalDateTime endMonth = query.getYearMonthEnd(); |
|
|
|
|
|
LocalDateTime startMonth = query.getYearMonthStart(); |
|
|
|
|
|
query.setYearMonthStartQuery(startMonth.getYear()*100 + startMonth.getMonthValue()); |
|
|
|
|
|
query.setYearMonthEndQuery(endMonth.getYear()*100 + endMonth.getMonthValue()); |
|
|
|
|
|
query.setSelectCenterFlag(0); |
|
|
|
|
|
if(CollUtil.isNotEmpty(query.getCenterList())){ |
|
|
|
|
|
query.setSelectCenterFlag(1); |
|
|
|
|
|
} |
|
|
|
|
|
if(query.getLoadType()==0) { |
|
|
if(query.getLoadType()==0) { |
|
|
BmsSupplier supplier = bmsSupplierService.getById(query.getTargetId()); |
|
|
BmsSupplier supplier = bmsSupplierService.getById(query.getTargetId()); |
|
|
if(supplier==null){ |
|
|
if(supplier==null){ |
|
@ -135,6 +127,20 @@ public class BirBudgetTargetServiceImpl extends ServiceImpl<BirBudgetTargetMappe |
|
|
.distinct().collect(Collectors.toList()); |
|
|
.distinct().collect(Collectors.toList()); |
|
|
query.setSupplierCodes(supplierCodes); |
|
|
query.setSupplierCodes(supplierCodes); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public List<BirBaseReportVo> listBaseVo(BirBudgetTargetSo query) { |
|
|
|
|
|
List<BirBaseReportVo> returnList = new ArrayList<>(); |
|
|
|
|
|
LocalDateTime endMonth = query.getYearMonthEnd(); |
|
|
|
|
|
LocalDateTime startMonth = query.getYearMonthStart(); |
|
|
|
|
|
query.setYearMonthStartQuery(startMonth.getYear()*100 + startMonth.getMonthValue()); |
|
|
|
|
|
query.setYearMonthEndQuery(endMonth.getYear()*100 + endMonth.getMonthValue()); |
|
|
|
|
|
query.setSelectCenterFlag(0); |
|
|
|
|
|
if(CollUtil.isNotEmpty(query.getCenterList())){ |
|
|
|
|
|
query.setSelectCenterFlag(1); |
|
|
|
|
|
} |
|
|
|
|
|
initQuery(query); |
|
|
|
|
|
|
|
|
List<BirActivityCenterGoods> birActivityCenterGoodsList = new ArrayList<>(); |
|
|
List<BirActivityCenterGoods> birActivityCenterGoodsList = new ArrayList<>(); |
|
|
List<BirBaseDispatchVo> birBaseDispatchVoList = new ArrayList<>(); |
|
|
List<BirBaseDispatchVo> birBaseDispatchVoList = new ArrayList<>(); |
|
@ -213,7 +219,7 @@ public class BirBudgetTargetServiceImpl extends ServiceImpl<BirBudgetTargetMappe |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(vo.getDispatchAmt().compareTo(BigDecimal.ZERO)!=0){ |
|
|
if(vo.getDispatchAmt().compareTo(BigDecimal.ZERO)!=0){ |
|
|
vo.setTotalRealRate(vo.getTotalRealAmt().divide(vo.getDispatchAmt(), 2, RoundingMode.DOWN)); |
|
|
vo.setTotalRealRate(vo.getTotalRealAmt().divide(vo.getDispatchAmt(), 4, RoundingMode.DOWN)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return vo; |
|
|
return vo; |
|
@ -368,5 +374,36 @@ public class BirBudgetTargetServiceImpl extends ServiceImpl<BirBudgetTargetMappe |
|
|
return targetVo; |
|
|
return targetVo; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<String> getCenterByTargetId(BirBudgetTargetSo query){ |
|
|
|
|
|
boolean isRestBir = BirHttpUtil.isRestBir(); |
|
|
|
|
|
if(isRestBir){ |
|
|
|
|
|
return (List<String>) BirHttpUtil.get("/bir/roiRate/getCenterByTargetId",query).getData(); |
|
|
|
|
|
} |
|
|
|
|
|
initQuery(query); |
|
|
|
|
|
List<BirActivityCenterGoods> centerGoodsList = new ArrayList<>(); |
|
|
|
|
|
if(query.getSupplierIds().size()>2000 || query.getSupplierCodes().size()>2000) { |
|
|
|
|
|
List<String> supplierIds = query.getSupplierIds(); |
|
|
|
|
|
List<String> supplierCodes = query.getSupplierCodes(); |
|
|
|
|
|
|
|
|
|
|
|
List<List<String>> supplierIdList = CollectionUtil.createList(supplierIds, 2000); |
|
|
|
|
|
List<List<String>> supplierCodeList = CollectionUtil.createList(supplierCodes, 2000); |
|
|
|
|
|
|
|
|
|
|
|
for(int i=0;i<supplierIdList.size();i++) { |
|
|
|
|
|
List<String> tempIds = supplierIdList.get(i); |
|
|
|
|
|
tempIds.add("-99"); |
|
|
|
|
|
query.setSupplierIds(tempIds); |
|
|
|
|
|
List<BirActivityCenterGoods> tempCenterGoodsList = birActivityCenterGoodsMapper.list4CenterSqlserver(query); |
|
|
|
|
|
centerGoodsList.addAll(tempCenterGoodsList); |
|
|
|
|
|
} |
|
|
|
|
|
}else{ |
|
|
|
|
|
//防止传入空数组,导致SQL查出所有客户
|
|
|
|
|
|
List<String> supplierIds = query.getSupplierIds(); |
|
|
|
|
|
supplierIds.add("-99"); |
|
|
|
|
|
query.setSupplierIds(supplierIds); |
|
|
|
|
|
centerGoodsList = birActivityCenterGoodsMapper.list4CenterSqlserver(query); |
|
|
|
|
|
} |
|
|
|
|
|
List<String> centerIdList = centerGoodsList.stream().map(a->a.getCenterId()).collect(Collectors.toList()); |
|
|
|
|
|
return centerIdList; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|