From 6d40d6af508e31321bc9d8ef545eb6c5a1327851 Mon Sep 17 00:00:00 2001 From: hu177768073 <177768073@qq.com> Date: Thu, 23 Jan 2025 14:41:37 +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 | 64 +++++++++++++++++++ .../openapi/service/ApiGasOrderService.java | 2 +- 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 bweb/src/main/java/com/bweb/controller/TuanYouController.java diff --git a/bweb/src/main/java/com/bweb/config/AuthConfig.java b/bweb/src/main/java/com/bweb/config/AuthConfig.java index a58c746..0001be8 100644 --- a/bweb/src/main/java/com/bweb/config/AuthConfig.java +++ b/bweb/src/main/java/com/bweb/config/AuthConfig.java @@ -97,6 +97,7 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/test/*") .excludePathPatterns("/testNotify/*") .excludePathPatterns("/merchantChainBrand/*") + .excludePathPatterns("/tuanYou/*") .excludePathPatterns("/merchantChainBrandAccount") ; } diff --git a/bweb/src/main/java/com/bweb/controller/TuanYouController.java b/bweb/src/main/java/com/bweb/controller/TuanYouController.java new file mode 100644 index 0000000..f8ac2a6 --- /dev/null +++ b/bweb/src/main/java/com/bweb/controller/TuanYouController.java @@ -0,0 +1,64 @@ +package com.bweb.controller; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.hfkj.channel.gas.newlink.NewLinkRequestService; +import com.hfkj.common.utils.ResponseMsgUtil; +import com.hfkj.model.ResponseData; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +@Controller +@RequestMapping(value = "/tuanYou") +@Api(value="团油业务") +public class TuanYouController { + private static Logger log = LoggerFactory.getLogger(TuanYouController.class); + + @RequestMapping(value="/getTuanYouAccount",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询团油账户余额") + public ResponseData getTuanYouAccount() { + try { + List> accountList = new ArrayList<>(); + Map account = null; + JSONObject object = NewLinkRequestService.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); + return ResponseMsgUtil.exception(e); + } + } + +} diff --git a/service/src/main/java/com/hfkj/openapi/service/ApiGasOrderService.java b/service/src/main/java/com/hfkj/openapi/service/ApiGasOrderService.java index 11ce19d..93f1f9a 100644 --- a/service/src/main/java/com/hfkj/openapi/service/ApiGasOrderService.java +++ b/service/src/main/java/com/hfkj/openapi/service/ApiGasOrderService.java @@ -270,7 +270,7 @@ public class ApiGasOrderService { throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "未找到订单"); } if (!gasOrder.getStatus().equals(OrderOilStatus.STATUS2.getNumber()) - || gasOrder.getStatus().equals(OrderOilStatus.STATUS6.getNumber())) { + || !gasOrder.getStatus().equals(OrderOilStatus.STATUS6.getNumber())) { throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "订单状态暂时无法申请退款"); } // 创建退款订单