Commit 46343ee17efa6107cbcb04e8ce0965fd30852941

Authored by 陶汉栋
1 parent f0ac21af
Exists in master

no message

Showing 27 changed files with 805 additions and 448 deletions   Show diff stats
cloud/common/src/main/java/com/sincere/common/dto/admin/QuestionBean.java 0 → 100644
... ... @@ -0,0 +1,275 @@
  1 +package com.sincere.common.dto.admin;
  2 +
  3 +import java.io.Serializable;
  4 +
  5 +public class QuestionBean implements Serializable {
  6 +
  7 + private String ID;
  8 + private String Question;
  9 +
  10 + private String Qtype;
  11 +
  12 + private String Answer;
  13 +
  14 + private String CorrectAnswer;
  15 +
  16 + private String Analysis;
  17 +
  18 + private String State;
  19 +
  20 + private String Intime;
  21 +
  22 + private String ExamineFlag;
  23 +
  24 + private String ExamineUserId;
  25 +
  26 + private String CreateUserId;
  27 +
  28 + private String SubjectId;
  29 +
  30 + private String SchoolId;
  31 +
  32 + private String DifficulteId;
  33 +
  34 + private String KnowledgeId;
  35 +
  36 + private String ChapterId;
  37 +
  38 + private String GradeId;
  39 +
  40 + private String SourceId;
  41 +
  42 + private String OrderId;
  43 +
  44 + private String SId;
  45 +
  46 + private String StemId;
  47 +
  48 + private String AutomaticCorrection;
  49 +
  50 + private String PkgId;
  51 +
  52 + private String PkgType;
  53 +
  54 + public String getQuestion() {
  55 + return Question;
  56 + }
  57 +
  58 + public void setQuestion(String question) {
  59 + Question = question;
  60 + }
  61 +
  62 + public String getQtype() {
  63 + return Qtype;
  64 + }
  65 +
  66 + public void setQtype(String qtype) {
  67 + Qtype = qtype;
  68 + }
  69 +
  70 + public String getAnswer() {
  71 + return Answer;
  72 + }
  73 +
  74 + public void setAnswer(String answer) {
  75 + Answer = answer;
  76 + }
  77 +
  78 + public String getCorrectAnswer() {
  79 + return CorrectAnswer;
  80 + }
  81 +
  82 + public void setCorrectAnswer(String correctAnswer) {
  83 + CorrectAnswer = correctAnswer;
  84 + }
  85 +
  86 + public String getAnalysis() {
  87 + return Analysis;
  88 + }
  89 +
  90 + public void setAnalysis(String analysis) {
  91 + Analysis = analysis;
  92 + }
  93 +
  94 + public String getState() {
  95 + return State;
  96 + }
  97 +
  98 + public void setState(String state) {
  99 + State = state;
  100 + }
  101 +
  102 + public String getIntime() {
  103 + return Intime;
  104 + }
  105 +
  106 + public void setIntime(String intime) {
  107 + Intime = intime;
  108 + }
  109 +
  110 + public String getExamineFlag() {
  111 + return ExamineFlag;
  112 + }
  113 +
  114 + public void setExamineFlag(String examineFlag) {
  115 + ExamineFlag = examineFlag;
  116 + }
  117 +
  118 + public String getExamineUserId() {
  119 + return ExamineUserId;
  120 + }
  121 +
  122 + public String getID() {
  123 + return ID;
  124 + }
  125 +
  126 + public void setID(String ID) {
  127 + this.ID = ID;
  128 + }
  129 +
  130 + public void setExamineUserId(String examineUserId) {
  131 + ExamineUserId = examineUserId;
  132 + }
  133 +
  134 + public String getCreateUserId() {
  135 + return CreateUserId;
  136 + }
  137 +
  138 + public void setCreateUserId(String createUserId) {
  139 + CreateUserId = createUserId;
  140 + }
  141 +
  142 + public String getSubjectId() {
  143 + return SubjectId;
  144 + }
  145 +
  146 + public void setSubjectId(String subjectId) {
  147 + SubjectId = subjectId;
  148 + }
  149 +
  150 + public String getSchoolId() {
  151 + return SchoolId;
  152 + }
  153 +
  154 + public void setSchoolId(String schoolId) {
  155 + SchoolId = schoolId;
  156 + }
  157 +
  158 + public String getDifficulteId() {
  159 + return DifficulteId;
  160 + }
  161 +
  162 + public void setDifficulteId(String difficulteId) {
  163 + DifficulteId = difficulteId;
  164 + }
  165 +
  166 + public String getKnowledgeId() {
  167 + return KnowledgeId;
  168 + }
  169 +
  170 + public void setKnowledgeId(String knowledgeId) {
  171 + KnowledgeId = knowledgeId;
  172 + }
  173 +
  174 + public String getChapterId() {
  175 + return ChapterId;
  176 + }
  177 +
  178 + public void setChapterId(String chapterId) {
  179 + ChapterId = chapterId;
  180 + }
  181 +
  182 + public String getGradeId() {
  183 + return GradeId;
  184 + }
  185 +
  186 + public void setGradeId(String gradeId) {
  187 + GradeId = gradeId;
  188 + }
  189 +
  190 + public String getSourceId() {
  191 + return SourceId;
  192 + }
  193 +
  194 + public void setSourceId(String sourceId) {
  195 + SourceId = sourceId;
  196 + }
  197 +
  198 + public String getOrderId() {
  199 + return OrderId;
  200 + }
  201 +
  202 + public void setOrderId(String orderId) {
  203 + OrderId = orderId;
  204 + }
  205 +
  206 + public String getSId() {
  207 + return SId;
  208 + }
  209 +
  210 + public void setSId(String SId) {
  211 + this.SId = SId;
  212 + }
  213 +
  214 + public String getStemId() {
  215 + return StemId;
  216 + }
  217 +
  218 + public void setStemId(String stemId) {
  219 + StemId = stemId;
  220 + }
  221 +
  222 + public String getAutomaticCorrection() {
  223 + return AutomaticCorrection;
  224 + }
  225 +
  226 + public void setAutomaticCorrection(String automaticCorrection) {
  227 + AutomaticCorrection = automaticCorrection;
  228 + }
  229 +
  230 + public String getPkgId() {
  231 + return PkgId;
  232 + }
  233 +
  234 + public void setPkgId(String pkgId) {
  235 + PkgId = pkgId;
  236 + }
  237 +
  238 + public String getPkgType() {
  239 + return PkgType;
  240 + }
  241 +
  242 + public void setPkgType(String pkgType) {
  243 + PkgType = pkgType;
  244 + }
  245 +
  246 + @Override
  247 + public String toString() {
  248 + return "QuestionBean{" +
  249 + "ID='" + ID + '\'' +
  250 + ", Question='" + Question + '\'' +
  251 + ", Qtype='" + Qtype + '\'' +
  252 + ", Answer='" + Answer + '\'' +
  253 + ", CorrectAnswer='" + CorrectAnswer + '\'' +
  254 + ", Analysis='" + Analysis + '\'' +
  255 + ", State='" + State + '\'' +
  256 + ", Intime='" + Intime + '\'' +
  257 + ", ExamineFlag='" + ExamineFlag + '\'' +
  258 + ", ExamineUserId='" + ExamineUserId + '\'' +
  259 + ", CreateUserId='" + CreateUserId + '\'' +
  260 + ", SubjectId='" + SubjectId + '\'' +
  261 + ", SchoolId='" + SchoolId + '\'' +
  262 + ", DifficulteId='" + DifficulteId + '\'' +
  263 + ", KnowledgeId='" + KnowledgeId + '\'' +
  264 + ", ChapterId='" + ChapterId + '\'' +
  265 + ", GradeId='" + GradeId + '\'' +
  266 + ", SourceId='" + SourceId + '\'' +
  267 + ", OrderId='" + OrderId + '\'' +
  268 + ", SId='" + SId + '\'' +
  269 + ", StemId='" + StemId + '\'' +
  270 + ", AutomaticCorrection='" + AutomaticCorrection + '\'' +
  271 + ", PkgId='" + PkgId + '\'' +
  272 + ", PkgType='" + PkgType + '\'' +
  273 + '}';
  274 + }
  275 +}
... ...
cloud/dahua/pom.xml
... ... @@ -31,12 +31,36 @@
31 31 </exclusions>
32 32 </dependency>
33 33  
34   - <dependency>
  34 + <!-- <dependency>
35 35 <groupId>org.slf4j</groupId>
36 36 <artifactId>slf4j-log4j12</artifactId>
37 37 <version>1.7.25</version>
38 38 <scope>compile</scope>
39   - </dependency>
  39 + </dependency>-->
  40 + <dependency>
  41 + <groupId>org.apache.logging.log4j</groupId>
  42 + <artifactId>log4j-slf4j-impl</artifactId>
  43 + <version>2.10.0</version>
  44 + <scope>compile</scope>
  45 + </dependency>
  46 + <dependency>
  47 + <groupId>org.apache.logging.log4j</groupId>
  48 + <artifactId>log4j-core</artifactId>
  49 + <version>2.10.0</version>
  50 + <scope>compile</scope>
  51 + </dependency>
  52 + <dependency>
  53 + <groupId>org.apache.logging.log4j</groupId>
  54 + <artifactId>log4j-jul</artifactId>
  55 + <version>2.10.0</version>
  56 + <scope>compile</scope>
  57 + </dependency>
  58 + <dependency>
  59 + <groupId>org.slf4j</groupId>
  60 + <artifactId>jul-to-slf4j</artifactId>
  61 + <version>1.7.25</version>
  62 + <scope>compile</scope>
  63 + </dependency>
40 64  
41 65 <dependency>
42 66 <groupId>org.springframework.boot</groupId>
... ...
cloud/dahua/src/main/java/com/example/dahua/MyTask.java
1 1 package com.example.dahua;
2 2  
  3 +import com.example.dahua.Gate.Gate;
3 4 import com.example.dahua.alarmListen.AlarmListenModule;
  5 +import com.example.dahua.bean.CardBean;
4 6 import com.example.dahua.bean.DeviceInfoBean;
  7 +import com.example.dahua.bean.TeacherBean;
  8 +import com.example.dahua.bean.UserInfoBean;
  9 +import com.example.dahua.dao.UserDao;
