Search in sources :

Example 1 with FaceMatching

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

the class PersonalNameController method show.

// 显示详情
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) {
    PersonalName personalname = personalnameservice.selectById(id);
    uiModel.addAttribute("personalname", personalname);
    // uiModel.addAttribute("personalname", personalname);
    PersonalServiceAuthentication peraonalservice = personalServiceAuthenticationService.selectById(personalname.getPersonalServiceAuthentication());
    String ss = peraonalservice.getServiceAuthenticationItem();
    String sdk = peraonalservice.getServiceAuthenticationSdkItem();
    uiModel.addAttribute("peraonalservice", peraonalservice);
    AppService appService = appServiceImpl.selectById(peraonalservice.getAppService());
    uiModel.addAttribute("appService", appService);
    Bankcardelements bank = sqlSession.selectOne("com.itrus.portal.db.BankcardelementsMapper.selectByPrimaryKey", personalname.getBankcardelements());
    FaceMatching facemat = null;
    FaceMatching facema = null;
    FaceMatching faceMatchin = null;
    List<FaceMatching> faceMatching = null;
    FaceMatchingExample face = new FaceMatchingExample();
    FaceMatchingExample.Criteria faceMat = face.createCriteria();
    faceMat.andPersonalNameEqualTo(personalname.getId());
    faceMatching = sqlSession.selectList("com.itrus.portal.db.FaceMatchingMapper.selectByExample", face);
    if (faceMatching != null && faceMatching.size() >= 1) {
        facema = faceMatching.get(0);
    }
    if (faceMatching != null && faceMatching.size() >= 2) {
        facemat = faceMatching.get(1);
    } else if (facema != null) {
        FaceMatchingExample faceM = new FaceMatchingExample();
        FaceMatchingExample.Criteria faceMat1 = faceM.createCriteria();
        faceMat1.andPhotoTypeEqualTo(0);
        faceMat1.andCreateTimeLessThanOrEqualTo(facema.getCreateTime());
        faceMat1.andPersonIdEqualTo(facema.getPersonId());
        if (facema.getSource().equals("6")) {
            faceMat1.andSourceEqualTo("3");
        }
        faceMat1.andBelievableFaceIsNotNull();
        faceM.setOrderByClause("create_time desc");
        faceM.setLimit(1);
        faceMatchin = sqlSession.selectOne("com.itrus.portal.db.FaceMatchingMapper.selectByExample", faceM);
    }
    if (ss != null && ss != "") {
        // 银行卡3,4要素
        if (ss.indexOf("4") != -1 || ss.indexOf("5") != -1) {
            uiModel.addAttribute("organition", bank);
        } else {
            uiModel.addAttribute("organition", 1);
        }
        // 身份证人像核验
        if (ss.indexOf("2") != -1) {
            uiModel.addAttribute("personal", 1);
        }
        if (ss.indexOf("3") != -1) {
            if (faceMatching != null && faceMatching.size() >= 1) {
                if (facema.getPhotoType() != 0) {
                    uiModel.addAttribute("face", facemat);
                } else {
                    uiModel.addAttribute("face", facema);
                }
            }
        } else {
            uiModel.addAttribute("face", 1);
        }
        if (ss.indexOf("6") != -1 || ss.indexOf("7") != -1) {
            if (faceMatching != null && faceMatching.size() >= 1) {
                if (facema.getPhotoType() == 0) {
                    uiModel.addAttribute("faceM", facema);
                } else if (facema.getPhotoType() == 1) {
                    uiModel.addAttribute("faceM1", facema);
                }
            }
            /*System.out.println(facema.getId());
					System.out.println(facemat.getId());*/
            if (faceMatching != null && faceMatching.size() >= 2) {
                if (facemat.getPhotoType() == 0) {
                    uiModel.addAttribute("faceM", facemat);
                } else if (facemat.getPhotoType() == 1) {
                    uiModel.addAttribute("faceM1", facemat);
                }
            } else {
                uiModel.addAttribute("faceMa", faceMatchin);
            }
        } else {
            uiModel.addAttribute("faceM", 1);
        }
        // 身份证间项
        if (ss.indexOf("1") != -1) {
            uiModel.addAttribute("persona", 1);
        }
    }
    // uiModel.addAttribute("face", faceMatching);
    if (sdk != null && sdk != "") {
        // 银行卡OCR
        if (sdk.indexOf("3") != -1) {
            uiModel.addAttribute("BankOCR", bank);
        } else {
            uiModel.addAttribute("BankOCR", 1);
        }
        // 身份证OCR
        if (sdk.indexOf("1") != -1) {
            uiModel.addAttribute("OCR", 1);
        }
        // 活体检验
        if (sdk.indexOf("2") != -1) {
            uiModel.addAttribute("HUO", 1);
        }
    }
    ApplicationInfo applicationInfo = applicationInfoService.selectById(personalname.getApplicationInfo());
    uiModel.addAttribute("applicationInfo", applicationInfo);
    return "personalname/show";
}
Also used : PersonalServiceAuthentication(com.itrus.portal.db.PersonalServiceAuthentication) AppService(com.itrus.portal.db.AppService) FaceMatching(com.itrus.portal.db.FaceMatching) PersonalName(com.itrus.portal.db.PersonalName) ApplicationInfo(com.itrus.portal.db.ApplicationInfo) Bankcardelements(com.itrus.portal.db.Bankcardelements) FaceMatchingExample(com.itrus.portal.db.FaceMatchingExample) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with FaceMatching

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

the class BelievableFaceController method show.

/**
 * 返回查看详情页面
 * @param id
 * @param uiModel
 * @return
 */
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) {
    BelievableFace believableFace = believableFaceService.selectById(id);
    uiModel.addAttribute("believableFace", believableFace);
    ApplicationInfo applicationInfo = applicationInfoService.selectById(believableFace.getApplicationInfo());
    uiModel.addAttribute("applicationInfo", applicationInfo);
    // 查询照片表,多条数据
    FaceMatchingExample face = new FaceMatchingExample();
    FaceMatchingExample.Criteria faceMat = face.createCriteria();
    faceMat.andBelievableFaceEqualTo(believableFace.getId());
    List<FaceMatching> faceMatching = sqlSession.selectList("com.itrus.portal.db.FaceMatchingMapper.selectByExample", face);
    uiModel.addAttribute("faceMatching", faceMatching);
    return "believableFace/show";
}
Also used : FaceMatching(com.itrus.portal.db.FaceMatching) ApplicationInfo(com.itrus.portal.db.ApplicationInfo) FaceMatchingExample(com.itrus.portal.db.FaceMatchingExample) BelievableFace(com.itrus.portal.db.BelievableFace) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with FaceMatching

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

the class RealNameCordController method loadImg.

/**
 * 得到图片
 *
 * @param type1
 *            企业类型 1,企业 2,个人3,可信人脸
 * @param type2
 *            认证类型 1,法人 2,代理人
 * @param id
 * @param response
 * @return
 */
@RequestMapping(value = "/img/{type1}/{type2}/{id}")
public String loadImg(@PathVariable("type1") String type1, @PathVariable("type2") String type2, @PathVariable("id") Long id, HttpServletResponse response) {
    String img = null;
    String serviceId = null;
    OutputStream os = null;
    FileInputStream fis = null;
    RealNameRecord realNameRecord = null;
    Agentinformation agentionfo = new Agentinformation();
    Corporateinformation corporatein = new Corporateinformation();
    PersonalName personalName = null;
    FaceMatching faceMatching0 = null;
    File file = null;
    try {
        response.setHeader("Pragma", "no-cache");
        response.setHeader("Cache-Control", "no-cache");
        response.setDateHeader("Expires", 0);
        if ("1".equals(type1)) {
            realNameRecord = realnameservice.selectById(id);
            corporatein = sqlSession.selectOne("com.itrus.portal.db.CorporateinformationMapper.selectByPrimaryKey", realNameRecord.getCorporateinformation());
            agentionfo = sqlSession.selectOne("com.itrus.portal.db.AgentinformationMapper.selectByPrimaryKey", realNameRecord.getAgentinformation());
            realNameRecord = realnameservice.selectById(id);
            if (realNameRecord != null && "1".equals(type2)) {
                img = corporatein.getPhotoCodeImg();
            }
            if (realNameRecord != null && "2".equals(type2)) {
                img = agentionfo.getPhotoCodeImg();
            }
            file = filePathUtils.getBillFile(realNameRecord.getSerialnumber());
        }
        if ("2".equals(type1)) {
            personalName = sqlSession.selectOne("com.itrus.portal.db.PersonalNameMapper.selectByPrimaryKey", id);
            /*	FaceMatchingExample face = new FaceMatchingExample();
				FaceMatchingExample.Criteria faceMat=face.createCriteria();
				faceMat.andPersonalNameEqualTo(personalName.getId());
				List<FaceMatching> facem = sqlSession.selectList("com.itrus.portal.db.FaceMatchingMapper.selectByExample", face);
				faceMatching0 = sqlSession.selectOne("com.itrus.portal.db.FaceMatchingMapper.selectByPrimaryKey", id);
				if(facem!=null&&facem.size()>=1){
					faceMatching1 = facem.get(0);
				}
				if(facem!=null&&facem.size()>=2){
					faceMatching0 = facem.get(1);
				} 
				*/
            if (personalName != null && "2".equals(type2)) {
                img = personalName.getPhotoCodeImg();
            }
            if (personalName != null && "1".equals(type2)) {
                img = personalName.getInformationImg();
            }
            /*if (personalName != null && "3".equals(type2)) {
					if(faceMatching0.getPhotoType()==0){
						img = faceMatching0.getPhotoCodeImg();
					}else{
						img = faceMatching1.getPhotoCodeImg();
					}
					img = faceMatching0.getPhotoCodeImg();
					
				}*/
            /*if (personalName != null && "4".equals(type2)) {
					if(faceMatching0.getPhotoType()==1){
						img = faceMatching0.getPhotoCodeImg();
					}else{
						img = faceMatching1.getPhotoCodeImg();
					}
					img = faceMatching0.getPhotoCodeImg();
					
				}*/
            file = filePathUtils.getBillFile(personalName.getSerialnumber());
        }
        if ("3".equals(type1)) {
            faceMatching0 = sqlSession.selectOne("com.itrus.portal.db.FaceMatchingMapper.selectByPrimaryKey", id);
            personalName = sqlSession.selectOne("com.itrus.portal.db.PersonalNameMapper.selectByPrimaryKey", faceMatching0.getPersonalName());
            if (personalName != null && "1".equals(type2)) {
                /*	if(faceMatching0.getPhotoType()==0){
							img = faceMatching0.getPhotoCodeImg();
						}else{
							img = faceMatching1.getPhotoCodeImg();
						}*/
                img = faceMatching0.getPhotoCodeImg();
            }
            file = filePathUtils.getBillFile(personalName.getSerialnumber());
        }
        if (realNameRecord == null && personalName == null) {
            return "status403";
        }
        if (img == null) {
            return "status403";
        }
        if (!file.exists()) {
            file.mkdir();
        }
        File imgFile = new File(file, img);
        fis = new FileInputStream(imgFile);
        byte[] bb = IOUtils.toByteArray(fis);
        os = response.getOutputStream();
        os.write(bb);
        os.flush();
    } catch (IOException e) {
        // 未找到
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        // 关闭流!
        try {
            if (null != fis) {
                fis.close();
            }
            if (null != os) {
                os.close();
            }
        } catch (IOException e) {
        }
    }
    return null;
}
Also used : Agentinformation(com.itrus.portal.db.Agentinformation) FaceMatching(com.itrus.portal.db.FaceMatching) PersonalName(com.itrus.portal.db.PersonalName) OutputStream(java.io.OutputStream) Corporateinformation(com.itrus.portal.db.Corporateinformation) IOException(java.io.IOException) RealNameRecord(com.itrus.portal.db.RealNameRecord) File(java.io.File) FileInputStream(java.io.FileInputStream) IOException(java.io.IOException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

FaceMatching (com.itrus.portal.db.FaceMatching)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 ApplicationInfo (com.itrus.portal.db.ApplicationInfo)2 FaceMatchingExample (com.itrus.portal.db.FaceMatchingExample)2 PersonalName (com.itrus.portal.db.PersonalName)2 Agentinformation (com.itrus.portal.db.Agentinformation)1 AppService (com.itrus.portal.db.AppService)1 Bankcardelements (com.itrus.portal.db.Bankcardelements)1 BelievableFace (com.itrus.portal.db.BelievableFace)1 Corporateinformation (com.itrus.portal.db.Corporateinformation)1 PersonalServiceAuthentication (com.itrus.portal.db.PersonalServiceAuthentication)1 RealNameRecord (com.itrus.portal.db.RealNameRecord)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1