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; 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())) { 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"; } 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; } }