From bc692804cbb38d53199ccc7e3fd9ea3bcfc0ad3b Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期二, 21 十月 2025 17:55:06 +0800
Subject: [PATCH] 人员分布

---
 ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TAppUserController.java |   34 ++++++++++++++++++++++++++++++----
 1 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TAppUserController.java b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TAppUserController.java
index 7cf28c1..2a840f4 100644
--- a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TAppUserController.java
+++ b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TAppUserController.java
@@ -3,7 +3,9 @@
 
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.ruoyi.common.constant.Constants;
 import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.framework.web.service.TokenService;
 import com.ruoyi.system.dto.UpdateDetailTeamDto;
 import com.ruoyi.system.model.TAppUser;
@@ -16,7 +18,10 @@
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.*;
+
+import java.time.LocalDate;
 
 /**
  * <p>
@@ -36,13 +41,15 @@
     private final PasswordEncoder passwordEncoder;
     private final TAppUserEquipmentService appUserEquipmentService;
     private final TAppUserLocationService appUserLocationService;
+    private final RedisCache redisCache;
     @Autowired
-    public TAppUserController(TAppUserService appUserService, TokenService tokenService, PasswordEncoder passwordEncoder, TAppUserEquipmentService appUserEquipmentService, TAppUserLocationService appUserLocationService) {
+    public TAppUserController(TAppUserService appUserService, TokenService tokenService, PasswordEncoder passwordEncoder, TAppUserEquipmentService appUserEquipmentService, TAppUserLocationService appUserLocationService, RedisCache redisCache) {
         this.appUserService = appUserService;
         this.tokenService = tokenService;
         this.passwordEncoder = passwordEncoder;
         this.appUserEquipmentService = appUserEquipmentService;
         this.appUserLocationService = appUserLocationService;
+        this.redisCache = redisCache;
     }
 
     /**
@@ -90,8 +97,8 @@
     /**
      * 查看人员管理详情--修改队伍情况
      */
-    @ApiOperation(value = "查看人员管理详情--修改队伍情况",response = TAppUserEquipment.class)
-    @PostMapping(value = "/open/t-app-user/updateDetailTeam")
+    @ApiOperation(value = "查看人员管理详情--修改队伍情况",response = UpdateDetailTeamDto.class)
+    @PostMapping(value = "/api/t-app-user/updateDetailTeam")
     public R<?> updateDetailTeam(@RequestBody String param) {
         String userId = tokenService.getLoginUserApplet().getUserId();
         UpdateDetailTeamDto dto = JSON.parseObject(param, UpdateDetailTeamDto.class);
@@ -108,7 +115,7 @@
      * 用户打点
      */
     @ApiOperation(value = "用户打点",response = TAppUserLocation.class)
-    @PostMapping(value = "/open/t-app-user/appUserLocation")
+    @PostMapping(value = "/api/t-app-user/appUserLocation")
     public R<?> appUserLocation(@RequestBody String param) {
         TAppUserLocation location = JSON.parseObject(param,TAppUserLocation.class);
         String userId = tokenService.getLoginUserApplet().getUserId();
@@ -117,5 +124,24 @@
         return R.ok();
     }
 
+    /**
+     * 用户实时定位上传
+     */
+    @ApiOperation(value = "用户实时定位上传")
+    @PostMapping(value = "/open/t-app-user/positioningUpload")
+    public R<String> positioningUpload(@RequestParam(value = "lon") String lon ,
+                                       @RequestParam(value = "lat") String lat ) {
+        String userId = tokenService.getLoginUserApplet().getUserId();
+        String location = redisCache.getCacheObject(Constants.LOCATION + userId + ":" + LocalDate.now());
+        if(StringUtils.hasLength(location)){
+            redisCache.setCacheObject(Constants.LOCATION + userId + ":" + LocalDate.now(), location + ";" +lon + "," + lat);
+        }else {
+            redisCache.setCacheObject(Constants.LOCATION + userId + ":" + LocalDate.now(), lon + "," + lat);
+        }
+        // 实时定位点
+        redisCache.setCacheObject(Constants.LOCATION + userId, lon + "," + lat);
+        return R.ok();
+    }
+
 }
 

--
Gitblit v1.7.1