liusheng
2024-03-19 ded03f0315e02c13f17b8bf7777c89a5cc73130e
ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundtaxServiceImpl.java
@@ -3,131 +3,182 @@
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;
/**
 * 专家费用算税申请主Service业务层处理
 *
 *
 * @author ruoyi
 * @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;
    /**
     * 查询专家费用算税申请主列表
     *
     *
     * @param serviceFundtax 专家费用算税申请主
     * @return 专家费用算税申请主
     */
    @Override
    public List<ServiceFundtax> queryList(ServiceFundtax serviceFundtax) {
        LambdaQueryWrapper<ServiceFundtax> wrappers = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(serviceFundtax.getApplyno())){
            wrappers.eq(ServiceFundtax::getApplyno ,serviceFundtax.getApplyno());
        if (StringUtils.isNotBlank(serviceFundtax.getApplyno())) {
            wrappers.eq(ServiceFundtax::getApplyno, serviceFundtax.getApplyno());
        }
        if (serviceFundtax.getTaxedtime() != null){
            wrappers.eq(ServiceFundtax::getTaxedtime ,serviceFundtax.getTaxedtime());
        if (serviceFundtax.getTaxedtime() != null) {
            wrappers.eq(ServiceFundtax::getTaxedtime, serviceFundtax.getTaxedtime());
        }
        if (StringUtils.isNotBlank(serviceFundtax.getUserno())){
            wrappers.eq(ServiceFundtax::getUserno ,serviceFundtax.getUserno());
        if (StringUtils.isNotBlank(serviceFundtax.getUserno())) {
            wrappers.eq(ServiceFundtax::getUserno, serviceFundtax.getUserno());
        }
        if (StringUtils.isNotBlank(serviceFundtax.getUsername())){
            wrappers.like(ServiceFundtax::getUsername ,serviceFundtax.getUsername());
        if (StringUtils.isNotBlank(serviceFundtax.getUsername())) {
            wrappers.like(ServiceFundtax::getUsername, serviceFundtax.getUsername());
        }
        if (StringUtils.isNotBlank(serviceFundtax.getDeptmentno())){
            wrappers.eq(ServiceFundtax::getDeptmentno ,serviceFundtax.getDeptmentno());
        if (StringUtils.isNotBlank(serviceFundtax.getDeptmentno())) {
            wrappers.eq(ServiceFundtax::getDeptmentno, serviceFundtax.getDeptmentno());
        }
        if (StringUtils.isNotBlank(serviceFundtax.getDeptmentname())){
            wrappers.like(ServiceFundtax::getDeptmentname ,serviceFundtax.getDeptmentname());
        if (StringUtils.isNotBlank(serviceFundtax.getDeptmentname())) {
            wrappers.like(ServiceFundtax::getDeptmentname, serviceFundtax.getDeptmentname());
        }
        if (StringUtils.isNotBlank(serviceFundtax.getManagerno())){
            wrappers.eq(ServiceFundtax::getManagerno ,serviceFundtax.getManagerno());
        if (StringUtils.isNotBlank(serviceFundtax.getManagerno())) {
            wrappers.eq(ServiceFundtax::getManagerno, serviceFundtax.getManagerno());
        }
        if (StringUtils.isNotBlank(serviceFundtax.getManagername())){
            wrappers.like(ServiceFundtax::getManagername ,serviceFundtax.getManagername());
        if (StringUtils.isNotBlank(serviceFundtax.getManagername())) {
            wrappers.like(ServiceFundtax::getManagername, serviceFundtax.getManagername());
        }
        if (serviceFundtax.getPretaxamount() != null){
            wrappers.eq(ServiceFundtax::getPretaxamount ,serviceFundtax.getPretaxamount());
        if (serviceFundtax.getPretaxamount() != null) {
            wrappers.eq(ServiceFundtax::getPretaxamount, serviceFundtax.getPretaxamount());
        }
        if (serviceFundtax.getTaxedamount() != null){
            wrappers.eq(ServiceFundtax::getTaxedamount ,serviceFundtax.getTaxedamount());
        if (serviceFundtax.getTaxedamount() != null) {
            wrappers.eq(ServiceFundtax::getTaxedamount, serviceFundtax.getTaxedamount());
        }
        if (serviceFundtax.getTaxamount() != null){
            wrappers.eq(ServiceFundtax::getTaxamount ,serviceFundtax.getTaxamount());
        if (serviceFundtax.getTaxamount() != null) {
            wrappers.eq(ServiceFundtax::getTaxamount, serviceFundtax.getTaxamount());
        }
        if (serviceFundtax.getMedicalcost() != null){
            wrappers.eq(ServiceFundtax::getMedicalcost ,serviceFundtax.getMedicalcost());
        if (serviceFundtax.getIstax() != null) {
            wrappers.eq(ServiceFundtax::getIstax, serviceFundtax.getIstax());
        }
        if (serviceFundtax.getBodymaintaincost() != null){
            wrappers.eq(ServiceFundtax::getBodymaintaincost ,serviceFundtax.getBodymaintaincost());
        if (serviceFundtax.getMedicalcost() != null) {
            wrappers.eq(ServiceFundtax::getMedicalcost, serviceFundtax.getMedicalcost());
        }
        if (serviceFundtax.getOrgangaincost() != null){
            wrappers.eq(ServiceFundtax::getOrgangaincost ,serviceFundtax.getOrgangaincost());
        if (serviceFundtax.getBodymaintaincost() != null) {
            wrappers.eq(ServiceFundtax::getBodymaintaincost, serviceFundtax.getBodymaintaincost());
        }
        if (serviceFundtax.getOrganmaintaincost() != null){
            wrappers.eq(ServiceFundtax::getOrganmaintaincost ,serviceFundtax.getOrganmaintaincost());
        if (serviceFundtax.getOrgangaincost() != null) {
            wrappers.eq(ServiceFundtax::getOrgangaincost, serviceFundtax.getOrgangaincost());
        }
        if (StringUtils.isNotBlank(serviceFundtax.getRemark())){
            wrappers.eq(ServiceFundtax::getRemark ,serviceFundtax.getRemark());
        if (serviceFundtax.getOrganmaintaincost() != null) {
            wrappers.eq(ServiceFundtax::getOrganmaintaincost, serviceFundtax.getOrganmaintaincost());
        }
        if (serviceFundtax.getRecordstatus() != null){
            wrappers.eq(ServiceFundtax::getRecordstatus ,serviceFundtax.getRecordstatus());
        if (StringUtils.isNotBlank(serviceFundtax.getRemark())) {
            wrappers.eq(ServiceFundtax::getRemark, serviceFundtax.getRemark());
        }
        if (serviceFundtax.getCheckstatus() != null){
            wrappers.eq(ServiceFundtax::getCheckstatus ,serviceFundtax.getCheckstatus());
        if (serviceFundtax.getRecordstatus() != null) {
            wrappers.eq(ServiceFundtax::getRecordstatus, serviceFundtax.getRecordstatus());
        }
        if (serviceFundtax.getFlowlevel() != null){
            wrappers.eq(ServiceFundtax::getFlowlevel ,serviceFundtax.getFlowlevel());
        if (serviceFundtax.getCheckstatus() != null) {
            wrappers.eq(ServiceFundtax::getCheckstatus, serviceFundtax.getCheckstatus());
        }
        if (serviceFundtax.getBackflowlevel() != null){
            wrappers.eq(ServiceFundtax::getBackflowlevel ,serviceFundtax.getBackflowlevel());
        if (serviceFundtax.getFlowlevel() != null) {
            wrappers.eq(ServiceFundtax::getFlowlevel, serviceFundtax.getFlowlevel());
        }
        if (StringUtils.isNotBlank(serviceFundtax.getIsdistribute())){
            wrappers.eq(ServiceFundtax::getIsdistribute ,serviceFundtax.getIsdistribute());
        if (serviceFundtax.getBackflowlevel() != null) {
            wrappers.eq(ServiceFundtax::getBackflowlevel, serviceFundtax.getBackflowlevel());
        }
        if (StringUtils.isNotBlank(serviceFundtax.getRiqi())){
            wrappers.eq(ServiceFundtax::getRiqi ,serviceFundtax.getRiqi());
        if (StringUtils.isNotBlank(serviceFundtax.getIsdistribute())) {
            wrappers.eq(ServiceFundtax::getIsdistribute, serviceFundtax.getIsdistribute());
        }
        if (StringUtils.isNotBlank(serviceFundtax.getOpochecker())){
            wrappers.eq(ServiceFundtax::getOpochecker ,serviceFundtax.getOpochecker());
        if (StringUtils.isNotBlank(serviceFundtax.getRiqi())) {
            wrappers.eq(ServiceFundtax::getRiqi, serviceFundtax.getRiqi());
        }
        if (StringUtils.isNotBlank(serviceFundtax.getFinvicepresident())){
            wrappers.eq(ServiceFundtax::getFinvicepresident ,serviceFundtax.getFinvicepresident());
        if (StringUtils.isNotBlank(serviceFundtax.getOpochecker())) {
            wrappers.eq(ServiceFundtax::getOpochecker, serviceFundtax.getOpochecker());
        }
        if (StringUtils.isNotBlank(serviceFundtax.getBusvicepresident())){
            wrappers.eq(ServiceFundtax::getBusvicepresident ,serviceFundtax.getBusvicepresident());
        if (StringUtils.isNotBlank(serviceFundtax.getFinvicepresident())) {
            wrappers.eq(ServiceFundtax::getFinvicepresident, serviceFundtax.getFinvicepresident());
        }
        if (StringUtils.isNotBlank(serviceFundtax.getPresident())){
            wrappers.eq(ServiceFundtax::getPresident ,serviceFundtax.getPresident());
        if (StringUtils.isNotBlank(serviceFundtax.getBusvicepresident())) {
            wrappers.eq(ServiceFundtax::getBusvicepresident, serviceFundtax.getBusvicepresident());
        }
        if (StringUtils.isNotBlank(serviceFundtax.getOfficedirector())){
            wrappers.eq(ServiceFundtax::getOfficedirector ,serviceFundtax.getOfficedirector());
        if (StringUtils.isNotBlank(serviceFundtax.getPresident())) {
            wrappers.eq(ServiceFundtax::getPresident, serviceFundtax.getPresident());
        }
        if (StringUtils.isNotBlank(serviceFundtax.getFinancedirector())){
            wrappers.eq(ServiceFundtax::getFinancedirector ,serviceFundtax.getFinancedirector());
        if (StringUtils.isNotBlank(serviceFundtax.getOfficedirector())) {
            wrappers.eq(ServiceFundtax::getOfficedirector, serviceFundtax.getOfficedirector());
        }
        if (StringUtils.isNotBlank(serviceFundtax.getFinancechecher())){
            wrappers.eq(ServiceFundtax::getFinancechecher ,serviceFundtax.getFinancechecher());
        if (StringUtils.isNotBlank(serviceFundtax.getFinancedirector())) {
            wrappers.eq(ServiceFundtax::getFinancedirector, serviceFundtax.getFinancedirector());
        }
        if (StringUtils.isNotBlank(serviceFundtax.getUploadflag())){
            wrappers.eq(ServiceFundtax::getUploadflag ,serviceFundtax.getUploadflag());
        if (StringUtils.isNotBlank(serviceFundtax.getFinancechecher())) {
            wrappers.eq(ServiceFundtax::getFinancechecher, serviceFundtax.getFinancechecher());
        }
        if (serviceFundtax.getUploadtime() != null){
            wrappers.eq(ServiceFundtax::getUploadtime ,serviceFundtax.getUploadtime());
        if (StringUtils.isNotBlank(serviceFundtax.getUploadflag())) {
            wrappers.eq(ServiceFundtax::getUploadflag, serviceFundtax.getUploadflag());
        }
        if (StringUtils.isNotBlank(serviceFundtax.getUpdownremark())){
            wrappers.eq(ServiceFundtax::getUpdownremark ,serviceFundtax.getUpdownremark());
        if (serviceFundtax.getUploadtime() != null) {
            wrappers.eq(ServiceFundtax::getUploadtime, serviceFundtax.getUploadtime());
        }
        if (StringUtils.isNotBlank(serviceFundtax.getUpdownremark())) {
            wrappers.eq(ServiceFundtax::getUpdownremark, serviceFundtax.getUpdownremark());
        }
        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;
    }
}