From bd6790acfa335ca50d6129ddd382f10ca541eae2 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 9 Apr 2024 15:23:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/bweb/config/AuthConfig.java | 1 + .../bweb/controller/TuanYouController.java | 28 +++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/config/AuthConfig.java b/hai-bweb/src/main/java/com/bweb/config/AuthConfig.java index d92f866d..b6695ffa 100644 --- a/hai-bweb/src/main/java/com/bweb/config/AuthConfig.java +++ b/hai-bweb/src/main/java/com/bweb/config/AuthConfig.java @@ -99,6 +99,7 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/openApi/*") .excludePathPatterns("/test/*") .excludePathPatterns("/apiProduct/*") + .excludePathPatterns("/tuanYou/*") ; } diff --git a/hai-bweb/src/main/java/com/bweb/controller/TuanYouController.java b/hai-bweb/src/main/java/com/bweb/controller/TuanYouController.java index 763e1449..b88e254d 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/TuanYouController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/TuanYouController.java @@ -1,5 +1,6 @@ package com.bweb.controller; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.hai.common.utils.ResponseMsgUtil; import com.hai.config.HuiLianTongUnionCardConfig; @@ -15,6 +16,8 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; +import java.util.*; + /** * @author hurui @@ -35,8 +38,29 @@ public class TuanYouController { @ApiOperation(value = "查询团油账户余额") public ResponseData getTuanYouAccount() { try { - - return ResponseMsgUtil.success(TuanYouConfig.queryCompanyAccountInfo2JD()); + List> accountList = new ArrayList<>(); + Map account = null; + JSONObject object = TuanYouConfig.queryCompanyAccountInfo2JD(); + if (!object.getJSONArray("result").isEmpty()) { + JSONArray result = object.getJSONArray("result"); + for (Object obj : result) { + JSONObject jsonObject = (JSONObject) obj; + account = new LinkedHashMap<>(); + if (jsonObject.getInteger("energyType") == 1) { + account.put("账户类型", "汽油"); + } else if (jsonObject.getInteger("energyType") == 2) { + account.put("账户类型", "柴油"); + } else if (jsonObject.getInteger("energyType") == 3) { + account.put("账户类型", "天然气"); + } + account.put("账户编号", jsonObject.getString("accountNo")); + account.put("账户余额", jsonObject.getString("accountBalance")); + account.put("充值账户余额", jsonObject.getString("companyDepositBalance")); + account.put("赠送账户金额", jsonObject.getString("companyGivenBalance")); + accountList.add(account); + } + } + return ResponseMsgUtil.success(accountList); } catch (Exception e) { log.error("getUserByTelephone",e);