| | |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.ruoyi.tms.domain.TmsArBillItem; |
| | | import com.ruoyi.tms.domain.TmsReceivableFee; |
| | | import com.ruoyi.tms.mapper.TmsArBillItemMapper; |
| | | import com.ruoyi.tms.mapper.TmsReceivableFeeMapper; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.scheduling.annotation.Async; |
| | |
| | | |
| | | @Resource |
| | | private TmsArBillItemMapper tmsArBillItemMapper; |
| | | |
| | | @Resource |
| | | private TmsReceivableFeeMapper tmsReceivableFeeMapper; |
| | | |
| | | /** |
| | | * 查询应收账单 |
| | |
| | | public TmsArBill selectTmsArBillById(Integer id) |
| | | { |
| | | TmsArBill tmsArBill = tmsArBillMapper.selectTmsArBillById(id); |
| | | tmsArBill.setItems(tmsArBillItemMapper.selectTmsArBillItemList(new TmsArBillItem(){{setBillId( id);}})); |
| | | tmsArBill.setItems(tmsArBillItemMapper.selectTmsArBillItemList(new TmsArBillItem(){{setBillId( id);setStatus(0);}})); |
| | | return tmsArBill; |
| | | } |
| | | |
| | |
| | | return tmsArBillMapper.insertTmsArBill(tmsArBill); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult cancelArBill(Integer id) { |
| | | |
| | | TmsArBillItem billItem = tmsArBillItemMapper.selectTmsArBillItemById(id); |
| | | if(billItem == null){ |
| | | return AjaxResult.warn("数据不存在"); |
| | | } |
| | | if(billItem.getStatus() == 1){ |
| | | return AjaxResult.warn("该数据已作废"); |
| | | } |
| | | billItem.setStatus(1); |
| | | tmsArBillItemMapper.updateTmsArBillItem(billItem); |
| | | tmsReceivableFeeMapper.update(new LambdaUpdateWrapper<TmsReceivableFee>() |
| | | .set(TmsReceivableFee::getStatus,0) |
| | | .in(TmsReceivableFee::getId, billItem.getArFeeId()) |
| | | ); |
| | | |
| | | tmsArBillMapper.update(new LambdaUpdateWrapper<TmsArBill>() |
| | | .setSql("settle_amount = settle_amount - " + billItem.getEstimateAmount()) |
| | | .setSql("actual_settlement_amount = actual_settlement_amount - " + billItem.getEstimateAmount()) |
| | | .eq(TmsArBill::getId, billItem.getBillId()) |
| | | ); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * 新增应收账单[批量] |
| | | * |