package com.yuchen.saas.park.service.service.property.bill;

import com.yuchen.saas.park.api.dto.property.CreateBillDto;
import com.yuchen.saas.park.api.dto.property.PropertySlipCreateBillDto;
import com.yuchen.saas.park.service.service.property.PropertyBillSubService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class SlipBillServiceImpl extends BasePropertyBillService implements IPropertyBillService {
    @Resource
    private PropertyBillService propertyBillService;
    @Resource
    private PropertyBillSubService propertyBillSubService;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void createBill(CreateBillDto createBillDto) {
        super.validParam(createBillDto);
        PropertySlipCreateBillDto dto = createBillDto.getSlipCreateBillDto();
        propertyBillService.saveBatch(dto.getBillList());
        propertyBillSubService.saveBatch(dto.getBillSubList());
    }

}
