|
|
@ -71,6 +71,7 @@ public class BirCenterRateServiceImpl implements BirCenterRateService { |
|
|
|
private BmsSupplierTargetMapper bmsSupplierTargetMapper; |
|
|
|
private TbsScheduleItemMapper tbsScheduleItemMapper; |
|
|
|
private TbsCostApplyMapper tbsCostApplyMapper; |
|
|
|
private BmsSupplierMapper supplierMapper; |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<TbsCostSubItem.CostCenterTranStr> findCostCenterDataByCostApplyId(Long costApplyId,Long policyId){ |
|
|
@ -250,22 +251,35 @@ public class BirCenterRateServiceImpl implements BirCenterRateService { |
|
|
|
int startMonth = Integer.parseInt(curYear+"01"); |
|
|
|
int endMonth = Integer.parseInt(curYear+curMonthString); |
|
|
|
int[] currQ = MonthValues.getQArr(curMonth); |
|
|
|
|
|
|
|
//更变客户维度为总公司维度
|
|
|
|
List<String> supplierCode4Group = new ArrayList<>(); |
|
|
|
supplierCode4Group.add(supplierCode); |
|
|
|
LambdaQueryWrapper<BmsSupplier> supplierLqw = new LambdaQueryWrapper<>(); |
|
|
|
supplierLqw.eq(BmsSupplier::getCode,supplierCode); |
|
|
|
BmsSupplier supplier = supplierMapper.selectOne(supplierLqw); |
|
|
|
if(supplier.getComRegionCode()!=null){ |
|
|
|
LambdaQueryWrapper<BmsSupplier> supplierLqw4Group = new LambdaQueryWrapper<>(); |
|
|
|
supplierLqw4Group.eq(BmsSupplier::getComRegionCode,supplier.getComRegionCode()); |
|
|
|
List<BmsSupplier> supplierList = supplierMapper.selectList(supplierLqw4Group); |
|
|
|
for (BmsSupplier bmsSupplier : supplierList) { |
|
|
|
supplierCode4Group.add(bmsSupplier.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
BirMonthCusCenterSo queryCusCenterRate = new BirMonthCusCenterSo(); |
|
|
|
queryCusCenterRate.setSupplierCode(supplierCode); |
|
|
|
queryCusCenterRate.setSupplierCodeList(supplierCode4Group); |
|
|
|
queryCusCenterRate.setCenterType(centerType); |
|
|
|
queryCusCenterRate.setCenterId(centerId); |
|
|
|
queryCusCenterRate.setStartYearMonth(startMonth); |
|
|
|
queryCusCenterRate.setEndYearMonth(endMonth); |
|
|
|
//年目标费率
|
|
|
|
CusTargetRateDTO targetRateDTO = this.buildCusCenterTargetData(supplierCode); |
|
|
|
CusTargetRateDTO targetRateDTO = this.buildCusCenterTargetData(supplierCode4Group); |
|
|
|
List<BirActivityCenterGoodsMonthVo> centerGoodsMonthVoList = birActivityCenterGoodsMapper.listMonthCusCenterVo(queryCusCenterRate); |
|
|
|
BigDecimal totalCostQty = BigDecimal.ZERO; |
|
|
|
BigDecimal totalDispatchQty = BigDecimal.ZERO; |
|
|
|
|
|
|
|
List<String> supplierCodeList = new ArrayList<>(); |
|
|
|
supplierCodeList.add(supplierCode); |
|
|
|
List<ErpDispatchSumVo> dispatchSumVos = dispatchDataMapper.querySumCost(startMonth,endMonth,supplierCodeList); |
|
|
|
|
|
|
|
List<ErpDispatchSumVo> dispatchSumVos = dispatchDataMapper.querySumCost(startMonth,endMonth,supplierCode4Group); |
|
|
|
for (int monthNumber : currQ) { |
|
|
|
String tmp = monthNumber>9?monthNumber+"":"0"+monthNumber; |
|
|
|
int currYearMonth = Integer.parseInt(curYear+tmp); |
|
|
@ -312,10 +326,10 @@ public class BirCenterRateServiceImpl implements BirCenterRateService { |
|
|
|
|
|
|
|
/** |
|
|
|
* 计算客户目标费率 |
|
|
|
* @param supplierCode |
|
|
|
* @param supplierCodes |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public CusTargetRateDTO buildCusCenterTargetData(String supplierCode){ |
|
|
|
public CusTargetRateDTO buildCusCenterTargetData(List<String> supplierCodes){ |
|
|
|
String cusTargetRateQty=null; |
|
|
|
String cusTargetRate=null; |
|
|
|
LocalDate nowTime = LocalDate.now(); |
|
|
@ -324,7 +338,7 @@ public class BirCenterRateServiceImpl implements BirCenterRateService { |
|
|
|
int[] currQ = MonthValues.getQArr(curMonth); |
|
|
|
List<BmsSupplierTarget> supplierTargetList = bmsSupplierTargetMapper.selectList( |
|
|
|
new LambdaQueryWrapper<BmsSupplierTarget>() |
|
|
|
.in(BmsSupplierTarget::getSupplierCode, supplierCode) |
|
|
|
.in(BmsSupplierTarget::getSupplierCode, supplierCodes) |
|
|
|
); |
|
|
|
List<Long> scheduleItemIds = supplierTargetList.stream().map(BmsSupplierTarget::getScheduleItemId).collect(Collectors.toList()); |
|
|
|
List<Long> scheduleIds = supplierTargetList.stream().map(BmsSupplierTarget::getScheduleId).collect(Collectors.toList()); |
|
|
|