@ -10,22 +10,23 @@ import com.qs.serve.common.framework.manager.AsyncManager;
import com.qs.serve.common.model.enums.BudgetLogOptFlag ;
import com.qs.serve.common.model.enums.BudgetLogOptFlag ;
import com.qs.serve.common.model.consts.BudgetLogRollbackFlag ;
import com.qs.serve.common.model.consts.BudgetLogRollbackFlag ;
import com.qs.serve.common.model.dto.R ;
import com.qs.serve.common.model.dto.R ;
import com.qs.serve.common.model.enums.MonthValues ;
import com.qs.serve.common.util.* ;
import com.qs.serve.common.util.* ;
import com.qs.serve.common.util.model.DateFormatString ;
import com.qs.serve.common.util.model.DateFormatString ;
import com.qs.serve.modules.bir.entity.BirActivityCenterGoods ;
import com.qs.serve.modules.bir.entity.BirActivityCenterGoods ;
import com.qs.serve.modules.bir.entity.BirBaseActivity ;
import com.qs.serve.modules.bir.entity.BirBaseActivity ;
import com.qs.serve.modules.bir.entity.dto.BirRoiCostDTO ;
import com.qs.serve.modules.bir.entity.dto.BirRoiCostDTO ;
import com.qs.serve.modules.bir.entity.vo.BirRoiCostItemVo ;
import com.qs.serve.modules.bir.entity.vo.YtdQtdToOAVo ;
import com.qs.serve.modules.bir.entity.vo.YtdQtdToOAVo ;
import com.qs.serve.modules.bir.mapper.BirActivityCenterGoodsMapper ;
import com.qs.serve.modules.bir.mapper.BirActivityCenterGoodsMapper ;
import com.qs.serve.modules.bir.mapper.BirBaseActivityMapper ;
import com.qs.serve.modules.bir.mapper.BirBaseActivityMapper ;
import com.qs.serve.modules.bir.mapper.BirRoiRateMapper ;
import com.qs.serve.modules.bir.service.BirCenterRateService ;
import com.qs.serve.modules.bir.service.BirCenterRateService ;
import com.qs.serve.modules.bir.service.BirRoiRateService ;
import com.qs.serve.modules.bir.service.BirRoiRateService ;
import com.qs.serve.modules.bms.entity.BmsRegion ;
import com.qs.serve.modules.bms.entity.* ;
import com.qs.serve.modules.bms.entity.BmsRegion2 ;
import com.qs.serve.modules.bms.entity.BmsSubject ;
import com.qs.serve.modules.bms.entity.BmsSupplier ;
import com.qs.serve.modules.bms.mapper.BmsRegion2Mapper ;
import com.qs.serve.modules.bms.mapper.BmsRegion2Mapper ;
import com.qs.serve.modules.bms.mapper.BmsRegionMapper ;
import com.qs.serve.modules.bms.mapper.BmsRegionMapper ;
import com.qs.serve.modules.bms.mapper.BmsSupplierTargetMapper ;
import com.qs.serve.modules.bms.service.BmsSubjectService ;
import com.qs.serve.modules.bms.service.BmsSubjectService ;
import com.qs.serve.modules.bms.service.BmsSupplierService ;
import com.qs.serve.modules.bms.service.BmsSupplierService ;
import com.qs.serve.modules.erp.entity.dto.ErpDispatchSumVo ;
import com.qs.serve.modules.erp.entity.dto.ErpDispatchSumVo ;
@ -112,6 +113,11 @@ public class TbsCostApplyServiceImpl extends ServiceImpl<TbsCostApplyMapper,TbsC
private BirCenterRateService centerRateService ;
private BirCenterRateService centerRateService ;
private BirActivityCenterGoodsMapper birActivityCenterGoodsMapper ;
private BirActivityCenterGoodsMapper birActivityCenterGoodsMapper ;
private BirBaseActivityMapper birBaseActivityMapper ;
private BirBaseActivityMapper birBaseActivityMapper ;
private BirRoiRateMapper birRoiRateMapper ;
private final ErpDispatchDataMapper dispatchDataMapper ;
private TbsScheduleItemMapper tbsScheduleItemMapper ;
private BmsSupplierTargetMapper bmsSupplierTargetMapper ;
private TbsBudgetMatchApplication tbsBudgetMatchApplication ;
private TbsBudgetMatchApplication tbsBudgetMatchApplication ;
@ -572,6 +578,94 @@ public class TbsCostApplyServiceImpl extends ServiceImpl<TbsCostApplyMapper,TbsC
List < TbsCostContract > contracts = costContractMapper . selectList ( lqw ) ;
List < TbsCostContract > contracts = costContractMapper . selectList ( lqw ) ;
if ( contracts . size ( ) > 0 ) {
if ( contracts . size ( ) > 0 ) {
//构建合同DATA
buildContractSeeyonData ( id , data , contracts ) ;
} else {
Assert . throwEx ( "请补充合同信息" ) ;
}
//创建子表数据
List < Object > subList = new ArrayList < > ( ) ;
//活动明细
buildActivityCenterGoodsSeeyonData ( id , tbsCostApply , activityList , subList ) ;
// 付款条件
for ( TbsActivityPayCondition payCondition : payConditions ) {
// TbsActivity currActivity = null;
// for (TbsActivity activity : activityList) {
// if(payCondition.getActivityId().equals(activity.getId())){
// currActivity = activity;
// break;
// }
// }
TbsContractCostSubItem . Payment subPayment = new TbsContractCostSubItem . Payment ( ) ;
subPayment . setPayItem ( payCondition . getTitle ( ) ) ;
subPayment . setPayCondition ( payCondition . getConditionMsg ( ) ) ;
subPayment . setPayMoney ( payCondition . getPaymentPrice ( ) ) ;
subPayment . setPayDate ( payCondition . getPreNotifyTime ( ) ! = null ? payCondition . getPreNotifyTime ( ) . format ( DateTimeFormatter . ofPattern ( "yyyy-MM-dd" ) ) : null ) ;
subPayment . setActualPayDate ( null ) ;
String stateMsg = payCondition . getFinishedFlag ( ) . equals ( 1 ) ? "已完成" : "未处理" ;
subPayment . setPayCompleteState ( stateMsg ) ;
subPayment . setPayRemark ( payCondition . getRemark ( ) ) ;
subPayment . setPayCode ( payCondition . getCode ( ) ) ;
subList . add ( subPayment ) ;
}
// 协议条款
LambdaQueryWrapper < TbsCostTodo > todoLqw = new LambdaQueryWrapper < > ( ) ;
todoLqw . eq ( TbsCostTodo : : getCostApplyId , tbsCostApply . getId ( ) ) ;
List < TbsCostTodo > costTodoList = tbsCostTodoMapper . selectList ( todoLqw ) ;
for ( TbsCostTodo costTodo : costTodoList ) {
TbsContractCostSubItem . ToDoItem toDoItem = new TbsContractCostSubItem . ToDoItem ( ) ;
toDoItem . setServiceDescription ( costTodo . getDescr ( ) ) ;
toDoItem . setDeliveryStandard ( costTodo . getPayMsg ( ) ) ;
toDoItem . setDeliveryDate ( costTodo . getPrePayDate ( ) = = null ? null : costTodo . getPrePayDate ( ) . toString ( ) ) ;
toDoItem . setAgreeRemark ( costTodo . getRemark ( ) ) ;
toDoItem . setAgreeCompleteState ( costTodo . getFinishedFlag ( ) . equals ( 1 ) ? "已完成" : "未完成" ) ;
subList . add ( toDoItem ) ;
}
//构造客户维度的 年度、季度合计
try {
List < TbsContractCostSubItem . CusCenterRate > cusCenterRateList = buildCusRateMain ( supplier ) ;
subList . addAll ( cusCenterRateList ) ;
} catch ( Exception e ) {
log . error ( "[构造客户维度的 年度、季度合计]异常:{}" , e . getMessage ( ) ) ;
}
//关联
data . put ( "sub" , subList ) ;
}
private void buildActivityCenterGoodsSeeyonData ( String id , TbsCostApply tbsCostApply , List < TbsActivity > activityList , List < Object > subList ) {
LambdaQueryWrapper < TbsActivityCenterGoods > actCgLqw = new LambdaQueryWrapper < > ( ) ;
actCgLqw . eq ( TbsActivityCenterGoods : : getCostApplyId , id ) ;
List < TbsActivityCenterGoods > activityCenterGoodsList = tbsActivityCenterGoodsMapper . selectList ( actCgLqw ) ;
for ( TbsActivityCenterGoods centerGoods : activityCenterGoodsList ) {
TbsActivity currActivity = null ;
for ( TbsActivity activity : activityList ) {
if ( centerGoods . getActivityId ( ) . equals ( activity . getId ( ) ) ) {
currActivity = activity ;
break ;
}
}
TbsContractCostSubItem . Activity dataActivity = new TbsContractCostSubItem . Activity ( ) ;
dataActivity . setActivityCode ( currActivity . getActivityCode ( ) ) ;
dataActivity . setActivityPurpose ( currActivity . getActTitle ( ) ) ;
dataActivity . setCostCode ( tbsCostApply . getCode ( ) ) ;
dataActivity . setStartDate ( currActivity . getActStartDate ( ) = = null ? null : currActivity . getActStartDate ( ) . toString ( ) ) ;
dataActivity . setEndDate ( currActivity . getActEndDate ( ) = = null ? null : currActivity . getActEndDate ( ) . toString ( ) ) ;
dataActivity . setWriteOffDate ( currActivity . getPreCheckDate ( ) = = null ? null : currActivity . getPreCheckDate ( ) . toString ( ) ) ;
dataActivity . setProductType ( GoodsType . getName ( centerGoods . getTargetType ( ) ) ) ;
dataActivity . setProduct ( centerGoods . getTargetName ( ) ) ;
dataActivity . setActivityAccountCode ( centerGoods . getSubjectCode ( ) ) ;
dataActivity . setActivityAccountName ( centerGoods . getSubjectName ( ) ) ;
dataActivity . setActivityCostCenterNo ( centerGoods . getCenterCode ( ) ) ;
dataActivity . setActivityCostCenterName ( centerGoods . getCenterName ( ) + "(" + centerGoods . getCenterType ( ) + ")" ) ;
dataActivity . setMoney ( centerGoods . getCenterGoodsAmount ( ) ) ;
subList . add ( dataActivity ) ;
}
}
private void buildContractSeeyonData ( String id , Map < String , Object > data , List < TbsCostContract > contracts ) {
//活动的科目和成本中心
//活动的科目和成本中心
List < TbsActivityCenter > tbsActivityCenters = tbsActivityCenterService . listByCostApplyId ( Long . parseLong ( id ) ) ;
List < TbsActivityCenter > tbsActivityCenters = tbsActivityCenterService . listByCostApplyId ( Long . parseLong ( id ) ) ;
String concatCenterCodes = tbsActivityCenters . stream ( ) . map ( TbsActivityCenter : : getCenterCode ) . collect ( Collectors . joining ( "," ) ) ;
String concatCenterCodes = tbsActivityCenters . stream ( ) . map ( TbsActivityCenter : : getCenterCode ) . collect ( Collectors . joining ( "," ) ) ;
@ -627,78 +721,141 @@ public class TbsCostApplyServiceImpl extends ServiceImpl<TbsCostApplyMapper,TbsC
} ) . collect ( Collectors . joining ( " , " ) ) ;
} ) . collect ( Collectors . joining ( " , " ) ) ;
}
}
data . put ( "contractFile" , urls ) ;
data . put ( "contractFile" , urls ) ;
} else {
Assert . throwEx ( "请补充合同信息" ) ;
}
}
//创建子表数据
@NotNull
List < Object > subList = new ArrayList < > ( ) ;
private List < TbsContractCostSubItem . CusCenterRate > buildCusRateMain ( BmsSupplier supplier ) {
List < BmsSupplierTarget > supplierTargetList = bmsSupplierTargetMapper . selectList (
new LambdaQueryWrapper < BmsSupplierTarget > ( )
. eq ( BmsSupplierTarget : : getSupplierId , supplier . getId ( ) )
) ;
List < Long > scheduleItemIds = supplierTargetList . stream ( ) . map ( BmsSupplierTarget : : getScheduleItemId ) . collect ( Collectors . toList ( ) ) ;
List < Long > scheduleIds = supplierTargetList . stream ( ) . map ( BmsSupplierTarget : : getScheduleId ) . collect ( Collectors . toList ( ) ) ;
List < TbsScheduleItem > scheduleItems = null ;
if ( scheduleItemIds . size ( ) > 0 & & scheduleIds . size ( ) > 0 ) {
LambdaQueryWrapper < TbsScheduleItem > scheduleItemsLqw = new LambdaQueryWrapper < > ( ) ;
scheduleItemsLqw . in ( TbsScheduleItem : : getId , scheduleItemIds ) ;
scheduleItemsLqw . in ( TbsScheduleItem : : getScheduleId , scheduleIds ) ;
scheduleItems = tbsScheduleItemMapper . selectList ( scheduleItemsLqw ) ;
}
//最近12个月
LocalDate currMonth = LocalDate . now ( ) ;
//活动明细
int currMonthNum = currMonth . getYear ( ) * 100 + currMonth . getMonthValue ( ) ;
LambdaQueryWrapper < TbsActivityCenterGoods > actCgLqw = new LambdaQueryWrapper < > ( ) ;
LocalDate startMonth = currMonth . plusMonths ( - 12 ) ;
actCgLqw . eq ( TbsActivityCenterGoods : : getCostApplyId , id ) ;
int startMonthNum = startMonth . getYear ( ) * 100 + startMonth . getMonthValue ( ) ;
List < TbsActivityCenterGoods > activityCenterGoodsList = tbsActivityCenterGoodsMapper . selectList ( actCgLqw ) ;
for ( TbsActivityCenterGoods centerGoods : activityCenterGoodsList ) {
//发货金额
TbsActivity currActivity = null ;
List < ErpDispatchSumVo > dispatchSumVos = dispatchDataMapper . querySumCost ( startMonthNum , currMonthNum , Arrays . asList ( supplier . getCode ( ) ) ) ;
for ( TbsActivity activity : activityList ) {
//客户核销金额
if ( centerGoods . getActivityId ( ) . equals ( activity . getId ( ) ) ) {
BirRoiCostDTO costDTO = new BirRoiCostDTO ( ) ;
currActivity = activity ;
costDTO . setStartMonthNum ( startMonthNum ) ;
break ;
costDTO . setEndMonthNum ( currMonthNum ) ;
costDTO . setSupplierId ( supplier . getId ( ) ) ;
List < BirRoiCostItemVo > costItemVoList = birRoiRateMapper . queryRoiCostItems ( costDTO ) ;
//用户季度费率
List < TbsContractCostSubItem . CusCenterRate > cusCenterRateList =
this . buildCusCenterRate ( supplierTargetList , scheduleItems , currMonth , startMonth , dispatchSumVos , costItemVoList ) ;
//用户年费率
this . buildCusCenterYearRate ( supplierTargetList , dispatchSumVos , costItemVoList , cusCenterRateList ) ;
return cusCenterRateList ;
}
}
/ * *
* 用户年费率
* @param supplierTargetList
* @param dispatchSumVos
* @param costItemVoList
* @param cusCenterRateList
* /
private void buildCusCenterYearRate ( List < BmsSupplierTarget > supplierTargetList , List < ErpDispatchSumVo > dispatchSumVos , List < BirRoiCostItemVo > costItemVoList , List < TbsContractCostSubItem . CusCenterRate > cusCenterRateList ) {
BigDecimal dispatchAmt = BigDecimal . ZERO ;
BigDecimal totalCost = BigDecimal . ZERO ;
BigDecimal cusDispatch = BigDecimal . ZERO ;
BigDecimal cusCost = BigDecimal . ZERO ;
for ( ErpDispatchSumVo dispatchSumVo : dispatchSumVos ) {
dispatchAmt = dispatchAmt . add ( dispatchSumVo . getDispatchSumCost ( ) ) ;
}
for ( BirRoiCostItemVo itemVo : costItemVoList ) {
totalCost = totalCost . add ( itemVo . getCostRealAmt ( ) ) ;
}
for ( BmsSupplierTarget supplierTarget : supplierTargetList ) {
cusDispatch = cusDispatch . add ( supplierTarget . getTargetCostAmount ( ) ) ;
cusCost = cusCost . add ( supplierTarget . getTargetCostAmount ( ) ) ;
}
for ( TbsContractCostSubItem . CusCenterRate centerRate : cusCenterRateList ) {
centerRate . setYtdCusCenterCost ( totalCost . toString ( ) ) ;
centerRate . setYtdCusCenterSend ( dispatchAmt . toString ( ) ) ;
centerRate . setYtdCusCenterExpenseRate ( totalCost . divide ( dispatchAmt , RoundingMode . DOWN ) . toString ( ) ) ;
if ( cusCost . compareTo ( BigDecimal . ZERO ) ! = 0 & & cusDispatch . compareTo ( BigDecimal . ZERO ) ! = 0 ) {
centerRate . setYtdCusCenterTargetExpenseRate ( cusCost . divide ( cusDispatch , RoundingMode . DOWN ) . toString ( ) ) ;
}
}
TbsContractCostSubItem . Activity dataActivity = new TbsContractCostSubItem . Activity ( ) ;
dataActivity . setActivityCode ( currActivity . getActivityCode ( ) ) ;
dataActivity . setActivityPurpose ( currActivity . getActTitle ( ) ) ;
dataActivity . setCostCode ( tbsCostApply . getCode ( ) ) ;
dataActivity . setStartDate ( currActivity . getActStartDate ( ) = = null ? null : currActivity . getActStartDate ( ) . toString ( ) ) ;
dataActivity . setEndDate ( currActivity . getActEndDate ( ) = = null ? null : currActivity . getActEndDate ( ) . toString ( ) ) ;
dataActivity . setWriteOffDate ( currActivity . getPreCheckDate ( ) = = null ? null : currActivity . getPreCheckDate ( ) . toString ( ) ) ;
dataActivity . setProductType ( GoodsType . getName ( centerGoods . getTargetType ( ) ) ) ;
dataActivity . setProduct ( centerGoods . getTargetName ( ) ) ;
dataActivity . setActivityAccountCode ( centerGoods . getSubjectCode ( ) ) ;
dataActivity . setActivityAccountName ( centerGoods . getSubjectName ( ) ) ;
dataActivity . setActivityCostCenterNo ( centerGoods . getCenterCode ( ) ) ;
dataActivity . setActivityCostCenterName ( centerGoods . getCenterName ( ) + "(" + centerGoods . getCenterType ( ) + ")" ) ;
dataActivity . setMoney ( centerGoods . getCenterGoodsAmount ( ) ) ;
subList . add ( dataActivity ) ;
}
}
// 付款条件
for ( TbsActivityPayCondition payCondition : payConditions ) {
// TbsActivity currActivity = null;
// for (TbsActivity activity : activityList) {
// if(payCondition.getActivityId().equals(activity.getId())){
// currActivity = activity;
// break;
// }
// }
TbsContractCostSubItem . Payment subPayment = new TbsContractCostSubItem . Payment ( ) ;
subPayment . setPayItem ( payCondition . getTitle ( ) ) ;
subPayment . setPayCondition ( payCondition . getConditionMsg ( ) ) ;
subPayment . setPayMoney ( payCondition . getPaymentPrice ( ) ) ;
subPayment . setPayDate ( payCondition . getPreNotifyTime ( ) ! = null ? payCondition . getPreNotifyTime ( ) . format ( DateTimeFormatter . ofPattern ( "yyyy-MM-dd" ) ) : null ) ;
subPayment . setActualPayDate ( null ) ;
String stateMsg = payCondition . getFinishedFlag ( ) . equals ( 1 ) ? "已完成" : "未处理" ;
subPayment . setPayCompleteState ( stateMsg ) ;
subPayment . setPayRemark ( payCondition . getRemark ( ) ) ;
subPayment . setPayCode ( payCondition . getCode ( ) ) ;
subList . add ( subPayment ) ;
}
}
// 协议条款
/ * *
LambdaQueryWrapper < TbsCostTodo > todoLqw = new LambdaQueryWrapper < > ( ) ;
* 创建客户维度的季度费率
todoLqw . eq ( TbsCostTodo : : getCostApplyId , tbsCostApply . getId ( ) ) ;
* @param supplierTargetList
List < TbsCostTodo > costTodoList = tbsCostTodoMapper . selectList ( todoLqw ) ;
* @param scheduleItems
for ( TbsCostTodo costTodo : costTodoList ) {
* @param currMonth
TbsContractCostSubItem . ToDoItem toDoItem = new TbsContractCostSubItem . ToDoItem ( ) ;
* @param startMonth
toDoItem . setServiceDescription ( costTodo . getDescr ( ) ) ;
* @param dispatchSumVos
toDoItem . setDeliveryStandard ( costTodo . getPayMsg ( ) ) ;
* @param costItemVoList
toDoItem . setDeliveryDate ( costTodo . getPrePayDate ( ) = = null ? null : costTodo . getPrePayDate ( ) . toString ( ) ) ;
* /
toDoItem . setAgreeRemark ( costTodo . getRemark ( ) ) ;
private List < TbsContractCostSubItem . CusCenterRate > buildCusCenterRate ( List < BmsSupplierTarget > supplierTargetList ,
toDoItem . setAgreeCompleteState ( costTodo . getFinishedFlag ( ) . equals ( 1 ) ? "已完成" : "未完成" ) ;
List < TbsScheduleItem > scheduleItems ,
subList . add ( toDoItem ) ;
LocalDate currMonth , LocalDate startMonth ,
List < ErpDispatchSumVo > dispatchSumVos ,
List < BirRoiCostItemVo > costItemVoList ) {
List < TbsContractCostSubItem . CusCenterRate > cusCenterRateList = new ArrayList < > ( ) ;
int [ ] currQ = MonthValues . getQArr ( startMonth . getMonthValue ( ) ) ;
if ( currQ ! = null ) {
BigDecimal dispatchAmt = BigDecimal . ZERO ;
BigDecimal totalCost = BigDecimal . ZERO ;
BigDecimal cusDispatch = BigDecimal . ZERO ;
BigDecimal cusCost = BigDecimal . ZERO ;
for ( int monthVal : currQ ) {
int monthNum = currMonth . getYear ( ) * 100 + monthVal ;
if ( dispatchSumVos ! = null ) {
for ( ErpDispatchSumVo dispatchSumVo : dispatchSumVos ) {
if ( dispatchSumVo . getYearMonth ( ) . equals ( monthNum ) ) {
dispatchAmt = dispatchAmt . add ( dispatchSumVo . getDispatchSumCost ( ) ) ;
break ;
}
}
}
for ( BirRoiCostItemVo itemVo : costItemVoList ) {
if ( itemVo . getYearMonth ( ) . equals ( monthNum ) ) {
totalCost = totalCost . add ( itemVo . getCostRealAmt ( ) ) ;
}
}
if ( scheduleItems ! = null ) {
for ( BmsSupplierTarget supplierTarget : supplierTargetList ) {
for ( TbsScheduleItem item : scheduleItems ) {
//匹配条件
if ( supplierTarget . getScheduleItemId ( ) . equals ( item . getId ( ) ) ) {
//匹配时间
int itemMonth = item . getStartDate ( ) . getMonthValue ( ) ;
if ( itemMonth = = monthVal ) {
cusDispatch = cusDispatch . add ( supplierTarget . getTargetCostAmount ( ) ) ;
cusCost = cusCost . add ( supplierTarget . getTargetCostAmount ( ) ) ;
break ;
}
}
}
}
//关联
}
data . put ( "sub" , subList ) ;
}
}
TbsContractCostSubItem . CusCenterRate centerRate = new TbsContractCostSubItem . CusCenterRate ( ) ;
centerRate . setQtdCusCenterCost ( totalCost . toString ( ) ) ;
centerRate . setQtdCusCenterSend ( dispatchAmt . toString ( ) ) ;
centerRate . setQtdCusCenterExpenseRate ( totalCost . divide ( dispatchAmt , RoundingMode . DOWN ) . toString ( ) ) ;
if ( cusCost . compareTo ( BigDecimal . ZERO ) ! = 0 & & cusDispatch . compareTo ( BigDecimal . ZERO ) ! = 0 ) {
centerRate . setQtdCusCenterTargetExpenseRate ( cusCost . divide ( cusDispatch , RoundingMode . DOWN ) . toString ( ) ) ;
}
cusCenterRateList . add ( centerRate ) ;
}
return cusCenterRateList ;
}
}
private void buildCommonApplyData ( String id , TbsCostApply tbsCostApply , List < TbsActivity > activityList , BmsSupplier supplier , SysUser sysUser , Map < String , Object > data ) {
private void buildCommonApplyData ( String id , TbsCostApply tbsCostApply , List < TbsActivity > activityList , BmsSupplier supplier , SysUser sysUser , Map < String , Object > data ) {
@ -753,7 +910,14 @@ public class TbsCostApplyServiceImpl extends ServiceImpl<TbsCostApplyMapper,TbsC
try {
try {
this . buildSubList ( tbsActivityCenters , subjectNames , subList ) ;
this . buildSubList ( tbsActivityCenters , subjectNames , subList ) ;
} catch ( Exception e ) {
} catch ( Exception e ) {
e . printStackTrace ( ) ;
log . error ( "【费用申请,创建子表数据】:{}" , e . getMessage ( ) ) ;
}
//构造客户维度的 年度、季度合计
try {
List < TbsContractCostSubItem . CusCenterRate > cusCenterRateList = buildCusRateMain ( supplier ) ;
subList . addAll ( cusCenterRateList ) ;
} catch ( Exception e ) {
log . error ( "【费用申请,创建客户维度费率数据】:{}" , e . getMessage ( ) ) ;
}
}
//创建商品抬头列表
//创建商品抬头列表
List < TbsActivityGoods > tbsActivityGoods = tbsActivityGoodsService . listByCostApplyId ( Long . parseLong ( id ) ) ;
List < TbsActivityGoods > tbsActivityGoods = tbsActivityGoodsService . listByCostApplyId ( Long . parseLong ( id ) ) ;
@ -827,7 +991,7 @@ public class TbsCostApplyServiceImpl extends ServiceImpl<TbsCostApplyMapper,TbsC
//成本中心去重
//成本中心去重
Map < String , List < TbsActivityCenter > > centerMapList = tbsActivityCenters . stream ( ) . collect ( Collectors . groupingBy ( a - > a . getCenterType ( ) + "-" + a . getCenterId ( ) ) ) ;
Map < String , List < TbsActivityCenter > > centerMapList = tbsActivityCenters . stream ( ) . collect ( Collectors . groupingBy ( a - > a . getCenterType ( ) + "-" + a . getCenterId ( ) ) ) ;
List < TbsActivityCenter > centerList = centerMapList . values ( ) . stream ( ) . map ( a - > a . get ( 0 ) ) . collect ( Collectors . toList ( ) ) ;
List < TbsActivityCenter > centerList = centerMapList . values ( ) . stream ( ) . map ( a - > a . get ( 0 ) ) . collect ( Collectors . toList ( ) ) ;
// TODO 有异常
for ( TbsActivityCenter center : centerList ) {
for ( TbsActivityCenter center : centerList ) {
TbsCostSubItem . CostCenterTranStr costCenter = centerRateService . buildCostCenter ( center . getCenterType ( ) , center . getCenterId ( ) , center . getCenterName ( ) ) ;
TbsCostSubItem . CostCenterTranStr costCenter = centerRateService . buildCostCenter ( center . getCenterType ( ) , center . getCenterId ( ) , center . getCenterName ( ) ) ;
subList . add ( costCenter ) ;
subList . add ( costCenter ) ;