|
@@ -33,6 +33,7 @@ public class PdfBuilderTest {
|
|
|
private Map<String, Object> parameters;
|
|
|
|
|
|
private SectionView section1;
|
|
|
+ private SectionView section2;
|
|
|
|
|
|
public class Pair {
|
|
|
public Pair(String key, String value) {
|
|
@@ -74,8 +75,8 @@ public class PdfBuilderTest {
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
- public Map<String, String> getKeyValues() {
|
|
|
- HashMap<String, String> ret = new HashMap<>();
|
|
|
+ public Map<String, Object> getKeyValues() {
|
|
|
+ HashMap<String, Object> ret = new HashMap<>();
|
|
|
ret.put(String.format("%s__seq", this.seq), this.seq);
|
|
|
ret.put(String.format("%s__title", this.seq), this.title);
|
|
|
for(int i = 0; i < data.size(); i++) {
|
|
@@ -91,6 +92,64 @@ public class PdfBuilderTest {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public class SectionTable extends SectionView {
|
|
|
+ @Override
|
|
|
+ public Map<String, String> getKeyMapping() {
|
|
|
+ HashMap<String, String> ret = new HashMap<>();
|
|
|
+ for(SectionView sv: this.views) {
|
|
|
+ if(sv instanceof SectionTableRow) {
|
|
|
+ for(Map.Entry<String, String> entry: sv.getKeyMapping().entrySet()) {
|
|
|
+ ret.put(this.seq + "_" + entry.getKey(), this.seq + "_" + entry.getValue());
|
|
|
+ }
|
|
|
+ break; // all rows are the same.
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException("SectionTable should only contain SectionTableRow");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> getKeyValues() {
|
|
|
+ Map<String, Object> ret = new HashMap<>();
|
|
|
+ for(int i = 0; i < this.views.size(); i++) {
|
|
|
+ SectionView sv = this.views.get(i);
|
|
|
+ HashMap<String, Object> mp = new HashMap<>();
|
|
|
+ if(sv instanceof SectionTableRow) {
|
|
|
+ for(Map.Entry<String, String> entry: sv.getKeyMapping().entrySet()) {
|
|
|
+ mp.put(this.seq + "_" + entry.getKey(), entry.getValue());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException("SectionTable should only contain SectionTableRow");
|
|
|
+ }
|
|
|
+ ret.put(Integer.toString(i), mp);
|
|
|
+ }
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public class SectionTableRow extends SectionView {
|
|
|
+ @Override
|
|
|
+ public Map<String, String> getKeyMapping() {
|
|
|
+ HashMap<String, String> ret = new HashMap<>();
|
|
|
+ for(int i = 0; i < data.size(); i++) {
|
|
|
+ ret.put(
|
|
|
+ String.format("%d", i),
|
|
|
+ String.format("%s", data.get(i).key));
|
|
|
+ }
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> getKeyValues() {
|
|
|
+ HashMap<String, Object> ret = new HashMap<>();
|
|
|
+ for(int i = 0; i < data.size(); i++) {
|
|
|
+ ret.put(data.get(i).key, data.get(i).value);
|
|
|
+ }
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Before
|
|
|
public void initialize() {
|
|
|
new File(TARGET_TMP_TEST).mkdirs();
|
|
@@ -130,6 +189,60 @@ public class PdfBuilderTest {
|
|
|
section1_3.data.add(new Pair("publicRecordScore", "20"));
|
|
|
section1_3.data.add(new Pair("financeScore", "40"));
|
|
|
section1_3.data.add(new Pair("antiBribeScore", "5"));
|
|
|
+
|
|
|
+ section2 = new SectionView();
|
|
|
+ section2.seq = "2";
|
|
|
+ section2.title = "注册信息";
|
|
|
+
|
|
|
+ section2.views.add(new SectionView());
|
|
|
+ SectionView section2_1 = section2.views.get(0);
|
|
|
+ section2_1.seq = "2.1";
|
|
|
+ section2_1.title = "注册信息";
|
|
|
+ section2_1.data.add(new Pair("riskCount", "0"));
|
|
|
+ section2_1.data.add(new Pair("companyName", "上海成泰医药科技有限公司"));
|
|
|
+ section2_1.data.add(new Pair("industry", "-"));
|
|
|
+ section2_1.data.add(new Pair("juridicalPerson", "闫天牧"));
|
|
|
+ section2_1.data.add(new Pair("claimCapitalScore", ""));
|
|
|
+ section2_1.data.add(new Pair("realCapitalScore", ""));
|
|
|
+ section2_1.data.add(new Pair("companySize", ""));
|
|
|
+ section2_1.data.add(new Pair("employee", ""));
|
|
|
+ section2_1.data.add(new Pair("status", ""));
|
|
|
+ section2_1.data.add(new Pair("govAgency", ""));
|
|
|
+ section2_1.data.add(new Pair("establishDate", ""));
|
|
|
+ section2_1.data.add(new Pair("registeredAddress", ""));
|
|
|
+ section2_1.data.add(new Pair("taxCert", ""));
|
|
|
+ section2_1.data.add(new Pair("companyType", ""));
|
|
|
+ section2_1.data.add(new Pair("scope", ""));
|
|
|
+ section2_1.data.add(new Pair("companyTypeStd", "个体户、民营企业 0分\n" + //
|
|
|
+ "上市公司、国有企业、跨国企业 10分\n" + //
|
|
|
+ "除以上两种 5分"));
|
|
|
+ section2_1.data.add(new Pair("companyTypeDesc", "有限责任公司(自然人投资或控股)"));
|
|
|
+ section2_1.data.add(new Pair("companyTypeResult", "合格"));
|
|
|
+ section2_1.data.add(new Pair("companyTypeScore", "3"));
|
|
|
+ section2_1.data.add(new Pair("activePeriodStd", "3年及以下 0分\n" + //
|
|
|
+ "3-5年,含3年 5分\n" + //
|
|
|
+ "5年以上,含5年 10分"));
|
|
|
+ section2_1.data.add(new Pair("activePeriodDesc", "3年"));
|
|
|
+ section2_1.data.add(new Pair("activePeriodResult", "合格"));
|
|
|
+ section2_1.data.add(new Pair("activePeriodScore", "3"));
|
|
|
+ section2_1.data.add(new Pair("claimCapitalStd", "100万以下 0分\n" + //
|
|
|
+ "100万-500万 3分\n" + //
|
|
|
+ "500万以上 5分"));
|
|
|
+ section2_1.data.add(new Pair("claimCapitalDesc", "300 万人民币"));
|
|
|
+ section2_1.data.add(new Pair("claimCapitalResult", "合格"));
|
|
|
+ section2_1.data.add(new Pair("claimCapitalScore", "3"));
|
|
|
+ section2_1.data.add(new Pair("realCapitalStd", "100万以下 0分\n" + //
|
|
|
+ "100万-500万 3分\n" + //
|
|
|
+ "500万以上 5分"));
|
|
|
+ section2_1.data.add(new Pair("realCapitalDesc", "102 万人民币"));
|
|
|
+ section2_1.data.add(new Pair("realCapitalResult", "合格"));
|
|
|
+ section2_1.data.add(new Pair("realCapitalScore", "3"));
|
|
|
+
|
|
|
+ section2.views.add(new SectionView());
|
|
|
+ SectionView section2_2 = section2.views.get(1);
|
|
|
+ section2_2.seq = "2.2";
|
|
|
+ section2_2.title = "利益冲突情况";
|
|
|
+ section2_2.data.add(new Pair("riskCount", "0"));
|
|
|
}
|
|
|
|
|
|
private String preprocess(SectionView sv, String path) throws IOException {
|