forked from rongchao/epmet-cloud-rizhao
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.
119 lines
4.2 KiB
119 lines
4.2 KiB
package com.epmet.controller;
|
|
|
|
import com.epmet.commons.tools.utils.Result;
|
|
import com.epmet.commons.tools.validator.ValidatorUtils;
|
|
import com.epmet.dto.form.*;
|
|
import com.epmet.dto.result.StaffOrgsResultDTO;
|
|
import com.epmet.dto.result.UserTokenResultDTO;
|
|
import com.epmet.service.ThirdLoginService;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
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;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* @Description 第三方-居民端、政府端登陆服务
|
|
* @author sun
|
|
*/
|
|
@RestController
|
|
@RequestMapping("thirdlogin")
|
|
public class ThirdLoginController {
|
|
|
|
@Autowired
|
|
private ThirdLoginService thirdLoginService;
|
|
|
|
/**
|
|
* @param formDTO
|
|
* @return
|
|
* @Author sun
|
|
* @Description 单客户-居民端微信小程序登录
|
|
**/
|
|
@PostMapping("resilogin")
|
|
public Result<UserTokenResultDTO> resiLogin(@RequestBody LoginFormDTO formDTO) {
|
|
ValidatorUtils.validateEntity(formDTO);
|
|
return new Result<UserTokenResultDTO>().ok(thirdLoginService.resiLogin(formDTO));
|
|
}
|
|
|
|
/**
|
|
* @param formDTO
|
|
* @return
|
|
* @Author sun
|
|
* @Description 单客户-政府端微信小程序登录
|
|
**/
|
|
@PostMapping("worklogin")
|
|
public Result<UserTokenResultDTO> workLogin(@RequestBody LoginFormDTO formDTO) {
|
|
ValidatorUtils.validateEntity(formDTO);
|
|
return new Result<UserTokenResultDTO>().ok(thirdLoginService.workLogin(formDTO));
|
|
}
|
|
|
|
/**
|
|
* @param formDTO
|
|
* @return
|
|
* @Author sun
|
|
* @Description 单客户-选择组织,进入首页
|
|
**/
|
|
@PostMapping(value = "enterorg")
|
|
public Result<UserTokenResultDTO> enterOrg(@RequestBody ThirdWxmpEnteOrgFormDTO formDTO) {
|
|
ValidatorUtils.validateEntity(formDTO,ThirdWxmpEnteOrgFormDTO.AddUserShowGroup.class,ThirdWxmpEnteOrgFormDTO.AddUserInternalGroup.class);
|
|
UserTokenResultDTO userTokenResultDTO=thirdLoginService.enterOrg(formDTO);
|
|
return new Result<UserTokenResultDTO>().ok(userTokenResultDTO);
|
|
}
|
|
|
|
/**
|
|
* @param formDTO
|
|
* @return
|
|
* @Author sun
|
|
* @Description 单客户-手机验证码获取组织
|
|
**/
|
|
@PostMapping(value = "/getmyorg")
|
|
public Result<List<StaffOrgsResultDTO>> getmyorg(@RequestBody ThirdStaffOrgsFormDTO formDTO) {
|
|
ValidatorUtils.validateEntity(formDTO, StaffOrgsFormDTO.AddUserShowGroup.class, StaffOrgsFormDTO.GetMyOrgByLoginWxmp.class);
|
|
List<StaffOrgsResultDTO> staffOrgs = thirdLoginService.getMyOrg(formDTO);
|
|
return new Result<List<StaffOrgsResultDTO>>().ok(staffOrgs);
|
|
}
|
|
|
|
/**
|
|
* @param formDTO
|
|
* @return
|
|
* @author sun
|
|
* @description 单客户-手机号密码获取组织
|
|
**/
|
|
@PostMapping(value = "/getmyorgbypassword")
|
|
public Result<List<StaffOrgsResultDTO>> getMyOrgByPassword(@RequestBody ThirdStaffOrgsFormDTO formDTO) {
|
|
ValidatorUtils.validateEntity(formDTO, StaffOrgsFormDTO.AddUserShowGroup.class, StaffOrgsFormDTO.GetMyOrgByPassWordGroup.class);
|
|
List<StaffOrgsResultDTO> staffOrgs = thirdLoginService.getMyOrgByPassword(formDTO);
|
|
return new Result<List<StaffOrgsResultDTO>>().ok(staffOrgs);
|
|
}
|
|
|
|
/**
|
|
* @param formDTO
|
|
* @return
|
|
* @author sun
|
|
* @description 单客户-获取微信用户手机号
|
|
**/
|
|
@PostMapping("getresiwxphone")
|
|
public Result getResiWxPhone(@RequestBody GetResiWxPhoneFormDTO formDTO) {
|
|
String phone = thirdLoginService.getResiWxPhone(formDTO);
|
|
if (StringUtils.isNotBlank(phone) && !"null".equals(phone)) {
|
|
return new Result().ok(phone);
|
|
}
|
|
return new Result().ok("");
|
|
}
|
|
|
|
/**
|
|
* @param formDTO
|
|
* @author sun
|
|
* @description 单客户-工作端微信小程序登录-发送验证码
|
|
**/
|
|
@PostMapping(value = "sendsmscode")
|
|
public Result sendSmsCode(@RequestBody ThirdSendSmsCodeFormDTO formDTO) {
|
|
ValidatorUtils.validateEntity(formDTO,ThirdSendSmsCodeFormDTO.AddUserShowGroup.class);
|
|
thirdLoginService.sendSmsCode(formDTO);
|
|
return new Result();
|
|
}
|
|
|
|
}
|
|
|