From d2d510bf43ac7a76363d2914095b8aafc9012adc Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期六, 26 十月 2024 11:26:37 +0800
Subject: [PATCH] merge

---
 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TShoppingOrder.java            |    4 ++++
 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TCharingOrderMapVO.java           |    2 ++
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java |   10 +++++++++-
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java |   10 +++++++++-
 4 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TShoppingOrder.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TShoppingOrder.java
index b1e370b..16a7aea 100644
--- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TShoppingOrder.java
+++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TShoppingOrder.java
@@ -156,6 +156,10 @@
     @TableField("refund_serial_number")
     private String refundSerialNumber;
 
+    @ApiModelProperty(value = "地址json")
+    @TableField("address_json")
+    private String addressJson;
+
     @ApiModelProperty(value = "退款成功时间")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @TableField("refund_time")
diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TCharingOrderMapVO.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TCharingOrderMapVO.java
index b2d3618..f9958b4 100644
--- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TCharingOrderMapVO.java
+++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TCharingOrderMapVO.java
@@ -16,4 +16,6 @@
     private List<Map<String,Object>> maps;
     @ApiModelProperty("下方折线图")
     private List<Map<String,Object>> maps1;
+    private BigDecimal allMoney;
+    private BigDecimal commissionAmount;
 }
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 0100bb5..d1971fb 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
@@ -937,8 +937,16 @@
 
 
         tCharingOrderMapVO.setMaps(maps);
+        BigDecimal allMoney = new BigDecimal(0);
+        for (Map<String, Object> map : maps) {
+            BigDecimal periodElectricPrice = (BigDecimal) map.get("period_electric_price");
+            allMoney = allMoney.add(periodElectricPrice);
+            BigDecimal total_amount = (BigDecimal) map.get("total_amount");
+            allMoney = allMoney.add(total_amount);
+        }
+        allMoney =  allMoney.multiply(new BigDecimal("0.006"));
 
-
+        tCharingOrderMapVO.setAllMoney(allMoney);
         return R.ok(tCharingOrderMapVO);
 
     }
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 3158616..68f7c00 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
@@ -5,9 +5,11 @@
 import java.time.LocalDateTime;
 
 
+import com.alibaba.fastjson2.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
 import com.ruoyi.account.api.feignClient.AppCouponClient;
+import com.ruoyi.account.api.feignClient.AppUserAddressClient;
 import com.ruoyi.account.api.feignClient.AppUserClient;
 import com.ruoyi.account.api.model.TAppUserAddress;
 import com.ruoyi.common.core.domain.R;
@@ -347,7 +349,9 @@
 		List<MyShoppingOrderList> list = shoppingOrderService.getNoInvoicedOrder(query);
 		return AjaxResult.success(list);
 	}
-	
+
+	@Resource
+	private AppUserAddressClient appUserAddressClient;
 	@PostMapping("/create")
 	public R<TShoppingOrder> shopCreate(@RequestBody ExchangeDto exchangeDto) {
 		TShoppingOrder shoppingOrder = new TShoppingOrder();
@@ -380,6 +384,10 @@
 		shoppingOrder.setPhone(exchangeDto.getPhone());
 		shoppingOrder.setCreateTime(LocalDateTime.now());
 		shoppingOrder.setDelFlag(false);
+
+
+		TAppUserAddress data = appUserAddressClient.getAppUserAddressById(exchangeDto.getAddressId()).getData();
+		shoppingOrder.setAddressJson(JSON.toJSONString(data));
 		shoppingOrderService.save(shoppingOrder);
 		
 		return R.ok(shoppingOrder);

--
Gitblit v1.7.1