zouxuan 5 anni fa
parent
commit
e576c8adf7

+ 1 - 1
edu-auth/edu-auth-server/src/main/java/com/keao/edu/auth/AuthServerApplication.java

@@ -16,7 +16,7 @@ import com.spring4all.swagger.EnableSwagger2Doc;
 
 @SpringBootApplication
 @EnableDiscoveryClient
-@EnableFeignClients({"com.keao.edu.auth.api.client"})
+@EnableFeignClients({"com.keao.edu"})
 @MapperScan("com.keao.edu.auth.dal.dao")
 @ComponentScan(basePackages="com.keao.edu")
 @Configuration

+ 1 - 2
edu-auth/edu-auth-server/src/main/java/com/keao/edu/auth/service/impl/SysUserServiceImpl.java

@@ -145,8 +145,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<Integer, SysUser> implem
 	@Transactional(rollbackFor = Exception.class)
 	public SysUserInfo initUser(LoginEntity loginEntity) {
 		if(StringUtils.equalsIgnoreCase(loginEntity.getClientId(),"STUDENT")){
-//			eduUserFeignService.studentApply(new Student(loginEntity.getOrganId(),loginEntity.getPhone()));
-			eduUserFeignService.getExamRoom(1);
+			eduUserFeignService.studentApply(loginEntity.getOrganId(),loginEntity.getPhone());
 			return queryUserInfoByPhone(loginEntity.getPhone());
 		}
 		throw new UsernameNotFoundException("404.9");

+ 4 - 5
edu-user/edu-user-client-api/src/main/java/com/keao/edu/user/api/client/EduUserFeignService.java

@@ -4,19 +4,18 @@ package com.keao.edu.user.api.client;
 import com.keao.edu.common.config.FeignConfiguration;
 import com.keao.edu.user.api.client.fallback.EduUserFeignServiceFallback;
 import com.keao.edu.user.api.entity.ExamRoom;
-import com.keao.edu.user.api.entity.Student;
 import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
 
-@FeignClient(name = "user-server", configuration = { FeignConfiguration.class }, fallback = EduUserFeignServiceFallback.class)
+@FeignClient(contextId = "eduUserFeignService", name = "user-server", configuration = { FeignConfiguration.class }, fallback = EduUserFeignServiceFallback.class)
 public interface EduUserFeignService {
 
 	@RequestMapping(value = "examRoom/get", method = RequestMethod.GET)
 	ExamRoom getExamRoom(Integer id);
 
-	@PostMapping(value = "student/apply", consumes = MediaType.APPLICATION_JSON_VALUE)
-	Object studentApply(Student student);
+	@PostMapping(value = "student/apply")
+	Object studentApply(@RequestParam("organId") Integer organId, @RequestParam("phone") String phone);
 }

+ 2 - 2
edu-user/edu-user-client-api/src/main/java/com/keao/edu/user/api/client/fallback/EduUserFeignServiceFallback.java

@@ -10,12 +10,12 @@ import org.springframework.web.bind.annotation.RequestParam;
 public class EduUserFeignServiceFallback implements EduUserFeignService {
 
 	@Override
-	public ExamRoom getExamRoom(@RequestParam("id") Integer id){
+	public ExamRoom getExamRoom(Integer id){
 		return null;
 	}
 
 	@Override
-	public Object studentApply(Student student) {
+	public Object studentApply(Integer organId, String phone) {
 		return null;
 	}
 

+ 1 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/UserServerApplication.java

@@ -15,7 +15,7 @@ import org.springframework.web.client.RestTemplate;
 
 @SpringBootApplication
 @EnableDiscoveryClient
-@EnableFeignClients({"com.keao.edu.user.api.client"})
+@EnableFeignClients({"com.keao.edu"})
 @MapperScan({"com.keao.edu.user.dao"})
 @ComponentScan(basePackages="com.keao.edu")
 @Configuration

+ 1 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/config/ResourceServerConfig.java

@@ -25,7 +25,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
 	@Override
 	public void configure(HttpSecurity http) throws Exception {
 		http.authorizeRequests()
-				.antMatchers("/v2/api-docs", "/su/**")
+				.antMatchers("/v2/api-docs", "/su/**","/student/apply")
 				.permitAll()
 				.anyRequest().authenticated().and().csrf().disable().exceptionHandling().accessDeniedHandler(baseAccessDeniedHandler)
 				.authenticationEntryPoint(baseAuthenticationEntryPoint).and();

+ 2 - 2
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/StudentController.java

@@ -40,8 +40,8 @@ public class StudentController extends BaseController {
 
 	@ApiOperation(value = "学员报名")
 	@PostMapping(value = "apply")
-	public HttpResponseResult apply(@RequestBody Student student) {
-		studentService.addStudent(student);
+	public HttpResponseResult apply(Integer organId,String phone) {
+		studentService.addStudent(new Student(organId,phone));
 		return succeed();
 	}
 }