Commit d2f34f58fd3ea62b9e8b16a5b44303a3626a3d41

Authored by 陈杰
2 parents f07769a9 d63d4f1c
Exists in master and in 1 other branch cloud_copy

Merge remote-tracking branch 'origin/master'

cloud/dahua/src/main/java/com/example/dahua/async/MyScheduledTask.java
... ... @@ -55,7 +55,7 @@ public class MyScheduledTask {
55 55  
56 56 private boolean isSendDahua = false;
57 57  
58   - private boolean isClose = true;//判断是否关机
  58 + private boolean isClose = true, isCloseYT = true;//判断是否关机
59 59  
60 60 @Scheduled(fixedRate = 5000)
61 61 private void sendErrorInfo() throws InterruptedException {
... ... @@ -67,12 +67,19 @@ public class MyScheduledTask {
67 67  
68 68 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
69 69 int hour = Integer.parseInt(simpleDateFormat.format(new Date()));
70   - SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("HH:mm");
71   - if (simpleDateFormat1.format(new Date()).equals("6:00")) {
72   - if (!isClose){
73   - isClose=true;
74   - close(31);//打开
75   - }
  70 + if (hour == 7 && !isCloseYT){
  71 + isCloseYT = true;
  72 + close(31,97);
  73 + }
  74 +
  75 + if (hour == 17 && isCloseYT){
  76 + isCloseYT = false;
  77 + close(30,97);
  78 + }
  79 +
  80 + if (hour == 6 && !isClose) {
  81 + isClose = true;
  82 + close(31,479);//打开
76 83 }
77 84 if (hour >= 9 && hour <= 11) {
78 85  
... ... @@ -81,27 +88,25 @@ public class MyScheduledTask {
81 88 dealData();
82 89 } else if (hour >= 18 || hour <= 5) {
83 90 //高级中学班牌关闭显示器
84   - if (simpleDateFormat1.format(new Date()).equals("22:00")) {
85   - if (isClose){
86   - isClose = false;
87   - close(30);//关闭
88   - }
89   - }
90 91  
  92 + if (isClose) {
  93 + isClose = false;
  94 + close(30,479);//关闭
  95 + }
91 96 dealData();
92 97 }
93 98  
94 99 }
95 100  
96   - private void close(int cmd) {
  101 + private void close(int cmd,int schoolId) {
97 102 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
98 103 String date = simpleDateFormat.format(new Date());
99   - FileUtils.getInstance().writeLogs(date+" "+cmd,FileUtils.sendOrder);
  104 + FileUtils.getInstance().writeLogs(date + " " + cmd, FileUtils.sendOrder);
100 105 MqttManager mqttManager = new MqttManager();
101 106  
102 107 mqttManager.init();
103 108  
104   - List<String> stringList = userDao.getAllDecWithSch(479);
  109 + List<String> stringList = userDao.getAllDecWithSch(schoolId);
105 110 System.out.println("stringList:" + stringList);
106 111 for (int i = 0; i < stringList.size(); i++) {
107 112 String devId = stringList.get(i);
... ...
cloud/dahua/src/main/java/com/example/dahua/lib/CompressPic.java
... ... @@ -17,7 +17,7 @@ import java.io.InputStream;
17 17 public class CompressPic {
18 18  
19 19 public static String CompressPic(String srcPath, String targetPath, String studentcode) throws Exception {
20   - double cutPercent = 0.1;
  20 + double cutPercent = 0.5;
21 21 File file = new File(srcPath.trim());
22 22 BufferedImage bufferedImage = ImageIO.read(new FileInputStream(file));
23 23 int width = bufferedImage.getWidth(null);
... ...
cloud/haikang/src/test/java/com/sincere/haikang/HaikangApplicationTests.java
... ... @@ -32,19 +32,19 @@ public class HaikangApplicationTests {
32 32 @Test
33 33 public void my() throws IOException {
34 34  
35   - File file = new File("C:\\TaoHandong\\copy\\21_指纹签到.txt");
  35 + File file = new File("C:\\TaoHandong\\copy\\21_qiandaoErr.txt");
36 36 BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
37 37  
38 38 String content = "";
39 39 String result = "";
40 40 while ((content=bufferedReader.readLine())!=null){
41 41  
42   - if (content.split("cardNo:").length>1){
  42 + if (content.split("cardNo:").length>1&&!result.contains(content.split("cardNo:")[1])){
43 43 result+="\'"+content.split("cardNo:")[1]+"\',";
44 44 }
45 45  
46 46 }
47   -System.out.println("result:"+result);
  47 + System.out.println("result:"+result+result.split(",").length);
48 48  
49 49 }
50 50  
... ...
cloud/haikangface/pom.xml
... ... @@ -156,13 +156,13 @@
156 156 <configuration>
157 157 <includeSystemScope>true</includeSystemScope>
158 158 <layout>ZIP</layout>
159   - <!-- <includes>
  159 + <includes>
160 160 <include>
161   - &lt;!&ndash; 排除所有Jar &ndash;&gt;
  161 + <!-- 排除所有Jar -->
162 162 <groupId>nothing</groupId>
163 163 <artifactId>nothing</artifactId>
164 164 </include>
165   - </includes>-->
  165 + </includes>
166 166 </configuration>
167 167 </plugin>
168 168 </plugins>
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/CMSServer.java
... ... @@ -168,6 +168,16 @@ public class CMSServer implements ApplicationRunner {
168 168 dwInLen = pInBuffer.size();
169 169 lLoginID = lUserID;
170 170 map.put(deviceId, lLoginID);
  171 +
  172 + try {
  173 + Thread.sleep(1000);
  174 + for (int i = 0; i < 7; i++) {
  175 + SetCardWeekPlan(deviceId, HKXmlUtils.getInstance().SetCardWeekPlanTime("00:00:00", "23:00:00",""+i), "设置卡权限周计划时间");
  176 + }
  177 + } catch (InterruptedException e) {
  178 + e.printStackTrace();
  179 + }
  180 +
171 181 } //设备下线
172 182 return true;
173 183 }
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/async/SendUserAsync.java
... ... @@ -46,7 +46,7 @@ public class SendUserAsync {
46 46  
47 47 // @Async("taskExecutor")
48 48 public void sendStuToHaiKang(String srcFile, String picUrl, String card, String startTime, String endTime, int validTimeEnabled, String name, String deviceId, String userType, int isPiliang) {
49   - System.out.println("下发卡号:"+card+" startTime:"+startTime+" endTime:"+endTime);
  49 +// System.out.println("下发卡号:"+card+" startTime:"+startTime+" endTime:"+endTime);
50 50 if (null == sendRecoderUtils) sendRecoderUtils = new SendRecoderUtils();
51 51 //1、检测图片是否合格
52 52 boolean check = true;
... ... @@ -63,9 +63,6 @@ public class SendUserAsync {
63 63 cmsServer.SetCardWeekPlan(deviceId, HKXmlUtils.getInstance().SetCardRightCfg(card), "设置卡权限");
64 64 cmsServer.SetCardWeekPlan(deviceId, HKXmlUtils.getInstance().SetCardWeekPlan(), "卡权限周计划");
65 65 // cmsServer.SetCardWeekPlan(deviceId, HKXmlUtils.getInstance().SetCardTemplate(), "设置卡权限计划模板");
66   - for (int i = 0; i < 7; i++) {
67   - cmsServer.SetCardWeekPlan(deviceId, HKXmlUtils.getInstance().SetCardWeekPlanTime("00:00:00", "23:00:00",""+i), "设置卡权限周计划时间");
68   - }
69 66 if (result) {
70 67 if (isPiliang == 0) {
71 68 new File(srcFile).deleteOnExit();
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/bean/AttendanceBean.java
... ... @@ -21,6 +21,16 @@ public class AttendanceBean implements Serializable {
21 21  
22 22 private int state;
23 23  
  24 + private int isKaoqin;
  25 +
  26 + public int getIsKaoqin() {
  27 + return isKaoqin;
  28 + }
  29 +
  30 + public void setIsKaoqin(int isKaoqin) {
  31 + this.isKaoqin = isKaoqin;
  32 + }
  33 +
24 34 public String getClint_id() {
25 35 return clint_id;
26 36 }
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/bean/HSGrade.java 0 → 100644
... ... @@ -0,0 +1,120 @@
  1 +package com.sincere.haikangface.bean;
  2 +
  3 +public class HSGrade {
  4 +
  5 + private String Name;
  6 +
  7 + private String AddTime;
  8 +
  9 + private int Status;
  10 +
  11 + private String UserId;
  12 +
  13 + private int SchoolId;
  14 +
  15 + private String ShortName;
  16 +
  17 + private int SchoolYear;
  18 +
  19 + private int Year;
  20 +
  21 + private String Remark;
  22 +
  23 + private int IsFinish;
  24 +
  25 + public String getName() {
  26 + return Name;
  27 + }
  28 +
  29 + public void setName(String name) {
  30 + Name = name;
  31 + }
  32 +
  33 + public String getAddTime() {
  34 + return AddTime;
  35 + }
  36 +
  37 + public void setAddTime(String addTime) {
  38 + AddTime = addTime;
  39 + }
  40 +
  41 + public int getStatus() {
  42 + return Status;
  43 + }
  44 +
  45 + public void setStatus(int status) {
  46 + Status = status;
  47 + }
  48 +
  49 + public String getUserId() {
  50 + return UserId;
  51 + }
  52 +
  53 + public void setUserId(String userId) {
  54 + UserId = userId;
  55 + }
  56 +
  57 + public int getSchoolId() {
  58 + return SchoolId;
  59 + }
  60 +
  61 + public void setSchoolId(int schoolId) {
  62 + SchoolId = schoolId;
  63 + }
  64 +
  65 + public String getShortName() {
  66 + return ShortName;
  67 + }
  68 +
  69 + public void setShortName(String shortName) {
  70 + ShortName = shortName;
  71 + }
  72 +
  73 + public int getSchoolYear() {
  74 + return SchoolYear;
  75 + }
  76 +
  77 + public void setSchoolYear(int schoolYear) {
  78 + SchoolYear = schoolYear;
  79 + }
  80 +
  81 + public int getYear() {
  82 + return Year;
  83 + }
  84 +
  85 + public void setYear(int year) {
  86 + Year = year;
  87 + }
  88 +
  89 + public String getRemark() {
  90 + return Remark;
  91 + }
  92 +
  93 + public void setRemark(String remark) {
  94 + Remark = remark;
  95 + }
  96 +
  97 + public int getIsFinish() {
  98 + return IsFinish;
  99 + }
  100 +
  101 + public void setIsFinish(int isFinish) {
  102 + IsFinish = isFinish;
  103 + }
  104 +
  105 + @Override
  106 + public String toString() {
  107 + return "HSGrade{" +
  108 + "Name='" + Name + '\'' +
  109 + ", AddTime='" + AddTime + '\'' +
  110 + ", Status=" + Status +
  111 + ", UserId='" + UserId + '\'' +
  112 + ", SchoolId=" + SchoolId +
  113 + ", ShortName='" + ShortName + '\'' +
  114 + ", SchoolYear=" + SchoolYear +
  115 + ", Year=" + Year +
  116 + ", Remark='" + Remark + '\'' +
  117 + ", IsFinish=" + IsFinish +
  118 + '}';
  119 + }
  120 +}
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/bean/HS_ResBook.java 0 → 100644
... ... @@ -0,0 +1,98 @@
  1 +package com.sincere.haikangface.bean;
  2 +
  3 +public class HS_ResBook {
  4 +
  5 + private String Name;
  6 +
  7 + private String AddTime;
  8 +
  9 + private String Status;
  10 +
  11 + private String UserId;
  12 +
  13 + private String SchoolId;
  14 +
  15 + private String Press;
  16 +
  17 + private String PressTimes;
  18 +
  19 + private String Price;
  20 +
  21 + public String getName() {
  22 + return Name;
  23 + }
  24 +
  25 + public void setName(String name) {
  26 + Name = name;
  27 + }
  28 +
  29 + public String getAddTime() {
  30 + return AddTime;
  31 + }
  32 +
  33 + public void setAddTime(String addTime) {
  34 + AddTime = addTime;
  35 + }
  36 +
  37 + public String getStatus() {
  38 + return Status;
  39 + }
  40 +
  41 + public void setStatus(String status) {
  42 + Status = status;
  43 + }
  44 +
  45 + public String getUserId() {
  46 + return UserId;
  47 + }
  48 +
  49 + public void setUserId(String userId) {
  50 + UserId = userId;
  51 + }
  52 +
  53 + public String getSchoolId() {
  54 + return SchoolId;
  55 + }
  56 +
  57 + public void setSchoolId(String schoolId) {
  58 + SchoolId = schoolId;
  59 + }
  60 +
  61 + public String getPress() {
  62 + return Press;
  63 + }
  64 +
  65 + public void setPress(String press) {
  66 + Press = press;
  67 + }
  68 +
  69 + public String getPressTimes() {
  70 + return PressTimes;
  71 + }
  72 +
  73 + public void setPressTimes(String pressTimes) {
  74 + PressTimes = pressTimes;
  75 + }
  76 +
  77 + public String getPrice() {
  78 + return Price;
  79 + }
  80 +
  81 + public void setPrice(String price) {
  82 + Price = price;
  83 + }
  84 +
  85 + @Override
  86 + public String toString() {
  87 + return "HS_ResBook{" +
  88 + "Name='" + Name + '\'' +
  89 + ", AddTime='" + AddTime + '\'' +
  90 + ", Status='" + Status + '\'' +
  91 + ", UserId='" + UserId + '\'' +
  92 + ", SchoolId='" + SchoolId + '\'' +
  93 + ", Press='" + Press + '\'' +
  94 + ", PressTimes='" + PressTimes + '\'' +
  95 + ", Price='" + Price + '\'' +
  96 + '}';
  97 + }
  98 +}
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/bean/HS_ResBookVersion.java 0 → 100644
... ... @@ -0,0 +1,87 @@
  1 +package com.sincere.haikangface.bean;
  2 +
  3 +public class HS_ResBookVersion {
  4 +
  5 + private int BookId;
  6 +
  7 + private int GradeId;
  8 +
  9 + private int SubjectId;
  10 +
  11 + private int IsUse;
  12 +
  13 + private int State;
  14 +
  15 + private String Intime;
  16 +
  17 + private int SchoolId;
  18 +
  19 + public int getBookId() {
  20 + return BookId;
  21 + }
  22 +
  23 + public void setBookId(int bookId) {
  24 + BookId = bookId;
  25 + }
  26 +
  27 + public int getGradeId() {
  28 + return GradeId;
  29 + }
  30 +
  31 + public void setGradeId(int gradeId) {
  32 + GradeId = gradeId;
  33 + }
  34 +
  35 + public int getSubjectId() {
  36 + return SubjectId;
  37 + }
  38 +
  39 + public void setSubjectId(int subjectId) {
  40 + SubjectId = subjectId;
  41 + }
  42 +
  43 + public int getIsUse() {
  44 + return IsUse;
  45 + }
  46 +
  47 + public void setIsUse(int isUse) {
  48 + IsUse = isUse;
  49 + }
  50 +
  51 + public int getState() {
  52 + return State;
  53 + }
  54 +
  55 + public void setState(int state) {
  56 + State = state;
  57 + }
  58 +
  59 + public String getIntime() {
  60 + return Intime;
  61 + }
  62 +
  63 + public void setIntime(String intime) {
  64 + Intime = intime;
  65 + }
  66 +
  67 + public int getSchoolId() {
  68 + return SchoolId;
  69 + }
  70 +
  71 + public void setSchoolId(int schoolId) {
  72 + SchoolId = schoolId;
  73 + }
  74 +
  75 + @Override
  76 + public String toString() {
  77 + return "HS_ResBookVersion{" +
  78 + "BookId=" + BookId +
  79 + ", GradeId=" + GradeId +
  80 + ", SubjectId=" + SubjectId +
  81 + ", IsUse=" + IsUse +
  82 + ", State=" + State +
  83 + ", Intime='" + Intime + '\'' +
  84 + ", SchoolId=" + SchoolId +
  85 + '}';
  86 + }
  87 +}
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/bean/HS_ResChapter.java 0 → 100644
... ... @@ -0,0 +1,152 @@
  1 +package com.sincere.haikangface.bean;
  2 +
  3 +public class HS_ResChapter {
  4 +
  5 + private int id;
  6 +
  7 + private String Name;
  8 +
  9 + private int SubjectId;
  10 +
  11 + private int GradeId;
  12 +
  13 + private int Pid;
  14 +
  15 + private int JiaoCaiId;
  16 +
  17 + private int BookVersionId;
  18 +
  19 + private int Sort;
  20 +
  21 + private int Type;
  22 +
  23 + private String AddTime;
  24 +
  25 + private int Status;
  26 +
  27 + private String UserId;
  28 +
  29 + private int SchoolId;
  30 +
  31 + public int getId() {
  32 + return id;
  33 + }
  34 +
  35 + public void setId(int id) {
  36 + this.id = id;
  37 + }
  38 +
  39 + public String getName() {
  40 + return Name;
  41 + }
  42 +
  43 + public void setName(String name) {
  44 + Name = name;
  45 + }
  46 +
  47 + public int getSubjectId() {
  48 + return SubjectId;
  49 + }
  50 +
  51 + public void setSubjectId(int subjectId) {
  52 + SubjectId = subjectId;
  53 + }
  54 +
  55 + public int getGradeId() {
  56 + return GradeId;
  57 + }
  58 +
  59 + public void setGradeId(int gradeId) {
  60 + GradeId = gradeId;
  61 + }
  62 +
  63 + public int getPid() {
  64 + return Pid;
  65 + }
  66 +
  67 + public void setPid(int pid) {
  68 + Pid = pid;
  69 + }
  70 +
  71 + public int getJiaoCaiId() {
  72 + return JiaoCaiId;
  73 + }
  74 +
  75 + public void setJiaoCaiId(int jiaoCaiId) {
  76 + JiaoCaiId = jiaoCaiId;
  77 + }
  78 +
  79 + public int getBookVersionId() {
  80 + return BookVersionId;
  81 + }
  82 +
  83 + public void setBookVersionId(int bookVersionId) {
  84 + BookVersionId = bookVersionId;
  85 + }
  86 +
  87 + public int getSort() {
  88 + return Sort;
  89 + }
  90 +
  91 + public void setSort(int sort) {
  92 + Sort = sort;
  93 + }
  94 +
  95 + public int getType() {
  96 + return Type;
  97 + }
  98 +
  99 + public void setType(int type) {
  100 + Type = type;
  101 + }
  102 +
  103 + public String getAddTime() {
  104 + return AddTime;
  105 + }
  106 +
  107 + public void setAddTime(String addTime) {
  108 + AddTime = addTime;
  109 + }
  110 +
  111 + public int getStatus() {
  112 + return Status;
  113 + }
  114 +
  115 + public void setStatus(int status) {
  116 + Status = status;
  117 + }
  118 +
  119 + public String getUserId() {
  120 + return UserId;
  121 + }
  122 +
  123 + public void setUserId(String userId) {
  124 + UserId = userId;
  125 + }
  126 +
  127 + public int getSchoolId() {
  128 + return SchoolId;
  129 + }
  130 +
  131 + public void setSchoolId(int schoolId) {
  132 + SchoolId = schoolId;
  133 + }
  134 +
  135 + @Override
  136 + public String toString() {
  137 + return "HS_ResChapter{" +
  138 + "Name='" + Name + '\'' +
  139 + ", SubjectId=" + SubjectId +
  140 + ", GradeId=" + GradeId +
  141 + ", Pid=" + Pid +
  142 + ", JiaoCaiId=" + JiaoCaiId +
  143 + ", BookVersionId=" + BookVersionId +
  144 + ", Sort=" + Sort +
  145 + ", Type=" + Type +
  146 + ", AddTime='" + AddTime + '\'' +
  147 + ", Status=" + Status +
  148 + ", UserId='" + UserId + '\'' +
  149 + ", SchoolId=" + SchoolId +
  150 + '}';
  151 + }
  152 +}
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/bean/SubjectBean.java 0 → 100644
... ... @@ -0,0 +1,120 @@
  1 +package com.sincere.haikangface.bean;
  2 +
  3 +public class SubjectBean {
  4 +
  5 + private int subject_id;
  6 +
  7 + private int school_id;
  8 +
  9 + private String subject_name;
  10 +
  11 + private String intime;
  12 +
  13 + private int subId;
  14 +
  15 + private int IsElective;
  16 +
  17 + private int Status;
  18 +
  19 + private int TypeId;
  20 +
  21 + private int MaxPerson;
  22 +
  23 + private String ShortName;
  24 +
  25 + public int getSubject_id() {
  26 + return subject_id;
  27 + }
  28 +
  29 + public void setSubject_id(int subject_id) {
  30 + this.subject_id = subject_id;
  31 + }
  32 +
  33 + public int getSchool_id() {
  34 + return school_id;
  35 + }
  36 +
  37 + public void setSchool_id(int school_id) {
  38 + this.school_id = school_id;
  39 + }
  40 +
  41 + public String getSubject_name() {
  42 + return subject_name;
  43 + }
  44 +
  45 + public void setSubject_name(String subject_name) {
  46 + this.subject_name = subject_name;
  47 + }
  48 +
  49 + public String getIntime() {
  50 + return intime;
  51 + }
  52 +
  53 + public void setIntime(String intime) {
  54 + this.intime = intime;
  55 + }
  56 +
  57 + public int getSubId() {
  58 + return subId;
  59 + }
  60 +
  61 + public void setSubId(int subId) {
  62 + this.subId = subId;
  63 + }
  64 +
  65 + public int getIsElective() {
  66 + return IsElective;
  67 + }
  68 +
  69 + public void setIsElective(int isElective) {
  70 + IsElective = isElective;
  71 + }
  72 +
  73 + public int getStatus() {
  74 + return Status;
  75 + }
  76 +
  77 + public void setStatus(int status) {
  78 + Status = status;
  79 + }
  80 +
  81 + public int getTypeId() {
  82 + return TypeId;
  83 + }
  84 +
  85 + public void setTypeId(int typeId) {
  86 + TypeId = typeId;
  87 + }
  88 +
  89 + public int getMaxPerson() {
  90 + return MaxPerson;
  91 + }
  92 +
  93 + public void setMaxPerson(int maxPerson) {
  94 + MaxPerson = maxPerson;
  95 + }
  96 +
  97 + public String getShortName() {
  98 + return ShortName;
  99 + }
  100 +
  101 + public void setShortName(String shortName) {
  102 + ShortName = shortName;
  103 + }
  104 +
  105 + @Override
  106 + public String toString() {
  107 + return "SubjectBean{" +
  108 + "subject_id=" + subject_id +
  109 + ", school_id=" + school_id +
  110 + ", subject_name='" + subject_name + '\'' +
  111 + ", intime='" + intime + '\'' +
  112 + ", subId=" + subId +
  113 + ", IsElective=" + IsElective +
  114 + ", Status=" + Status +
  115 + ", TypeId=" + TypeId +
  116 + ", MaxPerson=" + MaxPerson +
  117 + ", ShortName='" + ShortName + '\'' +
  118 + '}';
  119 + }
  120 +}
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/control/UserControl.java
... ... @@ -2,7 +2,9 @@ package com.sincere.haikangface.control;
2 2  
3 3 import com.sincere.haikangface.CMSServer;
4 4 import com.sincere.haikangface.async.SendUserAsync;
  5 +import com.sincere.haikangface.bean.AttendanceBean;
5 6 import com.sincere.haikangface.bean.StudentBean;
  7 +import com.sincere.haikangface.dao.DeviceDao;
6 8 import com.sincere.haikangface.dao.UserDao;
7 9 import com.sincere.haikangface.utils.*;
8 10 import com.sincere.haikangface.xiananDao.SendRecordDao;
... ... @@ -11,6 +13,7 @@ import io.swagger.annotations.ApiOperation;
11 13 import org.json.JSONArray;
12 14 import org.json.JSONObject;
13 15 import org.springframework.beans.factory.annotation.Autowired;
  16 +import org.springframework.util.StringUtils;
14 17 import org.springframework.web.bind.annotation.RequestMapping;
15 18 import org.springframework.web.bind.annotation.RequestMethod;
16 19 import org.springframework.web.bind.annotation.RequestParam;
... ... @@ -39,6 +42,9 @@ public class UserControl {
39 42 UserDao userDao;
40 43  
41 44 @Autowired
  45 + DeviceDao deviceDao;
  46 +
  47 + @Autowired
42 48 CMSServer cmsServer;
43 49  
44 50 @Autowired
... ... @@ -53,6 +59,7 @@ public class UserControl {
53 59  
54 60 try {
55 61 System.out.println("设备编号:"+deviceId);
  62 + long time = System.currentTimeMillis();
56 63 if (filePath.contains("\\.jpg"))filePath=filePath.replace("\\.jpg","\\.png");
57 64 if (new File(filePath.trim()).exists()) {
58 65 String targetPath = FileUtils.picPathComp + new File(filePath).getName();
... ... @@ -66,6 +73,9 @@ public class UserControl {
66 73 isPiliang = 1;
67 74 }
68 75 sendUserAsync.sendStuToHaiKang(filePath, targetPath, new BigInteger(getCard(card), 16).toString(), startTime, endTime, validTimeEnabled, name, deviceId, userType, isPiliang);
  76 +
  77 + System.out.println("time:"+(System.currentTimeMillis()-time)/1000);
  78 +
69 79 } catch (Exception e) {
70 80 e.printStackTrace();
71 81 return false;
... ... @@ -128,11 +138,28 @@ public class UserControl {
128 138  
129 139 String targetPath = FileUtils.picPathComp;
130 140 System.out.println("fileName:" + file.getOriginalFilename());
131   - return FileUtils.upload(file, targetPath, file.getOriginalFilename());
  141 + return "";
  142 +
  143 + }
  144 +
  145 +
  146 + @RequestMapping(value = "getKaoqinTem", method = RequestMethod.GET)
  147 + @ApiOperation("根据设备获取考勤模板")
  148 + public String getKaoqinTem(@RequestParam("deviceId") String deviceId) {
  149 + AttendanceBean attendanceBean = deviceDao.selectDevice(deviceId);
  150 + int isKaoqin = attendanceBean.getIsKaoqin();//获取考勤模板id
  151 + List<AttendanceBean> attendanceBeans = deviceDao.getAttens(isKaoqin);//获取同一模板下的设备
  152 + List<String> list = new ArrayList<>();
132 153  
  154 + for (int i = 0; i < attendanceBeans.size(); i++) {
  155 + String clientId = attendanceBeans.get(i).getClint_id();
  156 + if (!StringUtils.isEmpty(clientId))list.add(clientId);
  157 + }
  158 + return list.toString();
133 159 }
134 160  
135 161  
  162 +
136 163 private String getCard(String card) {
137 164  
138 165 if (card.length() == 8) {
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/dao/DeviceDao.java
... ... @@ -22,6 +22,9 @@ public interface DeviceDao {
22 22 @Select("select * from SZ_Attendance where clint_id = #{clint_id}")
23 23 AttendanceBean selectDevice(@Param("clint_id") String clint_id);
24 24  
  25 + @Select("select * from SZ_Attendance where IsKaoqin = #{IsKaoqin}")
  26 + List<AttendanceBean> getAttens(@Param("IsKaoqin")int IsKaoqin);
  27 +
25 28 @Update("update SZ_Attendance set isConnection = #{isConnection} where clint_id = #{clint_id}")
26 29 int updateDeviceStatu(@Param("isConnection") int isConnection, @Param("clint_id") String clint_id);
27 30  
... ... @@ -48,9 +51,8 @@ public interface DeviceDao {
48 51 @Select("select school_id from SZ_Attendance where clint_id = #{deviceId}")
49 52 int getSchoolId(@Param("deviceId")String deviceId);
50 53  
51   -
52   -
53 54 @Select("select * from SZ_Attendance where clint_type = #{clint_type} and school_id = #{school_id}")
54 55 List<AttendanceBean> selectDeviceWithschool_id(@Param("clint_type") String clint_type, @Param("school_id") String school_id);
55 56  
  57 +
56 58 }
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/dao/UserDao.java
1 1 package com.sincere.haikangface.dao;
2 2  
3   -import com.sincere.haikangface.bean.FileBean;
4   -import com.sincere.haikangface.bean.StudentBean;
5   -import com.sincere.haikangface.bean.UserBean;
  3 +import com.sincere.haikangface.bean.*;
6 4 import org.apache.ibatis.annotations.*;
7 5 import org.springframework.stereotype.Repository;
8 6  
... ... @@ -71,15 +69,73 @@ public interface UserDao {
71 69 @Select("select * from HS_ResFiles where UserId = 'zy405704' and id >= 4476 ")
72 70 List<FileBean> getFIlesReses();
73 71 //
74   - @Select("(select Name from HS_ResGrade where SchoolId = 1021 and id = #{id})")
  72 + @Select("(select Name from HS_ResGrade where SchoolId = 350 and id = #{id})")
75 73 String getGradeName(@Param("id")String id);
76 74 //
77   - @Select("select id from HS_ResGrade where SchoolId = 885 and name = #{name}")
  75 + @Select("select id from HS_ResGrade where SchoolId = 349 and name = #{name}")
78 76 String getGradeId(@Param("name")String name);
  77 +
  78 + @Select("select * from HS_ResGrade where SchoolId = 350")
  79 + List<HSGrade> getGrades();
  80 +
  81 +
  82 + @Insert("insert into HS_ResGrade values (#{name},#{addTime},#{status},#{userId},#{schoolId},#{shortName},#{schoolYear},#{year},#{remark},#{isFinish})")
  83 + void addGrade(@Param("name") String name, @Param("addTime") String addTime, @Param("status") int status, @Param("userId") String userId,
  84 + @Param("schoolId") int schoolId, @Param("shortName") String shortName, @Param("schoolYear") int schoolYear,@Param("year") int year, @Param("remark") String remark, @Param("isFinish") int isFinish);
79 85 //
80   - @Select("select Top(1)subject_id from SZ_Subject where subject_name =(select subject_name from SZ_Subject where school_id = 1021 and subject_id = #{subject_id}) and school_id = 885")
81   - String getSubjectId(@Param("subject_id")int subject_id);
  86 + @Select("select * from HS_ResBook where SchoolId = 350")
  87 + List<HS_ResBook> getHSResBook();
  88 +
  89 + @Insert(" insert into HS_ResBook values (#{name},#{addTime},#{status},#{userId},#{schoolId},#{press},#{pressTimes},#{price})")
  90 + void addHSResBook(@Param("name") String name,@Param("addTime") String addTime, @Param("status")String status,@Param("userId") String userId, @Param("schoolId")String schoolId, @Param("press")String press,
  91 + @Param("pressTimes") String pressTimes,@Param("price") String price);
  92 +
  93 + @Select("select * from SZ_Subject where school_id =350 and Status = 1")
  94 + List<SubjectBean> getSubjects();
  95 +
  96 + @Insert("insert into SZ_Subject values(#{school_id},#{subject_name},#{intime},#{subId},#{isElective},#{status},#{typeId},#{maxPerson},#{shortName})")
  97 + void addSubjectbean( @Param("school_id") int school_id, @Param("subject_name") String subject_name,@Param("intime") String intime,
  98 + @Param("subId") int subId, @Param("isElective") int isElective, @Param("status") int status, @Param("typeId") int typeId, @Param("maxPerson") int maxPerson, @Param("shortName") String shortName);
  99 +
  100 + @Select("select Top(1)subject_id from SZ_Subject where subject_name = #{subject_name} and school_id = 349")
  101 + String getSubjectId(@Param("subject_name")String subject_name);
  102 +
  103 + @Select("select Top(1) subject_name from SZ_Subject where subject_id = #{subject_id} and school_id = 350")
  104 + String getSubjectName(@Param("subject_id")int subject_id);
  105 +
  106 + @Select("select Top(1) name from HS_ResBook where SchoolId = 350 and id = #{id}")
  107 + String getBookName(@Param("id") int bookId);
  108 +
  109 + @Select("select Top(1) id from HS_ResBook where SchoolId = 349 and name = #{name}")
  110 + int getBookId(@Param("name") String bookName);
  111 +
  112 + @Select("select id from HS_ResBookVersion where SchoolId = #{SchoolId}")
  113 + List<String> getbookversionId(@Param("SchoolId")String SchoolId);
  114 +
  115 + @Select("select * from HS_ResChapter where SchoolId = 350")
  116 + List<HS_ResChapter> getChapters();
  117 +
82 118 //
  119 + @Select(" select * from HS_ResBookVersion where SchoolId = 350")
  120 + List<HS_ResBookVersion> getResBookVersion();
  121 +
  122 + @Insert("insert into HS_ResBookVersion values(#{bookId},#{gradeId},#{subjectId},#{isUse},#{state},#{intime},#{schoolId})")
  123 + void addResBookVersion(@Param("bookId") int bookId, @Param("gradeId")int gradeId,@Param("subjectId") int subjectId,@Param("isUse") int isUse, @Param("state")int state,
  124 + @Param("intime")String intime,@Param("schoolId") int schoolId);
  125 +
  126 + @Insert("insert into HS_ResChapter values(#{name},#{subjectId},#{gradeId},#{pid},#{jiaoCaiId},#{bookVersionId},#{sort},#{type},#{addTime},#{status},#{userId},#{schoolId})")
  127 + void addChapter(@Param("name") String name, @Param("subjectId")int subjectId, @Param("gradeId")int gradeId, @Param("pid")int pid, @Param("jiaoCaiId")int jiaoCaiId, @Param("bookVersionId")int bookVersionId,
  128 + @Param("sort")int sort, @Param("type")int type,@Param("addTime") String addTime,@Param("status") int status,@Param("userId") String userId, @Param("schoolId")int schoolId);
  129 +
  130 + @Select("Select Top(1)name from HS_ResChapter where id = #{pid} ")
  131 + String getChapterName(@Param("pid") int pid);
  132 +
  133 + @Select(" Select Top(1)id from HS_ResChapter where name=#{name} and SchoolId = 349")
  134 + String getChapterId(@Param("name") String name);
  135 +
  136 + @Update("update HS_ResChapter set Pid = #{pid} where SchoolId = 349 and userId = #{userId} and name = #{name}")
  137 + void updateChapter(@Param("userId") String userId, @Param("name") String name, @Param("pid") String chapterId);
  138 +
83 139 @Select("select id from HS_ResBook where SchoolId = 885 and name =(select name from HS_ResBook where SchoolId = 1021 and Id = #{id})")
84 140 String getJiaoCaiId(@Param("id")int id);
85 141  
... ... @@ -117,4 +173,5 @@ public interface UserDao {
117 173  
118 174 @Insert("insert into HS_ResRalation (FileId,AddTime,UserId) values (#{FileId},#{AddTime},#{userId})")
119 175 void addRelation(@Param("FileId") String id, @Param("AddTime") String time, @Param("userId") String userId);
  176 +
120 177 }
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/utils/CompressPic.java
... ... @@ -16,7 +16,7 @@ import java.io.InputStream;
16 16 public class CompressPic {
17 17  
18 18 public static String CompressPic(String srcPath, String targetPath) throws Exception {
19   - double cutPercent = 0.1;
  19 + double cutPercent = 0.5;
20 20 File file = new File(srcPath.trim());
21 21 FileInputStream fileInputStreamSrc = new FileInputStream(file);
22 22 BufferedImage bufferedImage = ImageIO.read(fileInputStreamSrc);
... ...
cloud/haikangface/src/test/java/com/sincere/haikangface/HaikangfaceApplicationTests.java
1 1 package com.sincere.haikangface;
2 2  
3   -import com.sincere.haikangface.bean.AttendanceBean;
4   -import com.sincere.haikangface.bean.FileBean;
5   -import com.sincere.haikangface.bean.SendRecordBean;
6   -import com.sincere.haikangface.bean.StudentBean;
  3 +import com.sincere.haikangface.bean.*;
7 4 import com.sincere.haikangface.dao.DeviceDao;
8 5 import com.sincere.haikangface.dao.UserDao;
9 6 import com.sincere.haikangface.xiananDao.SendRecordDao;
... ... @@ -88,48 +85,98 @@ public class HaikangfaceApplicationTests {
88 85  
89 86 @Test
90 87 public void send() {
  88 + /* List<HSGrade> gradeList = userDao.getGrades();
91 89  
92   - /*List<SendRecordBean> sendRecordBeans = sendRecordDao.getSenSuccesss("luzx01","1066");
93   - List<StudentBean> studentBeans = userDao.getAllStuWithSchoolId("1066");
94   - List<SendRecordBean> studentBeanList = new ArrayList<>();
95   - for (int i = 0; i < sendRecordBeans.size(); i++) {
96   - SendRecordBean sendRecordBean = sendRecordBeans.get(i);
97   -
98   - boolean isHas = false;
99   - for (int j = 0; j < studentBeans.size(); j++) {
100   - if (sendRecordBean.getCustomerid().equals(studentBeans.get(j).getStudent_id())){
101   - isHas = true;
102   - break;
103   - }
104   - }
  90 + for (int i = 0; i < gradeList.size(); i++) {
  91 + HSGrade hsGrade = gradeList.get(i);
  92 + hsGrade.setUserId("zy205616");
  93 + hsGrade.setSchoolId(349);
  94 + userDao.addGrade(hsGrade.getName(), hsGrade.getAddTime(), hsGrade.getStatus(), hsGrade.getUserId(), hsGrade.getSchoolId(), hsGrade.getShortName(), hsGrade.getSchoolYear(), hsGrade.getYear(), hsGrade.getRemark(), hsGrade.getIsFinish());
  95 + }*/
105 96  
106   - if (!isHas){
107   - studentBeanList.add(sendRecordBean);
108   - }
  97 + /*List<HS_ResBook> hs_resBookList = userDao.getHSResBook();
  98 + for (int i = 0; i < hs_resBookList.size(); i++) {
  99 + HS_ResBook hs_resBook = hs_resBookList.get(i);
  100 + hs_resBook.setUserId("zy205616");
  101 + hs_resBook.setSchoolId("349");
  102 + userDao.addHSResBook(hs_resBook.getName(), hs_resBook.getAddTime(), hs_resBook.getStatus(), hs_resBook.getUserId(), hs_resBook.getSchoolId(), hs_resBook.getPress(), hs_resBook.getPressTimes(), hs_resBook.getPrice());
  103 + }*/
109 104  
110   - }
  105 + /*List<SubjectBean> subjectBeans = userDao.getSubjects();
111 106  
112   - System.out.println("studentBeanList:"+studentBeanList.size());*/
113   - /* List<AttendanceBean> attendanceBeans = deviceDao.selectDeviceWithschool_id("18", "1066");
  107 + for (int i = 0; i < subjectBeans.size(); i++) {
  108 + SubjectBean subjectBean = subjectBeans.get(i);
  109 + subjectBean.setSchool_id(349);
  110 + userDao.addSubjectbean(subjectBean.getSchool_id(),subjectBean.getSubject_name(),subjectBean.getIntime(),subjectBean.getSubId(),
  111 + subjectBean.getIsElective(),subjectBean.getStatus(),subjectBean.getTypeId(),subjectBean.getMaxPerson(),subjectBean.getShortName());
  112 + }*/
114 113  
115   - List<StudentBean> studentBeans = userDao.getAllStudentsWithSchoolId("1066");
  114 + /* List<HS_ResBookVersion> hs_resBookVersions = userDao.getResBookVersion();
116 115  
117   - RestTemplate restTemplate = new RestTemplate();
118   - int index = 0;
  116 + for (int i = 0; i < hs_resBookVersions.size(); i++) {
  117 + HS_ResBookVersion hs_resBookVersion = hs_resBookVersions.get(i);
  118 +
  119 + hs_resBookVersion.setSchoolId(349);
  120 + String gradeName = userDao.getGradeName(hs_resBookVersion.getGradeId() + "");
  121 + hs_resBookVersion.setGradeId(Integer.parseInt(userDao.getGradeId(gradeName)));
  122 +
  123 + String subjectName = userDao.getSubjectName(hs_resBookVersion.getSubjectId());
  124 + hs_resBookVersion.setSubjectId(Integer.parseInt(userDao.getSubjectId(subjectName)));
  125 +
  126 + String bookName = userDao.getBookName(hs_resBookVersion.getBookId());
  127 + hs_resBookVersion.setBookId(userDao.getBookId(bookName));
119 128  
120   - for (int j = 0; j < attendanceBeans.size(); j++) {
121   - String filePath = "E:\\wwwhtdocs\\SmartCampus\\face17e50\\School1066\\Student\\20191025.jpg";
122   - String deviceId = attendanceBeans.get(j).getClint_id();
123   - String url = String.format("http://114.55.30.100:8089/facereco/sendStuCardAndImg?card=%s&deviceId=%s&endTime=%s&filePath=%s&name=%s&userType=%s&validTimeEnabled=%s&startTime=%s"
124   - , "34D6D9FB", deviceId, "2023-10-01 10:00:00", filePath, "ping", "2", "1", "2019-10-01 10:00:00");
125   - String result1 = restTemplate.getForObject(url, String.class);
126   - System.out.println("下发人脸:" + result1 + " " + url + " idnex:" + index);
  129 + userDao.addResBookVersion(hs_resBookVersion.getBookId(), hs_resBookVersion.getGradeId(), hs_resBookVersion.getSubjectId(), hs_resBookVersion.getIsUse(), hs_resBookVersion.getState(), hs_resBookVersion.getIntime(), hs_resBookVersion.getSchoolId());
  130 +
  131 + }*/
  132 +
  133 + /* List<HS_ResChapter> hs_resChapters = userDao.getChapters();
  134 +
  135 + List<String> ver1 = userDao.getbookversionId("349");
  136 + List<String> ver2 = userDao.getbookversionId("350");
  137 + System.out.println(ver1.toString()+ " ------- "+ver2.toString());
  138 + for (int i = 0; i < hs_resChapters.size(); i++) {
  139 + HS_ResChapter hs_resChapter = hs_resChapters.get(i);
  140 + int position = index(hs_resChapter.getBookVersionId()+"",ver2);
  141 + System.out.println("position:"+position+" name:"+hs_resChapter.getName()+" bookid:"+hs_resChapter.getBookVersionId());
  142 + if (position!=-1){
  143 + String bookversionId = ver1.get(position);
  144 + hs_resChapter.setBookVersionId(Integer.parseInt(bookversionId));
  145 + hs_resChapter.setUserId("zy205616");
  146 + hs_resChapter.setSchoolId(349);
  147 +
  148 + userDao.addChapter(hs_resChapter.getName(),hs_resChapter.getSubjectId(),hs_resChapter.getGradeId(),hs_resChapter.getPid(),
  149 + hs_resChapter.getJiaoCaiId(),hs_resChapter.getBookVersionId(),hs_resChapter.getSort(),hs_resChapter.getType(),
  150 + hs_resChapter.getAddTime(),hs_resChapter.getStatus(),hs_resChapter.getUserId(),hs_resChapter.getSchoolId());
  151 + }
  152 + }*/
  153 +
  154 + /*List<HS_ResChapter> hs_resChapters = userDao.getChapters();
  155 +
  156 + for (int i = 0; i < hs_resChapters.size(); i++) {
  157 + HS_ResChapter hs_resChapter = hs_resChapters.get(i);
  158 + if (hs_resChapter.getPid()!=0){
  159 + System.out.println("hs_resChapter:"+hs_resChapter.getName());
  160 + String chaname = userDao.getChapterName(hs_resChapter.getPid());
  161 + String chapterId = userDao.getChapterId(chaname);//349的章节主目录
  162 + hs_resChapter.setUserId("zy205616");
  163 + hs_resChapter.setSchoolId(349);
  164 + userDao.updateChapter(hs_resChapter.getUserId(),hs_resChapter.getName(),chapterId);
  165 + }
127 166 }*/
  167 +
  168 + }
  169 +
  170 + private int index(String content,List<String> list){
  171 + for (int i = 0; i < list.size(); i++) {
  172 + if (list.get(i).trim().equals(content.trim()))return i;
  173 + }
  174 + return -1;
128 175 }
129 176  
130 177 @Test
131   - public void fileRes(){
132   - File file = new File("C:\\TaoHandong\\copy\\zhiwen\\21_指纹签到.txt");
  178 + public void fileRes() {
  179 + /*File file = new File("C:\\TaoHandong\\copy\\zhiwen\\21_指纹签到.txt");
133 180  
134 181 try {
135 182 BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
... ... @@ -145,7 +192,7 @@ public class HaikangfaceApplicationTests {
145 192 e.printStackTrace();
146 193 } catch (IOException e) {
147 194 e.printStackTrace();
148   - }
  195 + }*/
149 196  
150 197  
151 198 // List<FileBean> fileBeans = userDao.getFileRes();
... ...