| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.UpdateDetailTeamDto; |
| | | 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; |
| | |
| | | */ |
| | | @Api(tags = "人员管理") |
| | | @RestController |
| | | @RequestMapping("/t-app-user") |
| | | @RequestMapping("") |
| | | public class TAppUserController { |
| | | |
| | | private final TAppUserService appUserService; |
| | | private final TokenService tokenService; |
| | | private final PasswordEncoder passwordEncoder; |
| | | private final TAppUserEquipmentService appUserEquipmentService; |
| | | private final TAppUserLocationService appUserLocationService; |
| | | @Autowired |
| | | public TAppUserController(TAppUserService appUserService, TokenService tokenService, PasswordEncoder passwordEncoder) { |
| | | public TAppUserController(TAppUserService appUserService, TokenService tokenService, PasswordEncoder passwordEncoder, TAppUserEquipmentService appUserEquipmentService, TAppUserLocationService appUserLocationService) { |
| | | this.appUserService = appUserService; |
| | | this.tokenService = tokenService; |
| | | this.passwordEncoder = passwordEncoder; |
| | | this.appUserEquipmentService = appUserEquipmentService; |
| | | this.appUserLocationService = appUserLocationService; |
| | | } |
| | | |
| | | /** |
| | | * 添加人员管理管理管理 |
| | | */ |
| | | @ApiOperation(value = "注册人员管理",notes = "请求参数:TAppUser对象",response = TAppUser.class) |
| | | @PostMapping(value = "/api/t-equipment/add") |
| | | @PostMapping(value = "/api/t-app-user/add") |
| | | public R<Boolean> add(@RequestBody String param) { |
| | | TAppUser dto = JSON.parseObject(param,TAppUser.class); |
| | | long count = appUserService.count(Wrappers.lambdaQuery(TAppUser.class).eq(TAppUser::getAccount, dto.getAccount())); |
| | |
| | | } |
| | | dto.setState(0); |
| | | dto.setStatus(1); |
| | | passwordEncoder.encode(dto.getPassword()); |
| | | dto.setPassword(passwordEncoder.encode(dto.getPassword())); |
| | | appUserService.save(dto); |
| | | return R.ok(); |
| | | } |
| | |
| | | * 查看人员管理详情 |
| | | */ |
| | | @ApiOperation(value = "查看人员管理详情") |
| | | @GetMapping(value = "/open/t-equipment/getDetailById") |
| | | @GetMapping(value = "/open/t-app-user/getDetailById") |
| | | public R<TAppUser> getDetailById() { |
| | | String userId = tokenService.getLoginUserApplet().getUserId(); |
| | | TAppUser appUser = appUserService.getById(userId); |
| | | 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 = "/open/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 = "/open/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(); |
| | | } |
| | | |
| | | } |
| | | |