Commit a2a3d0700446fdb3c7066405f091185f0d906247
1 parent
3690b06b
Exists in
master
大华和海康增加权限下发接口
Showing
15 changed files
with
503 additions
and
7 deletions
Show diff stats
cloud/dahua/src/main/java/com/example/dahua/bean/PermissionBean.java
0 → 100644
| ... | ... | @@ -0,0 +1,27 @@ |
| 1 | +package com.example.dahua.bean; | |
| 2 | + | |
| 3 | +import java.io.Serializable; | |
| 4 | +import java.util.List; | |
| 5 | + | |
| 6 | +public class PermissionBean implements Serializable { | |
| 7 | + | |
| 8 | + private List<String> deviceIds; | |
| 9 | + | |
| 10 | + private List<WeekDay> weekDays; | |
| 11 | + | |
| 12 | + public List<String> getDeviceIds() { | |
| 13 | + return deviceIds; | |
| 14 | + } | |
| 15 | + | |
| 16 | + public void setDeviceIds(List<String> deviceIds) { | |
| 17 | + this.deviceIds = deviceIds; | |
| 18 | + } | |
| 19 | + | |
| 20 | + public List<WeekDay> getWeekDays() { | |
| 21 | + return weekDays; | |
| 22 | + } | |
| 23 | + | |
| 24 | + public void setWeekDays(List<WeekDay> weekDays) { | |
| 25 | + this.weekDays = weekDays; | |
| 26 | + } | |
| 27 | +} | ... | ... |
cloud/dahua/src/main/java/com/example/dahua/bean/WeekDay.java
0 → 100644
| ... | ... | @@ -0,0 +1,27 @@ |
| 1 | +package com.example.dahua.bean; | |
| 2 | + | |
| 3 | +import java.io.Serializable; | |
| 4 | +import java.util.List; | |
| 5 | + | |
| 6 | +public class WeekDay implements Serializable { | |
| 7 | + | |
| 8 | + private int weekDay; | |
| 9 | + | |
| 10 | + private List<WeekTime> weekTimes; | |
| 11 | + | |
| 12 | + public int getWeekDay() { | |
| 13 | + return weekDay; | |
| 14 | + } | |
| 15 | + | |
| 16 | + public void setWeekDay(int weekDay) { | |
| 17 | + this.weekDay = weekDay; | |
| 18 | + } | |
| 19 | + | |
| 20 | + public List<WeekTime> getWeekTimes() { | |
| 21 | + return weekTimes; | |
| 22 | + } | |
| 23 | + | |
| 24 | + public void setWeekTimes(List<WeekTime> weekTimes) { | |
| 25 | + this.weekTimes = weekTimes; | |
| 26 | + } | |
| 27 | +} | ... | ... |
cloud/dahua/src/main/java/com/example/dahua/bean/WeekTime.java
0 → 100644
| ... | ... | @@ -0,0 +1,26 @@ |
| 1 | +package com.example.dahua.bean; | |
| 2 | + | |
| 3 | +import java.io.Serializable; | |
| 4 | + | |
| 5 | +public class WeekTime implements Serializable { | |
| 6 | + | |
| 7 | + private String startTime; | |
| 8 | + | |
| 9 | + private String endTime; | |
| 10 | + | |
| 11 | + public String getStartTime() { | |
| 12 | + return startTime; | |
| 13 | + } | |
| 14 | + | |
| 15 | + public void setStartTime(String startTime) { | |
| 16 | + this.startTime = startTime; | |
| 17 | + } | |
| 18 | + | |
| 19 | + public String getEndTime() { | |
| 20 | + return endTime; | |
| 21 | + } | |
| 22 | + | |
| 23 | + public void setEndTime(String endTime) { | |
| 24 | + this.endTime = endTime; | |
| 25 | + } | |
| 26 | +} | ... | ... |
cloud/dahua/src/main/java/com/example/dahua/control/UserControl.java
| ... | ... | @@ -3,6 +3,7 @@ package com.example.dahua.control; |
| 3 | 3 | import com.example.dahua.MyTask; |
| 4 | 4 | import com.example.dahua.async.ImageUtils; |
| 5 | 5 | import com.example.dahua.async.SendUserInfoTask; |
| 6 | +import com.example.dahua.bean.PermissionBean; | |
| 6 | 7 | import com.example.dahua.lib.CompressPic; |
| 7 | 8 | import com.example.dahua.service.UserService; |
| 8 | 9 | import com.example.dahua.utils.*; |
| ... | ... | @@ -56,6 +57,13 @@ public class UserControl { |
| 56 | 57 | return HttpUtils.uploadImgs(new File(file), schoolId, studentCode, clint_type, file.contains("Teacher") ? 1 : 2); |
| 57 | 58 | } |
| 58 | 59 | |
| 60 | + @RequestMapping(value = "sendPermission", method = RequestMethod.POST) | |
| 61 | + @ApiOperation(value = "设置权限") | |
| 62 | + public boolean sendPermission(@RequestBody PermissionBean permissionBean) { | |
| 63 | + userService.sendPermission(permissionBean); | |
| 64 | + return true; | |
| 65 | + } | |
| 66 | + | |
| 59 | 67 | |
| 60 | 68 | @RequestMapping(value = "imgsSend", method = RequestMethod.GET) |
| 61 | 69 | @ApiOperation(value = "照片下放") | ... | ... |
cloud/dahua/src/main/java/com/example/dahua/module/GateModule.java
| 1 | 1 | package com.example.dahua.module; |
| 2 | 2 | |
| 3 | 3 | import java.io.UnsupportedEncodingException; |
| 4 | +import java.util.List; | |
| 4 | 5 | |
| 6 | +import com.example.dahua.bean.PermissionBean; | |
| 7 | +import com.example.dahua.bean.WeekDay; | |
| 8 | +import com.example.dahua.bean.WeekTime; | |
| 5 | 9 | import com.example.dahua.lib.NetSDKLib; |
| 6 | 10 | import com.example.dahua.lib.NetSDKLib.*; |
| 7 | 11 | import com.example.dahua.lib.ToolKits; |
| ... | ... | @@ -247,6 +251,67 @@ public class GateModule { |
| 247 | 251 | } |
| 248 | 252 | |
| 249 | 253 | /** |
| 254 | + * 门禁刷卡时间段设置 | |
| 255 | + */ | |
| 256 | + public static void setAccessTimeSchedule(LLong lLong, PermissionBean permissionBean) { | |
| 257 | + | |
| 258 | + CFG_ACCESS_TIMESCHEDULE_INFO msg = new CFG_ACCESS_TIMESCHEDULE_INFO(); | |
| 259 | + String strCmd = NetSDKLib.CFG_CMD_ACCESSTIMESCHEDULE; | |
| 260 | + int nChannel = 120; // 通道号 | |
| 261 | + | |
| 262 | +// msg.stuTimeWeekDay[0].stuTimeSection[0].dwRecordMask | |
| 263 | + String name = "权限模板"; | |
| 264 | + System.arraycopy(name.getBytes(), 0, msg.szName, 0, name.getBytes().length); | |
| 265 | + | |
| 266 | + List<WeekDay> weekDays = permissionBean.getWeekDays(); | |
| 267 | + | |
| 268 | + for (WeekDay weekDay : | |
| 269 | + weekDays) { | |
| 270 | + List<WeekTime> weekTimes = weekDay.getWeekTimes(); | |
| 271 | + for (int i = 0; i < weekTimes.size(); i++) { | |
| 272 | + WeekTime weekTime = weekTimes.get(i); | |
| 273 | + String startTime = weekTime.getStartTime(); | |
| 274 | + String endTime = weekTime.getEndTime(); | |
| 275 | + msg.stuTimeWeekDay[weekDay.getWeekDay()].stuTimeSection[i].nBeginHour = Integer.parseInt(startTime.split(":")[0]); | |
| 276 | + msg.stuTimeWeekDay[weekDay.getWeekDay()].stuTimeSection[i].nBeginMin = Integer.parseInt(startTime.split(":")[1]); | |
| 277 | + msg.stuTimeWeekDay[weekDay.getWeekDay()].stuTimeSection[i].nBeginSec = 0; | |
| 278 | + | |
| 279 | + msg.stuTimeWeekDay[weekDay.getWeekDay()].stuTimeSection[i].nEndHour = Integer.parseInt(endTime.split(":")[0]); | |
| 280 | + msg.stuTimeWeekDay[weekDay.getWeekDay()].stuTimeSection[i].nEndMin = Integer.parseInt(endTime.split(":")[1]); | |
| 281 | + msg.stuTimeWeekDay[weekDay.getWeekDay()].stuTimeSection[i].nEndSec = 0; | |
| 282 | + | |
| 283 | + } | |
| 284 | + } | |
| 285 | + | |
| 286 | +// 获取 | |
| 287 | +// if (ToolKits.GetDevConfig(lLong, nChannel, strCmd, msg)) { | |
| 288 | + System.out.println("Enable:" + msg.bEnable); | |
| 289 | + try { | |
| 290 | + System.out.println("自定义名称:" + new String(msg.szName, "UTF-8").trim()); | |
| 291 | + } catch (UnsupportedEncodingException e) { | |
| 292 | + e.printStackTrace(); | |
| 293 | + } | |
| 294 | + for (int i = 0; i < 7; i++) { | |
| 295 | + for (int j = 0; j < 4; j++) { | |
| 296 | + System.out.println("dwRecordMask:" + msg.stuTimeWeekDay[i].stuTimeSection[j].dwRecordMask); | |
| 297 | + System.out.println(msg.stuTimeWeekDay[i].stuTimeSection[j].startTime() + "-" + msg.stuTimeWeekDay[i].stuTimeSection[j].endTime() + "\n"); | |
| 298 | + } | |
| 299 | + } | |
| 300 | + msg.write(); | |
| 301 | + boolean set = ToolKits.SetDevConfig(lLong, nChannel, strCmd, msg); | |
| 302 | + msg.read(); | |
| 303 | + // 设置 | |
| 304 | + if (set) { | |
| 305 | + System.out.println("Set AccessTimeSchedule Succeed!"); | |
| 306 | + } else { | |
| 307 | + System.err.println("Set AccessTimeSchedule Failed!" + ToolKits.getErrorCodePrint()); | |
| 308 | + } | |
| 309 | +// } else { | |
| 310 | +// System.err.println("Get AccessTimeSchedule Failed!" + ToolKits.getErrorCodePrint()); | |
| 311 | +// } | |
| 312 | + } | |
| 313 | + | |
| 314 | + /** | |
| 250 | 315 | * 修改卡信息 |
| 251 | 316 | * |
| 252 | 317 | * @param recordNo 记录集编号 |
| ... | ... | @@ -908,4 +973,6 @@ public class GateModule { |
| 908 | 973 | m_lFindHandle.setValue(0); |
| 909 | 974 | } |
| 910 | 975 | } |
| 976 | + | |
| 977 | + | |
| 911 | 978 | } | ... | ... |
cloud/dahua/src/main/java/com/example/dahua/service/UserService.java
| 1 | 1 | package com.example.dahua.service; |
| 2 | 2 | |
| 3 | 3 | import com.example.dahua.bean.AttendanceBean; |
| 4 | +import com.example.dahua.bean.PermissionBean; | |
| 4 | 5 | import com.example.dahua.bean.UserInfoBean; |
| 5 | 6 | import org.springframework.scheduling.annotation.Async; |
| 6 | 7 | import org.springframework.web.multipart.MultipartFile; |
| ... | ... | @@ -49,5 +50,11 @@ public interface UserService { |
| 49 | 50 | */ |
| 50 | 51 | void sendUserInfos(String schoolId, String clint_type, int type); |
| 51 | 52 | |
| 53 | + /** | |
| 54 | + * 下发权限 | |
| 55 | + * @param permissionBean | |
| 56 | + * @return | |
| 57 | + */ | |
| 58 | + boolean sendPermission(PermissionBean permissionBean); | |
| 52 | 59 | |
| 53 | 60 | } | ... | ... |
cloud/dahua/src/main/java/com/example/dahua/service/UserServiceImp.java
| 1 | 1 | package com.example.dahua.service; |
| 2 | 2 | |
| 3 | +import com.example.dahua.MyTask; | |
| 3 | 4 | import com.example.dahua.async.SendUserInfoTask; |
| 4 | -import com.example.dahua.bean.AttendanceBean; | |
| 5 | -import com.example.dahua.bean.TeacherBean; | |
| 6 | -import com.example.dahua.bean.UserInfoBean; | |
| 5 | +import com.example.dahua.bean.*; | |
| 7 | 6 | import com.example.dahua.dao.UserDao; |
| 7 | +import com.example.dahua.lib.NetSDKLib; | |
| 8 | +import com.example.dahua.module.GateModule; | |
| 8 | 9 | import org.apache.commons.lang.StringUtils; |
| 9 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | 11 | import org.springframework.stereotype.Repository; |
| ... | ... | @@ -99,4 +100,18 @@ public class UserServiceImp implements UserService { |
| 99 | 100 | myTask.doTaskSendUserInfos(schoolId, clint_type, type, -1); |
| 100 | 101 | } |
| 101 | 102 | |
| 103 | + @Override | |
| 104 | + public boolean sendPermission(PermissionBean permissionBean) { | |
| 105 | + | |
| 106 | + List<String> deviceIds = permissionBean.getDeviceIds(); | |
| 107 | + for (String deviceId : | |
| 108 | + deviceIds) { | |
| 109 | + NetSDKLib.LLong loginHandleLong = MyTask.lLongMap.get(deviceId); | |
| 110 | + GateModule.setAccessTimeSchedule(loginHandleLong,permissionBean); | |
| 111 | + } | |
| 112 | + | |
| 113 | + | |
| 114 | + return false; | |
| 115 | + } | |
| 116 | + | |
| 102 | 117 | } | ... | ... |
cloud/haikangface/src/main/java/com/sincere/haikangface/CMSServer.java
| ... | ... | @@ -674,6 +674,8 @@ public class CMSServer implements ApplicationRunner { |
| 674 | 674 | * @param clint_id |
| 675 | 675 | */ |
| 676 | 676 | public void SetCardWeekPlan(String clint_id, String card, String userType, String strConfigXMLCard, String content) { |
| 677 | + try { | |
| 678 | + | |
| 677 | 679 | HCEHomeCMS.NET_EHOME_XML_CFG struXMLCard = new HCEHomeCMS.NET_EHOME_XML_CFG(); |
| 678 | 680 | |
| 679 | 681 | HCEHomeCMS.NET_DVR_STRING_POINTER stringRequestCard = new HCEHomeCMS.NET_DVR_STRING_POINTER(); |
| ... | ... | @@ -717,6 +719,9 @@ public class CMSServer implements ApplicationRunner { |
| 717 | 719 | } else { |
| 718 | 720 | System.out.println(content + "成功"); |
| 719 | 721 | } |
| 722 | + }catch (Exception e){ | |
| 723 | + e.printStackTrace(); | |
| 724 | + } | |
| 720 | 725 | } |
| 721 | 726 | |
| 722 | 727 | ... | ... |
cloud/haikangface/src/main/java/com/sincere/haikangface/async/SendUserAsync.java
| ... | ... | @@ -2,10 +2,15 @@ package com.sincere.haikangface.async; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | import com.sincere.haikangface.CMSServer; |
| 5 | +import com.sincere.haikangface.bean.face.PermissionBean; | |
| 6 | +import com.sincere.haikangface.bean.face.WeekDay; | |
| 7 | +import com.sincere.haikangface.bean.face.WeekTime; | |
| 5 | 8 | import com.sincere.haikangface.dao.DeviceDao; |
| 6 | 9 | import com.sincere.haikangface.dao.UserDao; |
| 7 | 10 | import com.sincere.haikangface.utils.*; |
| 8 | 11 | import com.sincere.haikangface.xiananDao.SendRecordDao; |
| 12 | +import lombok.extern.slf4j.Slf4j; | |
| 13 | +import org.apache.poi.ss.formula.functions.WeekdayFunc; | |
| 9 | 14 | import org.json.JSONArray; |
| 10 | 15 | import org.json.JSONObject; |
| 11 | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -20,6 +25,7 @@ import java.net.URL; |
| 20 | 25 | import java.util.*; |
| 21 | 26 | |
| 22 | 27 | @Component |
| 28 | +@Slf4j | |
| 23 | 29 | public class SendUserAsync { |
| 24 | 30 | |
| 25 | 31 | |
| ... | ... | @@ -51,7 +57,7 @@ public class SendUserAsync { |
| 51 | 57 | cmsServer.SetCardWeekPlan(deviceId, card, userType, HKXmlUtils.getInstance().SetCardTemplate(), "设置卡权限计划模板"); |
| 52 | 58 | cmsServer.SetCardWeekPlan(deviceId, card, userType, HKXmlUtils.getInstance().SetCardWeekPlan(), "卡权限周计划"); |
| 53 | 59 | for (int i = 0; i < 7; i++) { |
| 54 | - cmsServer.SetCardWeekPlan(deviceId, card, userType, HKXmlUtils.getInstance().SetCardWeekPlanTime("00:00:00", "23:00:00", "" + i), "设置卡权限周计划时间"); | |
| 60 | + cmsServer.SetCardWeekPlan(deviceId, card, userType, HKXmlUtils.getInstance().SetCardWeekPlanTime(HKXmlUtils.getInstance().SetCardWeekPlanTimes("00:00:00", "23:00:00"), "" + i), "设置卡权限周计划时间"); | |
| 55 | 61 | } |
| 56 | 62 | cmsServer.SetCardWeekPlan(deviceId, card, userType, HKXmlUtils.getInstance().SetCardRightCfg(card), "设置卡权限"); |
| 57 | 63 | } |
| ... | ... | @@ -63,6 +69,56 @@ public class SendUserAsync { |
| 63 | 69 | |
| 64 | 70 | } |
| 65 | 71 | |
| 72 | + | |
| 73 | + /** | |
| 74 | + * 下发权限 | |
| 75 | + * @param permissionBean | |
| 76 | + */ | |
| 77 | + public boolean sendPermiss(PermissionBean permissionBean) { | |
| 78 | + | |
| 79 | + String cardNum = permissionBean.getCardNum(); | |
| 80 | + List<String> deviceIds = permissionBean.getDeviceIds(); | |
| 81 | + String userType = permissionBean.getUserType(); | |
| 82 | + List<WeekDay> weekDays = permissionBean.getWeekDays(); | |
| 83 | + | |
| 84 | + for (String deviceId : | |
| 85 | + deviceIds) { | |
| 86 | + if (!cmsServer.getIsDeviceOnline(deviceId)){//设备在线 | |
| 87 | + cmsServer.SetCardWeekPlan(deviceId, cardNum, userType, HKXmlUtils.getInstance().SetCardTemplate(), "设置卡权限计划模板"); | |
| 88 | + cmsServer.SetCardWeekPlan(deviceId, cardNum, userType, HKXmlUtils.getInstance().SetCardWeekPlan(), "卡权限周计划"); | |
| 89 | + | |
| 90 | + for (WeekDay weekDay: | |
| 91 | + weekDays) { | |
| 92 | + | |
| 93 | + List<WeekTime> weekTimes = weekDay.getWeekTimes(); | |
| 94 | + int weekdayIndex = weekDay.getWeekDay(); | |
| 95 | + | |
| 96 | + StringBuffer stringBuffer = new StringBuffer();//添加时间集 | |
| 97 | + | |
| 98 | + for (WeekTime weetTime : | |
| 99 | + weekTimes) { | |
| 100 | + | |
| 101 | + String weekPlanTimes = HKXmlUtils.getInstance().SetCardWeekPlanTimes(weetTime.getStartTime(),weetTime.getEndTime()); | |
| 102 | + log.error("weekPlanTimes:{}",weekPlanTimes); | |
| 103 | + stringBuffer.append(weekPlanTimes); | |
| 104 | + | |
| 105 | + } | |
| 106 | + String weekPlanTime = HKXmlUtils.getInstance().SetCardWeekPlanTime(stringBuffer.toString(), "" + weekdayIndex); | |
| 107 | + log.error("weekPlanTime:{}",weekPlanTime); | |
| 108 | + cmsServer.SetCardWeekPlan(deviceId, cardNum, userType, weekPlanTime, "设置卡权限周计划时间"); | |
| 109 | + cmsServer.SetCardWeekPlan(deviceId, cardNum, userType, HKXmlUtils.getInstance().SetCardRightCfg(cardNum), "设置卡权限"); | |
| 110 | + } | |
| 111 | + }else {//设备不在线 | |
| 112 | + log.error("deviceId:{}",deviceId+"不在线"); | |
| 113 | + } | |
| 114 | + | |
| 115 | + } | |
| 116 | + | |
| 117 | + return true; | |
| 118 | + } | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 66 | 122 | /** |
| 67 | 123 | * 调用传图片接口 |
| 68 | 124 | * | ... | ... |
cloud/haikangface/src/main/java/com/sincere/haikangface/bean/face/FaceBean.java
0 → 100644
| ... | ... | @@ -0,0 +1,118 @@ |
| 1 | +package com.sincere.haikangface.bean.face; | |
| 2 | + | |
| 3 | +import com.fasterxml.jackson.annotation.JsonInclude; | |
| 4 | + | |
| 5 | +import java.io.Serializable; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * 下发人脸参数对象 | |
| 9 | + */ | |
| 10 | +@JsonInclude(JsonInclude.Include.NON_EMPTY) | |
| 11 | +public class FaceBean implements Serializable { | |
| 12 | + | |
| 13 | + | |
| 14 | + private String srcFilePath;//源文件路径 | |
| 15 | + | |
| 16 | + private String targetFilePath;//压缩后的目标文件路径 | |
| 17 | + | |
| 18 | + private String cardNum;//卡号 | |
| 19 | + | |
| 20 | + private String cardStartTime;//卡有效开始时间 | |
| 21 | + | |
| 22 | + private String cardEndTime;//卡失效时间 | |
| 23 | + | |
| 24 | + private String validTimeEnabled;//卡是否生效 1:生效 0:失效 | |
| 25 | + | |
| 26 | + private String stuName;//学生名字 | |
| 27 | + | |
| 28 | + private String deviceId;//设备id | |
| 29 | + | |
| 30 | + private String userType;//身份类型 | |
| 31 | + | |
| 32 | + public String getSrcFilePath() { | |
| 33 | + return srcFilePath; | |
| 34 | + } | |
| 35 | + | |
| 36 | + public void setSrcFilePath(String srcFilePath) { | |
| 37 | + this.srcFilePath = srcFilePath; | |
| 38 | + } | |
| 39 | + | |
| 40 | + public String getTargetFilePath() { | |
| 41 | + return targetFilePath; | |
| 42 | + } | |
| 43 | + | |
| 44 | + public void setTargetFilePath(String targetFilePath) { | |
| 45 | + this.targetFilePath = targetFilePath; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public String getCardNum() { | |
| 49 | + return cardNum; | |
| 50 | + } | |
| 51 | + | |
| 52 | + public void setCardNum(String cardNum) { | |
| 53 | + this.cardNum = cardNum; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public String getCardStartTime() { | |
| 57 | + return cardStartTime; | |
| 58 | + } | |
| 59 | + | |
| 60 | + public void setCardStartTime(String cardStartTime) { | |
| 61 | + this.cardStartTime = cardStartTime; | |
| 62 | + } | |
| 63 | + | |
| 64 | + public String getCardEndTime() { | |
| 65 | + return cardEndTime; | |
| 66 | + } | |
| 67 | + | |
| 68 | + public void setCardEndTime(String cardEndTime) { | |
| 69 | + this.cardEndTime = cardEndTime; | |
| 70 | + } | |
| 71 | + | |
| 72 | + public String getValidTimeEnabled() { | |
| 73 | + return validTimeEnabled; | |
| 74 | + } | |
| 75 | + | |
| 76 | + public void setValidTimeEnabled(String validTimeEnabled) { | |
| 77 | + this.validTimeEnabled = validTimeEnabled; | |
| 78 | + } | |
| 79 | + | |
| 80 | + public String getStuName() { | |
| 81 | + return stuName; | |
| 82 | + } | |
| 83 | + | |
| 84 | + public void setStuName(String stuName) { | |
| 85 | + this.stuName = stuName; | |
| 86 | + } | |
| 87 | + | |
| 88 | + public String getDeviceId() { | |
| 89 | + return deviceId; | |
| 90 | + } | |
| 91 | + | |
| 92 | + public void setDeviceId(String deviceId) { | |
| 93 | + this.deviceId = deviceId; | |
| 94 | + } | |
| 95 | + | |
| 96 | + public String getUserType() { | |
| 97 | + return userType; | |
| 98 | + } | |
| 99 | + | |
| 100 | + public void setUserType(String userType) { | |
| 101 | + this.userType = userType; | |
| 102 | + } | |
| 103 | + | |
| 104 | + @Override | |
| 105 | + public String toString() { | |
| 106 | + return "FaceBean{" + | |
| 107 | + "srcFilePath='" + srcFilePath + '\'' + | |
| 108 | + ", targetFilePath='" + targetFilePath + '\'' + | |
| 109 | + ", cardNum='" + cardNum + '\'' + | |
| 110 | + ", cardStartTime='" + cardStartTime + '\'' + | |
| 111 | + ", cardEndTime='" + cardEndTime + '\'' + | |
| 112 | + ", validTimeEnabled='" + validTimeEnabled + '\'' + | |
| 113 | + ", stuName='" + stuName + '\'' + | |
| 114 | + ", deviceId='" + deviceId + '\'' + | |
| 115 | + ", userType='" + userType + '\'' + | |
| 116 | + '}'; | |
| 117 | + } | |
| 118 | +} | ... | ... |
cloud/haikangface/src/main/java/com/sincere/haikangface/bean/face/PermissionBean.java
0 → 100644
| ... | ... | @@ -0,0 +1,47 @@ |
| 1 | +package com.sincere.haikangface.bean.face; | |
| 2 | + | |
| 3 | +import java.io.Serializable; | |
| 4 | +import java.util.List; | |
| 5 | + | |
| 6 | +public class PermissionBean implements Serializable { | |
| 7 | + | |
| 8 | + private List<String> deviceIds; | |
| 9 | + | |
| 10 | + private String cardNum; | |
| 11 | + | |
| 12 | + private String userType;//学生类型 | |
| 13 | + | |
| 14 | + private List<WeekDay> weekDays; | |
| 15 | + | |
| 16 | + public List<String> getDeviceIds() { | |
| 17 | + return deviceIds; | |
| 18 | + } | |
| 19 | + | |
| 20 | + public void setDeviceIds(List<String> deviceIds) { | |
| 21 | + this.deviceIds = deviceIds; | |
| 22 | + } | |
| 23 | + | |
| 24 | + public String getCardNum() { | |
| 25 | + return cardNum; | |
| 26 | + } | |
| 27 | + | |
| 28 | + public void setCardNum(String cardNum) { | |
| 29 | + this.cardNum = cardNum; | |
| 30 | + } | |
| 31 | + | |
| 32 | + public String getUserType() { | |
| 33 | + return userType; | |
| 34 | + } | |
| 35 | + | |
| 36 | + public void setUserType(String userType) { | |
| 37 | + this.userType = userType; | |
| 38 | + } | |
| 39 | + | |
| 40 | + public List<WeekDay> getWeekDays() { | |
| 41 | + return weekDays; | |
| 42 | + } | |
| 43 | + | |
| 44 | + public void setWeekDays(List<WeekDay> weekDays) { | |
| 45 | + this.weekDays = weekDays; | |
| 46 | + } | |
| 47 | +} | ... | ... |
cloud/haikangface/src/main/java/com/sincere/haikangface/bean/face/WeekDay.java
0 → 100644
| ... | ... | @@ -0,0 +1,28 @@ |
| 1 | +package com.sincere.haikangface.bean.face; | |
| 2 | + | |
| 3 | +import java.io.Serializable; | |
| 4 | +import java.util.List; | |
| 5 | + | |
| 6 | +public class WeekDay implements Serializable { | |
| 7 | + | |
| 8 | + | |
| 9 | + private int weekDay; | |
| 10 | + | |
| 11 | + private List<WeekTime> weekTimes; | |
| 12 | + | |
| 13 | + public int getWeekDay() { | |
| 14 | + return weekDay; | |
| 15 | + } | |
| 16 | + | |
| 17 | + public void setWeekDay(int weekDay) { | |
| 18 | + this.weekDay = weekDay; | |
| 19 | + } | |
| 20 | + | |
| 21 | + public List<WeekTime> getWeekTimes() { | |
| 22 | + return weekTimes; | |
| 23 | + } | |
| 24 | + | |
| 25 | + public void setWeekTimes(List<WeekTime> weekTimes) { | |
| 26 | + this.weekTimes = weekTimes; | |
| 27 | + } | |
| 28 | +} | ... | ... |
cloud/haikangface/src/main/java/com/sincere/haikangface/bean/face/WeekTime.java
0 → 100644
| ... | ... | @@ -0,0 +1,27 @@ |
| 1 | +package com.sincere.haikangface.bean.face; | |
| 2 | + | |
| 3 | +import java.io.Serializable; | |
| 4 | + | |
| 5 | +public class WeekTime implements Serializable { | |
| 6 | + | |
| 7 | + private String startTime; | |
| 8 | + | |
| 9 | + private String endTime; | |
| 10 | + | |
| 11 | + | |
| 12 | + public String getStartTime() { | |
| 13 | + return startTime; | |
| 14 | + } | |
| 15 | + | |
| 16 | + public void setStartTime(String startTime) { | |
| 17 | + this.startTime = startTime; | |
| 18 | + } | |
| 19 | + | |
| 20 | + public String getEndTime() { | |
| 21 | + return endTime; | |
| 22 | + } | |
| 23 | + | |
| 24 | + public void setEndTime(String endTime) { | |
| 25 | + this.endTime = endTime; | |
| 26 | + } | |
| 27 | +} | ... | ... |
cloud/haikangface/src/main/java/com/sincere/haikangface/control/UserControl.java
| ... | ... | @@ -8,6 +8,7 @@ import com.sincere.haikangface.CMSServer; |
| 8 | 8 | import com.sincere.haikangface.async.SendUserAsync; |
| 9 | 9 | import com.sincere.haikangface.bean.StudentBean; |
| 10 | 10 | import com.sincere.haikangface.bean.StudentInfo; |
| 11 | +import com.sincere.haikangface.bean.face.PermissionBean; | |
| 11 | 12 | import com.sincere.haikangface.dao.UserDao; |
| 12 | 13 | import com.sincere.haikangface.fegin.HaikangfaceFegin; |
| 13 | 14 | import com.sincere.haikangface.utils.*; |
| ... | ... | @@ -53,6 +54,18 @@ public class UserControl { |
| 53 | 54 | |
| 54 | 55 | SendRecoderUtils sendRecoderUtils; |
| 55 | 56 | |
| 57 | + | |
| 58 | + @RequestMapping(value = "sendPermiss", method = RequestMethod.POST) | |
| 59 | + @ApiOperation("下发权限给设备") | |
| 60 | + public boolean sendPermiss(@RequestBody PermissionBean permissionBean) { | |
| 61 | + | |
| 62 | + if (!StringUtils.isEmpty(permissionBean)) { | |
| 63 | + return sendUserAsync.sendPermiss(permissionBean); | |
| 64 | + } | |
| 65 | + return false; | |
| 66 | + } | |
| 67 | + | |
| 68 | + | |
| 56 | 69 | @RequestMapping(value = "sendStuCardAndImg", method = RequestMethod.GET) |
| 57 | 70 | @ApiOperation("下发人脸给设备") |
| 58 | 71 | public boolean sendCardAndImg(@RequestParam("filePath") String filePath, @RequestParam("card") String card | ... | ... |
cloud/haikangface/src/main/java/com/sincere/haikangface/utils/HKXmlUtils.java
| ... | ... | @@ -114,7 +114,7 @@ public class HKXmlUtils { |
| 114 | 114 | /** |
| 115 | 115 | * 设置卡权限周计划时间 |
| 116 | 116 | */ |
| 117 | - public String SetCardWeekPlanTime(String startTime, String endTime, String weekDay) { | |
| 117 | + public String SetCardWeekPlanTime(String weekPlanTime, String weekDay) { | |
| 118 | 118 | return "<Params>\n" + |
| 119 | 119 | "<ConfigCmd>SetCardWeekPlanTime</ConfigCmd>\n" + |
| 120 | 120 | "<ConfigParam1>1</ConfigParam1>\n" + |
| ... | ... | @@ -122,11 +122,36 @@ public class HKXmlUtils { |
| 122 | 122 | "<ConfigXML>\n" + |
| 123 | 123 | "<WeekPlanTimeList>\n" + |
| 124 | 124 | "<WeekPlanTime>\n" + |
| 125 | - "<startTime>" + startTime + "</startTime>\n" + | |
| 126 | - "<endTime>" + endTime + "</endTime>\n" + | |
| 125 | + weekPlanTime + "\n" + | |
| 127 | 126 | "</WeekPlanTime>\n" + |
| 128 | 127 | "</WeekPlanTimeList>\n" + |
| 129 | 128 | "</ConfigXML>\n" + |
| 130 | 129 | "</Params>"; |
| 130 | +// return "<Params>\n" + | |
| 131 | +// "<ConfigCmd>SetCardWeekPlanTime</ConfigCmd>\n" + | |
| 132 | +// "<ConfigParam1>1</ConfigParam1>\n" + | |
| 133 | +// "<ConfigParam2>" + weekDay + "</ConfigParam2>\n" + | |
| 134 | +// "<ConfigXML>\n" + | |
| 135 | +// "<WeekPlanTimeList>\n" + | |
| 136 | +// "<WeekPlanTime>\n" + | |
| 137 | +// "<startTime>" + startTime + "</startTime>\n" + | |
| 138 | +// "<endTime>" + endTime + "</endTime>\n" + | |
| 139 | +// "</WeekPlanTime>\n" + | |
| 140 | +// "</WeekPlanTimeList>\n" + | |
| 141 | +// "</ConfigXML>\n" + | |
| 142 | +// "</Params>"; | |
| 143 | + } | |
| 144 | + | |
| 145 | + | |
| 146 | + /** | |
| 147 | + * 设置多个周计划时间段 | |
| 148 | + * | |
| 149 | + * @param startTime | |
| 150 | + * @param endTime | |
| 151 | + * @return | |
| 152 | + */ | |
| 153 | + public String SetCardWeekPlanTimes(String startTime, String endTime) { | |
| 154 | + return "<startTime>" + startTime + "</startTime>\n" + | |
| 155 | + "<endTime>" + endTime + "</endTime>\n"; | |
| 131 | 156 | } |
| 132 | 157 | } | ... | ... |