| | |
| | | import com.thhy.general.exception.BasicException; |
| | | import com.thhy.general.utils.ScreenMqUtils; |
| | | import com.thhy.general.utils.UserInfoUtils; |
| | | import com.thhy.staff.config.EmqxConfig; |
| | | import com.thhy.staff.config.FaceConfig; |
| | | import com.thhy.staff.modules.biz.applyhistory.entity.UserApplyHistory; |
| | | import com.thhy.staff.modules.biz.applyhistory.mapper.UserApplyHistoryMapper; |
| | | import com.thhy.staff.modules.biz.depart.entity.OtherUser; |
| | | import com.thhy.staff.modules.biz.face.entity.MqContent; |
| | | import com.thhy.staff.modules.biz.face.mapper.FaceDeviceMapper; |
| | | import com.thhy.staff.modules.biz.group.entity.GroupUser; |
| | | import com.thhy.staff.modules.biz.netty.NettyServerHandler; |
| | | import com.thhy.staff.modules.biz.platuser.controller.FaceServer; |
| | | import com.thhy.staff.modules.biz.platuser.entity.*; |
| | | import com.thhy.staff.modules.biz.platuser.mapper.PlatUserMapper; |
| | | import com.thhy.staff.modules.biz.platuser.service.PlatUserService; |
| | | import com.thhy.staff.modules.biz.platuser.service.SysUserService; |
| | | import com.thhy.staff.modules.biz.position.mapper.PositionMapper; |
| | | import com.thhy.staff.utils.MqUtils; |
| | | import com.thhy.staff.utils.ProcessFlag; |
| | | import com.thhy.staff.utils.StaffNoUtils; |
| | | import io.netty.channel.ChannelHandlerContext; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.websocket.Session; |
| | | import java.io.IOException; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | |
| | | private PlatUserMapper platUserMapper; |
| | | |
| | | @Autowired |
| | | private SysUserService sysUserService; |
| | | |
| | | @Autowired |
| | | private UserApplyHistoryMapper historyMapper; |
| | | |
| | | @Autowired |
| | | private PositionMapper positionMapper; |
| | | private ScreenMqUtils screenMqUtils; |
| | | |
| | | @Autowired |
| | | private ScreenMqUtils screenMqUtils; |
| | | private FaceDeviceMapper faceDeviceMapper; |
| | | |
| | | @Autowired |
| | | private EmqxConfig emqxConfig; |
| | | |
| | | @Autowired |
| | | private FaceConfig faceConfig; |
| | | |
| | | public PlatUser get(Serializable id){ |
| | | return platUserMapper.queryById(id); |
| | |
| | | platUserMapper.updateFace(faceDto); |
| | | if(faceDto.getSyncToDevice()==1){ |
| | | //下发 |
| | | List<String> sns = faceDeviceMapper.queryDevSn(); |
| | | |
| | | MqContent mqContent = new MqContent("sync_person", faceConfig.getUrlPrefix()+faceConfig.getNotify()); |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("path",faceConfig.getUrlPrefix()+faceConfig.getSinglePer()); |
| | | JSONObject pathParamJson = new JSONObject(); |
| | | pathParamJson.put("dev_sno",""); |
| | | pathParamJson.put("limit",10); |
| | | pathParamJson.put("offset",0); |
| | | pathParamJson.put("total",1); |
| | | pathParamJson.put("person_list","[\""+faceDto.getUserId()+"\"]"); |
| | | pathParamJson.put("person_type","4"); |
| | | jsonObject.put("path_params",pathParamJson); |
| | | mqContent.setData(jsonObject); |
| | | |
| | | MqUtils.createClient(emqxConfig,sns,JSON.toJSONString(mqContent)); |
| | | /*Map<String,Object> map = AcsMain.addFace(fd.getJobNum(),filePrefix+"/"+fd.getPhoto()); |
| | | if(map.containsKey("code")){ |
| | | if(Integer.parseInt(map.get("code").toString())!=0){ |
| | |
| | | } |
| | | });*/ |
| | | |
| | | CopyOnWriteArraySet<ChannelHandlerContext> CTXS= NettyServerHandler.CTXS; |
| | | /*CopyOnWriteArraySet<ChannelHandlerContext> CTXS= NettyServerHandler.CTXS; |
| | | if(CTXS.size()<1){ |
| | | throw new BasicException(new BasicMessage("99991","与门禁一体机失去链接")); |
| | | } |
| | |
| | | ctx.flush(); |
| | | logger.info("成功推送消息到局域网段"); |
| | | } |
| | | }); |
| | | });*/ |
| | | } |
| | | } |
| | | |
| | |
| | | platUserMapper.insertDoorLis(doorLis); |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | String eventLog = "{\n" + |
| | | "\t\"ipAddress\":\t\"192.168.1.12\",\n" + |
| | | "\t\"ipv6Address\":\t\"240e:345:129e:cf00:e2ca:3cff:fef0:d933\",\n" + |
| | | "\t\"portNo\":\t443,\n" + |
| | | "\t\"protocol\":\t\"HTTPS\",\n" + |
| | | "\t\"macAddress\":\t\"e0:ca:3c:f0:d9:33\",\n" + |
| | | "\t\"channelID\":\t1,\n" + |
| | | "\t\"dateTime\":\t\"2023-09-05T15:44:04+08:00\",\n" + |
| | | "\t\"activePostCount\":\t1,\n" + |
| | | "\t\"eventType\":\t\"AccessControllerEvent\",\n" + |
| | | "\t\"eventState\":\t\"active\",\n" + |
| | | "\t\"eventDescription\":\t\"Access Controller Event\",\n" + |
| | | "\t\"AccessControllerEvent\":\t{\n" + |
| | | "\t\t\"deviceName\":\t\"Access Controller\",\n" + |
| | | "\t\t\"majorEventType\":\t5,\n" + |
| | | "\t\t\"subEventType\":\t76,\n" + |
| | | "\t\t\"cardReaderKind\":\t1,\n" + |
| | | "\t\t\"cardReaderNo\":\t1,\n" + |
| | | "\t\t\"verifyNo\":\t233,\n" + |
| | | "\t\t\"serialNo\":\t437,\n" + |
| | | "\t\t\"currentVerifyMode\":\t\"cardOrFace\",\n" + |
| | | "\t\t\"frontSerialNo\":\t436,\n" + |
| | | "\t\t\"attendanceStatus\":\t\"undefined\",\n" + |
| | | "\t\t\"statusValue\":\t0,\n" + |
| | | "\t\t\"mask\":\t\"no\",\n" + |
| | | "\t\t\"helmet\":\t\"unknown\",\n" + |
| | | "\t\t\"picturesNumber\":\t1,\n" + |
| | | "\t\t\"purePwdVerifyEnable\":\ttrue,\n" + |
| | | "\t\t\"FaceRect\":\t{\n" + |
| | | "\t\t\t\"height\":\t0.116000,\n" + |
| | | "\t\t\t\"width\":\t0.065000,\n" + |
| | | "\t\t\t\"x\":\t0.546000,\n" + |
| | | "\t\t\t\"y\":\t0.634000\n" + |
| | | "\t\t}\n" + |
| | | "\t}\n" + |
| | | "}"; |
| | | JSONObject jsonObject = JSONObject.parseObject(eventLog); |
| | | |
| | | if(!jsonObject.containsKey("eventType")){ |
| | | //platUserMapper.addDoorHis(eventLog); |
| | | return; |
| | | } |
| | | String eventType = jsonObject.getString("eventType"); |
| | | if(!"AccessControllerEvent".equals(eventType)){ |
| | | //platUserMapper.addDoorHis(eventLog); |
| | | return; |
| | | } |
| | | |
| | | JSONObject control = jsonObject.getJSONObject("AccessControllerEvent"); |
| | | |
| | | String majorEventType = control.getString("majorEventType"); |
| | | if(!"1".equals(majorEventType)&&!"5".equals(majorEventType)){ |
| | | //platUserMapper.addDoorHis(eventLog); |
| | | return; |
| | | } |
| | | |
| | | DoorLis doorLis = new DoorLis(); |
| | | //doorLis.setOriStr(eventLog); |
| | | doorLis.setIpAddress(jsonObject.getString("ipAddress")); |
| | | doorLis.setMacAddress(jsonObject.getString("macAddress")); |
| | | doorLis.setNoticeType(Integer.parseInt(majorEventType)); |
| | | if("5".equals(majorEventType)){ |
| | | String subEventType = control.getString("subEventType"); |
| | | if("75".equals(subEventType)){ |
| | | doorLis.setVerify(1); |
| | | doorLis.setName(control.getString("name")); |
| | | doorLis.setEmployeeNoString(control.getString("employeeNoString")); |
| | | }else if("76".equals(subEventType)){ |
| | | doorLis.setVerify(2); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> faceRecord(String token) { |
| | | SysUserInfo userInfo = UserInfoUtils.getInstance().getUserInfo(token); |
| | |
| | | } |
| | | platUserMapper.insertDoorListener(doorLisPic); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | MqContent mqContent = new MqContent("sync_person", "notify"); |
| | | String uu = "02d32ee86bec2b11e4b23eb6"; |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("path","/path"); |
| | | JSONObject pathParamJson = new JSONObject(); |
| | | |
| | | pathParamJson.put("dev_sno",""); |
| | | pathParamJson.put("limit",10); |
| | | pathParamJson.put("offset",0); |
| | | pathParamJson.put("total",1); |
| | | pathParamJson.put("person_list","[\""+uu+"\"]"); |
| | | pathParamJson.put("person_type","4"); |
| | | jsonObject.put("path_params",pathParamJson); |
| | | mqContent.setData(jsonObject); |
| | | |
| | | System.out.println(pathParamJson.toJSONString()); |
| | | } |
| | | } |