完成token配置管理;向terminal(终端)添加operator_id;
This commit is contained in:
parent
e226265865
commit
57ec8bae00
@ -21,6 +21,8 @@
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="rateModelId" column="rate_model_id"/>
|
||||
<result property="operatorId" column="operator_id"/>
|
||||
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectXhpcTerminalVo">
|
||||
|
||||
@ -45,6 +45,16 @@ public class XhpcTerminal extends BaseEntity {
|
||||
/** 费率模型id */
|
||||
private Long rateModelId;
|
||||
|
||||
private Long operatorId;
|
||||
|
||||
public Long getOperatorId() {
|
||||
return operatorId;
|
||||
}
|
||||
|
||||
public void setOperatorId(Long operatorId) {
|
||||
this.operatorId = operatorId;
|
||||
}
|
||||
|
||||
public static long getSerialVersionUID() {
|
||||
|
||||
return serialVersionUID;
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
package com.xhpc.general.controller;
|
||||
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.general.domain.EtTokenEntity;
|
||||
import com.xhpc.general.service.IXhpcEtTokenService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* program: ruoyi
|
||||
* User: HongYun
|
||||
* Date:2021-09-10 14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(value = "/token")
|
||||
public class XhpcEtTokenController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private IXhpcEtTokenService iXhpcEtTokenService;
|
||||
|
||||
@GetMapping(value = "/list")
|
||||
public TableDataInfo list(String operatorId, String operatorId3irdpty){
|
||||
|
||||
startPage();
|
||||
return getDataTable(iXhpcEtTokenService.list(operatorId, operatorId3irdpty));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/delete")
|
||||
public AjaxResult delete(@RequestBody EtTokenEntity etTokenEntity){
|
||||
|
||||
return iXhpcEtTokenService.delete(etTokenEntity.getId());
|
||||
}
|
||||
|
||||
@PostMapping(value = "/add")
|
||||
public AjaxResult add(@RequestBody EtTokenEntity etTokenEntity){
|
||||
|
||||
return iXhpcEtTokenService.add(etTokenEntity.getOperatorId(),etTokenEntity.getOperatorId3irdpty(),
|
||||
etTokenEntity.getSecretTokenType(),etTokenEntity.getDataSecret(),
|
||||
etTokenEntity.getDataSecretiv(),etTokenEntity.getOperatorSecret(),etTokenEntity.getSigSecret(),
|
||||
etTokenEntity.getEncrypt(),etTokenEntity.getUrlPrefix());
|
||||
}
|
||||
}
|
||||
@ -5,8 +5,6 @@ import com.xhpc.general.service.IXhpcServiceDataUpdateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static com.xhpc.general.service.XhpcSmsServiceImpl.REDIS;
|
||||
|
||||
/**
|
||||
* program: ruoyi
|
||||
* User: HongYun
|
||||
|
||||
@ -0,0 +1,119 @@
|
||||
package com.xhpc.general.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* program: ruoyi
|
||||
* User: HongYun
|
||||
* Date:2021-09-10 14
|
||||
*/
|
||||
public class EtTokenEntity {
|
||||
private Integer id;
|
||||
private String operatorId;
|
||||
private String operatorId3irdpty;
|
||||
private String secretTokenType;
|
||||
private String token;
|
||||
private Date tokenExpiry;
|
||||
private String dataSecret;
|
||||
private String dataSecretiv;
|
||||
private String operatorSecret;
|
||||
private String sigSecret;
|
||||
private Boolean encrypt;
|
||||
private String urlPrefix;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getOperatorId() {
|
||||
return operatorId;
|
||||
}
|
||||
|
||||
public void setOperatorId(String operatorId) {
|
||||
this.operatorId = operatorId;
|
||||
}
|
||||
|
||||
public String getOperatorId3irdpty() {
|
||||
return operatorId3irdpty;
|
||||
}
|
||||
|
||||
public void setOperatorId3irdpty(String operatorId3irdpty) {
|
||||
this.operatorId3irdpty = operatorId3irdpty;
|
||||
}
|
||||
|
||||
public String getSecretTokenType() {
|
||||
return secretTokenType;
|
||||
}
|
||||
|
||||
public void setSecretTokenType(String secretTokenType) {
|
||||
this.secretTokenType = secretTokenType;
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public Date getTokenExpiry() {
|
||||
return tokenExpiry;
|
||||
}
|
||||
|
||||
public void setTokenExpiry(Date tokenExpiry) {
|
||||
this.tokenExpiry = tokenExpiry;
|
||||
}
|
||||
|
||||
public String getDataSecret() {
|
||||
return dataSecret;
|
||||
}
|
||||
|
||||
public void setDataSecret(String dataSecret) {
|
||||
this.dataSecret = dataSecret;
|
||||
}
|
||||
|
||||
public String getDataSecretiv() {
|
||||
return dataSecretiv;
|
||||
}
|
||||
|
||||
public void setDataSecretiv(String dataSecretiv) {
|
||||
this.dataSecretiv = dataSecretiv;
|
||||
}
|
||||
|
||||
public String getOperatorSecret() {
|
||||
return operatorSecret;
|
||||
}
|
||||
|
||||
public void setOperatorSecret(String operatorSecret) {
|
||||
this.operatorSecret = operatorSecret;
|
||||
}
|
||||
|
||||
public String getSigSecret() {
|
||||
return sigSecret;
|
||||
}
|
||||
|
||||
public void setSigSecret(String sigSecret) {
|
||||
this.sigSecret = sigSecret;
|
||||
}
|
||||
|
||||
public Boolean getEncrypt() {
|
||||
return encrypt;
|
||||
}
|
||||
|
||||
public void setEncrypt(Boolean encrypt) {
|
||||
this.encrypt = encrypt;
|
||||
}
|
||||
|
||||
public String getUrlPrefix() {
|
||||
return urlPrefix;
|
||||
}
|
||||
|
||||
public void setUrlPrefix(String urlPrefix) {
|
||||
this.urlPrefix = urlPrefix;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.xhpc.general.mapper;
|
||||
|
||||
import com.xhpc.general.domain.EtTokenEntity;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* program: ruoyi
|
||||
* User: HongYun
|
||||
* Date:2021-09-10 14
|
||||
*/
|
||||
public interface XhpcEtTokenMapper {
|
||||
|
||||
|
||||
List<EtTokenEntity> selectBy(@Param(value = "operatorId") String operatorId,@Param(value = "operatorId3irdpty") String operatorId3irdpty);
|
||||
|
||||
int deleteBy(@Param(value = "id") Integer id);
|
||||
|
||||
int checkExistsBy(@Param(value = "operatorId") String operatorId,@Param(value = "operatorId3irdpty") String operatorId3irdpty,@Param(value = "secretTokenType") String secretTokenType);
|
||||
|
||||
int insertBy(@Param(value = "operatorId") String operatorId,@Param(value = "operatorId3irdpty") String operatorId3irdpty,@Param(value = "secretTokenType") String secretTokenType,
|
||||
@Param(value = "dataSecret") String dataSecret,@Param(value = "dataSecretiv") String dataSecretiv,@Param(value ="operatorSecret" ) String operatorSecret,
|
||||
@Param(value = "sigSecret") String sigSecret,@Param(value = "encrypt") Boolean encrypt,@Param(value = "urlPrefix") String urlPrefix);
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package com.xhpc.general.service;
|
||||
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.general.domain.EtTokenEntity;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* program: ruoyi
|
||||
* User: HongYun
|
||||
* Date:2021-09-10 14
|
||||
*/
|
||||
public interface IXhpcEtTokenService {
|
||||
|
||||
List<EtTokenEntity> list(String operatorId,String operatorId3irdpty);
|
||||
|
||||
AjaxResult delete(Integer id);
|
||||
|
||||
AjaxResult add(String operatorId, String operatorId3irdpty, String secretTokenType,
|
||||
String dataSecret,String dataSecretiv,String operatorSecret,
|
||||
String sigSecret,Boolean encrypt,String urlPrefix);
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
package com.xhpc.general.service;
|
||||
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.general.domain.EtTokenEntity;
|
||||
import com.xhpc.general.mapper.XhpcEtTokenMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* program: ruoyi
|
||||
* User: HongYun
|
||||
* Date:2021-09-10 14
|
||||
*/
|
||||
@Service
|
||||
public class XhpcTeTokenServiceImpl implements IXhpcEtTokenService {
|
||||
|
||||
@Autowired
|
||||
private XhpcEtTokenMapper xhpcEtTokenMapper;
|
||||
|
||||
@Override
|
||||
public List<EtTokenEntity> list(String operatorId, String operatorId3irdpty) {
|
||||
|
||||
return xhpcEtTokenMapper.selectBy(operatorId, operatorId3irdpty);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult delete(Integer id) {
|
||||
|
||||
int result = xhpcEtTokenMapper.deleteBy(id);
|
||||
return result==1? AjaxResult.success() :AjaxResult.error();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult add(String operatorId, String operatorId3irdpty, String secretTokenType,String dataSecret, String dataSecretiv, String operatorSecret, String sigSecret, Boolean encrypt, String urlPrefix) {
|
||||
|
||||
int checkExistsSign = xhpcEtTokenMapper.checkExistsBy(operatorId, operatorId3irdpty, secretTokenType);
|
||||
if(checkExistsSign!=0){
|
||||
return AjaxResult.error("该密钥设置已存在");
|
||||
}else {
|
||||
int result = xhpcEtTokenMapper.insertBy(operatorId, operatorId3irdpty, secretTokenType, dataSecret, dataSecretiv, operatorSecret, sigSecret, encrypt, urlPrefix);
|
||||
return result==1? AjaxResult.success():AjaxResult.error();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
<?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.xhpc.general.mapper.XhpcEtTokenMapper">
|
||||
|
||||
|
||||
<resultMap id="BaseResultToken" type="com.xhpc.general.domain.EtTokenEntity">
|
||||
<result property="id" column="id"/>
|
||||
<result property="operatorId" column="operator_id" jdbcType="VARCHAR" />
|
||||
<result property="operatorId3irdpty" column="operator_id3irdpty" jdbcType="VARCHAR"/>
|
||||
<result property="secretTokenType" column="secret_token_type" jdbcType="VARCHAR"/>
|
||||
<result property="token" column="token"/>
|
||||
<result property="tokenExpiry" column="token_expiry"/>
|
||||
<result property="dataSecret" column="data_secret" jdbcType="VARCHAR"/>
|
||||
<result property="dataSecret" column="data_secretiv" jdbcType="VARCHAR"/>
|
||||
<result property="operatorSecret" column="operator_secret" jdbcType="VARCHAR"/>
|
||||
<result property="sigSecret" column="sig_secret" jdbcType="VARCHAR"/>
|
||||
<result property="encrypt" column="encrypt"/>
|
||||
<result property="urlPrefix" column="url_prefix" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectBy" resultMap="BaseResultToken">
|
||||
|
||||
select * from et_auth_sec_token
|
||||
<where>
|
||||
<if test=" operatorId!= null and operatorId != ''">
|
||||
AND operator_id like concat('%',#{operatorId},'%')
|
||||
</if>
|
||||
<if test="operatorId3irdpty != null and operatorId3irdpty != ''">
|
||||
AND operator_id3irdpty like concat('%',#{operatorId3irdpty},'%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<delete id="deleteBy">
|
||||
|
||||
delete from et_auth_sec_token
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="checkExistsBy" resultType="java.lang.Integer">
|
||||
|
||||
select count(id) from et_auth_sec_token
|
||||
where operator_id = #{operatorId}
|
||||
and operator_id3irdpty = #{operatorId3irdpty}
|
||||
and secret_token_type = #{secretTokenType}
|
||||
</select>
|
||||
|
||||
<insert id="insertBy">
|
||||
|
||||
insert into et_auth_sec_token
|
||||
(operator_id,operator_id3irdpty,secret_token_type,data_secret,data_secretiv,operator_secret,sig_secret,encrypt,url_prefix)
|
||||
values (#{operatorId},#{operatorId3irdpty},#{secretTokenType},
|
||||
#{dataSecret},#{dataSecretiv},#{operatorSecret},#{sigSecret},#{encrypt},#{urlPrefix})
|
||||
</insert>
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user