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 List<String> domainList;
private Tool tool = new Tool(); private Tool tool = new Tool();
File domain; File domain;
File frame;
File testdomain; File testdomain;
private FreeMarkerManager freeMarkerManager; private FreeMarkerManager freeMarkerManager;
@ -65,8 +66,8 @@ public class ApiCallable implements Callable {
sbtest.append(s1 + File.separator); sbtest.append(s1 + File.separator);
} }
domain = new File(sbmain.toString()); domain = Tool.createPath(sbmain.toString(),"module");
domain.mkdirs(); frame = Tool.createPath(sbmain.toString(),"frame");
testdomain = new File(sbtest.toString()); testdomain = new File(sbtest.toString());
testdomain.mkdirs(); testdomain.mkdirs();
@ -102,77 +103,77 @@ public class ApiCallable implements Callable {
HashMap<String, Object> ctx = new HashMap<String, Object>(); HashMap<String, Object> ctx = new HashMap<String, Object>();
ctx.put("domain", String.join(".", domainList)); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); freeMarkerManager.outputTemp(file, "/Java_api/StringUtils.java", ctx);
} }
@ -215,9 +216,10 @@ public class ApiCallable implements Callable {
} }
List<String> entNames = new ArrayList<>(); List<String> entNames = new ArrayList<>();
for (String s : reader.getDeptEntList()) { for (String entName : reader.getDeptEntList()) {
if (entName.matches("(.*\\.ent)\\.(.*)")){
Pattern compile = Pattern.compile("(.*\\.ent)\\.(.*)"); Pattern compile = Pattern.compile("(.*\\.ent)\\.(.*)");
Matcher matcher = compile.matcher(s); Matcher matcher = compile.matcher(entName);
if (matcher.find()) { if (matcher.find()) {
String EntName = matcher.group(2); String EntName = matcher.group(2);
@ -229,6 +231,14 @@ public class ApiCallable implements Callable {
generateEntity(entReader); 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<>(); List<String> reqNames = new ArrayList<>();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -1,4 +1,4 @@
package ${domain}; package ${domain}.frame;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.wb.api.auth.request.LoginRequest; 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.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;

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

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

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

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

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

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

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

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

Loading…
Cancel
Save

Powered by TurnKey Linux.