| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.order.api.model.*; |
| | | import com.ruoyi.order.api.query.TOrderInvoiceQuery; |
| | | import com.ruoyi.order.api.vo.AccountListVO; |
| | |
| | | import com.ruoyi.order.api.vo.TOrderInvoiceVO; |
| | | import com.ruoyi.order.export.*; |
| | | import com.ruoyi.order.service.*; |
| | | import com.ruoyi.order.vo.StatisticsOfBatteryVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | |
| | | // chargingBillService.save(tChargingBill14); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/accountSettlementStatement"}, logical = Logical.OR) |
| | | @PostMapping(value = "/accountBillList") |
| | | @ApiOperation(value = "列表查询", tags = {"管理后台-账户结算账单"}) |
| | | public R<AccountListVO> accountBillList(@RequestBody ChargingListQuery dto) { |
| | |
| | | ChargingBillVO res = chargingBillService.chargingBillList1(dto); |
| | | List<ChargingBillListVO> records = res.getList().getRecords(); |
| | | accountListVO.setBillCount(records.size()); |
| | | accountListVO.setTotalAmount(res.getPaymentAmount().subtract(res.getRefundAmount()).subtract(res.getCommissionAmount()).subtract(res.getSharingAmount()).setScale(2, BigDecimal.ROUND_DOWN)); |
| | | accountListVO.setTotalAmount(res.getPaymentAmount().subtract(res.getCommissionAmount()).subtract(res.getSharingAmount()).setScale(2, BigDecimal.ROUND_DOWN)); |
| | | accountListVO.setPaymentAmount(res.getPaymentAmount().setScale(2, BigDecimal.ROUND_DOWN)); |
| | | accountListVO.setRefundAmount(res.getRefundAmount().setScale(2, BigDecimal.ROUND_DOWN)); |
| | | accountListVO.setCommissionAmount(res.getCommissionAmount().setScale(2, BigDecimal.ROUND_DOWN)); |
| | |
| | | accountListVO.setOrderList(res.getExportList()); |
| | | return R.ok(accountListVO); |
| | | } |
| | | |
| | | @RequiresPermissions(value = {"/chargeBill"}, logical = Logical.OR) |
| | | @PostMapping(value = "/chargingBillList") |
| | | @ApiOperation(value = "充电算帐单列表查询", tags = {"管理后台-充电算账单"}) |
| | | public AjaxResult<ChargingBillVO> chargingBillList(@RequestBody ChargingListQuery dto) { |
| | |
| | | public R<ChargingBillVO> chargingBillListExport(String uid) { |
| | | return R.ok(null); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargeBill/export"}, logical = Logical.OR) |
| | | @ApiOperation(value = "导出", tags = {"管理后台-充电算账单"}) |
| | | @PutMapping("/export") |
| | | public void export(@RequestBody ChargingListQuery dto) |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/accountSettlementStatement/export"}, logical = Logical.OR) |
| | | @ApiOperation(value = "导出", tags = {"管理后台-账户结算账单"}) |
| | | @PutMapping("/exportAccount") |
| | | public void exportAccount(@RequestBody ChargingListQuery dto) |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "下载-未出账", tags = {"管理后台-充电算账单"}) |
| | | @PutMapping("/download") |
| | | public void download(@RequestBody ExportUidDto uid) |
| | |
| | | chargingBillExport.setSiteName(data.get(0).getName()); |
| | | } |
| | | // // 根据账单的出账时间 查询上个月的充电订单 |
| | | // LocalDateTime localDate = byId.getBillTime().minusMonths(1); |
| | | LocalDateTime localDate = byId.getBillTime().minusMonths(1); |
| | | // // 账单周期 |
| | | // // 获取 LocalDate 对象 |
| | | // LocalDate date = localDate.toLocalDate(); |
| | | // // 获取该月份的第一天 |
| | | // LocalDate firstDayOfMonth = date.withDayOfMonth(1); |
| | | LocalDateTime localDate = byId.getBillTime().minusDays(1); |
| | | // todo 临时修改为前一天 |
| | | // 获取 LocalDate 对象 |
| | | LocalDate date = localDate.toLocalDate(); |
| | | // // 获取该月份的第一天 |
| | | // LocalDate firstDayOfMonth = date.withDayOfMonth(1); |
| | | // // 获取该月份的最后一天 |
| | | // LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth()); |
| | | // todo 临时修改为查询昨天凌晨00:00:00 到 23:59:59 |
| | | LocalDateTime firstDayOfMonth = LocalDateTime.of(date, LocalTime.MIN); |
| | | LocalDateTime lastDayOfMonth = LocalDateTime.of(date, LocalTime.MAX); |
| | | // 获取该月份的第一天 |
| | | LocalDate firstDayOfMonth = date.withDayOfMonth(1); |
| | | // 获取该月份的最后一天 |
| | | LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth()); |
| | | // 获取该月份的最后一天 |
| | | // LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth()); |
| | | QueryWrapper<TChargingOrder> eq = new QueryWrapper<TChargingOrder>() |
| | |
| | | int i =1; |
| | | for (TChargingOrder tChargingOrder : tChargingOrders) { |
| | | // 账单信息 |
| | | paymentAmount = paymentAmount.add(tChargingOrder.getRechargeAmount()); |
| | | commissionAmount = commissionAmount.add(tChargingOrder.getPaymentAmount().multiply(bigDecimal1).setScale(2, BigDecimal.ROUND_DOWN)); |
| | | if (!tChargingOrder.getOrderSource().equals(2)){ |
| | | chargingBillExport.setPaymentAmount(tChargingOrder.getRechargeAmount()); |
| | | paymentAmount = paymentAmount.add(tChargingOrder.getRechargeAmount()); |
| | | |
| | | }else{ |
| | | chargingBillExport.setPaymentAmount(tChargingOrder.getServiceCharge()!=null? |
| | | tChargingOrder.getServiceCharge().multiply(new BigDecimal("0.2")).setScale(2, BigDecimal.ROUND_DOWN) |
| | | :new BigDecimal("0")); |
| | | paymentAmount = paymentAmount.add(tChargingOrder.getServiceCharge()!=null? |
| | | tChargingOrder.getServiceCharge().multiply(new BigDecimal("0.2")).setScale(2, BigDecimal.ROUND_DOWN) |
| | | :new BigDecimal("0")); |
| | | |
| | | } |
| | | commissionAmount = commissionAmount.add(tChargingOrder.getRechargeAmount().multiply(bigDecimal1).setScale(2, BigDecimal.ROUND_DOWN)); |
| | | sharingAmount = sharingAmount.add(tChargingOrder.getSharingAmount()!=null?tChargingOrder.getSharingAmount():new BigDecimal("0")); |
| | | // 退款信息 |
| | | ChargingBillRefundExport chargingBillRefundExport = new ChargingBillRefundExport(); |
| | |
| | | } |
| | | chargingBillExport.setPaymentAmount(paymentAmount); |
| | | chargingBillExport.setRefundAmount(refundAmount); |
| | | chargingBillExport.setIncome(paymentAmount.subtract(refundAmount).subtract(commissionAmount) |
| | | .subtract(sharingAmount).setScale(2, BigDecimal.ROUND_DOWN)); |
| | | chargingBillExport.setIncome(paymentAmount.subtract(refundAmount) |
| | | .setScale(2, BigDecimal.ROUND_DOWN)); |
| | | chargingBillExports.add(chargingBillExport); |
| | | // 导出 |
| | | List<Map<String, Object>> sheetsList = new ArrayList<>(); |