Commit 17788a111fe687f29ff852690c07b7312b42a074
1 parent
605a62a0
Exists in
master
中控指纹机
Showing
36 changed files
with
1196 additions
and
18 deletions
Show diff stats
cloud/common/src/main/java/com/sincere/common/dto/smartCampus/SZ_AttendanceDto.java
... | ... | @@ -23,6 +23,25 @@ public class SZ_AttendanceDto { |
23 | 23 | |
24 | 24 | private int IsKaoqin; |
25 | 25 | |
26 | + private String ip ; | |
27 | + private int port ; | |
28 | + | |
29 | + public String getIp() { | |
30 | + return ip; | |
31 | + } | |
32 | + | |
33 | + public void setIp(String ip) { | |
34 | + this.ip = ip; | |
35 | + } | |
36 | + | |
37 | + public int getPort() { | |
38 | + return port; | |
39 | + } | |
40 | + | |
41 | + public void setPort(int port) { | |
42 | + this.port = port; | |
43 | + } | |
44 | + | |
26 | 45 | public int getIsKaoqin() { |
27 | 46 | return IsKaoqin; |
28 | 47 | } | ... | ... |
cloud/common/src/main/java/com/sincere/common/dto/smartCampus/SyncUserDto.java
... | ... | @@ -15,14 +15,14 @@ public class SyncUserDto { |
15 | 15 | private int sex ; |
16 | 16 | private String mobile ; |
17 | 17 | private int updateType ; |
18 | - private String hxyCustomerId ; | |
18 | + private String yxyUserId ; | |
19 | 19 | |
20 | - public String getHxyCustomerId() { | |
21 | - return hxyCustomerId; | |
20 | + public String getYxyUserId() { | |
21 | + return yxyUserId; | |
22 | 22 | } |
23 | 23 | |
24 | - public void setHxyCustomerId(String hxyCustomerId) { | |
25 | - this.hxyCustomerId = hxyCustomerId; | |
24 | + public void setYxyUserId(String yxyUserId) { | |
25 | + this.yxyUserId = yxyUserId; | |
26 | 26 | } |
27 | 27 | |
28 | 28 | public int getId() { | ... | ... |
cloud/common/src/main/java/com/sincere/common/dto/xiaoan/FingerDto.java
0 → 100644
... | ... | @@ -0,0 +1,39 @@ |
1 | +package com.sincere.common.dto.xiaoan; | |
2 | + | |
3 | +import java.util.Date; | |
4 | + | |
5 | +/** | |
6 | + * @author chen | |
7 | + * @version 1.0 | |
8 | + * @date 2019/12/31 0031 13:37 | |
9 | + */ | |
10 | +public class FingerDto { | |
11 | + | |
12 | + private int studentId ; | |
13 | + private String orderMsg ; | |
14 | + private Date createTime ; | |
15 | + | |
16 | + public Date getCreateTime() { | |
17 | + return createTime; | |
18 | + } | |
19 | + | |
20 | + public void setCreateTime(Date createTime) { | |
21 | + this.createTime = createTime; | |
22 | + } | |
23 | + | |
24 | + public int getStudentId() { | |
25 | + return studentId; | |
26 | + } | |
27 | + | |
28 | + public void setStudentId(int studentId) { | |
29 | + this.studentId = studentId; | |
30 | + } | |
31 | + | |
32 | + public String getOrderMsg() { | |
33 | + return orderMsg; | |
34 | + } | |
35 | + | |
36 | + public void setOrderMsg(String orderMsg) { | |
37 | + this.orderMsg = orderMsg; | |
38 | + } | |
39 | +} | ... | ... |
cloud/common/src/main/java/com/sincere/common/util/HttpClientUtils.java
... | ... | @@ -46,8 +46,8 @@ public class HttpClientUtils { |
46 | 46 | // JSONObject jsonObject = HttpClientUtils.httpPostJson(url,json); |
47 | 47 | // System.out.println(jsonObject.toJSONString()); |
48 | 48 | |
49 | - String url = "http://115.239.135.60/token/yxt" ; | |
50 | - String json = "key=SZKJ&secret=87dyNIZReZNl6LXGsihfyX3unYgwukSk" ; | |
49 | + String url = "http://campus.myjxt.com/api/Room/GetListPageRoom" ; | |
50 | + String json = "PageIndex=1&roomId=6583&pageSize=9999" ; | |
51 | 51 | JSONObject jsonObject = HttpClientUtils.httpPost(url,json); |
52 | 52 | System.out.println(jsonObject.toJSONString()); |
53 | 53 | } |
... | ... | @@ -84,7 +84,7 @@ public class HttpClientUtils { |
84 | 84 | |
85 | 85 | } |
86 | 86 | } catch (IOException e) { |
87 | - | |
87 | + e.printStackTrace(); | |
88 | 88 | } finally { |
89 | 89 | httpPost.releaseConnection(); |
90 | 90 | } | ... | ... |
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/controller/AttendanceController.java
... | ... | @@ -31,5 +31,18 @@ public class AttendanceController { |
31 | 31 | |
32 | 32 | } |
33 | 33 | |
34 | + @RequestMapping(value = "insertAttendance", method = RequestMethod.POST) | |
35 | + void insertAttendance(@RequestBody SZ_AttendanceDto attendanceDto){ | |
36 | + attendacenService.insertAttendance(attendanceDto); | |
37 | + } | |
38 | + | |
39 | + @RequestMapping(value = "updateAttendance", method = RequestMethod.GET) | |
40 | + void updateAttendance(@RequestParam("clientId") String clientId){ | |
41 | + attendacenService.updateAttendance(clientId); | |
42 | + } | |
34 | 43 | |
44 | + @RequestMapping(value = "selectRoomAttendance", method = RequestMethod.GET) | |
45 | + List<String> selectRoomAttendance(@RequestParam("placeId") int placeId){ | |
46 | + return attendacenService.selectRoomAttendance(placeId); | |
47 | + } | |
35 | 48 | } | ... | ... |
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/controller/UserController.java
0 → 100644
... | ... | @@ -0,0 +1,26 @@ |
1 | +package com.sincere.smartSearch.controller; | |
2 | + | |
3 | +import com.sincere.smartSearch.service.UserService; | |
4 | +import org.springframework.beans.factory.annotation.Autowired; | |
5 | +import org.springframework.web.bind.annotation.RequestMapping; | |
6 | +import org.springframework.web.bind.annotation.RequestMethod; | |
7 | +import org.springframework.web.bind.annotation.RequestParam; | |
8 | +import org.springframework.web.bind.annotation.RestController; | |
9 | + | |
10 | +/** | |
11 | + * @author chen | |
12 | + * @version 1.0 | |
13 | + * @date 2019/12/31 0031 13:53 | |
14 | + */ | |
15 | +@RestController | |
16 | +@RequestMapping("/sm/user") | |
17 | +public class UserController { | |
18 | + | |
19 | + @Autowired | |
20 | + UserService userService; | |
21 | + | |
22 | + @RequestMapping(value = "selectStudentNumByStudentId",method = RequestMethod.GET) | |
23 | + String selectStudentNumByStudentId(@RequestParam("studentId") int studentId){ | |
24 | + return userService.selectStudentNumByStudentId(studentId); | |
25 | + } | |
26 | +} | ... | ... |
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/mapper/AttendaceMapper.java
... | ... | @@ -13,4 +13,10 @@ public interface AttendaceMapper { |
13 | 13 | |
14 | 14 | List<SZ_AttendanceDto> getAttensWithIsKaoqin(int IsKaoqin); |
15 | 15 | |
16 | + int insertAttendance(SZ_AttendanceDto attendanceDto) ; | |
17 | + | |
18 | + int updateAttendance(String client_id); | |
19 | + | |
20 | + List<String> selectRoomAttendance(int placeId); | |
21 | + | |
16 | 22 | } | ... | ... |
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/mapper/UserMapper.java
0 → 100644
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/service/AttendacenService.java
... | ... | @@ -13,4 +13,9 @@ public interface AttendacenService { |
13 | 13 | |
14 | 14 | List<SZ_AttendanceDto> getAttensWithIsKaoqin(int IsKaoqin); |
15 | 15 | |
16 | + int insertAttendance(SZ_AttendanceDto attendanceDto) ; | |
17 | + | |
18 | + int updateAttendance(String client_id); | |
19 | + | |
20 | + List<String> selectRoomAttendance(int placeId); | |
16 | 21 | } | ... | ... |
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/service/UserService.java
0 → 100644
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/service/impl/AttendacenServiceImp.java
... | ... | @@ -24,4 +24,19 @@ public class AttendacenServiceImp implements AttendacenService { |
24 | 24 | |
25 | 25 | return attendaceMapper.getAttensWithIsKaoqin(IsKaoqin); |
26 | 26 | } |
27 | + | |
28 | + @Override | |
29 | + public int insertAttendance(SZ_AttendanceDto attendanceDto) { | |
30 | + return attendaceMapper.insertAttendance(attendanceDto); | |
31 | + } | |
32 | + | |
33 | + @Override | |
34 | + public int updateAttendance(String client_id) { | |
35 | + return attendaceMapper.updateAttendance(client_id); | |
36 | + } | |
37 | + | |
38 | + @Override | |
39 | + public List<String> selectRoomAttendance(int placeId) { | |
40 | + return attendaceMapper.selectRoomAttendance(placeId); | |
41 | + } | |
27 | 42 | } | ... | ... |
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/service/impl/UserServiceImpl.java
0 → 100644
... | ... | @@ -0,0 +1,23 @@ |
1 | +package com.sincere.smartSearch.service.impl; | |
2 | + | |
3 | +import com.sincere.smartSearch.mapper.UserMapper; | |
4 | +import com.sincere.smartSearch.service.UserService; | |
5 | +import org.springframework.beans.factory.annotation.Autowired; | |
6 | +import org.springframework.stereotype.Service; | |
7 | + | |
8 | +/** | |
9 | + * @author chen | |
10 | + * @version 1.0 | |
11 | + * @date 2019/12/31 0031 13:53 | |
12 | + */ | |
13 | +@Service | |
14 | +public class UserServiceImpl implements UserService { | |
15 | + | |
16 | + @Autowired | |
17 | + UserMapper userMapper ; | |
18 | + | |
19 | + @Override | |
20 | + public String selectStudentNumByStudentId(int studentId) { | |
21 | + return userMapper.selectStudentNumByStudentId(studentId); | |
22 | + } | |
23 | +} | ... | ... |
cloud/search_smartCampus/src/main/resources/application.yml
... | ... | @@ -4,12 +4,12 @@ spring: |
4 | 4 | application: |
5 | 5 | name: smartCampusSearch |
6 | 6 | datasource: |
7 | -# username: szjxtuser | |
8 | -# password: RQminVCJota3H1u8bBYH | |
9 | -# url: jdbc:sqlserver://116.62.155.137:33419;database=SmartCampus | |
10 | - username: SZJXTUSER | |
11 | - password: xst200919 | |
12 | - url: jdbc:sqlserver://60.190.202.57:14333;database=SmartCampusSZ | |
7 | + username: szjxtuser | |
8 | + password: RQminVCJota3H1u8bBYH | |
9 | + url: jdbc:sqlserver://116.62.155.137:33419;database=SmartCampus | |
10 | +# username: SZJXTUSER | |
11 | +# password: xst200919 | |
12 | +# url: jdbc:sqlserver://60.190.202.57:14333;database=SmartCampusSZ | |
13 | 13 | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
14 | 14 | mvc: |
15 | 15 | static-path-pattern: /images/** | ... | ... |
cloud/search_smartCampus/src/main/resources/mapper/AttendanceMapper.xml
... | ... | @@ -28,4 +28,18 @@ |
28 | 28 | |
29 | 29 | </select> |
30 | 30 | |
31 | + <insert id="insertAttendance" parameterType="com.sincere.common.dto.smartCampus.SZ_AttendanceDto"> | |
32 | + insert into SZ_Attendance(clint_id , clint_type , ip , port , intime ,school_id , state) | |
33 | + values (#{clint_id},#{clint_type},#{ip} , #{port},#{intime},#{school_id},#{state}) | |
34 | + </insert> | |
35 | + | |
36 | + <update id="updateAttendance" parameterType="java.lang.String"> | |
37 | + update SZ_Attendance set lastlogin_time = GETDATE() , isConnection = 1 where clint_id = #{clint_id} | |
38 | + </update> | |
39 | + | |
40 | + | |
41 | + <select id="selectRoomAttendance" parameterType="java.lang.Integer" resultType="java.lang.String"> | |
42 | + select KaoQinAttendance from XA_PlaceAttendance where PlaceId = #{placeId} | |
43 | + </select> | |
44 | + | |
31 | 45 | </mapper> | ... | ... |
cloud/search_smartCampus/src/main/resources/mapper/SyncMapper.xml
... | ... | @@ -48,7 +48,7 @@ |
48 | 48 | </update> |
49 | 49 | |
50 | 50 | <update id="updateUser" parameterType="java.lang.Integer" > |
51 | - update HS_StudentUpdateCard set yxy_is_new = 1 where ID = #{id} | |
51 | + update HS_StudentUpdateCard set Yxy_IsNew = 1 where ID = #{id} | |
52 | 52 | </update> |
53 | 53 | |
54 | 54 | <resultMap id="UserDtp" type="com.sincere.common.dto.smartCampus.SyncUserDto"> |
... | ... | @@ -60,7 +60,7 @@ |
60 | 60 | <result column="Sex" property="sex" /> |
61 | 61 | <result column="mobile" property="mobile" /> |
62 | 62 | <result column="UpdateType" property="updateType" /> |
63 | - <result column="hxyCustomerId" property="hxyCustomerId" /> | |
63 | + <result column="yxyUserId" property="yxyUserId" /> | |
64 | 64 | </resultMap> |
65 | 65 | <select id="selectUser" parameterType="java.lang.Integer" resultMap="UserDtp"> |
66 | 66 | select HS_StudentUpdateCard.ID , HS_StudentUpdateCard.UserType , HS_StudentUpdateCard.Name , HS_StudentUpdateCard.ClassId , HS_StudentUpdateCard.CustomerId , HS_StudentUpdateCard.Sex , HS_StudentUpdateCard.mobile , HS_StudentUpdateCard.UpdateType , SZ_UserRelation.yxyUserId from HS_StudentUpdateCard |
... | ... | @@ -74,7 +74,7 @@ |
74 | 74 | </insert> |
75 | 75 | |
76 | 76 | <update id="updateDeptRelation" parameterType="com.sincere.common.dto.smartCampus.DeptRelationDto"> |
77 | - update SZ_DeptRelation set updateTime = GETDATE() where state = #{state} and hxyDeptId = #{hxyDeptId} | |
77 | + update SZ_DeptRelation set updateTime = GETDATE() , state = #{state} where hxyDeptId = #{hxyDeptId} | |
78 | 78 | </update> |
79 | 79 | |
80 | 80 | <select id="selectYxyIdByHxyId" parameterType="java.lang.Integer" resultType="java.lang.String"> |
... | ... | @@ -88,7 +88,7 @@ |
88 | 88 | </insert> |
89 | 89 | |
90 | 90 | <update id="updateUserRelation" parameterType="com.sincere.common.dto.smartCampus.DeptRelationDto"> |
91 | - update SZ_UserRelation set updateTime = GETDATE() where state = #{state} and hxyCustomerId = #{hxyCustomerId} | |
91 | + update SZ_UserRelation set updateTime = GETDATE() , state = #{state} where hxyCustomerId = #{hxyCustomerId} | |
92 | 92 | </update> |
93 | 93 | |
94 | 94 | <select id="selectUserYxyIdByHxyId" parameterType="java.lang.String" resultType="java.lang.String"> | ... | ... |
cloud/search_smartCampus/src/main/resources/mapper/UserMapper.xml
0 → 100644
... | ... | @@ -0,0 +1,9 @@ |
1 | +<?xml version="1.0" encoding="UTF-8" ?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | |
3 | +<mapper namespace="com.sincere.smartSearch.mapper.UserMapper" > | |
4 | + | |
5 | + <select id="selectStudentNumByStudentId" parameterType="java.lang.Integer" resultType="java.lang.String"> | |
6 | + select student_num from SZ_V_School_Student where student_id = #{studentId} | |
7 | + </select> | |
8 | + | |
9 | +</mapper> | |
0 | 10 | \ No newline at end of file | ... | ... |
cloud/search_xiaoan/src/main/java/com/sincere/xiaoanSearch/controller/ZkController.java
0 → 100644
... | ... | @@ -0,0 +1,30 @@ |
1 | +package com.sincere.xiaoanSearch.controller; | |
2 | + | |
3 | +import com.sincere.common.dto.xiaoan.CheckInDto; | |
4 | +import com.sincere.common.dto.xiaoan.CheckOutDto; | |
5 | +import com.sincere.common.dto.xiaoan.FingerDto; | |
6 | +import com.sincere.xiaoanSearch.model.CheckIn; | |
7 | +import com.sincere.xiaoanSearch.service.ZkService; | |
8 | +import org.springframework.beans.factory.annotation.Autowired; | |
9 | +import org.springframework.web.bind.annotation.RequestBody; | |
10 | +import org.springframework.web.bind.annotation.RequestMapping; | |
11 | +import org.springframework.web.bind.annotation.RequestMethod; | |
12 | +import org.springframework.web.bind.annotation.RestController; | |
13 | + | |
14 | +/** | |
15 | + * @author chen | |
16 | + * @version 1.0 | |
17 | + * @date 2019/12/31 0031 13:41 | |
18 | + */ | |
19 | +@RestController | |
20 | +@RequestMapping("/xa/zk") | |
21 | +public class ZkController { | |
22 | + | |
23 | + @Autowired | |
24 | + ZkService zkService ; | |
25 | + | |
26 | + @RequestMapping(value = "insertFinger",method = RequestMethod.POST) | |
27 | + public int insertFinger(@RequestBody FingerDto fingerDto){ | |
28 | + return zkService.insertFinger(fingerDto); | |
29 | + } | |
30 | +} | ... | ... |
cloud/search_xiaoan/src/main/java/com/sincere/xiaoanSearch/mapper/FingerMapper.java
0 → 100644
... | ... | @@ -0,0 +1,13 @@ |
1 | +package com.sincere.xiaoanSearch.mapper; | |
2 | + | |
3 | +import com.sincere.common.dto.xiaoan.FingerDto; | |
4 | + | |
5 | +/** | |
6 | + * @author chen | |
7 | + * @version 1.0 | |
8 | + * @date 2019/12/31 0031 13:38 | |
9 | + */ | |
10 | +public interface FingerMapper { | |
11 | + | |
12 | + int insertFinger(FingerDto fingerDto); | |
13 | +} | ... | ... |
cloud/search_xiaoan/src/main/java/com/sincere/xiaoanSearch/service/ZkService.java
0 → 100644
... | ... | @@ -0,0 +1,12 @@ |
1 | +package com.sincere.xiaoanSearch.service; | |
2 | + | |
3 | +import com.sincere.common.dto.xiaoan.FingerDto; | |
4 | + | |
5 | +/** | |
6 | + * @author chen | |
7 | + * @version 1.0 | |
8 | + * @date 2019/12/31 0031 13:40 | |
9 | + */ | |
10 | +public interface ZkService { | |
11 | + int insertFinger(FingerDto fingerDto); | |
12 | +} | ... | ... |
cloud/search_xiaoan/src/main/java/com/sincere/xiaoanSearch/service/impl/ZkServiceImpl.java
0 → 100644
... | ... | @@ -0,0 +1,24 @@ |
1 | +package com.sincere.xiaoanSearch.service.impl; | |
2 | + | |
3 | +import com.sincere.common.dto.xiaoan.FingerDto; | |
4 | +import com.sincere.xiaoanSearch.mapper.FingerMapper; | |
5 | +import com.sincere.xiaoanSearch.service.ZkService; | |
6 | +import org.springframework.beans.factory.annotation.Autowired; | |
7 | +import org.springframework.stereotype.Service; | |
8 | + | |
9 | +/** | |
10 | + * @author chen | |
11 | + * @version 1.0 | |
12 | + * @date 2019/12/31 0031 13:40 | |
13 | + */ | |
14 | +@Service | |
15 | +public class ZkServiceImpl implements ZkService { | |
16 | + | |
17 | + @Autowired | |
18 | + FingerMapper fingerMapper ; | |
19 | + | |
20 | + @Override | |
21 | + public int insertFinger(FingerDto fingerDto) { | |
22 | + return fingerMapper.insertFinger(fingerDto); | |
23 | + } | |
24 | +} | ... | ... |
cloud/search_xiaoan/src/main/resources/mapper/FingerMapper.xml
0 → 100644
... | ... | @@ -0,0 +1,11 @@ |
1 | +<?xml version="1.0" encoding="UTF-8" ?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | |
3 | +<mapper namespace="com.sincere.xiaoanSearch.mapper.FingerMapper" > | |
4 | + | |
5 | + | |
6 | + <insert id="insertFinger" parameterType="com.sincere.common.dto.xiaoan.FingerDto"> | |
7 | + insert into zk_finger (student_id , order_msg , create_time) | |
8 | + values (#{studentId},#{orderMsg},#{createTime}) | |
9 | + </insert> | |
10 | + | |
11 | +</mapper> | |
0 | 12 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,138 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | |
3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
4 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
5 | + <parent> | |
6 | + <artifactId>cloud</artifactId> | |
7 | + <groupId>com.sincere</groupId> | |
8 | + <version>1.0.0</version> | |
9 | + </parent> | |
10 | + <modelVersion>4.0.0</modelVersion> | |
11 | + | |
12 | + <artifactId>zkAttendance</artifactId> | |
13 | + | |
14 | + <dependencies> | |
15 | + <dependency> | |
16 | + <groupId>com.sincere</groupId> | |
17 | + <artifactId>common</artifactId> | |
18 | + <version>1.0.0</version> | |
19 | + </dependency> | |
20 | + <dependency> | |
21 | + <groupId>org.springframework.boot</groupId> | |
22 | + <artifactId>spring-boot-starter-test</artifactId> | |
23 | + <scope>test</scope> | |
24 | + </dependency> | |
25 | + <dependency> | |
26 | + <groupId>org.springframework.cloud</groupId> | |
27 | + <artifactId>spring-cloud-starter-feign</artifactId> | |
28 | + <version>1.3.6.RELEASE</version> | |
29 | + </dependency> | |
30 | + <dependency> | |
31 | + <groupId>org.springframework.cloud</groupId> | |
32 | + <artifactId>spring-cloud-openfeign-core</artifactId> | |
33 | + <version>2.1.2.RELEASE</version> | |
34 | + </dependency> | |
35 | + <dependency> | |
36 | + <groupId>org.apache.commons</groupId> | |
37 | + <artifactId>commons-lang3</artifactId> | |
38 | + <version>3.3.2</version> | |
39 | + </dependency> | |
40 | + </dependencies> | |
41 | + | |
42 | + <dependencyManagement> | |
43 | + <dependencies> | |
44 | + <dependency> | |
45 | + <groupId>org.springframework.cloud</groupId> | |
46 | + <artifactId>spring-cloud-dependencies</artifactId> | |
47 | + <version>${spring-cloud.version}</version> | |
48 | + <type>pom</type> | |
49 | + <scope>import</scope> | |
50 | + </dependency> | |
51 | + </dependencies> | |
52 | + </dependencyManagement> | |
53 | + | |
54 | + <build> | |
55 | + <!--打包文件名--> | |
56 | + <finalName>att_server</finalName> | |
57 | + <!--打包方式--> | |
58 | + <plugins> | |
59 | + <!-- 设置编译版本 --> | |
60 | + <plugin> | |
61 | + <groupId>org.apache.maven.plugins</groupId> | |
62 | + <artifactId>maven-compiler-plugin</artifactId> | |
63 | + <version>3.1</version> | |
64 | + <configuration> | |
65 | + <source>1.8</source> | |
66 | + <target>1.8</target> | |
67 | + <encoding>UTF-8</encoding> | |
68 | + </configuration> | |
69 | + </plugin> | |
70 | + <!-- 打包jar文件时,配置manifest文件,加入lib包的jar依赖 --> | |
71 | + <!-- 本地启动需要注释--> | |
72 | + <plugin> | |
73 | + <groupId>org.apache.maven.plugins</groupId> | |
74 | + <artifactId>maven-jar-plugin</artifactId> | |
75 | + <configuration> | |
76 | + <archive> | |
77 | + <manifest> | |
78 | + <mainClass>com.sincere.quartz.QuartzApplication</mainClass> | |
79 | + <addClasspath>true</addClasspath> | |
80 | + <classpathPrefix>lib/</classpathPrefix> | |
81 | + </manifest> | |
82 | + <manifestEntries> | |
83 | + <Class-Path>./config/</Class-Path> | |
84 | + </manifestEntries> | |
85 | + </archive> | |
86 | + <excludes> | |
87 | + <exclude>config/**</exclude> | |
88 | + </excludes> | |
89 | + <classesDirectory></classesDirectory> | |
90 | + </configuration> | |
91 | + </plugin> | |
92 | + <!-- 拷贝依赖的jar包到lib目录 --> | |
93 | + <plugin> | |
94 | + <groupId>org.apache.maven.plugins</groupId> | |
95 | + <artifactId>maven-dependency-plugin</artifactId> | |
96 | + <executions> | |
97 | + <execution> | |
98 | + <id>copy</id> | |
99 | + <phase>package</phase> | |
100 | + <goals> | |
101 | + <goal>copy-dependencies</goal> | |
102 | + </goals> | |
103 | + <configuration> | |
104 | + <outputDirectory> | |
105 | + ${project.build.directory}/lib | |
106 | + </outputDirectory> | |
107 | + </configuration> | |
108 | + </execution> | |
109 | + </executions> | |
110 | + </plugin> | |
111 | + <!-- 解决资源文件的编码问题 --> | |
112 | + <plugin> | |
113 | + <groupId>org.apache.maven.plugins</groupId> | |
114 | + <artifactId>maven-resources-plugin</artifactId> | |
115 | + <version>2.5</version> | |
116 | + <configuration> | |
117 | + <encoding>UTF-8</encoding> | |
118 | + </configuration> | |
119 | + </plugin> | |
120 | + <!-- 打包source文件为jar文件 --> | |
121 | + <plugin> | |
122 | + <artifactId>maven-source-plugin</artifactId> | |
123 | + <version>2.2</version> | |
124 | + <configuration> | |
125 | + <attach>true</attach> | |
126 | + </configuration> | |
127 | + <executions> | |
128 | + <execution> | |
129 | + <phase>compile</phase> | |
130 | + <goals> | |
131 | + <goal>jar</goal> | |
132 | + </goals> | |
133 | + </execution> | |
134 | + </executions> | |
135 | + </plugin> | |
136 | + </plugins> | |
137 | + </build> | |
138 | +</project> | |
0 | 139 | \ No newline at end of file | ... | ... |
cloud/zkAttendance/src/main/java/com/sincere/att/AttApplication.java
0 → 100644
... | ... | @@ -0,0 +1,21 @@ |
1 | +package com.sincere.att; | |
2 | + | |
3 | +import org.springframework.boot.SpringApplication; | |
4 | +import org.springframework.boot.autoconfigure.SpringBootApplication; | |
5 | +import org.springframework.cloud.netflix.eureka.EnableEurekaClient; | |
6 | +import org.springframework.cloud.openfeign.EnableFeignClients; | |
7 | + | |
8 | +/** | |
9 | + * @author chen | |
10 | + * @version 1.0 | |
11 | + * @date 2019/11/27 0027 14:24 | |
12 | + */ | |
13 | +@EnableFeignClients(basePackages = "com.sincere.att.feign") | |
14 | +@EnableEurekaClient | |
15 | +@SpringBootApplication | |
16 | +public class AttApplication { | |
17 | + | |
18 | + public static void main(String[] args) { | |
19 | + SpringApplication.run(AttApplication.class, args); | |
20 | + } | |
21 | +} | ... | ... |
cloud/zkAttendance/src/main/java/com/sincere/att/Swagger2.java
0 → 100644
... | ... | @@ -0,0 +1,38 @@ |
1 | +package com.sincere.att; | |
2 | + | |
3 | +import io.swagger.annotations.ApiOperation; | |
4 | +import org.springframework.context.annotation.Bean; | |
5 | +import org.springframework.context.annotation.Configuration; | |
6 | +import springfox.documentation.builders.ApiInfoBuilder; | |
7 | +import springfox.documentation.builders.PathSelectors; | |
8 | +import springfox.documentation.builders.RequestHandlerSelectors; | |
9 | +import springfox.documentation.service.ApiInfo; | |
10 | +import springfox.documentation.spi.DocumentationType; | |
11 | +import springfox.documentation.spring.web.plugins.Docket; | |
12 | +import springfox.documentation.swagger2.annotations.EnableSwagger2; | |
13 | + | |
14 | +@EnableSwagger2 | |
15 | +@Configuration //让Spring来加载该类配置 | |
16 | +public class Swagger2 { | |
17 | + | |
18 | + @Bean | |
19 | + public Docket createRestApi() { | |
20 | + return new Docket(DocumentationType.SWAGGER_2) | |
21 | + .apiInfo(apiInfo()) | |
22 | + .enableUrlTemplating(true) | |
23 | + .select() | |
24 | + // 扫描所有有注解的api,用这种方式更灵活 | |
25 | + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) | |
26 | + .paths(PathSelectors.any()) | |
27 | + .build(); | |
28 | + | |
29 | + } | |
30 | + private ApiInfo apiInfo() { | |
31 | + return new ApiInfoBuilder() | |
32 | + .title("Spring Boot中使用Swagger2构建RESTful APIs") | |
33 | + .description("接口文档") | |
34 | + .termsOfServiceUrl("") | |
35 | + .version("1.0") | |
36 | + .build(); | |
37 | + } | |
38 | +} | ... | ... |
cloud/zkAttendance/src/main/java/com/sincere/att/controller/AttPushController.java
0 → 100644
... | ... | @@ -0,0 +1,295 @@ |
1 | +package com.sincere.att.controller; | |
2 | + | |
3 | +import com.alibaba.fastjson.JSON; | |
4 | +import com.alibaba.fastjson.JSONArray; | |
5 | +import com.alibaba.fastjson.JSONObject; | |
6 | +import com.sincere.att.feign.ScFeign; | |
7 | +import com.sincere.att.feign.XaFeign; | |
8 | +import com.sincere.att.logs.LogName; | |
9 | +import com.sincere.att.logs.LoggerUtils; | |
10 | +import com.sincere.att.vo.AttendanceInfoBean; | |
11 | +import com.sincere.att.vo.UserOrderVo; | |
12 | +import com.sincere.common.dto.smartCampus.SZ_AttendanceDto; | |
13 | +import com.sincere.common.dto.xiaoan.FingerDto; | |
14 | +import com.sincere.common.util.DateUtils; | |
15 | +import com.sincere.common.util.HttpClientUtils; | |
16 | +import org.slf4j.Logger; | |
17 | +import org.springframework.beans.factory.annotation.Autowired; | |
18 | +import org.springframework.stereotype.Controller; | |
19 | +import org.springframework.web.bind.annotation.*; | |
20 | + | |
21 | +import javax.servlet.http.HttpServletRequest; | |
22 | +import javax.servlet.http.HttpServletResponse; | |
23 | +import java.io.ByteArrayOutputStream; | |
24 | +import java.io.IOException; | |
25 | +import java.io.InputStream; | |
26 | +import java.io.UnsupportedEncodingException; | |
27 | +import java.math.BigInteger; | |
28 | +import java.text.SimpleDateFormat; | |
29 | +import java.util.*; | |
30 | + | |
31 | +/** | |
32 | + * 所有的设备请求都会在url参数里携带SN,这是设备序列号(serial number的缩写),每个设备唯一标识 | |
33 | + */ | |
34 | +@Controller | |
35 | +@RequestMapping("/iclock") | |
36 | +public class AttPushController { | |
37 | + private static final Logger Log_orderFail = LoggerUtils.Logger(LogName.orderFail); | |
38 | + private static final Logger Log_orderSuccess = LoggerUtils.Logger(LogName.orderSuccess); | |
39 | + private static final Logger Log_kaoInfo = LoggerUtils.Logger(LogName.kaoInfo); | |
40 | + | |
41 | + private static Map<String, List<String>> cmdMap = new HashMap<>(); | |
42 | + private static Map<String , Integer> cmdOrderMap = new HashMap<>(); | |
43 | + | |
44 | + private static String pwd = "22222222-6faf-48uh-a5a9-447ec68bfe2f" ; | |
45 | + private static String account = "yueqingzhijiao" ; | |
46 | + | |
47 | + | |
48 | + @Autowired | |
49 | + ScFeign scFeign; | |
50 | + | |
51 | + @Autowired | |
52 | + XaFeign xaFeign ; | |
53 | + | |
54 | + @RequestMapping(value = "sendOrder/{roomId}" , method = RequestMethod.GET) | |
55 | + public void sendOrder(@PathVariable int roomId){ | |
56 | + JSONObject object = new JSONObject(); | |
57 | + object.put("PageIndex",1); | |
58 | + object.put("roomId",roomId); | |
59 | + object.put("pageSize",9999); | |
60 | + JSONObject result = HttpClientUtils.httpPostJson("http://campus.myjxt.com/api/Room/GetListPageRoom",object.toJSONString()); | |
61 | + JSONArray array = (JSONArray) ((JSONObject) result.get("data")).get("roomList") ; | |
62 | + List<String> order = new ArrayList<>(); | |
63 | + List<String> attendanceList = scFeign.selectRoomAttendance(roomId); | |
64 | + for(String attendance : attendanceList){ | |
65 | + for(int i = 0 ; i < array.size() ; i++){ | |
66 | + JSONObject student = (JSONObject) array.get(i); | |
67 | + UserOrderVo vo = new UserOrderVo(); | |
68 | + vo.setStudentId((Integer) student.get("studentid")); | |
69 | + vo.setStudentName((String) student.get("name")); | |
70 | + int number = 1 ; | |
71 | + try{ | |
72 | + number = cmdOrderMap.get(attendance) ; | |
73 | + }catch (Exception e){ | |
74 | + | |
75 | + } | |
76 | + vo.setNumber(number); | |
77 | + number++ ; | |
78 | + cmdOrderMap.put(attendance,number) ; | |
79 | + if(vo.getStudentId() != 0){ | |
80 | + order.add(vo.toString()); | |
81 | + } | |
82 | + } | |
83 | + cmdMap.put(attendance,order); | |
84 | + } | |
85 | + } | |
86 | + /** | |
87 | + * 1,设备通完电以后第一个发送到后台的请求 | |
88 | + * 格式为 /iclock/cdata?options=all&language=xxxx&pushver=xxxx | |
89 | + */ | |
90 | + @RequestMapping(value="/cdata",params = {"options","language","pushver"},method = RequestMethod.GET) | |
91 | + public void init(String SN, String options, String language, String pushver, HttpServletRequest request , | |
92 | + @RequestParam(required = false) String PushOptionsFlag, HttpServletResponse response){ | |
93 | + try { | |
94 | + if(cmdMap.get(SN) == null){ | |
95 | + cmdMap.put(SN,new ArrayList<>()); | |
96 | + cmdOrderMap.put(SN,1); | |
97 | + } | |
98 | + if(scFeign.selectAttendaceWithId(SN) == null){ | |
99 | + SZ_AttendanceDto attendanceDto = new SZ_AttendanceDto(); | |
100 | + attendanceDto.setClint_id(SN); | |
101 | + attendanceDto.setClint_type("24"); | |
102 | + attendanceDto.setIp(request.getRemoteAddr()); | |
103 | + attendanceDto.setPort(request.getRemotePort()); | |
104 | + attendanceDto.setIntime(DateUtils.date2String(new Date(),DateUtils.format2)); | |
105 | + attendanceDto.setSchool_id("-1"); | |
106 | + attendanceDto.setState(1); | |
107 | + scFeign.insertAttendance(attendanceDto); | |
108 | + }else { | |
109 | + scFeign.updateAttendance(SN); | |
110 | + } | |
111 | + String initOptions = initOptions(SN,PushOptionsFlag); | |
112 | + response.getWriter().write(initOptions);//返回成功以后设备会发送心跳请求 | |
113 | + } catch (IOException e) { | |
114 | + e.printStackTrace(); | |
115 | + } | |
116 | + } | |
117 | + | |
118 | + /** | |
119 | + * 2,心跳请求,会从服务器拿到命令返回 给设备 | |
120 | + */ | |
121 | + @RequestMapping("/getrequest") | |
122 | + public void heartBeat(String SN, HttpServletResponse response){ | |
123 | + scFeign.updateAttendance(SN); | |
124 | + StringBuffer sb = new StringBuffer("OK"); | |
125 | + List<String> cmds = cmdMap.get(SN); | |
126 | + if(cmds==null){//等于空说明从来没加载过,如果初始化加载过了,此时应该不为Null 只是size为0 | |
127 | + cmds = new ArrayList<>(); | |
128 | + cmdMap.put(SN,cmds); | |
129 | + cmdOrderMap.put(SN,1); | |
130 | + } | |
131 | + if(cmds!=null&&cmds.size()>0){ | |
132 | + sb.setLength(0);//如果有命令就不返回OK了 | |
133 | + cmds.stream().forEach(cmd->sb.append(cmd).append("\r\n\r\n")); | |
134 | + | |
135 | + } | |
136 | + try { | |
137 | + response.setCharacterEncoding("gbk"); | |
138 | + response.getWriter().write(sb.toString()); | |
139 | + } catch (IOException e) { | |
140 | + e.printStackTrace(); | |
141 | + } | |
142 | + } | |
143 | + | |
144 | + | |
145 | + /** | |
146 | + * 3,候补心跳请求,正常情况下设备不发此请求,有大量数据上传的时候,不发上面的心跳,发这个请求, | |
147 | + * 这个请求,服务器只能返回OK,不可以返回命令 | |
148 | + */ | |
149 | + @RequestMapping("/ping") | |
150 | + public void ping(HttpServletResponse response){ | |
151 | + System.out.println("考勤机心跳请求大量进来了......ping"+new SimpleDateFormat("HH:mm:ss").format(new Date())); | |
152 | + try { | |
153 | + response.getWriter().write("OK"); | |
154 | + } catch (IOException e) { | |
155 | + e.printStackTrace(); | |
156 | + } | |
157 | + } | |
158 | + | |
159 | + /** | |
160 | + * 4,设备端处理完命令以后会发送该请求,告诉服务器命令的处理结果 | |
161 | + */ | |
162 | + @RequestMapping("/devicecmd") | |
163 | + public void handleCmd(String SN, @RequestBody String data, HttpServletResponse response){ | |
164 | + //判断data 清空map | |
165 | + List<String> cmdList = cmdMap.get(SN); | |
166 | + String[] returnList = data.split("\n"); | |
167 | + if(returnList.length > 0 && cmdList.size() > 0){ | |
168 | + for(String message : returnList){ | |
169 | + String number = message.substring(message.indexOf("=")+1,message.indexOf("&")); | |
170 | + String result = message.substring(message.indexOf("=",message.indexOf("&"))+1,message.indexOf("&",message.indexOf("&")+1)); | |
171 | + if(result.equals("0")){ | |
172 | + Iterator<String> it = cmdList.iterator(); | |
173 | + while (((Iterator) it).hasNext()) { | |
174 | + String b = it.next(); | |
175 | + if (b.contains("C:"+number)) { | |
176 | + Log_orderSuccess.info("指令成功=========="+b); | |
177 | + it.remove(); | |
178 | + } | |
179 | + } | |
180 | + } | |
181 | + } | |
182 | + } | |
183 | + try { | |
184 | + response.getWriter().write("OK"); | |
185 | + } catch (IOException e) { | |
186 | + e.printStackTrace(); | |
187 | + } | |
188 | + } | |
189 | + | |
190 | + | |
191 | + /** | |
192 | + * 5 考勤数据上报 | |
193 | + */ | |
194 | + @RequestMapping(value = "/cdata") | |
195 | + public void handleRtData(HttpServletRequest request, HttpServletResponse response, String SN, String table) throws UnsupportedEncodingException { | |
196 | + request.setCharacterEncoding("gbk"); | |
197 | + String data = ""; | |
198 | + ByteArrayOutputStream bos = null; | |
199 | + byte[] b= new byte[1024]; | |
200 | + try { | |
201 | + InputStream is = request.getInputStream(); | |
202 | + bos = new ByteArrayOutputStream(); | |
203 | + int len = 0; | |
204 | + while((len=is.read(b))!=-1){ | |
205 | + bos.write(b,0,len); | |
206 | + } | |
207 | + data = new String(bos.toByteArray(),"gbk"); | |
208 | + } catch (IOException e) { | |
209 | + e.printStackTrace(); | |
210 | + } | |
211 | + if("ATTLOG".equals(table)){ | |
212 | + String[] list = data.split("\t"); | |
213 | + String cardNo = scFeign.selectStudentNumByStudentId(Integer.valueOf(list[0])); | |
214 | + cardNo = new BigInteger(cardNo, 16).toString(); | |
215 | + //考勤日志 | |
216 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
217 | + String info = String.format("<AttendanceInfo submitTime=\"%s\"><Info device=\"%s\" card=\"%s\" operTime=\"%s\" direc=\"%s\"></Info></AttendanceInfo>", | |
218 | + simpleDateFormat.format(new Date()), SN, cardNo, list[1], "-1"); | |
219 | + AttendanceInfoBean attendanceInfoBean = new AttendanceInfoBean(); | |
220 | + attendanceInfoBean.setInfo(info); | |
221 | + attendanceInfoBean.setIsControl(0); | |
222 | + attendanceInfoBean.setPwd(pwd); | |
223 | + attendanceInfoBean.setUsername(account); | |
224 | + | |
225 | + String jsonResult = JSON.toJSONString(attendanceInfoBean); | |
226 | + String urlHXY = "http://campus.myjxt.com/api/XiaoAnCommon/SendHXY"; | |
227 | + JSONObject jsonObject = HttpClientUtils.httpPostJson(urlHXY, jsonResult); | |
228 | + if ((int) jsonObject.get("status") == 1){ | |
229 | + Log_kaoInfo.info("出入寝签到成功:" + SN + " 卡号:" + cardNo); | |
230 | + }else { | |
231 | + Log_orderFail.info("出入寝签到失败:" + SN + " 卡号:" + cardNo + " result1:" + jsonObject.toJSONString()); | |
232 | + } | |
233 | + } | |
234 | + if("OPERLOG".equals(table)){ | |
235 | + //操作日志 | |
236 | + if(data.substring(0,3).contains("FP")){ | |
237 | + //添加指纹 | |
238 | + String studentId = data.substring(data.indexOf("=")+1,data.indexOf("\t",data.indexOf("="))); | |
239 | + String order = data.substring(3); | |
240 | + FingerDto fingerDto = new FingerDto(); | |
241 | + fingerDto.setOrderMsg(order); | |
242 | + fingerDto.setStudentId(Integer.valueOf(studentId)); | |
243 | + fingerDto.setCreateTime(new Date()); | |
244 | + xaFeign.insertFinger(fingerDto); | |
245 | + } | |
246 | + } | |
247 | + try { | |
248 | + response.getWriter().write("OK"); | |
249 | + } catch (IOException e) { | |
250 | + e.printStackTrace(); | |
251 | + } | |
252 | + } | |
253 | + | |
254 | + /** | |
255 | + * 设备通电以后连接到服务器,需要返回的初始化参数 | |
256 | + * @param sn | |
257 | + * @param PushOptionsFlag | |
258 | + * @return | |
259 | + */ | |
260 | + private String initOptions(String sn,String PushOptionsFlag) { | |
261 | + StringBuffer devOptions = new StringBuffer(); | |
262 | + devOptions.append("GET OPTION FROM: "+sn); | |
263 | + // + "\nStamp=" + devInfo.devInfoJson.getString("Stamp") | |
264 | + devOptions.append("\nATTLOGStamp=0"); | |
265 | + devOptions.append("\nOPERLOGStamp=0"); | |
266 | + devOptions.append("\nBIODATAStamp=0"); | |
267 | + devOptions.append("\nATTPHOTOStamp=0"); | |
268 | + devOptions.append("\nErrorDelay=10");//断网重连 | |
269 | + devOptions.append("\nDelay=5");//心跳间隔 | |
270 | + devOptions.append("\nTimeZone=8");//时区 | |
271 | + devOptions.append("\nRealtime=1");//实时上传 | |
272 | + devOptions.append("\nServerVer=3.0.1");//这个必须填写 | |
273 | +// 1 考勤记录 | |
274 | +// 2 操作日志 | |
275 | +// 3 考勤照片 | |
276 | +// 4 登记新指纹 | |
277 | +// 5 登记新用户 | |
278 | +// 6 指纹图片 | |
279 | +// 7 修改用户信息 | |
280 | +// 8 修改指纹 | |
281 | +// 9 新登记人脸 | |
282 | +// 10 用户照片 | |
283 | +// 11 工作号码 | |
284 | +// 12 比对照片 | |
285 | + devOptions.append("\nTransFlag=111111111111");// 1-12二进制位 分别代表以上含义 | |
286 | + System.out.println("PushOptionsFlag============="+PushOptionsFlag); | |
287 | + if (PushOptionsFlag!=null&&PushOptionsFlag.equals("1")) | |
288 | + { | |
289 | + // 支持参数单独获取的才要把需要获取的参数回传给设备 modifeid by max 20170926 | |
290 | + devOptions.append("\nPushOptions=RegDeviceType,FingerFunOn,FaceFunOn,FPVersion,FaceVersion,NetworkType,HardwareId3,HardwareId5,HardwareId56,LicenseStatus3,LicenseStatus5,LicenseStatus56"); | |
291 | + } | |
292 | + devOptions.append("\n"); | |
293 | + return devOptions.toString(); | |
294 | + } | |
295 | +} | ... | ... |
cloud/zkAttendance/src/main/java/com/sincere/att/feign/ScFeign.java
0 → 100644
... | ... | @@ -0,0 +1,36 @@ |
1 | +package com.sincere.att.feign; | |
2 | + | |
3 | +import com.sincere.common.dto.smartCampus.SZ_AttendanceDto; | |
4 | +import org.springframework.cloud.openfeign.FeignClient; | |
5 | +import org.springframework.web.bind.annotation.RequestBody; | |
6 | +import org.springframework.web.bind.annotation.RequestMapping; | |
7 | +import org.springframework.web.bind.annotation.RequestMethod; | |
8 | +import org.springframework.web.bind.annotation.RequestParam; | |
9 | + | |
10 | +import java.util.List; | |
11 | + | |
12 | +/** | |
13 | + * @author chen | |
14 | + * @version 1.0 | |
15 | + * @date 2019/12/31 0031 11:08 | |
16 | + */ | |
17 | +@FeignClient("smartCampusSearch") | |
18 | +public interface ScFeign { | |
19 | + | |
20 | + @RequestMapping(value = "attendance/insertAttendance", method = RequestMethod.POST) | |
21 | + void insertAttendance(@RequestBody SZ_AttendanceDto attendanceDto); | |
22 | + | |
23 | + @RequestMapping(value = "attendance/updateAttendance", method = RequestMethod.GET) | |
24 | + void updateAttendance(@RequestParam("clientId") String clientId); | |
25 | + | |
26 | + @RequestMapping(value = "attendance/selectAttendaceWithId" , method = RequestMethod.GET) | |
27 | + SZ_AttendanceDto selectAttendaceWithId(@RequestParam("clint_id") String clint_id); | |
28 | + | |
29 | + @RequestMapping(value = "attendance/selectRoomAttendance", method = RequestMethod.GET) | |
30 | + List<String> selectRoomAttendance(@RequestParam("placeId") int placeId); | |
31 | + | |
32 | + @RequestMapping(value = "/sm/user/selectStudentNumByStudentId",method = RequestMethod.GET) | |
33 | + String selectStudentNumByStudentId(@RequestParam("studentId") int studentId); | |
34 | + | |
35 | + | |
36 | +} | ... | ... |
cloud/zkAttendance/src/main/java/com/sincere/att/feign/XaFeign.java
0 → 100644
... | ... | @@ -0,0 +1,19 @@ |
1 | +package com.sincere.att.feign; | |
2 | + | |
3 | +import com.sincere.common.dto.xiaoan.FingerDto; | |
4 | +import org.springframework.cloud.openfeign.FeignClient; | |
5 | +import org.springframework.web.bind.annotation.RequestBody; | |
6 | +import org.springframework.web.bind.annotation.RequestMapping; | |
7 | +import org.springframework.web.bind.annotation.RequestMethod; | |
8 | + | |
9 | +/** | |
10 | + * @author chen | |
11 | + * @version 1.0 | |
12 | + * @date 2019/12/31 0031 13:42 | |
13 | + */ | |
14 | +@FeignClient("xiaoanSearch") | |
15 | +public interface XaFeign { | |
16 | + | |
17 | + @RequestMapping(value = "/xa/zk/insertFinger",method = RequestMethod.POST) | |
18 | + int insertFinger(@RequestBody FingerDto fingerDto); | |
19 | +} | ... | ... |
cloud/zkAttendance/src/main/java/com/sincere/att/logs/LogName.java
0 → 100644
... | ... | @@ -0,0 +1,39 @@ |
1 | +package com.sincere.att.logs; | |
2 | + | |
3 | +/** | |
4 | + * @author chen | |
5 | + * @version 1.0 | |
6 | + * @date 2019/10/12 0012 16:18 | |
7 | + */ | |
8 | +public enum LogName { | |
9 | + orderSuccess("orderSuccess"), | |
10 | + orderFail("orderFail"), | |
11 | + kaoInfo("kaoInfo"), | |
12 | + heartBeat("heartBeat"), | |
13 | + error("error"); | |
14 | + | |
15 | + private String logFileName; | |
16 | + | |
17 | + LogName(String fileName) { | |
18 | + this.logFileName = fileName; | |
19 | + } | |
20 | + | |
21 | + public String getLogFileName() { | |
22 | + return logFileName; | |
23 | + } | |
24 | + | |
25 | + public void setLogFileName(String logFileName) { | |
26 | + this.logFileName = logFileName; | |
27 | + } | |
28 | + | |
29 | + public static LogName getAwardTypeEnum(String value) { | |
30 | + LogName[] arr = values(); | |
31 | + for (LogName item : arr) { | |
32 | + if (null != item && !item.logFileName.equals("")) { | |
33 | + return item; | |
34 | + } | |
35 | + } | |
36 | + return null; | |
37 | + } | |
38 | +} | |
39 | + | ... | ... |
cloud/zkAttendance/src/main/java/com/sincere/att/logs/LoggerUtils.java
0 → 100644
... | ... | @@ -0,0 +1,27 @@ |
1 | +package com.sincere.att.logs; | |
2 | + | |
3 | +import org.slf4j.Logger; | |
4 | +import org.slf4j.LoggerFactory; | |
5 | + | |
6 | +/** | |
7 | + * @author chen | |
8 | + * @version 1.0 | |
9 | + * @date 2019/10/12 0012 16:19 | |
10 | + */ | |
11 | +public class LoggerUtils { | |
12 | + | |
13 | + public static <T> Logger Logger(Class<T> clazz) { | |
14 | + return LoggerFactory.getLogger(clazz); | |
15 | + } | |
16 | + | |
17 | + /** | |
18 | + * 打印到指定的文件下 | |
19 | + * | |
20 | + * @param desc 日志文件名称 | |
21 | + * @return | |
22 | + */ | |
23 | + public static Logger Logger(LogName desc) { | |
24 | + return LoggerFactory.getLogger(desc.getLogFileName()); | |
25 | + } | |
26 | + | |
27 | +} | ... | ... |
cloud/zkAttendance/src/main/java/com/sincere/att/logs/MyTimeBasedFileNamingAndTriggeringPolicy.java
0 → 100644
... | ... | @@ -0,0 +1,32 @@ |
1 | +package com.sincere.att.logs; | |
2 | + | |
3 | +import ch.qos.logback.core.joran.spi.NoAutoStart; | |
4 | +import ch.qos.logback.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy; | |
5 | + | |
6 | +/** | |
7 | + * @author chen | |
8 | + * @version 1.0 | |
9 | + * @date 2019/10/31 0031 13:42 | |
10 | + */ | |
11 | +@NoAutoStart | |
12 | +public class MyTimeBasedFileNamingAndTriggeringPolicy<E> extends DefaultTimeBasedFileNamingAndTriggeringPolicy<E> { | |
13 | + | |
14 | + //这个用来指定时间间隔 | |
15 | + private Integer multiple = 1; | |
16 | + | |
17 | + @Override | |
18 | + protected void computeNextCheck() { | |
19 | + nextCheck = rc.getEndOfNextNthPeriod(dateInCurrentPeriod, multiple).getTime(); | |
20 | + } | |
21 | + | |
22 | + public Integer getMultiple() { | |
23 | + return multiple; | |
24 | + } | |
25 | + | |
26 | + public void setMultiple(Integer multiple) { | |
27 | + if (multiple > 1) { | |
28 | + this.multiple = multiple; | |
29 | + } | |
30 | + } | |
31 | + | |
32 | +} | ... | ... |
cloud/zkAttendance/src/main/java/com/sincere/att/vo/AttendanceInfoBean.java
0 → 100644
... | ... | @@ -0,0 +1,61 @@ |
1 | +package com.sincere.att.vo; | |
2 | + | |
3 | +/** | |
4 | + * 考勤账号表 | |
5 | + */ | |
6 | +public class AttendanceInfoBean { | |
7 | + | |
8 | + /** | |
9 | + * 控制器类型,0是其他控制器,1是微耕控制器 | |
10 | + */ | |
11 | + private Integer isControl; | |
12 | + | |
13 | + public Integer getIsControl() { | |
14 | + return isControl; | |
15 | + } | |
16 | + | |
17 | + public void setIsControl(Integer isControl) { | |
18 | + this.isControl = isControl; | |
19 | + } | |
20 | + | |
21 | + public String getInfo() { | |
22 | + return info; | |
23 | + } | |
24 | + | |
25 | + public void setInfo(String info) { | |
26 | + this.info = info; | |
27 | + } | |
28 | + | |
29 | + public String getUsername() { | |
30 | + return username; | |
31 | + } | |
32 | + | |
33 | + public void setUsername(String username) { | |
34 | + this.username = username; | |
35 | + } | |
36 | + | |
37 | + public String getPwd() { | |
38 | + return pwd; | |
39 | + } | |
40 | + | |
41 | + public void setPwd(String pwd) { | |
42 | + this.pwd = pwd; | |
43 | + } | |
44 | + | |
45 | + /** | |
46 | + * 刷卡信息,XML格式字符串:<AttendanceInfo submitTime="2017-08-01T16:30:30"> | |
47 | + * <Info device="FD98DC58C467DB43" card="223456789" operTime="2017-08-01T11:20:30" direc="0"></Info> | |
48 | + * </AttendanceInfo> | |
49 | + */ | |
50 | + private String info; | |
51 | + | |
52 | + /** | |
53 | + * 账号 | |
54 | + */ | |
55 | + private String username; | |
56 | + | |
57 | + /** | |
58 | + * 密码 | |
59 | + */ | |
60 | + private String pwd; | |
61 | +} | ... | ... |
cloud/zkAttendance/src/main/java/com/sincere/att/vo/OrderVo.java
0 → 100644
... | ... | @@ -0,0 +1,28 @@ |
1 | +package com.sincere.att.vo; | |
2 | + | |
3 | +/** | |
4 | + * @author chen | |
5 | + * @version 1.0 | |
6 | + * @date 2019/12/31 0031 9:50 | |
7 | + */ | |
8 | +public class OrderVo { | |
9 | + | |
10 | + private int number ; | |
11 | + private int studentId ; | |
12 | + | |
13 | + public int getNumber() { | |
14 | + return number; | |
15 | + } | |
16 | + | |
17 | + public void setNumber(int number) { | |
18 | + this.number = number; | |
19 | + } | |
20 | + | |
21 | + public int getStudentId() { | |
22 | + return studentId; | |
23 | + } | |
24 | + | |
25 | + public void setStudentId(int studentId) { | |
26 | + this.studentId = studentId; | |
27 | + } | |
28 | +} | ... | ... |
cloud/zkAttendance/src/main/java/com/sincere/att/vo/UserOrderVo.java
0 → 100644
... | ... | @@ -0,0 +1,25 @@ |
1 | +package com.sincere.att.vo; | |
2 | + | |
3 | +/** | |
4 | + * @author chen | |
5 | + * @version 1.0 | |
6 | + * @date 2019/12/31 0031 9:08 | |
7 | + */ | |
8 | +public class UserOrderVo extends OrderVo { | |
9 | + | |
10 | + private String studentName ; | |
11 | + | |
12 | + | |
13 | + public String getStudentName() { | |
14 | + return studentName; | |
15 | + } | |
16 | + | |
17 | + public void setStudentName(String studentName) { | |
18 | + this.studentName = studentName; | |
19 | + } | |
20 | + | |
21 | + @Override | |
22 | + public String toString() { | |
23 | + return "C:"+this.getNumber()+":DATA UPDATE USERINFO PIN="+this.getStudentId()+"\tName="+this.getStudentName()+"\tPasswd=\tCard=\tPri=0\r\n\r\n"; | |
24 | + } | |
25 | +} | ... | ... |
... | ... | @@ -0,0 +1,16 @@ |
1 | +server: | |
2 | + port: 8081 | |
3 | + | |
4 | +spring: | |
5 | + application: | |
6 | + name: zkAtt-server | |
7 | + | |
8 | +eureka: | |
9 | + instance: | |
10 | + hostname: localhost | |
11 | + lease-expiration-duration-in-seconds: 60 | |
12 | + lease-renewal-interval-in-seconds: 10 | |
13 | + client: | |
14 | + service-url: | |
15 | + defaultZone: http://localhost:8761/eureka/,http://localhost:8762/eureka/ | |
16 | + | ... | ... |
... | ... | @@ -0,0 +1,3 @@ |
1 | +C:2:DATA UPDATE USERINFO PIN=133\tName=jwz\tPasswd=\tCard=\tPri=0 下发用户 | |
2 | +C:3:DATA QUERY FINGERTMP PIN=133\tFID=6 | |
3 | +C:4:DATA UPDATE FINGERTMP PIN=133\tFID=7\tSize=1636\tValid=1\tTMP=TYlTUzIxAAAEyskECAUHCc7QAAAcy2kBAAAAhHcop8oiAAQP8QDjAInFcgAwAPAPogBAymEP3wBIAE4PjcpOAGAPrACUAGrFAAFrACcPCwB3yoAPrQB3AJkPBcuDAKQPnABAAEjFtACfADoOKwC0yqwPogC0AIQPB8vAALQPwgAMADTFCQHOAKkObwDVyjgPcADUAIYPAsvWAJwOZQA3AELF0gD3ACEPwgH+yvUO4gAMAWAOZMoPAUgP4ADfAQ/FYgAgASsOMwAiy48PVgAtATEOasoyAaoOmgD2AajFCgE0AfsOHwA8y5gPvAA8AVsPkMpCAaIPfwCJAZPF7wBUAYIPsgBTy4wPvQBcAcEPs1LyFdOlSgbua3NB6JK6koftPHIqyw5fygJHDNJkIj+vAcpylhGXFsummIb7nNepuyTXMqIUiRIi3CPymbQu+WslGfKTFXfGpPvq8QLiNPv+zP4QHQt2CJ8S+cYIGmkLxfov8gIxIQ6J9H7++Ar6MhIBjvw/D+IHqDyg6iapgQPPBHvWhH+SGRPwi1n+mE9PIZyBh8cYddcAB4ZUPWhMfrq+EOW1OYGCTIYJXJvobcmZTp+shUhguv4UJQwnETLfHG7mewNkp/y2WtMM3gQinKv1qTJMDkYVRQwc9pYmp+nei8f0CPjaJ6vlPmhbbNJkJIIxNXsgPwHHxyPtAgBuAXDCwAB4y2zCOgYAssQJUgoFANYBCcAFBwRSBXqMPgkAaAsE9MH+RAYAfNZrxApuBACnJAOPEQQnJZB3dMLAAUp6zQHPKQlBRssAcuTs//7B/UY6wS/aAck0icJpBsDHrn/ABwDLNcwvM94AFTqgwsE6icW7dMH/wXwHxWVCqG5sFADcR0lvxQjAiXBcUwbF1khGwMKGBwDYiAb4/fwPAIVOYrFvXIDBFACpUXRXacUKZcBU/koQxYdXlMD/wXjB/wT/UTUXARRVnsG9wvsIaIvBhcJozAChkvb+//3//vYTBGlYa8J8wsAFwcSZwDHAGQEQop7EC3nCwcHBjELBxa7C/MISAMO1g8YPwsCZwMHABGd80gGYh1B+arRxiwtnwcHCDwBYiVQJU3J0wZMNxb2QjMLCwMJfwgGSDsrClCT+ZcIEuQrKgZhMam3COsKMxgHBnDrCwATAjAzFwx4BFJx1a5ZJwMHDxMBwB8BgkcE7CgC1o/jCxKzAjgoAx6P1wG4IxcbDCwDtaa2AD8XGxYsMAFq3R77Bw26QDABhtzkK/sHCcMPABhUFyL+3wYTCwATEmwnAw1xzGQHMy8dbcMGCw5uEvVgOysPMMMCQxAeUJssEz6s9w8FLxa0JWoRxdcPBBsFr6AAK1NbElkbBxAiToMHBwcEFcEA1wP79/w0Ab9U+soLCw8SDGcQC0Wg2Z8TIxcUEwsULwcDBwMPAB8LAwAFw20ZvwAHAlN8ABNuM+ysHwcYAyMLDwHbBBJAKynvoOmLCwgZ6es0BYvVMPCrJAGM/QsL/ooJVwREQxnAqBREWFrLA+TUFEFowEzDBEQP/dTUGED4+P/8mzRGYRhfD/wZZAdo+R/3+OgXVg0vQfgUQP1ADhwYVzVd0Pf4GEPxYAp/DAxB7WBoBAxQPZwDAUkIAzkMFygELRVI= | |
0 | 4 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,118 @@ |
1 | +<?xml version="1.0" encoding="utf-8" ?> | |
2 | +<configuration scan="true" scanPeriod="60 seconds" debug="false"> | |
3 | + <!-- 定义日志文件 输入位置 --> | |
4 | + <property name="logPath" value="d:/zk_log" /> | |
5 | + <!-- 日志最大的历史 30天 --> | |
6 | + <property name="maxHistory" value="600"/> | |
7 | + | |
8 | + <!-- 配置项, 通过此节点配置日志输出位置(控制台、文件、数据库)、输出格式等--> | |
9 | + <!-- ConsoleAppender代表输出到控制台 --> | |
10 | + <appender name="consoleLog" class="ch.qos.logback.core.ConsoleAppender"> | |
11 | + <!-- layout代表输出格式 --> | |
12 | + <layout class="ch.qos.logback.classic.PatternLayout"> | |
13 | + <pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger -%msg%n</pattern> | |
14 | + </layout> | |
15 | + </appender> | |
16 | + <!-- 日志输出文件 --> | |
17 | + <appender name="orderSuccessInfoLog" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
18 | + <encoder> | |
19 | + <pattern>%d{yyyy-MM-dd HH:mm:ss} -%msg%n</pattern> | |
20 | + </encoder> | |
21 | + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |
22 | + <timeBasedFileNamingAndTriggeringPolicy class="com.sincere.att.logs.MyTimeBasedFileNamingAndTriggeringPolicy"> | |
23 | + <multiple>1</multiple> | |
24 | + </timeBasedFileNamingAndTriggeringPolicy> | |
25 | + <!-- 输出路径 --> | |
26 | + <fileNamePattern>${logPath}/info/orderSuccess/%d{yyyy-MM-dd}.log</fileNamePattern> | |
27 | + <maxHistory>${maxHistory}</maxHistory> | |
28 | + </rollingPolicy> | |
29 | + </appender> | |
30 | + <appender name="orderFailInfoLog" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
31 | + <encoder> | |
32 | + <pattern>%d{yyyy-MM-dd HH:mm:ss} -%msg%n</pattern> | |
33 | + </encoder> | |
34 | + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |
35 | + <timeBasedFileNamingAndTriggeringPolicy class="com.sincere.att.logs.MyTimeBasedFileNamingAndTriggeringPolicy"> | |
36 | + <multiple>1</multiple> | |
37 | + </timeBasedFileNamingAndTriggeringPolicy> | |
38 | + <!-- 输出路径 --> | |
39 | + <fileNamePattern>${logPath}/info/orderFail/%d{yyyy-MM-dd}.log</fileNamePattern> | |
40 | + <maxHistory>${maxHistory}</maxHistory> | |
41 | + </rollingPolicy> | |
42 | + </appender> | |
43 | + <appender name="heartBeatLog" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
44 | + <encoder> | |
45 | + <pattern>%d{yyyy-MM-dd HH:mm:ss} -%msg%n</pattern> | |
46 | + </encoder> | |
47 | + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |
48 | + <timeBasedFileNamingAndTriggeringPolicy class="com.sincere.att.logs.MyTimeBasedFileNamingAndTriggeringPolicy"> | |
49 | + <multiple>1</multiple> | |
50 | + </timeBasedFileNamingAndTriggeringPolicy> | |
51 | + <!-- 输出路径 --> | |
52 | + <fileNamePattern>${logPath}/info/heartBeat/%d{yyyy-MM-dd}.log</fileNamePattern> | |
53 | + <maxHistory>${maxHistory}</maxHistory> | |
54 | + </rollingPolicy> | |
55 | + </appender> | |
56 | + <appender name="kaoInfoInfoLog" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
57 | + <encoder> | |
58 | + <pattern>%d{yyyy-MM-dd HH:mm:ss} -%msg%n</pattern> | |
59 | + </encoder> | |
60 | + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |
61 | + <timeBasedFileNamingAndTriggeringPolicy class="com.sincere.att.logs.MyTimeBasedFileNamingAndTriggeringPolicy"> | |
62 | + <multiple>1</multiple> | |
63 | + </timeBasedFileNamingAndTriggeringPolicy> | |
64 | + <!-- 输出路径 --> | |
65 | + <fileNamePattern>${logPath}/info/kaoInfo/%d{yyyy-MM-dd}.log</fileNamePattern> | |
66 | + <maxHistory>${maxHistory}</maxHistory> | |
67 | + </rollingPolicy> | |
68 | + </appender> | |
69 | + | |
70 | + | |
71 | + <!-- 特殊记录Error日志 --> | |
72 | + <appender name="fileErrorLog" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
73 | + <!-- 只记录ERROR级别日志,添加范围过滤,可以将该类型的日志特殊记录到某个位置 --> | |
74 | + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> | |
75 | + <level>ERROR</level> | |
76 | + </filter> | |
77 | + <encoder> | |
78 | + <pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger -%msg%n</pattern> | |
79 | + </encoder> | |
80 | + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |
81 | + <timeBasedFileNamingAndTriggeringPolicy class="com.sincere.att.logs.MyTimeBasedFileNamingAndTriggeringPolicy"> | |
82 | + <multiple>1</multiple> | |
83 | + </timeBasedFileNamingAndTriggeringPolicy> | |
84 | + <fileNamePattern>${logPath}/infoError/${PROJECT_NAME}.%d{yyyy-MM-dd}.log</fileNamePattern> | |
85 | + <!-- 日志最大的历史 60天 --> | |
86 | + <maxHistory>${maxHistory}</maxHistory> | |
87 | + </rollingPolicy> | |
88 | + </appender> | |
89 | + | |
90 | + <!-- 不同的业务逻辑日志打印到指定文件夹--> | |
91 | + <logger name="orderSuccess" additivity="false" level="INFO"> | |
92 | + <appender-ref ref="orderSuccessInfoLog"/> | |
93 | + </logger> | |
94 | + <logger name="orderFail" additivity="false" level="INFO"> | |
95 | + <appender-ref ref="orderFailInfoLog"/> | |
96 | + </logger> | |
97 | + <logger name="kaoInfo" additivity="false" level="INFO"> | |
98 | + <appender-ref ref="kaoInfoInfoLog"/> | |
99 | + </logger> | |
100 | + <logger name="heartBeat" additivity="false" level="INFO"> | |
101 | + <appender-ref ref="heartBeatLog"/> | |
102 | + </logger> | |
103 | + <logger name="error" additivity="false" level="ERROR"> | |
104 | + <appender-ref ref="fileErrorLog"/> | |
105 | + </logger> | |
106 | + | |
107 | + <root level="info"> | |
108 | + <appender-ref ref="consoleLog" /> | |
109 | + <appender-ref ref="orderSuccessInfoLog" /> | |
110 | + <appender-ref ref="orderFailInfoLog" /> | |
111 | + <appender-ref ref="kaoInfoInfoLog" /> | |
112 | + <appender-ref ref="heartBeatLog" /> | |
113 | + </root> | |
114 | + | |
115 | + <root level="error"> | |
116 | + <appender-ref ref="fileErrorLog" /> | |
117 | + </root> | |
118 | +</configuration> | |
0 | 119 | \ No newline at end of file | ... | ... |