| | |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.YwAccountMapper; |
| | | 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.YwContractRevenue; |
| | | import com.doumee.dao.business.model.YwProject; |
| | | import com.doumee.service.business.YwAccountService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | 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.util.CollectionUtils; |
| | |
| | | private YwAccountMapper ywAccountMapper; |
| | | @Autowired |
| | | private CompanyMapper companyMapper; |
| | | @Autowired |
| | | private YwContractRevenueMapper ywContractRevenueMapper; |
| | | |
| | | @Override |
| | | public Integer create(YwAccount model) { |
| | |
| | | || !Constants.equalsInteger(ywProject.getType(),Constants.TWO)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,请选择正确的公司信息!"); |
| | | } |
| | | if(StringUtils.isNotBlank(model.getTitle())){ |
| | | if(ywAccountMapper.selectCount(new QueryWrapper<YwAccount>().lambda() |
| | | .eq(YwAccount::getTitle,model.getTitle()) |
| | | .eq(YwAccount::getIsdeleted,Constants.ZERO)) >0){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,收支条目不能重复~"); |
| | | } |
| | | } |
| | | |
| | | |
| | | model.setCreator(model.getLoginUserInfo().getId()); |
| | | model.setIsdeleted(Constants.ZERO); |
| | | model.setCreateDate(new Date()); |
| | |
| | | |
| | | @Override |
| | | public void deleteById(Integer id, LoginUserInfo user) { |
| | | if(ywContractRevenueMapper.selectCount(new QueryWrapper<YwContractRevenue>().lambda().eq(YwContractRevenue::getAccountId,id))>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"当前收支账户已关联业务,不可删除"); |
| | | } |
| | | YwAccount model = new YwAccount(); |
| | | model.setId(id); |
| | | model.setIsdeleted(Constants.ONE); |
| | |
| | | || !Constants.equalsInteger(ywProject.getType(),Constants.TWO)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,请选择正确的公司信息!"); |
| | | } |
| | | if(StringUtils.isNotBlank(model.getTitle())){ |
| | | if(ywAccountMapper.selectCount(new QueryWrapper<YwAccount>().lambda() |
| | | .eq(YwAccount::getTitle,model.getTitle()) |
| | | .ne(YwAccount::getId,model.getId()) |
| | | .eq(YwAccount::getIsdeleted,Constants.ZERO)) >0){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,收支条目不能重复~"); |
| | | } |
| | | } |
| | | |
| | | model.setEditDate(model.getCreateDate()); |
| | | model.setEditor(model.getCreator()); |
| | | ywAccountMapper.updateById(model); |