|
@@ -9,6 +9,7 @@ import cn.com.qmth.stmms.ms.marking.utils.RandomUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import net.coobird.thumbnailator.Thumbnails;
|
|
|
+import org.junit.Test;
|
|
|
import org.junit.runner.RunWith;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -17,8 +18,10 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
+import java.io.ByteArrayInputStream;
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
+import java.io.InputStream;
|
|
|
import java.util.*;
|
|
|
|
|
|
@RunWith(SpringRunner.class)
|
|
@@ -58,7 +61,7 @@ public class BatchCreateDataTest {
|
|
|
// 考生初始准考证号
|
|
|
private int initNumber = 1000000;
|
|
|
// 考生数量
|
|
|
- private static int COUNT = 60000;
|
|
|
+ private static int COUNT = 3000;
|
|
|
// 评卷员数量
|
|
|
private static int MARKER_COUNT = 15;
|
|
|
// 科组长数量
|
|
@@ -66,20 +69,20 @@ public class BatchCreateDataTest {
|
|
|
// 工作id
|
|
|
private static Long WORK_ID = 1L;
|
|
|
// 是否开启粗分档
|
|
|
- private static Boolean isOpenRoughLevel = true;
|
|
|
+ private static Boolean isOpenRoughLevel = false;
|
|
|
// 生成科目
|
|
|
private List<Subject> subjects = Arrays.asList(Subject.SX, Subject.SC, Subject.SM);
|
|
|
// 是否复制图片
|
|
|
private boolean isCreateImage = false;
|
|
|
- // 图片存放目录
|
|
|
- private String baseDir = "D:\\my_workspaces\\ide_workspace_qmth\\idea_workspace\\stmms-ms-server\\upload";
|
|
|
+ // 图片存放目录(源图片命名为 source.jpg,放在baseDir根目录下)
|
|
|
+ private String baseDir = "/Users/xiaofei/mslk";
|
|
|
|
|
|
/**
|
|
|
* 生成数据
|
|
|
*
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
-// @Test
|
|
|
+ @Test
|
|
|
public void createTask() throws Exception {
|
|
|
createData();
|
|
|
}
|
|
@@ -319,7 +322,7 @@ public class BatchCreateDataTest {
|
|
|
if (!out.exists()) {
|
|
|
out.mkdirs();
|
|
|
}
|
|
|
- File in = new File(imageDir, "sx.jpg");
|
|
|
+ File in = new File(baseDir, "source.jpg");
|
|
|
for (Student student : students) {
|
|
|
Thumbnails.of(in).scale(1f).toFile(new File(imageDir, student.getExamNumber() + ".jpg"));
|
|
|
}
|
|
@@ -331,7 +334,7 @@ public class BatchCreateDataTest {
|
|
|
if (!out.exists()) {
|
|
|
out.mkdirs();
|
|
|
}
|
|
|
- File in = new File(sheetDir, "sx.jpg");
|
|
|
+ File in = new File(baseDir, "source.jpg");
|
|
|
for (Student student : students) {
|
|
|
Thumbnails.of(in).scale(1f).toFile(new File(sheetDir, student.getExamNumber() + ".jpg"));
|
|
|
}
|
|
@@ -343,7 +346,7 @@ public class BatchCreateDataTest {
|
|
|
if (!out.exists()) {
|
|
|
out.mkdirs();
|
|
|
}
|
|
|
- File in = new File(thumbDir, "sx.jpg");
|
|
|
+ File in = new File(baseDir, "source.jpg");
|
|
|
for (Student student : students) {
|
|
|
Thumbnails.of(in).scale(1f).toFile(new File(thumbDir, student.getExamNumber() + ".jpg"));
|
|
|
}
|