You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
169 lines
5.8 KiB
169 lines
5.8 KiB
package com.epmet.controller;
|
|
|
|
import com.epmet.commons.tools.annotation.LoginUser;
|
|
import com.epmet.commons.tools.security.dto.TokenDto;
|
|
import com.epmet.commons.tools.utils.Result;
|
|
import com.epmet.commons.tools.validator.ValidatorUtils;
|
|
import com.epmet.commons.tools.validator.group.AddGroup;
|
|
import com.epmet.commons.tools.validator.group.DefaultGroup;
|
|
import com.epmet.dto.UserDTO;
|
|
import com.epmet.dto.UserWechatDTO;
|
|
import com.epmet.dto.form.*;
|
|
import com.epmet.dto.result.*;
|
|
import com.epmet.service.UserService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
/**
|
|
* @Description
|
|
* @Author yinzuomei
|
|
* @Date 2020/3/30 12:42
|
|
*/
|
|
@RestController
|
|
@RequestMapping("user")
|
|
public class UserController {
|
|
@Autowired
|
|
private UserService userService;
|
|
|
|
|
|
/**
|
|
* @param formDTO
|
|
* @return com.epmet.commons.tools.utils.Result
|
|
* @Author yinzuomei
|
|
* @Description 根据openId、app查询对应终端用户信息
|
|
* @Date 2020/3/16 16:15
|
|
**/
|
|
@PostMapping("selecWxLoginUserInfo")
|
|
public Result<UserDTO> selecWxLoginUserInfo(@RequestBody WxLoginUserInfoFormDTO formDTO){
|
|
ValidatorUtils.validateEntity(formDTO);
|
|
return userService.selecWxLoginUserInfo(formDTO);
|
|
}
|
|
|
|
|
|
/**
|
|
* @param userWechatDTO
|
|
* @return 将获取到的居民微信信息,保存到user_wechat表,返回主键
|
|
* @Author yinzuomei
|
|
* @Description
|
|
* @Date 2020/3/16 15:49
|
|
**/
|
|
@PostMapping("saveOrUpdateUserWechatDTO")
|
|
public Result<UserDTO> saveOrUpdateUserWechatDTO(@RequestBody UserWechatDTO userWechatDTO) {
|
|
//效验数据
|
|
ValidatorUtils.validateEntity(userWechatDTO, AddGroup.class, DefaultGroup.class);
|
|
return userService.saveOrUpdateUserWechatDTO(userWechatDTO);
|
|
}
|
|
|
|
/**
|
|
* @param passwordLoginUserInfoFormDTO
|
|
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.PasswordLoginUserInfoResultDTO>
|
|
* @Author yinzuomei
|
|
* @Description 根据手机号、app获取对应终端用户信息
|
|
* @Date 2020/3/16 16:15
|
|
**/
|
|
@PostMapping("selectLoginUserInfoByPassword")
|
|
public Result<PasswordLoginUserInfoResultDTO> selectLoginUserInfoByPassword(@RequestBody PasswordLoginUserInfoFormDTO passwordLoginUserInfoFormDTO) {
|
|
//效验数据
|
|
ValidatorUtils.validateEntity(passwordLoginUserInfoFormDTO);
|
|
Result<PasswordLoginUserInfoResultDTO> result= userService.selectLoginUserInfoByPassword(passwordLoginUserInfoFormDTO);
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* @param wxUserInfoFormDTO
|
|
* @Author sun
|
|
* @Description 居民端个人信息-同步用户微信信息
|
|
**/
|
|
@PostMapping("updatewxuserinfo")
|
|
public Result updateWxUserInfo(@LoginUser TokenDto tokenDTO, @RequestBody WxUserInfoFormDTO wxUserInfoFormDTO) {
|
|
wxUserInfoFormDTO.setUserId(tokenDTO.getUserId());
|
|
ValidatorUtils.validateEntity(wxUserInfoFormDTO);
|
|
return userService.updateWxUserInfo(wxUserInfoFormDTO);
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @Description 查询用户注册时间
|
|
* @Author zxc
|
|
* @CreatedTime 2020/4/27 16:14
|
|
*/
|
|
@PostMapping("selectcreatedtimebyuserid")
|
|
public Result<CreatedTimeByUserIdResultDTO> createdTimeByUserId(@RequestBody CreatedTimeByUserIdFormDTO formDTO){
|
|
return new Result<CreatedTimeByUserIdResultDTO>().ok(userService.createdTimeByUserId(formDTO));
|
|
}
|
|
|
|
/**
|
|
* @Description 居民端获取个人信息
|
|
* @param myResiUserInfoFormDTO
|
|
* @return MyResiUserInfoResultDTO
|
|
* @author wangc
|
|
* @date 2020.05.22 19:24
|
|
**/
|
|
@PostMapping("resimyselfmsg")
|
|
public Result<MyResiUserInfoResultDTO> resiMyselfMsg(@RequestBody MyResiUserInfoFormDTO myResiUserInfoFormDTO){
|
|
ValidatorUtils.validateEntity(myResiUserInfoFormDTO);
|
|
return new Result<MyResiUserInfoResultDTO>().ok(userService.resiMyselfMsg(myResiUserInfoFormDTO));
|
|
}
|
|
|
|
/**
|
|
* 从缓存中查询已登录用户的基本信息以及角色等相关信息
|
|
* @return
|
|
*/
|
|
@PostMapping("loginuserdetails")
|
|
public Result<LoginUserDetailsResultDTO> getLoginUserDetails(@RequestBody LoginUserDetailsFormDTO dto) {
|
|
ValidatorUtils.validateEntity(dto, StaffPermCacheFormDTO.GetStaffCurrPermissions.class);
|
|
LoginUserDetailsResultDTO govTokenDto = userService.getLoginUserDetails(dto.getApp(), dto.getClient(), dto.getUserId());
|
|
return new Result<LoginUserDetailsResultDTO>().ok(govTokenDto);
|
|
}
|
|
|
|
/**
|
|
* @param formDTO
|
|
* @Author sun
|
|
* @Description 小程序微信用户登陆,新增或更新用户信息
|
|
**/
|
|
@PostMapping("savewxuser")
|
|
public Result<UserDTO> saveWxUser(@RequestBody WxUserFormDTO formDTO){
|
|
return new Result<UserDTO>().ok(userService.saveWxUser(formDTO));
|
|
}
|
|
|
|
/**
|
|
* 居民端个人信息-同步用户微信信息
|
|
* 供Feign调用
|
|
*
|
|
* @param wxUserInfoFormDTO
|
|
* @return com.epmet.commons.tools.utils.Result
|
|
* @Author zhangyong
|
|
* @Date 14:51 2020-07-23
|
|
**/
|
|
@PostMapping("updateUserBaseAndWxUserInfo")
|
|
public Result updateUserBaseAndWxUserInfo(@RequestBody WxUserInfoFormDTO wxUserInfoFormDTO) {
|
|
ValidatorUtils.validateEntity(wxUserInfoFormDTO);
|
|
return userService.updateWxUserInfo(wxUserInfoFormDTO);
|
|
}
|
|
|
|
/**
|
|
* @Author sun
|
|
* @Description 居民端-查询用户基础信息 返回值只有userId 、openId
|
|
**/
|
|
@PostMapping("getuserbasicinfo")
|
|
public Result<UserBasicInfo> getUserBasicInfo(@RequestBody UserBasicInfoFormDTO formDTO){
|
|
ValidatorUtils.validateEntity(formDTO, UserBasicInfoFormDTO.UserBasicInfoGroup.class);
|
|
return new Result<UserBasicInfo>().ok(userService.getUserBasicInfo(formDTO));
|
|
}
|
|
|
|
/**
|
|
* @Description 新增或更新用户信息
|
|
* @Param formDTO
|
|
* @author zxc
|
|
* @date 2021/1/19 上午10:35
|
|
*/
|
|
@PostMapping("saveuserinfo")
|
|
public Result<UserDTO> saveUserInfo(@RequestBody UserInfoFormDTO formDTO){
|
|
ValidatorUtils.validateEntity(formDTO, UserInfoFormDTO.UserInfoForm.class);
|
|
return new Result<UserDTO>().ok(userService.saveUserInfo(formDTO));
|
|
}
|
|
|
|
}
|
|
|