| | |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 收款确认 |
| | |
| | | public R add(PaymentConfirmAddDTO addDTO) { |
| | | if (StrUtil.isNotBlank(addDTO.getContractNo())) { |
| | | Contract contract = contractService.getOne(Wrappers.<Contract>lambdaQuery().eq(Contract::getContractNo, addDTO.getContractNo())); |
| | | if (ObjUtil.isNull(contract)) { |
| | | return R.failed("合同查询失败,请检查合同编号"); |
| | | } |
| | | BusinessCustomer customer = businessCustomerService.getOne(Wrappers.<BusinessCustomer>lambdaQuery() |
| | | .eq(StrUtil.isNotBlank(addDTO.getBusGuestName()), BusinessCustomer::getRegisterName, addDTO.getBusGuestName()) |
| | | .eq(StrUtil.isNotBlank(addDTO.getBusGuestId()), BusinessCustomer::getId, addDTO.getBusGuestId())); |
| | |
| | | |
| | | entity.setBusGuestId(customer.getId()); |
| | | entity.setBusGuestName(customer.getRegisterName()); |
| | | entity.setBusinessType(""); |
| | | entity.setBusinessType("退款"); |
| | | entity.setTransationAmount(addDTO.getTransationAmount()); |
| | | BigDecimal newtotal = addDTO.getTransationAmount().multiply(new BigDecimal("-1")).add(lastConfirm.getTotalAmount()); |
| | | if (newtotal.compareTo(new BigDecimal("0")) > 0) { |
| | |
| | | } |
| | | baseMapper.insert(entity); |
| | | } |
| | | |
| | | @Override |
| | | public R queryAllBusinessType() { |
| | | return R.ok(baseMapper.selectList(Wrappers.<PaymentConfirm>lambdaQuery().select(PaymentConfirm::getBusinessType).isNotNull(PaymentConfirm::getBusinessType) |
| | | .groupBy(PaymentConfirm::getBusinessType)).stream().map(PaymentConfirm::getBusinessType).collect(Collectors.toList())); |
| | | } |
| | | } |