master
王兵 4 years ago
parent 9c02190fa3
commit 7cba3f7335

@ -98,7 +98,7 @@
GridPane.valignment="CENTER">
<children>
<CheckBox fx:id="needMordDB" selected="false" text="多数据库"/>
<CheckBox fx:id="needCloud" selected="false" text="添加Cloud"/>
<CheckBox fx:id="needCloud" selected="false" text="启用微服"/>
<CheckBox fx:id="needAsync" selected="false" text="异步编程"/>
<CheckBox fx:id="needMail" selected="false" text="发送邮件"/>
</children>

@ -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;

@ -45,8 +45,8 @@ public class ActionConfig implements BeanDefinitionRegistryPostProcessor {
Matcher matcher = compile.matcher(aPackage);
if (matcher.find()) {
String domain = matcher.group(1);
registryScreen(domain + ".action.screen", beanDefinitionRegistry);
registryControl(domain + ".action.control", beanDefinitionRegistry);
registryScreen(domain + ".action.page.screen", beanDefinitionRegistry);
registryControl(domain + ".action.page.control", beanDefinitionRegistry);
registryAjax(domain + ".action.ajax", beanDefinitionRegistry);
registryApi(domain + ".action.api", beanDefinitionRegistry);
}

@ -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();
}
}

@ -27,7 +27,7 @@ public class LocalData {
system = new Token();
system.setId(0);
system.setUserId(0);
system.setUserName("wsys");
system.setUserName("system");
system.putRes(".*");
}

@ -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;
}
}

@ -108,23 +108,26 @@
</dependency>
</#if>
<#if project.needCloud>
<!-- SpringCloud客户端 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
<version>2.1.2.RELEASE</version>
</dependency>
<!-- SpringCloud负载均衡 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix-ribbon</artifactId>
<verison>2.1.2.RELEASE</verison>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-openfeign</artifactId>
<verison>2.1.2.RELEASE</verison>
<version>2.1.2.RELEASE</version>
</dependency>
<#-- SpringCloud微服务通信 -->
<#--<dependency>-->
<#--<groupId>org.springframework.cloud</groupId>-->
<#--<artifactId>spring-cloud-starter-openfeign</artifactId>-->
<#--<version>2.1.2.RELEASE</version>-->
<#--</dependency>-->
</#if>
<#if dataBase == 'MySQL'>

@ -7,6 +7,7 @@ spring.application.name=${project.name?default("SpringBoot")}
spring.main.banner-mode=CONSOLE
spring.devtools.restart.enabled=true
<#if project.needCloud>
eureka.client.fetch-registry=true
eureka.client.serviceUrl.defaultZone=http://localhost:18080/eureka/
</#if>
# 编码配置

@ -7,6 +7,7 @@ spring.application.name=${project.name}
spring.main.banner-mode=off
spring.devtools.restart.enabled=false
<#if project.needCloud>
eureka.client.fetch-registry=true
eureka.client.serviceUrl.defaultZone=http://localhost:18080/eureka/
</#if>
# 编码配置

Loading…
Cancel
Save

Powered by TurnKey Linux.