Commit a4c5d51e88c8970e6c95d9ba865f796fa466bb2d

Authored by 邱一成
2 parents f0d840f4 0a43b0af
Exists in master

Merge branch 'master' of http://git.shunzhi.net/taohd/mycloud

# Conflicts:
#	cloud/dahua/src/main/java/com/example/dahua/async/SendUserInfoTask.java
#	cloud/dahua/src/main/resources/application.yml
Showing 26 changed files with 715 additions and 850 deletions   Show diff stats
cloud/.mvn/wrapper/MavenWrapperDownloader.java
... ... @@ -1,114 +0,0 @@
1   -/*
2   -Licensed to the Apache Software Foundation (ASF) under one
3   -or more contributor license agreements. See the NOTICE file
4   -distributed with this work for additional information
5   -regarding copyright ownership. The ASF licenses this file
6   -to you under the Apache License, Version 2.0 (the
7   -"License"); you may not use this file except in compliance
8   -with the License. You may obtain a copy of the License at
9   -
10   - https://www.apache.org/licenses/LICENSE-2.0
11   -
12   -Unless required by applicable law or agreed to in writing,
13   -software distributed under the License is distributed on an
14   -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   -KIND, either express or implied. See the License for the
16   -specific language governing permissions and limitations
17   -under the License.
18   -*/
19   -
20   -import java.io.File;
21   -import java.io.FileInputStream;
22   -import java.io.FileOutputStream;
23   -import java.io.IOException;
24   -import java.net.URL;
25   -import java.nio.channels.Channels;
26   -import java.nio.channels.ReadableByteChannel;
27   -import java.util.Properties;
28   -
29   -public class MavenWrapperDownloader {
30   -
31   - /**
32   - * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
33   - */
34   - private static final String DEFAULT_DOWNLOAD_URL =
35   - "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar";
36   -
37   - /**
38   - * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
39   - * use instead of the default one.
40   - */
41   - private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
42   - ".mvn/wrapper/maven-wrapper.properties";
43   -
44   - /**
45   - * Path where the maven-wrapper.jar will be saved to.
46   - */
47   - private static final String MAVEN_WRAPPER_JAR_PATH =
48   - ".mvn/wrapper/maven-wrapper.jar";
49   -
50   - /**
51   - * Name of the property which should be used to override the default download url for the wrapper.
52   - */
53   - private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
54   -
55   - public static void main(String args[]) {
56   - System.out.println("- Downloader started");
57   - File baseDirectory = new File(args[0]);
58   - System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
59   -
60   - // If the maven-wrapper.properties exists, read it and check if it contains a custom
61   - // wrapperUrl parameter.
62   - File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
63   - String url = DEFAULT_DOWNLOAD_URL;
64   - if (mavenWrapperPropertyFile.exists()) {
65   - FileInputStream mavenWrapperPropertyFileInputStream = null;
66   - try {
67   - mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
68   - Properties mavenWrapperProperties = new Properties();
69   - mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
70   - url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
71   - } catch (IOException e) {
72   - System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
73   - } finally {
74   - try {
75   - if (mavenWrapperPropertyFileInputStream != null) {
76   - mavenWrapperPropertyFileInputStream.close();
77   - }
78   - } catch (IOException e) {
79   - // Ignore ...
80   - }
81   - }
82   - }
83   - System.out.println("- Downloading from: : " + url);
84   -
85   - File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
86   - if (!outputFile.getParentFile().exists()) {
87   - if (!outputFile.getParentFile().mkdirs()) {
88   - System.out.println(
89   - "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'");
90   - }
91   - }
92   - System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
93   - try {
94   - downloadFileFromURL(url, outputFile);
95   - System.out.println("Done");
96   - System.exit(0);
97   - } catch (Throwable e) {
98   - System.out.println("- Error downloading");
99   - e.printStackTrace();
100   - System.exit(1);
101   - }
102   - }
103   -
104   - private static void downloadFileFromURL(String urlString, File destination) throws Exception {
105   - URL website = new URL(urlString);
106   - ReadableByteChannel rbc;
107   - rbc = Channels.newChannel(website.openStream());
108   - FileOutputStream fos = new FileOutputStream(destination);
109   - fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
110   - fos.close();
111   - rbc.close();
112   - }
113   -
114   -}
cloud/.mvn/wrapper/maven-wrapper.jar
No preview for this file type
cloud/.mvn/wrapper/maven-wrapper.properties
... ... @@ -1 +0,0 @@
1   -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip
cloud/dahua/src/main/java/com/example/dahua/MyTask.java
1 1 package com.example.dahua;
2 2  
3 3 import com.example.dahua.bean.*;
4   -import com.example.dahua.dao.SearchDao;
5 4 import com.example.dahua.dao.UserDao;
6 5 import com.example.dahua.lib.NetSDKLib;
7 6 import com.example.dahua.lib.ToolKits;
8 7 import com.example.dahua.lib.Utils;
9 8 import com.example.dahua.module.AutoRegisterModule;
10   -import com.example.dahua.module.FaceRecognitionModule;
11 9 import com.example.dahua.module.GateModule;
12 10 import com.example.dahua.module.LoginModule;
13 11 import com.example.dahua.service.AttendanceService;
14 12 import com.example.dahua.utils.DateUtils;
15 13 import com.example.dahua.utils.FileUtils;
  14 +import com.example.dahua.xiananDao.SearchMapper;
