Commit 70c1b5df02fdcd86d5f51095ed1f463a13ffb63d
1 parent
eb6f1ade
Exists in
master
1
Showing
2 changed files
with
130 additions
and
103 deletions
Show diff stats
cloud/zkAttendance/src/main/java/com/sincere/att/Swagger2.java
| ... | ... | @@ -19,10 +19,9 @@ public class Swagger2 { |
| 19 | 19 | public Docket createRestApi() { |
| 20 | 20 | return new Docket(DocumentationType.SWAGGER_2) |
| 21 | 21 | .apiInfo(apiInfo()) |
| 22 | - .enableUrlTemplating(true) | |
| 23 | 22 | .select() |
| 24 | 23 | // 扫描所有有注解的api,用这种方式更灵活 |
| 25 | - .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) | |
| 24 | + .apis(RequestHandlerSelectors.basePackage("com.sincere.att.controller")) | |
| 26 | 25 | .paths(PathSelectors.any()) |
| 27 | 26 | .build(); |
| 28 | 27 | ... | ... |
cloud/zkAttendance/src/main/java/com/sincere/att/controller/AttPushController.java
| ... | ... | @@ -14,12 +14,9 @@ import com.sincere.common.dto.smartCampus.SZ_AttendanceDto; |
| 14 | 14 | import com.sincere.common.dto.xiaoan.FingerDto; |
| 15 | 15 | import com.sincere.common.util.DateUtils; |
| 16 | 16 | import com.sincere.common.util.HttpClientUtils; |
| 17 | -import io.swagger.annotations.Api; | |
| 18 | -import io.swagger.annotations.ApiOperation; | |
| 19 | 17 | import org.apache.commons.lang3.StringUtils; |
| 20 | 18 | import org.slf4j.Logger; |
| 21 | 19 | import org.springframework.beans.factory.annotation.Autowired; |
| 22 | -import org.springframework.stereotype.Controller; | |
| 23 | 20 | import org.springframework.web.bind.annotation.*; |
| 24 | 21 | |
| 25 | 22 | import javax.servlet.http.HttpServletRequest; |
| ... | ... | @@ -35,7 +32,7 @@ import java.util.*; |
| 35 | 32 | /** |
| 36 | 33 | * 所有的设备请求都会在url参数里携带SN,这是设备序列号(serial number的缩写),每个设备唯一标识 |
| 37 | 34 | */ |
| 38 | -@Controller | |
| 35 | +@RestController | |
| 39 | 36 | @RequestMapping("/iclock") |
| 40 | 37 | public class AttPushController { |
| 41 | 38 | private static final Logger Log_orderFail = LoggerUtils.Logger(LogName.orderFail); |
| ... | ... | @@ -43,80 +40,80 @@ public class AttPushController { |
| 43 | 40 | private static final Logger Log_kaoInfo = LoggerUtils.Logger(LogName.kaoInfo); |
| 44 | 41 | |
| 45 | 42 | private static Map<String, List<String>> cmdMap = new HashMap<>(); |
| 46 | - private static Map<String, Integer> cmdOrderMap = new HashMap<>(); | |
| 43 | + private static Map<String , Integer> cmdOrderMap = new HashMap<>(); | |
| 47 | 44 | |
| 48 | - private static String pwd = "22222222-6faf-48uh-a5a9-447ec68bfe2f"; | |
| 49 | - private static String account = "yueqingzhijiao"; | |
| 45 | + private static String pwd = "22222222-6faf-48uh-a5a9-447ec68bfe2f" ; | |
| 46 | + private static String account = "yueqingzhijiao" ; | |
| 50 | 47 | |
| 51 | 48 | |
| 52 | 49 | @Autowired |
| 53 | 50 | ScFeign scFeign; |
| 54 | 51 | |
| 55 | 52 | @Autowired |
| 56 | - XaFeign xaFeign; | |
| 53 | + XaFeign xaFeign ; | |
| 57 | 54 | |
| 58 | - @RequestMapping(value = "sendUser/{roomId}", method = RequestMethod.GET) | |
| 59 | - public void sendUser(@PathVariable int roomId) { | |
| 55 | + @RequestMapping(value = "sendUser" , method = RequestMethod.GET) | |
| 56 | + public void sendUser(int roomId){ | |
| 60 | 57 | JSONObject object = new JSONObject(); |
| 61 | - object.put("PageIndex", 1); | |
| 62 | - object.put("roomId", roomId); | |
| 63 | - object.put("pageSize", 9999); | |
| 64 | - JSONObject result = HttpClientUtils.httpPostJson("http://campus.myjxt.com/api/Room/GetListPageRoom", object.toJSONString()); | |
| 65 | - JSONArray array = (JSONArray) ((JSONObject) result.get("data")).get("roomList"); | |
| 58 | + object.put("pageIndex",1); | |
| 59 | + object.put("roomId",roomId); | |
| 60 | + object.put("pageSize",9999); | |
| 61 | + JSONObject result = HttpClientUtils.httpPostJson("http://campus.myjxt.com/api/Room/GetListPageRoom",object.toJSONString()); | |
| 62 | + JSONArray array = (JSONArray) ((JSONObject) result.get("data")).get("roomList") ; | |
| 66 | 63 | List<String> order = new ArrayList<>(); |
| 67 | 64 | List<String> attendanceList = scFeign.selectRoomAttendance(roomId); |
| 68 | - for (String attendance : attendanceList) { | |
| 69 | - for (int i = 0; i < array.size(); i++) { | |
| 65 | + for(String attendance : attendanceList){ | |
| 66 | + for(int i = 0 ; i < array.size() ; i++){ | |
| 70 | 67 | JSONObject student = (JSONObject) array.get(i); |
| 71 | 68 | UserOrderVo vo = new UserOrderVo(); |
| 72 | 69 | vo.setStudentId((Integer) student.get("studentid")); |
| 73 | 70 | vo.setStudentName((String) student.get("name")); |
| 74 | - int number = 1; | |
| 75 | - try { | |
| 76 | - number = cmdOrderMap.get(attendance); | |
| 77 | - } catch (Exception e) { | |
| 71 | + int number = 1 ; | |
| 72 | + try{ | |
| 73 | + number = cmdOrderMap.get(attendance) ; | |
| 74 | + }catch (Exception e){ | |
| 78 | 75 | |
| 79 | 76 | } |
| 80 | 77 | vo.setNumber(number); |
| 81 | - number++; | |
| 82 | - cmdOrderMap.put(attendance, number); | |
| 83 | - if (vo.getStudentId() != 0) { | |
| 78 | + number++ ; | |
| 79 | + cmdOrderMap.put(attendance,number) ; | |
| 80 | + if(vo.getStudentId() != 0){ | |
| 84 | 81 | order.add(vo.toString()); |
| 85 | 82 | } |
| 86 | 83 | } |
| 87 | - cmdMap.put(attendance, order); | |
| 84 | + cmdMap.put(attendance,order); | |
| 88 | 85 | } |
| 89 | 86 | } |
| 90 | 87 | |
| 91 | - @RequestMapping(value = "sendFinger/{roomId}", method = RequestMethod.GET) | |
| 92 | - public void sendFinger(@PathVariable int roomId) { | |
| 88 | + @RequestMapping(value = "sendFinger" , method = RequestMethod.GET) | |
| 89 | + public void sendFinger(int roomId){ | |
| 93 | 90 | JSONObject object = new JSONObject(); |
| 94 | - object.put("PageIndex", 1); | |
| 95 | - object.put("roomId", roomId); | |
| 96 | - object.put("pageSize", 9999); | |
| 97 | - JSONObject result = HttpClientUtils.httpPostJson("http://campus.myjxt.com/api/Room/GetListPageRoom", object.toJSONString()); | |
| 98 | - JSONArray array = (JSONArray) ((JSONObject) result.get("data")).get("roomList"); | |
| 91 | + object.put("PageIndex",1); | |
| 92 | + object.put("roomId",roomId); | |
| 93 | + object.put("pageSize",9999); | |
| 94 | + JSONObject result = HttpClientUtils.httpPostJson("http://campus.myjxt.com/api/Room/GetListPageRoom",object.toJSONString()); | |
| 95 | + JSONArray array = (JSONArray) ((JSONObject) result.get("data")).get("roomList") ; | |
| 99 | 96 | List<String> order = new ArrayList<>(); |
| 100 | 97 | List<String> attendanceList = scFeign.selectRoomAttendance(roomId); |
| 101 | - for (String attendance : attendanceList) { | |
| 102 | - for (int i = 0; i < array.size(); i++) { | |
| 98 | + for(String attendance : attendanceList){ | |
| 99 | + for(int i = 0 ; i < array.size() ; i++){ | |
| 103 | 100 | JSONObject student = (JSONObject) array.get(i); |
| 104 | 101 | FingerOrderVo vo = new FingerOrderVo(); |
| 105 | - int number = 1; | |
| 106 | - try { | |
| 107 | - number = cmdOrderMap.get(attendance); | |
| 108 | - } catch (Exception e) { | |
| 102 | + int number = 1 ; | |
| 103 | + try{ | |
| 104 | + number = cmdOrderMap.get(attendance) ; | |
| 105 | + }catch (Exception e){ | |
| 109 | 106 | |
| 110 | 107 | } |
| 111 | 108 | vo.setNumber(number); |
| 112 | - vo.setOrder(xaFeign.selectFinger((Integer) student.get("studentid"))); | |
| 113 | - number++; | |
| 114 | - cmdOrderMap.put(attendance, number); | |
| 115 | - if (StringUtils.isNotBlank(vo.getOrder())) { | |
| 109 | + vo.setOrder(xaFeign.selectFinger((Integer)student.get("studentid"))); | |
| 110 | + number++ ; | |
| 111 | + cmdOrderMap.put(attendance,number) ; | |
| 112 | + if(StringUtils.isNotBlank(vo.getOrder())){ | |
| 116 | 113 | order.add(vo.toString()); |
| 117 | 114 | } |
| 118 | 115 | } |
| 119 | - cmdMap.put(attendance, order); | |
| 116 | + cmdMap.put(attendance,order); | |
| 120 | 117 | } |
| 121 | 118 | } |
| 122 | 119 | |
| ... | ... | @@ -124,28 +121,29 @@ public class AttPushController { |
| 124 | 121 | * 1,设备通完电以后第一个发送到后台的请求 |
| 125 | 122 | * 格式为 /iclock/cdata?options=all&language=xxxx&pushver=xxxx |
| 126 | 123 | */ |
| 127 | - @RequestMapping(value = "/cdata", params = {"options", "language", "pushver"}, method = RequestMethod.GET) | |
| 128 | - public void init(String SN, String options, String language, String pushver, HttpServletRequest request, | |
| 129 | - @RequestParam(required = false) String PushOptionsFlag, HttpServletResponse response) { | |
| 124 | + @RequestMapping(value="/cdata",params = {"options","language","pushver"},method = RequestMethod.GET) | |
| 125 | + public void init(String SN, String options, String language, String pushver, HttpServletRequest request , | |
| 126 | + @RequestParam(required = false) String PushOptionsFlag, HttpServletResponse response){ | |
| 130 | 127 | try { |
| 131 | - if (cmdMap.get(SN) == null) { | |
| 132 | - cmdMap.put(SN, new ArrayList<>()); | |
| 133 | - cmdOrderMap.put(SN, 1); | |
| 128 | + if(cmdMap.get(SN) == null){ | |
| 129 | + System.out.println("设备上线:" + SN); | |
| 130 | + cmdMap.put(SN,new ArrayList<>()); | |
| 131 | + cmdOrderMap.put(SN,1); | |
| 134 | 132 | } |
| 135 | - if (scFeign.selectAttendaceWithId(SN) == null) { | |
| 133 | + if(scFeign.selectAttendaceWithId(SN) == null){ | |
| 136 | 134 | SZ_AttendanceDto attendanceDto = new SZ_AttendanceDto(); |
| 137 | 135 | attendanceDto.setClint_id(SN); |
| 138 | 136 | attendanceDto.setClint_type("24"); |
| 139 | 137 | attendanceDto.setIp(request.getRemoteAddr()); |
| 140 | 138 | attendanceDto.setPort(request.getRemotePort()); |
| 141 | - attendanceDto.setIntime(DateUtils.date2String(new Date(), DateUtils.format2)); | |
| 139 | + attendanceDto.setIntime(DateUtils.date2String(new Date(),DateUtils.format2)); | |
| 142 | 140 | attendanceDto.setSchool_id("-1"); |
| 143 | 141 | attendanceDto.setState(1); |
| 144 | 142 | scFeign.insertAttendance(attendanceDto); |
| 145 | - } else { | |
| 143 | + }else { | |
| 146 | 144 | scFeign.updateAttendance(SN); |
| 147 | 145 | } |
| 148 | - String initOptions = initOptions(SN, PushOptionsFlag); | |
| 146 | + String initOptions = initOptions(SN,PushOptionsFlag); | |
| 149 | 147 | response.getWriter().write(initOptions);//返回成功以后设备会发送心跳请求 |
| 150 | 148 | } catch (IOException e) { |
| 151 | 149 | e.printStackTrace(); |
| ... | ... | @@ -156,18 +154,19 @@ public class AttPushController { |
| 156 | 154 | * 2,心跳请求,会从服务器拿到命令返回 给设备 |
| 157 | 155 | */ |
| 158 | 156 | @RequestMapping("/getrequest") |
| 159 | - public void heartBeat(String SN, HttpServletResponse response) { | |
| 157 | + public void heartBeat(String SN, HttpServletResponse response){ | |
| 160 | 158 | scFeign.updateAttendance(SN); |
| 161 | 159 | StringBuffer sb = new StringBuffer("OK"); |
| 162 | - List<String> cmds = cmdMap.get(SN); | |
| 163 | - if (cmds == null) {//等于空说明从来没加载过,如果初始化加载过了,此时应该不为Null 只是size为0 | |
| 160 | + List<String> cmds = cmdMap.get(SN); | |
| 161 | + if(cmds==null){//等于空说明从来没加载过,如果初始化加载过了,此时应该不为Null 只是size为0 | |
| 162 | + System.out.println("设备上线:" + SN); | |
| 164 | 163 | cmds = new ArrayList<>(); |
| 165 | - cmdMap.put(SN, cmds); | |
| 166 | - cmdOrderMap.put(SN, 1); | |
| 164 | + cmdMap.put(SN,cmds); | |
| 165 | + cmdOrderMap.put(SN,1); | |
| 167 | 166 | } |
| 168 | - if (cmds != null && cmds.size() > 0) { | |
| 169 | - sb.setLength(0);//如果有命令就不返回OK了 | |
| 170 | - cmds.stream().forEach(cmd -> sb.append(cmd).append("\r\n\r\n")); | |
| 167 | + if(cmds!=null&&cmds.size()>0){ | |
| 168 | + sb.setLength(0);//如果有命令就不返回OK了 | |
| 169 | + cmds.stream().forEach(cmd->sb.append(cmd).append("\r\n\r\n")); | |
| 171 | 170 | |
| 172 | 171 | } |
| 173 | 172 | try { |
| ... | ... | @@ -184,8 +183,8 @@ public class AttPushController { |
| 184 | 183 | * 这个请求,服务器只能返回OK,不可以返回命令 |
| 185 | 184 | */ |
| 186 | 185 | @RequestMapping("/ping") |
| 187 | - public void ping(HttpServletResponse response) { | |
| 188 | - System.out.println("考勤机心跳请求大量进来了......ping" + new SimpleDateFormat("HH:mm:ss").format(new Date())); | |
| 186 | + public void ping(HttpServletResponse response){ | |
| 187 | + System.out.println("考勤机心跳请求大量进来了......ping"+new SimpleDateFormat("HH:mm:ss").format(new Date())); | |
| 189 | 188 | try { |
| 190 | 189 | response.getWriter().write("OK"); |
| 191 | 190 | } catch (IOException e) { |
| ... | ... | @@ -197,20 +196,20 @@ public class AttPushController { |
| 197 | 196 | * 4,设备端处理完命令以后会发送该请求,告诉服务器命令的处理结果 |
| 198 | 197 | */ |
| 199 | 198 | @RequestMapping("/devicecmd") |
| 200 | - public void handleCmd(String SN, @RequestBody String data, HttpServletResponse response) { | |
| 199 | + public void handleCmd(String SN, @RequestBody String data, HttpServletResponse response){ | |
| 201 | 200 | //判断data 清空map |
| 202 | 201 | List<String> cmdList = cmdMap.get(SN); |
| 203 | 202 | String[] returnList = data.split("\n"); |
| 204 | - if (returnList.length > 0 && cmdList.size() > 0) { | |
| 205 | - for (String message : returnList) { | |
| 206 | - String number = message.substring(message.indexOf("=") + 1, message.indexOf("&")); | |
| 207 | - String result = message.substring(message.indexOf("=", message.indexOf("&")) + 1, message.indexOf("&", message.indexOf("&") + 1)); | |
| 208 | - if (result.equals("0")) { | |
| 203 | + if(returnList.length > 0 && cmdList.size() > 0){ | |
| 204 | + for(String message : returnList){ | |
| 205 | + String number = message.substring(message.indexOf("=")+1,message.indexOf("&")); | |
| 206 | + String result = message.substring(message.indexOf("=",message.indexOf("&"))+1,message.indexOf("&",message.indexOf("&")+1)); | |
| 207 | + if(result.equals("0")){ | |
| 209 | 208 | Iterator<String> it = cmdList.iterator(); |
| 210 | 209 | while (((Iterator) it).hasNext()) { |
| 211 | 210 | String b = it.next(); |
| 212 | - if (b.contains("C:" + number)) { | |
| 213 | - Log_orderSuccess.info("指令成功==========" + b); | |
| 211 | + if (b.contains("C:"+number)) { | |
| 212 | + Log_orderSuccess.info("指令成功=========="+b); | |
| 214 | 213 | it.remove(); |
| 215 | 214 | } |
| 216 | 215 | } |
| ... | ... | @@ -233,46 +232,50 @@ public class AttPushController { |
| 233 | 232 | request.setCharacterEncoding("gbk"); |
| 234 | 233 | String data = ""; |
| 235 | 234 | ByteArrayOutputStream bos = null; |
| 236 | - byte[] b = new byte[1024]; | |
| 235 | + byte[] b= new byte[1024]; | |
| 237 | 236 | try { |
| 238 | 237 | InputStream is = request.getInputStream(); |
| 239 | 238 | bos = new ByteArrayOutputStream(); |
| 240 | 239 | int len = 0; |
| 241 | - while ((len = is.read(b)) != -1) { | |
| 242 | - bos.write(b, 0, len); | |
| 240 | + while((len=is.read(b))!=-1){ | |
| 241 | + bos.write(b,0,len); | |
| 243 | 242 | } |
| 244 | - data = new String(bos.toByteArray(), "gbk"); | |
| 243 | + data = new String(bos.toByteArray(),"gbk"); | |
| 245 | 244 | } catch (IOException e) { |
| 246 | 245 | e.printStackTrace(); |
| 247 | 246 | } |
| 248 | - if ("ATTLOG".equals(table)) { | |
| 247 | + if("ATTLOG".equals(table)){ | |
| 249 | 248 | String[] list = data.split("\t"); |
| 250 | 249 | String cardNo = scFeign.selectStudentNumByStudentId(Integer.valueOf(list[0])); |
| 251 | - cardNo = new BigInteger(cardNo, 16).toString(); | |
| 252 | - //考勤日志 | |
| 253 | - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 254 | - String info = String.format("<AttendanceInfo submitTime=\"%s\"><Info device=\"%s\" card=\"%s\" operTime=\"%s\" direc=\"%s\"></Info></AttendanceInfo>", | |
| 255 | - simpleDateFormat.format(new Date()), SN, cardNo, list[1], "-1"); | |
| 256 | - AttendanceInfoBean attendanceInfoBean = new AttendanceInfoBean(); | |
| 257 | - attendanceInfoBean.setInfo(info); | |
| 258 | - attendanceInfoBean.setIsControl(0); | |
| 259 | - attendanceInfoBean.setPwd(pwd); | |
| 260 | - attendanceInfoBean.setUsername(account); | |
| 250 | + if(StringUtils.isNotBlank(cardNo)){ | |
| 251 | + String cardNo10 = new BigInteger(cardNo, 16).toString(); | |
| 252 | + //考勤日志 | |
| 253 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 254 | + String info = String.format("<AttendanceInfo submitTime=\"%s\"><Info device=\"%s\" card=\"%s\" operTime=\"%s\" direc=\"%s\"></Info></AttendanceInfo>", | |
| 255 | + simpleDateFormat.format(new Date()), SN, cardNo10, list[1], "-1"); | |
| 256 | + AttendanceInfoBean attendanceInfoBean = new AttendanceInfoBean(); | |
| 257 | + attendanceInfoBean.setInfo(info); | |
| 258 | + attendanceInfoBean.setIsControl(0); | |
| 259 | + attendanceInfoBean.setPwd(pwd); | |
| 260 | + attendanceInfoBean.setUsername(account); | |
| 261 | 261 | |
| 262 | - String jsonResult = JSON.toJSONString(attendanceInfoBean); | |
| 263 | - String urlHXY = "http://campus.myjxt.com/api/XiaoAnCommon/SendHXY"; | |
| 264 | - JSONObject jsonObject = HttpClientUtils.httpPostJson(urlHXY, jsonResult); | |
| 265 | - if ((int) jsonObject.get("status") == 1) { | |
| 266 | - Log_kaoInfo.info("出入寝签到成功:" + SN + " 卡号:" + cardNo); | |
| 267 | - } else { | |
| 268 | - Log_orderFail.info("出入寝签到失败:" + SN + " 卡号:" + cardNo + " result1:" + jsonObject.toJSONString()); | |
| 262 | + String jsonResult = JSON.toJSONString(attendanceInfoBean); | |
| 263 | + String urlHXY = "http://campus.myjxt.com/api/XiaoAnCommon/SendHXY"; | |
| 264 | + JSONObject jsonObject = HttpClientUtils.httpPostJson(urlHXY, jsonResult); | |
| 265 | + if ((int) jsonObject.get("status") == 1){ | |
| 266 | + Log_kaoInfo.info("出入寝签到成功:" + SN + " 卡号:" + cardNo); | |
| 267 | + }else { | |
| 268 | + Log_orderFail.info("出入寝签到失败:" + SN + " 卡号:" + cardNo + " result1:" + jsonObject.toJSONString()); | |
| 269 | + } | |
| 270 | + }else { | |
| 271 | + System.out.println(cardNo); | |
| 269 | 272 | } |
| 270 | 273 | } |
| 271 | - if ("OPERLOG".equals(table)) { | |
| 274 | + if("OPERLOG".equals(table)){ | |
| 272 | 275 | //操作日志 |
| 273 | - if (data.substring(0, 3).contains("FP")) { | |
| 276 | + if(data.substring(0,3).contains("FP")){ | |
| 274 | 277 | //添加指纹 |
| 275 | - String studentId = data.substring(data.indexOf("=") + 1, data.indexOf("\t", data.indexOf("="))); | |
| 278 | + String studentId = data.substring(data.indexOf("=")+1,data.indexOf("\t",data.indexOf("="))); | |
| 276 | 279 | String order = data.substring(3); |
| 277 | 280 | FingerDto fingerDto = new FingerDto(); |
| 278 | 281 | fingerDto.setOrderMsg(order); |
| ... | ... | @@ -288,16 +291,40 @@ public class AttPushController { |
| 288 | 291 | } |
| 289 | 292 | } |
| 290 | 293 | |
| 294 | + public static void main(String[] args){ | |
| 295 | + String cardNo = "FF013E0F" ; | |
| 296 | + String SN = "A4JS174260624" ; | |
| 297 | + String cardNo10 = new BigInteger(cardNo, 16).toString(); | |
| 298 | + //考勤日志 | |
| 299 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 300 | + String info = String.format("<AttendanceInfo submitTime=\"%s\"><Info device=\"%s\" card=\"%s\" operTime=\"%s\" direc=\"%s\"></Info></AttendanceInfo>", | |
| 301 | + simpleDateFormat.format(new Date()), SN, cardNo10, DateUtils.date2String(new Date(),DateUtils.format2), "-1"); | |
| 302 | + AttendanceInfoBean attendanceInfoBean = new AttendanceInfoBean(); | |
| 303 | + attendanceInfoBean.setInfo(info); | |
| 304 | + attendanceInfoBean.setIsControl(0); | |
| 305 | + attendanceInfoBean.setPwd(pwd); | |
| 306 | + attendanceInfoBean.setUsername(account); | |
| 307 | + | |
| 308 | + String jsonResult = JSON.toJSONString(attendanceInfoBean); | |
| 309 | + String urlHXY = "http://campus.myjxt.com/api/XiaoAnCommon/SendHXY"; | |
| 310 | + JSONObject jsonObject = HttpClientUtils.httpPostJson(urlHXY, jsonResult); | |
| 311 | + if ((int) jsonObject.get("status") == 1){ | |
| 312 | + Log_kaoInfo.info("出入寝签到成功:" + SN + " 卡号:" + cardNo); | |
| 313 | + }else { | |
| 314 | + Log_orderFail.info("出入寝签到失败:" + SN + " 卡号:" + cardNo + " result1:" + jsonObject.toJSONString()); | |
| 315 | + } | |
| 316 | + } | |
| 317 | + | |
| 318 | + | |
| 291 | 319 | /** |
| 292 | 320 | * 设备通电以后连接到服务器,需要返回的初始化参数 |
| 293 | - * | |
| 294 | 321 | * @param sn |
| 295 | 322 | * @param PushOptionsFlag |
| 296 | 323 | * @return |
| 297 | 324 | */ |
| 298 | - private String initOptions(String sn, String PushOptionsFlag) { | |
| 325 | + private String initOptions(String sn,String PushOptionsFlag) { | |
| 299 | 326 | StringBuffer devOptions = new StringBuffer(); |
| 300 | - devOptions.append("GET OPTION FROM: " + sn); | |
| 327 | + devOptions.append("GET OPTION FROM: "+sn); | |
| 301 | 328 | // + "\nStamp=" + devInfo.devInfoJson.getString("Stamp") |
| 302 | 329 | devOptions.append("\nATTLOGStamp=0"); |
| 303 | 330 | devOptions.append("\nOPERLOGStamp=0"); |
| ... | ... | @@ -321,8 +348,9 @@ public class AttPushController { |
| 321 | 348 | // 11 工作号码 |
| 322 | 349 | // 12 比对照片 |
| 323 | 350 | devOptions.append("\nTransFlag=111111111111");// 1-12二进制位 分别代表以上含义 |
| 324 | - System.out.println("PushOptionsFlag=============" + PushOptionsFlag); | |
| 325 | - if (PushOptionsFlag != null && PushOptionsFlag.equals("1")) { | |
| 351 | + System.out.println("PushOptionsFlag============="+PushOptionsFlag); | |
| 352 | + if (PushOptionsFlag!=null&&PushOptionsFlag.equals("1")) | |
| 353 | + { | |
| 326 | 354 | // 支持参数单独获取的才要把需要获取的参数回传给设备 modifeid by max 20170926 |
| 327 | 355 | devOptions.append("\nPushOptions=RegDeviceType,FingerFunOn,FaceFunOn,FPVersion,FaceVersion,NetworkType,HardwareId3,HardwareId5,HardwareId56,LicenseStatus3,LicenseStatus5,LicenseStatus56"); |
| 328 | 356 | } | ... | ... |