mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-04 10:00:11 +08:00
Merge branch 'dev' of http://192.168.2.2:8099/jsowell/jsowell-charger-web into dev
This commit is contained in:
72
jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/ThirdPartyBaseController.java
vendored
Normal file
72
jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/ThirdPartyBaseController.java
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
package com.jsowell.web.controller.thirdparty;
|
||||
|
||||
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.exception.BusinessException;
|
||||
import com.jsowell.pile.thirdparty.CommonParamsDTO;
|
||||
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
|
||||
import com.jsowell.thirdparty.lianlian.common.CommonResult;
|
||||
import com.jsowell.thirdparty.platform.ThirdPartyPlatformService;
|
||||
import com.jsowell.thirdparty.platform.util.Cryptos;
|
||||
import com.jsowell.thirdparty.service.ThirdpartySecretInfoService;
|
||||
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.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 内蒙古接口
|
||||
*/
|
||||
@Anonymous
|
||||
@RestController
|
||||
public class ThirdPartyBaseController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("zhongDianLianPlatformServiceImpl")
|
||||
private ThirdPartyPlatformService platformLogic;
|
||||
|
||||
@Autowired
|
||||
private ThirdpartySecretInfoService thirdpartySecretInfoService;
|
||||
|
||||
/**
|
||||
* 获取token接口
|
||||
* http://localhost:8080/query_token
|
||||
*/
|
||||
@PostMapping("/query_token")
|
||||
public CommonResult<?> queryToken(@RequestBody CommonParamsDTO dto) {
|
||||
logger.info("平台请求令牌 params:{}", JSON.toJSONString(dto));
|
||||
try {
|
||||
Map<String, String> map = platformLogic.queryToken(dto);
|
||||
logger.info("平台请求令牌 result:{}", JSON.toJSONString(map));
|
||||
return CommonResult.success(0, "请求令牌成功!", map.get("Data"), map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
logger.error("平台请求令牌接口 异常", e);
|
||||
return CommonResult.failed("获取token发生异常");
|
||||
}
|
||||
}
|
||||
|
||||
// 解析DTO
|
||||
protected <T> T parseDto(CommonParamsDTO dto, Class<T> targetClass) {
|
||||
// 解密
|
||||
String operatorId = dto.getOperatorID();
|
||||
// 通过operatorId 查出 operatorSecret
|
||||
// ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorId);
|
||||
ThirdPartySecretInfoVO secretInfoVO = thirdpartySecretInfoService.queryByOperatorId(operatorId);
|
||||
if (secretInfoVO == null) {
|
||||
throw new BusinessException("1", "无此对接平台");
|
||||
}
|
||||
|
||||
String dataSecret = secretInfoVO.getTheirDataSecret();
|
||||
String dataSecretIv = secretInfoVO.getTheirDataSecretIv();
|
||||
|
||||
// 解密data 获取参数中的OperatorSecret
|
||||
String decrypt = Cryptos.decrypt(dto.getData(), dataSecret, dataSecretIv);
|
||||
return JSONObject.parseObject(decrypt, targetClass);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.jsowell.web.controller.thirdparty;
|
||||
|
||||
import com.jsowell.common.annotation.Log;
|
||||
import com.jsowell.common.core.controller.BaseController;
|
||||
import com.jsowell.common.core.domain.AjaxResult;
|
||||
import com.jsowell.common.core.page.TableDataInfo;
|
||||
import com.jsowell.common.enums.BusinessType;
|
||||
import com.jsowell.common.util.poi.ExcelUtil;
|
||||
import com.jsowell.thirdparty.domain.ThirdpartySecretInfo;
|
||||
import com.jsowell.thirdparty.service.ThirdpartySecretInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 对接三方平台配置Controller
|
||||
*
|
||||
* @author jsowell
|
||||
* @date 2024-04-18
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/thirdparty/secret")
|
||||
public class ThirdpartySecretInfoController extends BaseController {
|
||||
@Autowired
|
||||
private ThirdpartySecretInfoService thirdpartySecretInfoService;
|
||||
|
||||
/**
|
||||
* 查询对接三方平台配置列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('thirdparty:secret:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ThirdpartySecretInfo thirdpartySecretInfo) {
|
||||
startPage();
|
||||
List<ThirdpartySecretInfo> list = thirdpartySecretInfoService.selectThirdpartySecretInfoList(thirdpartySecretInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出对接三方平台配置列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('thirdparty:secret:export')")
|
||||
@Log(title = "对接三方平台配置", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ThirdpartySecretInfo thirdpartySecretInfo) {
|
||||
List<ThirdpartySecretInfo> list = thirdpartySecretInfoService.selectThirdpartySecretInfoList(thirdpartySecretInfo);
|
||||
ExcelUtil<ThirdpartySecretInfo> util = new ExcelUtil<ThirdpartySecretInfo>(ThirdpartySecretInfo.class);
|
||||
util.exportExcel(response, list, "对接三方平台配置数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取对接三方平台配置详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('thirdparty:secret:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(thirdpartySecretInfoService.selectThirdpartySecretInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增对接三方平台配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('thirdparty:secret:add')")
|
||||
@Log(title = "对接三方平台配置", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ThirdpartySecretInfo thirdpartySecretInfo) {
|
||||
return toAjax(thirdpartySecretInfoService.insertThirdpartySecretInfo(thirdpartySecretInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改对接三方平台配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('thirdparty:secret:edit')")
|
||||
@Log(title = "对接三方平台配置", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ThirdpartySecretInfo thirdpartySecretInfo) {
|
||||
return toAjax(thirdpartySecretInfoService.updateThirdpartySecretInfo(thirdpartySecretInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除对接三方平台配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('thirdparty:secret:remove')")
|
||||
@Log(title = "对接三方平台配置", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(thirdpartySecretInfoService.deleteThirdpartySecretInfoByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,14 @@
|
||||
package com.jsowell.web.controller.thirdparty.neimenggu;
|
||||
|
||||
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.exception.BusinessException;
|
||||
import com.jsowell.pile.domain.ThirdPartyPlatformConfig;
|
||||
import com.jsowell.pile.dto.QueryOperatorInfoDTO;
|
||||
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.service.ThirdpartySecretInfoService;
|
||||
import com.jsowell.web.controller.thirdparty.ThirdPartyBaseController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -23,18 +19,18 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 内蒙古接口
|
||||
* 内蒙古自治区充电设施监测服务平台
|
||||
*/
|
||||
@Anonymous
|
||||
@RestController
|
||||
@RequestMapping("/evcs")
|
||||
public class NMGController extends BaseController {
|
||||
public class NMGController extends ThirdPartyBaseController {
|
||||
@Autowired
|
||||
@Qualifier("neiMengGuPlatformServiceImpl")
|
||||
private ThirdPartyPlatformService platformLogic;
|
||||
|
||||
@Autowired
|
||||
private ThirdPartyPlatformConfigService thirdPartyPlatformConfigService;
|
||||
private ThirdpartySecretInfoService thirdpartySecretInfoService;
|
||||
|
||||
/**
|
||||
* 获取token接口
|
||||
@@ -42,37 +38,17 @@ public class NMGController extends BaseController {
|
||||
*/
|
||||
@PostMapping("/v1/query_token")
|
||||
public CommonResult<?> queryToken(@RequestBody CommonParamsDTO dto) {
|
||||
logger.info("海南平台请求令牌 params:{}", JSON.toJSONString(dto));
|
||||
logger.info("内蒙古平台请求令牌 params:{}", JSON.toJSONString(dto));
|
||||
try {
|
||||
Map<String, String> map = platformLogic.queryToken(dto);
|
||||
logger.info("海南平台请求令牌 result:{}", JSON.toJSONString(map));
|
||||
logger.info("内蒙古平台请求令牌 result:{}", JSON.toJSONString(map));
|
||||
return CommonResult.success(0, "请求令牌成功!", map.get("Data"), map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
logger.error("海南平台 请求令牌接口 异常", e);
|
||||
logger.error("内蒙古平台 请求令牌接口 异常", e);
|
||||
return CommonResult.failed("获取token发生异常");
|
||||
}
|
||||
}
|
||||
|
||||
// 解析DTO
|
||||
private <T> T parseDto(CommonParamsDTO dto, Class<T> targetClass) {
|
||||
// 解密
|
||||
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
|
||||
String decrypt = Cryptos.decrypt(dto.getData(), dataSecret, dataSecretIv);
|
||||
return JSONObject.parseObject(decrypt, targetClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询运营商信息
|
||||
* 接口名称:supervise_query_operator_info
|
||||
@@ -82,14 +58,14 @@ public class NMGController extends BaseController {
|
||||
*/
|
||||
@PostMapping("/v1/supervise_query_operator_info")
|
||||
public CommonResult<?> queryOperatorInfo(@RequestBody CommonParamsDTO dto) {
|
||||
logger.info("海南平台查询运营商信息 params:{}", JSON.toJSONString(dto));
|
||||
logger.info("内蒙古平台查询运营商信息 params:{}", JSON.toJSONString(dto));
|
||||
try {
|
||||
QueryOperatorInfoDTO paramDTO = parseDto(dto, QueryOperatorInfoDTO.class);
|
||||
Map<String, String> map = platformLogic.queryOperatorInfo(paramDTO);
|
||||
logger.info("海南平台查询运营商信息 result:{}", JSON.toJSONString(map));
|
||||
logger.info("内蒙古平台查询运营商信息 result:{}", JSON.toJSONString(map));
|
||||
return CommonResult.success(0, "请求令牌成功!", map.get("Data"), map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
logger.error("海南平台查询运营商信息 异常", e);
|
||||
logger.error("内蒙古平台查询运营商信息 异常", e);
|
||||
return CommonResult.failed("查询运营商信息发生异常");
|
||||
}
|
||||
}
|
||||
@@ -103,14 +79,14 @@ public class NMGController extends BaseController {
|
||||
*/
|
||||
@PostMapping("/v1/supervise_query_stations_info")
|
||||
public CommonResult<?> queryStationsInfo(@RequestBody CommonParamsDTO dto) {
|
||||
logger.info("海南平台查询运营商信息 params:{}", JSON.toJSONString(dto));
|
||||
logger.info("内蒙古平台查询运营商信息 params:{}", JSON.toJSONString(dto));
|
||||
try {
|
||||
QueryStationInfoDTO paramDTO = parseDto(dto, QueryStationInfoDTO.class);
|
||||
Map<String, String> map = platformLogic.queryStationsInfo(paramDTO);
|
||||
logger.info("海南平台查询运营商信息 result:{}", JSON.toJSONString(map));
|
||||
logger.info("内蒙古平台查询运营商信息 result:{}", JSON.toJSONString(map));
|
||||
return CommonResult.success(0, "请求令牌成功!", map.get("Data"), map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
logger.error("海南平台查询运营商信息 异常", e);
|
||||
logger.error("内蒙古平台查询运营商信息 异常", e);
|
||||
return CommonResult.failed("查询运营商信息发生异常");
|
||||
}
|
||||
}
|
||||
@@ -121,19 +97,16 @@ public class NMGController extends BaseController {
|
||||
*/
|
||||
@PostMapping("/v1/supervise_query_station_status")
|
||||
public CommonResult<?> queryStationStatus(@RequestBody CommonParamsDTO dto) {
|
||||
logger.info("海南平台查询充换电站状态信息 params:{}", JSON.toJSONString(dto));
|
||||
logger.info("内蒙古平台查询充换电站状态信息 params:{}", JSON.toJSONString(dto));
|
||||
try {
|
||||
QueryStationInfoDTO paramDTO = parseDto(dto, QueryStationInfoDTO.class);
|
||||
Map<String, String> map = platformLogic.queryStationStatus(paramDTO);
|
||||
logger.info("海南平台查询充换电站状态信息 result:{}", JSON.toJSONString(map));
|
||||
logger.info("内蒙古平台查询充换电站状态信息 result:{}", JSON.toJSONString(map));
|
||||
return CommonResult.success(0, "查询充换电站状态信息成功!", map.get("Data"), map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
logger.error("海南平台查询充换电站状态信息异常", e);
|
||||
logger.error("内蒙古平台查询充换电站状态信息异常", e);
|
||||
return CommonResult.failed("查询充换电站状态信息发生异常");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -36,10 +36,10 @@ spring:
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
# url: jdbc:mysql://192.168.2.2:3306/jsowell_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# username: jsowell_dev
|
||||
url: jdbc:mysql://192.168.2.2:3306/jsowell_prd_copy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: jsowell_prd_copy
|
||||
url: jdbc:mysql://192.168.2.2:3306/jsowell_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: jsowell_dev
|
||||
#url: jdbc:mysql://192.168.2.2:3306/jsowell_prd_copy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
#username: jsowell_prd_copy
|
||||
password: 123456
|
||||
# 从库数据源
|
||||
slave:
|
||||
|
||||
@@ -36,6 +36,9 @@ public class CacheConstants {
|
||||
// 缓存时间 30天
|
||||
public static final int cache_expire_time_30d = cache_expire_time_1d * 30;
|
||||
|
||||
// 第三方平台密钥配置
|
||||
public static final String THIRD_PARTY_SECRET_INFO = "third_party_secret_info:";
|
||||
|
||||
// 保存order_monitor_data
|
||||
public static final String INSERT_ORDER_MONITOR_DATA = "insert_order_monitor_data:";
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jsowell.pile.mapper;
|
||||
|
||||
import com.jsowell.pile.domain.ThirdPartyPlatformConfig;
|
||||
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
@@ -68,4 +69,6 @@ public interface ThirdPartyPlatformConfigMapper {
|
||||
* @return
|
||||
*/
|
||||
ThirdPartyPlatformConfig getInfoByOperatorId(String operatorId);
|
||||
|
||||
ThirdPartySecretInfoVO queryThirdPartySecretInfo(String operatorId);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.jsowell.pile.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jsowell.pile.domain.ThirdPartySettingInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 第三方平台配置Service接口
|
||||
*
|
||||
@@ -67,18 +67,5 @@ public interface ThirdPartySettingInfoService {
|
||||
*/
|
||||
public int deleteThirdPartySettingInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 根据站点id 查询配置列表
|
||||
*
|
||||
* @param stationId
|
||||
* @return
|
||||
*/
|
||||
public ThirdPartySettingInfo getInfoByStationId(Long stationId);
|
||||
|
||||
/**
|
||||
* 修改站点互联互通配置
|
||||
* @param info
|
||||
* @return
|
||||
*/
|
||||
int updateStationSettingInfo(ThirdPartySettingInfo info);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package com.jsowell.pile.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.pile.domain.ThirdPartyPlatformConfig;
|
||||
import com.jsowell.pile.mapper.ThirdPartyPlatformConfigMapper;
|
||||
import com.jsowell.pile.service.ThirdPartyPlatformConfigService;
|
||||
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.jsowell.pile.mapper.ThirdPartyPlatformConfigMapper;
|
||||
import com.jsowell.pile.domain.ThirdPartyPlatformConfig;
|
||||
import com.jsowell.pile.service.ThirdPartyPlatformConfigService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 对接平台配置信息Service业务层处理
|
||||
@@ -98,4 +99,12 @@ public class ThirdPartyPlatformConfigServiceImpl implements ThirdPartyPlatformCo
|
||||
public ThirdPartyPlatformConfig getInfoByOperatorId(String operatorId) {
|
||||
return thirdPartyPlatformConfigMapper.getInfoByOperatorId(operatorId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询第三方平台配置的密钥信息
|
||||
* @return
|
||||
*/
|
||||
public ThirdPartySecretInfoVO queryThirdPartySecretInfo(String operatorId) {
|
||||
return thirdPartyPlatformConfigMapper.queryThirdPartySecretInfo(operatorId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.jsowell.pile.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.pile.domain.ThirdPartySettingInfo;
|
||||
import com.jsowell.pile.mapper.ThirdPartySettingInfoMapper;
|
||||
import com.jsowell.pile.service.ThirdPartySettingInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.jsowell.pile.mapper.ThirdPartySettingInfoMapper;
|
||||
import com.jsowell.pile.domain.ThirdPartySettingInfo;
|
||||
import com.jsowell.pile.service.ThirdPartySettingInfoService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 第三方平台配置Service业务层处理
|
||||
@@ -98,33 +98,5 @@ public class ThirdPartySettingInfoServiceImpl implements ThirdPartySettingInfoSe
|
||||
return thirdPartySettingInfoMapper.deleteThirdPartySettingInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据站点id 查询配置列表
|
||||
*
|
||||
* @param stationId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ThirdPartySettingInfo getInfoByStationId(Long stationId) {
|
||||
return thirdPartySettingInfoMapper.getInfoByStationId(stationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改站点互联互通配置
|
||||
* @param info
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int updateStationSettingInfo(ThirdPartySettingInfo info) {
|
||||
Long stationId = info.getStationId();
|
||||
ThirdPartySettingInfo infoByStationId = getInfoByStationId(stationId);
|
||||
if (infoByStationId == null) {
|
||||
// 新增
|
||||
return insertThirdPartySettingInfo(info);
|
||||
}else {
|
||||
// 修改
|
||||
info.setId(infoByStationId.getId());
|
||||
return updateThirdPartySettingInfo(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.jsowell.pile.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 第三方平台配置的密钥信息
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class ThirdPartySecretInfoVO {
|
||||
// 我方的组织机构代码
|
||||
private String ourOperatorId;
|
||||
|
||||
// 我方生成的唯一识别密钥
|
||||
private String ourOperatorSecret;
|
||||
|
||||
// 我方生成的消息密钥
|
||||
private String ourDataSecret;
|
||||
|
||||
// 我方生成的初始化向量
|
||||
private String ourDataSecretIv;
|
||||
|
||||
// 我方生成的签名密钥
|
||||
private String ourSigSecret;
|
||||
|
||||
// 对接平台的组织机构代码
|
||||
private String theirOperatorId;
|
||||
|
||||
// 对接平台生成的唯一识别密钥
|
||||
private String theirOperatorSecret;
|
||||
|
||||
// 对接平台生成的消息密钥
|
||||
private String theirDataSecret;
|
||||
|
||||
// 对接平台的初始化向量
|
||||
private String theirDataSecretIv;
|
||||
|
||||
// 对接平台生成的签名密钥
|
||||
private String theirSigSecret;
|
||||
|
||||
// 对接平台接口前缀
|
||||
private String theirUrlPrefix;
|
||||
}
|
||||
234
jsowell-pile/src/main/java/com/jsowell/thirdparty/domain/ThirdpartySecretInfo.java
vendored
Normal file
234
jsowell-pile/src/main/java/com/jsowell/thirdparty/domain/ThirdpartySecretInfo.java
vendored
Normal file
@@ -0,0 +1,234 @@
|
||||
package com.jsowell.thirdparty.domain;
|
||||
|
||||
import com.jsowell.common.annotation.Excel;
|
||||
import com.jsowell.common.core.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 对接三方平台配置对象 thirdparty_secret_info
|
||||
*
|
||||
* @author jsowell
|
||||
* @date 2024-04-18
|
||||
*/
|
||||
public class ThirdpartySecretInfo extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 对接平台名称
|
||||
*/
|
||||
@Excel(name = "对接平台名称")
|
||||
private String platformName;
|
||||
|
||||
/**
|
||||
* 对接平台类型
|
||||
*/
|
||||
@Excel(name = "对接平台类型")
|
||||
private String platformType;
|
||||
|
||||
/**
|
||||
* 接口地址前缀
|
||||
*/
|
||||
@Excel(name = "接口地址前缀")
|
||||
private String urlPrefix;
|
||||
|
||||
/**
|
||||
* 对接平台标识(使用组织机构代码)
|
||||
*/
|
||||
@Excel(name = "对接平台标识", readConverterExp = "使=用组织机构代码")
|
||||
private String theirOperatorId;
|
||||
|
||||
/**
|
||||
* 对接平台生成的唯一识别密钥
|
||||
*/
|
||||
@Excel(name = "对接平台生成的唯一识别密钥")
|
||||
private String theirOperatorSecret;
|
||||
|
||||
/**
|
||||
* 对接平台生成的消息密钥
|
||||
*/
|
||||
@Excel(name = "对接平台生成的消息密钥")
|
||||
private String theirDataSecret;
|
||||
|
||||
/**
|
||||
* 对接平台生成的初始化向量
|
||||
*/
|
||||
@Excel(name = "对接平台生成的初始化向量")
|
||||
private String theirDataSecretIv;
|
||||
|
||||
/**
|
||||
* 对接平台生成的签名密钥
|
||||
*/
|
||||
@Excel(name = "对接平台生成的签名密钥")
|
||||
private String theirSigSecret;
|
||||
|
||||
/**
|
||||
* 我方生成的唯一识别密钥
|
||||
*/
|
||||
@Excel(name = "我方生成的唯一识别密钥")
|
||||
private String ourOperatorSecret;
|
||||
|
||||
/**
|
||||
* 我方生成的消息密钥
|
||||
*/
|
||||
@Excel(name = "我方生成的消息密钥")
|
||||
private String ourDataSecret;
|
||||
|
||||
/**
|
||||
* 我方生成的初始化向量
|
||||
*/
|
||||
@Excel(name = "我方生成的初始化向量")
|
||||
private String ourDataSecretIv;
|
||||
|
||||
/**
|
||||
* 我方生成的签名密钥
|
||||
*/
|
||||
@Excel(name = "我方生成的签名密钥")
|
||||
private String ourSigSecret;
|
||||
|
||||
/**
|
||||
* 删除标识(0-正常;1-删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setPlatformName(String platformName) {
|
||||
this.platformName = platformName;
|
||||
}
|
||||
|
||||
public String getPlatformName() {
|
||||
return platformName;
|
||||
}
|
||||
|
||||
public void setPlatformType(String platformType) {
|
||||
this.platformType = platformType;
|
||||
}
|
||||
|
||||
public String getPlatformType() {
|
||||
return platformType;
|
||||
}
|
||||
|
||||
public void setUrlPrefix(String urlPrefix) {
|
||||
this.urlPrefix = urlPrefix;
|
||||
}
|
||||
|
||||
public String getUrlPrefix() {
|
||||
return urlPrefix;
|
||||
}
|
||||
|
||||
public void setTheirOperatorId(String theirOperatorId) {
|
||||
this.theirOperatorId = theirOperatorId;
|
||||
}
|
||||
|
||||
public String getTheirOperatorId() {
|
||||
return theirOperatorId;
|
||||
}
|
||||
|
||||
public void setTheirOperatorSecret(String theirOperatorSecret) {
|
||||
this.theirOperatorSecret = theirOperatorSecret;
|
||||
}
|
||||
|
||||
public String getTheirOperatorSecret() {
|
||||
return theirOperatorSecret;
|
||||
}
|
||||
|
||||
public void setTheirDataSecret(String theirDataSecret) {
|
||||
this.theirDataSecret = theirDataSecret;
|
||||
}
|
||||
|
||||
public String getTheirDataSecret() {
|
||||
return theirDataSecret;
|
||||
}
|
||||
|
||||
public void setTheirDataSecretIv(String theirDataSecretIv) {
|
||||
this.theirDataSecretIv = theirDataSecretIv;
|
||||
}
|
||||
|
||||
public String getTheirDataSecretIv() {
|
||||
return theirDataSecretIv;
|
||||
}
|
||||
|
||||
public void setTheirSigSecret(String theirSigSecret) {
|
||||
this.theirSigSecret = theirSigSecret;
|
||||
}
|
||||
|
||||
public String getTheirSigSecret() {
|
||||
return theirSigSecret;
|
||||
}
|
||||
|
||||
public void setOurOperatorSecret(String ourOperatorSecret) {
|
||||
this.ourOperatorSecret = ourOperatorSecret;
|
||||
}
|
||||
|
||||
public String getOurOperatorSecret() {
|
||||
return ourOperatorSecret;
|
||||
}
|
||||
|
||||
public void setOurDataSecret(String ourDataSecret) {
|
||||
this.ourDataSecret = ourDataSecret;
|
||||
}
|
||||
|
||||
public String getOurDataSecret() {
|
||||
return ourDataSecret;
|
||||
}
|
||||
|
||||
public void setOurDataSecretIv(String ourDataSecretIv) {
|
||||
this.ourDataSecretIv = ourDataSecretIv;
|
||||
}
|
||||
|
||||
public String getOurDataSecretIv() {
|
||||
return ourDataSecretIv;
|
||||
}
|
||||
|
||||
public void setOurSigSecret(String ourSigSecret) {
|
||||
this.ourSigSecret = ourSigSecret;
|
||||
}
|
||||
|
||||
public String getOurSigSecret() {
|
||||
return ourSigSecret;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.JSON_STYLE)
|
||||
.append("id", getId())
|
||||
.append("platformName", getPlatformName())
|
||||
.append("platformType", getPlatformType())
|
||||
.append("urlPrefix", getUrlPrefix())
|
||||
.append("theirOperatorId", getTheirOperatorId())
|
||||
.append("theirOperatorSecret", getTheirOperatorSecret())
|
||||
.append("theirDataSecret", getTheirDataSecret())
|
||||
.append("theirDataSecretIv", getTheirDataSecretIv())
|
||||
.append("theirSigSecret", getTheirSigSecret())
|
||||
.append("ourOperatorSecret", getOurOperatorSecret())
|
||||
.append("ourDataSecret", getOurDataSecret())
|
||||
.append("ourDataSecretIv", getOurDataSecretIv())
|
||||
.append("ourSigSecret", getOurSigSecret())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("delFlag", getDelFlag())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
66
jsowell-pile/src/main/java/com/jsowell/thirdparty/mapper/ThirdpartySecretInfoMapper.java
vendored
Normal file
66
jsowell-pile/src/main/java/com/jsowell/thirdparty/mapper/ThirdpartySecretInfoMapper.java
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
package com.jsowell.thirdparty.mapper;
|
||||
|
||||
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
|
||||
import com.jsowell.thirdparty.domain.ThirdpartySecretInfo;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 对接三方平台配置Mapper接口
|
||||
*
|
||||
* @author jsowell
|
||||
* @date 2024-04-18
|
||||
*/
|
||||
@Repository
|
||||
public interface ThirdpartySecretInfoMapper {
|
||||
/**
|
||||
* 查询对接三方平台配置
|
||||
*
|
||||
* @param id 对接三方平台配置主键
|
||||
* @return 对接三方平台配置
|
||||
*/
|
||||
ThirdpartySecretInfo selectThirdpartySecretInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询对接三方平台配置列表
|
||||
*
|
||||
* @param thirdpartySecretInfo 对接三方平台配置
|
||||
* @return 对接三方平台配置集合
|
||||
*/
|
||||
List<ThirdpartySecretInfo> selectThirdpartySecretInfoList(ThirdpartySecretInfo thirdpartySecretInfo);
|
||||
|
||||
/**
|
||||
* 新增对接三方平台配置
|
||||
*
|
||||
* @param thirdpartySecretInfo 对接三方平台配置
|
||||
* @return 结果
|
||||
*/
|
||||
int insertThirdpartySecretInfo(ThirdpartySecretInfo thirdpartySecretInfo);
|
||||
|
||||
/**
|
||||
* 修改对接三方平台配置
|
||||
*
|
||||
* @param thirdpartySecretInfo 对接三方平台配置
|
||||
* @return 结果
|
||||
*/
|
||||
int updateThirdpartySecretInfo(ThirdpartySecretInfo thirdpartySecretInfo);
|
||||
|
||||
/**
|
||||
* 删除对接三方平台配置
|
||||
*
|
||||
* @param id 对接三方平台配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteThirdpartySecretInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除对接三方平台配置
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteThirdpartySecretInfoByIds(Long[] ids);
|
||||
|
||||
ThirdPartySecretInfoVO queryByOperatorId(String theirOperatorId);
|
||||
}
|
||||
64
jsowell-pile/src/main/java/com/jsowell/thirdparty/service/ThirdpartySecretInfoService.java
vendored
Normal file
64
jsowell-pile/src/main/java/com/jsowell/thirdparty/service/ThirdpartySecretInfoService.java
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
package com.jsowell.thirdparty.service;
|
||||
|
||||
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
|
||||
import com.jsowell.thirdparty.domain.ThirdpartySecretInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 对接三方平台配置Service接口
|
||||
*
|
||||
* @author jsowell
|
||||
* @date 2024-04-18
|
||||
*/
|
||||
public interface ThirdpartySecretInfoService {
|
||||
/**
|
||||
* 查询对接三方平台配置
|
||||
*
|
||||
* @param id 对接三方平台配置主键
|
||||
* @return 对接三方平台配置
|
||||
*/
|
||||
public ThirdpartySecretInfo selectThirdpartySecretInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询对接三方平台配置列表
|
||||
*
|
||||
* @param thirdpartySecretInfo 对接三方平台配置
|
||||
* @return 对接三方平台配置集合
|
||||
*/
|
||||
public List<ThirdpartySecretInfo> selectThirdpartySecretInfoList(ThirdpartySecretInfo thirdpartySecretInfo);
|
||||
|
||||
/**
|
||||
* 新增对接三方平台配置
|
||||
*
|
||||
* @param thirdpartySecretInfo 对接三方平台配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertThirdpartySecretInfo(ThirdpartySecretInfo thirdpartySecretInfo);
|
||||
|
||||
/**
|
||||
* 修改对接三方平台配置
|
||||
*
|
||||
* @param thirdpartySecretInfo 对接三方平台配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateThirdpartySecretInfo(ThirdpartySecretInfo thirdpartySecretInfo);
|
||||
|
||||
/**
|
||||
* 批量删除对接三方平台配置
|
||||
*
|
||||
* @param ids 需要删除的对接三方平台配置主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteThirdpartySecretInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除对接三方平台配置信息
|
||||
*
|
||||
* @param id 对接三方平台配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteThirdpartySecretInfoById(Long id);
|
||||
|
||||
ThirdPartySecretInfoVO queryByOperatorId(String theirOperatorId);
|
||||
}
|
||||
116
jsowell-pile/src/main/java/com/jsowell/thirdparty/service/impl/ThirdpartySecretInfoServiceImpl.java
vendored
Normal file
116
jsowell-pile/src/main/java/com/jsowell/thirdparty/service/impl/ThirdpartySecretInfoServiceImpl.java
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
package com.jsowell.thirdparty.service.impl;
|
||||
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
import com.jsowell.common.core.redis.RedisCache;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
|
||||
import com.jsowell.thirdparty.domain.ThirdpartySecretInfo;
|
||||
import com.jsowell.thirdparty.mapper.ThirdpartySecretInfoMapper;
|
||||
import com.jsowell.thirdparty.service.ThirdpartySecretInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 对接三方平台配置Service业务层处理
|
||||
*
|
||||
* @author jsowell
|
||||
* @date 2024-04-18
|
||||
*/
|
||||
@Service
|
||||
public class ThirdpartySecretInfoServiceImpl implements ThirdpartySecretInfoService {
|
||||
@Autowired
|
||||
private ThirdpartySecretInfoMapper thirdpartySecretInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
/**
|
||||
* 查询对接三方平台配置
|
||||
*
|
||||
* @param id 对接三方平台配置主键
|
||||
* @return 对接三方平台配置
|
||||
*/
|
||||
@Override
|
||||
public ThirdpartySecretInfo selectThirdpartySecretInfoById(Long id) {
|
||||
return thirdpartySecretInfoMapper.selectThirdpartySecretInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询对接三方平台配置列表
|
||||
*
|
||||
* @param thirdpartySecretInfo 对接三方平台配置
|
||||
* @return 对接三方平台配置
|
||||
*/
|
||||
@Override
|
||||
public List<ThirdpartySecretInfo> selectThirdpartySecretInfoList(ThirdpartySecretInfo thirdpartySecretInfo) {
|
||||
return thirdpartySecretInfoMapper.selectThirdpartySecretInfoList(thirdpartySecretInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增对接三方平台配置
|
||||
*
|
||||
* @param thirdpartySecretInfo 对接三方平台配置
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertThirdpartySecretInfo(ThirdpartySecretInfo thirdpartySecretInfo) {
|
||||
thirdpartySecretInfo.setCreateTime(DateUtils.getNowDate());
|
||||
return thirdpartySecretInfoMapper.insertThirdpartySecretInfo(thirdpartySecretInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改对接三方平台配置
|
||||
*
|
||||
* @param thirdpartySecretInfo 对接三方平台配置
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateThirdpartySecretInfo(ThirdpartySecretInfo thirdpartySecretInfo) {
|
||||
thirdpartySecretInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
return thirdpartySecretInfoMapper.updateThirdpartySecretInfo(thirdpartySecretInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除对接三方平台配置
|
||||
*
|
||||
* @param ids 需要删除的对接三方平台配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteThirdpartySecretInfoByIds(Long[] ids) {
|
||||
return thirdpartySecretInfoMapper.deleteThirdpartySecretInfoByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除对接三方平台配置信息
|
||||
*
|
||||
* @param id 对接三方平台配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteThirdpartySecretInfoById(Long id) {
|
||||
return thirdpartySecretInfoMapper.deleteThirdpartySecretInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询第三方平台密钥配置信息
|
||||
* @param theirOperatorId 第三方平台的组织结构代码
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ThirdPartySecretInfoVO queryByOperatorId(String theirOperatorId) {
|
||||
// 加缓存
|
||||
String redisKey = CacheConstants.THIRD_PARTY_SECRET_INFO + theirOperatorId;
|
||||
ThirdPartySecretInfoVO result = redisCache.getCacheObject(redisKey);
|
||||
if (Objects.isNull(result)) {
|
||||
result = thirdpartySecretInfoMapper.queryByOperatorId(theirOperatorId);
|
||||
if (Objects.nonNull(result)) {
|
||||
redisCache.setCacheObject(redisKey, result, CacheConstants.cache_expire_time_1h);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -110,4 +110,8 @@
|
||||
where del_flag = '0'
|
||||
and operator_id = #{operatorId,jdbcType=VARCHAR}
|
||||
</select>
|
||||
|
||||
<select id="queryThirdPartySecretInfo" resultType="com.jsowell.pile.vo.ThirdPartySecretInfoVO">
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -8,7 +8,6 @@
|
||||
<result property="id" column="id" />
|
||||
<result property="type" column="type" />
|
||||
<result property="urlAddress" column="url_address" />
|
||||
<result property="stationId" column="station_id" />
|
||||
<result property="operatorId" column="operator_id" />
|
||||
<result property="operatorSecret" column="operator_secret" />
|
||||
<result property="signSecret" column="sign_secret" />
|
||||
@@ -22,12 +21,12 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectThirdPartySettingInfoVo">
|
||||
select id, type, url_address, station_id, operator_id, operator_secret, sign_secret, data_secret, data_secret_IV, create_time, create_by, update_time, update_by, del_flag from thirdparty_setting_info
|
||||
select id, type, url_address, operator_id, operator_secret, sign_secret, data_secret, data_secret_IV, create_time, create_by, update_time, update_by, del_flag from thirdparty_setting_info
|
||||
</sql>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, type, url_address, station_id, operator_id, operator_secret, sign_secret, data_secret, data_secret_IV, create_time, create_by, update_time, update_by, del_flag
|
||||
id, type, url_address, operator_id, operator_secret, sign_secret, data_secret, data_secret_IV, create_time, create_by, update_time, update_by, del_flag
|
||||
</sql>
|
||||
|
||||
<select id="selectThirdPartySettingInfoList" parameterType="com.jsowell.pile.domain.ThirdPartySettingInfo" resultMap="ThirdPartySettingInfoResult">
|
||||
@@ -35,7 +34,6 @@
|
||||
<where>
|
||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||
<if test="urlAddress != null and type != ''"> and url_address = #{urlAddress}</if>
|
||||
<if test="stationId != null and stationId != ''"> and station_id = #{stationId}</if>
|
||||
<if test="operatorId != null and operatorId != ''"> and operator_id = #{operatorId}</if>
|
||||
<if test="operatorSecret != null and operatorSecret != ''"> and operator_secret = #{operatorSecret}</if>
|
||||
<if test="signSecret != null and signSecret != ''"> and sign_secret = #{signSecret}</if>
|
||||
@@ -54,7 +52,6 @@
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="type != null">type,</if>
|
||||
<if test="urlAddress != null">url_address,</if>
|
||||
<if test="stationId != null">station_id,</if>
|
||||
<if test="operatorId != null">operator_id,</if>
|
||||
<if test="operatorSecret != null">operator_secret,</if>
|
||||
<if test="signSecret != null">sign_secret,</if>
|
||||
@@ -88,7 +85,6 @@
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="type != null">type = #{type},</if>
|
||||
<if test="urlAddress != null">url_address = #{urlAddress},</if>
|
||||
<if test="stationId != null">station_id = #{stationId},</if>
|
||||
<if test="operatorId != null">operator_id = #{operatorId},</if>
|
||||
<if test="operatorSecret != null">operator_secret = #{operatorSecret},</if>
|
||||
<if test="signSecret != null">sign_secret = #{signSecret},</if>
|
||||
@@ -114,19 +110,10 @@
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="getInfoByStationId" resultMap="ThirdPartySettingInfoResult">
|
||||
select <include refid="Base_Column_List"/>
|
||||
from thirdparty_setting_info
|
||||
where station_id = #{stationId,jdbcType=BIGINT}
|
||||
</select>
|
||||
|
||||
<select id="selectThirdInfo" resultMap="ThirdPartySettingInfoResult">
|
||||
select <include refid="Base_Column_List"/>
|
||||
from thirdparty_setting_info
|
||||
where del_flag = '0'
|
||||
<if test="stationId != null">
|
||||
and station_id = #{stationId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
and type = #{type,jdbcType=VARCHAR}
|
||||
</if>
|
||||
|
||||
155
jsowell-pile/src/main/resources/mapper/thirdparty/ThirdpartySecretInfoMapper.xml
vendored
Normal file
155
jsowell-pile/src/main/resources/mapper/thirdparty/ThirdpartySecretInfoMapper.xml
vendored
Normal file
@@ -0,0 +1,155 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jsowell.thirdparty.mapper.ThirdpartySecretInfoMapper">
|
||||
|
||||
<resultMap type="com.jsowell.thirdparty.domain.ThirdpartySecretInfo" id="ThirdpartySecretInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="platformName" column="platform_name" />
|
||||
<result property="platformType" column="platform_type" />
|
||||
<result property="urlPrefix" column="url_prefix" />
|
||||
<result property="theirOperatorId" column="their_operator_id" />
|
||||
<result property="theirOperatorSecret" column="their_operator_secret" />
|
||||
<result property="theirDataSecret" column="their_data_secret" />
|
||||
<result property="theirDataSecretIv" column="their_data_secret_iv" />
|
||||
<result property="theirSigSecret" column="their_sig_secret" />
|
||||
<result property="ourOperatorSecret" column="our_operator_secret" />
|
||||
<result property="ourDataSecret" column="our_data_secret" />
|
||||
<result property="ourDataSecretIv" column="our_data_secret_iv" />
|
||||
<result property="ourSigSecret" column="our_sig_secret" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, platform_name, platform_type, url_prefix, their_operator_id, their_operator_secret, their_data_secret,
|
||||
their_data_secret_iv, their_sig_secret, our_operator_secret, our_data_secret, our_data_secret_iv,
|
||||
our_sig_secret, create_by, create_time, update_by, update_time, del_flag
|
||||
</sql>
|
||||
|
||||
<sql id="selectThirdpartySecretInfoVo">
|
||||
select <include refid="Base_Column_List"/>
|
||||
from thirdparty_secret_info
|
||||
</sql>
|
||||
|
||||
<select id="selectThirdpartySecretInfoList" parameterType="com.jsowell.thirdparty.domain.ThirdpartySecretInfo" resultMap="ThirdpartySecretInfoResult">
|
||||
<include refid="selectThirdpartySecretInfoVo"/>
|
||||
<where>
|
||||
<if test="platformName != null and platformName != ''"> and platform_name like concat('%', #{platformName}, '%')</if>
|
||||
<if test="platformType != null and platformType != ''"> and platform_type = #{platformType}</if>
|
||||
<if test="urlPrefix != null and urlPrefix != ''"> and url_prefix = #{urlPrefix}</if>
|
||||
<if test="theirOperatorId != null and theirOperatorId != ''"> and their_operator_id = #{theirOperatorId}</if>
|
||||
<if test="theirOperatorSecret != null and theirOperatorSecret != ''"> and their_operator_secret = #{theirOperatorSecret}</if>
|
||||
<if test="theirDataSecret != null and theirDataSecret != ''"> and their_data_secret = #{theirDataSecret}</if>
|
||||
<if test="theirDataSecretIv != null and theirDataSecretIv != ''"> and their_data_secret_iv = #{theirDataSecretIv}</if>
|
||||
<if test="theirSigSecret != null and theirSigSecret != ''"> and their_sig_secret = #{theirSigSecret}</if>
|
||||
<if test="ourOperatorSecret != null and ourOperatorSecret != ''"> and our_operator_secret = #{ourOperatorSecret}</if>
|
||||
<if test="ourDataSecret != null and ourDataSecret != ''"> and our_data_secret = #{ourDataSecret}</if>
|
||||
<if test="ourDataSecretIv != null and ourDataSecretIv != ''"> and our_data_secret_iv = #{ourDataSecretIv}</if>
|
||||
<if test="ourSigSecret != null and ourSigSecret != ''"> and our_sig_secret = #{ourSigSecret}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectThirdpartySecretInfoById" parameterType="Long" resultMap="ThirdpartySecretInfoResult">
|
||||
<include refid="selectThirdpartySecretInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertThirdpartySecretInfo" parameterType="com.jsowell.thirdparty.domain.ThirdpartySecretInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into thirdparty_secret_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="platformName != null">platform_name,</if>
|
||||
<if test="platformType != null">platform_type,</if>
|
||||
<if test="urlPrefix != null">url_prefix,</if>
|
||||
<if test="theirOperatorId != null">their_operator_id,</if>
|
||||
<if test="theirOperatorSecret != null">their_operator_secret,</if>
|
||||
<if test="theirDataSecret != null">their_data_secret,</if>
|
||||
<if test="theirDataSecretIv != null">their_data_secret_iv,</if>
|
||||
<if test="theirSigSecret != null">their_sig_secret,</if>
|
||||
<if test="ourOperatorSecret != null">our_operator_secret,</if>
|
||||
<if test="ourDataSecret != null">our_data_secret,</if>
|
||||
<if test="ourDataSecretIv != null">our_data_secret_iv,</if>
|
||||
<if test="ourSigSecret != null">our_sig_secret,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="platformName != null">#{platformName},</if>
|
||||
<if test="platformType != null">#{platformType},</if>
|
||||
<if test="urlPrefix != null">#{urlPrefix},</if>
|
||||
<if test="theirOperatorId != null">#{theirOperatorId},</if>
|
||||
<if test="theirOperatorSecret != null">#{theirOperatorSecret},</if>
|
||||
<if test="theirDataSecret != null">#{theirDataSecret},</if>
|
||||
<if test="theirDataSecretIv != null">#{theirDataSecretIv},</if>
|
||||
<if test="theirSigSecret != null">#{theirSigSecret},</if>
|
||||
<if test="ourOperatorSecret != null">#{ourOperatorSecret},</if>
|
||||
<if test="ourDataSecret != null">#{ourDataSecret},</if>
|
||||
<if test="ourDataSecretIv != null">#{ourDataSecretIv},</if>
|
||||
<if test="ourSigSecret != null">#{ourSigSecret},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateThirdpartySecretInfo" parameterType="com.jsowell.thirdparty.domain.ThirdpartySecretInfo">
|
||||
update thirdparty_secret_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="platformName != null">platform_name = #{platformName},</if>
|
||||
<if test="platformType != null">platform_type = #{platformType},</if>
|
||||
<if test="urlPrefix != null">url_prefix = #{urlPrefix},</if>
|
||||
<if test="theirOperatorId != null">their_operator_id = #{theirOperatorId},</if>
|
||||
<if test="theirOperatorSecret != null">their_operator_secret = #{theirOperatorSecret},</if>
|
||||
<if test="theirDataSecret != null">their_data_secret = #{theirDataSecret},</if>
|
||||
<if test="theirDataSecretIv != null">their_data_secret_iv = #{theirDataSecretIv},</if>
|
||||
<if test="theirSigSecret != null">their_sig_secret = #{theirSigSecret},</if>
|
||||
<if test="ourOperatorSecret != null">our_operator_secret = #{ourOperatorSecret},</if>
|
||||
<if test="ourDataSecret != null">our_data_secret = #{ourDataSecret},</if>
|
||||
<if test="ourDataSecretIv != null">our_data_secret_iv = #{ourDataSecretIv},</if>
|
||||
<if test="ourSigSecret != null">our_sig_secret = #{ourSigSecret},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteThirdpartySecretInfoById" parameterType="Long">
|
||||
delete from thirdparty_secret_info where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteThirdpartySecretInfoByIds" parameterType="String">
|
||||
delete from thirdparty_secret_info where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="queryByOperatorId" resultType="com.jsowell.pile.vo.ThirdPartySecretInfoVO">
|
||||
select
|
||||
t1.their_operator_id as theirOperatorId,
|
||||
t1.their_operator_secret as theirOperatorSecret,
|
||||
t1.their_data_secret as theirDataSecret,
|
||||
t1.their_data_secret_iv as theirDataSecretIv,
|
||||
t1.their_sig_secret as theirSigSecret,
|
||||
t1.url_prefix as theirUrlPrefix,
|
||||
t1.our_operator_secret as ourOperatorSecret,
|
||||
t1.our_data_secret as ourDataSecret,
|
||||
t1.our_data_secret_iv as ourDataSecretIv,
|
||||
t1.our_sig_secret as ourSigSecret
|
||||
from thirdparty_secret_info t1
|
||||
where del_flag = '0'
|
||||
and their_operator_id = #{theirOperatorId,jdbcType=VARCHAR}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -148,7 +148,7 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
|
||||
// 组装联联平台所需要的数据格式
|
||||
StationInfo info = StationInfo.builder()
|
||||
.stationID("LC" +dto.getStationId())
|
||||
.stationID("LC" + dto.getStationId())
|
||||
.operatorID(operatorId)
|
||||
// .equipmentOwnerID(Constants.OPERATORID_LIANLIAN)
|
||||
.stationName(pileStationInfo.getStationName())
|
||||
|
||||
@@ -10,11 +10,11 @@ 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.vo.AccessTokenVO;
|
||||
import com.jsowell.thirdparty.lianlian.vo.LianLianResultVO;
|
||||
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;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
||||
@@ -820,7 +820,7 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
.map(PileInfoVO::getSpeedType)
|
||||
.collect(Collectors.toSet());
|
||||
vo.setOperatorId(Constants.OPERATORID_LIANLIAN);
|
||||
vo.setStationId(stationId);
|
||||
vo.setStationId("LC" + stationId);
|
||||
|
||||
for (String equipmentType : equipmentTypeList) {
|
||||
for (BillingPriceVO billingPriceVO : billingPriceVOList) {
|
||||
|
||||
@@ -14,7 +14,6 @@ import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
|
||||
import com.jsowell.common.enums.ykc.BillingTimeTypeEnum;
|
||||
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
|
||||
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.OrderBasicInfo;
|
||||
@@ -25,7 +24,6 @@ import com.jsowell.pile.dto.QueryEquipChargeStatusDTO;
|
||||
import com.jsowell.pile.dto.QueryOperatorInfoDTO;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.thirdparty.CommonParamsDTO;
|
||||
import com.jsowell.pile.thirdparty.EquipmentInfo;
|
||||
import com.jsowell.pile.util.MerchantUtils;
|
||||
import com.jsowell.pile.vo.base.ConnectorInfoVO;
|
||||
@@ -37,7 +35,6 @@ import com.jsowell.pile.vo.web.PileStationVO;
|
||||
import com.jsowell.thirdparty.lianlian.domain.ConnectorChargeStatusInfo;
|
||||
import com.jsowell.thirdparty.lianlian.domain.ConnectorStatusInfo;
|
||||
import com.jsowell.thirdparty.lianlian.domain.StationStatusInfo;
|
||||
import com.jsowell.thirdparty.lianlian.vo.AccessTokenVO;
|
||||
import com.jsowell.thirdparty.lianlian.vo.QueryChargingStatusVO;
|
||||
import com.jsowell.thirdparty.platform.ThirdPartyPlatformService;
|
||||
import com.jsowell.thirdparty.platform.neimenggu.domain.ChargeOrderInfo;
|
||||
@@ -98,49 +95,49 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> queryToken(CommonParamsDTO dto) {
|
||||
AccessTokenVO vo = new AccessTokenVO();
|
||||
// 0:成功;1:失败
|
||||
int succStat = 0;
|
||||
// 0:无;1:无此对接平台;2:密钥错误; 3~99:自定义
|
||||
int failReason = 0;
|
||||
|
||||
String operatorId = dto.getPlatformID();
|
||||
// 通过operatorId 查出 operatorSecret
|
||||
ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorId);
|
||||
if (platformConfig == null) {
|
||||
failReason = 1;
|
||||
succStat = 1;
|
||||
} else {
|
||||
String operatorSecret = platformConfig.getOperatorSecret();
|
||||
String dataSecret = platformConfig.getDataSecret();
|
||||
String dataSecretIv = platformConfig.getDataSecretIv();
|
||||
// 解密data 获取参数中的OperatorSecret
|
||||
String decrypt = Cryptos.decrypt(dto.getData(), dataSecret, dataSecretIv);
|
||||
String inputOperatorSecret = null;
|
||||
if (StringUtils.isNotBlank(decrypt)) {
|
||||
inputOperatorSecret = JSON.parseObject(decrypt).getString("PlatformSecret");
|
||||
}
|
||||
// 对比密钥
|
||||
if (!StringUtils.equals(operatorSecret, inputOperatorSecret)) {
|
||||
failReason = 1;
|
||||
succStat = 1;
|
||||
} else {
|
||||
// 生成token
|
||||
String token = JWTUtils.createToken(operatorId, operatorSecret, JWTUtils.ttlMillis);
|
||||
vo.setAccessToken(token);
|
||||
vo.setTokenAvailableTime((int) (JWTUtils.ttlMillis / 1000));
|
||||
}
|
||||
}
|
||||
// 组装返回参数
|
||||
vo.setPlatformId(operatorId);
|
||||
vo.setFailReason(failReason);
|
||||
vo.setSuccStat(succStat);
|
||||
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMap(vo, platformConfig);
|
||||
return resultMap;
|
||||
}
|
||||
// @Override
|
||||
// public Map<String, String> queryToken(CommonParamsDTO dto) {
|
||||
// AccessTokenVO vo = new AccessTokenVO();
|
||||
// // 0:成功;1:失败
|
||||
// int succStat = 0;
|
||||
// // 0:无;1:无此对接平台;2:密钥错误; 3~99:自定义
|
||||
// int failReason = 0;
|
||||
//
|
||||
// String operatorId = dto.getPlatformID();
|
||||
// // 通过operatorId 查出 operatorSecret
|
||||
// ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorId);
|
||||
// if (platformConfig == null) {
|
||||
// failReason = 1;
|
||||
// succStat = 1;
|
||||
// } else {
|
||||
// String operatorSecret = platformConfig.getOperatorSecret();
|
||||
// String dataSecret = platformConfig.getDataSecret();
|
||||
// String dataSecretIv = platformConfig.getDataSecretIv();
|
||||
// // 解密data 获取参数中的OperatorSecret
|
||||
// String decrypt = Cryptos.decrypt(dto.getData(), dataSecret, dataSecretIv);
|
||||
// String inputOperatorSecret = null;
|
||||
// if (StringUtils.isNotBlank(decrypt)) {
|
||||
// inputOperatorSecret = JSON.parseObject(decrypt).getString("PlatformSecret");
|
||||
// }
|
||||
// // 对比密钥
|
||||
// if (!StringUtils.equals(operatorSecret, inputOperatorSecret)) {
|
||||
// failReason = 1;
|
||||
// succStat = 1;
|
||||
// } else {
|
||||
// // 生成token
|
||||
// String token = JWTUtils.createToken(operatorId, operatorSecret, JWTUtils.ttlMillis);
|
||||
// vo.setAccessToken(token);
|
||||
// vo.setTokenAvailableTime((int) (JWTUtils.ttlMillis / 1000));
|
||||
// }
|
||||
// }
|
||||
// // 组装返回参数
|
||||
// vo.setPlatformId(operatorId);
|
||||
// vo.setFailReason(failReason);
|
||||
// vo.setSuccStat(succStat);
|
||||
//
|
||||
// Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMap(vo, platformConfig);
|
||||
// return resultMap;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 查询运营商信息 query_operator_info
|
||||
|
||||
@@ -3,13 +3,26 @@ package com.jsowell.thirdparty.platform.util;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.jsowell.pile.domain.ThirdPartyPlatformConfig;
|
||||
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Component
|
||||
public class ThirdPartyPlatformUtils {
|
||||
|
||||
/**
|
||||
* 生成结果集
|
||||
* @param obj 需要返回的数据
|
||||
* @param secretInfo 密钥配置信息对象
|
||||
* @return 结果集
|
||||
*/
|
||||
public static Map<String, String> generateResultMap(Object obj, ThirdPartySecretInfoVO secretInfo) {
|
||||
return generateResultMap(obj, secretInfo.getTheirOperatorSecret(), secretInfo.getTheirDataSecretIv(), secretInfo.getTheirSigSecret());
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成结果集
|
||||
* @param obj 需要返回的数据
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.jsowell.thirdparty.platform.zhongdianlian.service;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.jsowell.common.util.JWTUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.service.ThirdPartyPlatformConfigService;
|
||||
import com.jsowell.pile.thirdparty.CommonParamsDTO;
|
||||
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
|
||||
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.ThirdPartyPlatformUtils;
|
||||
import com.jsowell.thirdparty.service.ThirdpartySecretInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class ZhongDianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
|
||||
@Autowired
|
||||
private ThirdPartyPlatformConfigService thirdPartyPlatformConfigService;
|
||||
|
||||
@Autowired
|
||||
private ThirdpartySecretInfoService thirdpartySecretInfoService;
|
||||
|
||||
/**
|
||||
* query_token 获取token,提供给第三方平台使用
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> queryToken(CommonParamsDTO dto) {
|
||||
AccessTokenVO vo = new AccessTokenVO();
|
||||
// 0:成功;1:失败
|
||||
int succStat = 0;
|
||||
// 0:无;1:无此对接平台;2:密钥错误; 3~99:自定义
|
||||
int failReason = 0;
|
||||
|
||||
String operatorId = StringUtils.isNotBlank(dto.getOperatorID()) ? dto.getOperatorID() : dto.getPlatformID();
|
||||
// 通过operatorId 查出 operatorSecret
|
||||
// ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorId);
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByOperatorId(operatorId);
|
||||
if (thirdPartySecretInfoVO == null) {
|
||||
failReason = 1;
|
||||
succStat = 1;
|
||||
} else {
|
||||
String theirOperatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret();
|
||||
String dataSecret = thirdPartySecretInfoVO.getOurDataSecret();
|
||||
String dataSecretIv = thirdPartySecretInfoVO.getOurDataSecretIv();
|
||||
// 解密data 获取参数中的OperatorSecret
|
||||
String decrypt = Cryptos.decrypt(dto.getData(), dataSecret, dataSecretIv);
|
||||
String inputOperatorSecret = null;
|
||||
if (StringUtils.isNotBlank(decrypt)) {
|
||||
inputOperatorSecret = JSON.parseObject(decrypt).getString("PlatformSecret");
|
||||
}
|
||||
// 对比密钥
|
||||
if (!StringUtils.equals(theirOperatorSecret, inputOperatorSecret)) {
|
||||
failReason = 1;
|
||||
succStat = 1;
|
||||
} else {
|
||||
// 生成token
|
||||
String token = JWTUtils.createToken(operatorId, theirOperatorSecret, JWTUtils.ttlMillis);
|
||||
vo.setAccessToken(token);
|
||||
vo.setTokenAvailableTime((int) (JWTUtils.ttlMillis / 1000));
|
||||
}
|
||||
}
|
||||
// 组装返回参数
|
||||
vo.setPlatformId(operatorId);
|
||||
vo.setFailReason(failReason);
|
||||
vo.setSuccStat(succStat);
|
||||
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMap(vo, thirdPartySecretInfoVO);
|
||||
return resultMap;
|
||||
}
|
||||
}
|
||||
44
jsowell-ui/src/api/thirdParty/secret.js
vendored
Normal file
44
jsowell-ui/src/api/thirdParty/secret.js
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询对接三方平台配置列表
|
||||
export function listSecret(query) {
|
||||
return request({
|
||||
url: '/thirdparty/secret/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询对接三方平台配置详细
|
||||
export function getSecret(id) {
|
||||
return request({
|
||||
url: '/thirdparty/secret/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增对接三方平台配置
|
||||
export function addSecret(data) {
|
||||
return request({
|
||||
url: '/thirdparty/secret',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改对接三方平台配置
|
||||
export function updateSecret(data) {
|
||||
return request({
|
||||
url: '/thirdparty/secret',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除对接三方平台配置
|
||||
export function delSecret(id) {
|
||||
return request({
|
||||
url: '/thirdparty/secret/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
381
jsowell-ui/src/views/thirdParty/secret/index.vue
vendored
Normal file
381
jsowell-ui/src/views/thirdParty/secret/index.vue
vendored
Normal file
@@ -0,0 +1,381 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
|
||||
<el-form-item label="对接平台名称" prop="platformName">
|
||||
<el-input
|
||||
v-model="queryParams.platformName"
|
||||
placeholder="请输入对接平台名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="对接平台标识" prop="theirOperatorId">
|
||||
<el-input
|
||||
v-model="queryParams.theirOperatorId"
|
||||
placeholder="请输入对接平台标识"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<!--<el-form-item label="对接平台生成的消息密钥" prop="theirDataSecret">
|
||||
<el-input
|
||||
v-model="queryParams.theirDataSecret"
|
||||
placeholder="请输入对接平台生成的消息密钥"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>-->
|
||||
<!--<el-form-item label="对接平台生成的初始化向量" prop="theirDataSecretIv">
|
||||
<el-input
|
||||
v-model="queryParams.theirDataSecretIv"
|
||||
placeholder="请输入对接平台生成的初始化向量"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>-->
|
||||
<!--<el-form-item label="对接平台生成的签名密钥" prop="theirSigSecret">
|
||||
<el-input
|
||||
v-model="queryParams.theirSigSecret"
|
||||
placeholder="请输入对接平台生成的签名密钥"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>-->
|
||||
<!--<el-form-item label="我方生成的唯一识别密钥" prop="ourOperatorSecret">
|
||||
<el-input
|
||||
v-model="queryParams.ourOperatorSecret"
|
||||
placeholder="请输入我方生成的唯一识别密钥"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>-->
|
||||
<!--<el-form-item label="我方生成的消息密钥" prop="ourDataSecret">
|
||||
<el-input
|
||||
v-model="queryParams.ourDataSecret"
|
||||
placeholder="请输入我方生成的消息密钥"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>-->
|
||||
<!--<el-form-item label="我方生成的初始化向量" prop="ourDataSecretIv">
|
||||
<el-input
|
||||
v-model="queryParams.ourDataSecretIv"
|
||||
placeholder="请输入我方生成的初始化向量"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>-->
|
||||
<!--<el-form-item label="我方生成的签名密钥" prop="ourSigSecret">
|
||||
<el-input
|
||||
v-model="queryParams.ourSigSecret"
|
||||
placeholder="请输入我方生成的签名密钥"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>-->
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['thirdparty:secret:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['thirdparty:secret:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['thirdparty:secret:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<!--<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['thirdparty:secret:export']"
|
||||
>导出</el-button>
|
||||
</el-col>-->
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="secretList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!--<el-table-column label="主键" align="center" prop="id" />-->
|
||||
<el-table-column label="对接平台名称" align="center" prop="platformName" />
|
||||
<el-table-column label="对接平台类型" align="center" prop="platformType" />
|
||||
<el-table-column label="接口地址前缀" align="center" prop="urlPrefix" />
|
||||
<el-table-column label="对接平台标识" align="center" prop="theirOperatorId" />
|
||||
<!--<el-table-column label="对接平台生成的唯一识别密钥" align="center" prop="theirOperatorSecret" />
|
||||
<el-table-column label="对接平台生成的消息密钥" align="center" prop="theirDataSecret" />
|
||||
<el-table-column label="对接平台生成的初始化向量" align="center" prop="theirDataSecretIv" />
|
||||
<el-table-column label="对接平台生成的签名密钥" align="center" prop="theirSigSecret" />
|
||||
<el-table-column label="我方生成的唯一识别密钥" align="center" prop="ourOperatorSecret" />
|
||||
<el-table-column label="我方生成的消息密钥" align="center" prop="ourDataSecret" />
|
||||
<el-table-column label="我方生成的初始化向量" align="center" prop="ourDataSecretIv" />
|
||||
<el-table-column label="我方生成的签名密钥" align="center" prop="ourSigSecret" />-->
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['thirdparty:secret:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['thirdparty:secret:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改对接三方平台配置对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="300px">
|
||||
<el-form-item label="对接平台名称" prop="platformName">
|
||||
<el-input v-model="form.platformName" placeholder="请输入对接平台名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="接口地址前缀" prop="urlPrefix">
|
||||
<el-input v-model="form.urlPrefix" placeholder="请输入接口地址前缀" />
|
||||
</el-form-item>
|
||||
<el-form-item label="对接平台标识(OperatorId)" prop="theirOperatorId">
|
||||
<el-input v-model="form.theirOperatorId" placeholder="请输入对接平台标识(OperatorId)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="对接平台唯一识别密钥(OperatorSecret)" prop="theirOperatorSecret">
|
||||
<el-input v-model="form.theirOperatorSecret" placeholder="请输入对接平台生成的唯一识别密钥(OperatorSecret)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="对接平台消息密钥(DataSecret)" prop="theirDataSecret">
|
||||
<el-input v-model="form.theirDataSecret" placeholder="请输入对接平台生成的消息密钥(DataSecret)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="对接平台初始化向量(DataSecretIv)" prop="theirDataSecretIv">
|
||||
<el-input v-model="form.theirDataSecretIv" placeholder="请输入对接平台生成的初始化向量(DataSecretIv)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="对接平台签名密钥(SigSecret)" prop="theirSigSecret">
|
||||
<el-input v-model="form.theirSigSecret" placeholder="请输入对接平台生成的签名密钥(SigSecret)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="我方唯一识别密钥(OperatorSecret)" prop="ourOperatorSecret">
|
||||
<el-input v-model="form.ourOperatorSecret" placeholder="请输入我方生成的唯一识别密钥(OperatorSecret)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="我方消息密钥(DataSecret)" prop="ourDataSecret">
|
||||
<el-input v-model="form.ourDataSecret" placeholder="请输入我方生成的消息密钥(DataSecret)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="我方初始化向量(DataSecretIv)" prop="ourDataSecretIv">
|
||||
<el-input v-model="form.ourDataSecretIv" placeholder="请输入我方生成的初始化向量(DataSecretIv)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="我方签名密钥(SigSecret)" prop="ourSigSecret">
|
||||
<el-input v-model="form.ourSigSecret" placeholder="请输入我方生成的签名密钥(SigSecret)" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
import {addSecret, getSecret, listSecret, updateSecret} from "@/api/thirdParty/secret";
|
||||
|
||||
export default {
|
||||
name: "Secret",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 对接三方平台配置表格数据
|
||||
secretList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
platformName: null,
|
||||
platformType: null,
|
||||
urlPrefix: null,
|
||||
theirOperatorId: null,
|
||||
theirOperatorSecret: null,
|
||||
theirDataSecret: null,
|
||||
theirDataSecretIv: null,
|
||||
theirSigSecret: null,
|
||||
ourOperatorSecret: null,
|
||||
ourDataSecret: null,
|
||||
ourDataSecretIv: null,
|
||||
ourSigSecret: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询对接三方平台配置列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listSecret(this.queryParams).then(response => {
|
||||
this.secretList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
platformName: null,
|
||||
platformType: null,
|
||||
urlPrefix: null,
|
||||
theirOperatorId: null,
|
||||
theirOperatorSecret: null,
|
||||
theirDataSecret: null,
|
||||
theirDataSecretIv: null,
|
||||
theirSigSecret: null,
|
||||
ourOperatorSecret: null,
|
||||
ourDataSecret: null,
|
||||
ourDataSecretIv: null,
|
||||
ourSigSecret: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
delFlag: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加对接三方平台配置";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getSecret(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改对接三方平台配置";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateSecret(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addSecret(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除对接三方平台配置编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delSecret(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('thirdparty/secret/export', {
|
||||
...this.queryParams
|
||||
}, `secret_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user