From 3b7c832ffe25aed9cbdf0a40cbb332905b698351 Mon Sep 17 00:00:00 2001 From: liujie <1793218484@qq.com> Date: 星期三, 22 十月 2025 18:27:10 +0800 Subject: [PATCH] 人员详情 --- ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TAppUserController.java | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 107 insertions(+), 2 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 7ad519f..89b9447 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 @@ -2,16 +2,30 @@ import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.dto.UserIdDto; import com.ruoyi.system.model.TAppUser; +import com.ruoyi.system.model.TAppUserEquipment; +import com.ruoyi.system.model.TAppUserLocation; +import com.ruoyi.system.service.TAppUserEquipmentService; +import com.ruoyi.system.service.TAppUserLocationService; import com.ruoyi.system.service.TAppUserService; import io.swagger.annotations.Api; 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; + +import java.util.List; /** * <p> @@ -29,11 +43,17 @@ private final TAppUserService appUserService; private final TokenService tokenService; 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) { + 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; } /** @@ -49,7 +69,7 @@ } dto.setState(0); dto.setStatus(1); - passwordEncoder.encode(dto.getPassword()); + dto.setPassword(passwordEncoder.encode(dto.getPassword())); appUserService.save(dto); return R.ok(); } @@ -65,5 +85,90 @@ return R.ok(appUser); } + + + /** + * 查看人员管理详情--队伍情况 + */ + @ApiOperation(value = "查看人员管理详情--队伍情况",response = TAppUserEquipment.class) + @GetMapping(value = "/open/t-app-user/getDetailTeam") + public R<TAppUserEquipment> getDetailTeam() { + String userId = tokenService.getLoginUserApplet().getUserId(); + TAppUserEquipment tAppUserEquipment = appUserEquipmentService.getOne(Wrappers.lambdaQuery(TAppUserEquipment.class).eq(TAppUserEquipment::getAppUserId, userId)); + return R.ok(tAppUserEquipment); + } + + /** + * 查看人员管理详情--修改队伍情况 + */ + @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); + TAppUserEquipment tAppUserEquipment = appUserEquipmentService.getOne(Wrappers.lambdaQuery(TAppUserEquipment.class).eq(TAppUserEquipment::getAppUserId, userId)); + tAppUserEquipment.setPersonCount(dto.getPersonCount()); + tAppUserEquipment.setEquipmentCount(dto.getEquipmentCount()); + appUserEquipmentService.updateById(tAppUserEquipment); + return R.ok(); + } + + + + /** + * 用户打点 + */ + @ApiOperation(value = "用户打点",response = TAppUserLocation.class) + @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(); + location.setAppUserId(userId); + appUserLocationService.save(location); + 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(); + } + + /** + * 用户打点 + */ + @ApiOperation(value = "获取用户打点数据",response = TAppUserLocation.class) + @GetMapping(value = "/open/t-app-user/getAppUserLocation") + public R<List<TAppUserLocation>> getAppUserLocation() { + String userId = tokenService.getLoginUserApplet().getUserId(); + List<TAppUserLocation> list = appUserLocationService.list(new LambdaQueryWrapper<TAppUserLocation>().eq(TAppUserLocation::getAppUserId, userId).orderByDesc(TAppUserLocation::getTime)); + return R.ok(list); + } + + /** + * 用户打点 + */ + @ApiOperation(value = "获取用户打点数据--详情",response = TAppUserLocation.class) + @PostMapping(value = "/open/t-app-user/getAppUserLocationFromId") + public R<TAppUserLocation> getAppUserLocationFromId(@RequestBody String param) { + UserIdDto dto = JSON.parseObject(param, UserIdDto.class); + TAppUserLocation location = appUserLocationService.getById(dto.getId()); + return R.ok(location); + } + + } -- Gitblit v1.7.1