Commit 5efb4092db6d284d3ad5349407076b2757de1eae

Authored by 陈杰
1 parent d2f34f58
Exists in master and in 1 other branch cloud_copy

微耕服务 嵌入分布式

Showing 116 changed files with 5149 additions and 2806 deletions   Show diff stats

Too many changes.

To preserve performance only 100 of 116 files displayed.

cloud/autho/pom.xml
@@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
6 <groupId>com.sincere</groupId> 6 <groupId>com.sincere</groupId>
7 <artifactId>cloud</artifactId> 7 <artifactId>cloud</artifactId>
8 <version>1.0.0</version> 8 <version>1.0.0</version>
9 - <relativePath/> <!-- lookup parent from repository -->  
10 </parent> 9 </parent>
11 <groupId>com.sincere</groupId> 10 <groupId>com.sincere</groupId>
12 <artifactId>autho</artifactId> 11 <artifactId>autho</artifactId>
cloud/common/libs/sqljdbc4-4.2-6.jar
No preview for this file type
cloud/common/pom.xml
@@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
6 <groupId>com.sincere</groupId> 6 <groupId>com.sincere</groupId>
7 <artifactId>cloud</artifactId> 7 <artifactId>cloud</artifactId>
8 <version>1.0.0</version> 8 <version>1.0.0</version>
9 - <relativePath/> <!-- lookup parent from repository -->  
10 </parent> 9 </parent>
11 <groupId>com.sincere</groupId> 10 <groupId>com.sincere</groupId>
12 <artifactId>common</artifactId> 11 <artifactId>common</artifactId>
@@ -20,71 +19,27 @@ @@ -20,71 +19,27 @@
20 19
21 <dependencies> 20 <dependencies>
22 <dependency> 21 <dependency>
23 - <groupId>org.springframework.boot</groupId>  
24 - <artifactId>spring-boot-starter</artifactId>  
25 - </dependency>  
26 -  
27 - <dependency>  
28 - <groupId>org.springframework.boot</groupId>  
29 - <artifactId>spring-boot-starter-test</artifactId>  
30 - <scope>test</scope>  
31 - </dependency>  
32 -  
33 - <dependency>  
34 - <groupId>com.microsoft.sqlserver.jdbc</groupId>  
35 - <artifactId>sqljdbc</artifactId>  
36 - <scope>system</scope>  
37 - <version>1</version>  
38 - <systemPath>${project.basedir}/libs/sqljdbc4-4.2-6.jar</systemPath>  
39 - </dependency>  
40 -  
41 -  
42 - <dependency>  
43 - <groupId>org.springframework.boot</groupId>  
44 - <artifactId>spring-boot</artifactId>  
45 - </dependency>  
46 - <dependency>  
47 - <groupId>com.baomidou</groupId>  
48 - <artifactId>mybatis-plus-core</artifactId>  
49 - <version>3.0.1</version>  
50 - <scope>compile</scope>  
51 - </dependency>  
52 -  
53 - <dependency>  
54 - <groupId>com.baomidou</groupId>  
55 - <artifactId>mybatis-plus-extension</artifactId>  
56 - <version>3.0.1</version>  
57 - <scope>compile</scope>  
58 - </dependency>  
59 -  
60 - <dependency>  
61 <groupId>org.apache.tomcat.embed</groupId> 22 <groupId>org.apache.tomcat.embed</groupId>
62 <artifactId>tomcat-embed-core</artifactId> 23 <artifactId>tomcat-embed-core</artifactId>
63 </dependency> 24 </dependency>
64 -  
65 <dependency> 25 <dependency>
66 <groupId>io.jsonwebtoken</groupId> 26 <groupId>io.jsonwebtoken</groupId>
67 <artifactId>jjwt</artifactId> 27 <artifactId>jjwt</artifactId>
68 <version>0.9.0</version> 28 <version>0.9.0</version>
69 </dependency> 29 </dependency>
70 -  
71 <dependency> 30 <dependency>
72 <groupId>org.springframework.security</groupId> 31 <groupId>org.springframework.security</groupId>
73 <artifactId>spring-security-core</artifactId> 32 <artifactId>spring-security-core</artifactId>
74 </dependency> 33 </dependency>
75 -  
76 <dependency> 34 <dependency>
77 <groupId>org.projectlombok</groupId> 35 <groupId>org.projectlombok</groupId>
78 <artifactId>lombok</artifactId> 36 <artifactId>lombok</artifactId>
79 </dependency> 37 </dependency>
80 -  
81 -  
82 <dependency> 38 <dependency>
83 <groupId>commons-collections</groupId> 39 <groupId>commons-collections</groupId>
84 <artifactId>commons-collections</artifactId> 40 <artifactId>commons-collections</artifactId>
85 <version>3.2.2</version> 41 <version>3.2.2</version>
86 </dependency> 42 </dependency>
87 -  
88 </dependencies> 43 </dependencies>
89 44
90 <build> 45 <build>
cloud/common/src/main/java/com/sincere/common/CommonApplication.java
@@ -1,13 +0,0 @@ @@ -1,13 +0,0 @@
1 -package com.sincere.common;  
2 -  
3 -import org.springframework.boot.SpringApplication;  
4 -import org.springframework.boot.autoconfigure.SpringBootApplication;  
5 -  
6 -@SpringBootApplication  
7 -public class CommonApplication {  
8 -  
9 - public static void main(String[] args) {  
10 - SpringApplication.run(CommonApplication.class, args);  
11 - }  
12 -  
13 -}  
cloud/common/src/main/java/com/sincere/common/commons/Result.java
1 -package com.sincere.common.commons;  
2 -  
3 -import lombok.AllArgsConstructor;  
4 -import lombok.Data;  
5 -import lombok.NoArgsConstructor;  
6 -  
7 -import java.io.Serializable;  
8 -  
9 -/**  
10 - * @Author: [zhangzhiguang]  
11 - * @Date: [2018-08-01 23:39]  
12 - * @Description: [ ]  
13 - * @Version: [1.0.0]  
14 - * @Copy: [com.zzg]  
15 - */  
16 -@Data  
17 -@NoArgsConstructor  
18 -@AllArgsConstructor  
19 -public class Result<T> implements Serializable {  
20 -  
21 - private T datas;  
22 - private Integer resp_code;  
23 - private String resp_msg;  
24 -  
25 - public static <T> Result<T> succeed(String msg) {  
26 - return succeedWith(null, CodeEnum.SUCCESS.getCode(),msg);  
27 - }  
28 -  
29 - public static <T> Result<T> succeed(T model, String msg) {  
30 - return succeedWith(model, CodeEnum.SUCCESS.getCode(),msg);  
31 - }  
32 -  
33 - public static <T> Result<T> succeedWith(T datas, Integer code,String msg) {  
34 - return new Result<T>(datas, code, msg);  
35 - }  
36 -  
37 - public static <T> Result<T> failed(String msg) {  
38 - return failedWith(null, CodeEnum.ERROR.getCode(), msg);  
39 - }  
40 -  
41 - public static <T> Result<T> failed(T model,String msg) {  
42 - return failedWith(model, CodeEnum.ERROR.getCode(), msg);  
43 - }  
44 -  
45 - public static <T> Result<T> failedWith(T datas, Integer code, String msg) {  
46 - return new Result<T>( datas, code, msg);  
47 - }  
48 -  
49 -} 1 +//package com.sincere.common.commons;
  2 +//
  3 +//import lombok.AllArgsConstructor;
  4 +//import lombok.Data;
  5 +//import lombok.NoArgsConstructor;
  6 +//
  7 +//import java.io.Serializable;
  8 +//
  9 +///**
  10 +// * @Author: [zhangzhiguang]
  11 +// * @Date: [2018-08-01 23:39]
  12 +// * @Description: [ ]
  13 +// * @Version: [1.0.0]
  14 +// * @Copy: [com.zzg]
  15 +// */
  16 +//@Data
  17 +//@NoArgsConstructor
  18 +//@AllArgsConstructor
  19 +//public class Result<T> implements Serializable {
  20 +//
  21 +// private T datas;
  22 +// private Integer resp_code;
  23 +// private String resp_msg;
  24 +//
  25 +// public static <T> Result<T> succeed(String msg) {
  26 +// return succeedWith(null, CodeEnum.SUCCESS.getCode(),msg);
  27 +// }
  28 +//
  29 +// public static <T> Result<T> succeed(T model, String msg) {
  30 +// return succeedWith(model, CodeEnum.SUCCESS.getCode(),msg);
  31 +// }
  32 +//
  33 +// public static <T> Result<T> succeedWith(T datas, Integer code,String msg) {
  34 +// return new Result<T>(datas, code, msg);
  35 +// }
  36 +//
  37 +// public static <T> Result<T> failed(String msg) {
  38 +// return failedWith(null, CodeEnum.ERROR.getCode(), msg);
  39 +// }
  40 +//
  41 +// public static <T> Result<T> failed(T model,String msg) {
  42 +// return failedWith(model, CodeEnum.ERROR.getCode(), msg);
  43 +// }
  44 +//
  45 +// public static <T> Result<T> failedWith(T datas, Integer code, String msg) {
  46 +// return new Result<T>( datas, code, msg);
  47 +// }
  48 +//
  49 +//}
cloud/common/src/main/java/com/sincere/common/config/DataSourceHolder.java
@@ -1,25 +0,0 @@ @@ -1,25 +0,0 @@
1 -package com.sincere.common.config;  
2 -  
3 -  
4 -/**  
5 - * 用于数据源切换  
6 - *  
7 - */  
8 -public class DataSourceHolder {  
9 -  
10 - private static final ThreadLocal<DataSourceKey> dataSourceKey = new ThreadLocal<>();  
11 -  
12 - public static DataSourceKey getDataSourceKey() {  
13 - return dataSourceKey.get();  
14 - }  
15 -  
16 - public static void setDataSourceKey(DataSourceKey type) {  
17 - dataSourceKey.set(type);  
18 - }  
19 -  
20 - public static void clearDataSourceKey() {  
21 - dataSourceKey.remove();  
22 - }  
23 -  
24 -  
25 -}  
26 \ No newline at end of file 0 \ No newline at end of file
cloud/common/src/main/java/com/sincere/common/config/DataSourceKey.java
@@ -1,11 +0,0 @@ @@ -1,11 +0,0 @@
1 -package com.sincere.common.config;  
2 -  
3 -/**  
4 - * 数据源定义  
5 - *  
6 - * @author owen  
7 - * @create 2017年7月2日  
8 - */  
9 -public enum DataSourceKey {  
10 - core, log ,sharding  
11 -}  
12 \ No newline at end of file 0 \ No newline at end of file
cloud/common/src/main/java/com/sincere/common/dto/smartCampus/SchoolDto.java 0 → 100644
@@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
  1 +package com.sincere.common.dto.smartCampus;
  2 +
  3 +import java.io.Serializable;
  4 +
  5 +/**
  6 + * @author chen
  7 + * @version 1.0
  8 + * @date 2019/11/12 0012 9:06
  9 + */
  10 +public class SchoolDto implements Serializable {
  11 +
  12 + private int schoolId ;
  13 + private String schoolName ;
  14 +
  15 + public int getSchoolId() {
  16 + return schoolId;
  17 + }
  18 +
  19 + public void setSchoolId(int schoolId) {
  20 + this.schoolId = schoolId;
  21 + }
  22 +
  23 + public String getSchoolName() {
  24 + return schoolName;
  25 + }
  26 +
  27 + public void setSchoolName(String schoolName) {
  28 + this.schoolName = schoolName;
  29 + }
  30 +
  31 +}
cloud/common/src/main/java/com/sincere/common/dto/smartCampus/StudentCardDto.java 0 → 100644
@@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
  1 +package com.sincere.common.dto.smartCampus;
  2 +
  3 +import java.io.Serializable;
  4 +
  5 +/**
  6 + * @author chen
  7 + * @version 1.0
  8 + * @date 2019/11/12 0012 9:33
  9 + */
  10 +public class StudentCardDto implements Serializable {
  11 +
  12 + private String cardType ;
  13 + private String cardNum ;
  14 +
  15 + public String getCardType() {
  16 + return cardType;
  17 + }
  18 +
  19 + public void setCardType(String cardType) {
  20 + this.cardType = cardType;
  21 + }
  22 +
  23 + public String getCardNum() {
  24 + return cardNum;
  25 + }
  26 +
  27 + public void setCardNum(String cardNum) {
  28 + this.cardNum = cardNum;
  29 + }
  30 +
  31 +}
cloud/common/src/main/java/com/sincere/common/dto/smartCampus/UpdateCardDto.java 0 → 100644
@@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
  1 +package com.sincere.common.dto.smartCampus;
  2 +
  3 +import java.io.Serializable;
  4 +
  5 +/**
  6 + * @author chen
  7 + * @version 1.0
  8 + * @date 2019/11/12 0012 9:31
  9 + */
  10 +public class UpdateCardDto implements Serializable {
  11 +
  12 + private int id ;
  13 + private int userType ;
  14 + private String oldCard ;
  15 +
  16 + public int getId() {
  17 + return id;
  18 + }
  19 +
  20 + public void setId(int id) {
  21 + this.id = id;
  22 + }
  23 +
  24 + public int getUserType() {
  25 + return userType;
  26 + }
  27 +
  28 + public void setUserType(int userType) {
  29 + this.userType = userType;
  30 + }
  31 +
  32 + public String getOldCard() {
  33 + return oldCard;
  34 + }
  35 +
  36 + public void setOldCard(String oldCard) {
  37 + this.oldCard = oldCard;
  38 + }
  39 +}
cloud/common/src/main/java/com/sincere/common/dto/smartCampus/UserDto.java 0 → 100644
@@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
  1 +package com.sincere.common.dto.smartCampus;
  2 +
  3 +import java.io.Serializable;
  4 +
  5 +/**
  6 + * @author chen
  7 + * @version 1.0
  8 + * @date 2019/11/12 0012 9:28
  9 + */
  10 +public class UserDto implements Serializable {
  11 +
  12 + private int schoolId;
  13 + private int classId ;
  14 + private String name ;
  15 + private int studentId ;
  16 +
  17 + public int getSchoolId() {
  18 + return schoolId;
  19 + }
  20 +
  21 + public void setSchoolId(int schoolId) {
  22 + this.schoolId = schoolId;
  23 + }
  24 +
  25 + public int getClassId() {
  26 + return classId;
  27 + }
  28 +
  29 + public void setClassId(int classId) {
  30 + this.classId = classId;
  31 + }
  32 +
  33 + public String getName() {
  34 + return name;
  35 + }
  36 +
  37 + public void setName(String name) {
  38 + this.name = name;
  39 + }
  40 +
  41 + public int getStudentId() {
  42 + return studentId;
  43 + }
  44 +
  45 + public void setStudentId(int studentId) {
  46 + this.studentId = studentId;
  47 + }
  48 +}
cloud/common/src/main/java/com/sincere/common/dto/xiaoan/CheckInDto.java 0 → 100644
@@ -0,0 +1,59 @@ @@ -0,0 +1,59 @@
  1 +package com.sincere.common.dto.xiaoan;
  2 +
  3 +import java.io.Serializable;
  4 +
  5 +/**
  6 + * @author chen
  7 + * @version 1.0
  8 + * @date 2019/11/12 0012 9:40
  9 + */
  10 +public class CheckInDto implements Serializable {
  11 +
  12 + private String deviceId ;
  13 + private String cardNo ;
  14 + private int funNo ;
  15 + private int flag ;
  16 + private String checkTime ;
  17 +
  18 +
  19 + public String getDeviceId() {
  20 + return deviceId;
  21 + }
  22 +
  23 + public void setDeviceId(String deviceId) {
  24 + this.deviceId = deviceId;
  25 + }
  26 +
  27 + public String getCardNo() {
  28 + return cardNo;
  29 + }
  30 +
  31 + public void setCardNo(String cardNo) {
  32 + this.cardNo = cardNo;
  33 + }
  34 +
  35 + public int getFlag() {
  36 + return flag;
  37 + }
  38 +
  39 + public void setFlag(int flag) {
  40 + this.flag = flag;
  41 + }
  42 +
  43 + public String getCheckTime() {
  44 + return checkTime;
  45 + }
  46 +
  47 + public void setCheckTime(String checkTime) {
  48 + this.checkTime = checkTime;
  49 + }
  50 +
  51 +
  52 + public int getFunNo() {
  53 + return funNo;
  54 + }
  55 +
  56 + public void setFunNo(int funNo) {
  57 + this.funNo = funNo;
  58 + }
  59 +}
cloud/common/src/main/java/com/sincere/common/dto/xiaoan/CheckOutDto.java 0 → 100644
@@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
  1 +package com.sincere.common.dto.xiaoan;
  2 +
  3 +import java.io.Serializable;
  4 +
  5 +/**
  6 + * @author chen
  7 + * @version 1.0
  8 + * @date 2019/11/12 0012 13:36
  9 + */
  10 +public class CheckOutDto implements Serializable {
  11 +
  12 + private String out;
  13 + private int isSuccess ;
  14 +
  15 + public String getOut() {
  16 + return out;
  17 + }
  18 +
  19 + public void setOut(String out) {
  20 + this.out = out;
  21 + }
  22 +
  23 + public int getIsSuccess() {
  24 + return isSuccess;
  25 + }
  26 +
  27 + public void setIsSuccess(int isSuccess) {
  28 + this.isSuccess = isSuccess;
  29 + }
  30 +}
cloud/common/src/main/java/com/sincere/common/dto/xiaoan/PassFailDto.java 0 → 100644
@@ -0,0 +1,76 @@ @@ -0,0 +1,76 @@
  1 +package com.sincere.common.dto.xiaoan;
  2 +
  3 +import java.io.Serializable;
  4 +import java.util.Date;
  5 +
  6 +/**
  7 + * @author chen
  8 + * @version 1.0
  9 + * @date 2019/11/12 0012 10:03
  10 + */
  11 +public class PassFailDto implements Serializable {
  12 +
  13 + private String cardNum ;
  14 + private String deviceId ;
  15 + private String direction ;
  16 + private String resultIntro ;
  17 + private Date createTime ;
  18 + private int schoolId ;
  19 + private Date inTime ;
  20 +
  21 + public String getCardNum() {
  22 + return cardNum;
  23 + }
  24 +
  25 + public void setCardNum(String cardNum) {
  26 + this.cardNum = cardNum;
  27 + }
  28 +
  29 + public String getDeviceId() {
  30 + return deviceId;
  31 + }
  32 +
  33 + public void setDeviceId(String deviceId) {
  34 + this.deviceId = deviceId;
  35 + }
  36 +
  37 + public String getDirection() {
  38 + return direction;
  39 + }
  40 +
  41 + public void setDirection(String direction) {
  42 + this.direction = direction;
  43 + }
  44 +
  45 + public String getResultIntro() {
  46 + return resultIntro;
  47 + }
  48 +
  49 + public void setResultIntro(String resultIntro) {
  50 + this.resultIntro = resultIntro;
  51 + }
  52 +
  53 + public Date getCreateTime() {
  54 + return createTime;
  55 + }
  56 +
  57 + public void setCreateTime(Date createTime) {
  58 + this.createTime = createTime;
  59 + }
  60 +
  61 + public int getSchoolId() {
  62 + return schoolId;
  63 + }
  64 +
  65 + public void setSchoolId(int schoolId) {
  66 + this.schoolId = schoolId;
  67 + }
  68 +
  69 + public Date getInTime() {
  70 + return inTime;
  71 + }
  72 +
  73 + public void setInTime(Date inTime) {
  74 + this.inTime = inTime;
  75 + }
  76 +}
cloud/common/src/main/java/com/sincere/common/dto/xiaoan/SendFailDto.java 0 → 100644
@@ -0,0 +1,215 @@ @@ -0,0 +1,215 @@
  1 +package com.sincere.common.dto.xiaoan;
  2 +
  3 +import com.sincere.common.dto.smartCampus.SchoolDto;
  4 +import com.sincere.common.dto.smartCampus.StudentCardDto;
  5 +import com.sincere.common.dto.smartCampus.UpdateCardDto;
  6 +import com.sincere.common.dto.smartCampus.UserDto;
  7 +
  8 +import java.io.Serializable;
  9 +import java.util.Date;
  10 +
  11 +/**
  12 + * @author chen
  13 + * @version 1.0
  14 + * @date 2019/11/12 0012 10:12
  15 + */
  16 +public class SendFailDto implements Serializable {
  17 +
  18 + private String deviceId ;
  19 + private String cardNum ;
  20 + private String oldCardNum ;
  21 + private String cardType ;
  22 + private int customerId ;
  23 + private int userType ;
  24 + private int classId ;
  25 + private String schoolName ;
  26 + private int studentType ;
  27 + private int openFlag ;
  28 + private int status ;
  29 + private int updateId ;
  30 + private Date createTime ;
  31 + private int sex ;
  32 + private String name ;
  33 + private int failType ;
  34 + private String failContent ;
  35 + private int schoolId ;
  36 + private int shiduan ;
  37 +
  38 + public SendFailDto() {
  39 + }
  40 +
  41 + public SendFailDto(UserDto user , SchoolDto school , StudentCardDto studentCard , UpdateCardDto updateCard) {
  42 + if(updateCard != null){
  43 + oldCardNum = updateCard.getOldCard();
  44 + userType = updateCard.getUserType() ;
  45 + }
  46 + if(studentCard != null){
  47 + cardType = studentCard.getCardType();
  48 + }
  49 + if(user != null){
  50 + customerId = user.getStudentId();
  51 + classId = user.getClassId();
  52 + schoolId = user.getSchoolId();
  53 + name = user.getName();
  54 + }
  55 + if(school != null){
  56 + schoolName = school.getSchoolName();
  57 + }
  58 + createTime = new Date();
  59 + studentType =1 ;
  60 + sex = 1;
  61 + }
  62 +
  63 +
  64 + public String getDeviceId() {
  65 + return deviceId;
  66 + }
  67 +
  68 + public void setDeviceId(String deviceId) {
  69 + this.deviceId = deviceId;
  70 + }
  71 +
  72 + public String getCardNum() {
  73 + return cardNum;
  74 + }
  75 +
  76 + public void setCardNum(String cardNum) {
  77 + this.cardNum = cardNum;
  78 + }
  79 +
  80 + public String getOldCardNum() {
  81 + return oldCardNum;
  82 + }
  83 +
  84 + public void setOldCardNum(String oldCardNum) {
  85 + this.oldCardNum = oldCardNum;
  86 + }
  87 +
  88 + public String getCardType() {
  89 + return cardType;
  90 + }
  91 +
  92 + public void setCardType(String cardType) {
  93 + this.cardType = cardType;
  94 + }
  95 +
  96 + public int getCustomerId() {
  97 + return customerId;
  98 + }
  99 +
  100 + public void setCustomerId(int customerId) {
  101 + this.customerId = customerId;
  102 + }
  103 +
  104 + public int getUserType() {
  105 + return userType;
  106 + }
  107 +
  108 + public void setUserType(int userType) {
  109 + this.userType = userType;
  110 + }
  111 +
  112 + public int getClassId() {
  113 + return classId;
  114 + }
  115 +
  116 + public void setClassId(int classId) {
  117 + this.classId = classId;
  118 + }
  119 +
  120 + public String getSchoolName() {
  121 + return schoolName;
  122 + }
  123 +
  124 + public void setSchoolName(String schoolName) {
  125 + this.schoolName = schoolName;
  126 + }
  127 +
  128 + public int getStudentType() {
  129 + return studentType;
  130 + }
  131 +
  132 + public void setStudentType(int studentType) {
  133 + this.studentType = studentType;
  134 + }
  135 +
  136 + public int getOpenFlag() {
  137 + return openFlag;
  138 + }
  139 +
  140 + public void setOpenFlag(int openFlag) {
  141 + this.openFlag = openFlag;
  142 + }
  143 +
  144 + public int getStatus() {
  145 + return status;
  146 + }
  147 +
  148 + public void setStatus(int status) {
  149 + this.status = status;
  150 + }
  151 +
  152 + public int getUpdateId() {
  153 + return updateId;
  154 + }
  155 +
  156 + public void setUpdateId(int updateId) {
  157 + this.updateId = updateId;
  158 + }
  159 +
  160 + public Date getCreateTime() {
  161 + return createTime;
  162 + }
  163 +
  164 + public void setCreateTime(Date createTime) {
  165 + this.createTime = createTime;
  166 + }
  167 +
  168 + public int getSex() {
  169 + return sex;
  170 + }
  171 +
  172 + public void setSex(int sex) {
  173 + this.sex = sex;
  174 + }
  175 +
  176 + public String getName() {
  177 + return name;
  178 + }
  179 +
  180 + public void setName(String name) {
  181 + this.name = name;
  182 + }
  183 +
  184 + public int getFailType() {
  185 + return failType;
  186 + }
  187 +
  188 + public void setFailType(int failType) {
  189 + this.failType = failType;
  190 + }
  191 +
  192 + public String getFailContent() {
  193 + return failContent;
  194 + }
  195 +
  196 + public void setFailContent(String failContent) {
  197 + this.failContent = failContent;
  198 + }
  199 +
  200 + public int getSchoolId() {
  201 + return schoolId;
  202 + }
  203 +
  204 + public void setSchoolId(int schoolId) {
  205 + this.schoolId = schoolId;
  206 + }
  207 +
  208 + public int getShiduan() {
  209 + return shiduan;
  210 + }
  211 +
  212 + public void setShiduan(int shiduan) {
  213 + this.shiduan = shiduan;
  214 + }
  215 +}
cloud/common/src/main/java/com/sincere/common/dto/xiaoan/SendMessageDto.java 0 → 100644
@@ -0,0 +1,94 @@ @@ -0,0 +1,94 @@
  1 +package com.sincere.common.dto.xiaoan;
  2 +
  3 +import java.io.Serializable;
  4 +import java.util.Date;
  5 +
  6 +/**
  7 + * @author chen
  8 + * @version 1.0
  9 + * @date 2019/11/12 0012 9:37
  10 + */
  11 +public class SendMessageDto implements Serializable {
  12 +
  13 + private long id ;
  14 + private String deviceId ;
  15 + private String cardNo ;
  16 + private long index ;
  17 + private String send ;
  18 + private String result ;
  19 + private int correct ;
  20 + private Date createTime ;
  21 + private String functionId ;
  22 +
  23 + public long getId() {
  24 + return id;
  25 + }
  26 +
  27 + public void setId(long id) {
  28 + this.id = id;
  29 + }
  30 +
  31 + public String getDeviceId() {
  32 + return deviceId;
  33 + }
  34 +
  35 + public void setDeviceId(String deviceId) {
  36 + this.deviceId = deviceId;
  37 + }
  38 +
  39 + public String getCardNo() {
  40 + return cardNo;
  41 + }
  42 +
  43 + public void setCardNo(String cardNo) {
  44 + this.cardNo = cardNo;
  45 + }
  46 +
  47 + public long getIndex() {
  48 + return index;
  49 + }
  50 +
  51 + public void setIndex(long index) {
  52 + this.index = index;
  53 + }
  54 +
  55 + public String getSend() {
  56 + return send;
  57 + }
  58 +
  59 + public void setSend(String send) {
  60 + this.send = send;
  61 + }
  62 +
  63 + public String getResult() {
  64 + return result;
  65 + }
  66 +
  67 + public void setResult(String result) {
  68 + this.result = result;
  69 + }
  70 +
  71 + public int getCorrect() {
  72 + return correct;
  73 + }
  74 +
  75 + public void setCorrect(int correct) {
  76 + this.correct = correct;
  77 + }
  78 +
  79 + public Date getCreateTime() {
  80 + return createTime;
  81 + }
  82 +
  83 + public void setCreateTime(Date createTime) {
  84 + this.createTime = createTime;
  85 + }
  86 +
  87 + public String getFunctionId() {
  88 + return functionId;
  89 + }
  90 +
  91 + public void setFunctionId(String functionId) {
  92 + this.functionId = functionId;
  93 + }
  94 +}
cloud/common/src/main/java/com/sincere/common/dto/xiaoan/SendSuccessDto.java 0 → 100644
@@ -0,0 +1,196 @@ @@ -0,0 +1,196 @@
  1 +package com.sincere.common.dto.xiaoan;
  2 +
  3 +import com.sincere.common.dto.smartCampus.SchoolDto;
  4 +import com.sincere.common.dto.smartCampus.StudentCardDto;
  5 +import com.sincere.common.dto.smartCampus.UpdateCardDto;
  6 +import com.sincere.common.dto.smartCampus.UserDto;
  7 +
  8 +import java.io.Serializable;
  9 +import java.util.Date;
  10 +
  11 +/**
  12 + * @author chen
  13 + * @version 1.0
  14 + * @date 2019/11/12 0012 10:06
  15 + */
  16 +public class SendSuccessDto implements Serializable {
  17 +
  18 + private String deviceId ;
  19 + private String cardNum ;
  20 + private String oldCardNum ;
  21 + private String cardType ;
  22 + private int customerId ;
  23 + private int userType ;
  24 + private int classId ;
  25 + private String schoolName ;
  26 + private int studentType ;
  27 + private int openFlag ;
  28 + private int status ;
  29 + private int updateId ;
  30 + private Date createTime ;
  31 + private int sex ;
  32 + private String name ;
  33 + private int schoolId ;
  34 + private int shiduan ;
  35 +
  36 + public SendSuccessDto() {
  37 + }
  38 +
  39 + public SendSuccessDto(UserDto user , SchoolDto school , StudentCardDto studentCard , UpdateCardDto updateCard) {
  40 + if(updateCard != null){
  41 + oldCardNum = updateCard.getOldCard();
  42 + userType = updateCard.getUserType() ;
  43 + }
  44 + if(studentCard != null){
  45 + cardType = studentCard.getCardType();
  46 + }
  47 + if(user != null){
  48 + customerId = user.getStudentId();
  49 + classId = user.getClassId();
  50 + schoolId = user.getSchoolId();
  51 + name = user.getName();
  52 + }
  53 + if(school != null){
  54 + schoolName = school.getSchoolName();
  55 + }
  56 + createTime = new Date();
  57 + studentType =1 ;
  58 + sex = 1;
  59 + }
  60 +
  61 + public String getDeviceId() {
  62 + return deviceId;
  63 + }
  64 +
  65 + public void setDeviceId(String deviceId) {
  66 + this.deviceId = deviceId;
  67 + }
  68 +
  69 + public String getCardNum() {
  70 + return cardNum;
  71 + }
  72 +
  73 + public void setCardNum(String cardNum) {
  74 + this.cardNum = cardNum;
  75 + }
  76 +
  77 + public String getOldCardNum() {
  78 + return oldCardNum;
  79 + }
  80 +
  81 + public void setOldCardNum(String oldCardNum) {
  82 + this.oldCardNum = oldCardNum;
  83 + }
  84 +
  85 + public String getCardType() {
  86 + return cardType;
  87 + }
  88 +
  89 + public void setCardType(String cardType) {
  90 + this.cardType = cardType;
  91 + }
  92 +
  93 + public int getCustomerId() {
  94 + return customerId;
  95 + }
  96 +
  97 + public void setCustomerId(int customerId) {
  98 + this.customerId = customerId;
  99 + }
  100 +
  101 + public int getUserType() {
  102 + return userType;
  103 + }
  104 +
  105 + public void setUserType(int userType) {
  106 + this.userType = userType;
  107 + }
  108 +
  109 + public int getClassId() {
  110 + return classId;
  111 + }
  112 +
  113 + public void setClassId(int classId) {
  114 + this.classId = classId;
  115 + }
  116 +
  117 + public String getSchoolName() {
  118 + return schoolName;
  119 + }
  120 +
  121 + public void setSchoolName(String schoolName) {
  122 + this.schoolName = schoolName;
  123 + }
  124 +
  125 + public int getStudentType() {
  126 + return studentType;
  127 + }
  128 +
  129 + public void setStudentType(int studentType) {
  130 + this.studentType = studentType;
  131 + }
  132 +
  133 + public int getOpenFlag() {
  134 + return openFlag;
  135 + }
  136 +
  137 + public void setOpenFlag(int openFlag) {
  138 + this.openFlag = openFlag;
  139 + }
  140 +
  141 + public int getStatus() {
  142 + return status;
  143 + }
  144 +
  145 + public void setStatus(int status) {
  146 + this.status = status;
  147 + }
  148 +
  149 + public int getUpdateId() {
  150 + return updateId;
  151 + }
  152 +
  153 + public void setUpdateId(int updateId) {
  154 + this.updateId = updateId;
  155 + }
  156 +
  157 + public Date getCreateTime() {
  158 + return createTime;
  159 + }
  160 +
  161 + public void setCreateTime(Date createTime) {
  162 + this.createTime = createTime;
  163 + }
  164 +
  165 + public int getSex() {
  166 + return sex;
  167 + }
  168 +
  169 + public void setSex(int sex) {
  170 + this.sex = sex;
  171 + }
  172 +
  173 + public String getName() {
  174 + return name;
  175 + }
  176 +
  177 + public void setName(String name) {
  178 + this.name = name;
  179 + }
  180 +
  181 + public int getSchoolId() {
  182 + return schoolId;
  183 + }
  184 +
  185 + public void setSchoolId(int schoolId) {
  186 + this.schoolId = schoolId;
  187 + }
  188 +
  189 + public int getShiduan() {
  190 + return shiduan;
  191 + }
  192 +
  193 + public void setShiduan(int shiduan) {
  194 + this.shiduan = shiduan;
  195 + }
  196 +}
