MrShi
2024-11-26 14a20df4699cf3d933e2bdbe1ba2aba15ade1059
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractRevenueServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,448 @@
package com.doumee.service.business.impl;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.model.LoginUserInfo;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Constants;
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.*;
import com.doumee.dao.business.dao.CompanyMapper;
import com.doumee.dao.business.model.*;
import com.doumee.dao.business.vo.EditRecordDataVO;
import com.doumee.dao.system.MultifileMapper;
import com.doumee.dao.system.SystemUserMapper;
import com.doumee.dao.system.model.Multifile;
import com.doumee.dao.system.model.SystemUser;
import com.doumee.service.business.YwContractRevenueService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
 * è¿ç»´åˆåŒæ”¶æ”¯æµæ°´Service实现
 * @author æ±Ÿè¹„蹄
 * @date 2024/11/25 10:29
 */
@Service
public class YwContractRevenueServiceImpl implements YwContractRevenueService {
    @Autowired
    private YwContractRevenueMapper ywContractRevenueMapper;
    @Autowired
    private YwContractBillMapper ywContractBillMapper;
    @Autowired
    private YwContractMapper ywContractMapper;
    @Autowired
    private CompanyMapper companyMapper;
    @Autowired
    private YwAccountMapper ywAccountMapper;
    @Autowired
    private MultifileMapper multifileMapper;
    @Autowired
    private YwContractRoomMapper ywContractRoomMapper;
    @Autowired
    private SystemUserMapper systemUserMapper;
    @Override
    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
    public Integer create(YwContractRevenue ywContractRevenue) {
        if(Objects.isNull(ywContractRevenue)
        || Objects.isNull(ywContractRevenue.getActReceivableFee())
                || Objects.isNull(ywContractRevenue.getActPayDate())
                || Objects.isNull(ywContractRevenue.getPayType())
                || Objects.isNull(ywContractRevenue.getCompanyId())
                || Objects.isNull(ywContractRevenue.getAccountId())
                || Objects.isNull(ywContractRevenue.getBillId())
                || ywContractRevenue.getActReceivableFee().compareTo(BigDecimal.ZERO) <= Constants.ZERO
        ){
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        YwContractBill ywContractBill = ywContractBillMapper.selectById(ywContractRevenue.getBillId());
        if(Objects.isNull(ywContractBill)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到账单信息");
        }
        if(!Constants.equalsInteger(ywContractBill.getStatus(),Constants.ZERO)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"账单状态已流转,无法进行该操作");
        }
        if(!(Constants.equalsInteger(ywContractBill.getPayStatus(),Constants.ZERO)
        || Constants.equalsInteger(ywContractBill.getPayStatus(),Constants.TWO)
                || Constants.equalsInteger(ywContractBill.getPayStatus(),Constants.THREE)
                || Constants.equalsInteger(ywContractBill.getPayStatus(),Constants.FOUR)
        )){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"账单结清状态已流转,无法进行该操作");
        }
        Company company =companyMapper.selectById(ywContractRevenue.getCompanyId());
        if(Objects.isNull(company)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到所属公司信息");
        }
        YwAccount ywAccount =ywAccountMapper.selectById(ywContractRevenue.getAccountId());
        if(Objects.isNull(ywAccount)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到收支账户信息");
        }
        LoginUserInfo loginUserInfo = ywContractRevenue.getLoginUserInfo();
        ywContractRevenue.setCreateDate(new Date());
        ywContractRevenue.setCreator(loginUserInfo.getId());
        ywContractRevenue.setIsdeleted(Constants.ZERO);
        ywContractRevenue.setStatus(Constants.ZERO);
        ywContractRevenue.setContractId(ywContractBill.getContractId());
        //根据收支情况 æ›´æ–°è´¦å•数据
        //查询当前账单下 å·²æ”¯ä»˜çš„费用
        List<YwContractRevenue> ywContractRevenueList = ywContractRevenueMapper.selectList(new QueryWrapper<YwContractRevenue>().lambda().eq(YwContractRevenue::getIsdeleted,Constants.ZERO)
                .eq(YwContractRevenue::getStatus,Constants.ZERO)
        );
        //已支付金额
        BigDecimal payTotal = BigDecimal.ZERO;
        //待支付金额
        BigDecimal waitPayTotal = BigDecimal.ZERO;
        //无付款记录 åˆ™ä¸ºåˆæ¬¡æ”¯ä»˜ æ ¹æ®è´¦å•类型 åˆ¤æ–­æ˜¯æ”¯å‡º / æ”¶å…¥
        if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(ywContractRevenueList)){
            ywContractRevenue.setRevenueType(ywContractBill.getType());
            if(ywContractRevenue.getActReceivableFee().compareTo(ywContractBill.getReceivableFee())>Constants.ZERO){
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"请输入正确的金额!");
            }else  if(ywContractRevenue.getActReceivableFee().compareTo(ywContractBill.getReceivableFee())==Constants.ZERO){
                ywContractBill.setPayStatus(Constants.ONE);
            }else{
                ywContractBill.setPayStatus(Constants.TWO);
            }
        }else{
            //获取已支付的总金额 ï¼ˆå¯èƒ½æœ‰æ”¶å…¥ æœ‰æ”¯å‡ºï¼‰
            payTotal = ywContractRevenueList.stream().map(i->i.getActReceivableFee().multiply(
                    BigDecimal.valueOf(Constants.equalsInteger(ywContractRevenue.getRevenueType(),Constants.ZERO)?Constants.ONE:-Constants.ONE))
            ).reduce(BigDecimal.ZERO,BigDecimal::add);
            //获取待支付款金额 å¦‚果账单类型为支出 æˆ– ï¼ˆè´¦å•类型为收入 ä¸” å¾…支付金额 å°äºŽ 0) åˆ™ä¸ºæ”¯ä»˜
            waitPayTotal = ywContractBill.getReceivableFee().subtract(payTotal);
            //如果待支付金额 å¤§äºŽ 0  åˆ™æ˜¯ æ”¶å…¥ å¦åˆ™æ˜¯æ”¯å‡º å…¶ä»–状态 ä¸ºå¼‚常!
            if(waitPayTotal.compareTo(BigDecimal.ZERO)>Constants.ZERO){
                ywContractRevenue.setRevenueType(Constants.ZERO);
            }else if(waitPayTotal.compareTo(BigDecimal.ZERO)<Constants.ZERO){
                ywContractRevenue.setRevenueType(Constants.ONE);
            }else{
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"收支金额异常!请联系管理员");
            }
            //待支付的流水 å¦‚果为收入 åˆ™æ¯”对 é‡‘额值  å¦‚果是支出 åˆ™èŽ·å–ç»å¯¹å€¼ è¿›è¡Œå¯¹æ¯”
            if(Constants.equalsInteger(ywContractRevenue.getRevenueType(),Constants.ZERO)){
                //如果支付金额 å¤§äºŽ å¾…支付金额 åˆ™æç¤ºå¼‚常 å¦‚果支付金额小于 å¾…支付金额 åˆ™çŠ¶æ€ä¸å˜åŒ– å…¶ä»–状态 å¼‚常
                if(waitPayTotal.compareTo(ywContractRevenue.getActReceivableFee())>Constants.ZERO){
                    throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"请输入正确的金额!");
                }else if(waitPayTotal.compareTo(ywContractRevenue.getActReceivableFee())==Constants.ZERO){
                    ywContractBill.setPayStatus(Constants.ONE);
                }
            }else{
                waitPayTotal = waitPayTotal.abs();
                if(waitPayTotal.compareTo(ywContractRevenue.getActReceivableFee())>Constants.ZERO){
                    throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"请输入正确的金额!");
                }else if(waitPayTotal.compareTo(ywContractRevenue.getActReceivableFee())==Constants.ZERO){
                    ywContractBill.setPayStatus(Constants.ONE);
                }
            }
        }
        ywContractRevenueMapper.insert(ywContractRevenue);
        ywContractBillMapper.updateById(ywContractBill);
        //存储附件信息
        if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ywContractRevenue.getMultifileList())){
            for (Multifile multifile:ywContractRevenue.getMultifileList()) {
                if(Objects.isNull(multifile)
                        || StringUtils.isBlank(multifile.getFileurl())
                        || StringUtils.isBlank(multifile.getName())){
                    throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"附件信息错误");
                }
                multifile.setCreator(loginUserInfo.getId());
                multifile.setCreateDate(new Date());
                multifile.setIsdeleted(Constants.ZERO);
                multifile.setObjType(Constants.MultiFile.FN_CONTRACT_REVENUE_FILE.getKey());
                multifile.setObjId(ywContractRevenue.getId());
            }
            multifileMapper.insert(ywContractRevenue.getMultifileList());
        }
        return ywContractRevenue.getId();
    }
    @Override
    public void deleteById(Integer id) {
        ywContractRevenueMapper.deleteById(id);
    }
    @Override
    public void delete(YwContractRevenue ywContractRevenue) {
        UpdateWrapper<YwContractRevenue> deleteWrapper = new UpdateWrapper<>(ywContractRevenue);
        ywContractRevenueMapper.delete(deleteWrapper);
    }
    @Override
    public void deleteByIdInBatch(List<Integer> ids) {
        if (CollectionUtils.isEmpty(ids)) {
            return;
        }
        ywContractRevenueMapper.deleteBatchIds(ids);
    }
    @Override
    public void updateById(YwContractRevenue ywContractRevenue) {
        ywContractRevenueMapper.updateById(ywContractRevenue);
    }
    @Override
    public void updateByIdInBatch(List<YwContractRevenue> ywContractRevenues) {
        if (CollectionUtils.isEmpty(ywContractRevenues)) {
            return;
        }
        for (YwContractRevenue ywContractRevenue: ywContractRevenues) {
            this.updateById(ywContractRevenue);
        }
    }
    @Override
    public YwContractRevenue findById(Integer id) {
        return ywContractRevenueMapper.selectById(id);
    }
    @Override
    public YwContractRevenue getDetail(Integer id) {
        YwContractRevenue ywContractRevenue = ywContractRevenueMapper.selectJoinOne(
                YwContractRevenue.class,
                new MPJLambdaWrapper<YwContractRevenue>().selectAll(YwContractRevenue.class)
                        .selectAs(YwContractBill::getCode,YwContractRevenue::getBillCode)
                        .selectAs(YwContract::getCode,YwContractRevenue::getContractCode)
                        .selectAs(YwCustomer::getName,YwContractRevenue::getCustomerName)
                        .selectAs(SystemUser::getRealname,YwContractRevenue::getRealname)
                        .leftJoin(YwContractBill.class,YwContractBill::getId,YwContractRevenue::getBillId)
                        .leftJoin(YwContract.class,YwContract::getId,YwContractBill::getContractId)
                        .leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId)
                        .leftJoin(SystemUser.class,SystemUser::getId,YwContractRevenue::getCreator)
                        .eq(YwContractRevenue::getId,id)
        );
       this.getRecordData(ywContractRevenue);
        return ywContractRevenue;
    }
    /**
     * æ“ä½œè®°å½•
     * @param ywContractRevenue
     */
    public void getRecordData(YwContractRevenue ywContractRevenue){
        List<EditRecordDataVO> editRecordDataVOList = new ArrayList();
        //模拟流水记录
        if(Objects.nonNull(ywContractRevenue.getCreateDate())){
            EditRecordDataVO editRecordDataVO = new EditRecordDataVO();
            editRecordDataVO.setEditRemark("创建流水");
            editRecordDataVO.setEditTime(ywContractRevenue.getCreateDate());
            SystemUser createUser = systemUserMapper.selectById(ywContractRevenue.getCreator());
            if(Objects.nonNull(createUser)){
                editRecordDataVO.setEditUserName(createUser.getRealname());
            }
            editRecordDataVOList.add(editRecordDataVO);
        }
        if(Objects.nonNull(ywContractRevenue.getEditor())){
            EditRecordDataVO editRecordDataVO = new EditRecordDataVO();
            editRecordDataVO.setEditRemark("关闭流水");
            editRecordDataVO.setEditTime(ywContractRevenue.getEditDate());
            SystemUser closeUser = systemUserMapper.selectById(ywContractRevenue.getEditor());
            if(Objects.nonNull(closeUser)){
                editRecordDataVO.setEditUserName(closeUser.getRealname());
            }
            editRecordDataVOList.add(editRecordDataVO);
        }
        if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(editRecordDataVOList)){
            ywContractRevenue.setEditRecordDataVOList(editRecordDataVOList);
        }
    }
    @Override
    public void closeRevenue(Integer id,LoginUserInfo loginUserInfo) {
        YwContractRevenue ywContractRevenue = ywContractRevenueMapper.selectById(id);
        if(Objects.isNull(ywContractRevenue)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
        }
        YwContractBill ywContractBill = ywContractBillMapper.selectById(ywContractRevenue.getBillId());
        if(Objects.isNull(ywContractBill)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
        }
        YwContract ywContract = ywContractMapper.selectById(ywContractBill.getContractId());
        if(Objects.isNull(ywContract)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
        }
        if(Constants.equalsInteger(ywContract.getStatus(),Constants.THREE)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"合同状态已流转,无法操作");
        }
        if(Constants.equalsInteger(ywContractBill.getPayStatus(),Constants.ONE)
            || Constants.equalsInteger(ywContractBill.getPayStatus(),Constants.TWO)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"账单状态已流转,无法操作");
        }
        //查询账单下 æ‰€æœ‰çš„账单
        List<YwContractRevenue> ywContractRevenueList =  ywContractRevenueMapper.selectList(new QueryWrapper<YwContractRevenue>().lambda().eq(YwContractRevenue::getStatus,Constants.ZERO)
                        .eq(YwContractRevenue::getIsdeleted,Constants.ZERO)
                .eq(YwContractRevenue::getBillId,ywContractRevenue.getBillId())
                .ne(YwContractRevenue::getId,id)
        );
        if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(ywContractRevenueList)){
            //无其他流水记录 æ ¹æ®è´¦å•创建类型  å˜æ›´çŠ¶æ€
            //自建账单 æ ¹æ®è´¦å•收支类型进行 å˜æ›´çŠ¶æ€
            if(Constants.equalsInteger(ywContractBill.getType(),Constants.ONE)){
                if(Constants.equalsInteger(ywContractBill.getBillType(),Constants.ZERO)){
                    ywContractBill.setPayStatus(Constants.ZERO);
                }else{
                    ywContractBill.setPayStatus(Constants.THREE);
                }
            }else{
                //合同账单 å˜ä¸º å¾…收款
                ywContractBill.setPayStatus(Constants.ZERO);
            }
        }else{
            //存在其他流水 åˆ™ç»Ÿä¸€å˜æ›´ä¸º éƒ¨åˆ†ç»“ç®—
            ywContractBill.setPayStatus(Constants.TWO);
        }
        ywContractBillMapper.update(null,new UpdateWrapper<YwContractBill>().lambda()
                .set(YwContractBill::getPayStatus,ywContractBill.getPayStatus())
                .set(YwContractBill::getEditor,loginUserInfo.getId())
                .set(YwContractBill::getEditDate," now() ")
                .eq(YwContractBill::getId,ywContractBill.getId())
        );
        ywContractRevenueMapper.update(null,new UpdateWrapper<YwContractRevenue>().lambda()
                .set(YwContractRevenue::getStatus,Constants.ONE)
                .set(YwContractRevenue::getEditor,loginUserInfo.getId())
                .set(YwContractRevenue::getEditDate," now() ")
                .eq(YwContractRevenue::getId,id));
    }
    @Override
    public YwContractRevenue findOne(YwContractRevenue ywContractRevenue) {
        QueryWrapper<YwContractRevenue> wrapper = new QueryWrapper<>(ywContractRevenue);
        return ywContractRevenueMapper.selectOne(wrapper);
    }
    @Override
    public List<YwContractRevenue> findList(YwContractRevenue ywContractRevenue) {
        List<YwContractRevenue> ywContractRevenueList = ywContractRevenueMapper.selectJoinList(YwContractRevenue.class,new MPJLambdaWrapper<YwContractRevenue>()
                .selectAll(YwContractRevenue.class)
                .selectAs(YwCustomer::getName,YwContractRevenue::getCustomerNme)
                .leftJoin(YwContract.class,YwContract::getId,YwContractRevenue::getContractId)
                .leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId)
                .eq(YwContractRevenue::getStatus,Constants.ZERO)
                .eq(Objects.nonNull(ywContractRevenue) && Objects.nonNull(ywContractRevenue.getBillId()),YwContractRevenue::getBillId,ywContractRevenue.getBillId())
        );
        return ywContractRevenueList;
    }
    @Override
    public PageData<YwContractRevenue> findPage(PageWrap<YwContractRevenue> pageWrap) {
        IPage<YwContractRevenue> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
        MPJLambdaWrapper<YwContractRevenue> queryWrapper = new MPJLambdaWrapper<>();
        Utils.MP.blankToNull(pageWrap.getModel());
        YwContractRevenue model = pageWrap.getModel();
        IPage<YwContractRevenue> iPage = ywContractRevenueMapper.selectJoinPage(page,YwContractRevenue.class,
                queryWrapper.selectAll(YwContractRevenue.class)
                        .selectAs(YwContractBill::getCode,YwContractRevenue::getBillCode)
                         .selectAs(YwContract::getCode,YwContractRevenue::getContractCode)
                        .selectAs(YwCustomer::getName,YwContractRevenue::getCustomerName)
                        .selectAs(SystemUser::getRealname,YwContractRevenue::getRealname)
                        .leftJoin(YwContractBill.class,YwContractBill::getId,YwContractRevenue::getBillId)
                        .leftJoin(YwContract.class,YwContract::getId,YwContractBill::getContractId)
                        .leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId)
                        .leftJoin(SystemUser.class,SystemUser::getId,YwContractRevenue::getCreator)
                        .eq(YwContractRevenue::getIsdeleted,Constants.ZERO)
                        .like(Objects.nonNull(model)&&StringUtils.isNotBlank(model.getCustomerNme()),
                                YwCustomer::getName,model.getCustomerNme())
                        .eq(Objects.nonNull(model)&&Objects.nonNull(model.getPayType()),
                                YwContractRevenue::getPayType,model.getPayType())
                        .eq(Objects.nonNull(model)&&Objects.nonNull(model.getRevenueType()),
                                YwContractRevenue::getRevenueType,model.getRevenueType())
                        .ge(Objects.nonNull(model)&&Objects.nonNull(model.getPayDateStart()),YwContractRevenue::getActPayDate, Utils.Date.getStart(model.getPayDateStart()))
                        .le(Objects.nonNull(model)&&Objects.nonNull(model.getPayDateEnd()),YwContractRevenue::getActPayDate, Utils.Date.getEnd(model.getPayDateEnd())) )
                ;
        this.dealRoomDetail(iPage.getRecords());
        for (YwContractRevenue ywContractRevenue:iPage.getRecords()) {
            //楼宇名称
            List<YwContractRoom> ywContractRoomList = ywContractRevenue.getYwContractRoomList();
            StringBuilder roomPathName = new StringBuilder();
            for (YwContractRoom ywContractRoom:ywContractRoomList) {
                if(StringUtils.isNotBlank(ywContractRoom.getProjectName())){
                    roomPathName.append(ywContractRoom.getProjectName()+"/");
                }
                if(StringUtils.isNotBlank(ywContractRoom.getBuildingName())){
                    roomPathName.append(ywContractRoom.getBuildingName()+"/");
                }
                if(StringUtils.isNotBlank(ywContractRoom.getFloorName())){
                    roomPathName.append(ywContractRoom.getFloorName()+"/");
                }
                if(StringUtils.isNotBlank(ywContractRoom.getRoomName())){
                    roomPathName.append(ywContractRoom.getRoomName());
                }
                if(StringUtils.isNotBlank(roomPathName)){
                    roomPathName.append(";");
                }
            }
            ywContractRevenue.setRoomPathName(roomPathName.toString());
        }
        return PageData.from(iPage);
    }
    public void dealRoomDetail(List<YwContractRevenue> ywContractRevenueList){
        //查询账单下的楼宇数据
        if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ywContractRevenueList)){
            //获取所有数据
            List<Integer> billIdList = ywContractRevenueList.stream().map(i->i.getBillId()).collect(Collectors.toList());
            if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(billIdList)){
                List<YwContractRoom> ywContractRoomList  = ywContractRoomMapper.selectJoinList(YwContractRoom.class,new MPJLambdaWrapper<YwContractRoom>()
                        .selectAll(YwContractRoom.class)
                        .selectAs(YwProject::getName,YwRoom::getProjectName)
                        .selectAs(YwFloor::getName,YwRoom::getFloorName)
                        .selectAs(YwBuilding::getName,YwRoom::getBuildingName)
                        .selectAs(YwRoom::getName,YwContractRoom::getRoomName)
                        .leftJoin(YwRoom.class,YwRoom::getId,YwContractRoom::getRoomId)
                        .leftJoin(YwFloor.class,YwFloor::getId,YwRoom::getFloor)
                        .leftJoin(YwProject.class,YwProject::getId,YwRoom::getProjectId)
                        .leftJoin(YwBuilding.class,YwBuilding::getId,YwRoom::getBuildingId)
                        .in(YwContractRoom::getContractId,billIdList)
                        .eq(YwContractRoom::getType,Constants.ONE)
                );
                if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ywContractRoomList)){
                    for (YwContractRevenue ywContractRevenue:ywContractRevenueList) {
                        ywContractRevenue.setYwContractRoomList(
                                ywContractRoomList.stream().filter(i->Constants.equalsInteger(i.getContractId(),ywContractRevenue.getBillId())).collect(Collectors.toList())
                        );
                    }
                }
            }
        }
    }
    @Override
    public long count(YwContractRevenue ywContractRevenue) {
        QueryWrapper<YwContractRevenue> wrapper = new QueryWrapper<>(ywContractRevenue);
        return ywContractRevenueMapper.selectCount(wrapper);
    }
}