From 94d706f49ecf6b1d68e338e7bf46dfcf7b2a49d4 Mon Sep 17 00:00:00 2001 From: Lemon Date: Sat, 27 May 2023 09:05:18 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=20=E5=AF=B9=E6=8E=A5?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E9=85=8D=E7=BD=AE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pile/DockingPlatformConfigController.java | 98 +++++++++++++ .../pile/domain/DockingPlatformConfig.java | 136 ++++++++++++++++++ .../mapper/DockingPlatformConfigMapper.java | 61 ++++++++ .../IDockingPlatformConfigService.java | 61 ++++++++ .../DockingPlatformConfigServiceImpl.java | 96 +++++++++++++ .../pile/DockingPlatformConfigMapper.xml | 101 +++++++++++++ .../service/impl/LianLianServiceImpl.java | 10 +- 7 files changed, 561 insertions(+), 2 deletions(-) create mode 100644 jsowell-admin/src/main/java/com/jsowell/web/controller/pile/DockingPlatformConfigController.java create mode 100644 jsowell-pile/src/main/java/com/jsowell/pile/domain/DockingPlatformConfig.java create mode 100644 jsowell-pile/src/main/java/com/jsowell/pile/mapper/DockingPlatformConfigMapper.java create mode 100644 jsowell-pile/src/main/java/com/jsowell/pile/service/IDockingPlatformConfigService.java create mode 100644 jsowell-pile/src/main/java/com/jsowell/pile/service/impl/DockingPlatformConfigServiceImpl.java create mode 100644 jsowell-pile/src/main/resources/mapper/pile/DockingPlatformConfigMapper.xml diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/DockingPlatformConfigController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/DockingPlatformConfigController.java new file mode 100644 index 000000000..ec1e524b3 --- /dev/null +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/DockingPlatformConfigController.java @@ -0,0 +1,98 @@ +package com.jsowell.web.controller.pile; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.jsowell.common.annotation.Log; +import com.jsowell.common.core.controller.BaseController; +import com.jsowell.common.core.domain.AjaxResult; +import com.jsowell.common.enums.BusinessType; +import com.jsowell.pile.domain.DockingPlatformConfig; +import com.jsowell.pile.service.IDockingPlatformConfigService; +import com.jsowell.common.util.poi.ExcelUtil; +import com.jsowell.common.core.page.TableDataInfo; + +/** + * 对接平台配置信息Controller + * + * @author jsowell + * @date 2023-05-27 + */ +@RestController +@RequestMapping("/pile/config") +public class DockingPlatformConfigController extends BaseController { + @Autowired + private IDockingPlatformConfigService dockingPlatformConfigService; + + /** + * 查询对接平台配置信息列表 + */ + @PreAuthorize("@ss.hasPermi('pile:config:list')") + @GetMapping("/list") + public TableDataInfo list(DockingPlatformConfig dockingPlatformConfig) { + startPage(); + List list = dockingPlatformConfigService.selectDockingPlatformConfigList(dockingPlatformConfig); + return getDataTable(list); + } + + /** + * 导出对接平台配置信息列表 + */ + @PreAuthorize("@ss.hasPermi('pile:config:export')") + @Log(title = "对接平台配置信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DockingPlatformConfig dockingPlatformConfig) { + List list = dockingPlatformConfigService.selectDockingPlatformConfigList(dockingPlatformConfig); + ExcelUtil util = new ExcelUtil(DockingPlatformConfig.class); + util.exportExcel(response, list, "对接平台配置信息数据"); + } + + /** + * 获取对接平台配置信息详细信息 + */ + @PreAuthorize("@ss.hasPermi('pile:config:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Integer id) { + return AjaxResult.success(dockingPlatformConfigService.selectDockingPlatformConfigById(id)); + } + + /** + * 新增对接平台配置信息 + */ + @PreAuthorize("@ss.hasPermi('pile:config:add')") + @Log(title = "对接平台配置信息", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DockingPlatformConfig dockingPlatformConfig) { + return toAjax(dockingPlatformConfigService.insertDockingPlatformConfig(dockingPlatformConfig)); + } + + /** + * 修改对接平台配置信息 + */ + @PreAuthorize("@ss.hasPermi('pile:config:edit')") + @Log(title = "对接平台配置信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DockingPlatformConfig dockingPlatformConfig) { + return toAjax(dockingPlatformConfigService.updateDockingPlatformConfig(dockingPlatformConfig)); + } + + /** + * 删除对接平台配置信息 + */ + @PreAuthorize("@ss.hasPermi('pile:config:remove')") + @Log(title = "对接平台配置信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Integer[] ids) { + return toAjax(dockingPlatformConfigService.deleteDockingPlatformConfigByIds(ids)); + } +} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/domain/DockingPlatformConfig.java b/jsowell-pile/src/main/java/com/jsowell/pile/domain/DockingPlatformConfig.java new file mode 100644 index 000000000..e3f6ae781 --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/domain/DockingPlatformConfig.java @@ -0,0 +1,136 @@ +package com.jsowell.pile.domain; + +import com.jsowell.common.annotation.Excel; +import com.jsowell.common.core.domain.BaseEntity; + +/** + * 对接平台配置信息对象 docking_platform_config + * + * @author jsowell + * @date 2023-05-27 + */ +public class DockingPlatformConfig extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** $column.columnComment */ + private Integer id; + + /** 对接平台名称 */ + @Excel(name = "对接平台名称") + private String name; + + /** 运营商id */ + @Excel(name = "运营商id") + private String operatorId; + + /** 运营商密钥 */ + @Excel(name = "运营商密钥") + private String operatorSecret; + + /** 签名密钥 */ + @Excel(name = "签名密钥") + private String signSecret; + + /** 消息密钥 */ + @Excel(name = "消息密钥") + private String dataSecret; + + /** 消息密钥初始化向量 */ + @Excel(name = "消息密钥初始化向量") + private String dataSecretIv; + + /** 删除标识 */ + private String delFlag; + + public void setId(Integer id) + { + this.id = id; + } + + public Integer getId() + { + return id; + } + public void setName(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } + public void setOperatorId(String operatorId) + { + this.operatorId = operatorId; + } + + public String getOperatorId() + { + return operatorId; + } + public void setOperatorSecret(String operatorSecret) + { + this.operatorSecret = operatorSecret; + } + + public String getOperatorSecret() + { + return operatorSecret; + } + public void setSignSecret(String signSecret) + { + this.signSecret = signSecret; + } + + public String getSignSecret() + { + return signSecret; + } + public void setDataSecret(String dataSecret) + { + this.dataSecret = dataSecret; + } + + public String getDataSecret() + { + return dataSecret; + } + public void setDataSecretIv(String dataSecretIv) + { + this.dataSecretIv = dataSecretIv; + } + + public String getDataSecretIv() + { + return dataSecretIv; + } + 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("name", getName()) + .append("operatorId", getOperatorId()) + .append("operatorSecret", getOperatorSecret()) + .append("signSecret", getSignSecret()) + .append("dataSecret", getDataSecret()) + .append("dataSecretIv", getDataSecretIv()) + .append("createTime", getCreateTime()) + .append("createBy", getCreateBy()) + .append("updateTime", getUpdateTime()) + .append("updateBy", getUpdateBy()) + .append("delFlag", getDelFlag()) + .toString(); + } +} 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 new file mode 100644 index 000000000..ad54e333a --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/DockingPlatformConfigMapper.java @@ -0,0 +1,61 @@ +package com.jsowell.pile.mapper; + +import java.util.List; +import com.jsowell.pile.domain.DockingPlatformConfig; + +/** + * 对接平台配置信息Mapper接口 + * + * @author jsowell + * @date 2023-05-27 + */ +public interface DockingPlatformConfigMapper +{ + /** + * 查询对接平台配置信息 + * + * @param id 对接平台配置信息主键 + * @return 对接平台配置信息 + */ + public DockingPlatformConfig selectDockingPlatformConfigById(Integer id); + + /** + * 查询对接平台配置信息列表 + * + * @param dockingPlatformConfig 对接平台配置信息 + * @return 对接平台配置信息集合 + */ + public List selectDockingPlatformConfigList(DockingPlatformConfig dockingPlatformConfig); + + /** + * 新增对接平台配置信息 + * + * @param dockingPlatformConfig 对接平台配置信息 + * @return 结果 + */ + public int insertDockingPlatformConfig(DockingPlatformConfig dockingPlatformConfig); + + /** + * 修改对接平台配置信息 + * + * @param dockingPlatformConfig 对接平台配置信息 + * @return 结果 + */ + public int updateDockingPlatformConfig(DockingPlatformConfig dockingPlatformConfig); + + /** + * 删除对接平台配置信息 + * + * @param id 对接平台配置信息主键 + * @return 结果 + */ + public int deleteDockingPlatformConfigById(Integer id); + + /** + * 批量删除对接平台配置信息 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteDockingPlatformConfigByIds(Integer[] ids); +} 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 new file mode 100644 index 000000000..9795c99d0 --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/IDockingPlatformConfigService.java @@ -0,0 +1,61 @@ +package com.jsowell.pile.service; + +import java.util.List; +import com.jsowell.pile.domain.DockingPlatformConfig; + +/** + * 对接平台配置信息Service接口 + * + * @author jsowell + * @date 2023-05-27 + */ +public interface IDockingPlatformConfigService +{ + /** + * 查询对接平台配置信息 + * + * @param id 对接平台配置信息主键 + * @return 对接平台配置信息 + */ + public DockingPlatformConfig selectDockingPlatformConfigById(Integer id); + + /** + * 查询对接平台配置信息列表 + * + * @param dockingPlatformConfig 对接平台配置信息 + * @return 对接平台配置信息集合 + */ + public List selectDockingPlatformConfigList(DockingPlatformConfig dockingPlatformConfig); + + /** + * 新增对接平台配置信息 + * + * @param dockingPlatformConfig 对接平台配置信息 + * @return 结果 + */ + public int insertDockingPlatformConfig(DockingPlatformConfig dockingPlatformConfig); + + /** + * 修改对接平台配置信息 + * + * @param dockingPlatformConfig 对接平台配置信息 + * @return 结果 + */ + public int updateDockingPlatformConfig(DockingPlatformConfig dockingPlatformConfig); + + /** + * 批量删除对接平台配置信息 + * + * @param ids 需要删除的对接平台配置信息主键集合 + * @return 结果 + */ + public int deleteDockingPlatformConfigByIds(Integer[] ids); + + /** + * 删除对接平台配置信息信息 + * + * @param id 对接平台配置信息主键 + * @return 结果 + */ + public int deleteDockingPlatformConfigById(Integer id); +} 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 new file mode 100644 index 000000000..46b3c0aab --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/DockingPlatformConfigServiceImpl.java @@ -0,0 +1,96 @@ +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; +import com.jsowell.pile.mapper.DockingPlatformConfigMapper; +import com.jsowell.pile.domain.DockingPlatformConfig; +import com.jsowell.pile.service.IDockingPlatformConfigService; + +/** + * 对接平台配置信息Service业务层处理 + * + * @author jsowell + * @date 2023-05-27 + */ +@Service +public class DockingPlatformConfigServiceImpl implements IDockingPlatformConfigService +{ + @Autowired + private DockingPlatformConfigMapper dockingPlatformConfigMapper; + + /** + * 查询对接平台配置信息 + * + * @param id 对接平台配置信息主键 + * @return 对接平台配置信息 + */ + @Override + public DockingPlatformConfig selectDockingPlatformConfigById(Integer id) + { + return dockingPlatformConfigMapper.selectDockingPlatformConfigById(id); + } + + /** + * 查询对接平台配置信息列表 + * + * @param dockingPlatformConfig 对接平台配置信息 + * @return 对接平台配置信息 + */ + @Override + public List selectDockingPlatformConfigList(DockingPlatformConfig dockingPlatformConfig) + { + return dockingPlatformConfigMapper.selectDockingPlatformConfigList(dockingPlatformConfig); + } + + /** + * 新增对接平台配置信息 + * + * @param dockingPlatformConfig 对接平台配置信息 + * @return 结果 + */ + @Override + public int insertDockingPlatformConfig(DockingPlatformConfig dockingPlatformConfig) + { + dockingPlatformConfig.setCreateTime(DateUtils.getNowDate()); + return dockingPlatformConfigMapper.insertDockingPlatformConfig(dockingPlatformConfig); + } + + /** + * 修改对接平台配置信息 + * + * @param dockingPlatformConfig 对接平台配置信息 + * @return 结果 + */ + @Override + public int updateDockingPlatformConfig(DockingPlatformConfig dockingPlatformConfig) + { + dockingPlatformConfig.setUpdateTime(DateUtils.getNowDate()); + return dockingPlatformConfigMapper.updateDockingPlatformConfig(dockingPlatformConfig); + } + + /** + * 批量删除对接平台配置信息 + * + * @param ids 需要删除的对接平台配置信息主键 + * @return 结果 + */ + @Override + public int deleteDockingPlatformConfigByIds(Integer[] ids) + { + return dockingPlatformConfigMapper.deleteDockingPlatformConfigByIds(ids); + } + + /** + * 删除对接平台配置信息信息 + * + * @param id 对接平台配置信息主键 + * @return 结果 + */ + @Override + public int deleteDockingPlatformConfigById(Integer id) + { + return dockingPlatformConfigMapper.deleteDockingPlatformConfigById(id); + } +} diff --git a/jsowell-pile/src/main/resources/mapper/pile/DockingPlatformConfigMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/DockingPlatformConfigMapper.xml new file mode 100644 index 000000000..8ce463e79 --- /dev/null +++ b/jsowell-pile/src/main/resources/mapper/pile/DockingPlatformConfigMapper.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + insert into docking_platform_config + + name, + operator_id, + operator_secret, + sign_secret, + data_secret, + data_secret_IV, + create_time, + create_by, + update_time, + update_by, + del_flag, + + + #{name}, + #{operatorId}, + #{operatorSecret}, + #{signSecret}, + #{dataSecret}, + #{dataSecretIv}, + #{createTime}, + #{createBy}, + #{updateTime}, + #{updateBy}, + #{delFlag}, + + + + + update docking_platform_config + + name = #{name}, + operator_id = #{operatorId}, + operator_secret = #{operatorSecret}, + sign_secret = #{signSecret}, + data_secret = #{dataSecret}, + data_secret_IV = #{dataSecretIv}, + create_time = #{createTime}, + create_by = #{createBy}, + update_time = #{updateTime}, + update_by = #{updateBy}, + del_flag = #{delFlag}, + + where id = #{id} + + + + delete from docking_platform_config where id = #{id} + + + + delete from docking_platform_config where id in + + #{id} + + + \ 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 f69874031..edac8570e 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 @@ -1270,9 +1270,15 @@ public class LianLianServiceImpl implements LianLianService { Map resultMap = Maps.newLinkedHashMap(); // 加密数据 TODO vo对象加密 - resultMap.put("data", ""); + // byte[] encryptText = Cryptos.aesEncrypt(JSONObject.toJSONString(vo).getBytes(), + // dataSecret.getBytes(), dataSecretIV.getBytes()); + // String encryptData = Encodes.encodeBase64(encryptText); + + // resultMap.put("Data", encryptData); // 生成sig TODO 生成sig - resultMap.put("sig", ""); + String resultSign = GBSignUtils.sign(resultMap, operatorSecret); + resultMap.put("Sig", resultSign); + return resultMap; } From 53b5432f9f7d6523bd8f6286ca210d012ce0ab10 Mon Sep 17 00:00:00 2001 From: Lemon Date: Sat, 27 May 2023 09:18:54 +0800 Subject: [PATCH 2/2] =?UTF-8?q?udpate=20=E8=81=94=E8=81=94=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E4=BB=A4=E7=89=8C=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/DockingPlatformConfigMapper.java | 7 +++ .../IDockingPlatformConfigService.java | 7 +++ .../DockingPlatformConfigServiceImpl.java | 47 ++++++++++--------- .../pile/DockingPlatformConfigMapper.xml | 11 +++++ .../service/impl/LianLianServiceImpl.java | 17 +++++-- 5 files changed, 63 insertions(+), 26 deletions(-) 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);