cloud/common/src/main/java/com/sincere/common/entity/SysUser.java
@@ -1,99 +0,0 @@ @@ -1,99 +0,0 @@
1 -package com.sincere.common.entity;  
2 -  
3 -  
4 -import lombok.Data;  
5 -import lombok.experimental.Accessors;  
6 -  
7 -import java.time.LocalDateTime;  
8 -  
9 -/**  
10 - * <p>  
11 - * 用户表  
12 - * </p>  
13 - *  
14 - * @author yukong  
15 - * @since 2018-10-08  
16 - */  
17 -@Data  
18 -@Accessors(chain = true)  
19 -public class SysUser {  
20 -  
21 - private static final long serialVersionUID = 1L;  
22 -  
23 - /**  
24 - * 主键ID  
25 - */  
26 - private Integer userId;  
27 -  
28 - /**  
29 - * 用户名  
30 - */  
31 - private String username;  
32 -  
33 - /**  
34 - * 密码  
35 - */  
36 - private String password;  
37 -  
38 - /**  
39 - * 邮箱  
40 - */  
41 - private String email;  
42 -  
43 - /**  
44 - * 手机号码  
45 - */  
46 - private String mobile;  
47 -  
48 - /**  
49 - * qq号码  
50 - */  
51 - private String qq;  
52 -  
53 - /**  
54 - * 微信号码  
55 - */  
56 - private String wechat;  
57 -  
58 - /**  
59 - * 微博url  
60 - */  
61 - private String weibo;  
62 -  
63 - /**  
64 - * 头像url  
65 - */  
66 - private String avatar;  
67 -  
68 - /**  
69 - * qq openid  
70 - */  
71 - private String qqOpenid;  
72 -  
73 - /**  
74 - * 微信openid  
75 - */  
76 - private String wechatOpenid;  
77 -  
78 - /**  
79 - * 微博openid  
80 - */  
81 - private String weiboOpenid;  
82 -  
83 - /**  
84 - * 创建时间  
85 - */  
86 - private LocalDateTime createTime;  
87 -  
88 - /**  
89 - * 更新时间  
90 - */  
91 - private LocalDateTime modifyTime;  
92 -  
93 - /**  
94 - * 是否删除 0-未删除 1-删除  
95 - */  
96 - private String delFlag;  
97 -  
98 -  
99 -}  
cloud/common/src/main/java/com/sincere/common/enums/ApiErrorCodeEnum.java
1 package com.sincere.common.enums; 1 package com.sincere.common.enums;
2 -  
3 -  
4 -import com.baomidou.mybatisplus.extension.api.IErrorCode;  
5 -  
6 /** 2 /**
7 * @author yukong 3 * @author yukong
8 * @date 2019-04-20 18:54 4 * @date 2019-04-20 18:54
9 */ 5 */
10 -public enum ApiErrorCodeEnum implements IErrorCode { 6 +public enum ApiErrorCodeEnum{
11 /** 7 /**
12 * 失败 8 * 失败
13 */ 9 */
@@ -40,17 +36,14 @@ public enum ApiErrorCodeEnum implements IErrorCode { @@ -40,17 +36,14 @@ public enum ApiErrorCodeEnum implements IErrorCode {
40 return SUCCESS; 36 return SUCCESS;
41 } 37 }
42 38
43 - @Override  
44 public long getCode() { 39 public long getCode() {
45 return code; 40 return code;
46 } 41 }
47 42
48 - @Override  
49 public String getMsg() { 43 public String getMsg() {
50 return msg; 44 return msg;
51 } 45 }
52 46
53 - @Override  
54 public String toString() { 47 public String toString() {
55 return String.format(" ErrorCode:{code=%s, msg=%s} ", code, msg); 48 return String.format(" ErrorCode:{code=%s, msg=%s} ", code, msg);
56 } 49 }
cloud/common/src/main/java/com/sincere/common/model/log/SysLog.java
@@ -1,37 +0,0 @@ @@ -1,37 +0,0 @@
1 -package com.sincere.common.model.log;  
2 -  
3 -import lombok.AllArgsConstructor;  
4 -import lombok.Builder;  
5 -import lombok.Data;  
6 -import lombok.NoArgsConstructor;  
7 -  
8 -import java.io.Serializable;  
9 -import java.util.Date;  
10 -  
11 -  
12 -/**  
13 -* @author 作者 owen E-mail: 624191343@qq.com  
14 -* @version 创建时间:2017年11月12日 上午22:57:51  
15 -* 日志实体  
16 - */  
17 -@Builder  
18 -@Data  
19 -@NoArgsConstructor  
20 -@AllArgsConstructor  
21 -public class SysLog implements Serializable {  
22 -  
23 - private static final long serialVersionUID = -5398795297842978376L;  
24 -  
25 - private Long id;  
26 -// 用户名  
27 - private String username;  
28 -// 归属模块  
29 - private String module;  
30 -// 执行方法的参数值  
31 - private String params;  
32 - private String remark;  
33 -// 是否执行成功  
34 - private Boolean flag;  
35 -  
36 - private Date createTime;  
37 -}  
cloud/common/src/main/java/com/sincere/common/model/system/LoginAppUser.java
@@ -1,93 +0,0 @@ @@ -1,93 +0,0 @@
1 -package com.sincere.common.model.system;  
2 -  
3 -import com.fasterxml.jackson.annotation.JsonIgnore;  
4 -import lombok.Getter;  
5 -import lombok.Setter;  
6 -import org.springframework.security.core.GrantedAuthority;  
7 -import org.springframework.security.core.authority.SimpleGrantedAuthority;  
8 -import org.springframework.security.core.userdetails.UserDetails;  
9 -import org.springframework.util.CollectionUtils;  
10 -  
11 -import java.io.Serializable;  
12 -import java.util.Collection;  
13 -import java.util.HashSet;  
14 -import java.util.Set;  
15 -  
16 -/**  
17 - * 用户实体绑定spring security  
18 - */  
19 -@Getter  
20 -@Setter  
21 -public class LoginAppUser extends SysUser implements UserDetails {  
22 -  
23 - /**  
24 - *  
25 - */  
26 - private static final long serialVersionUID = -3685249101751401211L;  
27 -  
28 - private Set<SysRole> sysRoles;  
29 -  
30 - private Set<String> permissions;  
31 -  
32 - /***  
33 - * 权限重写  
34 - */  
35 - @JsonIgnore  
36 - @Override  
37 - public Collection<? extends GrantedAuthority> getAuthorities() {  
38 - Collection<GrantedAuthority> collection = new HashSet<>();  
39 - if (!CollectionUtils.isEmpty(sysRoles)) {  
40 - sysRoles.parallelStream().forEach(role -> {  
41 - if (role.getCode().startsWith("ROLE_")) {  
42 - collection.add(new SimpleGrantedAuthority(role.getCode()));  
43 - } else {  
44 - collection.add(new SimpleGrantedAuthority("ROLE_" + role.getCode()));  
45 - }  
46 - });  
47 - }  
48 -  
49 - if (!CollectionUtils.isEmpty(permissions)) {  
50 - permissions.parallelStream().forEach(per -> {  
51 - collection.add(new SimpleGrantedAuthority(per));  
52 - });  
53 - }  
54 -  
55 - return collection;  
56 - }  
57 -  
58 -  
59 - @JsonIgnore  
60 - public Collection<? extends GrantedAuthority> putAll( Collection<GrantedAuthority> collections) {  
61 - Collection<GrantedAuthority> collection = new HashSet<>();  
62 -  
63 - collection.addAll(collections) ;  
64 -  
65 - return collection;  
66 - }  
67 -  
68 -  
69 - @Override  
70 - public boolean isAccountNonExpired() {  
71 - return true;  
72 - }  
73 -  
74 - @Override  
75 - public boolean isAccountNonLocked() {  
76 - return true;  
77 - }  
78 -  
79 - @Override  
80 - public boolean isCredentialsNonExpired() {  
81 - return true;  
82 - }  
83 -  
84 - @Override  
85 - public boolean isEnabled() {  
86 - return getEnabled();  
87 - }  
88 -  
89 - @Override  
90 - protected Serializable pkVal() {  
91 - return null;  
92 - }  
93 -}  
cloud/common/src/main/java/com/sincere/common/model/system/SysMenu.java
@@ -1,37 +0,0 @@ @@ -1,37 +0,0 @@
1 -package com.sincere.common.model.system;  
2 -  
3 -import com.fasterxml.jackson.databind.annotation.JsonSerialize;  
4 -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;  
5 -import lombok.Data;  
6 -  
7 -import java.io.Serializable;  
8 -import java.util.Date;  
9 -import java.util.List;  
10 -import java.util.Set;  
11 -  
12 -@Data  
13 -public class SysMenu implements Serializable {  
14 -  
15 - private static final long serialVersionUID = 749360940290141180L;  
16 - @JsonSerialize(using= ToStringSerializer.class)  
17 - private Long id;  
18 - private Long parentId;  
19 - private String name;  
20 - private String css;  
21 - private String url;  
22 - private String path;  
23 - private Integer sort;  
24 - private Date createTime;  
25 - private Date updateTime;  
26 - private Integer isMenu;  
27 - private Boolean hidden;  
28 -  
29 -  
30 - private List<SysMenu> subMenus;  
31 -  
32 - private Long roleId;  
33 - private Set<Long> menuIds;  
34 -  
35 -  
36 -  
37 -}  
cloud/common/src/main/java/com/sincere/common/model/system/SysPermission.java
@@ -1,47 +0,0 @@ @@ -1,47 +0,0 @@
1 -package com.sincere.common.model.system;  
2 -  
3 -import com.baomidou.mybatisplus.annotation.IdType;  
4 -import com.baomidou.mybatisplus.annotation.TableField;  
5 -import com.baomidou.mybatisplus.annotation.TableId;  
6 -import com.baomidou.mybatisplus.annotation.TableName;  
7 -import com.baomidou.mybatisplus.extension.activerecord.Model;  
8 -import com.fasterxml.jackson.databind.annotation.JsonSerialize;  
9 -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;  
10 -import lombok.Data;  
11 -  
12 -import java.io.Serializable;  
13 -import java.util.Date;  
14 -import java.util.Set;  
15 -  
16 -  
17 -/**  
18 - * @author 作者 owen E-mail: 624191343@qq.com  
19 - * @version 创建时间:2017年11月12日 上午22:57:51  
20 - * 权限标识  
21 - */  
22 -@Data  
23 -@TableName("sys_permission")  
24 -public class SysPermission extends Model<SysPermission> implements Serializable {  
25 - /**  
26 - *  
27 - */  
28 - private static final long serialVersionUID = 1389727646460449239L;  
29 - @TableId(value="id",type= IdType.ID_WORKER) //雪花算法 id生成策略  
30 - @JsonSerialize(using= ToStringSerializer.class)  
31 - private Long id;  
32 - private String permission;  
33 - private String name;  
34 - @TableField(value="createTime")  
35 - private Date createTime;  
36 - @TableField(value="updateTime")  
37 - private Date updateTime;  
38 - @TableField(exist=false)  
39 - private Long roleId;  
40 - @TableField(exist=false)  
41 - private Set<Long> authIds;  
42 -  
43 - @Override  
44 - protected Serializable pkVal() {  
45 - return null;  
46 - }  
47 -}  
cloud/common/src/main/java/com/sincere/common/model/system/SysRole.java
@@ -1,29 +0,0 @@ @@ -1,29 +0,0 @@
1 -package com.sincere.common.model.system;  
2 -  
3 -import com.fasterxml.jackson.databind.annotation.JsonSerialize;  
4 -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;  
5 -import lombok.Data;  
6 -  
7 -import java.io.Serializable;  
8 -import java.util.Date;  
9 -  
10 -/**  
11 - * @author 作者 owen E-mail: 624191343@qq.com  
12 - * @version 创建时间:2017年11月12日 上午22:57:51  
13 - * 角色  
14 - */  
15 -@Data  
16 -public class SysRole implements Serializable {  
17 -  
18 - /**  
19 - *  
20 - */  
21 - private static final long serialVersionUID = 4497149010220586111L;  
22 - @JsonSerialize(using= ToStringSerializer.class)  
23 - private Long id;  
24 - private String code;  
25 - private String name;  
26 - private Date createTime;  
27 - private Date updateTime;  
28 - private Long userId;  
29 -}  
cloud/common/src/main/java/com/sincere/common/model/system/SysUser.java
@@ -1,60 +0,0 @@ @@ -1,60 +0,0 @@
1 -package com.sincere.common.model.system;  
2 -  
3 -import com.baomidou.mybatisplus.annotation.IdType;  
4 -import com.baomidou.mybatisplus.annotation.TableField;  
5 -import com.baomidou.mybatisplus.annotation.TableId;  
6 -import com.baomidou.mybatisplus.annotation.TableName;  
7 -import com.baomidou.mybatisplus.extension.activerecord.Model;  
8 -import com.fasterxml.jackson.databind.annotation.JsonSerialize;  
9 -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;  
10 -import lombok.Data;  
11 -  
12 -import java.io.Serializable;  
13 -import java.util.Date;  
14 -import java.util.List;  
15 -  
16 -/**  
17 - * @author 作者 owen E-mail: 624191343@qq.com  
18 - * @version 创建时间:2017年11月12日 上午22:57:51  
19 - * 用户实体  
20 - */  
21 -@Data  
22 -@TableName("sys_user")  
23 -public class SysUser extends Model<SysUser> implements Serializable {  
24 -  
25 - /**  
26 - *  
27 - */  
28 - private static final long serialVersionUID = -5886012896705137070L;  
29 - @TableId(value="id",type= IdType.ID_WORKER) //雪花算法 id生成策略  
30 - @JsonSerialize(using= ToStringSerializer.class)  
31 - private Long id;  
32 - private String username;  
33 - private String password;  
34 - private String nickname;  
35 - private String headImgUrl;  
36 - private String phone;  
37 - private Integer sex;  
38 - private Boolean enabled;  
39 - private String type;  
40 - @TableField(value="createTime")  
41 - private Date createTime;  
42 - @TableField(value="updateTime")  
43 - private Date updateTime;  
44 -  
45 - @TableField(exist=false)  
46 - private List<SysRole> roles;  
47 -  
48 - @TableField(exist=false)  
49 - private String roleId;  
50 -  
51 - @TableField(exist=false)  
52 - private String oldPassword;  
53 - @TableField(exist=false)  
54 - private String newPassword;  
55 -  
56 - @Override  
57 - protected Serializable pkVal() {  
58 - return null;  
59 - }  
60 -}  
cloud/common/src/main/java/com/sincere/common/model/system/SysUserRole.java
@@ -1,18 +0,0 @@ @@ -1,18 +0,0 @@
1 -package com.sincere.common.model.system;  
2 -  
3 -import lombok.Data;  
4 -  
5 -/**  
6 - * @Author: [gitgeek]  
7 - * @Date: [2018-08-06 21:29]  
8 - * @Description: [ ]  
9 - * @Version: [1.0.0]  
10 - * @Copy: [com.zzg]  
11 - */  
12 -@Data  
13 -public class SysUserRole {  
14 -  
15 - private String userId;  
16 - private String roleId;  
17 -  
18 -}  
cloud/common/src/main/java/com/sincere/common/model/system/constants/UserType.java
@@ -1,19 +0,0 @@ @@ -1,19 +0,0 @@
1 -package com.sincere.common.model.system.constants;  
2 -  
3 -  
4 -/**  
5 - * @author 作者 owen E-mail: 624191343@qq.com  
6 - * @version 创建时间:2017年11月12日 上午22:57:51  
7 - * 用户类型  
8 - */  
9 -public enum UserType {  
10 -  
11 - /**  
12 - * 前端app用户  
13 - */  
14 - APP,  
15 - /**  
16 - * 后端管理用户  
17 - */  
18 - BACKEND  
19 -}  
cloud/common/src/main/java/com/sincere/common/util/DateUtils.java 0 → 100644
@@ -0,0 +1,67 @@ @@ -0,0 +1,67 @@
  1 +package com.sincere.common.util;
  2 +
  3 +import java.text.ParseException;
  4 +import java.text.SimpleDateFormat;
  5 +import java.util.Date;
  6 +
  7 +/**
  8 + * @author chen
  9 + * @version 1.0
  10 + * @date 2019/10/14 0014 14:16
  11 + */
  12 +public class DateUtils {
  13 +
  14 + public static String format = "yyyy";
  15 +
  16 + public static String format1 = "yyyy-MM-dd";
  17 +
  18 + public static String format2 = "yyyy-MM-dd HH:mm:ss";
  19 +
  20 + public static long getDate(){
  21 + return System.currentTimeMillis();
  22 + }
  23 +
  24 + public static String date2String(Date date, String format) {
  25 + SimpleDateFormat sdf = new SimpleDateFormat(format);
  26 + return sdf.format(date);
  27 + }
  28 +
  29 + public static Date string2Date(String date, String format) {
  30 + try{
  31 + SimpleDateFormat sdf = new SimpleDateFormat(format);
  32 + return sdf.parse(date);
  33 + }catch (Exception e){
  34 +
  35 + }
  36 + return new Date();
  37 + }
  38 +
  39 + public static Date getToday(){
  40 + return new Date();
  41 + }
  42 +
  43 + public static String getToday(String format) throws ParseException{
  44 + SimpleDateFormat sdf = new SimpleDateFormat(format);
  45 + return sdf.format(new Date());
  46 + }
  47 +
  48 + public static int getDateDifference(Date date1, Date date2, String timeType) {
  49 + int between = (int) (date1.getTime() - date2.getTime());
  50 + int difference = 0;
  51 + switch (timeType) {
  52 + case "day":
  53 + difference = between / (24 * 60 * 60 * 1000);
  54 + break;
  55 + case "hour":
  56 + difference = between / (60 * 60 * 1000);
  57 + break;
  58 + case "min":
  59 + difference = between / (60 * 1000);
  60 + break;
  61 + case "s":
  62 + difference = between / 1000;
  63 + }
  64 + return difference;
  65 + }
  66 +
  67 +}
cloud/common/src/main/java/com/sincere/common/util/UserUtil.java
@@ -29,7 +29,7 @@ public class UserUtil { @@ -29,7 +29,7 @@ public class UserUtil {
29 return null; 29 return null;
30 } 30 }
31 String token = authorization.split(" ")[1]; 31 String token = authorization.split(" ")[1];
32 - log.info("获取token成功,值为{}", token); 32 + //log.info("获取token成功,值为{}", token);
33 return token; 33 return token;
34 } 34 }
35 35
@@ -56,7 +56,7 @@ public class UserUtil { @@ -56,7 +56,7 @@ public class UserUtil {
56 } 56 }
57 Claims claims = getClaims(token); 57 Claims claims = getClaims(token);
58 Integer userId = (Integer) claims.get(UserConstants.USER_ID); 58 Integer userId = (Integer) claims.get(UserConstants.USER_ID);
59 - log.info("获取userId成功,值为", userId); 59 + //log.info("获取userId成功,值为", userId);
60 return userId; 60 return userId;
61 } 61 }
62 62
@@ -72,7 +72,7 @@ public class UserUtil { @@ -72,7 +72,7 @@ public class UserUtil {
72 } 72 }
73 Claims claims = getClaims(token); 73 Claims claims = getClaims(token);
74 String username = (String) claims.get(UserConstants.USER_NAME); 74 String username = (String) claims.get(UserConstants.USER_NAME);
75 - log.info("获取username成功,值为", username); 75 + //log.info("获取username成功,值为", username);
76 return username; 76 return username;
77 } 77 }
78 78
cloud/common/src/main/resources/application.properties
No preview for this file type
cloud/consumer/pom.xml
@@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
6 <groupId>com.sincere</groupId> 6 <groupId>com.sincere</groupId>
7 <artifactId>cloud</artifactId> 7 <artifactId>cloud</artifactId>
8 <version>1.0.0</version> 8 <version>1.0.0</version>
9 - <relativePath/> <!-- lookup parent from repository -->  
10 </parent> 9 </parent>
11 <groupId>com.example</groupId> 10 <groupId>com.example</groupId>
12 <artifactId>consumer</artifactId> 11 <artifactId>consumer</artifactId>
cloud/dahua/pom.xml
@@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
6 <groupId>com.sincere</groupId> 6 <groupId>com.sincere</groupId>
7 <artifactId>cloud</artifactId> 7 <artifactId>cloud</artifactId>
8 <version>1.0.0</version> 8 <version>1.0.0</version>
9 - <relativePath/> <!-- lookup parent from repository -->  
10 </parent> 9 </parent>
11 <groupId>com.example</groupId> 10 <groupId>com.example</groupId>
12 <artifactId>dahua</artifactId> 11 <artifactId>dahua</artifactId>
cloud/geteway/pom.xml
@@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
6 <groupId>com.sincere</groupId> 6 <groupId>com.sincere</groupId>
7 <artifactId>cloud</artifactId> 7 <artifactId>cloud</artifactId>
8 <version>1.0.0</version> 8 <version>1.0.0</version>
9 - <relativePath/> <!-- lookup parent from repository -->  
10 </parent> 9 </parent>
11 <groupId>com.example</groupId> 10 <groupId>com.example</groupId>
12 <artifactId>geteway</artifactId> 11 <artifactId>geteway</artifactId>
cloud/haikang/pom.xml
@@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
6 <groupId>com.sincere</groupId> 6 <groupId>com.sincere</groupId>
7 <artifactId>cloud</artifactId> 7 <artifactId>cloud</artifactId>
8 <version>1.0.0</version> 8 <version>1.0.0</version>
9 - <relativePath/> <!-- lookup parent from repository -->  
10 </parent> 9 </parent>
11 <groupId>com.sincere.haikang</groupId> 10 <groupId>com.sincere.haikang</groupId>
12 <artifactId>haikang</artifactId> 11 <artifactId>haikang</artifactId>
cloud/haikangface/pom.xml
@@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
6 <groupId>com.sincere</groupId> 6 <groupId>com.sincere</groupId>
7 <artifactId>cloud</artifactId> 7 <artifactId>cloud</artifactId>
8 <version>1.0.0</version> 8 <version>1.0.0</version>
9 - <relativePath/> <!-- lookup parent from repository -->  
10 </parent> 9 </parent>
11 <groupId>com.sincere</groupId> 10 <groupId>com.sincere</groupId>
12 <artifactId>haikangface</artifactId> 11 <artifactId>haikangface</artifactId>
cloud/mypulsar/pom.xml
@@ -3,10 +3,9 @@ @@ -3,10 +3,9 @@
3 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 3 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4 <modelVersion>4.0.0</modelVersion> 4 <modelVersion>4.0.0</modelVersion>
5 <parent> 5 <parent>
6 - <groupId>org.springframework.boot</groupId>  
7 - <artifactId>spring-boot-starter-parent</artifactId>  
8 - <version>2.1.6.RELEASE</version>  
9 - <relativePath/> <!-- lookup parent from repository --> 6 + <artifactId>cloud</artifactId>
  7 + <groupId>com.sincere</groupId>
  8 + <version>1.0.0</version>
10 </parent> 9 </parent>
11 10
12 <!--<packaging>war</packaging>--> 11 <!--<packaging>war</packaging>-->
@@ -2,11 +2,11 @@ @@ -2,11 +2,11 @@
2 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 2 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 3 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4 <modelVersion>4.0.0</modelVersion> 4 <modelVersion>4.0.0</modelVersion>
  5 + <packaging>pom</packaging>
5 <parent> 6 <parent>
6 <groupId>org.springframework.boot</groupId> 7 <groupId>org.springframework.boot</groupId>
7 <artifactId>spring-boot-starter-parent</artifactId> 8 <artifactId>spring-boot-starter-parent</artifactId>
8 <version>2.1.6.RELEASE</version> 9 <version>2.1.6.RELEASE</version>
9 - <relativePath/> <!-- lookup parent from repository -->  
10 </parent> 10 </parent>
11 <groupId>com.sincere</groupId> 11 <groupId>com.sincere</groupId>
12 <artifactId>cloud</artifactId> 12 <artifactId>cloud</artifactId>
@@ -24,6 +24,10 @@ @@ -24,6 +24,10 @@
24 <module>dahua</module> 24 <module>dahua</module>
25 <module>consumer</module> 25 <module>consumer</module>
26 <module>haikangface</module> 26 <module>haikangface</module>
  27 + <module>smartCampus_search</module>
  28 + <module>xiaoan_search</module>
  29 + <module>mypulsar</module>
  30 + <module>weigeng</module>
27 </modules> 31 </modules>
28 32
29 <properties> 33 <properties>
@@ -73,14 +77,4 @@ @@ -73,14 +77,4 @@
73 </dependency> 77 </dependency>
74 </dependencies> 78 </dependencies>
75 </dependencyManagement> 79 </dependencyManagement>
76 -  
77 - <build>  
78 - <plugins>  
79 - <plugin>  
80 - <groupId>org.springframework.boot</groupId>  
81 - <artifactId>spring-boot-maven-plugin</artifactId>  
82 - </plugin>  
83 - </plugins>  
84 - </build>  
85 -  
86 </project> 80 </project>
cloud/server1/pom.xml
@@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
6 <groupId>com.sincere</groupId> 6 <groupId>com.sincere</groupId>
7 <artifactId>cloud</artifactId> 7 <artifactId>cloud</artifactId>
8 <version>1.0.0</version> 8 <version>1.0.0</version>
9 - <relativePath/> <!-- lookup parent from repository -->  
10 </parent> 9 </parent>
11 <groupId>com.sincere</groupId> 10 <groupId>com.sincere</groupId>
12 <artifactId>server1</artifactId> 11 <artifactId>server1</artifactId>
cloud/server2/pom.xml
@@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
6 <groupId>com.sincere</groupId> 6 <groupId>com.sincere</groupId>
7 <artifactId>cloud</artifactId> 7 <artifactId>cloud</artifactId>
8 <version>1.0.0</version> 8 <version>1.0.0</version>
9 - <relativePath/> <!-- lookup parent from repository -->  
10 </parent> 9 </parent>
11 <groupId>com.sincere</groupId> 10 <groupId>com.sincere</groupId>
12 <artifactId>server2</artifactId> 11 <artifactId>server2</artifactId>
cloud/smartCampus_search/pom.xml 0 → 100644
@@ -0,0 +1,208 @@ @@ -0,0 +1,208 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project xmlns="http://maven.apache.org/POM/4.0.0"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5 + <parent>
  6 + <artifactId>cloud</artifactId>
  7 + <groupId>com.sincere</groupId>
  8 + <version>1.0.0</version>
  9 + </parent>
  10 + <modelVersion>4.0.0</modelVersion>
  11 +
  12 + <artifactId>smartCampus_search</artifactId>
  13 +
  14 + <dependencies>
  15 + <dependency>
  16 + <groupId>com.sincere</groupId>
  17 + <artifactId>common</artifactId>
  18 + <version>0.0.1-SNAPSHOT</version>
  19 + </dependency>
  20 + <dependency>
  21 + <groupId>io.netty</groupId>
  22 + <artifactId>netty-all</artifactId>
  23 + <version>4.1.33.Final</version>
  24 + </dependency>
  25 + <dependency>
  26 + <groupId>org.apache.mina</groupId>
  27 + <artifactId>mina-core</artifactId>
  28 + <version>2.1.3</version>
  29 + </dependency>
  30 + <dependency>
  31 + <groupId>com.microsoft.sqlserver</groupId>
  32 + <artifactId>mssql-jdbc</artifactId>
  33 + <version>6.4.0.jre8</version>
  34 + </dependency>
  35 + <!-- spring boot -->
  36 + <dependency>
  37 + <groupId>org.springframework.boot</groupId>
  38 + <artifactId>spring-boot-starter</artifactId>
  39 + </dependency>
  40 + <dependency>
  41 + <groupId>org.springframework.boot</groupId>
  42 + <artifactId>spring-boot-starter-web</artifactId>
  43 + </dependency>
  44 + <dependency>
  45 + <groupId>org.springframework.boot</groupId>
  46 + <artifactId>spring-boot-starter-aop</artifactId>
  47 + </dependency>
  48 + <!-- spring boot -->
  49 + <dependency>
  50 + <groupId>com.googlecode.rapid-framework</groupId>
  51 + <artifactId>rapid-core</artifactId>
  52 + <version>4.0.5</version>
  53 + </dependency>
  54 + <dependency>
  55 + <groupId>org.apache.commons</groupId>
  56 + <artifactId>commons-lang3</artifactId>
  57 + <version>3.3.2</version>
  58 + </dependency>
  59 + <!--只有slf4j-api依赖-->
  60 + <dependency>
  61 + <groupId>org.slf4j</groupId>
  62 + <artifactId>slf4j-api</artifactId>
  63 + <version>1.7.13</version>
  64 + </dependency>
  65 +
  66 + <dependency>
  67 + <groupId>commons-net</groupId>
  68 + <artifactId>commons-net</artifactId>
  69 + <version>2.0</version>
  70 + </dependency>
  71 + <dependency>
  72 + <groupId>org.apache.poi</groupId>
  73 + <artifactId>poi</artifactId>
  74 + <version>4.1.0</version>
  75 + </dependency>
  76 +
  77 + <dependency>
  78 + <groupId>org.apache.poi</groupId>
  79 + <artifactId>poi-ooxml</artifactId>
  80 + <version>4.1.0</version>
  81 + </dependency>
  82 +
  83 + <dependency>
  84 + <groupId>org.mybatis.spring.boot</groupId>
  85 + <artifactId>mybatis-spring-boot-starter</artifactId>
  86 + <version>1.3.0</version>
  87 + </dependency>
  88 + <dependency>
  89 + <groupId>com.alibaba</groupId>
  90 + <artifactId>druid</artifactId>
  91 + <version>1.0.11</version>
  92 + </dependency>
  93 + <dependency>
  94 + <groupId>io.springfox</groupId>
  95 + <artifactId>springfox-swagger2</artifactId>
  96 + <version>2.6.1</version>
  97 + </dependency>
  98 + <dependency>
  99 + <groupId>io.springfox</groupId>
  100 + <artifactId>springfox-swagger-ui</artifactId>
  101 + <version>2.6.1</version>
  102 + </dependency>
  103 + </dependencies>
  104 + <repositories>
  105 + <repository>
  106 + <id>spring-snapshots</id>
  107 + <name>Spring Snapshots</name>
  108 + <url>https://repo.spring.io/snapshot</url>
  109 + <snapshots>
  110 + <enabled>true</enabled>
  111 + </snapshots>
  112 + </repository>
  113 + <repository>
  114 + <id>spring-milestones</id>
  115 + <name>Spring Milestones</name>
  116 + <url>https://repo.spring.io/milestone</url>
  117 + <snapshots>
  118 + <enabled>false</enabled>
  119 + </snapshots>
  120 + </repository>
  121 + </repositories>
  122 +
  123 +
  124 + <build>
  125 + <!--打包文件名-->
  126 + <finalName>smartCampusSearch</finalName>
  127 + <!--打包方式-->
  128 + <plugins>
  129 + <!-- 设置编译版本 -->
  130 + <plugin>
  131 + <groupId>org.apache.maven.plugins</groupId>
  132 + <artifactId>maven-compiler-plugin</artifactId>
  133 + <version>3.1</version>
  134 + <configuration>
  135 + <source>1.8</source>
  136 + <target>1.8</target>
  137 + <encoding>UTF-8</encoding>
  138 + </configuration>
  139 + </plugin>
  140 + <!-- 打包jar文件时,配置manifest文件,加入lib包的jar依赖 -->
  141 + <!-- 本地启动需要注释-->
  142 + <plugin>
  143 + <groupId>org.apache.maven.plugins</groupId>
  144 + <artifactId>maven-jar-plugin</artifactId>
  145 + <configuration>
  146 + <archive>
  147 + <manifest>
  148 + <mainClass>com.sincere.smartSearch.SmartSearchApplication</mainClass>
  149 + <addClasspath>true</addClasspath>
  150 + <classpathPrefix>lib/</classpathPrefix>
  151 + </manifest>
  152 + <manifestEntries>
  153 + <Class-Path>./config/</Class-Path>
  154 + </manifestEntries>
  155 + </archive>
  156 + <excludes>
  157 + <exclude>config/**</exclude>
  158 + </excludes>
  159 + <classesDirectory></classesDirectory>
  160 + </configuration>
  161 + </plugin>
  162 + <!-- 拷贝依赖的jar包到lib目录 -->
  163 + <plugin>
  164 + <groupId>org.apache.maven.plugins</groupId>
  165 + <artifactId>maven-dependency-plugin</artifactId>
  166 + <executions>
  167 + <execution>
  168 + <id>copy</id>
  169 + <phase>package</phase>
  170 + <goals>
  171 + <goal>copy-dependencies</goal>
  172 + </goals>
  173 + <configuration>
  174 + <outputDirectory>
  175 + ${project.build.directory}/lib
  176 + </outputDirectory>
  177 + </configuration>
  178 + </execution>
  179 + </executions>
  180 + </plugin>
  181 + <!-- 解决资源文件的编码问题 -->
  182 + <plugin>
  183 + <groupId>org.apache.maven.plugins</groupId>
  184 + <artifactId>maven-resources-plugin</artifactId>
  185 + <version>2.5</version>
  186 + <configuration>
  187 + <encoding>UTF-8</encoding>
  188 + </configuration>
  189 + </plugin>
  190 + <!-- 打包source文件为jar文件 -->
  191 + <plugin>
  192 + <artifactId>maven-source-plugin</artifactId>
  193 + <version>2.2</version>
  194 + <configuration>
  195 + <attach>true</attach>
  196 + </configuration>
  197 + <executions>
  198 + <execution>
  199 + <phase>compile</phase>
  200 + <goals>
  201 + <goal>jar</goal>
  202 + </goals>
  203 + </execution>
  204 + </executions>
  205 + </plugin>
  206 + </plugins>
  207 + </build>
  208 +</project>
0 \ No newline at end of file 209 \ No newline at end of file
cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/SmartSearchApplication.java 0 → 100644
@@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
  1 +package com.sincere.smartSearch;
  2 +
  3 +import org.mybatis.spring.annotation.MapperScan;
  4 +import org.springframework.boot.SpringApplication;
  5 +import org.springframework.boot.autoconfigure.SpringBootApplication;
  6 +import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
  7 +
  8 +/**
  9 + * @author chen
  10 + * @version 1.0
  11 + * @date 2019/11/7 0007 15:06
  12 + */
  13 +@EnableEurekaClient
  14 +@SpringBootApplication
  15 +@MapperScan("com.sincere.smartSearch.mapper")
  16 +public class SmartSearchApplication {
  17 +
  18 + public static void main(String[] args) {
  19 + SpringApplication.run(SmartSearchApplication.class, args);
  20 + }
  21 +}
cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/controller/WgController.java 0 → 100644
@@ -0,0 +1,114 @@ @@ -0,0 +1,114 @@
  1 +package com.sincere.smartSearch.controller;
  2 +
  3 +import com.sincere.common.dto.smartCampus.SchoolDto;
  4 +import com.sincere.common.dto.smartCampus.StudentCardDto;
  5 +import com.sincere.common.dto.smartCampus.UpdateCardDto;
  6 +import com.sincere.common.dto.smartCampus.UserDto;
  7 +import com.sincere.smartSearch.model.School;
  8 +import com.sincere.smartSearch.model.StudentCard;
  9 +import com.sincere.smartSearch.model.UpdateCard;
  10 +import com.sincere.smartSearch.model.User;
  11 +import com.sincere.smartSearch.service.DeviceService;
  12 +import com.sincere.smartSearch.service.WgUserSearchService;
  13 +import org.springframework.beans.factory.annotation.Autowired;
  14 +import org.springframework.web.bind.annotation.RequestMapping;
  15 +import org.springframework.web.bind.annotation.RequestMethod;
  16 +import org.springframework.web.bind.annotation.RequestParam;
  17 +import org.springframework.web.bind.annotation.RestController;
  18 +
  19 +import java.nio.file.attribute.UserDefinedFileAttributeView;
  20 +
  21 +/**
  22 + * @author chen
  23 + * @version 1.0
  24 + * @date 2019/11/7 0007 15:47
  25 + */
  26 +@RestController
  27 +@RequestMapping("/sm/wg")
  28 +public class WgController {
  29 +
  30 + @Autowired
  31 + DeviceService deviceService;
  32 +
  33 + @Autowired
  34 + WgUserSearchService wgUserSearchService;
  35 +
  36 + @RequestMapping(value = "updateLinkTime",method = RequestMethod.GET)
  37 + int updateLinkTime(@RequestParam("sno") String sno){
  38 + return deviceService.updateLinkTime(sno);
  39 + }
  40 +
  41 + @RequestMapping(value = "selectOutOrderId",method = RequestMethod.GET)
  42 + String selectOutOrderId(@RequestParam("type") int type, @RequestParam("insideOrderId") int insideOrderId){
  43 + return deviceService.selectOutOrderId(type,insideOrderId);
  44 + }
  45 +
  46 + @RequestMapping(value = "checkLeave",method = RequestMethod.GET)
  47 + String checkLeave(@RequestParam("cardNo") String cardNo){
  48 + return wgUserSearchService.checkLeave(cardNo);
  49 + }
  50 +
  51 + @RequestMapping(value = "selectSchoolBySchoolId",method = RequestMethod.GET)
  52 + SchoolDto selectSchoolBySchoolId(@RequestParam("schoolId") int schoolId){
  53 + School school = wgUserSearchService.selectSchoolBySchoolId(schoolId);
  54 + return toSchoolDto(school);
  55 + }
  56 +
  57 + @RequestMapping(value = "selectUserByCardNum",method = RequestMethod.GET)
  58 + UserDto selectUserByCardNum(@RequestParam("cardNum") String cardNum){
  59 + User user = wgUserSearchService.selectUserByCardNum(cardNum);
  60 + return toUserDto(user);
  61 + }
  62 +
  63 + @RequestMapping(value = "selectUpdateCardByUpdateId",method = RequestMethod.GET)
  64 + UpdateCardDto selectUpdateCardByUpdateId(@RequestParam("updateId") int updateId){
  65 + UpdateCard updateCard = wgUserSearchService.selectUpdateCardByUpdateId(updateId);
  66 + return toUpdateCardDto(updateCard);
  67 + }
  68 +
  69 + @RequestMapping(value = "selectStudentCard",method = RequestMethod.GET)
  70 + StudentCardDto selectStudentCard(@RequestParam("cardNum") String cardNum){
  71 + StudentCard studentCard = wgUserSearchService.selectStudentCard(cardNum);
  72 + return toStudentCardDto(studentCard);
  73 + }
  74 +
  75 +
  76 + private SchoolDto toSchoolDto(School school){
  77 + SchoolDto schoolDto = new SchoolDto();
  78 + if(school != null){
  79 + schoolDto.setSchoolId(school.getSchoolId());
  80 + schoolDto.setSchoolName(school.getSchoolName());
  81 + }
  82 + return schoolDto;
  83 + }
  84 +
  85 + private UserDto toUserDto(User user){
  86 + UserDto userDto = new UserDto();
  87 + if(user != null){
  88 + userDto.setClassId(user.getClassId());
  89 + userDto.setName(user.getName());
  90 + userDto.setSchoolId(user.getSchoolId());
  91 + userDto.setStudentId(user.getStudentId());
  92 + }
  93 + return userDto;
  94 + }
  95 +
  96 + private UpdateCardDto toUpdateCardDto(UpdateCard updateCard){
  97 + UpdateCardDto updateCardDto = new UpdateCardDto();
  98 + if(updateCard != null){
  99 + updateCardDto.setId(updateCard.getId());
  100 + updateCardDto.setOldCard(updateCard.getOldCard());
  101 + updateCard.setUserType(updateCard.getUserType());
  102 + }
  103 + return updateCardDto;
  104 + }
  105 +
  106 + private StudentCardDto toStudentCardDto(StudentCard studentCard){
  107 + StudentCardDto studentCardDto = new StudentCardDto();
  108 + if(studentCard != null){
  109 + studentCardDto.setCardNum(studentCard.getCardNum());
  110 + studentCardDto.setCardType(studentCard.getCardType());
  111 + }
  112 + return studentCardDto;
  113 + }
  114 +}
cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/mapper/DeviceMapper.java 0 → 100644
@@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
  1 +package com.sincere.smartSearch.mapper;
  2 +
  3 +import com.sincere.smartSearch.model.DeviceLink;
  4 +import com.sincere.smartSearch.model.DeviceOrder;
  5 +
  6 +/**
  7 + * @author chen
  8 + * @version 1.0
  9 + * @date 2019/10/12 0012 16:27
  10 + */
  11 +public interface DeviceMapper {
  12 +
  13 + int updateLinkTime(DeviceLink deviceLink);
  14 +
  15 + int insertLink(DeviceLink deviceLink);
  16 +
  17 + String selectOutOrderId(DeviceOrder deviceOrder);
  18 +}
cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/mapper/WgUserSearchMapper.java 0 → 100644
@@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
  1 +package com.sincere.smartSearch.mapper;
  2 +
  3 +import com.sincere.smartSearch.model.School;
  4 +import com.sincere.smartSearch.model.StudentCard;
  5 +import com.sincere.smartSearch.model.UpdateCard;
  6 +import com.sincere.smartSearch.model.User;
  7 +
  8 +import java.util.List;
  9 +
  10 +/**
  11 + * @author chen
  12 + * @version 1.0
  13 + * @date 2019/10/14 0014 14:36
  14 + */
  15 +public interface WgUserSearchMapper {
  16 +
  17 + String checkLeave(String cardNo);
  18 +
  19 + School selectSchoolBySchoolId(int schoolId);
  20 +
  21 + List<User> selectUserByCardNum(String cardNum);
  22 +
  23 + UpdateCard selectUpdateCardByUpdateId(int updateId);
  24 +
  25 + List<StudentCard> selectStudentCard(String cardNum);
  26 +}
cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/model/DeviceLink.java 0 → 100644
@@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
  1 +package com.sincere.smartSearch.model;
  2 +
  3 +import java.util.Date;
  4 +
  5 +/**
  6 + * @author chen
  7 + * @version 1.0
  8 + * @date 2019/10/12 0012 16:24
  9 + */
  10 +public class DeviceLink {
  11 +
  12 + private String deviceNo ;
  13 + private Date lastTime ;
  14 + private int isRelation ;
  15 +
  16 + public String getDeviceNo() {
  17 + return deviceNo;
  18 + }
  19 +
  20 + public void setDeviceNo(String deviceNo) {
  21 + this.deviceNo = deviceNo;
  22 + }
  23 +
  24 + public Date getLastTime() {
  25 + return lastTime;
  26 + }
  27 +
  28 + public void setLastTime(Date lastTime) {
  29 + this.lastTime = lastTime;
  30 + }
  31 +
  32 + public int getIsRelation() {
  33 + return isRelation;
  34 + }
  35 +
  36 + public void setIsRelation(int isRelation) {
  37 + this.isRelation = isRelation;
  38 + }
  39 +}
cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/model/DeviceOrder.java 0 → 100644
@@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
  1 +package com.sincere.smartSearch.model;
  2 +
  3 +/**
  4 + * @author chen
  5 + * @version 1.0
  6 + * @date 2019/10/29 0029 10:23
  7 + */
  8 +public class DeviceOrder {
  9 +
  10 + private int type ;
  11 + private int insideOrderId ;
  12 +
  13 + public int getType() {
  14 + return type;
  15 + }
  16 +
  17 + public void setType(int type) {
  18 + this.type = type;
  19 + }
  20 +
  21 + public int getInsideOrderId() {
  22 + return insideOrderId;
  23 + }
  24 +
  25 + public void setInsideOrderId(int insideOrderId) {
  26 + this.insideOrderId = insideOrderId;
  27 + }
  28 +}
cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/model/School.java 0 → 100644
@@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
  1 +package com.sincere.smartSearch.model;
  2 +
  3 +/**
  4 + * @author chen
  5 + * @version 1.0
  6 + * @date 2019/10/14 0014 14:37
  7 + */
  8 +public class School {
  9 +
  10 + private int schoolId ;
  11 + private String schoolName ;
  12 +
  13 + public int getSchoolId() {
  14 + return schoolId;
  15 + }
  16 +
  17 + public void setSchoolId(int schoolId) {
  18 + this.schoolId = schoolId;
  19 + }
  20 +
  21 + public String getSchoolName() {
  22 + return schoolName;
  23 + }
  24 +
  25 + public void setSchoolName(String schoolName) {
  26 + this.schoolName = schoolName;
  27 + }
  28 +
  29 +}
cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/model/StudentCard.java 0 → 100644
@@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
  1 +package com.sincere.smartSearch.model;
  2 +
  3 +/**
  4 + * @author chen
  5 + * @version 1.0
  6 + * @date 2019/10/14 0014 14:50
  7 + */
  8 +public class StudentCard {
  9 + private String cardType ;
  10 + private String cardNum ;
  11 +
  12 + public String getCardType() {
  13 + return cardType;
  14 + }
  15 +
  16 + public void setCardType(String cardType) {
  17 + this.cardType = cardType;
  18 + }
  19 +
  20 + public String getCardNum() {
  21 + return cardNum;
  22 + }
  23 +
  24 + public void setCardNum(String cardNum) {
  25 + this.cardNum = cardNum;
  26 + }
  27 +}
cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/model/UpdateCard.java 0 → 100644
@@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
  1 +package com.sincere.smartSearch.model;
  2 +
  3 +/**
  4 + * @author chen
  5 + * @version 1.0
  6 + * @date 2019/10/14 0014 14:46
  7 + */
  8 +public class UpdateCard {
  9 + private int id ;
  10 + private int userType ;
  11 + private String oldCard ;
  12 +
  13 + public int getId() {
  14 + return id;
  15 + }
  16 +
  17 + public void setId(int id) {
  18 + this.id = id;
  19 + }
  20 +
  21 + public int getUserType() {
  22 + return userType;
  23 + }
  24 +
  25 + public void setUserType(int userType) {
  26 + this.userType = userType;
  27 + }
  28 +
  29 + public String getOldCard() {
  30 + return oldCard;
  31 + }
  32 +
  33 + public void setOldCard(String oldCard) {
  34 + this.oldCard = oldCard;
  35 + }
  36 +}
cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/model/User.java 0 → 100644
@@ -0,0 +1,46 @@ @@ -0,0 +1,46 @@
  1 +package com.sincere.smartSearch.model;
  2 +
  3 +/**
  4 + * @author chen
  5 + * @version 1.0
  6 + * @date 2019/10/14 0014 14:41
  7 + */
  8 +public class User {
  9 +
  10 + private int schoolId;
  11 + private int classId ;
  12 + private String name ;
  13 + private int studentId ;
  14 +
  15 + public int getSchoolId() {
  16 + return schoolId;
  17 + }
  18 +
  19 + public void setSchoolId(int schoolId) {
  20 + this.schoolId = schoolId;
  21 + }
  22 +
  23 + public int getClassId() {
  24 + return classId;
  25 + }
  26 +
  27 + public void setClassId(int classId) {
  28 + this.classId = classId;
  29 + }
  30 +
  31 + public String getName() {
  32 + return name;
  33 + }
  34 +
  35 + public void setName(String name) {
  36 + this.name = name;
  37 + }
  38 +
  39 + public int getStudentId() {
  40 + return studentId;
  41 + }
  42 +
  43 + public void setStudentId(int studentId) {
  44 + this.studentId = studentId;
  45 + }
  46 +}
cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/service/DeviceService.java 0 → 100644
@@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
  1 +package com.sincere.smartSearch.service;
  2 +
  3 +/**
  4 + * @author chen
  5 + * @version 1.0
  6 + * @date 2019/10/12 0012 16:30
  7 + */
  8 +public interface DeviceService {
  9 +
  10 + int updateLinkTime(String sno);
  11 +
  12 +
  13 + String selectOutOrderId(int type, int insideOrderId);
  14 +
  15 +}
cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/service/WgUserSearchService.java 0 → 100644
@@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
  1 +package com.sincere.smartSearch.service;
  2 +
  3 +import com.sincere.smartSearch.model.*;
  4 +
  5 +/**
  6 + * @author chen
  7 + * @version 1.0
  8 + * @date 2019/10/14 0014 14:55
  9 + */
  10 +public interface WgUserSearchService {
  11 +
  12 +
  13 + String checkLeave(String cardNo);
  14 +
  15 + School selectSchoolBySchoolId(int schoolId);
  16 +
  17 + User selectUserByCardNum(String cardNum);
  18 +
  19 + UpdateCard selectUpdateCardByUpdateId(int updateId);
  20 +
  21 + StudentCard selectStudentCard(String cardNum);
  22 +}
cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/service/impl/DeviceServiceImpl.java 0 → 100644
@@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
  1 +package com.sincere.smartSearch.service.impl;
  2 +
  3 +import com.sincere.smartSearch.mapper.DeviceMapper;
  4 +import com.sincere.smartSearch.model.DeviceLink;
  5 +import com.sincere.smartSearch.model.DeviceOrder;
  6 +import com.sincere.smartSearch.service.DeviceService;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.stereotype.Service;
  9 +
  10 +import java.util.Date;
  11 +
  12 +/**
  13 + * @author chen
  14 + * @version 1.0
  15 + * @date 2019/10/12 0012 16:31
  16 + */
  17 +@Service("deviceService")
  18 +public class DeviceServiceImpl implements DeviceService {
  19 +
  20 + @Autowired
  21 + DeviceMapper deviceMapper;
  22 +
  23 + @Override
  24 + public int updateLinkTime(String sno) {
  25 + DeviceLink deviceLink = new DeviceLink();
  26 + deviceLink.setDeviceNo(sno);
  27 + deviceLink.setLastTime(new Date());
  28 + if(deviceMapper.updateLinkTime(deviceLink) > 0){
  29 + //已存在,更新即可
  30 + }else {
  31 + deviceMapper.insertLink(deviceLink);
  32 + }
  33 + return 1 ;
  34 + }
  35 +
  36 + @Override
  37 + public String selectOutOrderId(int type, int insideOrderId) {
  38 + DeviceOrder deviceOrder = new DeviceOrder();
  39 + deviceOrder.setType(type);
  40 + deviceOrder.setInsideOrderId(insideOrderId);
  41 + return deviceMapper.selectOutOrderId(deviceOrder);
  42 + }
  43 +}
cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/service/impl/WgUserSearchServiceImpl.java 0 → 100644
@@ -0,0 +1,60 @@ @@ -0,0 +1,60 @@
  1 +package com.sincere.smartSearch.service.impl;
  2 +
  3 +import com.sincere.smartSearch.mapper.WgUserSearchMapper;
  4 +import com.sincere.smartSearch.model.School;
  5 +import com.sincere.smartSearch.model.StudentCard;
  6 +import com.sincere.smartSearch.model.UpdateCard;
  7 +import com.sincere.smartSearch.model.User;
  8 +import com.sincere.smartSearch.service.WgUserSearchService;
  9 +import org.slf4j.Logger;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.stereotype.Service;
  12 +
  13 +import java.util.List;
  14 +
  15 +/**
  16 + * @author chen
  17 + * @version 1.0
  18 + * @date 2019/10/14 0014 14:55
  19 + */
  20 +@Service("wgUserSearchService")
  21 +public class WgUserSearchServiceImpl implements WgUserSearchService {
  22 +
  23 + @Autowired
  24 + WgUserSearchMapper searchMapper;
  25 +
  26 +
  27 + @Override
  28 + public String checkLeave(String cardNo) {
  29 + return searchMapper.checkLeave(cardNo);
  30 + }
  31 +
  32 + @Override
  33 + public School selectSchoolBySchoolId(int schoolId) {
  34 + return searchMapper.selectSchoolBySchoolId(schoolId);
  35 + }
  36 +
  37 + @Override
  38 + public User selectUserByCardNum(String cardNum) {
  39 + try{
  40 + return searchMapper.selectUserByCardNum(cardNum).get(0);
  41 + }catch (Exception e){
  42 + }
  43 + return new User();
  44 + }
  45 +
  46 + @Override
  47 + public UpdateCard selectUpdateCardByUpdateId(int updateId) {
  48 + return searchMapper.selectUpdateCardByUpdateId(updateId);
  49 + }
  50 +
  51 + @Override
  52 + public StudentCard selectStudentCard(String cardNum) {
  53 + List<StudentCard> list = searchMapper.selectStudentCard(cardNum) ;
  54 + if(list != null && list.size() > 0){
  55 + return list.get(0);
  56 + }else {
  57 + return new StudentCard();
  58 + }
  59 + }
  60 +}
