Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e2e0339

Browse files
committed
update
1 parent e1278ba commit e2e0339

File tree

2 files changed

+137
-139
lines changed
  • src
    • main/java/com/coderdream/util
      • FileUtil.java
    • test/java/com/coderdream/util/mail
      • MailUtilTest.java

2 files changed

+137
-139
lines changed

src/main/java/com/coderdream/util/FileUtil.java

Lines changed: 58 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
public class FileUtil {
1313

1414
public static void main(String[] args) {
15-
method04();
15+
method05();
1616
}
1717

18-
private static void method01() {
18+
public static void method01() {
1919

2020
try {
2121
// read file content from file
@@ -63,9 +63,8 @@ private static void method01() {
6363
// System.out.println("size:\t" + major.size());
6464
int ind = 6;
6565
for (String string : major) {
66-
String sql = stringBuffer.toString() + ind
67-
+ ", N'MajorInfo', N'M" + String.format("%04d", ind - 5)
68-
+ "', N'" + string + "', 6, '');";
66+
String sql = stringBuffer.toString() + ind + ", N'MajorInfo', N'M"
67+
+ String.format("%04d", ind - 5) + "', N'" + string + "', 6, '');";
6968
System.out.println(sql);
7069
ind++;
7170
// System.out.println(String.format("%04d", ind));
@@ -89,7 +88,7 @@ private static void method01() {
8988

9089
}
9190

92-
private static void method02() {
91+
public static void method02() {
9392

9493
try {
9594
// read file content from file
@@ -135,9 +134,9 @@ private static void method02() {
135134
// System.out.println("size:\t" + major.size());
136135
int ind = 1137;
137136
for (String string : major) {
138-
String sql = stringBuffer.toString() + ind
139-
+ ", N'UniversityInfo', N'U" + String.format("%04d", ind - 5)
140-
+ "', N'" + string + "', 1136, '');";
137+
String sql = stringBuffer.toString() + ind + ", N'UniversityInfo', N'U"
138+
+ String.format("%04d", ind - 5) + "', N'" + string
139+
+ "', 1136, '');";
141140
System.out.println(sql);
142141
ind++;
143142
// System.out.println(String.format("%04d", ind));
@@ -160,8 +159,8 @@ private static void method02() {
160159
}
161160

162161
}
163-
164-
private static void method03() {
162+
163+
public static void method03() {
165164

166165
try {
167166
// read file content from file
@@ -207,9 +206,9 @@ private static void method03() {
207206
// System.out.println("size:\t" + major.size());
208207
int ind = 3566;
209208
for (String string : major) {
210-
String sql = stringBuffer.toString() + ind
211-
+ ", N'EducationInfo', N'E" + String.format("%04d", ind - 5)
212-
+ "', N'" + string + "', 3565, '');";
209+
String sql = stringBuffer.toString() + ind + ", N'EducationInfo', N'E"
210+
+ String.format("%04d", ind - 5) + "', N'" + string
211+
+ "', 3565, '');";
213212
System.out.println(sql);
214213
ind++;
215214
// System.out.println(String.format("%04d", ind));
@@ -232,54 +231,53 @@ private static void method03() {
232231
}
233232

234233
}
235-
236-
private static void method04() {
237-
238-
// read file content from file
239-
StringBuffer sb = new StringBuffer("");
240-
241-
242-
String str = null;
243-
List<String> major = new ArrayList<String>();
244-
major.add("Zai Xiang ");
245-
major.add("Chi Xiang ");
246-
major.add("Chi Zhi ");
247-
248-
249-
// INSERT INTO [PDRC_Dictionary]
250-
// ([ID],[Type],[KeyName],[value],[ParentID],[Remark])VALUES
251-
// (
252-
// ,
253-
// ,
254-
// ,
255-
// ,
256-
// ,);
257-
258-
StringBuffer stringBuffer = new StringBuffer(
259-
"INSERT INTO [PDRC_Dictionary] ([ID],[Type],[KeyName],[value],[ParentID],[Remark])VALUES (");
260-
String strParent = stringBuffer.toString()
261-
+ "3570, N'EmployeeStateInfo', 'EmployeeState', 'EmployeeState', null, null );";
262-
System.out.println(strParent);
263-
// System.out.println("size:\t" + major.size());
264-
int ind = 3571;
265-
for (String string : major) {
266-
String sql = stringBuffer.toString() + ind
267-
+ ", N'EmployeeStateInfo', N'E" + String.format("%04d", ind - 5)
268-
+ "', N'" + string + "', 3570, '');";
269-
System.out.println(sql);
270-
ind++;
271-
// System.out.println(String.format("%04d", ind));
272-
}
273-
274234

275-
// write string to file
276-
// FileWriter writer = new FileWriter("c://test2.txt");
277-
// BufferedWriter bw = new BufferedWriter(writer);
278-
// bw.write(sb.toString());
279-
//
280-
// bw.close();
281-
// writer.close();
235+
public static void method04() {
236+
List<String> major = new ArrayList<String>();
237+
major.add("Zai Xiang ");
238+
major.add("Chi Xiang ");
239+
major.add("Chi Zhi ");
240+
241+
StringBuffer stringBuffer = new StringBuffer(
242+
"INSERT INTO [PDRC_Dictionary] ([ID],[Type],[KeyName],[value],[ParentID],[Remark])VALUES (");
243+
String strParent = stringBuffer.toString()
244+
+ "3570, N'EmployeeStateInfo', 'EmployeeState', 'EmployeeState', null, null );";
245+
System.out.println(strParent);
246+
int ind = 3571;
247+
for (String string : major) {
248+
String sql = stringBuffer.toString() + ind + ", N'EmployeeStateInfo', N'E"
249+
+ String.format("%04d", ind - 5) + "', N'" + string + "', 3570, '');";
250+
System.out.println(sql);
251+
ind++;
252+
// System.out.println(String.format("%04d", ind));
253+
}
254+
}
282255

256+
public static void method05() {
257+
List<String> major = new ArrayList<String>();
258+
major.add("Wu Yi ");
259+
major.add("Shen Zhen ");
260+
major.add("Dong Wan ");
261+
major.add("Cheng Du ");
262+
major.add("Yan Zhou ");
263+
major.add("Shang Hai ");
264+
major.add("Da Lian ");
265+
major.add("Zhong Qing ");
266+
int index = 3574;
267+
StringBuffer stringBuffer = new StringBuffer(
268+
"INSERT INTO [PDRC_Dictionary] ([ID],[Type],[KeyName],[value],[ParentID],[Remark])VALUES (");
269+
String strParent = stringBuffer.toString() + index
270+
+ ", N'CandidateCityInfo', 'CandidateCity', 'CandidateCity', null, null );";
271+
System.out.println(strParent);
272+
int ind = index + 1;
273+
for (String string : major) {
274+
String sql = stringBuffer.toString() + ind
275+
+ ", N'CandidateCityInfo', N'CC" + String.format("%02d", ind - index)
276+
+ "', N'" + string + "', " + index + ", '');";
277+
System.out.println(sql);
278+
ind++;
279+
// System.out.println(String.format("%04d", ind));
280+
}
283281
}
284282

285283
}

src/test/java/com/coderdream/util/mail/MailUtilTest.java

Lines changed: 79 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -125,85 +125,85 @@ public void testMailTemplate_04() {
125125
}
126126
}
127127

128-
@Test
129-
public void testMailTemplate_05() {
130-
String templateName = "template_5.html";
131-
Map<String, String> map = new HashMap<String, String>();
132-
map.put("username", "He San Mei ");
133-
map.put("password", "123456");
134-
map.put("age", "27");
135-
map.put("sex", "Nu ");
136-
137-
List<TableCompareBean> tableCompareBeanListTotal = new ArrayList<TableCompareBean>();
138-
String databaseName1 = "BJC_Finance";
139-
String databaseName2 = "BJC_Finance_Test";
140-
Map<String, List<TableCompareBean>> totalTableCompareBeanListMap = MssqlService
141-
.compareTableConstructDiff(databaseName1, databaseName2);
142-
int i = 0;
143-
for (String tableName : totalTableCompareBeanListMap.keySet()) {
144-
List<TableCompareBean> tableCompareBeanList = totalTableCompareBeanListMap
145-
.get(tableName);
146-
System.out.println("###tableName\t" + tableName);
147-
for (TableCompareBean tableCompareBean : tableCompareBeanList) {
148-
System.out.println(tableCompareBean);
149-
}
150-
i++;
151-
if (i < 5) {
152-
tableCompareBeanListTotal.addAll(tableCompareBeanList);
153-
}
154-
}
155-
156-
try {
157-
MailUtil.sendMailByTemplateWithListObject("xulin.wh@qq.com", "test",
158-
tableCompareBeanListTotal, templateName);
159-
} catch (IOException e) {
160-
log.error(e.toString(), e);
161-
} catch (TemplateException e) {
162-
log.error(e.toString(), e);
163-
} catch (MessagingException e) {
164-
log.error(e.toString(), e);
165-
}
166-
}
167-
168-
@Test
169-
public void testMailTemplate_06() {
170-
String templateName = "template_6.html";
171-
Map<String, String> map = new HashMap<String, String>();
172-
map.put("username", "He San Mei ");
173-
map.put("password", "123456");
174-
map.put("age", "27");
175-
map.put("sex", "Nu ");
176-
177-
List<TableCompareBean> tableCompareBeanListTotal = new ArrayList<TableCompareBean>();
178-
String databaseName1 = "BJC_Finance";
179-
String databaseName2 = "BJC_Finance_Test";
180-
Map<String, List<TableCompareBean>> totalTableCompareBeanListMap = MssqlService
181-
.compareTableConstructDiff(databaseName1, databaseName2);
182-
int i = 0;
183-
for (String tableName : totalTableCompareBeanListMap.keySet()) {
184-
List<TableCompareBean> tableCompareBeanList = totalTableCompareBeanListMap
185-
.get(tableName);
186-
System.out.println("###tableName\t" + tableName);
187-
for (TableCompareBean tableCompareBean : tableCompareBeanList) {
188-
System.out.println(tableCompareBean);
189-
}
190-
i++;
191-
if (i < 5) {
192-
tableCompareBeanListTotal.addAll(tableCompareBeanList);
193-
}
194-
}
195-
196-
try {
197-
MailUtil.sendMailByTemplateWithListObject("xulin.wh@qq.com", "test",
198-
tableCompareBeanListTotal, templateName);
199-
} catch (IOException e) {
200-
log.error(e.toString(), e);
201-
} catch (TemplateException e) {
202-
log.error(e.toString(), e);
203-
} catch (MessagingException e) {
204-
log.error(e.toString(), e);
205-
}
206-
}
128+
// @Test
129+
// public void testMailTemplate_05() {
130+
// String templateName = "template_5.html";
131+
// Map map = new HashMap();
132+
// map.put("username", "He San Mei ");
133+
// map.put("password", "123456");
134+
// map.put("age", "27");
135+
// map.put("sex", "Nu ");
136+
//
137+
// List tableCompareBeanListTotal = new ArrayList();
138+
// String databaseName1 = "BJC_Finance";
139+
// String databaseName2 = "BJC_Finance_Test";
140+
// Map> totalTableCompareBeanListMap = MssqlService
141+
// .compareTableConstructDiff(databaseName1, databaseName2);
142+
// int i = 0;
143+
// for (String tableName : totalTableCompareBeanListMap.keySet()) {
144+
// List tableCompareBeanList = totalTableCompareBeanListMap
145+
// .get(tableName);
146+
// System.out.println("###tableName\t" + tableName);
147+
// for (TableCompareBean tableCompareBean : tableCompareBeanList) {
148+
// System.out.println(tableCompareBean);
149+
// }
150+
// i++;
151+
// if (i < 5) {
152+
// tableCompareBeanListTotal.addAll(tableCompareBeanList);
153+
// }
154+
// }
155+
//
156+
// try {
157+
// MailUtil.sendMailByTemplate("xulin.wh@qq.com", "test",
158+
// tableCompareBeanListTotal, templateName);
159+
// } catch (IOException e) {
160+
// log.error(e.toString(), e);
161+
// } catch (TemplateException e) {
162+
// log.error(e.toString(), e);
163+
// } catch (MessagingException e) {
164+
// log.error(e.toString(), e);
165+
// }
166+
// }
167+
168+
// @Test
169+
// public void testMailTemplate_06() {
170+
// String templateName = "template_6.html";
171+
// Map map = new HashMap();
172+
// map.put("username", "He San Mei ");
173+
// map.put("password", "123456");
174+
// map.put("age", "27");
175+
// map.put("sex", "Nu ");
176+
//
177+
// List tableCompareBeanListTotal = new ArrayList();
178+
// String databaseName1 = "BJC_Finance";
179+
// String databaseName2 = "BJC_Finance_Test";
180+
// Map> totalTableCompareBeanListMap = MssqlService
181+
// .compareTableConstructDiff(databaseName1, databaseName2);
182+
// int i = 0;
183+
// for (String tableName : totalTableCompareBeanListMap.keySet()) {
184+
// List tableCompareBeanList = totalTableCompareBeanListMap
185+
// .get(tableName);
186+
// System.out.println("###tableName\t" + tableName);
187+
// for (TableCompareBean tableCompareBean : tableCompareBeanList) {
188+
// System.out.println(tableCompareBean);
189+
// }
190+
// i++;
191+
// if (i < 5) {
192+
// tableCompareBeanListTotal.addAll(tableCompareBeanList);
193+
// }
194+
// }
195+
//
196+
// try {
197+
// MailUtil.sendMailByTemplateWithListObject("xulin.wh@qq.com", "test",
198+
// tableCompareBeanListTotal, templateName);
199+
// } catch (IOException e) {
200+
// log.error(e.toString(), e);
201+
// } catch (TemplateException e) {
202+
// log.error(e.toString(), e);
203+
// } catch (MessagingException e) {
204+
// log.error(e.toString(), e);
205+
// }
206+
// }
207207

208208
@Test
209209
public void testMail() {

0 commit comments

Comments
(0)