From a3287a90b8eec82f691bcce3c37812d55e59a729 Mon Sep 17 00:00:00 2001 From: Guoqs Date: Wed, 27 Mar 2024 16:13:43 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E7=A7=BB=E5=8A=A8utils?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hainan/HaiNanPlatformController.java | 4 +- .../thirdparty/huawei/HuaWeiController.java | 4 +- .../thirdparty/huawei/HuaWeiControllerV2.java | 4 +- .../lianlian/LianLianController.java | 4 +- .../thirdparty/nanrui/NRController.java | 4 +- .../ningxiajiaotou/NXJTController.java | 4 +- .../thirdparty/xindiantu/XDTController.java | 4 +- .../yongchengboche/YCBCController.java | 4 +- .../zhongdianlian/ZDLController.java | 4 +- .../test/java/SpringBootTestController.java | 6 +-- .../thirdparty/common/CommonService.java | 2 +- .../thirdparty/huawei/HuaweiServiceV2.java | 6 +-- .../huawei/impl/HuaWeiServiceImpl.java | 8 +-- .../service/impl/LianLianServiceImpl.java | 8 +-- .../nanrui/service/impl/NRServiceImpl.java | 8 +-- .../service/impl/NXJTServiceImpl.java | 6 +-- .../platform/ThirdPartyPlatformService.java | 6 +-- .../service/HaiNanPlatformServiceImpl.java | 8 +-- .../service/LianLianPlatformServiceImpl.java | 6 +-- .../{lianlian => platform}/util/Cryptos.java | 50 ++++++++++++++++++- .../{lianlian => platform}/util/Encodes.java | 2 +- .../util/Exceptions.java | 2 +- .../util/GBSignUtils.java | 2 +- .../util/HttpRequestUtil.java | 2 +- .../service/impl/YCBCServiceImpl.java | 6 +-- .../service/impl/ZDLServiceImpl.java | 8 +-- 26 files changed, 110 insertions(+), 62 deletions(-) rename jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/{lianlian => platform}/util/Cryptos.java (79%) rename jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/{lianlian => platform}/util/Encodes.java (98%) rename jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/{lianlian => platform}/util/Exceptions.java (97%) rename jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/{lianlian => platform}/util/GBSignUtils.java (97%) rename jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/{lianlian => platform}/util/HttpRequestUtil.java (99%) diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/hainan/HaiNanPlatformController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/hainan/HaiNanPlatformController.java index 457a41646..58d95abf4 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/hainan/HaiNanPlatformController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/hainan/HaiNanPlatformController.java @@ -16,8 +16,8 @@ import com.jsowell.pile.dto.QueryStationInfoDTO; import com.jsowell.pile.service.ThirdPartyPlatformConfigService; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.common.CommonResult; -import com.jsowell.thirdparty.lianlian.util.Cryptos; -import com.jsowell.thirdparty.lianlian.util.Encodes; +import com.jsowell.thirdparty.platform.util.Cryptos; +import com.jsowell.thirdparty.platform.util.Encodes; import com.jsowell.thirdparty.platform.ThirdPartyPlatformService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/huawei/HuaWeiController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/huawei/HuaWeiController.java index e101a6481..5c698b752 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/huawei/HuaWeiController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/huawei/HuaWeiController.java @@ -12,8 +12,8 @@ import com.jsowell.pile.dto.QueryStationInfoDTO; import com.jsowell.thirdparty.huawei.HuaWeiService; import com.jsowell.thirdparty.lianlian.common.CommonResult; import com.jsowell.pile.thirdparty.CommonParamsDTO; -import com.jsowell.thirdparty.lianlian.util.Cryptos; -import com.jsowell.thirdparty.lianlian.util.Encodes; +import com.jsowell.thirdparty.platform.util.Cryptos; +import com.jsowell.thirdparty.platform.util.Encodes; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/huawei/HuaWeiControllerV2.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/huawei/HuaWeiControllerV2.java index 824f7a860..9517ca8a1 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/huawei/HuaWeiControllerV2.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/huawei/HuaWeiControllerV2.java @@ -16,8 +16,8 @@ import com.jsowell.thirdparty.huawei.HuaweiServiceV2; import com.jsowell.thirdparty.lianlian.common.CommonResult; import com.jsowell.thirdparty.lianlian.domain.ConnectorStatusInfo; import com.jsowell.pile.thirdparty.CommonParamsDTO; -import com.jsowell.thirdparty.lianlian.util.Cryptos; -import com.jsowell.thirdparty.lianlian.util.Encodes; +import com.jsowell.thirdparty.platform.util.Cryptos; +import com.jsowell.thirdparty.platform.util.Encodes; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java index ee1c14a75..93fbff8e7 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java @@ -10,8 +10,8 @@ import com.jsowell.pile.dto.QueryStationInfoDTO; import com.jsowell.pile.service.ThirdPartyPlatformConfigService; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.common.CommonResult; -import com.jsowell.thirdparty.lianlian.util.Cryptos; -import com.jsowell.thirdparty.lianlian.util.Encodes; +import com.jsowell.thirdparty.platform.util.Cryptos; +import com.jsowell.thirdparty.platform.util.Encodes; import com.jsowell.thirdparty.platform.ThirdPartyPlatformService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/nanrui/NRController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/nanrui/NRController.java index 553c6019a..1a9150aca 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/nanrui/NRController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/nanrui/NRController.java @@ -17,8 +17,8 @@ import com.jsowell.pile.dto.nanrui.NRQueryOrderDTO; import com.jsowell.pile.dto.nanrui.PushAlarmInfoDTO; import com.jsowell.thirdparty.lianlian.common.CommonResult; import com.jsowell.pile.thirdparty.CommonParamsDTO; -import com.jsowell.thirdparty.lianlian.util.Cryptos; -import com.jsowell.thirdparty.lianlian.util.Encodes; +import com.jsowell.thirdparty.platform.util.Cryptos; +import com.jsowell.thirdparty.platform.util.Encodes; import com.jsowell.thirdparty.nanrui.service.NRService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/ningxiajiaotou/NXJTController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/ningxiajiaotou/NXJTController.java index 17e9090ac..15d030ca2 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/ningxiajiaotou/NXJTController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/ningxiajiaotou/NXJTController.java @@ -10,8 +10,8 @@ import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO; import com.jsowell.thirdparty.lianlian.common.CommonResult; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.service.LianLianService; -import com.jsowell.thirdparty.lianlian.util.Cryptos; -import com.jsowell.thirdparty.lianlian.util.Encodes; +import com.jsowell.thirdparty.platform.util.Cryptos; +import com.jsowell.thirdparty.platform.util.Encodes; import com.jsowell.thirdparty.ningxiajiaotou.service.NXJTService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/xindiantu/XDTController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/xindiantu/XDTController.java index 879e242a1..58c6eefd9 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/xindiantu/XDTController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/xindiantu/XDTController.java @@ -12,8 +12,8 @@ import com.jsowell.common.util.StringUtils; import com.jsowell.pile.dto.*; import com.jsowell.thirdparty.lianlian.common.CommonResult; import com.jsowell.pile.thirdparty.CommonParamsDTO; -import com.jsowell.thirdparty.lianlian.util.Cryptos; -import com.jsowell.thirdparty.lianlian.util.Encodes; +import com.jsowell.thirdparty.platform.util.Cryptos; +import com.jsowell.thirdparty.platform.util.Encodes; import com.jsowell.thirdparty.xindiantu.service.XDTService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/yongchengboche/YCBCController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/yongchengboche/YCBCController.java index c8cf2b5d9..94304c44a 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/yongchengboche/YCBCController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/yongchengboche/YCBCController.java @@ -13,8 +13,8 @@ import com.jsowell.pile.dto.*; import com.jsowell.thirdparty.lianlian.common.CommonResult; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.service.LianLianService; -import com.jsowell.thirdparty.lianlian.util.Cryptos; -import com.jsowell.thirdparty.lianlian.util.Encodes; +import com.jsowell.thirdparty.platform.util.Cryptos; +import com.jsowell.thirdparty.platform.util.Encodes; import com.jsowell.thirdparty.yongchengboche.dto.YCBCGetTokenDTO; import com.jsowell.thirdparty.yongchengboche.service.YCBCService; import org.springframework.beans.factory.annotation.Autowired; diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/zhongdianlian/ZDLController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/zhongdianlian/ZDLController.java index b62b8ebef..fe71ed585 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/zhongdianlian/ZDLController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/zhongdianlian/ZDLController.java @@ -15,8 +15,8 @@ import com.jsowell.pile.dto.QueryStationInfoDTO; import com.jsowell.thirdparty.lianlian.common.CommonResult; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.service.LianLianService; -import com.jsowell.thirdparty.lianlian.util.Cryptos; -import com.jsowell.thirdparty.lianlian.util.Encodes; +import com.jsowell.thirdparty.platform.util.Cryptos; +import com.jsowell.thirdparty.platform.util.Encodes; import com.jsowell.thirdparty.zhongdianlian.service.ZDLService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; diff --git a/jsowell-admin/src/test/java/SpringBootTestController.java b/jsowell-admin/src/test/java/SpringBootTestController.java index a39f65db8..f1c626c4d 100644 --- a/jsowell-admin/src/test/java/SpringBootTestController.java +++ b/jsowell-admin/src/test/java/SpringBootTestController.java @@ -73,9 +73,9 @@ import com.jsowell.thirdparty.amap.service.AMapService; import com.jsowell.thirdparty.huawei.HuaWeiService; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.service.LianLianService; -import com.jsowell.thirdparty.lianlian.util.Cryptos; -import com.jsowell.thirdparty.lianlian.util.Encodes; -import com.jsowell.thirdparty.lianlian.util.GBSignUtils; +import com.jsowell.thirdparty.platform.util.Cryptos; +import com.jsowell.thirdparty.platform.util.Encodes; +import com.jsowell.thirdparty.platform.util.GBSignUtils; import com.jsowell.thirdparty.lutongyunting.service.LTYTService; import com.jsowell.wxpay.common.WeChatPayParameter; import com.jsowell.wxpay.dto.AppletTemplateMessageSendDTO; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java index e14d9f549..004915f00 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java @@ -36,7 +36,7 @@ import com.jsowell.thirdparty.huawei.HuaweiServiceV2; import com.jsowell.thirdparty.platform.hainan.service.HaiNanPlatformServiceImpl; import com.jsowell.thirdparty.huawei.HuaWeiService; import com.jsowell.thirdparty.lianlian.service.LianLianService; -import com.jsowell.thirdparty.lianlian.util.HttpRequestUtil; +import com.jsowell.thirdparty.platform.util.HttpRequestUtil; import com.jsowell.thirdparty.lutongyunting.service.LTYTService; import com.jsowell.thirdparty.nanrui.service.NRService; import com.jsowell.thirdparty.ruanjie.service.RJService; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/HuaweiServiceV2.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/HuaweiServiceV2.java index dfe990a7a..095b1699c 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/HuaweiServiceV2.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/HuaweiServiceV2.java @@ -40,9 +40,9 @@ import com.jsowell.thirdparty.lianlian.common.CommonResult; import com.jsowell.thirdparty.lianlian.domain.ConnectorStatusInfo; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.service.LianLianService; -import com.jsowell.thirdparty.lianlian.util.Cryptos; -import com.jsowell.thirdparty.lianlian.util.Encodes; -import com.jsowell.thirdparty.lianlian.util.GBSignUtils; +import com.jsowell.thirdparty.platform.util.Cryptos; +import com.jsowell.thirdparty.platform.util.Encodes; +import com.jsowell.thirdparty.platform.util.GBSignUtils; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/impl/HuaWeiServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/impl/HuaWeiServiceImpl.java index 8d99c3347..551922340 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/impl/HuaWeiServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/impl/HuaWeiServiceImpl.java @@ -20,10 +20,10 @@ import com.jsowell.pile.vo.uniapp.BillingPriceVO; import com.jsowell.pile.vo.web.PileStationVO; import com.jsowell.thirdparty.huawei.HuaWeiService; import com.jsowell.pile.thirdparty.CommonParamsDTO; -import com.jsowell.thirdparty.lianlian.util.Cryptos; -import com.jsowell.thirdparty.lianlian.util.Encodes; -import com.jsowell.thirdparty.lianlian.util.GBSignUtils; -import com.jsowell.thirdparty.lianlian.util.HttpRequestUtil; +import com.jsowell.thirdparty.platform.util.Cryptos; +import com.jsowell.thirdparty.platform.util.Encodes; +import com.jsowell.thirdparty.platform.util.GBSignUtils; +import com.jsowell.thirdparty.platform.util.HttpRequestUtil; import com.jsowell.thirdparty.zhongdianlian.dto.ZDLGetTokenDTO; import com.jsowell.thirdparty.zhongdianlian.service.ZDLService; import lombok.extern.slf4j.Slf4j; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/impl/LianLianServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/impl/LianLianServiceImpl.java index f37201983..49eae214d 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/impl/LianLianServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/impl/LianLianServiceImpl.java @@ -41,10 +41,10 @@ import com.jsowell.thirdparty.common.CommonService; import com.jsowell.thirdparty.lianlian.domain.*; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.service.LianLianService; -import com.jsowell.thirdparty.lianlian.util.Cryptos; -import com.jsowell.thirdparty.lianlian.util.Encodes; -import com.jsowell.thirdparty.lianlian.util.GBSignUtils; -import com.jsowell.thirdparty.lianlian.util.HttpRequestUtil; +import com.jsowell.thirdparty.platform.util.Cryptos; +import com.jsowell.thirdparty.platform.util.Encodes; +import com.jsowell.thirdparty.platform.util.GBSignUtils; +import com.jsowell.thirdparty.platform.util.HttpRequestUtil; import com.jsowell.thirdparty.lianlian.vo.*; import com.jsowell.thirdparty.yongchengboche.dto.YCBCGetTokenDTO; import com.jsowell.thirdparty.yongchengboche.service.YCBCService; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/nanrui/service/impl/NRServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/nanrui/service/impl/NRServiceImpl.java index 1601dcc36..2e1cbcab4 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/nanrui/service/impl/NRServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/nanrui/service/impl/NRServiceImpl.java @@ -34,10 +34,10 @@ import com.jsowell.pile.vo.web.PileStationVO; import com.jsowell.thirdparty.common.CommonService; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.service.LianLianService; -import com.jsowell.thirdparty.lianlian.util.Cryptos; -import com.jsowell.thirdparty.lianlian.util.Encodes; -import com.jsowell.thirdparty.lianlian.util.GBSignUtils; -import com.jsowell.thirdparty.lianlian.util.HttpRequestUtil; +import com.jsowell.thirdparty.platform.util.Cryptos; +import com.jsowell.thirdparty.platform.util.Encodes; +import com.jsowell.thirdparty.platform.util.GBSignUtils; +import com.jsowell.thirdparty.platform.util.HttpRequestUtil; import com.jsowell.thirdparty.nanrui.domain.*; import com.jsowell.thirdparty.nanrui.service.NRService; import lombok.extern.slf4j.Slf4j; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/ningxiajiaotou/service/impl/NXJTServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/ningxiajiaotou/service/impl/NXJTServiceImpl.java index e62753b99..7848c2e17 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/ningxiajiaotou/service/impl/NXJTServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/ningxiajiaotou/service/impl/NXJTServiceImpl.java @@ -16,9 +16,9 @@ import com.jsowell.pile.vo.ningxiajiaotou.NXJTStationInfoVO; import com.jsowell.pile.vo.uniapp.OrderVO; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.service.LianLianService; -import com.jsowell.thirdparty.lianlian.util.Cryptos; -import com.jsowell.thirdparty.lianlian.util.Encodes; -import com.jsowell.thirdparty.lianlian.util.GBSignUtils; +import com.jsowell.thirdparty.platform.util.Cryptos; +import com.jsowell.thirdparty.platform.util.Encodes; +import com.jsowell.thirdparty.platform.util.GBSignUtils; import com.jsowell.thirdparty.ningxiajiaotou.service.NXJTService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/ThirdPartyPlatformService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/ThirdPartyPlatformService.java index fd258db07..ec61b6ed9 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/ThirdPartyPlatformService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/ThirdPartyPlatformService.java @@ -10,9 +10,9 @@ import com.jsowell.common.util.StringUtils; import com.jsowell.pile.dto.*; import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO; import com.jsowell.pile.thirdparty.CommonParamsDTO; -import com.jsowell.thirdparty.lianlian.util.Cryptos; -import com.jsowell.thirdparty.lianlian.util.Encodes; -import com.jsowell.thirdparty.lianlian.util.GBSignUtils; +import com.jsowell.thirdparty.platform.util.Cryptos; +import com.jsowell.thirdparty.platform.util.Encodes; +import com.jsowell.thirdparty.platform.util.GBSignUtils; import com.jsowell.thirdparty.lianlian.vo.AccessTokenVO; import com.jsowell.thirdparty.lianlian.vo.LianLianResultVO; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/hainan/service/HaiNanPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/hainan/service/HaiNanPlatformServiceImpl.java index 8f6736ac0..078060151 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/hainan/service/HaiNanPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/hainan/service/HaiNanPlatformServiceImpl.java @@ -32,10 +32,10 @@ import com.jsowell.pile.vo.web.PileConnectorInfoVO; import com.jsowell.pile.vo.web.PileStationVO; import com.jsowell.pile.vo.zdl.EquipBusinessPolicyVO; import com.jsowell.thirdparty.lianlian.domain.*; -import com.jsowell.thirdparty.lianlian.util.Cryptos; -import com.jsowell.thirdparty.lianlian.util.Encodes; -import com.jsowell.thirdparty.lianlian.util.GBSignUtils; -import com.jsowell.thirdparty.lianlian.util.HttpRequestUtil; +import com.jsowell.thirdparty.platform.util.Cryptos; +import com.jsowell.thirdparty.platform.util.Encodes; +import com.jsowell.thirdparty.platform.util.GBSignUtils; +import com.jsowell.thirdparty.platform.util.HttpRequestUtil; import com.jsowell.thirdparty.lianlian.vo.EquipmentAuthVO; import com.jsowell.thirdparty.lianlian.vo.QueryChargingStatusVO; import com.jsowell.thirdparty.lianlian.vo.QueryStartChargeVO; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformServiceImpl.java index 50833f9ce..4df1def0a 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformServiceImpl.java @@ -28,9 +28,9 @@ import com.jsowell.pile.vo.lianlian.PushStationFeeVO; import com.jsowell.pile.vo.uniapp.BillingPriceVO; import com.jsowell.pile.vo.web.PileStationVO; import com.jsowell.thirdparty.lianlian.domain.*; -import com.jsowell.thirdparty.lianlian.util.Cryptos; -import com.jsowell.thirdparty.lianlian.util.GBSignUtils; -import com.jsowell.thirdparty.lianlian.util.HttpRequestUtil; +import com.jsowell.thirdparty.platform.util.Cryptos; +import com.jsowell.thirdparty.platform.util.GBSignUtils; +import com.jsowell.thirdparty.platform.util.HttpRequestUtil; import com.jsowell.thirdparty.platform.ThirdPartyPlatformService; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/Cryptos.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/Cryptos.java similarity index 79% rename from jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/Cryptos.java rename to jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/Cryptos.java index d3cc04d12..267182c91 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/Cryptos.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/Cryptos.java @@ -1,6 +1,6 @@ /** */ -package com.jsowell.thirdparty.lianlian.util; +package com.jsowell.thirdparty.platform.util; import javax.crypto.Cipher; import javax.crypto.KeyGenerator; @@ -9,9 +9,11 @@ import javax.crypto.SecretKey; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; import java.security.GeneralSecurityException; import java.security.SecureRandom; import java.util.Arrays; +import java.util.Base64; /** * 数据加/解密工具类 @@ -31,6 +33,47 @@ public class Cryptos { private static SecureRandom random = new SecureRandom(); + private static final String AES_CIPHER_ALGORITHM = "AES/CBC/PKCS5Padding"; + /** + * 数据加密方法 + * @param data 待加密的数据 + * @param secretKey 加密密钥 + * @param iv 初始向量 + * @return 加密后的数据 + */ + public static String encrypt(String data, String secretKey, String iv) { + try { + SecretKeySpec secretKeySpec = new SecretKeySpec(secretKey.getBytes(), AES); + IvParameterSpec ivParameterSpec = new IvParameterSpec(iv.getBytes()); + Cipher cipher = Cipher.getInstance(AES_CIPHER_ALGORITHM); + cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, ivParameterSpec); + byte[] encryptedBytes = cipher.doFinal(data.getBytes()); + return Base64.getEncoder().encodeToString(encryptedBytes); + } catch (Exception e) { + throw new RuntimeException("Error while encrypting data", e); + } + } + + /** + * 数据解密方法 + * @param encryptedData 待解密的数据 + * @param secretKey 解密密钥 + * @param iv 初始向量 + * @return 解密后的数据 + */ + public static String decrypt(String encryptedData, String secretKey, String iv) { + try { + SecretKeySpec secretKeySpec = new SecretKeySpec(secretKey.getBytes(), AES); + IvParameterSpec ivParameterSpec = new IvParameterSpec(iv.getBytes()); + Cipher cipher = Cipher.getInstance(AES_CIPHER_ALGORITHM); + cipher.init(Cipher.DECRYPT_MODE, secretKeySpec, ivParameterSpec); + byte[] originalBytes = cipher.doFinal(Base64.getDecoder().decode(encryptedData)); + return new String(originalBytes); + } catch (Exception e) { + throw new RuntimeException("Error while decrypting data", e); + } + } + //-- HMAC-SHA1 funciton --// /** * 使用HMAC-SHA1进行消息签名, 返回字节数组,长度为20字节. @@ -175,6 +218,11 @@ public class Cryptos { return aes(input, key, Cipher.DECRYPT_MODE); } + public static String aesDecrypt(String input, String key, String iv) { + byte[] aes = aes(input.getBytes(), key.getBytes(), iv.getBytes(), Cipher.DECRYPT_MODE); + return new String(aes, StandardCharsets.UTF_8); + } + /** * 使用AES解密字符串, 返回原始字符串. * diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/Encodes.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/Encodes.java similarity index 98% rename from jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/Encodes.java rename to jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/Encodes.java index 93f4b604f..e57af4230 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/Encodes.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/Encodes.java @@ -1,7 +1,7 @@ /** * Copyright (c) 2005-2012 springside.org.cn */ -package com.jsowell.thirdparty.lianlian.util; +package com.jsowell.thirdparty.platform.util; import org.apache.commons.codec.DecoderException; import org.apache.commons.codec.binary.Base64; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/Exceptions.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/Exceptions.java similarity index 97% rename from jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/Exceptions.java rename to jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/Exceptions.java index 5c0ecba15..cc40a02ee 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/Exceptions.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/Exceptions.java @@ -1,4 +1,4 @@ -package com.jsowell.thirdparty.lianlian.util; +package com.jsowell.thirdparty.platform.util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/GBSignUtils.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/GBSignUtils.java similarity index 97% rename from jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/GBSignUtils.java rename to jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/GBSignUtils.java index e4d9bd1ce..6d7deb154 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/GBSignUtils.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/GBSignUtils.java @@ -1,4 +1,4 @@ -package com.jsowell.thirdparty.lianlian.util; +package com.jsowell.thirdparty.platform.util; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/HttpRequestUtil.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/HttpRequestUtil.java similarity index 99% rename from jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/HttpRequestUtil.java rename to jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/HttpRequestUtil.java index abfd6affe..9d5e52455 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/HttpRequestUtil.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/HttpRequestUtil.java @@ -1,4 +1,4 @@ -package com.jsowell.thirdparty.lianlian.util; +package com.jsowell.thirdparty.platform.util; import cn.hutool.http.HttpRequest; import com.alibaba.fastjson2.JSON; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/yongchengboche/service/impl/YCBCServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/yongchengboche/service/impl/YCBCServiceImpl.java index 9d12a0fb2..eb28345d0 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/yongchengboche/service/impl/YCBCServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/yongchengboche/service/impl/YCBCServiceImpl.java @@ -14,9 +14,9 @@ import com.jsowell.pile.dto.*; import com.jsowell.pile.service.ThirdPartyStationRelationService; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.service.LianLianService; -import com.jsowell.thirdparty.lianlian.util.Cryptos; -import com.jsowell.thirdparty.lianlian.util.Encodes; -import com.jsowell.thirdparty.lianlian.util.GBSignUtils; +import com.jsowell.thirdparty.platform.util.Cryptos; +import com.jsowell.thirdparty.platform.util.Encodes; +import com.jsowell.thirdparty.platform.util.GBSignUtils; import com.jsowell.thirdparty.lianlian.vo.LianLianResultVO; import com.jsowell.thirdparty.yongchengboche.dto.YCBCGetTokenDTO; import com.jsowell.thirdparty.yongchengboche.service.YCBCService; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/service/impl/ZDLServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/service/impl/ZDLServiceImpl.java index 48a498ef2..65ce590fd 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/service/impl/ZDLServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/service/impl/ZDLServiceImpl.java @@ -21,10 +21,10 @@ import com.jsowell.pile.vo.zdl.EquipBusinessPolicyVO; import com.jsowell.thirdparty.common.CommonService; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.service.LianLianService; -import com.jsowell.thirdparty.lianlian.util.Cryptos; -import com.jsowell.thirdparty.lianlian.util.Encodes; -import com.jsowell.thirdparty.lianlian.util.GBSignUtils; -import com.jsowell.thirdparty.lianlian.util.HttpRequestUtil; +import com.jsowell.thirdparty.platform.util.Cryptos; +import com.jsowell.thirdparty.platform.util.Encodes; +import com.jsowell.thirdparty.platform.util.GBSignUtils; +import com.jsowell.thirdparty.platform.util.HttpRequestUtil; import com.jsowell.thirdparty.yongchengboche.dto.YCBCGetTokenDTO; import com.jsowell.thirdparty.yongchengboche.service.YCBCService; import com.jsowell.pile.thirdparty.ZDLConnectorInfo; From 1030f77e55e8cbd7648e0160aba20f511d5cc98e Mon Sep 17 00:00:00 2001 From: Guoqs Date: Wed, 27 Mar 2024 16:18:33 +0800 Subject: [PATCH 02/11] update --- .../controller/thirdparty/lianlian/LianLianController.java | 2 +- .../lianlian/service/LianLianPlatformServiceImpl.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java index 93fbff8e7..1b69a8cde 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java @@ -10,9 +10,9 @@ import com.jsowell.pile.dto.QueryStationInfoDTO; import com.jsowell.pile.service.ThirdPartyPlatformConfigService; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.common.CommonResult; +import com.jsowell.thirdparty.platform.ThirdPartyPlatformService; import com.jsowell.thirdparty.platform.util.Cryptos; import com.jsowell.thirdparty.platform.util.Encodes; -import com.jsowell.thirdparty.platform.ThirdPartyPlatformService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.web.bind.annotation.PostMapping; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformServiceImpl.java index 4df1def0a..9d0b4f2c5 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformServiceImpl.java @@ -96,6 +96,11 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService { String signSecret = platformConfig.getSignSecret(); // 使用公共方法生成token Map resultMap = generateToken(operatorSecret, dataSecret, dataSecretIv, signSecret, operatorId, dto.getData()); + + // 拼装 + + // 加密 + return resultMap; } From 2b5697ba48b102e59d6c56200ce5080be3592eb8 Mon Sep 17 00:00:00 2001 From: Guoqs Date: Thu, 28 Mar 2024 09:06:37 +0800 Subject: [PATCH 03/11] =?UTF-8?q?update=20=E5=AF=B9=E6=8E=A5=E7=AC=AC?= =?UTF-8?q?=E4=B8=89=E6=96=B9=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jsowell/common/util/JWTUtils.java | 3 + .../platform/ThirdPartyPlatformService.java | 4 + .../service/LianLianPlatformServiceImpl.java | 83 ++++++++++++++++++- .../thirdparty/platform/util/Cryptos.java | 1 + 4 files changed, 90 insertions(+), 1 deletion(-) diff --git a/jsowell-common/src/main/java/com/jsowell/common/util/JWTUtils.java b/jsowell-common/src/main/java/com/jsowell/common/util/JWTUtils.java index 4af94b228..39fff47c1 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/util/JWTUtils.java +++ b/jsowell-common/src/main/java/com/jsowell/common/util/JWTUtils.java @@ -48,6 +48,9 @@ public class JWTUtils { private static final Long MILLIS_MINUTE_TEN = 20 * 60 * 1000L; + // 第三方平台token过期时间 24小时 + public static final long ttlMillis = 60 * 60 * 24 * 1000; + /** * 生成Jwt的方法 * diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/ThirdPartyPlatformService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/ThirdPartyPlatformService.java index ec61b6ed9..9f3d4d52f 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/ThirdPartyPlatformService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/ThirdPartyPlatformService.java @@ -38,6 +38,10 @@ public interface ThirdPartyPlatformService { throw new UnsupportedOperationException("This method is not yet implemented"); } + default Map queryToken(String operatorId, String operatorSecret) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + // =================================================================================== // // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 由我方平台实现此接口,对方平台调用的查询接口 ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ // // =================================================================================== // diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformServiceImpl.java index 9d0b4f2c5..7b73c5b93 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformServiceImpl.java @@ -14,7 +14,9 @@ import com.jsowell.common.enums.thirdparty.BusinessInformationExchangeEnum; import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; import com.jsowell.common.enums.ykc.OrderPayModeEnum; import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum; +import com.jsowell.common.exception.BusinessException; import com.jsowell.common.util.DateUtils; +import com.jsowell.common.util.JWTUtils; import com.jsowell.common.util.PageUtils; import com.jsowell.common.util.StringUtils; import com.jsowell.pile.domain.*; @@ -28,10 +30,11 @@ import com.jsowell.pile.vo.lianlian.PushStationFeeVO; import com.jsowell.pile.vo.uniapp.BillingPriceVO; import com.jsowell.pile.vo.web.PileStationVO; import com.jsowell.thirdparty.lianlian.domain.*; +import com.jsowell.thirdparty.lianlian.vo.AccessTokenVO; +import com.jsowell.thirdparty.platform.ThirdPartyPlatformService; import com.jsowell.thirdparty.platform.util.Cryptos; import com.jsowell.thirdparty.platform.util.GBSignUtils; import com.jsowell.thirdparty.platform.util.HttpRequestUtil; -import com.jsowell.thirdparty.platform.ThirdPartyPlatformService; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -104,6 +107,84 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService { return resultMap; } + // @Override + public Map queryTokenV2(CommonParamsDTO dto) { + String operatorId = dto.getOperatorID(); + // 通过operatorId 查出 operatorSecret + ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorId); + if (platformConfig == null) { + throw new BusinessException("1", "无此对接平台"); + } + + String operatorSecret = platformConfig.getOperatorSecret(); + String dataSecret = platformConfig.getDataSecret(); + String dataSecretIv = platformConfig.getDataSecretIv(); + String signSecret = platformConfig.getSignSecret(); + + // 解密data 获取参数中的OperatorSecret + try { + String decrypt = Cryptos.decrypt(dto.getData(), dataSecret, dataSecretIv); + String inputOperatorSecret = null; + if (StringUtils.isNotBlank(decrypt)) { + inputOperatorSecret = JSON.parseObject(decrypt).getString("OperatorSecret"); + } + if (!StringUtils.equals(operatorSecret, inputOperatorSecret)) { + throw new RuntimeException("密钥不一致"); + } + } catch (RuntimeException e) { + throw new BusinessException("2", "密钥错误"); + } + + // 生成token + String token = JWTUtils.createToken(operatorId, operatorSecret, JWTUtils.ttlMillis); + + // 组装返回参数 + AccessTokenVO vo = new AccessTokenVO(); + vo.setAccessToken(token); + vo.setOperatorID(operatorId); + vo.setTokenAvailableTime((int) (JWTUtils.ttlMillis / 1000)); + vo.setFailReason(0); + vo.setSuccStat(0); + + Map resultMap = Maps.newLinkedHashMap(); + // 加密数据 + String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(vo), dataSecret, dataSecretIv); + resultMap.put("Data", encryptData); + // 生成sig + String resultSign = GBSignUtils.sign(resultMap, signSecret); + resultMap.put("Sig", resultSign); + return resultMap; + } + + public static void main(String[] args) { + // 中电联平台 + String operatorId = "14405899X"; + String operatorSecret = "EOub5WNbERyOedvk"; + String dataSecret = "vj3RWNsWIxT5MC0K"; + String dataSecretIv = "jjkySnGlM3pbOUki"; + String signSecret = "NbELMbWtbHikNSlu"; + + String data = "JdVMdw0JVYvouzS4WA9APlqKyQJuTuvh43lDYGaVccrvMboNTVajQdkvtLfqq3+lxlUXkokSkGSDsmxNkUT/SQ=="; + String Seq = "0029"; + String sig = "C6410BF5C7185CAE8594846E006740E1"; + String timeStamp = "2024-03-27 16:18:39"; + + // 解密data 获取参数中的OperatorSecret + try { + String decrypt = Cryptos.decrypt(data, dataSecret, dataSecretIv); + String inputOperatorSecret = null; + if (StringUtils.isNotBlank(decrypt)) { + inputOperatorSecret = JSON.parseObject(decrypt).getString("OperatorSecret"); + } + if (!StringUtils.equals(operatorSecret, inputOperatorSecret)) { + throw new RuntimeException("密钥不一致"); + } + } catch (RuntimeException e) { + throw new BusinessException("2", "密钥错误"); + } + + } + /** * 查询充电站信息 query_stations_info * 此接口用于查询对接平台的充电站的信息 diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/Cryptos.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/Cryptos.java index 267182c91..03388e589 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/Cryptos.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/Cryptos.java @@ -34,6 +34,7 @@ public class Cryptos { private static SecureRandom random = new SecureRandom(); private static final String AES_CIPHER_ALGORITHM = "AES/CBC/PKCS5Padding"; + /** * 数据加密方法 * @param data 待加密的数据 From 3cdc99a4cd33d6ab1356f6b2ead517784168aa1b Mon Sep 17 00:00:00 2001 From: Guoqs Date: Thu, 28 Mar 2024 10:42:14 +0800 Subject: [PATCH 04/11] =?UTF-8?q?update=20=E5=B8=A7=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lianlian/service/LianLianPlatformServiceImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformServiceImpl.java index 7b73c5b93..eef855800 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformServiceImpl.java @@ -85,8 +85,8 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService { // InterfaceWithPlatformLogicFactory.register(platformType, this); // } - @Override - public Map queryToken(CommonParamsDTO dto) { + // @Override + public Map queryTokenOld(CommonParamsDTO dto) { String operatorId = dto.getOperatorID(); // 通过operatorId 查出 operatorSecret ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorId); @@ -107,8 +107,8 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService { return resultMap; } - // @Override - public Map queryTokenV2(CommonParamsDTO dto) { + @Override + public Map queryToken(CommonParamsDTO dto) { String operatorId = dto.getOperatorID(); // 通过operatorId 查出 operatorSecret ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorId); From f9f03c763ec81efc5623957c37126617556cc593 Mon Sep 17 00:00:00 2001 From: Guoqs Date: Thu, 28 Mar 2024 10:42:23 +0800 Subject: [PATCH 05/11] =?UTF-8?q?update=20=E5=B8=A7=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jsowell/common/core/domain/ykc/YKCFrameTypeCode.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jsowell-common/src/main/java/com/jsowell/common/core/domain/ykc/YKCFrameTypeCode.java b/jsowell-common/src/main/java/com/jsowell/common/core/domain/ykc/YKCFrameTypeCode.java index be8eed69c..9d7559c88 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/core/domain/ykc/YKCFrameTypeCode.java +++ b/jsowell-common/src/main/java/com/jsowell/common/core/domain/ykc/YKCFrameTypeCode.java @@ -40,10 +40,10 @@ public enum YKCFrameTypeCode { CONFIRM_START_CHARGING_CODE(0x32, "运营平台确认启动充电"), REMOTE_START_CHARGING_ANSWER_CODE(0x33, "远程启动充电命令回复"), - REMOTE_CONTROL_START_CODE(0x34, "运营平台远程控制启机"), + REMOTE_CONTROL_START_CODE(0x34, "运营平台远程控制启机(启动充电)"), REMOTE_STOP_CHARGING_ANSWER_CODE(0x35, "远程停机命令回复"), - REMOTE_STOP_CHARGING_CODE(0x36, "运营平台远程停机"), + REMOTE_STOP_CHARGING_CODE(0x36, "运营平台远程停机(停止充电)"), TRANSACTION_RECORDS_CODE(0x3B, "交易记录"), From 8482585a21918d7f40843deef9b6b5788268ba7c Mon Sep 17 00:00:00 2001 From: Guoqs Date: Thu, 28 Mar 2024 11:07:45 +0800 Subject: [PATCH 06/11] =?UTF-8?q?update=20=E5=AF=B9=E6=8E=A5=E7=AC=AC?= =?UTF-8?q?=E4=B8=89=E6=96=B9=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lianlian/LianLianController.java | 200 +++++++++++------- .../jsowell/pile/dto/PushInfoParamDTO.java | 2 + 2 files changed, 128 insertions(+), 74 deletions(-) diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java index 1b69a8cde..83263c1b9 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java @@ -4,8 +4,13 @@ import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.jsowell.common.annotation.Anonymous; import com.jsowell.common.core.controller.BaseController; +import com.jsowell.common.enums.ykc.ReturnCodeEnum; +import com.jsowell.common.exception.BusinessException; +import com.jsowell.common.response.RestApiResponse; import com.jsowell.common.util.JWTUtils; +import com.jsowell.common.util.StringUtils; import com.jsowell.pile.domain.ThirdPartyPlatformConfig; +import com.jsowell.pile.dto.PushInfoParamDTO; import com.jsowell.pile.dto.QueryStationInfoDTO; import com.jsowell.pile.service.ThirdPartyPlatformConfigService; import com.jsowell.pile.thirdparty.CommonParamsDTO; @@ -15,10 +20,7 @@ import com.jsowell.thirdparty.platform.util.Cryptos; import com.jsowell.thirdparty.platform.util.Encodes; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import java.nio.charset.StandardCharsets; @@ -217,84 +219,134 @@ public class LianLianController extends BaseController { } /** - * 联联平台设备状态变化推送 - * http://localhost:8080/LianLian/pushStationStatus + * 充电站信息变化推送 notificationStationInfo + */ + @PostMapping("/notificationStationInfo") + public RestApiResponse notificationStationInfo(@RequestBody PushInfoParamDTO dto) { + logger.info("联联平台充电站信息变化推送 params:{}", JSON.toJSONString(dto)); + RestApiResponse response = null; + try { + if (StringUtils.isBlank(String.valueOf(dto.getPileConnectorCode())) || + StringUtils.isBlank(String.valueOf(dto.getStatus()))) { + throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); + } + String result = lianLianService.notificationStationInfo(dto.getStationId()); + response = new RestApiResponse<>(result); + }catch (BusinessException e) { + logger.error("联联平台充电站信息变化推送 error",e); + response = new RestApiResponse<>(e.getCode(), e.getMessage()); + }catch (Exception e) { + logger.error("联联平台充电站信息变化推送 error", e); + response = new RestApiResponse<>(e); + } + logger.info("联联平台充电站信息变化推送 result:{}", response); + return response; + } + + /** + * 联联平台设备状态变化推送 notification_stationStatus + * http://localhost:8080/LianLian/notificationStationStatus * @param dto * @return */ - // @PostMapping("/pushStationStatus") - // public RestApiResponse pushStationStatus(@RequestBody PushInfoParamDTO dto) { - // logger.info("联联平台设备状态变化推送 params:{}", JSON.toJSONString(dto)); - // RestApiResponse response = null; - // try { - // if (StringUtils.isBlank(String.valueOf(dto.getPileConnectorCode())) || - // StringUtils.isBlank(String.valueOf(dto.getStatus()))) { - // throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); - // } - // String result = lianLianService.notificationStationStatus(dto.getPileConnectorCode(), dto.getStatus()); - // response = new RestApiResponse<>(result); - // }catch (BusinessException e) { - // logger.error("联联平台设备状态变化推送 error",e); - // response = new RestApiResponse<>(e.getCode(), e.getMessage()); - // }catch (Exception e) { - // logger.error("联联平台设备状态变化推送 error", e); - // response = new RestApiResponse<>(e); - // } - // logger.info("联联平台设备状态变化推送 result:{}", response); - // return response; - // } + @PostMapping("/notificationStationStatus") + public RestApiResponse notificationStationStatus(@RequestBody PushInfoParamDTO dto) { + logger.info("联联平台设备状态变化推送 params:{}", JSON.toJSONString(dto)); + RestApiResponse response = null; + try { + if (StringUtils.isBlank(String.valueOf(dto.getPileConnectorCode())) || + StringUtils.isBlank(String.valueOf(dto.getStatus()))) { + throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); + } + String result = lianLianService.notificationStationStatus(dto.getPileConnectorCode(), dto.getStatus()); + response = new RestApiResponse<>(result); + }catch (BusinessException e) { + logger.error("联联平台设备状态变化推送 error",e); + response = new RestApiResponse<>(e.getCode(), e.getMessage()); + }catch (Exception e) { + logger.error("联联平台设备状态变化推送 error", e); + response = new RestApiResponse<>(e); + } + logger.info("联联平台设备状态变化推送 result:{}", response); + return response; + } /** - * 推送订单信息 + * 站点费率变化推送 notification_stationFee + */ + @PostMapping("/notificationStationFee") + public RestApiResponse notificationStationFee(@RequestBody PushInfoParamDTO dto) { + logger.info("联联平台站点费率变化推送 params:{}", JSON.toJSONString(dto)); + RestApiResponse response = null; + try { + if (StringUtils.isBlank(String.valueOf(dto.getPileConnectorCode())) || + StringUtils.isBlank(String.valueOf(dto.getStatus()))) { + throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); + } + String result = lianLianService.notificationStationFee(dto.getStationId()); + response = new RestApiResponse<>(result); + }catch (BusinessException e) { + logger.error("联联平台站点费率变化推送 error",e); + response = new RestApiResponse<>(e.getCode(), e.getMessage()); + }catch (Exception e) { + logger.error("联联平台站点费率变化推送 error", e); + response = new RestApiResponse<>(e); + } + logger.info("联联平台站点费率变化推送 result:{}", response); + return response; + } + + /** + * 设备充电中状态变化推送 notification_connector_charge_status + * @return + */ + @GetMapping("/notificationConnectorChargeStatus/{orderCode}") + public RestApiResponse notificationConnectorChargeStatus(@PathVariable("orderCode")String orderCode) { + logger.info("联联平台设备充电中状态变化推送 params:{}", orderCode); + RestApiResponse response = null; + try { + if (StringUtils.isBlank(orderCode)) { + throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); + } + // String result = lianLianService.pushPileChargeStatusChange(orderCode); + String result = lianLianService.notificationConnectorChargeStatus(orderCode); + response = new RestApiResponse<>(result); + }catch (BusinessException e) { + logger.error("联联平台设备充电中状态变化推送 error",e); + response = new RestApiResponse<>(e.getCode(), e.getMessage()); + }catch (Exception e) { + logger.error("联联平台设备充电中状态变化推送 error", e); + response = new RestApiResponse<>(e); + } + logger.info("联联平台设备充电中状态变化推送 result:{}", response); + return response; + } + + /** + * 推送订单信息 notification_orderInfo * @param orderCode * @return */ - // @GetMapping("/pushOrderInfo/{orderCode}") - // public RestApiResponse pushOrderInfo(@PathVariable("orderCode")String orderCode) { - // logger.info("联联平台推送订单信息 params:{}", orderCode); - // RestApiResponse response = null; - // try { - // if (StringUtils.isBlank(orderCode)) { - // throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); - // } - // String result = lianLianService.notificationOrderInfo(orderCode); - // response = new RestApiResponse<>(result); - // }catch (BusinessException e) { - // logger.error("联联平台推送订单信息 error",e); - // response = new RestApiResponse<>(e.getCode(), e.getMessage()); - // }catch (Exception e) { - // logger.error("联联平台推送订单信息 error", e); - // response = new RestApiResponse<>(e); - // } - // logger.info("联联平台推送订单信息 result:{}", response); - // return response; - // } - - /** - * 设备充电中状态变化推送 - * @return - */ - // @GetMapping("/pushPileChargeStatusChange/{orderCode}") - // public RestApiResponse pushPileChargeStatusChange(@PathVariable("orderCode")String orderCode) { - // logger.info("联联平台设备充电中状态变化推送 params:{}", orderCode); - // RestApiResponse response = null; - // try { - // if (StringUtils.isBlank(orderCode)) { - // throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); - // } - // // String result = lianLianService.pushPileChargeStatusChange(orderCode); - // String result = lianLianService.notificationEquipChargeStatus(orderCode); - // response = new RestApiResponse<>(result); - // }catch (BusinessException e) { - // logger.error("联联平台设备充电中状态变化推送 error",e); - // response = new RestApiResponse<>(e.getCode(), e.getMessage()); - // }catch (Exception e) { - // logger.error("联联平台设备充电中状态变化推送 error", e); - // response = new RestApiResponse<>(e); - // } - // logger.info("联联平台设备充电中状态变化推送 result:{}", response); - // return response; - // } + @GetMapping("/notificationOrderInfo/{orderCode}") + public RestApiResponse notificationOrderInfo(@PathVariable("orderCode")String orderCode) { + logger.info("联联平台推送订单信息 params:{}", orderCode); + RestApiResponse response = null; + try { + if (StringUtils.isBlank(orderCode)) { + throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); + } + String result = lianLianService.notificationOrderInfo(orderCode); + response = new RestApiResponse<>(result); + }catch (BusinessException e) { + logger.error("联联平台推送订单信息 error",e); + response = new RestApiResponse<>(e.getCode(), e.getMessage()); + }catch (Exception e) { + logger.error("联联平台推送订单信息 error", e); + response = new RestApiResponse<>(e); + } + logger.info("联联平台推送订单信息 result:{}", response); + return response; + } /** * 请求设备认证 diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/dto/PushInfoParamDTO.java b/jsowell-pile/src/main/java/com/jsowell/pile/dto/PushInfoParamDTO.java index c1c188aa7..64a78061f 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/dto/PushInfoParamDTO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/dto/PushInfoParamDTO.java @@ -13,4 +13,6 @@ public class PushInfoParamDTO { private String pileConnectorCode; private String status; + + private String stationId; } From ad5d24618c9404b5b100532445029328556ea35b Mon Sep 17 00:00:00 2001 From: Guoqs Date: Thu, 28 Mar 2024 12:04:49 +0800 Subject: [PATCH 07/11] =?UTF-8?q?update=20=E5=AF=B9=E6=8E=A5=E7=AC=AC?= =?UTF-8?q?=E4=B8=89=E6=96=B9=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../thirdparty/lianlian/LianLianController.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java index 83263c1b9..c202cf5ae 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java @@ -220,14 +220,14 @@ public class LianLianController extends BaseController { /** * 充电站信息变化推送 notificationStationInfo + * http://localhost:8080/LianLian/notificationStationInfo */ @PostMapping("/notificationStationInfo") public RestApiResponse notificationStationInfo(@RequestBody PushInfoParamDTO dto) { logger.info("联联平台充电站信息变化推送 params:{}", JSON.toJSONString(dto)); RestApiResponse response = null; try { - if (StringUtils.isBlank(String.valueOf(dto.getPileConnectorCode())) || - StringUtils.isBlank(String.valueOf(dto.getStatus()))) { + if (StringUtils.isBlank(String.valueOf(dto.getStationId()))) { throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); } String result = lianLianService.notificationStationInfo(dto.getStationId()); @@ -273,14 +273,14 @@ public class LianLianController extends BaseController { /** * 站点费率变化推送 notification_stationFee + * http://localhost:8080/LianLian/notificationStationFee */ @PostMapping("/notificationStationFee") public RestApiResponse notificationStationFee(@RequestBody PushInfoParamDTO dto) { logger.info("联联平台站点费率变化推送 params:{}", JSON.toJSONString(dto)); RestApiResponse response = null; try { - if (StringUtils.isBlank(String.valueOf(dto.getPileConnectorCode())) || - StringUtils.isBlank(String.valueOf(dto.getStatus()))) { + if (StringUtils.isBlank(String.valueOf(dto.getStationId()))) { throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); } String result = lianLianService.notificationStationFee(dto.getStationId()); @@ -298,6 +298,7 @@ public class LianLianController extends BaseController { /** * 设备充电中状态变化推送 notification_connector_charge_status + * http://localhost:8080/LianLian/notificationConnectorChargeStatus * @return */ @GetMapping("/notificationConnectorChargeStatus/{orderCode}") @@ -324,6 +325,7 @@ public class LianLianController extends BaseController { /** * 推送订单信息 notification_orderInfo + * http://localhost:8080/LianLian/notificationOrderInfo/ * @param orderCode * @return */ From e8b162b210ba95e7cf84003b5e12169b987c2815 Mon Sep 17 00:00:00 2001 From: Guoqs Date: Thu, 28 Mar 2024 14:13:23 +0800 Subject: [PATCH 08/11] update --- .../web/controller/thirdparty/lianlian/LianLianController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java index c202cf5ae..736e194e4 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java @@ -219,7 +219,7 @@ public class LianLianController extends BaseController { } /** - * 充电站信息变化推送 notificationStationInfo + * 充电站信息变化推送 notification_stationInfo * http://localhost:8080/LianLian/notificationStationInfo */ @PostMapping("/notificationStationInfo") From e45012b252d482a578d127a5914d6e6ad37c10a3 Mon Sep 17 00:00:00 2001 From: Guoqs Date: Thu, 28 Mar 2024 14:32:01 +0800 Subject: [PATCH 09/11] =?UTF-8?q?update=20=E5=AF=B9=E6=8E=A5=E7=AC=AC?= =?UTF-8?q?=E4=B8=89=E6=96=B9=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lianlian/LianLianController.java | 460 +++++++++--------- .../platform/ThirdPartyPlatformService.java | 7 + .../service/LianLianPlatformServiceImpl.java | 38 ++ 3 files changed, 274 insertions(+), 231 deletions(-) diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java index 736e194e4..56ec1f35f 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java @@ -10,8 +10,7 @@ import com.jsowell.common.response.RestApiResponse; import com.jsowell.common.util.JWTUtils; import com.jsowell.common.util.StringUtils; import com.jsowell.pile.domain.ThirdPartyPlatformConfig; -import com.jsowell.pile.dto.PushInfoParamDTO; -import com.jsowell.pile.dto.QueryStationInfoDTO; +import com.jsowell.pile.dto.*; import com.jsowell.pile.service.ThirdPartyPlatformConfigService; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.common.CommonResult; @@ -356,50 +355,50 @@ public class LianLianController extends BaseController { * @param dto * @return */ - // @PostMapping("/v1/query_equip_auth") - // public CommonResult query_equip_auth(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { - // logger.info("联联平台请求设备认证 param:{}", JSON.toJSONString(dto)); - // try { - // // 校验令牌 - // String token = request.getHeader("Authorization"); - // if (!JWTUtils.checkThirdPartyToken(token)) { - // // 校验失败 - // return CommonResult.failed("令牌校验错误"); - // } - // // 校验签名 - // // Map resultMap = lianLianService.checkoutSign(dto); - // // if (resultMap == null) { - // // // 签名错误 - // // return CommonResult.failed("签名校验错误"); - // // } - // // String operatorSecret = resultMap.get("OperatorSecret"); - // // String dataString = resultMap.get("Data"); - // // String dataSecret = resultMap.get("DataSecret"); - // // String dataSecretIV = resultMap.get("DataSecretIV"); - // - // // 查询配置信息 - // ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); - // String operatorSecret = platformConfig.getOperatorSecret(); - // String dataString = dto.getData(); - // String dataSecret = platformConfig.getDataSecret(); - // String dataSecretIV = platformConfig.getDataSecretIv(); - // - // // 解密data - // byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); - // String dataStr = new String(plainText, StandardCharsets.UTF_8); - // // 转换成相应对象 - // QueryEquipmentDTO queryEquipmentDTO = JSONObject.parseObject(dataStr, QueryEquipmentDTO.class); - // queryEquipmentDTO.setOperatorID(dto.getOperatorID()); - // // Map map = lianLianService.query_equip_auth(queryEquipmentDTO); - // Map map = lianLianService.queryEquipAuth(queryEquipmentDTO); - // - // return CommonResult.success(0, "请求设备认证成功!", map.get("Data"), map.get("Sig")); - // } catch (Exception e) { - // logger.info("联联平台请求设备认证 error:", e); - // e.printStackTrace(); - // } - // return CommonResult.failed("请求设备认证发生异常"); - // } + @PostMapping("/v1/query_equip_auth") + public CommonResult query_equip_auth(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { + logger.info("联联平台请求设备认证 param:{}", JSON.toJSONString(dto)); + try { + // 校验令牌 + String token = request.getHeader("Authorization"); + if (!JWTUtils.checkThirdPartyToken(token)) { + // 校验失败 + return CommonResult.failed("令牌校验错误"); + } + // 校验签名 + // Map resultMap = lianLianService.checkoutSign(dto); + // if (resultMap == null) { + // // 签名错误 + // return CommonResult.failed("签名校验错误"); + // } + // String operatorSecret = resultMap.get("OperatorSecret"); + // String dataString = resultMap.get("Data"); + // String dataSecret = resultMap.get("DataSecret"); + // String dataSecretIV = resultMap.get("DataSecretIV"); + + // 查询配置信息 + ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); + String operatorSecret = platformConfig.getOperatorSecret(); + String dataString = dto.getData(); + String dataSecret = platformConfig.getDataSecret(); + String dataSecretIV = platformConfig.getDataSecretIv(); + + // 解密data + byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); + String dataStr = new String(plainText, StandardCharsets.UTF_8); + // 转换成相应对象 + QueryEquipmentDTO queryEquipmentDTO = JSONObject.parseObject(dataStr, QueryEquipmentDTO.class); + queryEquipmentDTO.setOperatorID(dto.getOperatorID()); + // Map map = lianLianService.query_equip_auth(queryEquipmentDTO); + Map map = lianLianService.queryEquipAuth(queryEquipmentDTO); + + return CommonResult.success(0, "请求设备认证成功!", map.get("Data"), map.get("Sig")); + } catch (Exception e) { + logger.info("联联平台请求设备认证 error:", e); + e.printStackTrace(); + } + return CommonResult.failed("请求设备认证发生异常"); + } /** * 请求启动充电 @@ -407,49 +406,49 @@ public class LianLianController extends BaseController { * @param dto * @return */ - // @PostMapping("/v1/query_start_charge") - // public CommonResult query_start_charge(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { - // logger.info("联联平台请求启动充电 params :{}", JSON.toJSONString(dto)); - // try { - // // 校验令牌 - // String token = request.getHeader("Authorization"); - // if (!JWTUtils.checkThirdPartyToken(token)) { - // // 校验失败 - // return CommonResult.failed("令牌校验错误"); - // } - // // 校验签名 - // // Map resultMap = lianLianService.checkoutSign(dto); - // // if (resultMap == null) { - // // // 签名错误 - // // return CommonResult.failed("签名校验错误"); - // // } - // // String operatorSecret = resultMap.get("OperatorSecret"); - // // String dataString = resultMap.get("Data"); - // // String dataSecret = resultMap.get("DataSecret"); - // // String dataSecretIV = resultMap.get("DataSecretIV"); - // - // // 查询配置信息 - // ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); - // String operatorSecret = platformConfig.getOperatorSecret(); - // String dataString = dto.getData(); - // String dataSecret = platformConfig.getDataSecret(); - // String dataSecretIV = platformConfig.getDataSecretIv(); - // - // // 解密data - // byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); - // String dataStr = new String(plainText, StandardCharsets.UTF_8); - // // 转换成相应对象 - // QueryStartChargeDTO queryStartChargeDTO = JSONObject.parseObject(dataStr, QueryStartChargeDTO.class); - // queryStartChargeDTO.setOperatorId(dto.getOperatorID()); - // // Map map = lianLianService.query_start_charge(queryStartChargeDTO); - // Map map = lianLianService.queryStartCharge(queryStartChargeDTO); - // - // return CommonResult.success(0, "请求启动充电成功!", map.get("Data"), map.get("Sig")); - // } catch (Exception e) { - // logger.error("联联平台请求启动充电 error", e); - // } - // return CommonResult.failed("请求启动充电发生异常"); - // } + @PostMapping("/v1/query_start_charge") + public CommonResult query_start_charge(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { + logger.info("联联平台请求启动充电 params :{}", JSON.toJSONString(dto)); + try { + // 校验令牌 + String token = request.getHeader("Authorization"); + if (!JWTUtils.checkThirdPartyToken(token)) { + // 校验失败 + return CommonResult.failed("令牌校验错误"); + } + // 校验签名 + // Map resultMap = lianLianService.checkoutSign(dto); + // if (resultMap == null) { + // // 签名错误 + // return CommonResult.failed("签名校验错误"); + // } + // String operatorSecret = resultMap.get("OperatorSecret"); + // String dataString = resultMap.get("Data"); + // String dataSecret = resultMap.get("DataSecret"); + // String dataSecretIV = resultMap.get("DataSecretIV"); + + // 查询配置信息 + ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); + String operatorSecret = platformConfig.getOperatorSecret(); + String dataString = dto.getData(); + String dataSecret = platformConfig.getDataSecret(); + String dataSecretIV = platformConfig.getDataSecretIv(); + + // 解密data + byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); + String dataStr = new String(plainText, StandardCharsets.UTF_8); + // 转换成相应对象 + QueryStartChargeDTO queryStartChargeDTO = JSONObject.parseObject(dataStr, QueryStartChargeDTO.class); + queryStartChargeDTO.setOperatorId(dto.getOperatorID()); + // Map map = lianLianService.query_start_charge(queryStartChargeDTO); + Map map = lianLianService.queryStartCharge(queryStartChargeDTO); + + return CommonResult.success(0, "请求启动充电成功!", map.get("Data"), map.get("Sig")); + } catch (Exception e) { + logger.error("联联平台请求启动充电 error", e); + } + return CommonResult.failed("请求启动充电发生异常"); + } /** * 查询充电状态 @@ -457,49 +456,49 @@ public class LianLianController extends BaseController { * @param dto * @return */ - // @PostMapping("/v1/query_equip_charge_status") - // public CommonResult query_equip_charge_status(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { - // logger.info("联联平台查询充电状态 params :{}", JSON.toJSONString(dto)); - // try { - // // 校验令牌 - // String token = request.getHeader("Authorization"); - // if (!JWTUtils.checkThirdPartyToken(token)) { - // // 校验失败 - // return CommonResult.failed("令牌校验错误"); - // } - // // 校验签名 - // // Map resultMap = lianLianService.checkoutSign(dto); - // // if (resultMap == null) { - // // // 签名错误 - // // return CommonResult.failed("签名校验错误"); - // // } - // // String operatorSecret = resultMap.get("OperatorSecret"); - // // String dataString = resultMap.get("Data"); - // // String dataSecret = resultMap.get("DataSecret"); - // // String dataSecretIV = resultMap.get("DataSecretIV"); - // - // // 查询配置信息 - // ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); - // String operatorSecret = platformConfig.getOperatorSecret(); - // String dataString = dto.getData(); - // String dataSecret = platformConfig.getDataSecret(); - // String dataSecretIV = platformConfig.getDataSecretIv(); - // - // // 解密data - // byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); - // String dataStr = new String(plainText, StandardCharsets.UTF_8); - // // 转换成相应对象 - // QueryEquipChargeStatusDTO queryEquipChargeStatusDTO = JSONObject.parseObject(dataStr, QueryEquipChargeStatusDTO.class); - // queryEquipChargeStatusDTO.setOperatorID(dto.getOperatorID()); - // // Map map = lianLianService.query_equip_charge_status(queryEquipChargeStatusDTO); - // Map map = lianLianService.queryEquipChargeStatus(queryEquipChargeStatusDTO); - // - // return CommonResult.success(0, "查询充电状态成功!", map.get("Data"), map.get("Sig")); - // } catch (Exception e) { - // logger.error("联联平台查询充电状态 error", e); - // } - // return CommonResult.failed("联联平台查询充电状态发生异常"); - // } + @PostMapping("/v1/query_equip_charge_status") + public CommonResult query_equip_charge_status(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { + logger.info("联联平台查询充电状态 params :{}", JSON.toJSONString(dto)); + try { + // 校验令牌 + String token = request.getHeader("Authorization"); + if (!JWTUtils.checkThirdPartyToken(token)) { + // 校验失败 + return CommonResult.failed("令牌校验错误"); + } + // 校验签名 + // Map resultMap = lianLianService.checkoutSign(dto); + // if (resultMap == null) { + // // 签名错误 + // return CommonResult.failed("签名校验错误"); + // } + // String operatorSecret = resultMap.get("OperatorSecret"); + // String dataString = resultMap.get("Data"); + // String dataSecret = resultMap.get("DataSecret"); + // String dataSecretIV = resultMap.get("DataSecretIV"); + + // 查询配置信息 + ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); + String operatorSecret = platformConfig.getOperatorSecret(); + String dataString = dto.getData(); + String dataSecret = platformConfig.getDataSecret(); + String dataSecretIV = platformConfig.getDataSecretIv(); + + // 解密data + byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); + String dataStr = new String(plainText, StandardCharsets.UTF_8); + // 转换成相应对象 + QueryEquipChargeStatusDTO queryEquipChargeStatusDTO = JSONObject.parseObject(dataStr, QueryEquipChargeStatusDTO.class); + queryEquipChargeStatusDTO.setOperatorID(dto.getOperatorID()); + // Map map = lianLianService.query_equip_charge_status(queryEquipChargeStatusDTO); + Map map = lianLianService.queryEquipChargeStatus(queryEquipChargeStatusDTO); + + return CommonResult.success(0, "查询充电状态成功!", map.get("Data"), map.get("Sig")); + } catch (Exception e) { + logger.error("联联平台查询充电状态 error", e); + } + return CommonResult.failed("联联平台查询充电状态发生异常"); + } /** * 请求停止充电 @@ -507,49 +506,49 @@ public class LianLianController extends BaseController { * @param dto * @return */ - // @PostMapping("/v1/query_stop_charge") - // public CommonResult query_stop_charge(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { - // logger.info("联联平台请求停止充电 params :{}", JSON.toJSONString(dto)); - // try { - // // 校验令牌 - // String token = request.getHeader("Authorization"); - // if (!JWTUtils.checkThirdPartyToken(token)) { - // // 校验失败 - // return CommonResult.failed("令牌校验错误"); - // } - // // 校验签名 - // // Map resultMap = lianLianService.checkoutSign(dto); - // // if (resultMap == null) { - // // // 签名错误 - // // return CommonResult.failed("签名校验错误"); - // // } - // // String operatorSecret = resultMap.get("OperatorSecret"); - // // String dataString = resultMap.get("Data"); - // // String dataSecret = resultMap.get("DataSecret"); - // // String dataSecretIV = resultMap.get("DataSecretIV"); - // - // // 查询配置信息 - // ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); - // String operatorSecret = platformConfig.getOperatorSecret(); - // String dataString = dto.getData(); - // String dataSecret = platformConfig.getDataSecret(); - // String dataSecretIV = platformConfig.getDataSecretIv(); - // - // // 解密data - // byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); - // String dataStr = new String(plainText, StandardCharsets.UTF_8); - // // 转换成相应对象 - // QueryStartChargeDTO queryStartChargeDTO = JSONObject.parseObject(dataStr, QueryStartChargeDTO.class); - // queryStartChargeDTO.setOperatorId(dto.getOperatorID()); - // // Map map = lianLianService.query_stop_charge(queryStartChargeDTO); - // Map map = lianLianService.queryStopCharge(queryStartChargeDTO); - // - // return CommonResult.success(0, "请求停止充电成功!", map.get("Data"), map.get("Sig")); - // } catch (Exception e) { - // logger.error("联联平台请求停止充电 error", e); - // } - // return CommonResult.failed("联联平台请求停止充电发生异常"); - // } + @PostMapping("/v1/query_stop_charge") + public CommonResult query_stop_charge(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { + logger.info("联联平台请求停止充电 params :{}", JSON.toJSONString(dto)); + try { + // 校验令牌 + String token = request.getHeader("Authorization"); + if (!JWTUtils.checkThirdPartyToken(token)) { + // 校验失败 + return CommonResult.failed("令牌校验错误"); + } + // 校验签名 + // Map resultMap = lianLianService.checkoutSign(dto); + // if (resultMap == null) { + // // 签名错误 + // return CommonResult.failed("签名校验错误"); + // } + // String operatorSecret = resultMap.get("OperatorSecret"); + // String dataString = resultMap.get("Data"); + // String dataSecret = resultMap.get("DataSecret"); + // String dataSecretIV = resultMap.get("DataSecretIV"); + + // 查询配置信息 + ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); + String operatorSecret = platformConfig.getOperatorSecret(); + String dataString = dto.getData(); + String dataSecret = platformConfig.getDataSecret(); + String dataSecretIV = platformConfig.getDataSecretIv(); + + // 解密data + byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); + String dataStr = new String(plainText, StandardCharsets.UTF_8); + // 转换成相应对象 + QueryStartChargeDTO queryStartChargeDTO = JSONObject.parseObject(dataStr, QueryStartChargeDTO.class); + queryStartChargeDTO.setOperatorId(dto.getOperatorID()); + // Map map = lianLianService.query_stop_charge(queryStartChargeDTO); + Map map = lianLianService.queryStopCharge(queryStartChargeDTO); + + return CommonResult.success(0, "请求停止充电成功!", map.get("Data"), map.get("Sig")); + } catch (Exception e) { + logger.error("联联平台请求停止充电 error", e); + } + return CommonResult.failed("联联平台请求停止充电发生异常"); + } @@ -559,62 +558,61 @@ public class LianLianController extends BaseController { * @param dto * @return */ - // @PostMapping("/v1/notification_order_settlement_info") - // public CommonResult notification_order_settlement_info(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { - // logger.info("联联平台推送订单结算信息 params:{}", JSON.toJSONString(dto)); - // try { - // // 校验令牌 - // String token = request.getHeader("Authorization"); - // if (!JWTUtils.checkThirdPartyToken(token)) { - // // 校验失败 - // return CommonResult.failed("令牌校验错误"); - // } - // // 校验签名 - // // Map resultMap = lianLianService.checkoutSign(dto); - // // if (resultMap == null) { - // // // 签名错误 - // // return CommonResult.failed("签名校验错误"); - // // } - // // String operatorSecret = resultMap.get("OperatorSecret"); - // // String dataString = resultMap.get("Data"); - // // String dataSecret = resultMap.get("DataSecret"); - // // String dataSecretIV = resultMap.get("DataSecretIV"); - // - // // 查询配置信息 - // ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); - // String operatorSecret = platformConfig.getOperatorSecret(); - // String dataString = dto.getData(); - // String dataSecret = platformConfig.getDataSecret(); - // String dataSecretIV = platformConfig.getDataSecretIv(); - // - // // 解密data - // byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); - // String dataStr = new String(plainText, StandardCharsets.UTF_8); - // // 转换成相应对象 - // PushOrderSettlementDTO pushOrderSettlementDTO = JSONObject.parseObject(dataStr, PushOrderSettlementDTO.class); - // pushOrderSettlementDTO.setOperatorId(dto.getOperatorID()); - // Map map = lianLianService.pushOrderSettlementInfo(pushOrderSettlementDTO); - // // Map map = lianLianService.notificationOrderInfo(pushOrderSettlementDTO); - // - // return CommonResult.success(0, "推送订单结算信息成功!", map.get("Data"), map.get("Sig")); - // } catch (Exception e) { - // logger.info("联联平台推送订单结算信息 error:", e); - // e.printStackTrace(); - // } - // return CommonResult.failed("推送订单结算信息发生异常"); - // } + @PostMapping("/v1/notification_order_settlement_info") + public CommonResult notification_order_settlement_info(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { + logger.info("联联平台推送订单结算信息 params:{}", JSON.toJSONString(dto)); + try { + // 校验令牌 + String token = request.getHeader("Authorization"); + if (!JWTUtils.checkThirdPartyToken(token)) { + // 校验失败 + return CommonResult.failed("令牌校验错误"); + } + // 校验签名 + // Map resultMap = lianLianService.checkoutSign(dto); + // if (resultMap == null) { + // // 签名错误 + // return CommonResult.failed("签名校验错误"); + // } + // String operatorSecret = resultMap.get("OperatorSecret"); + // String dataString = resultMap.get("Data"); + // String dataSecret = resultMap.get("DataSecret"); + // String dataSecretIV = resultMap.get("DataSecretIV"); - // @GetMapping("/pushStationFee/{stationId}") - // public RestApiResponse pushStationFee(@PathVariable("stationId") String stationId) { - // RestApiResponse response = null; - // try { - // // String result = lianLianService.pushStationFee(stationId); - // String result = lianLianService.notificationStationFee(stationId); - // response = new RestApiResponse<>(result); - // } catch (Exception e) { - // e.printStackTrace(); - // } - // return response; - // } + // 查询配置信息 + ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); + String operatorSecret = platformConfig.getOperatorSecret(); + String dataString = dto.getData(); + String dataSecret = platformConfig.getDataSecret(); + String dataSecretIV = platformConfig.getDataSecretIv(); + + // 解密data + byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); + String dataStr = new String(plainText, StandardCharsets.UTF_8); + // 转换成相应对象 + PushOrderSettlementDTO pushOrderSettlementDTO = JSONObject.parseObject(dataStr, PushOrderSettlementDTO.class); + pushOrderSettlementDTO.setOperatorId(dto.getOperatorID()); + Map map = lianLianService.notificationOrderSettlementInfo(pushOrderSettlementDTO); + + return CommonResult.success(0, "推送订单结算信息成功!", map.get("Data"), map.get("Sig")); + } catch (Exception e) { + logger.info("联联平台推送订单结算信息 error:", e); + e.printStackTrace(); + } + return CommonResult.failed("推送订单结算信息发生异常"); + } + + @GetMapping("/pushStationFee/{stationId}") + public RestApiResponse pushStationFee(@PathVariable("stationId") String stationId) { + RestApiResponse response = null; + try { + // String result = lianLianService.pushStationFee(stationId); + String result = lianLianService.notificationStationFee(stationId); + response = new RestApiResponse<>(result); + } catch (Exception e) { + e.printStackTrace(); + } + return response; + } } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/ThirdPartyPlatformService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/ThirdPartyPlatformService.java index 9f3d4d52f..0c5da5f41 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/ThirdPartyPlatformService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/ThirdPartyPlatformService.java @@ -334,6 +334,13 @@ public interface ThirdPartyPlatformService { throw new UnsupportedOperationException("This method is not yet implemented"); } + /** + * 推送订单结算信息 notification_order_settlement_info + */ + default Map notificationOrderSettlementInfo(PushOrderSettlementDTO order) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + // -------------------------------------- 以下是公用方法 --------------------------------------- // /** * 从联联平台获取令牌 diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformServiceImpl.java index eef855800..89282c6f6 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformServiceImpl.java @@ -20,6 +20,7 @@ import com.jsowell.common.util.JWTUtils; import com.jsowell.common.util.PageUtils; import com.jsowell.common.util.StringUtils; import com.jsowell.pile.domain.*; +import com.jsowell.pile.dto.PushOrderSettlementDTO; import com.jsowell.pile.dto.QueryStationInfoDTO; import com.jsowell.pile.service.*; import com.jsowell.pile.thirdparty.CommonParamsDTO; @@ -857,5 +858,42 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService { return result; } + /** + * + */ + @Override + public Map notificationOrderSettlementInfo(PushOrderSettlementDTO dto) { + String orderCode = dto.getStartChargeSeq(); + Map map = new LinkedHashMap<>(); + map.put("StartChargeSeq", orderCode); + map.put("ConnectorID", dto.getConnectorID()); + int confirmResult = Constants.one; + // 根据订单号查询订单信息 + OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode); + OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode); + if (orderInfo == null || orderDetail == null) { + return null; + } + // 通过operatorID 查出 operatorSecret + ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId()); + if (platformConfig == null) { + return null; + } + // orderInfo 和 orderDetail 都不为空,再根据传过来的数据进行修改数据库信息 + confirmResult = Constants.zero; + orderDetail.setTotalUsedElectricity(dto.getTotalPower()); // 累计充电量 + orderDetail.setTotalOrderAmount(dto.getTotalMoney()); // 累计总金额 + orderBasicInfoService.updateOrderDetail(orderDetail); + map.put("ConfirmResult", confirmResult); + + Map resultMap = Maps.newLinkedHashMap(); + // 加密数据 + String encrypt = Cryptos.encrypt(JSON.toJSONString(map), platformConfig.getDataSecret(), platformConfig.getDataSecretIv()); + resultMap.put("Data", encrypt); + // 生成sig + String resultSign = GBSignUtils.sign(resultMap, platformConfig.getSignSecret()); + resultMap.put("Sig", resultSign); + return resultMap; + } } From 4b4fe4f12402fc03326149e6953c3c3216cb62b3 Mon Sep 17 00:00:00 2001 From: Guoqs Date: Mon, 1 Apr 2024 09:57:23 +0800 Subject: [PATCH 10/11] update --- .../test/java/SpringBootTestController.java | 31 +++++++++++++------ jsowell-ui/.env.staging | 2 +- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/jsowell-admin/src/test/java/SpringBootTestController.java b/jsowell-admin/src/test/java/SpringBootTestController.java index f1c626c4d..701656d65 100644 --- a/jsowell-admin/src/test/java/SpringBootTestController.java +++ b/jsowell-admin/src/test/java/SpringBootTestController.java @@ -56,6 +56,7 @@ import com.jsowell.pile.mapper.PileBillingTemplateMapper; import com.jsowell.pile.service.*; import com.jsowell.pile.service.programlogic.AbstractProgramLogic; import com.jsowell.pile.service.programlogic.ProgramLogicFactory; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.pile.transaction.dto.OrderTransactionDTO; import com.jsowell.pile.transaction.service.TransactionService; import com.jsowell.pile.util.SnUtils; @@ -71,12 +72,11 @@ import com.jsowell.service.PileService; import com.jsowell.service.TempService; import com.jsowell.thirdparty.amap.service.AMapService; import com.jsowell.thirdparty.huawei.HuaWeiService; -import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.service.LianLianService; +import com.jsowell.thirdparty.lutongyunting.service.LTYTService; import com.jsowell.thirdparty.platform.util.Cryptos; import com.jsowell.thirdparty.platform.util.Encodes; import com.jsowell.thirdparty.platform.util.GBSignUtils; -import com.jsowell.thirdparty.lutongyunting.service.LTYTService; import com.jsowell.wxpay.common.WeChatPayParameter; import com.jsowell.wxpay.dto.AppletTemplateMessageSendDTO; import com.jsowell.wxpay.response.WechatPayRefundRequest; @@ -595,14 +595,6 @@ public class SpringBootTestController { return refundList; } - public static void main(String[] args) { - BigDecimal totalAmount = new BigDecimal("0.1"); - List payments = Lists.newArrayList(new BigDecimal("0.97"), new BigDecimal("1.00")); - - List refunds = calculateRefund(totalAmount, payments); - System.out.println("每笔单需要退还的金额: " + refunds); - } - /** * 测试多笔支付情况,解冻部分金额 */ @@ -10028,4 +10020,23 @@ public class SpringBootTestController { adapayService.createSettleAccountRequest(settleAccountDTO, adapayMemberId, wechatAppId); } + public static void main(String[] args) { + String data = "{\"total\":1,\"stationStatusInfo\":{\"operationID\":\"123456789\",\"stationID\":\"111111111111111\",\"connectorStatusInfos\":{\"connectorID\":1,\"equipmentID\":\"10000000000000000000001\",\"status\":4,\"currentA\":0,\"currentB\":0,\"currentC\":0,\"voltageA\":0,\"voltageB\":0,\"voltageC\":0,\"soc\":10}}}"; + String dataSecret = "1234567890abcdef"; + String dataSecretIv = "1234567890abcdef"; + + // 加密数据 + String encryptData = Cryptos.encrypt(JSON.toJSONString(data), dataSecret, dataSecretIv); + String encryptData2 = Cryptos.aesEncrypt(JSON.toJSONString(data), dataSecret, dataSecretIv); + System.out.println(StringUtils.equals(encryptData, encryptData2)); + String str = "il7B0BSEjFdzpyKzfOFpvg/Se1CP802RItKYFPfSLRxJ3jf0bVl9hvYOEktPAYW2nd7S8MBcyHYyacHKbI" + + "Sq5iTmDzG+ivnR+SZJv3USNTYVMz9rCQVSxd0cLlqsJauko79NnwQJbzDTyLooYoIwz75qBOH2/x" + + "OMirpeEqRJrF/EQjWekJmGk9RtboXePu2rka+Xm51syBPhiXJAq0GfbfaFu9tNqs/e2Vjja/ltE1M0lq" + + "vxfXQ6da6HrThsm5id4ClZFIi0acRfrsPLRixS/IQYtksxghvJwbqOsbIsITail9Ayy4tKcogeEZiOO+4Ed2" + + "64NSKmk7l3wKwJLAFjCFogBx8GE3OBz4pqcAn/ydA="; + + System.out.println(StringUtils.equals(encryptData, str)); + System.out.println(StringUtils.equals(encryptData2, str)); + } + } diff --git a/jsowell-ui/.env.staging b/jsowell-ui/.env.staging index 554f41d9a..9d4c40f1c 100644 --- a/jsowell-ui/.env.staging +++ b/jsowell-ui/.env.staging @@ -7,4 +7,4 @@ NODE_ENV = production ENV = 'staging' # 万车充后台管理系统/测试环境 -VUE_APP_BASE_API = '/stage-api' +VUE_APP_BASE_API = '/dev-api' From 38fb0c160413b11f66fb1421bb1fdc6edf5b1e71 Mon Sep 17 00:00:00 2001 From: Guoqs Date: Mon, 1 Apr 2024 14:35:19 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=E6=9B=B4=E6=96=B0sit=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E4=BA=8C=E7=BB=B4=E7=A0=81=E5=89=8D=E7=BC=80=E5=9F=9F=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jsowell-admin/src/main/resources/application-sit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsowell-admin/src/main/resources/application-sit.yml b/jsowell-admin/src/main/resources/application-sit.yml index 2c1d78b9f..2d768da5d 100644 --- a/jsowell-admin/src/main/resources/application-sit.yml +++ b/jsowell-admin/src/main/resources/application-sit.yml @@ -103,7 +103,7 @@ logging: # 基础URL前缀 baseurl: - prefix: http://192.168.2.3:8080 + prefix: http://apitest.jsowellcloud.com:8080 # Minio配置 minio: