日照智慧社区接口服务
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.
 
 
 
 
 

67 lines
2.3 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.SsoLoginFormDTO;
import com.epmet.dto.form.SsoLoginOperFormDTO;
import com.epmet.dto.result.SsoLoginResultDTO;
import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.service.SsoService;
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
*/
@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> ssoLogin(@RequestBody SsoLoginFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, SsoLoginFormDTO.SsoLoginForm.class);
return new Result<SsoLoginResultDTO>().ok(ssoService.ssoLogin(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.thirdLoginOper(formDTO));
}
@PostMapping("test")
public Result<ThirdPlatUserInfo> testssoLogin() {
ThirdPlatUserInfo userInfoByTicket = null;
try {
userInfoByTicket = jcetApiService.getUserInfoByTicket("ssoTicket-vYtMRuXAQZri3wpA2vyq5D8n3Q9oO7ui");
} catch (Exception e) {
e.printStackTrace();
}
return new Result<ThirdPlatUserInfo>().ok(userInfoByTicket);
}
}