5 10 import com.example.dahua.lib.NetSDKLib;
6 11 import com.example.dahua.lib.ToolKits;
7 12 import com.example.dahua.lib.Utils;
... ... @@ -51,15 +56,17 @@ public class MyTask implements ApplicationRunner {
51 56 //在线设备信息集合
52 57 private List<DeviceInfoBean> deviceInfoBeans = new ArrayList<>();
53 58  
54   - //存放设备的id和IP
55   - public static Map<String, String> devMap = new HashMap<>();
56   -
57 59 //存放登录句柄
58 60 public static Map<String, NetSDKLib.LLong> lLongMap = new HashMap<>();
59 61  
60 62 @Autowired
61 63 SendRecordDao sendRecordDao;
62 64  
  65 + @Autowired
  66 + UserDao userDao;
  67 +
  68 + public boolean isHasNewDevice = false;//判断是否有新设备上线
  69 +
63 70 @Override
64 71 public void run(ApplicationArguments args) throws Exception {
65 72 // 121.40.109.21
... ... @@ -72,7 +79,6 @@ public class MyTask implements ApplicationRunner {
72 79 }
73 80  
74 81  
75   -
76 82 /**
77 83 * 设备自注册
78 84 */
... ... @@ -95,7 +101,9 @@ public class MyTask implements ApplicationRunner {
95 101 attendanceService.updateConnectStateWithDevid(0, deviceId);
96 102 GateModule.stopRealLoadPic(lLongMap.get(deviceId));
97 103 lLongMap.remove(deviceId);
98   - devMap.remove(deviceId);
  104 +// devMap.remove(deviceId);
  105 + removeDevice(deviceId);
  106 + isHasNewDevice = true;
99 107 }
100 108 // AutoRegisterModule.logout()
101 109 // 断线提示
... ... @@ -111,8 +119,17 @@ public class MyTask implements ApplicationRunner {
111 119 String deviceId = getDeviceId(pchDVRIP, nDVRPort);
112 120 if (!StringUtils.isEmpty(deviceId)) {
113 121 attendanceService.updateConnectStateWithDevid(1, deviceId);
114   - devMap.put(deviceId,"");
115   - lLongMap.put(deviceId,m_hLoginHandle);
  122 +// devMap.put(deviceId,"");
  123 + DeviceInfoBean deviceInfoBean = new DeviceInfoBean();
  124 + deviceInfoBean.setDevcieId(deviceId);
  125 + deviceInfoBean.setDeviceIp(pchDVRIP);
  126 + deviceInfoBean.setDevicePort(nDVRPort);
  127 + deviceInfoBean.setLoginHandle(m_hLoginHandle);
  128 + deviceInfoBean.setPassword(password);
  129 + deviceInfoBean.setUsername(strUser);
  130 + deviceInfoBeans.add(deviceInfoBean);
  131 + lLongMap.put(deviceId, m_hLoginHandle);
  132 + isHasNewDevice = true;
116 133 }
117 134 }
118 135 }
... ... @@ -134,6 +151,24 @@ public class MyTask implements ApplicationRunner {
134 151 return "";
135 152 }
136 153  
  154 + /**
  155 + * 移除设备
  156 + *
  157 + * @param deviceId
  158 + */
  159 + private void removeDevice(String deviceId) {
  160 +
  161 + DeviceInfoBean deviceInfoBean = null;
  162 +
  163 +
  164 + for (DeviceInfoBean dev :
  165 + deviceInfoBeans) {
  166 + if (dev.getDevcieId().equals(deviceId)) deviceInfoBean = dev;
  167 + }
  168 +
  169 + if (null != deviceInfoBean) deviceInfoBeans.remove(deviceInfoBean);
  170 + }
  171 +
137 172  
138 173 @Autowired
139 174 private AttendanceService attendanceService;//设备控制服务
... ... @@ -170,20 +205,17 @@ public class MyTask implements ApplicationRunner {
170 205 * 主动注册调用的登录接口,获取登录句柄
171 206 */
172 207 NetSDKLib.LLong loginHandleLong = AutoRegisterModule.login(pIp, wPort, strUser, password, deviceId);
173   -// reloadPicCallBack.reloadCallBack(loginHandleLong);
174   -// AlarmListenModule.startListen(cbMessage,loginHandleLong);
175   - FileUtils.getInstance().writeLogs("设备注册:"+deviceId+" 登录句柄:"+loginHandleLong,FileUtils.devices);
  208 +// FileUtils.getInstance().writeLogs("设备注册:"+deviceId+" 登录句柄:"+loginHandleLong,FileUtils.devices);
176 209 if (loginHandleLong.longValue() != 0) {
177   -// System.out.println(String.format("Login Success [Device IP %s][port %s][DeviceID %s][loginHandleLong %s]\n", pIp,
178   -// wPort, deviceId,loginHandleLong));
179   - devMap.put(deviceId, pIp + "," + wPort);
180   - lLongMap.put(deviceId,loginHandleLong);
  210 + lLongMap.put(deviceId, loginHandleLong);
  211 + isHasNewDevice = true;
181 212 String inTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
182 213 int index = attendanceService.insert(deviceId, "22", pIp, wPort + "", inTime, "-1", "1");
183 214 DeviceInfoBean deviceInfoBean = new DeviceInfoBean();
184 215 deviceInfoBean.setDevcieId(deviceId);
185 216 deviceInfoBean.setDeviceIp(pIp);
186 217 deviceInfoBean.setDevicePort(wPort);
  218 + deviceInfoBean.setLoginHandle(loginHandleLong);
187 219 deviceInfoBeans.add(deviceInfoBean);
188 220  
189 221 } else {
... ... @@ -199,52 +231,85 @@ public class MyTask implements ApplicationRunner {
199 231 return 0;
200 232 }
201 233 }
202   - private ReloadPicCallBack reloadPicCallBack = new ReloadPicCallBack() {
203   - @Override
204   - public void reloadCallBack(NetSDKLib.LLong loginHandleLong) {
205   - //注册成功后进入订阅模式
206   - GateModule.realLoadPic(0, analyzerCallback,loginHandleLong);
  234 +
  235 + public void reloadPic() {
  236 +
  237 + /* Set<String> set = lLongMap.keySet();
  238 + Iterator<String> iterator = set.iterator();
  239 +
  240 + while (iterator.hasNext()){
  241 + String deviceId= iterator.next();
  242 + System.out.println("deviceId:"+deviceId+" llong:"+lLongMap.get(deviceId));
  243 + GateModule.stopRealLoadPic(lLongMap.get(deviceId));
  244 + GateModule.realLoadPic(0,analyzerCallback,lLongMap.get(deviceId));
  245 + }*/
  246 +
  247 + for (DeviceInfoBean dev :
  248 + deviceInfoBeans) {
  249 + System.out.println("dev:" + dev.toString() + " -------llong:" + lLongMap.get(dev.getDevcieId()));
  250 + FileUtils.getInstance().writeLogs(dev.getDevcieId() + "------" + lLongMap.get(dev.getDevcieId()), FileUtils.device_login);
  251 + if (lLongMap.get(dev.getDevcieId()).intValue() > 0)
  252 + GateModule.realLoadPic(0, analyzerCallback, lLongMap.get(dev.getDevcieId()));
  253 +
207 254 }
208   - };
209   - public interface ReloadPicCallBack{
210   - void reloadCallBack(NetSDKLib.LLong loginHandleLong);
  255 +
  256 + isHasNewDevice = false;
211 257 }
212 258  
213 259  
214 260 //智能订阅
215 261 private AnalyzerDataCB analyzerCallback = new AnalyzerDataCB();
  262 +
216 263 private class AnalyzerDataCB implements NetSDKLib.fAnalyzerDataCallBack {
217 264 private BufferedImage gateBufferedImage = null;
218 265  
219 266 public int invoke(NetSDKLib.LLong lAnalyzerHandle, int dwAlarmType,
220 267 Pointer pAlarmInfo, Pointer pBuffer, int dwBufSize,
221   - Pointer dwUser, int nSequence, Pointer reserved)
222   - {
  268 + Pointer dwUser, int nSequence, Pointer reserved) {
223 269 if (lAnalyzerHandle.longValue() == 0 || pAlarmInfo == null) {
224 270 return -1;
225 271 }
226 272  
227   - System.out.println("sda");
228   - File path = new File("./GateSnapPicture/");
  273 + byte[] bufferBytes = new byte[dwBufSize];
  274 +
  275 + pBuffer.read(0, bufferBytes, 0, dwBufSize);
  276 +
  277 +
  278 + File path = new File("E:\\wwwhtdocs\\SmartCampus\\face17e50\\FaceRecoder");
229 279 if (!path.exists()) {
230 280 path.mkdir();
231 281 }
232 282  
233 283 ///< 门禁事件
234   - if(dwAlarmType == NetSDKLib.EVENT_IVS_ACCESS_CTL) {
  284 + if (dwAlarmType == NetSDKLib.EVENT_IVS_ACCESS_CTL) {
235 285 NetSDKLib.DEV_EVENT_ACCESS_CTL_INFO msg = new NetSDKLib.DEV_EVENT_ACCESS_CTL_INFO();
236 286 ToolKits.GetPointerData(pAlarmInfo, msg);
237   -
238 287 // 保存图片,获取图片缓存
239   - String snapPicPath = path + "\\" + System.currentTimeMillis() + "GateSnapPicture.jpg"; // 保存图片地址
  288 + String snapPicPath = path + "\\" + System.currentTimeMillis() + ".png"; // 保存图片地址
240 289 byte[] buffer = pBuffer.getByteArray(0, dwBufSize);
241 290 ByteArrayInputStream byteArrInputGlobal = new ByteArrayInputStream(buffer);
242 291  
243 292 try {
  293 + System.out.println("sda:" + new String(msg.szCardNo) + " 抓拍照片存储地址:" + new String(msg.szSnapURL, "GBK").trim());
244 294 gateBufferedImage = ImageIO.read(byteArrInputGlobal);
245   - if(gateBufferedImage != null) {
246   - ImageIO.write(gateBufferedImage, "jpg", new File(snapPicPath));
  295 + if (gateBufferedImage != null) {
  296 + ImageIO.write(gateBufferedImage, "png", new File(snapPicPath));
247 297 }
  298 + String card = new String(msg.szCardNo).trim();
  299 + if (!StringUtils.isEmpty(card)) {
  300 + card=cardNo(card);
  301 + CardBean cardBean = userDao.getCards(card);//根据卡号获取身份信息
  302 + String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
  303 + snapPicPath = snapPicPath.replace("E:\\wwwhtdocs\\SmartCampus", "http://campus.myjxt.com");
  304 + if (cardBean.getType() == 0) {//老师
  305 + TeacherBean teacherBean = userDao.getTeacherWithId(cardBean.getUser_id());
  306 + sendRecordDao.addFaceRecoder("", teacherBean.getUser_id(), teacherBean.getName(), snapPicPath, 1, time, card);
  307 + } else if (cardBean.getType() == 2) {//学生
  308 + UserInfoBean userInfoBean = userDao.getStudentWithid(cardBean.getUser_id());
  309 + sendRecordDao.addFaceRecoder("", userInfoBean.getUser_id(), userInfoBean.getName(), snapPicPath, 1, time, card);
  310 + }
  311 + }
  312 +
248 313 } catch (IOException e2) {
249 314 e2.printStackTrace();
250 315 }
... ... @@ -262,60 +327,27 @@ public class MyTask implements ApplicationRunner {
262 327 }
263 328 }
264 329  
  330 + /**
  331 + * 卡号两两取反
  332 + *
  333 + * @param cardDex
  334 + * @return
  335 + */
  336 + public String cardNo(String cardDex) {
265 337  
266   - private fAlarmDataCB cbMessage = new fAlarmDataCB();
267   -
268   -
269   - private class fAlarmDataCB implements NetSDKLib.fMessCallBack{
270   -
271   - @Override
272   - public boolean invoke(int lCommand, NetSDKLib.LLong lLoginID,
273   - Pointer pStuEvent, int dwBufLen, String strDeviceIP,
274   - NativeLong nDevicePort, Pointer dwUser) {
275   -
276   - /* byte[] alarm = new byte[dwBufLen];
277   - pStuEvent.read(0, alarm, 0, dwBufLen);
278   - try {
279   - String alarmStr=new String(alarm,"GBK");
280   - System.out.println("报警信息:"+alarmStr);
281   - } catch (UnsupportedEncodingException e) {
282   - e.printStackTrace();
283   - }
284   -
285   - switch (lCommand) {
286   - case NetSDKLib.NET_ALARM_ALARM_EX:
287   - case NetSDKLib.NET_MOTION_ALARM_EX:
288   - case NetSDKLib.NET_VIDEOLOST_ALARM_EX:
289   - case NetSDKLib.NET_SHELTER_ALARM_EX:
290   - case NetSDKLib.NET_DISKFULL_ALARM_EX:
291   - case NetSDKLib.NET_DISKERROR_ALARM_EX: {
292   - String content = "";
293   - for (int i = 0; i < dwBufLen; i++) {
294   - if (alarm[i] == 1) {
295   - byte c = alarm[i];
296   - content+=String.valueOf(c);
297   -// AlarmEventInfo alarmEventInfo = new AlarmEventInfo(i, lCommand, AlarmStatus.ALARM_START);
298   -// if (!data.contains(alarmEventInfo)) {
299   -// data.add(alarmEventInfo);
300   -// eventQueue.postEvent(new AlarmListenEvent(target, alarmEventInfo));
301   -// }
302   - }else {
303   -// AlarmEventInfo alarmEventInfo = new AlarmEventInfo(i, lCommand, AlarmStatus.ALARM_STOP);
304   -// if (data.remove(alarmEventInfo)) {
305   -// eventQueue.postEvent(new AlarmListenEvent(target, alarmEventInfo));
306   -// }
307   - }
308   - }
309   -
310   - System.out.println("content:"+content);
311   - break;
312   - }
313   - default:
314   - break;
  338 + String cardR = "";
  339 + int length = cardDex.length();
  340 + if (length != 8) {
  341 + System.out.println("卡号格式不正确:" + cardDex);
  342 + return cardDex;
  343 + }
  344 + while (length > 0) {
  345 + length -= 2;
  346 + cardR += cardDex.substring(length, length + 2);
  347 + }
315 348  
316   - }*/
  349 + return cardR;
317 350  
318   - return true;
319   - }
320 351 }
  352 +
321 353 }
... ...
cloud/dahua/src/main/java/com/example/dahua/async/MyScheduledTask.java
1 1 package com.example.dahua.async;
2 2  
  3 +import com.example.dahua.MyTask;
3 4 import com.example.dahua.bean.SendRecordBean;
4 5 import com.example.dahua.bean.StudentBean;
5 6 import com.example.dahua.bean.UserInfoBean;
... ... @@ -36,7 +37,6 @@ import java.util.List;
36 37 @EnableScheduling
37 38 public class MyScheduledTask {
38 39  
39   -
40 40 @Autowired
41 41 SendRecordDao sendRecordDao;
42 42  
... ... @@ -44,16 +44,19 @@ public class MyScheduledTask {
44 44 UserDao userDao;
45 45  
46 46 @Autowired
47   - SendUserInfoTask myTask;
  47 + SendUserInfoTask sendUserInfoTask;
  48 +
  49 + @Autowired
  50 + MyTask myTasks;
48 51  
49   - @Value("${haikangpic}")
50   - private String haikangpic;
  52 +// @Value("${haikangpic}")
  53 +// private String haikangpic;
51 54  
52   - public boolean isSendHaikang = false;
  55 + public static boolean isSendHaikang = false;
53 56  
54   - public boolean isSendWeigeng = false;
  57 + public static boolean isSendWeigeng = false;
55 58  
56   - public boolean isSendDahua = false;
  59 + public static boolean isSendDahua = false;
57 60  
58 61 private boolean isClose = true, isCloseYT = true;//判断是否关机
59 62  
... ... @@ -92,8 +95,8 @@ public class MyScheduledTask {
92 95 isClose = false;
93 96 close(30, 479);//关闭
94 97 }
95   - if (hour >= 9 && hour < 11) {
96 98  
  99 + if (hour >= 9 && hour < 11) {
97 100 dealData();
98 101 } else if (hour >= 13 && hour < 14) {
99 102 dealData();
... ... @@ -101,6 +104,7 @@ public class MyScheduledTask {
101 104 dealData();
102 105 }
103 106  
  107 + if (myTasks.isHasNewDevice)myTasks.reloadPic();
104 108  
105 109 }
106 110  
... ... @@ -170,7 +174,7 @@ public class MyScheduledTask {
170 174 //System.out.println("isSendWeigeng:"+isSendWeigeng+"isSendHaikang:"+isSendHaikang+"isSendDahua:"+isSendDahua);
171 175 if (!isSendWeigeng) {
172 176 isSendWeigeng = true;
173   - myTask.addWeiGen();
  177 + sendUserInfoTask.addWeiGen();
174 178 }
175 179  
176 180 /**
... ... @@ -178,7 +182,7 @@ public class MyScheduledTask {
178 182 */
179 183 if (!isSendHaikang) {
180 184 isSendHaikang = true;
181   - myTask.addHaikangface();
  185 + sendUserInfoTask.addHaikangface();
182 186 }
183 187  
184 188 /**
... ... @@ -186,7 +190,7 @@ public class MyScheduledTask {
186 190 */
187 191 if (!isSendDahua) {
188 192 isSendDahua = true;
189   - myTask.addDahuaFace();
  193 + sendUserInfoTask.addDahuaFace();
190 194 }
191 195  
192 196 }
... ...
cloud/dahua/src/main/java/com/example/dahua/async/SendUserInfoTask.java
... ... @@ -43,9 +43,6 @@ public class SendUserInfoTask {
43 43 @Autowired
44 44 SendRecordDao sendRecordDao;
45 45  
46   - @Autowired
47   - MyScheduledTask myScheduledTask;
48   -
49 46 @Async("taskExecutor")
50 47 public void doTaskOne(String file, List<AttendanceBean> attendanceBeans, UserInfoBean userInfoBean, String schoolId, int failType) throws Exception {
51 48 File studentFile = new File(file);
... ... @@ -298,7 +295,7 @@ public class SendUserInfoTask {
298 295  
299 296 NetSDKLib.LLong loginHandleLong = MyTask.lLongMap.get(attendanceBean.getClint_id());
300 297 // System.out.println("loginHandleLong:" + loginHandleLong + MyTask.lLongMap.toString() + " 设备ID:" + attendanceBean.getClint_id());
301   -
  298 +// System.out.println("loginHandleLong:" +loginHandleLong);
302 299 if (loginHandleLong == null) {
303 300 FileUtils.getInstance().writeLogs("设备不在线:" + attendanceBean.getClint_id(), FileUtils.devices);
304 301 String deviceId = sendRecordDao.getFailIsExit(attendanceBean.getClint_id(), attendanceBean.getSchool_id());
... ... @@ -317,11 +314,6 @@ public class SendUserInfoTask {
317 314 GateModule.deleteCard(bCardFlags, loginHandleLong);
318 315 userDao.deleteRecordNo(user_id, bCardFlags);
319 316  
320   -// boolean update = GateModule.modifyCard(bCardFlags, cardNum, userInfoBean.getUser_id(), userInfoBean.getName(), "123456"
321   -// , Res.string().getCardStatusInt(1), Res.string().getCardTypeInt(1), 0, 0
322   -// , 1, startTime, endTime, loginHandleLong);
323   -// System.out.println("update:" + update);
324   -
325 317 bCardFlags = GateModule.insertCard(cardNum, user_id, name, "123456"
326 318 , Res.string().getCardStatusInt(1), Res.string().getCardTypeInt(1), 0, 0
327 319 , 1, startTime, endTime, loginHandleLong);
... ... @@ -378,7 +370,8 @@ public class SendUserInfoTask {
378 370 // 添加卡信息和人脸失败
379 371 if (bCardFlags == -1 && !bFaceFalgs) {
380 372 FileUtils.getInstance().writeLogs("下发人脸和卡号失败:" + cardNum + " " + attendanceBean.getClint_id(), FileUtils.sendUserErrTxt);
381   - System.out.println("添加卡信息和人脸失败");
  373 +// System.out.println("添加卡信息和人脸失败");
  374 + System.out.println("下发人脸和卡号失败" + "sendRecordBean:" + sendRecordBean);
382 375 sendRecordBean.setFailContent("下发人脸和卡号失败");
383 376 sendRecordDao.updateFace(sendRecordBean.getNum(), sendRecordBean.getDeviceID(), sendRecordBean.getFailType(), 7);//更新下发失败状态
384 377 sendRecordBean.setFailType(8);
... ... @@ -425,7 +418,7 @@ public class SendUserInfoTask {
425 418 // }
426 419 }
427 420  
428   - private String cardNo(String cardDex) {
  421 + public String cardNo(String cardDex) {
429 422  
430 423 String cardR = "";
431 424 int length = cardDex.length();
... ... @@ -438,7 +431,6 @@ public class SendUserInfoTask {
438 431 cardR += cardDex.substring(length, length + 2);
439 432 }
440 433  
441   -// return Long.parseLong(cardR, 16) + "";
442 434 return cardR;
443 435  
444 436 }
... ... @@ -520,7 +512,7 @@ public class SendUserInfoTask {
520 512 String customerID = customerIDs.get(i);
521 513 addKard(customerID, "2");//微耕
522 514 }
523   - myScheduledTask.isSendWeigeng = false;
  515 + MyScheduledTask.isSendWeigeng = false;
524 516 }
525 517  
526 518 String url = "http://campus.myjxt.com/api/OneCard/UpdateDataBK";
... ... @@ -580,7 +572,7 @@ public class SendUserInfoTask {
580 572 System.out.println("下发失败:" + url);
581 573 }
582 574 }
583   - myScheduledTask.isSendHaikang = false;
  575 + MyScheduledTask.isSendHaikang = false;
584 576  
585 577 }
586 578  
... ... @@ -611,7 +603,7 @@ public class SendUserInfoTask {
611 603 }
612 604 }
613 605  
614   - myScheduledTask.isSendDahua = false;
  606 + MyScheduledTask.isSendDahua = false;
615 607 }
616 608  
617 609 private void senfaceToDahua(SendRecordBean sendRecordBean) {
... ...
cloud/dahua/src/main/java/com/example/dahua/bean/CardBean.java 0 → 100644
... ... @@ -0,0 +1,45 @@
  1 +package com.example.dahua.bean;
  2 +
  3 +import java.io.Serializable;
  4 +
  5 +public class CardBean implements Serializable {
  6 +
  7 + private String num;
  8 +
  9 + private int type;//0:老师;2:学生
  10 +
  11 + private String user_id;//student_id或者teacher_id
  12 +
  13 + public String getNum() {
  14 + return num;
  15 + }
  16 +
  17 + public void setNum(String num) {
  18 + this.num = num;
  19 + }
  20 +
  21 + public int getType() {
  22 + return type;
  23 + }
  24 +
  25 + public void setType(int type) {
  26 + this.type = type;
  27 + }
  28 +
  29 + public String getUser_id() {
  30 + return user_id;
  31 + }
  32 +
  33 + public void setUser_id(String user_id) {
  34 + this.user_id = user_id;
  35 + }
  36 +
  37 + @Override
  38 + public String toString() {
  39 + return "CardBean{" +
  40 + "num='" + num + '\'' +
  41 + ", type=" + type +
  42 + ", user_id='" + user_id + '\'' +
  43 + '}';
  44 + }
  45 +}
... ...
cloud/dahua/src/main/java/com/example/dahua/bean/DeviceInfoBean.java
... ... @@ -52,4 +52,16 @@ public class DeviceInfoBean {
52 52 public void setLoginHandle(NetSDKLib.LLong loginHandle) {
53 53 this.loginHandle = loginHandle;
54 54 }
  55 +
  56 + @Override
  57 + public String toString() {
  58 + return "DeviceInfoBean{" +
  59 + "devcieId='" + devcieId + '\'' +
  60 + ", username='" + username + '\'' +
  61 + ", password='" + password + '\'' +
  62 + ", deviceIp='" + deviceIp + '\'' +
  63 + ", port=" + port +
  64 + ", loginHandle=" + loginHandle +
  65 + '}';
  66 + }
55 67 }
... ...
cloud/dahua/src/main/java/com/example/dahua/control/HelpControl.java
... ... @@ -1,113 +0,0 @@
1   -package com.example.dahua.control;
2   -
3   -import io.swagger.annotations.Api;
4   -import io.swagger.annotations.ApiImplicitParam;
5   -import io.swagger.annotations.ApiImplicitParams;
6   -import io.swagger.annotations.ApiOperation;
7   -import org.apache.poi.hssf.usermodel.HSSFCell;
8   -import org.apache.poi.hssf.usermodel.HSSFRow;
9   -import org.apache.poi.hssf.usermodel.HSSFSheet;
10   -import org.apache.poi.hssf.usermodel.HSSFWorkbook;
11   -import org.springframework.web.bind.annotation.RequestMapping;
12   -import org.springframework.web.bind.annotation.RequestMethod;
13   -import org.springframework.web.bind.annotation.RequestParam;
14   -import org.springframework.web.bind.annotation.RestController;
15   -
16   -import java.io.File;
17   -import java.io.FileOutputStream;
18   -import java.io.IOException;
19   -import java.util.ArrayList;
20   -import java.util.List;
21   -import java.util.Map;
22   -
23   -@RestController("/help/")
24   -@Api(tags = "辅助工具")
25   -@RequestMapping("/help/")
26   -public class HelpControl {
27   -
28   -
29   - @RequestMapping(value = "createFile", method = RequestMethod.GET)
30   - @ApiOperation(value = "生成文件")
31   - @ApiImplicitParams({@ApiImplicitParam(name = "file", value = "根目录")})
32   - public String createFile(@RequestParam("file") String file) {
33   -// System.out.println("count:" + (count++));
34   -
35   - //第一步,创建一个workbook对应一个excel文件
36   - HSSFWorkbook workbook = new HSSFWorkbook();
37   -
38   - File file1 = new File(file);
39   -
40   - File[] files = file1.listFiles();
41   -
42   - List<String> list = new ArrayList<>();
43   -
44   - for (int i = 0; i < files.length; i++) {
45   - File file2 = files[i];
46   -
47   - if (file2.isDirectory()) {
48   -
49   - File[] file3 = file2.listFiles();
50   - for (int j = 0; j < file3.length; j++) {
51   - File file4 = file3[j];
52   - String fileName = file4.getName();
53   - String fileDirName = file2.getName();
54   - list.add(fileDirName+","+fileName);
55   - }
56   -
57   - }else if (file2.isFile()){
58   - String fileName = file2.getName() ;
59   - String fileDirName = file1.getName();
60   - list.add(fileDirName+","+fileName);
61   - }
62   -
63   - }
64   -
65   -
66   - return writeToExcel(workbook,"文件",list).getAbsolutePath();
67   - }
68   -
69   -
70   - private File writeToExcel(HSSFWorkbook workbook, String sheetName, List<String> values) {
71   - //第二部,在workbook中创建一个sheet对应excel中的sheet
72   - HSSFSheet sheet = workbook.createSheet(sheetName);
73   - //第三部,在sheet表中添加表头第0行,老版本的poi对sheet的行列有限制
74   - HSSFRow row = sheet.createRow(0);
75   - //第四步,创建单元格,设置表头
76   - HSSFCell cell = null;
77   - for (int i = 0; i < 2; i++) {
78   - cell = row.createCell(i);
79   - if (i == 0)
80   - cell.setCellValue("目录名称");
81   - else if (i==1)
82   - cell.setCellValue("文件名称");
83   - }
84   -
85   - //第五步,写入数据
86   - for (int i = 0; i < values.size(); i++) {
87   -
88   - HSSFRow row1 = sheet.createRow(i + 1);
89   - String value = values.get(i);
90   -
91   - row1.createCell(0).setCellValue(value.split(",")[0]);
92   - row1.createCell(1).setCellValue(value.split(",")[1]);
93   - }
94   -
95   - //将文件保存到指定的位置
96   - try {
97   - File file = new File("./file/");
98   - if (!file.exists()) file.mkdirs();
99   -
100   - File file1 = new File(file.getAbsolutePath(), sheetName + ".xls");
101   - if (!file1.exists()) file1.createNewFile();
102   - FileOutputStream fos = new FileOutputStream(file1);
103   - workbook.write(fos);
104   - System.out.println("写入成功");
105   - fos.close();
106   - return file1;
107   - } catch (IOException e) {
108   - e.printStackTrace();
109   - }
110   - return null;
111   - }
112   -
113   -}
cloud/dahua/src/main/java/com/example/dahua/control/UserControl.java
1 1 package com.example.dahua.control;
2 2  
  3 +import com.example.dahua.MyTask;
3 4 import com.example.dahua.async.ImageUtils;
4 5 import com.example.dahua.async.SendUserInfoTask;
5 6 import com.example.dahua.lib.CompressPic;
... ... @@ -49,8 +50,11 @@ public class UserControl {
49 50 @Autowired
50 51 SendUserInfoTask sendUserInfoTask;
51 52  
52   - @Value("${haikangfaceurl}")
53   - private String haikangfaceurl;
  53 + @Autowired
  54 + MyTask myTasks;
  55 +
  56 +// @Value("${haikangfaceurl}")
  57 +// private String haikangfaceurl;
54 58  
55 59 @RequestMapping(value = "uploadImgAndUserInfo", method = RequestMethod.GET)
56 60 @ApiOperation(value = "上传用户信息")
... ... @@ -369,7 +373,6 @@ public class UserControl {
369 373  
370 374 sendUserInfoTask.deleteFace(cardNum, deviceId);
371 375  
372   -
373 376 }
374 377  
375 378  
... ... @@ -381,6 +384,14 @@ public class UserControl {
381 384  
382 385 }
383 386  
  387 + @RequestMapping(value = "startListener", method = RequestMethod.GET)
  388 + @ApiOperation("开启监听")
  389 + public void startListener() {
  390 +
  391 + myTasks.reloadPic();
  392 +
  393 + }
  394 +
384 395  
385 396 @RequestMapping(value = "compic", method = RequestMethod.GET)
386 397 @ApiOperation("图片压缩")
... ... @@ -440,9 +451,10 @@ public class UserControl {
440 451 e.printStackTrace();
441 452 }
442 453 return "解析失败";
443   -
444 454 }
445 455  
  456 +
  457 +
446 458 private String url = "https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic?access_token=24.12f07855bae00621f319d10f00f6aaa2.2592000.1576727813.282335-15990462";
447 459  
448 460 private String getAnswer(String imgUrl, int type) {
... ...
cloud/dahua/src/main/java/com/example/dahua/dao/UserDao.java
1 1 package com.example.dahua.dao;
2 2  
3   -import com.example.dahua.bean.AttendanceBean;
4   -import com.example.dahua.bean.StudentBean;
5   -import com.example.dahua.bean.TeacherBean;
6   -import com.example.dahua.bean.UserInfoBean;
  3 +import com.example.dahua.bean.*;
7 4 import org.apache.ibatis.annotations.*;
8 5 import org.springframework.stereotype.Repository;
9 6  
... ... @@ -26,8 +23,8 @@ public interface UserDao {
26 23 @Select(" select * from SZ_V_School_Teacher where school_id = #{school_id} and num = #{num}")
27 24 TeacherBean getTeacher(@Param("school_id")String school_id, @Param("num")String num);
28 25  
29   - @Select(" select * from SZ_V_School_Teacher where school_id = 562 and teacher_num = #{teacher_num}")
30   - List<TeacherBean> getTeachers( @Param("teacher_num")String teacher_num);
  26 + @Select(" select Top(1)* from SZ_V_School_Teacher where teacher_id = #{teacher_id}")
  27 + TeacherBean getTeacherWithId( @Param("teacher_id")String teacher_id);
31 28  
32 29 @Select(" select * from SZ_V_School_Teacher where school_id = 562 and name = #{name}")
33 30 List<TeacherBean> getTeachersWithName( @Param("name")String name);
... ... @@ -62,9 +59,8 @@ public interface UserDao {
62 59 @Select(" select studentcode from SZ_V_School_Student where student_id = #{customerid}")
63 60 String getStudentCode(@Param("customerid") String customerid);
64 61  
65   -
66   - @Select(" select * from SZ_V_School_Student where studentcode = #{studentcode}")
67   - UserInfoBean getStudentId(@Param("studentcode") String student_num);
  62 + @Select(" select * from SZ_V_School_Student where student_id = #{student_id}")
  63 + UserInfoBean getStudentWithid(@Param("student_id") String student_id);
68 64  
69 65 @Select(" select * from SZ_V_School_Student where student_num = #{student_num} and name = #{name}")
70 66 UserInfoBean getStudent(@Param("student_num") String student_num,@Param("name") String name);
... ... @@ -95,4 +91,7 @@ public interface UserDao {
95 91 @Select("select StudentId from SS_RoomNumber where Pid in (select id from SS_Room where SchoolId = 479)")
96 92 List<String> getStudentIds();
97 93  
  94 + @Select("select * from SZ_V_Card where num=#{num}")
  95 + CardBean getCards(@Param("num")String num);
  96 +
98 97 }
... ...
cloud/dahua/src/main/java/com/example/dahua/lib/CompressPic.java
... ... @@ -24,10 +24,10 @@ public class CompressPic {
24 24 int width = bufferedImage.getWidth(null);
25 25 int height = bufferedImage.getHeight(null);
26 26 long fileLength = file.length();
27   - if ((fileLength / 1024) < 64) {
  27 + if ((fileLength / 1024) < 128) {
28 28 writeImgToFile(bufferedImage, width, height, targetPath);
29 29 } else
30   - while ((fileLength / 1024) >= 64) {
  30 + while ((fileLength / 1024) >= 128) {
31 31 width = (int) (width * (1 - cutPercent));
32 32 height = (int) (height * (1 - cutPercent));
33 33  
... ...
cloud/dahua/src/main/java/com/example/dahua/utils/FileUtils.java
... ... @@ -12,6 +12,7 @@ public class FileUtils {
12 12  
13 13 public static String checkFail = "检测失败.txt";
14 14 public static String checkSuc = "检测成功.txt";
  15 + public static String device_login="设备登录id.txt";
15 16 private static FileUtils fileUtils;
16 17  
17 18 private String filePath = "./log/";//日志记录目录
... ...
cloud/dahua/src/main/java/com/example/dahua/xiananDao/SendRecordDao.java
... ... @@ -71,5 +71,10 @@ public interface SendRecordDao {
71 71  
72 72 @Select("select * from Face_SendFail where schoolId = #{schoolId} and userType = #{userType} and deviceID = #{deviceID}")
73 73 List<SendRecordBean> getFaceFails(@Param("userType")int userType,@Param("schoolId")int schoolId,@Param("deviceID")String deviceID);
  74 +
  75 + @Insert("insert into Face_Recoder values(#{deviceId},#{user_id},#{name},#{imgurl},#{inOrOut},#{time},#{cardNum})")
  76 + void addFaceRecoder(@Param("deviceId") String deviceId, @Param("user_id")String user_id, @Param("name")String name,
  77 + @Param("imgurl")String imgurl, @Param("inOrOut")int inOrOut, @Param("time")String time,
  78 + @Param("cardNum")String cardNum);
74 79 }
75 80  
... ...
cloud/dahua/src/main/resources/application.yaml
... ... @@ -54,6 +54,6 @@ mybatis:
54 54 config-location: classpath:mybatis-config.xml
55 55  
56 56  
57   -haikangpic: E:\wwwhtdocs\HFface\FaceLogs\
  57 +#haikangpic: E:\wwwhtdocs\HFface\FaceLogs\
58 58  
59   -haikangfaceurl: http://60.190.202.57:8899
  59 +#haikangfaceurl: http://60.190.202.57:8899
... ...
cloud/file/文件.xls
No preview for this file type
cloud/haikang/src/main/java/com/sincere/haikang/CMSServer.java
... ... @@ -240,7 +240,6 @@ public class CMSServer implements ApplicationRunner {
240 240 } else {
241 241  
242 242 HCEHomeCMS.NET_EHOME_XML_CFG struXMLCfg = new HCEHomeCMS.NET_EHOME_XML_CFG();
243   - HCEHomeCMS.NET_EHOME_XML_REMOTE_CTRL_PARAM struRemoteCtrl = new HCEHomeCMS.NET_EHOME_XML_REMOTE_CTRL_PARAM();
244 243 HCEHomeCMS.NET_DVR_STRING_POINTER stringRequestCard = new HCEHomeCMS.NET_DVR_STRING_POINTER();
245 244 stringRequestCard.read();
246 245 String strRequestCard = "SETDEVICECONFIG";
... ... @@ -352,6 +351,66 @@ public class CMSServer implements ApplicationRunner {
352 351 }
353 352  
354 353 /**
  354 + * 获取指纹信息
  355 + */
  356 + public void getFingerPrint(String clint_id, String cardNo){
  357 + HCEHomeCMS.NET_EHOME_XML_CFG struXMLCard = new HCEHomeCMS.NET_EHOME_XML_CFG();
  358 +
  359 + HCEHomeCMS.NET_DVR_STRING_POINTER stringRequestCard = new HCEHomeCMS.NET_DVR_STRING_POINTER();
  360 + stringRequestCard.read();
  361 + String strRequestCard = "GETDEVICECONFIG";
  362 + stringRequestCard.byString = strRequestCard.getBytes();
  363 + stringRequestCard.write();
  364 +
  365 + struXMLCard.pCmdBuf = stringRequestCard.getPointer();
  366 + struXMLCard.dwCmdLen = stringRequestCard.byString.length;
  367 + struXMLCard.write();
  368 +
  369 + HCEHomeCMS.NET_DVR_STRING_POINTER struConfigXMLCard = new HCEHomeCMS.NET_DVR_STRING_POINTER();
  370 + struConfigXMLCard.read();
  371 + String strConfigXMLCard = "<Params>\n" +
  372 + "<ConfigCmd>GetFingerPrint</ConfigCmd>\n" +
  373 + "<ConfigParam1>"+cardNo+"</ConfigParam1>\n" +
  374 + "<ConfigParam2>1,2,3,4,5,6,7,8,9,10</ConfigParam2>\n" +
  375 + "<ConfigParam3>1</ConfigParam3>\n" +
  376 + "<ConfigParam4>0</ConfigParam4>\n" +
  377 + "</Params>";
  378 + struConfigXMLCard.byString = strConfigXMLCard.getBytes();
  379 + struConfigXMLCard.write();
  380 +
  381 + struXMLCard.pInBuf = struConfigXMLCard.getPointer();
  382 + struXMLCard.dwInSize = struConfigXMLCard.byString.length;
  383 + struXMLCard.dwRecvTimeOut = 5000;
  384 + struXMLCard.dwSendTimeOut = 5000;
  385 + struXMLCard.write();
  386 +
  387 + HCEHomeCMS.NET_DVR_STRING_POINTER stringOutCard = new HCEHomeCMS.NET_DVR_STRING_POINTER();
  388 + stringOutCard.write();
  389 + struXMLCard.pOutBuf = stringOutCard.getPointer();
  390 + struXMLCard.dwOutSize = stringOutCard.size();
  391 + struXMLCard.write();
  392 +
  393 + HCEHomeCMS.NET_DVR_STRING_POINTER stringStatusCard = new HCEHomeCMS.NET_DVR_STRING_POINTER();
  394 + stringStatusCard.write();
  395 + struXMLCard.pStatusBuf = stringStatusCard.getPointer();
  396 + struXMLCard.dwStatusSize = stringStatusCard.size();
  397 + struXMLCard.write();
  398 +
  399 + int i = struXMLCard.size();
  400 + if (!hCEhomeCMS.NET_ECMS_XMLConfig(deviceAndLoginIdMap.get(clint_id), struXMLCard, struXMLCard.size())) {
  401 + int iErr = hCEhomeCMS.NET_ECMS_GetLastError();
  402 + System.err.println("获取指纹信息,错误号:" + iErr+"card:"+cardNo);
  403 + } else {
  404 + stringOutCard.read();
  405 + try {
  406 + System.out.println("获取指纹信息成功:"+new String(stringOutCard.byString,"utf-8").trim());
  407 + } catch (UnsupportedEncodingException e) {
  408 + e.printStackTrace();
  409 + }
  410 + }
  411 + }
  412 +
  413 + /**
355 414 * 删除指纹机信息
356 415 * @param clint_id
357 416 * @param cardNo
... ... @@ -496,7 +555,7 @@ public class CMSServer implements ApplicationRunner {
496 555 if (cardNo != null && cardNo.length() > 0) {
497 556 if (cardNo.length() >= 10) {
498 557 FileUtils.getInstance().writeLogs("学生id异常:" + deviceID + " 卡号:" + cardNo+" minorType:"+minorType, FileUtils.qiandaoErr);
499   - return false;
  558 + return true;
500 559 }
501 560  
502 561 cardNo = userDao.getStudent_Num(cardNo);
... ... @@ -555,28 +614,4 @@ public class CMSServer implements ApplicationRunner {
555 614 }
556 615 }
557 616  
558   - /**
559   - * 卡号两两倒置
560   - *
561   - * @param cardDex
562   - * @return
563   - */
564   - private String cardNo(String cardDex) {
565   -
566   - String cardR = "";
567   -
568   - int length = cardDex.length();
569   - if (length != 8) {
570   - System.out.println("卡号格式不正确:" + cardDex);
571   - return cardDex;
572   - }
573   - while (length > 0) {
574   - length -= 2;
575   - cardR += cardDex.substring(length, length + 2);
576   - }
577   -
578   -// return Long.parseLong(cardR, 16) + "";
579   - return cardR;
580   -
581   - }
582 617 }
... ...
cloud/haikang/src/main/java/com/sincere/haikang/async/SendUserAsync.java
... ... @@ -94,6 +94,12 @@ public class SendUserAsync {
94 94 }
95 95  
96 96 @Async("taskExecutor")
  97 + public void getFingerPrint(String cardNo,String clint_id){
  98 +
  99 + cmsServer.getFingerPrint(clint_id,cardNo);
  100 + }
  101 +
  102 + @Async("taskExecutor")
97 103 public void sendStuToHaiKang(List<StudentBean> studentBeans, int type) {
98 104  
99 105 try {
... ...
cloud/haikang/src/main/java/com/sincere/haikang/control/UserControl.java
... ... @@ -48,6 +48,17 @@ public class UserControl {
48 48  
49 49 }
50 50  
  51 + @RequestMapping(value = "getFingerPrint",method = RequestMethod.GET)
  52 + public boolean getFingerPrint(@RequestParam("card")String card,@RequestParam("clint_id")String clint_id){
  53 + sendUserAsync.getFingerPrint(card,clint_id);
  54 + return true;
  55 +
  56 + }
  57 +
  58 +
  59 +
  60 +
  61 +
51 62 // @RequestMapping(value = "uploadImg", method= RequestMethod.GET)
52 63 // public String uploadImg(@RequestParam("filePath")String filePath){
53 64 // return cmsServer.jbtnUploadActionPerformed(filePath);
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/admindao/ZuoyeAdminDao.java
1 1 package com.sincere.haikangface.admindao;
2 2  
3   -import org.apache.ibatis.annotations.Mapper;
4   -import org.apache.ibatis.annotations.Param;
5   -import org.apache.ibatis.annotations.Select;
  3 +import com.sincere.haikangface.bean.homework.QuestionBean;
  4 +import org.apache.ibatis.annotations.*;
6 5 import org.springframework.stereotype.Repository;
7 6  
  7 +import java.util.List;
  8 +
8 9 @Mapper
9 10 @Repository
10 11 public interface ZuoyeAdminDao {
... ... @@ -19,5 +20,30 @@ public interface ZuoyeAdminDao {
19 20 @Select("select Id from ZY_YYGrade where name like #{gradeId}")
20 21 String getGradeId(@Param("gradeId") String gradeId);
21 22  
  23 + @Insert("insert into ZY_YYQuestion (Question, Qtype, Answer, CorrectAnswer, Analysis, State, Intime, StemId, ExamineFlag, SubjectId, SuggestionTime, DifficulteId, ChapterId, GradeId, SourceId, QuestionSource, AutomaticCorrection)" +
  24 + " values (#{Question},#{Qtype},#{Answer},#{CorrectAnswer},#{Analysis},#{State},#{Intime},#{StemId},#{ExamineFlag},#{SubjectId},#{SuggestionTime},#{DifficulteId},#{ChapterId},#{GradeId},#{SourceId},#{QuestionSource},#{AutomaticCorrection})")
  25 + int addQuestion(@Param("Question") String Question, @Param("Qtype") String Qtype, @Param("Answer") String Answer, @Param("CorrectAnswer") String CorrectAnswer, @Param("Analysis") String Analysis, @Param("State") String State
  26 + , @Param("Intime") String Intime, @Param("StemId") String StemId, @Param("ExamineFlag") String ExamineFlag, @Param("SubjectId") String SubjectId, @Param("SuggestionTime") String SuggestionTime, @Param("DifficulteId") String DifficulteId
  27 + , @Param("ChapterId") String ChapterId, @Param("GradeId") String GradeId, @Param("SourceId") String SourceId, @Param("QuestionSource") String QuestionSource, @Param("AutomaticCorrection") String AutomaticCorrection);
  28 +
  29 + @Insert("insert into ZY_YYQuestionStem values(#{QuestionStem},#{State},#{Intime})")
  30 + int addQuestionStem(@Param("QuestionStem") String QuestionStem, @Param("State") String State, @Param("Intime") String Intime);
  31 +
  32 + @Select("select Top(1) ID from ZY_YYQuestionStem order by Intime desc ")
  33 + int getStemId();
  34 +
  35 + @Update("update ZY_YYQuestion set StemId = #{StemId} where ID = #{ID}")
  36 + void updateQuestion(@Param("StemId") long StemId, @Param("ID")long ID);
  37 +
  38 + @Select("select top (961)ID\n" +
  39 + "from ZY_YYQuestionStem order by ID desc")
  40 + List<Long> getStemIds();
  41 +
  42 + @Select("select Top(961)ID\n" +
  43 + "from ZY_YYQuestion order by ID desc ")
  44 + List<Long> getQueIds();
22 45  
  46 + @Insert("insert into ZY_YYQuestionAndKnowledg (QuestionId, KnowledgId, IsTest, Status)\n" +
  47 + "values (#{QuestionId},#{KnowledgId},#{IsTest},#{Status})")
  48 + void addYYQuestionAndKnowledg(@Param("QuestionId")long QuestionId,@Param("KnowledgId")long KnowledgId,@Param("IsTest")long IsTest,@Param("Status")long Status );
23 49 }
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/control/HelpControl.java 0 → 100644
... ... @@ -0,0 +1,113 @@
  1 +package com.sincere.haikangface.control;
  2 +
  3 +import io.swagger.annotations.Api;
  4 +import io.swagger.annotations.ApiImplicitParam;
  5 +import io.swagger.annotations.ApiImplicitParams;
  6 +import io.swagger.annotations.ApiOperation;
  7 +import org.apache.poi.hssf.usermodel.HSSFCell;
  8 +import org.apache.poi.hssf.usermodel.HSSFRow;
  9 +import org.apache.poi.hssf.usermodel.HSSFSheet;
  10 +import org.apache.poi.hssf.usermodel.HSSFWorkbook;
  11 +import org.springframework.web.bind.annotation.RequestMapping;
  12 +import org.springframework.web.bind.annotation.RequestMethod;
  13 +import org.springframework.web.bind.annotation.RequestParam;
  14 +import org.springframework.web.bind.annotation.RestController;
  15 +
  16 +import java.io.File;
  17 +import java.io.FileOutputStream;
  18 +import java.io.IOException;
  19 +import java.util.ArrayList;
  20 +import java.util.List;
  21 +import java.util.Map;
  22 +
  23 +@RestController("/help/")
  24 +@Api(tags = "辅助工具")
  25 +@RequestMapping("/help/*")
  26 +public class HelpControl {
  27 +
  28 +
  29 + @RequestMapping(value = "createFile", method = RequestMethod.GET)
  30 + @ApiOperation(value = "生成文件")
  31 + @ApiImplicitParams({@ApiImplicitParam(name = "file", value = "根目录")})
  32 + public String createFile(@RequestParam("file") String file) {
  33 +// System.out.println("count:" + (count++));
  34 +
  35 + //第一步,创建一个workbook对应一个excel文件
  36 + HSSFWorkbook workbook = new HSSFWorkbook();
  37 +
  38 + File file1 = new File(file);
  39 +
  40 + File[] files = file1.listFiles();
  41 +
  42 + List<String> list = new ArrayList<>();
  43 +
  44 + for (int i = 0; i < files.length; i++) {
  45 + File file2 = files[i];
  46 +
  47 + if (file2.isDirectory()) {
  48 +
  49 + File[] file3 = file2.listFiles();
  50 + for (int j = 0; j < file3.length; j++) {
  51 + File file4 = file3[j];
  52 + String fileName = file4.getName();
  53 + String fileDirName = file2.getName();
  54 + list.add(fileDirName+","+fileName);
  55 + }
  56 +
  57 + }else if (file2.isFile()){
  58 + String fileName = file2.getName() ;
  59 + String fileDirName = file1.getName();
  60 + list.add(fileDirName+","+fileName);
  61 + }
  62 +
  63 + }
  64 +
  65 +
  66 + return writeToExcel(workbook,"文件",list).getAbsolutePath();
  67 + }
  68 +
  69 +
  70 + private File writeToExcel(HSSFWorkbook workbook, String sheetName, List<String> values) {
  71 + //第二部,在workbook中创建一个sheet对应excel中的sheet
  72 + HSSFSheet sheet = workbook.createSheet(sheetName);
  73 + //第三部,在sheet表中添加表头第0行,老版本的poi对sheet的行列有限制
  74 + HSSFRow row = sheet.createRow(0);
  75 + //第四步,创建单元格,设置表头
  76 + HSSFCell cell = null;
  77 + for (int i = 0; i < 2; i++) {
  78 + cell = row.createCell(i);
  79 + if (i == 0)
  80 + cell.setCellValue("目录名称");
  81 + else if (i==1)
  82 + cell.setCellValue("文件名称");
  83 + }
  84 +
  85 + //第五步,写入数据
  86 + for (int i = 0; i < values.size(); i++) {
  87 +
  88 + HSSFRow row1 = sheet.createRow(i + 1);
  89 + String value = values.get(i);
  90 +
  91 + row1.createCell(0).setCellValue(value.split(",")[0]);
  92 + row1.createCell(1).setCellValue(value.split(",")[1]);
  93 + }
  94 +
  95 + //将文件保存到指定的位置
  96 + try {
  97 + File file = new File("./file/");
  98 + if (!file.exists()) file.mkdirs();
  99 +
  100 + File file1 = new File(file.getAbsolutePath(), sheetName + ".xls");
  101 + if (!file1.exists()) file1.createNewFile();
  102 + FileOutputStream fos = new FileOutputStream(file1);
  103 + workbook.write(fos);
  104 + System.out.println("写入成功");
  105 + fos.close();
  106 + return file1;
  107 + } catch (IOException e) {
  108 + e.printStackTrace();
  109 + }
  110 + return null;
  111 + }
  112 +
  113 +}
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/control/UserControl.java
... ... @@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
18 18 import org.springframework.web.bind.annotation.RequestParam;
19 19 import org.springframework.web.bind.annotation.RestController;
20 20 import org.springframework.web.multipart.MultipartFile;
  21 +import sun.rmi.runtime.Log;
21 22  
22 23 import java.io.*;
23 24 import java.math.BigInteger;
... ... @@ -53,22 +54,19 @@ public class UserControl {
53 54 @RequestParam("endTime") String endTime, @RequestParam("validTimeEnabled") int validTimeEnabled, @RequestParam("userType") String userType) {
54 55  
55 56 try {
56   -// System.out.println("设备编号:" + deviceId);
57 57 FileUtils.getInstance().writeLogs("filePath:" + filePath + " card:" + card + " name:" + name + " deviceId:" + deviceId, FileUtils.sendUserInfo);
58 58 long time = System.currentTimeMillis();
59   - if (filePath.contains(".jpg")) filePath = filePath.replace(".jpg", ".png");
  59 +// if (filePath.contains(".jpg")) filePath = filePath.replace(".jpg", ".png");
60 60 if (new File(filePath.trim()).exists()) {
61 61 String targetPath = FileUtils.picPathComp + new File(filePath).getName();
62 62 try {
63   -// System.out.println("targetPath:" + targetPath + " targetPath:" + new File(targetPath).exists());
64   -// System.out.println("exit:" + new File(targetPath).exists() + " targetPath:" + targetPath);
65 63 int isPiliang = 0;//0:批量,1:单张
66 64 if (filePath.contains("face17e50")) {//批量发送
67 65 isPiliang = 0;
68 66 } else {//单图发送
69 67 isPiliang = 1;
70 68 }
71   - sendUserAsync.sendStuToHaiKang(filePath, targetPath, new BigInteger(getCard(card), 16).toString(), startTime, endTime, validTimeEnabled, name, deviceId, userType, isPiliang);
  69 + sendUserAsync.sendStuToHaiKang(filePath, targetPath, Long.parseLong(getCard(card), 16)+"", startTime, endTime, validTimeEnabled, name, deviceId, userType, isPiliang);
72 70  
73 71 System.out.println("time:" + (System.currentTimeMillis() - time) / 1000);
74 72  
... ... @@ -79,7 +77,7 @@ public class UserControl {
79 77 } else {
80 78  
81 79 if (null == sendRecoderUtils) sendRecoderUtils = new SendRecoderUtils();
82   - sendRecoderUtils.sendFail(sendRecordDao, new BigInteger(getCard(card), 16).toString(), filePath, deviceId, userDao, "文件不存在", userType);
  80 + sendRecoderUtils.sendFail(sendRecordDao, Long.parseLong(getCard(card), 16)+"", filePath, deviceId, userDao, "文件不存在", userType);
83 81 System.out.println("文件不存在:" + filePath);
84 82 }
85 83 } catch (Exception e) {
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/dao/UserDao.java
... ... @@ -185,4 +185,10 @@ public interface UserDao {
185 185  
186 186 @Select("select clint_id from SZ_AttendanceDto where school_id = #{schoolId} and clint_type=18")
187 187 List<String> getDeviceIdsWidthSchoolId(@Param("schoolId") int schoolId);
  188 +
  189 +
  190 + @Select("select StudentId from SS_RoomNumber where Pid in (select id\n" +
  191 + " from SS_Room\n" +
  192 + " where SchoolId = 479 and SS_Room.Pid =10284 )")
  193 + List<String> getStudentIdWithRoom();
188 194 }
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/dao/ZuoYeDao.java
... ... @@ -70,7 +70,6 @@ public interface ZuoYeDao {
70 70 @Insert("insert into TK_QuestionStem values(#{QuestionStem},#{State},#{Intime})")
71 71 int addQuestionStem(@Param("QuestionStem") String QuestionStem, @Param("State") String State, @Param("Intime") String Intime);
72 72  
73   -
74 73 @Select("select Top(1) ID from TK_QuestionStem order by Intime desc ")
75 74 int getStemId();
76 75  
... ... @@ -86,4 +85,10 @@ public interface ZuoYeDao {
86 85 @Select("select IsCorrect from ZY_StudentAnswer where ID = #{ID}")
87 86 int getIsCorrect(@Param("ID") String id);
88 87  
  88 +
  89 + @Select("select *\n" +
  90 + "from TK_Question where Intime>'2019-01-01' and Qtype = 1 and ID in (select QuestionId from TK_QuestionAndKnowledg where KnowledgId>94569) order by Intime desc")
  91 + List<QuestionBean> getQuestionsRecent();
  92 +
  93 +
89 94 }
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/utils/SendRecoderUtils.java
... ... @@ -24,8 +24,9 @@ public class SendRecoderUtils {
24 24 */
25 25  
26 26 public void sendSuccess(SendRecordDao sendRecordDao, String card, String faceUrl, String deviceId, UserDao userDao, String userType) {
27   - BigInteger bigInteger = new BigInteger(card);
28   - String resultCard = getCard(String.format("%08x", bigInteger)).toUpperCase();
  27 +// BigInteger bigInteger = new BigInteger(card);
  28 + long lon = Long.parseLong(card);
  29 + String resultCard = getCard(String.format("%08x", lon)).toUpperCase();
29 30 StudentBean studentBean = null;
30 31 String customerId = "";
31 32 switch (userType) {
... ... @@ -81,8 +82,9 @@ public class SendRecoderUtils {
81 82 * @param userDao
82 83 */
83 84 public void sendFail(SendRecordDao sendRecordDao, String card, String faceUrl, String deviceId, UserDao userDao, String content, String userType) {
84   - BigInteger bigInteger = new BigInteger(card);
85   - String resultCard = getCard(String.format("%08x", bigInteger)).toUpperCase();
  85 +// BigInteger bigInteger = new BigInteger(card);
  86 + long lon = Long.parseLong(card);
  87 + String resultCard = getCard(String.format("%08x", lon)).toUpperCase();
86 88 StudentBean studentBean = null;
87 89 String customerId = "";
88 90 switch (userType) {
... ...
cloud/haikangface/src/test/java/com/sincere/haikangface/HaikangfaceApplicationTests.java
... ... @@ -6,11 +6,14 @@ import com.drew.metadata.Directory;
6 6 import com.drew.metadata.Metadata;
7 7 import com.drew.metadata.MetadataException;
8 8 import com.drew.metadata.exif.ExifDirectory;
  9 +import com.sincere.haikangface.admindao.ZuoyeAdminDao;
9 10 import com.sincere.haikangface.bean.*;
  11 +import com.sincere.haikangface.bean.homework.QuestionBean;
10 12 import com.sincere.haikangface.bean.xiaoan.AttendanceRecordsSS;
11 13 import com.sincere.haikangface.bean.xiaoan.CreditCardRecordsSS;
12 14 import com.sincere.haikangface.dao.DeviceDao;
13 15 import com.sincere.haikangface.dao.UserDao;
  16 +import com.sincere.haikangface.dao.ZuoYeDao;
14 17 import com.sincere.haikangface.xiananDao.SendRecordDao;
15 18 import org.bouncycastle.asn1.cms.MetaData;
16 19 import org.hibernate.validator.constraints.LuhnCheck;
... ... @@ -82,9 +85,9 @@ public class HaikangfaceApplicationTests {
82 85  
83 86 @Test
84 87 public void send() {
85   - /*RestTemplate restTemplate = new RestTemplate();
  88 + /* RestTemplate restTemplate = new RestTemplate();
86 89 //失败人脸补发
87   - List<SendRecordBean> sendRecordBeanList = sendRecordDao.getSenFail("562",2);
  90 + List<SendRecordBean> sendRecordBeanList = sendRecordDao.getSenFail("1066",2);
88 91 int idnex = 0;
89 92 for (int i = 0; i < sendRecordBeanList.size(); i++) {
90 93 SendRecordBean sendRecordBean = sendRecordBeanList.get(i);
... ... @@ -92,11 +95,11 @@ public class HaikangfaceApplicationTests {
92 95 ,sendRecordBean.getNum(),sendRecordBean.getDeviceID(),"2023-10-01 10:00:00",sendRecordBean.getImgPath(),sendRecordBean.getName(),"2","1","2019-10-01 10:00:00");
93 96 String result1 = restTemplate.getForObject(url, String.class);
94 97 System.out.println("下发人脸:" + result1+" idnex:"+idnex++);
95   - try {
96   - Thread.sleep(2000);
97   - } catch (InterruptedException e) {
98   - e.printStackTrace();
99   - }
  98 +// try {
  99 +// Thread.sleep(2000);
  100 +// } catch (InterruptedException e) {
  101 +// e.printStackTrace();
  102 +// }
100 103  
101 104 }*/
102 105  
... ... @@ -280,158 +283,34 @@ public class HaikangfaceApplicationTests {
280 283 }*/
281 284 }
282 285  
283   - @Test
284   - public void fileRes() {
285   -
286   -
287   - /*List<String> stringList = sendRecordDao.getAllARecords();
288   - for (int i = 0; i < stringList.size(); i++) {
289   -
290   - List<AttendanceRecordsSS> stus = sendRecordDao.getARecords(stringList.get(i));
291   - if (stus.size()>0){
292   - AttendanceRecordsSS attendanceRecordsSS = stus.get(0);
293   -
294   - sendRecordDao.deleteARecords(attendanceRecordsSS.getCustomerId(),attendanceRecordsSS.getSystime());
295   -
296   - }
297   -
298   - }*/
299   -
300   -
301   -
302   -
303   - /* List<CreditCardRecordsSS> creditCardRecordsSSES = sendRecordDao.getCardRecordss();
304   - List<String> customerIds = new ArrayList<>();
305   - for (int i = 0; i < creditCardRecordsSSES.size(); i++) {
306   - CreditCardRecordsSS creditCardRecordsSS = creditCardRecordsSSES.get(i);
307   - if (!customerIds.contains(creditCardRecordsSS.getCustomerId())) {
308   - customerIds.add(creditCardRecordsSS.getCustomerId());
309   - System.out.println("creditCardRecordsSS:" + creditCardRecordsSS.toString());
310   - String classId = userDao.getClassName(creditCardRecordsSS.getCustomerId());
311   - System.out.println("classId:" + classId);
312   - int result = sendRecordDao.addAttenRecodrds(creditCardRecordsSS.getUser_id(), creditCardRecordsSS.getSchool_id(),
313   - creditCardRecordsSS.getCustomerId(), creditCardRecordsSS.getUsertype(), creditCardRecordsSS.getCard_num(),
314   - creditCardRecordsSS.getCard_type(), creditCardRecordsSS.getOutof(), creditCardRecordsSS.getIntime(),
315   - creditCardRecordsSS.getCid(), creditCardRecordsSS.getFunc_no(), creditCardRecordsSS.getHead_image(),
316   - classId, "", creditCardRecordsSS.getAttendance_id(), creditCardRecordsSS.getName(), creditCardRecordsSS.getMobile(), creditCardRecordsSS.getClass_name(),
317   - creditCardRecordsSS.getSex(), creditCardRecordsSS.getStudent_type(), creditCardRecordsSS.getSystime());
318   - System.out.println("result:" + result);
319   - }
320   -
321   - }*/
322   - /*File file = new File("C:\\TaoHandong\\copy\\21_指纹签到.txt");
323   -
324   - try {
325   - BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
326   -
327   - String content = null;
328   - Set<String> strings = new HashSet<>();//存放studentid
329   - while ((content = bufferedReader.readLine()) != null) {
330   - if (content.contains("0x26")) {
331   - strings.add(content.split("cardNo:")[1]);
332   - }
333   - }
334   - System.out.println( "指纹签到数据:"+strings.size());
335   -
336   - String studentId = "";
337   -
338   - //获取全部住校生
339   - List<StudentBean> studentBeanList = userDao.getAllStuWithSchoolId("479");
340   -
341   - for (int i = 0; i < studentBeanList.size(); i++) {
342   - StudentBean studentBean = studentBeanList.get(i);
343   -
344   - if (!strings.contains(studentBean.getStudent_id())) {
345   - studentId += "'" + studentBean.getStudent_id() + "',";
346   - }
347   -
348   - }
349   -// System.out.println("studentId:"+studentId);
350   -
351   -
352   - File fileQD = new File("C:\\TaoHandong\\copy\\签到人员.txt");
  286 + @Autowired
  287 + ZuoYeDao zuoYeDao;
353 288  
354   - BufferedReader bufferedReaderQD = new BufferedReader(new FileReader(fileQD));
355   - String contentQD = null;
356   - Set<String> stringsQD = new HashSet<>();//存放studentid
357   - while ((contentQD = bufferedReaderQD.readLine()) != null) {
358   - List<String> studentids = userDao.getStudentIdWidthName(contentQD.trim(), "479");
359   - for (int i = 0; i < studentids.size(); i++) {
360   - stringsQD.add(studentids.get(i));
361   - }
362   - }
363   - System.out.println("stringsQD:" + stringsQD.size());
364   - String resultStuid="";
365   - Iterator iterator = stringsQD.iterator();
366   - while (iterator.hasNext()) {
367   - String studentId11 = (String) iterator.next();
368   - Iterator iterator1 = strings.iterator();
369   - boolean isHas = false;
370   - while (iterator1.hasNext()) {
371   - String stuId = (String) iterator1.next();
372   - if (studentId11.equals(stuId)) {
373   - isHas = true;
374   - }
375   - }
376   - if (!isHas) resultStuid += "'" + studentId11 + "',";
377   - }
  289 + @Autowired
  290 + ZuoyeAdminDao zuoyeAdminDao;
378 291  
379   - System.out.println("resultStuid:" + resultStuid);
380   - } catch (FileNotFoundException e) {
381   - e.printStackTrace();
382   - } catch (IOException e) {
383   - e.printStackTrace();
  292 + @Test
  293 + public void fileRes() {
  294 + List<QuestionBean> questionBeans = zuoYeDao.getQuestionsRecent();
  295 + /* List<QuestionBean> questionBeans = zuoYeDao.getQuestionsRecent();
  296 + String dateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
  297 +
  298 + for (QuestionBean ques :
  299 + questionBeans) {
  300 + zuoyeAdminDao.addQuestionStem("请回答下列问题", "1", dateTime);
  301 + int stemId = zuoyeAdminDao.getStemId();
  302 + String intime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
  303 + zuoyeAdminDao.addQuestion(ques.getQuestion(),ques.getQtype(),ques.getAnswer(),ques.getCorrectAnswer(),ques.getAnalysis(),
  304 + ques.getState(),intime,stemId+"",ques.getExamineFlag(),ques.getSubjectId(),"10","1",ques.getChapterId(),ques.getGradeId()+"","1","","1");
384 305 }*/
385 306  
  307 +List<Long> queIds = zuoyeAdminDao.getQueIds();
386 308  
387   -// List<FileBean> fileBeans = userDao.getFileRes();
388   -
389   - /* List<FileBean> fileBeanList = userDao.getFIlesReses();
390   -
391   - List<String> userIds = userDao.getUserids();
392   -
393   - for (int i = 0; i < fileBeanList.size(); i++) {
394   - FileBean fileBean = fileBeanList.get(i);
395 309  
396   - for (int j = 0; j < userIds.size(); j++) {
397   - String userId= userIds.get(j);
398   - String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
399   - userDao.addRelation(fileBean.getId(),time,userId);
  310 + for (int i = queIds.size()-1; i >=0 ; i--) {
  311 + zuoyeAdminDao.addYYQuestionAndKnowledg(queIds.get(i), Long.parseLong(questionBeans.get(questionBeans.size()-1-i).getKnowledgeId()),0,1);
400 312 }
401 313  
402   - }*/
403   -
404   -
405   -// System.out.println("fileBeans:"+fileBeans.toString());
406   -/*int index = 744;
407   - for (int i = index; i <fileBeans.size(); i++) {
408   - FileBean fileBean = fileBeans.get(i);
409   - System.out.println("fileBean:"+fileBean.toString());
410   - String gradeNamePJ = userDao.getGradeName(String.valueOf(fileBean.getGradeId()));
411   - gradeNamePJ = gradeNamePJ==null?"-1":gradeNamePJ;
412   - String gradeIdRC = userDao.getGradeId(gradeNamePJ.substring(0,gradeNamePJ.length()-1));
413   - String cateLofId = userDao.getResCatalog(userDao.getResCatalogName(fileBean.getCatalogId()));
414   - fileBean.setCatalogId(cateLofId==null?"-1":cateLofId);
415   - String resType = userDao.getResType(userDao.getResTypeName(String.valueOf(fileBean.getTypeId())));
416   - fileBean.setTypeId(Integer.parseInt(resType==null?"-1":resType));
417   - gradeIdRC = StringUtils.isEmpty(gradeIdRC)?"-1":gradeIdRC;
418   - fileBean.setGradeId(Integer.parseInt(gradeIdRC));
419   - String subject_id = userDao.getSubjectId(fileBean.getSubjectId());
420   - subject_id = subject_id==null?"-1":subject_id;
421   - fileBean.setSubjectId(Integer.parseInt(subject_id));
422   - String jiaocaiId = userDao.getJiaoCaiId(fileBean.getJiaoCaiId());
423   - jiaocaiId = jiaocaiId==null?"-1":jiaocaiId;
424   - fileBean.setJiaoCaiId(Integer.parseInt(jiaocaiId));
425   - fileBean.setUserId("zy405704");
426   - fileBean.setUserList("{\"SchoolId\":885,\"UserTypeList\":[\"1\"],\"UserIdList\":[]}");
427   - System.out.println("fileBean:"+fileBean.toString());
428   - userDao.addFiles(fileBean.getName(),fileBean.getCatalogId(),fileBean.getTypeId(),fileBean.getGradeId(),fileBean.getSubjectId(),
429   - fileBean.getJiaoCaiId(),fileBean.getCharpId(),fileBean.getFileUrl(),fileBean.getDescript(),
430   - fileBean.getKeywords(),fileBean.getAddTime(),fileBean.getStatus(),fileBean.getUserId(),fileBean.getTargetUrl(),
431   - fileBean.getClicks(),fileBean.getUserList(),fileBean.getIsShare(),fileBean.getCharpId(),fileBean.getKnowledgeId());
432   - index++;
433   - System.out.println("index:"+index);
434   - }*/
435 314  
436 315 }
437 316 }
... ...
cloud/log/2019-11-29/下发指令.txt 0 → 100644
... ... @@ -0,0 +1,4 @@
  1 +2019-11-29 17:00:01 2019-11-29 17:00:01 30
  2 +
  3 +2019-11-29 17:27:51 2019-11-29 17:27:51 30
  4 +
... ...
cloud/pom.xml
... ... @@ -85,20 +85,4 @@
85 85 </dependencies>
86 86 </dependencyManagement>
87 87  
88   - <build>
89   - <plugins>
90   - <plugin>
91   - <groupId>org.springframework.boot</groupId>
92   - <artifactId>spring-boot-maven-plugin</artifactId>
93   - <executions>
94   - <execution>
95   - <goals>
96   - <goal>repackage</goal>
97   - </goals>
98   - </execution>
99   - </executions>
100   - </plugin>
101   - </plugins>
102   - </build>
103   -
104 88 </project>
... ...