Search in sources :

Example 11 with MobileCertificate

use of com.itrus.portal.db.MobileCertificate in project portal by ixinportal.

the class MobileRiskStatisticsLogController method show.

/*
	 * 查看详情
	 */
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uimodel) {
    // 得到该条风控记录
    MobileRiskStatisticsLog mobileRiskStatisticsLog = mobileRiskStatisticsLogService.selectByRiskStatisticsLogId(id);
    uimodel.addAttribute("mobileRiskStatisticsLog", mobileRiskStatisticsLog);
    // 根据风控记录的用户ID查询该记录所对应的用户信息
    if (mobileRiskStatisticsLog != null) {
        MobileUser mobileUser = mobileRiskStatisticsLogService.selectByUserId(mobileRiskStatisticsLog.getUserId());
        uimodel.addAttribute("mobileUser", mobileUser);
        // 根据风控记录的证书序列号查询该条记录对应的证书信息
        MobileCertificate mobileCertificate = mobileRiskStatisticsLogService.selectbyCertNumber(mobileRiskStatisticsLog.getCertSequenceNumber());
        uimodel.addAttribute("mobileCertificate", mobileCertificate);
    }
    return "mobileriskstatisticslog/show";
}
Also used : MobileRiskStatisticsLog(com.itrus.portal.db.MobileRiskStatisticsLog) MobileCertificate(com.itrus.portal.db.MobileCertificate) MobileUser(com.itrus.portal.db.MobileUser) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 12 with MobileCertificate

use of com.itrus.portal.db.MobileCertificate in project portal by ixinportal.

the class MobileWebSocketHandler method handleMessage.

@Override
public void handleMessage(WebSocketSession session, WebSocketMessage<?> message) throws Exception {
    log.info("成功接收到消息");
    // 把客户端的消息解析为JSON对象
    if (message instanceof TextMessage) {
        // String appId =session.getAttributes().get("appId").toString();
        log.info("信息为:" + message.getPayload());
        // 针对ios系统做出的心跳处理
        if (message.getPayload().equals("heart")) {
            // 连云盾
            KeySegmentationTask.buildTask(session, message);
            return;
        }
        JSONObject msg = JSON.parseObject(message.getPayload().toString());
        try {
            if (msg.containsKey("certSn")) {
                log.error("签名");
                String deviceSerialNumber = msg.get("certSn").toString();
                log.error(deviceSerialNumber);
                MobileCertificateExample certificateExample = new MobileCertificateExample();
                MobileCertificateExample.Criteria criteria = certificateExample.createCriteria();
                criteria.andSequenceNumberEqualTo(deviceSerialNumber);
                MobileCertificate certificate = mobileCertificateService.selectByExample(certificateExample);
                log.error("" + certificate);
                log.error(" -------------------------------------------------------------");
                if (certificate != null) {
                    Long uId = certificate.getUserId();
                    MobileUser mobileUser = mobileUserService.selectMobileUserById(uId);
                    if (mobileUser != null) {
                        msg.put("uid", mobileUser.getUserId());
                    }
                }
                // System.out.println(mobileUser.getUserId());
                if (certificate.getLockStatus() == 1) {
                    // 如果锁定
                    // Map<String, Object> result=new HashMap<String,
                    // Object>();
                    // MobileApplyConfigManage
                    // applyConfigManage=mobileApplyConfigService.selectMobileApplyConfigManageById(certificate.getApplyConfigId());
                    msg.put("LockCause", certificate.getLockCause());
                    // msg.put("appId", appId);
                    msg.put("LockStatus", certificate.getLockStatus());
                    // result.put("PinTime", applyCo
                    // nfigManage.getPinTime());
                    session.sendMessage(new TextMessage(JSON.toJSONString(msg)));
                    return;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        if (msg.containsKey("service")) {
            /*
				 * service:certApply 申请证书移动端需要传过来的参数 1.设备信息 device
				 * equipmentCategory String 设备型号 appId Long 应用的名称
				 * operatingSystem String 操作系统 userId Long 和用户关联的字段 createTime
				 * date 创建时间 updateTime date 修改时间 deviceSerialNumber string
				 * 设备序列号 唯一标识 2.用户的信息 即 注册信息 user name String 用户姓名 phone String
				 * 手机号 idNumber String 身份证号 appId Long 和应用关联的字段 email String
				 * 电子邮件 registrationTime date 注册时间 createTime date 创建时间
				 * updateTime date 修改时间 userCod String 用户编码
				 */
            // msg.put("appId",msg );
            // msg.put("uid",mobileUser.getUserId());
            MobileService mobileService = SpringContextHolder.getBean(msg.getString("service"));
            Map<String, Object> result = mobileService.execute(msg.toJSONString());
            session.sendMessage(new TextMessage(JSON.toJSONString(result)));
            return;
        }
        // String deviceSerialNumber = msg.get("certSn").toString();
        // TextMessage msg = new TextMessage(session.getAttributes() +
        // "发送的数据"+message.getPayload());
        // this.handleTextMessage(session, (TextMessage)message);
        // 连云盾
        KeySegmentationTask.buildTask(session, message);
    } else // else if(message instanceof BinaryMessage) {
    // BinaryMessage msg = new BinaryMessage((byte[]) message.getPayload());
    // this.handleBinaryMessage(session, (BinaryMessage)message);
    // }
    {
        if (!(message instanceof PongMessage)) {
            throw new IllegalStateException("Unexpected WebSocket message type: " + message);
        }
        this.handlePongMessage(session, (PongMessage) message);
    }
}
Also used : MobileCertificate(com.itrus.portal.db.MobileCertificate) MobileCertificateExample(com.itrus.portal.db.MobileCertificateExample) MobileUser(com.itrus.portal.db.MobileUser) JSONObject(com.alibaba.fastjson.JSONObject) JSONObject(com.alibaba.fastjson.JSONObject) MobileService(com.itrus.portal.mobile.service.MobileService)

Aggregations

MobileCertificate (com.itrus.portal.db.MobileCertificate)12 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)8 MobileCertificateExample (com.itrus.portal.db.MobileCertificateExample)7 Date (java.util.Date)7 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)4 MobileUser (com.itrus.portal.db.MobileUser)3 MobileApplyConfigManage (com.itrus.portal.db.MobileApplyConfigManage)2 Calendar (java.util.Calendar)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 JSONObject (com.alibaba.fastjson.JSONObject)1 ApplicationInfo (com.itrus.portal.db.ApplicationInfo)1 MobileRiskStatisticsLog (com.itrus.portal.db.MobileRiskStatisticsLog)1 RaAccount (com.itrus.portal.db.RaAccount)1 MobileService (com.itrus.portal.mobile.service.MobileService)1 ArrayList (java.util.ArrayList)1