pageWrapper, RescueStationReq pageReq){
148 |
149 | if(!CheckParam.isNull(pageReq.getStationName())){
150 | pageWrapper.like(RescueStation::getStationName,"%"+pageReq.getStationName());
151 | }
152 |
153 | if(!CheckParam.isNull(pageReq.getCapacity())){
154 | pageWrapper.like(RescueStation::getCapacity,"%"+pageReq.getCapacity());
155 | }
156 |
157 | if(!CheckParam.isNull(pageReq.getStationAddress())){
158 | pageWrapper.like(RescueStation::getStationAddress,"%"+pageReq.getStationAddress());
159 | }
160 |
161 | if(!CheckParam.isNull(pageReq.getRescueRegion())){
162 | pageWrapper.like(RescueStation::getRescueRegion,"%"+pageReq.getRescueRegion());
163 | }
164 |
165 | if(!CheckParam.isNull(pageReq.getPhoneNumber())){
166 | pageWrapper.like(RescueStation::getPhoneNumber,"%"+pageReq.getPhoneNumber());
167 | }
168 | }
169 |
170 | }
171 |
--------------------------------------------------------------------------------
/platform-service/src/main/java/cn/common/service/impl/platform/AsyncHandlerServiceImpl.java:
--------------------------------------------------------------------------------
1 | package cn.common.service.impl.platform;
2 |
3 | import cn.common.service.platform.AsyncHandlerService;
4 | import cn.common.service.platform.PlatformBizService;
5 | import cn.common.service.platform.PlatformDictService;
6 | import lombok.extern.slf4j.Slf4j;
7 | import org.springframework.stereotype.Service;
8 | import pro.skywalking.configuration.redis.RedisRepository;
9 | import pro.skywalking.constants.BaseConstant;
10 |
11 | import javax.annotation.Resource;
12 | import javax.servlet.http.HttpServletRequest;
13 |
14 | /**
15 |
16 | * @Description: 异步处理服务方法实现
17 | */
18 | @Service(value = "asyncHandlerService")
19 | @Slf4j
20 | public class AsyncHandlerServiceImpl implements AsyncHandlerService {
21 |
22 | @Resource
23 | private HttpServletRequest request;
24 |
25 | @Resource
26 | private RedisRepository redisRepository;
27 |
28 | @Resource
29 | private PlatformBizService platformBizService;
30 |
31 | @Resource
32 | private BaseConstant baseConstant;
33 |
34 | @Resource
35 | private PlatformDictService platformDictService;
36 |
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/platform-service/src/main/java/cn/common/service/impl/platform/PlatformApiLogServiceImpl.java:
--------------------------------------------------------------------------------
1 | package cn.common.service.impl.platform;
2 |
3 | import cn.common.repository.repository.platform.PlatformApiLogRepository;
4 | import cn.common.service.platform.AuthUserService;
5 | import cn.common.service.platform.PlatformApiLogService;
6 | import cn.common.service.data.ItemCriteriaBuilder;
7 | import lombok.extern.slf4j.Slf4j;
8 | import ma.glasnost.orika.MapperFacade;
9 | import org.springframework.stereotype.Service;
10 |
11 | import javax.annotation.Resource;
12 |
13 | /**
14 |
15 | * @Description: 首页分类相关服务方法实现
16 | */
17 | @Service("platformApiLogService")
18 | @Slf4j
19 | public class PlatformApiLogServiceImpl implements PlatformApiLogService {
20 |
21 | @Resource
22 | private PlatformApiLogRepository platformApiLogRepository;
23 |
24 | @Resource
25 | private MapperFacade mapperFacade;
26 |
27 | @Resource
28 | private AuthUserService authUserService;
29 |
30 | @Resource
31 | private ItemCriteriaBuilder itemCriteriaBuilder;
32 |
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/platform-service/src/main/java/cn/common/service/impl/platform/PlatformBizServiceImpl.java:
--------------------------------------------------------------------------------
1 | package cn.common.service.impl.platform;
2 |
3 | import cn.common.service.platform.PlatformBizService;
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.springframework.stereotype.Service;
6 |
7 | /**
8 | * @author create by singer - Singer email:singer-coder@qq.com
9 | * @projectName animal-app-api
10 | * @Description:
11 | * @date 2022-01-18
12 | */
13 | @Service("platformBizService")
14 | @Slf4j
15 | public class PlatformBizServiceImpl implements PlatformBizService {
16 |
17 |
18 |
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/platform-service/src/main/java/cn/common/service/impl/platform/PlatformDictServiceImpl.java:
--------------------------------------------------------------------------------
1 | package cn.common.service.impl.platform;
2 |
3 | import cn.common.repository.entity.platform.PlatformDict;
4 | import cn.common.repository.repository.platform.PlatformDictRepository;
5 | import cn.common.service.platform.PlatformDictService;
6 | import com.alibaba.fastjson.JSON;
7 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
8 | import lombok.extern.slf4j.Slf4j;
9 | import org.springframework.stereotype.Service;
10 | import org.springframework.util.Assert;
11 | import pro.skywalking.configuration.redis.RedisRepository;
12 | import pro.skywalking.utils.CheckParam;
13 |
14 | import javax.annotation.Resource;
15 | import java.util.concurrent.TimeUnit;
16 |
17 | /**
18 | * @author create by singer - Singer email:singer-coder@qq.com
19 | * @packageName cn.common.service.impl
20 | * @Description: 平台数据字典服务方法实现
21 | * @date 2022-01-28
22 | */
23 | @Service("platformDictService")
24 | @Slf4j
25 | public class PlatformDictServiceImpl implements PlatformDictService {
26 |
27 | @Resource
28 | private PlatformDictRepository platformDictRepository;
29 |
30 | @Resource
31 | private RedisRepository redisRepository;
32 |
33 | /**
34 | * 插入字典数据 写入缓存以及数据库
35 | * @author: create by singer - Singer email:singer-coder@qq.com
36 | * @date 2022/2/9
37 | * @param platformDict 字典内容
38 | * @return cn.common.repository.entity.platform.PlatformDict
39 | */
40 | @Override
41 | public PlatformDict insertDict(PlatformDict platformDict){
42 | String dictType = platformDict.getDictType();
43 | Assert.notNull(dictType, "dictType is null");
44 | String dictKey = platformDict.getDictKey();
45 | Assert.notNull(dictKey, "dictKey is null");
46 | String dictValue = platformDict.getDictValue();
47 | Assert.notNull(dictValue, "dictValue is null");
48 | redisRepository.delete(dictType);
49 | platformDictRepository.insert(platformDict);
50 | redisRepository.set(dictType,JSON.toJSONString(platformDict));
51 | return platformDict;
52 | }
53 |
54 |
55 | /**
56 | * 更新字典 更新缓存里面的数据以及数据库里面的字典数据
57 | * @author: create by singer - Singer email:singer-coder@qq.com
58 | * @date 2022/2/9
59 | * @param platformDict 字典内容
60 | * @return cn.common.repository.entity.platform.PlatformDict
61 | */
62 | @Override
63 | public PlatformDict updateDict(PlatformDict platformDict){
64 | String dictType = platformDict.getDictType();
65 | Assert.notNull(dictType, "dictType is null");
66 | String dictKey = platformDict.getDictKey();
67 | Assert.notNull(dictKey, "dictKey is null");
68 | String dictValue = platformDict.getDictValue();
69 | Assert.notNull(dictValue, "dictValue is null");
70 | redisRepository.delete(dictType);
71 | PlatformDict dict = platformDictRepository.selectOne(new LambdaQueryWrapper()
72 | .eq(PlatformDict::getDictType, dictType));
73 | if(CheckParam.isNull(dict)){
74 | return null;
75 | }
76 | dict.setDictKey(dictKey);
77 | dict.setDictValue(dictValue);
78 | dict.setDictType(dictType);
79 | platformDictRepository.updateById(dict);
80 | redisRepository.set(dictType,JSON.toJSONString(dict));
81 | return dict;
82 | }
83 |
84 | /**
85 | * 从缓存和数据库里面拿到字典的值,拿不到则返回空
86 | * 能拿到则设置缓存
87 | * @author: create by singer - Singer email:singer-coder@qq.com
88 | * @date 2022/2/9
89 | * @param dictType
90 | * @return cn.common.repository.entity.platform.PlatformDict
91 | */
92 | @Override
93 | public PlatformDict getAndSetDict(String dictType){
94 | String cache = redisRepository.get(dictType);
95 | if(!CheckParam.isNull(cache)){
96 | return JSON.parseObject(cache,PlatformDict.class);
97 | }
98 | PlatformDict platformDict = platformDictRepository.selectOne(new LambdaQueryWrapper()
99 | .eq(PlatformDict::getDictType, dictType));
100 | if(CheckParam.isNull(platformDict)){
101 | return null;
102 | }else{
103 | redisRepository.set(dictType,JSON.toJSONString(platformDict),10L, TimeUnit.SECONDS);
104 | return platformDict;
105 | }
106 | }
107 |
108 |
109 |
110 | }
111 |
--------------------------------------------------------------------------------
/platform-service/src/main/java/cn/common/service/impl/platform/PlatformFileServiceImpl.java:
--------------------------------------------------------------------------------
1 | package cn.common.service.impl.platform;
2 |
3 | import cn.common.service.platform.PlatformFileService;
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.springframework.stereotype.Service;
6 | import org.springframework.web.multipart.MultipartFile;
7 | import pro.skywalking.configuration.oss.AliOssService;
8 | import pro.skywalking.configuration.oss.meta.MultipartFileUrlMeta;
9 |
10 | import javax.annotation.Resource;
11 |
12 | /**
13 | * @packageName cn.common.service.impl
14 | * @Description: 平台文件上传相关服务方法实现
15 | */
16 | @Service("platformFileService")
17 | @Slf4j
18 | public class PlatformFileServiceImpl implements PlatformFileService {
19 |
20 | @Resource
21 | private AliOssService aliOssService;
22 |
23 | /**
24 | * 上传文件
25 | * @param file
26 | * @return pro.skywalking.req.platform.upload.MultipartFileUrlResp
27 | */
28 | @Override
29 | public MultipartFileUrlMeta uploadFile(MultipartFile file){
30 | MultipartFileUrlMeta multipartFileUrlMeta = aliOssService.multipartFileToOss(file, false);
31 | return multipartFileUrlMeta;
32 | }
33 |
34 | /**
35 | * 上传文件
36 | * @param file
37 | * @return pro.skywalking.req.platform.upload.MultipartFileUrlResp
38 | */
39 | @Override
40 | public MultipartFileUrlMeta uploadFileMixed(MultipartFile file){
41 | MultipartFileUrlMeta multipartFileUrlMeta = aliOssService.mixFileToOss(file, false);
42 | return multipartFileUrlMeta;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/platform-service/src/main/java/cn/common/service/impl/platform/PlatformServiceImpl.java:
--------------------------------------------------------------------------------
1 | package cn.common.service.impl.platform;
2 |
3 | import cn.common.repository.entity.platform.AuthUser;
4 | import cn.common.repository.entity.platform.PlatformDict;
5 | import cn.common.repository.repository.platform.AuthUserRepository;
6 | import cn.common.repository.repository.platform.PlatformDictRepository;
7 | import cn.common.service.platform.PlatformService;
8 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
9 | import com.google.common.collect.Lists;
10 | import lombok.extern.slf4j.Slf4j;
11 | import ma.glasnost.orika.MapperFacade;
12 | import org.springframework.stereotype.Service;
13 | import pro.skywalking.collection.CollectionUtils;
14 | import pro.skywalking.resp.platform.dict.PlatformDictResp;
15 | import pro.skywalking.resp.platform.other.AuthUserSketchResp;
16 |
17 | import javax.annotation.Resource;
18 | import javax.servlet.http.HttpServletRequest;
19 | import java.util.List;
20 |
21 | /**
22 | * @projectName animal-app-api
23 | * @Description: 平台相关服务方法实现3
24 | */
25 | @Service("platformService")
26 | @Slf4j
27 | public class PlatformServiceImpl implements PlatformService {
28 |
29 | /**
30 | * 注册当前的ServletRequest
31 | */
32 | @Resource
33 | private HttpServletRequest httpServletRequest;
34 |
35 | @Resource
36 | private MapperFacade mapperFacade;
37 |
38 | @Resource
39 | private PlatformDictRepository platformDictRepository;
40 |
41 | @Resource
42 | private AuthUserRepository authUserRepository;
43 |
44 | /**
45 | * 根据字典类型查询字典
46 | * @param dictType 字典类型
47 | * @return java.util.List
48 | */
49 | @Override
50 | public List queryDictByType(String dictType){
51 | List platformDictList = platformDictRepository
52 | .selectList(new LambdaQueryWrapper().eq(PlatformDict::getDictType, dictType));
53 | if(CollectionUtils.isEmpty(platformDictList)){
54 | return Lists.newArrayList();
55 | }
56 | return mapperFacade.mapAsList(platformDictList, PlatformDictResp.class);
57 | }
58 |
59 | /**
60 | * 查询所有用户信息
61 | * @return java.util.List
62 | */
63 | @Override
64 | public List queryAllAuthUser(){
65 | List authUserList =
66 | authUserRepository.selectList(new LambdaQueryWrapper<>());
67 | if(CollectionUtils.isEmpty(authUserList)){
68 | return Lists.newArrayList();
69 | }
70 | List respList = mapperFacade.mapAsList(authUserList, AuthUserSketchResp.class);
71 | return respList;
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/platform-service/src/main/java/cn/common/service/netty/NettyBootstrapRunner.java:
--------------------------------------------------------------------------------
1 | package cn.common.service.netty;
2 |
3 | import lombok.extern.slf4j.Slf4j;
4 | import org.springframework.beans.BeansException;
5 | import org.springframework.beans.factory.annotation.Value;
6 | import org.springframework.boot.ApplicationArguments;
7 | import org.springframework.boot.ApplicationRunner;
8 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
9 | import org.springframework.context.ApplicationContext;
10 | import org.springframework.context.ApplicationContextAware;
11 | import org.springframework.context.ApplicationListener;
12 | import org.springframework.context.event.ContextClosedEvent;
13 | import org.springframework.stereotype.Component;
14 |
15 | import io.netty.bootstrap.ServerBootstrap;
16 | import io.netty.channel.Channel;
17 | import io.netty.channel.ChannelFutureListener;
18 | import io.netty.channel.ChannelHandlerContext;
19 | import io.netty.channel.ChannelInboundHandlerAdapter;
20 | import io.netty.channel.ChannelInitializer;
21 | import io.netty.channel.ChannelPipeline;
22 | import io.netty.channel.EventLoopGroup;
23 | import io.netty.channel.nio.NioEventLoopGroup;
24 | import io.netty.channel.socket.SocketChannel;
25 | import io.netty.channel.socket.nio.NioServerSocketChannel;
26 | import io.netty.handler.codec.http.DefaultFullHttpResponse;
27 | import io.netty.handler.codec.http.FullHttpRequest;
28 | import io.netty.handler.codec.http.HttpObjectAggregator;
29 | import io.netty.handler.codec.http.HttpResponseStatus;
30 | import io.netty.handler.codec.http.HttpServerCodec;
31 | import io.netty.handler.codec.http.HttpVersion;
32 | import io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler;
33 | import io.netty.handler.codec.http.websocketx.extensions.compression.WebSocketServerCompressionHandler;
34 | import io.netty.handler.stream.ChunkedWriteHandler;
35 |
36 | import java.net.*;
37 |
38 | /**
39 | * @packageName cn.common.service.netty
40 | * @Description: 初始化Netty服务
41 | */
42 | @Component
43 | @Slf4j
44 | @ConditionalOnProperty(prefix = "netty",name = "initStatus",havingValue = "true")
45 | public class NettyBootstrapRunner implements ApplicationRunner, ApplicationListener,
46 | ApplicationContextAware {
47 |
48 | @Value("${netty.websocket.port}")
49 | private int port;
50 |
51 | @Value("${netty.websocket.ip}")
52 | private String ip;
53 |
54 | @Value("${netty.websocket.path}")
55 | private String path;
56 |
57 | @Value("${netty.websocket.max-frame-size}")
58 | private Integer maxFrameSize;
59 |
60 | private ApplicationContext applicationContext;
61 |
62 | private Channel serverChannel;
63 |
64 | @Override
65 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
66 | this.applicationContext = applicationContext;
67 | }
68 |
69 | @Override
70 | public void run(ApplicationArguments args) throws Exception {
71 | EventLoopGroup bossGroup = new NioEventLoopGroup();
72 | EventLoopGroup workerGroup = new NioEventLoopGroup();
73 | try {
74 | ServerBootstrap serverBootstrap = new ServerBootstrap();
75 | serverBootstrap.group(bossGroup, workerGroup);
76 | serverBootstrap.channel(NioServerSocketChannel.class);
77 | serverBootstrap.localAddress(new InetSocketAddress(this.ip, this.port));
78 | serverBootstrap.childHandler(new ChannelInitializer() {
79 | @Override
80 | protected void initChannel(SocketChannel socketChannel) throws Exception {
81 | ChannelPipeline pipeline = socketChannel.pipeline();
82 | pipeline.addLast(new HttpServerCodec());
83 | pipeline.addLast(new ChunkedWriteHandler());
84 | pipeline.addLast(new HttpObjectAggregator(65536));
85 | pipeline.addLast(new ChannelInboundHandlerAdapter() {
86 | @Override
87 | public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
88 | if(msg instanceof FullHttpRequest) {
89 | FullHttpRequest fullHttpRequest = (FullHttpRequest) msg;
90 | String uri = fullHttpRequest.uri();
91 | if (!uri.equals(path)) {
92 | // 访问的路径不是 websocket的端点地址,响应404
93 | ctx.channel().writeAndFlush(new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.NOT_FOUND))
94 | .addListener(ChannelFutureListener.CLOSE);
95 | return ;
96 | }
97 | }
98 | super.channelRead(ctx, msg);
99 | }
100 | });
101 | pipeline.addLast(new WebSocketServerCompressionHandler());
102 | pipeline.addLast(new WebSocketServerProtocolHandler(path, null, true, maxFrameSize));
103 |
104 | /**
105 | * 从IOC中获取到Handler
106 | */
107 | pipeline.addLast(applicationContext.getBean(WebSocketMessageHandler.class));
108 | }
109 | });
110 | Channel channel = serverBootstrap.bind().sync().channel();
111 | this.serverChannel = channel;
112 | log.info("Netty-Websocket 服务启动,ip={},port={}", this.ip, this.port);
113 | channel.closeFuture().sync();
114 | } finally {
115 | bossGroup.shutdownGracefully();
116 | workerGroup.shutdownGracefully();
117 | }
118 | }
119 |
120 | @Override
121 | public void onApplicationEvent(ContextClosedEvent event) {
122 | if (this.serverChannel != null) {
123 | this.serverChannel.close();
124 | }
125 | log.info("websocket 服务停止");
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/platform-service/src/main/java/cn/common/service/netty/NettyChannelService.java:
--------------------------------------------------------------------------------
1 | package cn.common.service.netty;
2 |
3 | import io.netty.channel.Channel;
4 | import io.netty.channel.ChannelId;
5 | import io.netty.channel.group.ChannelGroup;
6 | import io.netty.channel.group.DefaultChannelGroup;
7 | import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
8 | import io.netty.util.concurrent.GlobalEventExecutor;
9 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
10 | import org.springframework.stereotype.Service;
11 |
12 | import java.util.concurrent.ConcurrentHashMap;
13 | import java.util.concurrent.ConcurrentMap;
14 |
15 | /**
16 | * @packageName cn.common.service.netty
17 |
18 | */
19 | @Service("nettyChannelService")
20 | public class NettyChannelService {
21 |
22 | private static ChannelGroup GlobalGroup = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE);
23 |
24 | private static ConcurrentMap ChannelMap = new ConcurrentHashMap();
25 |
26 | public void addChannel(Channel channel){
27 | GlobalGroup.add(channel);
28 | ChannelMap.put(channel.id().asShortText(),channel.id());
29 | }
30 |
31 | public void removeChannel(Channel channel){
32 | GlobalGroup.remove(channel);
33 | ChannelMap.remove(channel.id().asShortText());
34 | }
35 |
36 | public Channel getChannel(String id){
37 | return GlobalGroup.find(ChannelMap.get(id));
38 | }
39 |
40 | public void send2All(TextWebSocketFrame tws){
41 | GlobalGroup.writeAndFlush(tws);
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/platform-service/src/main/java/cn/common/service/netty/WebSocketMessageHandler.java:
--------------------------------------------------------------------------------
1 | package cn.common.service.netty;
2 |
3 | import com.alibaba.fastjson.JSON;
4 | import io.netty.channel.ChannelFutureListener;
5 | import io.netty.channel.ChannelHandler;
6 | import io.netty.channel.ChannelHandlerContext;
7 | import io.netty.channel.SimpleChannelInboundHandler;
8 | import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
9 | import io.netty.handler.codec.http.websocketx.WebSocketCloseStatus;
10 | import io.netty.handler.codec.http.websocketx.WebSocketFrame;
11 | import lombok.extern.slf4j.Slf4j;
12 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
13 | import org.springframework.stereotype.Component;
14 |
15 | import javax.annotation.Resource;
16 |
17 | @Component
18 | @Slf4j
19 | @ChannelHandler.Sharable
20 | @ConditionalOnProperty(prefix = "netty",name = "initStatus",havingValue = "true")
21 | public class WebSocketMessageHandler extends SimpleChannelInboundHandler {
22 |
23 | @Resource
24 | private NettyChannelService nettyChannelService;
25 |
26 |
27 | /**
28 | * Netty收到消息
29 | * @param ctx 上下文
30 | * @param ctx msg
31 | * @return
32 | */
33 | @Override
34 | protected void channelRead0(ChannelHandlerContext ctx, WebSocketFrame msg) throws Exception {
35 | if (msg instanceof TextWebSocketFrame) {
36 | TextWebSocketFrame textWebSocketFrame = (TextWebSocketFrame) msg;
37 | //发送过来的消息
38 | String text = textWebSocketFrame.text();
39 | // 业务层处理数据
40 | log.info(">>>>>>>>>>>>>>>>>>>>>>前端发送过来的消息:{}<<<<<<<<<<<<<<<<<<<<",text);
41 | String pushData = "";
42 | String data = JSON.toJSONString(pushData);
43 | log.info(">>>>>>>>>>>>>>>>>>>>>>建立连接后回复的消息:{}<<<<<<<<<<<<<<<<<<<<",data);
44 | // 响应客户端
45 | ctx.channel().writeAndFlush(new TextWebSocketFrame(data));
46 | } else {
47 | // 不接受文本以外的数据帧类型
48 | ctx.channel().writeAndFlush(WebSocketCloseStatus.INVALID_MESSAGE_TYPE).addListener(ChannelFutureListener.CLOSE);
49 | }
50 | }
51 |
52 | /**
53 | * Netty连接断开
54 | * @param ctx 上下文
55 | * @return
56 | */
57 | @Override
58 | public void channelInactive(ChannelHandlerContext ctx) throws Exception {
59 | super.channelInactive(ctx);
60 | nettyChannelService.removeChannel(ctx.channel());
61 | log.info("链接断开:{}", ctx.channel().remoteAddress());
62 | }
63 |
64 | /**
65 | * Netty连接创建
66 | * @param ctx 上下文
67 | * @return
68 | */
69 | @Override
70 | public void channelActive(ChannelHandlerContext ctx) throws Exception {
71 | super.channelActive(ctx);
72 | nettyChannelService.addChannel(ctx.channel());
73 | log.info("链接创建:{}", ctx.channel().remoteAddress());
74 | }
75 |
76 | }
77 |
--------------------------------------------------------------------------------
/platform-service/src/main/java/cn/common/service/platform/AsyncHandlerService.java:
--------------------------------------------------------------------------------
1 | package cn.common.service.platform;
2 |
3 | /**
4 | * @packageName cn.common.service
5 | * @Description: 异步处理服务
6 | */
7 | public interface AsyncHandlerService {
8 |
9 |
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/platform-service/src/main/java/cn/common/service/platform/AuthUserService.java:
--------------------------------------------------------------------------------
1 | package cn.common.service.platform;
2 |
3 |
4 | import cn.common.internal.AuthUserLoginReq;
5 | import cn.common.req.AppUpdatePwdReq;
6 | import cn.common.req.AppUserRegReq;
7 | import cn.common.resp.AppLoginResp;
8 | import cn.common.resp.TokenVerifyResp;
9 |
10 | /**
11 | * @Description: 系统用户相关服务
12 | */
13 |
14 | public interface AuthUserService {
15 |
16 | /**
17 | * 验证Token
18 | */
19 | TokenVerifyResp verifyToken();
20 |
21 | /**
22 | * 拿到用户ID
23 | */
24 | String currentAppUserId();
25 |
26 | /**
27 | * 拿到登录后的用户信息 不抛出异常
28 | */
29 | AppLoginResp queryLoginUserMetaNoThrow();
30 |
31 | /**
32 | * 用户注册
33 | * @param req 请求参数
34 | */
35 | AppLoginResp userRegister(AppUserRegReq req);
36 |
37 | /**
38 | * 拿到登录后的用户信息
39 | */
40 | AppLoginResp queryLoginUserMeta();
41 |
42 | /**
43 | * 更新密码
44 | * @param req 请求参数
45 | */
46 | void updatePassword(AppUpdatePwdReq req);
47 |
48 | /**
49 | * 系统退出登录
50 | */
51 | void logOut();
52 |
53 | /**
54 | * 系统登录
55 | * @param req 用户登录请求参数
56 | */
57 | AppLoginResp authUserLogin(AuthUserLoginReq req);
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/platform-service/src/main/java/cn/common/service/platform/PlatformApiLogService.java:
--------------------------------------------------------------------------------
1 | package cn.common.service.platform;
2 |
3 |
4 | /**
5 |
6 | * @Description: 系统日志相关服务*/
7 | public interface PlatformApiLogService {
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/platform-service/src/main/java/cn/common/service/platform/PlatformBizService.java:
--------------------------------------------------------------------------------
1 | package cn.common.service.platform;
2 |
3 | /**
4 | * @author create by singer - Singer email:singer-coder@qq.com
5 | * @projectName animal-app-api
6 | * @Description:
7 | * @date 2022-01-18
8 | */
9 | public interface PlatformBizService {
10 |
11 |
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/platform-service/src/main/java/cn/common/service/platform/PlatformDictService.java:
--------------------------------------------------------------------------------
1 | package cn.common.service.platform;
2 |
3 | import cn.common.repository.entity.platform.PlatformDict;
4 |
5 | /**
6 |
7 | * @Description: 平台数据字典服务
8 |
9 | */
10 | public interface PlatformDictService {
11 |
12 | /**
13 | * 插入字典数据 写入缓存以及数据库
14 | * @param platformDict 字典内容
15 | * @return cn.common.repository.entity.platform.PlatformDict
16 | */
17 | PlatformDict insertDict(PlatformDict platformDict);
18 |
19 | /**
20 | * 从缓存和数据库里面拿到字典的值,拿不到则返回空
21 | * 能拿到则设置缓存
22 | * @param dictType
23 | * @return cn.common.repository.entity.platform.PlatformDict
24 | */
25 | PlatformDict getAndSetDict(String dictType);
26 |
27 | /**
28 | * 更新字典 更新缓存里面的数据以及数据库里面的字典数据
29 | * @param platformDict 字典内容
30 | * @return cn.common.repository.entity.platform.PlatformDict
31 | */
32 | PlatformDict updateDict(PlatformDict platformDict);
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/platform-service/src/main/java/cn/common/service/platform/PlatformFileService.java:
--------------------------------------------------------------------------------
1 | package cn.common.service.platform;
2 |
3 | import org.springframework.web.multipart.MultipartFile;
4 | import pro.skywalking.configuration.oss.meta.MultipartFileUrlMeta;
5 |
6 | /**
7 | * @packageName cn.common.service
8 | * @Description: 平台文件上传Service
9 | */
10 | public interface PlatformFileService {
11 |
12 | /**
13 | * 上传文件
14 | * @param file
15 | * @return pro.skywalking.req.platform.upload.MultipartFileUrlResp
16 | */
17 | MultipartFileUrlMeta uploadFile(MultipartFile file);
18 |
19 | /**
20 | * 上传文件
21 | * @param file
22 | * @return pro.skywalking.req.platform.upload.MultipartFileUrlResp
23 | */
24 | MultipartFileUrlMeta uploadFileMixed(MultipartFile file);
25 | }
26 |
--------------------------------------------------------------------------------
/platform-service/src/main/java/cn/common/service/platform/PlatformService.java:
--------------------------------------------------------------------------------
1 | package cn.common.service.platform;
2 |
3 |
4 | import pro.skywalking.resp.platform.dict.PlatformDictResp;
5 | import pro.skywalking.resp.platform.other.AuthUserSketchResp;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * @projectName animal-app-api
11 | * @Description: 平台相关服务方法
12 | */
13 | public interface PlatformService {
14 |
15 |
16 | /**
17 | * 根据字典类型查询字典
18 | * @param dictType 字典类型
19 | * @return java.util.List
20 | */
21 | List queryDictByType(String dictType);
22 |
23 |
24 | /**
25 | * 查询所有用户信息
26 | * @return java.util.List
27 | */
28 | List queryAllAuthUser();
29 | }
30 |
--------------------------------------------------------------------------------