Commit c5e63bdb984a1cd025829c35b1f2ee399c320f01

Authored by 陶汉栋
1 parent 55460031
Exists in master and in 1 other branch cloud_copy

no message

cloud/weigeng/libs/sqljdbc4-4.2-6.jar
No preview for this file type
cloud/weigeng/src/main/java/com/sincere/weigeng/AuthService.java
@@ -1,86 +0,0 @@ @@ -1,86 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import org.json.JSONObject;  
4 -  
5 -import java.io.BufferedReader;  
6 -import java.io.InputStreamReader;  
7 -import java.net.HttpURLConnection;  
8 -import java.net.URL;  
9 -import java.util.List;  
10 -import java.util.Map;  
11 -  
12 -/**  
13 - * 获取token类  
14 - */  
15 -public class AuthService {  
16 - //设置APPID/AK/SK  
17 - public static final String APP_ID = "15990462";  
18 - public static final String API_KEY = "t70Rzr6SGmfU9S6MrqAkspsY";  
19 - public static final String SECRET_KEY = "nSqpqtrf7cCjo8vOB9knL85nwWNoxwvS ";  
20 - /**  
21 - * 获取权限token  
22 - * @return 返回示例:  
23 - * {  
24 - * "access_token": "24.460da4889caad24cccdb1fea17221975.2592000.1491995545.282335-1234567",  
25 - * "expires_in": 2592000  
26 - * }  
27 - */  
28 - public static String getAuth() {  
29 - // 官网获取的 API Key 更新为你注册的  
30 - String clientId = "t70Rzr6SGmfU9S6MrqAkspsY";  
31 - // 官网获取的 Secret Key 更新为你注册的  
32 - String clientSecret = "nSqpqtrf7cCjo8vOB9knL85nwWNoxwvS";  
33 - return getAuth(clientId, clientSecret);  
34 - }  
35 -  
36 - /**  
37 - * 获取API访问token  
38 - * 该token有一定的有效期,需要自行管理,当失效时需重新获取.  
39 - * @param ak - 百度云官网获取的 API Key  
40 - * @param sk - 百度云官网获取的 Securet Key  
41 - * @return assess_token 示例:  
42 - * "24.460da4889caad24cccdb1fea17221975.2592000.1491995545.282335-1234567"  
43 - */  
44 - public static String getAuth(String ak, String sk) {  
45 - // 获取token地址  
46 - String authHost = "https://aip.baidubce.com/oauth/2.0/token?";  
47 - String getAccessTokenUrl = authHost  
48 - // 1. grant_type为固定参数  
49 - + "grant_type=client_credentials"  
50 - // 2. 官网获取的 API Key  
51 - + "&client_id=" + ak  
52 - // 3. 官网获取的 Secret Key  
53 - + "&client_secret=" + sk;  
54 - try {  
55 - URL realUrl = new URL(getAccessTokenUrl);  
56 - // 打开和URL之间的连接  
57 - HttpURLConnection connection = (HttpURLConnection) realUrl.openConnection();  
58 - connection.setRequestMethod("GET");  
59 - connection.connect();  
60 - // 获取所有响应头字段  
61 - Map<String, List<String>> map = connection.getHeaderFields();  
62 - // 遍历所有的响应头字段  
63 - for (String key : map.keySet()) {  
64 - System.err.println(key + "--->" + map.get(key));  
65 - }  
66 - // 定义 BufferedReader输入流来读取URL的响应  
67 - BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));  
68 - String result = "";  
69 - String line;  
70 - while ((line = in.readLine()) != null) {  
71 - result += line;  
72 - }  
73 - /**  
74 - * 返回结果示例  
75 - */  
76 - System.err.println("result:" + result);  
77 - JSONObject jsonObject = new JSONObject(result);  
78 - String access_token = jsonObject.getString("access_token");  
79 - return access_token;  
80 - } catch (Exception e) {  
81 - System.err.printf("获取token失败!");  
82 - e.printStackTrace(System.err);  
83 - }  
84 - return null;  
85 - }  
86 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/HomeBean.java
@@ -1,33 +0,0 @@ @@ -1,33 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -public class HomeBean {  
4 -  
5 - private String CreatorUserId;  
6 -  
7 - private String Title;  
8 -  
9 -  
10 - public String getCreatorUserId() {  
11 - return CreatorUserId;  
12 - }  
13 -  
14 - public void setCreatorUserId(String creatorUserId) {  
15 - CreatorUserId = creatorUserId;  
16 - }  
17 -  
18 - public String getTitle() {  
19 - return Title;  
20 - }  
21 -  
22 - public void setTitle(String title) {  
23 - Title = title;  
24 - }  
25 -  
26 - @Override  
27 - public String toString() {  
28 - return "HomeBean{" +  
29 - "CreatorUserId='" + CreatorUserId + '\'' +  
30 - ", Title='" + Title + '\'' +  
31 - '}';  
32 - }  
33 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/Homework.java
@@ -1,189 +0,0 @@ @@ -1,189 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import java.io.Serializable;  
4 -  
5 -public class Homework implements Serializable {  
6 -  
7 - private String ID;  
8 -  
9 - private String CreatorUserId;  
10 -  
11 - private String PaperId;  
12 -  
13 - private String Title;  
14 -  
15 - private int SuggestionTime;  
16 -  
17 - private String Deadline;  
18 -  
19 - private int State;  
20 -  
21 - private String Intime;  
22 -  
23 - private int SubjectId;  
24 -  
25 - private int PublishAnswerType;  
26 -  
27 - private int IsPigai;  
28 -  
29 - private String StartTime;  
30 -  
31 - private int TypeId;  
32 -  
33 - private String QuestionIds;  
34 -  
35 - private int HomeworkType;  
36 -  
37 - private int PkgId;  
38 -  
39 - public String getCreatorUserId() {  
40 - return CreatorUserId;  
41 - }  
42 -  
43 - public void setCreatorUserId(String creatorUserId) {  
44 - CreatorUserId = creatorUserId;  
45 - }  
46 -  
47 - public String getPaperId() {  
48 - return PaperId;  
49 - }  
50 -  
51 - public String getID() {  
52 - return ID;  
53 - }  
54 -  
55 - public void setID(String ID) {  
56 - this.ID = ID;  
57 - }  
58 -  
59 - @Override  
60 - public String toString() {  
61 - return "Homework{" +  
62 - "ID='" + ID + '\'' +  
63 - ", CreatorUserId='" + CreatorUserId + '\'' +  
64 - ", PaperId='" + PaperId + '\'' +  
65 - ", Title='" + Title + '\'' +  
66 - ", SuggestionTime=" + SuggestionTime +  
67 - ", Deadline='" + Deadline + '\'' +  
68 - ", State=" + State +  
69 - ", Intime='" + Intime + '\'' +  
70 - ", SubjectId=" + SubjectId +  
71 - ", PublishAnswerType=" + PublishAnswerType +  
72 - ", IsPigai=" + IsPigai +  
73 - ", StartTime='" + StartTime + '\'' +  
74 - ", TypeId=" + TypeId +  
75 - ", QuestionIds='" + QuestionIds + '\'' +  
76 - ", HomeworkType=" + HomeworkType +  
77 - ", PkgId=" + PkgId +  
78 - '}';  
79 - }  
80 -  
81 - public void setPaperId(String paperId) {  
82 - PaperId = paperId;  
83 - }  
84 -  
85 - public String getTitle() {  
86 - return Title;  
87 - }  
88 -  
89 - public void setTitle(String title) {  
90 - Title = title;  
91 - }  
92 -  
93 - public int getSuggestionTime() {  
94 - return SuggestionTime;  
95 - }  
96 -  
97 - public void setSuggestionTime(int suggestionTime) {  
98 - SuggestionTime = suggestionTime;  
99 - }  
100 -  
101 - public String getDeadline() {  
102 - return Deadline;  
103 - }  
104 -  
105 - public void setDeadline(String deadline) {  
106 - Deadline = deadline;  
107 - }  
108 -  
109 - public int getState() {  
110 - return State;  
111 - }  
112 -  
113 - public void setState(int state) {  
114 - State = state;  
115 - }  
116 -  
117 - public String getIntime() {  
118 - return Intime;  
119 - }  
120 -  
121 - public void setIntime(String intime) {  
122 - Intime = intime;  
123 - }  
124 -  
125 - public int getSubjectId() {  
126 - return SubjectId;  
127 - }  
128 -  
129 - public void setSubjectId(int subjectId) {  
130 - SubjectId = subjectId;  
131 - }  
132 -  
133 - public int getPublishAnswerType() {  
134 - return PublishAnswerType;  
135 - }  
136 -  
137 - public void setPublishAnswerType(int publishAnswerType) {  
138 - PublishAnswerType = publishAnswerType;  
139 - }  
140 -  
141 - public int getIsPigai() {  
142 - return IsPigai;  
143 - }  
144 -  
145 - public void setIsPigai(int isPigai) {  
146 - IsPigai = isPigai;  
147 - }  
148 -  
149 - public String getStartTime() {  
150 - return StartTime;  
151 - }  
152 -  
153 - public void setStartTime(String startTime) {  
154 - StartTime = startTime;  
155 - }  
156 -  
157 - public int getTypeId() {  
158 - return TypeId;  
159 - }  
160 -  
161 - public void setTypeId(int typeId) {  
162 - TypeId = typeId;  
163 - }  
164 -  
165 - public String getQuestionIds() {  
166 - return QuestionIds;  
167 - }  
168 -  
169 - public void setQuestionIds(String questionIds) {  
170 - QuestionIds = questionIds;  
171 - }  
172 -  
173 - public int getHomeworkType() {  
174 - return HomeworkType;  
175 - }  
176 -  
177 - public void setHomeworkType(int homeworkType) {  
178 - HomeworkType = homeworkType;  
179 - }  
180 -  
181 - public int getPkgId() {  
182 - return PkgId;  
183 - }  
184 -  
185 - public void setPkgId(int pkgId) {  
186 - PkgId = pkgId;  
187 - }  
188 -  
189 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/HomeworkReceive.java
@@ -1,34 +0,0 @@ @@ -1,34 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import java.io.Serializable;  
4 -  
5 -public class HomeworkReceive implements Serializable {  
6 -  
7 - private String StudentId;  
8 -  
9 - private String StudnetAnswerIds;  
10 -  
11 - public String getStudentId() {  
12 - return StudentId;  
13 - }  
14 -  
15 - public void setStudentId(String studentId) {  
16 - StudentId = studentId;  
17 - }  
18 -  
19 - public String getStudnetAnswerIds() {  
20 - return StudnetAnswerIds;  
21 - }  
22 -  
23 - public void setStudnetAnswerIds(String studnetAnswerIds) {  
24 - StudnetAnswerIds = studnetAnswerIds;  
25 - }  
26 -  
27 - @Override  
28 - public String toString() {  
29 - return "HomeworkReceive{" +  
30 - "StudentId='" + StudentId + '\'' +  
31 - ", StudnetAnswerIds='" + StudnetAnswerIds + '\'' +  
32 - '}';  
33 - }  
34 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/ImageUtils.java
@@ -1,168 +0,0 @@ @@ -1,168 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import com.drew.imaging.ImageMetadataReader;  
4 -import com.drew.imaging.jpeg.JpegMetadataReader;  
5 -import com.drew.metadata.Directory;  
6 -import com.drew.metadata.Metadata;  
7 -import com.drew.metadata.Tag;  
8 -import com.sun.imageio.plugins.png.PNGImageReader;  
9 -import org.apache.commons.lang.StringUtils;  
10 -  
11 -import javax.imageio.ImageIO;  
12 -import java.awt.*;  
13 -import java.awt.image.BufferedImage;  
14 -import java.io.File;  
15 -import java.io.IOException;  
16 -import java.util.Iterator;  
17 -  
18 -public class ImageUtils {  
19 -  
20 -  
21 - /* *//**  
22 - * 获取图片正确显示需要旋转的角度(顺时针)  
23 - * @return  
24 - *//*  
25 - public static int getRotateAngleForPhoto(String filePath){  
26 - File file = new File(filePath);  
27 - int angle = 0;  
28 - Metadata metadata;  
29 - try {  
30 - metadata = JpegMetadataReader.readMetadata(file);  
31 - Directory directory = metadata.getDirectory(ExifDirectory.class);  
32 - if(directory.containsTag(ExifDirectory.TAG_ORIENTATION)){  
33 -  
34 - // Exif信息中方向    
35 - int orientation = directory.getInt(ExifDirectory.TAG_ORIENTATION);  
36 - // 原图片的方向信息  
37 - if(6 == orientation ){  
38 - //6旋转90  
39 - angle = 90;  
40 - }else if( 3 == orientation){  
41 - //3旋转180  
42 - angle = 180;  
43 - }else if( 8 == orientation){  
44 - //8旋转90  
45 - angle = 270;  
46 - }  
47 - }  
48 - } catch (JpegProcessingException e) {  
49 - e.printStackTrace();  
50 - } catch (MetadataException e) {  
51 - e.printStackTrace();  
52 - } catch (IOException e) {  
53 - e.printStackTrace();  
54 - }  
55 - return angle;  
56 - }*/  
57 -  
58 -  
59 - /**  
60 - * 获得图片调整角度  
61 - * make by dongxh 2017年11月1日下午3:40:20  
62 - * @param imgFile  
63 - * @return  
64 - */  
65 - public static Integer getImgRotateAngle(String imgFile){  
66 - return 0;  
67 - /*int angel = 0;  
68 - try {  
69 - File file = new File(imgFile);  
70 - Metadata metadata = ImageMetadataReader.readMetadata(file);  
71 - for (Directory directory : metadata.getDirectories()) {  
72 - for (Tag tag : directory.getTags()) {  
73 - if (tag.getTagType() == ExifDirectoryBase.TAG_ORIENTATION) {  
74 - String description = tag.getDescription();  
75 -// System.out.println(description);  
76 - if (description.contains("90")) {  
77 - // 顺时针旋转90度  
78 - angel = 90;  
79 - } else if (description.contains("180")) {  
80 - // 顺时针旋转180度  
81 - angel = 180;  
82 - } else if (description.contains("270")) {  
83 - // 顺时针旋转270度  
84 - angel = 270;  
85 - }  
86 - }  
87 - }  
88 - }  
89 -// System.out.println(angel);  
90 - } catch (Exception e) {  
91 - e.printStackTrace();  
92 - }  
93 - return angel;*/  
94 - /*Integer angel = 0;  
95 - Metadata metadata = null;  
96 - try{  
97 - if(StringUtils.isBlank(imgFile))return angel;  
98 - File _img_file_ = new File(imgFile);  
99 - if(!_img_file_.exists())return angel;  
100 - metadata = JpegMetadataReader.readMetadata(_img_file_);  
101 - Directory directory = metadata.getDirectory(ExifDirectory.class);  
102 - Iterator iterator =directory.getTagIterator();  
103 - while (iterator.hasNext()){  
104 - System.out.println("directory:"+iterator.next().toString());  
105 - }  
106 - if(directory != null && directory.containsTag(ExifDirectory.TAG_ORIENTATION)){  
107 - int orientation = directory.getInt(ExifDirectory.TAG_ORIENTATION);  
108 - // 原图片的方向信息  
109 - if(6 == orientation ){  
110 - //6旋转90  
111 - angel = 90;  
112 - }else if( 3 == orientation){  
113 - //3旋转180  
114 - angel = 180;  
115 - }else if( 8 == orientation){  
116 - //8旋转90  
117 - angel = 270;  
118 - }  
119 - }  
120 - }catch(Exception e){  
121 - e.printStackTrace();  
122 - }  
123 - return angel;*/  
124 - }  
125 -  
126 - /**  
127 - * 旋转照片  
128 - * @return  
129 - */  
130 - public static String rotatePhonePhoto(String fullPath, int angel){  
131 -  
132 - BufferedImage src;  
133 - try {  
134 - src = ImageIO.read(new File(fullPath));  
135 - int src_width = src.getWidth(null);  
136 - int src_height = src.getHeight(null);  
137 -  
138 - int swidth=src_width;  
139 - int sheight=src_height;  
140 -  
141 - if(angel==90||angel==270){  
142 - swidth = src_height;  
143 - sheight= src_width;  
144 - }  
145 -  
146 - Rectangle rect_des = new Rectangle(new Dimension(swidth,sheight));  
147 -  
148 - BufferedImage res = new BufferedImage(rect_des.width, rect_des.height,BufferedImage.TYPE_INT_RGB);  
149 - Graphics2D g2 = res.createGraphics();  
150 -  
151 - g2.translate((rect_des.width - src_width) / 2,  
152 - (rect_des.height - src_height) / 2);  
153 - g2.rotate(Math.toRadians(angel), src_width / 2, src_height / 2);  
154 -  
155 - g2.drawImage(src, null, null);  
156 -  
157 - ImageIO.write(res, "jpg", new File(fullPath));  
158 -  
159 - } catch (IOException e) {  
160 -  
161 - e.printStackTrace();  
162 - }  
163 -  
164 - return fullPath;  
165 -  
166 - }  
167 -  
168 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/JiaoCai.java
@@ -1,46 +0,0 @@ @@ -1,46 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import java.io.Serializable;  
4 -  
5 -public class JiaoCai implements Serializable {  
6 -  
7 -  
8 - private String ID;  
9 -  
10 - private String SubjectId;  
11 -  
12 - private String JiaoCaiName;  
13 -  
14 - public String getID() {  
15 - return ID;  
16 - }  
17 -  
18 - public void setID(String ID) {  
19 - this.ID = ID;  
20 - }  
21 -  
22 - public String getSubjectId() {  
23 - return SubjectId;  
24 - }  
25 -  
26 - public void setSubjectId(String subjectId) {  
27 - SubjectId = subjectId;  
28 - }  
29 -  
30 - public String getJiaoCaiName() {  
31 - return JiaoCaiName;  
32 - }  
33 -  
34 - public void setJiaoCaiName(String jiaoCaiName) {  
35 - JiaoCaiName = jiaoCaiName;  
36 - }  
37 -  
38 - @Override  
39 - public String toString() {  
40 - return "JiaoCai{" +  
41 - "ID='" + ID + '\'' +  
42 - ", SubjectId='" + SubjectId + '\'' +  
43 - ", JiaoCaiName='" + JiaoCaiName + '\'' +  
44 - '}';  
45 - }  
46 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/Knowledge.java
@@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import java.io.Serializable;  
4 -  
5 -public class Knowledge implements Serializable {  
6 -  
7 - private String Name;  
8 -  
9 - private String SubjectId;  
10 -  
11 - private String Id;  
12 -  
13 - public String getId() {  
14 - return Id;  
15 - }  
16 -  
17 - public void setId(String id) {  
18 - Id = id;  
19 - }  
20 -  
21 - public String getName() {  
22 - return Name;  
23 - }  
24 -  
25 - public void setName(String name) {  
26 - Name = name;  
27 - }  
28 -  
29 - public String getSubjectId() {  
30 - return SubjectId;  
31 - }  
32 -  
33 - public void setSubjectId(String subjectId) {  
34 - SubjectId = subjectId;  
35 - }  
36 -  
37 - @Override  
38 - public String toString() {  
39 - return "Knowledge{" +  
40 - "Name='" + Name + '\'' +  
41 - ", SubjectId='" + SubjectId + '\'' +  
42 - '}';  
43 - }  
44 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/MyTask.java
@@ -1,30 +0,0 @@ @@ -1,30 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import com.baidu.aip.ocr.AipOcr;  
4 -import com.baidu.aip.util.Base64Util;  
5 -import com.fasterxml.jackson.databind.ObjectMapper;  
6 -import org.json.JSONObject;  
7 -import org.springframework.boot.ApplicationArguments;  
8 -import org.springframework.boot.ApplicationRunner;  
9 -import org.springframework.http.HttpEntity;  
10 -import org.springframework.http.HttpHeaders;  
11 -import org.springframework.http.MediaType;  
12 -import org.springframework.http.ResponseEntity;  
13 -import org.springframework.stereotype.Component;  
14 -import org.springframework.util.LinkedMultiValueMap;  
15 -import org.springframework.util.MultiValueMap;  
16 -import org.springframework.web.client.RestTemplate;  
17 -  
18 -import java.util.HashMap;  
19 -  
20 -@Component  
21 -public class MyTask implements ApplicationRunner {  
22 -  
23 -  
24 -  
25 - @Override  
26 - public void run(ApplicationArguments args) throws Exception {  
27 -  
28 - System.out.println("authon:" + AuthService.getAuth());  
29 - }  
30 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/QuestionBean.java
@@ -1,277 +0,0 @@ @@ -1,277 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import java.io.Serializable;  
4 -  
5 -public class QuestionBean implements Serializable {  
6 -  
7 -  
8 - private String ID;  
9 -  
10 - private String Question;  
11 -  
12 - private String Qtype;  
13 -  
14 - private String Answer;  
15 -  
16 - private String CorrectAnswer;  
17 -  
18 - private String Analysis;  
19 -  
20 - private String State;  
21 -  
22 - private String Intime;  
23 -  
24 - private String ExamineFlag;  
25 -  
26 - private String ExamineUserId;  
27 -  
28 - private String CreateUserId;  
29 -  
30 - private String SubjectId;  
31 -  
32 - private String SchoolId;  
33 -  
34 - private String DifficulteId;  
35 -  
36 - private String KnowledgeId;  
37 -  
38 - private String ChapterId;  
39 -  
40 - private String GradeId;  
41 -  
42 - private String SourceId;  
43 -  
44 - private String OrderId;  
45 -  
46 - private String SId;  
47 -  
48 - private String StemId;  
49 -  
50 - private String AutomaticCorrection;  
51 -  
52 - private String PkgId;  
53 -  
54 - private String PkgType;  
55 -  
56 - public String getQuestion() {  
57 - return Question;  
58 - }  
59 -  
60 - public void setQuestion(String question) {  
61 - Question = question;  
62 - }  
63 -  
64 - public String getQtype() {  
65 - return Qtype;  
66 - }  
67 -  
68 - public void setQtype(String qtype) {  
69 - Qtype = qtype;  
70 - }  
71 -  
72 - public String getAnswer() {  
73 - return Answer;  
74 - }  
75 -  
76 - public void setAnswer(String answer) {  
77 - Answer = answer;  
78 - }  
79 -  
80 - public String getCorrectAnswer() {  
81 - return CorrectAnswer;  
82 - }  
83 -  
84 - public void setCorrectAnswer(String correctAnswer) {  
85 - CorrectAnswer = correctAnswer;  
86 - }  
87 -  
88 - public String getAnalysis() {  
89 - return Analysis;  
90 - }  
91 -  
92 - public void setAnalysis(String analysis) {  
93 - Analysis = analysis;  
94 - }  
95 -  
96 - public String getState() {  
97 - return State;  
98 - }  
99 -  
100 - public void setState(String state) {  
101 - State = state;  
102 - }  
103 -  
104 - public String getIntime() {  
105 - return Intime;  
106 - }  
107 -  
108 - public void setIntime(String intime) {  
109 - Intime = intime;  
110 - }  
111 -  
112 - public String getExamineFlag() {  
113 - return ExamineFlag;  
114 - }  
115 -  
116 - public void setExamineFlag(String examineFlag) {  
117 - ExamineFlag = examineFlag;  
118 - }  
119 -  
120 - public String getExamineUserId() {  
121 - return ExamineUserId;  
122 - }  
123 -  
124 - public void setExamineUserId(String examineUserId) {  
125 - ExamineUserId = examineUserId;  
126 - }  
127 -  
128 - public String getCreateUserId() {  
129 - return CreateUserId;  
130 - }  
131 -  
132 - public void setCreateUserId(String createUserId) {  
133 - CreateUserId = createUserId;  
134 - }  
135 -  
136 - public String getSubjectId() {  
137 - return SubjectId;  
138 - }  
139 -  
140 - public void setSubjectId(String subjectId) {  
141 - SubjectId = subjectId;  
142 - }  
143 -  
144 - public String getSchoolId() {  
145 - return SchoolId;  
146 - }  
147 -  
148 - public void setSchoolId(String schoolId) {  
149 - SchoolId = schoolId;  
150 - }  
151 -  
152 - public String getDifficulteId() {  
153 - return DifficulteId;  
154 - }  
155 -  
156 - public void setDifficulteId(String difficulteId) {  
157 - DifficulteId = difficulteId;  
158 - }  
159 -  
160 - public String getKnowledgeId() {  
161 - return KnowledgeId;  
162 - }  
163 -  
164 - public void setKnowledgeId(String knowledgeId) {  
165 - KnowledgeId = knowledgeId;  
166 - }  
167 -  
168 - public String getChapterId() {  
169 - return ChapterId;  
170 - }  
171 -  
172 - public void setChapterId(String chapterId) {  
173 - ChapterId = chapterId;  
174 - }  
175 -  
176 - public String getGradeId() {  
177 - return GradeId;  
178 - }  
179 -  
180 - public void setGradeId(String gradeId) {  
181 - GradeId = gradeId;  
182 - }  
183 -  
184 - public String getSourceId() {  
185 - return SourceId;  
186 - }  
187 -  
188 - public void setSourceId(String sourceId) {  
189 - SourceId = sourceId;  
190 - }  
191 -  
192 - public String getOrderId() {  
193 - return OrderId;  
194 - }  
195 -  
196 - public void setOrderId(String orderId) {  
197 - OrderId = orderId;  
198 - }  
199 -  
200 - public String getSId() {  
201 - return SId;  
202 - }  
203 -  
204 - public void setSId(String SId) {  
205 - this.SId = SId;  
206 - }  
207 -  
208 - public String getStemId() {  
209 - return StemId;  
210 - }  
211 -  
212 - public void setStemId(String stemId) {  
213 - StemId = stemId;  
214 - }  
215 -  
216 - public String getAutomaticCorrection() {  
217 - return AutomaticCorrection;  
218 - }  
219 -  
220 - public void setAutomaticCorrection(String automaticCorrection) {  
221 - AutomaticCorrection = automaticCorrection;  
222 - }  
223 -  
224 - public String getPkgId() {  
225 - return PkgId;  
226 - }  
227 -  
228 - public void setPkgId(String pkgId) {  
229 - PkgId = pkgId;  
230 - }  
231 -  
232 - public String getPkgType() {  
233 - return PkgType;  
234 - }  
235 -  
236 - public void setPkgType(String pkgType) {  
237 - PkgType = pkgType;  
238 - }  
239 -  
240 - public String getID() {  
241 - return ID;  
242 - }  
243 -  
244 - public void setID(String ID) {  
245 - this.ID = ID;  
246 - }  
247 -  
248 - @Override  
249 - public String toString() {  
250 - return "QuestionBean{" +  
251 - "ID='" + ID + '\'' +  
252 - ", Question='" + Question + '\'' +  
253 - ", Qtype='" + Qtype + '\'' +  
254 - ", Answer='" + Answer + '\'' +  
255 - ", CorrectAnswer='" + CorrectAnswer + '\'' +  
256 - ", Analysis='" + Analysis + '\'' +  
257 - ", State='" + State + '\'' +  
258 - ", Intime='" + Intime + '\'' +  
259 - ", ExamineFlag='" + ExamineFlag + '\'' +  
260 - ", ExamineUserId='" + ExamineUserId + '\'' +  
261 - ", CreateUserId='" + CreateUserId + '\'' +  
262 - ", SubjectId='" + SubjectId + '\'' +  
263 - ", SchoolId='" + SchoolId + '\'' +  
264 - ", DifficulteId='" + DifficulteId + '\'' +  
265 - ", KnowledgeId='" + KnowledgeId + '\'' +  
266 - ", ChapterId='" + ChapterId + '\'' +  
267 - ", GradeId='" + GradeId + '\'' +  
268 - ", SourceId='" + SourceId + '\'' +  
269 - ", OrderId='" + OrderId + '\'' +  
270 - ", SId='" + SId + '\'' +  
271 - ", StemId='" + StemId + '\'' +  
272 - ", AutomaticCorrection='" + AutomaticCorrection + '\'' +  
273 - ", PkgId='" + PkgId + '\'' +  
274 - ", PkgType='" + PkgType + '\'' +  
275 - '}';  
276 - }  
277 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/StudentAnswer.java
@@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import java.io.Serializable;  
4 -  
5 -public class StudentAnswer implements Serializable {  
6 -  
7 - private String ID;  
8 -  
9 - private String CorrectAnswer;  
10 -  
11 - private String Answer;  
12 -  
13 - public String getID() {  
14 - return ID;  
15 - }  
16 -  
17 - public String getAnswer() {  
18 - return Answer;  
19 - }  
20 -  
21 - public void setAnswer(String answer) {  
22 - Answer = answer;  
23 - }  
24 -  
25 - public void setID(String ID) {  
26 - this.ID = ID;  
27 - }  
28 -  
29 - public String getCorrectAnswer() {  
30 - return CorrectAnswer;  
31 - }  
32 -  
33 - public void setCorrectAnswer(String correctAnswer) {  
34 - CorrectAnswer = correctAnswer;  
35 - }  
36 -  
37 - @Override  
38 - public String toString() {  
39 - return "StudentAnswer{" +  
40 - "ID='" + ID + '\'' +  
41 - ", CorrectAnswer='" + CorrectAnswer + '\'' +  
42 - '}';  
43 - }  
44 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/StudentBean.java
@@ -1,233 +0,0 @@ @@ -1,233 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import java.io.Serializable;  
4 -import java.util.Date;  
5 -  
6 -public class StudentBean implements Serializable {  
7 -  
8 -  
9 - private long ID;  
10 - private String UserId;  
11 -  
12 - private String CustomerId;  
13 -  
14 - private int StudentType;  
15 -  
16 - private int UserType;  
17 -  
18 - private String Name;  
19 -  
20 - private int ClassId;  
21 -  
22 - private String ClassName;  
23 -  
24 - private String OldCard;  
25 -  
26 - private String Card;  
27 -  
28 - private int SchoolId;  
29 -  
30 - private int school_id;  
31 -  
32 - private int IsNew;  
33 -  
34 - private int UpdateType;  
35 -  
36 - private Date AddTime;  
37 -  
38 - private int Sex;  
39 -  
40 - private String Face;  
41 -  
42 - private String StudentCode;  
43 -  
44 - private String student_num;  
45 -  
46 - private String student_id;  
47 -  
48 - public String getUserId() {  
49 - return UserId;  
50 - }  
51 -  
52 - public void setUserId(String userId) {  
53 - UserId = userId;  
54 - }  
55 -  
56 - public String getCustomerId() {  
57 - return CustomerId;  
58 - }  
59 -  
60 - public void setCustomerId(String customerId) {  
61 - CustomerId = customerId;  
62 - }  
63 -  
64 - public int getStudentType() {  
65 - return StudentType;  
66 - }  
67 -  
68 - public void setStudentType(int studentType) {  
69 - StudentType = studentType;  
70 - }  
71 -  
72 - public int getUserType() {  
73 - return UserType;  
74 - }  
75 -  
76 - public void setUserType(int userType) {  
77 - UserType = userType;  
78 - }  
79 -  
80 - public String getName() {  
81 - return Name;  
82 - }  
83 -  
84 - public void setName(String name) {  
85 - Name = name;  
86 - }  
87 -  
88 - public int getClassId() {  
89 - return ClassId;  
90 - }  
91 -  
92 - public void setClassId(int classId) {  
93 - ClassId = classId;  
94 - }  
95 -  
96 - public String getClassName() {  
97 - return ClassName;  
98 - }  
99 -  
100 - public void setClassName(String className) {  
101 - ClassName = className;  
102 - }  
103 -  
104 - public String getOldCard() {  
105 - return OldCard;  
106 - }  
107 -  
108 - public void setOldCard(String oldCard) {  
109 - OldCard = oldCard;  
110 - }  
111 -  
112 - public String getCard() {  
113 - return Card;  
114 - }  
115 -  
116 - public int getSchool_id() {  
117 - return school_id;  
118 - }  
119 -  
120 - public void setSchool_id(int school_id) {  
121 - this.school_id = school_id;  
122 - }  
123 -  
124 - public String getStudent_num() {  
125 - return student_num;  
126 - }  
127 -  
128 - public void setStudent_num(String student_num) {  
129 - this.student_num = student_num;  
130 - }  
131 -  
132 - public void setCard(String card) {  
133 - Card = card;  
134 - }  
135 -  
136 - public int getSchoolId() {  
137 - return SchoolId;  
138 - }  
139 -  
140 - public void setSchoolId(int schoolId) {  
141 - SchoolId = schoolId;  
142 - }  
143 -  
144 - public int getIsNew() {  
145 - return IsNew;  
146 - }  
147 -  
148 - public void setIsNew(int isNew) {  
149 - IsNew = isNew;  
150 - }  
151 -  
152 - public int getUpdateType() {  
153 - return UpdateType;  
154 - }  
155 -  
156 - public void setUpdateType(int updateType) {  
157 - UpdateType = updateType;  
158 - }  
159 -  
160 - public Date getAddTime() {  
161 - return AddTime;  
162 - }  
163 -  
164 - public void setAddTime(Date addTime) {  
165 - AddTime = addTime;  
166 - }  
167 -  
168 - public int getSex() {  
169 - return Sex;  
170 - }  
171 -  
172 - public void setSex(int sex) {  
173 - Sex = sex;  
174 - }  
175 -  
176 - public String getFace() {  
177 - return Face;  
178 - }  
179 -  
180 - public void setFace(String face) {  
181 - Face = face;  
182 - }  
183 -  
184 - public String getStudentCode() {  
185 - return StudentCode;  
186 - }  
187 -  
188 - public void setStudentCode(String studentCode) {  
189 - StudentCode = studentCode;  
190 - }  
191 -  
192 - public long getID() {  
193 - return ID;  
194 - }  
195 -  
196 - public void setID(long ID) {  
197 - this.ID = ID;  
198 - }  
199 -  
200 - public String getStudent_id() {  
201 - return student_id;  
202 - }  
203 -  
204 - public void setStudent_id(String student_id) {  
205 - this.student_id = student_id;  
206 - }  
207 -  
208 - @Override  
209 - public String toString() {  
210 - return "StudentBean{" +  
211 - "ID=" + ID +  
212 - ", UserId='" + UserId + '\'' +  
213 - ", CustomerId='" + CustomerId + '\'' +  
214 - ", StudentType=" + StudentType +  
215 - ", UserType=" + UserType +  
216 - ", Name='" + Name + '\'' +  
217 - ", ClassId=" + ClassId +  
218 - ", ClassName='" + ClassName + '\'' +  
219 - ", OldCard='" + OldCard + '\'' +  
220 - ", Card='" + Card + '\'' +  
221 - ", SchoolId=" + SchoolId +  
222 - ", school_id=" + school_id +  
223 - ", IsNew=" + IsNew +  
224 - ", UpdateType=" + UpdateType +  
225 - ", AddTime=" + AddTime +  
226 - ", Sex=" + Sex +  
227 - ", Face='" + Face + '\'' +  
228 - ", StudentCode='" + StudentCode + '\'' +  
229 - ", student_num='" + student_num + '\'' +  
230 - ", student_id='" + student_id + '\'' +  
231 - '}';  
232 - }  
233 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/StudentInfo.java
@@ -1,57 +0,0 @@ @@ -1,57 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import java.io.Serializable;  
4 -  
5 -public class StudentInfo implements Serializable {  
6 -  
7 - private String student_id;  
8 -  
9 - private String name;  
10 -  
11 - private String class_name;  
12 -  
13 - private String ParentMobile;  
14 -  
15 - private String studentcode;  
16 -  
17 -  
18 - public String getStudentcode() {  
19 - return studentcode;  
20 - }  
21 -  
22 - public void setStudentcode(String studentcode) {  
23 - this.studentcode = studentcode;  
24 - }  
25 -  
26 - public String getStudent_id() {  
27 - return student_id;  
28 - }  
29 -  
30 - public void setStudent_id(String student_id) {  
31 - this.student_id = student_id;  
32 - }  
33 -  
34 - public String getName() {  
35 - return name;  
36 - }  
37 -  
38 - public void setName(String name) {  
39 - this.name = name;  
40 - }  
41 -  
42 - public String getClass_name() {  
43 - return class_name;  
44 - }  
45 -  
46 - public void setClass_name(String class_name) {  
47 - this.class_name = class_name;  
48 - }  
49 -  
50 - public String getParentMobile() {  
51 - return ParentMobile;  
52 - }  
53 -  
54 - public void setParentMobile(String parentMobile) {  
55 - ParentMobile = parentMobile;  
56 - }  
57 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/TestDao.java
@@ -1,138 +0,0 @@ @@ -1,138 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import org.apache.ibatis.annotations.*;  
4 -import org.springframework.stereotype.Repository;  
5 -  
6 -import java.util.List;  
7 -  
8 -@Repository  
9 -@Mapper  
10 -public interface TestDao {  
11 -  
12 -  
13 - @Insert("insert into TK_QuestionStem values(#{QuestionStem},#{State},#{Intime})")  
14 - int addQuestionStem(@Param("QuestionStem") String QuestionStem, @Param("State") String State, @Param("Intime") String Intime);  
15 -  
16 - @Insert("insert into TK_Question(Question,Qtype,Answer,CorrectAnswer,Analysis,State,Intime,ExamineFlag,ExamineUserId,CreateUserId,SubjectId,SchoolId,DifficulteId,KnowledgeId,ChapterId,GradeId,SourceId,OrderId,SId," +  
17 - "StemId,AutomaticCorrection,PkgId,PkgType) " +  
18 - "values(#{Question},#{Qtype},#{Answer},#{CorrectAnswer},#{Analysis},#{State},#{Intime},#{ExamineFlag},#{ExamineUserId}" +  
19 - ",#{CreateUserId},#{SubjectId},#{SchoolId},#{DifficulteId},#{KnowledgeId},#{ChapterId},#{GradeId},#{SourceId},#{OrderId},#{SId}" +  
20 - ",#{StemId},#{AutomaticCorrection},#{PkgId},#{PkgType})")  
21 - int addQuestion(@Param("Question") String Question, @Param("Qtype") String Qtype, @Param("Answer") String Answer, @Param("CorrectAnswer") String CorrectAnswer  
22 - , @Param("Analysis") String Analysis, @Param("State") String State, @Param("Intime") String Intime, @Param("ExamineFlag") String ExamineFlag, @Param("ExamineUserId") String ExamineUserId  
23 - , @Param("CreateUserId") String CreateUserId, @Param("SubjectId") String SubjectId, @Param("SchoolId") String SchoolId, @Param("DifficulteId") String DifficulteId, @Param("KnowledgeId") String KnowledgeId  
24 - , @Param("ChapterId") String ChapterId, @Param("GradeId") String GradeId, @Param("SourceId") String SourceId, @Param("OrderId") String OrderId, @Param("SId") String SId  
25 - , @Param("StemId") String StemId, @Param("AutomaticCorrection") String AutomaticCorrection, @Param("PkgId") String PkgId, @Param("PkgType") String PkgType);  
26 -  
27 - @Select("select Top(1) ID from TK_QuestionStem order by Intime desc ")  
28 - int getStemId();  
29 -  
30 - @Select("select * from TK_Question where Question like #{Question}")  
31 - List<QuestionBean> getQuestions(@Param("Question")String Question);  
32 -  
33 - @Update("update TK_Question set CorrectAnswer = #{answer},Analysis = #{explanation} where ID = #{id}")  
34 - void updateQuestion(@Param("id") String id, @Param("answer") String answer, @Param("explanation") String explanation);  
35 -  
36 -  
37 - //学生做作业  
38 - @Insert("insert into ZY_StudentAnswer (QuestionId,Answer,CorrectAnswer,QuestionType,IsCorrect,WorkID) values (" +  
39 - "#{QuestionId},#{Answer},#{CorrectAnswer},#{QuestionType},#{IsCorrect},#{WorkID})")  
40 - void StudentAnswer(@Param("QuestionId")String QuestionId,@Param("Answer")String Answer,@Param("CorrectAnswer")String CorrectAnswer,  
41 - @Param("QuestionType")String QuestionType,@Param("IsCorrect")String IsCorresct,@Param("WorkID")String WorkID);  
42 -  
43 - @Insert("insert into ZY_HomeworkReceive values(#{WorkId},#{ClassId},#{StudentId},#{StudnetAnswerIds},#{IsFinished}," +  
44 - "#{AnswerTime},#{FinishTime},#{Intime},#{IsPigai},#{IsPigai})")  
45 - void HomeworkReceive(@Param("WorkId")String WorkId,@Param("ClassId")String ClassId,@Param("StudentId")String StudentId,@Param("StudnetAnswerIds")String StudnetAnswerIds,  
46 - @Param("IsFinished")String IsFinished,@Param("AnswerTime")String AnswerTime,@Param("FinishTime")String FinishTime,@Param("Intime")String Intime,  
47 - @Param("IsPigai")String IsPigai,@Param("IsPigai")String UseTime);  
48 -  
49 - @Select("select * from TK_Question where ID = #{ID}")  
50 - QuestionBean getQues(@Param("ID")String ID);  
51 -  
52 - @Select("select StudentId from ZY_HomeworkReceive where WorkId = #{WorkId}")  
53 - List<String> getStudentIds(@Param("WorkId")String WorkId);  
54 -// )  
55 -  
56 - @Select("select ID from TK_Question where SchoolId = 885 and CorrectAnswer in('A','B','C','D') and ChapterId = #{ChapterId}")  
57 - List<String> getQIDS(@Param("ChapterId")String ChapterId );  
58 -  
59 - @Select("select ID from ZY_StudentAnswer where WorkID = #{WorkID}")  
60 - List<String> getStudentAnsIds(@Param("WorkID")String WorkID);  
61 -  
62 - //添加学生答题记录  
63 - @Insert("insert into ZY_StudentAnswer values (#{QuestionId},#{Answer},#{AnswerTime},#{CorrectAnswer},#{QuestionType},#{Pigai},#{IsCorrect},#{AppachIds},#{TeacherAppachIds},#{WorkID})")  
64 - void addStudentAnswer(@Param("QuestionId")String QuestionId,@Param("Answer")String Answer,@Param("AnswerTime")String AnswerTime,@Param("CorrectAnswer")String CorrectAnswer,  
65 - @Param("QuestionType")String QuestionType,@Param("Pigai")String Pigai,@Param("IsCorrect")String IsCorrect,@Param("AppachIds")String AppachIds,  
66 - @Param("TeacherAppachIds")String TeacherAppachIds,@Param("WorkID")String WorkID);  
67 -  
68 -  
69 - @Select("select Top(#{top}) ID from ZY_StudentAnswer where WorkID = #{WorkID} order by ID desc")  
70 - List<String> getTopIDs(@Param("WorkID")String WorkID,@Param("top")int top);  
71 -  
72 - @Select("select ID from ZY_HomeworkReceive where WorkId = #{WorkId} and ID >= #{ID} and ID<12054 order by ID desc")  
73 - List<String> get_HomeworkReceive(@Param("WorkId")String WorkId,@Param("ID")String ID);  
74 -  
75 - @Update("update ZY_HomeworkReceive set StudnetAnswerIds = #{StudnetAnswerIds} where ID = #{ID}")  
76 - void updateHomeWork(@Param("StudnetAnswerIds")String StudnetAnswerIds,@Param("ID")String ID);  
77 -  
78 - @Select("select * from ZY_HomeworkReceive where WorkId = #{WorkId} order by ID desc")  
79 - List<HomeworkReceive> get_HomeworkRec(@Param("WorkId")String WorkId);  
80 -  
81 - @Select("select Title from ZY_Homework where ID = #{ID} order by ID desc")  
82 - String getWorkName(@Param("ID") String workId);  
83 -  
84 - @Select("select * from ZY_StudentAnswer where WorkID = #{WorkId}")  
85 - List<StudentAnswer> get_stuAnswer(@Param("WorkId")String WorkId);  
86 -  
87 - @Update("update ZY_StudentAnswer set Answer = #{Answer},IsCorrect = #{IsCorrect} ,CorrectAnswer = #{CorrectAnswer} where ID = #{ID}")  
88 - void updateStudentAnswer(@Param("ID") String id,@Param("CorrectAnswer")String CorrectAnswer,@Param("Answer")String Answer,@Param("IsCorrect")String IsCorrect);  
89 -  
90 - @Select("select name from SZ_V_School_Student where student_id = #{student_id}")  
91 - String getStudentName(@Param("student_id") String studentId);  
92 -  
93 - @Select("select student_id from SZ_V_School_Student where class_id = #{class_id}")  
94 - List<String> getStudentIdsWithClassId(@Param("class_id") String class_id);  
95 -  
96 - @Select("select IsCorrect from ZY_StudentAnswer where ID = #{ID}")  
97 - int getIsCorrect(@Param("ID") String id);  
98 -  
99 - @Select("select QuestionId from ZY_StudentAnswer where WorkID = #{WorkID}")  
100 - List<String> getStuAnsIds(@Param("WorkID") String workId);  
101 -  
102 - @Select("select CorrectAnswer from ZY_StudentAnswer where WorkID = #{WorkID}")  
103 - List<String> correctAns(@Param("WorkID")String WorkID);  
104 -  
105 -  
106 - @Select("select * from ZY_TestPaper where CreatorUserId = #{CreateUserId} and Intime > #{Intime}")  
107 - List<TestPaper> getTestPapers(@Param("CreateUserId") String createUserId,@Param("Intime")String Intime);  
108 -  
109 - @Insert("insert into ZY_TestPaper values (#{addCreateUserId},#{questionIds},#{status},#{publishTime},#{name},#{isRecommend},#{state},#{intime},#{schoolId})")  
110 - void addTestPaper(@Param("addCreateUserId") String addCreateUserId, @Param("questionIds") String questionIds, @Param("status") int status,  
111 - @Param("publishTime") String publishTime, @Param("name") String name, @Param("isRecommend") int isRecommend,  
112 - @Param("state") int state, @Param("intime") String intime, @Param("schoolId") String schoolId);  
113 -  
114 - @Insert("insert into ZY_Homework values(#{addCreateUserId},#{id},#{name},#{s},#{s1},#{s2},#{s3},#{i},#{i1},#{i2},#{s4},#{i3},#{questionIds},#{i4},#{i5}) ")  
115 - void addHomework(@Param("addCreateUserId") String addCreateUserId, @Param("id") int id, @Param("name") String name,  
116 - @Param("s") String s, @Param("s1") String s1, @Param("s2") String s2, @Param("s3") String s3, @Param("i") int i,  
117 - @Param("i1") int i1, @Param("i2") int i2,@Param("s4") String s4, @Param("i3") int i3, @Param("questionIds") String questionIds, @Param("i4") int i4, @Param("i5") int i5);  
118 -  
119 -  
120 - @Select("select * from ZY_Homework where CreatorUserId in (select DISTINCT user_id from SZ_UserRole where school_id = 11)")  
121 - List<HomeBean> getCreatorUserId();  
122 -  
123 - @Select("select * from ZY_Homework where CreatorUserId = #{CreatorUserId}")  
124 - List<Homework> getHomeWork(@Param("CreatorUserId") String addCreateUserId);  
125 -  
126 - @Select("select * from SZ_V_School_Student where school_id = #{school_id}")  
127 - List<StudentInfo> getStudents(@Param("school_id") int school_id);  
128 -  
129 - @Select("select QuestionIds from ZY_Homework where ID = #{workId}")  
130 - String getQuestionIds(@Param("workId") String workId);  
131 -  
132 - @Select("select CorrectAnswer from TK_Question where ID = #{questionId}")  
133 - String getCorrectAnswer(@Param("questionId") String questionId);  
134 -  
135 -  
136 -  
137 -  
138 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/TestPaper.java
@@ -1,122 +0,0 @@ @@ -1,122 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import java.io.Serializable;  
4 -  
5 -public class TestPaper implements Serializable {  
6 -  
7 - private int ID;  
8 -  
9 - private String CreatorUserId;  
10 -  
11 - private String QuestionIds;  
12 -  
13 - private int Status;  
14 -  
15 - private String PublishTime;  
16 -  
17 - private String Name;  
18 -  
19 - private int IsRecommend;  
20 -  
21 - private int State;  
22 -  
23 - private String Intime;  
24 -  
25 - private int SchoolId;  
26 -  
27 - public String getCreatorUserId() {  
28 - return CreatorUserId;  
29 - }  
30 -  
31 - public void setCreatorUserId(String creatorUserId) {  
32 - CreatorUserId = creatorUserId;  
33 - }  
34 -  
35 - public String getQuestionIds() {  
36 - return QuestionIds;  
37 - }  
38 -  
39 - public void setQuestionIds(String questionIds) {  
40 - QuestionIds = questionIds;  
41 - }  
42 -  
43 - public int getStatus() {  
44 - return Status;  
45 - }  
46 -  
47 - public int getID() {  
48 - return ID;  
49 - }  
50 -  
51 - public void setID(int ID) {  
52 - this.ID = ID;  
53 - }  
54 -  
55 - public void setStatus(int status) {  
56 - Status = status;  
57 - }  
58 -  
59 - public String getPublishTime() {  
60 - return PublishTime;  
61 - }  
62 -  
63 - public void setPublishTime(String publishTime) {  
64 - PublishTime = publishTime;  
65 - }  
66 -  
67 - public String getName() {  
68 - return Name;  
69 - }  
70 -  
71 - public void setName(String name) {  
72 - Name = name;  
73 - }  
74 -  
75 - public int getIsRecommend() {  
76 - return IsRecommend;  
77 - }  
78 -  
79 - public void setIsRecommend(int isRecommend) {  
80 - IsRecommend = isRecommend;  
81 - }  
82 -  
83 - public int getState() {  
84 - return State;  
85 - }  
86 -  
87 - public void setState(int state) {  
88 - State = state;  
89 - }  
90 -  
91 - public String getIntime() {  
92 - return Intime;  
93 - }  
94 -  
95 - public void setIntime(String intime) {  
96 - Intime = intime;  
97 - }  
98 -  
99 - public int getSchoolId() {  
100 - return SchoolId;  
101 - }  
102 -  
103 - public void setSchoolId(int schoolId) {  
104 - SchoolId = schoolId;  
105 - }  
106 -  
107 - @Override  
108 - public String toString() {  
109 - return "TestPaper{" +  
110 - "ID=" + ID +  
111 - ", CreatorUserId='" + CreatorUserId + '\'' +  
112 - ", QuestionIds='" + QuestionIds + '\'' +  
113 - ", Status=" + Status +  
114 - ", PublishTime='" + PublishTime + '\'' +  
115 - ", Name='" + Name + '\'' +  
116 - ", IsRecommend=" + IsRecommend +  
117 - ", State=" + State +  
118 - ", Intime='" + Intime + '\'' +  
119 - ", SchoolId=" + SchoolId +  
120 - '}';  
121 - }  
122 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/dao/UserDao.java
@@ -1,29 +0,0 @@ @@ -1,29 +0,0 @@
1 -package com.sincere.weigeng.dao;  
2 -  
3 -import com.sincere.weigeng.JiaoCai;  
4 -import com.sincere.weigeng.Knowledge;  
5 -import org.apache.ibatis.annotations.*;  
6 -import org.springframework.stereotype.Repository;  
7 -  
8 -import java.util.List;  
9 -  
10 -@Repository  
11 -@Mapper  
12 -public interface UserDao {  
13 -  
14 -// @Insert("insert into HS_StudentUpdateCard (Card,SchoolId,StudentCode,CustomerId,StudentType,UserType,ClassId,ClassName,IsNew,UpdateType,AddTime) " +  
15 -// "values (#{Card},#{SchoolId},#{StudentCode},#{CustomerId},#{StudentType},#{UserType},#{ClassId},#{ClassName},#{IsNew,#{UpdateType),#{AddTime}")  
16 -// void addStudentUpdate(@Param("Card") String card, @Param("SchoolId") int school_id, @Param("StudentCode") String studentCode, @Param("CustomerId") String CustomerId  
17 -// , @Param("StudentType") String StudentType, @Param("UserType") String UserType, @Param("ClassId") String ClassId, @Param("ClassName") String ClassName,  
18 -// @Param("IsNew") String IsNew, @Param("UpdateType") String UpdateType, @Param("AddTime") String AddTime);  
19 -  
20 -  
21 - @Select ("select * from ZY_YYKnowledge where AddTime >2019 ")  
22 - List<Knowledge> getKnowledge();  
23 -  
24 - @Select("select * from ZY_YYJiaoCai where ID >= 26")  
25 - List<JiaoCai> getJiaoCai();  
26 -  
27 - @Insert("insert into ZY_YYJiaoCaiAndKnowledg values(#{id},#{id1},#{i},#{i1})")  
28 - void addKnowAndJicaoCai(@Param("id") String id, @Param("id1") String id1, @Param("i") int i, @Param("i1") int i1);  
29 -}  
cloud/weigeng/src/main/resources/mybatis-config.xml
@@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@
1 -<?xml version="1.0" encoding="UTF-8"?>  
2 -<!DOCTYPE configuration  
3 - PUBLIC "-//mybatis.org//DTD Config 3.0//EN"  
4 - "http://mybatis.org/dtd/mybatis-3-config.dtd">  
5 -  
6 -<configuration>  
7 - <properties >  
8 - <property name="dialect" value="mysql" />  
9 - </properties>  
10 - <settings>  
11 - <!-- 这个配置使全局的映射器启用或禁用缓存。系统默认值是true,设置只是为了展示出来 -->  
12 - <setting name="cacheEnabled" value="true" />  
13 - <!-- 全局启用或禁用延迟加载。当禁用时,所有关联对象都会即时加载。 系统默认值是true,设置只是为了展示出来 -->  
14 - <setting name="lazyLoadingEnabled" value="true" />  
15 - <!-- 允许或不允许多种结果集从一个单独的语句中返回(需要适合的驱动)。 系统默认值是true,设置只是为了展示出来 -->  
16 - <setting name="multipleResultSetsEnabled" value="true" />  
17 - <!--使用列标签代替列名。不同的驱动在这方便表现不同。参考驱动文档或充分测试两种方法来决定所使用的驱动。 系统默认值是true,设置只是为了展示出来 -->  
18 - <setting name="useColumnLabel" value="true" />  
19 - <!--允许 JDBC 支持生成的键。需要适合的驱动。如果设置为 true 则这个设置强制生成的键被使用,尽管一些驱动拒绝兼容但仍然有效(比如  
20 - Derby)。 系统默认值是false,设置只是为了展示出来 -->  
21 - <setting name="useGeneratedKeys" value="false" />  
22 - <!--配置默认的执行器。SIMPLE 执行器没有什么特别之处。REUSE 执行器重用预处理语句。BATCH 执行器重用语句和批量更新 系统默认值是SIMPLE,设置只是为了展示出来 -->  
23 - <setting name="defaultExecutorType" value="SIMPLE" />  
24 - <!--设置超时时间,它决定驱动等待一个数据库响应的时间。 系统默认值是null,设置只是为了展示出来 -->  
25 - <setting name="defaultStatementTimeout" value="25000" />  
26 - </settings>  
27 -  
28 - <!--<typeAliases>-->  
29 - <!--<typeAlias alias="user" type="com.shunzhi.mqtt2kanban.bean.User"/>-->  
30 - <!--</typeAliases>-->  
31 -  
32 - <!--<mappers>-->  
33 - <!--<control resource="mybatis/control/UserMapper.xml"/>-->  
34 - <!--</mappers>-->  
35 -</configuration>  
cloud/weigeng/src/test/java/com/sincere/weigeng/WeigengApplicationTests.java
@@ -1,570 +0,0 @@ @@ -1,570 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import com.drew.imaging.jpeg.JpegMetadataReader;  
4 -import com.drew.imaging.jpeg.JpegProcessingException;  
5 -import com.drew.metadata.Directory;  
6 -import com.drew.metadata.Metadata;  
7 -import com.drew.metadata.Tag;  
8 -import com.drew.metadata.exif.ExifDirectory;  
9 -import com.sincere.weigeng.dao.UserDao;  
10 -import org.apache.poi.hssf.usermodel.HSSFCell;  
11 -import org.apache.poi.hssf.usermodel.HSSFRow;  
12 -import org.apache.poi.hssf.usermodel.HSSFSheet;  
13 -import org.apache.poi.hssf.usermodel.HSSFWorkbook;  
14 -import org.json.JSONArray;  
15 -import org.json.JSONObject;  
16 -import org.junit.Test;  
17 -import org.junit.runner.RunWith;  
18 -import org.springframework.beans.factory.annotation.Autowired;  
19 -import org.springframework.boot.test.context.SpringBootTest;  
20 -import org.springframework.http.HttpEntity;  
21 -import org.springframework.http.HttpHeaders;  
22 -import org.springframework.http.MediaType;  
23 -import org.springframework.http.ResponseEntity;  
24 -import org.springframework.test.context.junit4.SpringRunner;  
25 -import org.springframework.util.LinkedMultiValueMap;  
26 -import org.springframework.util.MultiValueMap;  
27 -import org.springframework.web.client.RestTemplate;  
28 -  
29 -import javax.imageio.ImageIO;  
30 -import java.awt.*;  
31 -import java.awt.image.BufferedImage;  
32 -import java.io.*;  
33 -import java.text.SimpleDateFormat;  
34 -import java.util.*;  
35 -import java.util.List;  
36 -  
37 -@RunWith(SpringRunner.class)  
38 -@SpringBootTest  
39 -public class WeigengApplicationTests {  
40 -  
41 - @Autowired  
42 - TestDao testDao;  
43 -  
44 - @Test  
45 - public void contextLoads() {  
46 -  
47 - try {  
48 - BufferedReader bufferedReader = new BufferedReader(new FileReader("C:\\Users\\taohandong\\Desktop\\json.txt"));  
49 - String content = null;  
50 - StringBuilder stringBuilder = new StringBuilder();  
51 - while ((content = bufferedReader.readLine()) != null) {  
52 - stringBuilder.append(content);  
53 - }  
54 -  
55 - JSONObject jsonObject = new JSONObject(stringBuilder.toString());  
56 - JSONObject data = jsonObject.optJSONObject("data");  
57 - JSONArray questions = data.optJSONArray("questions");  
58 - for (int i = 0; i < questions.length(); i++) {  
59 - JSONObject question = questions.optJSONObject(i);  
60 - String question_text = question.optString("question_text");  
61 - String answer = question.optString("answer");//答案  
62 - String explanation = question.optString("explanation");//解析  
63 -// <p><img src="/Web/Assets/ueditor/asp/upload/image/20190916/15686369926495741.png" title="image.png" alt="image.png"/></p>  
64 - explanation = "<p><img src=\"" + explanation + "\" title=\"image.png\" alt=\"image.png\"/></p>";  
65 - answer = getAnswer(answer);  
66 - System.out.println("question_text:" + question_text + "\r\nanswer:" + answer + "\r\nexplanation:" + explanation);  
67 - List<QuestionBean> questionBeans = testDao.getQuestions(question_text);//获取题目  
68 - for (int j = 0; j < questionBeans.size(); j++) {  
69 - QuestionBean questionBean = questionBeans.get(j);  
70 - testDao.updateQuestion(questionBean.getID(), answer, explanation);  
71 - }  
72 -// System.out.println(questionBeans.toString());  
73 - }  
74 -  
75 - } catch (FileNotFoundException e) {  
76 - e.printStackTrace();  
77 - } catch (IOException e) {  
78 - e.printStackTrace();  
79 - }  
80 -  
81 - }  
82 -  
83 - private String url = "https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic?access_token=24.26683b650b73b63e0b08afa7ac36e880.2592000.1571310480.282335-15990462";  
84 -  
85 - private String getAnswer(String imgUrl) {  
86 - RestTemplate restTemplate = new RestTemplate();  
87 -  
88 - HttpHeaders headers = new HttpHeaders();  
89 - headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);  
90 -  
91 - MultiValueMap<String, String> multiValueMap = new LinkedMultiValueMap<>();  
92 -// multiValueMap.add("image", ImageUtils.ImageToBase64ByLocal("C:\\Users\\taohandong\\Desktop\\识别.png"));  
93 - multiValueMap.add("url", imgUrl);  
94 - HttpEntity<MultiValueMap> requestEntity = new HttpEntity<MultiValueMap>(multiValueMap,  
95 -  
96 - headers);  
97 -  
98 - ResponseEntity<String> result = restTemplate.postForEntity(url, requestEntity, String.class);  
99 -  
100 - JSONObject jsonObject = new JSONObject(result.getBody());  
101 -// System.out.println("result:"+result.getBody());  
102 - JSONArray words_result = jsonObject.optJSONArray("words_result");  
103 -// System.out.println("words_result:"+words_result);  
104 - StringBuilder stringBuilder = new StringBuilder();  
105 - if (words_result != null) {  
106 - for (int i = 0; i < words_result.length(); i++) {  
107 - String words = words_result.optJSONObject(i).optString("words");  
108 - stringBuilder.append(words + " ");  
109 - }  
110 - System.out.println("result:" + stringBuilder.toString());  
111 - }  
112 - return stringBuilder.toString().equals("") ? "B" : stringBuilder.toString();  
113 - }  
114 -  
115 - @Test  
116 - public void get() {  
117 -  
118 -// String url = "https://zujuan.21cnjy.com/api/question/list?xd=1&chid=3&categories=3877&knowledges=&question_channel_type=1&difficult_index=&exam_type=&kid_num=&grade_id=&sort_field=time&filterquestion=0&page=&_grade_id=&tree_type=category&version_id=&_=1568766250186";  
119 -// RestTemplate restTemplate = new RestTemplate();  
120 -// System.out.println(restTemplate.getForObject(url, String.class));  
121 - /*String createrUserId = "zy273789", time = "2019-10-08";  
122 - List<TestPaper> testPaperList = testDao.getTestPapers(createrUserId, time);  
123 - for (int i = 0; i < testPaperList.size(); i++) {  
124 - TestPaper testPaper = testPaperList.get(i);  
125 - int schoolId = 11;  
126 - testDao.addTestPaper("zy284782", testPaper.getQuestionIds(), testPaper.getStatus(), testPaper.getPublishTime(),  
127 - testPaper.getName(), testPaper.getIsRecommend(), testPaper.getState(), testPaper.getIntime(), schoolId + "");  
128 -  
129 - }*/  
130 -  
131 - }  
132 -  
133 -  
134 - /**  
135 - * 创建试卷  
136 - */  
137 - @Test  
138 - public void createTestPaper() {  
139 - String createUserId = "zy309728";  
140 - List<TestPaper> testPaperList = testDao.getTestPapers(createUserId, "2019-09-18 16:00:00");  
141 - System.out.println("testPaperList:" + testPaperList.toString());  
142 -  
143 - String addCreateUserId = "zy411337", SchoolId = "885";  
144 - /* for (int i = 1; i < testPaperList.size(); i++) {  
145 - TestPaper testPaper = testPaperList.get(i);  
146 - int ID = testPaper.getID();  
147 - //添加试卷  
148 - testDao.addTestPaper(addCreateUserId, testPaper.getQuestionIds(), testPaper.getStatus(), testPaper.getPublishTime()  
149 - , testPaper.getName(), testPaper.getIsRecommend(), testPaper.getState(), testPaper.getIntime(), SchoolId);  
150 -  
151 - //发布作业  
152 - testDao.addHomework(addCreateUserId, testPaper.getID(), testPaper.getName(), "50", "2019-09-20 18:00", "2", "2019-09-19 19:10", 1, 0, 1, "2019-09-19 19:10", 0, testPaper.getQuestionIds(), 0, 0);  
153 - }*/  
154 - /*String[] answers = new String[]{"A", "B", "C", "D"};  
155 - String QuestionType = "1";  
156 - String CorrectAnswer = "";  
157 - List<Homework> homeworkList = testDao.getHomeWork(addCreateUserId);  
158 - for (int i = 0; i < homeworkList.size(); i++) {  
159 - Homework homework = homeworkList.get(i);  
160 - String[] questionIds = homework.getQuestionIds().split(",");  
161 - for (int j = 0; j < questionIds.length; j++) {  
162 - String questionId = questionIds[j];  
163 - QuestionBean questionBean = testDao.getQues(questionId);  
164 - CorrectAnswer = questionBean.getCorrectAnswer();  
165 - String answer = answers[new Random().nextInt(4)];  
166 - String IsCorresct = answer.trim().equals(CorrectAnswer.trim()) ? "1" : "3";  
167 - testDao.StudentAnswer(questionId, answer, CorrectAnswer, QuestionType, IsCorresct, homework.getID());  
168 - }  
169 -  
170 - }*/  
171 -// if (ID <= 4191 && ID >= 4187) {  
172 - String classId = "36398";  
173 - List<Homework> homeworkList = testDao.getHomeWork(addCreateUserId);  
174 - for (int i = 0; i < homeworkList.size(); i++) {  
175 - String workId = homeworkList.get(i).getID();  
176 -// List<String> stuAnsIds = testDao.getStudentAnsIds(workId);  
177 -// String stuAnIds = stuAnsIds.toString().replace("[", "");  
178 -// stuAnIds = stuAnIds.replace("]", "");  
179 -  
180 - List<String> strings = testDao.getStudentIdsWithClassId(classId);  
181 - String stuIds = strings.toString().replace("[", "");  
182 - stuIds = stuIds.replace("]", "");  
183 - String[] stuStrings = stuIds.split(",");//学生id  
184 -  
185 - for (int j = 0; j < stuStrings.length; j++) {  
186 - String studentId = stuStrings[j];  
187 -  
188 - testDao.HomeworkReceive(workId, classId, studentId, "", "1", j + "", "2019-09-23 21:28:00", "2019-09-22 17:50:00", "1", j + "");  
189 - }  
190 -  
191 - }  
192 -  
193 - }  
194 -  
195 - @Autowired  
196 - UserDao userDao;  
197 -  
198 - @Test  
199 - public void doHomeWork() {  
200 - StudentBean studentBean = new StudentBean();  
201 - studentBean.setCard("9A1229A9");  
202 - studentBean.setSchool_id(110);  
203 - studentBean.setStudentCode("140881200710270056");  
204 - studentBean.setCustomerId("583912");  
205 -  
206 -// userDao.addStudentUpdate(studentBean.getCard(),studentBean.getSchool_id(),studentBean.getStudentCode(),studentBean.getCustomerId(),"1","2"  
207 -// ,"55640","2014级(08)班","0","1","2019-09-22 16:26");  
208 -  
209 - /* String QuestionId = "21656, 21657, 21658, 21659, 21753, 21706, 21724, 21796, 21797, 21798";  
210 - String Answer = "";  
211 - String CorrectAnswer = "";  
212 - String QuestionType = "1";  
213 - String IsCorresct = "";  
214 - String WorkID = "4198";  
215 - String[] questionIds = QuestionId.split(",");  
216 - for (int i = 0; i < questionIds.length; i++) {  
217 - String questionId = questionIds[i];  
218 - QuestionBean questionBean = testDao.getQues(questionId);  
219 - CorrectAnswer = questionBean.getCorrectAnswer();  
220 - Answer = "B";  
221 - IsCorresct = Answer.trim().equals(CorrectAnswer.trim()) ? "1" : "3";  
222 - testDao.StudentAnswer(questionId, Answer, CorrectAnswer, QuestionType, IsCorresct, WorkID);  
223 - }*/  
224 -  
225 - }  
226 -  
227 -  
228 - @Test  
229 - public void HomeworkRec() {  
230 - String WorkID = "4198";  
231 - String ClassId = "";  
232 - //查询学生id  
233 - List<String> list = testDao.getStudentIds("4172");  
234 - String StudentIds = list.toString().replace("[", "");  
235 - StudentIds = StudentIds.replace("]", "");  
236 - System.out.println("StudentIds:" + StudentIds);  
237 - String StudnetAnswerIds = testDao.getStudentAnsIds(WorkID).toString().replace("[", "");  
238 - StudnetAnswerIds = StudnetAnswerIds.replace("]", "");  
239 - String[] studentIds = StudentIds.split(",");  
240 - for (int i = 0; i < studentIds.length; i++) {  
241 - String studentId = studentIds[i];  
242 - String finishTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());  
243 - testDao.HomeworkReceive(WorkID, ClassId, studentId, StudnetAnswerIds, "1", i + "", "2019-09-19 16:50", finishTime  
244 - , "1", "" + i);  
245 - }  
246 - }  
247 -  
248 - @Test  
249 - public void getQIds() {  
250 -  
251 - List<Knowledge> knowledges = userDao.getKnowledge();  
252 - System.out.println("knowledges:" + knowledges.toString());  
253 -  
254 - List<JiaoCai> jiaoCais = userDao.getJiaoCai();  
255 - System.out.println("jiaoCais:" + jiaoCais.toString());  
256 -  
257 - for (int i = 0; i < 1; i++) {  
258 - JiaoCai jiaoCai = jiaoCais.get(i);  
259 - String SubjectId = jiaoCai.getSubjectId();  
260 - for (int j = 0; j < knowledges.size(); j++) {  
261 - Knowledge knowledge = knowledges.get(j);  
262 - if (SubjectId.equals(knowledge.getSubjectId())) {  
263 - userDao.addKnowAndJicaoCai(jiaoCai.getID(), knowledge.getId(), 0, 1);  
264 - }  
265 - }  
266 -  
267 - }  
268 -  
269 - }  
270 -  
271 - @Test  
272 - public void tongji() {  
273 -  
274 - String[] answers = new String[]{"A", "B", "C", "D", "A", "A"};  
275 - String createUserId = "zy411337";  
276 - List<Homework> homeworkList = testDao.getHomeWork(createUserId);//获取布置的作业  
277 - System.out.println("homeworkList:" + homeworkList);  
278 - for (int m = 0; m < homeworkList.size(); m++) {  
279 - String WorkId = homeworkList.get(m).getID();  
280 - Map<String, List<String>> mapRecIDs = new HashMap<>();  
281 - System.out.println("workId:" + WorkId);  
282 -// List<String> queIds = testDao.getStuAnsIds(WorkId);  
283 -// String questionIds = queIds.toString().replace("[", "");  
284 -// questionIds = questionIds.replace("]", "");  
285 -  
286 - //获取正确答案  
287 -// List<String> correct = testDao.correctAns(WorkId);  
288 -// String corrStr = correct.toString().replace("[", "");  
289 -// corrStr = corrStr.replace("]", "");  
290 -// String[] correctAnser = corrStr.split(",");  
291 -  
292 - String questionIds = testDao.getQuestionIds(WorkId);  
293 -  
294 - //获取答题学生数量  
295 - List<String> homeworkReceiveIds = testDao.get_HomeworkReceive(WorkId, "12012");  
296 - System.out.println("homeworkReceiveIds:" + homeworkReceiveIds.size());  
297 - for (int j = 0; j < homeworkReceiveIds.size(); j++) {//接收学生数量  
298 -  
299 - String[] quesStirngs = questionIds.split(",");  
300 - System.out.println("quesStirngs:" + quesStirngs.length);  
301 - for (int i = 0; i < quesStirngs.length; i++) {  
302 - String questionId = quesStirngs[i];  
303 - String CorrectAnswer = testDao.getCorrectAnswer(questionId);  
304 - int randow = new Random().nextInt(6);  
305 - String answer = null;  
306 - String isCorrsct = "";  
307 - if (randow == 0 || randow == 1 || randow == 2 || randow == 3 || randow == 4) {  
308 - answer = CorrectAnswer.trim();  
309 - isCorrsct = "1";  
310 - } else {  
311 - answer = answers[randow];  
312 - isCorrsct = "3";  
313 - }  
314 - //插入一条新的记录  
315 - testDao.addStudentAnswer(quesStirngs[i], answer.trim(), "", CorrectAnswer.trim(), "1", "", isCorrsct, "", "", WorkId);  
316 - }  
317 - //获取最新的十条记录  
318 - List<String> idLists = testDao.getTopIDs(WorkId, questionIds.split(",").length);  
319 - System.out.println("idLists:" + idLists.toString());  
320 - mapRecIDs.put(j + "", idLists);  
321 - }  
322 -// System.out.println("mapRecIDs:" + mapRecIDs.toString() + " 0:" + mapRecIDs.get("0").toString().replace("[", ""));  
323 -  
324 - for (int i = 0; i < homeworkReceiveIds.size(); i++) {  
325 - String homeRecId = homeworkReceiveIds.get(i);  
326 - System.out.println("i:" + i);  
327 - String ansIds = mapRecIDs.get(i + "").toString().replace("[", "");  
328 - ansIds = ansIds.replace("]", "");  
329 - testDao.updateHomeWork(ansIds, homeRecId);  
330 - }  
331 -  
332 - List<HomeworkReceive> homRecIDs = testDao.get_HomeworkRec(WorkId);  
333 -  
334 - Map<String, String> stuMap = new HashMap<>();  
335 - for (int i = 0; i < homRecIDs.size(); i++) {  
336 - HomeworkReceive homeworkReceive = homRecIDs.get(i);  
337 -  
338 - String studentId = homeworkReceive.getStudentId();  
339 -  
340 - String studentName = testDao.getStudentName(studentId);  
341 -  
342 - String studnetAnswerIds = homeworkReceive.getStudnetAnswerIds();  
343 -  
344 - String[] stuIds = studnetAnswerIds.split(",");  
345 -  
346 - String isC = "";  
347 - for (int j = 0; j < stuIds.length; j++) {  
348 - String id = stuIds[j];  
349 - int idCorrect = testDao.getIsCorrect(id);  
350 - if (idCorrect == 1) {  
351 - isC += "1 ";  
352 - } else if (idCorrect == 3) {  
353 - isC += "0 ";  
354 - }  
355 - }  
356 - stuMap.put(studentName, isC);  
357 - System.out.println("" + studentName + " " + isC);  
358 -  
359 - }  
360 -  
361 - }  
362 - }  
363 -  
364 - private void writeToExcel(HSSFWorkbook workbook, String HomeworkTitle, Map<String, String[]> correctAns, String[] names, String title) {  
365 - //第二部,在workbook中创建一个sheet对应excel中的sheet  
366 - HSSFSheet sheet = workbook.createSheet(HomeworkTitle);  
367 - //第三部,在sheet表中添加表头第0行,老版本的poi对sheet的行列有限制  
368 - HSSFRow row = sheet.createRow(0);  
369 - //第四步,创建单元格,设置表头  
370 - HSSFCell cell = null;  
371 - for (int i = 0; i < correctAns.get(names[0]).length; i++) {  
372 - cell = row.createCell(i);  
373 - cell.setCellValue("第" + (i + 1) + "");  
374 - }  
375 -  
376 - //第五步,写入数据  
377 - for (int i = 0; i < names.length; i++) {  
378 -  
379 -// String oneData =correctAns[i];//姓名对应的正确率  
380 - HSSFRow row1 = sheet.createRow(i + 1);  
381 - String[] corrects = correctAns.get(names[i]);  
382 - System.out.println("names:" + names[i]);  
383 - for (int j = 0; j < corrects.length; j++) {  
384 - //创建单元格设值  
385 - row1.createCell(j).setCellValue(corrects[j]);  
386 - }  
387 - row1.createCell(corrects.length).setCellValue(names[i]);  
388 - }  
389 -  
390 - //将文件保存到指定的位置  
391 - try {  
392 - File file = new File("C:\\Users\\taohandong\\Desktop\\文澜\\"+title+".xls");  
393 - if (!file.exists())file.createNewFile();  
394 - FileOutputStream fos = new FileOutputStream(file);  
395 - workbook.write(fos);  
396 - System.out.println("写入成功");  
397 - fos.close();  
398 - } catch (IOException e) {  
399 - e.printStackTrace();  
400 - }  
401 -  
402 - }  
403 -  
404 -  
405 - @Test  
406 - public void getStu() {  
407 - //第一步,创建一个workbook对应一个excel文件  
408 - HSSFWorkbook workbook = new HSSFWorkbook();  
409 -  
410 - String createUserId = "zy595910";  
411 - String title="作业";  
412 - //ZY_Homework表取出要统计的作业  
413 - String WorkId = "4408";  
414 - String workName = testDao.getWorkName(WorkId);  
415 -  
416 - //ZY_HomeworkReceive 表获取学生作业答题情况;  
417 - List<HomeworkReceive> homRecIDs = testDao.get_HomeworkRec(WorkId);  
418 -  
419 - Map<String, String[]> stuMap = new HashMap<>();  
420 - String[] names = new String[homRecIDs.size()];  
421 - String[] isCorrect = null;  
422 - for (int i = 0; i < homRecIDs.size(); i++) {  
423 - HomeworkReceive homeworkReceive = homRecIDs.get(i);  
424 -  
425 - String studentId = homeworkReceive.getStudentId();  
426 -  
427 - String studentName = testDao.getStudentName(studentId);  
428 -  
429 - String studnetAnswerIds = homeworkReceive.getStudnetAnswerIds();  
430 -// System.out.println("studnetAnswerIds:"+studnetAnswerIds+" WorkId:"+WorkId + " StudentId:"+studentId);  
431 - if (null != studnetAnswerIds) {  
432 - names[i] = studentName;  
433 - String[] stuIds = studnetAnswerIds.split(",");  
434 - isCorrect = new String[stuIds.length];  
435 - String isC = "";  
436 - for (int j = 0; j < stuIds.length; j++) {  
437 - String id = stuIds[j];  
438 - System.out.println("IsCorrectId:" + id);  
439 - //ZY_StudentAnswer表获取题目是否正确  
440 - int idCorrect = testDao.getIsCorrect(id);  
441 - if (idCorrect == 1) {  
442 - isC += "1 ";  
443 - isCorrect[j] = "1";  
444 - } else if (idCorrect == 3) {  
445 - isC += "0 ";  
446 - isCorrect[j] = "0";  
447 - }  
448 - }  
449 - stuMap.put(studentName, isCorrect);  
450 - System.out.println("" + studentName + " " + isC);  
451 - }  
452 - }  
453 - if (names!=null&&stuMap.size()>0)  
454 - writeToExcel(workbook, workName, stuMap, names,title);  
455 -// System.out.println("stuMap:" + stuMap.toString());  
456 - }  
457 -  
458 -  
459 - /**  
460 - * 旋转图片  
461 - */  
462 - @Test  
463 - public void trnImgs() {  
464 -  
465 - File file = new File("C:\\TaoHandong\\copy\\school479\\StudentCompressed");  
466 - File[] files = file.listFiles();  
467 -  
468 - List<StudentInfo> studentInfos = testDao.getStudents(479);  
469 -  
470 - List<StudentInfo> studentInfoList = new ArrayList<>();  
471 -  
472 - for (int i = 0; i < studentInfos.size(); i++) {  
473 - StudentInfo studentInfo = studentInfos.get(i);  
474 -  
475 - boolean isHas = false;  
476 - for (int j = 0; j < files.length; j++) {  
477 - File img = files[j];  
478 - String imgName = img.getName().split("\\.")[0];  
479 -  
480 - if (imgName.equals(studentInfo.getStudentcode())) {  
481 - isHas = true;  
482 - break;  
483 - }  
484 -  
485 - }  
486 -  
487 - if (!isHas) {  
488 - studentInfoList.add(studentInfo);  
489 - }  
490 -  
491 - }  
492 -  
493 - System.out.println("studentInfoList:" + studentInfoList);  
494 - //第一步,创建一个workbook对应一个excel文件  
495 - HSSFWorkbook workbook = new HSSFWorkbook();  
496 - //第二部,在workbook中创建一个sheet对应excel中的sheet  
497 - HSSFSheet sheet = workbook.createSheet("缺少的学生人脸");  
498 - //第三部,在sheet表中添加表头第0行,老版本的poi对sheet的行列有限制  
499 - HSSFRow row = sheet.createRow(0);  
500 -  
501 - String[] titles = new String[]{"姓名", "班级", "学籍号", "号码"};  
502 - //第四步,创建单元格,设置表头  
503 - HSSFCell cell = null;  
504 - for (int i = 0; i < titles.length; i++) {  
505 - cell = row.createCell(i);  
506 - cell.setCellValue(titles[i]);  
507 - }  
508 -  
509 - //第五步,写入数据  
510 - for (int i = 0; i < studentInfoList.size(); i++) {  
511 - HSSFRow row1 = sheet.createRow(i + 1);  
512 - for (int j = 0; j < titles.length; j++) {  
513 - String value = studentInfoList.get(i).getClass_name();  
514 - switch (j) {  
515 - case 0:  
516 - value = studentInfoList.get(i).getName();  
517 - break;  
518 - case 1:  
519 - value = studentInfoList.get(i).getClass_name();  
520 - break;  
521 - case 2:  
522 - value = studentInfoList.get(i).getStudentcode();  
523 - break;  
524 - case 3:  
525 - value = studentInfoList.get(i).getParentMobile();  
526 - break;  
527 - }  
528 - //创建单元格设值  
529 - row1.createCell(j).setCellValue(value);  
530 - }  
531 - }  
532 -  
533 - //将文件保存到指定的位置  
534 - try {  
535 - FileOutputStream fos = new FileOutputStream("C:\\Users\\taohandong\\Desktop\\result.xls");  
536 - workbook.write(fos);  
537 - System.out.println("写入成功");  
538 - fos.close();  
539 - } catch (IOException e) {  
540 - e.printStackTrace();  
541 - }  
542 -  
543 - /* File file = new File("C:\\TaoHandong\\copy\\School1030\\Student");  
544 -  
545 - File outFile = new File("C:\\TaoHandong\\copy\\School1030\\Student1");  
546 -  
547 - if (!outFile.exists()) outFile.mkdirs();  
548 -  
549 - File[] files = file.listFiles();  
550 - System.out.println("files:" + files.length);  
551 - BufferedImage bufferedImage;  
552 - for (int i = 0; i < files.length; i++) {  
553 - File img = files[i];  
554 - int ang = ImageUtils.getImgRotateAngle(img.getAbsolutePath());  
555 - System.out.println(img.getName() + " ang:" + ang);  
556 -// try {  
557 -// bufferedImage = ImageIO.read(img);  
558 -// moveImg(bufferedImage,img,outFile);  
559 -// } catch (IOException e) {  
560 -// e.printStackTrace();  
561 -// }  
562 -  
563 - }*/  
564 -  
565 - }  
566 -  
567 - private List<String> name = new ArrayList<>();  
568 -  
569 -  
570 -}