diff --git a/cloud/autho/pom.xml b/cloud/autho/pom.xml index 8131621..06b0023 100644 --- a/cloud/autho/pom.xml +++ b/cloud/autho/pom.xml @@ -6,7 +6,6 @@ com.sincere cloud 1.0.0 - com.sincere autho diff --git a/cloud/common/libs/sqljdbc4-4.2-6.jar b/cloud/common/libs/sqljdbc4-4.2-6.jar deleted file mode 100644 index d33695c..0000000 Binary files a/cloud/common/libs/sqljdbc4-4.2-6.jar and /dev/null differ diff --git a/cloud/common/pom.xml b/cloud/common/pom.xml index e8908de..79499df 100644 --- a/cloud/common/pom.xml +++ b/cloud/common/pom.xml @@ -6,7 +6,6 @@ com.sincere cloud 1.0.0 - com.sincere common @@ -20,71 +19,27 @@ - org.springframework.boot - spring-boot-starter - - - - org.springframework.boot - spring-boot-starter-test - test - - - - com.microsoft.sqlserver.jdbc - sqljdbc - system - 1 - ${project.basedir}/libs/sqljdbc4-4.2-6.jar - - - - - org.springframework.boot - spring-boot - - - com.baomidou - mybatis-plus-core - 3.0.1 - compile - - - - com.baomidou - mybatis-plus-extension - 3.0.1 - compile - - - org.apache.tomcat.embed tomcat-embed-core - io.jsonwebtoken jjwt 0.9.0 - org.springframework.security spring-security-core - org.projectlombok lombok - - commons-collections commons-collections 3.2.2 - diff --git a/cloud/common/src/main/java/com/sincere/common/CommonApplication.java b/cloud/common/src/main/java/com/sincere/common/CommonApplication.java deleted file mode 100644 index 1877306..0000000 --- a/cloud/common/src/main/java/com/sincere/common/CommonApplication.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.sincere.common; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class CommonApplication { - - public static void main(String[] args) { - SpringApplication.run(CommonApplication.class, args); - } - -} diff --git a/cloud/common/src/main/java/com/sincere/common/commons/Result.java b/cloud/common/src/main/java/com/sincere/common/commons/Result.java index edd5a57..53fd556 100644 --- a/cloud/common/src/main/java/com/sincere/common/commons/Result.java +++ b/cloud/common/src/main/java/com/sincere/common/commons/Result.java @@ -1,49 +1,49 @@ -package com.sincere.common.commons; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; - -/** - * @Author: [zhangzhiguang] - * @Date: [2018-08-01 23:39] - * @Description: [ ] - * @Version: [1.0.0] - * @Copy: [com.zzg] - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -public class Result implements Serializable { - - private T datas; - private Integer resp_code; - private String resp_msg; - - public static Result succeed(String msg) { - return succeedWith(null, CodeEnum.SUCCESS.getCode(),msg); - } - - public static Result succeed(T model, String msg) { - return succeedWith(model, CodeEnum.SUCCESS.getCode(),msg); - } - - public static Result succeedWith(T datas, Integer code,String msg) { - return new Result(datas, code, msg); - } - - public static Result failed(String msg) { - return failedWith(null, CodeEnum.ERROR.getCode(), msg); - } - - public static Result failed(T model,String msg) { - return failedWith(model, CodeEnum.ERROR.getCode(), msg); - } - - public static Result failedWith(T datas, Integer code, String msg) { - return new Result( datas, code, msg); - } - -} +//package com.sincere.common.commons; +// +//import lombok.AllArgsConstructor; +//import lombok.Data; +//import lombok.NoArgsConstructor; +// +//import java.io.Serializable; +// +///** +// * @Author: [zhangzhiguang] +// * @Date: [2018-08-01 23:39] +// * @Description: [ ] +// * @Version: [1.0.0] +// * @Copy: [com.zzg] +// */ +//@Data +//@NoArgsConstructor +//@AllArgsConstructor +//public class Result implements Serializable { +// +// private T datas; +// private Integer resp_code; +// private String resp_msg; +// +// public static Result succeed(String msg) { +// return succeedWith(null, CodeEnum.SUCCESS.getCode(),msg); +// } +// +// public static Result succeed(T model, String msg) { +// return succeedWith(model, CodeEnum.SUCCESS.getCode(),msg); +// } +// +// public static Result succeedWith(T datas, Integer code,String msg) { +// return new Result(datas, code, msg); +// } +// +// public static Result failed(String msg) { +// return failedWith(null, CodeEnum.ERROR.getCode(), msg); +// } +// +// public static Result failed(T model,String msg) { +// return failedWith(model, CodeEnum.ERROR.getCode(), msg); +// } +// +// public static Result failedWith(T datas, Integer code, String msg) { +// return new Result( datas, code, msg); +// } +// +//} diff --git a/cloud/common/src/main/java/com/sincere/common/config/DataSourceHolder.java b/cloud/common/src/main/java/com/sincere/common/config/DataSourceHolder.java deleted file mode 100644 index ffcd552..0000000 --- a/cloud/common/src/main/java/com/sincere/common/config/DataSourceHolder.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.sincere.common.config; - - -/** - * 用于数据源切换 - * - */ -public class DataSourceHolder { - - private static final ThreadLocal dataSourceKey = new ThreadLocal<>(); - - public static DataSourceKey getDataSourceKey() { - return dataSourceKey.get(); - } - - public static void setDataSourceKey(DataSourceKey type) { - dataSourceKey.set(type); - } - - public static void clearDataSourceKey() { - dataSourceKey.remove(); - } - - -} \ No newline at end of file diff --git a/cloud/common/src/main/java/com/sincere/common/config/DataSourceKey.java b/cloud/common/src/main/java/com/sincere/common/config/DataSourceKey.java deleted file mode 100644 index 90cce36..0000000 --- a/cloud/common/src/main/java/com/sincere/common/config/DataSourceKey.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.sincere.common.config; - -/** - * 数据源定义 - * - * @author owen - * @create 2017年7月2日 - */ -public enum DataSourceKey { - core, log ,sharding -} \ No newline at end of file diff --git a/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/SchoolDto.java b/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/SchoolDto.java new file mode 100644 index 0000000..458c149 --- /dev/null +++ b/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/SchoolDto.java @@ -0,0 +1,31 @@ +package com.sincere.common.dto.smartCampus; + +import java.io.Serializable; + +/** + * @author chen + * @version 1.0 + * @date 2019/11/12 0012 9:06 + */ +public class SchoolDto implements Serializable { + + private int schoolId ; + private String schoolName ; + + public int getSchoolId() { + return schoolId; + } + + public void setSchoolId(int schoolId) { + this.schoolId = schoolId; + } + + public String getSchoolName() { + return schoolName; + } + + public void setSchoolName(String schoolName) { + this.schoolName = schoolName; + } + +} diff --git a/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/StudentCardDto.java b/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/StudentCardDto.java new file mode 100644 index 0000000..bfc60cc --- /dev/null +++ b/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/StudentCardDto.java @@ -0,0 +1,31 @@ +package com.sincere.common.dto.smartCampus; + +import java.io.Serializable; + +/** + * @author chen + * @version 1.0 + * @date 2019/11/12 0012 9:33 + */ +public class StudentCardDto implements Serializable { + + private String cardType ; + private String cardNum ; + + public String getCardType() { + return cardType; + } + + public void setCardType(String cardType) { + this.cardType = cardType; + } + + public String getCardNum() { + return cardNum; + } + + public void setCardNum(String cardNum) { + this.cardNum = cardNum; + } + +} diff --git a/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/UpdateCardDto.java b/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/UpdateCardDto.java new file mode 100644 index 0000000..38d08bb --- /dev/null +++ b/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/UpdateCardDto.java @@ -0,0 +1,39 @@ +package com.sincere.common.dto.smartCampus; + +import java.io.Serializable; + +/** + * @author chen + * @version 1.0 + * @date 2019/11/12 0012 9:31 + */ +public class UpdateCardDto implements Serializable { + + private int id ; + private int userType ; + private String oldCard ; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getUserType() { + return userType; + } + + public void setUserType(int userType) { + this.userType = userType; + } + + public String getOldCard() { + return oldCard; + } + + public void setOldCard(String oldCard) { + this.oldCard = oldCard; + } +} diff --git a/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/UserDto.java b/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/UserDto.java new file mode 100644 index 0000000..436426d --- /dev/null +++ b/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/UserDto.java @@ -0,0 +1,48 @@ +package com.sincere.common.dto.smartCampus; + +import java.io.Serializable; + +/** + * @author chen + * @version 1.0 + * @date 2019/11/12 0012 9:28 + */ +public class UserDto implements Serializable { + + private int schoolId; + private int classId ; + private String name ; + private int studentId ; + + public int getSchoolId() { + return schoolId; + } + + public void setSchoolId(int schoolId) { + this.schoolId = schoolId; + } + + public int getClassId() { + return classId; + } + + public void setClassId(int classId) { + this.classId = classId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getStudentId() { + return studentId; + } + + public void setStudentId(int studentId) { + this.studentId = studentId; + } +} diff --git a/cloud/common/src/main/java/com/sincere/common/dto/xiaoan/CheckInDto.java b/cloud/common/src/main/java/com/sincere/common/dto/xiaoan/CheckInDto.java new file mode 100644 index 0000000..6004618 --- /dev/null +++ b/cloud/common/src/main/java/com/sincere/common/dto/xiaoan/CheckInDto.java @@ -0,0 +1,59 @@ +package com.sincere.common.dto.xiaoan; + +import java.io.Serializable; + +/** + * @author chen + * @version 1.0 + * @date 2019/11/12 0012 9:40 + */ +public class CheckInDto implements Serializable { + + private String deviceId ; + private String cardNo ; + private int funNo ; + private int flag ; + private String checkTime ; + + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getCardNo() { + return cardNo; + } + + public void setCardNo(String cardNo) { + this.cardNo = cardNo; + } + + public int getFlag() { + return flag; + } + + public void setFlag(int flag) { + this.flag = flag; + } + + public String getCheckTime() { + return checkTime; + } + + public void setCheckTime(String checkTime) { + this.checkTime = checkTime; + } + + + public int getFunNo() { + return funNo; + } + + public void setFunNo(int funNo) { + this.funNo = funNo; + } +} diff --git a/cloud/common/src/main/java/com/sincere/common/dto/xiaoan/CheckOutDto.java b/cloud/common/src/main/java/com/sincere/common/dto/xiaoan/CheckOutDto.java new file mode 100644 index 0000000..851f51b --- /dev/null +++ b/cloud/common/src/main/java/com/sincere/common/dto/xiaoan/CheckOutDto.java @@ -0,0 +1,30 @@ +package com.sincere.common.dto.xiaoan; + +import java.io.Serializable; + +/** + * @author chen + * @version 1.0 + * @date 2019/11/12 0012 13:36 + */ +public class CheckOutDto implements Serializable { + + private String out; + private int isSuccess ; + + public String getOut() { + return out; + } + + public void setOut(String out) { + this.out = out; + } + + public int getIsSuccess() { + return isSuccess; + } + + public void setIsSuccess(int isSuccess) { + this.isSuccess = isSuccess; + } +} diff --git a/cloud/common/src/main/java/com/sincere/common/dto/xiaoan/PassFailDto.java b/cloud/common/src/main/java/com/sincere/common/dto/xiaoan/PassFailDto.java new file mode 100644 index 0000000..a4f68a7 --- /dev/null +++ b/cloud/common/src/main/java/com/sincere/common/dto/xiaoan/PassFailDto.java @@ -0,0 +1,76 @@ +package com.sincere.common.dto.xiaoan; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author chen + * @version 1.0 + * @date 2019/11/12 0012 10:03 + */ +public class PassFailDto implements Serializable { + + private String cardNum ; + private String deviceId ; + private String direction ; + private String resultIntro ; + private Date createTime ; + private int schoolId ; + private Date inTime ; + + public String getCardNum() { + return cardNum; + } + + public void setCardNum(String cardNum) { + this.cardNum = cardNum; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getDirection() { + return direction; + } + + public void setDirection(String direction) { + this.direction = direction; + } + + public String getResultIntro() { + return resultIntro; + } + + public void setResultIntro(String resultIntro) { + this.resultIntro = resultIntro; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public int getSchoolId() { + return schoolId; + } + + public void setSchoolId(int schoolId) { + this.schoolId = schoolId; + } + + public Date getInTime() { + return inTime; + } + + public void setInTime(Date inTime) { + this.inTime = inTime; + } +} diff --git a/cloud/common/src/main/java/com/sincere/common/dto/xiaoan/SendFailDto.java b/cloud/common/src/main/java/com/sincere/common/dto/xiaoan/SendFailDto.java new file mode 100644 index 0000000..8a0d6dc --- /dev/null +++ b/cloud/common/src/main/java/com/sincere/common/dto/xiaoan/SendFailDto.java @@ -0,0 +1,215 @@ +package com.sincere.common.dto.xiaoan; + +import com.sincere.common.dto.smartCampus.SchoolDto; +import com.sincere.common.dto.smartCampus.StudentCardDto; +import com.sincere.common.dto.smartCampus.UpdateCardDto; +import com.sincere.common.dto.smartCampus.UserDto; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author chen + * @version 1.0 + * @date 2019/11/12 0012 10:12 + */ +public class SendFailDto implements Serializable { + + private String deviceId ; + private String cardNum ; + private String oldCardNum ; + private String cardType ; + private int customerId ; + private int userType ; + private int classId ; + private String schoolName ; + private int studentType ; + private int openFlag ; + private int status ; + private int updateId ; + private Date createTime ; + private int sex ; + private String name ; + private int failType ; + private String failContent ; + private int schoolId ; + private int shiduan ; + + public SendFailDto() { + } + + public SendFailDto(UserDto user , SchoolDto school , StudentCardDto studentCard , UpdateCardDto updateCard) { + if(updateCard != null){ + oldCardNum = updateCard.getOldCard(); + userType = updateCard.getUserType() ; + } + if(studentCard != null){ + cardType = studentCard.getCardType(); + } + if(user != null){ + customerId = user.getStudentId(); + classId = user.getClassId(); + schoolId = user.getSchoolId(); + name = user.getName(); + } + if(school != null){ + schoolName = school.getSchoolName(); + } + createTime = new Date(); + studentType =1 ; + sex = 1; + } + + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getCardNum() { + return cardNum; + } + + public void setCardNum(String cardNum) { + this.cardNum = cardNum; + } + + public String getOldCardNum() { + return oldCardNum; + } + + public void setOldCardNum(String oldCardNum) { + this.oldCardNum = oldCardNum; + } + + public String getCardType() { + return cardType; + } + + public void setCardType(String cardType) { + this.cardType = cardType; + } + + public int getCustomerId() { + return customerId; + } + + public void setCustomerId(int customerId) { + this.customerId = customerId; + } + + public int getUserType() { + return userType; + } + + public void setUserType(int userType) { + this.userType = userType; + } + + public int getClassId() { + return classId; + } + + public void setClassId(int classId) { + this.classId = classId; + } + + public String getSchoolName() { + return schoolName; + } + + public void setSchoolName(String schoolName) { + this.schoolName = schoolName; + } + + public int getStudentType() { + return studentType; + } + + public void setStudentType(int studentType) { + this.studentType = studentType; + } + + public int getOpenFlag() { + return openFlag; + } + + public void setOpenFlag(int openFlag) { + this.openFlag = openFlag; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getUpdateId() { + return updateId; + } + + public void setUpdateId(int updateId) { + this.updateId = updateId; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public int getSex() { + return sex; + } + + public void setSex(int sex) { + this.sex = sex; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getFailType() { + return failType; + } + + public void setFailType(int failType) { + this.failType = failType; + } + + public String getFailContent() { + return failContent; + } + + public void setFailContent(String failContent) { + this.failContent = failContent; + } + + public int getSchoolId() { + return schoolId; + } + + public void setSchoolId(int schoolId) { + this.schoolId = schoolId; + } + + public int getShiduan() { + return shiduan; + } + + public void setShiduan(int shiduan) { + this.shiduan = shiduan; + } +} diff --git a/cloud/common/src/main/java/com/sincere/common/dto/xiaoan/SendMessageDto.java b/cloud/common/src/main/java/com/sincere/common/dto/xiaoan/SendMessageDto.java new file mode 100644 index 0000000..2ed29bc --- /dev/null +++ b/cloud/common/src/main/java/com/sincere/common/dto/xiaoan/SendMessageDto.java @@ -0,0 +1,94 @@ +package com.sincere.common.dto.xiaoan; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author chen + * @version 1.0 + * @date 2019/11/12 0012 9:37 + */ +public class SendMessageDto implements Serializable { + + private long id ; + private String deviceId ; + private String cardNo ; + private long index ; + private String send ; + private String result ; + private int correct ; + private Date createTime ; + private String functionId ; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getCardNo() { + return cardNo; + } + + public void setCardNo(String cardNo) { + this.cardNo = cardNo; + } + + public long getIndex() { + return index; + } + + public void setIndex(long index) { + this.index = index; + } + + public String getSend() { + return send; + } + + public void setSend(String send) { + this.send = send; + } + + public String getResult() { + return result; + } + + public void setResult(String result) { + this.result = result; + } + + public int getCorrect() { + return correct; + } + + public void setCorrect(int correct) { + this.correct = correct; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getFunctionId() { + return functionId; + } + + public void setFunctionId(String functionId) { + this.functionId = functionId; + } +} diff --git a/cloud/common/src/main/java/com/sincere/common/dto/xiaoan/SendSuccessDto.java b/cloud/common/src/main/java/com/sincere/common/dto/xiaoan/SendSuccessDto.java new file mode 100644 index 0000000..b128a16 --- /dev/null +++ b/cloud/common/src/main/java/com/sincere/common/dto/xiaoan/SendSuccessDto.java @@ -0,0 +1,196 @@ +package com.sincere.common.dto.xiaoan; + +import com.sincere.common.dto.smartCampus.SchoolDto; +import com.sincere.common.dto.smartCampus.StudentCardDto; +import com.sincere.common.dto.smartCampus.UpdateCardDto; +import com.sincere.common.dto.smartCampus.UserDto; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author chen + * @version 1.0 + * @date 2019/11/12 0012 10:06 + */ +public class SendSuccessDto implements Serializable { + + private String deviceId ; + private String cardNum ; + private String oldCardNum ; + private String cardType ; + private int customerId ; + private int userType ; + private int classId ; + private String schoolName ; + private int studentType ; + private int openFlag ; + private int status ; + private int updateId ; + private Date createTime ; + private int sex ; + private String name ; + private int schoolId ; + private int shiduan ; + + public SendSuccessDto() { + } + + public SendSuccessDto(UserDto user , SchoolDto school , StudentCardDto studentCard , UpdateCardDto updateCard) { + if(updateCard != null){ + oldCardNum = updateCard.getOldCard(); + userType = updateCard.getUserType() ; + } + if(studentCard != null){ + cardType = studentCard.getCardType(); + } + if(user != null){ + customerId = user.getStudentId(); + classId = user.getClassId(); + schoolId = user.getSchoolId(); + name = user.getName(); + } + if(school != null){ + schoolName = school.getSchoolName(); + } + createTime = new Date(); + studentType =1 ; + sex = 1; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getCardNum() { + return cardNum; + } + + public void setCardNum(String cardNum) { + this.cardNum = cardNum; + } + + public String getOldCardNum() { + return oldCardNum; + } + + public void setOldCardNum(String oldCardNum) { + this.oldCardNum = oldCardNum; + } + + public String getCardType() { + return cardType; + } + + public void setCardType(String cardType) { + this.cardType = cardType; + } + + public int getCustomerId() { + return customerId; + } + + public void setCustomerId(int customerId) { + this.customerId = customerId; + } + + public int getUserType() { + return userType; + } + + public void setUserType(int userType) { + this.userType = userType; + } + + public int getClassId() { + return classId; + } + + public void setClassId(int classId) { + this.classId = classId; + } + + public String getSchoolName() { + return schoolName; + } + + public void setSchoolName(String schoolName) { + this.schoolName = schoolName; + } + + public int getStudentType() { + return studentType; + } + + public void setStudentType(int studentType) { + this.studentType = studentType; + } + + public int getOpenFlag() { + return openFlag; + } + + public void setOpenFlag(int openFlag) { + this.openFlag = openFlag; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getUpdateId() { + return updateId; + } + + public void setUpdateId(int updateId) { + this.updateId = updateId; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public int getSex() { + return sex; + } + + public void setSex(int sex) { + this.sex = sex; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getSchoolId() { + return schoolId; + } + + public void setSchoolId(int schoolId) { + this.schoolId = schoolId; + } + + public int getShiduan() { + return shiduan; + } + + public void setShiduan(int shiduan) { + this.shiduan = shiduan; + } +} diff --git a/cloud/common/src/main/java/com/sincere/common/entity/SysUser.java b/cloud/common/src/main/java/com/sincere/common/entity/SysUser.java deleted file mode 100644 index 7b61aed..0000000 --- a/cloud/common/src/main/java/com/sincere/common/entity/SysUser.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.sincere.common.entity; - - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.time.LocalDateTime; - -/** - *

- * 用户表 - *

