parent
9c02190fa3
commit
7cba3f7335
@ -1,46 +1,27 @@
|
||||
package ${domain}.action;
|
||||
package com.example.action;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
<#list modules as m>
|
||||
import ${domain}.module.${m.moduleName}.req.*;
|
||||
import ${domain}.module.${m.moduleName}.mgr.*;
|
||||
</#list>
|
||||
import ${domain}.frame.auth.LocalData;
|
||||
import ${domain}.frame.utils.MapperUtil;
|
||||
import ${domain}.frame.utils.Message;
|
||||
import ${domain}.frame.base.BaseResponse;
|
||||
import ${domain}.frame.base.ErrorType;
|
||||
import ${domain}.frame.auth.Token;
|
||||
import ${domain}.frame.utils.LogUtil;
|
||||
import ${domain}.frame.base.Error;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import com.example.frame.base.BaseResponse;
|
||||
import com.example.module.wsys.rsp.UserFindResponse;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
@Controller
|
||||
@ResponseBody
|
||||
@RestController
|
||||
@RequestMapping("/feign")
|
||||
public class FeignController {
|
||||
<#list modules as m>
|
||||
<#list m.tables as table>
|
||||
@Autowired
|
||||
private ${table.getCName()}Manager ${table.getFName()}Manager;
|
||||
</#list>
|
||||
</#list>
|
||||
|
||||
@RequestMapping(value = "/user/create", method = RequestMethod.POST)
|
||||
public BaseResponse d(@RequestBody NewTableGetRequest asd) {
|
||||
@RequestMapping("/{module}/{target}/{method}")
|
||||
public BaseResponse find(
|
||||
@PathVariable String module,
|
||||
@PathVariable String target,
|
||||
@PathVariable String method,
|
||||
@RequestHeader String token,
|
||||
@RequestBody String data) {
|
||||
|
||||
return newTableGetResponse;
|
||||
System.out.println("===========");
|
||||
return new UserFindResponse();
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package ${domain}.action.control;
|
||||
package ${domain}.action.page.control;
|
||||
|
||||
import ${domain}.frame.base.Control;
|
||||
import org.springframework.ui.Model;
|
@ -1,4 +1,4 @@
|
||||
package ${domain}.action.screen;
|
||||
package ${domain}.action.page.screen;
|
||||
|
||||
import ${domain}.frame.base.Screen;
|
||||
import ${domain}.frame.auth.LocalData;
|
@ -0,0 +1,17 @@
|
||||
package com.example.config;
|
||||
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@Configuration
|
||||
public class CloudConfig {
|
||||
|
||||
@Bean
|
||||
@LoadBalanced
|
||||
public RestTemplate restTemplate() {
|
||||
return new RestTemplate();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.example.module.wsys.svr;
|
||||
|
||||
import com.example.frame.auth.Token;
|
||||
import com.example.module.wsys.req.UserFindRequest;
|
||||
import com.example.module.wsys.rsp.UserFindResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@Service
|
||||
public class UserService {
|
||||
|
||||
@Autowired
|
||||
RestTemplate restTemplate;
|
||||
|
||||
@RequestMapping("/user/find")
|
||||
public UserFindResponse find(UserFindRequest request, @RequestParam(name = "token") Token token) {
|
||||
UserFindRequest userFindRequest = new UserFindRequest();
|
||||
userFindRequest.setUserName("AAAAAAAAAAAA");
|
||||
userFindRequest.setPageNumber(2);
|
||||
|
||||
//请求地址
|
||||
String url = "http://EXAMPLE-WEB/feign/wsys/user/find";
|
||||
//入参
|
||||
|
||||
UserFindResponse userFindResponse = restTemplate.postForObject(url, userFindRequest, UserFindResponse.class);
|
||||
return userFindResponse;
|
||||
}
|
||||
}
|
Loading…
Reference in new issue