16 15 import com.example.dahua.xiananDao.SendRecordDao;
17 16 import com.sun.jna.Pointer;
18 17 import lombok.extern.slf4j.Slf4j;
... ... @@ -61,7 +60,7 @@ public class MyTask implements ApplicationRunner {
61 60 SendRecordDao sendRecordDao;
62 61  
63 62 @Autowired
64   - SearchDao searchDao;
  63 + SearchMapper searchMapper;
65 64  
66 65 @Autowired
67 66 UserDao userDao;
... ... @@ -392,7 +391,7 @@ public class MyTask implements ApplicationRunner {
392 391 checkIn.setFunNo(8);
393 392 checkIn.setFlag(eventType == 2 ? 1 : 0);
394 393 checkIn.setCheckTime(eventTime);
395   - searchDao.checkIn(checkIn);
  394 + searchMapper.checkIn(checkIn);
396 395 if (checkIn.getIsSuccess() == 1) {
397 396 //考勤成功
398 397 String content = "考勤成功!,设备:" + deviceId + "卡号:" + cardNo + "方向:" + (eventType == 1 ? "进门" : "出门") + "______" + eventTime;
... ... @@ -406,10 +405,10 @@ public class MyTask implements ApplicationRunner {
406 405 }
407 406 } else {
408 407 //判断是否请假
409   - String studentNum = searchDao.checkLeave(cardNo);
  408 + String studentNum = userDao.checkLeave(cardNo);
410 409 if (org.apache.commons.lang.StringUtils.isNotBlank(studentNum)) {
411 410 //短信信息
412   - Message mobileMessage = searchDao.selectByParentMobile(cardNo);
  411 + Message mobileMessage = userDao.selectByParentMobile(cardNo);
413 412 if (mobileMessage.getSchoolId() == 4) {
414 413 //才发送短信
415 414 ShortMsg shortMsg = new ShortMsg();
... ... @@ -423,11 +422,11 @@ public class MyTask implements ApplicationRunner {
423 422 } else {
424 423 shortMsg.setMsg(mobileMessage.getName() + "家长您好,你的孩子于" + DateUtils.date2String(new Date(), DateUtils.format2) + "请假后进校,请知晓;");
425 424 }
426   - searchDao.insertMessage(shortMsg.getTableName(),shortMsg.getSchoolId()+"",shortMsg.getMobile(),shortMsg.getMsg());
  425 + userDao.insertMessage(shortMsg.getTableName(),shortMsg.getSchoolId()+"",shortMsg.getMobile(),shortMsg.getMsg());
427 426 }
428 427 } else {
429 428 //若即不成功,也不是请假,则按刷卡异常处理
430   - User user = searchDao.selectUserByCardNum(cardNo).get(0);
  429 + User user = userDao.selectUserByCardNum(cardNo).get(0);
431 430 if(user ==null ){
432 431 System.out.println("卡号"+cardNo+"没找到对应学生或老师");
433 432 }
... ...
cloud/dahua/src/main/java/com/example/dahua/async/SendUserInfoTask.java
... ... @@ -10,6 +10,7 @@ import com.example.dahua.bean.TeacherBean;
10 10 import com.example.dahua.bean.UserInfoBean;
11 11 import com.example.dahua.common.Res;
12 12 import com.example.dahua.dao.UserDao;
  13 +import com.example.dahua.enums.*;
13 14 import com.example.dahua.lib.CompressPic;
14 15 import com.example.dahua.lib.FilePath;
15 16 import com.example.dahua.lib.NetSDKLib;
... ... @@ -44,21 +45,32 @@ public class SendUserInfoTask {
44 45 @Autowired
45 46 SendRecordDao sendRecordDao;
46 47  
  48 + /**
  49 + * 下发单个用户人脸任务
  50 + * @param file
  51 + * @param attendanceBeans
  52 + * @param userInfoBean
  53 + * @param schoolId
  54 + * @param failType
  55 + * @param userType
  56 + * @throws Exception
  57 + */
47 58 // @Async("taskExecutor")
48 59 public void doTaskOne(String file, List<AttendanceBean> attendanceBeans, UserInfoBean userInfoBean, String schoolId, int failType, int userType) throws Exception {
49 60 File studentFile = new File(file);
  61 + //学籍号
50 62 String studentCode = studentFile.getName().split("\\.")[0];
51 63 //判断是否是副卡
52 64 String[] studentCodes = studentCode.split("_");
53 65  
54   -
55   - if (studentCodes.length > 1) {//副卡
56   -
  66 + //副卡
  67 + if (studentCodes.length > 1) {
57 68 String cardType = studentCodes[1];
  69 + //获取卡号
58 70 String cardNum = userDao.getCardNum(userInfoBean.getStudent_id(), cardType);
59 71 userInfoBean.setStudent_num(cardNum);
60   -
61 72 }
  73 + //设置下发记录
62 74 SendRecordBean sendRecordBean = new SendRecordBean();
63 75 sendRecordBean.setSchoolId(Integer.parseInt(schoolId));
64 76 sendRecordBean.setSchoolName(userDao.getSchoolName(schoolId));
... ... @@ -67,9 +79,11 @@ public class SendUserInfoTask {
67 79 sendRecordBean.setNum(userInfoBean.getStudent_num());
68 80 sendRecordBean.setName(userInfoBean.getName());
69 81 sendRecordBean.setImgPath(file);
  82 + //用户id(即学生ID)
70 83 sendRecordBean.setCustomerid(userInfoBean.getStudent_id());
71 84 sendRecordBean.setFailType(failType);
72   - sendUserInfoToDev(file, attendanceBeans, userInfoBean, userType + "", sendRecordBean);
  85 + //下发至设备
  86 + sendUserInfoToDev(file, attendanceBeans, userInfoBean, String.valueOf(userType), sendRecordBean);
73 87 }
74 88  
75 89 // @Async("taskExecutor")
... ... @@ -217,26 +231,30 @@ public class SendUserInfoTask {
217 231  
218 232 private synchronized boolean sendUserInfoToDev(String file, List<AttendanceBean> attendanceBeans, UserInfoBean userInfoBean, String userType, SendRecordBean sendRecordBean) {
219 233 try {
  234 + //用户信息
220 235 if (userInfoBean == null) {
221   - System.out.println("学生用户不存在");
  236 + log.warn("学生用户信息不存在");
222 237 return false;
223 238 }
224   - if (attendanceBeans.size() == 0) {//"该学校下没有人脸设备"
225   - System.out.println("该学校下没有人脸设备:");
226   - sendRecordBean.setFailType(2);
227   - sendRecordBean.setFailContent("图片目录不存在");
228   - String schoolName = sendRecordDao.getSchoolDevice(sendRecordBean.getSchoolId(), 2);//判断是否已经记录改学校没有设备
229   - if (StringUtils.isEmpty(schoolName)) {//不存在记录则添加,保证没有设备的学校记录只有一条
230   - sendRecordDao.updateFace(sendRecordBean.getNum(), sendRecordBean.getDeviceID(), sendRecordBean.getFailType(), 2);//更新下发失败状态
231   - addFailDace(sendRecordBean);
232   - }
233   - return false;
234   - }
235   -
  239 + //卡号
236 240 String cardNum = userInfoBean.getStudent_num();
237   - System.out.println("cardNum:" + cardNum);
238 241 if (StringUtils.isEmpty(cardNum) || cardNum.equals("null")) {
239   - System.out.println("卡号为空");
  242 + log.warn("下发卡号为空");
  243 + return false;
  244 + }
  245 + //该学校下没有人脸设备
  246 + if (attendanceBeans.size() == 0) {
  247 + sendRecordBean.setFailType(EnumSendFaceType.NOT_EXIST_DEVICE.code);
  248 + sendRecordBean.setFailContent(EnumSendFaceType.NOT_EXIST_DEVICE.message);
  249 + //获取学校下发失败记录,判断是否已经记录该学校没有设备
  250 + String schoolName = sendRecordDao.getSchoolDevice(sendRecordBean.getSchoolId(), EnumSendFaceType.NOT_EXIST_DEVICE.code);
  251 + //不存在记录则添加,保证没有设备的学校记录只有一条
  252 + if (StringUtils.isEmpty(schoolName)) {
  253 + //更新下发失败状态
  254 + sendRecordDao.updateFace(sendRecordBean.getNum(), sendRecordBean.getDeviceID(), sendRecordBean.getFailType(), EnumSendFaceType.NOT_EXIST_DEVICE.code);
  255 + addFailDace(sendRecordBean);
  256 + }
  257 + log.warn("该学校下没有人脸设备");
240 258 return false;
241 259 }
242 260  
... ... @@ -276,9 +294,9 @@ public class SendUserInfoTask {
276 294 } catch (Exception e) {
277 295 e.printStackTrace();
278 296 }
279   -
280   - for (AttendanceBean attendanceBean :
281   - attendanceBeans) {
  297 + log.info("下发人脸设备总数,size: "+ attendanceBeans.size());
  298 + //下发至所有设备
  299 + for (AttendanceBean attendanceBean : attendanceBeans) {
282 300 pushCardAndFace(attendanceBean, userInfoBean.getUser_id(), userInfoBean.getStudent_num(), userInfoBean.getName(), memory, sendRecordBean,userType);
283 301 }
284 302 }
... ... @@ -295,136 +313,202 @@ public class SendUserInfoTask {
295 313 */
296 314 private synchronized void pushCardAndFace(AttendanceBean attendanceBean, String user_id, String student_num, String name, Memory memory, SendRecordBean sendRecordBean,String userType) {
297 315 try{
298   - sendRecordBean.setDeviceID(attendanceBean.getClint_id());
299   - sendRecordBean.setSchoolId(Integer.parseInt(attendanceBean.getSchool_id()));
300   - sendRecordBean.setTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
301   - sendRecordBean.setSchoolName(userDao.getSchoolName(attendanceBean.getSchool_id()));
302   - String startTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
303   - Calendar calendar = Calendar.getInstance();
304   - calendar.add(Calendar.YEAR, 4);
305   - String endTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime());
306   - //记录集编号,存在于设备的,默认为 -1, 其他值为存在下发记录
307   - int bCardFlags = -1;
308   - //从下发记录表:SZ_Student_RecoderNo 获取记录集编号
309   - bCardFlags = userDao.getRecordNo(user_id, attendanceBean.getClint_id()) == null ? -1 : Integer.parseInt(userDao.getRecordNo(user_id, attendanceBean.getClint_id()));
310   -
311   - NetSDKLib.LLong loginHandleLong = MyTask.lLongMap.get(attendanceBean.getClint_id());
312   - log.info("设备ID: {},设备登录句柄: {}",loginHandleLong,attendanceBean.getClint_id() );
313   -
314   - //若设备不在线时,且人脸下发失败表中存在记录,则执行修改下发失败状态为:设备不在线
315   - if (loginHandleLong == null) {
316   - log.info("设备不在线, 设备ID: {} ",attendanceBean.getClint_id() );
317   - FileUtils.getInstance().writeLogs("设备不在线:" + attendanceBean.getClint_id(), FileUtils.devices);
318   - String deviceId = sendRecordDao.getFailIsExit(attendanceBean.getClint_id(), attendanceBean.getSchool_id());
319   - sendRecordBean.setFailType(2);
320   - sendRecordBean.setFailContent("设备不在线");
321   - if (!StringUtils.isEmpty(deviceId)) {
322   - sendRecordDao.updateFace(sendRecordBean.getNum(), sendRecordBean.getDeviceID(), sendRecordBean.getFailType(), 2);//更新下发失败状态
323   - addFailDace(sendRecordBean);
324   - }
325   - } else {
  316 + sendRecordBean.setDeviceID(attendanceBean.getClint_id());
  317 + sendRecordBean.setSchoolId(Integer.parseInt(attendanceBean.getSchool_id()));
  318 + sendRecordBean.setTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
  319 + sendRecordBean.setSchoolName(userDao.getSchoolName(attendanceBean.getSchool_id()));
  320 +
  321 + String startTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
  322 + Calendar calendar = Calendar.getInstance();
  323 + calendar.add(Calendar.YEAR, 4);
  324 + String endTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime());
  325 +
  326 + /**
  327 + * 注:用户下发逻辑
  328 + * 下发时,先从下发记录表:SZ_Student_RecoderNo 获取当前用户下发记录集编号,存在于设备的,新增卡号时返回,
  329 + * 若存在记录集编号,则表示用户已下发过,执行修改用户信息,反之,则新增下发用户人脸、卡信息
  330 + */
  331 +
326 332 //人脸下发成功标识:false:失败 true:成功
327 333 boolean bFaceFalgs = false;
328   - //卡号取反
329   - String cardNum = cardNo(student_num);
330   - log.info("=====开始执行下发人脸及卡号任务=====: clintId:{}, userId:{}, cardNum:{}, name:{} ",attendanceBean.getClint_id(),user_id,cardNum,name);
331   - if (bCardFlags != -1) {
332   - //修改设备卡信息
333   - boolean isEditCard = GateModule.modifyCard(bCardFlags, cardNum, user_id, name, "123456", Res.string().getCardStatusInt(1), Res.string().getCardTypeInt(1),
334   - 0, 0, 1, startTime, endTime, loginHandleLong, userType);
335   -
336   - if (isEditCard) {
337   - //设备修改卡成功, 更新下发记录表
338   - userDao.updateRecordNo(user_id, bCardFlags, attendanceBean.getClint_id());
339   - //设备卡修改成功后,更新设备人脸信息
340   - boolean isEditFace = GateModule.modifyFaceInfo(user_id, memory, loginHandleLong);
341   - //修改卡信息成功,但是人脸不成功的话,就需要新增人脸
342   - if (!isEditFace) {
343   - bFaceFalgs = GateModule.addFaceInfo(user_id, memory, loginHandleLong);
  334 + //卡下发成功标识:false:失败 true:成功
  335 + boolean bCardFlags = false;
  336 + //卡操作错误号
  337 + String cardErrNum ="";
  338 + //人脸操作错误号
  339 + String faceErrNum ="";
  340 + //新的记录集编号
  341 + int newRecordNo = 0;
  342 + //获取记录集编号
  343 + String recordNo = userDao.getRecordNo(user_id, attendanceBean.getClint_id());
  344 + if(!StringUtils.isEmpty(recordNo)){
  345 + bCardFlags = true;
  346 + }
  347 + //登录设备
  348 + NetSDKLib.LLong loginHandleLong = MyTask.lLongMap.get(attendanceBean.getClint_id());
  349 + log.info("设备ID: {},设备登录句柄: {}",attendanceBean.getClint_id(),loginHandleLong);
  350 +
  351 + //若设备不在线时,且人脸下发失败表中存在记录,则执行修改下发失败状态为:设备不在线
  352 + if (loginHandleLong == null) {
  353 + log.info("设备不在线, 设备ID: {} ",attendanceBean.getClint_id() );
  354 + FileUtils.getInstance().writeLogs("设备不在线:" + attendanceBean.getClint_id(), FileUtils.devices);
  355 + //设备不在线
  356 + sendRecordBean.setFailType(EnumSendFaceType.NOT_ONLINE_DEVICE.code);
  357 + sendRecordBean.setFailContent(EnumSendFaceType.NOT_ONLINE_DEVICE.message);
  358 + //判断该学校设备ID对应失败记录是否存在:Face_SendFail
  359 + String deviceId = sendRecordDao.getFailIsExit(attendanceBean.getClint_id(), attendanceBean.getSchool_id());
  360 + if (!StringUtils.isEmpty(deviceId)) {
  361 + //更新下发失败状态
  362 + sendRecordDao.updateFace(sendRecordBean.getNum(), sendRecordBean.getDeviceID(), sendRecordBean.getFailType(), EnumSendFaceType.NOT_ONLINE_DEVICE.code);
  363 + //添加下发失败记录
  364 + addFailDace(sendRecordBean);
  365 + }
  366 + } else {
  367 + log.info("=================开始执行下发人脸及卡号任务=================");
  368 + //卡号取反
  369 + String cardNum = cardNo(student_num);
  370 + //bCardFlags = true, 存在下发记录,则存在下发记录集编号,执行修改卡、人脸信息
  371 + if (bCardFlags) {
  372 + //修改设备卡信息
  373 + boolean isEditCard = GateModule.modifyCard(Integer.parseInt(recordNo),cardNum, user_id, name, "123456", Res.string().getCardStatusInt(1),
  374 + Res.string().getCardTypeInt(1), 0, 0, 1, startTime, endTime, loginHandleLong, userType,cardErrNum);
  375 +
  376 + if (isEditCard) {
  377 + //修改卡成功, 更新下发记录集编号表
  378 + userDao.updateRecordNo(user_id, Integer.parseInt(recordNo), attendanceBean.getClint_id());
  379 + //修改卡成功, 更新设备用户人脸信息
  380 + boolean isEditFace = GateModule.modifyFaceInfo(user_id, memory, loginHandleLong,faceErrNum);
  381 + //修改卡信息成功,但是人脸修改不成功的话,就需要新增人脸
  382 + if (!isEditFace) {
  383 + bFaceFalgs = GateModule.addFaceInfo(user_id, memory, loginHandleLong,faceErrNum);
  384 + }
  385 + }else{
  386 + //设备修改卡信息失败,则删除下发记录集编号表记录:SZ_Student_RecoderNo,重新下发.
  387 + userDao.deleteRecordNo(user_id, Integer.parseInt(recordNo));
  388 + //重新下发卡号至设备
  389 + newRecordNo = GateModule.insertCard(cardNum, user_id, name, "123456", Res.string().getCardStatusInt(1),
  390 + Res.string().getCardTypeInt(1), 0, 1, 1, startTime, endTime, loginHandleLong,userType,cardErrNum);
  391 +
  392 + //下发卡至设备,返回值不为-1为下发成功,保存下发记录集编号表
  393 + if (newRecordNo != -1) {
  394 + userDao.saveRecordNo(user_id, newRecordNo, name, attendanceBean.getClint_id());//存储记录集编号
  395 + }
  396 + //添加人脸
  397 + bFaceFalgs = GateModule.addFaceInfo(user_id, memory, loginHandleLong,faceErrNum);
344 398 }
345   - }else{
346   - //设备修改卡信息失败,则删除下发记录集编号表记录:SZ_Student_RecoderNo,重新下发.
347   - userDao.deleteRecordNo(user_id, bCardFlags);
348   - //重新下发卡号至设备
349   - bCardFlags = GateModule.insertCard(cardNum, user_id, name, "123456"
  399 +
  400 + } else {
  401 + //新增卡信息, 新增人脸信息至设备
  402 + newRecordNo = GateModule.insertCard(cardNum, user_id, name, "123456"
350 403 , Res.string().getCardStatusInt(1), Res.string().getCardTypeInt(1), 0, 1
351   - , 1, startTime, endTime, loginHandleLong,userType);
  404 + , 1, startTime, endTime, loginHandleLong,userType,cardErrNum);
  405 +
352 406 //下发卡至设备,返回值不为-1为下发成功,保存下发记录集编号表
353   - if (bCardFlags != -1) {
354   - userDao.saveRecordNo(user_id, bCardFlags, name, attendanceBean.getClint_id());//存储记录集编号
  407 + if (newRecordNo != -1) {
  408 + userDao.saveRecordNo(user_id, newRecordNo, name, attendanceBean.getClint_id());
355 409 }
356 410 //添加人脸
357   - bFaceFalgs = GateModule.addFaceInfo(user_id, memory, loginHandleLong);
358   - }
  411 + bFaceFalgs = GateModule.addFaceInfo(user_id, memory, loginHandleLong,faceErrNum);
359 412  
360   - } else {
361   - //新增卡信息, 新增人脸信息至设备
362   - bCardFlags = GateModule.insertCard(cardNum, user_id, name, "123456"
363   - , Res.string().getCardStatusInt(1), Res.string().getCardTypeInt(1), 0, 1
364   - , 1, startTime, endTime, loginHandleLong,userType);
365   - //下发卡至设备,返回值不为-1为下发成功,保存下发记录集编号表
366   - if (bCardFlags != -1) {
367   - userDao.saveRecordNo(user_id, bCardFlags, name, attendanceBean.getClint_id());
368 413 }
369   - //添加人脸
370   - bFaceFalgs = GateModule.addFaceInfo(user_id, memory, loginHandleLong);
371   -
372   - }
373   -
374   - if (bCardFlags != -1 && bFaceFalgs) {
375   - FileUtils.getInstance().writeLogs("下发人脸和卡号成功:" + cardNum + " " + attendanceBean.getClint_id(), FileUtils.sendUserSucTxt);
376   - log.info("下发人脸和卡号成功, sendRecordBean: "+ JSON.toJSONString(sendRecordBean));
377   -
378   - //人脸下发成功记录, 先判断是否已经存在了
379   - List<SendRecordBean> sendRecordBeanList = sendRecordDao.getFaceSucceIsexit(sendRecordBean.getDeviceID(), String.valueOf(sendRecordBean.getSchoolId()), sendRecordBean.getCustomerid());
380   - if (sendRecordBeanList.size() > 0) {
381   - //删除重复数据
382   - for (int i = 0; i < sendRecordBeanList.size(); i++) {
383   - sendRecordDao.deleteFaceSuccess(sendRecordBeanList.get(i).getDeviceID(), sendRecordBeanList.get(i).getNum());
  414 + /**
  415 + * 人脸和卡都下发成功
  416 + */
  417 + if (bCardFlags && bFaceFalgs) {
  418 + FileUtils.getInstance().writeLogs("下发人脸和卡号成功:" + cardNum + " " + attendanceBean.getClint_id(), FileUtils.sendUserSucTxt);
  419 + log.info("下发人脸和卡号成功, sendRecordBean: "+ JSON.toJSONString(sendRecordBean));
  420 +
  421 + //人脸下发成功记录, 先判断是否已经存在了
  422 + List<SendRecordBean> sendRecordBeanList = sendRecordDao.getFaceSucceIsexit(sendRecordBean.getDeviceID(), String.valueOf(sendRecordBean.getSchoolId()), sendRecordBean.getNum());
  423 + if (sendRecordBeanList.size() > 0) {
  424 + //删除重复数据
  425 + for (int i = 0; i < sendRecordBeanList.size(); i++) {
  426 + sendRecordDao.deleteFaceSuccess(sendRecordBeanList.get(i).getDeviceID(), sendRecordBeanList.get(i).getNum());
  427 + }
384 428 }
  429 + //重新添加人脸下发记录
  430 + sendRecordDao.addFaceSuccess(sendRecordBean.getCustomerid(), sendRecordBean.getDeviceID(), sendRecordBean.getNum(), sendRecordBean.getName(), sendRecordBean.getTime(),
  431 + sendRecordBean.getSchoolName(), sendRecordBean.getImgPath(), sendRecordBean.getSchoolId(), sendRecordBean.getUserType(), 22);
385 432  
  433 + //重新下发时,删除之前失败记录
  434 + if (sendRecordBean.getFailType() != 0){
  435 + sendRecordDao.deleteFaceFail(sendRecordBean.getNum(), sendRecordBean.getDeviceID());
  436 + }
  437 + }
  438 + /**
  439 + * 人脸和卡都下发失败
  440 + */
  441 + if (!bCardFlags && !bFaceFalgs) {
  442 + FileUtils.getInstance().writeLogs("下发人脸和卡号失败:" + cardNum + " user_id: " + user_id + " loginHandleLong: " + loginHandleLong, FileUtils.sendUserErrTxt);
  443 + log.info("下发人脸和卡号失败, sendRecordBean: "+ JSON.toJSONString(sendRecordBean));
  444 + //失败信息
  445 + String failContent = analysisErrorMsg(cardErrNum,faceErrNum);
  446 + sendRecordBean.setFailType(EnumSendFaceType.FACE_AND_CARD_FAIL.code);
  447 + sendRecordBean.setFailContent(failContent);
  448 + sendRecordDao.updateFace(sendRecordBean.getNum(), sendRecordBean.getDeviceID(), sendRecordBean.getFailType(), EnumSendFaceType.FACE_AND_CARD_FAIL.code);
  449 + addFailDace(sendRecordBean);
  450 + }
  451 + /**
  452 + * 下发卡号成功,下发人脸失败,
  453 + */
  454 + if (bCardFlags && !bFaceFalgs) {
  455 + FileUtils.getInstance().writeLogs("下发卡号成功,下发人脸失败:" + cardNum + " " + attendanceBean.getClint_id(), FileUtils.sendUserErrTxt);
  456 + log.info("下发卡号成功,下发人脸失败, sendRecordBean: " + JSON.toJSONString(sendRecordBean));
  457 + //失败信息
  458 + String failContent = analysisErrorMsg(cardErrNum,faceErrNum);
  459 + sendRecordBean.setFailType(EnumSendFaceType.FACE_FAIL_CARD_SUCCESS.code);
  460 + sendRecordBean.setFailContent(failContent);
  461 + sendRecordDao.updateFace(sendRecordBean.getNum(), sendRecordBean.getDeviceID(), sendRecordBean.getFailType(), EnumSendFaceType.FACE_FAIL_CARD_SUCCESS.code);
  462 + addFailDace(sendRecordBean);
  463 + }
  464 + /**
  465 + * 下发卡号失败,下发人脸成功,
  466 + * 注:此一般不存在
  467 + */
  468 + if (!bCardFlags && bFaceFalgs) {
  469 + FileUtils.getInstance().writeLogs("卡信息已存在,下发人脸成功:" + cardNum + " " + attendanceBean.getClint_id(), FileUtils.sendUserSucTxt);
  470 + log.info("-----------卡信息已存在,添加人脸成功----------");
386 471 }
387   - //重新添加人脸下发记录
388   - sendRecordDao.addFaceSuccess(sendRecordBean.getCustomerid(), sendRecordBean.getDeviceID(), sendRecordBean.getNum(), sendRecordBean.getName(), sendRecordBean.getTime(),
389   - sendRecordBean.getSchoolName(), sendRecordBean.getImgPath(), sendRecordBean.getSchoolId(), sendRecordBean.getUserType(), 22);
390   -
391   - //删除成功
392   - if (sendRecordBean.getFailType() != 0)
393   - sendRecordDao.deleteFaceFail(sendRecordBean.getNum(), sendRecordBean.getDeviceID());
394   -
395   - }
396   -
397   - // 添加卡信息和人脸失败
398   - if (bCardFlags == -1 && !bFaceFalgs) {
399   - FileUtils.getInstance().writeLogs("下发人脸和卡号失败:" + cardNum + " user_id: " + user_id + " loginHandleLong: " + loginHandleLong, FileUtils.sendUserErrTxt);
400   - log.error("下发人脸和卡号失败, sendRecordBean: "+ JSON.toJSONString(sendRecordBean));
401   - sendRecordBean.setFailContent("下发人脸和卡号失败");
402   - sendRecordDao.updateFace(sendRecordBean.getNum(), sendRecordBean.getDeviceID(), sendRecordBean.getFailType(), 7);//更新下发失败状态
403   - sendRecordBean.setFailType(8);
404   - addFailDace(sendRecordBean);
405   - }
406   -
407   - // 添加卡信息成功,添加人脸失败
408   - if (bCardFlags != -1 && !bFaceFalgs) {
409   - FileUtils.getInstance().writeLogs("下发卡号成功,下发人脸失败:" + cardNum + " " + attendanceBean.getClint_id(), FileUtils.sendUserErrTxt);
410   - log.error("下发人脸和卡号失败, sendRecordBean: " + JSON.toJSONString(sendRecordBean));
411   - sendRecordDao.updateFace(sendRecordBean.getNum(), sendRecordBean.getDeviceID(), sendRecordBean.getFailType(), 5);//更新下发失败状态
412   - sendRecordBean.setFailContent("下发卡号成功,人脸失败:照片特征值提取失败");
413   - sendRecordBean.setFailType(5);
414   - addFailDace(sendRecordBean);
415 472 }
  473 + } catch (Exception e) {
  474 + e.printStackTrace();
  475 + }
  476 + }
416 477  
417   - // 卡信息已存在,添加人脸成功,此情况不存在.
418   - if (bCardFlags == -1 && bFaceFalgs) {
419   - FileUtils.getInstance().writeLogs("下发人脸成功:" + cardNum + " " + attendanceBean.getClint_id(), FileUtils.sendUserSucTxt);
420   - System.out.println("卡信息已存在,添加人脸成功-----------\n");
  478 + /**
  479 + * 解析下发异常信息
  480 + * @param cardErrNum
  481 + * @param faceErrNum
  482 + * @return
  483 + */
  484 + private String analysisErrorMsg(String cardErrNum,String faceErrNum){
  485 + StringBuffer sb = new StringBuffer();
  486 + //卡异常信息
  487 + if(!StringUtils.isEmpty(cardErrNum)){
  488 + EnumSendCardErrorType enumSendCardErrorType = EnumSendCardErrorType.getByCode(cardErrNum);
  489 + String message = "";
  490 + if(enumSendCardErrorType !=null){
  491 + message= enumSendCardErrorType.getMessage();
  492 + sb.append("下发卡:").append(message).append(";");
421 493 }
  494 + log.info("下发卡失败,错误码:{},错误描述:{}",cardErrNum,message);
422 495 }
423   - } catch (Exception e) {
424   - e.printStackTrace();
  496 + //人脸异常信息
  497 + if(!StringUtils.isEmpty(faceErrNum)){
  498 + EnumSendFaceErrorType enumSendFaceErrorType = EnumSendFaceErrorType.getByCode(faceErrNum);
  499 + String message = "";
  500 + if(enumSendFaceErrorType !=null){
  501 + message= enumSendFaceErrorType.getMessage();
  502 + sb.append("下发人脸:").append(message);
  503 + }
  504 + log.info("下发人脸失败,错误码:{},错误描述:{}",faceErrNum,message);
425 505 }
  506 + return sb.toString();
426 507 }
427 508  
  509 + public static void main(String[] args) {
  510 + System.out.println(new SendUserInfoTask().analysisErrorMsg("",""));
  511 + }
428 512  
429 513 /**
430 514 * 添加人脸下发失败记录
... ... @@ -440,15 +524,16 @@ public class SendUserInfoTask {
440 524 for (int i = 0; i < sendRecordBeanList.size(); i++) {
441 525 sendRecordDao.deleteFaceFail(sendRecordBeanList.get(i).getNum(), sendRecordBeanList.get(i).getDeviceID());
442 526 }
443   -
  527 + //TODO 不明含义
444 528 if (sendRecordBean.getFailType() == 5) sendRecordBean.setFailType(8);
445   -
446   - String imagePath = sendRecordBean.getImgPath().replace("C:/imgCom",
447   - String.format("E:\\wwwhtdocs\\smartcampus\\face17e5\\School%s\\%s", sendRecordBean.getSchoolId(), sendRecordBean.getUserType() == 1 ? "Teacher" : "Student"));
  529 + //
  530 + String rootPath = sendRecordBean.getUserType() == EnumSzBusinessType.EnumUserType.TEACHER.code ? "Teacher" : "Student" ;
  531 + //人脸路径
  532 + String imagePath = sendRecordBean.getImgPath().replace("C:/imgCom", String.format("E:\\wwwhtdocs\\smartcampus\\face17e5\\School%s\\%s", sendRecordBean.getSchoolId(), rootPath));
448 533  
449 534 //添加失败记录
450 535 sendRecordDao.addFaceFail(sendRecordBean.getCustomerid(), sendRecordBean.getDeviceID(), sendRecordBean.getNum(), sendRecordBean.getName(), sendRecordBean.getTime(),
451   - sendRecordBean.getSchoolName(), imagePath, sendRecordBean.getSchoolId(), sendRecordBean.getFailContent(), sendRecordBean.getFailType(), sendRecordBean.getUserType(), 22);
  536 + sendRecordBean.getSchoolName(), imagePath, sendRecordBean.getSchoolId(), sendRecordBean.getFailContent(), sendRecordBean.getFailType(), sendRecordBean.getUserType(), EnumDeviceType.DH_FACE.deviceType);
452 537 }
453 538  
454 539  
... ...
cloud/dahua/src/main/java/com/example/dahua/bean/SendRecordBean.java
... ... @@ -7,27 +7,27 @@ import java.io.Serializable;
7 7 */
8 8 public class SendRecordBean implements Serializable {
9 9  
10   -
11   - private String customerid;//用户编号
12   -
  10 + //用户编号:学生student_id;老师teacher_id
  11 + private String customerid;
  12 + //卡号
13 13 private String Num;
14   -
  14 + //用户姓名
15 15 private String Name;
16   -
  16 + //学校ID
17 17 private int schoolId;
18   -
19   - private String schoolName;//下发结果
20   -
  18 + //学校名
  19 + private String schoolName;
  20 + //设备iD
21 21 private String deviceID;
22   -
23   - private String imgPath;//下发的图片路径
24   -
  22 + //下发的图片路径
  23 + private String imgPath;
  24 + //用户类型
25 25 private int userType;
26   -
  26 + //下发时间
27 27 private String time;
28   -
  28 + //下发失败原因
29 29 private String failContent;
30   -
  30 + //下发失败类型:详情见枚举:EnumSendFaceType
31 31 private int failType;
32 32  
33 33  
... ...
cloud/dahua/src/main/java/com/example/dahua/control/FileControl.java
... ... @@ -42,6 +42,16 @@ public class FileControl {
42 42 @Autowired
43 43 UserDao userDao;
44 44  
  45 + /**
  46 + * 单个人脸下发至设备
  47 + * @param file
  48 + * @param schoolId
  49 + * @param studentCode
  50 + * @param clint_type
  51 + * @param userType
  52 + * @param deviceId
  53 + * @return
  54 + */
45 55 @RequestMapping(method = RequestMethod.POST, value = "uploadImg")
46 56 public String uploadImg(@RequestParam("file") MultipartFile file, @RequestParam("schoolId") String schoolId,
47 57 @RequestParam("studentCode") String studentCode, @RequestParam("clint_type") String clint_type,
... ... @@ -67,6 +77,11 @@ public class FileControl {
67 77 return "0";
68 78 }
69 79  
  80 + /**
  81 + * 权限下发至设备
  82 + * @param permissionBean
  83 + * @return
  84 + */
70 85 @RequestMapping(value = "sendPermission", method = RequestMethod.POST)
71 86 @ApiOperation(value = "设置权限")
72 87 public boolean sendPermission(@RequestBody PermissionBean permissionBean) {
... ...
cloud/dahua/src/main/java/com/example/dahua/control/UserControl.java
... ... @@ -48,7 +48,14 @@ public class UserControl {
48 48 @Autowired
49 49 UserDao userDao;
50 50  
51   -
  51 + /**
  52 + * 单个人脸下发至设备
  53 + * @param file
  54 + * @param schoolId
  55 + * @param studentCode
  56 + * @param clint_type
  57 + * @return
  58 + */
52 59 @RequestMapping(value = "uploadImgAndUserInfo", method = RequestMethod.GET)
53 60 @ApiOperation(value = "上传用户信息")
54 61 public boolean uploadImgAndUserInfo(@RequestParam("file") String file, @RequestParam("schoolId") String schoolId, @RequestParam("studentCode") String studentCode, @RequestParam("clint_type") String clint_type,@RequestParam(value = "deviceId",required = false) String deviceId) {
... ... @@ -56,6 +63,11 @@ public class UserControl {
56 63 return HttpUtils.uploadImgs(new File(file), schoolId, studentCode, clint_type, file.contains("Teacher") ? 1 : 2,deviceId);
57 64 }
58 65  
  66 + /**
  67 + * 权限下发至设备
  68 + * @param permissionBean
  69 + * @return
  70 + */
59 71 @RequestMapping(value = "sendPermission", method = RequestMethod.POST)
60 72 @ApiOperation(value = "设置权限")
61 73 public boolean sendPermission(@RequestBody PermissionBean permissionBean) {
... ... @@ -69,6 +81,12 @@ public class UserControl {
69 81 return true;
70 82 }
71 83  
  84 + /**
  85 + * 批量下发人脸
  86 + * @param deviceIds
  87 + * @param schoolId
  88 + * @param userType
  89 + */
72 90 @RequestMapping(value = "sendFaces", method = RequestMethod.GET)
73 91 @ApiOperation(value = "下发学校下所有人脸给指定设备", notes = "下发所有人脸给指定设备")
74 92 public void sendFaces(@RequestParam("deviceIds") String deviceIds, @RequestParam("schoolId") String schoolId, @RequestParam("userType") String userType) {
... ...
cloud/dahua/src/main/java/com/example/dahua/dao/SearchDao.java
... ... @@ -1,55 +0,0 @@
1   -package com.example.dahua.dao;
2   -
3   -import com.example.dahua.bean.CheckIn;
4   -import com.example.dahua.bean.Message;
5   -import com.example.dahua.bean.User;
6   -import org.apache.ibatis.annotations.Param;
7   -import org.apache.ibatis.annotations.Select;
8   -import org.springframework.stereotype.Repository;
9   -
10   -import java.util.List;
11   -
12   -@Repository
13   -public interface SearchDao {
14   - /**
15   - * 考勤推送存储过程
16   - * @param checkIn
17   - * @return
18   - */
19   - int checkIn(CheckIn checkIn);
20   -
21   - /**
22   - * 获取学生信息
23   - * @param cardNum
24   - * @return
25   - */
26   - List<User> selectUserByCardNum(String cardNum);
27   -
28   - /**
29   - * 获取卡号
30   - * @param cardNo
31   - * @return
32   - */
33   - @Select("select Top(1) StudentNum from HS_LeaveExaminePassList where StudentNum= #{cardNo} and GETDATE() <![CDATA[ > ]]> LeaveTime and GETDATE() <![CDATA[ < ]]> ReturnTime")
34   - String checkLeave(@Param("cardNo") String cardNo);
35   -
36   - /**
37   - * 获取学生父母电话
38   - * @param cardNo
39   - * @return
40   - */
41   - @Select("select school_id , ParentMobile , name from SZ_V_School_Student where student_num = #{cardNo}")
42   - Message selectByParentMobile(@Param("cardNo") String cardNo);
43   -
44   - /**
45   - * 插入短信发送表
46   - * @param tableName
47   - * @param schoolId
48   - * @param mobile
49   - * @param msg
50   - */
51   - @Select("insert into ${tableName} (SchoolID,Mobile,Msg,tdtype,Status,IsNeedSend,SendTime,intime) values (#{schoolId},#{mobile},#{msg},1,0,1,GETDATE(),GETDATE())")
52   - void insertMessage(@Param("tableName") String tableName,@Param("schoolId") String schoolId,@Param("mobile") String mobile,@Param("msg") String msg);
53   -
54   -
55   -}
cloud/dahua/src/main/java/com/example/dahua/dao/UserDao.java
... ... @@ -169,4 +169,47 @@ public interface UserDao {
169 169 " where studentcode = #{studentcode} and school_id = #{school_id}\n" +
170 170 ")")
171 171 void updateStu(@Param("studentcode") String studentCode,@Param("httpUrl") String httpUrl,@Param("school_id")String school_id);
  172 +
  173 + /**
  174 + * 获取学生信息
  175 + * @param cardNum
  176 + * @return
  177 + */
  178 + @Select(" select school_id , class_id ,name ,student_id from\n" +
  179 + " (select top 1 b.school_id, b.class_id, b.name, student_id from SZ_V_Card a\n" +
  180 + " inner join SZ_V_School_Student b on a.user_id = b.student_id\n" +
  181 + " and b.role_state = 1 where a.type = 2 and a.num = #{cardNum}\n" +
  182 + " union\n" +
  183 + " select top 1 b.school_id, 0 as class_id, b.name,b.teacher_id as student_id from SZ_V_Card a\n" +
  184 + " inner join SZ_V_School_Teacher b on a.user_id = b.teacher_id\n" +
  185 + " and b.role_state = 1 where a.type = 0 and a.num = #{cardNum}\n" +
  186 + " ) x ")
  187 + List<User> selectUserByCardNum(@Param("studentcode") String cardNum);
  188 +
  189 + /**
  190 + * 获取卡号
  191 + * @param cardNo
  192 + * @return
  193 + */
  194 + @Select("select Top(1) StudentNum from HS_LeaveExaminePassList where StudentNum= #{cardNo} and GETDATE() <![CDATA[ > ]]> LeaveTime and GETDATE() <![CDATA[ < ]]> ReturnTime")
  195 + String checkLeave(@Param("cardNo") String cardNo);
  196 +
  197 + /**
  198 + * 获取学生父母电话
  199 + * @param cardNo
  200 + * @return
  201 + */
  202 + @Select("select school_id , ParentMobile , name from SZ_V_School_Student where student_num = #{cardNo}")
  203 + Message selectByParentMobile(@Param("cardNo") String cardNo);
  204 +
  205 + /**
  206 + * 插入短信发送表
  207 + * @param tableName
  208 + * @param schoolId
  209 + * @param mobile
  210 + * @param msg
  211 + */
  212 + @Insert("insert into ${tableName} (SchoolID,Mobile,Msg,tdtype,Status,IsNeedSend,SendTime,intime) values (#{schoolId},#{mobile},#{msg},1,0,1,GETDATE(),GETDATE())")
  213 + void insertMessage(@Param("tableName") String tableName, @Param("schoolId") String schoolId, @Param("mobile") String mobile, @Param("msg") String msg);
  214 +
172 215 }
... ...
cloud/dahua/src/main/java/com/example/dahua/dbconfig/MessageDataSourceConfig.java
... ... @@ -10,7 +10,6 @@ import org.springframework.context.annotation.Bean;
10 10 import org.springframework.context.annotation.Configuration;
11 11 import org.springframework.context.annotation.Primary;
12 12 import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
13   -import org.springframework.jdbc.core.JdbcTemplate;
14 13  
15 14 import javax.sql.DataSource;
16 15  
... ...
cloud/dahua/src/main/java/com/example/dahua/enums/EnumDeviceType.java 0 → 100644
... ... @@ -0,0 +1,36 @@
  1 +package com.example.dahua.enums;
  2 +
  3 +/**
  4 + * 设备类型枚举
  5 + *
  6 + * @author xuquan
  7 + * @date 2020/11/11 16:06
  8 + */
  9 +
  10 +public enum EnumDeviceType {
  11 +
  12 + SCHOOL_CARD(1, "校牌"),
  13 + CLASS_CARD(2, "班牌"),
  14 + CLOUD_WINDOW(4, "云视窗"),
  15 + ZJ_CONTROL(6, "闸机控制器"),
  16 + LOAN_PERIOD(7, "话机"),
  17 + HK_FACE(18, "海康人脸设备"),
  18 + FACE(19, "人脸设备"),
  19 + DH_FACE(22, "大华人脸设备"),
  20 + HK_ZW(23, "海康指纹机"),
  21 + ZK_ZW(24, "中控指纹机"),
  22 + BG_FACE_WG(25, "博观人脸带温感"),
  23 + BG_FACE_CG(26, "博观人脸常规"),
  24 + LQ_QS(27, "乐清寝室看板"),
  25 + HK_FACE_YTJ(28, "海康人脸权限一体机"),
  26 + DH_FACE_YTJ(29, "大华人脸权限一体机");
  27 +
  28 + public final int deviceType;
  29 + public final String deviceName;
  30 +
  31 + EnumDeviceType(int deviceType, String deviceName) {
  32 + this.deviceType = deviceType;
  33 + this.deviceName = deviceName;
  34 + }
  35 +
  36 +}
... ...
cloud/dahua/src/main/java/com/example/dahua/enums/EnumSendCardErrorType.java 0 → 100644
... ... @@ -0,0 +1,51 @@
  1 +package com.example.dahua.enums;
  2 +
  3 +import org.apache.commons.lang.StringUtils;
  4 +
  5 +/**
  6 + *下发卡常见异常码、异常描述枚举
  7 + * @author xuquan
  8 + * @date 2020/11/11 15:19
  9 + */
  10 +
  11 +public enum EnumSendCardErrorType {
  12 +
  13 + CHECK_DATA_ERR_21("21", "对返回数据的校验出错"),
  14 + EXIST_USER_146("146", "用户已存在"),
  15 + NOT_ONLINE_USER_147("147", "用户不存在"),
  16 + UNKNOWN_1091("1091" , "未知错误"),
  17 + UNKNOWN_1147("1147" , "未知错误"),
  18 + UNKNOWN_1162("1162", "未知错误");
  19 +
  20 + public final String code;
  21 + public final String message;
  22 +
  23 + public String getCode() {
  24 + return code;
  25 + }
  26 +
  27 + public String getMessage() {
  28 + return message;
  29 + }
  30 +
  31 + EnumSendCardErrorType(String code, String message) {
  32 + this.code = code;
  33 + this.message = message;
  34 + }
  35 +
  36 + /**
  37 + * 根据key获得具体的值
  38 + */
  39 + public static EnumSendCardErrorType getByCode(String code){
  40 + if(StringUtils.isBlank(code)){
  41 + return null;
  42 + }
  43 + for(EnumSendCardErrorType enums: EnumSendCardErrorType.values()){
  44 + if(enums.getCode().equals(code)){
  45 + return enums;
  46 + }
  47 + }
  48 + return null;
  49 + }
  50 +
  51 +}
... ...
cloud/dahua/src/main/java/com/example/dahua/enums/EnumSendFaceErrorType.java 0 → 100644
... ... @@ -0,0 +1,49 @@
  1 +package com.example.dahua.enums;
  2 +
  3 +import org.apache.commons.lang.StringUtils;
  4 +
  5 +/**
  6 + * 下发人脸常见异常码、异常描述枚举
  7 + * @author xuquan
  8 + * @date 2020/11/11 15:23
  9 + */
  10 +public enum EnumSendFaceErrorType {
  11 +
  12 + EXCEED_SIZE_1028("1028", "图片大小超限"),
  13 + NOT_EXIST_USER_1029("1029", "用户ID不存在"),
  14 + EXTRACT_ERROR_1030("1030", "照片特征值提取失败"),
  15 + EXIST_IMG_1031("1031", "照片已存在"),
  16 + UPPER_LIMIT_1032("1032", "照片数量超过上限");
  17 +
  18 + public final String code;
  19 + public final String message;
  20 +
  21 + public String getCode() {
  22 + return code;
  23 + }
  24 +
  25 + public String getMessage() {
  26 + return message;
  27 + }
  28 +
  29 + EnumSendFaceErrorType(String code, String message) {
  30 + this.code = code;
  31 + this.message = message;
  32 + }
  33 +
  34 + /**
  35 + * 根据key获得具体的值
  36 + */
  37 + public static EnumSendFaceErrorType getByCode(String code){
  38 + if(StringUtils.isBlank(code)){
  39 + return null;
  40 + }
  41 + for(EnumSendFaceErrorType enums: EnumSendFaceErrorType.values()){
  42 + if(enums.getCode().equals(code)){
  43 + return enums;
  44 + }
  45 + }
  46 + return null;
  47 + }
  48 +
  49 +}
... ...
cloud/dahua/src/main/java/com/example/dahua/enums/EnumSendFaceType.java 0 → 100644
... ... @@ -0,0 +1,25 @@
  1 +package com.example.dahua.enums;
  2 +
  3 +/**
  4 + * 下发人脸枚举配置中心
  5 + *
  6 + * @Author: xuquan
  7 + * @Date: 2020/11/1 14:59
  8 + */
  9 +public enum EnumSendFaceType {
  10 +
  11 + NOT_EXIST_DEVICE(1, "设备不存在"),
  12 + NOT_ONLINE_DEVICE(2, "设备不在线"),
  13 + FACE_AND_CARD_FAIL(3, "人脸信息、卡信息下发失败"),
  14 + FACE_FAIL_CARD_SUCCESS(4, "人脸信息下发失败,卡信息下发成功"),
  15 + FACE_SUCCESS_CARD_FAIl(5, "人脸信息下发成功,卡信息下发失败");
  16 +
  17 + public final int code;
  18 + public final String message;
  19 +
  20 + EnumSendFaceType(int code, String message) {
  21 + this.code = code;
  22 + this.message = message;
  23 + }
  24 +
  25 +}
... ...
cloud/dahua/src/main/java/com/example/dahua/enums/EnumSzBusinessType.java 0 → 100644
... ... @@ -0,0 +1,49 @@
  1 +package com.example.dahua.enums;
  2 +
  3 +/**
  4 + * 顺治科技智能校卫业务枚举配置中心
  5 + *
  6 + * @author xuquan
  7 + * @date 2020/11/11 14:43
  8 + */
  9 +
  10 +public interface EnumSzBusinessType {
  11 +
  12 + /**
  13 + * 用户类型
  14 + */
  15 + public enum EnumUserType {
  16 +
  17 + TEACHER(1, "teacher","老师"),
  18 + STUDENT(2, "student","学生");
  19 +// PARENT(3, "parent","家长");
  20 +
  21 + public final int code;
  22 + public final String enName;
  23 + public final String cnName;
  24 +
  25 + EnumUserType(int code, String enName,String cnName) {
  26 + this.code = code;
  27 + this.enName = enName;
  28 + this.cnName = cnName;
  29 + }
  30 + }
  31 +
  32 +// public enum EnumCardType {
  33 +//
  34 +// STUDENT(1, "student","学生"),
  35 +// TEACHER(2, "teacher","老师");
  36 +//// PARENT(3, "parent","家长");
  37 +//
  38 +// public final int code;
  39 +// public final String enName;
  40 +// public final String cnName;
  41 +//
  42 +// EnumUserType(int code, String enName,String cnName) {
  43 +// this.code = code;
  44 +// this.enName = enName;
  45 +// this.cnName = cnName;
  46 +// }
  47 +// }
  48 +
  49 +}
... ...
cloud/dahua/src/main/java/com/example/dahua/module/GateModule.java
1 1 package com.example.dahua.module;
2 2  
3   -import java.awt.image.BufferedImage;
4   -import java.io.ByteArrayInputStream;
5   -import java.io.File;
6   -import java.io.IOException;
7   -import java.io.UnsupportedEncodingException;
8   -import java.util.ArrayList;
9   -import java.util.HashMap;
10   -import java.util.List;
11   -import java.util.Map;
12   -
13 3 import com.example.dahua.bean.PermissionBean;
14 4 import com.example.dahua.bean.WeekDay;
15 5 import com.example.dahua.bean.WeekTime;
  6 +import com.example.dahua.enums.EnumSendCardErrorType;
  7 +import com.example.dahua.enums.EnumSendFaceErrorType;
16 8 import com.example.dahua.lib.NetSDKLib;
17 9 import com.example.dahua.lib.NetSDKLib.*;
18 10 import com.example.dahua.lib.ToolKits;
... ... @@ -21,6 +13,15 @@ import com.sun.jna.ptr.IntByReference;
21 13 import lombok.extern.slf4j.Slf4j;
22 14  
23 15 import javax.imageio.ImageIO;
  16 +import java.awt.image.BufferedImage;
  17 +import java.io.ByteArrayInputStream;
  18 +import java.io.File;
  19 +import java.io.IOException;
  20 +import java.io.UnsupportedEncodingException;
  21 +import java.util.ArrayList;
  22 +import java.util.HashMap;
  23 +import java.util.List;
  24 +import java.util.Map;
24 25  
25 26  
26 27 @Slf4j
... ... @@ -201,7 +202,8 @@ public class GateModule {
201 202  
202 203 public static synchronized int insertCard(String cardNo, String userId, String cardName, String cardPwd,
203 204 int cardStatus, int cardType, int useTimes, int isFirstEnter,
204   - int isValid, String startValidTime, String endValidTime, LLong lLong,String userType) {
  205 + int isValid, String startValidTime, String endValidTime, LLong lLong,
  206 + String userType,String cardErrNum) {
205 207 /**
206 208 * 门禁卡记录集信息
207 209 */
... ... @@ -287,16 +289,18 @@ public class GateModule {
287 289 String ret=ToolKits.getErrorCodePrint();
288 290 String number = ret.substring(ret.indexOf("|") + 1, ret.indexOf(")"));
289 291 log.info("添加卡信息失败,错误信息:{} ,错误码:{} ",ret,number);
290   - //146用户已存在,21对返回数据的校验出错,1162未知错误 number.equals("1162")||
291   - if(number.equals("21")||number.equals("146")) {
  292 + cardErrNum = number;
  293 + //146用户已存在,21对返回数据的校验出错,1162未知错误
  294 + if(number.equals(EnumSendCardErrorType.CHECK_DATA_ERR_21.code)|| number.equals(EnumSendCardErrorType.EXIST_USER_146.code)||
  295 + number.equals(EnumSendCardErrorType.UNKNOWN_1162.code)) {
292 296 //用户已存在/返回数据校验出错时,执行删除用户
293 297 deleteUser( userId, lLong);
294 298 //重新下发卡至设备
295   - return insertCard( cardNo, userId, cardName, cardPwd,
296   - cardStatus, cardType, useTimes, isFirstEnter,
297   - isValid, startValidTime, endValidTime, lLong, userType);
  299 + cardErrNum = "";
  300 + return insertCard(cardNo, userId, cardName, cardPwd, cardStatus, cardType, useTimes, isFirstEnter,
  301 + isValid, startValidTime, endValidTime, lLong, userType,cardErrNum);
298 302 }
299   - //其他错误码,返回-1
  303 + //新增卡失败,错误码,返回-1
300 304 return -1;
301 305 } else {
302 306 log.info("添加卡信息成功,卡信息记录集编号 : "+ insert.stuCtrlRecordSetResult.nRecNo);
... ... @@ -682,7 +686,8 @@ public class GateModule {
682 686 */
683 687 public static boolean modifyCard(int recordNo, String cardNo, String userId, String cardName, String cardPwd,
684 688 int cardStatus, int cardType, int useTimes, int isFirstEnter,
685   - int isValid, String startValidTime, String endValidTime, LLong lLong,String userType) {
  689 + int isValid, String startValidTime, String endValidTime, LLong lLong,
  690 + String userType,String cardErrNum) {
686 691 /**
687 692 * 门禁卡记录集信息
688 693 */
... ... @@ -770,15 +775,9 @@ public class GateModule {
770 775 String ret=ToolKits.getErrorCodePrint();
771 776 //结果码
772 777 String number = ret.substring(ret.indexOf("|") + 1, ret.indexOf(")"));
773   - //147用户不存在,21对返回数据的校验出错
774   -// if(number.equals("21")||number.equals("147")) {
775   -//
776   -// }
777   -// if(number.equals("1091")||number.equals("1147"))//未知错误
778   -// {
779   -// return Integer.parseInt(number);
780   -// }
  778 + cardErrNum = number;
781 779 log.error("修改卡信息失败,错误信息:{} ,错误码:{} ",ret,number);
  780 +
782 781 return false;
783 782 }
784 783 log.info("修改卡信息成功!");
... ... @@ -1081,7 +1080,7 @@ public class GateModule {
1081 1080 log.info("[" + i + "]删除用户结果:" + failCodes[i].nFailCode);
1082 1081 }
1083 1082 } else {
1084   - log.error("添加卡信息失败"+ ToolKits.getErrorCodePrint());
  1083 + log.error("删除用户失败"+ ToolKits.getErrorCodePrint());
1085 1084 }
1086 1085  
1087 1086 stIn.read();
... ... @@ -1138,7 +1137,7 @@ public class GateModule {
1138 1137 return true;
1139 1138 }
1140 1139  
1141   - public static synchronized boolean addFaceInfo(String userId, Memory memory, LLong lLong) {
  1140 + public static synchronized boolean addFaceInfo(String userId, Memory memory, LLong lLong,String faceErrNum) {
1142 1141 int emType = EM_FACEINFO_OPREATE_TYPE.EM_FACEINFO_OPREATE_ADD; // 添加
1143 1142  
1144 1143 /**
... ... @@ -1173,14 +1172,17 @@ public class GateModule {
1173 1172 } else {
1174 1173 String ret=ToolKits.getErrorCodePrint();
1175 1174 String number = ret.substring(ret.indexOf("|") + 1, ret.indexOf(")"));
1176   - log.error("修改卡信息失败,错误信息:{} ,错误码:{} ",ret,number);
1177   - //number = 1031:照片已存在;number = 1029 :用户ID不存在
1178   - if(number.equals("1031")){
1179   - return modifyFaceInfo( userId, memory, lLong);
  1175 + faceErrNum = number;
  1176 + log.error("添加信息失败,错误信息:{} ,错误码:{} ",ret,number);
  1177 + //照片已存在
  1178 + if(number.equals(EnumSendFaceErrorType.EXIST_IMG_1031.code)){
  1179 + faceErrNum = "";
  1180 + return modifyFaceInfo(userId, memory, lLong,faceErrNum);
1180 1181 }
1181   - if(number.equals("1029"))
1182   - {
1183   - return addFaceInfo( userId, memory, lLong);
  1182 + //用户Id不存在
  1183 + if(number.equals(EnumSendFaceErrorType.NOT_EXIST_USER_1029.code)) {
  1184 + faceErrNum = "";
  1185 + return addFaceInfo( userId, memory, lLong,faceErrNum);
1184 1186 }
1185 1187 return false;
1186 1188 }
... ... @@ -1238,7 +1240,7 @@ public class GateModule {
1238 1240 }
1239 1241  
1240 1242  
1241   - public static boolean modifyFaceInfo(String userId, Memory memory, LLong lLong) {
  1243 + public static boolean modifyFaceInfo(String userId, Memory memory, LLong lLong,String faceErrNum) {
1242 1244 int emType = EM_FACEINFO_OPREATE_TYPE.EM_FACEINFO_OPREATE_UPDATE; // 修改
1243 1245  
1244 1246 /**
... ... @@ -1274,6 +1276,7 @@ public class GateModule {
1274 1276 } else {
1275 1277 String ret=ToolKits.getErrorCodePrint();
1276 1278 String number = ret.substring(ret.indexOf("|") + 1, ret.indexOf(")"));
  1279 + faceErrNum = number;
1277 1280 log.error("修改人脸失败,错误信息:{} ,错误码:{} ",ret,number);
1278 1281 return false;
1279 1282 }
... ...
cloud/dahua/src/main/java/com/example/dahua/service/imp/UserServiceImp.java
... ... @@ -4,9 +4,11 @@ import com.example.dahua.MyTask;
4 4 import com.example.dahua.async.SendUserInfoTask;
5 5 import com.example.dahua.bean.*;
6 6 import com.example.dahua.dao.UserDao;
  7 +import com.example.dahua.enums.EnumDeviceType;
7 8 import com.example.dahua.lib.NetSDKLib;
8 9 import com.example.dahua.module.GateModule;
9 10 import com.example.dahua.service.UserService;
  11 +import lombok.extern.slf4j.Slf4j;
10 12 import org.apache.commons.lang.StringUtils;
11 13 import org.springframework.beans.factory.annotation.Autowired;
12 14 import org.springframework.stereotype.Repository;
... ... @@ -16,6 +18,7 @@ import java.util.List;
16 18  
17 19 @Repository
18 20 @Service
  21 +@Slf4j
19 22 public class UserServiceImp implements UserService {
20 23  
21 24 @Autowired
... ... @@ -26,13 +29,16 @@ public class UserServiceImp implements UserService {
26 29  
27 30 @Override
28 31 public List<AttendanceBean> getAttendanceBeans(String schoolId, String clint_type, String devid) {
29   -
30   - if (!StringUtils.isEmpty(devid)) return userDao.getAttendanceBeanWithId(schoolId, clint_type, devid);
  32 + //如果设备ID未传,则返回该学校下所有设备,反之,查询对应设备
  33 + if (!StringUtils.isEmpty(devid)) {
  34 + return userDao.getAttendanceBeanWithId(schoolId, clint_type, devid);
  35 + }
31 36  
32 37 List<AttendanceBean> attendanceBeanList = userDao.getAttendanceBeans(schoolId, clint_type);
33   -
34   - if (attendanceBeanList.size()==0)attendanceBeanList = userDao.getAttendanceBeans(schoolId,"29");
35   -
  38 + if (attendanceBeanList.size()==0){
  39 + //若未查询到结果,则查询大华人脸一体机 29
  40 + attendanceBeanList = userDao.getAttendanceBeans(schoolId,String.valueOf(EnumDeviceType.DH_FACE_YTJ.deviceType));
  41 + }
36 42 return attendanceBeanList;
37 43 }
38 44  
... ... @@ -52,10 +58,11 @@ public class UserServiceImp implements UserService {
52 58 */
53 59 @Override
54 60 public boolean uploadImgAndUserInfo(String file, String schoolId, String studentCode, String clint_type, int userType, String devid) {
55   - List<AttendanceBean> attendanceBeans = getAttendanceBeans(schoolId, clint_type, devid);//获取学校下的大华设备
56   -
57   - System.out.println("设备数量:" + attendanceBeans.size());
58   -
  61 + //获取学校下的大华设备
  62 + List<AttendanceBean> attendanceBeans = getAttendanceBeans(schoolId, clint_type, devid);
  63 + if(attendanceBeans.size()<1){
  64 + log.warn("下发用户人脸信息失败,学校ID: {},该学校下无设备!设备类型:{}",schoolId,clint_type);
  65 + }
59 66 UserInfoBean userInfoBean = null;
60 67 try {
61 68 if (userType == 2) {
... ... @@ -87,7 +94,7 @@ public class UserServiceImp implements UserService {
87 94 userInfoBean.setStudent_id(teacher.getTeacher_id());
88 95 }
89 96 }
90   -
  97 + //下发任务
91 98 myTask.doTaskOne(file, attendanceBeans, userInfoBean, schoolId, -1, userType);
92 99 } catch (Exception e) {
93 100 e.printStackTrace();
... ... @@ -107,14 +114,20 @@ public class UserServiceImp implements UserService {
107 114 myTask.doTaskSendUserInfos(schoolId, clint_type, type, -1);
108 115 }
109 116  
  117 + /**
  118 + * 下发权限至设备
  119 + * @param permissionBean
  120 + * @return
  121 + */
110 122 @Override
111 123 public boolean sendPermission(PermissionBean permissionBean) {
112   -
  124 + //下发权限对应设备集合
113 125 List<String> deviceIds = permissionBean.getDeviceIds();
114 126 if (null != deviceIds)
115   - for (String deviceId :
116   - deviceIds) {
  127 + for (String deviceId : deviceIds) {
  128 + // 句柄
117 129 NetSDKLib.LLong loginHandleLong = MyTask.lLongMap.get(deviceId);
  130 + //下发权限
118 131 GateModule.setAccessTimeSchedule(loginHandleLong, permissionBean);
119 132 GateModule.getAccessTimeSchedule1(loginHandleLong);
120 133 }
... ...
cloud/dahua/src/main/java/com/example/dahua/utils/HttpUtils.java
... ... @@ -22,6 +22,17 @@ import java.util.Map;
22 22  
23 23 public class HttpUtils {
24 24  
  25 + /**
  26 + * 单个人脸下发至设备
  27 + * 文件先由文件服务上传至100服务上,在21服务进行下发动作
  28 + * @param file
  29 + * @param schoolId
  30 + * @param studentCode
  31 + * @param clint_type
  32 + * @param userType
  33 + * @param deviceId
  34 + * @return
  35 + */
25 36 public static boolean uploadImgs(File file, String schoolId, String studentCode, String clint_type, int userType,String deviceId) {
26 37  
27 38 if (!file.exists()) {
... ... @@ -88,7 +99,11 @@ public class HttpUtils {
88 99 return result.getBody();
89 100 }
90 101  
91   -
  102 + /**
  103 + * 权限下发至设备
  104 + * @param permissionBean
  105 + * @return
  106 + */
92 107 public static boolean sendPermission(PermissionBean permissionBean) {
93 108 String url = "http://121.40.109.21:8991/file/sendPermission";
94 109 RestTemplate restTemplate = new RestTemplate();
... ... @@ -107,6 +122,10 @@ public class HttpUtils {
107 122 return responseEntity.getBody().equals("1");
108 123 }
109 124  
  125 + /**
  126 + * 权限下发至海康设备
  127 + * @param permissionFaceBean
  128 + */
110 129 public static void sendPermission2HK(PermissionFaceBean permissionFaceBean) {
111 130 String url = "http://114.55.30.100:8089/facereco/sendPermiss";
112 131 PermissionBean permissionBean = permissionFaceBean.getPermissionBean();
... ...
cloud/dahua/src/main/java/com/example/dahua/xiananDao/SearchMapper.java 0 → 100644
... ... @@ -0,0 +1,13 @@
  1 +package com.example.dahua.xiananDao;
  2 +
  3 +import com.example.dahua.bean.CheckIn;
  4 +
  5 +public interface SearchMapper {
  6 + /**
  7 + * 考勤推送存储过程
  8 + * @param checkIn
  9 + * @return
  10 + */
  11 + void checkIn(CheckIn checkIn);
  12 +
  13 +}
... ...
cloud/dahua/src/main/resources/application.yml
... ... @@ -46,6 +46,8 @@ mybatis:
46 46 mapper-locations: classpath:xiaoanmapper/*.xml
47 47 config-location: classpath:mybatis-config.xml
48 48  
  49 +#logging:
  50 +# config: classpath:logback-spring.xml
49 51  
50 52 #haikangpic: E:\wwwhtdocs\HFface\FaceLogs\
51 53  
... ...
cloud/dahua/src/main/resources/xiaoanmapper/SearchMapper.xml
1 1 <?xml version="1.0" encoding="UTF-8" ?>
2 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3   -<mapper namespace="com.example.dahua.dao.SearchDao" >
  3 +<mapper namespace="com.example.dahua.xiananDao.SearchMapper" >
4 4  
5 5  
6 6 <resultMap id="resultMap" type="com.example.dahua.bean.CheckIn">
7 7 <result column="arr" property="out" jdbcType="VARCHAR" />
8 8 <result column="iscuccess" property="isSuccess" jdbcType="INTEGER" />
9 9 </resultMap>
10   - <insert id="checkIn" parameterType="com.example.dahua.bean.CheckIn" statementType="CALLABLE" >
  10 +
  11 + <insert id="checkIn" parameterType="com.example.dahua.bean.CheckIn" statementType="CALLABLE">
11 12 {call AttendanceService(
12 13 #{deviceId,mode=IN} , #{cardNo,mode=IN} , #{funNo,mode=IN}, #{flag,mode=IN} , #{checkTime,mode=IN},
13 14 #{out,mode=OUT,jdbcType=VARCHAR,resultMap=resultMap},#{isSuccess,mode=OUT,jdbcType=INTEGER,resultMap=resultMap}
14 15 )}
15 16 </insert>
16 17  
17   - <resultMap id="User" type="com.example.dahua.bean.User" >
18   - <result column="school_id" property="schoolId" jdbcType="INTEGER" />
19   - <result column="class_id" property="classId" jdbcType="INTEGER" />
20   - <result column="name" property="name" jdbcType="VARCHAR" />
21   - <result column="student_id" property="studentId" jdbcType="INTEGER" />
22   - </resultMap>
23   - <select id="selectUserByCardNum" parameterType="java.lang.String" resultMap="User">
24   - select school_id , class_id ,name ,student_id from
25   - (select top 1 b.school_id, b.class_id, b.name, student_id from SZ_V_Card a
26   - inner join SZ_V_School_Student b on a.user_id = b.student_id
27   - and b.role_state = 1 where a.type = 2 and a.num = #{cardNum}
28   - union
29   - select top 1 b.school_id, 0 as class_id, b.name,b.teacher_id as student_id from SZ_V_Card a
30   - inner join SZ_V_School_Teacher b on a.user_id = b.teacher_id
31   - and b.role_state = 1 where a.type = 0 and a.num = #{cardNum}
32   - ) x
33   - </select>
34   -
35 18 </mapper>
36 19 \ No newline at end of file
... ...
cloud/dahua/src/test/java/com/example/dahua/Tester.java 0 → 100644
... ... @@ -0,0 +1,16 @@
  1 +package com.example.dahua;
  2 +
  3 +
  4 +import org.junit.runner.RunWith;
  5 +import org.springframework.boot.test.context.SpringBootTest;
  6 +import org.springframework.test.context.junit4.SpringRunner;
  7 +
  8 +/**
  9 + * 单元测试继承该类即可
  10 + */
  11 +@RunWith(SpringRunner.class)
  12 +@SpringBootTest
  13 +public abstract class Tester {}
  14 +
  15 +
  16 +
... ...
cloud/dahua/src/test/java/com/example/dahua/mapper/SearchMapperTest.java 0 → 100644
... ... @@ -0,0 +1,64 @@
  1 +package com.example.dahua.mapper;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.example.dahua.Tester;
  5 +import com.example.dahua.bean.CheckIn;
  6 +import com.example.dahua.bean.ShortMsg;
  7 +import com.example.dahua.dao.UserDao;
  8 +import com.example.dahua.utils.DateUtils;
  9 +import com.example.dahua.xiananDao.SearchMapper;
  10 +import org.junit.Test;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +
  13 +import java.util.Date;
  14 +
  15 +/**
  16 + * TODO
  17 + *
  18 + * @author xuquan
  19 + * @date 2020/11/11 12:13
  20 + */
  21 +
  22 +public class SearchMapperTest extends Tester {
  23 +
  24 + @Autowired
  25 + private SearchMapper searchMapper;
  26 +
  27 + @Autowired
  28 + private UserDao userDao;
  29 +
  30 + @Test
  31 + public void test(){
  32 + //有效刷卡调考勤存储过程
  33 + CheckIn checkIn = new CheckIn();
  34 + checkIn.setDeviceId("1212");
  35 + checkIn.setCardNo("24234");
  36 + checkIn.setFunNo(8);
  37 + checkIn.setFlag(1);
  38 + checkIn.setCheckTime("2020-11-11 12:19:12");
  39 + searchMapper.checkIn(checkIn);
  40 + System.out.println(JSON.toJSON(checkIn));
  41 + }
  42 +
  43 + @Test
  44 + public void test2(){
  45 + userDao.checkLeave("234232");
  46 + System.out.println(JSON.toJSON(userDao.checkLeave("234232")));
  47 + userDao.selectByParentMobile("234232");
  48 + System.out.println(JSON.toJSON(userDao.selectByParentMobile("234232")));
  49 +// userDao.checkLeave("234232");
  50 +// System.out.println(JSON.toJSON(userDao.checkLeave("234232")));
  51 + }
  52 +
  53 + @Test
  54 + public void test3(){
  55 + ShortMsg shortMsg = new ShortMsg();
  56 + String tableSuffix = DateUtils.date2String(new Date(), DateUtils.format);
  57 + shortMsg.setTableName("smsNew" + tableSuffix);
  58 + shortMsg.setSchoolId(23);
  59 + shortMsg.setMobile("124124242");
  60 +// userDao.insertMessage();
  61 +// System.out.println(JSON.toJSON(userDao.checkLeave("234232")));
  62 +
  63 + }
  64 +}
... ...
cloud/mvnw
... ... @@ -1,286 +0,0 @@
1   -#!/bin/sh
2   -# ----------------------------------------------------------------------------
3   -# Licensed to the Apache Software Foundation (ASF) under one
4   -# or more contributor license agreements. See the NOTICE file
5   -# distributed with this work for additional information
6   -# regarding copyright ownership. The ASF licenses this file
7   -# to you under the Apache License, Version 2.0 (the
8   -# "License"); you may not use this file except in compliance
9   -# with the License. You may obtain a copy of the License at
10   -#
11   -# https://www.apache.org/licenses/LICENSE-2.0
12   -#
13   -# Unless required by applicable law or agreed to in writing,
14   -# software distributed under the License is distributed on an
15   -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   -# KIND, either express or implied. See the License for the
17   -# specific language governing permissions and limitations
18   -# under the License.
19   -# ----------------------------------------------------------------------------
20   -
21   -# ----------------------------------------------------------------------------
22   -# Maven2 Start Up Batch script
23   -#
24   -# Required ENV vars:
25   -# ------------------
26   -# JAVA_HOME - location of a JDK home dir
27   -#
28   -# Optional ENV vars
29   -# -----------------
30   -# M2_HOME - location of maven2's installed home dir
31   -# MAVEN_OPTS - parameters passed to the Java VM when running Maven
32   -# e.g. to debug Maven itself, use
33   -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
34   -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
35   -# ----------------------------------------------------------------------------
36   -
37   -if [ -z "$MAVEN_SKIP_RC" ] ; then
38   -
39   - if [ -f /etc/mavenrc ] ; then
40   - . /etc/mavenrc
41   - fi
42   -
43   - if [ -f "$HOME/.mavenrc" ] ; then
44   - . "$HOME/.mavenrc"
45   - fi
46   -
47   -fi
48   -
49   -# OS specific support. $var _must_ be set to either true or false.
50   -cygwin=false;
51   -darwin=false;
52   -mingw=false
53   -case "`uname`" in
54   - CYGWIN*) cygwin=true ;;
55   - MINGW*) mingw=true;;
56   - Darwin*) darwin=true
57   - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
58   - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
59   - if [ -z "$JAVA_HOME" ]; then
60   - if [ -x "/usr/libexec/java_home" ]; then
61   - export JAVA_HOME="`/usr/libexec/java_home`"
62   - else
63   - export JAVA_HOME="/Library/Java/Home"
64   - fi
65   - fi
66   - ;;
67   -esac
68   -
69   -if [ -z "$JAVA_HOME" ] ; then
70   - if [ -r /etc/gentoo-release ] ; then
71   - JAVA_HOME=`java-config --jre-home`
72   - fi
73   -fi
74   -
75   -if [ -z "$M2_HOME" ] ; then
76   - ## resolve links - $0 may be a link to maven's home
77   - PRG="$0"
78   -
79   - # need this for relative symlinks
80   - while [ -h "$PRG" ] ; do
81   - ls=`ls -ld "$PRG"`
82   - link=`expr "$ls" : '.*-> \(.*\)$'`
83   - if expr "$link" : '/.*' > /dev/null; then
84   - PRG="$link"
85   - else
86   - PRG="`dirname "$PRG"`/$link"
87   - fi
88   - done
89   -
90   - saveddir=`pwd`
91   -
92   - M2_HOME=`dirname "$PRG"`/..
93   -
94   - # make it fully qualified
95   - M2_HOME=`cd "$M2_HOME" && pwd`
96   -
97   - cd "$saveddir"
98   - # echo Using m2 at $M2_HOME
99   -fi
100   -
101   -# For Cygwin, ensure paths are in UNIX format before anything is touched
102   -if $cygwin ; then
103   - [ -n "$M2_HOME" ] &&
104   - M2_HOME=`cygpath --unix "$M2_HOME"`
105   - [ -n "$JAVA_HOME" ] &&
106   - JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
107   - [ -n "$CLASSPATH" ] &&
108   - CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
109   -fi
110   -
111   -# For Mingw, ensure paths are in UNIX format before anything is touched
112   -if $mingw ; then
113   - [ -n "$M2_HOME" ] &&
114   - M2_HOME="`(cd "$M2_HOME"; pwd)`"
115   - [ -n "$JAVA_HOME" ] &&
116   - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
117   - # TODO classpath?
118   -fi
119   -
120   -if [ -z "$JAVA_HOME" ]; then
121   - javaExecutable="`which javac`"
122   - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
123   - # readlink(1) is not available as standard on Solaris 10.
124   - readLink=`which readlink`
125   - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
126   - if $darwin ; then
127   - javaHome="`dirname \"$javaExecutable\"`"
128   - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
129   - else
130   - javaExecutable="`readlink -f \"$javaExecutable\"`"
131   - fi
132   - javaHome="`dirname \"$javaExecutable\"`"
133   - javaHome=`expr "$javaHome" : '\(.*\)/bin'`
134   - JAVA_HOME="$javaHome"
135   - export JAVA_HOME
136   - fi
137   - fi
138   -fi
139   -
140   -if [ -z "$JAVACMD" ] ; then
141   - if [ -n "$JAVA_HOME" ] ; then
142   - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
143   - # IBM's JDK on AIX uses strange locations for the executables
144   - JAVACMD="$JAVA_HOME/jre/sh/java"
145   - else
146   - JAVACMD="$JAVA_HOME/bin/java"
147   - fi
148   - else
149   - JAVACMD="`which java`"
150   - fi
151   -fi
152   -
153   -if [ ! -x "$JAVACMD" ] ; then
154   - echo "Error: JAVA_HOME is not defined correctly." >&2
155   - echo " We cannot execute $JAVACMD" >&2
156   - exit 1
157   -fi
158   -
159   -if [ -z "$JAVA_HOME" ] ; then
160   - echo "Warning: JAVA_HOME environment variable is not set."
161   -fi
162   -
163   -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
164   -
165   -# traverses directory structure from process work directory to filesystem root
166   -# first directory with .mvn subdirectory is considered project base directory
167   -find_maven_basedir() {
168   -
169   - if [ -z "$1" ]
170   - then
171   - echo "Path not specified to find_maven_basedir"
172   - return 1
173   - fi
174   -
175   - basedir="$1"
176   - wdir="$1"
177   - while [ "$wdir" != '/' ] ; do
178   - if [ -d "$wdir"/.mvn ] ; then
179   - basedir=$wdir
180   - break
181   - fi
182   - # workaround for JBEAP-8937 (on Solaris 10/Sparc)
183   - if [ -d "${wdir}" ]; then
184   - wdir=`cd "$wdir/.."; pwd`
185   - fi
186   - # end of workaround
187   - done
188   - echo "${basedir}"
189   -}
190   -
191   -# concatenates all lines of a file
192   -concat_lines() {
193   - if [ -f "$1" ]; then
194   - echo "$(tr -s '\n' ' ' < "$1")"
195   - fi
196   -}
197   -
198   -BASE_DIR=`find_maven_basedir "$(pwd)"`
199   -if [ -z "$BASE_DIR" ]; then
200   - exit 1;
201   -fi
202   -
203   -##########################################################################################
204   -# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
205   -# This allows using the maven wrapper in projects that prohibit checking in binary data.
206   -##########################################################################################
207   -if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
208   - if [ "$MVNW_VERBOSE" = true ]; then
209   - echo "Found .mvn/wrapper/maven-wrapper.jar"
210   - fi
211   -else
212   - if [ "$MVNW_VERBOSE" = true ]; then
213   - echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
214   - fi
215   - jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"
216   - while IFS="=" read key value; do
217   - case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
218   - esac
219   - done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
220   - if [ "$MVNW_VERBOSE" = true ]; then
221   - echo "Downloading from: $jarUrl"
222   - fi
223   - wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
224   -
225   - if command -v wget > /dev/null; then
226   - if [ "$MVNW_VERBOSE" = true ]; then
227   - echo "Found wget ... using wget"
228   - fi
229   - wget "$jarUrl" -O "$wrapperJarPath"
230   - elif command -v curl > /dev/null; then
231   - if [ "$MVNW_VERBOSE" = true ]; then
232   - echo "Found curl ... using curl"
233   - fi
234   - curl -o "$wrapperJarPath" "$jarUrl"
235   - else
236   - if [ "$MVNW_VERBOSE" = true ]; then
237   - echo "Falling back to using Java to download"
238   - fi
239   - javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
240   - if [ -e "$javaClass" ]; then
241   - if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
242   - if [ "$MVNW_VERBOSE" = true ]; then
243   - echo " - Compiling MavenWrapperDownloader.java ..."
244   - fi
245   - # Compiling the Java class
246   - ("$JAVA_HOME/bin/javac" "$javaClass")
247   - fi
248   - if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
249   - # Running the downloader
250   - if [ "$MVNW_VERBOSE" = true ]; then
251   - echo " - Running MavenWrapperDownloader.java ..."
252   - fi
253   - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
254   - fi
255   - fi
256   - fi
257   -fi
258   -##########################################################################################
259   -# End of extension
260   -##########################################################################################
261   -
262   -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
263   -if [ "$MVNW_VERBOSE" = true ]; then
264   - echo $MAVEN_PROJECTBASEDIR
265   -fi
266   -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
267   -
268   -# For Cygwin, switch paths to Windows format before running java
269   -if $cygwin; then
270   - [ -n "$M2_HOME" ] &&
271   - M2_HOME=`cygpath --path --windows "$M2_HOME"`
272   - [ -n "$JAVA_HOME" ] &&
273   - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
274   - [ -n "$CLASSPATH" ] &&
275   - CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
276   - [ -n "$MAVEN_PROJECTBASEDIR" ] &&
277   - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
278   -fi
279   -
280   -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
281   -
282   -exec "$JAVACMD" \
283   - $MAVEN_OPTS \
284   - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
285   - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
286   - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
cloud/mvnw.cmd
... ... @@ -1,161 +0,0 @@
1   -@REM ----------------------------------------------------------------------------
2   -@REM Licensed to the Apache Software Foundation (ASF) under one
3   -@REM or more contributor license agreements. See the NOTICE file
4   -@REM distributed with this work for additional information
5   -@REM regarding copyright ownership. The ASF licenses this file
6   -@REM to you under the Apache License, Version 2.0 (the
7   -@REM "License"); you may not use this file except in compliance
8   -@REM with the License. You may obtain a copy of the License at
9   -@REM
10   -@REM https://www.apache.org/licenses/LICENSE-2.0
11   -@REM
12   -@REM Unless required by applicable law or agreed to in writing,
13   -@REM software distributed under the License is distributed on an
14   -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   -@REM KIND, either express or implied. See the License for the
16   -@REM specific language governing permissions and limitations
17   -@REM under the License.
18   -@REM ----------------------------------------------------------------------------
19   -
20   -@REM ----------------------------------------------------------------------------
21   -@REM Maven2 Start Up Batch script
22   -@REM
23   -@REM Required ENV vars:
24   -@REM JAVA_HOME - location of a JDK home dir
25   -@REM
26   -@REM Optional ENV vars
27   -@REM M2_HOME - location of maven2's installed home dir
28   -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
29   -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
30   -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
31   -@REM e.g. to debug Maven itself, use
32   -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
33   -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
34   -@REM ----------------------------------------------------------------------------
35   -
36   -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
37   -@echo off
38   -@REM set title of command window
39   -title %0
40   -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
41   -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
42   -
43   -@REM set %HOME% to equivalent of $HOME
44   -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
45   -
46   -@REM Execute a user defined script before this one
47   -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
48   -@REM check for pre script, once with legacy .bat ending and once with .cmd ending
49   -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
50   -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
51   -:skipRcPre
52   -
53   -@setlocal
54   -
55   -set ERROR_CODE=0
56   -
57   -@REM To isolate internal variables from possible post scripts, we use another setlocal
58   -@setlocal
59   -
60   -@REM ==== START VALIDATION ====
61   -if not "%JAVA_HOME%" == "" goto OkJHome
62   -
63   -echo.
64   -echo Error: JAVA_HOME not found in your environment. >&2
65   -echo Please set the JAVA_HOME variable in your environment to match the >&2
66   -echo location of your Java installation. >&2
67   -echo.
68   -goto error
69   -
70   -:OkJHome
71   -if exist "%JAVA_HOME%\bin\java.exe" goto init
72   -
73   -echo.
74   -echo Error: JAVA_HOME is set to an invalid directory. >&2
75   -echo JAVA_HOME = "%JAVA_HOME%" >&2
76   -echo Please set the JAVA_HOME variable in your environment to match the >&2
77   -echo location of your Java installation. >&2
78   -echo.
79   -goto error
80   -
81   -@REM ==== END VALIDATION ====
82   -
83   -:init
84   -
85   -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
86   -@REM Fallback to current working directory if not found.
87   -
88   -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
89   -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
90   -
91   -set EXEC_DIR=%CD%
92   -set WDIR=%EXEC_DIR%
93   -:findBaseDir
94   -IF EXIST "%WDIR%"\.mvn goto baseDirFound
95   -cd ..
96   -IF "%WDIR%"=="%CD%" goto baseDirNotFound
97   -set WDIR=%CD%
98   -goto findBaseDir
99   -
100   -:baseDirFound
101   -set MAVEN_PROJECTBASEDIR=%WDIR%
102   -cd "%EXEC_DIR%"
103   -goto endDetectBaseDir
104   -
105   -:baseDirNotFound
106   -set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
107   -cd "%EXEC_DIR%"
108   -
109   -:endDetectBaseDir
110   -
111   -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
112   -
113   -@setlocal EnableExtensions EnableDelayedExpansion
114   -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
115   -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
116   -
117   -:endReadAdditionalConfig
118   -
119   -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
120   -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
121   -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
122   -
123   -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"
124   -FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO (
125   - IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
126   -)
127   -
128   -@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
129   -@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
130   -if exist %WRAPPER_JAR% (
131   - echo Found %WRAPPER_JAR%
132   -) else (
133   - echo Couldn't find %WRAPPER_JAR%, downloading it ...
134   - echo Downloading from: %DOWNLOAD_URL%
135   - powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"
136   - echo Finished downloading %WRAPPER_JAR%
137   -)
138   -@REM End of extension
139   -
140   -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
141   -if ERRORLEVEL 1 goto error
142   -goto end
143   -
144   -:error
145   -set ERROR_CODE=1
146   -
147   -:end
148   -@endlocal & set ERROR_CODE=%ERROR_CODE%
149   -
150   -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
151   -@REM check for post script, once with legacy .bat ending and once with .cmd ending
152   -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
153   -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
154   -:skipRcPost
155   -
156   -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
157   -if "%MAVEN_BATCH_PAUSE%" == "on" pause
158   -
159   -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
160   -
161   -exit /B %ERROR_CODE%