diff --git a/pom.xml b/pom.xml
index 1160745..9c8d578 100644
--- a/pom.xml
+++ b/pom.xml
@@ -106,6 +106,13 @@
login-oauth2-server
1.0-SNAPSHOT
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-mongodb
+
+
diff --git a/src/main/java/cn/com/tenlion/usercenter/controller/api/userrealtimelocation/UserRealtimeLocationController.java b/src/main/java/cn/com/tenlion/usercenter/controller/api/userrealtimelocation/UserRealtimeLocationController.java
new file mode 100644
index 0000000..2231e36
--- /dev/null
+++ b/src/main/java/cn/com/tenlion/usercenter/controller/api/userrealtimelocation/UserRealtimeLocationController.java
@@ -0,0 +1,93 @@
+package cn.com.tenlion.usercenter.controller.api.userrealtimelocation;
+
+import cn.com.tenlion.usercenter.service.userrealtimelocation.IUserRealtimeLocationService;
+import ink.wgink.common.base.DefaultBaseController;
+import ink.wgink.interfaces.consts.ISystemConstant;
+import ink.wgink.module.map.pojo.dtos.userlocation.UserLocationDTO;
+import ink.wgink.pojo.ListPage;
+import ink.wgink.pojo.result.ErrorResult;
+import ink.wgink.pojo.result.SuccessResult;
+import ink.wgink.pojo.result.SuccessResultList;
+import io.swagger.annotations.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName: UserRealtimeLocationController
+ * @Description: 用户实时定位
+ * @Author: CodeFactory
+ * @Date: 2021-10-29 15:37:01
+ * @Version: 3.0
+ **/
+@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "用户实时定位接口")
+@RestController
+@RequestMapping(ISystemConstant.API_PREFIX + "/user-realtime-location")
+public class UserRealtimeLocationController extends DefaultBaseController {
+
+ @Autowired
+ private IUserRealtimeLocationService userRealtimeLocationService;
+
+ @ApiOperation(value = "删除用户实时定位", notes = "删除用户实时定位接口")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "ids", value = "ID列表,用下划线分隔", paramType = "path", example = "1_2_3")
+ })
+ @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
+ @DeleteMapping("remove/{ids}")
+ public SuccessResult remove(@PathVariable("ids") String ids) {
+ userRealtimeLocationService.remove(Arrays.asList(ids.split("\\_")));
+ return new SuccessResult();
+ }
+
+ @ApiOperation(value = "用户定位列表", notes = "用户定位列表接口")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "userId", value = "用户ID", paramType = "path", required = true),
+ @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String", required = true),
+ @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String", required = true)
+ })
+ @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
+ @GetMapping("list/{startTime}/{endTime}")
+ public List list(@PathVariable("userId") String userId,
+ @PathVariable("startTime") String startTime,
+ @PathVariable("endTime") String endTime) {
+ Map params = requestParams();
+ return userRealtimeLocationService.listByUserIdAndStartTimeAndEndTime(params, userId, startTime, endTime);
+ }
+
+ @ApiOperation(value = "用户实时定位分页列表", notes = "用户实时定位分页列表接口")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
+ @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
+ @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
+ @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
+ })
+ @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
+ @GetMapping("listpage/{startTime}/{endTime}")
+ public SuccessResultList> listPage(ListPage page,
+ @PathVariable("startTime") String startTime,
+ @PathVariable("endTime") String endTime) {
+ Map params = requestParams();
+ page.setParams(params);
+ return userRealtimeLocationService.listPageByStartTimeAndEndTime(page, startTime, endTime);
+ }
+
+ @ApiOperation(value = "用户实时定位分页列表", notes = "用户实时定位分页列表接口")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
+ @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
+ @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
+ @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
+ })
+ @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
+ @GetMapping("listpage")
+ public SuccessResultList> listPage(ListPage page) {
+ Map params = requestParams();
+ page.setParams(params);
+ return userRealtimeLocationService.listPage(page);
+ }
+
+
+}
\ No newline at end of file
diff --git a/src/main/java/cn/com/tenlion/usercenter/controller/app/api/userrealtimelocation/UserRealtimeLocationAppController.java b/src/main/java/cn/com/tenlion/usercenter/controller/app/api/userrealtimelocation/UserRealtimeLocationAppController.java
new file mode 100644
index 0000000..55337d4
--- /dev/null
+++ b/src/main/java/cn/com/tenlion/usercenter/controller/app/api/userrealtimelocation/UserRealtimeLocationAppController.java
@@ -0,0 +1,66 @@
+package cn.com.tenlion.usercenter.controller.app.api.userrealtimelocation;
+
+import cn.com.tenlion.usercenter.service.userrealtimelocation.IUserRealtimeLocationService;
+import ink.wgink.common.base.DefaultBaseController;
+import ink.wgink.interfaces.consts.ISystemConstant;
+import ink.wgink.module.map.pojo.dtos.userlocation.UserLocationDTO;
+import ink.wgink.pojo.ListPage;
+import ink.wgink.pojo.result.ErrorResult;
+import ink.wgink.pojo.result.SuccessResultList;
+import io.swagger.annotations.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName: UserRealtimeLocationAppController
+ * @Description: 用户实时定位
+ * @Author: CodeFactory
+ * @Date: 2021-10-29 15:37:01
+ * @Version: 3.0
+ **/
+@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "用户实时定位接口")
+@RestController
+@RequestMapping(ISystemConstant.APP_PREFIX + "/user-realtime-location")
+public class UserRealtimeLocationAppController extends DefaultBaseController {
+
+ @Autowired
+ private IUserRealtimeLocationService userRealtimeLocationService;
+
+ @ApiOperation(value = "用户定位列表", notes = "用户定位列表接口")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "token", value = "token", paramType = "header", required = true),
+ @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String", required = true),
+ @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String", required = true)
+ })
+ @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
+ @GetMapping("list")
+ public List list(@RequestHeader("token") String token,
+ @RequestParam("startTime") String startTime,
+ @RequestParam("endTime") String endTime) {
+ Map params = requestParams();
+ return userRealtimeLocationService.listByTokenAndStartTimeAndEndTime(params, token, startTime, endTime);
+ }
+
+ @ApiOperation(value = "用户定位分页列表", notes = "用户定位分页列表接口")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "token", value = "token", paramType = "header", required = true),
+ @ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
+ @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
+ @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String", required = true),
+ @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String", required = true)
+ })
+ @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
+ @GetMapping("listpage")
+ public SuccessResultList> listPage(@RequestHeader("token") String token,
+ ListPage page,
+ @RequestParam("startTime") String startTime,
+ @RequestParam("endTime") String endTime) {
+ Map params = requestParams();
+ page.setParams(params);
+ return userRealtimeLocationService.listPageByTokenAndStartTimeAndEndTime(token, page, startTime, endTime);
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/cn/com/tenlion/usercenter/controller/resource/userrealtimelocation/UserRealtimeLocationResourceController.java b/src/main/java/cn/com/tenlion/usercenter/controller/resource/userrealtimelocation/UserRealtimeLocationResourceController.java
new file mode 100644
index 0000000..7bdcb3d
--- /dev/null
+++ b/src/main/java/cn/com/tenlion/usercenter/controller/resource/userrealtimelocation/UserRealtimeLocationResourceController.java
@@ -0,0 +1,53 @@
+package cn.com.tenlion.usercenter.controller.resource.userrealtimelocation;
+
+import ink.wgink.common.base.DefaultBaseController;
+import ink.wgink.interfaces.consts.ISystemConstant;
+import ink.wgink.module.map.pojo.dtos.userlocation.UserLocationDTO;
+import ink.wgink.module.map.service.userlocation.IUserLocationService;
+import ink.wgink.pojo.ListPage;
+import ink.wgink.pojo.result.ErrorResult;
+import ink.wgink.pojo.result.SuccessResultList;
+import io.swagger.annotations.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Primary;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName: UserRealtimeLocationResourceController
+ * @Description: 用户定位
+ * @Author: CodeFactory
+ * @Date: 2021-10-29 15:37:01
+ * @Version: 3.0
+ **/
+@Api(tags = ISystemConstant.API_TAGS_RESOURCE_PREFIX + "用户实时定位接口")
+@Primary
+@RestController
+@RequestMapping(ISystemConstant.RESOURCE_PREFIX + "/user-realtime-location")
+public class UserRealtimeLocationResourceController extends DefaultBaseController {
+
+ @Autowired
+ private IUserLocationService userLocationService;
+
+ @ApiOperation(value = "用户定位分页列表", notes = "用户定位分页列表接口")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"),
+ @ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
+ @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
+ @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
+ @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
+ @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
+ })
+ @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
+ @GetMapping("listpage")
+ public SuccessResultList> listPage(ListPage page) {
+ Map params = requestParams();
+ page.setParams(params);
+ return userLocationService.listPage(page);
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/cn/com/tenlion/usercenter/controller/route/userrealtimelocation/UserRealtimeLocationRouteController.java b/src/main/java/cn/com/tenlion/usercenter/controller/route/userrealtimelocation/UserRealtimeLocationRouteController.java
new file mode 100644
index 0000000..522da95
--- /dev/null
+++ b/src/main/java/cn/com/tenlion/usercenter/controller/route/userrealtimelocation/UserRealtimeLocationRouteController.java
@@ -0,0 +1,28 @@
+package cn.com.tenlion.usercenter.controller.route.userrealtimelocation;
+
+import ink.wgink.common.base.DefaultBaseController;
+import ink.wgink.interfaces.consts.ISystemConstant;
+import io.swagger.annotations.Api;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.servlet.ModelAndView;
+
+/**
+ * @ClassName: UserLocationController
+ * @Description: 用户定位
+ * @Author: CodeFactory
+ * @Date: 2021-10-29 15:37:01
+ * @Version: 3.0
+ **/
+@Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "用户实时定位路由")
+@RestController
+@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/user-realtime-location")
+public class UserRealtimeLocationRouteController extends DefaultBaseController {
+
+ @GetMapping("list")
+ public ModelAndView list() {
+ return new ModelAndView("user-realtime-location/list");
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/cn/com/tenlion/usercenter/enums/mongo/MongoCollectionEnum.java b/src/main/java/cn/com/tenlion/usercenter/enums/mongo/MongoCollectionEnum.java
new file mode 100644
index 0000000..4522f73
--- /dev/null
+++ b/src/main/java/cn/com/tenlion/usercenter/enums/mongo/MongoCollectionEnum.java
@@ -0,0 +1,29 @@
+package cn.com.tenlion.usercenter.enums.mongo;
+
+/**
+ * @ClassName: MongoCollectionEnum
+ * @Description: mongo集合
+ * @Author: wanggeng
+ * @Date: 2021/10/29 4:21 下午
+ * @Version: 1.0
+ */
+public enum MongoCollectionEnum {
+
+ USER_REALTIME_LOCATION("userRealtimeLocation", "用户实时定位");
+
+ private String collection;
+ private String summary;
+
+ MongoCollectionEnum(String collection, String summary) {
+ this.collection = collection;
+ this.summary = summary;
+ }
+
+ public String getCollection() {
+ return collection;
+ }
+
+ public String getSummary() {
+ return summary;
+ }
+}
diff --git a/src/main/java/cn/com/tenlion/usercenter/enums/websocket/WebSocketCustomTypeEnum.java b/src/main/java/cn/com/tenlion/usercenter/enums/websocket/WebSocketCustomTypeEnum.java
new file mode 100644
index 0000000..3c987b2
--- /dev/null
+++ b/src/main/java/cn/com/tenlion/usercenter/enums/websocket/WebSocketCustomTypeEnum.java
@@ -0,0 +1,29 @@
+package cn.com.tenlion.usercenter.enums.websocket;
+
+/**
+ * @ClassName: WebSocketCustomTypeEnum
+ * @Description: 自定义消息枚举类型
+ * @Author: wanggeng
+ * @Date: 2021/10/29 4:15 下午
+ * @Version: 1.0
+ */
+public enum WebSocketCustomTypeEnum {
+
+ LOCATION_REALTIME(11001, "实时定位");
+
+ private int value;
+ private String summary;
+
+ WebSocketCustomTypeEnum(int value, String summary) {
+ this.value = value;
+ this.summary = summary;
+ }
+
+ public int getValue() {
+ return value;
+ }
+
+ public String getSummary() {
+ return summary == null ? "" : summary.trim();
+ }
+}
diff --git a/src/main/java/cn/com/tenlion/usercenter/service/userrealtimelocation/IUserRealtimeLocationService.java b/src/main/java/cn/com/tenlion/usercenter/service/userrealtimelocation/IUserRealtimeLocationService.java
new file mode 100644
index 0000000..4785c7b
--- /dev/null
+++ b/src/main/java/cn/com/tenlion/usercenter/service/userrealtimelocation/IUserRealtimeLocationService.java
@@ -0,0 +1,41 @@
+package cn.com.tenlion.usercenter.service.userrealtimelocation;
+
+import ink.wgink.module.map.pojo.dtos.userlocation.UserLocationDTO;
+import ink.wgink.module.map.pojo.vos.userlocation.UserLocationVO;
+import ink.wgink.pojo.ListPage;
+import ink.wgink.pojo.result.SuccessResultList;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName: IUserRealtimeService
+ * @Description: 用户实时定位
+ * @Author: wanggeng
+ * @Date: 2021/10/29 3:57 下午
+ * @Version: 1.0
+ */
+public interface IUserRealtimeLocationService {
+
+ /**
+ * 新增用户定位
+ *
+ * @param userLocationVO
+ * @return
+ */
+ void save(UserLocationVO userLocationVO);
+
+ void remove(List ids);
+
+ List listByTokenAndStartTimeAndEndTime(Map params, String token, String startTime, String endTime);
+
+ List listByUserIdAndStartTimeAndEndTime(Map params, String userId, String startTime, String endTime);
+
+ SuccessResultList> listPageByTokenAndStartTimeAndEndTime(String token, ListPage page, String startTime, String endTime);
+
+ SuccessResultList> listPageByUserIdAndStartTimeAndEndTime(ListPage page, String userId, String startTime, String endTime);
+
+ SuccessResultList> listPageByStartTimeAndEndTime(ListPage page, String startTime, String endTime);
+
+ SuccessResultList> listPage(ListPage page);
+}
diff --git a/src/main/java/cn/com/tenlion/usercenter/service/userrealtimelocation/impl/UserRealtimeLocationServiceImpl.java b/src/main/java/cn/com/tenlion/usercenter/service/userrealtimelocation/impl/UserRealtimeLocationServiceImpl.java
new file mode 100644
index 0000000..95f73ea
--- /dev/null
+++ b/src/main/java/cn/com/tenlion/usercenter/service/userrealtimelocation/impl/UserRealtimeLocationServiceImpl.java
@@ -0,0 +1,139 @@
+package cn.com.tenlion.usercenter.service.userrealtimelocation.impl;
+
+import cn.com.tenlion.usercenter.enums.mongo.MongoCollectionEnum;
+import cn.com.tenlion.usercenter.service.userrealtimelocation.IUserRealtimeLocationService;
+import ink.wgink.app.AppTokenManager;
+import ink.wgink.common.base.DefaultBaseService;
+import ink.wgink.module.map.pojo.dtos.userlocation.UserLocationDTO;
+import ink.wgink.module.map.pojo.vos.userlocation.UserLocationVO;
+import ink.wgink.module.map.service.userlocation.IUserLocationService;
+import ink.wgink.pojo.ListPage;
+import ink.wgink.pojo.result.SuccessResultList;
+import ink.wgink.util.date.DateUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.regex.Pattern;
+
+/**
+ * @ClassName: UserRealtimeServiceImpl
+ * @Description: 用户实时定位
+ * @Author: wanggeng
+ * @Date: 2021/10/29 3:57 下午
+ * @Version: 1.0
+ */
+@Service
+public class UserRealtimeLocationServiceImpl extends DefaultBaseService implements IUserRealtimeLocationService {
+
+ @Autowired
+ private IUserLocationService userLocationService;
+ @Autowired
+ private MongoTemplate mongoTemplate;
+
+ @Override
+ public void save(UserLocationVO userLocationVO) {
+ userLocationVO.setGmtCreate(DateUtil.getTime());
+ userLocationService.save(userLocationVO.getCreator(), userLocationVO);
+ mongoTemplate.insert(userLocationVO, MongoCollectionEnum.USER_REALTIME_LOCATION.getCollection());
+ }
+
+ @Override
+ public void remove(List ids) {
+ userLocationService.remove(ids);
+ Query query = new Query(Criteria.where("userLocationId").in(ids));
+ mongoTemplate.remove(query, MongoCollectionEnum.USER_REALTIME_LOCATION.getCollection());
+ }
+
+ @Override
+ public List listByTokenAndStartTimeAndEndTime(Map params, String token, String startTime, String endTime) {
+ String userId = AppTokenManager.getInstance().getToken(token).getUserId();
+ return listByUserIdAndStartTimeAndEndTime(params, userId, startTime, endTime);
+ }
+
+ @Override
+ public List listByUserIdAndStartTimeAndEndTime(Map params, String userId, String startTime, String endTime) {
+ Query query = getListQuery(userId, startTime, endTime, params);
+ return mongoTemplate.find(query, UserLocationDTO.class, MongoCollectionEnum.USER_REALTIME_LOCATION.getCollection());
+ }
+
+ @Override
+ public SuccessResultList> listPageByTokenAndStartTimeAndEndTime(String token, ListPage page, String startTime, String endTime) {
+ String userId = AppTokenManager.getInstance().getToken(token).getUserId();
+ return listPageByUserIdAndStartTimeAndEndTime(page, userId, startTime, endTime);
+ }
+
+ @Override
+ public SuccessResultList> listPageByUserIdAndStartTimeAndEndTime(ListPage page, String userId, String startTime, String endTime) {
+ Query query = getListQuery(userId, startTime, endTime, page.getParams());
+ return listPage(query, page);
+ }
+
+ @Override
+ public SuccessResultList> listPageByStartTimeAndEndTime(ListPage page, String startTime, String endTime) {
+ Query query = getListQuery(null, startTime, endTime, page.getParams());
+ return listPage(query, page);
+ }
+
+ @Override
+ public SuccessResultList> listPage(ListPage page) {
+ String startTime = Objects.toString(page.getParams().get("startTime"), "");
+ String endTime = Objects.toString(page.getParams().get("endTime"), "");
+ Query query = getListQuery(null, startTime, endTime, page.getParams());
+ return listPage(query, page);
+ }
+
+ /**
+ * 分页
+ *
+ * @param query
+ * @param page
+ * @return
+ */
+ private SuccessResultList> listPage(Query query, ListPage page) {
+ long total = mongoTemplate.count(query, MongoCollectionEnum.USER_REALTIME_LOCATION.getCollection());
+ query.with(Pageable.ofSize(page.getRows()).withPage(page.getPage() - 1));
+ List userLocationDTOs = mongoTemplate.find(query, UserLocationDTO.class, MongoCollectionEnum.USER_REALTIME_LOCATION.getCollection());
+ return new SuccessResultList<>(userLocationDTOs, page.getPage(), total);
+ }
+
+ /**
+ * 得到列表请求对象
+ *
+ * @param userId
+ * @param startTime
+ * @param endTime
+ * @param params
+ * @return
+ */
+ private Query getListQuery(String userId, String startTime, String endTime, Map params) {
+ Query query = new Query();
+ if (!StringUtils.isBlank(startTime) || !StringUtils.isBlank(endTime)) {
+ Criteria criteria = Criteria.where("gmtCreate");
+ if (!StringUtils.isBlank(startTime)) {
+ criteria.gt(startTime);
+ }
+ if (!StringUtils.isBlank(endTime)) {
+ criteria.lt(endTime);
+ }
+ query.addCriteria(criteria);
+ }
+ if (!StringUtils.isBlank(userId)) {
+ query.addCriteria(Criteria.where("uerId").is(userId));
+ }
+ String keywords = getKeywords(params);
+ if (!StringUtils.isBlank(keywords)) {
+ Pattern pattern = Pattern.compile("^.*" + keywords + ".*$", Pattern.CASE_INSENSITIVE);
+ query.addCriteria(Criteria.where("userName").regex(pattern));
+ query.addCriteria(Criteria.where("uerUsername").regex(pattern));
+ }
+ return query;
+ }
+}
diff --git a/src/main/java/cn/com/tenlion/usercenter/service/websocket/WebSocketTextCustomServiceImpl.java b/src/main/java/cn/com/tenlion/usercenter/service/websocket/WebSocketTextCustomServiceImpl.java
new file mode 100644
index 0000000..08bce72
--- /dev/null
+++ b/src/main/java/cn/com/tenlion/usercenter/service/websocket/WebSocketTextCustomServiceImpl.java
@@ -0,0 +1,40 @@
+package cn.com.tenlion.usercenter.service.websocket;
+
+import cn.com.tenlion.usercenter.enums.websocket.WebSocketCustomTypeEnum;
+import cn.com.tenlion.usercenter.service.userrealtimelocation.IUserRealtimeLocationService;
+import com.alibaba.fastjson.JSONObject;
+import ink.wgink.common.base.DefaultBaseService;
+import ink.wgink.module.instantmessage.service.IWebSocketTextCustomService;
+import ink.wgink.module.instantmessage.websocket.exception.CustomHandleException;
+import ink.wgink.module.instantmessage.websocket.pojo.WebSocketClientMessage;
+import ink.wgink.module.map.pojo.vos.userlocation.UserLocationVO;
+import io.netty.channel.Channel;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * @ClassName: WebSocketTextCustomServiceImpl
+ * @Description: 自定义websocket业务实现
+ * @Author: wanggeng
+ * @Date: 2021/10/29 2:40 下午
+ * @Version: 1.0
+ */
+@Service
+public class WebSocketTextCustomServiceImpl extends DefaultBaseService implements IWebSocketTextCustomService {
+
+ @Autowired
+ private IUserRealtimeLocationService userRealtimeLocationService;
+
+ @Override
+ public void handle(Channel channel, WebSocketClientMessage webSocketClientMessage) throws CustomHandleException {
+ try {
+ if (WebSocketCustomTypeEnum.LOCATION_REALTIME.getValue() == webSocketClientMessage.getType()) {
+ UserLocationVO userLocationVO = JSONObject.parseObject(webSocketClientMessage.getBody(), UserLocationVO.class);
+ userRealtimeLocationService.save(userLocationVO);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new CustomHandleException(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml
index 4be5906..97a2c0f 100644
--- a/src/main/resources/application-test.yml
+++ b/src/main/resources/application-test.yml
@@ -50,13 +50,16 @@ spring:
slow-sql-millis: 2000
connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
use-global-data-source-stat: true
+ data:
+ mongodb:
+ uri: mongodb://usercenter:usercenter@192.168.0.156:27017/smart-city-usercenter
mybatis:
config-location: classpath:mybatis/mybatis-config.xml
mapper-locations: classpath*:mybatis/mapper/**/*.xml
swagger:
- base-package-list: ink.wgink,com.cn
+ base-package-list: ink.wgink,cn.com.tenlion
file:
upload-path: /Users/wanggeng/Desktop/UploadFiles/
@@ -90,6 +93,6 @@ logging:
name: /Users/wanggeng/Desktop/UploadFiles/logs/usercenter-logs.log
level:
root: error
+ org.springframework.data.mongodb: debug
org.springframework.boot.autoconfigure.security.servlet: debug
ink.wgink: debug
- cn.com: debug
\ No newline at end of file
diff --git a/src/main/resources/templates/user-realtime-location/list.html b/src/main/resources/templates/user-realtime-location/list.html
new file mode 100644
index 0000000..b04a463
--- /dev/null
+++ b/src/main/resources/templates/user-realtime-location/list.html
@@ -0,0 +1,276 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file