Commit 713628befdbec1c9613fd97ade29282c3c48c868
1 parent
17788a11
Exists in
master
中控指纹机
Showing
10 changed files
with
115 additions
and
39 deletions
Show diff stats
cloud/search_xiaoan/src/main/java/com/sincere/xiaoanSearch/controller/ZkController.java
| 1 | package com.sincere.xiaoanSearch.controller; | 1 | package com.sincere.xiaoanSearch.controller; |
| 2 | 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; | 3 | import com.sincere.common.dto.xiaoan.FingerDto; |
| 6 | -import com.sincere.xiaoanSearch.model.CheckIn; | ||
| 7 | import com.sincere.xiaoanSearch.service.ZkService; | 4 | import com.sincere.xiaoanSearch.service.ZkService; |
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 5 | 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; | 6 | +import org.springframework.web.bind.annotation.*; |
| 13 | 7 | ||
| 14 | /** | 8 | /** |
| 15 | * @author chen | 9 | * @author chen |
| @@ -27,4 +21,9 @@ public class ZkController { | @@ -27,4 +21,9 @@ public class ZkController { | ||
| 27 | public int insertFinger(@RequestBody FingerDto fingerDto){ | 21 | public int insertFinger(@RequestBody FingerDto fingerDto){ |
| 28 | return zkService.insertFinger(fingerDto); | 22 | return zkService.insertFinger(fingerDto); |
| 29 | } | 23 | } |
| 24 | + | ||
| 25 | + @RequestMapping(value = "selectFinger",method = RequestMethod.GET) | ||
| 26 | + String selectFinger(@RequestParam("studentId") int studentId){ | ||
| 27 | + return zkService.selectFinger(studentId); | ||
| 28 | + } | ||
| 30 | } | 29 | } |
cloud/search_xiaoan/src/main/java/com/sincere/xiaoanSearch/mapper/FingerMapper.java
| @@ -10,4 +10,6 @@ import com.sincere.common.dto.xiaoan.FingerDto; | @@ -10,4 +10,6 @@ import com.sincere.common.dto.xiaoan.FingerDto; | ||
| 10 | public interface FingerMapper { | 10 | public interface FingerMapper { |
| 11 | 11 | ||
| 12 | int insertFinger(FingerDto fingerDto); | 12 | int insertFinger(FingerDto fingerDto); |
| 13 | + | ||
| 14 | + String selectFinger(int studentId); | ||
| 13 | } | 15 | } |
cloud/search_xiaoan/src/main/java/com/sincere/xiaoanSearch/service/ZkService.java
| @@ -8,5 +8,8 @@ import com.sincere.common.dto.xiaoan.FingerDto; | @@ -8,5 +8,8 @@ import com.sincere.common.dto.xiaoan.FingerDto; | ||
| 8 | * @date 2019/12/31 0031 13:40 | 8 | * @date 2019/12/31 0031 13:40 |
| 9 | */ | 9 | */ |
| 10 | public interface ZkService { | 10 | public interface ZkService { |
| 11 | + | ||
| 11 | int insertFinger(FingerDto fingerDto); | 12 | int insertFinger(FingerDto fingerDto); |
| 13 | + | ||
| 14 | + String selectFinger(int studentId); | ||
| 12 | } | 15 | } |
cloud/search_xiaoan/src/main/java/com/sincere/xiaoanSearch/service/impl/ZkServiceImpl.java
| @@ -21,4 +21,9 @@ public class ZkServiceImpl implements ZkService { | @@ -21,4 +21,9 @@ public class ZkServiceImpl implements ZkService { | ||
| 21 | public int insertFinger(FingerDto fingerDto) { | 21 | public int insertFinger(FingerDto fingerDto) { |
| 22 | return fingerMapper.insertFinger(fingerDto); | 22 | return fingerMapper.insertFinger(fingerDto); |
| 23 | } | 23 | } |
| 24 | + | ||
| 25 | + @Override | ||
| 26 | + public String selectFinger(int studentId) { | ||
| 27 | + return fingerMapper.selectFinger(studentId); | ||
| 28 | + } | ||
| 24 | } | 29 | } |
cloud/search_xiaoan/src/main/resources/mapper/FingerMapper.xml
| @@ -8,4 +8,8 @@ | @@ -8,4 +8,8 @@ | ||
| 8 | values (#{studentId},#{orderMsg},#{createTime}) | 8 | values (#{studentId},#{orderMsg},#{createTime}) |
| 9 | </insert> | 9 | </insert> |
| 10 | 10 | ||
| 11 | + <select id="selectFinger" parameterType="java.lang.Integer" resultType="java.lang.String"> | ||
| 12 | + select order_msg from zk_finger where student_id = #{studentId} | ||
| 13 | + </select> | ||
| 14 | + | ||
| 11 | </mapper> | 15 | </mapper> |
| 12 | \ No newline at end of file | 16 | \ No newline at end of file |
cloud/zkAttendance/src/main/java/com/sincere/att/controller/AttPushController.java
| @@ -8,11 +8,13 @@ import com.sincere.att.feign.XaFeign; | @@ -8,11 +8,13 @@ import com.sincere.att.feign.XaFeign; | ||
| 8 | import com.sincere.att.logs.LogName; | 8 | import com.sincere.att.logs.LogName; |
| 9 | import com.sincere.att.logs.LoggerUtils; | 9 | import com.sincere.att.logs.LoggerUtils; |
| 10 | import com.sincere.att.vo.AttendanceInfoBean; | 10 | import com.sincere.att.vo.AttendanceInfoBean; |
| 11 | +import com.sincere.att.vo.FingerOrderVo; | ||
| 11 | import com.sincere.att.vo.UserOrderVo; | 12 | import com.sincere.att.vo.UserOrderVo; |
| 12 | import com.sincere.common.dto.smartCampus.SZ_AttendanceDto; | 13 | import com.sincere.common.dto.smartCampus.SZ_AttendanceDto; |
| 13 | import com.sincere.common.dto.xiaoan.FingerDto; | 14 | import com.sincere.common.dto.xiaoan.FingerDto; |
| 14 | import com.sincere.common.util.DateUtils; | 15 | import com.sincere.common.util.DateUtils; |
| 15 | import com.sincere.common.util.HttpClientUtils; | 16 | import com.sincere.common.util.HttpClientUtils; |
| 17 | +import org.apache.commons.lang3.StringUtils; | ||
| 16 | import org.slf4j.Logger; | 18 | import org.slf4j.Logger; |
| 17 | import org.springframework.beans.factory.annotation.Autowired; | 19 | import org.springframework.beans.factory.annotation.Autowired; |
| 18 | import org.springframework.stereotype.Controller; | 20 | import org.springframework.stereotype.Controller; |
| @@ -51,8 +53,8 @@ public class AttPushController { | @@ -51,8 +53,8 @@ public class AttPushController { | ||
| 51 | @Autowired | 53 | @Autowired |
| 52 | XaFeign xaFeign ; | 54 | XaFeign xaFeign ; |
| 53 | 55 | ||
| 54 | - @RequestMapping(value = "sendOrder/{roomId}" , method = RequestMethod.GET) | ||
| 55 | - public void sendOrder(@PathVariable int roomId){ | 56 | + @RequestMapping(value = "sendUser/{roomId}" , method = RequestMethod.GET) |
| 57 | + public void sendUser(@PathVariable int roomId){ | ||
| 56 | JSONObject object = new JSONObject(); | 58 | JSONObject object = new JSONObject(); |
| 57 | object.put("PageIndex",1); | 59 | object.put("PageIndex",1); |
| 58 | object.put("roomId",roomId); | 60 | object.put("roomId",roomId); |
| @@ -83,6 +85,39 @@ public class AttPushController { | @@ -83,6 +85,39 @@ public class AttPushController { | ||
| 83 | cmdMap.put(attendance,order); | 85 | cmdMap.put(attendance,order); |
| 84 | } | 86 | } |
| 85 | } | 87 | } |
| 88 | + | ||
| 89 | + @RequestMapping(value = "sendUser/{roomId}" , method = RequestMethod.GET) | ||
| 90 | + public void sendFinger(@PathVariable int roomId){ | ||
| 91 | + JSONObject object = new JSONObject(); | ||
| 92 | + object.put("PageIndex",1); | ||
| 93 | + object.put("roomId",roomId); | ||
| 94 | + object.put("pageSize",9999); | ||
| 95 | + JSONObject result = HttpClientUtils.httpPostJson("http://campus.myjxt.com/api/Room/GetListPageRoom",object.toJSONString()); | ||
| 96 | + JSONArray array = (JSONArray) ((JSONObject) result.get("data")).get("roomList") ; | ||
| 97 | + List<String> order = new ArrayList<>(); | ||
| 98 | + List<String> attendanceList = scFeign.selectRoomAttendance(roomId); | ||
| 99 | + for(String attendance : attendanceList){ | ||
| 100 | + for(int i = 0 ; i < array.size() ; i++){ | ||
| 101 | + JSONObject student = (JSONObject) array.get(i); | ||
| 102 | + FingerOrderVo vo = new FingerOrderVo(); | ||
| 103 | + int number = 1 ; | ||
| 104 | + try{ | ||
| 105 | + number = cmdOrderMap.get(attendance) ; | ||
| 106 | + }catch (Exception e){ | ||
| 107 | + | ||
| 108 | + } | ||
| 109 | + vo.setNumber(number); | ||
| 110 | + vo.setOrder(xaFeign.selectFinger((Integer)student.get("studentid"))); | ||
| 111 | + number++ ; | ||
| 112 | + cmdOrderMap.put(attendance,number) ; | ||
| 113 | + if(StringUtils.isNotBlank(vo.getOrder())){ | ||
| 114 | + order.add(vo.toString()); | ||
| 115 | + } | ||
| 116 | + } | ||
| 117 | + cmdMap.put(attendance,order); | ||
| 118 | + } | ||
| 119 | + } | ||
| 120 | + | ||
| 86 | /** | 121 | /** |
| 87 | * 1,设备通完电以后第一个发送到后台的请求 | 122 | * 1,设备通完电以后第一个发送到后台的请求 |
| 88 | * 格式为 /iclock/cdata?options=all&language=xxxx&pushver=xxxx | 123 | * 格式为 /iclock/cdata?options=all&language=xxxx&pushver=xxxx |
cloud/zkAttendance/src/main/java/com/sincere/att/feign/XaFeign.java
| @@ -5,6 +5,7 @@ import org.springframework.cloud.openfeign.FeignClient; | @@ -5,6 +5,7 @@ import org.springframework.cloud.openfeign.FeignClient; | ||
| 5 | import org.springframework.web.bind.annotation.RequestBody; | 5 | import org.springframework.web.bind.annotation.RequestBody; |
| 6 | import org.springframework.web.bind.annotation.RequestMapping; | 6 | import org.springframework.web.bind.annotation.RequestMapping; |
| 7 | import org.springframework.web.bind.annotation.RequestMethod; | 7 | import org.springframework.web.bind.annotation.RequestMethod; |
| 8 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 8 | 9 | ||
| 9 | /** | 10 | /** |
| 10 | * @author chen | 11 | * @author chen |
| @@ -16,4 +17,7 @@ public interface XaFeign { | @@ -16,4 +17,7 @@ public interface XaFeign { | ||
| 16 | 17 | ||
| 17 | @RequestMapping(value = "/xa/zk/insertFinger",method = RequestMethod.POST) | 18 | @RequestMapping(value = "/xa/zk/insertFinger",method = RequestMethod.POST) |
| 18 | int insertFinger(@RequestBody FingerDto fingerDto); | 19 | int insertFinger(@RequestBody FingerDto fingerDto); |
| 20 | + | ||
| 21 | + @RequestMapping(value = "/xa/zk/selectFinger",method = RequestMethod.GET) | ||
| 22 | + String selectFinger(@RequestParam("studentId") int studentId); | ||
| 19 | } | 23 | } |
cloud/zkAttendance/src/main/java/com/sincere/att/vo/FingerOrderVo.java
0 → 100644
| @@ -0,0 +1,34 @@ | @@ -0,0 +1,34 @@ | ||
| 1 | +package com.sincere.att.vo; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * 下发 指纹命令 | ||
| 5 | + * @author chen | ||
| 6 | + * @version 1.0 | ||
| 7 | + * @date 2019/12/31 0031 15:39 | ||
| 8 | + */ | ||
| 9 | +public class FingerOrderVo { | ||
| 10 | + | ||
| 11 | + private int number ; | ||
| 12 | + private String order ; | ||
| 13 | + | ||
| 14 | + public int getNumber() { | ||
| 15 | + return number; | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + public void setNumber(int number) { | ||
| 19 | + this.number = number; | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + public String getOrder() { | ||
| 23 | + return order; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + public void setOrder(String order) { | ||
| 27 | + this.order = order; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + @Override | ||
| 31 | + public String toString() { | ||
| 32 | + return "C:"+this.number+":DATA UPDATE FINGERTMP "+this.order+"\r\n\r\n"; | ||
| 33 | + } | ||
| 34 | +} |
cloud/zkAttendance/src/main/java/com/sincere/att/vo/OrderVo.java
| @@ -1,28 +0,0 @@ | @@ -1,28 +0,0 @@ | ||
| 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
| 1 | package com.sincere.att.vo; | 1 | package com.sincere.att.vo; |
| 2 | 2 | ||
| 3 | /** | 3 | /** |
| 4 | + * 下发用户 指令 | ||
| 4 | * @author chen | 5 | * @author chen |
| 5 | * @version 1.0 | 6 | * @version 1.0 |
| 6 | * @date 2019/12/31 0031 9:08 | 7 | * @date 2019/12/31 0031 9:08 |
| 7 | */ | 8 | */ |
| 8 | -public class UserOrderVo extends OrderVo { | 9 | +public class UserOrderVo { |
| 9 | 10 | ||
| 10 | private String studentName ; | 11 | private String studentName ; |
| 12 | + private int number ; | ||
| 13 | + private int studentId ; | ||
| 11 | 14 | ||
| 15 | + public int getNumber() { | ||
| 16 | + return number; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + public void setNumber(int number) { | ||
| 20 | + this.number = number; | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + public int getStudentId() { | ||
| 24 | + return studentId; | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + public void setStudentId(int studentId) { | ||
| 28 | + this.studentId = studentId; | ||
| 29 | + } | ||
| 12 | 30 | ||
| 13 | public String getStudentName() { | 31 | public String getStudentName() { |
| 14 | return studentName; | 32 | return studentName; |
| @@ -20,6 +38,6 @@ public class UserOrderVo extends OrderVo { | @@ -20,6 +38,6 @@ public class UserOrderVo extends OrderVo { | ||
| 20 | 38 | ||
| 21 | @Override | 39 | @Override |
| 22 | public String toString() { | 40 | 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"; | 41 | + return "C:"+this.number+":DATA UPDATE USERINFO PIN="+this.studentId+"\tName="+this.studentName+"\tPasswd=\tCard=\tPri=0\r\n\r\n"; |
| 24 | } | 42 | } |
| 25 | } | 43 | } |