|
@@ -0,0 +1,48 @@
|
|
|
+package cn.com.qmth.examcloud.core.basic.api.provider;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+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 cn.com.qmth.examcloud.commons.web.security.bean.User;
|
|
|
+import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.AuthCloudService;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.request.LoginReq;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.response.LoginResp;
|
|
|
+import cn.com.qmth.examcloud.core.basic.service.AuthService;
|
|
|
+import cn.com.qmth.examcloud.core.basic.service.bean.LoginInfo;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+
|
|
|
+@Transactional
|
|
|
+@RestController
|
|
|
+@RequestMapping("${$rmp.cloud.basic}" + "auth")
|
|
|
+public class AuthCloudServiceProvider extends ControllerSupport implements AuthCloudService {
|
|
|
+
|
|
|
+ private static final long serialVersionUID = 4189424508654646499L;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ AuthService authService;
|
|
|
+
|
|
|
+ @ApiOperation(value = "登录")
|
|
|
+ @PostMapping("login")
|
|
|
+ @Override
|
|
|
+ public LoginResp login(@RequestBody LoginReq req) {
|
|
|
+ LoginInfo loginInfo = new LoginInfo();
|
|
|
+ loginInfo.setAccountType(req.getAccountType());
|
|
|
+ loginInfo.setAccountValue(req.getAccountValue());
|
|
|
+ loginInfo.setClientIp(req.getClientIp());
|
|
|
+ loginInfo.setDomain(req.getDomain());
|
|
|
+ loginInfo.setPassword(req.getPassword());
|
|
|
+ loginInfo.setRootOrgId(req.getRootOrgId());
|
|
|
+
|
|
|
+ User user = authService.login(loginInfo);
|
|
|
+
|
|
|
+ LoginResp resp = new LoginResp();
|
|
|
+ resp.setUser(user);
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|