feat:正元跨单位、外来人员接口
This commit is contained in:
1 parent
d2e62d2fbf
commit
b03e37ac2c
21 files changed
+387
-31
No files matched your search
+6
@@ -1,10 +1,16 @@
|
||||
package com.bsd.pjcloud.thirdparty.dto.zy.foreign;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 获取区域编码
|
||||
*/
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class ZyForeignGetRegionIdByTokenDto {
|
||||
}
|
||||
+6
@@ -1,12 +1,18 @@
|
||||
package com.bsd.pjcloud.thirdparty.dto.zy.foreign;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 本地一卡通交易数据同步
|
||||
*/
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class ZyForeignSyncNativeCardTradeInfoDto {
|
||||
|
||||
|
||||
+6
@@ -1,10 +1,16 @@
|
||||
package com.bsd.pjcloud.thirdparty.dto.zy.mer;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 获取token
|
||||
*/
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class ZyMerGetTokenDto {
|
||||
|
||||
|
||||
+6
@@ -1,10 +1,16 @@
|
||||
package com.bsd.pjcloud.thirdparty.dto.zy.mer;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 身份信息同步
|
||||
*/
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class ZyMerSyncAccClassInfoDto {
|
||||
|
||||
|
||||
+6
@@ -1,10 +1,16 @@
|
||||
package com.bsd.pjcloud.thirdparty.dto.zy.mer;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 账户信息同步
|
||||
*/
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class ZyMerSyncAccountInfoDto {
|
||||
|
||||
|
||||
+6
@@ -1,10 +1,16 @@
|
||||
package com.bsd.pjcloud.thirdparty.dto.zy.self;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 第三方url健康探测
|
||||
*/
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class ZySelfCheckSystemStatusDto {
|
||||
|
||||
|
||||
+6
@@ -1,10 +1,16 @@
|
||||
package com.bsd.pjcloud.thirdparty.dto.zy.self;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 第三方一卡通系统提供冲正接口
|
||||
*/
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class ZySelfCorrectDto {
|
||||
|
||||
|
||||
+6
@@ -1,10 +1,16 @@
|
||||
package com.bsd.pjcloud.thirdparty.dto.zy.self;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 第三方提供获取token
|
||||
*/
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class ZySelfGetTokenDto {
|
||||
|
||||
|
||||
+6
@@ -1,10 +1,16 @@
|
||||
package com.bsd.pjcloud.thirdparty.dto.zy.self;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 第三方一卡通系统提供扣费接口
|
||||
*/
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class ZySelfPayDto {
|
||||
|
||||
|
||||
+6
@@ -1,10 +1,16 @@
|
||||
package com.bsd.pjcloud.thirdparty.dto.zy.stride;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 统一身份验证功能
|
||||
*/
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class ZyStrideAuthenticationDto {
|
||||
|
||||
|
||||
+6
@@ -1,10 +1,16 @@
|
||||
package com.bsd.pjcloud.thirdparty.dto.zy.stride;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 智慧园区通刷平台提供消费接口
|
||||
*/
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class ZyStrideConsumptionDto {
|
||||
|
||||
|
||||
+6
@@ -1,10 +1,16 @@
|
||||
package com.bsd.pjcloud.thirdparty.dto.zy.stride;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 智慧园区通刷平台提供冲正接口
|
||||
*/
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class ZyStrideCorrectDto {
|
||||
|
||||
|
||||
+16
@@ -1,4 +1,20 @@
|
||||
package com.bsd.pjcloud.thirdparty.service.impl;
|
||||
|
||||
import com.bsd.pjcloud.thirdparty.dto.zy.foreign.ZyForeignGetRegionIdByTokenDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.zy.foreign.ZyForeignSyncNativeCardTradeInfoDto;
|
||||
import com.bsd.pjcloud.thirdparty.vo.zy.foreign.ZyForeignGetRegionIdByTokenVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.zy.foreign.ZyForeignSyncNativeCardTradeInfoVo;
|
||||
|
||||
public interface ZyForeignService {
|
||||
|
||||
/**
|
||||
* 本地一卡通交易数据同步
|
||||
*/
|
||||
ZyForeignSyncNativeCardTradeInfoVo syncNativeCardTradeInfoApi(ZyForeignSyncNativeCardTradeInfoDto dto);
|
||||
|
||||
/**
|
||||
* 获取区域编码
|
||||
*/
|
||||
ZyForeignGetRegionIdByTokenVo getRegionIdByToken(ZyForeignGetRegionIdByTokenDto dto);
|
||||
|
||||
}
|
||||
+1
-1
@@ -26,6 +26,6 @@ public interface ZyMerService {
|
||||
/**
|
||||
* 身份信息同步
|
||||
*/
|
||||
ZyMerSyncAccClassInfoVo syncAccClassInfo(ZyMerSyncAccClassInfoDto dto);
|
||||
ZyMerSyncAccClassInfoVo syncAccClassInfoApi(ZyMerSyncAccClassInfoDto dto);
|
||||
|
||||
}
|
||||
+23
@@ -1,4 +1,27 @@
|
||||
package com.bsd.pjcloud.thirdparty.service.impl;
|
||||
|
||||
import com.bsd.pjcloud.thirdparty.dto.zy.stride.ZyStrideAuthenticationDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.zy.stride.ZyStrideConsumptionDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.zy.stride.ZyStrideCorrectDto;
|
||||
import com.bsd.pjcloud.thirdparty.vo.zy.stride.ZyStrideAuthenticationVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.zy.stride.ZyStrideConsumptionVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.zy.stride.ZyStrideCorrectVo;
|
||||
|
||||
public interface ZyStrideService {
|
||||
|
||||
/**
|
||||
* 统一身份验证功能
|
||||
*/
|
||||
ZyStrideAuthenticationVo authenticationApi(ZyStrideAuthenticationDto dto);
|
||||
|
||||
/**
|
||||
* 智慧园区通刷平台提供消费接口
|
||||
*/
|
||||
ZyStrideConsumptionVo consumptionApi(ZyStrideConsumptionDto dto);
|
||||
|
||||
/**
|
||||
* 智慧园区通刷平台提供冲正接口
|
||||
*/
|
||||
ZyStrideCorrectVo correctApi(ZyStrideCorrectDto dto);
|
||||
|
||||
}
|
||||
+76
@@ -1,15 +1,91 @@
|
||||
package com.bsd.pjcloud.thirdparty.service.impl.zy;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.bsd.pjcloud.thirdparty.config.ZyConfig;
|
||||
import com.bsd.pjcloud.thirdparty.dto.zy.foreign.ZyForeignGetRegionIdByTokenDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.zy.foreign.ZyForeignSyncNativeCardTradeInfoDto;
|
||||
import com.bsd.pjcloud.thirdparty.service.impl.ZyForeignService;
|
||||
import com.bsd.pjcloud.thirdparty.utils.zy.api.ZyApi;
|
||||
import com.bsd.pjcloud.thirdparty.utils.zy.api.ZyApiTool;
|
||||
import com.bsd.pjcloud.thirdparty.vo.zy.foreign.ZyForeignGetRegionIdByTokenVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.zy.foreign.ZyForeignSyncNativeCardTradeInfoVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class ZyForeignServiceImpl implements ZyForeignService {
|
||||
|
||||
private final String TAG = "正元跨部门api";
|
||||
|
||||
private final ZyConfig zyConfig;
|
||||
|
||||
private final ZyApiTool zyApiTool;
|
||||
|
||||
/**
|
||||
* 本地一卡通交易数据同步
|
||||
*/
|
||||
@Override
|
||||
public ZyForeignSyncNativeCardTradeInfoVo syncNativeCardTradeInfoApi(ZyForeignSyncNativeCardTradeInfoDto dto) {
|
||||
String url = zyConfig.getBaseUrl() + ZyApi.Foreign.SYNC_NATIVE_CARD_TRADE_INFO;
|
||||
try {
|
||||
url = String.format(url, zyApiTool.getToken());
|
||||
Map<String, Object> encryptionBody = new HashMap<>();
|
||||
encryptionBody.put("regionCode", dto);
|
||||
String body = zyApiTool.getEncryptionDto(encryptionBody);
|
||||
String res = HttpRequest.post(url)
|
||||
.body(body)
|
||||
.execute()
|
||||
.body();
|
||||
if (ObjectUtil.isEmpty(res)) {
|
||||
throw new RuntimeException("response is empty");
|
||||
}
|
||||
ZyForeignSyncNativeCardTradeInfoVo vo = JSONUtil.toBean(res, ZyForeignSyncNativeCardTradeInfoVo.class);
|
||||
if (!vo.isSuccess()) {
|
||||
throw new RuntimeException(String.format("请求错误res|%s|url|%s|body|%s|", res, url, body));
|
||||
}
|
||||
return vo;
|
||||
} catch (Exception e) {
|
||||
log.error("|{}||syncNativeCardTradeInfoApi|意外的错误error|{}|", TAG, e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取区域编码
|
||||
*/
|
||||
@Override
|
||||
public ZyForeignGetRegionIdByTokenVo getRegionIdByToken(ZyForeignGetRegionIdByTokenDto dto) {
|
||||
String url = zyConfig.getBaseUrl() + ZyApi.Foreign.GET_REGION_ID_BY_TOKEN;
|
||||
try {
|
||||
url = String.format(url, zyApiTool.getToken());
|
||||
Map<String, Object> encryptionBody = new HashMap<>();
|
||||
encryptionBody.put("accClasses", dto);
|
||||
String body = zyApiTool.getEncryptionDto(encryptionBody);
|
||||
String res = HttpRequest.post(url)
|
||||
.body(body)
|
||||
.execute()
|
||||
.body();
|
||||
if (ObjectUtil.isEmpty(res)) {
|
||||
throw new RuntimeException("response is empty");
|
||||
}
|
||||
ZyForeignGetRegionIdByTokenVo vo = JSONUtil.toBean(res, ZyForeignGetRegionIdByTokenVo.class);
|
||||
if (!vo.isSuccess()) {
|
||||
throw new RuntimeException(String.format("请求错误res|%s|url|%s|body|%s|", res, url, body));
|
||||
}
|
||||
return vo;
|
||||
} catch (Exception e) {
|
||||
log.error("|{}||getRegionIdByToken|意外的错误error|{}|", TAG, e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+6
-13
@@ -1,10 +1,8 @@
|
||||
package com.bsd.pjcloud.thirdparty.service.impl.zy;
|
||||
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.bsd.pjcloud.common.core.constant.CacheConstants;
|
||||
import com.bsd.pjcloud.thirdparty.config.ZyConfig;
|
||||
import com.bsd.pjcloud.thirdparty.dto.zy.mer.ZyMerSyncAccClassInfoDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.zy.mer.ZyMerSyncAccountInfoDto;
|
||||
@@ -16,24 +14,19 @@ import com.bsd.pjcloud.thirdparty.utils.zy.api.ZyApiTool;
|
||||
import com.bsd.pjcloud.thirdparty.vo.zy.mer.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.apache.commons.codec.digest.DigestUtils.md5Hex;
|
||||
|
||||
@Service
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class ZyMerServiceImpl implements ZyMerService {
|
||||
|
||||
private final String TAG = "ZyMerServiceImpl";
|
||||
private final String TAG = "正元商户api";
|
||||
|
||||
private final ZyConfig zyConfig;
|
||||
|
||||
@@ -63,7 +56,7 @@ public class ZyMerServiceImpl implements ZyMerService {
|
||||
}
|
||||
return vo;
|
||||
} catch (Exception e) {
|
||||
log.error("|{}||syncDealerInfo|意外的错误error|{}|", TAG, e.getMessage());
|
||||
log.error("|{}||syncDealerInfoApi|意外的错误error|{}|", TAG, e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -92,7 +85,7 @@ public class ZyMerServiceImpl implements ZyMerService {
|
||||
}
|
||||
return vo;
|
||||
} catch (Exception e) {
|
||||
log.error("|{}||syncEnterpriseInfo|意外的错误error|{}|", TAG, e.getMessage());
|
||||
log.error("|{}||syncEnterpriseInfoApi|意外的错误error|{}|", TAG, e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -121,7 +114,7 @@ public class ZyMerServiceImpl implements ZyMerService {
|
||||
}
|
||||
return vo;
|
||||
} catch (Exception e) {
|
||||
log.error("|{}||syncAccountInfo|意外的错误error|{}|", TAG, e.getMessage());
|
||||
log.error("|{}||syncAccountInfoApi|意外的错误error|{}|", TAG, e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -130,7 +123,7 @@ public class ZyMerServiceImpl implements ZyMerService {
|
||||
* 身份信息同步
|
||||
*/
|
||||
@Override
|
||||
public ZyMerSyncAccClassInfoVo syncAccClassInfo(ZyMerSyncAccClassInfoDto dto) {
|
||||
public ZyMerSyncAccClassInfoVo syncAccClassInfoApi(ZyMerSyncAccClassInfoDto dto) {
|
||||
String url = zyConfig.getBaseUrl() + ZyApi.Mer.SYNC_ACC_CLASS_INFO;
|
||||
try {
|
||||
url = String.format(url, zyApiTool.getToken());
|
||||
@@ -150,7 +143,7 @@ public class ZyMerServiceImpl implements ZyMerService {
|
||||
}
|
||||
return vo;
|
||||
} catch (Exception e) {
|
||||
log.error("|{}||syncAccClassInfo|意外的错误error|{}|", TAG, e.getMessage());
|
||||
log.error("|{}||syncAccClassInfoApi|意外的错误error|{}|", TAG, e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
+108
@@ -1,15 +1,123 @@
|
||||
package com.bsd.pjcloud.thirdparty.service.impl.zy;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.bsd.pjcloud.thirdparty.config.ZyConfig;
|
||||
import com.bsd.pjcloud.thirdparty.dto.zy.stride.ZyStrideAuthenticationDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.zy.stride.ZyStrideConsumptionDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.zy.stride.ZyStrideCorrectDto;
|
||||
import com.bsd.pjcloud.thirdparty.service.impl.ZyStrideService;
|
||||
import com.bsd.pjcloud.thirdparty.utils.zy.api.ZyApi;
|
||||
import com.bsd.pjcloud.thirdparty.utils.zy.api.ZyApiTool;
|
||||
import com.bsd.pjcloud.thirdparty.vo.zy.mer.ZyMerSyncDealerInfoVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.zy.stride.ZyStrideAuthenticationVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.zy.stride.ZyStrideConsumptionVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.zy.stride.ZyStrideCorrectVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class ZyStrideServiceImpl implements ZyStrideService {
|
||||
|
||||
private final String TAG = "正元外来人员api";
|
||||
|
||||
private final ZyConfig zyConfig;
|
||||
|
||||
private final ZyApiTool zyApiTool;
|
||||
|
||||
/**
|
||||
* 统一身份验证功能
|
||||
*/
|
||||
@Override
|
||||
public ZyStrideAuthenticationVo authenticationApi(ZyStrideAuthenticationDto dto) {
|
||||
String url = zyConfig.getBaseUrl() + ZyApi.Stride.AUTHENTICATION;
|
||||
try {
|
||||
url = String.format(url, zyApiTool.getToken());
|
||||
Map<String, Object> encryptionBody = new HashMap<>();
|
||||
encryptionBody.put("dealers", dto);
|
||||
String body = zyApiTool.getEncryptionDto(encryptionBody);
|
||||
String res = HttpRequest.post(url)
|
||||
.body(body)
|
||||
.execute()
|
||||
.body();
|
||||
if (ObjectUtil.isEmpty(res)) {
|
||||
throw new RuntimeException("response is empty");
|
||||
}
|
||||
ZyStrideAuthenticationVo vo = JSONUtil.toBean(res, ZyStrideAuthenticationVo.class);
|
||||
if (!vo.isSuccess()) {
|
||||
throw new RuntimeException(String.format("请求错误res|%s|url|%s|body|%s|", res, url, body));
|
||||
}
|
||||
return vo;
|
||||
} catch (Exception e) {
|
||||
log.error("|{}||authenticationApi|意外的错误error|{}|", TAG, e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 智慧园区通刷平台提供消费接口
|
||||
*/
|
||||
@Override
|
||||
public ZyStrideConsumptionVo consumptionApi(ZyStrideConsumptionDto dto) {
|
||||
String url = zyConfig.getBaseUrl() + ZyApi.Stride.CONSUMPTION;
|
||||
try {
|
||||
url = String.format(url, zyApiTool.getToken());
|
||||
Map<String, Object> encryptionBody = new HashMap<>();
|
||||
encryptionBody.put("dealers", dto);
|
||||
String body = zyApiTool.getEncryptionDto(encryptionBody);
|
||||
String res = HttpRequest.post(url)
|
||||
.body(body)
|
||||
.execute()
|
||||
.body();
|
||||
if (ObjectUtil.isEmpty(res)) {
|
||||
throw new RuntimeException("response is empty");
|
||||
}
|
||||
ZyStrideConsumptionVo vo = JSONUtil.toBean(res, ZyStrideConsumptionVo.class);
|
||||
if (!vo.isSuccess()) {
|
||||
throw new RuntimeException(String.format("请求错误res|%s|url|%s|body|%s|", res, url, body));
|
||||
}
|
||||
return vo;
|
||||
} catch (Exception e) {
|
||||
log.error("|{}||consumptionApi|意外的错误error|{}|", TAG, e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 智慧园区通刷平台提供冲正接口
|
||||
*/
|
||||
@Override
|
||||
public ZyStrideCorrectVo correctApi(ZyStrideCorrectDto dto) {
|
||||
String url = zyConfig.getBaseUrl() + ZyApi.Stride.CORRECT;
|
||||
try {
|
||||
url = String.format(url, zyApiTool.getToken());
|
||||
Map<String, Object> encryptionBody = new HashMap<>();
|
||||
encryptionBody.put("dealers", dto);
|
||||
String body = zyApiTool.getEncryptionDto(encryptionBody);
|
||||
String res = HttpRequest.post(url)
|
||||
.body(body)
|
||||
.execute()
|
||||
.body();
|
||||
if (ObjectUtil.isEmpty(res)) {
|
||||
throw new RuntimeException("response is empty");
|
||||
}
|
||||
ZyStrideCorrectVo vo = JSONUtil.toBean(res, ZyStrideCorrectVo.class);
|
||||
if (!vo.isSuccess()) {
|
||||
throw new RuntimeException(String.format("请求错误res|%s|url|%s|body|%s|", res, url, body));
|
||||
}
|
||||
return vo;
|
||||
} catch (Exception e) {
|
||||
log.error("|{}||correctApi|意外的错误error|{}|", TAG, e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -24,19 +24,19 @@ public class ZyApi {
|
||||
// 统一身份验证功能
|
||||
public class Stride {
|
||||
// 统一身份验证功能
|
||||
public static final String AUTHENTICATION = "/authentication?access_token={access_token}";
|
||||
public static final String AUTHENTICATION = "/api/authentication?access_token=%s";
|
||||
// 智慧园区通刷平台提供消费接口
|
||||
public static final String CONSUMPTION = "/consumption?access_token={access_token}";
|
||||
public static final String CONSUMPTION = "/api/consumption?access_token=%s";
|
||||
// 智慧园区通刷平台提供冲正接口
|
||||
public static final String CORRECT = "/correct?access_token={access_token}";
|
||||
public static final String CORRECT = "/api/correct?access_token=%s";
|
||||
}
|
||||
|
||||
// 本地一卡通交易数据同步
|
||||
public static class Foreign {
|
||||
// 本地一卡通交易数据同步
|
||||
public static final String SYNC_NATIVE_CARD_TRADE_INFO = "/getToken/syncNativeCardTradeInfo?access_token={access_token}";
|
||||
public static final String SYNC_NATIVE_CARD_TRADE_INFO = "/api/getToken/syncNativeCardTradeInfo?access_token=%s";
|
||||
// 获取区域编码
|
||||
public static final String GET_REGION_ID_BY_TOKEN = "/getRegionIdByToken?access_token={access_token}";
|
||||
public static final String GET_REGION_ID_BY_TOKEN = "/api/getRegionIdByToken?access_token=%s";
|
||||
}
|
||||
|
||||
// 第三方需提供的接口
|
||||
@@ -44,11 +44,11 @@ public class ZyApi {
|
||||
// 第三方url健康探测
|
||||
public static final String CHECK_SYSTEM_STATUS = "/checkSystemStatus";
|
||||
// 第三方一卡通系统提供冲正接口
|
||||
public static final String CORRECT = "/correct?access_token={access_token}";
|
||||
public static final String CORRECT = "/correct?access_token=%s";
|
||||
// 第三方一卡通系统提供扣费接口
|
||||
public static final String PAY = "/pay?access_token={access_token}";
|
||||
public static final String PAY = "/pay?access_token=%s";
|
||||
// 第三方提供获取token
|
||||
public static final String GET_TOKEN = "/getToken?appId={appid}&appSecret={appsecret}_1730169197889";
|
||||
public static final String GET_TOKEN = "/getToken?appId=%s&appSecret=%s";
|
||||
}
|
||||
|
||||
}
|
||||
-1
@@ -10,7 +10,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
+77
-8
@@ -2,13 +2,25 @@ package com.bsd.pjcloud.admin;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.bsd.pjcloud.thirdparty.ThirdPartyApp;
|
||||
import com.bsd.pjcloud.thirdparty.dto.zy.foreign.ZyForeignGetRegionIdByTokenDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.zy.foreign.ZyForeignSyncNativeCardTradeInfoDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.zy.mer.ZyMerSyncAccClassInfoDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.zy.mer.ZyMerSyncAccountInfoDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.zy.mer.ZyMerSyncDealerInfoDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.zy.mer.ZyMerSyncEnterpriseInfoDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.zy.stride.ZyStrideAuthenticationDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.zy.stride.ZyStrideConsumptionDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.zy.stride.ZyStrideCorrectDto;
|
||||
import com.bsd.pjcloud.thirdparty.service.impl.ZyForeignService;
|
||||
import com.bsd.pjcloud.thirdparty.service.impl.ZyMerService;
|
||||
import com.bsd.pjcloud.thirdparty.service.impl.ZyStrideService;
|
||||
import com.bsd.pjcloud.thirdparty.utils.zy.api.ZyApiTool;
|
||||
import com.bsd.pjcloud.thirdparty.vo.zy.foreign.ZyForeignGetRegionIdByTokenVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.zy.foreign.ZyForeignSyncNativeCardTradeInfoVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.zy.mer.*;
|
||||
import com.bsd.pjcloud.thirdparty.vo.zy.stride.ZyStrideAuthenticationVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.zy.stride.ZyStrideConsumptionVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.zy.stride.ZyStrideCorrectVo;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
@@ -22,10 +34,14 @@ import java.util.Map;
|
||||
public class ZyTest {
|
||||
|
||||
@Resource
|
||||
private ZyMerService zyMerService;
|
||||
private ZyApiTool zyApiTool;
|
||||
|
||||
@Resource
|
||||
private ZyApiTool zyApiTool;
|
||||
private ZyMerService zyMerService;
|
||||
@Resource
|
||||
private ZyForeignService zyForeignService;
|
||||
@Resource
|
||||
private ZyStrideService zyStrideService;
|
||||
|
||||
/************************** start mer start **************************/
|
||||
|
||||
@@ -59,7 +75,7 @@ public class ZyTest {
|
||||
* 记账单位同步
|
||||
*/
|
||||
@Test
|
||||
public void merSyncEnterpriseInfo(){
|
||||
public void merSyncEnterpriseInfo() {
|
||||
ZyMerSyncEnterpriseInfoDto dto = new ZyMerSyncEnterpriseInfoDto();
|
||||
ZyMerSyncEnterpriseInfoVo vo = zyMerService.syncEnterpriseInfoApi(dto);
|
||||
System.out.println(vo);
|
||||
@@ -69,7 +85,7 @@ public class ZyTest {
|
||||
* 账户信息同步
|
||||
*/
|
||||
@Test
|
||||
public void merSyncAccountInfoApi(){
|
||||
public void merSyncAccountInfoApi() {
|
||||
ZyMerSyncAccountInfoDto dto = new ZyMerSyncAccountInfoDto();
|
||||
ZyMerSyncAccountInfoVo vo = zyMerService.syncAccountInfoApi(dto);
|
||||
System.out.println(vo);
|
||||
@@ -79,21 +95,74 @@ public class ZyTest {
|
||||
* 身份信息同步
|
||||
*/
|
||||
@Test
|
||||
public void merSyncAccClassInfo(){
|
||||
public void merSyncAccClassInfo() {
|
||||
ZyMerSyncAccClassInfoDto dto = new ZyMerSyncAccClassInfoDto();
|
||||
ZyMerSyncAccClassInfoVo vo = zyMerService.syncAccClassInfo(dto);
|
||||
ZyMerSyncAccClassInfoVo vo = zyMerService.syncAccClassInfoApi(dto);
|
||||
System.out.println(vo);
|
||||
}
|
||||
|
||||
/************************** end mer end **************************/
|
||||
|
||||
|
||||
/************************** start mer start **************************/
|
||||
/************************** start foreign start **************************/
|
||||
|
||||
/**
|
||||
* 身份信息同步
|
||||
*/
|
||||
@Test
|
||||
public void foreignSyncAccClassInfo() {
|
||||
ZyForeignSyncNativeCardTradeInfoDto dto = new ZyForeignSyncNativeCardTradeInfoDto();
|
||||
ZyForeignSyncNativeCardTradeInfoVo vo = zyForeignService.syncNativeCardTradeInfoApi(dto);
|
||||
System.out.println(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 身份信息同步
|
||||
*/
|
||||
@Test
|
||||
public void foreignGetRegionIdByToken() {
|
||||
ZyForeignGetRegionIdByTokenDto dto = new ZyForeignGetRegionIdByTokenDto();
|
||||
ZyForeignGetRegionIdByTokenVo vo = zyForeignService.getRegionIdByToken(dto);
|
||||
System.out.println(vo);
|
||||
}
|
||||
|
||||
/************************** end foreign end **************************/
|
||||
|
||||
|
||||
/************************** start stride start **************************/
|
||||
|
||||
/************************** end mer end **************************/
|
||||
/**
|
||||
* 统一身份验证功能
|
||||
*/
|
||||
@Test
|
||||
public void strideAuthenticationApi() {
|
||||
ZyStrideAuthenticationDto dto = new ZyStrideAuthenticationDto();
|
||||
ZyStrideAuthenticationVo vo = zyStrideService.authenticationApi(dto);
|
||||
System.out.println(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 智慧园区通刷平台提供消费接口
|
||||
*/
|
||||
@Test
|
||||
public void strideConsumptionApi() {
|
||||
ZyStrideConsumptionDto dto = new ZyStrideConsumptionDto();
|
||||
ZyStrideConsumptionVo vo = zyStrideService.consumptionApi(dto);
|
||||
System.out.println(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 智慧园区通刷平台提供冲正接口
|
||||
*/
|
||||
@Test
|
||||
public void strideCorrectApi() {
|
||||
ZyStrideCorrectDto dto = new ZyStrideCorrectDto();
|
||||
ZyStrideCorrectVo vo = zyStrideService.correctApi(dto);
|
||||
System.out.println(vo);
|
||||
}
|
||||
|
||||
|
||||
/************************** end stride end **************************/
|
||||
|
||||
@Test
|
||||
public void encryption() {
|
||||
|
||||
Reference in new issue
Block a user