| | |
| | | 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.YwAccountMapper; |
| | | import com.doumee.dao.business.YwContractBillMapper; |
| | | import com.doumee.dao.business.YwContractRevenueMapper; |
| | | import com.doumee.dao.business.dao.CompanyMapper; |
| | | import com.doumee.dao.business.model.Company; |
| | | import com.doumee.dao.business.model.YwAccount; |
| | | import com.doumee.dao.business.model.YwContractBill; |
| | | import com.doumee.dao.business.model.YwContractRevenue; |
| | | import com.doumee.service.business.YwContractRevenueService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 运维合同收支流水Service实现 |
| | |
| | | @Autowired |
| | | private YwContractRevenueMapper ywContractRevenueMapper; |
| | | |
| | | @Autowired |
| | | private YwContractBillMapper ywContractBillMapper; |
| | | |
| | | @Autowired |
| | | private CompanyMapper companyMapper; |
| | | |
| | | @Autowired |
| | | private YwAccountMapper ywAccountMapper; |
| | | |
| | | @Override |
| | | 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()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | YwContractBill ywContractBill = ywContractBillMapper.selectById(ywContractRevenue.getBillId()); |
| | | if(Objects.isNull(ywContractBill)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.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()); |
| | | ywContractRevenue.setRevenueType(ywContractBill.getBillType()); |
| | | ywContractRevenueMapper.insert(ywContractRevenue); |
| | | //根据收支情况 更新账单数据 |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | return ywContractRevenue.getId(); |
| | | } |
| | | |