From 8e509dd55967d23fd6b6e72b03da6fd0d600e45b Mon Sep 17 00:00:00 2001 From: Lemon Date: Wed, 24 May 2023 15:17:09 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=20=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0=E5=AF=B9=E6=8E=A5=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=20=E8=A1=A8=E3=80=81=E5=AE=9E=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pile/ThirdPartySettingInfoController.java | 104 ++++++++++++ .../pile/domain/ThirdPartySettingInfo.java | 152 ++++++++++++++++++ .../mapper/ThirdPartySettingInfoMapper.java | 61 +++++++ .../IThirdPartySettingInfoService.java | 61 +++++++ .../ThirdPartySettingInfoServiceImpl.java | 96 +++++++++++ .../pile/ThirdPartySettingInfoMapper.xml | 106 ++++++++++++ 6 files changed, 580 insertions(+) create mode 100644 jsowell-admin/src/main/java/com/jsowell/web/controller/pile/ThirdPartySettingInfoController.java create mode 100644 jsowell-pile/src/main/java/com/jsowell/pile/domain/ThirdPartySettingInfo.java create mode 100644 jsowell-pile/src/main/java/com/jsowell/pile/mapper/ThirdPartySettingInfoMapper.java create mode 100644 jsowell-pile/src/main/java/com/jsowell/pile/service/IThirdPartySettingInfoService.java create mode 100644 jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartySettingInfoServiceImpl.java create mode 100644 jsowell-pile/src/main/resources/mapper/pile/ThirdPartySettingInfoMapper.xml diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/ThirdPartySettingInfoController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/ThirdPartySettingInfoController.java new file mode 100644 index 000000000..b37ddfdd3 --- /dev/null +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/ThirdPartySettingInfoController.java @@ -0,0 +1,104 @@ +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.ThirdPartySettingInfo; +import com.jsowell.pile.service.IThirdPartySettingInfoService; +import com.jsowell.common.util.poi.ExcelUtil; +import com.jsowell.common.core.page.TableDataInfo; + +/** + * 第三方平台配置Controller + * + * @author jsowell + * @date 2023-05-24 + */ +@RestController +@RequestMapping("/pile/info") +public class ThirdPartySettingInfoController extends BaseController +{ + @Autowired + private IThirdPartySettingInfoService thirdPartySettingInfoService; + + /** + * 查询第三方平台配置列表 + */ + @PreAuthorize("@ss.hasPermi('pile:info:list')") + @GetMapping("/list") + public TableDataInfo list(ThirdPartySettingInfo thirdPartySettingInfo) + { + startPage(); + List list = thirdPartySettingInfoService.selectThirdPartySettingInfoList(thirdPartySettingInfo); + return getDataTable(list); + } + + /** + * 导出第三方平台配置列表 + */ + @PreAuthorize("@ss.hasPermi('pile:info:export')") + @Log(title = "第三方平台配置", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ThirdPartySettingInfo thirdPartySettingInfo) + { + List list = thirdPartySettingInfoService.selectThirdPartySettingInfoList(thirdPartySettingInfo); + ExcelUtil util = new ExcelUtil(ThirdPartySettingInfo.class); + util.exportExcel(response, list, "第三方平台配置数据"); + } + + /** + * 获取第三方平台配置详细信息 + */ + @PreAuthorize("@ss.hasPermi('pile:info:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(thirdPartySettingInfoService.selectThirdPartySettingInfoById(id)); + } + + /** + * 新增第三方平台配置 + */ + @PreAuthorize("@ss.hasPermi('pile:info:add')") + @Log(title = "第三方平台配置", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ThirdPartySettingInfo thirdPartySettingInfo) + { + return toAjax(thirdPartySettingInfoService.insertThirdPartySettingInfo(thirdPartySettingInfo)); + } + + /** + * 修改第三方平台配置 + */ + @PreAuthorize("@ss.hasPermi('pile:info:edit')") + @Log(title = "第三方平台配置", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ThirdPartySettingInfo thirdPartySettingInfo) + { + return toAjax(thirdPartySettingInfoService.updateThirdPartySettingInfo(thirdPartySettingInfo)); + } + + /** + * 删除第三方平台配置 + */ + @PreAuthorize("@ss.hasPermi('pile:info:remove')") + @Log(title = "第三方平台配置", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(thirdPartySettingInfoService.deleteThirdPartySettingInfoByIds(ids)); + } +} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/domain/ThirdPartySettingInfo.java b/jsowell-pile/src/main/java/com/jsowell/pile/domain/ThirdPartySettingInfo.java new file mode 100644 index 000000000..5b57eabb3 --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/domain/ThirdPartySettingInfo.java @@ -0,0 +1,152 @@ +package com.jsowell.pile.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_setting_info + * + * @author jsowell + * @date 2023-05-24 + */ +public class ThirdPartySettingInfo extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Long id; + + /** 对接类型(1-联联平台) */ + @Excel(name = "对接类型", readConverterExp = "1=-联联平台") + private String type; + + /** 站点id */ + @Excel(name = "站点id") + private String stationId; + + /** 运营商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(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setType(String type) + { + this.type = type; + } + + public String getType() + { + return type; + } + public void setStationId(String stationId) + { + this.stationId = stationId; + } + + public String getStationId() + { + return stationId; + } + 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("type", getType()) + .append("stationId", getStationId()) + .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/ThirdPartySettingInfoMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/ThirdPartySettingInfoMapper.java new file mode 100644 index 000000000..46f3e026a --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/ThirdPartySettingInfoMapper.java @@ -0,0 +1,61 @@ +package com.jsowell.pile.mapper; + +import java.util.List; +import com.jsowell.pile.domain.ThirdPartySettingInfo; + +/** + * 第三方平台配置Mapper接口 + * + * @author jsowell + * @date 2023-05-24 + */ +public interface ThirdPartySettingInfoMapper +{ + /** + * 查询第三方平台配置 + * + * @param id 第三方平台配置主键 + * @return 第三方平台配置 + */ + public ThirdPartySettingInfo selectThirdPartySettingInfoById(Long id); + + /** + * 查询第三方平台配置列表 + * + * @param thirdPartySettingInfo 第三方平台配置 + * @return 第三方平台配置集合 + */ + public List selectThirdPartySettingInfoList(ThirdPartySettingInfo thirdPartySettingInfo); + + /** + * 新增第三方平台配置 + * + * @param thirdPartySettingInfo 第三方平台配置 + * @return 结果 + */ + public int insertThirdPartySettingInfo(ThirdPartySettingInfo thirdPartySettingInfo); + + /** + * 修改第三方平台配置 + * + * @param thirdPartySettingInfo 第三方平台配置 + * @return 结果 + */ + public int updateThirdPartySettingInfo(ThirdPartySettingInfo thirdPartySettingInfo); + + /** + * 删除第三方平台配置 + * + * @param id 第三方平台配置主键 + * @return 结果 + */ + public int deleteThirdPartySettingInfoById(Long id); + + /** + * 批量删除第三方平台配置 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteThirdPartySettingInfoByIds(Long[] ids); +} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/IThirdPartySettingInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/IThirdPartySettingInfoService.java new file mode 100644 index 000000000..94302bc29 --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/IThirdPartySettingInfoService.java @@ -0,0 +1,61 @@ +package com.jsowell.pile.service; + +import java.util.List; +import com.jsowell.pile.domain.ThirdPartySettingInfo; + +/** + * 第三方平台配置Service接口 + * + * @author jsowell + * @date 2023-05-24 + */ +public interface IThirdPartySettingInfoService +{ + /** + * 查询第三方平台配置 + * + * @param id 第三方平台配置主键 + * @return 第三方平台配置 + */ + public ThirdPartySettingInfo selectThirdPartySettingInfoById(Long id); + + /** + * 查询第三方平台配置列表 + * + * @param thirdPartySettingInfo 第三方平台配置 + * @return 第三方平台配置集合 + */ + public List selectThirdPartySettingInfoList(ThirdPartySettingInfo thirdPartySettingInfo); + + /** + * 新增第三方平台配置 + * + * @param thirdPartySettingInfo 第三方平台配置 + * @return 结果 + */ + public int insertThirdPartySettingInfo(ThirdPartySettingInfo thirdPartySettingInfo); + + /** + * 修改第三方平台配置 + * + * @param thirdPartySettingInfo 第三方平台配置 + * @return 结果 + */ + public int updateThirdPartySettingInfo(ThirdPartySettingInfo thirdPartySettingInfo); + + /** + * 批量删除第三方平台配置 + * + * @param ids 需要删除的第三方平台配置主键集合 + * @return 结果 + */ + public int deleteThirdPartySettingInfoByIds(Long[] ids); + + /** + * 删除第三方平台配置信息 + * + * @param id 第三方平台配置主键 + * @return 结果 + */ + public int deleteThirdPartySettingInfoById(Long id); +} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartySettingInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartySettingInfoServiceImpl.java new file mode 100644 index 000000000..8250b9dcc --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartySettingInfoServiceImpl.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.ThirdPartySettingInfoMapper; +import com.jsowell.pile.domain.ThirdPartySettingInfo; +import com.jsowell.pile.service.IThirdPartySettingInfoService; + +/** + * 第三方平台配置Service业务层处理 + * + * @author jsowell + * @date 2023-05-24 + */ +@Service +public class ThirdPartySettingInfoServiceImpl implements IThirdPartySettingInfoService +{ + @Autowired + private ThirdPartySettingInfoMapper thirdPartySettingInfoMapper; + + /** + * 查询第三方平台配置 + * + * @param id 第三方平台配置主键 + * @return 第三方平台配置 + */ + @Override + public ThirdPartySettingInfo selectThirdPartySettingInfoById(Long id) + { + return thirdPartySettingInfoMapper.selectThirdPartySettingInfoById(id); + } + + /** + * 查询第三方平台配置列表 + * + * @param thirdPartySettingInfo 第三方平台配置 + * @return 第三方平台配置 + */ + @Override + public List selectThirdPartySettingInfoList(ThirdPartySettingInfo thirdPartySettingInfo) + { + return thirdPartySettingInfoMapper.selectThirdPartySettingInfoList(thirdPartySettingInfo); + } + + /** + * 新增第三方平台配置 + * + * @param thirdPartySettingInfo 第三方平台配置 + * @return 结果 + */ + @Override + public int insertThirdPartySettingInfo(ThirdPartySettingInfo thirdPartySettingInfo) + { + thirdPartySettingInfo.setCreateTime(DateUtils.getNowDate()); + return thirdPartySettingInfoMapper.insertThirdPartySettingInfo(thirdPartySettingInfo); + } + + /** + * 修改第三方平台配置 + * + * @param thirdPartySettingInfo 第三方平台配置 + * @return 结果 + */ + @Override + public int updateThirdPartySettingInfo(ThirdPartySettingInfo thirdPartySettingInfo) + { + thirdPartySettingInfo.setUpdateTime(DateUtils.getNowDate()); + return thirdPartySettingInfoMapper.updateThirdPartySettingInfo(thirdPartySettingInfo); + } + + /** + * 批量删除第三方平台配置 + * + * @param ids 需要删除的第三方平台配置主键 + * @return 结果 + */ + @Override + public int deleteThirdPartySettingInfoByIds(Long[] ids) + { + return thirdPartySettingInfoMapper.deleteThirdPartySettingInfoByIds(ids); + } + + /** + * 删除第三方平台配置信息 + * + * @param id 第三方平台配置主键 + * @return 结果 + */ + @Override + public int deleteThirdPartySettingInfoById(Long id) + { + return thirdPartySettingInfoMapper.deleteThirdPartySettingInfoById(id); + } +} diff --git a/jsowell-pile/src/main/resources/mapper/pile/ThirdPartySettingInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/ThirdPartySettingInfoMapper.xml new file mode 100644 index 000000000..d9dcf819f --- /dev/null +++ b/jsowell-pile/src/main/resources/mapper/pile/ThirdPartySettingInfoMapper.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + select id, type, 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 + + + + + + + + insert into thirdparty_setting_info + + type, + station_id, + operator_id, + operator_secret, + sign_secret, + data_secret, + data_secret_IV, + create_time, + create_by, + update_time, + update_by, + del_flag, + + + #{type}, + #{stationId}, + #{operatorId}, + #{operatorSecret}, + #{signSecret}, + #{dataSecret}, + #{dataSecretIv}, + #{createTime}, + #{createBy}, + #{updateTime}, + #{updateBy}, + #{delFlag}, + + + + + update thirdparty_setting_info + + type = #{type}, + station_id = #{stationId}, + 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 thirdparty_setting_info where id = #{id} + + + + delete from thirdparty_setting_info where id in + + #{id} + + + \ No newline at end of file From 198ebfeb1a3e0c9c15bd0d677c9cbad0472619d3 Mon Sep 17 00:00:00 2001 From: Lemon Date: Wed, 24 May 2023 15:27:08 +0800 Subject: [PATCH 2/3] update --- .../pile/domain/ThirdPartySettingInfo.java | 133 +++++++++--------- .../mapper/ThirdPartySettingInfoMapper.java | 28 ++-- .../IThirdPartySettingInfoService.java | 26 ++-- .../ThirdPartySettingInfoServiceImpl.java | 47 ++++--- .../pile/ThirdPartySettingInfoMapper.xml | 11 ++ 5 files changed, 143 insertions(+), 102 deletions(-) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/domain/ThirdPartySettingInfo.java b/jsowell-pile/src/main/java/com/jsowell/pile/domain/ThirdPartySettingInfo.java index 5b57eabb3..d5967ca86 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/domain/ThirdPartySettingInfo.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/domain/ThirdPartySettingInfo.java @@ -7,146 +7,153 @@ import org.apache.commons.lang3.builder.ToStringStyle; /** * 第三方平台配置对象 thirdparty_setting_info - * + * * @author jsowell * @date 2023-05-24 */ -public class ThirdPartySettingInfo extends BaseEntity -{ +public class ThirdPartySettingInfo extends BaseEntity { private static final long serialVersionUID = 1L; - /** 主键 */ + /** + * 主键 + */ private Long id; - /** 对接类型(1-联联平台) */ + /** + * 对接类型(1-联联平台) + */ @Excel(name = "对接类型", readConverterExp = "1=-联联平台") private String type; - /** 站点id */ + /** + * 站点id + */ @Excel(name = "站点id") - private String stationId; + private Long stationId; - /** 运营商id */ + /** + * 运营商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(Long id) - { + public void setId(Long id) { this.id = id; } - public Long getId() - { + public Long getId() { return id; } - public void setType(String type) - { + + public void setType(String type) { this.type = type; } - public String getType() - { + public String getType() { return type; } - public void setStationId(String stationId) - { + + public void setStationId(Long stationId) { this.stationId = stationId; } - public String getStationId() - { + public Long getStationId() { return stationId; } - public void setOperatorId(String operatorId) - { + + public void setOperatorId(String operatorId) { this.operatorId = operatorId; } - public String getOperatorId() - { + public String getOperatorId() { return operatorId; } - public void setOperatorSecret(String operatorSecret) - { + + public void setOperatorSecret(String operatorSecret) { this.operatorSecret = operatorSecret; } - public String getOperatorSecret() - { + public String getOperatorSecret() { return operatorSecret; } - public void setSignSecret(String signSecret) - { + + public void setSignSecret(String signSecret) { this.signSecret = signSecret; } - public String getSignSecret() - { + public String getSignSecret() { return signSecret; } - public void setDataSecret(String dataSecret) - { + + public void setDataSecret(String dataSecret) { this.dataSecret = dataSecret; } - public String getDataSecret() - { + public String getDataSecret() { return dataSecret; } - public void setDataSecretIv(String dataSecretIv) - { + + public void setDataSecretIv(String dataSecretIv) { this.dataSecretIv = dataSecretIv; } - public String getDataSecretIv() - { + public String getDataSecretIv() { return dataSecretIv; } - public void setDelFlag(String delFlag) - { + + public void setDelFlag(String delFlag) { this.delFlag = delFlag; } - public String getDelFlag() - { + public String getDelFlag() { return delFlag; } @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.JSON_STYLE) - .append("id", getId()) - .append("type", getType()) - .append("stationId", getStationId()) - .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(); + .append("id", getId()) + .append("type", getType()) + .append("stationId", getStationId()) + .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/ThirdPartySettingInfoMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/ThirdPartySettingInfoMapper.java index 46f3e026a..4d0d9e6fa 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/ThirdPartySettingInfoMapper.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/ThirdPartySettingInfoMapper.java @@ -1,19 +1,21 @@ package com.jsowell.pile.mapper; import java.util.List; + import com.jsowell.pile.domain.ThirdPartySettingInfo; +import org.springframework.stereotype.Component; /** * 第三方平台配置Mapper接口 - * + * * @author jsowell * @date 2023-05-24 */ -public interface ThirdPartySettingInfoMapper -{ +@Component +public interface ThirdPartySettingInfoMapper { /** * 查询第三方平台配置 - * + * * @param id 第三方平台配置主键 * @return 第三方平台配置 */ @@ -21,7 +23,7 @@ public interface ThirdPartySettingInfoMapper /** * 查询第三方平台配置列表 - * + * * @param thirdPartySettingInfo 第三方平台配置 * @return 第三方平台配置集合 */ @@ -29,7 +31,7 @@ public interface ThirdPartySettingInfoMapper /** * 新增第三方平台配置 - * + * * @param thirdPartySettingInfo 第三方平台配置 * @return 结果 */ @@ -37,7 +39,7 @@ public interface ThirdPartySettingInfoMapper /** * 修改第三方平台配置 - * + * * @param thirdPartySettingInfo 第三方平台配置 * @return 结果 */ @@ -45,7 +47,7 @@ public interface ThirdPartySettingInfoMapper /** * 删除第三方平台配置 - * + * * @param id 第三方平台配置主键 * @return 结果 */ @@ -53,9 +55,17 @@ public interface ThirdPartySettingInfoMapper /** * 批量删除第三方平台配置 - * + * * @param ids 需要删除的数据主键集合 * @return 结果 */ public int deleteThirdPartySettingInfoByIds(Long[] ids); + + /** + * 根据站点id 查询配置列表 + * + * @param stationId + * @return + */ + public ThirdPartySettingInfo getInfoByStationId(Long stationId); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/IThirdPartySettingInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/IThirdPartySettingInfoService.java index 94302bc29..29cab6909 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/IThirdPartySettingInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/IThirdPartySettingInfoService.java @@ -1,19 +1,19 @@ package com.jsowell.pile.service; import java.util.List; + import com.jsowell.pile.domain.ThirdPartySettingInfo; /** * 第三方平台配置Service接口 - * + * * @author jsowell * @date 2023-05-24 */ -public interface IThirdPartySettingInfoService -{ +public interface IThirdPartySettingInfoService { /** * 查询第三方平台配置 - * + * * @param id 第三方平台配置主键 * @return 第三方平台配置 */ @@ -21,7 +21,7 @@ public interface IThirdPartySettingInfoService /** * 查询第三方平台配置列表 - * + * * @param thirdPartySettingInfo 第三方平台配置 * @return 第三方平台配置集合 */ @@ -29,7 +29,7 @@ public interface IThirdPartySettingInfoService /** * 新增第三方平台配置 - * + * * @param thirdPartySettingInfo 第三方平台配置 * @return 结果 */ @@ -37,7 +37,7 @@ public interface IThirdPartySettingInfoService /** * 修改第三方平台配置 - * + * * @param thirdPartySettingInfo 第三方平台配置 * @return 结果 */ @@ -45,7 +45,7 @@ public interface IThirdPartySettingInfoService /** * 批量删除第三方平台配置 - * + * * @param ids 需要删除的第三方平台配置主键集合 * @return 结果 */ @@ -53,9 +53,17 @@ public interface IThirdPartySettingInfoService /** * 删除第三方平台配置信息 - * + * * @param id 第三方平台配置主键 * @return 结果 */ public int deleteThirdPartySettingInfoById(Long id); + + /** + * 根据站点id 查询配置列表 + * + * @param stationId + * @return + */ + public ThirdPartySettingInfo getInfoByStationId(Long stationId); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartySettingInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartySettingInfoServiceImpl.java index 8250b9dcc..6696fd573 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartySettingInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartySettingInfoServiceImpl.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.IThirdPartySettingInfoService; /** * 第三方平台配置Service业务层处理 - * + * * @author jsowell * @date 2023-05-24 */ @Service -public class ThirdPartySettingInfoServiceImpl implements IThirdPartySettingInfoService -{ +public class ThirdPartySettingInfoServiceImpl implements IThirdPartySettingInfoService { @Autowired private ThirdPartySettingInfoMapper thirdPartySettingInfoMapper; /** * 查询第三方平台配置 - * + * * @param id 第三方平台配置主键 * @return 第三方平台配置 */ @Override - public ThirdPartySettingInfo selectThirdPartySettingInfoById(Long id) - { + public ThirdPartySettingInfo selectThirdPartySettingInfoById(Long id) { return thirdPartySettingInfoMapper.selectThirdPartySettingInfoById(id); } /** * 查询第三方平台配置列表 - * + * * @param thirdPartySettingInfo 第三方平台配置 * @return 第三方平台配置 */ @Override - public List selectThirdPartySettingInfoList(ThirdPartySettingInfo thirdPartySettingInfo) - { + public List selectThirdPartySettingInfoList(ThirdPartySettingInfo thirdPartySettingInfo) { return thirdPartySettingInfoMapper.selectThirdPartySettingInfoList(thirdPartySettingInfo); } /** * 新增第三方平台配置 - * + * * @param thirdPartySettingInfo 第三方平台配置 * @return 结果 */ @Override - public int insertThirdPartySettingInfo(ThirdPartySettingInfo thirdPartySettingInfo) - { + public int insertThirdPartySettingInfo(ThirdPartySettingInfo thirdPartySettingInfo) { thirdPartySettingInfo.setCreateTime(DateUtils.getNowDate()); return thirdPartySettingInfoMapper.insertThirdPartySettingInfo(thirdPartySettingInfo); } /** * 修改第三方平台配置 - * + * * @param thirdPartySettingInfo 第三方平台配置 * @return 结果 */ @Override - public int updateThirdPartySettingInfo(ThirdPartySettingInfo thirdPartySettingInfo) - { + public int updateThirdPartySettingInfo(ThirdPartySettingInfo thirdPartySettingInfo) { thirdPartySettingInfo.setUpdateTime(DateUtils.getNowDate()); return thirdPartySettingInfoMapper.updateThirdPartySettingInfo(thirdPartySettingInfo); } /** * 批量删除第三方平台配置 - * + * * @param ids 需要删除的第三方平台配置主键 * @return 结果 */ @Override - public int deleteThirdPartySettingInfoByIds(Long[] ids) - { + public int deleteThirdPartySettingInfoByIds(Long[] ids) { return thirdPartySettingInfoMapper.deleteThirdPartySettingInfoByIds(ids); } /** * 删除第三方平台配置信息 - * + * * @param id 第三方平台配置主键 * @return 结果 */ @Override - public int deleteThirdPartySettingInfoById(Long id) - { + public int deleteThirdPartySettingInfoById(Long id) { return thirdPartySettingInfoMapper.deleteThirdPartySettingInfoById(id); } + + /** + * 根据站点id 查询配置列表 + * + * @param stationId + * @return + */ + @Override + public ThirdPartySettingInfo getInfoByStationId(Long stationId) { + return thirdPartySettingInfoMapper.getInfoByStationId(stationId); + } } diff --git a/jsowell-pile/src/main/resources/mapper/pile/ThirdPartySettingInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/ThirdPartySettingInfoMapper.xml index d9dcf819f..724e84742 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/ThirdPartySettingInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/ThirdPartySettingInfoMapper.xml @@ -24,6 +24,11 @@ select id, type, 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 + + + id, type, station_id, operator_id, operator_secret, sign_secret, data_secret, data_secret_IV, create_time, create_by, update_time, update_by, del_flag + + + select + from thirdparty_setting_info + where station_id = #{stationId,jdbcType=BIGINT} + \ No newline at end of file From 477c902f3806034eba01563b9e3a238d70aac4bf Mon Sep 17 00:00:00 2001 From: Lemon Date: Wed, 24 May 2023 15:42:27 +0800 Subject: [PATCH 3/3] =?UTF-8?q?update=20=20=E8=81=94=E8=81=94=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E7=9B=B8=E5=85=B3=E9=85=8D=E7=BD=AE=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E4=BB=8E=E6=95=B0=E6=8D=AE=E5=BA=93=E8=B0=83=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/LianLianServiceImpl.java | 166 +++++++++++++++--- 1 file changed, 139 insertions(+), 27 deletions(-) diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/service/impl/LianLianServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/service/impl/LianLianServiceImpl.java index 8e922c1d7..6082e36ac 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/service/impl/LianLianServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/service/impl/LianLianServiceImpl.java @@ -28,6 +28,7 @@ import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO; import com.jsowell.pile.vo.uniapp.BillingPriceVO; import com.jsowell.pile.vo.web.PileConnectorInfoVO; import com.jsowell.pile.vo.web.PileModelInfoVO; +import com.jsowell.pile.vo.web.PileStationVO; import com.jsowell.thirdparty.domain.*; import com.jsowell.thirdparty.service.LianLianService; import com.jsowell.thirdparty.vo.*; @@ -42,11 +43,11 @@ import java.util.stream.Collectors; @Service public class LianLianServiceImpl implements LianLianService { private static final String TEST_URL = "http://dataexchange.evchargeonline.com:81/shevcs/v1/"; // http://testdataexchange.evchargeonline.com:82/shevcs/v1/ - private static final String OPERATOR_ID = "MA1JLFUU8"; // MA1JLFUU8 987654321 - private static final String OPERATOR_SECRET = "fGwLsxW1HdzLw7jp"; // fGwLsxW1HdzLw7jp 1234567890abcdef - private static final String SIG_SECRET = "TmsdVaFVTtjzZbLi"; // 签名秘钥 TmsdVaFVTtjzZbLi 1234567890abcdef - private static final String DATA_SECRET = "R1Hdq80mSWswwCzt"; // 消息密钥 R1Hdq80mSWswwCzt 1234567890abcdef - private static final String DATA_SECRETIV = "LVpz3qHD8sM2PYjl"; // 消息密钥初始化向量 LVpz3qHD8sM2PYjl 1234567890abcdef + // private static final String OPERATOR_ID = "MA1JLFUU8"; // MA1JLFUU8 987654321 + // private static final String OPERATOR_SECRET = "fGwLsxW1HdzLw7jp"; // fGwLsxW1HdzLw7jp 1234567890abcdef + // private static final String SIG_SECRET = "TmsdVaFVTtjzZbLi"; // 签名秘钥 TmsdVaFVTtjzZbLi 1234567890abcdef + // private static final String DATA_SECRET = "R1Hdq80mSWswwCzt"; // 消息密钥 R1Hdq80mSWswwCzt 1234567890abcdef + // private static final String DATA_SECRETIV = "LVpz3qHD8sM2PYjl"; // 消息密钥初始化向量 LVpz3qHD8sM2PYjl 1234567890abcdef @Autowired private IPileMerchantInfoService pileMerchantInfoService; @@ -72,6 +73,9 @@ public class LianLianServiceImpl implements LianLianService { @Autowired private IPileBillingTemplateService pileBillingTemplateService; + @Autowired + private IThirdPartySettingInfoService thirdPartySettingInfoService; + @Override public void pushMerchantInfo(Long merchantId) { // 通过id查询运营商信息 @@ -101,10 +105,21 @@ public class LianLianServiceImpl implements LianLianService { // 通过id查询站点相关信息 PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(dto.getStationId()); + // 通过站点id查询相关配置信息 + ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(dto.getStationId()); + if (settingInfo == null) { + return; + } + String operatorId = settingInfo.getOperatorId(); + String operatorSecret = settingInfo.getOperatorSecret(); + String signSecret = settingInfo.getSignSecret(); + String dataSecret = settingInfo.getDataSecret(); + String dataSecretIv = settingInfo.getDataSecretIv(); + // 组装联联平台所需要的数据格式 StationInfo info = StationInfo.builder() .stationID(String.valueOf(dto.getStationId())) - .operatorID(dto.getOperatorID()) + .operatorID(operatorId) .equipmentOwnerID(Constants.OPERATORID_LIANLIAN) .stationName(pileStationInfo.getStationName()) .isAloneApply(Integer.valueOf(pileStationInfo.getAloneApply())) @@ -157,9 +172,9 @@ public class LianLianServiceImpl implements LianLianService { System.out.println("jsonString : " + jsonString); // 获取令牌 - String token = getToken(dto.getOperatorID(), OPERATOR_SECRET); - String result = HttpRequestUtil.sendPost(token, jsonString, url, dto.getDataSecret() - , dto.getDataSecretIV(), dto.getOperatorID(), dto.getSigSecret()); + String token = getToken(operatorId, operatorSecret); + String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret + , dataSecretIv, operatorId, signSecret); System.out.println(result); @@ -632,10 +647,24 @@ public class LianLianServiceImpl implements LianLianService { */ @Override public String pushConnectorStatus(String pileConnectorCode, String status) { + // 查出该桩所属哪个站点 + String pileSn = StringUtils.substring(pileConnectorCode, 0, 16); + PileStationVO stationVO = pileStationInfoService.getStationInfoByPileSn(pileSn); + // 通过站点id查询相关配置信息 + ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(stationVO.getId())); + if (settingInfo == null) { + return null; + } + String operatorId = settingInfo.getOperatorId(); + String operatorSecret = settingInfo.getOperatorSecret(); + String signSecret = settingInfo.getSignSecret(); + String dataSecret = settingInfo.getDataSecret(); + String dataSecretIv = settingInfo.getDataSecretIv(); + String url = TEST_URL + "notification_stationStatus"; // 获取令牌 - String token = getToken(OPERATOR_ID, OPERATOR_SECRET); + String token = getToken(operatorId, operatorSecret); if (StringUtils.isBlank(token)) { return null; } @@ -648,7 +677,7 @@ public class LianLianServiceImpl implements LianLianService { json.put("ConnectorStatusInfo", info); String jsonString = JSONObject.toJSONString(json); - String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET); + String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); return result; } @@ -665,12 +694,23 @@ public class LianLianServiceImpl implements LianLianService { OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode); OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode); + // 通过站点id查询相关配置信息 + ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderBasicInfo.getStationId())); + if (settingInfo == null) { + return null; + } + String operatorId = settingInfo.getOperatorId(); + String operatorSecret = settingInfo.getOperatorSecret(); + String signSecret = settingInfo.getSignSecret(); + String dataSecret = settingInfo.getDataSecret(); + String dataSecretIv = settingInfo.getDataSecretIv(); + String url = TEST_URL + "notification_orderInfo"; // 拼装成联联平台所需格式对象 OrderInfo orderInfo = OrderInfo.builder() - .operatorID(OPERATOR_ID) - .equipmentOwnerID(OPERATOR_ID) + .operatorID(operatorId) + .equipmentOwnerID(Constants.OPERATORID_LIANLIAN) .stationID(orderBasicInfo.getStationId()) .equipmentID(orderBasicInfo.getPileSn()) .connectorID(orderBasicInfo.getPileConnectorCode()) @@ -750,7 +790,7 @@ public class LianLianServiceImpl implements LianLianService { orderInfo.setChargeDetails(chargeDetails); // 获取令牌 - String token = getToken(OPERATOR_ID, OPERATOR_SECRET); + String token = getToken(operatorId, operatorSecret); if (StringUtils.isBlank(token)) { return null; } @@ -759,7 +799,7 @@ public class LianLianServiceImpl implements LianLianService { json.put("OrderInfo", orderInfo); String jsonString = JSONObject.toJSONString(json); - String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET); + String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); return result; } @@ -776,10 +816,21 @@ public class LianLianServiceImpl implements LianLianService { if (orderInfo == null) { return null; } + // 通过站点id查询相关配置信息 + ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderInfo.getStationId())); + if (settingInfo == null) { + return null; + } + String operatorId = settingInfo.getOperatorId(); + String operatorSecret = settingInfo.getOperatorSecret(); + String signSecret = settingInfo.getSignSecret(); + String dataSecret = settingInfo.getDataSecret(); + String dataSecretIv = settingInfo.getDataSecretIv(); + // 推送启动充电结果(调用接口 notification_start_charge_result) String url = TEST_URL + "notification_start_charge_result"; // 获取令牌 - String token = getToken(OPERATOR_ID, OPERATOR_SECRET); + String token = getToken(operatorId, operatorSecret); if (StringUtils.isBlank(token)) { return null; } @@ -804,7 +855,7 @@ public class LianLianServiceImpl implements LianLianService { String jsonString = JSONObject.toJSONString(json); - String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET); + String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); return result; } @@ -816,10 +867,23 @@ public class LianLianServiceImpl implements LianLianService { */ @Override public String pushChargeStatus(String orderCode) { + // 根据订单号查询订单信息 + OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode); + // 通过站点id查询相关配置信息 + ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderInfo.getStationId())); + if (settingInfo == null) { + return null; + } + String operatorId = settingInfo.getOperatorId(); + String operatorSecret = settingInfo.getOperatorSecret(); + String signSecret = settingInfo.getSignSecret(); + String dataSecret = settingInfo.getDataSecret(); + String dataSecretIv = settingInfo.getDataSecretIv(); + // 调用 查询充电状态方法 QueryChargingStatusVO vo = query_equip_charge_status(orderCode); // 获取令牌 - String token = getToken(OPERATOR_ID, OPERATOR_SECRET); + String token = getToken(operatorId, operatorSecret); if (StringUtils.isBlank(token)) { return null; } @@ -827,7 +891,7 @@ public class LianLianServiceImpl implements LianLianService { // 调用联联平台接口 String jsonString = JSONObject.toJSONString(vo); - String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET); + String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); return result; } @@ -845,6 +909,17 @@ public class LianLianServiceImpl implements LianLianService { if (orderInfo == null) { return null; } + // 通过站点id查询相关配置信息 + ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderInfo.getStationId())); + if (settingInfo == null) { + return null; + } + String operatorId = settingInfo.getOperatorId(); + String operatorSecret = settingInfo.getOperatorSecret(); + String signSecret = settingInfo.getSignSecret(); + String dataSecret = settingInfo.getDataSecret(); + String dataSecretIv = settingInfo.getDataSecretIv(); + String orderStatus = orderInfo.getOrderStatus(); String successFlag = "1"; if (StringUtils.equals(orderStatus, OrderStatusEnum.IN_THE_CHARGING.getValue())) { @@ -858,7 +933,7 @@ public class LianLianServiceImpl implements LianLianService { orderStatus = "5"; } // 获取token - String token = getToken(OPERATOR_ID, OPERATOR_SECRET); + String token = getToken(operatorId, operatorSecret); if (StringUtils.isBlank(token)) { return null; } @@ -874,7 +949,7 @@ public class LianLianServiceImpl implements LianLianService { String jsonString = JSONObject.toJSONString(json); // 发送请求 - String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET); + String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); return result; } @@ -890,6 +965,17 @@ public class LianLianServiceImpl implements LianLianService { OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode); OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode); + // 通过站点id查询相关配置信息 + ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderBasicInfo.getStationId())); + if (settingInfo == null) { + return null; + } + String operatorId = settingInfo.getOperatorId(); + String operatorSecret = settingInfo.getOperatorSecret(); + String signSecret = settingInfo.getSignSecret(); + String dataSecret = settingInfo.getDataSecret(); + String dataSecretIv = settingInfo.getDataSecretIv(); + JSONObject json = new JSONObject(); json.put("StartChargeSeq", orderCode); json.put("ConnectorID", orderBasicInfo.getPileConnectorCode()); @@ -902,12 +988,12 @@ public class LianLianServiceImpl implements LianLianService { json.put("StopReason", 2); // 2:BMS 停止充电 String jsonString = JSONObject.toJSONString(json); - String token = getToken(OPERATOR_ID, OPERATOR_SECRET); + String token = getToken(operatorId, operatorSecret); if (token == null) { return null; } // 发送请求 - String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET); + String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); return result; } @@ -954,13 +1040,27 @@ public class LianLianServiceImpl implements LianLianService { JSONObject json = new JSONObject(); json.put("StartChargeSeq", orderCode); String jsonString = JSONObject.toJSONString(json); + + OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode); + + // 通过站点id查询相关配置信息 + ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderBasicInfo.getStationId())); + if (settingInfo == null) { + return null; + } + String operatorId = settingInfo.getOperatorId(); + String operatorSecret = settingInfo.getOperatorSecret(); + String signSecret = settingInfo.getSignSecret(); + String dataSecret = settingInfo.getDataSecret(); + String dataSecretIv = settingInfo.getDataSecretIv(); + // 获取令牌 - String token = getToken(OPERATOR_ID, OPERATOR_SECRET); + String token = getToken(operatorId, operatorSecret); if (StringUtils.isBlank(token)){ return null; } // 发送请求 - String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET); + String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); return result; } @@ -980,6 +1080,18 @@ public class LianLianServiceImpl implements LianLianService { if (orderInfo == null || orderDetail == null) { return null; } + + // 通过站点id查询相关配置信息 + ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderInfo.getStationId())); + if (settingInfo == null) { + return null; + } + String operatorId = settingInfo.getOperatorId(); + String operatorSecret = settingInfo.getOperatorSecret(); + String signSecret = settingInfo.getSignSecret(); + String dataSecret = settingInfo.getDataSecret(); + String dataSecretIv = settingInfo.getDataSecretIv(); + JSONObject json = new JSONObject(); json.put("CheckOrderSeq", orderCode); json.put("StartTime", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderInfo.getChargeStartTime())); @@ -997,13 +1109,13 @@ public class LianLianServiceImpl implements LianLianService { json.put("ChargeOrders", list); // 获取令牌 - String token = getToken(OPERATOR_ID, OPERATOR_SECRET); + String token = getToken(operatorId, operatorSecret); if (StringUtils.isBlank(token)){ return null; } String jsonString = JSONObject.toJSONString(json); // 发送请求 - String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET); + String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); return result; }