cloud/smartCampus_search/src/main/resources/application.yml 0 → 100644
@@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
  1 +server:
  2 + port: 7777
  3 +spring:
  4 + application:
  5 + name: smartCampusSearch
  6 + datasource:
  7 + username: SZJXTUSER
  8 + password: xst200919
  9 + url: jdbc:sqlserver://60.190.202.57:14333;database=SmartCampusSZ
  10 + driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
  11 +##mybatis
  12 +mybatis:
  13 + mapper-locations: classpath:mapper/*.xml
  14 + type-aliases-package: com.sincere.smartSearch.model
  15 + check-config-location: true
  16 +
  17 +eureka:
  18 + instance:
  19 + hostname: localhost
  20 + lease-expiration-duration-in-seconds: 60
  21 + lease-renewal-interval-in-seconds: 10
  22 + client:
  23 + service-url:
  24 + defaultZone: http://localhost:8761/eureka/,http://localhost:8762/eureka/
  25 +
  26 +
  27 +
cloud/smartCampus_search/src/main/resources/logback.xml 0 → 100644
@@ -0,0 +1,61 @@ @@ -0,0 +1,61 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<configuration debug="true">
  3 +     <!-- 项目名称 -->
  4 +     <property name="PROJECT_NAME" value="schedule" />
  5 +
  6 +     <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
  7 + <!--    <property name="LOG_HOME" value="/opt/web/log/" />-->
  8 + <property name="LOG_HOME" value="D://smartCampus_java//log"/>
  9 +
  10 +     <!-- 控制台输出 -->
  11 +     <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
  12 +         <!--<withJansi>true</withJansi>-->
  13 +         <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
  14 +             <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
  15 +             <pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] %highlight([%-5level] %logger{50} - %msg%n)</pattern>
  16 +             <charset>UTF-8</charset>
  17 +         </encoder>
  18 +     </appender>
  19 +
  20 +     <!-- 按照每天生成日志文件 -->
  21 +     <appender name="SYSTEM_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
  22 +         <!-- 过滤器,只打印ERROR级别的日志 -->
  23 +         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  24 +             <!--日志文件输出的文件名-->
  25 +             <FileNamePattern>${LOG_HOME}/${PROJECT_NAME}.system-dev.%d{yyyy-MM-dd HH}.%i.log</FileNamePattern>
  26 +             <!--日志文件保留天数-->
  27 +             <MaxHistory>30</MaxHistory>
  28 +             <!--日志文件最大的大小-->
  29 +             <MaxFileSize>100MB</MaxFileSize>
  30 +         </rollingPolicy>
  31 +
  32 +         <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
  33 +             <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
  34 +             <pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] [%-5level] %logger{50} - %msg%n</pattern>
  35 +             <charset>UTF-8</charset>
  36 +         </encoder>
  37 +     </appender>
  38 +     <logger name="system_error" additivity="true">
  39 +        <appender-ref ref="SYSTEM_FILE"/>
  40 +    </logger>
  41 +
  42 +    <!-- 设置Spring&Hibernate日志输出级别 -->
  43 +    <logger name="org.springframework" level="WARN" />
  44 +    <logger name="org.mybatis" level="WARN" />
  45 +    <logger name="com.ibatis" level="DEBUG" />
  46 +    <logger name="com.ibatis.common.jdbc.SimpleDataSource" level="DEBUG" />
  47 +    <logger name="com.ibatis.common.jdbc.ScriptRunner" level="DEBUG" />
  48 +    <logger name="com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate" level="DEBUG" />
  49 +
  50 +
  51 +    <logger name="java.sql.Connection" level="DEBUG" />
  52 +    <logger name="java.sql.Statement" level="DEBUG" />
  53 +    <logger name="java.sql.PreparedStatement" level="DEBUG" />
  54 +    <logger name="com.sincere.smartSearch.mapper" level="DEBUG" />
  55 +    <!-- 开发环境下的日志配置 -->
  56 +    <root level="ERROR">
  57 +        <appender-ref ref="CONSOLE" />
  58 +        <appender-ref ref="SYSTEM_FILE" />
  59 +    </root>
  60 +
  61 +</configuration>
0 \ No newline at end of file 62 \ No newline at end of file
cloud/smartCampus_search/src/main/resources/mapper/DeviceMapper.xml 0 → 100644
@@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3 +<mapper namespace="com.sincere.smartSearch.mapper.DeviceMapper" >
  4 +
  5 + <update id="updateLinkTime" parameterType="com.sincere.smartSearch.model.DeviceLink">
  6 + update AC_DeviceLink set LastTime =#{lastTime} where DeviceNo = #{deviceNo}
  7 + </update>
  8 +
  9 + <insert id="insertLink" parameterType="com.sincere.smartSearch.model.DeviceLink">
  10 + insert into AC_DeviceLink(DeviceNo,LastTime,IsRelation)
  11 + values (#{deviceNo},#{lastTime},0)
  12 + </insert>
  13 +
  14 + <select id="selectOutOrderId" parameterType="com.sincere.smartSearch.model.DeviceOrder" resultType="java.lang.String">
  15 + select OutsideOrderID from AC_DeviceOrder where Type = #{type} and InsideOrderID = #{insideOrderId}
  16 + </select>
  17 +</mapper>
0 \ No newline at end of file 18 \ No newline at end of file
cloud/smartCampus_search/src/main/resources/mapper/WgUserSearchMapper.xml 0 → 100644
@@ -0,0 +1,56 @@ @@ -0,0 +1,56 @@
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3 +<mapper namespace="com.sincere.smartSearch.mapper.WgUserSearchMapper" >
  4 +
  5 +
  6 + <select id="checkLeave" parameterType="java.lang.String" resultType="java.lang.String">
  7 + select StudentNum from HS_LeaveExaminePassList where StudentNum= #{cardNo}
  8 + and GETDATE() <![CDATA[ > ]]> LeaveTime and GETDATE() <![CDATA[ < ]]> ReturnTime
  9 + </select>
  10 +
  11 + <resultMap id="School" type="com.sincere.smartSearch.model.School" >
  12 + <result column="school_id" property="schoolId" jdbcType="INTEGER" />
  13 + <result column="school_name" property="schoolName" jdbcType="VARCHAR" />
  14 + </resultMap>
  15 +
  16 + <select id="selectSchoolBySchoolId" parameterType="java.lang.Integer" resultMap="School">
  17 + select school_id , school_name from SZ_School where school_id = #{schoolId}
  18 + </select>
  19 +
  20 +
  21 + <resultMap id="User" type="com.sincere.smartSearch.model.User" >
  22 + <result column="school_id" property="schoolId" jdbcType="INTEGER" />
  23 + <result column="class_id" property="classId" jdbcType="INTEGER" />
  24 + <result column="name" property="name" jdbcType="VARCHAR" />
  25 + <result column="student_id" property="studentId" jdbcType="INTEGER" />
  26 + </resultMap>
  27 +
  28 + <select id="selectUserByCardNum" parameterType="java.lang.String" resultMap="User">
  29 + select school_id , class_id ,name ,student_id from
  30 + (select top 1 b.school_id, b.class_id, b.name, student_id from SZ_V_Card a
  31 + inner join SZ_V_School_Student b on a.user_id = b.student_id
  32 + and b.role_state = 1 where a.type = 2 and a.num = #{cardNum}
  33 + union
  34 + select top 1 b.school_id, 0 as class_id, b.name,b.teacher_id as student_id from SZ_V_Card a
  35 + inner join SZ_V_School_Teacher b on a.user_id = b.teacher_id
  36 + and b.role_state = 1 where a.type = 0 and a.num = #{cardNum}
  37 + ) x
  38 + </select>
  39 +
  40 + <resultMap id="UpDateCard" type="com.sincere.smartSearch.model.UpdateCard" >
  41 + <result column="ID" property="id" jdbcType="INTEGER" />
  42 + <result column="UserType" property="userType" jdbcType="INTEGER" />
  43 + <result column="oldCard" property="oldCard" jdbcType="VARCHAR" />
  44 + </resultMap>
  45 + <select id="selectUpdateCardByUpdateId" parameterType="java.lang.Integer" resultMap="UpDateCard">
  46 + select ID ,UserType , OldCard from HS_StudentUpdateCard where ID = #{updateId}
  47 + </select>
  48 +
  49 + <resultMap id="StudentCard" type="com.sincere.smartSearch.model.StudentCard" >
  50 + <result column="CardType" property="cardType" jdbcType="VARCHAR" />
  51 + <result column="CardNum" property="cardNum" jdbcType="VARCHAR" />
  52 + </resultMap>
  53 + <select id="selectStudentCard" parameterType="java.lang.String" resultMap="StudentCard">
  54 + select CardType , CardNum from HS_StudentCards where CardNum = #{cardNum}
  55 + </select>
  56 +</mapper>
0 \ No newline at end of file 57 \ No newline at end of file
cloud/weigeng/libs/sqljdbc4-4.2-6.jar
No preview for this file type
cloud/weigeng/pom.xml
@@ -3,10 +3,9 @@ @@ -3,10 +3,9 @@
3 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 3 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4 <modelVersion>4.0.0</modelVersion> 4 <modelVersion>4.0.0</modelVersion>
5 <parent> 5 <parent>
6 - <groupId>org.springframework.boot</groupId>  
7 - <artifactId>spring-boot-starter-parent</artifactId>  
8 - <version>2.1.8.RELEASE</version>  
9 - <relativePath/> <!-- lookup parent from repository --> 6 + <artifactId>cloud</artifactId>
  7 + <groupId>com.sincere</groupId>
  8 + <version>1.0.0</version>
10 </parent> 9 </parent>
11 <groupId>com.sincere</groupId> 10 <groupId>com.sincere</groupId>
12 <artifactId>weigeng</artifactId> 11 <artifactId>weigeng</artifactId>
@@ -14,58 +13,59 @@ @@ -14,58 +13,59 @@
14 <name>weigeng</name> 13 <name>weigeng</name>
15 <description>Demo project for Spring Boot</description> 14 <description>Demo project for Spring Boot</description>
16 15
17 - <properties>  
18 - <java.version>1.8</java.version>  
19 - <spring-cloud.version>Greenwich.SR2</spring-cloud.version>  
20 - </properties> 16 +<!-- <properties>-->
  17 +<!-- <java.version>1.8</java.version>-->
  18 +<!-- <spring-cloud.version>Finchley.SR1</spring-cloud.version>-->
  19 +<!-- </properties>-->
21 20
22 <dependencies> 21 <dependencies>
23 <dependency> 22 <dependency>
24 - <groupId>org.springframework.boot</groupId>  
25 - <artifactId>spring-boot-starter-web</artifactId> 23 + <groupId>com.sincere</groupId>
  24 + <artifactId>common</artifactId>
  25 + <version>0.0.1-SNAPSHOT</version>
26 </dependency> 26 </dependency>
27 <dependency> 27 <dependency>
28 - <groupId>org.springframework.cloud</groupId>  
29 - <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> 28 + <groupId>org.apache.mina</groupId>
  29 + <artifactId>mina-core</artifactId>
  30 + <version>2.1.3</version>
30 </dependency> 31 </dependency>
31 -  
32 <dependency> 32 <dependency>
33 - <groupId>com.baidu.aip</groupId>  
34 - <artifactId>java-sdk</artifactId>  
35 - <version>4.10.0</version> 33 + <groupId>org.apache.poi</groupId>
  34 + <artifactId>poi</artifactId>
  35 + <version>4.1.0</version>
36 </dependency> 36 </dependency>
37 37
38 <dependency> 38 <dependency>
39 - <groupId>com.microsoft.sqlserver.jdbc</groupId>  
40 - <artifactId>sqljdbc</artifactId>  
41 - <scope>system</scope>  
42 - <version>1</version>  
43 - <systemPath>${project.basedir}/libs/sqljdbc4-4.2-6.jar</systemPath> 39 + <groupId>org.springframework.boot</groupId>
  40 + <artifactId>spring-boot-starter-test</artifactId>
  41 + <scope>test</scope>
44 </dependency> 42 </dependency>
45 -  
46 <dependency> 43 <dependency>
47 - <groupId>org.mybatis.spring.boot</groupId>  
48 - <artifactId>mybatis-spring-boot-starter</artifactId>  
49 - <version>2.0.1</version> 44 + <groupId>org.springframework.cloud</groupId>
  45 + <artifactId>spring-cloud-starter-feign</artifactId>
  46 + <version>1.3.6.RELEASE</version>
50 </dependency> 47 </dependency>
51 -  
52 <dependency> 48 <dependency>
53 - <groupId>com.drewnoakes</groupId>  
54 - <artifactId>metadata-extractor</artifactId>  
55 - <version>2.4.0-beta-1</version> 49 + <groupId>org.springframework.cloud</groupId>
  50 + <artifactId>spring-cloud-openfeign-core</artifactId>
  51 + <version>2.1.2.RELEASE</version>
56 </dependency> 52 </dependency>
57 -  
58 <dependency> 53 <dependency>
59 - <groupId>org.apache.poi</groupId>  
60 - <artifactId>poi</artifactId>  
61 - <version>4.1.0</version> 54 + <groupId>io.springfox</groupId>
  55 + <artifactId>springfox-swagger2</artifactId>
  56 + <version>2.5.0</version>
62 </dependency> 57 </dependency>
63 -  
64 <dependency> 58 <dependency>
65 - <groupId>org.springframework.boot</groupId>  
66 - <artifactId>spring-boot-starter-test</artifactId>  
67 - <scope>test</scope> 59 + <groupId>io.springfox</groupId>
  60 + <artifactId>springfox-swagger-ui</artifactId>
  61 + <version>2.5.0</version>
68 </dependency> 62 </dependency>
  63 + <dependency>
  64 + <groupId>org.apache.commons</groupId>
  65 + <artifactId>commons-lang3</artifactId>
  66 + <version>3.3.2</version>
  67 + </dependency>
  68 +
69 </dependencies> 69 </dependencies>
70 70
71 <dependencyManagement> 71 <dependencyManagement>
cloud/weigeng/src/main/java/com/sincere/weigeng/AuthService.java
@@ -1,86 +0,0 @@ @@ -1,86 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import org.json.JSONObject;  
4 -  
5 -import java.io.BufferedReader;  
6 -import java.io.InputStreamReader;  
7 -import java.net.HttpURLConnection;  
8 -import java.net.URL;  
9 -import java.util.List;  
10 -import java.util.Map;  
11 -  
12 -/**  
13 - * 获取token类  
14 - */  
15 -public class AuthService {  
16 - //设置APPID/AK/SK  
17 - public static final String APP_ID = "15990462";  
18 - public static final String API_KEY = "t70Rzr6SGmfU9S6MrqAkspsY";  
19 - public static final String SECRET_KEY = "nSqpqtrf7cCjo8vOB9knL85nwWNoxwvS ";  
20 - /**  
21 - * 获取权限token  
22 - * @return 返回示例:  
23 - * {  
24 - * "access_token": "24.460da4889caad24cccdb1fea17221975.2592000.1491995545.282335-1234567",  
25 - * "expires_in": 2592000  
26 - * }  
27 - */  
28 - public static String getAuth() {  
29 - // 官网获取的 API Key 更新为你注册的  
30 - String clientId = "t70Rzr6SGmfU9S6MrqAkspsY";  
31 - // 官网获取的 Secret Key 更新为你注册的  
32 - String clientSecret = "nSqpqtrf7cCjo8vOB9knL85nwWNoxwvS";  
33 - return getAuth(clientId, clientSecret);  
34 - }  
35 -  
36 - /**  
37 - * 获取API访问token  
38 - * 该token有一定的有效期,需要自行管理,当失效时需重新获取.  
39 - * @param ak - 百度云官网获取的 API Key  
40 - * @param sk - 百度云官网获取的 Securet Key  
41 - * @return assess_token 示例:  
42 - * "24.460da4889caad24cccdb1fea17221975.2592000.1491995545.282335-1234567"  
43 - */  
44 - public static String getAuth(String ak, String sk) {  
45 - // 获取token地址  
46 - String authHost = "https://aip.baidubce.com/oauth/2.0/token?";  
47 - String getAccessTokenUrl = authHost  
48 - // 1. grant_type为固定参数  
49 - + "grant_type=client_credentials"  
50 - // 2. 官网获取的 API Key  
51 - + "&client_id=" + ak  
52 - // 3. 官网获取的 Secret Key  
53 - + "&client_secret=" + sk;  
54 - try {  
55 - URL realUrl = new URL(getAccessTokenUrl);  
56 - // 打开和URL之间的连接  
57 - HttpURLConnection connection = (HttpURLConnection) realUrl.openConnection();  
58 - connection.setRequestMethod("GET");  
59 - connection.connect();  
60 - // 获取所有响应头字段  
61 - Map<String, List<String>> map = connection.getHeaderFields();  
62 - // 遍历所有的响应头字段  
63 - for (String key : map.keySet()) {  
64 - System.err.println(key + "--->" + map.get(key));  
65 - }  
66 - // 定义 BufferedReader输入流来读取URL的响应  
67 - BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));  
68 - String result = "";  
69 - String line;  
70 - while ((line = in.readLine()) != null) {  
71 - result += line;  
72 - }  
73 - /**  
74 - * 返回结果示例  
75 - */  
76 - System.err.println("result:" + result);  
77 - JSONObject jsonObject = new JSONObject(result);  
78 - String access_token = jsonObject.getString("access_token");  
79 - return access_token;  
80 - } catch (Exception e) {  
81 - System.err.printf("获取token失败!");  
82 - e.printStackTrace(System.err);  
83 - }  
84 - return null;  
85 - }  
86 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/HomeBean.java
@@ -1,33 +0,0 @@ @@ -1,33 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -public class HomeBean {  
4 -  
5 - private String CreatorUserId;  
6 -  
7 - private String Title;  
8 -  
9 -  
10 - public String getCreatorUserId() {  
11 - return CreatorUserId;  
12 - }  
13 -  
14 - public void setCreatorUserId(String creatorUserId) {  
15 - CreatorUserId = creatorUserId;  
16 - }  
17 -  
18 - public String getTitle() {  
19 - return Title;  
20 - }  
21 -  
22 - public void setTitle(String title) {  
23 - Title = title;  
24 - }  
25 -  
26 - @Override  
27 - public String toString() {  
28 - return "HomeBean{" +  
29 - "CreatorUserId='" + CreatorUserId + '\'' +  
30 - ", Title='" + Title + '\'' +  
31 - '}';  
32 - }  
33 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/Homework.java
@@ -1,189 +0,0 @@ @@ -1,189 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import java.io.Serializable;  
4 -  
5 -public class Homework implements Serializable {  
6 -  
7 - private String ID;  
8 -  
9 - private String CreatorUserId;  
10 -  
11 - private String PaperId;  
12 -  
13 - private String Title;  
14 -  
15 - private int SuggestionTime;  
16 -  
17 - private String Deadline;  
18 -  
19 - private int State;  
20 -  
21 - private String Intime;  
22 -  
23 - private int SubjectId;  
24 -  
25 - private int PublishAnswerType;  
26 -  
27 - private int IsPigai;  
28 -  
29 - private String StartTime;  
30 -  
31 - private int TypeId;  
32 -  
33 - private String QuestionIds;  
34 -  
35 - private int HomeworkType;  
36 -  
37 - private int PkgId;  
38 -  
39 - public String getCreatorUserId() {  
40 - return CreatorUserId;  
41 - }  
42 -  
43 - public void setCreatorUserId(String creatorUserId) {  
44 - CreatorUserId = creatorUserId;  
45 - }  
46 -  
47 - public String getPaperId() {  
48 - return PaperId;  
49 - }  
50 -  
51 - public String getID() {  
52 - return ID;  
53 - }  
54 -  
55 - public void setID(String ID) {  
56 - this.ID = ID;  
57 - }  
58 -  
59 - @Override  
60 - public String toString() {  
61 - return "Homework{" +  
62 - "ID='" + ID + '\'' +  
63 - ", CreatorUserId='" + CreatorUserId + '\'' +  
64 - ", PaperId='" + PaperId + '\'' +  
65 - ", Title='" + Title + '\'' +  
66 - ", SuggestionTime=" + SuggestionTime +  
67 - ", Deadline='" + Deadline + '\'' +  
68 - ", State=" + State +  
69 - ", Intime='" + Intime + '\'' +  
70 - ", SubjectId=" + SubjectId +  
71 - ", PublishAnswerType=" + PublishAnswerType +  
72 - ", IsPigai=" + IsPigai +  
73 - ", StartTime='" + StartTime + '\'' +  
74 - ", TypeId=" + TypeId +  
75 - ", QuestionIds='" + QuestionIds + '\'' +  
76 - ", HomeworkType=" + HomeworkType +  
77 - ", PkgId=" + PkgId +  
78 - '}';  
79 - }  
80 -  
81 - public void setPaperId(String paperId) {  
82 - PaperId = paperId;  
83 - }  
84 -  
85 - public String getTitle() {  
86 - return Title;  
87 - }  
88 -  
89 - public void setTitle(String title) {  
90 - Title = title;  
91 - }  
92 -  
93 - public int getSuggestionTime() {  
94 - return SuggestionTime;  
95 - }  
96 -  
97 - public void setSuggestionTime(int suggestionTime) {  
98 - SuggestionTime = suggestionTime;  
99 - }  
100 -  
101 - public String getDeadline() {  
102 - return Deadline;  
103 - }  
104 -  
105 - public void setDeadline(String deadline) {  
106 - Deadline = deadline;  
107 - }  
108 -  
109 - public int getState() {  
110 - return State;  
111 - }  
112 -  
113 - public void setState(int state) {  
114 - State = state;  
115 - }  
116 -  
117 - public String getIntime() {  
118 - return Intime;  
119 - }  
120 -  
121 - public void setIntime(String intime) {  
122 - Intime = intime;  
123 - }  
124 -  
125 - public int getSubjectId() {  
126 - return SubjectId;  
127 - }  
128 -  
129 - public void setSubjectId(int subjectId) {  
130 - SubjectId = subjectId;  
131 - }  
132 -  
133 - public int getPublishAnswerType() {  
134 - return PublishAnswerType;  
135 - }  
136 -  
137 - public void setPublishAnswerType(int publishAnswerType) {  
138 - PublishAnswerType = publishAnswerType;  
139 - }  
140 -  
141 - public int getIsPigai() {  
142 - return IsPigai;  
143 - }  
144 -  
145 - public void setIsPigai(int isPigai) {  
146 - IsPigai = isPigai;  
147 - }  
148 -  
149 - public String getStartTime() {  
150 - return StartTime;  
151 - }  
152 -  
153 - public void setStartTime(String startTime) {  
154 - StartTime = startTime;  
155 - }  
156 -  
157 - public int getTypeId() {  
158 - return TypeId;  
159 - }  
160 -  
161 - public void setTypeId(int typeId) {  
162 - TypeId = typeId;  
163 - }  
164 -  
165 - public String getQuestionIds() {  
166 - return QuestionIds;  
167 - }  
168 -  
169 - public void setQuestionIds(String questionIds) {  
170 - QuestionIds = questionIds;  
171 - }  
172 -  
173 - public int getHomeworkType() {  
174 - return HomeworkType;  
175 - }  
176 -  
177 - public void setHomeworkType(int homeworkType) {  
178 - HomeworkType = homeworkType;  
179 - }  
180 -  
181 - public int getPkgId() {  
182 - return PkgId;  
183 - }  
184 -  
185 - public void setPkgId(int pkgId) {  
186 - PkgId = pkgId;  
187 - }  
188 -  
189 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/HomeworkReceive.java
@@ -1,34 +0,0 @@ @@ -1,34 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import java.io.Serializable;  
4 -  
5 -public class HomeworkReceive implements Serializable {  
6 -  
7 - private String StudentId;  
8 -  
9 - private String StudnetAnswerIds;  
10 -  
11 - public String getStudentId() {  
12 - return StudentId;  
13 - }  
14 -  
15 - public void setStudentId(String studentId) {  
16 - StudentId = studentId;  
17 - }  
18 -  
19 - public String getStudnetAnswerIds() {  
20 - return StudnetAnswerIds;  
21 - }  
22 -  
23 - public void setStudnetAnswerIds(String studnetAnswerIds) {  
24 - StudnetAnswerIds = studnetAnswerIds;  
25 - }  
26 -  
27 - @Override  
28 - public String toString() {  
29 - return "HomeworkReceive{" +  
30 - "StudentId='" + StudentId + '\'' +  
31 - ", StudnetAnswerIds='" + StudnetAnswerIds + '\'' +  
32 - '}';  
33 - }  
34 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/ImageUtils.java
@@ -1,168 +0,0 @@ @@ -1,168 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import com.drew.imaging.ImageMetadataReader;  
4 -import com.drew.imaging.jpeg.JpegMetadataReader;  
5 -import com.drew.metadata.Directory;  
6 -import com.drew.metadata.Metadata;  
7 -import com.drew.metadata.Tag;  
8 -import com.sun.imageio.plugins.png.PNGImageReader;  
9 -import org.apache.commons.lang.StringUtils;  
10 -  
11 -import javax.imageio.ImageIO;  
12 -import java.awt.*;  
13 -import java.awt.image.BufferedImage;  
14 -import java.io.File;  
15 -import java.io.IOException;  
16 -import java.util.Iterator;  
17 -  
18 -public class ImageUtils {  
19 -  
20 -  
21 - /* *//**  
22 - * 获取图片正确显示需要旋转的角度(顺时针)  
23 - * @return  
24 - *//*  
25 - public static int getRotateAngleForPhoto(String filePath){  
26 - File file = new File(filePath);  
27 - int angle = 0;  
28 - Metadata metadata;  
29 - try {  
30 - metadata = JpegMetadataReader.readMetadata(file);  
31 - Directory directory = metadata.getDirectory(ExifDirectory.class);  
32 - if(directory.containsTag(ExifDirectory.TAG_ORIENTATION)){  
33 -  
34 - // Exif信息中方向    
35 - int orientation = directory.getInt(ExifDirectory.TAG_ORIENTATION);  
36 - // 原图片的方向信息  
37 - if(6 == orientation ){  
38 - //6旋转90  
39 - angle = 90;  
40 - }else if( 3 == orientation){  
41 - //3旋转180  
42 - angle = 180;  
43 - }else if( 8 == orientation){  
44 - //8旋转90  
45 - angle = 270;  
46 - }  
47 - }  
48 - } catch (JpegProcessingException e) {  
49 - e.printStackTrace();  
50 - } catch (MetadataException e) {  
51 - e.printStackTrace();  
52 - } catch (IOException e) {  
53 - e.printStackTrace();  
54 - }  
55 - return angle;  
56 - }*/  
57 -  
58 -  
59 - /**  
60 - * 获得图片调整角度  
61 - * make by dongxh 2017年11月1日下午3:40:20  
62 - * @param imgFile  
63 - * @return  
64 - */  
65 - public static Integer getImgRotateAngle(String imgFile){  
66 - return 0;  
67 - /*int angel = 0;  
68 - try {  
69 - File file = new File(imgFile);  
70 - Metadata metadata = ImageMetadataReader.readMetadata(file);  
71 - for (Directory directory : metadata.getDirectories()) {  
72 - for (Tag tag : directory.getTags()) {  
73 - if (tag.getTagType() == ExifDirectoryBase.TAG_ORIENTATION) {  
74 - String description = tag.getDescription();  
75 -// System.out.println(description);  
76 - if (description.contains("90")) {  
77 - // 顺时针旋转90度  
78 - angel = 90;  
79 - } else if (description.contains("180")) {  
80 - // 顺时针旋转180度  
81 - angel = 180;  
82 - } else if (description.contains("270")) {  
83 - // 顺时针旋转270度  
84 - angel = 270;  
85 - }  
86 - }  
87 - }  
88 - }  
89 -// System.out.println(angel);  
90 - } catch (Exception e) {  
91 - e.printStackTrace();  
92 - }  
93 - return angel;*/  
94 - /*Integer angel = 0;  
95 - Metadata metadata = null;  
96 - try{  
97 - if(StringUtils.isBlank(imgFile))return angel;  
98 - File _img_file_ = new File(imgFile);  
99 - if(!_img_file_.exists())return angel;  
100 - metadata = JpegMetadataReader.readMetadata(_img_file_);  
101 - Directory directory = metadata.getDirectory(ExifDirectory.class);  
102 - Iterator iterator =directory.getTagIterator();  
103 - while (iterator.hasNext()){  
104 - System.out.println("directory:"+iterator.next().toString());  
105 - }  
106 - if(directory != null && directory.containsTag(ExifDirectory.TAG_ORIENTATION)){  
107 - int orientation = directory.getInt(ExifDirectory.TAG_ORIENTATION);  
108 - // 原图片的方向信息  
109 - if(6 == orientation ){  
110 - //6旋转90  
111 - angel = 90;  
112 - }else if( 3 == orientation){  
113 - //3旋转180  
114 - angel = 180;  
115 - }else if( 8 == orientation){  
116 - //8旋转90  
117 - angel = 270;  
118 - }  
119 - }  
120 - }catch(Exception e){  
121 - e.printStackTrace();  
122 - }  
123 - return angel;*/  
124 - }  
125 -  
126 - /**  
127 - * 旋转照片  
128 - * @return  
129 - */  
130 - public static String rotatePhonePhoto(String fullPath, int angel){  
131 -  
132 - BufferedImage src;  
133 - try {  
134 - src = ImageIO.read(new File(fullPath));  
135 - int src_width = src.getWidth(null);  
136 - int src_height = src.getHeight(null);  
137 -  
138 - int swidth=src_width;  
139 - int sheight=src_height;  
140 -  
141 - if(angel==90||angel==270){  
142 - swidth = src_height;  
143 - sheight= src_width;  
144 - }  
145 -  
146 - Rectangle rect_des = new Rectangle(new Dimension(swidth,sheight));  
147 -  
148 - BufferedImage res = new BufferedImage(rect_des.width, rect_des.height,BufferedImage.TYPE_INT_RGB);  
149 - Graphics2D g2 = res.createGraphics();  
150 -  
151 - g2.translate((rect_des.width - src_width) / 2,  
152 - (rect_des.height - src_height) / 2);  
153 - g2.rotate(Math.toRadians(angel), src_width / 2, src_height / 2);  
154 -  
155 - g2.drawImage(src, null, null);  
156 -  
157 - ImageIO.write(res, "jpg", new File(fullPath));  
158 -  
159 - } catch (IOException e) {  
160 -  
161 - e.printStackTrace();  
162 - }  
163 -  
164 - return fullPath;  
165 -  
166 - }  
167 -  
168 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/JiaoCai.java
@@ -1,46 +0,0 @@ @@ -1,46 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import java.io.Serializable;  
4 -  
5 -public class JiaoCai implements Serializable {  
6 -  
7 -  
8 - private String ID;  
9 -  
10 - private String SubjectId;  
11 -  
12 - private String JiaoCaiName;  
13 -  
14 - public String getID() {  
15 - return ID;  
16 - }  
17 -  
18 - public void setID(String ID) {  
19 - this.ID = ID;  
20 - }  
21 -  
22 - public String getSubjectId() {  
23 - return SubjectId;  
24 - }  
25 -  
26 - public void setSubjectId(String subjectId) {  
27 - SubjectId = subjectId;  
28 - }  
29 -  
30 - public String getJiaoCaiName() {  
31 - return JiaoCaiName;  
32 - }  
33 -  
34 - public void setJiaoCaiName(String jiaoCaiName) {  
35 - JiaoCaiName = jiaoCaiName;  
36 - }  
37 -  
38 - @Override  
39 - public String toString() {  
40 - return "JiaoCai{" +  
41 - "ID='" + ID + '\'' +  
42 - ", SubjectId='" + SubjectId + '\'' +  
43 - ", JiaoCaiName='" + JiaoCaiName + '\'' +  
44 - '}';  
45 - }  
46 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/Knowledge.java
@@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import java.io.Serializable;  
4 -  
5 -public class Knowledge implements Serializable {  
6 -  
7 - private String Name;  
8 -  
9 - private String SubjectId;  
10 -  
11 - private String Id;  
12 -  
13 - public String getId() {  
14 - return Id;  
15 - }  
16 -  
17 - public void setId(String id) {  
18 - Id = id;  
19 - }  
20 -  
21 - public String getName() {  
22 - return Name;  
23 - }  
24 -  
25 - public void setName(String name) {  
26 - Name = name;  
27 - }  
28 -  
29 - public String getSubjectId() {  
30 - return SubjectId;  
31 - }  
32 -  
33 - public void setSubjectId(String subjectId) {  
34 - SubjectId = subjectId;  
35 - }  
36 -  
37 - @Override  
38 - public String toString() {  
39 - return "Knowledge{" +  
40 - "Name='" + Name + '\'' +  
41 - ", SubjectId='" + SubjectId + '\'' +  
42 - '}';  
43 - }  
44 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/MyTask.java
@@ -1,30 +0,0 @@ @@ -1,30 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import com.baidu.aip.ocr.AipOcr;  
4 -import com.baidu.aip.util.Base64Util;  
5 -import com.fasterxml.jackson.databind.ObjectMapper;  
6 -import org.json.JSONObject;  
7 -import org.springframework.boot.ApplicationArguments;  
8 -import org.springframework.boot.ApplicationRunner;  
9 -import org.springframework.http.HttpEntity;  
10 -import org.springframework.http.HttpHeaders;  
11 -import org.springframework.http.MediaType;  
12 -import org.springframework.http.ResponseEntity;  
13 -import org.springframework.stereotype.Component;  
14 -import org.springframework.util.LinkedMultiValueMap;  
15 -import org.springframework.util.MultiValueMap;  
16 -import org.springframework.web.client.RestTemplate;  
17 -  
18 -import java.util.HashMap;  
19 -  
20 -@Component  
21 -public class MyTask implements ApplicationRunner {  
22 -  
23 -  
24 -  
25 - @Override  
26 - public void run(ApplicationArguments args) throws Exception {  
27 -  
28 - System.out.println("authon:" + AuthService.getAuth());  
29 - }  
30 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/QuestionBean.java
@@ -1,277 +0,0 @@ @@ -1,277 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import java.io.Serializable;  
4 -  
5 -public class QuestionBean implements Serializable {  
6 -  
7 -  
8 - private String ID;  
9 -  
10 - private String Question;  
11 -  
12 - private String Qtype;  
13 -  
14 - private String Answer;  
15 -  
16 - private String CorrectAnswer;  
17 -  
18 - private String Analysis;  
19 -  
20 - private String State;  
21 -  
22 - private String Intime;  
23 -  
24 - private String ExamineFlag;  
25 -  
26 - private String ExamineUserId;  
27 -  
28 - private String CreateUserId;  
29 -  
30 - private String SubjectId;  
31 -  
32 - private String SchoolId;  
33 -  
34 - private String DifficulteId;  
35 -  
36 - private String KnowledgeId;  
37 -  
38 - private String ChapterId;  
39 -  
40 - private String GradeId;  
41 -  
42 - private String SourceId;  
43 -  
44 - private String OrderId;  
45 -  
46 - private String SId;  
47 -  
48 - private String StemId;  
49 -  
50 - private String AutomaticCorrection;  
51 -  
52 - private String PkgId;  
53 -  
54 - private String PkgType;  
55 -  
56 - public String getQuestion() {  
57 - return Question;  
58 - }  
59 -  
60 - public void setQuestion(String question) {  
61 - Question = question;  
62 - }  
63 -  
64 - public String getQtype() {  
65 - return Qtype;  
66 - }  
67 -  
68 - public void setQtype(String qtype) {  
69 - Qtype = qtype;  
70 - }  
71 -  
72 - public String getAnswer() {  
73 - return Answer;  
74 - }  
75 -  
76 - public void setAnswer(String answer) {  
77 - Answer = answer;  
78 - }  
79 -  
80 - public String getCorrectAnswer() {  
81 - return CorrectAnswer;  
82 - }  
83 -  
84 - public void setCorrectAnswer(String correctAnswer) {  
85 - CorrectAnswer = correctAnswer;  
86 - }  
87 -  
88 - public String getAnalysis() {  
89 - return Analysis;  
90 - }  
91 -  
92 - public void setAnalysis(String analysis) {  
93 - Analysis = analysis;  
94 - }  
95 -  
96 - public String getState() {  
97 - return State;  
98 - }  
99 -  
100 - public void setState(String state) {  
101 - State = state;  
102 - }  
103 -  
104 - public String getIntime() {  
105 - return Intime;  
106 - }  
107 -  
108 - public void setIntime(String intime) {  
109 - Intime = intime;  
110 - }  
111 -  
112 - public String getExamineFlag() {  
113 - return ExamineFlag;  
114 - }  
115 -  
116 - public void setExamineFlag(String examineFlag) {  
117 - ExamineFlag = examineFlag;  
118 - }  
119 -  
120 - public String getExamineUserId() {  
121 - return ExamineUserId;  
122 - }  
123 -  
124 - public void setExamineUserId(String examineUserId) {  
125 - ExamineUserId = examineUserId;  
126 - }  
127 -  
128 - public String getCreateUserId() {  
129 - return CreateUserId;  
130 - }  
131 -  
132 - public void setCreateUserId(String createUserId) {  
133 - CreateUserId = createUserId;  
134 - }  
135 -  
136 - public String getSubjectId() {  
137 - return SubjectId;  
138 - }  
139 -  
140 - public void setSubjectId(String subjectId) {  
141 - SubjectId = subjectId;  
142 - }  
143 -  
144 - public String getSchoolId() {  
145 - return SchoolId;  
146 - }  
147 -  
148 - public void setSchoolId(String schoolId) {  
149 - SchoolId = schoolId;  
150 - }  
151 -  
152 - public String getDifficulteId() {  
153 - return DifficulteId;  
154 - }  
155 -  
156 - public void setDifficulteId(String difficulteId) {  
157 - DifficulteId = difficulteId;  
158 - }  
159 -  
160 - public String getKnowledgeId() {  
161 - return KnowledgeId;  
162 - }  
163 -  
164 - public void setKnowledgeId(String knowledgeId) {  
165 - KnowledgeId = knowledgeId;  
166 - }  
167 -  
168 - public String getChapterId() {  
169 - return ChapterId;  
170 - }  
171 -  
172 - public void setChapterId(String chapterId) {  
173 - ChapterId = chapterId;  
174 - }  
175 -  
176 - public String getGradeId() {  
177 - return GradeId;  
178 - }  
179 -  
180 - public void setGradeId(String gradeId) {  
181 - GradeId = gradeId;  
182 - }  
183 -  
184 - public String getSourceId() {  
185 - return SourceId;  
186 - }  
187 -  
188 - public void setSourceId(String sourceId) {  
189 - SourceId = sourceId;  
190 - }  
191 -  
192 - public String getOrderId() {  
193 - return OrderId;  
194 - }  
195 -  
196 - public void setOrderId(String orderId) {  
197 - OrderId = orderId;  
198 - }  
199 -  
200 - public String getSId() {  
201 - return SId;  
202 - }  
203 -  
204 - public void setSId(String SId) {  
205 - this.SId = SId;  
206 - }  
207 -  
208 - public String getStemId() {  
209 - return StemId;  
210 - }  
211 -  
212 - public void setStemId(String stemId) {  
213 - StemId = stemId;  
214 - }  
215 -  
216 - public String getAutomaticCorrection() {  
217 - return AutomaticCorrection;  
218 - }  
219 -  
220 - public void setAutomaticCorrection(String automaticCorrection) {  
221 - AutomaticCorrection = automaticCorrection;  
222 - }  
223 -  
224 - public String getPkgId() {  
225 - return PkgId;  
226 - }  
227 -  
228 - public void setPkgId(String pkgId) {  
229 - PkgId = pkgId;  
230 - }  
231 -  
232 - public String getPkgType() {  
233 - return PkgType;  
234 - }  
235 -  
236 - public void setPkgType(String pkgType) {  
237 - PkgType = pkgType;  
238 - }  
239 -  
240 - public String getID() {  
241 - return ID;  
242 - }  
243 -  
244 - public void setID(String ID) {  
245 - this.ID = ID;  
246 - }  
247 -  
248 - @Override  
249 - public String toString() {  
250 - return "QuestionBean{" +  
251 - "ID='" + ID + '\'' +  
252 - ", Question='" + Question + '\'' +  
253 - ", Qtype='" + Qtype + '\'' +  
254 - ", Answer='" + Answer + '\'' +  
255 - ", CorrectAnswer='" + CorrectAnswer + '\'' +  
256 - ", Analysis='" + Analysis + '\'' +  
257 - ", State='" + State + '\'' +  
258 - ", Intime='" + Intime + '\'' +  
259 - ", ExamineFlag='" + ExamineFlag + '\'' +  
260 - ", ExamineUserId='" + ExamineUserId + '\'' +  
261 - ", CreateUserId='" + CreateUserId + '\'' +  
262 - ", SubjectId='" + SubjectId + '\'' +  
263 - ", SchoolId='" + SchoolId + '\'' +  
264 - ", DifficulteId='" + DifficulteId + '\'' +  
265 - ", KnowledgeId='" + KnowledgeId + '\'' +  
266 - ", ChapterId='" + ChapterId + '\'' +  
267 - ", GradeId='" + GradeId + '\'' +  
268 - ", SourceId='" + SourceId + '\'' +  
269 - ", OrderId='" + OrderId + '\'' +  
270 - ", SId='" + SId + '\'' +  
271 - ", StemId='" + StemId + '\'' +  
272 - ", AutomaticCorrection='" + AutomaticCorrection + '\'' +  
273 - ", PkgId='" + PkgId + '\'' +  
274 - ", PkgType='" + PkgType + '\'' +  
275 - '}';  
276 - }  
277 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/StudentAnswer.java
@@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import java.io.Serializable;  
4 -  
5 -public class StudentAnswer implements Serializable {  
6 -  
7 - private String ID;  
8 -  
9 - private String CorrectAnswer;  
10 -  
11 - private String Answer;  
12 -  
13 - public String getID() {  
14 - return ID;  
15 - }  
16 -  
17 - public String getAnswer() {  
18 - return Answer;  
19 - }  
20 -  
21 - public void setAnswer(String answer) {  
22 - Answer = answer;  
23 - }  
24 -  
25 - public void setID(String ID) {  
26 - this.ID = ID;  
27 - }  
28 -  
29 - public String getCorrectAnswer() {  
30 - return CorrectAnswer;  
31 - }  
32 -  
33 - public void setCorrectAnswer(String correctAnswer) {  
34 - CorrectAnswer = correctAnswer;  
35 - }  
36 -  
37 - @Override  
38 - public String toString() {  
39 - return "StudentAnswer{" +  
40 - "ID='" + ID + '\'' +  
41 - ", CorrectAnswer='" + CorrectAnswer + '\'' +  
42 - '}';  
43 - }  
44 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/StudentBean.java
@@ -1,233 +0,0 @@ @@ -1,233 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import java.io.Serializable;  
4 -import java.util.Date;  
5 -  
6 -public class StudentBean implements Serializable {  
7 -  
8 -  
9 - private long ID;  
10 - private String UserId;  
11 -  
12 - private String CustomerId;  
13 -  
14 - private int StudentType;  
15 -  
16 - private int UserType;  
17 -  
18 - private String Name;  
19 -  
20 - private int ClassId;  
21 -  
22 - private String ClassName;  
23 -  
24 - private String OldCard;  
25 -  
26 - private String Card;  
27 -  
28 - private int SchoolId;  
29 -  
30 - private int school_id;  
31 -  
32 - private int IsNew;  
33 -  
34 - private int UpdateType;  
35 -  
36 - private Date AddTime;  
37 -  
38 - private int Sex;  
39 -  
40 - private String Face;  
41 -  
42 - private String StudentCode;  
43 -  
44 - private String student_num;  
45 -  
46 - private String student_id;  
47 -  
48 - public String getUserId() {  
49 - return UserId;  
50 - }  
51 -  
52 - public void setUserId(String userId) {  
53 - UserId = userId;  
54 - }  
55 -  
56 - public String getCustomerId() {  
57 - return CustomerId;  
58 - }  
59 -  
60 - public void setCustomerId(String customerId) {  
61 - CustomerId = customerId;  
62 - }  
63 -  
64 - public int getStudentType() {  
65 - return StudentType;  
66 - }  
67 -  
68 - public void setStudentType(int studentType) {  
69 - StudentType = studentType;  
70 - }  
71 -  
72 - public int getUserType() {  
73 - return UserType;  
74 - }  
75 -  
76 - public void setUserType(int userType) {  
77 - UserType = userType;  
78 - }  
79 -  
80 - public String getName() {  
81 - return Name;  
82 - }  
83 -  
84 - public void setName(String name) {  
85 - Name = name;  
86 - }  
87 -  
88 - public int getClassId() {  
89 - return ClassId;  
90 - }  
91 -  
92 - public void setClassId(int classId) {  
93 - ClassId = classId;  
94 - }  
95 -  
96 - public String getClassName() {  
97 - return ClassName;  
98 - }  
99 -  
100 - public void setClassName(String className) {  
101 - ClassName = className;  
102 - }  
103 -  
104 - public String getOldCard() {  
105 - return OldCard;  
106 - }  
107 -  
108 - public void setOldCard(String oldCard) {  
109 - OldCard = oldCard;  
110 - }  
111 -  
112 - public String getCard() {  
113 - return Card;  
114 - }  
115 -  
116 - public int getSchool_id() {  
117 - return school_id;  
118 - }  
119 -  
120 - public void setSchool_id(int school_id) {  
121 - this.school_id = school_id;  
122 - }  
123 -  
124 - public String getStudent_num() {  
125 - return student_num;  
126 - }  
127 -  
128 - public void setStudent_num(String student_num) {  
129 - this.student_num = student_num;  
130 - }  
131 -  
132 - public void setCard(String card) {  
133 - Card = card;  
134 - }  
135 -  
136 - public int getSchoolId() {  
137 - return SchoolId;  
138 - }  
139 -  
140 - public void setSchoolId(int schoolId) {  
141 - SchoolId = schoolId;  
142 - }  
143 -  
144 - public int getIsNew() {  
145 - return IsNew;  
146 - }  
147 -  
148 - public void setIsNew(int isNew) {  
149 - IsNew = isNew;  
150 - }  
151 -  
152 - public int getUpdateType() {  
153 - return UpdateType;  
154 - }  
155 -  
156 - public void setUpdateType(int updateType) {  
157 - UpdateType = updateType;  
158 - }  
159 -  
160 - public Date getAddTime() {  
161 - return AddTime;  
162 - }  
163 -  
164 - public void setAddTime(Date addTime) {  
165 - AddTime = addTime;  
166 - }  
167 -  
168 - public int getSex() {  
169 - return Sex;  
170 - }  
171 -  
172 - public void setSex(int sex) {  
173 - Sex = sex;  
174 - }  
175 -  
176 - public String getFace() {  
177 - return Face;  
178 - }  
179 -  
180 - public void setFace(String face) {  
181 - Face = face;  
182 - }  
183 -  
184 - public String getStudentCode() {  
185 - return StudentCode;  
186 - }  
187 -  
188 - public void setStudentCode(String studentCode) {  
189 - StudentCode = studentCode;  
190 - }  
191 -  
192 - public long getID() {  
193 - return ID;  
194 - }  
195 -  
196 - public void setID(long ID) {  
197 - this.ID = ID;  
198 - }  
199 -  
200 - public String getStudent_id() {  
201 - return student_id;  
202 - }  
203 -  
204 - public void setStudent_id(String student_id) {  
205 - this.student_id = student_id;  
206 - }  
207 -  
208 - @Override  
209 - public String toString() {  
210 - return "StudentBean{" +  
211 - "ID=" + ID +  
212 - ", UserId='" + UserId + '\'' +  
213 - ", CustomerId='" + CustomerId + '\'' +  
214 - ", StudentType=" + StudentType +  
215 - ", UserType=" + UserType +  
216 - ", Name='" + Name + '\'' +  
217 - ", ClassId=" + ClassId +  
218 - ", ClassName='" + ClassName + '\'' +  
219 - ", OldCard='" + OldCard + '\'' +  
220 - ", Card='" + Card + '\'' +  
221 - ", SchoolId=" + SchoolId +  
222 - ", school_id=" + school_id +  
223 - ", IsNew=" + IsNew +  
224 - ", UpdateType=" + UpdateType +  
225 - ", AddTime=" + AddTime +  
226 - ", Sex=" + Sex +  
227 - ", Face='" + Face + '\'' +  
228 - ", StudentCode='" + StudentCode + '\'' +  
229 - ", student_num='" + student_num + '\'' +  
230 - ", student_id='" + student_id + '\'' +  
231 - '}';  
232 - }  
233 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/StudentInfo.java
@@ -1,57 +0,0 @@ @@ -1,57 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import java.io.Serializable;  
4 -  
5 -public class StudentInfo implements Serializable {  
6 -  
7 - private String student_id;  
8 -  
9 - private String name;  
10 -  
11 - private String class_name;  
12 -  
13 - private String ParentMobile;  
14 -  
15 - private String studentcode;  
16 -  
17 -  
18 - public String getStudentcode() {  
19 - return studentcode;  
20 - }  
21 -  
22 - public void setStudentcode(String studentcode) {  
23 - this.studentcode = studentcode;  
24 - }  
25 -  
26 - public String getStudent_id() {  
27 - return student_id;  
28 - }  
29 -  
30 - public void setStudent_id(String student_id) {  
31 - this.student_id = student_id;  
32 - }  
33 -  
34 - public String getName() {  
35 - return name;  
36 - }  
37 -  
38 - public void setName(String name) {  
39 - this.name = name;  
40 - }  
41 -  
42 - public String getClass_name() {  
43 - return class_name;  
44 - }  
45 -  
46 - public void setClass_name(String class_name) {  
47 - this.class_name = class_name;  
48 - }  
49 -  
50 - public String getParentMobile() {  
51 - return ParentMobile;  
52 - }  
53 -  
54 - public void setParentMobile(String parentMobile) {  
55 - ParentMobile = parentMobile;  
56 - }  
57 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/Swagger2.java 0 → 100644
@@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
  1 +package com.sincere.weigeng;
  2 +
  3 +import io.swagger.annotations.ApiOperation;
  4 +import org.springframework.context.annotation.Bean;
  5 +import org.springframework.context.annotation.Configuration;
  6 +import springfox.documentation.builders.ApiInfoBuilder;
  7 +import springfox.documentation.builders.PathSelectors;
  8 +import springfox.documentation.builders.RequestHandlerSelectors;
  9 +import springfox.documentation.service.ApiInfo;
  10 +import springfox.documentation.spi.DocumentationType;
  11 +import springfox.documentation.spring.web.plugins.Docket;
  12 +import springfox.documentation.swagger2.annotations.EnableSwagger2;
  13 +
  14 +@EnableSwagger2
  15 +@Configuration //让Spring来加载该类配置
  16 +public class Swagger2 {
  17 +
  18 + @Bean
  19 + public Docket createRestApi() {
  20 + return new Docket(DocumentationType.SWAGGER_2)
  21 + .apiInfo(apiInfo())
  22 + .enableUrlTemplating(true)
  23 + .select()
  24 + // 扫描所有有注解的api,用这种方式更灵活
  25 + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
  26 + .paths(PathSelectors.any())
  27 + .build();
  28 +
  29 + }
  30 + private ApiInfo apiInfo() {
  31 + return new ApiInfoBuilder()
  32 + .title("Spring Boot中使用Swagger2构建RESTful APIs")
  33 + .description("接口文档")
  34 + .termsOfServiceUrl("")
  35 + .version("1.0")
  36 + .build();
  37 + }
  38 +}
cloud/weigeng/src/main/java/com/sincere/weigeng/TestDao.java
@@ -1,138 +0,0 @@ @@ -1,138 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import org.apache.ibatis.annotations.*;  
4 -import org.springframework.stereotype.Repository;  
5 -  
6 -import java.util.List;  
7 -  
8 -@Repository  
9 -@Mapper  
10 -public interface TestDao {  
11 -  
12 -  
13 - @Insert("insert into TK_QuestionStem values(#{QuestionStem},#{State},#{Intime})")  
14 - int addQuestionStem(@Param("QuestionStem") String QuestionStem, @Param("State") String State, @Param("Intime") String Intime);  
15 -  
16 - @Insert("insert into TK_Question(Question,Qtype,Answer,CorrectAnswer,Analysis,State,Intime,ExamineFlag,ExamineUserId,CreateUserId,SubjectId,SchoolId,DifficulteId,KnowledgeId,ChapterId,GradeId,SourceId,OrderId,SId," +  
17 - "StemId,AutomaticCorrection,PkgId,PkgType) " +  
18 - "values(#{Question},#{Qtype},#{Answer},#{CorrectAnswer},#{Analysis},#{State},#{Intime},#{ExamineFlag},#{ExamineUserId}" +  
19 - ",#{CreateUserId},#{SubjectId},#{SchoolId},#{DifficulteId},#{KnowledgeId},#{ChapterId},#{GradeId},#{SourceId},#{OrderId},#{SId}" +  
20 - ",#{StemId},#{AutomaticCorrection},#{PkgId},#{PkgType})")  
21 - int addQuestion(@Param("Question") String Question, @Param("Qtype") String Qtype, @Param("Answer") String Answer, @Param("CorrectAnswer") String CorrectAnswer  
22 - , @Param("Analysis") String Analysis, @Param("State") String State, @Param("Intime") String Intime, @Param("ExamineFlag") String ExamineFlag, @Param("ExamineUserId") String ExamineUserId  
23 - , @Param("CreateUserId") String CreateUserId, @Param("SubjectId") String SubjectId, @Param("SchoolId") String SchoolId, @Param("DifficulteId") String DifficulteId, @Param("KnowledgeId") String KnowledgeId  
24 - , @Param("ChapterId") String ChapterId, @Param("GradeId") String GradeId, @Param("SourceId") String SourceId, @Param("OrderId") String OrderId, @Param("SId") String SId  
25 - , @Param("StemId") String StemId, @Param("AutomaticCorrection") String AutomaticCorrection, @Param("PkgId") String PkgId, @Param("PkgType") String PkgType);  
26 -  
27 - @Select("select Top(1) ID from TK_QuestionStem order by Intime desc ")  
28 - int getStemId();  
29 -  
30 - @Select("select * from TK_Question where Question like #{Question}")  
31 - List<QuestionBean> getQuestions(@Param("Question")String Question);  
32 -  
33 - @Update("update TK_Question set CorrectAnswer = #{answer},Analysis = #{explanation} where ID = #{id}")  
34 - void updateQuestion(@Param("id") String id, @Param("answer") String answer, @Param("explanation") String explanation);  
35 -  
36 -  
37 - //学生做作业  
38 - @Insert("insert into ZY_StudentAnswer (QuestionId,Answer,CorrectAnswer,QuestionType,IsCorrect,WorkID) values (" +  
39 - "#{QuestionId},#{Answer},#{CorrectAnswer},#{QuestionType},#{IsCorrect},#{WorkID})")  
40 - void StudentAnswer(@Param("QuestionId")String QuestionId,@Param("Answer")String Answer,@Param("CorrectAnswer")String CorrectAnswer,  
41 - @Param("QuestionType")String QuestionType,@Param("IsCorrect")String IsCorresct,@Param("WorkID")String WorkID);  
42 -  
43 - @Insert("insert into ZY_HomeworkReceive values(#{WorkId},#{ClassId},#{StudentId},#{StudnetAnswerIds},#{IsFinished}," +  
44 - "#{AnswerTime},#{FinishTime},#{Intime},#{IsPigai},#{IsPigai})")  
45 - void HomeworkReceive(@Param("WorkId")String WorkId,@Param("ClassId")String ClassId,@Param("StudentId")String StudentId,@Param("StudnetAnswerIds")String StudnetAnswerIds,  
46 - @Param("IsFinished")String IsFinished,@Param("AnswerTime")String AnswerTime,@Param("FinishTime")String FinishTime,@Param("Intime")String Intime,  
47 - @Param("IsPigai")String IsPigai,@Param("IsPigai")String UseTime);  
48 -  
49 - @Select("select * from TK_Question where ID = #{ID}")  
50 - QuestionBean getQues(@Param("ID")String ID);  
51 -  
52 - @Select("select StudentId from ZY_HomeworkReceive where WorkId = #{WorkId}")  
53 - List<String> getStudentIds(@Param("WorkId")String WorkId);  
54 -// )  
55 -  
56 - @Select("select ID from TK_Question where SchoolId = 885 and CorrectAnswer in('A','B','C','D') and ChapterId = #{ChapterId}")  
57 - List<String> getQIDS(@Param("ChapterId")String ChapterId );  
58 -  
59 - @Select("select ID from ZY_StudentAnswer where WorkID = #{WorkID}")  
60 - List<String> getStudentAnsIds(@Param("WorkID")String WorkID);  
61 -  
62 - //添加学生答题记录  
63 - @Insert("insert into ZY_StudentAnswer values (#{QuestionId},#{Answer},#{AnswerTime},#{CorrectAnswer},#{QuestionType},#{Pigai},#{IsCorrect},#{AppachIds},#{TeacherAppachIds},#{WorkID})")  
64 - void addStudentAnswer(@Param("QuestionId")String QuestionId,@Param("Answer")String Answer,@Param("AnswerTime")String AnswerTime,@Param("CorrectAnswer")String CorrectAnswer,  
65 - @Param("QuestionType")String QuestionType,@Param("Pigai")String Pigai,@Param("IsCorrect")String IsCorrect,@Param("AppachIds")String AppachIds,  
66 - @Param("TeacherAppachIds")String TeacherAppachIds,@Param("WorkID")String WorkID);  
67 -  
68 -  
69 - @Select("select Top(#{top}) ID from ZY_StudentAnswer where WorkID = #{WorkID} order by ID desc")  
70 - List<String> getTopIDs(@Param("WorkID")String WorkID,@Param("top")int top);  
71 -  
72 - @Select("select ID from ZY_HomeworkReceive where WorkId = #{WorkId} and ID >= #{ID} and ID<12054 order by ID desc")  
73 - List<String> get_HomeworkReceive(@Param("WorkId")String WorkId,@Param("ID")String ID);  
74 -  
75 - @Update("update ZY_HomeworkReceive set StudnetAnswerIds = #{StudnetAnswerIds} where ID = #{ID}")  
76 - void updateHomeWork(@Param("StudnetAnswerIds")String StudnetAnswerIds,@Param("ID")String ID);  
77 -  
78 - @Select("select * from ZY_HomeworkReceive where WorkId = #{WorkId} order by ID desc")  
79 - List<HomeworkReceive> get_HomeworkRec(@Param("WorkId")String WorkId);  
80 -  
81 - @Select("select Title from ZY_Homework where ID = #{ID} order by ID desc")  
82 - String getWorkName(@Param("ID") String workId);  
83 -  
84 - @Select("select * from ZY_StudentAnswer where WorkID = #{WorkId}")  
85 - List<StudentAnswer> get_stuAnswer(@Param("WorkId")String WorkId);  
86 -  
87 - @Update("update ZY_StudentAnswer set Answer = #{Answer},IsCorrect = #{IsCorrect} ,CorrectAnswer = #{CorrectAnswer} where ID = #{ID}")  
88 - void updateStudentAnswer(@Param("ID") String id,@Param("CorrectAnswer")String CorrectAnswer,@Param("Answer")String Answer,@Param("IsCorrect")String IsCorrect);  
89 -  
90 - @Select("select name from SZ_V_School_Student where student_id = #{student_id}")  
91 - String getStudentName(@Param("student_id") String studentId);  
92 -  
93 - @Select("select student_id from SZ_V_School_Student where class_id = #{class_id}")  
94 - List<String> getStudentIdsWithClassId(@Param("class_id") String class_id);  
95 -  
96 - @Select("select IsCorrect from ZY_StudentAnswer where ID = #{ID}")  
97 - int getIsCorrect(@Param("ID") String id);  
98 -  
99 - @Select("select QuestionId from ZY_StudentAnswer where WorkID = #{WorkID}")  
100 - List<String> getStuAnsIds(@Param("WorkID") String workId);  
101 -  
102 - @Select("select CorrectAnswer from ZY_StudentAnswer where WorkID = #{WorkID}")  
103 - List<String> correctAns(@Param("WorkID")String WorkID);  
104 -  
105 -  
106 - @Select("select * from ZY_TestPaper where CreatorUserId = #{CreateUserId} and Intime > #{Intime}")  
107 - List<TestPaper> getTestPapers(@Param("CreateUserId") String createUserId,@Param("Intime")String Intime);  
108 -  
109 - @Insert("insert into ZY_TestPaper values (#{addCreateUserId},#{questionIds},#{status},#{publishTime},#{name},#{isRecommend},#{state},#{intime},#{schoolId})")  
110 - void addTestPaper(@Param("addCreateUserId") String addCreateUserId, @Param("questionIds") String questionIds, @Param("status") int status,  
111 - @Param("publishTime") String publishTime, @Param("name") String name, @Param("isRecommend") int isRecommend,  
112 - @Param("state") int state, @Param("intime") String intime, @Param("schoolId") String schoolId);  
113 -  
114 - @Insert("insert into ZY_Homework values(#{addCreateUserId},#{id},#{name},#{s},#{s1},#{s2},#{s3},#{i},#{i1},#{i2},#{s4},#{i3},#{questionIds},#{i4},#{i5}) ")  
115 - void addHomework(@Param("addCreateUserId") String addCreateUserId, @Param("id") int id, @Param("name") String name,  
116 - @Param("s") String s, @Param("s1") String s1, @Param("s2") String s2, @Param("s3") String s3, @Param("i") int i,  
117 - @Param("i1") int i1, @Param("i2") int i2,@Param("s4") String s4, @Param("i3") int i3, @Param("questionIds") String questionIds, @Param("i4") int i4, @Param("i5") int i5);  
118 -  
119 -  
120 - @Select("select * from ZY_Homework where CreatorUserId in (select DISTINCT user_id from SZ_UserRole where school_id = 11)")  
121 - List<HomeBean> getCreatorUserId();  
122 -  
123 - @Select("select * from ZY_Homework where CreatorUserId = #{CreatorUserId}")  
124 - List<Homework> getHomeWork(@Param("CreatorUserId") String addCreateUserId);  
125 -  
126 - @Select("select * from SZ_V_School_Student where school_id = #{school_id}")  
127 - List<StudentInfo> getStudents(@Param("school_id") int school_id);  
128 -  
129 - @Select("select QuestionIds from ZY_Homework where ID = #{workId}")  
130 - String getQuestionIds(@Param("workId") String workId);  
131 -  
132 - @Select("select CorrectAnswer from TK_Question where ID = #{questionId}")  
133 - String getCorrectAnswer(@Param("questionId") String questionId);  
134 -  
135 -  
136 -  
137 -  
138 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/TestPaper.java
@@ -1,122 +0,0 @@ @@ -1,122 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import java.io.Serializable;  
4 -  
5 -public class TestPaper implements Serializable {  
6 -  
7 - private int ID;  
8 -  
9 - private String CreatorUserId;  
10 -  
11 - private String QuestionIds;  
12 -  
13 - private int Status;  
14 -  
15 - private String PublishTime;  
16 -  
17 - private String Name;  
18 -  
19 - private int IsRecommend;  
20 -  
21 - private int State;  
22 -  
23 - private String Intime;  
24 -  
25 - private int SchoolId;  
26 -  
27 - public String getCreatorUserId() {  
28 - return CreatorUserId;  
29 - }  
30 -  
31 - public void setCreatorUserId(String creatorUserId) {  
32 - CreatorUserId = creatorUserId;  
33 - }  
34 -  
35 - public String getQuestionIds() {  
36 - return QuestionIds;  
37 - }  
38 -  
39 - public void setQuestionIds(String questionIds) {  
40 - QuestionIds = questionIds;  
41 - }  
42 -  
43 - public int getStatus() {  
44 - return Status;  
45 - }  
46 -  
47 - public int getID() {  
48 - return ID;  
49 - }  
50 -  
51 - public void setID(int ID) {  
52 - this.ID = ID;  
53 - }  
54 -  
55 - public void setStatus(int status) {  
56 - Status = status;  
57 - }  
58 -  
59 - public String getPublishTime() {  
60 - return PublishTime;  
61 - }  
62 -  
63 - public void setPublishTime(String publishTime) {  
64 - PublishTime = publishTime;  
65 - }  
66 -  
67 - public String getName() {  
68 - return Name;  
69 - }  
70 -  
71 - public void setName(String name) {  
72 - Name = name;  
73 - }  
74 -  
75 - public int getIsRecommend() {  
76 - return IsRecommend;  
77 - }  
78 -  
79 - public void setIsRecommend(int isRecommend) {  
80 - IsRecommend = isRecommend;  
81 - }  
82 -  
83 - public int getState() {  
84 - return State;  
85 - }  
86 -  
87 - public void setState(int state) {  
88 - State = state;  
89 - }  
90 -  
91 - public String getIntime() {  
92 - return Intime;  
93 - }  
94 -  
95 - public void setIntime(String intime) {  
96 - Intime = intime;  
97 - }  
98 -  
99 - public int getSchoolId() {  
100 - return SchoolId;  
101 - }  
102 -  
103 - public void setSchoolId(int schoolId) {  
104 - SchoolId = schoolId;  
105 - }  
106 -  
107 - @Override  
108 - public String toString() {  
109 - return "TestPaper{" +  
110 - "ID=" + ID +  
111 - ", CreatorUserId='" + CreatorUserId + '\'' +  
112 - ", QuestionIds='" + QuestionIds + '\'' +  
113 - ", Status=" + Status +  
114 - ", PublishTime='" + PublishTime + '\'' +  
115 - ", Name='" + Name + '\'' +  
116 - ", IsRecommend=" + IsRecommend +  
117 - ", State=" + State +  
118 - ", Intime='" + Intime + '\'' +  
119 - ", SchoolId=" + SchoolId +  
120 - '}';  
121 - }  
122 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/WeigengApplication.java
1 package com.sincere.weigeng; 1 package com.sincere.weigeng;
2 2
  3 +import com.sincere.weigeng.utils.WatchServer;
3 import org.springframework.boot.SpringApplication; 4 import org.springframework.boot.SpringApplication;
4 import org.springframework.boot.autoconfigure.SpringBootApplication; 5 import org.springframework.boot.autoconfigure.SpringBootApplication;
  6 +import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
  7 +import org.springframework.cloud.openfeign.EnableFeignClients;
5 8
  9 +@EnableFeignClients(basePackages = "com.sincere.weigeng.feign")
  10 +@EnableEurekaClient
6 @SpringBootApplication 11 @SpringBootApplication
7 public class WeigengApplication { 12 public class WeigengApplication {
8 13
  14 + private static String ip = "172.16.3.175";
  15 + private static int port = 1200;
  16 +
9 public static void main(String[] args) { 17 public static void main(String[] args) {
10 SpringApplication.run(WeigengApplication.class, args); 18 SpringApplication.run(WeigengApplication.class, args);
  19 + //WatchServer.WatchingServerRunning(ip,port);
11 } 20 }
12 21
13 } 22 }
cloud/weigeng/src/main/java/com/sincere/weigeng/controller/WgController.java 0 → 100644
@@ -0,0 +1,220 @@ @@ -0,0 +1,220 @@
  1 +package com.sincere.weigeng.controller;
  2 +
  3 +import com.sincere.common.dto.smartCampus.SchoolDto;
  4 +import com.sincere.common.dto.smartCampus.StudentCardDto;
  5 +import com.sincere.common.dto.smartCampus.UpdateCardDto;
  6 +import com.sincere.common.dto.smartCampus.UserDto;
  7 +import com.sincere.common.dto.xiaoan.SendFailDto;
  8 +import com.sincere.common.dto.xiaoan.SendMessageDto;
  9 +import com.sincere.common.dto.xiaoan.SendSuccessDto;
  10 +import com.sincere.weigeng.feign.SmFeign;
  11 +import com.sincere.weigeng.feign.XaFeign;
  12 +import com.sincere.weigeng.logs.LogName;
  13 +import com.sincere.weigeng.logs.LoggerUtils;
  14 +import com.sincere.weigeng.utils.WatchServer;
  15 +import com.sincere.weigeng.vo.*;
  16 +import io.swagger.annotations.Api;
  17 +import io.swagger.annotations.ApiOperation;
  18 +import org.slf4j.Logger;
  19 +import org.springframework.beans.factory.annotation.Autowired;
  20 +import org.springframework.web.bind.annotation.RequestBody;
  21 +import org.springframework.web.bind.annotation.RequestMapping;
  22 +import org.springframework.web.bind.annotation.RequestMethod;
  23 +import org.springframework.web.bind.annotation.RestController;
  24 +
  25 +import java.util.List;
  26 +
  27 +/**
  28 + * @author chen
  29 + * @version 1.0
  30 + * @date 2019/10/14 0014 9:12
  31 + */
  32 +@RestController
  33 +@Api(value = "微耕")
  34 +public class WgController {
  35 +
  36 + private static final Logger Log_orderSuccess = LoggerUtils.Logger(LogName.orderSuccess);
  37 + private static final Logger Log_orderFail = LoggerUtils.Logger(LogName.orderFail);
  38 +
  39 + @Autowired
  40 + SmFeign smFeign;
  41 +
  42 + @Autowired
  43 + XaFeign xaFeign;
  44 +
  45 + private static String ip = "172.16.3.175";
  46 + private static int port = 1200;
  47 +
  48 + @RequestMapping(value = "watching" , method = RequestMethod.GET)
  49 + public void watching(){
  50 + WatchServer.WatchingServerRunning(ip,port,smFeign,xaFeign);
  51 + }
  52 +
  53 + @RequestMapping(value = "setTime" , method = RequestMethod.GET)
  54 + public void setTime(long sn){
  55 + WatchServer.setTime(xaFeign,sn,"48");
  56 + }
  57 +
  58 + @ApiOperation("远程开门")
  59 + @RequestMapping(value = "openDoor" , method = RequestMethod.POST)
  60 + public boolean openDoor(@RequestBody OpenDoorVo openDoorVo) {
  61 + String functionId = smFeign.selectOutOrderId(openDoorVo.getType(),openDoorVo.getId());
  62 + long messageId = WatchServer.openDoor(xaFeign,openDoorVo.getSn(),functionId,openDoorVo.getDoorNo(),null);
  63 + SendMessageDto message = getResult(messageId);
  64 + if(message.getCorrect() == 1){
  65 + Log_orderSuccess.info("web端远程开门成功!");
  66 + }else {
  67 + Log_orderFail.info("远程开门失败");
  68 + }
  69 + return message.getCorrect() == 1 ;
  70 + }
  71 +
  72 +
  73 + @ApiOperation("设置考勤时段")
  74 + @RequestMapping(value = "setAttendanceTime" , method = RequestMethod.POST)
  75 + public boolean setAttendanceTime(@RequestBody AttendanceTimeVo attendanceTimeVo){
  76 + String functionId = smFeign.selectOutOrderId(attendanceTimeVo.getType(),attendanceTimeVo.getId());
  77 + List<Long> result = WatchServer.SetAttendanceTime(xaFeign,attendanceTimeVo.getSn(),functionId,attendanceTimeVo.getShiduan(),
  78 + attendanceTimeVo.getStart(),attendanceTimeVo.getEnd(),attendanceTimeVo.getIsMonday(),attendanceTimeVo.getIsTuesday(),
  79 + attendanceTimeVo.getIsWednesday(),attendanceTimeVo.getIsThursday(),attendanceTimeVo.getIsFriday(),
  80 + attendanceTimeVo.getIsSaturday(),attendanceTimeVo.getIsWeekend(),attendanceTimeVo.getShiqu());
  81 + boolean isSuccess = true ;
  82 + for(Long messageId : result){
  83 + SendMessageDto message = getResult(messageId);
  84 + if(message.getCorrect() == 1){
  85 + Log_orderSuccess.info("设备"+attendanceTimeVo.getSn()+"时段"+attendanceTimeVo.getShiduan()+"!!设置成功");
  86 + }else {
  87 + Log_orderFail.info("设备"+attendanceTimeVo.getSn()+"时段"+attendanceTimeVo.getShiduan()+"!!设置失败");
  88 + isSuccess = false ;
  89 + }
  90 + }
  91 + return isSuccess;
  92 + }
  93 +
  94 +
  95 + @ApiOperation("单个卡号的权限添加或修改")
  96 + @RequestMapping(value = "setSignalCardInfo" , method = RequestMethod.POST)
  97 + public boolean setSignalCardInfo(@RequestBody SignalCardInfoVo signalCardInfoVo){
  98 + String functionId = smFeign.selectOutOrderId(signalCardInfoVo.getType(),signalCardInfoVo.getId());
  99 + String cardNo = initCardNo(signalCardInfoVo.getCardNo());
  100 + long messageId = WatchServer.SetSignalCardInfo(xaFeign,signalCardInfoVo.getSn(),functionId,cardNo,
  101 + signalCardInfoVo.getShiduan(),signalCardInfoVo.getStartTime(),signalCardInfoVo.getEndTime());
  102 + SendMessageDto message = getResult(messageId);
  103 + UserDto user = smFeign.selectUserByCardNum(cardNo);
  104 + StudentCardDto studentCard = smFeign.selectStudentCard(cardNo);
  105 + SchoolDto school = smFeign.selectSchoolBySchoolId(user.getSchoolId());
  106 + UpdateCardDto updateCard = smFeign.selectUpdateCardByUpdateId(signalCardInfoVo.getUpdateId());
  107 + if(message.getCorrect() == 1){
  108 + Log_orderSuccess.info("设备"+signalCardInfoVo.getSn()+"时段"+signalCardInfoVo.getShiduan()+"卡号"+cardNo+"!!设置成功");
  109 + SendSuccessDto sendSuccess = new SendSuccessDto(user,school,studentCard,updateCard);
  110 + sendSuccess.setDeviceId(signalCardInfoVo.getSn()+"");
  111 + sendSuccess.setShiduan(signalCardInfoVo.getShiduan());
  112 + sendSuccess.setCardNum(cardNo);
  113 + sendSuccess.setUpdateId(signalCardInfoVo.getUpdateId());
  114 + sendSuccess.setOpenFlag(1);
  115 + sendSuccess.setStatus(1);
  116 + xaFeign.insertSendSuccess(sendSuccess);
  117 + }else {
  118 + Log_orderFail.info("设备"+signalCardInfoVo.getSn()+"时段"+signalCardInfoVo.getShiduan()+"卡号"+cardNo+"!!设置失败");
  119 + SendFailDto sendFail = new SendFailDto(user,school,studentCard,updateCard);
  120 + sendFail.setDeviceId(signalCardInfoVo.getSn()+"");
  121 + sendFail.setShiduan(signalCardInfoVo.getShiduan());
  122 + sendFail.setCardNum(cardNo);
  123 + sendFail.setUpdateId(signalCardInfoVo.getUpdateId());
  124 + sendFail.setOpenFlag(1);
  125 + sendFail.setStatus(1);
  126 + sendFail.setFailType(2);
  127 + sendFail.setFailContent("其他");
  128 + xaFeign.insertSendFail(sendFail);
  129 + }
  130 + return message.getCorrect() == 1;
  131 + }
  132 +
  133 +
  134 + @ApiOperation("清除单个卡号权限")
  135 + @RequestMapping(value = "clearSinglePower" , method = RequestMethod.POST)
  136 + public boolean clearSinglePower(@RequestBody CardInfo cardInfo){
  137 + String functionId = smFeign.selectOutOrderId(cardInfo.getType(),cardInfo.getId());
  138 + String cardNo = initCardNo(cardInfo.getCardNo());
  139 + long messageId = WatchServer.clearSinglePower(xaFeign,cardInfo.getSn(),functionId,cardNo);
  140 + SendMessageDto message = getResult(messageId);
  141 + if(message.getCorrect() == 1){
  142 + Log_orderSuccess.info("卡号"+cardNo+"清除权限成功");
  143 + SendSuccessDto sendSuccess = new SendSuccessDto();
  144 + sendSuccess.setCardNum(cardNo);
  145 + sendSuccess.setDeviceId(cardInfo.getSn()+"");
  146 + xaFeign.updateSendSuccess(sendSuccess);
  147 + }else {
  148 + Log_orderFail.info("卡号"+cardNo+"清除权限失败");
  149 + }
  150 + return message.getCorrect() == 1 ;
  151 + }
  152 +
  153 + @ApiOperation("清除全部权限")
  154 + @RequestMapping(value = "clearAllPower" , method = RequestMethod.POST)
  155 + public boolean clearAllPower(@RequestBody CleanShiDuanVo cleanShiDuanVo){
  156 + String functionId = smFeign.selectOutOrderId(cleanShiDuanVo.getType(),cleanShiDuanVo.getId());
  157 + long messageId = WatchServer.clearAllPower(xaFeign,cleanShiDuanVo.getSn(),functionId);
  158 + SendMessageDto message = getResult(messageId);
  159 + if(message.getCorrect() == 1){
  160 + Log_orderSuccess.info("设备"+cleanShiDuanVo.getSn()+"清除权限成功");
  161 + SendSuccessDto sendSuccess = new SendSuccessDto();
  162 + sendSuccess.setDeviceId(cleanShiDuanVo.getSn()+"");
  163 + xaFeign.updateSendSuccess(sendSuccess);
  164 + }else {
  165 + Log_orderFail.info("设备"+cleanShiDuanVo.getSn()+"清除权限失败");
  166 + }
  167 + return message.getCorrect() == 1 ;
  168 + }
  169 +
  170 +
  171 + @ApiOperation("清除时段")
  172 + @RequestMapping(value = "clearShiDuan" , method = RequestMethod.POST)
  173 + public boolean clearShiDuan(@RequestBody CleanShiDuanVo cleanShiDuanVo){
  174 + String functionId = smFeign.selectOutOrderId(cleanShiDuanVo.getType(),cleanShiDuanVo.getId());
  175 + long messageId = WatchServer.clearShiDuan(xaFeign,cleanShiDuanVo.getSn(),functionId);
  176 + SendMessageDto sendMessage = getResult(messageId);
  177 + if(sendMessage.getCorrect() == 1){
  178 + Log_orderSuccess.info("设备"+cleanShiDuanVo.getSn()+"时段清除成功");
  179 + }else {
  180 + Log_orderFail.info("设备"+cleanShiDuanVo.getSn()+"时段清除失败");
  181 + }
  182 + return sendMessage.getCorrect() == 1;
  183 + }
  184 +
  185 + @ApiOperation("查询单个卡号 权限")
  186 + @RequestMapping(value = "searchPower" , method = RequestMethod.POST)
  187 + public boolean searchPower(@RequestBody CardInfo cardInfo){
  188 + String functionId = smFeign.selectOutOrderId(cardInfo.getType(),cardInfo.getId());
  189 + String cardNo = initCardNo(cardInfo.getCardNo());
  190 + long messageId = WatchServer.searchPower(xaFeign,cardInfo.getSn(),functionId,cardNo);
  191 + SendMessageDto sendMessage = getResult(messageId);
  192 + if(sendMessage.getCorrect() == 1){
  193 + Log_orderSuccess.info("设备"+cardInfo.getSn()+"卡号"+cardNo+"查询权限成功");
  194 + }else {
  195 + Log_orderFail.info("设备"+cardInfo.getSn()+"卡号"+cardNo+"查询权限失败");
  196 + }
  197 + return sendMessage.getCorrect() == 1;
  198 + }
  199 +
  200 + @RequestMapping(value = "watch" , method = RequestMethod.GET)
  201 + public int watch(){
  202 + return 1 ;
  203 + }
  204 +
  205 + private SendMessageDto getResult(long messageId){
  206 + try{
  207 + Thread.sleep(300);
  208 + }catch (Exception e){
  209 +
  210 + }
  211 + return xaFeign.selectById(messageId);
  212 + }
  213 +
  214 + private String initCardNo(String cardNo){
  215 + while (cardNo.length() < 8){
  216 + cardNo = "0" + cardNo ;
  217 + }
  218 + return cardNo ;
  219 + }
  220 +}
cloud/weigeng/src/main/java/com/sincere/weigeng/dao/UserDao.java
@@ -1,29 +0,0 @@ @@ -1,29 +0,0 @@
1 -package com.sincere.weigeng.dao;  
2 -  
3 -import com.sincere.weigeng.JiaoCai;  
4 -import com.sincere.weigeng.Knowledge;  
5 -import org.apache.ibatis.annotations.*;  
6 -import org.springframework.stereotype.Repository;  
7 -  
8 -import java.util.List;  
9 -  
10 -@Repository  
11 -@Mapper  
12 -public interface UserDao {  
13 -  
14 -// @Insert("insert into HS_StudentUpdateCard (Card,SchoolId,StudentCode,CustomerId,StudentType,UserType,ClassId,ClassName,IsNew,UpdateType,AddTime) " +  
15 -// "values (#{Card},#{SchoolId},#{StudentCode},#{CustomerId},#{StudentType},#{UserType},#{ClassId},#{ClassName},#{IsNew,#{UpdateType),#{AddTime}")  
16 -// void addStudentUpdate(@Param("Card") String card, @Param("SchoolId") int school_id, @Param("StudentCode") String studentCode, @Param("CustomerId") String CustomerId  
17 -// , @Param("StudentType") String StudentType, @Param("UserType") String UserType, @Param("ClassId") String ClassId, @Param("ClassName") String ClassName,  
18 -// @Param("IsNew") String IsNew, @Param("UpdateType") String UpdateType, @Param("AddTime") String AddTime);  
19 -  
20 -  
21 - @Select ("select * from ZY_YYKnowledge where AddTime >2019 ")  
22 - List<Knowledge> getKnowledge();  
23 -  
24 - @Select("select * from ZY_YYJiaoCai where ID >= 26")  
25 - List<JiaoCai> getJiaoCai();  
26 -  
27 - @Insert("insert into ZY_YYJiaoCaiAndKnowledg values(#{id},#{id1},#{i},#{i1})")  
28 - void addKnowAndJicaoCai(@Param("id") String id, @Param("id1") String id1, @Param("i") int i, @Param("i1") int i1);  
29 -}  
cloud/weigeng/src/main/java/com/sincere/weigeng/feign/SmFeign.java 0 → 100644
@@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
  1 +package com.sincere.weigeng.feign;
  2 +
  3 +import com.sincere.common.dto.smartCampus.SchoolDto;
  4 +import com.sincere.common.dto.smartCampus.StudentCardDto;
  5 +import com.sincere.common.dto.smartCampus.UpdateCardDto;
  6 +import com.sincere.common.dto.smartCampus.UserDto;
  7 +import org.springframework.cloud.openfeign.FeignClient;
  8 +import org.springframework.web.bind.annotation.RequestMapping;
  9 +import org.springframework.web.bind.annotation.RequestMethod;
  10 +import org.springframework.web.bind.annotation.RequestParam;
  11 +
  12 +/**
  13 + * @author chen
  14 + * @version 1.0
  15 + * @date 2019/11/12 0012 11:08
  16 + */
  17 +@FeignClient("smartCampusSearch")
  18 +public interface SmFeign {
  19 +
  20 + @RequestMapping(value = "/sm/wg/updateLinkTime",method = RequestMethod.GET)
  21 + int updateLinkTime(@RequestParam("sno") String sno);
  22 +
  23 + @RequestMapping(value = "/sm/wg/selectOutOrderId",method = RequestMethod.GET)
  24 + String selectOutOrderId(@RequestParam("type") int type, @RequestParam("insideOrderId") int insideOrderId);
  25 +
  26 + @RequestMapping(value = "/sm/wg/checkLeave",method = RequestMethod.GET)
  27 + String checkLeave(@RequestParam("cardNo") String cardNo);
  28 +
  29 + @RequestMapping(value = "/sm/wg/selectSchoolBySchoolId",method = RequestMethod.GET)
  30 + SchoolDto selectSchoolBySchoolId(@RequestParam("schoolId") int schoolId);
  31 +
  32 + @RequestMapping(value = "/sm/wg/selectUserByCardNum",method = RequestMethod.GET)
  33 + UserDto selectUserByCardNum(@RequestParam("cardNum") String cardNum);
  34 +
  35 + @RequestMapping(value = "/sm/wg/selectUpdateCardByUpdateId",method = RequestMethod.GET)
  36 + UpdateCardDto selectUpdateCardByUpdateId(@RequestParam("updateId") int updateId);
  37 +
  38 + @RequestMapping(value = "/sm/wg/selectStudentCard",method = RequestMethod.GET)
  39 + StudentCardDto selectStudentCard(@RequestParam("cardNum") String cardNum);
  40 +}
cloud/weigeng/src/main/java/com/sincere/weigeng/feign/XaFeign.java 0 → 100644
@@ -0,0 +1,47 @@ @@ -0,0 +1,47 @@
  1 +package com.sincere.weigeng.feign;
  2 +
  3 +import com.sincere.common.dto.xiaoan.*;
  4 +import org.springframework.cloud.openfeign.FeignClient;
  5 +import org.springframework.web.bind.annotation.RequestBody;
  6 +import org.springframework.web.bind.annotation.RequestMapping;
  7 +import org.springframework.web.bind.annotation.RequestMethod;
  8 +import org.springframework.web.bind.annotation.RequestParam;
  9 +
  10 +/**
  11 + * @author chen
  12 + * @version 1.0
  13 + * @date 2019/11/12 0012 11:12
  14 + */
  15 +@FeignClient("xiaoanSearch")
  16 +public interface XaFeign {
  17 +
  18 + @RequestMapping(value = "/xa/wg/checkIn",method = RequestMethod.POST)
  19 + CheckOutDto checkIn(@RequestBody CheckInDto checkInDto);
  20 +
  21 + @RequestMapping(value = "/xa/wg/insertMessage",method = RequestMethod.POST)
  22 + long insertMessage(@RequestBody SendMessageDto sendMessageDto);
  23 +
  24 + @RequestMapping(value = "/xa/wg/selectById",method = RequestMethod.GET)
  25 + SendMessageDto selectById(@RequestParam("id") long id);
  26 +
  27 + @RequestMapping(value = "/xa/wg/selectMessage",method = RequestMethod.GET)
  28 + SendMessageDto selectMessage(@RequestParam("deviceId") String deviceId, @RequestParam("index") long index,@RequestParam("functionId") String functionId);
  29 +
  30 + @RequestMapping(value = "/xa/wg/updateMessage",method = RequestMethod.GET)
  31 + int updateMessage(@RequestParam("id") long id, @RequestParam("result") String result, @RequestParam("correct") int correct);
  32 +
  33 + @RequestMapping(value = "/xa/wg/insertPassFail",method = RequestMethod.POST)
  34 + int insertPassFail(@RequestBody PassFailDto passFailDto);
  35 +
  36 + @RequestMapping(value = "/xa/wg/insertSendSuccess",method = RequestMethod.POST)
  37 + int insertSendSuccess(@RequestBody SendSuccessDto sendSuccessDto);
  38 +
  39 + @RequestMapping(value = "/xa/wg/insertSendFail",method = RequestMethod.POST)
  40 + int insertSendFail(@RequestBody SendFailDto sendFailDto);
  41 +
  42 + @RequestMapping(value = "/xa/wg/deleteSendFail",method = RequestMethod.POST)
  43 + int deleteSendFail(@RequestBody SendFailDto sendFailDto);
  44 +
  45 + @RequestMapping(value = "/xa/wg/deleteSendFail",method = RequestMethod.POST)
  46 + int updateSendSuccess(@RequestBody SendSuccessDto sendSuccessDto);
  47 +}
cloud/weigeng/src/main/java/com/sincere/weigeng/logs/LogName.java 0 → 100644
@@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
  1 +package com.sincere.weigeng.logs;
  2 +
  3 +/**
  4 + * @author chen
  5 + * @version 1.0
  6 + * @date 2019/10/12 0012 16:18
  7 + */
  8 +public enum LogName {
  9 + orderSuccess("orderSuccess"),
  10 + orderFail("orderFail"),
  11 + kaoInfo("kaoInfo"),
  12 + heartBeat("heartBeat"),
  13 + error("error");
  14 +
  15 + private String logFileName;
  16 +
  17 + LogName(String fileName) {
  18 + this.logFileName = fileName;
  19 + }
  20 +
  21 + public String getLogFileName() {
  22 + return logFileName;
  23 + }
  24 +
  25 + public void setLogFileName(String logFileName) {
  26 + this.logFileName = logFileName;
  27 + }
  28 +
  29 + public static LogName getAwardTypeEnum(String value) {
  30 + LogName[] arr = values();
  31 + for (LogName item : arr) {
  32 + if (null != item && !item.logFileName.equals("")) {
  33 + return item;
  34 + }
  35 + }
  36 + return null;
  37 + }
  38 +}
  39 +
cloud/weigeng/src/main/java/com/sincere/weigeng/logs/LoggerUtils.java 0 → 100644
@@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
  1 +package com.sincere.weigeng.logs;
  2 +
  3 +import org.slf4j.Logger;
  4 +import org.slf4j.LoggerFactory;
  5 +
  6 +/**
  7 + * @author chen
  8 + * @version 1.0
  9 + * @date 2019/10/12 0012 16:19
  10 + */
  11 +public class LoggerUtils {
  12 +
  13 + public static <T> Logger Logger(Class<T> clazz) {
  14 + return LoggerFactory.getLogger(clazz);
  15 + }
  16 +
  17 + /**
  18 + * 打印到指定的文件下
  19 + *
  20 + * @param desc 日志文件名称
  21 + * @return
  22 + */
  23 + public static Logger Logger(LogName desc) {
  24 + return LoggerFactory.getLogger(desc.getLogFileName());
  25 + }
  26 +
  27 +}
cloud/weigeng/src/main/java/com/sincere/weigeng/logs/MyTimeBasedFileNamingAndTriggeringPolicy.java 0 → 100644
@@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
  1 +package com.sincere.weigeng.logs;
  2 +
  3 +import ch.qos.logback.core.joran.spi.NoAutoStart;
  4 +import ch.qos.logback.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy;
  5 +
  6 +/**
  7 + * @author chen
  8 + * @version 1.0
  9 + * @date 2019/10/31 0031 13:42
  10 + */
  11 +@NoAutoStart
  12 +public class MyTimeBasedFileNamingAndTriggeringPolicy<E> extends DefaultTimeBasedFileNamingAndTriggeringPolicy<E> {
  13 +
  14 + //这个用来指定时间间隔
  15 + private Integer multiple = 1;
  16 +
  17 + @Override
  18 + protected void computeNextCheck() {
  19 + nextCheck = rc.getEndOfNextNthPeriod(dateInCurrentPeriod, multiple).getTime();
  20 + }
  21 +
  22 + public Integer getMultiple() {
  23 + return multiple;
  24 + }
  25 +
  26 + public void setMultiple(Integer multiple) {
  27 + if (multiple > 1) {
  28 + this.multiple = multiple;
  29 + }
  30 + }
  31 +
  32 +}
cloud/weigeng/src/main/java/com/sincere/weigeng/utils/WGUtils.java 0 → 100644
@@ -0,0 +1,133 @@ @@ -0,0 +1,133 @@
  1 +package com.sincere.weigeng.utils;
  2 +
  3 +/**
  4 + * @author chen
  5 + * @version 1.0
  6 + * @date 2019/10/14 0014 11:03
  7 + */
  8 +public class WGUtils {
  9 +
  10 + //指令转换 message 10进制 要先转16 在转byte
  11 + public static Byte toFunctionHex(String message){
  12 + Integer i = Integer.valueOf(message) ;
  13 + if(i > 127){
  14 + i = i-256 ;
  15 + }
  16 + return Byte.valueOf(i+"");
  17 + }
  18 +
  19 + //短报文 转化 message 16进制 要先转16 在转byte
  20 + public static Byte toHex(String message){
  21 + Integer i = Integer.valueOf(message,16) ;
  22 + if(i > 127){
  23 + i = i-256 ;
  24 + }
  25 + return Byte.valueOf(i+"");
  26 + }
  27 +
  28 + public static String getCardNo(byte[] buff, int start, int len){
  29 + String cardNo = "" ;
  30 + for(int i = start ; i < start+len ; i++){
  31 + cardNo += byte2Hex(buff[i]);
  32 + }
  33 + return cardNo;
  34 + }
  35 +
  36 + public static String byte2Hex(byte b){
  37 + int i = b ;
  38 + if( b < 0){
  39 + i = b + 256 ;
  40 + }
  41 + String result = Integer.toHexString(i).toUpperCase() ;
  42 + if(result.length() == 1){
  43 + result = "0"+result;
  44 + }
  45 + return result;
  46 + }
  47 +
  48 + //4字节转成整型数(低位前, 高位后)
  49 + public static int byteToInt(byte[] buff, int start, int len) {
  50 + int val = 0;
  51 + for (int i = 0; i < len && i < 4; i++)
  52 + {
  53 + long lng = buff[i + start];
  54 + val += (lng << (8 * i));
  55 + }
  56 + return val;
  57 + }
  58 +
  59 + //4字节转成整型数(低位前, 高位后)
  60 + public static long byteToLong(byte[] buff, int start, int len) {
  61 + long val = 0;
  62 + for (int i = 0; i < len && i < 4; i++)
  63 + {
  64 + long lng = buff[i + start];
  65 + val += (lng << (8 * i));
  66 + }
  67 + return val;
  68 + }
  69 +
  70 + //获取Hex值, 主要用于日期时间格式
  71 + public static byte getHex(int val) {
  72 + return (byte)((val % 10) + (((val -(val % 10)) / 10)%10) *16);
  73 + }
  74 +
  75 +
  76 + public static String getReasonDetailChinese(int Reason){
  77 + if (Reason > 45) {
  78 + return "";
  79 + }
  80 + if (Reason <= 0) {
  81 + return "";
  82 + }
  83 + return RecordDetails[(Reason - 1) * 4 + 3]; //中文信息
  84 + }
  85 +
  86 + public static String RecordDetails[] = {
  87 + "1","SwipePass","Swipe","刷卡开门",
  88 + "2","SwipePass","Swipe Close","刷卡关",
  89 + "3","SwipePass","Swipe Open","刷卡开",
  90 + "4","SwipePass","Swipe Limited Times","刷卡开门(带限次)",
  91 + "5","SwipeNOPass","Denied Access: PC Control","刷卡禁止通过: 电脑控制",
  92 + "6","SwipeNOPass","Denied Access: No PRIVILEGE","刷卡禁止通过: 没有权限",
  93 + "7","SwipeNOPass","Denied Access: Wrong PASSWORD","刷卡禁止通过: 密码不对",
  94 + "8","SwipeNOPass","Denied Access: AntiBack","刷卡禁止通过: 反潜回",
  95 + "9","SwipeNOPass","Denied Access: More Cards","刷卡禁止通过: 多卡",
  96 + "10","SwipeNOPass","Denied Access: First Card Open","刷卡禁止通过: 首卡",
  97 + "11","SwipeNOPass","Denied Access: Door Set NC","刷卡禁止通过: 门为常闭",
  98 + "12","SwipeNOPass","Denied Access: InterLock","刷卡禁止通过: 互锁",
  99 + "13","SwipeNOPass","Denied Access: Limited Times","刷卡禁止通过: 受刷卡次数限制",
  100 + "14","SwipeNOPass","Denied Access: Limited Person Indoor","刷卡禁止通过: 门内人数限制",
  101 + "15","SwipeNOPass","Denied Access: Invalid Timezone","刷卡禁止通过: 卡过期或不在有效时段",
  102 + "16","SwipeNOPass","Denied Access: In Order","刷卡禁止通过: 按顺序进出限制",
  103 + "17","SwipeNOPass","Denied Access: SWIPE GAP LIMIT","刷卡禁止通过: 刷卡间隔约束",
  104 + "18","SwipeNOPass","Denied Access","刷卡禁止通过: 原因不明",
  105 + "19","SwipeNOPass","Denied Access: Limited Times","刷卡禁止通过: 刷卡次数限制",
  106 + "20","ValidEvent","Push Button","按钮开门",
  107 + "21","ValidEvent","Push Button Open","按钮开",
  108 + "22","ValidEvent","Push Button Close","按钮关",
  109 + "23","ValidEvent","Door Open","门打开[门磁信号]",
  110 + "24","ValidEvent","Door Closed","门关闭[门磁信号]",
  111 + "25","ValidEvent","Super Password Open Door","超级密码开门",
  112 + "26","ValidEvent","Super Password Open","超级密码开",
  113 + "27","ValidEvent","Super Password Close","超级密码关",
  114 + "28","Warn","Controller Power On","控制器上电",
  115 + "29","Warn","Controller Reset","控制器复位",
  116 + "30","Warn","Push Button Invalid: Disable","按钮不开门: 按钮禁用",
  117 + "31","Warn","Push Button Invalid: Forced Lock","按钮不开门: 强制关门",
  118 + "32","Warn","Push Button Invalid: Not On Line","按钮不开门: 门不在线",
  119 + "33","Warn","Push Button Invalid: InterLock","按钮不开门: 互锁",
  120 + "34","Warn","Threat","胁迫报警",
  121 + "35","Warn","Threat Open","胁迫报警开",
  122 + "36","Warn","Threat Close","胁迫报警关",
  123 + "37","Warn","Open too long","门长时间未关报警[合法开门后]",
  124 + "38","Warn","Forced Open","强行闯入报警",
  125 + "39","Warn","Fire","火警",
  126 + "40","Warn","Forced Close","强制关门",
  127 + "41","Warn","Guard Against Theft","防盗报警",
  128 + "42","Warn","7*24Hour Zone","烟雾煤气温度报警",
  129 + "43","Warn","Emergency Call","紧急呼救报警",
  130 + "44","RemoteOpen","Remote Open Door","操作员远程开门",
  131 + "45","RemoteOpen","Remote Open Door By USB Reader","发卡器确定发出的远程开门"
  132 + };
  133 +}
cloud/weigeng/src/main/java/com/sincere/weigeng/utils/WatchServer.java 0 → 100644
@@ -0,0 +1,509 @@ @@ -0,0 +1,509 @@
  1 +package com.sincere.weigeng.utils;
  2 +
  3 +
  4 +import com.sincere.common.dto.smartCampus.UserDto;
  5 +import com.sincere.common.dto.xiaoan.CheckInDto;
  6 +import com.sincere.common.dto.xiaoan.CheckOutDto;
  7 +import com.sincere.common.dto.xiaoan.PassFailDto;
  8 +import com.sincere.common.dto.xiaoan.SendMessageDto;
  9 +import com.sincere.common.util.DateUtils;
  10 +import com.sincere.weigeng.feign.SmFeign;
  11 +import com.sincere.weigeng.feign.XaFeign;
  12 +import com.sincere.weigeng.logs.LogName;
  13 +import com.sincere.weigeng.logs.LoggerUtils;
  14 +import org.apache.commons.lang3.StringUtils;
  15 +import org.apache.mina.core.session.IoSession;
  16 +import org.apache.mina.transport.socket.DatagramSessionConfig;
  17 +import org.apache.mina.transport.socket.nio.NioDatagramAcceptor;
  18 +import org.slf4j.Logger;
  19 +
  20 +import java.io.IOException;
  21 +import java.net.InetSocketAddress;
  22 +import java.util.*;
  23 +import java.util.concurrent.ConcurrentHashMap;
  24 +
  25 +/**
  26 + * @author chen
  27 + * @version 1.0
  28 + * @date 2019/10/12 0012 16:57
  29 + */
  30 +public class WatchServer {
  31 +
  32 + private static final Logger Log_orderSuccess = LoggerUtils.Logger(LogName.orderSuccess);
  33 + private static final Logger Log_orderFail = LoggerUtils.Logger(LogName.orderFail);
  34 + private static final Logger Log_kaoInfo = LoggerUtils.Logger(LogName.kaoInfo);
  35 + private static final Logger Log_heartBeat = LoggerUtils.Logger(LogName.heartBeat);
  36 + private static final Logger Log_error = LoggerUtils.Logger(LogName.error);
  37 +
  38 + private static List<Long> snoList = new ArrayList<>();
  39 + private static List<Long> indexList = new ArrayList<>();
  40 + private static WatchingShortHandler watchingShortHandler ;
  41 + private static Queue<byte[]> queue = new LinkedList<>();
  42 + private static Map<Long , IoSession> sessionMap = new ConcurrentHashMap<>();
  43 +
  44 + // 进入服务器监控状态
  45 + public static int WatchingServerRunning(String watchServerIP,int watchServerPort,
  46 + SmFeign smFeign ,XaFeign xaFeign) {
  47 + watchingShortHandler = new WatchingShortHandler(queue,sessionMap);
  48 + // 创建UDP数据包NIO
  49 + NioDatagramAcceptor acceptor = new NioDatagramAcceptor();
  50 + // NIO设置底层IOHandler
  51 + acceptor.setHandler(watchingShortHandler);
  52 +
  53 + // 设置是否重用地址? 也就是每个发过来的udp信息都是一个地址?
  54 + DatagramSessionConfig dcfg = acceptor.getSessionConfig();
  55 + dcfg.setReuseAddress(false);
  56 + // 绑定端口地址
  57 + try {
  58 + acceptor.bind(new InetSocketAddress(watchServerIP, watchServerPort));
  59 + } catch (IOException e) {
  60 + Log_orderSuccess.info("绑定接收服务器失败....");
  61 + e.printStackTrace();
  62 + return 0;
  63 + }
  64 + Log_orderSuccess.info("绑定接收服务器成功....");
  65 + long recordIndex = 0;
  66 + while(true) {
  67 + if (!queue.isEmpty()) {
  68 + byte[] recvBuff;
  69 + synchronized (queue) {
  70 + recvBuff= queue.poll();
  71 + }
  72 + if (recvBuff[1]== 0x20) {
  73 + long sn = WgUdpCommShort.getLongByByte(recvBuff, 4, 4);
  74 + smFeign.updateLinkTime(sn+"");
  75 + Log_heartBeat.info("设备"+sn);
  76 + boolean isExist = true ;
  77 + long recordIndexGet = WgUdpCommShort.getLongByByte(recvBuff, 8, 4);
  78 + if(snoList.indexOf(sn) >= 0){
  79 + int number = snoList.indexOf(sn);
  80 + recordIndex = indexList.get(number);
  81 + indexList.set(number,recordIndexGet);
  82 + }else {
  83 + snoList.add(sn);
  84 + recordIndex = 0 ;
  85 + indexList.add(recordIndexGet);
  86 + System.out.println("设备"+sn+"上线");
  87 + isExist = false ;
  88 + }
  89 + if(isExist){
  90 + if (recordIndex < recordIndexGet || (recordIndexGet - recordIndex) < -5) {
  91 + watching(recvBuff,smFeign,xaFeign);
  92 + }
  93 + }
  94 + }else {
  95 + push(recvBuff,xaFeign);
  96 + }
  97 + } else {
  98 + long times = 100;
  99 + try {
  100 + Thread.sleep(times);
  101 + } catch (InterruptedException e) {
  102 + e.printStackTrace();
  103 + }
  104 + }
  105 + }
  106 + }
  107 +
  108 + private static void watching(byte[] recv,SmFeign smFeign ,XaFeign xaFeign){
  109 + long res = 0;
  110 + //8-11 记录的索引号
  111 + //(=0表示没有记录) 4 0x00000000
  112 + int recordIndex = 0;
  113 + recordIndex = WGUtils.byteToInt(recv, 8, 4);
  114 + //12 记录类型**********************************************
  115 + //0=无记录
  116 + //1=刷卡记录
  117 + //2=门磁,按钮, 设备启动, 远程开门记录
  118 + //3=报警记录 1
  119 + //0xFF=表示指定索引位的记录已被覆盖掉了. 请使用索引0, 取回最早一条记录的索引值
  120 + int recordType = recv[12];
  121 +
  122 + //13 有效性(0 表示不通过, 1表示通过) 1
  123 + int recordValid = recv[13];
  124 +
  125 + //14 门号(1,2,3,4) 1 业务需要-->1出2进
  126 + int recordDoorNO = recv[14];
  127 +
  128 + //15 进门/出门(1表示进门, 2表示出门) 1 0x01
  129 + //int recordInOrOut = recv[15];
  130 +
  131 + //16-19 卡号(类型是刷卡记录时)
  132 + //或编号(其他类型记录) 4
  133 + String cardNo = WGUtils.getCardNo(recv, 16, 4);
  134 +
  135 + //20-26 刷卡时间:
  136 + //年月日时分秒 (采用BCD码)见设置时间部分的说明
  137 + String recordTime = "2000-01-01 00:00:00";
  138 + recordTime = String.format("%02X%02X-%02X-%02X %02X:%02X:%02X",
  139 + recv[20], recv[21], recv[22], recv[23], recv[24], recv[25], recv[26]);
  140 + //2012.12.11 10:49:59 7
  141 + //27 记录原因代码(可以查 “刷卡记录说明.xls”文件的ReasonNO)
  142 + //处理复杂信息才用 1
  143 + int reason = recv[27];
  144 + if (recordType == 0) {
  145 + Log_orderSuccess.info(String.format("索引位={0} 无记录", recordIndex));
  146 + }else if (recordType == 0xff) {
  147 + Log_orderSuccess.info("指定索引位的记录已被覆盖掉了,请使用索引0, 取回最早一条记录的索引值");
  148 + } else if (recordType == 1) {
  149 + long sno = 0;
  150 + sno = WgUdpCommShort.getLongByByte(recv, 4, 4);//解析设备号
  151 + String msg = "索引位=" + recordIndex
  152 + + ",卡号=" + cardNo
  153 + +"进出=" + (recordDoorNO == 1 ? "出门" : "进门")
  154 + + ",有效=" + (recordValid == 1 ? "通过" : "禁止")
  155 + + ",时间=" + recordTime
  156 + + ",描述=" + WGUtils.getReasonDetailChinese(reason) + "";
  157 + Log_orderSuccess.info("控制器:" + sno + msg);
  158 + if(recordValid == 1) {
  159 + //有效刷卡调考勤存储过程
  160 + CheckInDto checkIn = new CheckInDto();
  161 + checkIn.setDeviceId(sno+"");
  162 + checkIn.setCardNo(cardNo);
  163 + checkIn.setFunNo(8);
  164 + checkIn.setFlag(recordDoorNO == 1 ? 1 : 0);
  165 + checkIn.setCheckTime(recordTime);
  166 + CheckOutDto checkOutDto = xaFeign.checkIn(checkIn);
  167 + if(checkOutDto.getIsSuccess() == 1){
  168 + //考勤成功
  169 + Log_kaoInfo.info("考勤成功!,设备:"+sno+"卡号:"+cardNo+"方向:"+(recordDoorNO == 1 ? "出门" : "进门")+"______"+ recordTime);
  170 + }else {
  171 + //考勤失败
  172 + Log_orderFail.error("考勤失败!,设备:"+sno+"卡号:"+cardNo + "---"+ checkOutDto.getOut());
  173 + }
  174 + }else {
  175 + //判断是否请假
  176 + String studentNum = smFeign.checkLeave(cardNo);
  177 + if (StringUtils.isNotBlank(studentNum)) {
  178 + int outOf = recordDoorNO == 1 ? 1 : 0;
  179 + //远程开门
  180 + openDoor(xaFeign,sno,"64",recordDoorNO,cardNo);
  181 + Log_orderSuccess.info("请假开门成功"+cardNo);
  182 + } else {
  183 + //没有请假不做任何处理,则是刷卡异常,入库
  184 + UserDto user = smFeign.selectUserByCardNum(cardNo);
  185 + PassFailDto passFail = new PassFailDto();
  186 + passFail.setCardNum(cardNo);
  187 + passFail.setDeviceId(sno+"");
  188 + passFail.setDirection((recordDoorNO == 1 ? "出门" : "进门"));
  189 + passFail.setResultIntro(WGUtils.getReasonDetailChinese(reason));
  190 + passFail.setInTime(DateUtils.string2Date(recordTime, DateUtils.format2));
  191 + passFail.setCreateTime(new Date());
  192 + passFail.setSchoolId(user.getSchoolId());
  193 + xaFeign.insertPassFail(passFail);
  194 + }
  195 + }
  196 + }
  197 + }
  198 +
  199 + private static void push(byte[] recv,XaFeign xaFeign){
  200 + long index = WgUdpCommShort.getXidOfCommand(recv);
  201 + long sno = WgUdpCommShort.getLongByByte(recv, 4, 4);
  202 + String functionId = WGUtils.byte2Hex(recv[1]);
  203 + SendMessageDto sendMessage = xaFeign.selectMessage(sno+"",index,functionId);
  204 + if(sendMessage != null){
  205 + if(recv[8] == 1){
  206 + sendMessage.setCorrect(1);
  207 + }else {
  208 + sendMessage.setCorrect(0);
  209 + }
  210 + StringBuffer result = new StringBuffer();
  211 + for(byte b : recv){
  212 + result.append(WGUtils.byte2Hex(b)).append("-");
  213 + }
  214 + sendMessage.setResult(result.toString().substring(0,result.toString().length()-1));
  215 + xaFeign.updateMessage(sendMessage.getId(),sendMessage.getResult(),sendMessage.getCorrect());
  216 + }
  217 + }
  218 +
  219 + //远程开门
  220 + public static long openDoor(XaFeign xaFeign,long sno , String outsideOrderId,int doorNo , String cardNo){
  221 + WgUdpCommShort pkt = new WgUdpCommShort();
  222 + pkt.iDevSn = sno;
  223 + try{
  224 + int doorNO =doorNo;
  225 + pkt.Reset();
  226 + pkt.functionID = WGUtils.toFunctionHex(outsideOrderId);
  227 + pkt.data[0] =(byte) (doorNO & 0xff);
  228 + if(StringUtils.isNotBlank(cardNo)){
  229 + pkt.data[20] = WGUtils.toHex(cardNo.substring(0,2));
  230 + pkt.data[21] = WGUtils.toHex(cardNo.substring(2,4));
  231 + pkt.data[22] = WGUtils.toHex(cardNo.substring(4,6));
  232 + pkt.data[23] = WGUtils.toHex(cardNo.substring(6,8));
  233 + }
  234 + byte[] bytes = pkt.toByte();
  235 + long index = WgUdpCommShort.getXidOfCommand(bytes);
  236 + long result = insert(xaFeign,sno+"",outsideOrderId,cardNo,index,bytes);
  237 + pkt.run(watchingShortHandler.getSessionMap().get(sno),bytes);
  238 + return result ;
  239 + }catch (Exception e){
  240 + Log_error.error(e.toString());
  241 + }
  242 + return 0L;
  243 + }
  244 +
  245 + //重置控制板时间
  246 + public static long setTime(XaFeign xaFeign,long sno , String outsideOrderId){
  247 + WgUdpCommShort pkt = new WgUdpCommShort();
  248 + pkt.iDevSn = sno;
  249 + try{
  250 + pkt.Reset();
  251 + pkt.functionID = WGUtils.toFunctionHex(outsideOrderId);
  252 + Calendar cal = (Calendar.getInstance());
  253 + pkt.data[0] = WGUtils.toHex(String.valueOf(cal.get(Calendar.YEAR)).substring(0,2));
  254 + pkt.data[1] = WGUtils.toHex(String.valueOf(cal.get(Calendar.YEAR)).substring(2,4));
  255 + pkt.data[2] = WGUtils.toHex(String.valueOf(cal.get(Calendar.MONTH)+1));
  256 + pkt.data[3] = WGUtils.toHex(String.valueOf(cal.get(Calendar.DATE)));
  257 + pkt.data[4] =WGUtils.toHex(String.valueOf(cal.get(Calendar.HOUR_OF_DAY)));
  258 + pkt.data[5] =WGUtils.toHex(String.valueOf(cal.get(Calendar.MINUTE)));
  259 + pkt.data[6] = WGUtils.toHex(String.valueOf(cal.get(Calendar.SECOND)));
  260 + byte[] bytes = pkt.toByte();
  261 + long index = WgUdpCommShort.getXidOfCommand(bytes);
  262 + long result = insert(xaFeign,sno+"",outsideOrderId,null,index,bytes);
  263 + pkt.run(watchingShortHandler.getSessionMap().get(sno),bytes);
  264 + return result ;
  265 + }catch (Exception e){
  266 + Log_error.error(e.toString());
  267 + }
  268 + return 0L;
  269 + }
  270 +
  271 +
  272 +
  273 + //设置考勤时段
  274 + public static List<Long> SetAttendanceTime(XaFeign xaFeign,long sno ,String outsideOrderId, int shiduan , Date begin ,Date end ,
  275 + int isMonDay ,int isTuesDay , int isWednesDay ,int isThursDay , int isFriday ,
  276 + int isSaturDay , int isWeekend , String shiqu){
  277 + List<Long> resultList = new ArrayList<>();
  278 + WgUdpCommShort pkt = new WgUdpCommShort();
  279 + pkt.iDevSn = sno;
  280 + try{
  281 + pkt.Reset();
  282 + pkt.functionID = WGUtils.toFunctionHex(outsideOrderId);
  283 + String[] shiQuArray = shiqu.split(",");
  284 + int shiDuanCount = shiQuArray.length / 6 ;
  285 + for (int i = 0; i < shiDuanCount; i++){
  286 + if (i == 0) {
  287 + pkt.data[0] = WGUtils.toHex(shiduan+"");
  288 + } else {
  289 + pkt.data[0] = WGUtils.toHex((shiduan+20*i)+"");
  290 + }
  291 + Calendar c = Calendar.getInstance();
  292 + c.setTime(begin);
  293 + //开始时间 20 19 01 01
  294 + pkt.data[1] = WGUtils.toHex(String.valueOf(c.get(Calendar.YEAR)).substring(0,2));
  295 + pkt.data[2] = WGUtils.toHex(String.valueOf(c.get(Calendar.YEAR)).substring(2,4));
  296 + pkt.data[3] = WGUtils.toHex(String.valueOf(c.get(Calendar.MONTH)+1));
  297 + pkt.data[4] = WGUtils.toHex(String.valueOf(c.get(Calendar.DATE)));
  298 + //结束时间
  299 + c.setTime(end);
  300 + pkt.data[5] = WGUtils.toHex(String.valueOf(c.get(Calendar.YEAR)).substring(0,2));
  301 + pkt.data[6] = WGUtils.toHex(String.valueOf(c.get(Calendar.YEAR)).substring(2,4));
  302 + pkt.data[7] = WGUtils.toHex(String.valueOf(c.get(Calendar.MONTH)+1));
  303 + pkt.data[8] = WGUtils.toHex(String.valueOf(c.get(Calendar.DATE)));
  304 + //星期几 有效
  305 + pkt.data[9] = WGUtils.toHex(String.valueOf(isMonDay));
  306 + pkt.data[10] = WGUtils.toHex(String.valueOf(isTuesDay));
  307 + pkt.data[11] = WGUtils.toHex(String.valueOf(isWednesDay));
  308 + pkt.data[12] = WGUtils.toHex(String.valueOf(isThursDay));
  309 + pkt.data[13] = WGUtils.toHex(String.valueOf(isFriday));
  310 + pkt.data[14] = WGUtils.toHex(String.valueOf(isSaturDay));
  311 + pkt.data[15] = WGUtils.toHex(String.valueOf(isWeekend));
  312 + //有效时区
  313 + pkt.data[16] = WGUtils.toHex(shiQuArray[i * 6 + 0].substring(0, 2));
  314 + pkt.data[17] = WGUtils.toHex(shiQuArray[i * 6 + 0].substring(3, 5));
  315 +
  316 + pkt.data[18] = WGUtils.toHex(shiQuArray[i * 6 + 1].substring(0, 2));
  317 + pkt.data[19] = WGUtils.toHex(shiQuArray[i * 6 + 1].substring(3, 5));
  318 +
  319 + pkt.data[20] = WGUtils.toHex(shiQuArray[i * 6 + 2].substring(0, 2));
  320 + pkt.data[21] = WGUtils.toHex(shiQuArray[i * 6 + 2].substring(3, 5));
  321 +
  322 + pkt.data[22] = WGUtils.toHex(shiQuArray[i * 6 + 3].substring(0, 2));
  323 + pkt.data[23] = WGUtils.toHex(shiQuArray[i * 6 + 3].substring(3, 5));
  324 +
  325 + pkt.data[24] = WGUtils.toHex(shiQuArray[i * 6 + 4].substring(0, 2));
  326 + pkt.data[25] = WGUtils.toHex(shiQuArray[i * 6 + 4].substring(3, 5));
  327 +
  328 + pkt.data[26] = WGUtils.toHex(shiQuArray[i * 6 + 5].substring(0, 2));
  329 + pkt.data[27] = WGUtils.toHex(shiQuArray[i * 6 + 5].substring(3, 5));
  330 + if (shiDuanCount != 1) {
  331 + //需要链接时段
  332 + if (i != shiDuanCount - 1) {
  333 + //只要不是最后一个时段
  334 + pkt.data[28] = WGUtils.toHex((shiduan+20*(i+1)+""));
  335 + } else {
  336 + pkt.data[28] = 0;
  337 + }
  338 + } else {
  339 + pkt.data[28] = 0;
  340 + }
  341 + byte[] bytes = pkt.toByte();
  342 + long index = WgUdpCommShort.getXidOfCommand(bytes);
  343 + long result = insert(xaFeign,sno+"",outsideOrderId,null,index,bytes);
  344 + pkt.run(watchingShortHandler.getSessionMap().get(sno),bytes);
  345 + resultList.add(result);
  346 + }
  347 + return resultList ;
  348 + }catch (Exception e){
  349 + Log_error.error(e.toString());
  350 + }
  351 + return resultList;
  352 + }
  353 +
  354 +
  355 + //设置权限
  356 + public static long SetSignalCardInfo(XaFeign xaFeign,long sno , String outsideOrderId, String cardNo , int shiduan , Date begin , Date end){
  357 + WgUdpCommShort pkt = new WgUdpCommShort();
  358 + pkt.iDevSn = sno;
  359 + try{
  360 + pkt.Reset();
  361 + pkt.functionID = WGUtils.toFunctionHex(outsideOrderId);
  362 + pkt.iDevSn = sno;
  363 + //0D D7 37 00
  364 + pkt.data[0] = WGUtils.toHex(cardNo.substring(0,2));
  365 + pkt.data[1] = WGUtils.toHex(cardNo.substring(2,4));
  366 + pkt.data[2] = WGUtils.toHex(cardNo.substring(4,6));
  367 + pkt.data[3] = WGUtils.toHex(cardNo.substring(6,8));
  368 +
  369 + //20 10 01 01 起始日期: 2010年01月01日 (必须大于2001年)
  370 + Calendar c = Calendar.getInstance();
  371 + c.setTime(begin);
  372 + pkt.data[4] = WGUtils.toHex(String.valueOf(c.get(Calendar.YEAR)).substring(0,2));
  373 + pkt.data[5] = WGUtils.toHex(String.valueOf(c.get(Calendar.YEAR)).substring(2,4));
  374 + pkt.data[6] = WGUtils.toHex(String.valueOf(c.get(Calendar.MONTH)+1));
  375 + pkt.data[7] = WGUtils.toHex(String.valueOf(c.get(Calendar.DATE)));
  376 + //20 29 12 31 截止日期: 2029年12月31日
  377 + c.setTime(end);
  378 + pkt.data[8] = WGUtils.toHex(String.valueOf(c.get(Calendar.YEAR)).substring(0,2));
  379 + pkt.data[9] = WGUtils.toHex(String.valueOf(c.get(Calendar.YEAR)).substring(2,4));
  380 + pkt.data[10] = WGUtils.toHex(String.valueOf(c.get(Calendar.MONTH)+1));
  381 + pkt.data[11] = WGUtils.toHex(String.valueOf(c.get(Calendar.DATE)));
  382 + //01 允许通过 一号门 [对单门, 双门, 四门控制器有效]
  383 + pkt.data[12] = WGUtils.toHex(shiduan+"");
  384 + //01 允许通过 二号门 [对双门, 四门控制器有效]
  385 + pkt.data[13] = WGUtils.toHex(shiduan+"");
  386 + //01 允许通过 三号门 [对四门控制器有效]
  387 + pkt.data[14] = WGUtils.toHex(shiduan+"");
  388 + //01 允许通过 四号门 [对四门控制器有效]
  389 + pkt.data[15] = WGUtils.toHex(shiduan+"");
  390 + byte[] bytes = pkt.toByte();
  391 + long index = WgUdpCommShort.getXidOfCommand(bytes);
  392 + long result = insert(xaFeign,sno+"",outsideOrderId,cardNo,index,bytes);
  393 + pkt.run(watchingShortHandler.getSessionMap().get(sno),bytes);
  394 + return result ;
  395 + }catch (Exception e){
  396 + Log_error.error(e.toString());
  397 + }
  398 + return 0l;
  399 + }
  400 +
  401 + //删除单张卡权限
  402 + public static long clearSinglePower(XaFeign xaFeign,long sno ,String outsideOrderId, String cardNo){
  403 + WgUdpCommShort pkt = new WgUdpCommShort();
  404 + pkt.iDevSn = sno;
  405 + try{
  406 + pkt.Reset();
  407 + pkt.functionID = WGUtils.toFunctionHex(outsideOrderId);
  408 + pkt.iDevSn = sno;
  409 + pkt.data[0] = WGUtils.toHex(cardNo.substring(0,2));
  410 + pkt.data[1] = WGUtils.toHex(cardNo.substring(2,4));
  411 + pkt.data[2] = WGUtils.toHex(cardNo.substring(4,6));
  412 + pkt.data[3] = WGUtils.toHex(cardNo.substring(6,8));
  413 + byte[] bytes = pkt.toByte();
  414 + long index = WgUdpCommShort.getXidOfCommand(bytes);
  415 + long result = insert(xaFeign,sno+"",outsideOrderId,cardNo,index,bytes);
  416 + pkt.run(watchingShortHandler.getSessionMap().get(sno),bytes);
  417 + return result ;
  418 + }catch (Exception e){
  419 + Log_error.error(e.toString());
  420 + }
  421 + return 0l;
  422 + }
  423 +
  424 + //删除全部权限
  425 + public static long clearAllPower(XaFeign xaFeign,long sno ,String outsideOrderId){
  426 + WgUdpCommShort pkt = new WgUdpCommShort();
  427 + pkt.iDevSn = sno;
  428 + try{
  429 + pkt.Reset();
  430 + pkt.functionID = WGUtils.toFunctionHex(outsideOrderId);
  431 + pkt.iDevSn = sno;
  432 + pkt.data[0] = (byte) 0x55 ;
  433 + pkt.data[1] = (byte) 0xAA ;
  434 + pkt.data[2] = (byte) 0xAA ;
  435 + pkt.data[3] = (byte) 0x55 ;
  436 + byte[] bytes = pkt.toByte();
  437 + long index = WgUdpCommShort.getXidOfCommand(bytes);
  438 + long result = insert(xaFeign,sno+"",outsideOrderId,null,index,bytes);
  439 + pkt.run(watchingShortHandler.getSessionMap().get(sno),bytes);
  440 + return result ;
  441 + }catch (Exception e){
  442 + Log_error.error(e.toString());
  443 + }
  444 + return 0l;
  445 + }
  446 +
  447 + //查询卡权限
  448 + public static long searchPower(XaFeign xaFeign,long sno ,String outsideOrderId, String cardNo){
  449 + WgUdpCommShort pkt = new WgUdpCommShort();
  450 + pkt.iDevSn = sno;
  451 + try{
  452 + pkt.Reset();
  453 + pkt.functionID = WGUtils.toFunctionHex(outsideOrderId);
  454 + pkt.iDevSn = sno;
  455 + pkt.data[0] = WGUtils.toHex(cardNo.substring(0,2));
  456 + pkt.data[1] = WGUtils.toHex(cardNo.substring(2,4));
  457 + pkt.data[2] = WGUtils.toHex(cardNo.substring(4,6));
  458 + pkt.data[3] = WGUtils.toHex(cardNo.substring(6,8));
  459 + byte[] bytes = pkt.toByte();
  460 + long index = WgUdpCommShort.getXidOfCommand(bytes);
  461 + long result = insert(xaFeign,sno+"",outsideOrderId,cardNo,index,bytes);
  462 + pkt.run(watchingShortHandler.getSessionMap().get(sno),bytes);
  463 + return result ;
  464 + }catch (Exception e){
  465 + Log_error.error(e.toString());
  466 + }
  467 + return 0l;
  468 + }
  469 +
  470 + //删除时段
  471 + public static long clearShiDuan(XaFeign xaFeign,long sno , String outsideOrderId){
  472 + WgUdpCommShort pkt = new WgUdpCommShort();
  473 + pkt.iDevSn = sno;
  474 + try{
  475 + pkt.Reset();
  476 + pkt.functionID = WGUtils.toFunctionHex(outsideOrderId);
  477 + pkt.iDevSn = sno;
  478 + pkt.data[0] = (byte) 0x55 ;
  479 + pkt.data[1] = (byte) 0xAA ;
  480 + pkt.data[2] = (byte) 0xAA ;
  481 + pkt.data[3] = (byte) 0x55 ;
  482 + byte[] bytes = pkt.toByte();
  483 + long index = WgUdpCommShort.getXidOfCommand(bytes);
  484 + long result = insert(xaFeign,sno+"",outsideOrderId,null,index,bytes);
  485 + pkt.run(watchingShortHandler.getSessionMap().get(sno),bytes);
  486 + return result ;
  487 + }catch (Exception e){
  488 + Log_error.error(e.toString());
  489 + }
  490 + return 0l;
  491 + }
  492 +
  493 + private static long insert(XaFeign xaFeign ,String sn ,String functionId , String cardNo , long index , byte[] recv){
  494 +
  495 + StringBuffer send = new StringBuffer();
  496 + for(byte b : recv){
  497 + send.append(WGUtils.byte2Hex(b)).append("-");
  498 + }
  499 + SendMessageDto sendMessage = new SendMessageDto();
  500 + sendMessage.setDeviceId(sn);
  501 + sendMessage.setFunctionId(Integer.toHexString(Integer.valueOf(functionId)));
  502 + sendMessage.setIndex(index);
  503 + sendMessage.setCardNo(cardNo);
  504 + sendMessage.setCreateTime(new Date());
  505 + sendMessage.setSend(send.toString().substring(0,send.toString().length()-1));
  506 + xaFeign.insertMessage(sendMessage);
  507 + return sendMessage.getId();
  508 + }
  509 +}
cloud/weigeng/src/main/java/com/sincere/weigeng/utils/WatchingShortHandler.java 0 → 100644
@@ -0,0 +1,90 @@ @@ -0,0 +1,90 @@
  1 +package com.sincere.weigeng.utils;
  2 +
  3 +import org.apache.mina.core.buffer.IoBuffer;
  4 +import org.apache.mina.core.service.IoHandlerAdapter;
  5 +import org.apache.mina.core.session.IdleStatus;
  6 +import org.apache.mina.core.session.IoSession;
  7 +
  8 +import java.util.Map;
  9 +import java.util.Queue;
  10 +
  11 +
  12 +/**
  13 + * Class the extends IoHandlerAdapter in order to properly handle
  14 + * connections and the data the connections send
  15 + *
  16 + * @author <a href="http://mina.apache.org" mce_href="http://mina.apache.org">Apache MINA Project</a>
  17 + */
  18 +public class WatchingShortHandler extends IoHandlerAdapter {
  19 +
  20 + private Queue<byte[]> queue;
  21 + private Map<Long , IoSession> sessionMap ;
  22 + public WatchingShortHandler(Queue<byte[]> queue , Map<Long , IoSession> sessionMap) {
  23 + super();
  24 + this.queue = queue;
  25 + this.sessionMap = sessionMap;
  26 + }
  27 +
  28 + /**
  29 + * 异常来关闭session
  30 + */
  31 + @Override
  32 + public void exceptionCaught(IoSession session, Throwable cause)
  33 + throws Exception {
  34 + cause.printStackTrace();
  35 + session.close(true);
  36 + }
  37 +
  38 + /**
  39 + * 服务器端收到一个消息
  40 + */
  41 + @Override
  42 + public void messageReceived(IoSession session, Object message) throws Exception {
  43 + IoBuffer io = (IoBuffer) message;
  44 + if (io.hasRemaining()) {
  45 + byte[] validBytes = new byte[io.remaining()];
  46 + io.get(validBytes,0,io.remaining());
  47 + if (validBytes.length == WgUdpCommShort.WGPacketSize) {
  48 + synchronized (queue) {
  49 + long sn = WgUdpCommShort.getLongByByte(validBytes, 4, 4);
  50 + sessionMap.put(sn,session);
  51 + queue.offer(validBytes);
  52 + }
  53 + } else {
  54 + }
  55 + }
  56 + }
  57 +
  58 + @Override
  59 + public void sessionClosed(IoSession session) throws Exception {
  60 + }
  61 +
  62 + @Override
  63 + public void sessionCreated(IoSession session) throws Exception {
  64 + }
  65 +
  66 + @Override
  67 + public void sessionIdle(IoSession session, IdleStatus status)
  68 + throws Exception {
  69 + }
  70 +
  71 + @Override
  72 + public void sessionOpened(IoSession session) throws Exception {
  73 + }
  74 +
  75 + public Queue<byte[]> getQueue() {
  76 + return queue;
  77 + }
  78 +
  79 + public void setQueue(Queue<byte[]> queue) {
  80 + this.queue = queue;
  81 + }
  82 +
  83 + public Map<Long, IoSession> getSessionMap() {
  84 + return sessionMap;
  85 + }
  86 +
  87 + public void setSessionMap(Map<Long, IoSession> sessionMap) {
  88 + this.sessionMap = sessionMap;
  89 + }
  90 +}
cloud/weigeng/src/main/java/com/sincere/weigeng/utils/WgUdpCommShort.java 0 → 100644
@@ -0,0 +1,120 @@ @@ -0,0 +1,120 @@
  1 +package com.sincere.weigeng.utils;
  2 +
  3 +import org.apache.mina.core.buffer.IoBuffer;
  4 +import org.apache.mina.core.session.IoSession;
  5 +
  6 +public class WgUdpCommShort { //短报文协议
  7 +
  8 + public static final int WGPacketSize = 64; //报文长度
  9 + public static final byte Type = 0x17; //2015-04-30 08:50:29 0x19; //类型
  10 + public static final int ControllerPort = 60000; //控制器端口
  11 + public static final long SpecialFlag = 0x55AAAA55; //特殊标识 防止误操作
  12 +
  13 + public static byte[] longToByte(long number) {
  14 + byte[] b = new byte[8];
  15 + for (int i = 0; i < 8; i++) {
  16 + b[i] = (byte) (number % 256);
  17 + number >>= 8;
  18 + }
  19 + return b;
  20 + }
  21 +
  22 + //从字节转换为 long型数据, 最大长度为8字节 低位在前, 高位在后...
  23 + //bytlen (1--8), 不在此范围则返回 -1
  24 + public static long getLongByByte(byte[] data,int startIndex,int bytlen)
  25 + {
  26 + long ret =-1;
  27 + if ((bytlen >=1) && (bytlen <=8))
  28 + {
  29 + ret = getIntByByte(data[startIndex + bytlen-1]);
  30 + for (int i=1; i<bytlen; i++)
  31 + {
  32 + ret <<=8;
  33 + ret += getIntByByte(data[startIndex + bytlen-1-i]);
  34 + }
  35 + }
  36 + return ret;
  37 + }
  38 +
  39 + //将带符号的bt转换为不带符号的int类型数据
  40 + public static int getIntByByte(byte bt) //bt 转换为无符号的int
  41 + {
  42 + if (bt <0)
  43 + {
  44 + return (bt+256);
  45 + }
  46 + else
  47 + {
  48 + return bt;
  49 + }
  50 + }
  51 +
  52 +
  53 + public byte functionID; //功能号
  54 + public long iDevSn; //设备序列号 4字节
  55 + public byte[] data= new byte[56]; //56字节的数据 [含流水号]
  56 +
  57 + private static long _Global_xid = 0;
  58 + protected long _xid = 0; //2011-5-12 15:28:37
  59 + void GetNewXid() //2011-1-10 14:22:16 获取新的Xid
  60 + {
  61 + _Global_xid++;
  62 + _xid = _Global_xid; //新的值
  63 + }
  64 + static long getXidOfCommand(byte[] cmd) //获取指令中的xid
  65 + {
  66 + long ret = -1;
  67 + if (cmd.length >= WGPacketSize)
  68 + {
  69 + ret = getLongByByte(cmd, 40, 4);
  70 + }
  71 + return ret;
  72 + }
  73 +
  74 + public WgUdpCommShort()
  75 + {
  76 + Reset();
  77 + }
  78 + public void Reset() //数据复位
  79 + {
  80 + for(int i=0; i<data.length; i++)
  81 + {
  82 + data[i] =0;
  83 + }
  84 + }
  85 + public byte[] toByte() //生成64字节指令包
  86 + {
  87 + byte[] buff =new byte[WGPacketSize];
  88 + for(int i=0; i<data.length; i++)
  89 + {
  90 + buff[i] =0;
  91 + }
  92 + buff[0] = Type;
  93 + buff[1] = functionID;
  94 + System.arraycopy(longToByte(iDevSn), 0, buff, 4, 4);
  95 + System.arraycopy(data, 0, buff, 8, data.length);
  96 +
  97 + GetNewXid();
  98 + System.arraycopy(longToByte(_xid), 0, buff, 40, 4);
  99 + return buff;
  100 + }
  101 +
  102 + public void run(IoSession ioSession , byte[] command){
  103 + byte[] bytCommand = command;
  104 + IoBuffer b;
  105 + Boolean bSent =false;
  106 + //ioSession = connFuture.getSession();
  107 + if (ioSession !=null)
  108 + {
  109 + if (ioSession.isConnected())
  110 + {
  111 + b = IoBuffer.allocate(bytCommand.length);
  112 + b.put(bytCommand);
  113 + b.flip();
  114 + ioSession.write(b);
  115 + bSent = true;
  116 + }
  117 + }
  118 + }
  119 +
  120 +}
cloud/weigeng/src/main/java/com/sincere/weigeng/vo/AttendanceTimeVo.java 0 → 100644
@@ -0,0 +1,156 @@ @@ -0,0 +1,156 @@
  1 +package com.sincere.weigeng.vo;
  2 +
  3 +import java.util.Date;
  4 +
  5 +/**
  6 + * @author chen
  7 + * @version 1.0
  8 + * @date 2019/11/1 0001 8:00
  9 + */
  10 +public class AttendanceTimeVo {
  11 + /**
  12 + * 设置考勤时段
  13 + * @param id 指令id
  14 + * @param sn 设备号
  15 + * @param shiduan 时段
  16 + * @param start 开始时间
  17 + * @param end 截止时间
  18 + * @param IsMonday 周一是否有效 0 无效 1有效
  19 + * @param IsTuesday 周二是否有效 0 无效 1有效
  20 + * @param IsWednesday 周三是否有效 0 无效 1有效
  21 + * @param IsThursday 周四是否有效 0 无效 1有效
  22 + * @param IsFriday 周五是否有效 0 无效 1有效
  23 + * @param IsSaturday 周六是否有效 0 无效 1有效
  24 + * @param IsWeekend 周日是否有效 0 无效 1有效
  25 + * @param shiqu 具体的时间点,格式 “09:09,11:11,00:00,00:00,00:00,00:00”
  26 + * 注意:时间点之间拿英文的都好隔开。时与分不足两位要补0。一个完整的时段需要6个时间点。不足6个的要补“00:00”
  27 + * @param type 设备类型
  28 + * @return
  29 + */
  30 + private int id ;
  31 + private int type ;
  32 + private long sn ;
  33 + private int shiduan ;
  34 + private Date start ;
  35 + private Date end ;
  36 + private int IsMonday ;
  37 + private int IsTuesday ;
  38 + private int IsWednesday ;
  39 + private int IsThursday ;
  40 + private int IsFriday ;
  41 + private int IsSaturday ;
  42 + private int IsWeekend ;
  43 + private String shiqu ;
  44 +
  45 + public int getId() {
  46 + return id;
  47 + }
  48 +
  49 + public void setId(int id) {
  50 + this.id = id;
  51 + }
  52 +
  53 + public int getType() {
  54 + return type;
  55 + }
  56 +
  57 + public void setType(int type) {
  58 + this.type = type;
  59 + }
  60 +
  61 + public Date getStart() {
  62 + return start;
  63 + }
  64 +
  65 + public void setStart(Date start) {
  66 + this.start = start;
  67 + }
  68 +
  69 + public Date getEnd() {
  70 + return end;
  71 + }
  72 +
  73 + public void setEnd(Date end) {
  74 + this.end = end;
  75 + }
  76 +
  77 + public int getIsMonday() {
  78 + return IsMonday;
  79 + }
  80 +
  81 + public void setIsMonday(int isMonday) {
  82 + IsMonday = isMonday;
  83 + }
  84 +
  85 + public int getIsTuesday() {
  86 + return IsTuesday;
  87 + }
  88 +
  89 + public void setIsTuesday(int isTuesday) {
  90 + IsTuesday = isTuesday;
  91 + }
  92 +
  93 + public int getIsWednesday() {
  94 + return IsWednesday;
  95 + }
  96 +
  97 + public void setIsWednesday(int isWednesday) {
  98 + IsWednesday = isWednesday;
  99 + }
  100 +
  101 + public int getIsThursday() {
  102 + return IsThursday;
  103 + }
  104 +
  105 + public void setIsThursday(int isThursday) {
  106 + IsThursday = isThursday;
  107 + }
  108 +
  109 + public int getIsFriday() {
  110 + return IsFriday;
  111 + }
  112 +
  113 + public void setIsFriday(int isFriday) {
  114 + IsFriday = isFriday;
  115 + }
  116 +
  117 + public int getIsSaturday() {
  118 + return IsSaturday;
  119 + }
  120 +
  121 + public void setIsSaturday(int isSaturday) {
  122 + IsSaturday = isSaturday;
  123 + }
  124 +
  125 + public int getIsWeekend() {
  126 + return IsWeekend;
  127 + }
  128 +
  129 + public void setIsWeekend(int isWeekend) {
  130 + IsWeekend = isWeekend;
  131 + }
  132 +
  133 + public String getShiqu() {
  134 + return shiqu;
  135 + }
  136 +
  137 + public void setShiqu(String shiqu) {
  138 + this.shiqu = shiqu;
  139 + }
  140 +
  141 + public long getSn() {
  142 + return sn;
  143 + }
  144 +
  145 + public void setSn(long sn) {
  146 + this.sn = sn;
  147 + }
  148 +
  149 + public int getShiduan() {
  150 + return shiduan;
  151 + }
  152 +
  153 + public void setShiduan(int shiduan) {
  154 + this.shiduan = shiduan;
  155 + }
  156 +}
cloud/weigeng/src/main/java/com/sincere/weigeng/vo/CardInfo.java 0 → 100644
@@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
  1 +package com.sincere.weigeng.vo;
  2 +
  3 +/**
  4 + * @author chen
  5 + * @version 1.0
  6 + * @date 2019/11/1 0001 8:09
  7 + */
  8 +public class CardInfo {
  9 +
  10 + /**
  11 + *
  12 + * @param id 指令
  13 + * @param sn 设备号
  14 + * @param cardNo 卡号
  15 + * @param type 设备类型
  16 + * @return
  17 + */
  18 + private int id ;
  19 + private int type ;
  20 + private long sn ;
  21 + private String cardNo ;
  22 +
  23 + public int getId() {
  24 + return id;
  25 + }
  26 +
  27 + public void setId(int id) {
  28 + this.id = id;
  29 + }
  30 +
  31 + public int getType() {
  32 + return type;
  33 + }
  34 +
  35 + public void setType(int type) {
  36 + this.type = type;
  37 + }
  38 +
  39 + public long getSn() {
  40 + return sn;
  41 + }
  42 +
  43 + public void setSn(long sn) {
  44 + this.sn = sn;
  45 + }
  46 +
  47 + public String getCardNo() {
  48 + return cardNo;
  49 + }
  50 +
  51 + public void setCardNo(String cardNo) {
  52 + this.cardNo = cardNo;
  53 + }
  54 +}
cloud/weigeng/src/main/java/com/sincere/weigeng/vo/CleanShiDuanVo.java 0 → 100644
@@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
  1 +package com.sincere.weigeng.vo;
  2 +
  3 +/**
  4 + * @author chen
  5 + * @version 1.0
  6 + * @date 2019/11/1 0001 8:12
  7 + */
  8 +public class CleanShiDuanVo {
  9 +
  10 + /**
  11 + *
  12 + * @param id 指令
  13 + * @param sn 设备号
  14 + * @param type 设备类型
  15 + * @return
  16 + */
  17 + private int id ;
  18 + private int type ;
  19 + private long sn ;
  20 +
  21 + public int getId() {
  22 + return id;
  23 + }
  24 +
  25 + public void setId(int id) {
  26 + this.id = id;
  27 + }
  28 +
  29 + public int getType() {
  30 + return type;
  31 + }
  32 +
  33 + public void setType(int type) {
  34 + this.type = type;
  35 + }
  36 +
  37 + public long getSn() {
  38 + return sn;
  39 + }
  40 +
  41 + public void setSn(long sn) {
  42 + this.sn = sn;
  43 + }
  44 +}
cloud/weigeng/src/main/java/com/sincere/weigeng/vo/OpenDoorVo.java 0 → 100644
@@ -0,0 +1,53 @@ @@ -0,0 +1,53 @@
  1 +package com.sincere.weigeng.vo;
  2 +
  3 +/**
  4 + * @author chen
  5 + * @version 1.0
  6 + * @date 2019/11/1 0001 7:58
  7 + */
  8 +public class OpenDoorVo {
  9 + /**
  10 + * 开门
  11 + * @param sn 设备号
  12 + * @param id 指令id
  13 + * @param doorNo 门号
  14 + * @param type 设备类型 微耕 =1
  15 + * @return
  16 + */
  17 + private int id ;
  18 + private int type ;
  19 + private long sn ;
  20 + private int doorNo ;
  21 +
  22 + public int getId() {
  23 + return id;
  24 + }
  25 +
  26 + public void setId(int id) {
  27 + this.id = id;
  28 + }
  29 +
  30 + public int getType() {
  31 + return type;
  32 + }
  33 +
  34 + public void setType(int type) {
  35 + this.type = type;
  36 + }
  37 +
  38 + public long getSn() {
  39 + return sn;
  40 + }
  41 +
  42 + public void setSn(long sn) {
  43 + this.sn = sn;
  44 + }
  45 +
  46 + public int getDoorNo() {
  47 + return doorNo;
  48 + }
  49 +
  50 + public void setDoorNo(int doorNo) {
  51 + this.doorNo = doorNo;
  52 + }
  53 +}
cloud/weigeng/src/main/java/com/sincere/weigeng/vo/SignalCardInfoVo.java 0 → 100644
@@ -0,0 +1,95 @@ @@ -0,0 +1,95 @@
  1 +package com.sincere.weigeng.vo;
  2 +
  3 +import java.util.Date;
  4 +
  5 +/**
  6 + * @author chen
  7 + * @version 1.0
  8 + * @date 2019/11/1 0001 8:05
  9 + */
  10 +public class SignalCardInfoVo {
  11 + /**
  12 + * 单个卡号的权限添加或修改
  13 + * @param updateId updateCard 主键
  14 + * @param cardNo 卡号 十进制
  15 + * @param id 指令
  16 + * @param sn 设备号
  17 + * @param shiduan 时段
  18 + * @param startTime 卡权限有效开始时间
  19 + * @param endTime 卡权限有效结束时间
  20 + * @param type 设备类型
  21 + * @return
  22 + */
  23 + private int id ;
  24 + private int type ;
  25 + private int updateId ;
  26 + private String cardNo ;
  27 + private long sn ;
  28 + private Date startTime ;
  29 + private Date endTime ;
  30 + private int shiduan ;
  31 +
  32 + public int getId() {
  33 + return id;
  34 + }
  35 +
  36 + public void setId(int id) {
  37 + this.id = id;
  38 + }
  39 +
  40 + public int getType() {
  41 + return type;
  42 + }
  43 +
  44 + public void setType(int type) {
  45 + this.type = type;
  46 + }
  47 +
  48 + public int getUpdateId() {
  49 + return updateId;
  50 + }
  51 +
  52 + public void setUpdateId(int updateId) {
  53 + this.updateId = updateId;
  54 + }
  55 +
  56 + public String getCardNo() {
  57 + return cardNo;
  58 + }
  59 +
  60 + public void setCardNo(String cardNo) {
  61 + this.cardNo = cardNo;
  62 + }
  63 +
  64 + public long getSn() {
  65 + return sn;
  66 + }
  67 +
  68 + public void setSn(long sn) {
  69 + this.sn = sn;
  70 + }
  71 +
  72 + public Date getStartTime() {
  73 + return startTime;
  74 + }
  75 +
  76 + public void setStartTime(Date startTime) {
  77 + this.startTime = startTime;
  78 + }
  79 +
  80 + public Date getEndTime() {
  81 + return endTime;
  82 + }
  83 +
  84 + public void setEndTime(Date endTime) {
  85 + this.endTime = endTime;
  86 + }
  87 +
  88 + public int getShiduan() {
  89 + return shiduan;
  90 + }
  91 +
  92 + public void setShiduan(int shiduan) {
  93 + this.shiduan = shiduan;
  94 + }
  95 +}
cloud/weigeng/src/main/resources/application.yaml
1 server: 1 server:
2 - port: 1200 2 + port: 9000
3 3
4 spring: 4 spring:
5 application: 5 application:
6 - name: weigen-server 6 + name: weigeng-server
7 profiles: 7 profiles:
8 active: dev 8 active: dev
9 - datasource:  
10 - username: szjxtuser  
11 - password: RQminVCJota3H1u8bBYH  
12 - url: jdbc:sqlserver://116.62.155.137:33419;database=SmartCampus  
13 - driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver  
14 -# datasource:  
15 -# username: szjxtuser  
16 -# password: RQminVCJota3H1u8bBYH  
17 -# url: jdbc:sqlserver://116.62.155.137:33419;database=SmartAdmin 9 +
18 10
19 eureka: 11 eureka:
20 instance: 12 instance:
@@ -24,10 +16,5 @@ eureka: @@ -24,10 +16,5 @@ eureka:
24 client: 16 client:
25 service-url: 17 service-url:
26 # defaultZone: http://localhost:8761/eureka/ 18 # defaultZone: http://localhost:8761/eureka/
27 - defaultZone: http://121.40.109.21:8761/eureka/,http://121.40.109.21:8762/eureka/  
28 - 19 + defaultZone: http://localhost:8761/eureka/,http://localhost:8762/eureka/
29 20
30 -mybatis:  
31 - type-aliases-package: com.sincere.weigeng.dao  
32 - mapper-locations: classpath:mapper/*.xml  
33 - config-location: classpath:mybatis-config.xml  
cloud/weigeng/src/main/resources/logback.xml 0 → 100644
@@ -0,0 +1,118 @@ @@ -0,0 +1,118 @@
  1 +<?xml version="1.0" encoding="utf-8" ?>
  2 +<configuration scan="true" scanPeriod="60 seconds" debug="false">
  3 + <!-- 定义日志文件 输入位置 -->
  4 + <property name="logPath" value="d:/wg_log" />
  5 + <!-- 日志最大的历史 30天 -->
  6 + <property name="maxHistory" value="600"/>
  7 +
  8 + <!-- 配置项, 通过此节点配置日志输出位置(控制台、文件、数据库)、输出格式等-->
  9 + <!-- ConsoleAppender代表输出到控制台 -->
  10 + <appender name="consoleLog" class="ch.qos.logback.core.ConsoleAppender">
  11 + <!-- layout代表输出格式 -->
  12 + <layout class="ch.qos.logback.classic.PatternLayout">
  13 + <pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger -%msg%n</pattern>
  14 + </layout>
  15 + </appender>
  16 + <!-- 日志输出文件 -->
  17 + <appender name="orderSuccessInfoLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
  18 + <encoder>
  19 + <pattern>%d{yyyy-MM-dd HH:mm:ss} -%msg%n</pattern>
  20 + </encoder>
  21 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  22 + <timeBasedFileNamingAndTriggeringPolicy class="com.sincere.weigeng.logs.MyTimeBasedFileNamingAndTriggeringPolicy">
  23 + <multiple>1</multiple>
  24 + </timeBasedFileNamingAndTriggeringPolicy>
  25 + <!-- 输出路径 -->
  26 + <fileNamePattern>${logPath}/info/orderSuccess/%d{yyyy-MM-dd HH}.log</fileNamePattern>
  27 + <maxHistory>${maxHistory}</maxHistory>
  28 + </rollingPolicy>
  29 + </appender>
  30 + <appender name="orderFailInfoLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
  31 + <encoder>
  32 + <pattern>%d{yyyy-MM-dd HH:mm:ss} -%msg%n</pattern>
  33 + </encoder>
  34 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  35 + <timeBasedFileNamingAndTriggeringPolicy class="com.sincere.weigeng.logs.MyTimeBasedFileNamingAndTriggeringPolicy">
  36 + <multiple>1</multiple>
  37 + </timeBasedFileNamingAndTriggeringPolicy>
  38 + <!-- 输出路径 -->
  39 + <fileNamePattern>${logPath}/info/orderFail/%d{yyyy-MM-dd HH}.log</fileNamePattern>
  40 + <maxHistory>${maxHistory}</maxHistory>
  41 + </rollingPolicy>
  42 + </appender>
  43 + <appender name="heartBeatLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
  44 + <encoder>
  45 + <pattern>%d{yyyy-MM-dd HH:mm:ss} -%msg%n</pattern>
  46 + </encoder>
  47 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  48 + <timeBasedFileNamingAndTriggeringPolicy class="com.sincere.weigeng.logs.MyTimeBasedFileNamingAndTriggeringPolicy">
  49 + <multiple>1</multiple>
  50 + </timeBasedFileNamingAndTriggeringPolicy>
  51 + <!-- 输出路径 -->
  52 + <fileNamePattern>${logPath}/info/heartBeat/%d{yyyy-MM-dd HH}.log</fileNamePattern>
  53 + <maxHistory>${maxHistory}</maxHistory>
  54 + </rollingPolicy>
  55 + </appender>
  56 + <appender name="kaoInfoInfoLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
  57 + <encoder>
  58 + <pattern>%d{yyyy-MM-dd HH:mm:ss} -%msg%n</pattern>
  59 + </encoder>
  60 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  61 + <timeBasedFileNamingAndTriggeringPolicy class="com.sincere.weigeng.logs.MyTimeBasedFileNamingAndTriggeringPolicy">
  62 + <multiple>1</multiple>
  63 + </timeBasedFileNamingAndTriggeringPolicy>
  64 + <!-- 输出路径 -->
  65 + <fileNamePattern>${logPath}/info/kaoInfo/%d{yyyy-MM-dd HH}.log</fileNamePattern>
  66 + <maxHistory>${maxHistory}</maxHistory>
  67 + </rollingPolicy>
  68 + </appender>
  69 +
  70 +
  71 + <!-- 特殊记录Error日志 -->
  72 + <appender name="fileErrorLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
  73 + <!-- 只记录ERROR级别日志,添加范围过滤,可以将该类型的日志特殊记录到某个位置 -->
  74 + <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
  75 + <level>ERROR</level>
  76 + </filter>
  77 + <encoder>
  78 + <pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger -%msg%n</pattern>
  79 + </encoder>
  80 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  81 + <timeBasedFileNamingAndTriggeringPolicy class="com.sincere.weigeng.logs.MyTimeBasedFileNamingAndTriggeringPolicy">
  82 + <multiple>1</multiple>
  83 + </timeBasedFileNamingAndTriggeringPolicy>
  84 + <fileNamePattern>${logPath}/infoError/${PROJECT_NAME}.%d{yyyy-MM-dd}.log</fileNamePattern>
  85 + <!-- 日志最大的历史 60天 -->
  86 + <maxHistory>${maxHistory}</maxHistory>
  87 + </rollingPolicy>
  88 + </appender>
  89 +
  90 + <!-- 不同的业务逻辑日志打印到指定文件夹-->
  91 + <logger name="orderSuccess" additivity="false" level="INFO">
  92 + <appender-ref ref="orderSuccessInfoLog"/>
  93 + </logger>
  94 + <logger name="orderFail" additivity="false" level="INFO">
  95 + <appender-ref ref="orderFailInfoLog"/>
  96 + </logger>
  97 + <logger name="kaoInfo" additivity="false" level="INFO">
  98 + <appender-ref ref="kaoInfoInfoLog"/>
  99 + </logger>
  100 + <logger name="heartBeat" additivity="false" level="INFO">
  101 + <appender-ref ref="heartBeatLog"/>
  102 + </logger>
  103 + <logger name="error" additivity="false" level="ERROR">
  104 + <appender-ref ref="fileErrorLog"/>
  105 + </logger>
  106 +
  107 + <root level="info">
  108 +        <appender-ref ref="consoleLog" />
  109 + <appender-ref ref="orderSuccessInfoLog" />
  110 + <appender-ref ref="orderFailInfoLog" />
  111 + <appender-ref ref="kaoInfoInfoLog" />
  112 + <appender-ref ref="heartBeatLog" />
  113 + </root>
  114 +
  115 + <root level="error">
  116 + <appender-ref ref="fileErrorLog" />
  117 + </root>
  118 +</configuration>
0 \ No newline at end of file 119 \ No newline at end of file
cloud/weigeng/src/main/resources/mybatis-config.xml
@@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@
1 -<?xml version="1.0" encoding="UTF-8"?>  
2 -<!DOCTYPE configuration  
3 - PUBLIC "-//mybatis.org//DTD Config 3.0//EN"  
4 - "http://mybatis.org/dtd/mybatis-3-config.dtd">  
5 -  
6 -<configuration>  
7 - <properties >  
8 - <property name="dialect" value="mysql" />  
9 - </properties>  
10 - <settings>  
11 - <!-- 这个配置使全局的映射器启用或禁用缓存。系统默认值是true,设置只是为了展示出来 -->  
12 - <setting name="cacheEnabled" value="true" />  
13 - <!-- 全局启用或禁用延迟加载。当禁用时,所有关联对象都会即时加载。 系统默认值是true,设置只是为了展示出来 -->  
14 - <setting name="lazyLoadingEnabled" value="true" />  
15 - <!-- 允许或不允许多种结果集从一个单独的语句中返回(需要适合的驱动)。 系统默认值是true,设置只是为了展示出来 -->  
16 - <setting name="multipleResultSetsEnabled" value="true" />  
17 - <!--使用列标签代替列名。不同的驱动在这方便表现不同。参考驱动文档或充分测试两种方法来决定所使用的驱动。 系统默认值是true,设置只是为了展示出来 -->  
18 - <setting name="useColumnLabel" value="true" />  
19 - <!--允许 JDBC 支持生成的键。需要适合的驱动。如果设置为 true 则这个设置强制生成的键被使用,尽管一些驱动拒绝兼容但仍然有效(比如  
20 - Derby)。 系统默认值是false,设置只是为了展示出来 -->  
21 - <setting name="useGeneratedKeys" value="false" />  
22 - <!--配置默认的执行器。SIMPLE 执行器没有什么特别之处。REUSE 执行器重用预处理语句。BATCH 执行器重用语句和批量更新 系统默认值是SIMPLE,设置只是为了展示出来 -->  
23 - <setting name="defaultExecutorType" value="SIMPLE" />  
24 - <!--设置超时时间,它决定驱动等待一个数据库响应的时间。 系统默认值是null,设置只是为了展示出来 -->  
25 - <setting name="defaultStatementTimeout" value="25000" />  
26 - </settings>  
27 -  
28 - <!--<typeAliases>-->  
29 - <!--<typeAlias alias="user" type="com.shunzhi.mqtt2kanban.bean.User"/>-->  
30 - <!--</typeAliases>-->  
31 -  
32 - <!--<mappers>-->  
33 - <!--<control resource="mybatis/control/UserMapper.xml"/>-->  
34 - <!--</mappers>-->  
35 -</configuration>  
36 \ No newline at end of file 0 \ No newline at end of file
cloud/weigeng/src/test/java/com/sincere/weigeng/WeigengApplicationTests.java
@@ -1,570 +0,0 @@ @@ -1,570 +0,0 @@
1 -package com.sincere.weigeng;  
2 -  
3 -import com.drew.imaging.jpeg.JpegMetadataReader;  
4 -import com.drew.imaging.jpeg.JpegProcessingException;  
5 -import com.drew.metadata.Directory;  
6 -import com.drew.metadata.Metadata;  
7 -import com.drew.metadata.Tag;  
8 -import com.drew.metadata.exif.ExifDirectory;  
9 -import com.sincere.weigeng.dao.UserDao;  
10 -import org.apache.poi.hssf.usermodel.HSSFCell;  
11 -import org.apache.poi.hssf.usermodel.HSSFRow;  
12 -import org.apache.poi.hssf.usermodel.HSSFSheet;  
13 -import org.apache.poi.hssf.usermodel.HSSFWorkbook;  
14 -import org.json.JSONArray;  
15 -import org.json.JSONObject;  
16 -import org.junit.Test;  
17 -import org.junit.runner.RunWith;  
18 -import org.springframework.beans.factory.annotation.Autowired;  
19 -import org.springframework.boot.test.context.SpringBootTest;  
20 -import org.springframework.http.HttpEntity;  
21 -import org.springframework.http.HttpHeaders;  
22 -import org.springframework.http.MediaType;  
23 -import org.springframework.http.ResponseEntity;  
24 -import org.springframework.test.context.junit4.SpringRunner;  
25 -import org.springframework.util.LinkedMultiValueMap;  
26 -import org.springframework.util.MultiValueMap;  
27 -import org.springframework.web.client.RestTemplate;  
28 -  
29 -import javax.imageio.ImageIO;  
30 -import java.awt.*;  
31 -import java.awt.image.BufferedImage;  
32 -import java.io.*;  
33 -import java.text.SimpleDateFormat;  
34 -import java.util.*;  
35 -import java.util.List;  
36 -  
37 -@RunWith(SpringRunner.class)  
38 -@SpringBootTest  
39 -public class WeigengApplicationTests {  
40 -  
41 - @Autowired  
42 - TestDao testDao;  
43 -  
44 - @Test  
45 - public void contextLoads() {  
46 -  
47 - try {  
48 - BufferedReader bufferedReader = new BufferedReader(new FileReader("C:\\Users\\taohandong\\Desktop\\json.txt"));  
49 - String content = null;  
50 - StringBuilder stringBuilder = new StringBuilder();  
51 - while ((content = bufferedReader.readLine()) != null) {  
52 - stringBuilder.append(content);  
53 - }  
54 -  
55 - JSONObject jsonObject = new JSONObject(stringBuilder.toString());  
56 - JSONObject data = jsonObject.optJSONObject("data");  
57 - JSONArray questions = data.optJSONArray("questions");  
58 - for (int i = 0; i < questions.length(); i++) {  
59 - JSONObject question = questions.optJSONObject(i);  
60 - String question_text = question.optString("question_text");  
61 - String answer = question.optString("answer");//答案  
62 - String explanation = question.optString("explanation");//解析  
63 -// <p><img src="/Web/Assets/ueditor/asp/upload/image/20190916/15686369926495741.png" title="image.png" alt="image.png"/></p>  
64 - explanation = "<p><img src=\"" + explanation + "\" title=\"image.png\" alt=\"image.png\"/></p>";  
65 - answer = getAnswer(answer);  
66 - System.out.println("question_text:" + question_text + "\r\nanswer:" + answer + "\r\nexplanation:" + explanation);  
67 - List<QuestionBean> questionBeans = testDao.getQuestions(question_text);//获取题目  
68 - for (int j = 0; j < questionBeans.size(); j++) {  
69 - QuestionBean questionBean = questionBeans.get(j);  
70 - testDao.updateQuestion(questionBean.getID(), answer, explanation);  
71 - }  
72 -// System.out.println(questionBeans.toString());  
73 - }  
74 -  
75 - } catch (FileNotFoundException e) {  
76 - e.printStackTrace();  
77 - } catch (IOException e) {  
78 - e.printStackTrace();  
79 - }  
80 -  
81 - }  
82 -  
83 - private String url = "https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic?access_token=24.26683b650b73b63e0b08afa7ac36e880.2592000.1571310480.282335-15990462";  
84 -  
85 - private String getAnswer(String imgUrl) {  
86 - RestTemplate restTemplate = new RestTemplate();  
87 -  
88 - HttpHeaders headers = new HttpHeaders();  
89 - headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);  
90 -  
91 - MultiValueMap<String, String> multiValueMap = new LinkedMultiValueMap<>();  
92 -// multiValueMap.add("image", ImageUtils.ImageToBase64ByLocal("C:\\Users\\taohandong\\Desktop\\识别.png"));  
93 - multiValueMap.add("url", imgUrl);  
94 - HttpEntity<MultiValueMap> requestEntity = new HttpEntity<MultiValueMap>(multiValueMap,  
95 -  
96 - headers);  
97 -  
98 - ResponseEntity<String> result = restTemplate.postForEntity(url, requestEntity, String.class);  
99 -  
100 - JSONObject jsonObject = new JSONObject(result.getBody());  
101 -// System.out.println("result:"+result.getBody());  
102 - JSONArray words_result = jsonObject.optJSONArray("words_result");  
103 -// System.out.println("words_result:"+words_result);  
104 - StringBuilder stringBuilder = new StringBuilder();  
105 - if (words_result != null) {  
106 - for (int i = 0; i < words_result.length(); i++) {  
107 - String words = words_result.optJSONObject(i).optString("words");  
108 - stringBuilder.append(words + " ");  
109 - }  
110 - System.out.println("result:" + stringBuilder.toString());  
111 - }  
112 - return stringBuilder.toString().equals("") ? "B" : stringBuilder.toString();  
113 - }  
114 -  
115 - @Test  
116 - public void get() {  
117 -  
118 -// String url = "https://zujuan.21cnjy.com/api/question/list?xd=1&chid=3&categories=3877&knowledges=&question_channel_type=1&difficult_index=&exam_type=&kid_num=&grade_id=&sort_field=time&filterquestion=0&page=&_grade_id=&tree_type=category&version_id=&_=1568766250186";  
119 -// RestTemplate restTemplate = new RestTemplate();  
120 -// System.out.println(restTemplate.getForObject(url, String.class));  
121 - /*String createrUserId = "zy273789", time = "2019-10-08";  
122 - List<TestPaper> testPaperList = testDao.getTestPapers(createrUserId, time);  
123 - for (int i = 0; i < testPaperList.size(); i++) {  
124 - TestPaper testPaper = testPaperList.get(i);  
125 - int schoolId = 11;  
126 - testDao.addTestPaper("zy284782", testPaper.getQuestionIds(), testPaper.getStatus(), testPaper.getPublishTime(),  
127 - testPaper.getName(), testPaper.getIsRecommend(), testPaper.getState(), testPaper.getIntime(), schoolId + "");  
128 -  
129 - }*/  
130 -  
131 - }  
132 -  
133 -  
134 - /**  
135 - * 创建试卷  
136 - */  
137 - @Test  
138 - public void createTestPaper() {  
139 - String createUserId = "zy309728";  
140 - List<TestPaper> testPaperList = testDao.getTestPapers(createUserId, "2019-09-18 16:00:00");  
141 - System.out.println("testPaperList:" + testPaperList.toString());  
142 -  
143 - String addCreateUserId = "zy411337", SchoolId = "885";  
144 - /* for (int i = 1; i < testPaperList.size(); i++) {  
145 - TestPaper testPaper = testPaperList.get(i);  
146 - int ID = testPaper.getID();  
147 - //添加试卷  
148 - testDao.addTestPaper(addCreateUserId, testPaper.getQuestionIds(), testPaper.getStatus(), testPaper.getPublishTime()  
149 - , testPaper.getName(), testPaper.getIsRecommend(), testPaper.getState(), testPaper.getIntime(), SchoolId);  
150 -  
151 - //发布作业  
152 - testDao.addHomework(addCreateUserId, testPaper.getID(), testPaper.getName(), "50", "2019-09-20 18:00", "2", "2019-09-19 19:10", 1, 0, 1, "2019-09-19 19:10", 0, testPaper.getQuestionIds(), 0, 0);  
153 - }*/  
154 - /*String[] answers = new String[]{"A", "B", "C", "D"};  
155 - String QuestionType = "1";  
156 - String CorrectAnswer = "";  
157 - List<Homework> homeworkList = testDao.getHomeWork(addCreateUserId);  
158 - for (int i = 0; i < homeworkList.size(); i++) {  
159 - Homework homework = homeworkList.get(i);  
160 - String[] questionIds = homework.getQuestionIds().split(",");  
161 - for (int j = 0; j < questionIds.length; j++) {  
162 - String questionId = questionIds[j];  
163 - QuestionBean questionBean = testDao.getQues(questionId);  
164 - CorrectAnswer = questionBean.getCorrectAnswer();  
165 - String answer = answers[new Random().nextInt(4)];  
166 - String IsCorresct = answer.trim().equals(CorrectAnswer.trim()) ? "1" : "3";  
167 - testDao.StudentAnswer(questionId, answer, CorrectAnswer, QuestionType, IsCorresct, homework.getID());  
168 - }  
169 -  
170 - }*/  
171 -// if (ID <= 4191 && ID >= 4187) {  
172 - String classId = "36398";  
173 - List<Homework> homeworkList = testDao.getHomeWork(addCreateUserId);  
174 - for (int i = 0; i < homeworkList.size(); i++) {  
175 - String workId = homeworkList.get(i).getID();  
176 -// List<String> stuAnsIds = testDao.getStudentAnsIds(workId);  
177 -// String stuAnIds = stuAnsIds.toString().replace("[", "");  
178 -// stuAnIds = stuAnIds.replace("]", "");  
179 -  
180 - List<String> strings = testDao.getStudentIdsWithClassId(classId);  
181 - String stuIds = strings.toString().replace("[", "");  
182 - stuIds = stuIds.replace("]", "");  
183 - String[] stuStrings = stuIds.split(",");//学生id  
184 -  
185 - for (int j = 0; j < stuStrings.length; j++) {  
186 - String studentId = stuStrings[j];  
187 -  
188 - testDao.HomeworkReceive(workId, classId, studentId, "", "1", j + "", "2019-09-23 21:28:00", "2019-09-22 17:50:00", "1", j + "");  
189 - }  
190 -  
191 - }  
192 -  
193 - }  
194 -  
195 - @Autowired  
196 - UserDao userDao;  
197 -  
198 - @Test  
199 - public void doHomeWork() {  
200 - StudentBean studentBean = new StudentBean();  
201 - studentBean.setCard("9A1229A9");  
202 - studentBean.setSchool_id(110);  
203 - studentBean.setStudentCode("140881200710270056");  
204 - studentBean.setCustomerId("583912");  
205 -  
206 -// userDao.addStudentUpdate(studentBean.getCard(),studentBean.getSchool_id(),studentBean.getStudentCode(),studentBean.getCustomerId(),"1","2"  
207 -// ,"55640","2014级(08)班","0","1","2019-09-22 16:26");  
208 -  
209 - /* String QuestionId = "21656, 21657, 21658, 21659, 21753, 21706, 21724, 21796, 21797, 21798";  
210 - String Answer = "";  
211 - String CorrectAnswer = "";  
212 - String QuestionType = "1";  
213 - String IsCorresct = "";  
214 - String WorkID = "4198";  
215 - String[] questionIds = QuestionId.split(",");  
216 - for (int i = 0; i < questionIds.length; i++) {  
217 - String questionId = questionIds[i];  
218 - QuestionBean questionBean = testDao.getQues(questionId);  
219 - CorrectAnswer = questionBean.getCorrectAnswer();  
220 - Answer = "B";  
221 - IsCorresct = Answer.trim().equals(CorrectAnswer.trim()) ? "1" : "3";  
222 - testDao.StudentAnswer(questionId, Answer, CorrectAnswer, QuestionType, IsCorresct, WorkID);  
223 - }*/  
224 -  
225 - }  
226 -  
227 -  
228 - @Test  
229 - public void HomeworkRec() {  
230 - String WorkID = "4198";  
231 - String ClassId = "";  
232 - //查询学生id  
233 - List<String> list = testDao.getStudentIds("4172");  
234 - String StudentIds = list.toString().replace("[", "");  
235 - StudentIds = StudentIds.replace("]", "");  
236 - System.out.println("StudentIds:" + StudentIds);  
237 - String StudnetAnswerIds = testDao.getStudentAnsIds(WorkID).toString().replace("[", "");  
238 - StudnetAnswerIds = StudnetAnswerIds.replace("]", "");  
239 - String[] studentIds = StudentIds.split(",");  
240 - for (int i = 0; i < studentIds.length; i++) {  
241 - String studentId = studentIds[i];  
242 - String finishTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());  
243 - testDao.HomeworkReceive(WorkID, ClassId, studentId, StudnetAnswerIds, "1", i + "", "2019-09-19 16:50", finishTime  
244 - , "1", "" + i);  
245 - }  
246 - }  
247 -  
248 - @Test  
249 - public void getQIds() {  
250 -  
251 - List<Knowledge> knowledges = userDao.getKnowledge();  
252 - System.out.println("knowledges:" + knowledges.toString());  
253 -  
254 - List<JiaoCai> jiaoCais = userDao.getJiaoCai();  
255 - System.out.println("jiaoCais:" + jiaoCais.toString());  
256 -  
257 - for (int i = 0; i < 1; i++) {  
258 - JiaoCai jiaoCai = jiaoCais.get(i);  
259 - String SubjectId = jiaoCai.getSubjectId();  
260 - for (int j = 0; j < knowledges.size(); j++) {  
261 - Knowledge knowledge = knowledges.get(j);  
262 - if (SubjectId.equals(knowledge.getSubjectId())) {  
263 - userDao.addKnowAndJicaoCai(jiaoCai.getID(), knowledge.getId(), 0, 1);  
264 - }  
265 - }  
266 -  
267 - }  
268 -  
269 - }  
270 -  
271 - @Test  
272 - public void tongji() {  
273 -  
274 - String[] answers = new String[]{"A", "B", "C", "D", "A", "A"};  
275 - String createUserId = "zy411337";  
276 - List<Homework> homeworkList = testDao.getHomeWork(createUserId);//获取布置的作业  
277 - System.out.println("homeworkList:" + homeworkList);  
278 - for (int m = 0; m < homeworkList.size(); m++) {  
279 - String WorkId = homeworkList.get(m).getID();  
280 - Map<String, List<String>> mapRecIDs = new HashMap<>();  
281 - System.out.println("workId:" + WorkId);  
282 -// List<String> queIds = testDao.getStuAnsIds(WorkId);  
283 -// String questionIds = queIds.toString().replace("[", "");  
284 -// questionIds = questionIds.replace("]", "");  
285 -  
286 - //获取正确答案  
287 -// List<String> correct = testDao.correctAns(WorkId);  
288 -// String corrStr = correct.toString().replace("[", "");  
289 -// corrStr = corrStr.replace("]", "");  
290 -// String[] correctAnser = corrStr.split(",");  
291 -  
292 - String questionIds = testDao.getQuestionIds(WorkId);  
293 -  
294 - //获取答题学生数量  
295 - List<String> homeworkReceiveIds = testDao.get_HomeworkReceive(WorkId, "12012");  
296 - System.out.println("homeworkReceiveIds:" + homeworkReceiveIds.size());  
297 - for (int j = 0; j < homeworkReceiveIds.size(); j++) {//接收学生数量  
298 -  
299 - String[] quesStirngs = questionIds.split(",");  
300 - System.out.println("quesStirngs:" + quesStirngs.length);  
301 - for (int i = 0; i < quesStirngs.length; i++) {  
302 - String questionId = quesStirngs[i];  
303 - String CorrectAnswer = testDao.getCorrectAnswer(questionId);  
304 - int randow = new Random().nextInt(6);  
305 - String answer = null;  
306 - String isCorrsct = "";  
307 - if (randow == 0 || randow == 1 || randow == 2 || randow == 3 || randow == 4) {  
308 - answer = CorrectAnswer.trim();  
309 - isCorrsct = "1";  
310 - } else {  
311 - answer = answers[randow];  
312 - isCorrsct = "3";  
313 - }  
314 - //插入一条新的记录  
315 - testDao.addStudentAnswer(quesStirngs[i], answer.trim(), "", CorrectAnswer.trim(), "1", "", isCorrsct, "", "", WorkId);  
316 - }  
317 - //获取最新的十条记录  
318 - List<String> idLists = testDao.getTopIDs(WorkId, questionIds.split(",").length);  
319 - System.out.println("idLists:" + idLists.toString());  
320 - mapRecIDs.put(j + "", idLists);  
321 - }  
322 -// System.out.println("mapRecIDs:" + mapRecIDs.toString() + " 0:" + mapRecIDs.get("0").toString().replace("[", ""));  
323 -  
324 - for (int i = 0; i < homeworkReceiveIds.size(); i++) {  
325 - String homeRecId = homeworkReceiveIds.get(i);  
326 - System.out.println("i:" + i);  
327 - String ansIds = mapRecIDs.get(i + "").toString().replace("[", "");  
328 - ansIds = ansIds.replace("]", "");  
329 - testDao.updateHomeWork(ansIds, homeRecId);  
330 - }  
331 -  
332 - List<HomeworkReceive> homRecIDs = testDao.get_HomeworkRec(WorkId);  
333 -  
334 - Map<String, String> stuMap = new HashMap<>();  
335 - for (int i = 0; i < homRecIDs.size(); i++) {  
336 - HomeworkReceive homeworkReceive = homRecIDs.get(i);  
337 -  
338 - String studentId = homeworkReceive.getStudentId();  
339 -  
340 - String studentName = testDao.getStudentName(studentId);  
341 -  
342 - String studnetAnswerIds = homeworkReceive.getStudnetAnswerIds();  
343 -  
344 - String[] stuIds = studnetAnswerIds.split(",");  
345 -  
346 - String isC = "";  
347 - for (int j = 0; j < stuIds.length; j++) {  
348 - String id = stuIds[j];  
349 - int idCorrect = testDao.getIsCorrect(id);  
350 - if (idCorrect == 1) {  
351 - isC += "1 ";  
352 - } else if (idCorrect == 3) {  
353 - isC += "0 ";  
354 - }  
355 - }  
356 - stuMap.put(studentName, isC);  
357 - System.out.println("" + studentName + " " + isC);  
358 -  
359 - }  
360 -  
361 - }  
362 - }  
363 -  
364 - private void writeToExcel(HSSFWorkbook workbook, String HomeworkTitle, Map<String, String[]> correctAns, String[] names, String title) {  
365 - //第二部,在workbook中创建一个sheet对应excel中的sheet  
366 - HSSFSheet sheet = workbook.createSheet(HomeworkTitle);  
367 - //第三部,在sheet表中添加表头第0行,老版本的poi对sheet的行列有限制  
368 - HSSFRow row = sheet.createRow(0);  
369 - //第四步,创建单元格,设置表头  
370 - HSSFCell cell = null;  
371 - for (int i = 0; i < correctAns.get(names[0]).length; i++) {  
372 - cell = row.createCell(i);  
373 - cell.setCellValue("第" + (i + 1) + "");  
374 - }  
375 -  
376 - //第五步,写入数据  
377 - for (int i = 0; i < names.length; i++) {  
378 -  
379 -// String oneData =correctAns[i];//姓名对应的正确率  
380 - HSSFRow row1 = sheet.createRow(i + 1);  
381 - String[] corrects = correctAns.get(names[i]);  
382 - System.out.println("names:" + names[i]);  
383 - for (int j = 0; j < corrects.length; j++) {  
384 - //创建单元格设值  
385 - row1.createCell(j).setCellValue(corrects[j]);  
386 - }  
387 - row1.createCell(corrects.length).setCellValue(names[i]);  
388 - }  
389 -  
390 - //将文件保存到指定的位置  
391 - try {  
392 - File file = new File("C:\\Users\\taohandong\\Desktop\\文澜\\"+title+".xls");  
393 - if (!file.exists())file.createNewFile();  
394 - FileOutputStream fos = new FileOutputStream(file);  
395 - workbook.write(fos);  
396 - System.out.println("写入成功");  
397 - fos.close();  
398 - } catch (IOException e) {  
399 - e.printStackTrace();  
400 - }  
401 -  
402 - }  
403 -  
404 -  
405 - @Test  
406 - public void getStu() {  
407 - //第一步,创建一个workbook对应一个excel文件  
408 - HSSFWorkbook workbook = new HSSFWorkbook();  
409 -  
410 - String createUserId = "zy595910";  
411 - String title="作业";  
412 - //ZY_Homework表取出要统计的作业  
413 - String WorkId = "4408";  
414 - String workName = testDao.getWorkName(WorkId);  
415 -  
416 - //ZY_HomeworkReceive 表获取学生作业答题情况;  
417 - List<HomeworkReceive> homRecIDs = testDao.get_HomeworkRec(WorkId);  
418 -  
419 - Map<String, String[]> stuMap = new HashMap<>();  
420 - String[] names = new String[homRecIDs.size()];  
421 - String[] isCorrect = null;  
422 - for (int i = 0; i < homRecIDs.size(); i++) {  
423 - HomeworkReceive homeworkReceive = homRecIDs.get(i);  
424 -  
425 - String studentId = homeworkReceive.getStudentId();  
426 -  
427 - String studentName = testDao.getStudentName(studentId);  
428 -  
429 - String studnetAnswerIds = homeworkReceive.getStudnetAnswerIds();  
430 -// System.out.println("studnetAnswerIds:"+studnetAnswerIds+" WorkId:"+WorkId + " StudentId:"+studentId);  
431 - if (null != studnetAnswerIds) {  
432 - names[i] = studentName;  
433 - String[] stuIds = studnetAnswerIds.split(",");  
434 - isCorrect = new String[stuIds.length];  
435 - String isC = "";  
436 - for (int j = 0; j < stuIds.length; j++) {  
437 - String id = stuIds[j];  
438 - System.out.println("IsCorrectId:" + id);  
439 - //ZY_StudentAnswer表获取题目是否正确  
440 - int idCorrect = testDao.getIsCorrect(id);  
441 - if (idCorrect == 1) {  
442 - isC += "1 ";  
443 - isCorrect[j] = "1";  
444 - } else if (idCorrect == 3) {  
445 - isC += "0 ";  
446 - isCorrect[j] = "0";  
447 - }  
448 - }  
449 - stuMap.put(studentName, isCorrect);  
450 - System.out.println("" + studentName + " " + isC);  
451 - }  
452 - }  
453 - if (names!=null&&stuMap.size()>0)  
454 - writeToExcel(workbook, workName, stuMap, names,title);  
455 -// System.out.println("stuMap:" + stuMap.toString());  
456 - }  
457 -  
458 -  
459 - /**  
460 - * 旋转图片  
461 - */  
462 - @Test  
463 - public void trnImgs() {  
464 -  
465 - File file = new File("C:\\TaoHandong\\copy\\school479\\StudentCompressed");  
466 - File[] files = file.listFiles();  
467 -  
468 - List<StudentInfo> studentInfos = testDao.getStudents(479);  
469 -  
470 - List<StudentInfo> studentInfoList = new ArrayList<>();  
471 -  
472 - for (int i = 0; i < studentInfos.size(); i++) {  
473 - StudentInfo studentInfo = studentInfos.get(i);  
474 -  
475 - boolean isHas = false;  
476 - for (int j = 0; j < files.length; j++) {  
477 - File img = files[j];  
478 - String imgName = img.getName().split("\\.")[0];  
479 -  
480 - if (imgName.equals(studentInfo.getStudentcode())) {  
481 - isHas = true;  
482 - break;  
483 - }  
484 -  
485 - }  
486 -  
487 - if (!isHas) {  
488 - studentInfoList.add(studentInfo);  
489 - }  
490 -  
491 - }  
492 -  
493 - System.out.println("studentInfoList:" + studentInfoList);  
494 - //第一步,创建一个workbook对应一个excel文件  
495 - HSSFWorkbook workbook = new HSSFWorkbook();  
496 - //第二部,在workbook中创建一个sheet对应excel中的sheet  
497 - HSSFSheet sheet = workbook.createSheet("缺少的学生人脸");  
498 - //第三部,在sheet表中添加表头第0行,老版本的poi对sheet的行列有限制  
499 - HSSFRow row = sheet.createRow(0);  
500 -  
501 - String[] titles = new String[]{"姓名", "班级", "学籍号", "号码"};  
502 - //第四步,创建单元格,设置表头  
503 - HSSFCell cell = null;  
504 - for (int i = 0; i < titles.length; i++) {  
505 - cell = row.createCell(i);  
506 - cell.setCellValue(titles[i]);  
507 - }  
508 -  
509 - //第五步,写入数据  
510 - for (int i = 0; i < studentInfoList.size(); i++) {  
511 - HSSFRow row1 = sheet.createRow(i + 1);  
512 - for (int j = 0; j < titles.length; j++) {  
513 - String value = studentInfoList.get(i).getClass_name();  
514 - switch (j) {  
515 - case 0:  
516 - value = studentInfoList.get(i).getName();  
517 - break;  
518 - case 1:  
519 - value = studentInfoList.get(i).getClass_name();  
520 - break;  
521 - case 2:  
522 - value = studentInfoList.get(i).getStudentcode();  
523 - break;  
524 - case 3:  
525 - value = studentInfoList.get(i).getParentMobile();  
526 - break;  
527 - }  
528 - //创建单元格设值  
529 - row1.createCell(j).setCellValue(value);  
530 - }  
531 - }  
532 -  
533 - //将文件保存到指定的位置  
534 - try {  
535 - FileOutputStream fos = new FileOutputStream("C:\\Users\\taohandong\\Desktop\\result.xls");  
536 - workbook.write(fos);  
537 - System.out.println("写入成功");  
538 - fos.close();  
539 - } catch (IOException e) {  
540 - e.printStackTrace();  
541 - }  
542 -  
543 - /* File file = new File("C:\\TaoHandong\\copy\\School1030\\Student");  
544 -  
545 - File outFile = new File("C:\\TaoHandong\\copy\\School1030\\Student1");  
546 -  
547 - if (!outFile.exists()) outFile.mkdirs();  
548 -  
549 - File[] files = file.listFiles();  
550 - System.out.println("files:" + files.length);  
551 - BufferedImage bufferedImage;  
552 - for (int i = 0; i < files.length; i++) {  
553 - File img = files[i];  
554 - int ang = ImageUtils.getImgRotateAngle(img.getAbsolutePath());  
555 - System.out.println(img.getName() + " ang:" + ang);  
556 -// try {  
557 -// bufferedImage = ImageIO.read(img);  
558 -// moveImg(bufferedImage,img,outFile);  
559 -// } catch (IOException e) {  
560 -// e.printStackTrace();  
561 -// }  
562 -  
563 - }*/  
564 -  
565 - }  
566 -  
567 - private List<String> name = new ArrayList<>();  
568 -  
569 -  
570 -}  
cloud/xiaoan_search/pom.xml 0 → 100644
@@ -0,0 +1,209 @@ @@ -0,0 +1,209 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project xmlns="http://maven.apache.org/POM/4.0.0"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5 + <parent>
  6 + <artifactId>cloud</artifactId>
  7 + <groupId>com.sincere</groupId>
  8 + <version>1.0.0</version>
  9 + </parent>
  10 + <modelVersion>4.0.0</modelVersion>
  11 +
  12 + <artifactId>xiaoan_search</artifactId>
  13 + <dependencies>
  14 + <dependency>
  15 + <groupId>com.sincere</groupId>
  16 + <artifactId>common</artifactId>
  17 + <version>0.0.1-SNAPSHOT</version>
  18 + </dependency>
  19 + <!-- https://mvnrepository.com/artifact/io.netty/netty-all -->
  20 + <dependency>
  21 + <groupId>io.netty</groupId>
  22 + <artifactId>netty-all</artifactId>
  23 + <version>4.1.33.Final</version>
  24 + </dependency>
  25 + <dependency>
  26 + <groupId>org.apache.mina</groupId>
  27 + <artifactId>mina-core</artifactId>
  28 + <version>2.1.3</version>
  29 + </dependency>
  30 + <dependency>
  31 + <groupId>com.microsoft.sqlserver</groupId>
  32 + <artifactId>mssql-jdbc</artifactId>
  33 + <version>6.4.0.jre8</version>
  34 + </dependency>
  35 + <!-- spring boot -->
  36 + <dependency>
  37 + <groupId>org.springframework.boot</groupId>
  38 + <artifactId>spring-boot-starter</artifactId>
  39 + </dependency>
  40 + <dependency>
  41 + <groupId>org.springframework.boot</groupId>
  42 + <artifactId>spring-boot-starter-web</artifactId>
  43 + </dependency>
  44 + <dependency>
  45 + <groupId>org.springframework.boot</groupId>
  46 + <artifactId>spring-boot-starter-aop</artifactId>
  47 + </dependency>
  48 + <!-- spring boot -->
  49 + <dependency>
  50 + <groupId>com.googlecode.rapid-framework</groupId>
  51 + <artifactId>rapid-core</artifactId>
  52 + <version>4.0.5</version>
  53 + </dependency>
  54 + <dependency>
  55 + <groupId>org.apache.commons</groupId>
  56 + <artifactId>commons-lang3</artifactId>
  57 + <version>3.3.2</version>
  58 + </dependency>
  59 + <!--只有slf4j-api依赖-->
  60 + <dependency>
  61 + <groupId>org.slf4j</groupId>
  62 + <artifactId>slf4j-api</artifactId>
  63 + <version>1.7.13</version>
  64 + </dependency>
  65 +
  66 + <dependency>
  67 + <groupId>commons-net</groupId>
  68 + <artifactId>commons-net</artifactId>
  69 + <version>2.0</version>
  70 + </dependency>
  71 + <dependency>
  72 + <groupId>org.apache.poi</groupId>
  73 + <artifactId>poi</artifactId>
  74 + <version>4.1.0</version>
  75 + </dependency>
  76 +
  77 + <dependency>
  78 + <groupId>org.apache.poi</groupId>
  79 + <artifactId>poi-ooxml</artifactId>
  80 + <version>4.1.0</version>
  81 + </dependency>
  82 +
  83 + <dependency>
  84 + <groupId>org.mybatis.spring.boot</groupId>
  85 + <artifactId>mybatis-spring-boot-starter</artifactId>
  86 + <version>1.3.0</version>
  87 + </dependency>
  88 + <dependency>
  89 + <groupId>com.alibaba</groupId>
  90 + <artifactId>druid</artifactId>
  91 + <version>1.0.11</version>
  92 + </dependency>
  93 + <dependency>
  94 + <groupId>io.springfox</groupId>
  95 + <artifactId>springfox-swagger2</artifactId>
  96 + <version>2.6.1</version>
  97 + </dependency>
  98 + <dependency>
  99 + <groupId>io.springfox</groupId>
  100 + <artifactId>springfox-swagger-ui</artifactId>
  101 + <version>2.6.1</version>
  102 + </dependency>
  103 + </dependencies>
  104 + <repositories>
  105 + <repository>
  106 + <id>spring-snapshots</id>
  107 + <name>Spring Snapshots</name>
  108 + <url>https://repo.spring.io/snapshot</url>
  109 + <snapshots>
  110 + <enabled>true</enabled>
  111 + </snapshots>
  112 + </repository>
  113 + <repository>
  114 + <id>spring-milestones</id>
  115 + <name>Spring Milestones</name>
  116 + <url>https://repo.spring.io/milestone</url>
  117 + <snapshots>
  118 + <enabled>false</enabled>
  119 + </snapshots>
  120 + </repository>
  121 + </repositories>
  122 +
  123 +
  124 + <build>
  125 + <!--打包文件名-->
  126 + <finalName>xianao_search</finalName>
  127 + <!--打包方式-->
  128 + <plugins>
  129 + <!-- 设置编译版本 -->
  130 + <plugin>
  131 + <groupId>org.apache.maven.plugins</groupId>
  132 + <artifactId>maven-compiler-plugin</artifactId>
  133 + <version>3.1</version>
  134 + <configuration>
  135 + <source>1.8</source>
  136 + <target>1.8</target>
  137 + <encoding>UTF-8</encoding>
  138 + </configuration>
  139 + </plugin>
  140 + <!-- 打包jar文件时,配置manifest文件,加入lib包的jar依赖 -->
  141 + <!-- 本地启动需要注释-->
  142 + <plugin>
  143 + <groupId>org.apache.maven.plugins</groupId>
  144 + <artifactId>maven-jar-plugin</artifactId>
  145 + <configuration>
  146 + <archive>
  147 + <manifest>
  148 + <mainClass>com.jevon.Application</mainClass>
  149 + <addClasspath>true</addClasspath>
  150 + <classpathPrefix>lib/</classpathPrefix>
  151 + </manifest>
  152 + <manifestEntries>
  153 + <Class-Path>./config/</Class-Path>
  154 + </manifestEntries>
  155 + </archive>
  156 + <excludes>
  157 + <exclude>config/**</exclude>
  158 + </excludes>
  159 + <classesDirectory></classesDirectory>
  160 + </configuration>
  161 + </plugin>
  162 + <!-- 拷贝依赖的jar包到lib目录 -->
  163 + <plugin>
  164 + <groupId>org.apache.maven.plugins</groupId>
  165 + <artifactId>maven-dependency-plugin</artifactId>
  166 + <executions>
  167 + <execution>
  168 + <id>copy</id>
  169 + <phase>package</phase>
  170 + <goals>
  171 + <goal>copy-dependencies</goal>
  172 + </goals>
  173 + <configuration>
  174 + <outputDirectory>
  175 + ${project.build.directory}/lib
  176 + </outputDirectory>
  177 + </configuration>
  178 + </execution>
  179 + </executions>
  180 + </plugin>
  181 + <!-- 解决资源文件的编码问题 -->
  182 + <plugin>
  183 + <groupId>org.apache.maven.plugins</groupId>
  184 + <artifactId>maven-resources-plugin</artifactId>
  185 + <version>2.5</version>
  186 + <configuration>
  187 + <encoding>UTF-8</encoding>
  188 + </configuration>
  189 + </plugin>
  190 + <!-- 打包source文件为jar文件 -->
  191 + <plugin>
  192 + <artifactId>maven-source-plugin</artifactId>
  193 + <version>2.2</version>
  194 + <configuration>
  195 + <attach>true</attach>
  196 + </configuration>
  197 + <executions>
  198 + <execution>
  199 + <phase>compile</phase>
  200 + <goals>
  201 + <goal>jar</goal>
  202 + </goals>
  203 + </execution>
  204 + </executions>
  205 + </plugin>
  206 + </plugins>
  207 + </build>
  208 +
  209 +</project>
0 \ No newline at end of file 210 \ No newline at end of file
cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/XiaoanSearchApplication.java 0 → 100644
@@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
  1 +package com.sincere.xiaoanSearch;
  2 +
  3 +import org.mybatis.spring.annotation.MapperScan;
  4 +import org.springframework.boot.SpringApplication;
  5 +import org.springframework.boot.autoconfigure.SpringBootApplication;
  6 +import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
  7 +
  8 +/**
  9 + * @author chen
  10 + * @version 1.0
  11 + * @date 2019/11/11 0011 15:40
  12 + */
  13 +@EnableEurekaClient
  14 +@SpringBootApplication
  15 +@MapperScan("com.sincere.xiaoanSearch.mapper")
  16 +public class XiaoanSearchApplication {
  17 +
  18 + public static void main(String[] args) {
  19 + SpringApplication.run(XiaoanSearchApplication.class, args);
  20 + }
  21 +}
cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/controller/WgController.java 0 → 100644
@@ -0,0 +1,99 @@ @@ -0,0 +1,99 @@
  1 +package com.sincere.xiaoanSearch.controller;
  2 +
  3 +import com.sincere.common.dto.xiaoan.*;
  4 +import com.sincere.xiaoanSearch.model.*;
  5 +import com.sincere.xiaoanSearch.service.CheckInService;
  6 +import com.sincere.xiaoanSearch.service.WgService;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.web.bind.annotation.*;
  9 +
  10 +/**
  11 + * @author chen
  12 + * @version 1.0
  13 + * @date 2019/11/11 0011 15:53
  14 + */
  15 +@RestController
  16 +@RequestMapping("/xa/wg")
  17 +public class WgController {
  18 +
  19 + @Autowired
  20 + CheckInService checkInService;
  21 +
  22 + @Autowired
  23 + WgService wgService;
  24 +
  25 + @RequestMapping(value = "checkIn",method = RequestMethod.POST)
  26 + public CheckOutDto checkIn(@RequestBody CheckInDto checkInDto){
  27 + CheckIn checkIn = new CheckIn(checkInDto);
  28 + checkInService.checkIn(checkIn);
  29 + CheckOutDto checkOutDto = new CheckOutDto();
  30 + checkOutDto.setIsSuccess(checkIn.getIsSuccess());
  31 + checkOutDto.setOut(checkIn.getOut());
  32 + return checkOutDto;
  33 + }
  34 +
  35 + @RequestMapping(value = "insertMessage",method = RequestMethod.POST)
  36 + public long insertMessage(@RequestBody SendMessageDto sendMessageDto){
  37 + SendMessage sendMessage = new SendMessage(sendMessageDto);
  38 + wgService.insertMessage(sendMessage);
  39 + return sendMessage.getId();
  40 + }
  41 +
  42 + @RequestMapping(value = "selectById",method = RequestMethod.GET)
  43 + SendMessageDto selectById(@RequestParam("id") long id){
  44 + SendMessage sendMessage = wgService.selectById(id);
  45 + return toSendMessageDto(sendMessage);
  46 + }
  47 +
  48 + @RequestMapping(value = "selectMessage",method = RequestMethod.GET)
  49 + SendMessageDto selectMessage(@RequestParam("deviceId") String deviceId, @RequestParam("index") long index,@RequestParam("functionId") String functionId){
  50 + SendMessage sendMessage = wgService.selectMessage(deviceId,index,functionId);
  51 + return toSendMessageDto(sendMessage);
  52 + }
  53 +
  54 + @RequestMapping(value = "updateMessage",method = RequestMethod.GET)
  55 + int updateMessage(@RequestParam("id") long id, @RequestParam("result") String result, @RequestParam("correct") int correct){
  56 + return wgService.updateMessage(id,result,correct);
  57 + }
  58 +
  59 + @RequestMapping(value = "insertPassFail",method = RequestMethod.POST)
  60 + int insertPassFail(@RequestBody PassFailDto passFailDto){
  61 + return wgService.insertPassFail(new PassFail(passFailDto));
  62 + }
  63 +
  64 + @RequestMapping(value = "insertSendSuccess",method = RequestMethod.POST)
  65 + int insertSendSuccess(@RequestBody SendSuccessDto sendSuccessDto){
  66 + return wgService.insertSendSuccess(new SendSuccess(sendSuccessDto));
  67 + }
  68 +
  69 + @RequestMapping(value = "insertSendFail",method = RequestMethod.POST)
  70 + int insertSendFail(@RequestBody SendFailDto sendFailDto){
  71 + return wgService.insertSendFail(new SendFail(sendFailDto));
  72 + }
  73 +
  74 + @RequestMapping(value = "deleteSendFail",method = RequestMethod.POST)
  75 + int deleteSendFail(@RequestBody SendFailDto sendFailDto){
  76 + return wgService.deleteSendFail(new SendFail(sendFailDto));
  77 + }
  78 +
  79 + @RequestMapping(value = "updateSendSuccess",method = RequestMethod.POST)
  80 + int updateSendSuccess(@RequestBody SendSuccessDto sendSuccessDto){
  81 + return wgService.updateSendSuccess(new SendSuccess(sendSuccessDto));
  82 + }
  83 +
  84 + public SendMessageDto toSendMessageDto(SendMessage sendMessage){
  85 + SendMessageDto sendMessageDto = new SendMessageDto();
  86 + if(sendMessage != null){
  87 + sendMessageDto.setId(sendMessage.getId());
  88 + sendMessageDto.setDeviceId(sendMessage.getDeviceId());
  89 + sendMessageDto.setCardNo(sendMessage.getCardNo());
  90 + sendMessageDto.setIndex(sendMessage.getIndex());
  91 + sendMessageDto.setSend(sendMessage.getSend());
  92 + sendMessageDto.setResult(sendMessage.getResult());
  93 + sendMessageDto.setCorrect(sendMessage.getCorrect());
  94 + sendMessageDto.setCreateTime(sendMessage.getCreateTime());
  95 + sendMessageDto.setFunctionId(sendMessage.getFunctionId());
  96 + }
  97 + return sendMessageDto ;
  98 + }
  99 +}
cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/mapper/CheckMapper.java 0 → 100644
@@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
  1 +package com.sincere.xiaoanSearch.mapper;
  2 +
  3 +import com.sincere.xiaoanSearch.model.CheckIn;
  4 +
  5 +/**
  6 + * @author chen
  7 + * @version 1.0
  8 + * @date 2019/10/14 0014 14:36
  9 + */
  10 +public interface CheckMapper {
  11 +
  12 + void checkIn(CheckIn checkIn);
  13 +
  14 +}