提交 | 用户 | 时间
|
c7f709
|
1 |
package com.iailab.module.data.channel.http.service.impl; |
L |
2 |
|
|
3 |
import com.alibaba.fastjson.JSONObject; |
|
4 |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
5 |
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
6 |
import com.iailab.framework.common.pojo.PageResult; |
|
7 |
import com.iailab.module.data.channel.http.dao.HttpTokenDao; |
|
8 |
import com.iailab.module.data.channel.http.entity.HttpTokenEntity; |
|
9 |
import com.iailab.module.data.channel.http.service.HttpTokenService; |
|
10 |
import com.iailab.module.data.channel.http.vo.HttpTokenPageReqVO; |
|
11 |
import com.iailab.module.data.common.utils.HttpsRequest; |
|
12 |
import org.apache.commons.lang3.StringUtils; |
|
13 |
import org.springframework.stereotype.Service; |
|
14 |
|
|
15 |
import javax.annotation.Resource; |
|
16 |
import java.util.Date; |
|
17 |
import java.util.HashMap; |
|
18 |
import java.util.List; |
|
19 |
import java.util.Map; |
|
20 |
|
|
21 |
@Service |
|
22 |
public class HttpTokenServiceImpl extends ServiceImpl<HttpTokenDao, HttpTokenEntity> implements HttpTokenService { |
|
23 |
|
|
24 |
@Resource |
|
25 |
private HttpsRequest httpsRequest; |
|
26 |
|
|
27 |
@Resource |
|
28 |
private HttpTokenDao httpTokenDao; |
|
29 |
|
|
30 |
|
|
31 |
@Override |
|
32 |
public PageResult<HttpTokenEntity> queryPage(HttpTokenPageReqVO reqVO) { |
|
33 |
return httpTokenDao.selectPage(reqVO); |
|
34 |
} |
|
35 |
|
|
36 |
@Override |
|
37 |
public HttpTokenEntity info(String id) { |
|
38 |
return httpTokenDao.selectById(id); |
|
39 |
} |
|
40 |
|
|
41 |
@Override |
|
42 |
public void add(HttpTokenEntity httpTokenEntity) { |
|
43 |
httpTokenDao.insert(httpTokenEntity); |
|
44 |
} |
|
45 |
|
|
46 |
@Override |
|
47 |
public void update(HttpTokenEntity httpTokenEntity) { |
|
48 |
httpTokenDao.updateById(httpTokenEntity); |
|
49 |
} |
|
50 |
|
|
51 |
@Override |
|
52 |
public void delete(String id) { |
|
53 |
httpTokenDao.deleteById(id); |
|
54 |
} |
|
55 |
|
|
56 |
@Override |
|
57 |
public List<HttpTokenEntity> list() { |
|
58 |
return httpTokenDao.selectList(new QueryWrapper<>()); |
|
59 |
} |
|
60 |
|
|
61 |
@Override |
|
62 |
public HttpTokenEntity getByApiId(String apiId) { |
|
63 |
QueryWrapper<HttpTokenEntity> wrapper = new QueryWrapper<>(); |
|
64 |
wrapper.eq(StringUtils.isNotBlank(apiId), "api_id", apiId); |
|
65 |
return httpTokenDao.selectOne(wrapper); |
|
66 |
} |
|
67 |
|
|
68 |
@Override |
|
69 |
public String queryToken(String clientId) { |
|
70 |
return httpTokenDao.selectOne(new QueryWrapper<HttpTokenEntity>().eq("client_id", clientId)).getToken(); |
|
71 |
} |
|
72 |
} |