|
|
|
package com.epmet.controller;
|
|
|
|
|
|
|
|
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.PasswordLoginUserInfoFormDTO;
|
|
|
|
import com.epmet.dto.form.WxLoginUserInfoFormDTO;
|
|
|
|
import com.epmet.dto.form.WxUserInfoFormDTO;
|
|
|
|
import com.epmet.dto.result.PasswordLoginUserInfoResultDTO;
|
|
|
|
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(TokenDto tokenDTO, @RequestBody WxUserInfoFormDTO wxUserInfoFormDTO) {
|
|
|
|
wxUserInfoFormDTO.setUserId(tokenDTO.getUserId());
|
|
|
|
ValidatorUtils.validateEntity(wxUserInfoFormDTO);
|
|
|
|
return userService.updateWxUserInfo(wxUserInfoFormDTO);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|