| | |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.dto.TBillDto; |
| | | import com.ruoyi.system.dto.TbillSaveDto; |
| | | import com.ruoyi.system.mapper.TBillMapper; |
| | | import com.ruoyi.system.model.TBill; |
| | | import com.ruoyi.system.model.TBillDetail; |
| | | import com.ruoyi.system.model.TContract; |
| | | import com.ruoyi.system.model.THouse; |
| | | import com.ruoyi.system.query.TBillQuery; |
| | | import com.ruoyi.system.service.TBillDetailService; |
| | | import com.ruoyi.system.service.TBillService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import io.jsonwebtoken.lang.Assert; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | |
| | | @Autowired |
| | | TBillMapper tBillMapper; |
| | | |
| | | @Autowired |
| | | TBillDetailService tBillDetailService; |
| | | |
| | | |
| | | public PageInfo<TBillDto> queryPage(TBillQuery query){ |
| | | PageInfo<TBill> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | PageInfo<TBillDto> info = tBillMapper.page(pageInfo, query); |
| | |
| | | return pageInfo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 传的金额 |
| | | * @param tBill |
| | | * @return |
| | | */ |
| | | public Boolean checkAndUpdateBill(TBill tBill){ |
| | | public Boolean lockAndUpdateInfo(TBill tBill){ |
| | | if (StringUtils.isEmpty(tBill.getId())){ |
| | | throw new ServiceException("账单主键ID不能为空"); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveBill(TbillSaveDto bill) { |
| | | save(bill); |
| | | if (bill.getBillType().equals("3")){ |
| | | if (bill.getDetails()==null || bill.getDetails().size()==0){ |
| | | throw new ServiceException("生活费用列表不能为空"); |
| | | } |
| | | for (TBillDetail detail : bill.getDetails()) { |
| | | detail.setBillId(bill.getId()); |
| | | tBillDetailService.save(detail); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |