diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/DockingPlatformConfigMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/DockingPlatformConfigMapper.java index ad54e333a..a5f2e21ba 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/DockingPlatformConfigMapper.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/DockingPlatformConfigMapper.java @@ -58,4 +58,11 @@ public interface DockingPlatformConfigMapper * @return 结果 */ public int deleteDockingPlatformConfigByIds(Integer[] ids); + + /** + * 通过operatorId查询配置信息 + * @param operatorId + * @return + */ + DockingPlatformConfig getInfoByOperatorId(String operatorId); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/IDockingPlatformConfigService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/IDockingPlatformConfigService.java index 9795c99d0..9c4746de5 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/IDockingPlatformConfigService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/IDockingPlatformConfigService.java @@ -58,4 +58,11 @@ public interface IDockingPlatformConfigService * @return 结果 */ public int deleteDockingPlatformConfigById(Integer id); + + /** + * 通过operatorId查询配置信息 + * @param operatorId + * @return + */ + DockingPlatformConfig getInfoByOperatorId(String operatorId); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/DockingPlatformConfigServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/DockingPlatformConfigServiceImpl.java index 46b3c0aab..97540bb28 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/DockingPlatformConfigServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/DockingPlatformConfigServiceImpl.java @@ -1,6 +1,7 @@ package com.jsowell.pile.service.impl; import java.util.List; + import com.jsowell.common.util.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -10,87 +11,91 @@ import com.jsowell.pile.service.IDockingPlatformConfigService; /** * 对接平台配置信息Service业务层处理 - * + * * @author jsowell * @date 2023-05-27 */ @Service -public class DockingPlatformConfigServiceImpl implements IDockingPlatformConfigService -{ +public class DockingPlatformConfigServiceImpl implements IDockingPlatformConfigService { @Autowired private DockingPlatformConfigMapper dockingPlatformConfigMapper; /** * 查询对接平台配置信息 - * + * * @param id 对接平台配置信息主键 * @return 对接平台配置信息 */ @Override - public DockingPlatformConfig selectDockingPlatformConfigById(Integer id) - { + public DockingPlatformConfig selectDockingPlatformConfigById(Integer id) { return dockingPlatformConfigMapper.selectDockingPlatformConfigById(id); } /** * 查询对接平台配置信息列表 - * + * * @param dockingPlatformConfig 对接平台配置信息 * @return 对接平台配置信息 */ @Override - public List selectDockingPlatformConfigList(DockingPlatformConfig dockingPlatformConfig) - { + public List selectDockingPlatformConfigList(DockingPlatformConfig dockingPlatformConfig) { return dockingPlatformConfigMapper.selectDockingPlatformConfigList(dockingPlatformConfig); } /** * 新增对接平台配置信息 - * + * * @param dockingPlatformConfig 对接平台配置信息 * @return 结果 */ @Override - public int insertDockingPlatformConfig(DockingPlatformConfig dockingPlatformConfig) - { + public int insertDockingPlatformConfig(DockingPlatformConfig dockingPlatformConfig) { dockingPlatformConfig.setCreateTime(DateUtils.getNowDate()); return dockingPlatformConfigMapper.insertDockingPlatformConfig(dockingPlatformConfig); } /** * 修改对接平台配置信息 - * + * * @param dockingPlatformConfig 对接平台配置信息 * @return 结果 */ @Override - public int updateDockingPlatformConfig(DockingPlatformConfig dockingPlatformConfig) - { + public int updateDockingPlatformConfig(DockingPlatformConfig dockingPlatformConfig) { dockingPlatformConfig.setUpdateTime(DateUtils.getNowDate()); return dockingPlatformConfigMapper.updateDockingPlatformConfig(dockingPlatformConfig); } /** * 批量删除对接平台配置信息 - * + * * @param ids 需要删除的对接平台配置信息主键 * @return 结果 */ @Override - public int deleteDockingPlatformConfigByIds(Integer[] ids) - { + public int deleteDockingPlatformConfigByIds(Integer[] ids) { return dockingPlatformConfigMapper.deleteDockingPlatformConfigByIds(ids); } /** * 删除对接平台配置信息信息 - * + * * @param id 对接平台配置信息主键 * @return 结果 */ @Override - public int deleteDockingPlatformConfigById(Integer id) - { + public int deleteDockingPlatformConfigById(Integer id) { return dockingPlatformConfigMapper.deleteDockingPlatformConfigById(id); } + + /** + * 通过operatorId查询配置信息 + * + * @param operatorId + * @return + */ + @Override + public DockingPlatformConfig getInfoByOperatorId(String operatorId) { + return dockingPlatformConfigMapper.getInfoByOperatorId(operatorId); + } } diff --git a/jsowell-pile/src/main/resources/mapper/pile/DockingPlatformConfigMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/DockingPlatformConfigMapper.xml index 8ce463e79..d01599061 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/DockingPlatformConfigMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/DockingPlatformConfigMapper.xml @@ -23,6 +23,11 @@ select id, name, operator_id, operator_secret, sign_secret, data_secret, data_secret_IV, create_time, create_by, update_time, update_by, del_flag from docking_platform_config + + + id, name, operator_id, operator_secret, sign_secret, data_secret, data_secret_IV, create_time, create_by, update_time, update_by, del_flag + + + select + from docking_platform_config + where operator_id = #{operatorId,jdbcType=VARCHAR} + \ No newline at end of file diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/impl/LianLianServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/impl/LianLianServiceImpl.java index edac8570e..cbd2b0cb6 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/impl/LianLianServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/impl/LianLianServiceImpl.java @@ -88,6 +88,9 @@ public class LianLianServiceImpl implements LianLianService { @Autowired private IThirdPartySettingInfoService thirdPartySettingInfoService; + @Autowired + private IDockingPlatformConfigService dockingPlatformConfigService; + @Override public void pushMerchantInfo(Long merchantId) { // 通过id查询运营商信息 @@ -1231,7 +1234,11 @@ public class LianLianServiceImpl implements LianLianService { public Map generateToken(QueryTokenDTO dto) throws UnsupportedEncodingException { String operatorID = dto.getOperatorID(); // 通过operatorID 查出 operatorSecret TODO 建表 设置密钥 - String operatorSecret = "123123123123aaaa"; + DockingPlatformConfig platformConfig = dockingPlatformConfigService.getInfoByOperatorId(operatorID); + if (platformConfig == null) { + return null; + } + String operatorSecret = platformConfig.getOperatorSecret(); Map map = Maps.newLinkedHashMap(); map.put("OperatorID", dto.getOperatorID()); @@ -1270,11 +1277,11 @@ public class LianLianServiceImpl implements LianLianService { Map resultMap = Maps.newLinkedHashMap(); // 加密数据 TODO vo对象加密 - // byte[] encryptText = Cryptos.aesEncrypt(JSONObject.toJSONString(vo).getBytes(), - // dataSecret.getBytes(), dataSecretIV.getBytes()); - // String encryptData = Encodes.encodeBase64(encryptText); + byte[] encryptText = Cryptos.aesEncrypt(JSONObject.toJSONString(vo).getBytes(), + platformConfig.getDataSecret().getBytes(), platformConfig.getDataSecretIv().getBytes()); + String encryptData = Encodes.encodeBase64(encryptText); - // resultMap.put("Data", encryptData); + resultMap.put("Data", encryptData); // 生成sig TODO 生成sig String resultSign = GBSignUtils.sign(resultMap, operatorSecret); resultMap.put("Sig", resultSign);