From 530c09f7b74bf21c0e9b464f3511936792d7f96a Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期五, 01 十一月 2024 15:54:16 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java | 31 ++++--- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java | 37 ++++---- ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java | 6 + ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TCoupon.java | 4 + ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java | 4 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java | 9 + ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TParkingRecord.java | 2 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TShoppingOrderMapper.xml | 1 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TExchangeOrderController.java | 40 ++++++++++ ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java | 31 ++++--- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java | 2 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml | 8 +- ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java | 2 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java | 14 ++- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TGoodsServiceImpl.java | 11 +- ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml | 4 16 files changed, 136 insertions(+), 70 deletions(-) diff --git a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TParkingRecord.java b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TParkingRecord.java index 81b5024..39343ad 100644 --- a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TParkingRecord.java +++ b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TParkingRecord.java @@ -123,5 +123,7 @@ @TableField("serialnumber") private String serialnumber; + @TableField(exist = false) + private String parkName; } diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java index 20929f8..19ec997 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java @@ -46,6 +46,12 @@ } @Override + public R<Integer> getSalesCountByGoodsIdgetCount(Integer goodId, Integer goodeType, Integer buyType) { + return null; + } + + + @Override public R<List<String>> getCodeByOrderId(String goodsIds) { return R.fail("根据订单ids查询现金购买优惠券订单编号:" + cause.getMessage()); } diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java index 210327e..02994b0 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java @@ -28,6 +28,8 @@ public R managementGiveVip(@RequestBody TGrantVip grantVip); @GetMapping("/t-exchange-order/getSalesCountByGoodsIds/{goodsIds}") R<List<Integer>> getSalesCountByGoodsId(@PathVariable("goodsIds") String goodsIds); + @GetMapping("/t-exchange-order/getCount") + R<Integer> getSalesCountByGoodsIdgetCount(@RequestParam("goodId") Integer goodId,@RequestParam("goodeType")Integer goodeType,@RequestParam("buyType")Integer buyType); /** * 管理后台 根据t_app_coupon订单购买或者兑换优惠券的订单编号 diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TCoupon.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TCoupon.java index ebe7621..5a99b2a 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TCoupon.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TCoupon.java @@ -122,6 +122,10 @@ @TableField(exist = false) private Integer useCount; + @ApiModelProperty(value = "销量") + @TableField(exist = false) + private Integer salesCount; + } diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java index 171a350..06a4e3f 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java @@ -229,17 +229,22 @@ siteList.setPageSize(99999); PageInfo<GetSiteListDTO> list = siteService.getSiteList(siteList); for (GetSiteListDTO record : list.getRecords()) { - Long count = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).eq(TChargingGun::getStatus, new int[]{3, 4, 5, 6}).count(); + List<Integer> c1 = new ArrayList<>(); + c1.add(3); + c1.add(4); + c1.add(5); + c1.add(6); + Long count = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).eq(TChargingGun::getStatus, 2).count(); record.setC1(count); - Long count1 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).eq(TChargingGun::getStatus, 2).count(); + Long count1 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).count(); record.setC2(count1); - Long count2 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).eq(TChargingGun::getStatus, new int[]{3, 4, 5, 6}).count(); + Long count2 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).eq(TChargingGun::getStatus, 2).count(); record.setK1(count2); - Long count3 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).eq(TChargingGun::getStatus, 2).count(); + Long count3 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).count(); record.setK2(count3); - Long count4 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).eq(TChargingGun::getStatus, new int[]{3, 4, 5, 6}).count(); + Long count4 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).eq(TChargingGun::getStatus, 2).count(); record.setM1(count4); - Long count5 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).eq(TChargingGun::getStatus, 2).count(); + Long count5 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).count(); record.setM2(count5); //利用率 @@ -295,14 +300,7 @@ @ApiOperation(value = "获取该充电站的利用率", tags = {"管理后台-数据分析-电站分析"}) public R getPercentByCityCode(@RequestBody ChargingPercentProvinceDto chargingPercentProvinceDto){ - if (chargingPercentProvinceDto.getDate1()==null){ - LocalDate today = LocalDate.now(); - LocalDate lastMonth = today.minusMonths(1); - LocalDate firstDayOfLastMonth = lastMonth.withDayOfMonth(1); - LocalDate lastDayOfLastMonth =lastMonth.withDayOfMonth(lastMonth.lengthOfMonth()); - chargingPercentProvinceDto.setDate1(firstDayOfLastMonth); - chargingPercentProvinceDto.setDate2(lastDayOfLastMonth); - } + @@ -316,6 +314,9 @@ List<GetSiteListDTO> records = siteService.getSiteList(siteList).getRecords(); List<Integer> collect = records.stream().map(GetSiteListDTO::getId).collect(Collectors.toList()); // 通过时间段获取和充电桩id获取各个充电站的充电订单 + if (chargingPercentProvinceDto.getDate1().equals(chargingPercentProvinceDto.getDate2())){ + chargingPercentProvinceDto.setDate2(chargingPercentProvinceDto.getDate1().plusDays(1)); + } List<ChargingOrderGroup> data = chargingOrderClient.getBySiteIdAndTime(chargingPercentProvinceDto).getData(); // 计算利用率展示 for (ChargingOrderGroup datum : data) { @@ -325,7 +326,7 @@ bigDecimal1 = bigDecimal1.add(chargingPile.getRatedPower()); } - long daysBetween = ChronoUnit.DAYS.between(chargingPercentProvinceDto.getDate1(), chargingPercentProvinceDto.getDate2()) + 1; + long daysBetween = ChronoUnit.DAYS.between(chargingPercentProvinceDto.getDate1(), chargingPercentProvinceDto.getDate2()); BigDecimal multiply = bigDecimal1.multiply(new BigDecimal("24")).multiply(BigDecimal.valueOf(daysBetween)); //得到利用率 BigDecimal divide = datum.getChargingCapacity().divide(multiply, 0, BigDecimal.ROUND_HALF_UP); diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java index 8c9284b..5d91a4c 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java @@ -70,7 +70,11 @@ .page(Page.of(query.getPageCurr(), query.getPageSize())); for (TParkingRecord record : page.getRecords()) { + TParkingLot byId = parkingLotService.getById(record.getParkingLotId()); record.setUid(record.getId().toString()); + if (byId!=null) { + record.setParkName(byId.getName()); + } } return R.ok(page); } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java index efc6208..53af2b7 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java @@ -365,17 +365,17 @@ } } // 时段总服务费 - BigDecimal bigDecimal = new BigDecimal("0"); List<TChargingOrderAccountingStrategy> list = chargingOrderAccountingStrategyService.lambdaQuery().eq(TChargingOrderAccountingStrategy::getChargingOrderId, strategyId).orderByDesc(TChargingOrderAccountingStrategy::getStartTime).list(); - + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); for (TChargingOrderAccountingStrategy tChargingOrderAccountingStrategy : list) { + String format = tChargingOrderAccountingStrategy.getCreateTime().format(formatter); + tChargingOrderAccountingStrategy.setStartTime(format+" "+tChargingOrderAccountingStrategy.getStartTime()); + tChargingOrderAccountingStrategy.setEndTime(format+" "+tChargingOrderAccountingStrategy.getEndTime()); if (byId.getVipDiscountAmount()!=null && byId.getServiceCharge().compareTo(BigDecimal.ZERO) != 0){ BigDecimal multiply = byId.getVipDiscountAmount().divide(byId.getServiceCharge(), 2) .multiply(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); tChargingOrderAccountingStrategy.setVipDiscount(multiply); } - bigDecimal = bigDecimal.add(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); - if (byId.getCouponDiscountAmount()!=null && byId.getServiceCharge().compareTo(BigDecimal.ZERO) != 0){ BigDecimal multiply = byId.getCouponDiscountAmount().divide(byId.getServiceCharge(), 2) .multiply(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); @@ -1186,6 +1186,8 @@ tCharingUserMapVO.setMap(charMap); tCharingUserMapVO.setMap1(charMap1); }else { + + List<Map<String,Object>> map = chargingOrderService.usersByQuery(statisticsQueryDto); @@ -1805,8 +1807,8 @@ EndOfChargePageInfo endOfChargePageInfo = chargingOrderService.getEndOfChargePageInfo(id); return AjaxResult.success(endOfChargePageInfo); } - - + + /** * 获取订单数据 * @param order diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TExchangeOrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TExchangeOrderController.java index e179dab..7d688c5 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TExchangeOrderController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TExchangeOrderController.java @@ -237,6 +237,46 @@ } return R.ok(res); } + + @GetMapping("/getCount") + public R<Integer> getCount(@RequestParam("goodId") Integer goodId,@RequestParam("goodeType")Integer goodeType,@RequestParam("buyType")Integer buyType){ + if (buyType==1){ + //现金 + if (goodeType==1){ + //商品 + Integer reduce = tShoppingOrderService.list(new QueryWrapper<TShoppingOrder>() + .eq("order_type",1) + .eq("goods_id", goodId) + .isNull("refund_status")) + .stream().map(TShoppingOrder::getPurchaseQuantity).reduce(0, Integer::sum); + return R.ok(reduce); + }else { + //优惠券 + Integer reduce = tShoppingOrderService.list(new QueryWrapper<TShoppingOrder>() + .eq("order_type",2) + .eq("coupon_id", goodId) + .isNull("refund_status")) + .stream().map(TShoppingOrder::getPurchaseQuantity).reduce(0, Integer::sum); + return R.ok(reduce); + } + + }else { + //兑换 + if (goodeType==1){ + Integer reduce = exchangeOrderService.list(new QueryWrapper<TExchangeOrder>().eq("order_type",1) + .ne("status",4).eq("goods_id", goodId)) + .stream().map(TExchangeOrder::getPurchaseQuantity).reduce(0, Integer::sum); + return R.ok(reduce); + }else { + Integer reduce = exchangeOrderService.list(new QueryWrapper<TExchangeOrder>().eq("order_type",2) + .ne("status",4).eq("coupon_id", goodId)) + .stream().map(TExchangeOrder::getPurchaseQuantity).reduce(0, Integer::sum); + return R.ok(reduce); + } + } + + + } /** * 管理后台 根据t_app_coupon订单ids查询优惠券的订单编号 * @param goodsIds 订单号-商品类型 diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java index a1649f7..f7268d3 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java @@ -191,7 +191,7 @@ // todo 根据支付方式 取消订单 byId.setCancellationId(userid); byId.setCancellationTime(LocalDateTime.now()); - byId.setStatus(4); + byId.setStatus(5); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); TShoppingOrderRefund tShoppingOrderRefund = new TShoppingOrderRefund(); tShoppingOrderRefund.setPayTime(byId.getPayTime()); diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java index bb69665..bcdc67a 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java @@ -101,6 +101,9 @@ BigDecimal refundAmount = new BigDecimal("0"); int orderCount = 0; for (ChargingBillListVO chargingBillListVO : list) { + if (chargingBillListVO.getType()==2){ + continue; + } String temp = ""; String temp1 = ""; switch (chargingBillListVO.getType()){ @@ -250,10 +253,10 @@ } if (data3!=null)tChargingOrder.setUserName(data3.getName()); // 累加实收金额 支付结算金额 - if (tChargingOrder.getOrderAmount()!=null){ - paymentAmount = paymentAmount.add(tChargingOrder.getOrderAmount()); + if (tChargingOrder.getChargeAmount()!=null){ + paymentAmount = paymentAmount.add(tChargingOrder.getChargeAmount()); } - // 入账金额 + // 总金额 if (tChargingOrder.getOrderAmount()!=null){ orderAmount = orderAmount.add(tChargingOrder.getOrderAmount()); } @@ -264,7 +267,9 @@ List<TChargingOrderRefund> list2 = chargingOrderRefundService.lambdaQuery().eq(TChargingOrderRefund::getRefundStatus, 2) .eq(TChargingOrderRefund::getChargingOrderId, tChargingOrder.getId()).list(); for (TChargingOrderRefund tChargingOrderRefund : list2) { - refundAmount = refundAmount.add(tChargingOrderRefund.getRefundTotalAmount()); + if (tChargingOrderRefund.getRefundStatus()==2){ + refundAmount = refundAmount.add(tChargingOrderRefund.getRefundTotalAmount()); + } } // 累加累计服务费 if (tChargingOrder.getServiceCharge()!=null){ @@ -272,7 +277,7 @@ } // 累加平台手续费 if (tChargingOrder.getOrderAmount()!=null){ - commissionAmount = commissionAmount.add(tChargingOrder.getOrderAmount().multiply(BigDecimal.valueOf(0.006))); + commissionAmount = commissionAmount.add(tChargingOrder.getPaymentAmount().multiply(BigDecimal.valueOf(0.006))); } // 累加平台分佣 if (tChargingOrder.getSharingAmount()!=null){ @@ -295,18 +300,17 @@ chargingBillVO.setPaymentAmount(BigDecimal.ZERO); } - chargingBillVO.setOrderAmount(chargingBillVO.getPaymentAmount().subtract(chargingBillVO.getRefundAmount()==null?BigDecimal.ZERO:chargingBillVO.getRefundAmount()) - .subtract(chargingBillVO.getCommissionAmount()==null?BigDecimal.ZERO:chargingBillVO.getCommissionAmount()) - .subtract(chargingBillVO.getSharingAmount()==null?BigDecimal.ZERO:chargingBillVO.getSharingAmount())); - chargingBillListVO.setPaymentAmount(paymentAmount == null?BigDecimal.ZERO:paymentAmount); - chargingBillListVO.setOrderAmount(orderAmount == null?BigDecimal.ZERO:orderAmount.subtract(refundAmount).subtract(commissionAmount).subtract(sharingAmount)); + chargingBillListVO.setOrderAmount(chargingBillVO.getPaymentAmount().subtract(chargingBillVO.getRefundAmount()==null?BigDecimal.ZERO:chargingBillVO.getRefundAmount())); + chargingBillListVO.setPaymentAmount(paymentAmount); + chargingBillListVO.setOrderAmount(orderAmount == null?BigDecimal.ZERO:orderAmount.subtract(sharingAmount).subtract(commissionAmount)); chargingBillListVO.setRefundAmount(refundAmount == null?BigDecimal.ZERO:refundAmount); chargingBillListVO.setElectrovalence(electrovalence == null?BigDecimal.ZERO:electrovalence); chargingBillListVO.setServiceCharge(serviceCharge == null?BigDecimal.ZERO:serviceCharge); chargingBillListVO.setCommissionAmount(commissionAmount == null?BigDecimal.ZERO:commissionAmount.setScale(2, RoundingMode.HALF_DOWN)); chargingBillListVO.setSharingAmount(sharingAmount == null?BigDecimal.ZERO:sharingAmount); chargingBillListVO.setChargingCapacity(chargingCapacity == null?BigDecimal.ZERO:chargingCapacity); - chargingBillListVO.setBillMoney(chargingBillListVO.getPaymentAmount().subtract(chargingBillListVO.getRefundAmount()==null?BigDecimal.ZERO:chargingBillListVO.getRefundAmount()) + chargingBillListVO.setBillMoney(chargingBillListVO.getPaymentAmount().subtract(chargingBillListVO.getRefundAmount()==null?BigDecimal.ZERO:chargingBillListVO.getRefundAmount() + .subtract(commissionAmount).subtract(sharingAmount)) .subtract(chargingBillListVO.getCommissionAmount()==null?BigDecimal.ZERO:chargingBillListVO.getCommissionAmount()) .subtract(chargingBillListVO.getSharingAmount()==null?BigDecimal.ZERO:chargingBillListVO.getSharingAmount())); switch (chargingBillListVO.getType()){ @@ -359,11 +363,8 @@ chargingBillVO.setCategory(""); chargingBillVO.setExportList(tChargingOrders); for (TChargingOrder tChargingOrder : tChargingOrders) { - if (tChargingOrder.getRefundAmount()!=null && tChargingOrder.getPaymentAmount()!=null){ - paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getPaymentAmount()); - - }else if (tChargingOrder.getPaymentAmount()!=null){ - paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getPaymentAmount()); + if (tChargingOrder.getOrderAmount()!=null){ + paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getChargeAmount()); } // 累加订单金额 @@ -377,7 +378,7 @@ List<TChargingOrderRefund> list2 = chargingOrderRefundService.lambdaQuery().eq(TChargingOrderRefund::getChargingOrderId, tChargingOrder.getId()) .eq(TChargingOrderRefund::getRefundStatus, 2).list(); for (TChargingOrderRefund tChargingOrderRefund : list2) { - refundAmountTotal =refundAmountTotal.add(tChargingOrder.getRefundAmount()); + refundAmountTotal =refundAmountTotal.add(tChargingOrderRefund.getRefundAmount()); } // 累加累计服务费 if (tChargingOrder.getServiceCharge()!=null){ @@ -407,7 +408,7 @@ } chargingBillVO.setChargingCapacity(chargingCapacityTotal); chargingBillVO.setPaymentAmount(paymentAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); - chargingBillVO.setOrderAmount(orderAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); + chargingBillVO.setOrderAmount(paymentAmountTotal.subtract(refundAmountTotal).subtract(commissionAmountTotal).subtract(sharingAmountTotal)); chargingBillVO.setElectrovalence(electrovalenceTotal.setScale(2, RoundingMode.HALF_DOWN)); chargingBillVO.setServiceCharge(serviceChargeTotal.setScale(2, RoundingMode.HALF_DOWN)); chargingBillVO.setOrderCount(orderCount); diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java index 33bd961..583675f 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java @@ -1206,8 +1206,8 @@ BigDecimal electronicMoney = new BigDecimal("0"); BigDecimal serviceMoney = new BigDecimal("0"); for (ChargingOrderVO chargingOrderVO : list) { - chargingOrderVO.setCommissionAmount(chargingOrderVO.getServiceCharge().multiply(new BigDecimal("0.006"))); - chargingOrderVO.setPlatFormMoney(chargingOrderVO.getServiceCharge().multiply(new BigDecimal("0.006"))); + chargingOrderVO.setCommissionAmount(chargingOrderVO.getOrderAmount().multiply(new BigDecimal("0.006"))); + chargingOrderVO.setPlatFormMoney(chargingOrderVO.getOrderAmount().multiply(new BigDecimal("0.006"))); chargingOrderVO.setUid(chargingOrderVO.getId()+""); TChargingGun data3 = chargingGunClient.getChargingGunById(chargingOrderVO.getChargingGunId()).getData(); TChargingPile data2 = chargingPileClient.getChargingPileById(chargingOrderVO.getChargingPileId()).getData(); @@ -1399,12 +1399,11 @@ List<ChargingOrderListVO> list = this.baseMapper.chargingList(pageInfo,dto,startTime1,startTime2,endTime1,endTime2); for (ChargingOrderListVO chargingOrderListVO : list) { chargingOrderListVO.setChargingCapacity(chargingOrderListVO.getElectricity()); - chargingOrderListVO.setPaymentAmount(chargingOrderListVO.getPaymentAmount()); BigDecimal bigDecimal = new BigDecimal("0.006"); if (chargingOrderListVO.getOrderAmount()!=null){ chargingOrderListVO.setCommissionAmount(chargingOrderListVO.getOrderAmount().multiply(bigDecimal)); } - chargingOrderListVO.setPaymentAmount(chargingOrderListVO.getResidualAmount()==null?chargingOrderListVO.getPaymentAmount():chargingOrderListVO.getPaymentAmount()); + chargingOrderListVO.setPaymentAmount(chargingOrderListVO.getPaymentAmount()); chargingOrderListVO.setUid(chargingOrderListVO.getId()+""); List<Integer> integers = new ArrayList<>(); integers.add(chargingOrderListVO.getSiteId()); @@ -1423,7 +1422,7 @@ UploadRealTimeMonitoringData data5 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrderListVO.getCode()).getData(); if (data5!=null){ if (data5.getTime_remaining()!=null){ - chargingOrderListVO.setChargingSecond(data5.getTime_remaining()*60L); + chargingOrderListVO.setChargingSecond(data5.getCumulative_charging_time()*60L); } } @@ -1432,8 +1431,8 @@ List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataClient.getDataByOrderCode(chargingOrderListVO.getCode()).getData(); if (data6!=null && !data6.isEmpty()){ // 第一条数据soc为开始 最后一条数据soc为结束soc - chargingOrderListVO.setStartSoc(data6.get(0).getSoc().toString()); - chargingOrderListVO.setEndSoc(data6.get(data6.size()-1).getSoc().toString()); + chargingOrderListVO.setEndSoc(data6.get(0).getSoc().toString()); + chargingOrderListVO.setStartSoc(data6.get(data6.size()-1).getSoc().toString()); } } @@ -1613,9 +1612,7 @@ @Override public ChargingOrderListInfoVO chargingInfo(String uid) { TChargingOrder chargingOrder= this.getById(uid); - ChargingOrderListInfoVO chargingOrderListInfoVO = new ChargingOrderListInfoVO(); - chargingOrderListInfoVO.setStatus(chargingOrder.getStatus()); BigDecimal bigDecimal = new BigDecimal("0.006"); if (chargingOrder.getOrderAmount()!=null){ @@ -1664,24 +1661,32 @@ if (uploadRealTimeMonitoringData.getOutput_current()!=null&& uploadRealTimeMonitoringData.getOutput_voltage()!=null){ uploadRealTimeMonitoringData.setPower(uploadRealTimeMonitoringData.getOutput_voltage() - .multiply(uploadRealTimeMonitoringData.getOutput_current())); + .multiply(uploadRealTimeMonitoringData.getOutput_current()).divide(new BigDecimal(1000),2, BigDecimal.ROUND_HALF_UP)); } } if (!data6.isEmpty()){ // 第一条数据soc为开始 最后一条数据soc为结束soc - chargingOrderListInfoVO.setStartSoc(data6.get(0).getSoc().toString()); - chargingOrderListInfoVO.setEndSoc(data6.get(data6.size()-1).getSoc().toString()); + chargingOrderListInfoVO.setStartSoc(data6.get(data6.size()-1).getSoc().toString()); + chargingOrderListInfoVO.setEndSoc(data6.get(0).getSoc().toString()); chargingOrderListInfoVO.setChargingCapacity(data6.get(data6.size()-1).getCharging_degree()); - chargingOrderListInfoVO.setChargingSecond(data6.get(data6.size()-1).getCumulative_charging_time()*60+""); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); for (UploadRealTimeMonitoringData uploadRealTimeMonitoringData : data6) { uploadRealTimeMonitoringData.setCreateTime(simpleDateFormat.format(uploadRealTimeMonitoringData.getCreate_time())); } } } + chargingOrderListInfoVO.setList(data6); } + // 获取充电时间 + UploadRealTimeMonitoringData data5 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrder.getCode()).getData(); + if (data5!=null){ + if (data5.getTime_remaining()!=null){ + chargingOrderListInfoVO.setChargingSecond(data5.getCumulative_charging_time()*60L+""); + } + } if (chargingOrder.getAppUserCarId()!=null){ List<TAppUserCar> data3 = appUserCarClient.getCarByIds(Collections.singletonList(chargingOrder.getAppUserCarId())).getData(); diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml index f126021..71bb06e 100644 --- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml +++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml @@ -93,7 +93,7 @@ and t1.status = #{req.status} </if> <if test="req.orderSource != null and req.orderSource != 1 "> - and t1.orderSource = #{req.orderSource} + and t1.order_source = #{req.orderSource} </if> <if test="req.siteId != null "> and t1.site_id = #{req.siteId} @@ -702,10 +702,10 @@ </if> <if test="statisticsQueryDto.dayType ==5"> <if test="statisticsQueryDto.startTime != null"> - AND create_time >= #{statisticsQueryDto.startTime} + AND DATE(create_time) >= #{statisticsQueryDto.startTime} </if> <if test="statisticsQueryDto.endTime != null"> - AND create_time <= #{statisticsQueryDto.endTime} + AND DATE(create_time) <= #{statisticsQueryDto.endTime} </if> </if> GROUP BY @@ -850,7 +850,7 @@ </select> <select id="chargingList" resultType="com.ruoyi.order.api.vo.ChargingOrderListVO"> - select t1.* ,t1.current as chargingCapacity,t1.recharge_amount as paymentAmount,t1.electricity as chargingCapacity from t_charging_order t1 + select t1.* ,t1.current as chargingCapacity,t1.payment_amount as paymentAmount,t1.electricity as chargingCapacity from t_charging_order t1 where 1=1 <if test="null != req.code and req.code!=''"> and t1.code LIKE CONCAT('%',#{req.code},'%') diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TShoppingOrderMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TShoppingOrderMapper.xml index 31e9d7b..decc40a 100644 --- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TShoppingOrderMapper.xml +++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TShoppingOrderMapper.xml @@ -94,7 +94,6 @@ </if> and (t1.vip_discount_amount > 0 or t1.coupon_discount_amount > 0) and t1.recharge_payment_status =2 - and t1.refund_status !=2 AND t1.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} </if> </if> diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java index 3ea9ee4..c003b2e 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java @@ -125,7 +125,7 @@ @GetMapping("/getInfoByType") @ApiOperation(tags = {"小程序-兑换商城"},value = "商品查看详情") - public R getInfoByType(Integer goodType,Integer id) { + public R getInfoByType(Integer goodType,Integer id,Integer type) { if (goodType==1){ TGoods byId = goodsService.getById(id); if (byId==null||byId.getStatus()==2){ @@ -135,7 +135,8 @@ // for (int i = 0; i < list.size(); i++) { // list.get(i).setSalesCount(data.get(i)); // } - + Integer data = orderClient.getSalesCountByGoodsIdgetCount(byId.getId(), 1, type).getData(); + byId.setSalesCount(data); return R.ok(byId); } else { @@ -143,7 +144,9 @@ if (byId==null||byId.getStatus()==2){ return R.fail(2,"该商品已不存在"); } - return R.ok(byId); + Integer data = orderClient.getSalesCountByGoodsIdgetCount(byId.getId(),2, type).getData(); + byId.setSalesCount(data); + return R.ok(byId); } } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TGoodsServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TGoodsServiceImpl.java index 5f390ad..d5e2f68 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TGoodsServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TGoodsServiceImpl.java @@ -78,14 +78,11 @@ pageInfo.setRecords(list); return pageInfo; } - String string = stringBuilder.toString(); - // 订单号加上商品类型 - String res = string+"-"+basePage.getType(); - - List<Integer> data = orderClient.getSalesCountByGoodsId(res).getData(); - for (int i = 0; i < list.size(); i++) { - list.get(i).setSalesCount(data.get(i)); + for (TGoods tGoods : list) { + Integer data = orderClient.getSalesCountByGoodsIdgetCount(tGoods.getId(), tGoods.getGoodType(), basePage.getType()).getData(); + tGoods.setSalesCount(data); } + pageInfo.setRecords(list); return pageInfo; } diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml index c8879ee..4351904 100644 --- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml +++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml @@ -55,13 +55,13 @@ <select id="pageList1" resultType="com.ruoyi.other.api.domain.TGoods"> SELECT - id,name,redeem_points as redeemPoints,inventory,original_price as originalPrice ,preferential_price as preferentialPrice,vip_price as vipPrice,1 as goodType,cover_picture as coverPicture + id,name,redeem_points as redeemPoints,inventory,original_price as originalPrice ,preferential_price as preferentialPrice,vip_price as vipPrice,1 as goodType,cover_picture as coverPicture,underlying_sales as underlyingSales FROM t_goods WHERE `status` = 1 and del_flag = 0 and type = #{appGoodQuery.type} UNION ALL SELECT - id,name,redeem_points as redeemPoints,inventory_quantity as inventory,payment_amount as originalPrice,payment_amount as preferentiaPrice,vip_payment_amount as vipPrice,2 as goodType,cover_picture as coverPicture + id,name,redeem_points as redeemPoints,inventory_quantity as inventory,payment_amount as originalPrice,payment_amount as preferentiaPrice,vip_payment_amount as vipPrice,2 as goodType,cover_picture as coverPicture,0 as underlyingSales FROM t_coupon WHERE `status`= 1 and del_flag = 0 and ways_to_obtain != #{appGoodQuery.type} -- Gitblit v1.7.1