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.
94 lines
3.4 KiB
94 lines
3.4 KiB
package com.epmet.controller;
|
|
|
|
import com.epmet.commons.thirdplat.apiservice.jcet.JcetApiService;
|
|
import com.epmet.commons.thirdplat.bean.ThirdPlatUserInfo;
|
|
import com.epmet.commons.tools.utils.Result;
|
|
import com.epmet.commons.tools.validator.ValidatorUtils;
|
|
import com.epmet.dto.form.SsoEnteOrgFormDTO;
|
|
import com.epmet.dto.form.SsoLoginFormDTO;
|
|
import com.epmet.dto.form.SsoWorkLoginFormDTO;
|
|
import com.epmet.dto.form.SsoLoginOperFormDTO;
|
|
import com.epmet.dto.result.SsoLoginResultDTO;
|
|
import com.epmet.dto.result.UserTokenResultDTO;
|
|
import com.epmet.service.SsoService;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
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;
|
|
|
|
/**
|
|
* @Author zxc
|
|
* @DateTime 2021/1/18 下午4:33
|
|
*/
|
|
@Slf4j
|
|
@RestController
|
|
@RequestMapping("sso")
|
|
public class SsoController {
|
|
|
|
@Autowired
|
|
private SsoService ssoService;
|
|
|
|
@Autowired
|
|
private JcetApiService jcetApiService;
|
|
|
|
/**
|
|
* @Description 0、泸州app登陆入口:得到token
|
|
* @Param formDTO
|
|
* @author zxc
|
|
* @date 2021/1/18 下午4:59
|
|
*/
|
|
@PostMapping("resi/login")
|
|
public Result<SsoLoginResultDTO> ssoResiLogin(@RequestBody SsoLoginFormDTO formDTO){
|
|
ValidatorUtils.validateEntity(formDTO, SsoLoginFormDTO.SsoLoginForm.class);
|
|
return new Result<SsoLoginResultDTO>().ok(ssoService.ssoResiLogin(formDTO));
|
|
}
|
|
|
|
/**
|
|
* @Description 0、第三方系统跳转至 运营平台登陆接口
|
|
* @Param formDTO
|
|
* @author zxc
|
|
* @date 2021/1/18 下午4:59
|
|
*/
|
|
@PostMapping("oper/third/login")
|
|
public Result<UserTokenResultDTO> thirdLoginOper(@RequestBody SsoLoginOperFormDTO formDTO) {
|
|
ValidatorUtils.validateEntity(formDTO, SsoLoginOperFormDTO.ThirdPlatformLoginForm.class);
|
|
return new Result<UserTokenResultDTO>().ok(ssoService.thirdLoginOperWork(formDTO));
|
|
}
|
|
|
|
@PostMapping("test")
|
|
public Result<ThirdPlatUserInfo> testssoLogin() {
|
|
ThirdPlatUserInfo userInfoByTicket = null;
|
|
try {
|
|
userInfoByTicket = jcetApiService.getCUserInfoByTicket("ssoTicket-vYtMRuXAQZri3wpA2vyq5D8n3Q9oO7ui");
|
|
} catch (Exception e) {
|
|
log.error("method exception", e);
|
|
}
|
|
return new Result<ThirdPlatUserInfo>().ok(userInfoByTicket);
|
|
}
|
|
|
|
/**
|
|
* @param formDTO
|
|
* @Author sun
|
|
* @Description 1、ticket自动登录获取内部token
|
|
**/
|
|
@PostMapping("work/login")
|
|
public Result<UserTokenResultDTO> ssoWorkLogin(@RequestBody SsoWorkLoginFormDTO formDTO){
|
|
ValidatorUtils.validateEntity(formDTO, SsoWorkLoginFormDTO.SsoLoginForm.class);
|
|
return new Result<UserTokenResultDTO>().ok(ssoService.ssoWorkLogin(formDTO));
|
|
}
|
|
|
|
/**
|
|
* @param formDTO
|
|
* @Author sun
|
|
* @Description 4、自动进入组织-返回token
|
|
**/
|
|
@PostMapping(value = "work/enterorg")
|
|
public Result<UserTokenResultDTO> enterOrg(@RequestBody SsoEnteOrgFormDTO formDTO) {
|
|
ValidatorUtils.validateEntity(formDTO, SsoEnteOrgFormDTO.AddUserShowGroup.class, SsoEnteOrgFormDTO.AddUserInternalGroup.class);
|
|
UserTokenResultDTO userTokenResultDTO = ssoService.enterOrg(formDTO);
|
|
return new Result<UserTokenResultDTO>().ok(userTokenResultDTO);
|
|
}
|
|
|
|
}
|
|
|