|
|
@ -38,11 +38,85 @@ public class TbsBudgetReleaseApplicationService { |
|
|
|
private final TbsActivityCenterGoodsService activityCenterGoodsService; |
|
|
|
private final TbsCostApplyService costApplyService; |
|
|
|
private final TbsActivityPayConditionService activityPayConditionService; |
|
|
|
private final TbsScheduleItemBudgetService tbsScheduleItemBudgetService; |
|
|
|
|
|
|
|
public void initHis(Long activityId){ |
|
|
|
TbsBudget budget = budgetService.getById("1669"); |
|
|
|
TbsScheduleItemBudget scheduleItemBudget = tbsScheduleItemBudgetService.getById("4896"); |
|
|
|
TbsActivity activity = activityService.getById(activityId); |
|
|
|
TbsCostApply costApply = costApplyService.getById(activity.getCostApplyId()); |
|
|
|
SysUser sysUser = new SysUser(); |
|
|
|
sysUser.setId("0"); |
|
|
|
sysUser.setName("系统执行"); |
|
|
|
sysUser.setCode("0"); |
|
|
|
|
|
|
|
List<TbsBudgetLog> budgetLogList = new ArrayList<>(); |
|
|
|
List<TbsActivityCenterGoods> centerGoodsList = activityCenterGoodsService.listByActivityId(activityId); |
|
|
|
for (TbsActivityCenterGoods centerGoods : centerGoodsList) { |
|
|
|
BigDecimal amount = centerGoods.getCenterGoodsAmount(); |
|
|
|
|
|
|
|
TbsBudgetCostItem costItem = new TbsBudgetCostItem(); |
|
|
|
costItem.setCenterGoodsCode(centerGoods.getCenterGoodsCode()); |
|
|
|
costItem.setCostApplyId(centerGoods.getCostApplyId()); |
|
|
|
costItem.setActivityId(centerGoods.getActivityId()); |
|
|
|
costItem.setActivityCode(centerGoods.getActivityCode()); |
|
|
|
costItem.setSupplierId(centerGoods.getSupplierId()); |
|
|
|
costItem.setSupplierCode(centerGoods.getSupplierCode()); |
|
|
|
costItem.setSupplierName(centerGoods.getSupplierName()); |
|
|
|
costItem.setSubjectId(centerGoods.getSubjectId()); |
|
|
|
costItem.setSubjectCode(centerGoods.getSubjectCode()); |
|
|
|
costItem.setSubjectName(centerGoods.getSubjectName()); |
|
|
|
costItem.setCenterType(centerGoods.getCenterType()); |
|
|
|
costItem.setCenterId(centerGoods.getCenterId()); |
|
|
|
costItem.setCenterCode(centerGoods.getCenterCode()); |
|
|
|
costItem.setCenterName(centerGoods.getCenterName()); |
|
|
|
costItem.setCenterAmount(centerGoods.getCenterAmount()); |
|
|
|
costItem.setCenterRate(centerGoods.getCenterRate()); |
|
|
|
costItem.setCenterGoodsAmount(centerGoods.getCenterGoodsAmount()); |
|
|
|
costItem.setCenterGoodsRate(centerGoods.getCenterGoodsRate()); |
|
|
|
costItem.setTargetType(centerGoods.getTargetType()); |
|
|
|
costItem.setTargetId(centerGoods.getTargetId()); |
|
|
|
costItem.setTargetCode(centerGoods.getTargetCode()); |
|
|
|
costItem.setTargetName(centerGoods.getTargetName()); |
|
|
|
costItem.setTargetLevelPathIds(centerGoods.getTargetLevelPathIds()); |
|
|
|
costItem.setTargetLevelPathNames(centerGoods.getTargetLevelPathNames()); |
|
|
|
costItem.setActStartDate(centerGoods.getActStartDate()); |
|
|
|
costItem.setActEndDate(centerGoods.getActEndDate()); |
|
|
|
costItem.setPreStartDate(centerGoods.getPreStartDate()); |
|
|
|
costItem.setPreEndDate(centerGoods.getPreEndDate()); |
|
|
|
costItem.setPreCheckDate(centerGoods.getPreCheckDate()); |
|
|
|
costItem.setCenterGoodItemId(centerGoods.getId()); |
|
|
|
|
|
|
|
TbsBudgetLog budgetLog = TbsBudgetLogBuildUtil.buildTbsBudgetLog(BudgetLogOptFlag.State_1,sysUser,costApply,costItem ,budget,amount,activity); |
|
|
|
budgetLog.setBudgetId(budget.getId()); |
|
|
|
|
|
|
|
budgetLog.setScheduleItemBudgetId(scheduleItemBudget.getId()); |
|
|
|
budgetLog.setScheduleId(scheduleItemBudget.getScheduleId()); |
|
|
|
budgetLog.setScheduleItemId(scheduleItemBudget.getScheduleItemId()); |
|
|
|
budgetLog.setItemName(scheduleItemBudget.getItemName()); |
|
|
|
|
|
|
|
budgetLogList.add(budgetLog); |
|
|
|
} |
|
|
|
//移除历史记录
|
|
|
|
budgetLogService.remove(new LambdaQueryWrapper<TbsBudgetLog>() |
|
|
|
.eq(TbsBudgetLog::getCostApplyId,activity.getCostApplyId()) |
|
|
|
.eq(TbsBudgetLog::getOptType, BudgetLogOptFlag.State_1.getCode()) |
|
|
|
.eq(TbsBudgetLog::getActivityId,activity.getId())); |
|
|
|
//重新保存
|
|
|
|
if(CollectionUtil.isNotEmpty(budgetLogList)){ |
|
|
|
budgetLogService.saveBatch(budgetLogList); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 依据剩余预算刷新释放金额 |
|
|
|
*/ |
|
|
|
public void check(){ |
|
|
|
//校验活动的核销金额是否匹配,不匹配则中断
|
|
|
|
//查询需要补偿释放的活动ID
|
|
|
|
List<Long> activityIds = vtbFundFlowMapper.listMissReleaseActivityId(); |
|
|
|
//List<Long> activityIds = vtbFundFlowMapper.listMissReleaseActivityId();
|
|
|
|
Long[] activityIds = new Long[]{229065L,229066L,229067L,229068L,229069L,229070L,229071L,229072L,229073L,229074L,229075L}; |
|
|
|
for (Long activityId : activityIds) { |
|
|
|
TbsActivity activity = activityService.getById(activityId); |
|
|
|
TbsCostApply costApply = costApplyService.getById(activity.getCostApplyId()); |
|
|
@ -84,6 +158,9 @@ public class TbsBudgetReleaseApplicationService { |
|
|
|
budgetLogList.add(budgetLog); |
|
|
|
} |
|
|
|
|
|
|
|
//TODO 二次校验,释放金额是否一致
|
|
|
|
|
|
|
|
|
|
|
|
//移除历史记录
|
|
|
|
fundFlowService.remove( |
|
|
|
new LambdaQueryWrapper<VtbFundFlow>() |
|
|
|