- * - * @author yukong - * @since 2018-10-08 - */ -@Data -@Accessors(chain = true) -public class SysUser { - - private static final long serialVersionUID = 1L; - - /** - * 主键ID - */ - private Integer userId; - - /** - * 用户名 - */ - private String username; - - /** - * 密码 - */ - private String password; - - /** - * 邮箱 - */ - private String email; - - /** - * 手机号码 - */ - private String mobile; - - /** - * qq号码 - */ - private String qq; - - /** - * 微信号码 - */ - private String wechat; - - /** - * 微博url - */ - private String weibo; - - /** - * 头像url - */ - private String avatar; - - /** - * qq openid - */ - private String qqOpenid; - - /** - * 微信openid - */ - private String wechatOpenid; - - /** - * 微博openid - */ - private String weiboOpenid; - - /** - * 创建时间 - */ - private LocalDateTime createTime; - - /** - * 更新时间 - */ - private LocalDateTime modifyTime; - - /** - * 是否删除 0-未删除 1-删除 - */ - private String delFlag; - - -} diff --git a/cloud/common/src/main/java/com/sincere/common/enums/ApiErrorCodeEnum.java b/cloud/common/src/main/java/com/sincere/common/enums/ApiErrorCodeEnum.java index d819e9d..ce7ca63 100644 --- a/cloud/common/src/main/java/com/sincere/common/enums/ApiErrorCodeEnum.java +++ b/cloud/common/src/main/java/com/sincere/common/enums/ApiErrorCodeEnum.java @@ -1,13 +1,9 @@ package com.sincere.common.enums; - - -import com.baomidou.mybatisplus.extension.api.IErrorCode; - /** * @author yukong * @date 2019-04-20 18:54 */ -public enum ApiErrorCodeEnum implements IErrorCode { +public enum ApiErrorCodeEnum{ /** * 失败 */ @@ -40,17 +36,14 @@ public enum ApiErrorCodeEnum implements IErrorCode { return SUCCESS; } - @Override public long getCode() { return code; } - @Override public String getMsg() { return msg; } - @Override public String toString() { return String.format(" ErrorCode:{code=%s, msg=%s} ", code, msg); } diff --git a/cloud/common/src/main/java/com/sincere/common/model/log/SysLog.java b/cloud/common/src/main/java/com/sincere/common/model/log/SysLog.java deleted file mode 100644 index 1964632..0000000 --- a/cloud/common/src/main/java/com/sincere/common/model/log/SysLog.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.sincere.common.model.log; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.util.Date; - - -/** -* @author 作者 owen E-mail: 624191343@qq.com -* @version 创建时间:2017年11月12日 上午22:57:51 -* 日志实体 - */ -@Builder -@Data -@NoArgsConstructor -@AllArgsConstructor -public class SysLog implements Serializable { - - private static final long serialVersionUID = -5398795297842978376L; - - private Long id; -// 用户名 - private String username; -// 归属模块 - private String module; -// 执行方法的参数值 - private String params; - private String remark; -// 是否执行成功 - private Boolean flag; - - private Date createTime; -} diff --git a/cloud/common/src/main/java/com/sincere/common/model/system/LoginAppUser.java b/cloud/common/src/main/java/com/sincere/common/model/system/LoginAppUser.java deleted file mode 100644 index ab7d55e..0000000 --- a/cloud/common/src/main/java/com/sincere/common/model/system/LoginAppUser.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.sincere.common.model.system; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import lombok.Getter; -import lombok.Setter; -import org.springframework.security.core.GrantedAuthority; -import org.springframework.security.core.authority.SimpleGrantedAuthority; -import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.util.CollectionUtils; - -import java.io.Serializable; -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; - -/** - * 用户实体绑定spring security - */ -@Getter -@Setter -public class LoginAppUser extends SysUser implements UserDetails { - - /** - * - */ - private static final long serialVersionUID = -3685249101751401211L; - - private Set sysRoles; - - private Set permissions; - - /*** - * 权限重写 - */ - @JsonIgnore - @Override - public Collection getAuthorities() { - Collection collection = new HashSet<>(); - if (!CollectionUtils.isEmpty(sysRoles)) { - sysRoles.parallelStream().forEach(role -> { - if (role.getCode().startsWith("ROLE_")) { - collection.add(new SimpleGrantedAuthority(role.getCode())); - } else { - collection.add(new SimpleGrantedAuthority("ROLE_" + role.getCode())); - } - }); - } - - if (!CollectionUtils.isEmpty(permissions)) { - permissions.parallelStream().forEach(per -> { - collection.add(new SimpleGrantedAuthority(per)); - }); - } - - return collection; - } - - - @JsonIgnore - public Collection putAll( Collection collections) { - Collection collection = new HashSet<>(); - - collection.addAll(collections) ; - - return collection; - } - - - @Override - public boolean isAccountNonExpired() { - return true; - } - - @Override - public boolean isAccountNonLocked() { - return true; - } - - @Override - public boolean isCredentialsNonExpired() { - return true; - } - - @Override - public boolean isEnabled() { - return getEnabled(); - } - - @Override - protected Serializable pkVal() { - return null; - } -} diff --git a/cloud/common/src/main/java/com/sincere/common/model/system/SysMenu.java b/cloud/common/src/main/java/com/sincere/common/model/system/SysMenu.java deleted file mode 100644 index 836e549..0000000 --- a/cloud/common/src/main/java/com/sincere/common/model/system/SysMenu.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.sincere.common.model.system; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import lombok.Data; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; -import java.util.Set; - -@Data -public class SysMenu implements Serializable { - - private static final long serialVersionUID = 749360940290141180L; - @JsonSerialize(using= ToStringSerializer.class) - private Long id; - private Long parentId; - private String name; - private String css; - private String url; - private String path; - private Integer sort; - private Date createTime; - private Date updateTime; - private Integer isMenu; - private Boolean hidden; - - - private List subMenus; - - private Long roleId; - private Set menuIds; - - - -} diff --git a/cloud/common/src/main/java/com/sincere/common/model/system/SysPermission.java b/cloud/common/src/main/java/com/sincere/common/model/system/SysPermission.java deleted file mode 100644 index ba9f063..0000000 --- a/cloud/common/src/main/java/com/sincere/common/model/system/SysPermission.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.sincere.common.model.system; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.activerecord.Model; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import lombok.Data; - -import java.io.Serializable; -import java.util.Date; -import java.util.Set; - - -/** - * @author 作者 owen E-mail: 624191343@qq.com - * @version 创建时间:2017年11月12日 上午22:57:51 - * 权限标识 - */ -@Data -@TableName("sys_permission") -public class SysPermission extends Model implements Serializable { - /** - * - */ - private static final long serialVersionUID = 1389727646460449239L; - @TableId(value="id",type= IdType.ID_WORKER) //雪花算法 id生成策略 - @JsonSerialize(using= ToStringSerializer.class) - private Long id; - private String permission; - private String name; - @TableField(value="createTime") - private Date createTime; - @TableField(value="updateTime") - private Date updateTime; - @TableField(exist=false) - private Long roleId; - @TableField(exist=false) - private Set authIds; - - @Override - protected Serializable pkVal() { - return null; - } -} diff --git a/cloud/common/src/main/java/com/sincere/common/model/system/SysRole.java b/cloud/common/src/main/java/com/sincere/common/model/system/SysRole.java deleted file mode 100644 index 5451d4e..0000000 --- a/cloud/common/src/main/java/com/sincere/common/model/system/SysRole.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.sincere.common.model.system; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import lombok.Data; - -import java.io.Serializable; -import java.util.Date; - -/** - * @author 作者 owen E-mail: 624191343@qq.com - * @version 创建时间:2017年11月12日 上午22:57:51 - * 角色 - */ -@Data -public class SysRole implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 4497149010220586111L; - @JsonSerialize(using= ToStringSerializer.class) - private Long id; - private String code; - private String name; - private Date createTime; - private Date updateTime; - private Long userId; -} diff --git a/cloud/common/src/main/java/com/sincere/common/model/system/SysUser.java b/cloud/common/src/main/java/com/sincere/common/model/system/SysUser.java deleted file mode 100644 index c2a9030..0000000 --- a/cloud/common/src/main/java/com/sincere/common/model/system/SysUser.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.sincere.common.model.system; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.activerecord.Model; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import lombok.Data; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -/** - * @author 作者 owen E-mail: 624191343@qq.com - * @version 创建时间:2017年11月12日 上午22:57:51 - * 用户实体 - */ -@Data -@TableName("sys_user") -public class SysUser extends Model implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -5886012896705137070L; - @TableId(value="id",type= IdType.ID_WORKER) //雪花算法 id生成策略 - @JsonSerialize(using= ToStringSerializer.class) - private Long id; - private String username; - private String password; - private String nickname; - private String headImgUrl; - private String phone; - private Integer sex; - private Boolean enabled; - private String type; - @TableField(value="createTime") - private Date createTime; - @TableField(value="updateTime") - private Date updateTime; - - @TableField(exist=false) - private List roles; - - @TableField(exist=false) - private String roleId; - - @TableField(exist=false) - private String oldPassword; - @TableField(exist=false) - private String newPassword; - - @Override - protected Serializable pkVal() { - return null; - } -} diff --git a/cloud/common/src/main/java/com/sincere/common/model/system/SysUserRole.java b/cloud/common/src/main/java/com/sincere/common/model/system/SysUserRole.java deleted file mode 100644 index d44f809..0000000 --- a/cloud/common/src/main/java/com/sincere/common/model/system/SysUserRole.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.sincere.common.model.system; - -import lombok.Data; - -/** - * @Author: [gitgeek] - * @Date: [2018-08-06 21:29] - * @Description: [ ] - * @Version: [1.0.0] - * @Copy: [com.zzg] - */ -@Data -public class SysUserRole { - - private String userId; - private String roleId; - -} diff --git a/cloud/common/src/main/java/com/sincere/common/model/system/constants/UserType.java b/cloud/common/src/main/java/com/sincere/common/model/system/constants/UserType.java deleted file mode 100644 index 0c8052b..0000000 --- a/cloud/common/src/main/java/com/sincere/common/model/system/constants/UserType.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.sincere.common.model.system.constants; - - -/** - * @author 作者 owen E-mail: 624191343@qq.com - * @version 创建时间:2017年11月12日 上午22:57:51 - * 用户类型 - */ -public enum UserType { - - /** - * 前端app用户 - */ - APP, - /** - * 后端管理用户 - */ - BACKEND -} diff --git a/cloud/common/src/main/java/com/sincere/common/util/DateUtils.java b/cloud/common/src/main/java/com/sincere/common/util/DateUtils.java new file mode 100644 index 0000000..a8a2d52 --- /dev/null +++ b/cloud/common/src/main/java/com/sincere/common/util/DateUtils.java @@ -0,0 +1,67 @@ +package com.sincere.common.util; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/14 0014 14:16 + */ +public class DateUtils { + + public static String format = "yyyy"; + + public static String format1 = "yyyy-MM-dd"; + + public static String format2 = "yyyy-MM-dd HH:mm:ss"; + + public static long getDate(){ + return System.currentTimeMillis(); + } + + public static String date2String(Date date, String format) { + SimpleDateFormat sdf = new SimpleDateFormat(format); + return sdf.format(date); + } + + public static Date string2Date(String date, String format) { + try{ + SimpleDateFormat sdf = new SimpleDateFormat(format); + return sdf.parse(date); + }catch (Exception e){ + + } + return new Date(); + } + + public static Date getToday(){ + return new Date(); + } + + public static String getToday(String format) throws ParseException{ + SimpleDateFormat sdf = new SimpleDateFormat(format); + return sdf.format(new Date()); + } + + public static int getDateDifference(Date date1, Date date2, String timeType) { + int between = (int) (date1.getTime() - date2.getTime()); + int difference = 0; + switch (timeType) { + case "day": + difference = between / (24 * 60 * 60 * 1000); + break; + case "hour": + difference = between / (60 * 60 * 1000); + break; + case "min": + difference = between / (60 * 1000); + break; + case "s": + difference = between / 1000; + } + return difference; + } + +} diff --git a/cloud/common/src/main/java/com/sincere/common/util/UserUtil.java b/cloud/common/src/main/java/com/sincere/common/util/UserUtil.java index 5e5e728..15edb7a 100644 --- a/cloud/common/src/main/java/com/sincere/common/util/UserUtil.java +++ b/cloud/common/src/main/java/com/sincere/common/util/UserUtil.java @@ -29,7 +29,7 @@ public class UserUtil { return null; } String token = authorization.split(" ")[1]; - log.info("获取token成功,值为{}", token); + //log.info("获取token成功,值为{}", token); return token; } @@ -56,7 +56,7 @@ public class UserUtil { } Claims claims = getClaims(token); Integer userId = (Integer) claims.get(UserConstants.USER_ID); - log.info("获取userId成功,值为", userId); + //log.info("获取userId成功,值为", userId); return userId; } @@ -72,7 +72,7 @@ public class UserUtil { } Claims claims = getClaims(token); String username = (String) claims.get(UserConstants.USER_NAME); - log.info("获取username成功,值为", username); + //log.info("获取username成功,值为", username); return username; } diff --git a/cloud/common/src/main/resources/application.properties b/cloud/common/src/main/resources/application.properties deleted file mode 100644 index 8b13789..0000000 --- a/cloud/common/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ - diff --git a/cloud/consumer/pom.xml b/cloud/consumer/pom.xml index 86a1dde..691200d 100644 --- a/cloud/consumer/pom.xml +++ b/cloud/consumer/pom.xml @@ -6,7 +6,6 @@ com.sincere cloud 1.0.0 - com.example consumer diff --git a/cloud/dahua/pom.xml b/cloud/dahua/pom.xml index 3506b35..93ba1d8 100644 --- a/cloud/dahua/pom.xml +++ b/cloud/dahua/pom.xml @@ -6,7 +6,6 @@ com.sincere cloud 1.0.0 - com.example dahua diff --git a/cloud/geteway/pom.xml b/cloud/geteway/pom.xml index 7c7ba31..81ac48b 100644 --- a/cloud/geteway/pom.xml +++ b/cloud/geteway/pom.xml @@ -6,7 +6,6 @@ com.sincere cloud 1.0.0 - com.example geteway diff --git a/cloud/haikang/pom.xml b/cloud/haikang/pom.xml index 6199b3e..ba0fb83 100644 --- a/cloud/haikang/pom.xml +++ b/cloud/haikang/pom.xml @@ -6,7 +6,6 @@ com.sincere cloud 1.0.0 - com.sincere.haikang haikang diff --git a/cloud/haikangface/pom.xml b/cloud/haikangface/pom.xml index 03e1345..ba23955 100644 --- a/cloud/haikangface/pom.xml +++ b/cloud/haikangface/pom.xml @@ -6,7 +6,6 @@ com.sincere cloud 1.0.0 - com.sincere haikangface diff --git a/cloud/mypulsar/pom.xml b/cloud/mypulsar/pom.xml index 9ecd11c..d40c204 100644 --- a/cloud/mypulsar/pom.xml +++ b/cloud/mypulsar/pom.xml @@ -3,10 +3,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework.boot - spring-boot-starter-parent - 2.1.6.RELEASE - + cloud + com.sincere + 1.0.0 diff --git a/cloud/pom.xml b/cloud/pom.xml index 30f8fa2..ab2b9ef 100644 --- a/cloud/pom.xml +++ b/cloud/pom.xml @@ -2,11 +2,11 @@ 4.0.0 + pom org.springframework.boot spring-boot-starter-parent 2.1.6.RELEASE - com.sincere cloud @@ -24,6 +24,10 @@ dahua consumer haikangface + smartCampus_search + xiaoan_search + mypulsar + weigeng @@ -73,14 +77,4 @@ - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - diff --git a/cloud/server1/pom.xml b/cloud/server1/pom.xml index 78e3442..cf7a20b 100644 --- a/cloud/server1/pom.xml +++ b/cloud/server1/pom.xml @@ -6,7 +6,6 @@ com.sincere cloud 1.0.0 - com.sincere server1 diff --git a/cloud/server2/pom.xml b/cloud/server2/pom.xml index 7516dd6..2ed43ce 100644 --- a/cloud/server2/pom.xml +++ b/cloud/server2/pom.xml @@ -6,7 +6,6 @@ com.sincere cloud 1.0.0 - com.sincere server2 diff --git a/cloud/smartCampus_search/pom.xml b/cloud/smartCampus_search/pom.xml new file mode 100644 index 0000000..6e0e4ad --- /dev/null +++ b/cloud/smartCampus_search/pom.xml @@ -0,0 +1,208 @@ + + + + cloud + com.sincere + 1.0.0 + + 4.0.0 + + smartCampus_search + + + + com.sincere + common + 0.0.1-SNAPSHOT + + + io.netty + netty-all + 4.1.33.Final + + + org.apache.mina + mina-core + 2.1.3 + + + com.microsoft.sqlserver + mssql-jdbc + 6.4.0.jre8 + + + + org.springframework.boot + spring-boot-starter + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-aop + + + + com.googlecode.rapid-framework + rapid-core + 4.0.5 + + + org.apache.commons + commons-lang3 + 3.3.2 + + + + org.slf4j + slf4j-api + 1.7.13 + + + + commons-net + commons-net + 2.0 + + + org.apache.poi + poi + 4.1.0 + + + + org.apache.poi + poi-ooxml + 4.1.0 + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 1.3.0 + + + com.alibaba + druid + 1.0.11 + + + io.springfox + springfox-swagger2 + 2.6.1 + + + io.springfox + springfox-swagger-ui + 2.6.1 + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + + + + + smartCampusSearch + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.8 + 1.8 + UTF-8 + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + com.sincere.smartSearch.SmartSearchApplication + true + lib/ + + + ./config/ + + + + config/** + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy + package + + copy-dependencies + + + + ${project.build.directory}/lib + + + + + + + + org.apache.maven.plugins + maven-resources-plugin + 2.5 + + UTF-8 + + + + + maven-source-plugin + 2.2 + + true + + + + compile + + jar + + + + + + + \ No newline at end of file diff --git a/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/SmartSearchApplication.java b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/SmartSearchApplication.java new file mode 100644 index 0000000..09a4069 --- /dev/null +++ b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/SmartSearchApplication.java @@ -0,0 +1,21 @@ +package com.sincere.smartSearch; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.netflix.eureka.EnableEurekaClient; + +/** + * @author chen + * @version 1.0 + * @date 2019/11/7 0007 15:06 + */ +@EnableEurekaClient +@SpringBootApplication +@MapperScan("com.sincere.smartSearch.mapper") +public class SmartSearchApplication { + + public static void main(String[] args) { + SpringApplication.run(SmartSearchApplication.class, args); + } +} diff --git a/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/controller/WgController.java b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/controller/WgController.java new file mode 100644 index 0000000..a521ab8 --- /dev/null +++ b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/controller/WgController.java @@ -0,0 +1,114 @@ +package com.sincere.smartSearch.controller; + +import com.sincere.common.dto.smartCampus.SchoolDto; +import com.sincere.common.dto.smartCampus.StudentCardDto; +import com.sincere.common.dto.smartCampus.UpdateCardDto; +import com.sincere.common.dto.smartCampus.UserDto; +import com.sincere.smartSearch.model.School; +import com.sincere.smartSearch.model.StudentCard; +import com.sincere.smartSearch.model.UpdateCard; +import com.sincere.smartSearch.model.User; +import com.sincere.smartSearch.service.DeviceService; +import com.sincere.smartSearch.service.WgUserSearchService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.nio.file.attribute.UserDefinedFileAttributeView; + +/** + * @author chen + * @version 1.0 + * @date 2019/11/7 0007 15:47 + */ +@RestController +@RequestMapping("/sm/wg") +public class WgController { + + @Autowired + DeviceService deviceService; + + @Autowired + WgUserSearchService wgUserSearchService; + + @RequestMapping(value = "updateLinkTime",method = RequestMethod.GET) + int updateLinkTime(@RequestParam("sno") String sno){ + return deviceService.updateLinkTime(sno); + } + + @RequestMapping(value = "selectOutOrderId",method = RequestMethod.GET) + String selectOutOrderId(@RequestParam("type") int type, @RequestParam("insideOrderId") int insideOrderId){ + return deviceService.selectOutOrderId(type,insideOrderId); + } + + @RequestMapping(value = "checkLeave",method = RequestMethod.GET) + String checkLeave(@RequestParam("cardNo") String cardNo){ + return wgUserSearchService.checkLeave(cardNo); + } + + @RequestMapping(value = "selectSchoolBySchoolId",method = RequestMethod.GET) + SchoolDto selectSchoolBySchoolId(@RequestParam("schoolId") int schoolId){ + School school = wgUserSearchService.selectSchoolBySchoolId(schoolId); + return toSchoolDto(school); + } + + @RequestMapping(value = "selectUserByCardNum",method = RequestMethod.GET) + UserDto selectUserByCardNum(@RequestParam("cardNum") String cardNum){ + User user = wgUserSearchService.selectUserByCardNum(cardNum); + return toUserDto(user); + } + + @RequestMapping(value = "selectUpdateCardByUpdateId",method = RequestMethod.GET) + UpdateCardDto selectUpdateCardByUpdateId(@RequestParam("updateId") int updateId){ + UpdateCard updateCard = wgUserSearchService.selectUpdateCardByUpdateId(updateId); + return toUpdateCardDto(updateCard); + } + + @RequestMapping(value = "selectStudentCard",method = RequestMethod.GET) + StudentCardDto selectStudentCard(@RequestParam("cardNum") String cardNum){ + StudentCard studentCard = wgUserSearchService.selectStudentCard(cardNum); + return toStudentCardDto(studentCard); + } + + + private SchoolDto toSchoolDto(School school){ + SchoolDto schoolDto = new SchoolDto(); + if(school != null){ + schoolDto.setSchoolId(school.getSchoolId()); + schoolDto.setSchoolName(school.getSchoolName()); + } + return schoolDto; + } + + private UserDto toUserDto(User user){ + UserDto userDto = new UserDto(); + if(user != null){ + userDto.setClassId(user.getClassId()); + userDto.setName(user.getName()); + userDto.setSchoolId(user.getSchoolId()); + userDto.setStudentId(user.getStudentId()); + } + return userDto; + } + + private UpdateCardDto toUpdateCardDto(UpdateCard updateCard){ + UpdateCardDto updateCardDto = new UpdateCardDto(); + if(updateCard != null){ + updateCardDto.setId(updateCard.getId()); + updateCardDto.setOldCard(updateCard.getOldCard()); + updateCard.setUserType(updateCard.getUserType()); + } + return updateCardDto; + } + + private StudentCardDto toStudentCardDto(StudentCard studentCard){ + StudentCardDto studentCardDto = new StudentCardDto(); + if(studentCard != null){ + studentCardDto.setCardNum(studentCard.getCardNum()); + studentCardDto.setCardType(studentCard.getCardType()); + } + return studentCardDto; + } +} diff --git a/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/mapper/DeviceMapper.java b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/mapper/DeviceMapper.java new file mode 100644 index 0000000..95118d0 --- /dev/null +++ b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/mapper/DeviceMapper.java @@ -0,0 +1,18 @@ +package com.sincere.smartSearch.mapper; + +import com.sincere.smartSearch.model.DeviceLink; +import com.sincere.smartSearch.model.DeviceOrder; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/12 0012 16:27 + */ +public interface DeviceMapper { + + int updateLinkTime(DeviceLink deviceLink); + + int insertLink(DeviceLink deviceLink); + + String selectOutOrderId(DeviceOrder deviceOrder); +} diff --git a/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/mapper/WgUserSearchMapper.java b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/mapper/WgUserSearchMapper.java new file mode 100644 index 0000000..2d6758e --- /dev/null +++ b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/mapper/WgUserSearchMapper.java @@ -0,0 +1,26 @@ +package com.sincere.smartSearch.mapper; + +import com.sincere.smartSearch.model.School; +import com.sincere.smartSearch.model.StudentCard; +import com.sincere.smartSearch.model.UpdateCard; +import com.sincere.smartSearch.model.User; + +import java.util.List; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/14 0014 14:36 + */ +public interface WgUserSearchMapper { + + String checkLeave(String cardNo); + + School selectSchoolBySchoolId(int schoolId); + + List selectUserByCardNum(String cardNum); + + UpdateCard selectUpdateCardByUpdateId(int updateId); + + List selectStudentCard(String cardNum); +} diff --git a/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/model/DeviceLink.java b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/model/DeviceLink.java new file mode 100644 index 0000000..14affb9 --- /dev/null +++ b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/model/DeviceLink.java @@ -0,0 +1,39 @@ +package com.sincere.smartSearch.model; + +import java.util.Date; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/12 0012 16:24 + */ +public class DeviceLink { + + private String deviceNo ; + private Date lastTime ; + private int isRelation ; + + public String getDeviceNo() { + return deviceNo; + } + + public void setDeviceNo(String deviceNo) { + this.deviceNo = deviceNo; + } + + public Date getLastTime() { + return lastTime; + } + + public void setLastTime(Date lastTime) { + this.lastTime = lastTime; + } + + public int getIsRelation() { + return isRelation; + } + + public void setIsRelation(int isRelation) { + this.isRelation = isRelation; + } +} diff --git a/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/model/DeviceOrder.java b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/model/DeviceOrder.java new file mode 100644 index 0000000..993d31a --- /dev/null +++ b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/model/DeviceOrder.java @@ -0,0 +1,28 @@ +package com.sincere.smartSearch.model; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/29 0029 10:23 + */ +public class DeviceOrder { + + private int type ; + private int insideOrderId ; + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public int getInsideOrderId() { + return insideOrderId; + } + + public void setInsideOrderId(int insideOrderId) { + this.insideOrderId = insideOrderId; + } +} diff --git a/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/model/School.java b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/model/School.java new file mode 100644 index 0000000..6bd8624 --- /dev/null +++ b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/model/School.java @@ -0,0 +1,29 @@ +package com.sincere.smartSearch.model; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/14 0014 14:37 + */ +public class School { + + private int schoolId ; + private String schoolName ; + + public int getSchoolId() { + return schoolId; + } + + public void setSchoolId(int schoolId) { + this.schoolId = schoolId; + } + + public String getSchoolName() { + return schoolName; + } + + public void setSchoolName(String schoolName) { + this.schoolName = schoolName; + } + +} diff --git a/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/model/StudentCard.java b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/model/StudentCard.java new file mode 100644 index 0000000..7e737da --- /dev/null +++ b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/model/StudentCard.java @@ -0,0 +1,27 @@ +package com.sincere.smartSearch.model; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/14 0014 14:50 + */ +public class StudentCard { + private String cardType ; + private String cardNum ; + + public String getCardType() { + return cardType; + } + + public void setCardType(String cardType) { + this.cardType = cardType; + } + + public String getCardNum() { + return cardNum; + } + + public void setCardNum(String cardNum) { + this.cardNum = cardNum; + } +} diff --git a/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/model/UpdateCard.java b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/model/UpdateCard.java new file mode 100644 index 0000000..cfa3b48 --- /dev/null +++ b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/model/UpdateCard.java @@ -0,0 +1,36 @@ +package com.sincere.smartSearch.model; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/14 0014 14:46 + */ +public class UpdateCard { + private int id ; + private int userType ; + private String oldCard ; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getUserType() { + return userType; + } + + public void setUserType(int userType) { + this.userType = userType; + } + + public String getOldCard() { + return oldCard; + } + + public void setOldCard(String oldCard) { + this.oldCard = oldCard; + } +} diff --git a/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/model/User.java b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/model/User.java new file mode 100644 index 0000000..397c576 --- /dev/null +++ b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/model/User.java @@ -0,0 +1,46 @@ +package com.sincere.smartSearch.model; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/14 0014 14:41 + */ +public class User { + + private int schoolId; + private int classId ; + private String name ; + private int studentId ; + + public int getSchoolId() { + return schoolId; + } + + public void setSchoolId(int schoolId) { + this.schoolId = schoolId; + } + + public int getClassId() { + return classId; + } + + public void setClassId(int classId) { + this.classId = classId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getStudentId() { + return studentId; + } + + public void setStudentId(int studentId) { + this.studentId = studentId; + } +} diff --git a/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/service/DeviceService.java b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/service/DeviceService.java new file mode 100644 index 0000000..4af02ea --- /dev/null +++ b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/service/DeviceService.java @@ -0,0 +1,15 @@ +package com.sincere.smartSearch.service; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/12 0012 16:30 + */ +public interface DeviceService { + + int updateLinkTime(String sno); + + + String selectOutOrderId(int type, int insideOrderId); + +} diff --git a/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/service/WgUserSearchService.java b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/service/WgUserSearchService.java new file mode 100644 index 0000000..8c0cd69 --- /dev/null +++ b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/service/WgUserSearchService.java @@ -0,0 +1,22 @@ +package com.sincere.smartSearch.service; + +import com.sincere.smartSearch.model.*; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/14 0014 14:55 + */ +public interface WgUserSearchService { + + + String checkLeave(String cardNo); + + School selectSchoolBySchoolId(int schoolId); + + User selectUserByCardNum(String cardNum); + + UpdateCard selectUpdateCardByUpdateId(int updateId); + + StudentCard selectStudentCard(String cardNum); +} diff --git a/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/service/impl/DeviceServiceImpl.java b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/service/impl/DeviceServiceImpl.java new file mode 100644 index 0000000..74c79f4 --- /dev/null +++ b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/service/impl/DeviceServiceImpl.java @@ -0,0 +1,43 @@ +package com.sincere.smartSearch.service.impl; + +import com.sincere.smartSearch.mapper.DeviceMapper; +import com.sincere.smartSearch.model.DeviceLink; +import com.sincere.smartSearch.model.DeviceOrder; +import com.sincere.smartSearch.service.DeviceService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/12 0012 16:31 + */ +@Service("deviceService") +public class DeviceServiceImpl implements DeviceService { + + @Autowired + DeviceMapper deviceMapper; + + @Override + public int updateLinkTime(String sno) { + DeviceLink deviceLink = new DeviceLink(); + deviceLink.setDeviceNo(sno); + deviceLink.setLastTime(new Date()); + if(deviceMapper.updateLinkTime(deviceLink) > 0){ + //已存在,更新即可 + }else { + deviceMapper.insertLink(deviceLink); + } + return 1 ; + } + + @Override + public String selectOutOrderId(int type, int insideOrderId) { + DeviceOrder deviceOrder = new DeviceOrder(); + deviceOrder.setType(type); + deviceOrder.setInsideOrderId(insideOrderId); + return deviceMapper.selectOutOrderId(deviceOrder); + } +} diff --git a/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/service/impl/WgUserSearchServiceImpl.java b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/service/impl/WgUserSearchServiceImpl.java new file mode 100644 index 0000000..b7dc49a --- /dev/null +++ b/cloud/smartCampus_search/src/main/java/com/sincere/smartSearch/service/impl/WgUserSearchServiceImpl.java @@ -0,0 +1,60 @@ +package com.sincere.smartSearch.service.impl; + +import com.sincere.smartSearch.mapper.WgUserSearchMapper; +import com.sincere.smartSearch.model.School; +import com.sincere.smartSearch.model.StudentCard; +import com.sincere.smartSearch.model.UpdateCard; +import com.sincere.smartSearch.model.User; +import com.sincere.smartSearch.service.WgUserSearchService; +import org.slf4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/14 0014 14:55 + */ +@Service("wgUserSearchService") +public class WgUserSearchServiceImpl implements WgUserSearchService { + + @Autowired + WgUserSearchMapper searchMapper; + + + @Override + public String checkLeave(String cardNo) { + return searchMapper.checkLeave(cardNo); + } + + @Override + public School selectSchoolBySchoolId(int schoolId) { + return searchMapper.selectSchoolBySchoolId(schoolId); + } + + @Override + public User selectUserByCardNum(String cardNum) { + try{ + return searchMapper.selectUserByCardNum(cardNum).get(0); + }catch (Exception e){ + } + return new User(); + } + + @Override + public UpdateCard selectUpdateCardByUpdateId(int updateId) { + return searchMapper.selectUpdateCardByUpdateId(updateId); + } + + @Override + public StudentCard selectStudentCard(String cardNum) { + List list = searchMapper.selectStudentCard(cardNum) ; + if(list != null && list.size() > 0){ + return list.get(0); + }else { + return new StudentCard(); + } + } +} diff --git a/cloud/smartCampus_search/src/main/resources/application.yml b/cloud/smartCampus_search/src/main/resources/application.yml new file mode 100644 index 0000000..fbb7c59 --- /dev/null +++ b/cloud/smartCampus_search/src/main/resources/application.yml @@ -0,0 +1,27 @@ +server: + port: 7777 +spring: + application: + name: smartCampusSearch + datasource: + username: SZJXTUSER + password: xst200919 + url: jdbc:sqlserver://60.190.202.57:14333;database=SmartCampusSZ + driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver +##mybatis +mybatis: + mapper-locations: classpath:mapper/*.xml + type-aliases-package: com.sincere.smartSearch.model + check-config-location: true + +eureka: + instance: + hostname: localhost + lease-expiration-duration-in-seconds: 60 + lease-renewal-interval-in-seconds: 10 + client: + service-url: + defaultZone: http://localhost:8761/eureka/,http://localhost:8762/eureka/ + + + diff --git a/cloud/smartCampus_search/src/main/resources/logback.xml b/cloud/smartCampus_search/src/main/resources/logback.xml new file mode 100644 index 0000000..e3953ee --- /dev/null +++ b/cloud/smartCampus_search/src/main/resources/logback.xml @@ -0,0 +1,61 @@ + + +     +     + +     + + + +     +     +         +         +             +             [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] %highlight([%-5level] %logger{50} - %msg%n) +             UTF-8 +         +     + +     +     +         +         +             +             ${LOG_HOME}/${PROJECT_NAME}.system-dev.%d{yyyy-MM-dd HH}.%i.log +             +             30 +             +             100MB +         + +         +             +             [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] [%-5level] %logger{50} - %msg%n +             UTF-8 +         +     +     +        +    + +    +    +    +    +    +    +    + + +    +    +    +    +    +    +        +        +    + + \ No newline at end of file diff --git a/cloud/smartCampus_search/src/main/resources/mapper/DeviceMapper.xml b/cloud/smartCampus_search/src/main/resources/mapper/DeviceMapper.xml new file mode 100644 index 0000000..d21d2f4 --- /dev/null +++ b/cloud/smartCampus_search/src/main/resources/mapper/DeviceMapper.xml @@ -0,0 +1,17 @@ + + + + + + update AC_DeviceLink set LastTime =#{lastTime} where DeviceNo = #{deviceNo} + + + + insert into AC_DeviceLink(DeviceNo,LastTime,IsRelation) + values (#{deviceNo},#{lastTime},0) + + + + \ No newline at end of file diff --git a/cloud/smartCampus_search/src/main/resources/mapper/WgUserSearchMapper.xml b/cloud/smartCampus_search/src/main/resources/mapper/WgUserSearchMapper.xml new file mode 100644 index 0000000..01b4897 --- /dev/null +++ b/cloud/smartCampus_search/src/main/resources/mapper/WgUserSearchMapper.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cloud/weigeng/libs/sqljdbc4-4.2-6.jar b/cloud/weigeng/libs/sqljdbc4-4.2-6.jar deleted file mode 100644 index d33695c..0000000 Binary files a/cloud/weigeng/libs/sqljdbc4-4.2-6.jar and /dev/null differ diff --git a/cloud/weigeng/pom.xml b/cloud/weigeng/pom.xml index f208afb..74c6112 100644 --- a/cloud/weigeng/pom.xml +++ b/cloud/weigeng/pom.xml @@ -3,10 +3,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework.boot - spring-boot-starter-parent - 2.1.8.RELEASE - + cloud + com.sincere + 1.0.0 com.sincere weigeng @@ -14,58 +13,59 @@ weigeng Demo project for Spring Boot - - 1.8 - Greenwich.SR2 - + + + + - org.springframework.boot - spring-boot-starter-web + com.sincere + common + 0.0.1-SNAPSHOT - org.springframework.cloud - spring-cloud-starter-netflix-eureka-server + org.apache.mina + mina-core + 2.1.3 - - com.baidu.aip - java-sdk - 4.10.0 + org.apache.poi + poi + 4.1.0 - com.microsoft.sqlserver.jdbc - sqljdbc - system - 1 - ${project.basedir}/libs/sqljdbc4-4.2-6.jar + org.springframework.boot + spring-boot-starter-test + test - - org.mybatis.spring.boot - mybatis-spring-boot-starter - 2.0.1 + org.springframework.cloud + spring-cloud-starter-feign + 1.3.6.RELEASE - - com.drewnoakes - metadata-extractor - 2.4.0-beta-1 + org.springframework.cloud + spring-cloud-openfeign-core + 2.1.2.RELEASE - - org.apache.poi - poi - 4.1.0 + io.springfox + springfox-swagger2 + 2.5.0 - - org.springframework.boot - spring-boot-starter-test - test + io.springfox + springfox-swagger-ui + 2.5.0 + + org.apache.commons + commons-lang3 + 3.3.2 + + diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/AuthService.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/AuthService.java deleted file mode 100644 index 36ae7cb..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/AuthService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.sincere.weigeng; - -import org.json.JSONObject; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.List; -import java.util.Map; - -/** - * 获取token类 - */ -public class AuthService { - //设置APPID/AK/SK - public static final String APP_ID = "15990462"; - public static final String API_KEY = "t70Rzr6SGmfU9S6MrqAkspsY"; - public static final String SECRET_KEY = "nSqpqtrf7cCjo8vOB9knL85nwWNoxwvS "; - /** - * 获取权限token - * @return 返回示例: - * { - * "access_token": "24.460da4889caad24cccdb1fea17221975.2592000.1491995545.282335-1234567", - * "expires_in": 2592000 - * } - */ - public static String getAuth() { - // 官网获取的 API Key 更新为你注册的 - String clientId = "t70Rzr6SGmfU9S6MrqAkspsY"; - // 官网获取的 Secret Key 更新为你注册的 - String clientSecret = "nSqpqtrf7cCjo8vOB9knL85nwWNoxwvS"; - return getAuth(clientId, clientSecret); - } - - /** - * 获取API访问token - * 该token有一定的有效期,需要自行管理,当失效时需重新获取. - * @param ak - 百度云官网获取的 API Key - * @param sk - 百度云官网获取的 Securet Key - * @return assess_token 示例: - * "24.460da4889caad24cccdb1fea17221975.2592000.1491995545.282335-1234567" - */ - public static String getAuth(String ak, String sk) { - // 获取token地址 - String authHost = "https://aip.baidubce.com/oauth/2.0/token?"; - String getAccessTokenUrl = authHost - // 1. grant_type为固定参数 - + "grant_type=client_credentials" - // 2. 官网获取的 API Key - + "&client_id=" + ak - // 3. 官网获取的 Secret Key - + "&client_secret=" + sk; - try { - URL realUrl = new URL(getAccessTokenUrl); - // 打开和URL之间的连接 - HttpURLConnection connection = (HttpURLConnection) realUrl.openConnection(); - connection.setRequestMethod("GET"); - connection.connect(); - // 获取所有响应头字段 - Map> map = connection.getHeaderFields(); - // 遍历所有的响应头字段 - for (String key : map.keySet()) { - System.err.println(key + "--->" + map.get(key)); - } - // 定义 BufferedReader输入流来读取URL的响应 - BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); - String result = ""; - String line; - while ((line = in.readLine()) != null) { - result += line; - } - /** - * 返回结果示例 - */ - System.err.println("result:" + result); - JSONObject jsonObject = new JSONObject(result); - String access_token = jsonObject.getString("access_token"); - return access_token; - } catch (Exception e) { - System.err.printf("获取token失败!"); - e.printStackTrace(System.err); - } - return null; - } -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/HomeBean.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/HomeBean.java deleted file mode 100644 index 3409099..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/HomeBean.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.sincere.weigeng; - -public class HomeBean { - - private String CreatorUserId; - - private String Title; - - - public String getCreatorUserId() { - return CreatorUserId; - } - - public void setCreatorUserId(String creatorUserId) { - CreatorUserId = creatorUserId; - } - - public String getTitle() { - return Title; - } - - public void setTitle(String title) { - Title = title; - } - - @Override - public String toString() { - return "HomeBean{" + - "CreatorUserId='" + CreatorUserId + '\'' + - ", Title='" + Title + '\'' + - '}'; - } -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/Homework.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/Homework.java deleted file mode 100644 index 9a34851..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/Homework.java +++ /dev/null @@ -1,189 +0,0 @@ -package com.sincere.weigeng; - -import java.io.Serializable; - -public class Homework implements Serializable { - - private String ID; - - private String CreatorUserId; - - private String PaperId; - - private String Title; - - private int SuggestionTime; - - private String Deadline; - - private int State; - - private String Intime; - - private int SubjectId; - - private int PublishAnswerType; - - private int IsPigai; - - private String StartTime; - - private int TypeId; - - private String QuestionIds; - - private int HomeworkType; - - private int PkgId; - - public String getCreatorUserId() { - return CreatorUserId; - } - - public void setCreatorUserId(String creatorUserId) { - CreatorUserId = creatorUserId; - } - - public String getPaperId() { - return PaperId; - } - - public String getID() { - return ID; - } - - public void setID(String ID) { - this.ID = ID; - } - - @Override - public String toString() { - return "Homework{" + - "ID='" + ID + '\'' + - ", CreatorUserId='" + CreatorUserId + '\'' + - ", PaperId='" + PaperId + '\'' + - ", Title='" + Title + '\'' + - ", SuggestionTime=" + SuggestionTime + - ", Deadline='" + Deadline + '\'' + - ", State=" + State + - ", Intime='" + Intime + '\'' + - ", SubjectId=" + SubjectId + - ", PublishAnswerType=" + PublishAnswerType + - ", IsPigai=" + IsPigai + - ", StartTime='" + StartTime + '\'' + - ", TypeId=" + TypeId + - ", QuestionIds='" + QuestionIds + '\'' + - ", HomeworkType=" + HomeworkType + - ", PkgId=" + PkgId + - '}'; - } - - public void setPaperId(String paperId) { - PaperId = paperId; - } - - public String getTitle() { - return Title; - } - - public void setTitle(String title) { - Title = title; - } - - public int getSuggestionTime() { - return SuggestionTime; - } - - public void setSuggestionTime(int suggestionTime) { - SuggestionTime = suggestionTime; - } - - public String getDeadline() { - return Deadline; - } - - public void setDeadline(String deadline) { - Deadline = deadline; - } - - public int getState() { - return State; - } - - public void setState(int state) { - State = state; - } - - public String getIntime() { - return Intime; - } - - public void setIntime(String intime) { - Intime = intime; - } - - public int getSubjectId() { - return SubjectId; - } - - public void setSubjectId(int subjectId) { - SubjectId = subjectId; - } - - public int getPublishAnswerType() { - return PublishAnswerType; - } - - public void setPublishAnswerType(int publishAnswerType) { - PublishAnswerType = publishAnswerType; - } - - public int getIsPigai() { - return IsPigai; - } - - public void setIsPigai(int isPigai) { - IsPigai = isPigai; - } - - public String getStartTime() { - return StartTime; - } - - public void setStartTime(String startTime) { - StartTime = startTime; - } - - public int getTypeId() { - return TypeId; - } - - public void setTypeId(int typeId) { - TypeId = typeId; - } - - public String getQuestionIds() { - return QuestionIds; - } - - public void setQuestionIds(String questionIds) { - QuestionIds = questionIds; - } - - public int getHomeworkType() { - return HomeworkType; - } - - public void setHomeworkType(int homeworkType) { - HomeworkType = homeworkType; - } - - public int getPkgId() { - return PkgId; - } - - public void setPkgId(int pkgId) { - PkgId = pkgId; - } - -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/HomeworkReceive.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/HomeworkReceive.java deleted file mode 100644 index 1679780..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/HomeworkReceive.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.sincere.weigeng; - -import java.io.Serializable; - -public class HomeworkReceive implements Serializable { - - private String StudentId; - - private String StudnetAnswerIds; - - public String getStudentId() { - return StudentId; - } - - public void setStudentId(String studentId) { - StudentId = studentId; - } - - public String getStudnetAnswerIds() { - return StudnetAnswerIds; - } - - public void setStudnetAnswerIds(String studnetAnswerIds) { - StudnetAnswerIds = studnetAnswerIds; - } - - @Override - public String toString() { - return "HomeworkReceive{" + - "StudentId='" + StudentId + '\'' + - ", StudnetAnswerIds='" + StudnetAnswerIds + '\'' + - '}'; - } -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/ImageUtils.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/ImageUtils.java deleted file mode 100644 index b9fa1e0..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/ImageUtils.java +++ /dev/null @@ -1,168 +0,0 @@ -package com.sincere.weigeng; - -import com.drew.imaging.ImageMetadataReader; -import com.drew.imaging.jpeg.JpegMetadataReader; -import com.drew.metadata.Directory; -import com.drew.metadata.Metadata; -import com.drew.metadata.Tag; -import com.sun.imageio.plugins.png.PNGImageReader; -import org.apache.commons.lang.StringUtils; - -import javax.imageio.ImageIO; -import java.awt.*; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import java.util.Iterator; - -public class ImageUtils { - - - /* *//** - * 获取图片正确显示需要旋转的角度(顺时针) - * @return - *//* - public static int getRotateAngleForPhoto(String filePath){ - File file = new File(filePath); - int angle = 0; - Metadata metadata; - try { - metadata = JpegMetadataReader.readMetadata(file); - Directory directory = metadata.getDirectory(ExifDirectory.class); - if(directory.containsTag(ExifDirectory.TAG_ORIENTATION)){ - - // Exif信息中方向   - int orientation = directory.getInt(ExifDirectory.TAG_ORIENTATION); - // 原图片的方向信息 - if(6 == orientation ){ - //6旋转90 - angle = 90; - }else if( 3 == orientation){ - //3旋转180 - angle = 180; - }else if( 8 == orientation){ - //8旋转90 - angle = 270; - } - } - } catch (JpegProcessingException e) { - e.printStackTrace(); - } catch (MetadataException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - return angle; - }*/ - - - /** - * 获得图片调整角度 - * make by dongxh 2017年11月1日下午3:40:20 - * @param imgFile - * @return - */ - public static Integer getImgRotateAngle(String imgFile){ - return 0; - /*int angel = 0; - try { - File file = new File(imgFile); - Metadata metadata = ImageMetadataReader.readMetadata(file); - for (Directory directory : metadata.getDirectories()) { - for (Tag tag : directory.getTags()) { - if (tag.getTagType() == ExifDirectoryBase.TAG_ORIENTATION) { - String description = tag.getDescription(); -// System.out.println(description); - if (description.contains("90")) { - // 顺时针旋转90度 - angel = 90; - } else if (description.contains("180")) { - // 顺时针旋转180度 - angel = 180; - } else if (description.contains("270")) { - // 顺时针旋转270度 - angel = 270; - } - } - } - } -// System.out.println(angel); - } catch (Exception e) { - e.printStackTrace(); - } - return angel;*/ - /*Integer angel = 0; - Metadata metadata = null; - try{ - if(StringUtils.isBlank(imgFile))return angel; - File _img_file_ = new File(imgFile); - if(!_img_file_.exists())return angel; - metadata = JpegMetadataReader.readMetadata(_img_file_); - Directory directory = metadata.getDirectory(ExifDirectory.class); - Iterator iterator =directory.getTagIterator(); - while (iterator.hasNext()){ - System.out.println("directory:"+iterator.next().toString()); - } - if(directory != null && directory.containsTag(ExifDirectory.TAG_ORIENTATION)){ - int orientation = directory.getInt(ExifDirectory.TAG_ORIENTATION); - // 原图片的方向信息 - if(6 == orientation ){ - //6旋转90 - angel = 90; - }else if( 3 == orientation){ - //3旋转180 - angel = 180; - }else if( 8 == orientation){ - //8旋转90 - angel = 270; - } - } - }catch(Exception e){ - e.printStackTrace(); - } - return angel;*/ - } - - /** - * 旋转照片 - * @return - */ - public static String rotatePhonePhoto(String fullPath, int angel){ - - BufferedImage src; - try { - src = ImageIO.read(new File(fullPath)); - int src_width = src.getWidth(null); - int src_height = src.getHeight(null); - - int swidth=src_width; - int sheight=src_height; - - if(angel==90||angel==270){ - swidth = src_height; - sheight= src_width; - } - - Rectangle rect_des = new Rectangle(new Dimension(swidth,sheight)); - - BufferedImage res = new BufferedImage(rect_des.width, rect_des.height,BufferedImage.TYPE_INT_RGB); - Graphics2D g2 = res.createGraphics(); - - g2.translate((rect_des.width - src_width) / 2, - (rect_des.height - src_height) / 2); - g2.rotate(Math.toRadians(angel), src_width / 2, src_height / 2); - - g2.drawImage(src, null, null); - - ImageIO.write(res, "jpg", new File(fullPath)); - - } catch (IOException e) { - - e.printStackTrace(); - } - - return fullPath; - - } - -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/JiaoCai.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/JiaoCai.java deleted file mode 100644 index fa2541a..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/JiaoCai.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.sincere.weigeng; - -import java.io.Serializable; - -public class JiaoCai implements Serializable { - - - private String ID; - - private String SubjectId; - - private String JiaoCaiName; - - public String getID() { - return ID; - } - - public void setID(String ID) { - this.ID = ID; - } - - public String getSubjectId() { - return SubjectId; - } - - public void setSubjectId(String subjectId) { - SubjectId = subjectId; - } - - public String getJiaoCaiName() { - return JiaoCaiName; - } - - public void setJiaoCaiName(String jiaoCaiName) { - JiaoCaiName = jiaoCaiName; - } - - @Override - public String toString() { - return "JiaoCai{" + - "ID='" + ID + '\'' + - ", SubjectId='" + SubjectId + '\'' + - ", JiaoCaiName='" + JiaoCaiName + '\'' + - '}'; - } -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/Knowledge.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/Knowledge.java deleted file mode 100644 index a500a9b..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/Knowledge.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.sincere.weigeng; - -import java.io.Serializable; - -public class Knowledge implements Serializable { - - private String Name; - - private String SubjectId; - - private String Id; - - public String getId() { - return Id; - } - - public void setId(String id) { - Id = id; - } - - public String getName() { - return Name; - } - - public void setName(String name) { - Name = name; - } - - public String getSubjectId() { - return SubjectId; - } - - public void setSubjectId(String subjectId) { - SubjectId = subjectId; - } - - @Override - public String toString() { - return "Knowledge{" + - "Name='" + Name + '\'' + - ", SubjectId='" + SubjectId + '\'' + - '}'; - } -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/MyTask.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/MyTask.java deleted file mode 100644 index 21a60ec..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/MyTask.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.sincere.weigeng; - -import com.baidu.aip.ocr.AipOcr; -import com.baidu.aip.util.Base64Util; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.json.JSONObject; -import org.springframework.boot.ApplicationArguments; -import org.springframework.boot.ApplicationRunner; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Component; -import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; -import org.springframework.web.client.RestTemplate; - -import java.util.HashMap; - -@Component -public class MyTask implements ApplicationRunner { - - - - @Override - public void run(ApplicationArguments args) throws Exception { - - System.out.println("authon:" + AuthService.getAuth()); - } -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/QuestionBean.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/QuestionBean.java deleted file mode 100644 index 7430f92..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/QuestionBean.java +++ /dev/null @@ -1,277 +0,0 @@ -package com.sincere.weigeng; - -import java.io.Serializable; - -public class QuestionBean implements Serializable { - - - private String ID; - - private String Question; - - private String Qtype; - - private String Answer; - - private String CorrectAnswer; - - private String Analysis; - - private String State; - - private String Intime; - - private String ExamineFlag; - - private String ExamineUserId; - - private String CreateUserId; - - private String SubjectId; - - private String SchoolId; - - private String DifficulteId; - - private String KnowledgeId; - - private String ChapterId; - - private String GradeId; - - private String SourceId; - - private String OrderId; - - private String SId; - - private String StemId; - - private String AutomaticCorrection; - - private String PkgId; - - private String PkgType; - - public String getQuestion() { - return Question; - } - - public void setQuestion(String question) { - Question = question; - } - - public String getQtype() { - return Qtype; - } - - public void setQtype(String qtype) { - Qtype = qtype; - } - - public String getAnswer() { - return Answer; - } - - public void setAnswer(String answer) { - Answer = answer; - } - - public String getCorrectAnswer() { - return CorrectAnswer; - } - - public void setCorrectAnswer(String correctAnswer) { - CorrectAnswer = correctAnswer; - } - - public String getAnalysis() { - return Analysis; - } - - public void setAnalysis(String analysis) { - Analysis = analysis; - } - - public String getState() { - return State; - } - - public void setState(String state) { - State = state; - } - - public String getIntime() { - return Intime; - } - - public void setIntime(String intime) { - Intime = intime; - } - - public String getExamineFlag() { - return ExamineFlag; - } - - public void setExamineFlag(String examineFlag) { - ExamineFlag = examineFlag; - } - - public String getExamineUserId() { - return ExamineUserId; - } - - public void setExamineUserId(String examineUserId) { - ExamineUserId = examineUserId; - } - - public String getCreateUserId() { - return CreateUserId; - } - - public void setCreateUserId(String createUserId) { - CreateUserId = createUserId; - } - - public String getSubjectId() { - return SubjectId; - } - - public void setSubjectId(String subjectId) { - SubjectId = subjectId; - } - - public String getSchoolId() { - return SchoolId; - } - - public void setSchoolId(String schoolId) { - SchoolId = schoolId; - } - - public String getDifficulteId() { - return DifficulteId; - } - - public void setDifficulteId(String difficulteId) { - DifficulteId = difficulteId; - } - - public String getKnowledgeId() { - return KnowledgeId; - } - - public void setKnowledgeId(String knowledgeId) { - KnowledgeId = knowledgeId; - } - - public String getChapterId() { - return ChapterId; - } - - public void setChapterId(String chapterId) { - ChapterId = chapterId; - } - - public String getGradeId() { - return GradeId; - } - - public void setGradeId(String gradeId) { - GradeId = gradeId; - } - - public String getSourceId() { - return SourceId; - } - - public void setSourceId(String sourceId) { - SourceId = sourceId; - } - - public String getOrderId() { - return OrderId; - } - - public void setOrderId(String orderId) { - OrderId = orderId; - } - - public String getSId() { - return SId; - } - - public void setSId(String SId) { - this.SId = SId; - } - - public String getStemId() { - return StemId; - } - - public void setStemId(String stemId) { - StemId = stemId; - } - - public String getAutomaticCorrection() { - return AutomaticCorrection; - } - - public void setAutomaticCorrection(String automaticCorrection) { - AutomaticCorrection = automaticCorrection; - } - - public String getPkgId() { - return PkgId; - } - - public void setPkgId(String pkgId) { - PkgId = pkgId; - } - - public String getPkgType() { - return PkgType; - } - - public void setPkgType(String pkgType) { - PkgType = pkgType; - } - - public String getID() { - return ID; - } - - public void setID(String ID) { - this.ID = ID; - } - - @Override - public String toString() { - return "QuestionBean{" + - "ID='" + ID + '\'' + - ", Question='" + Question + '\'' + - ", Qtype='" + Qtype + '\'' + - ", Answer='" + Answer + '\'' + - ", CorrectAnswer='" + CorrectAnswer + '\'' + - ", Analysis='" + Analysis + '\'' + - ", State='" + State + '\'' + - ", Intime='" + Intime + '\'' + - ", ExamineFlag='" + ExamineFlag + '\'' + - ", ExamineUserId='" + ExamineUserId + '\'' + - ", CreateUserId='" + CreateUserId + '\'' + - ", SubjectId='" + SubjectId + '\'' + - ", SchoolId='" + SchoolId + '\'' + - ", DifficulteId='" + DifficulteId + '\'' + - ", KnowledgeId='" + KnowledgeId + '\'' + - ", ChapterId='" + ChapterId + '\'' + - ", GradeId='" + GradeId + '\'' + - ", SourceId='" + SourceId + '\'' + - ", OrderId='" + OrderId + '\'' + - ", SId='" + SId + '\'' + - ", StemId='" + StemId + '\'' + - ", AutomaticCorrection='" + AutomaticCorrection + '\'' + - ", PkgId='" + PkgId + '\'' + - ", PkgType='" + PkgType + '\'' + - '}'; - } -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/StudentAnswer.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/StudentAnswer.java deleted file mode 100644 index 050e488..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/StudentAnswer.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.sincere.weigeng; - -import java.io.Serializable; - -public class StudentAnswer implements Serializable { - - private String ID; - - private String CorrectAnswer; - - private String Answer; - - public String getID() { - return ID; - } - - public String getAnswer() { - return Answer; - } - - public void setAnswer(String answer) { - Answer = answer; - } - - public void setID(String ID) { - this.ID = ID; - } - - public String getCorrectAnswer() { - return CorrectAnswer; - } - - public void setCorrectAnswer(String correctAnswer) { - CorrectAnswer = correctAnswer; - } - - @Override - public String toString() { - return "StudentAnswer{" + - "ID='" + ID + '\'' + - ", CorrectAnswer='" + CorrectAnswer + '\'' + - '}'; - } -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/StudentBean.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/StudentBean.java deleted file mode 100644 index a874e09..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/StudentBean.java +++ /dev/null @@ -1,233 +0,0 @@ -package com.sincere.weigeng; - -import java.io.Serializable; -import java.util.Date; - -public class StudentBean implements Serializable { - - - private long ID; - private String UserId; - - private String CustomerId; - - private int StudentType; - - private int UserType; - - private String Name; - - private int ClassId; - - private String ClassName; - - private String OldCard; - - private String Card; - - private int SchoolId; - - private int school_id; - - private int IsNew; - - private int UpdateType; - - private Date AddTime; - - private int Sex; - - private String Face; - - private String StudentCode; - - private String student_num; - - private String student_id; - - public String getUserId() { - return UserId; - } - - public void setUserId(String userId) { - UserId = userId; - } - - public String getCustomerId() { - return CustomerId; - } - - public void setCustomerId(String customerId) { - CustomerId = customerId; - } - - public int getStudentType() { - return StudentType; - } - - public void setStudentType(int studentType) { - StudentType = studentType; - } - - public int getUserType() { - return UserType; - } - - public void setUserType(int userType) { - UserType = userType; - } - - public String getName() { - return Name; - } - - public void setName(String name) { - Name = name; - } - - public int getClassId() { - return ClassId; - } - - public void setClassId(int classId) { - ClassId = classId; - } - - public String getClassName() { - return ClassName; - } - - public void setClassName(String className) { - ClassName = className; - } - - public String getOldCard() { - return OldCard; - } - - public void setOldCard(String oldCard) { - OldCard = oldCard; - } - - public String getCard() { - return Card; - } - - public int getSchool_id() { - return school_id; - } - - public void setSchool_id(int school_id) { - this.school_id = school_id; - } - - public String getStudent_num() { - return student_num; - } - - public void setStudent_num(String student_num) { - this.student_num = student_num; - } - - public void setCard(String card) { - Card = card; - } - - public int getSchoolId() { - return SchoolId; - } - - public void setSchoolId(int schoolId) { - SchoolId = schoolId; - } - - public int getIsNew() { - return IsNew; - } - - public void setIsNew(int isNew) { - IsNew = isNew; - } - - public int getUpdateType() { - return UpdateType; - } - - public void setUpdateType(int updateType) { - UpdateType = updateType; - } - - public Date getAddTime() { - return AddTime; - } - - public void setAddTime(Date addTime) { - AddTime = addTime; - } - - public int getSex() { - return Sex; - } - - public void setSex(int sex) { - Sex = sex; - } - - public String getFace() { - return Face; - } - - public void setFace(String face) { - Face = face; - } - - public String getStudentCode() { - return StudentCode; - } - - public void setStudentCode(String studentCode) { - StudentCode = studentCode; - } - - public long getID() { - return ID; - } - - public void setID(long ID) { - this.ID = ID; - } - - public String getStudent_id() { - return student_id; - } - - public void setStudent_id(String student_id) { - this.student_id = student_id; - } - - @Override - public String toString() { - return "StudentBean{" + - "ID=" + ID + - ", UserId='" + UserId + '\'' + - ", CustomerId='" + CustomerId + '\'' + - ", StudentType=" + StudentType + - ", UserType=" + UserType + - ", Name='" + Name + '\'' + - ", ClassId=" + ClassId + - ", ClassName='" + ClassName + '\'' + - ", OldCard='" + OldCard + '\'' + - ", Card='" + Card + '\'' + - ", SchoolId=" + SchoolId + - ", school_id=" + school_id + - ", IsNew=" + IsNew + - ", UpdateType=" + UpdateType + - ", AddTime=" + AddTime + - ", Sex=" + Sex + - ", Face='" + Face + '\'' + - ", StudentCode='" + StudentCode + '\'' + - ", student_num='" + student_num + '\'' + - ", student_id='" + student_id + '\'' + - '}'; - } -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/StudentInfo.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/StudentInfo.java deleted file mode 100644 index 726f1cc..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/StudentInfo.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.sincere.weigeng; - -import java.io.Serializable; - -public class StudentInfo implements Serializable { - - private String student_id; - - private String name; - - private String class_name; - - private String ParentMobile; - - private String studentcode; - - - public String getStudentcode() { - return studentcode; - } - - public void setStudentcode(String studentcode) { - this.studentcode = studentcode; - } - - public String getStudent_id() { - return student_id; - } - - public void setStudent_id(String student_id) { - this.student_id = student_id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getClass_name() { - return class_name; - } - - public void setClass_name(String class_name) { - this.class_name = class_name; - } - - public String getParentMobile() { - return ParentMobile; - } - - public void setParentMobile(String parentMobile) { - ParentMobile = parentMobile; - } -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/Swagger2.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/Swagger2.java new file mode 100644 index 0000000..03089f0 --- /dev/null +++ b/cloud/weigeng/src/main/java/com/sincere/weigeng/Swagger2.java @@ -0,0 +1,38 @@ +package com.sincere.weigeng; + +import io.swagger.annotations.ApiOperation; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +@EnableSwagger2 +@Configuration //让Spring来加载该类配置 +public class Swagger2 { + + @Bean + public Docket createRestApi() { + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo()) + .enableUrlTemplating(true) + .select() + // 扫描所有有注解的api,用这种方式更灵活 + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) + .paths(PathSelectors.any()) + .build(); + + } + private ApiInfo apiInfo() { + return new ApiInfoBuilder() + .title("Spring Boot中使用Swagger2构建RESTful APIs") + .description("接口文档") + .termsOfServiceUrl("") + .version("1.0") + .build(); + } +} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/TestDao.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/TestDao.java deleted file mode 100644 index 9c1ef65..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/TestDao.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.sincere.weigeng; - -import org.apache.ibatis.annotations.*; -import org.springframework.stereotype.Repository; - -import java.util.List; - -@Repository -@Mapper -public interface TestDao { - - - @Insert("insert into TK_QuestionStem values(#{QuestionStem},#{State},#{Intime})") - int addQuestionStem(@Param("QuestionStem") String QuestionStem, @Param("State") String State, @Param("Intime") String Intime); - - @Insert("insert into TK_Question(Question,Qtype,Answer,CorrectAnswer,Analysis,State,Intime,ExamineFlag,ExamineUserId,CreateUserId,SubjectId,SchoolId,DifficulteId,KnowledgeId,ChapterId,GradeId,SourceId,OrderId,SId," + - "StemId,AutomaticCorrection,PkgId,PkgType) " + - "values(#{Question},#{Qtype},#{Answer},#{CorrectAnswer},#{Analysis},#{State},#{Intime},#{ExamineFlag},#{ExamineUserId}" + - ",#{CreateUserId},#{SubjectId},#{SchoolId},#{DifficulteId},#{KnowledgeId},#{ChapterId},#{GradeId},#{SourceId},#{OrderId},#{SId}" + - ",#{StemId},#{AutomaticCorrection},#{PkgId},#{PkgType})") - int addQuestion(@Param("Question") String Question, @Param("Qtype") String Qtype, @Param("Answer") String Answer, @Param("CorrectAnswer") String CorrectAnswer - , @Param("Analysis") String Analysis, @Param("State") String State, @Param("Intime") String Intime, @Param("ExamineFlag") String ExamineFlag, @Param("ExamineUserId") String ExamineUserId - , @Param("CreateUserId") String CreateUserId, @Param("SubjectId") String SubjectId, @Param("SchoolId") String SchoolId, @Param("DifficulteId") String DifficulteId, @Param("KnowledgeId") String KnowledgeId - , @Param("ChapterId") String ChapterId, @Param("GradeId") String GradeId, @Param("SourceId") String SourceId, @Param("OrderId") String OrderId, @Param("SId") String SId - , @Param("StemId") String StemId, @Param("AutomaticCorrection") String AutomaticCorrection, @Param("PkgId") String PkgId, @Param("PkgType") String PkgType); - - @Select("select Top(1) ID from TK_QuestionStem order by Intime desc ") - int getStemId(); - - @Select("select * from TK_Question where Question like #{Question}") - List getQuestions(@Param("Question")String Question); - - @Update("update TK_Question set CorrectAnswer = #{answer},Analysis = #{explanation} where ID = #{id}") - void updateQuestion(@Param("id") String id, @Param("answer") String answer, @Param("explanation") String explanation); - - - //学生做作业 - @Insert("insert into ZY_StudentAnswer (QuestionId,Answer,CorrectAnswer,QuestionType,IsCorrect,WorkID) values (" + - "#{QuestionId},#{Answer},#{CorrectAnswer},#{QuestionType},#{IsCorrect},#{WorkID})") - void StudentAnswer(@Param("QuestionId")String QuestionId,@Param("Answer")String Answer,@Param("CorrectAnswer")String CorrectAnswer, - @Param("QuestionType")String QuestionType,@Param("IsCorrect")String IsCorresct,@Param("WorkID")String WorkID); - - @Insert("insert into ZY_HomeworkReceive values(#{WorkId},#{ClassId},#{StudentId},#{StudnetAnswerIds},#{IsFinished}," + - "#{AnswerTime},#{FinishTime},#{Intime},#{IsPigai},#{IsPigai})") - void HomeworkReceive(@Param("WorkId")String WorkId,@Param("ClassId")String ClassId,@Param("StudentId")String StudentId,@Param("StudnetAnswerIds")String StudnetAnswerIds, - @Param("IsFinished")String IsFinished,@Param("AnswerTime")String AnswerTime,@Param("FinishTime")String FinishTime,@Param("Intime")String Intime, - @Param("IsPigai")String IsPigai,@Param("IsPigai")String UseTime); - - @Select("select * from TK_Question where ID = #{ID}") - QuestionBean getQues(@Param("ID")String ID); - - @Select("select StudentId from ZY_HomeworkReceive where WorkId = #{WorkId}") - List getStudentIds(@Param("WorkId")String WorkId); -// ) - - @Select("select ID from TK_Question where SchoolId = 885 and CorrectAnswer in('A','B','C','D') and ChapterId = #{ChapterId}") - List getQIDS(@Param("ChapterId")String ChapterId ); - - @Select("select ID from ZY_StudentAnswer where WorkID = #{WorkID}") - List getStudentAnsIds(@Param("WorkID")String WorkID); - - //添加学生答题记录 - @Insert("insert into ZY_StudentAnswer values (#{QuestionId},#{Answer},#{AnswerTime},#{CorrectAnswer},#{QuestionType},#{Pigai},#{IsCorrect},#{AppachIds},#{TeacherAppachIds},#{WorkID})") - void addStudentAnswer(@Param("QuestionId")String QuestionId,@Param("Answer")String Answer,@Param("AnswerTime")String AnswerTime,@Param("CorrectAnswer")String CorrectAnswer, - @Param("QuestionType")String QuestionType,@Param("Pigai")String Pigai,@Param("IsCorrect")String IsCorrect,@Param("AppachIds")String AppachIds, - @Param("TeacherAppachIds")String TeacherAppachIds,@Param("WorkID")String WorkID); - - - @Select("select Top(#{top}) ID from ZY_StudentAnswer where WorkID = #{WorkID} order by ID desc") - List getTopIDs(@Param("WorkID")String WorkID,@Param("top")int top); - - @Select("select ID from ZY_HomeworkReceive where WorkId = #{WorkId} and ID >= #{ID} and ID<12054 order by ID desc") - List get_HomeworkReceive(@Param("WorkId")String WorkId,@Param("ID")String ID); - - @Update("update ZY_HomeworkReceive set StudnetAnswerIds = #{StudnetAnswerIds} where ID = #{ID}") - void updateHomeWork(@Param("StudnetAnswerIds")String StudnetAnswerIds,@Param("ID")String ID); - - @Select("select * from ZY_HomeworkReceive where WorkId = #{WorkId} order by ID desc") - List get_HomeworkRec(@Param("WorkId")String WorkId); - - @Select("select Title from ZY_Homework where ID = #{ID} order by ID desc") - String getWorkName(@Param("ID") String workId); - - @Select("select * from ZY_StudentAnswer where WorkID = #{WorkId}") - List get_stuAnswer(@Param("WorkId")String WorkId); - - @Update("update ZY_StudentAnswer set Answer = #{Answer},IsCorrect = #{IsCorrect} ,CorrectAnswer = #{CorrectAnswer} where ID = #{ID}") - void updateStudentAnswer(@Param("ID") String id,@Param("CorrectAnswer")String CorrectAnswer,@Param("Answer")String Answer,@Param("IsCorrect")String IsCorrect); - - @Select("select name from SZ_V_School_Student where student_id = #{student_id}") - String getStudentName(@Param("student_id") String studentId); - - @Select("select student_id from SZ_V_School_Student where class_id = #{class_id}") - List getStudentIdsWithClassId(@Param("class_id") String class_id); - - @Select("select IsCorrect from ZY_StudentAnswer where ID = #{ID}") - int getIsCorrect(@Param("ID") String id); - - @Select("select QuestionId from ZY_StudentAnswer where WorkID = #{WorkID}") - List getStuAnsIds(@Param("WorkID") String workId); - - @Select("select CorrectAnswer from ZY_StudentAnswer where WorkID = #{WorkID}") - List correctAns(@Param("WorkID")String WorkID); - - - @Select("select * from ZY_TestPaper where CreatorUserId = #{CreateUserId} and Intime > #{Intime}") - List getTestPapers(@Param("CreateUserId") String createUserId,@Param("Intime")String Intime); - - @Insert("insert into ZY_TestPaper values (#{addCreateUserId},#{questionIds},#{status},#{publishTime},#{name},#{isRecommend},#{state},#{intime},#{schoolId})") - void addTestPaper(@Param("addCreateUserId") String addCreateUserId, @Param("questionIds") String questionIds, @Param("status") int status, - @Param("publishTime") String publishTime, @Param("name") String name, @Param("isRecommend") int isRecommend, - @Param("state") int state, @Param("intime") String intime, @Param("schoolId") String schoolId); - - @Insert("insert into ZY_Homework values(#{addCreateUserId},#{id},#{name},#{s},#{s1},#{s2},#{s3},#{i},#{i1},#{i2},#{s4},#{i3},#{questionIds},#{i4},#{i5}) ") - void addHomework(@Param("addCreateUserId") String addCreateUserId, @Param("id") int id, @Param("name") String name, - @Param("s") String s, @Param("s1") String s1, @Param("s2") String s2, @Param("s3") String s3, @Param("i") int i, - @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); - - - @Select("select * from ZY_Homework where CreatorUserId in (select DISTINCT user_id from SZ_UserRole where school_id = 11)") - List getCreatorUserId(); - - @Select("select * from ZY_Homework where CreatorUserId = #{CreatorUserId}") - List getHomeWork(@Param("CreatorUserId") String addCreateUserId); - - @Select("select * from SZ_V_School_Student where school_id = #{school_id}") - List getStudents(@Param("school_id") int school_id); - - @Select("select QuestionIds from ZY_Homework where ID = #{workId}") - String getQuestionIds(@Param("workId") String workId); - - @Select("select CorrectAnswer from TK_Question where ID = #{questionId}") - String getCorrectAnswer(@Param("questionId") String questionId); - - - - -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/TestPaper.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/TestPaper.java deleted file mode 100644 index 62780ac..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/TestPaper.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.sincere.weigeng; - -import java.io.Serializable; - -public class TestPaper implements Serializable { - - private int ID; - - private String CreatorUserId; - - private String QuestionIds; - - private int Status; - - private String PublishTime; - - private String Name; - - private int IsRecommend; - - private int State; - - private String Intime; - - private int SchoolId; - - public String getCreatorUserId() { - return CreatorUserId; - } - - public void setCreatorUserId(String creatorUserId) { - CreatorUserId = creatorUserId; - } - - public String getQuestionIds() { - return QuestionIds; - } - - public void setQuestionIds(String questionIds) { - QuestionIds = questionIds; - } - - public int getStatus() { - return Status; - } - - public int getID() { - return ID; - } - - public void setID(int ID) { - this.ID = ID; - } - - public void setStatus(int status) { - Status = status; - } - - public String getPublishTime() { - return PublishTime; - } - - public void setPublishTime(String publishTime) { - PublishTime = publishTime; - } - - public String getName() { - return Name; - } - - public void setName(String name) { - Name = name; - } - - public int getIsRecommend() { - return IsRecommend; - } - - public void setIsRecommend(int isRecommend) { - IsRecommend = isRecommend; - } - - public int getState() { - return State; - } - - public void setState(int state) { - State = state; - } - - public String getIntime() { - return Intime; - } - - public void setIntime(String intime) { - Intime = intime; - } - - public int getSchoolId() { - return SchoolId; - } - - public void setSchoolId(int schoolId) { - SchoolId = schoolId; - } - - @Override - public String toString() { - return "TestPaper{" + - "ID=" + ID + - ", CreatorUserId='" + CreatorUserId + '\'' + - ", QuestionIds='" + QuestionIds + '\'' + - ", Status=" + Status + - ", PublishTime='" + PublishTime + '\'' + - ", Name='" + Name + '\'' + - ", IsRecommend=" + IsRecommend + - ", State=" + State + - ", Intime='" + Intime + '\'' + - ", SchoolId=" + SchoolId + - '}'; - } -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/WeigengApplication.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/WeigengApplication.java index 8eb7742..d831577 100644 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/WeigengApplication.java +++ b/cloud/weigeng/src/main/java/com/sincere/weigeng/WeigengApplication.java @@ -1,13 +1,22 @@ package com.sincere.weigeng; +import com.sincere.weigeng.utils.WatchServer; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.netflix.eureka.EnableEurekaClient; +import org.springframework.cloud.openfeign.EnableFeignClients; +@EnableFeignClients(basePackages = "com.sincere.weigeng.feign") +@EnableEurekaClient @SpringBootApplication public class WeigengApplication { + private static String ip = "172.16.3.175"; + private static int port = 1200; + public static void main(String[] args) { SpringApplication.run(WeigengApplication.class, args); + //WatchServer.WatchingServerRunning(ip,port); } } diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/controller/WgController.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/controller/WgController.java new file mode 100644 index 0000000..6386ddc --- /dev/null +++ b/cloud/weigeng/src/main/java/com/sincere/weigeng/controller/WgController.java @@ -0,0 +1,220 @@ +package com.sincere.weigeng.controller; + +import com.sincere.common.dto.smartCampus.SchoolDto; +import com.sincere.common.dto.smartCampus.StudentCardDto; +import com.sincere.common.dto.smartCampus.UpdateCardDto; +import com.sincere.common.dto.smartCampus.UserDto; +import com.sincere.common.dto.xiaoan.SendFailDto; +import com.sincere.common.dto.xiaoan.SendMessageDto; +import com.sincere.common.dto.xiaoan.SendSuccessDto; +import com.sincere.weigeng.feign.SmFeign; +import com.sincere.weigeng.feign.XaFeign; +import com.sincere.weigeng.logs.LogName; +import com.sincere.weigeng.logs.LoggerUtils; +import com.sincere.weigeng.utils.WatchServer; +import com.sincere.weigeng.vo.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/14 0014 9:12 + */ +@RestController +@Api(value = "微耕") +public class WgController { + + private static final Logger Log_orderSuccess = LoggerUtils.Logger(LogName.orderSuccess); + private static final Logger Log_orderFail = LoggerUtils.Logger(LogName.orderFail); + + @Autowired + SmFeign smFeign; + + @Autowired + XaFeign xaFeign; + + private static String ip = "172.16.3.175"; + private static int port = 1200; + + @RequestMapping(value = "watching" , method = RequestMethod.GET) + public void watching(){ + WatchServer.WatchingServerRunning(ip,port,smFeign,xaFeign); + } + + @RequestMapping(value = "setTime" , method = RequestMethod.GET) + public void setTime(long sn){ + WatchServer.setTime(xaFeign,sn,"48"); + } + + @ApiOperation("远程开门") + @RequestMapping(value = "openDoor" , method = RequestMethod.POST) + public boolean openDoor(@RequestBody OpenDoorVo openDoorVo) { + String functionId = smFeign.selectOutOrderId(openDoorVo.getType(),openDoorVo.getId()); + long messageId = WatchServer.openDoor(xaFeign,openDoorVo.getSn(),functionId,openDoorVo.getDoorNo(),null); + SendMessageDto message = getResult(messageId); + if(message.getCorrect() == 1){ + Log_orderSuccess.info("web端远程开门成功!"); + }else { + Log_orderFail.info("远程开门失败"); + } + return message.getCorrect() == 1 ; + } + + + @ApiOperation("设置考勤时段") + @RequestMapping(value = "setAttendanceTime" , method = RequestMethod.POST) + public boolean setAttendanceTime(@RequestBody AttendanceTimeVo attendanceTimeVo){ + String functionId = smFeign.selectOutOrderId(attendanceTimeVo.getType(),attendanceTimeVo.getId()); + List result = WatchServer.SetAttendanceTime(xaFeign,attendanceTimeVo.getSn(),functionId,attendanceTimeVo.getShiduan(), + attendanceTimeVo.getStart(),attendanceTimeVo.getEnd(),attendanceTimeVo.getIsMonday(),attendanceTimeVo.getIsTuesday(), + attendanceTimeVo.getIsWednesday(),attendanceTimeVo.getIsThursday(),attendanceTimeVo.getIsFriday(), + attendanceTimeVo.getIsSaturday(),attendanceTimeVo.getIsWeekend(),attendanceTimeVo.getShiqu()); + boolean isSuccess = true ; + for(Long messageId : result){ + SendMessageDto message = getResult(messageId); + if(message.getCorrect() == 1){ + Log_orderSuccess.info("设备"+attendanceTimeVo.getSn()+"时段"+attendanceTimeVo.getShiduan()+"!!设置成功"); + }else { + Log_orderFail.info("设备"+attendanceTimeVo.getSn()+"时段"+attendanceTimeVo.getShiduan()+"!!设置失败"); + isSuccess = false ; + } + } + return isSuccess; + } + + + @ApiOperation("单个卡号的权限添加或修改") + @RequestMapping(value = "setSignalCardInfo" , method = RequestMethod.POST) + public boolean setSignalCardInfo(@RequestBody SignalCardInfoVo signalCardInfoVo){ + String functionId = smFeign.selectOutOrderId(signalCardInfoVo.getType(),signalCardInfoVo.getId()); + String cardNo = initCardNo(signalCardInfoVo.getCardNo()); + long messageId = WatchServer.SetSignalCardInfo(xaFeign,signalCardInfoVo.getSn(),functionId,cardNo, + signalCardInfoVo.getShiduan(),signalCardInfoVo.getStartTime(),signalCardInfoVo.getEndTime()); + SendMessageDto message = getResult(messageId); + UserDto user = smFeign.selectUserByCardNum(cardNo); + StudentCardDto studentCard = smFeign.selectStudentCard(cardNo); + SchoolDto school = smFeign.selectSchoolBySchoolId(user.getSchoolId()); + UpdateCardDto updateCard = smFeign.selectUpdateCardByUpdateId(signalCardInfoVo.getUpdateId()); + if(message.getCorrect() == 1){ + Log_orderSuccess.info("设备"+signalCardInfoVo.getSn()+"时段"+signalCardInfoVo.getShiduan()+"卡号"+cardNo+"!!设置成功"); + SendSuccessDto sendSuccess = new SendSuccessDto(user,school,studentCard,updateCard); + sendSuccess.setDeviceId(signalCardInfoVo.getSn()+""); + sendSuccess.setShiduan(signalCardInfoVo.getShiduan()); + sendSuccess.setCardNum(cardNo); + sendSuccess.setUpdateId(signalCardInfoVo.getUpdateId()); + sendSuccess.setOpenFlag(1); + sendSuccess.setStatus(1); + xaFeign.insertSendSuccess(sendSuccess); + }else { + Log_orderFail.info("设备"+signalCardInfoVo.getSn()+"时段"+signalCardInfoVo.getShiduan()+"卡号"+cardNo+"!!设置失败"); + SendFailDto sendFail = new SendFailDto(user,school,studentCard,updateCard); + sendFail.setDeviceId(signalCardInfoVo.getSn()+""); + sendFail.setShiduan(signalCardInfoVo.getShiduan()); + sendFail.setCardNum(cardNo); + sendFail.setUpdateId(signalCardInfoVo.getUpdateId()); + sendFail.setOpenFlag(1); + sendFail.setStatus(1); + sendFail.setFailType(2); + sendFail.setFailContent("其他"); + xaFeign.insertSendFail(sendFail); + } + return message.getCorrect() == 1; + } + + + @ApiOperation("清除单个卡号权限") + @RequestMapping(value = "clearSinglePower" , method = RequestMethod.POST) + public boolean clearSinglePower(@RequestBody CardInfo cardInfo){ + String functionId = smFeign.selectOutOrderId(cardInfo.getType(),cardInfo.getId()); + String cardNo = initCardNo(cardInfo.getCardNo()); + long messageId = WatchServer.clearSinglePower(xaFeign,cardInfo.getSn(),functionId,cardNo); + SendMessageDto message = getResult(messageId); + if(message.getCorrect() == 1){ + Log_orderSuccess.info("卡号"+cardNo+"清除权限成功"); + SendSuccessDto sendSuccess = new SendSuccessDto(); + sendSuccess.setCardNum(cardNo); + sendSuccess.setDeviceId(cardInfo.getSn()+""); + xaFeign.updateSendSuccess(sendSuccess); + }else { + Log_orderFail.info("卡号"+cardNo+"清除权限失败"); + } + return message.getCorrect() == 1 ; + } + + @ApiOperation("清除全部权限") + @RequestMapping(value = "clearAllPower" , method = RequestMethod.POST) + public boolean clearAllPower(@RequestBody CleanShiDuanVo cleanShiDuanVo){ + String functionId = smFeign.selectOutOrderId(cleanShiDuanVo.getType(),cleanShiDuanVo.getId()); + long messageId = WatchServer.clearAllPower(xaFeign,cleanShiDuanVo.getSn(),functionId); + SendMessageDto message = getResult(messageId); + if(message.getCorrect() == 1){ + Log_orderSuccess.info("设备"+cleanShiDuanVo.getSn()+"清除权限成功"); + SendSuccessDto sendSuccess = new SendSuccessDto(); + sendSuccess.setDeviceId(cleanShiDuanVo.getSn()+""); + xaFeign.updateSendSuccess(sendSuccess); + }else { + Log_orderFail.info("设备"+cleanShiDuanVo.getSn()+"清除权限失败"); + } + return message.getCorrect() == 1 ; + } + + + @ApiOperation("清除时段") + @RequestMapping(value = "clearShiDuan" , method = RequestMethod.POST) + public boolean clearShiDuan(@RequestBody CleanShiDuanVo cleanShiDuanVo){ + String functionId = smFeign.selectOutOrderId(cleanShiDuanVo.getType(),cleanShiDuanVo.getId()); + long messageId = WatchServer.clearShiDuan(xaFeign,cleanShiDuanVo.getSn(),functionId); + SendMessageDto sendMessage = getResult(messageId); + if(sendMessage.getCorrect() == 1){ + Log_orderSuccess.info("设备"+cleanShiDuanVo.getSn()+"时段清除成功"); + }else { + Log_orderFail.info("设备"+cleanShiDuanVo.getSn()+"时段清除失败"); + } + return sendMessage.getCorrect() == 1; + } + + @ApiOperation("查询单个卡号 权限") + @RequestMapping(value = "searchPower" , method = RequestMethod.POST) + public boolean searchPower(@RequestBody CardInfo cardInfo){ + String functionId = smFeign.selectOutOrderId(cardInfo.getType(),cardInfo.getId()); + String cardNo = initCardNo(cardInfo.getCardNo()); + long messageId = WatchServer.searchPower(xaFeign,cardInfo.getSn(),functionId,cardNo); + SendMessageDto sendMessage = getResult(messageId); + if(sendMessage.getCorrect() == 1){ + Log_orderSuccess.info("设备"+cardInfo.getSn()+"卡号"+cardNo+"查询权限成功"); + }else { + Log_orderFail.info("设备"+cardInfo.getSn()+"卡号"+cardNo+"查询权限失败"); + } + return sendMessage.getCorrect() == 1; + } + + @RequestMapping(value = "watch" , method = RequestMethod.GET) + public int watch(){ + return 1 ; + } + + private SendMessageDto getResult(long messageId){ + try{ + Thread.sleep(300); + }catch (Exception e){ + + } + return xaFeign.selectById(messageId); + } + + private String initCardNo(String cardNo){ + while (cardNo.length() < 8){ + cardNo = "0" + cardNo ; + } + return cardNo ; + } +} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/dao/UserDao.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/dao/UserDao.java deleted file mode 100644 index 976e636..0000000 --- a/cloud/weigeng/src/main/java/com/sincere/weigeng/dao/UserDao.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.sincere.weigeng.dao; - -import com.sincere.weigeng.JiaoCai; -import com.sincere.weigeng.Knowledge; -import org.apache.ibatis.annotations.*; -import org.springframework.stereotype.Repository; - -import java.util.List; - -@Repository -@Mapper -public interface UserDao { - -// @Insert("insert into HS_StudentUpdateCard (Card,SchoolId,StudentCode,CustomerId,StudentType,UserType,ClassId,ClassName,IsNew,UpdateType,AddTime) " + -// "values (#{Card},#{SchoolId},#{StudentCode},#{CustomerId},#{StudentType},#{UserType},#{ClassId},#{ClassName},#{IsNew,#{UpdateType),#{AddTime}") -// void addStudentUpdate(@Param("Card") String card, @Param("SchoolId") int school_id, @Param("StudentCode") String studentCode, @Param("CustomerId") String CustomerId -// , @Param("StudentType") String StudentType, @Param("UserType") String UserType, @Param("ClassId") String ClassId, @Param("ClassName") String ClassName, -// @Param("IsNew") String IsNew, @Param("UpdateType") String UpdateType, @Param("AddTime") String AddTime); - - - @Select ("select * from ZY_YYKnowledge where AddTime >2019 ") - List getKnowledge(); - - @Select("select * from ZY_YYJiaoCai where ID >= 26") - List getJiaoCai(); - - @Insert("insert into ZY_YYJiaoCaiAndKnowledg values(#{id},#{id1},#{i},#{i1})") - void addKnowAndJicaoCai(@Param("id") String id, @Param("id1") String id1, @Param("i") int i, @Param("i1") int i1); -} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/feign/SmFeign.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/feign/SmFeign.java new file mode 100644 index 0000000..3bd6bb0 --- /dev/null +++ b/cloud/weigeng/src/main/java/com/sincere/weigeng/feign/SmFeign.java @@ -0,0 +1,40 @@ +package com.sincere.weigeng.feign; + +import com.sincere.common.dto.smartCampus.SchoolDto; +import com.sincere.common.dto.smartCampus.StudentCardDto; +import com.sincere.common.dto.smartCampus.UpdateCardDto; +import com.sincere.common.dto.smartCampus.UserDto; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; + +/** + * @author chen + * @version 1.0 + * @date 2019/11/12 0012 11:08 + */ +@FeignClient("smartCampusSearch") +public interface SmFeign { + + @RequestMapping(value = "/sm/wg/updateLinkTime",method = RequestMethod.GET) + int updateLinkTime(@RequestParam("sno") String sno); + + @RequestMapping(value = "/sm/wg/selectOutOrderId",method = RequestMethod.GET) + String selectOutOrderId(@RequestParam("type") int type, @RequestParam("insideOrderId") int insideOrderId); + + @RequestMapping(value = "/sm/wg/checkLeave",method = RequestMethod.GET) + String checkLeave(@RequestParam("cardNo") String cardNo); + + @RequestMapping(value = "/sm/wg/selectSchoolBySchoolId",method = RequestMethod.GET) + SchoolDto selectSchoolBySchoolId(@RequestParam("schoolId") int schoolId); + + @RequestMapping(value = "/sm/wg/selectUserByCardNum",method = RequestMethod.GET) + UserDto selectUserByCardNum(@RequestParam("cardNum") String cardNum); + + @RequestMapping(value = "/sm/wg/selectUpdateCardByUpdateId",method = RequestMethod.GET) + UpdateCardDto selectUpdateCardByUpdateId(@RequestParam("updateId") int updateId); + + @RequestMapping(value = "/sm/wg/selectStudentCard",method = RequestMethod.GET) + StudentCardDto selectStudentCard(@RequestParam("cardNum") String cardNum); +} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/feign/XaFeign.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/feign/XaFeign.java new file mode 100644 index 0000000..eb9836c --- /dev/null +++ b/cloud/weigeng/src/main/java/com/sincere/weigeng/feign/XaFeign.java @@ -0,0 +1,47 @@ +package com.sincere.weigeng.feign; + +import com.sincere.common.dto.xiaoan.*; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; + +/** + * @author chen + * @version 1.0 + * @date 2019/11/12 0012 11:12 + */ +@FeignClient("xiaoanSearch") +public interface XaFeign { + + @RequestMapping(value = "/xa/wg/checkIn",method = RequestMethod.POST) + CheckOutDto checkIn(@RequestBody CheckInDto checkInDto); + + @RequestMapping(value = "/xa/wg/insertMessage",method = RequestMethod.POST) + long insertMessage(@RequestBody SendMessageDto sendMessageDto); + + @RequestMapping(value = "/xa/wg/selectById",method = RequestMethod.GET) + SendMessageDto selectById(@RequestParam("id") long id); + + @RequestMapping(value = "/xa/wg/selectMessage",method = RequestMethod.GET) + SendMessageDto selectMessage(@RequestParam("deviceId") String deviceId, @RequestParam("index") long index,@RequestParam("functionId") String functionId); + + @RequestMapping(value = "/xa/wg/updateMessage",method = RequestMethod.GET) + int updateMessage(@RequestParam("id") long id, @RequestParam("result") String result, @RequestParam("correct") int correct); + + @RequestMapping(value = "/xa/wg/insertPassFail",method = RequestMethod.POST) + int insertPassFail(@RequestBody PassFailDto passFailDto); + + @RequestMapping(value = "/xa/wg/insertSendSuccess",method = RequestMethod.POST) + int insertSendSuccess(@RequestBody SendSuccessDto sendSuccessDto); + + @RequestMapping(value = "/xa/wg/insertSendFail",method = RequestMethod.POST) + int insertSendFail(@RequestBody SendFailDto sendFailDto); + + @RequestMapping(value = "/xa/wg/deleteSendFail",method = RequestMethod.POST) + int deleteSendFail(@RequestBody SendFailDto sendFailDto); + + @RequestMapping(value = "/xa/wg/deleteSendFail",method = RequestMethod.POST) + int updateSendSuccess(@RequestBody SendSuccessDto sendSuccessDto); +} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/logs/LogName.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/logs/LogName.java new file mode 100644 index 0000000..a3d2a0b --- /dev/null +++ b/cloud/weigeng/src/main/java/com/sincere/weigeng/logs/LogName.java @@ -0,0 +1,39 @@ +package com.sincere.weigeng.logs; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/12 0012 16:18 + */ +public enum LogName { + orderSuccess("orderSuccess"), + orderFail("orderFail"), + kaoInfo("kaoInfo"), + heartBeat("heartBeat"), + error("error"); + + private String logFileName; + + LogName(String fileName) { + this.logFileName = fileName; + } + + public String getLogFileName() { + return logFileName; + } + + public void setLogFileName(String logFileName) { + this.logFileName = logFileName; + } + + public static LogName getAwardTypeEnum(String value) { + LogName[] arr = values(); + for (LogName item : arr) { + if (null != item && !item.logFileName.equals("")) { + return item; + } + } + return null; + } +} + diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/logs/LoggerUtils.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/logs/LoggerUtils.java new file mode 100644 index 0000000..4cc38fc --- /dev/null +++ b/cloud/weigeng/src/main/java/com/sincere/weigeng/logs/LoggerUtils.java @@ -0,0 +1,27 @@ +package com.sincere.weigeng.logs; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/12 0012 16:19 + */ +public class LoggerUtils { + + public static Logger Logger(Class clazz) { + return LoggerFactory.getLogger(clazz); + } + + /** + * 打印到指定的文件下 + * + * @param desc 日志文件名称 + * @return + */ + public static Logger Logger(LogName desc) { + return LoggerFactory.getLogger(desc.getLogFileName()); + } + +} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/logs/MyTimeBasedFileNamingAndTriggeringPolicy.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/logs/MyTimeBasedFileNamingAndTriggeringPolicy.java new file mode 100644 index 0000000..10ce6b5 --- /dev/null +++ b/cloud/weigeng/src/main/java/com/sincere/weigeng/logs/MyTimeBasedFileNamingAndTriggeringPolicy.java @@ -0,0 +1,32 @@ +package com.sincere.weigeng.logs; + +import ch.qos.logback.core.joran.spi.NoAutoStart; +import ch.qos.logback.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/31 0031 13:42 + */ +@NoAutoStart +public class MyTimeBasedFileNamingAndTriggeringPolicy extends DefaultTimeBasedFileNamingAndTriggeringPolicy { + + //这个用来指定时间间隔 + private Integer multiple = 1; + + @Override + protected void computeNextCheck() { + nextCheck = rc.getEndOfNextNthPeriod(dateInCurrentPeriod, multiple).getTime(); + } + + public Integer getMultiple() { + return multiple; + } + + public void setMultiple(Integer multiple) { + if (multiple > 1) { + this.multiple = multiple; + } + } + +} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/utils/WGUtils.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/utils/WGUtils.java new file mode 100644 index 0000000..7202b66 --- /dev/null +++ b/cloud/weigeng/src/main/java/com/sincere/weigeng/utils/WGUtils.java @@ -0,0 +1,133 @@ +package com.sincere.weigeng.utils; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/14 0014 11:03 + */ +public class WGUtils { + + //指令转换 message 10进制 要先转16 在转byte + public static Byte toFunctionHex(String message){ + Integer i = Integer.valueOf(message) ; + if(i > 127){ + i = i-256 ; + } + return Byte.valueOf(i+""); + } + + //短报文 转化 message 16进制 要先转16 在转byte + public static Byte toHex(String message){ + Integer i = Integer.valueOf(message,16) ; + if(i > 127){ + i = i-256 ; + } + return Byte.valueOf(i+""); + } + + public static String getCardNo(byte[] buff, int start, int len){ + String cardNo = "" ; + for(int i = start ; i < start+len ; i++){ + cardNo += byte2Hex(buff[i]); + } + return cardNo; + } + + public static String byte2Hex(byte b){ + int i = b ; + if( b < 0){ + i = b + 256 ; + } + String result = Integer.toHexString(i).toUpperCase() ; + if(result.length() == 1){ + result = "0"+result; + } + return result; + } + + //4字节转成整型数(低位前, 高位后) + public static int byteToInt(byte[] buff, int start, int len) { + int val = 0; + for (int i = 0; i < len && i < 4; i++) + { + long lng = buff[i + start]; + val += (lng << (8 * i)); + } + return val; + } + + //4字节转成整型数(低位前, 高位后) + public static long byteToLong(byte[] buff, int start, int len) { + long val = 0; + for (int i = 0; i < len && i < 4; i++) + { + long lng = buff[i + start]; + val += (lng << (8 * i)); + } + return val; + } + + //获取Hex值, 主要用于日期时间格式 + public static byte getHex(int val) { + return (byte)((val % 10) + (((val -(val % 10)) / 10)%10) *16); + } + + + public static String getReasonDetailChinese(int Reason){ + if (Reason > 45) { + return ""; + } + if (Reason <= 0) { + return ""; + } + return RecordDetails[(Reason - 1) * 4 + 3]; //中文信息 + } + + public static String RecordDetails[] = { + "1","SwipePass","Swipe","刷卡开门", + "2","SwipePass","Swipe Close","刷卡关", + "3","SwipePass","Swipe Open","刷卡开", + "4","SwipePass","Swipe Limited Times","刷卡开门(带限次)", + "5","SwipeNOPass","Denied Access: PC Control","刷卡禁止通过: 电脑控制", + "6","SwipeNOPass","Denied Access: No PRIVILEGE","刷卡禁止通过: 没有权限", + "7","SwipeNOPass","Denied Access: Wrong PASSWORD","刷卡禁止通过: 密码不对", + "8","SwipeNOPass","Denied Access: AntiBack","刷卡禁止通过: 反潜回", + "9","SwipeNOPass","Denied Access: More Cards","刷卡禁止通过: 多卡", + "10","SwipeNOPass","Denied Access: First Card Open","刷卡禁止通过: 首卡", + "11","SwipeNOPass","Denied Access: Door Set NC","刷卡禁止通过: 门为常闭", + "12","SwipeNOPass","Denied Access: InterLock","刷卡禁止通过: 互锁", + "13","SwipeNOPass","Denied Access: Limited Times","刷卡禁止通过: 受刷卡次数限制", + "14","SwipeNOPass","Denied Access: Limited Person Indoor","刷卡禁止通过: 门内人数限制", + "15","SwipeNOPass","Denied Access: Invalid Timezone","刷卡禁止通过: 卡过期或不在有效时段", + "16","SwipeNOPass","Denied Access: In Order","刷卡禁止通过: 按顺序进出限制", + "17","SwipeNOPass","Denied Access: SWIPE GAP LIMIT","刷卡禁止通过: 刷卡间隔约束", + "18","SwipeNOPass","Denied Access","刷卡禁止通过: 原因不明", + "19","SwipeNOPass","Denied Access: Limited Times","刷卡禁止通过: 刷卡次数限制", + "20","ValidEvent","Push Button","按钮开门", + "21","ValidEvent","Push Button Open","按钮开", + "22","ValidEvent","Push Button Close","按钮关", + "23","ValidEvent","Door Open","门打开[门磁信号]", + "24","ValidEvent","Door Closed","门关闭[门磁信号]", + "25","ValidEvent","Super Password Open Door","超级密码开门", + "26","ValidEvent","Super Password Open","超级密码开", + "27","ValidEvent","Super Password Close","超级密码关", + "28","Warn","Controller Power On","控制器上电", + "29","Warn","Controller Reset","控制器复位", + "30","Warn","Push Button Invalid: Disable","按钮不开门: 按钮禁用", + "31","Warn","Push Button Invalid: Forced Lock","按钮不开门: 强制关门", + "32","Warn","Push Button Invalid: Not On Line","按钮不开门: 门不在线", + "33","Warn","Push Button Invalid: InterLock","按钮不开门: 互锁", + "34","Warn","Threat","胁迫报警", + "35","Warn","Threat Open","胁迫报警开", + "36","Warn","Threat Close","胁迫报警关", + "37","Warn","Open too long","门长时间未关报警[合法开门后]", + "38","Warn","Forced Open","强行闯入报警", + "39","Warn","Fire","火警", + "40","Warn","Forced Close","强制关门", + "41","Warn","Guard Against Theft","防盗报警", + "42","Warn","7*24Hour Zone","烟雾煤气温度报警", + "43","Warn","Emergency Call","紧急呼救报警", + "44","RemoteOpen","Remote Open Door","操作员远程开门", + "45","RemoteOpen","Remote Open Door By USB Reader","发卡器确定发出的远程开门" + }; +} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/utils/WatchServer.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/utils/WatchServer.java new file mode 100644 index 0000000..b358ad3 --- /dev/null +++ b/cloud/weigeng/src/main/java/com/sincere/weigeng/utils/WatchServer.java @@ -0,0 +1,509 @@ +package com.sincere.weigeng.utils; + + +import com.sincere.common.dto.smartCampus.UserDto; +import com.sincere.common.dto.xiaoan.CheckInDto; +import com.sincere.common.dto.xiaoan.CheckOutDto; +import com.sincere.common.dto.xiaoan.PassFailDto; +import com.sincere.common.dto.xiaoan.SendMessageDto; +import com.sincere.common.util.DateUtils; +import com.sincere.weigeng.feign.SmFeign; +import com.sincere.weigeng.feign.XaFeign; +import com.sincere.weigeng.logs.LogName; +import com.sincere.weigeng.logs.LoggerUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.mina.core.session.IoSession; +import org.apache.mina.transport.socket.DatagramSessionConfig; +import org.apache.mina.transport.socket.nio.NioDatagramAcceptor; +import org.slf4j.Logger; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/12 0012 16:57 + */ +public class WatchServer { + + private static final Logger Log_orderSuccess = LoggerUtils.Logger(LogName.orderSuccess); + private static final Logger Log_orderFail = LoggerUtils.Logger(LogName.orderFail); + private static final Logger Log_kaoInfo = LoggerUtils.Logger(LogName.kaoInfo); + private static final Logger Log_heartBeat = LoggerUtils.Logger(LogName.heartBeat); + private static final Logger Log_error = LoggerUtils.Logger(LogName.error); + + private static List snoList = new ArrayList<>(); + private static List indexList = new ArrayList<>(); + private static WatchingShortHandler watchingShortHandler ; + private static Queue queue = new LinkedList<>(); + private static Map sessionMap = new ConcurrentHashMap<>(); + + // 进入服务器监控状态 + public static int WatchingServerRunning(String watchServerIP,int watchServerPort, + SmFeign smFeign ,XaFeign xaFeign) { + watchingShortHandler = new WatchingShortHandler(queue,sessionMap); + // 创建UDP数据包NIO + NioDatagramAcceptor acceptor = new NioDatagramAcceptor(); + // NIO设置底层IOHandler + acceptor.setHandler(watchingShortHandler); + + // 设置是否重用地址? 也就是每个发过来的udp信息都是一个地址? + DatagramSessionConfig dcfg = acceptor.getSessionConfig(); + dcfg.setReuseAddress(false); + // 绑定端口地址 + try { + acceptor.bind(new InetSocketAddress(watchServerIP, watchServerPort)); + } catch (IOException e) { + Log_orderSuccess.info("绑定接收服务器失败...."); + e.printStackTrace(); + return 0; + } + Log_orderSuccess.info("绑定接收服务器成功...."); + long recordIndex = 0; + while(true) { + if (!queue.isEmpty()) { + byte[] recvBuff; + synchronized (queue) { + recvBuff= queue.poll(); + } + if (recvBuff[1]== 0x20) { + long sn = WgUdpCommShort.getLongByByte(recvBuff, 4, 4); + smFeign.updateLinkTime(sn+""); + Log_heartBeat.info("设备"+sn); + boolean isExist = true ; + long recordIndexGet = WgUdpCommShort.getLongByByte(recvBuff, 8, 4); + if(snoList.indexOf(sn) >= 0){ + int number = snoList.indexOf(sn); + recordIndex = indexList.get(number); + indexList.set(number,recordIndexGet); + }else { + snoList.add(sn); + recordIndex = 0 ; + indexList.add(recordIndexGet); + System.out.println("设备"+sn+"上线"); + isExist = false ; + } + if(isExist){ + if (recordIndex < recordIndexGet || (recordIndexGet - recordIndex) < -5) { + watching(recvBuff,smFeign,xaFeign); + } + } + }else { + push(recvBuff,xaFeign); + } + } else { + long times = 100; + try { + Thread.sleep(times); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + } + + private static void watching(byte[] recv,SmFeign smFeign ,XaFeign xaFeign){ + long res = 0; + //8-11 记录的索引号 + //(=0表示没有记录) 4 0x00000000 + int recordIndex = 0; + recordIndex = WGUtils.byteToInt(recv, 8, 4); + //12 记录类型********************************************** + //0=无记录 + //1=刷卡记录 + //2=门磁,按钮, 设备启动, 远程开门记录 + //3=报警记录 1 + //0xFF=表示指定索引位的记录已被覆盖掉了. 请使用索引0, 取回最早一条记录的索引值 + int recordType = recv[12]; + + //13 有效性(0 表示不通过, 1表示通过) 1 + int recordValid = recv[13]; + + //14 门号(1,2,3,4) 1 业务需要-->1出2进 + int recordDoorNO = recv[14]; + + //15 进门/出门(1表示进门, 2表示出门) 1 0x01 + //int recordInOrOut = recv[15]; + + //16-19 卡号(类型是刷卡记录时) + //或编号(其他类型记录) 4 + String cardNo = WGUtils.getCardNo(recv, 16, 4); + + //20-26 刷卡时间: + //年月日时分秒 (采用BCD码)见设置时间部分的说明 + String recordTime = "2000-01-01 00:00:00"; + recordTime = String.format("%02X%02X-%02X-%02X %02X:%02X:%02X", + recv[20], recv[21], recv[22], recv[23], recv[24], recv[25], recv[26]); + //2012.12.11 10:49:59 7 + //27 记录原因代码(可以查 “刷卡记录说明.xls”文件的ReasonNO) + //处理复杂信息才用 1 + int reason = recv[27]; + if (recordType == 0) { + Log_orderSuccess.info(String.format("索引位={0} 无记录", recordIndex)); + }else if (recordType == 0xff) { + Log_orderSuccess.info("指定索引位的记录已被覆盖掉了,请使用索引0, 取回最早一条记录的索引值"); + } else if (recordType == 1) { + long sno = 0; + sno = WgUdpCommShort.getLongByByte(recv, 4, 4);//解析设备号 + String msg = "索引位=" + recordIndex + + ",卡号=" + cardNo + +"进出=" + (recordDoorNO == 1 ? "出门" : "进门") + + ",有效=" + (recordValid == 1 ? "通过" : "禁止") + + ",时间=" + recordTime + + ",描述=" + WGUtils.getReasonDetailChinese(reason) + ""; + Log_orderSuccess.info("控制器:" + sno + msg); + if(recordValid == 1) { + //有效刷卡调考勤存储过程 + CheckInDto checkIn = new CheckInDto(); + checkIn.setDeviceId(sno+""); + checkIn.setCardNo(cardNo); + checkIn.setFunNo(8); + checkIn.setFlag(recordDoorNO == 1 ? 1 : 0); + checkIn.setCheckTime(recordTime); + CheckOutDto checkOutDto = xaFeign.checkIn(checkIn); + if(checkOutDto.getIsSuccess() == 1){ + //考勤成功 + Log_kaoInfo.info("考勤成功!,设备:"+sno+"卡号:"+cardNo+"方向:"+(recordDoorNO == 1 ? "出门" : "进门")+"______"+ recordTime); + }else { + //考勤失败 + Log_orderFail.error("考勤失败!,设备:"+sno+"卡号:"+cardNo + "---"+ checkOutDto.getOut()); + } + }else { + //判断是否请假 + String studentNum = smFeign.checkLeave(cardNo); + if (StringUtils.isNotBlank(studentNum)) { + int outOf = recordDoorNO == 1 ? 1 : 0; + //远程开门 + openDoor(xaFeign,sno,"64",recordDoorNO,cardNo); + Log_orderSuccess.info("请假开门成功"+cardNo); + } else { + //没有请假不做任何处理,则是刷卡异常,入库 + UserDto user = smFeign.selectUserByCardNum(cardNo); + PassFailDto passFail = new PassFailDto(); + passFail.setCardNum(cardNo); + passFail.setDeviceId(sno+""); + passFail.setDirection((recordDoorNO == 1 ? "出门" : "进门")); + passFail.setResultIntro(WGUtils.getReasonDetailChinese(reason)); + passFail.setInTime(DateUtils.string2Date(recordTime, DateUtils.format2)); + passFail.setCreateTime(new Date()); + passFail.setSchoolId(user.getSchoolId()); + xaFeign.insertPassFail(passFail); + } + } + } + } + + private static void push(byte[] recv,XaFeign xaFeign){ + long index = WgUdpCommShort.getXidOfCommand(recv); + long sno = WgUdpCommShort.getLongByByte(recv, 4, 4); + String functionId = WGUtils.byte2Hex(recv[1]); + SendMessageDto sendMessage = xaFeign.selectMessage(sno+"",index,functionId); + if(sendMessage != null){ + if(recv[8] == 1){ + sendMessage.setCorrect(1); + }else { + sendMessage.setCorrect(0); + } + StringBuffer result = new StringBuffer(); + for(byte b : recv){ + result.append(WGUtils.byte2Hex(b)).append("-"); + } + sendMessage.setResult(result.toString().substring(0,result.toString().length()-1)); + xaFeign.updateMessage(sendMessage.getId(),sendMessage.getResult(),sendMessage.getCorrect()); + } + } + + //远程开门 + public static long openDoor(XaFeign xaFeign,long sno , String outsideOrderId,int doorNo , String cardNo){ + WgUdpCommShort pkt = new WgUdpCommShort(); + pkt.iDevSn = sno; + try{ + int doorNO =doorNo; + pkt.Reset(); + pkt.functionID = WGUtils.toFunctionHex(outsideOrderId); + pkt.data[0] =(byte) (doorNO & 0xff); + if(StringUtils.isNotBlank(cardNo)){ + pkt.data[20] = WGUtils.toHex(cardNo.substring(0,2)); + pkt.data[21] = WGUtils.toHex(cardNo.substring(2,4)); + pkt.data[22] = WGUtils.toHex(cardNo.substring(4,6)); + pkt.data[23] = WGUtils.toHex(cardNo.substring(6,8)); + } + byte[] bytes = pkt.toByte(); + long index = WgUdpCommShort.getXidOfCommand(bytes); + long result = insert(xaFeign,sno+"",outsideOrderId,cardNo,index,bytes); + pkt.run(watchingShortHandler.getSessionMap().get(sno),bytes); + return result ; + }catch (Exception e){ + Log_error.error(e.toString()); + } + return 0L; + } + + //重置控制板时间 + public static long setTime(XaFeign xaFeign,long sno , String outsideOrderId){ + WgUdpCommShort pkt = new WgUdpCommShort(); + pkt.iDevSn = sno; + try{ + pkt.Reset(); + pkt.functionID = WGUtils.toFunctionHex(outsideOrderId); + Calendar cal = (Calendar.getInstance()); + pkt.data[0] = WGUtils.toHex(String.valueOf(cal.get(Calendar.YEAR)).substring(0,2)); + pkt.data[1] = WGUtils.toHex(String.valueOf(cal.get(Calendar.YEAR)).substring(2,4)); + pkt.data[2] = WGUtils.toHex(String.valueOf(cal.get(Calendar.MONTH)+1)); + pkt.data[3] = WGUtils.toHex(String.valueOf(cal.get(Calendar.DATE))); + pkt.data[4] =WGUtils.toHex(String.valueOf(cal.get(Calendar.HOUR_OF_DAY))); + pkt.data[5] =WGUtils.toHex(String.valueOf(cal.get(Calendar.MINUTE))); + pkt.data[6] = WGUtils.toHex(String.valueOf(cal.get(Calendar.SECOND))); + byte[] bytes = pkt.toByte(); + long index = WgUdpCommShort.getXidOfCommand(bytes); + long result = insert(xaFeign,sno+"",outsideOrderId,null,index,bytes); + pkt.run(watchingShortHandler.getSessionMap().get(sno),bytes); + return result ; + }catch (Exception e){ + Log_error.error(e.toString()); + } + return 0L; + } + + + + //设置考勤时段 + public static List SetAttendanceTime(XaFeign xaFeign,long sno ,String outsideOrderId, int shiduan , Date begin ,Date end , + int isMonDay ,int isTuesDay , int isWednesDay ,int isThursDay , int isFriday , + int isSaturDay , int isWeekend , String shiqu){ + List resultList = new ArrayList<>(); + WgUdpCommShort pkt = new WgUdpCommShort(); + pkt.iDevSn = sno; + try{ + pkt.Reset(); + pkt.functionID = WGUtils.toFunctionHex(outsideOrderId); + String[] shiQuArray = shiqu.split(","); + int shiDuanCount = shiQuArray.length / 6 ; + for (int i = 0; i < shiDuanCount; i++){ + if (i == 0) { + pkt.data[0] = WGUtils.toHex(shiduan+""); + } else { + pkt.data[0] = WGUtils.toHex((shiduan+20*i)+""); + } + Calendar c = Calendar.getInstance(); + c.setTime(begin); + //开始时间 20 19 01 01 + pkt.data[1] = WGUtils.toHex(String.valueOf(c.get(Calendar.YEAR)).substring(0,2)); + pkt.data[2] = WGUtils.toHex(String.valueOf(c.get(Calendar.YEAR)).substring(2,4)); + pkt.data[3] = WGUtils.toHex(String.valueOf(c.get(Calendar.MONTH)+1)); + pkt.data[4] = WGUtils.toHex(String.valueOf(c.get(Calendar.DATE))); + //结束时间 + c.setTime(end); + pkt.data[5] = WGUtils.toHex(String.valueOf(c.get(Calendar.YEAR)).substring(0,2)); + pkt.data[6] = WGUtils.toHex(String.valueOf(c.get(Calendar.YEAR)).substring(2,4)); + pkt.data[7] = WGUtils.toHex(String.valueOf(c.get(Calendar.MONTH)+1)); + pkt.data[8] = WGUtils.toHex(String.valueOf(c.get(Calendar.DATE))); + //星期几 有效 + pkt.data[9] = WGUtils.toHex(String.valueOf(isMonDay)); + pkt.data[10] = WGUtils.toHex(String.valueOf(isTuesDay)); + pkt.data[11] = WGUtils.toHex(String.valueOf(isWednesDay)); + pkt.data[12] = WGUtils.toHex(String.valueOf(isThursDay)); + pkt.data[13] = WGUtils.toHex(String.valueOf(isFriday)); + pkt.data[14] = WGUtils.toHex(String.valueOf(isSaturDay)); + pkt.data[15] = WGUtils.toHex(String.valueOf(isWeekend)); + //有效时区 + pkt.data[16] = WGUtils.toHex(shiQuArray[i * 6 + 0].substring(0, 2)); + pkt.data[17] = WGUtils.toHex(shiQuArray[i * 6 + 0].substring(3, 5)); + + pkt.data[18] = WGUtils.toHex(shiQuArray[i * 6 + 1].substring(0, 2)); + pkt.data[19] = WGUtils.toHex(shiQuArray[i * 6 + 1].substring(3, 5)); + + pkt.data[20] = WGUtils.toHex(shiQuArray[i * 6 + 2].substring(0, 2)); + pkt.data[21] = WGUtils.toHex(shiQuArray[i * 6 + 2].substring(3, 5)); + + pkt.data[22] = WGUtils.toHex(shiQuArray[i * 6 + 3].substring(0, 2)); + pkt.data[23] = WGUtils.toHex(shiQuArray[i * 6 + 3].substring(3, 5)); + + pkt.data[24] = WGUtils.toHex(shiQuArray[i * 6 + 4].substring(0, 2)); + pkt.data[25] = WGUtils.toHex(shiQuArray[i * 6 + 4].substring(3, 5)); + + pkt.data[26] = WGUtils.toHex(shiQuArray[i * 6 + 5].substring(0, 2)); + pkt.data[27] = WGUtils.toHex(shiQuArray[i * 6 + 5].substring(3, 5)); + if (shiDuanCount != 1) { + //需要链接时段 + if (i != shiDuanCount - 1) { + //只要不是最后一个时段 + pkt.data[28] = WGUtils.toHex((shiduan+20*(i+1)+"")); + } else { + pkt.data[28] = 0; + } + } else { + pkt.data[28] = 0; + } + byte[] bytes = pkt.toByte(); + long index = WgUdpCommShort.getXidOfCommand(bytes); + long result = insert(xaFeign,sno+"",outsideOrderId,null,index,bytes); + pkt.run(watchingShortHandler.getSessionMap().get(sno),bytes); + resultList.add(result); + } + return resultList ; + }catch (Exception e){ + Log_error.error(e.toString()); + } + return resultList; + } + + + //设置权限 + public static long SetSignalCardInfo(XaFeign xaFeign,long sno , String outsideOrderId, String cardNo , int shiduan , Date begin , Date end){ + WgUdpCommShort pkt = new WgUdpCommShort(); + pkt.iDevSn = sno; + try{ + pkt.Reset(); + pkt.functionID = WGUtils.toFunctionHex(outsideOrderId); + pkt.iDevSn = sno; + //0D D7 37 00 + pkt.data[0] = WGUtils.toHex(cardNo.substring(0,2)); + pkt.data[1] = WGUtils.toHex(cardNo.substring(2,4)); + pkt.data[2] = WGUtils.toHex(cardNo.substring(4,6)); + pkt.data[3] = WGUtils.toHex(cardNo.substring(6,8)); + + //20 10 01 01 起始日期: 2010年01月01日 (必须大于2001年) + Calendar c = Calendar.getInstance(); + c.setTime(begin); + pkt.data[4] = WGUtils.toHex(String.valueOf(c.get(Calendar.YEAR)).substring(0,2)); + pkt.data[5] = WGUtils.toHex(String.valueOf(c.get(Calendar.YEAR)).substring(2,4)); + pkt.data[6] = WGUtils.toHex(String.valueOf(c.get(Calendar.MONTH)+1)); + pkt.data[7] = WGUtils.toHex(String.valueOf(c.get(Calendar.DATE))); + //20 29 12 31 截止日期: 2029年12月31日 + c.setTime(end); + pkt.data[8] = WGUtils.toHex(String.valueOf(c.get(Calendar.YEAR)).substring(0,2)); + pkt.data[9] = WGUtils.toHex(String.valueOf(c.get(Calendar.YEAR)).substring(2,4)); + pkt.data[10] = WGUtils.toHex(String.valueOf(c.get(Calendar.MONTH)+1)); + pkt.data[11] = WGUtils.toHex(String.valueOf(c.get(Calendar.DATE))); + //01 允许通过 一号门 [对单门, 双门, 四门控制器有效] + pkt.data[12] = WGUtils.toHex(shiduan+""); + //01 允许通过 二号门 [对双门, 四门控制器有效] + pkt.data[13] = WGUtils.toHex(shiduan+""); + //01 允许通过 三号门 [对四门控制器有效] + pkt.data[14] = WGUtils.toHex(shiduan+""); + //01 允许通过 四号门 [对四门控制器有效] + pkt.data[15] = WGUtils.toHex(shiduan+""); + byte[] bytes = pkt.toByte(); + long index = WgUdpCommShort.getXidOfCommand(bytes); + long result = insert(xaFeign,sno+"",outsideOrderId,cardNo,index,bytes); + pkt.run(watchingShortHandler.getSessionMap().get(sno),bytes); + return result ; + }catch (Exception e){ + Log_error.error(e.toString()); + } + return 0l; + } + + //删除单张卡权限 + public static long clearSinglePower(XaFeign xaFeign,long sno ,String outsideOrderId, String cardNo){ + WgUdpCommShort pkt = new WgUdpCommShort(); + pkt.iDevSn = sno; + try{ + pkt.Reset(); + pkt.functionID = WGUtils.toFunctionHex(outsideOrderId); + pkt.iDevSn = sno; + pkt.data[0] = WGUtils.toHex(cardNo.substring(0,2)); + pkt.data[1] = WGUtils.toHex(cardNo.substring(2,4)); + pkt.data[2] = WGUtils.toHex(cardNo.substring(4,6)); + pkt.data[3] = WGUtils.toHex(cardNo.substring(6,8)); + byte[] bytes = pkt.toByte(); + long index = WgUdpCommShort.getXidOfCommand(bytes); + long result = insert(xaFeign,sno+"",outsideOrderId,cardNo,index,bytes); + pkt.run(watchingShortHandler.getSessionMap().get(sno),bytes); + return result ; + }catch (Exception e){ + Log_error.error(e.toString()); + } + return 0l; + } + + //删除全部权限 + public static long clearAllPower(XaFeign xaFeign,long sno ,String outsideOrderId){ + WgUdpCommShort pkt = new WgUdpCommShort(); + pkt.iDevSn = sno; + try{ + pkt.Reset(); + pkt.functionID = WGUtils.toFunctionHex(outsideOrderId); + pkt.iDevSn = sno; + pkt.data[0] = (byte) 0x55 ; + pkt.data[1] = (byte) 0xAA ; + pkt.data[2] = (byte) 0xAA ; + pkt.data[3] = (byte) 0x55 ; + byte[] bytes = pkt.toByte(); + long index = WgUdpCommShort.getXidOfCommand(bytes); + long result = insert(xaFeign,sno+"",outsideOrderId,null,index,bytes); + pkt.run(watchingShortHandler.getSessionMap().get(sno),bytes); + return result ; + }catch (Exception e){ + Log_error.error(e.toString()); + } + return 0l; + } + + //查询卡权限 + public static long searchPower(XaFeign xaFeign,long sno ,String outsideOrderId, String cardNo){ + WgUdpCommShort pkt = new WgUdpCommShort(); + pkt.iDevSn = sno; + try{ + pkt.Reset(); + pkt.functionID = WGUtils.toFunctionHex(outsideOrderId); + pkt.iDevSn = sno; + pkt.data[0] = WGUtils.toHex(cardNo.substring(0,2)); + pkt.data[1] = WGUtils.toHex(cardNo.substring(2,4)); + pkt.data[2] = WGUtils.toHex(cardNo.substring(4,6)); + pkt.data[3] = WGUtils.toHex(cardNo.substring(6,8)); + byte[] bytes = pkt.toByte(); + long index = WgUdpCommShort.getXidOfCommand(bytes); + long result = insert(xaFeign,sno+"",outsideOrderId,cardNo,index,bytes); + pkt.run(watchingShortHandler.getSessionMap().get(sno),bytes); + return result ; + }catch (Exception e){ + Log_error.error(e.toString()); + } + return 0l; + } + + //删除时段 + public static long clearShiDuan(XaFeign xaFeign,long sno , String outsideOrderId){ + WgUdpCommShort pkt = new WgUdpCommShort(); + pkt.iDevSn = sno; + try{ + pkt.Reset(); + pkt.functionID = WGUtils.toFunctionHex(outsideOrderId); + pkt.iDevSn = sno; + pkt.data[0] = (byte) 0x55 ; + pkt.data[1] = (byte) 0xAA ; + pkt.data[2] = (byte) 0xAA ; + pkt.data[3] = (byte) 0x55 ; + byte[] bytes = pkt.toByte(); + long index = WgUdpCommShort.getXidOfCommand(bytes); + long result = insert(xaFeign,sno+"",outsideOrderId,null,index,bytes); + pkt.run(watchingShortHandler.getSessionMap().get(sno),bytes); + return result ; + }catch (Exception e){ + Log_error.error(e.toString()); + } + return 0l; + } + + private static long insert(XaFeign xaFeign ,String sn ,String functionId , String cardNo , long index , byte[] recv){ + + StringBuffer send = new StringBuffer(); + for(byte b : recv){ + send.append(WGUtils.byte2Hex(b)).append("-"); + } + SendMessageDto sendMessage = new SendMessageDto(); + sendMessage.setDeviceId(sn); + sendMessage.setFunctionId(Integer.toHexString(Integer.valueOf(functionId))); + sendMessage.setIndex(index); + sendMessage.setCardNo(cardNo); + sendMessage.setCreateTime(new Date()); + sendMessage.setSend(send.toString().substring(0,send.toString().length()-1)); + xaFeign.insertMessage(sendMessage); + return sendMessage.getId(); + } +} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/utils/WatchingShortHandler.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/utils/WatchingShortHandler.java new file mode 100644 index 0000000..32fcea8 --- /dev/null +++ b/cloud/weigeng/src/main/java/com/sincere/weigeng/utils/WatchingShortHandler.java @@ -0,0 +1,90 @@ +package com.sincere.weigeng.utils; + +import org.apache.mina.core.buffer.IoBuffer; +import org.apache.mina.core.service.IoHandlerAdapter; +import org.apache.mina.core.session.IdleStatus; +import org.apache.mina.core.session.IoSession; + +import java.util.Map; +import java.util.Queue; + + +/** + * Class the extends IoHandlerAdapter in order to properly handle + * connections and the data the connections send + * + * @author Apache MINA Project + */ +public class WatchingShortHandler extends IoHandlerAdapter { + + private Queue queue; + private Map sessionMap ; + public WatchingShortHandler(Queue queue , Map sessionMap) { + super(); + this.queue = queue; + this.sessionMap = sessionMap; + } + + /** + * 异常来关闭session + */ + @Override + public void exceptionCaught(IoSession session, Throwable cause) + throws Exception { + cause.printStackTrace(); + session.close(true); + } + + /** + * 服务器端收到一个消息 + */ + @Override + public void messageReceived(IoSession session, Object message) throws Exception { + IoBuffer io = (IoBuffer) message; + if (io.hasRemaining()) { + byte[] validBytes = new byte[io.remaining()]; + io.get(validBytes,0,io.remaining()); + if (validBytes.length == WgUdpCommShort.WGPacketSize) { + synchronized (queue) { + long sn = WgUdpCommShort.getLongByByte(validBytes, 4, 4); + sessionMap.put(sn,session); + queue.offer(validBytes); + } + } else { + } + } + } + + @Override + public void sessionClosed(IoSession session) throws Exception { + } + + @Override + public void sessionCreated(IoSession session) throws Exception { + } + + @Override + public void sessionIdle(IoSession session, IdleStatus status) + throws Exception { + } + + @Override + public void sessionOpened(IoSession session) throws Exception { + } + + public Queue getQueue() { + return queue; + } + + public void setQueue(Queue queue) { + this.queue = queue; + } + + public Map getSessionMap() { + return sessionMap; + } + + public void setSessionMap(Map sessionMap) { + this.sessionMap = sessionMap; + } +} diff --git a/cloud/weigeng/src/main/java/com/sincere/weigeng/utils/WgUdpCommShort.java b/cloud/weigeng/src/main/java/com/sincere/weigeng/utils/WgUdpCommShort.java new file mode 100644 index 0000000..30234cf --- /dev/null +++ b/cloud/weigeng/src/main/java/com/sincere/weigeng/utils/WgUdpCommShort.java @@ -0,0 +1,120 @@ +package com.sincere.weigeng.utils; + +import org.apache.mina.core.buffer.IoBuffer; +import org.apache.mina.core.session.IoSession; + +public class WgUdpCommShort { //短报文协议 + + public static final int WGPacketSize = 64; //报文长度 + public static final byte Type = 0x17; //2015-04-30 08:50:29 0x19; //类型 + public static final int ControllerPort = 60000; //控制器端口 + public static final long SpecialFlag = 0x55AAAA55; //特殊标识 防止误操作 + + public static byte[] longToByte(long number) { + byte[] b = new byte[8]; + for (int i = 0; i < 8; i++) { + b[i] = (byte) (number % 256); + number >>= 8; + } + return b; + } + + //从字节转换为 long型数据, 最大长度为8字节 低位在前, 高位在后... + //bytlen (1--8), 不在此范围则返回 -1 + public static long getLongByByte(byte[] data,int startIndex,int bytlen) + { + long ret =-1; + if ((bytlen >=1) && (bytlen <=8)) + { + ret = getIntByByte(data[startIndex + bytlen-1]); + for (int i=1; i= WGPacketSize) + { + ret = getLongByByte(cmd, 40, 4); + } + return ret; + } + + public WgUdpCommShort() + { + Reset(); + } + public void Reset() //数据复位 + { + for(int i=0; i + + + + + + + + + + + + %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger -%msg%n + + + + + + %d{yyyy-MM-dd HH:mm:ss} -%msg%n + + + + 1 + + + ${logPath}/info/orderSuccess/%d{yyyy-MM-dd HH}.log + ${maxHistory} + + + + + %d{yyyy-MM-dd HH:mm:ss} -%msg%n + + + + 1 + + + ${logPath}/info/orderFail/%d{yyyy-MM-dd HH}.log + ${maxHistory} + + + + + %d{yyyy-MM-dd HH:mm:ss} -%msg%n + + + + 1 + + + ${logPath}/info/heartBeat/%d{yyyy-MM-dd HH}.log + ${maxHistory} + + + + + %d{yyyy-MM-dd HH:mm:ss} -%msg%n + + + + 1 + + + ${logPath}/info/kaoInfo/%d{yyyy-MM-dd HH}.log + ${maxHistory} + + + + + + + + + ERROR + + + %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger -%msg%n + + + + 1 + + ${logPath}/infoError/${PROJECT_NAME}.%d{yyyy-MM-dd}.log + + ${maxHistory} + + + + + + + + + + + + + + + + + + + + + +        + + + + + + + + + + \ No newline at end of file diff --git a/cloud/weigeng/src/main/resources/mybatis-config.xml b/cloud/weigeng/src/main/resources/mybatis-config.xml deleted file mode 100644 index 595ed53..0000000 --- a/cloud/weigeng/src/main/resources/mybatis-config.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/cloud/weigeng/src/test/java/com/sincere/weigeng/WeigengApplicationTests.java b/cloud/weigeng/src/test/java/com/sincere/weigeng/WeigengApplicationTests.java deleted file mode 100644 index d24f749..0000000 --- a/cloud/weigeng/src/test/java/com/sincere/weigeng/WeigengApplicationTests.java +++ /dev/null @@ -1,570 +0,0 @@ -package com.sincere.weigeng; - -import com.drew.imaging.jpeg.JpegMetadataReader; -import com.drew.imaging.jpeg.JpegProcessingException; -import com.drew.metadata.Directory; -import com.drew.metadata.Metadata; -import com.drew.metadata.Tag; -import com.drew.metadata.exif.ExifDirectory; -import com.sincere.weigeng.dao.UserDao; -import org.apache.poi.hssf.usermodel.HSSFCell; -import org.apache.poi.hssf.usermodel.HSSFRow; -import org.apache.poi.hssf.usermodel.HSSFSheet; -import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.json.JSONArray; -import org.json.JSONObject; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; -import org.springframework.web.client.RestTemplate; - -import javax.imageio.ImageIO; -import java.awt.*; -import java.awt.image.BufferedImage; -import java.io.*; -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.List; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class WeigengApplicationTests { - - @Autowired - TestDao testDao; - - @Test - public void contextLoads() { - - try { - BufferedReader bufferedReader = new BufferedReader(new FileReader("C:\\Users\\taohandong\\Desktop\\json.txt")); - String content = null; - StringBuilder stringBuilder = new StringBuilder(); - while ((content = bufferedReader.readLine()) != null) { - stringBuilder.append(content); - } - - JSONObject jsonObject = new JSONObject(stringBuilder.toString()); - JSONObject data = jsonObject.optJSONObject("data"); - JSONArray questions = data.optJSONArray("questions"); - for (int i = 0; i < questions.length(); i++) { - JSONObject question = questions.optJSONObject(i); - String question_text = question.optString("question_text"); - String answer = question.optString("answer");//答案 - String explanation = question.optString("explanation");//解析 -//

image.png

- explanation = "

\"image.png\"/

"; - answer = getAnswer(answer); - System.out.println("question_text:" + question_text + "\r\nanswer:" + answer + "\r\nexplanation:" + explanation); - List questionBeans = testDao.getQuestions(question_text);//获取题目 - for (int j = 0; j < questionBeans.size(); j++) { - QuestionBean questionBean = questionBeans.get(j); - testDao.updateQuestion(questionBean.getID(), answer, explanation); - } -// System.out.println(questionBeans.toString()); - } - - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - - } - - private String url = "https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic?access_token=24.26683b650b73b63e0b08afa7ac36e880.2592000.1571310480.282335-15990462"; - - private String getAnswer(String imgUrl) { - RestTemplate restTemplate = new RestTemplate(); - - HttpHeaders headers = new HttpHeaders(); - headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); - - MultiValueMap multiValueMap = new LinkedMultiValueMap<>(); -// multiValueMap.add("image", ImageUtils.ImageToBase64ByLocal("C:\\Users\\taohandong\\Desktop\\识别.png")); - multiValueMap.add("url", imgUrl); - HttpEntity requestEntity = new HttpEntity(multiValueMap, - - headers); - - ResponseEntity result = restTemplate.postForEntity(url, requestEntity, String.class); - - JSONObject jsonObject = new JSONObject(result.getBody()); -// System.out.println("result:"+result.getBody()); - JSONArray words_result = jsonObject.optJSONArray("words_result"); -// System.out.println("words_result:"+words_result); - StringBuilder stringBuilder = new StringBuilder(); - if (words_result != null) { - for (int i = 0; i < words_result.length(); i++) { - String words = words_result.optJSONObject(i).optString("words"); - stringBuilder.append(words + " "); - } - System.out.println("result:" + stringBuilder.toString()); - } - return stringBuilder.toString().equals("") ? "B" : stringBuilder.toString(); - } - - @Test - public void get() { - -// 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"; -// RestTemplate restTemplate = new RestTemplate(); -// System.out.println(restTemplate.getForObject(url, String.class)); - /*String createrUserId = "zy273789", time = "2019-10-08"; - List testPaperList = testDao.getTestPapers(createrUserId, time); - for (int i = 0; i < testPaperList.size(); i++) { - TestPaper testPaper = testPaperList.get(i); - int schoolId = 11; - testDao.addTestPaper("zy284782", testPaper.getQuestionIds(), testPaper.getStatus(), testPaper.getPublishTime(), - testPaper.getName(), testPaper.getIsRecommend(), testPaper.getState(), testPaper.getIntime(), schoolId + ""); - - }*/ - - } - - - /** - * 创建试卷 - */ - @Test - public void createTestPaper() { - String createUserId = "zy309728"; - List testPaperList = testDao.getTestPapers(createUserId, "2019-09-18 16:00:00"); - System.out.println("testPaperList:" + testPaperList.toString()); - - String addCreateUserId = "zy411337", SchoolId = "885"; - /* for (int i = 1; i < testPaperList.size(); i++) { - TestPaper testPaper = testPaperList.get(i); - int ID = testPaper.getID(); - //添加试卷 - testDao.addTestPaper(addCreateUserId, testPaper.getQuestionIds(), testPaper.getStatus(), testPaper.getPublishTime() - , testPaper.getName(), testPaper.getIsRecommend(), testPaper.getState(), testPaper.getIntime(), SchoolId); - - //发布作业 - 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); - }*/ - /*String[] answers = new String[]{"A", "B", "C", "D"}; - String QuestionType = "1"; - String CorrectAnswer = ""; - List homeworkList = testDao.getHomeWork(addCreateUserId); - for (int i = 0; i < homeworkList.size(); i++) { - Homework homework = homeworkList.get(i); - String[] questionIds = homework.getQuestionIds().split(","); - for (int j = 0; j < questionIds.length; j++) { - String questionId = questionIds[j]; - QuestionBean questionBean = testDao.getQues(questionId); - CorrectAnswer = questionBean.getCorrectAnswer(); - String answer = answers[new Random().nextInt(4)]; - String IsCorresct = answer.trim().equals(CorrectAnswer.trim()) ? "1" : "3"; - testDao.StudentAnswer(questionId, answer, CorrectAnswer, QuestionType, IsCorresct, homework.getID()); - } - - }*/ -// if (ID <= 4191 && ID >= 4187) { - String classId = "36398"; - List homeworkList = testDao.getHomeWork(addCreateUserId); - for (int i = 0; i < homeworkList.size(); i++) { - String workId = homeworkList.get(i).getID(); -// List stuAnsIds = testDao.getStudentAnsIds(workId); -// String stuAnIds = stuAnsIds.toString().replace("[", ""); -// stuAnIds = stuAnIds.replace("]", ""); - - List strings = testDao.getStudentIdsWithClassId(classId); - String stuIds = strings.toString().replace("[", ""); - stuIds = stuIds.replace("]", ""); - String[] stuStrings = stuIds.split(",");//学生id - - for (int j = 0; j < stuStrings.length; j++) { - String studentId = stuStrings[j]; - - testDao.HomeworkReceive(workId, classId, studentId, "", "1", j + "", "2019-09-23 21:28:00", "2019-09-22 17:50:00", "1", j + ""); - } - - } - - } - - @Autowired - UserDao userDao; - - @Test - public void doHomeWork() { - StudentBean studentBean = new StudentBean(); - studentBean.setCard("9A1229A9"); - studentBean.setSchool_id(110); - studentBean.setStudentCode("140881200710270056"); - studentBean.setCustomerId("583912"); - -// userDao.addStudentUpdate(studentBean.getCard(),studentBean.getSchool_id(),studentBean.getStudentCode(),studentBean.getCustomerId(),"1","2" -// ,"55640","2014级(08)班","0","1","2019-09-22 16:26"); - - /* String QuestionId = "21656, 21657, 21658, 21659, 21753, 21706, 21724, 21796, 21797, 21798"; - String Answer = ""; - String CorrectAnswer = ""; - String QuestionType = "1"; - String IsCorresct = ""; - String WorkID = "4198"; - String[] questionIds = QuestionId.split(","); - for (int i = 0; i < questionIds.length; i++) { - String questionId = questionIds[i]; - QuestionBean questionBean = testDao.getQues(questionId); - CorrectAnswer = questionBean.getCorrectAnswer(); - Answer = "B"; - IsCorresct = Answer.trim().equals(CorrectAnswer.trim()) ? "1" : "3"; - testDao.StudentAnswer(questionId, Answer, CorrectAnswer, QuestionType, IsCorresct, WorkID); - }*/ - - } - - - @Test - public void HomeworkRec() { - String WorkID = "4198"; - String ClassId = ""; - //查询学生id - List list = testDao.getStudentIds("4172"); - String StudentIds = list.toString().replace("[", ""); - StudentIds = StudentIds.replace("]", ""); - System.out.println("StudentIds:" + StudentIds); - String StudnetAnswerIds = testDao.getStudentAnsIds(WorkID).toString().replace("[", ""); - StudnetAnswerIds = StudnetAnswerIds.replace("]", ""); - String[] studentIds = StudentIds.split(","); - for (int i = 0; i < studentIds.length; i++) { - String studentId = studentIds[i]; - String finishTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); - testDao.HomeworkReceive(WorkID, ClassId, studentId, StudnetAnswerIds, "1", i + "", "2019-09-19 16:50", finishTime - , "1", "" + i); - } - } - - @Test - public void getQIds() { - - List knowledges = userDao.getKnowledge(); - System.out.println("knowledges:" + knowledges.toString()); - - List jiaoCais = userDao.getJiaoCai(); - System.out.println("jiaoCais:" + jiaoCais.toString()); - - for (int i = 0; i < 1; i++) { - JiaoCai jiaoCai = jiaoCais.get(i); - String SubjectId = jiaoCai.getSubjectId(); - for (int j = 0; j < knowledges.size(); j++) { - Knowledge knowledge = knowledges.get(j); - if (SubjectId.equals(knowledge.getSubjectId())) { - userDao.addKnowAndJicaoCai(jiaoCai.getID(), knowledge.getId(), 0, 1); - } - } - - } - - } - - @Test - public void tongji() { - - String[] answers = new String[]{"A", "B", "C", "D", "A", "A"}; - String createUserId = "zy411337"; - List homeworkList = testDao.getHomeWork(createUserId);//获取布置的作业 - System.out.println("homeworkList:" + homeworkList); - for (int m = 0; m < homeworkList.size(); m++) { - String WorkId = homeworkList.get(m).getID(); - Map> mapRecIDs = new HashMap<>(); - System.out.println("workId:" + WorkId); -// List queIds = testDao.getStuAnsIds(WorkId); -// String questionIds = queIds.toString().replace("[", ""); -// questionIds = questionIds.replace("]", ""); - - //获取正确答案 -// List correct = testDao.correctAns(WorkId); -// String corrStr = correct.toString().replace("[", ""); -// corrStr = corrStr.replace("]", ""); -// String[] correctAnser = corrStr.split(","); - - String questionIds = testDao.getQuestionIds(WorkId); - - //获取答题学生数量 - List homeworkReceiveIds = testDao.get_HomeworkReceive(WorkId, "12012"); - System.out.println("homeworkReceiveIds:" + homeworkReceiveIds.size()); - for (int j = 0; j < homeworkReceiveIds.size(); j++) {//接收学生数量 - - String[] quesStirngs = questionIds.split(","); - System.out.println("quesStirngs:" + quesStirngs.length); - for (int i = 0; i < quesStirngs.length; i++) { - String questionId = quesStirngs[i]; - String CorrectAnswer = testDao.getCorrectAnswer(questionId); - int randow = new Random().nextInt(6); - String answer = null; - String isCorrsct = ""; - if (randow == 0 || randow == 1 || randow == 2 || randow == 3 || randow == 4) { - answer = CorrectAnswer.trim(); - isCorrsct = "1"; - } else { - answer = answers[randow]; - isCorrsct = "3"; - } - //插入一条新的记录 - testDao.addStudentAnswer(quesStirngs[i], answer.trim(), "", CorrectAnswer.trim(), "1", "", isCorrsct, "", "", WorkId); - } - //获取最新的十条记录 - List idLists = testDao.getTopIDs(WorkId, questionIds.split(",").length); - System.out.println("idLists:" + idLists.toString()); - mapRecIDs.put(j + "", idLists); - } -// System.out.println("mapRecIDs:" + mapRecIDs.toString() + " 0:" + mapRecIDs.get("0").toString().replace("[", "")); - - for (int i = 0; i < homeworkReceiveIds.size(); i++) { - String homeRecId = homeworkReceiveIds.get(i); - System.out.println("i:" + i); - String ansIds = mapRecIDs.get(i + "").toString().replace("[", ""); - ansIds = ansIds.replace("]", ""); - testDao.updateHomeWork(ansIds, homeRecId); - } - - List homRecIDs = testDao.get_HomeworkRec(WorkId); - - Map stuMap = new HashMap<>(); - for (int i = 0; i < homRecIDs.size(); i++) { - HomeworkReceive homeworkReceive = homRecIDs.get(i); - - String studentId = homeworkReceive.getStudentId(); - - String studentName = testDao.getStudentName(studentId); - - String studnetAnswerIds = homeworkReceive.getStudnetAnswerIds(); - - String[] stuIds = studnetAnswerIds.split(","); - - String isC = ""; - for (int j = 0; j < stuIds.length; j++) { - String id = stuIds[j]; - int idCorrect = testDao.getIsCorrect(id); - if (idCorrect == 1) { - isC += "1 "; - } else if (idCorrect == 3) { - isC += "0 "; - } - } - stuMap.put(studentName, isC); - System.out.println("" + studentName + " " + isC); - - } - - } - } - - private void writeToExcel(HSSFWorkbook workbook, String HomeworkTitle, Map correctAns, String[] names, String title) { - //第二部,在workbook中创建一个sheet对应excel中的sheet - HSSFSheet sheet = workbook.createSheet(HomeworkTitle); - //第三部,在sheet表中添加表头第0行,老版本的poi对sheet的行列有限制 - HSSFRow row = sheet.createRow(0); - //第四步,创建单元格,设置表头 - HSSFCell cell = null; - for (int i = 0; i < correctAns.get(names[0]).length; i++) { - cell = row.createCell(i); - cell.setCellValue("第" + (i + 1) + ""); - } - - //第五步,写入数据 - for (int i = 0; i < names.length; i++) { - -// String oneData =correctAns[i];//姓名对应的正确率 - HSSFRow row1 = sheet.createRow(i + 1); - String[] corrects = correctAns.get(names[i]); - System.out.println("names:" + names[i]); - for (int j = 0; j < corrects.length; j++) { - //创建单元格设值 - row1.createCell(j).setCellValue(corrects[j]); - } - row1.createCell(corrects.length).setCellValue(names[i]); - } - - //将文件保存到指定的位置 - try { - File file = new File("C:\\Users\\taohandong\\Desktop\\文澜\\"+title+".xls"); - if (!file.exists())file.createNewFile(); - FileOutputStream fos = new FileOutputStream(file); - workbook.write(fos); - System.out.println("写入成功"); - fos.close(); - } catch (IOException e) { - e.printStackTrace(); - } - - } - - - @Test - public void getStu() { - //第一步,创建一个workbook对应一个excel文件 - HSSFWorkbook workbook = new HSSFWorkbook(); - - String createUserId = "zy595910"; - String title="作业"; - //ZY_Homework表取出要统计的作业 - String WorkId = "4408"; - String workName = testDao.getWorkName(WorkId); - - //ZY_HomeworkReceive 表获取学生作业答题情况; - List homRecIDs = testDao.get_HomeworkRec(WorkId); - - Map stuMap = new HashMap<>(); - String[] names = new String[homRecIDs.size()]; - String[] isCorrect = null; - for (int i = 0; i < homRecIDs.size(); i++) { - HomeworkReceive homeworkReceive = homRecIDs.get(i); - - String studentId = homeworkReceive.getStudentId(); - - String studentName = testDao.getStudentName(studentId); - - String studnetAnswerIds = homeworkReceive.getStudnetAnswerIds(); -// System.out.println("studnetAnswerIds:"+studnetAnswerIds+" WorkId:"+WorkId + " StudentId:"+studentId); - if (null != studnetAnswerIds) { - names[i] = studentName; - String[] stuIds = studnetAnswerIds.split(","); - isCorrect = new String[stuIds.length]; - String isC = ""; - for (int j = 0; j < stuIds.length; j++) { - String id = stuIds[j]; - System.out.println("IsCorrectId:" + id); - //ZY_StudentAnswer表获取题目是否正确 - int idCorrect = testDao.getIsCorrect(id); - if (idCorrect == 1) { - isC += "1 "; - isCorrect[j] = "1"; - } else if (idCorrect == 3) { - isC += "0 "; - isCorrect[j] = "0"; - } - } - stuMap.put(studentName, isCorrect); - System.out.println("" + studentName + " " + isC); - } - } - if (names!=null&&stuMap.size()>0) - writeToExcel(workbook, workName, stuMap, names,title); -// System.out.println("stuMap:" + stuMap.toString()); - } - - - /** - * 旋转图片 - */ - @Test - public void trnImgs() { - - File file = new File("C:\\TaoHandong\\copy\\school479\\StudentCompressed"); - File[] files = file.listFiles(); - - List studentInfos = testDao.getStudents(479); - - List studentInfoList = new ArrayList<>(); - - for (int i = 0; i < studentInfos.size(); i++) { - StudentInfo studentInfo = studentInfos.get(i); - - boolean isHas = false; - for (int j = 0; j < files.length; j++) { - File img = files[j]; - String imgName = img.getName().split("\\.")[0]; - - if (imgName.equals(studentInfo.getStudentcode())) { - isHas = true; - break; - } - - } - - if (!isHas) { - studentInfoList.add(studentInfo); - } - - } - - System.out.println("studentInfoList:" + studentInfoList); - //第一步,创建一个workbook对应一个excel文件 - HSSFWorkbook workbook = new HSSFWorkbook(); - //第二部,在workbook中创建一个sheet对应excel中的sheet - HSSFSheet sheet = workbook.createSheet("缺少的学生人脸"); - //第三部,在sheet表中添加表头第0行,老版本的poi对sheet的行列有限制 - HSSFRow row = sheet.createRow(0); - - String[] titles = new String[]{"姓名", "班级", "学籍号", "号码"}; - //第四步,创建单元格,设置表头 - HSSFCell cell = null; - for (int i = 0; i < titles.length; i++) { - cell = row.createCell(i); - cell.setCellValue(titles[i]); - } - - //第五步,写入数据 - for (int i = 0; i < studentInfoList.size(); i++) { - HSSFRow row1 = sheet.createRow(i + 1); - for (int j = 0; j < titles.length; j++) { - String value = studentInfoList.get(i).getClass_name(); - switch (j) { - case 0: - value = studentInfoList.get(i).getName(); - break; - case 1: - value = studentInfoList.get(i).getClass_name(); - break; - case 2: - value = studentInfoList.get(i).getStudentcode(); - break; - case 3: - value = studentInfoList.get(i).getParentMobile(); - break; - } - //创建单元格设值 - row1.createCell(j).setCellValue(value); - } - } - - //将文件保存到指定的位置 - try { - FileOutputStream fos = new FileOutputStream("C:\\Users\\taohandong\\Desktop\\result.xls"); - workbook.write(fos); - System.out.println("写入成功"); - fos.close(); - } catch (IOException e) { - e.printStackTrace(); - } - - /* File file = new File("C:\\TaoHandong\\copy\\School1030\\Student"); - - File outFile = new File("C:\\TaoHandong\\copy\\School1030\\Student1"); - - if (!outFile.exists()) outFile.mkdirs(); - - File[] files = file.listFiles(); - System.out.println("files:" + files.length); - BufferedImage bufferedImage; - for (int i = 0; i < files.length; i++) { - File img = files[i]; - int ang = ImageUtils.getImgRotateAngle(img.getAbsolutePath()); - System.out.println(img.getName() + " ang:" + ang); -// try { -// bufferedImage = ImageIO.read(img); -// moveImg(bufferedImage,img,outFile); -// } catch (IOException e) { -// e.printStackTrace(); -// } - - }*/ - - } - - private List name = new ArrayList<>(); - - -} diff --git a/cloud/xiaoan_search/pom.xml b/cloud/xiaoan_search/pom.xml new file mode 100644 index 0000000..c503aa3 --- /dev/null +++ b/cloud/xiaoan_search/pom.xml @@ -0,0 +1,209 @@ + + + + cloud + com.sincere + 1.0.0 + + 4.0.0 + + xiaoan_search + + + com.sincere + common + 0.0.1-SNAPSHOT + + + + io.netty + netty-all + 4.1.33.Final + + + org.apache.mina + mina-core + 2.1.3 + + + com.microsoft.sqlserver + mssql-jdbc + 6.4.0.jre8 + + + + org.springframework.boot + spring-boot-starter + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-aop + + + + com.googlecode.rapid-framework + rapid-core + 4.0.5 + + + org.apache.commons + commons-lang3 + 3.3.2 + + + + org.slf4j + slf4j-api + 1.7.13 + + + + commons-net + commons-net + 2.0 + + + org.apache.poi + poi + 4.1.0 + + + + org.apache.poi + poi-ooxml + 4.1.0 + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 1.3.0 + + + com.alibaba + druid + 1.0.11 + + + io.springfox + springfox-swagger2 + 2.6.1 + + + io.springfox + springfox-swagger-ui + 2.6.1 + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + + + + + xianao_search + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.8 + 1.8 + UTF-8 + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + com.jevon.Application + true + lib/ + + + ./config/ + + + + config/** + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy + package + + copy-dependencies + + + + ${project.build.directory}/lib + + + + + + + + org.apache.maven.plugins + maven-resources-plugin + 2.5 + + UTF-8 + + + + + maven-source-plugin + 2.2 + + true + + + + compile + + jar + + + + + + + + \ No newline at end of file diff --git a/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/XiaoanSearchApplication.java b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/XiaoanSearchApplication.java new file mode 100644 index 0000000..d11e133 --- /dev/null +++ b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/XiaoanSearchApplication.java @@ -0,0 +1,21 @@ +package com.sincere.xiaoanSearch; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.netflix.eureka.EnableEurekaClient; + +/** + * @author chen + * @version 1.0 + * @date 2019/11/11 0011 15:40 + */ +@EnableEurekaClient +@SpringBootApplication +@MapperScan("com.sincere.xiaoanSearch.mapper") +public class XiaoanSearchApplication { + + public static void main(String[] args) { + SpringApplication.run(XiaoanSearchApplication.class, args); + } +} diff --git a/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/controller/WgController.java b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/controller/WgController.java new file mode 100644 index 0000000..e4d573b --- /dev/null +++ b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/controller/WgController.java @@ -0,0 +1,99 @@ +package com.sincere.xiaoanSearch.controller; + +import com.sincere.common.dto.xiaoan.*; +import com.sincere.xiaoanSearch.model.*; +import com.sincere.xiaoanSearch.service.CheckInService; +import com.sincere.xiaoanSearch.service.WgService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * @author chen + * @version 1.0 + * @date 2019/11/11 0011 15:53 + */ +@RestController +@RequestMapping("/xa/wg") +public class WgController { + + @Autowired + CheckInService checkInService; + + @Autowired + WgService wgService; + + @RequestMapping(value = "checkIn",method = RequestMethod.POST) + public CheckOutDto checkIn(@RequestBody CheckInDto checkInDto){ + CheckIn checkIn = new CheckIn(checkInDto); + checkInService.checkIn(checkIn); + CheckOutDto checkOutDto = new CheckOutDto(); + checkOutDto.setIsSuccess(checkIn.getIsSuccess()); + checkOutDto.setOut(checkIn.getOut()); + return checkOutDto; + } + + @RequestMapping(value = "insertMessage",method = RequestMethod.POST) + public long insertMessage(@RequestBody SendMessageDto sendMessageDto){ + SendMessage sendMessage = new SendMessage(sendMessageDto); + wgService.insertMessage(sendMessage); + return sendMessage.getId(); + } + + @RequestMapping(value = "selectById",method = RequestMethod.GET) + SendMessageDto selectById(@RequestParam("id") long id){ + SendMessage sendMessage = wgService.selectById(id); + return toSendMessageDto(sendMessage); + } + + @RequestMapping(value = "selectMessage",method = RequestMethod.GET) + SendMessageDto selectMessage(@RequestParam("deviceId") String deviceId, @RequestParam("index") long index,@RequestParam("functionId") String functionId){ + SendMessage sendMessage = wgService.selectMessage(deviceId,index,functionId); + return toSendMessageDto(sendMessage); + } + + @RequestMapping(value = "updateMessage",method = RequestMethod.GET) + int updateMessage(@RequestParam("id") long id, @RequestParam("result") String result, @RequestParam("correct") int correct){ + return wgService.updateMessage(id,result,correct); + } + + @RequestMapping(value = "insertPassFail",method = RequestMethod.POST) + int insertPassFail(@RequestBody PassFailDto passFailDto){ + return wgService.insertPassFail(new PassFail(passFailDto)); + } + + @RequestMapping(value = "insertSendSuccess",method = RequestMethod.POST) + int insertSendSuccess(@RequestBody SendSuccessDto sendSuccessDto){ + return wgService.insertSendSuccess(new SendSuccess(sendSuccessDto)); + } + + @RequestMapping(value = "insertSendFail",method = RequestMethod.POST) + int insertSendFail(@RequestBody SendFailDto sendFailDto){ + return wgService.insertSendFail(new SendFail(sendFailDto)); + } + + @RequestMapping(value = "deleteSendFail",method = RequestMethod.POST) + int deleteSendFail(@RequestBody SendFailDto sendFailDto){ + return wgService.deleteSendFail(new SendFail(sendFailDto)); + } + + @RequestMapping(value = "updateSendSuccess",method = RequestMethod.POST) + int updateSendSuccess(@RequestBody SendSuccessDto sendSuccessDto){ + return wgService.updateSendSuccess(new SendSuccess(sendSuccessDto)); + } + + public SendMessageDto toSendMessageDto(SendMessage sendMessage){ + SendMessageDto sendMessageDto = new SendMessageDto(); + if(sendMessage != null){ + sendMessageDto.setId(sendMessage.getId()); + sendMessageDto.setDeviceId(sendMessage.getDeviceId()); + sendMessageDto.setCardNo(sendMessage.getCardNo()); + sendMessageDto.setIndex(sendMessage.getIndex()); + sendMessageDto.setSend(sendMessage.getSend()); + sendMessageDto.setResult(sendMessage.getResult()); + sendMessageDto.setCorrect(sendMessage.getCorrect()); + sendMessageDto.setCreateTime(sendMessage.getCreateTime()); + sendMessageDto.setFunctionId(sendMessage.getFunctionId()); + } + return sendMessageDto ; + } +} diff --git a/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/mapper/CheckMapper.java b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/mapper/CheckMapper.java new file mode 100644 index 0000000..ccad4e0 --- /dev/null +++ b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/mapper/CheckMapper.java @@ -0,0 +1,14 @@ +package com.sincere.xiaoanSearch.mapper; + +import com.sincere.xiaoanSearch.model.CheckIn; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/14 0014 14:36 + */ +public interface CheckMapper { + + void checkIn(CheckIn checkIn); + +} diff --git a/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/mapper/SendMessageMapper.java b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/mapper/SendMessageMapper.java new file mode 100644 index 0000000..d01291f --- /dev/null +++ b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/mapper/SendMessageMapper.java @@ -0,0 +1,22 @@ +package com.sincere.xiaoanSearch.mapper; + + +import com.sincere.xiaoanSearch.model.SendMessage; + +import java.util.List; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/29 0029 14:00 + */ +public interface SendMessageMapper { + + SendMessage selectById(long id); + + List selectMessage(SendMessage sendMessage); + + int insert(SendMessage sendMessage); + + int update(SendMessage sendMessage); +} diff --git a/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/mapper/WgResultMapper.java b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/mapper/WgResultMapper.java new file mode 100644 index 0000000..4537c82 --- /dev/null +++ b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/mapper/WgResultMapper.java @@ -0,0 +1,24 @@ +package com.sincere.xiaoanSearch.mapper; + + +import com.sincere.xiaoanSearch.model.PassFail; +import com.sincere.xiaoanSearch.model.SendFail; +import com.sincere.xiaoanSearch.model.SendSuccess; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/14 0014 15:00 + */ +public interface WgResultMapper { + + int insertPassFail(PassFail passFail); + + int insertSendSuccess(SendSuccess sendSuccess); + + int insertSendFail(SendFail sendFail); + + int deleteSendFail(SendFail sendFail); + + int updateSendSuccess(SendSuccess sendSuccess); +} diff --git a/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/model/CheckIn.java b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/model/CheckIn.java new file mode 100644 index 0000000..28ba103 --- /dev/null +++ b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/model/CheckIn.java @@ -0,0 +1,84 @@ +package com.sincere.xiaoanSearch.model; + +import com.sincere.common.dto.xiaoan.CheckInDto; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/30 0030 10:26 + */ +public class CheckIn { + + private String deviceId ; + private String cardNo ; + private int funNo ; + private int flag ; + private String checkTime ; + + private String out; + private int isSuccess ; + + public CheckIn(CheckInDto checkInDto){ + this.deviceId = checkInDto.getDeviceId(); + this.cardNo = checkInDto.getCardNo(); + this.funNo = checkInDto.getFunNo(); + this.flag = checkInDto.getFlag() ; + this.checkTime = checkInDto.getCheckTime() ; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getCardNo() { + return cardNo; + } + + public void setCardNo(String cardNo) { + this.cardNo = cardNo; + } + + public int getFlag() { + return flag; + } + + public void setFlag(int flag) { + this.flag = flag; + } + + public String getCheckTime() { + return checkTime; + } + + public void setCheckTime(String checkTime) { + this.checkTime = checkTime; + } + + public String getOut() { + return out; + } + + public void setOut(String out) { + this.out = out; + } + + public int getIsSuccess() { + return isSuccess; + } + + public void setIsSuccess(int isSuccess) { + this.isSuccess = isSuccess; + } + + public int getFunNo() { + return funNo; + } + + public void setFunNo(int funNo) { + this.funNo = funNo; + } +} diff --git a/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/model/PassFail.java b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/model/PassFail.java new file mode 100644 index 0000000..d9b1442 --- /dev/null +++ b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/model/PassFail.java @@ -0,0 +1,87 @@ +package com.sincere.xiaoanSearch.model; + +import com.sincere.common.dto.xiaoan.PassFailDto; + +import java.util.Date; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/14 0014 14:58 + */ +public class PassFail { + + private String cardNum ; + private String deviceId ; + private String direction ; + private String resultIntro ; + private Date createTime ; + private int schoolId ; + private Date inTime ; + + public PassFail(PassFailDto passFailDto){ + this.cardNum = passFailDto.getCardNum(); + this.deviceId = passFailDto.getDeviceId(); + this.direction = passFailDto.getDirection(); + this.resultIntro = passFailDto.getResultIntro(); + this.createTime = passFailDto.getCreateTime(); + this.schoolId = passFailDto.getSchoolId(); + this.inTime = passFailDto.getInTime(); + } + + public String getCardNum() { + return cardNum; + } + + public void setCardNum(String cardNum) { + this.cardNum = cardNum; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getDirection() { + return direction; + } + + public void setDirection(String direction) { + this.direction = direction; + } + + public String getResultIntro() { + return resultIntro; + } + + public void setResultIntro(String resultIntro) { + this.resultIntro = resultIntro; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public int getSchoolId() { + return schoolId; + } + + public void setSchoolId(int schoolId) { + this.schoolId = schoolId; + } + + public Date getInTime() { + return inTime; + } + + public void setInTime(Date inTime) { + this.inTime = inTime; + } +} diff --git a/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/model/SendFail.java b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/model/SendFail.java new file mode 100644 index 0000000..44e9f3f --- /dev/null +++ b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/model/SendFail.java @@ -0,0 +1,214 @@ +package com.sincere.xiaoanSearch.model; + +import com.sincere.common.dto.smartCampus.SchoolDto; +import com.sincere.common.dto.smartCampus.StudentCardDto; +import com.sincere.common.dto.smartCampus.UpdateCardDto; +import com.sincere.common.dto.smartCampus.UserDto; +import com.sincere.common.dto.xiaoan.SendFailDto; + +import java.util.Date; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/14 0014 15:18 + */ +public class SendFail { + + private String deviceId ; + private String cardNum ; + private String oldCardNum ; + private String cardType ; + private int customerId ; + private int userType ; + private int classId ; + private String schoolName ; + private int studentType ; + private int openFlag ; + private int status ; + private int updateId ; + private Date createTime ; + private int sex ; + private String name ; + private int failType ; + private String failContent ; + private int schoolId ; + private int shiduan ; + + public SendFail(SendFailDto sendFailDto){ + this.deviceId = sendFailDto.getDeviceId(); + this.cardNum = sendFailDto.getCardNum(); + this.oldCardNum = sendFailDto.getOldCardNum(); + this.cardType = sendFailDto.getCardType(); + this.customerId = sendFailDto.getCustomerId(); + this.userType = sendFailDto.getUserType(); + this.classId = sendFailDto.getClassId(); + this.schoolName = sendFailDto.getSchoolName(); + this.studentType = sendFailDto.getStudentType(); + this.openFlag = sendFailDto.getOpenFlag(); + this.status = sendFailDto.getStatus(); + this.updateId = sendFailDto.getUpdateId(); + this.createTime = sendFailDto.getCreateTime(); + this.sex = sendFailDto.getSex(); + this.name = sendFailDto.getName(); + this.schoolId = sendFailDto.getSchoolId(); + this.shiduan =sendFailDto.getShiduan(); + this.failType = sendFailDto.getFailType(); + this.failContent = sendFailDto.getFailContent(); + } + + public SendFail() { + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getCardNum() { + return cardNum; + } + + public void setCardNum(String cardNum) { + this.cardNum = cardNum; + } + + public String getOldCardNum() { + return oldCardNum; + } + + public void setOldCardNum(String oldCardNum) { + this.oldCardNum = oldCardNum; + } + + public String getCardType() { + return cardType; + } + + public void setCardType(String cardType) { + this.cardType = cardType; + } + + public int getCustomerId() { + return customerId; + } + + public void setCustomerId(int customerId) { + this.customerId = customerId; + } + + public int getUserType() { + return userType; + } + + public void setUserType(int userType) { + this.userType = userType; + } + + public int getClassId() { + return classId; + } + + public void setClassId(int classId) { + this.classId = classId; + } + + public String getSchoolName() { + return schoolName; + } + + public void setSchoolName(String schoolName) { + this.schoolName = schoolName; + } + + public int getStudentType() { + return studentType; + } + + public void setStudentType(int studentType) { + this.studentType = studentType; + } + + public int getOpenFlag() { + return openFlag; + } + + public void setOpenFlag(int openFlag) { + this.openFlag = openFlag; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getUpdateId() { + return updateId; + } + + public void setUpdateId(int updateId) { + this.updateId = updateId; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public int getSex() { + return sex; + } + + public void setSex(int sex) { + this.sex = sex; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getSchoolId() { + return schoolId; + } + + public void setSchoolId(int schoolId) { + this.schoolId = schoolId; + } + + public int getShiduan() { + return shiduan; + } + + public void setShiduan(int shiduan) { + this.shiduan = shiduan; + } + + public int getFailType() { + return failType; + } + + public void setFailType(int failType) { + this.failType = failType; + } + + public String getFailContent() { + return failContent; + } + + public void setFailContent(String failContent) { + this.failContent = failContent; + } +} diff --git a/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/model/SendMessage.java b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/model/SendMessage.java new file mode 100644 index 0000000..082cae3 --- /dev/null +++ b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/model/SendMessage.java @@ -0,0 +1,109 @@ +package com.sincere.xiaoanSearch.model; + +import com.sincere.common.dto.xiaoan.SendMessageDto; + +import java.util.Date; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/29 0029 13:59 + */ +public class SendMessage { + + private long id ; + private String deviceId ; + private String cardNo ; + private long index ; + private String send ; + private String result ; + private int correct ; + private Date createTime ; + private String functionId ; + + public SendMessage() { + } + + public SendMessage(SendMessageDto sendMessageDto){ + this.deviceId = sendMessageDto.getDeviceId(); + this.cardNo = sendMessageDto.getCardNo(); + this.index = sendMessageDto.getIndex(); + this.send = sendMessageDto.getSend(); + this.result = sendMessageDto.getResult(); + this.correct = sendMessageDto.getCorrect(); + this.createTime = sendMessageDto.getCreateTime(); + this.functionId = sendMessageDto.getFunctionId(); + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getCardNo() { + return cardNo; + } + + public void setCardNo(String cardNo) { + this.cardNo = cardNo; + } + + public long getIndex() { + return index; + } + + public void setIndex(long index) { + this.index = index; + } + + public String getSend() { + return send; + } + + public void setSend(String send) { + this.send = send; + } + + public String getResult() { + return result; + } + + public void setResult(String result) { + this.result = result; + } + + public int getCorrect() { + return correct; + } + + public void setCorrect(int correct) { + this.correct = correct; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getFunctionId() { + return functionId; + } + + public void setFunctionId(String functionId) { + this.functionId = functionId; + } +} diff --git a/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/model/SendSuccess.java b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/model/SendSuccess.java new file mode 100644 index 0000000..5487516 --- /dev/null +++ b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/model/SendSuccess.java @@ -0,0 +1,195 @@ +package com.sincere.xiaoanSearch.model; + + +import com.sincere.common.dto.smartCampus.SchoolDto; +import com.sincere.common.dto.smartCampus.StudentCardDto; +import com.sincere.common.dto.smartCampus.UpdateCardDto; +import com.sincere.common.dto.smartCampus.UserDto; +import com.sincere.common.dto.xiaoan.SendSuccessDto; + +import java.util.Date; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/14 0014 15:18 + */ +public class SendSuccess { + + private String deviceId ; + private String cardNum ; + private String oldCardNum ; + private String cardType ; + private int customerId ; + private int userType ; + private int classId ; + private String schoolName ; + private int studentType ; + private int openFlag ; + private int status ; + private int updateId ; + private Date createTime ; + private int sex ; + private String name ; + private int schoolId ; + private int shiduan ; + + public SendSuccess() { + } + + public SendSuccess(SendSuccessDto sendSuccessDto){ + this.deviceId = sendSuccessDto.getDeviceId(); + this.cardNum = sendSuccessDto.getCardNum(); + this.oldCardNum = sendSuccessDto.getOldCardNum(); + this.cardType = sendSuccessDto.getCardType(); + this.customerId = sendSuccessDto.getCustomerId(); + this.userType = sendSuccessDto.getUserType(); + this.classId = sendSuccessDto.getClassId(); + this.schoolName = sendSuccessDto.getSchoolName(); + this.studentType = sendSuccessDto.getStudentType(); + this.openFlag = sendSuccessDto.getOpenFlag(); + this.status = sendSuccessDto.getStatus(); + this.updateId = sendSuccessDto.getUpdateId(); + this.createTime = sendSuccessDto.getCreateTime(); + this.sex = sendSuccessDto.getSex(); + this.name = sendSuccessDto.getName(); + this.schoolId = sendSuccessDto.getSchoolId(); + this.shiduan =sendSuccessDto.getShiduan(); + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getCardNum() { + return cardNum; + } + + public void setCardNum(String cardNum) { + this.cardNum = cardNum; + } + + public String getOldCardNum() { + return oldCardNum; + } + + public void setOldCardNum(String oldCardNum) { + this.oldCardNum = oldCardNum; + } + + public String getCardType() { + return cardType; + } + + public void setCardType(String cardType) { + this.cardType = cardType; + } + + public int getCustomerId() { + return customerId; + } + + public void setCustomerId(int customerId) { + this.customerId = customerId; + } + + public int getUserType() { + return userType; + } + + public void setUserType(int userType) { + this.userType = userType; + } + + public int getClassId() { + return classId; + } + + public void setClassId(int classId) { + this.classId = classId; + } + + public String getSchoolName() { + return schoolName; + } + + public void setSchoolName(String schoolName) { + this.schoolName = schoolName; + } + + public int getStudentType() { + return studentType; + } + + public void setStudentType(int studentType) { + this.studentType = studentType; + } + + public int getOpenFlag() { + return openFlag; + } + + public void setOpenFlag(int openFlag) { + this.openFlag = openFlag; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getUpdateId() { + return updateId; + } + + public void setUpdateId(int updateId) { + this.updateId = updateId; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public int getSex() { + return sex; + } + + public void setSex(int sex) { + this.sex = sex; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getSchoolId() { + return schoolId; + } + + public void setSchoolId(int schoolId) { + this.schoolId = schoolId; + } + + public int getShiduan() { + return shiduan; + } + + public void setShiduan(int shiduan) { + this.shiduan = shiduan; + } +} diff --git a/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/service/CheckInService.java b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/service/CheckInService.java new file mode 100644 index 0000000..4fa0c48 --- /dev/null +++ b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/service/CheckInService.java @@ -0,0 +1,14 @@ +package com.sincere.xiaoanSearch.service; + + +import com.sincere.xiaoanSearch.model.CheckIn; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/14 0014 14:55 + */ +public interface CheckInService { + + void checkIn(CheckIn checkIn); +} diff --git a/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/service/WgService.java b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/service/WgService.java new file mode 100644 index 0000000..dffe964 --- /dev/null +++ b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/service/WgService.java @@ -0,0 +1,33 @@ +package com.sincere.xiaoanSearch.service; + +import com.sincere.xiaoanSearch.model.PassFail; +import com.sincere.xiaoanSearch.model.SendFail; +import com.sincere.xiaoanSearch.model.SendMessage; +import com.sincere.xiaoanSearch.model.SendSuccess; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/14 0014 15:48 + */ +public interface WgService { + + int insertMessage(SendMessage sendMessage); + + SendMessage selectById(long id); + + SendMessage selectMessage(String deviceId, long index, String functionId); + + int updateMessage(long id, String result, int correct); + + + int insertPassFail(PassFail passFail); + + int insertSendSuccess(SendSuccess sendSuccess); + + int insertSendFail(SendFail sendFail); + + int deleteSendFail(SendFail sendFail); + + int updateSendSuccess(SendSuccess sendSuccess); +} diff --git a/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/service/impl/CheckInServiceImpl.java b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/service/impl/CheckInServiceImpl.java new file mode 100644 index 0000000..eaf6e20 --- /dev/null +++ b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/service/impl/CheckInServiceImpl.java @@ -0,0 +1,27 @@ +package com.sincere.xiaoanSearch.service.impl; + +import com.sincere.xiaoanSearch.mapper.CheckMapper; +import com.sincere.xiaoanSearch.model.CheckIn; +import com.sincere.xiaoanSearch.service.CheckInService; +import org.slf4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/14 0014 14:55 + */ +@Service("checkInService") +public class CheckInServiceImpl implements CheckInService { + + + @Autowired + CheckMapper checkMapper; + + @Override + public void checkIn(CheckIn checkIn) { + checkMapper.checkIn(checkIn); + } + +} diff --git a/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/service/impl/WgServiceImpl.java b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/service/impl/WgServiceImpl.java new file mode 100644 index 0000000..3f8ca66 --- /dev/null +++ b/cloud/xiaoan_search/src/main/java/com/sincere/xiaoanSearch/service/impl/WgServiceImpl.java @@ -0,0 +1,101 @@ +package com.sincere.xiaoanSearch.service.impl; + +import com.sincere.xiaoanSearch.mapper.SendMessageMapper; +import com.sincere.xiaoanSearch.mapper.WgResultMapper; +import com.sincere.xiaoanSearch.model.PassFail; +import com.sincere.xiaoanSearch.model.SendFail; +import com.sincere.xiaoanSearch.model.SendMessage; +import com.sincere.xiaoanSearch.model.SendSuccess; +import com.sincere.xiaoanSearch.service.WgService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * @author chen + * @version 1.0 + * @date 2019/10/14 0014 15:48 + */ +@Service("wgService") +public class WgServiceImpl implements WgService { + + @Autowired + WgResultMapper wgResultMapper; + + @Autowired + SendMessageMapper sendMessageMapper; + + @Override + public int insertMessage(SendMessage sendMessage) { + return sendMessageMapper.insert(sendMessage); + } + + @Override + public SendMessage selectById(long id) { + return sendMessageMapper.selectById(id); + } + + @Override + public SendMessage selectMessage(String deviceId,long index, String functionId) { + SendMessage sendMessage = new SendMessage(); + sendMessage.setDeviceId(deviceId); + sendMessage.setIndex(index); + sendMessage.setFunctionId(functionId); + return sendMessageMapper.selectMessage(sendMessage).get(0); + } + + @Override + public int updateMessage(long id, String result, int correct) { + SendMessage sendMessage = new SendMessage(); + sendMessage.setId(id); + sendMessage.setResult(result); + sendMessage.setCorrect(correct); + return sendMessageMapper.update(sendMessage); + } + + @Override + public int insertPassFail(PassFail passFail) { + return wgResultMapper.insertPassFail(passFail); + } + + @Override + public int insertSendSuccess(SendSuccess sendSuccess) { + SendSuccess updateSuccess = new SendSuccess(); + updateSuccess.setCardNum(sendSuccess.getCardNum()); + updateSuccess.setDeviceId(sendSuccess.getDeviceId()); + updateSuccess.setShiduan(sendSuccess.getShiduan()); + wgResultMapper.updateSendSuccess(updateSuccess); + SendFail updateFail = new SendFail(); + updateFail.setCardNum(sendSuccess.getCardNum()); + updateFail.setDeviceId(sendSuccess.getDeviceId()); + updateFail.setShiduan(sendSuccess.getShiduan()); + wgResultMapper.deleteSendFail(updateFail); + + return wgResultMapper.insertSendSuccess(sendSuccess); + } + + @Override + public int insertSendFail(SendFail sendFail) { + SendSuccess updateSuccess = new SendSuccess(); + updateSuccess.setCardNum(sendFail.getCardNum()); + updateSuccess.setDeviceId(sendFail.getDeviceId()); + updateSuccess.setShiduan(sendFail.getShiduan()); + wgResultMapper.updateSendSuccess(updateSuccess); + SendFail updateFail = new SendFail(); + updateFail.setCardNum(sendFail.getCardNum()); + updateFail.setDeviceId(sendFail.getDeviceId()); + updateFail.setShiduan(sendFail.getShiduan()); + wgResultMapper.deleteSendFail(updateFail); + + return wgResultMapper.insertSendFail(sendFail); + } + + @Override + public int deleteSendFail(SendFail sendFail) { + return wgResultMapper.deleteSendFail(sendFail); + } + + @Override + public int updateSendSuccess(SendSuccess sendSuccess) { + return wgResultMapper.updateSendSuccess(sendSuccess); + } +} diff --git a/cloud/xiaoan_search/src/main/resources/application.yml b/cloud/xiaoan_search/src/main/resources/application.yml new file mode 100644 index 0000000..c9fcda4 --- /dev/null +++ b/cloud/xiaoan_search/src/main/resources/application.yml @@ -0,0 +1,27 @@ +server: + port: 7778 +spring: + application: + name: xiaoanSearch + datasource: + username: SZJXTUSER + password: xst200919 + url: jdbc:sqlserver://60.190.202.57:14333;database=xiaoanhxy + driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver +##mybatis +mybatis: + mapper-locations: classpath:mapper/*.xml + type-aliases-package: com.sincere.xianaoSearch.model + check-config-location: true + +eureka: + instance: + hostname: localhost + lease-expiration-duration-in-seconds: 60 + lease-renewal-interval-in-seconds: 10 + client: + service-url: + defaultZone: http://localhost:8761/eureka/,http://localhost:8762/eureka/ + + + diff --git a/cloud/xiaoan_search/src/main/resources/logback.xml b/cloud/xiaoan_search/src/main/resources/logback.xml new file mode 100644 index 0000000..e3953ee --- /dev/null +++ b/cloud/xiaoan_search/src/main/resources/logback.xml @@ -0,0 +1,61 @@ + + +     +     + +     + + + +     +     +         +         +             +             [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] %highlight([%-5level] %logger{50} - %msg%n) +             UTF-8 +         +     + +     +     +         +         +             +             ${LOG_HOME}/${PROJECT_NAME}.system-dev.%d{yyyy-MM-dd HH}.%i.log +             +             30 +             +             100MB +         + +         +             +             [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] [%-5level] %logger{50} - %msg%n +             UTF-8 +         +     +     +        +    + +    +    +    +    +    +    +    + + +    +    +    +    +    +    +        +        +    + + \ No newline at end of file diff --git a/cloud/xiaoan_search/src/main/resources/mapper/SearchMapper.xml b/cloud/xiaoan_search/src/main/resources/mapper/SearchMapper.xml new file mode 100644 index 0000000..06ef670 --- /dev/null +++ b/cloud/xiaoan_search/src/main/resources/mapper/SearchMapper.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + {call AttendanceService( + #{deviceId,mode=IN} , #{cardNo,mode=IN} , #{funNo,mode=IN}, #{flag,mode=IN} , #{checkTime,mode=IN}, + #{out,mode=OUT,jdbcType=VARCHAR,resultMap=resultMap},#{isSuccess,mode=OUT,jdbcType=INTEGER,resultMap=resultMap} + )} + + + \ No newline at end of file diff --git a/cloud/xiaoan_search/src/main/resources/mapper/SendMessageMapper.xml b/cloud/xiaoan_search/src/main/resources/mapper/SendMessageMapper.xml new file mode 100644 index 0000000..1cf6679 --- /dev/null +++ b/cloud/xiaoan_search/src/main/resources/mapper/SendMessageMapper.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + insert into WG_send_message (device_id,card_no,serial_number,send,result,correct,create_time,function_id) + values (#{deviceId},#{cardNo},#{index},#{send},#{result},#{correct},#{createTime},#{functionId}) + + + + + + + + update WG_send_message set result = #{result} , correct =#{correct} + where id = #{id} + + \ No newline at end of file diff --git a/cloud/xiaoan_search/src/main/resources/mapper/WgResultMapper.xml b/cloud/xiaoan_search/src/main/resources/mapper/WgResultMapper.xml new file mode 100644 index 0000000..481e51a --- /dev/null +++ b/cloud/xiaoan_search/src/main/resources/mapper/WgResultMapper.xml @@ -0,0 +1,38 @@ + + + + + + INSERT INTO WG_PassFail (cardNum, deviceID, direction, resultIntro, createTime , schoolID,inTime) + VALUES (#{cardNum},#{deviceId},#{direction},#{resultIntro},#{createTime},#{schoolId},#{inTime}) + + + + INSERT INTO WG_SendSuccess (deviceID, cardNum, oldCardNum, cardType, customerID, userType, classID, schoolName, studentType, openFlag, status, updateID, createTime, sex, name,schoolID,shiduan) + values (#{deviceId} , #{cardNum}, #{oldCardNum},#{cardType},#{customerId},#{userType},#{classId},#{schoolName},#{studentType},#{openFlag},#{status},#{updateId},#{createTime},#{sex},#{name},#{schoolId},#{shiduan}) + + + + update WG_SendSuccess set status = 0 + + + and deviceID = #{deviceId} + + + and cardNum = #{cardNum} + + + and shiduan = #{shiduan} + + + + + + INSERT INTO WG_SendFail (deviceID, cardNum, cardType, customerID, userType, classID, schoolName, studentType, openFlag, status, updateID, createTime, sex, name , failType, failContent,schoolID,shiduan) + values (#{deviceId} , #{cardNum}, #{cardType},#{customerId},#{userType},#{classId},#{schoolName},#{studentType},#{openFlag},#{status},#{updateId},#{createTime},#{sex},#{name},#{failType},#{failContent},#{schoolId},#{shiduan}) + + + + delete WG_SendFail where deviceID = #{deviceId} and cardNum = #{cardNum} and shiduan=#{shiduan} + + \ No newline at end of file -- libgit2 0.21.0