Former-commit-id: 8b466082d199ce5f8eea016fed5ea1b8627677f7
master
wangbing 5 years ago
parent 8082a597e0
commit fe4729845f

@ -27,6 +27,7 @@ public class ApiCallable implements Callable {
private List<String> domainList;
private Tool tool = new Tool();
File domain;
File frame;
File testdomain;
private FreeMarkerManager freeMarkerManager;
@ -65,8 +66,8 @@ public class ApiCallable implements Callable {
sbtest.append(s1 + File.separator);
}
domain = new File(sbmain.toString());
domain.mkdirs();
domain = Tool.createPath(sbmain.toString(),"module");
frame = Tool.createPath(sbmain.toString(),"frame");
testdomain = new File(sbtest.toString());
testdomain.mkdirs();
@ -102,77 +103,77 @@ public class ApiCallable implements Callable {
HashMap<String, Object> ctx = new HashMap<String, Object>();
ctx.put("domain", String.join(".", domainList));
{
File file = new File(domain, "ApiEntity.java");
File file = new File(frame, "ApiEntity.java");
freeMarkerManager.outputTemp(file, "/Java_api/ApiEntity.java", ctx);
}
{
File file = new File(domain, "AESUtil.java");
File file = new File(frame, "AESUtil.java");
freeMarkerManager.outputTemp(file, "/Java_api/AESUtil.java", ctx);
}
{
File file = new File(domain, "ApiClient.java");
File file = new File(frame, "ApiClient.java");
freeMarkerManager.outputTemp(file, "/Java_api/ApiClient.java", ctx);
}
{
File file = new File(domain, "ApiRequest.java");
File file = new File(frame, "ApiRequest.java");
freeMarkerManager.outputTemp(file, "/Java_api/ApiRequest.java", ctx);
}
{
File file = new File(domain, "ApiFindRequest.java");
File file = new File(frame, "ApiFindRequest.java");
freeMarkerManager.outputTemp(file, "/Java_api/ApiFindRequest.java", ctx);
}
{
File file = new File(domain, "ApiSearchRequest.java");
File file = new File(frame, "ApiSearchRequest.java");
freeMarkerManager.outputTemp(file, "/Java_api/ApiSearchRequest.java", ctx);
}
{
File file = new File(domain, "ApiResponse.java");
File file = new File(frame, "ApiResponse.java");
freeMarkerManager.outputTemp(file, "/Java_api/ApiResponse.java", ctx);
}
{
File file = new File(domain, "ApiFindResponse.java");
File file = new File(frame, "ApiFindResponse.java");
freeMarkerManager.outputTemp(file, "/Java_api/ApiFindResponse.java", ctx);
}
{
File file = new File(domain, "Base64Util.java");
File file = new File(frame, "Base64Util.java");
freeMarkerManager.outputTemp(file, "/Java_api/Base64Util.java", ctx);
}
{
File file = new File(domain, "DownloadUtil.java");
File file = new File(frame, "DownloadUtil.java");
freeMarkerManager.outputTemp(file, "/Java_api/DownloadUtil.java", ctx);
}
{
File file = new File(domain, "Error.java");
File file = new File(frame, "Error.java");
freeMarkerManager.outputTemp(file, "/Java_api/Error.java", ctx);
}
{
File file = new File(domain, "ErrorType.java");
File file = new File(frame, "ErrorType.java");
freeMarkerManager.outputTemp(file, "/Java_api/ErrorType.java", ctx);
}
{
File file = new File(domain, "MapperUtil.java");
File file = new File(frame, "MapperUtil.java");
freeMarkerManager.outputTemp(file, "/Java_api/MapperUtil.java", ctx);
}
{
File file = new File(domain, "MD5Util.java");
File file = new File(frame, "MD5Util.java");
freeMarkerManager.outputTemp(file, "/Java_api/MD5Util.java", ctx);
}
{
File file = new File(domain, "RSAUtil.java");
File file = new File(frame, "RSAUtil.java");
freeMarkerManager.outputTemp(file, "/Java_api/RSAUtil.java", ctx);
}
{
File file = new File(domain, "ProgressRequestBody.java");
File file = new File(frame, "ProgressRequestBody.java");
freeMarkerManager.outputTemp(file, "/Java_api/ProgressRequestBody.java", ctx);
}
{
File file = new File(domain, "SortType.java");
File file = new File(frame, "SortType.java");
freeMarkerManager.outputTemp(file, "/Java_api/SortType.java", ctx);
}
{
File file = new File(domain, "StringUtils.java");
File file = new File(frame, "StringUtils.java");
freeMarkerManager.outputTemp(file, "/Java_api/StringUtils.java", ctx);
}
@ -215,20 +216,29 @@ public class ApiCallable implements Callable {
}
List<String> entNames = new ArrayList<>();
for (String s : reader.getDeptEntList()) {
Pattern compile = Pattern.compile("(.*\\.ent)\\.(.*)");
Matcher matcher = compile.matcher(s);
for (String entName : reader.getDeptEntList()) {
if (entName.matches("(.*\\.ent)\\.(.*)")){
Pattern compile = Pattern.compile("(.*\\.ent)\\.(.*)");
Matcher matcher = compile.matcher(entName);
if (matcher.find()) {
String EntName = matcher.group(2);
entNames.add(EntName);
if (matcher.find()) {
String EntName = matcher.group(2);
entNames.add(EntName);
List<File> files = Tool.findEntity(this.module, EntName + ".java");
List<File> files = Tool.findEntity(this.module, EntName + ".java");
for (File file : files) {
EntityReader entReader = new EntityReader(file);
generateEntity(entReader);
}
}
}else {
List<File> files = Tool.findEntity(this.module, entName + ".java");
for (File file : files) {
EntityReader entReader = new EntityReader(file);
generateEntity(entReader);
}
}
}
List<String> reqNames = new ArrayList<>();

@ -1,4 +1,4 @@
package ${domain};
package ${domain}.frame;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;

@ -1,4 +1,4 @@
package ${domain};
package ${domain}.frame;
import okhttp3.*;

@ -1,4 +1,4 @@
package ${domain};
package ${domain}.frame;
import java.util.Date;

@ -1,4 +1,4 @@
package ${domain};
package ${domain}.frame;
/**
* ApiFindRequest -

@ -1,4 +1,4 @@
package ${domain};
package ${domain}.frame;
import java.util.List;

@ -1,4 +1,4 @@
package ${domain};
package ${domain}.frame;
/**
* ApiRequest -

@ -1,4 +1,4 @@
package ${domain};
package ${domain}.frame;
import java.io.Serializable;
import java.util.ArrayList;

@ -1,4 +1,4 @@
package ${domain};
package ${domain}.frame;
/**
* ApiSearchRequest -

@ -1,8 +1,8 @@
package ${domain};
<#list modules as module>
import ${domain}.${module}.req.*;
import ${domain}.${module}.rsp.*;
import ${domain}.module.${module}.req.*;
import ${domain}.module.${module}.rsp.*;
</#list>
import org.junit.Assert;
import org.junit.Before;

@ -1,4 +1,4 @@
package ${domain};
package ${domain}.frame;
import java.util.Arrays;

@ -1,4 +1,4 @@
package ${domain};
package ${domain}.frame;
import okhttp3.*;

@ -1,4 +1,4 @@
package ${domain};
package ${domain}.frame;
public class Error {
private ErrorType type;

@ -1,4 +1,4 @@
package ${domain};
package ${domain}.frame;
public enum ErrorType {
BUSINESS_ERROR,

@ -1,4 +1,4 @@
package ${domain};
package ${domain}.frame;
import com.fasterxml.jackson.core.TreeNode;
import java.security.MessageDigest;

@ -1,4 +1,4 @@
package ${domain};
package ${domain}.frame;
import com.alibaba.fastjson.JSON;
import com.wb.api.auth.request.LoginRequest;

@ -1,4 +1,4 @@
package ${domain};
package ${domain}.frame;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;

@ -1,4 +1,4 @@
package ${domain};
package ${domain}.frame;
import okhttp3.MediaType;
import okhttp3.MultipartBody;

@ -1,4 +1,4 @@
package ${domain};
package ${domain}.frame;
import javax.crypto.Cipher;
import java.io.ByteArrayOutputStream;

@ -1,4 +1,4 @@
package ${domain};
package ${domain}.frame;
/**
* SortType -

@ -1,4 +1,4 @@
package ${domain};
package ${domain}.frame;
public class StringUtils {
private StringUtils() {

@ -1,4 +1,4 @@
package ${domain};
package ${domain}.frame;
import javax.validation.ConstraintViolation;
import javax.validation.Validation;

@ -1,9 +1,9 @@
package ${domain}.${module}.ent;
package ${domain}.module.${module}.ent;
<#list importList as i>
${i}
</#list>
import ${domain}.ApiEntity;
import ${domain}.frame.ApiEntity;
<#list annotation as i>
${i}

@ -1,19 +1,19 @@
package ${domain}.${module}.req;
package ${domain}.module.${module}.req;
<#list importList as i>
${i}
</#list>
<#list entNames as entName>
import ${domain}.${module}.ent.${entName};
import ${domain}.module.${module}.ent.${entName};
</#list>
<#if !isTempReq>
import ${domain}.${module}.rsp.${rspClassName};
import ${domain}.module.${module}.rsp.${rspClassName};
</#if>
import ${domain}.ApiRequest;
import ${domain}.frame.ApiRequest;
<#if findOrSearchflag=='1'>
import ${domain}.ApiFindRequest;
import ${domain}.frame.ApiFindRequest;
<#elseif findOrSearchflag=='2'>
import ${domain}.ApiSearchRequest;
import ${domain}.frame.ApiSearchRequest;
</#if>
<#list annotation as i>

@ -1,15 +1,15 @@
package ${domain}.${module}.rsp;
package ${domain}.module.${module}.rsp;
<#list importList as i>
${i}
</#list>
<#list entNames as entName>
import ${domain}.${module}.ent.${entName};
import ${domain}.module.${module}.ent.${entName};
</#list>
<#if hasList>
import ${domain}.ApiFindResponse;
import ${domain}.frame.ApiFindResponse;
<#else>
import ${domain}.ApiResponse;
import ${domain}.frame.ApiResponse;
</#if>
<#list annotation as i>

Loading…
Cancel
Save

Powered by TurnKey Linux.