From c40f67835aba57f9e1829a40bb34debcc16c0848 Mon Sep 17 00:00:00 2001
From: 彭雪彬 <1724387007@qq.com>
Date: Fri, 11 Jul 2025 12:25:07 +0800
Subject: [PATCH] 骑手同步数据添加钱包信息
---
oying-system/src/main/java/com/oying/modules/rider/utils/RiderSourceHttpUtils.java | 36 +++++++++++-------
oying-system/src/main/java/com/oying/modules/rider/domain/RiderSourceInfoHttp.java | 2 -
oying-system/src/main/java/com/oying/modules/rider/utils/Constants.java | 15 ++++++-
oying-system/src/main/java/com/oying/modules/rider/service/impl/RiderInfoServiceImpl.java | 22 +++++++++++
4 files changed, 57 insertions(+), 18 deletions(-)
diff --git a/oying-system/src/main/java/com/oying/modules/rider/domain/RiderSourceInfoHttp.java b/oying-system/src/main/java/com/oying/modules/rider/domain/RiderSourceInfoHttp.java
index 21d47c9..89750da 100644
--- a/oying-system/src/main/java/com/oying/modules/rider/domain/RiderSourceInfoHttp.java
+++ b/oying-system/src/main/java/com/oying/modules/rider/domain/RiderSourceInfoHttp.java
@@ -14,8 +14,6 @@
@Setter
public class RiderSourceInfoHttp implements Serializable {
- private String success;
-
private String code;
private String message;
diff --git a/oying-system/src/main/java/com/oying/modules/rider/service/impl/RiderInfoServiceImpl.java b/oying-system/src/main/java/com/oying/modules/rider/service/impl/RiderInfoServiceImpl.java
index 74eedd1..490c1b3 100644
--- a/oying-system/src/main/java/com/oying/modules/rider/service/impl/RiderInfoServiceImpl.java
+++ b/oying-system/src/main/java/com/oying/modules/rider/service/impl/RiderInfoServiceImpl.java
@@ -6,6 +6,8 @@
import com.oying.modules.rider.domain.RiderInfo;
import com.oying.modules.rider.domain.RiderSourceInfo;
import com.oying.modules.rider.domain.RiderSourceInfoHttp;
+import com.oying.modules.rider.domain.RiderWalletInfo;
+import com.oying.modules.rider.service.RiderWalletInfoService;
import com.oying.modules.rider.utils.Constants;
import com.oying.modules.rider.utils.RiderSourceHttpUtils;
import com.oying.utils.FileUtil;
@@ -20,6 +22,7 @@
import org.springframework.transaction.annotation.Transactional;
import com.oying.utils.PageUtil;
+import java.math.BigDecimal;
import java.util.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
@@ -36,6 +39,8 @@
public class RiderInfoServiceImpl extends ServiceImpl<RiderInfoMapper, RiderInfo> implements RiderInfoService {
private final RiderInfoMapper riderInfoMapper;
+
+ private final RiderWalletInfoService riderWalletInfoService;
@Override
public PageResult<RiderInfo> queryAll(RiderInfoQueryCriteria criteria, Page<Object> page) {
@@ -112,6 +117,23 @@
newRiderInfo.setRiderId(riderId);
newRiderInfo.setSourcePlatform(sourcePlatform);
create(newRiderInfo);
+ // 创建骑手钱包信息 正常
+ RiderWalletInfo riderWalletInfo = new RiderWalletInfo();
+ riderWalletInfo.setRiderId(riderId);
+ riderWalletInfo.setAmount(new BigDecimal(0.00));
+ riderWalletInfo.setAvailableBalance(new BigDecimal(0.00));
+ riderWalletInfo.setPurchasingElectricityAmount(new BigDecimal(0.00));
+ riderWalletInfo.setWithdrawTotal(new BigDecimal(0.00));
+ riderWalletInfo.setIncomeTotal(new BigDecimal(0.00));
+ riderWalletInfo.setFrozenAmount(new BigDecimal(0.00));
+ riderWalletInfo.setRunTotal(Constants.ZERO);
+ riderWalletInfo.setCashWithdrawalTotal(Constants.ZERO);
+ riderWalletInfo.setPurchasingElectricityTotal(Constants.ZERO);
+ riderWalletInfo.setStatus(Constants.WALLET_STATUS_NORMAL);
+ riderWalletInfo.setPhone(infoHttpData.getPhone());
+ riderWalletInfo.setCardName(infoHttpData.getCardName());
+ riderWalletInfo.setCardNum(infoHttpData.getCardNum());
+ riderWalletInfoService.create(riderWalletInfo);
} else {
// 是否相同平台
if (sourcePlatform.equals(riderInfo.getSourcePlatform())) {
diff --git a/oying-system/src/main/java/com/oying/modules/rider/utils/Constants.java b/oying-system/src/main/java/com/oying/modules/rider/utils/Constants.java
index 21c3053..929139b 100644
--- a/oying-system/src/main/java/com/oying/modules/rider/utils/Constants.java
+++ b/oying-system/src/main/java/com/oying/modules/rider/utils/Constants.java
@@ -24,6 +24,17 @@
/**
* 状态 0不生效,1生效 其他平台是否满足接单的条件
*/
- String SOURCE_ENABLED_ON = "0";
- String SOURCE_ENABLED_DFF = "1";
+ String SOURCE_ENABLED_ON = "1";
+ String SOURCE_ENABLED_DFF = "0";
+
+ /**
+ * 初始值0
+ */
+ Integer ZERO = 0;
+
+ /**
+ * 钱包状态(0冻结,1正常)
+ */
+ String WALLET_STATUS_NORMAL = "1";
+ String WALLET_STATUS_FROZEN = "0";
}
diff --git a/oying-system/src/main/java/com/oying/modules/rider/utils/RiderSourceHttpUtils.java b/oying-system/src/main/java/com/oying/modules/rider/utils/RiderSourceHttpUtils.java
index 3e777aa..191cbda 100644
--- a/oying-system/src/main/java/com/oying/modules/rider/utils/RiderSourceHttpUtils.java
+++ b/oying-system/src/main/java/com/oying/modules/rider/utils/RiderSourceHttpUtils.java
@@ -6,6 +6,7 @@
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
+import com.oying.modules.rider.domain.RiderSourceInfo;
import com.oying.modules.rider.domain.RiderSourceInfoHttp;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,7 +53,6 @@
RiderSourceInfoHttp riderSourceInfoHttp = new RiderSourceInfoHttp();
riderSourceInfoHttp.setCode("500");
riderSourceInfoHttp.setMessage(paramMap.get("phone") + "手机号请求异常:" + url);
- riderSourceInfoHttp.setSuccess("false");
return JSON.toJSONString(riderSourceInfoHttp);
} finally {
IoUtil.close(response);
@@ -69,20 +69,29 @@
public static RiderSourceInfoHttp getRiderSourceInfoHttp(String phone, String sourcePlatform) {
HashMap<String, Object> paramMap = new HashMap<>(2);
paramMap.put("phone", phone);
- paramMap.put("produceType", sourcePlatform);
- String url = "";
+ paramMap.put("sourcePlatform", sourcePlatform);
+ // String url = "";
// 转化成对象
RiderSourceInfoHttp riderSourceInfoHttp = new RiderSourceInfoHttp();
- try {
- String result = httpPostRequest(paramMap, url);
- // 转换数据
- riderSourceInfoHttp = riderConvertUtils(result);
- } catch (Exception e) {
- riderSourceInfoHttp.setCode("500");
- riderSourceInfoHttp.setMessage("获取数据失败");
- riderSourceInfoHttp.setSuccess("false");
- return riderSourceInfoHttp;
- }
+ // try {
+ // String result = httpPostRequest(paramMap, url);
+ // // 转换数据
+ // riderSourceInfoHttp = riderConvertUtils(result);
+ // } catch (Exception e) {
+ // riderSourceInfoHttp.setCode("500");
+ // riderSourceInfoHttp.setMessage("获取数据失败");
+ // riderSourceInfoHttp.setSuccess("false");
+ // return riderSourceInfoHttp;
+ // }
+ riderSourceInfoHttp.setCode(Constants.HTTP_CODE_SUCCESS);
+ riderSourceInfoHttp.setMessage("请求成功");
+ RiderSourceInfo riderSourceInfo = new RiderSourceInfo();
+ riderSourceInfo.setSourcePlatform("LY");
+ riderSourceInfo.setCardNum("123456789012345678");
+ riderSourceInfo.setPhone("15202394888");
+ riderSourceInfo.setCardName("张三");
+ riderSourceInfo.setEnabled(Constants.SOURCE_ENABLED_ON);
+ riderSourceInfoHttp.setData(riderSourceInfo);
return riderSourceInfoHttp;
}
@@ -101,7 +110,6 @@
} catch (Exception e) {
riderSourceInfoHttp.setCode("500");
riderSourceInfoHttp.setMessage("转化数据失败");
- riderSourceInfoHttp.setSuccess("false");
return riderSourceInfoHttp;
}
}
--
Gitblit v1.9.3