| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.project.domain.ServiceFund; |
| | | import com.ruoyi.project.domain.ServiceFunddetail; |
| | | import com.ruoyi.project.domain.ServiceFundtax; |
| | | import com.ruoyi.project.domain.vo.FundTaxVO; |
| | | import com.ruoyi.project.mapper.ServiceFunddetailMapper; |
| | | import com.ruoyi.project.mapper.ServiceFundtaxMapper; |
| | | import com.ruoyi.project.service.IServiceFundService; |
| | | import com.ruoyi.project.service.IServiceFunddetailService; |
| | | import com.ruoyi.project.service.IServiceFundtaxService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @date 2024-03-13 |
| | | */ |
| | | @Service |
| | | public class ServiceFundtaxServiceImpl extends ServiceImpl<ServiceFundtaxMapper, ServiceFundtax> implements IServiceFundtaxService |
| | | { |
| | | public class ServiceFundtaxServiceImpl extends ServiceImpl<ServiceFundtaxMapper, ServiceFundtax> implements IServiceFundtaxService { |
| | | |
| | | @Autowired |
| | | private ServiceFunddetailMapper serviceFunddetailMapper; |
| | | @Autowired |
| | | private IServiceFunddetailService serviceFunddetailService; |
| | | @Autowired |
| | | private IServiceFundService serviceFundService; |
| | | @Autowired |
| | | private ServiceFundtaxMapper serviceFundtaxMapper; |
| | | |
| | | |
| | | /** |
| | |
| | | return this.list(wrappers); |
| | | } |
| | | |
| | | @Override |
| | | public Integer getMaxFundTaxId() { |
| | | return serviceFundtaxMapper.getMaxFundTaxId(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean batchFundTax(FundTaxVO fundTaxVO) { |
| | | if (fundTaxVO.getFundTaxId() == null) { |
| | | throw new BaseException("分批算税出问题了,请检查后再进行计算"); |
| | | } |
| | | if (fundTaxVO.getAddOrupdate() == 1) { |
| | | Integer maxFundTaxId = serviceFundtaxMapper.getMaxFundTaxId(); |
| | | if (fundTaxVO.getFundTaxId() != maxFundTaxId.longValue()) { |
| | | throw new BaseException("该批数据不能算税"); |
| | | } |
| | | } |
| | | |
| | | ServiceFund serviceFund = new ServiceFund(); |
| | | serviceFund.setFundTaxId(fundTaxVO.getFundTaxId()); |
| | | serviceFund.setDel_flag(0); |
| | | List<ServiceFund> serviceFunds = serviceFundService.selectServiceFundList(serviceFund); |
| | | for (ServiceFund serviceFund1 : serviceFunds) { |
| | | ServiceFunddetail serviceFunddetail = new ServiceFunddetail(); |
| | | serviceFunddetail.setFundid(serviceFund1.getId()); |
| | | List<ServiceFunddetail> serviceFunddetails = serviceFunddetailMapper.selectServiceFunddetailList(serviceFunddetail); |
| | | serviceFunddetailService.calculateTax(serviceFunddetails); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | } |