Search in sources :

Example 1 with Trustedenterprise

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

the class TrustedPersonalInformationController method loadImg.

/**
 * 得到图片
 *
 * @param id
 * @param response
 * @return
 */
@RequestMapping(value = "/img/{type1}/{id}")
public String loadImg(@PathVariable("type1") String type1, @PathVariable("id") Long id, HttpServletResponse response) {
    String img = null;
    String serviceId = null;
    OutputStream os = null;
    FileInputStream fis = null;
    TrustedPersonalInformation trusted = null;
    Corporateinformation corporatein = new Corporateinformation();
    Trustedenterprise trus = null;
    File file = null;
    try {
        response.setHeader("Pragma", "no-cache");
        response.setHeader("Cache-Control", "no-cache");
        response.setDateHeader("Expires", 0);
        if ("1".equals(type1)) {
            trus = trustedenterpriseService.selectById(id);
            corporatein = sqlSession.selectOne("com.itrus.portal.db.CorporateinformationMapper.selectByPrimaryKey", trus.getCorporateinformation());
            img = corporatein.getPhotoCodeImg();
            file = filePathUtils.getBillFile(trus.getSerialnumber());
        }
        if ("2".equals(type1)) {
            trusted = sqlSession.selectOne("com.itrus.portal.db.TrustedPersonalInformationMapper.selectByPrimaryKey", id);
            img = trusted.getPhotoCodeImg();
            file = filePathUtils.getBillFile(trusted.getSerialnumber());
        }
        if (trusted == null && corporatein == 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 : Trustedenterprise(com.itrus.portal.db.Trustedenterprise) OutputStream(java.io.OutputStream) Corporateinformation(com.itrus.portal.db.Corporateinformation) IOException(java.io.IOException) TrustedPersonalInformation(com.itrus.portal.db.TrustedPersonalInformation) File(java.io.File) FileInputStream(java.io.FileInputStream) IOException(java.io.IOException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with Trustedenterprise

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

the class TrustedenterpriseController method show.

// 显示详情
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) {
    Trustedenterprise trustedenterprise = trustedenterpriseService.selectById(id);
    uiModel.addAttribute("trustedenterprise", trustedenterprise);
    Licenseinformation licenseinformation = sqlSession.selectOne("com.itrus.portal.db.LicenseinformationMapper.selectByPrimaryKey", trustedenterprise.getLicenseinformation());
    Enterprisebank enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterprisebankMapper.selectByPrimaryKey", trustedenterprise.getEnterprisebank());
    Corporateinformation corporateinformation = sqlSession.selectOne("com.itrus.portal.db.CorporateinformationMapper.selectByPrimaryKey", trustedenterprise.getCorporateinformation());
    Organization organition = sqlSession.selectOne("com.itrus.portal.db.OrganizationMapper.selectByPrimaryKey", trustedenterprise.getOrganization());
    String ss = trustedenterprise.getAuthenticationItem();
    if (null != ss && "" != ss) {
        if (ss.indexOf("1") != -1) {
            uiModel.addAttribute("licenseinformation", licenseinformation);
        } else {
            uiModel.addAttribute("licenseinformation", 1);
        }
        if (ss.indexOf("2") != -1) {
            uiModel.addAttribute("organition", organition);
        } else {
            uiModel.addAttribute("organition", 1);
        }
        if (ss.indexOf("3") != -1 || ss.indexOf("4") != -1) {
            uiModel.addAttribute("corporateinformation", corporateinformation);
        } else {
            uiModel.addAttribute("corporateinformation", 1);
        }
        /*if (ss.indexOf("5") != -1) {
					uiModel.addAttribute("agentinformation", agee);
				} else {
					uiModel.addAttribute("agentinformation", 1);
				}
				if (ss.indexOf("6") != -1) {
					uiModel.addAttribute("agentinformatio", agee);
				} else {
					uiModel.addAttribute("agentinformatio", 1);
				}*/
        if (ss.indexOf("7") != -1) {
            uiModel.addAttribute("enterprise", enterprise);
        } else if (ss.indexOf("8") != -1) {
            uiModel.addAttribute("enterprise", enterprise);
        } else {
            uiModel.addAttribute("enterprise", 1);
        }
    }
    return "trustedenterprise/show";
}
Also used : Licenseinformation(com.itrus.portal.db.Licenseinformation) Organization(com.itrus.portal.db.Organization) Trustedenterprise(com.itrus.portal.db.Trustedenterprise) Corporateinformation(com.itrus.portal.db.Corporateinformation) Enterprisebank(com.itrus.portal.db.Enterprisebank) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

Corporateinformation (com.itrus.portal.db.Corporateinformation)2 Trustedenterprise (com.itrus.portal.db.Trustedenterprise)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 Enterprisebank (com.itrus.portal.db.Enterprisebank)1 Licenseinformation (com.itrus.portal.db.Licenseinformation)1 Organization (com.itrus.portal.db.Organization)1 TrustedPersonalInformation (com.itrus.portal.db.TrustedPersonalInformation)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1