Search in sources :

Example 1 with IdentityCardExample

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

the class IdentityCardServiceImpl method getIdentityCardByBillId.

/**
 * 根据订单id获取订单的法人信息
 *
 * @param billId
 * @param itemStatus
 * @return
 */
public IdentityCard getIdentityCardByBillId(Long billId, Integer itemStatus) {
    IdentityCardExample example = new IdentityCardExample();
    IdentityCardExample.Criteria criteria = example.or();
    criteria.andBillEqualTo(billId);
    if (null != itemStatus) {
        criteria.andItemStatusEqualTo(itemStatus);
    }
    return sqlSession.selectOne("com.itrus.portal.db.IdentityCardMapper.selectByExample", example);
}
Also used : IdentityCardExample(com.itrus.portal.db.IdentityCardExample)

Example 2 with IdentityCardExample

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

the class BillWebController method loadImg.

/**
 * 得到图片
 *
 * @param type
 * @param id
 * @param num
 * @param response
 * @return
 */
@RequestMapping(value = "/img/{type}/{id}/{num}/{eid}")
public String loadImg(@PathVariable("type") int type, @PathVariable("id") Long id, @PathVariable("num") Long num, @PathVariable("eid") Long eid, HttpServletResponse response, HttpServletRequest request) {
    HttpSession session = request.getSession();
    Boolean verifyCodeStatus = (Boolean) session.getAttribute("webverifyCodeStatus");
    UserInfo webuserInfo = (UserInfo) session.getAttribute("webuserInfo");
    Enterprise enterprise = (Enterprise) session.getAttribute("webenterprise");
    if (null == verifyCodeStatus || !verifyCodeStatus || null == webuserInfo || !eid.equals(enterprise.getId())) {
        // 登录状态失效,跳转到登录页面
        return "redirect:/userInfoWeb/denglu.html";
    }
    String img = null;
    Long trueInfo = null;
    Long userid = null;
    UserInfo userInfo = null;
    OutputStream os = null;
    FileInputStream fis = null;
    try {
        response.setHeader("Pragma", "no-cache");
        response.setHeader("Cache-Control", "no-cache");
        response.setDateHeader("Expires", 0);
        if (type == 1) {
            BusinessLicenseExample bl = new BusinessLicenseExample();
            BusinessLicenseExample.Criteria criteria = bl.createCriteria();
            criteria.andIdEqualTo(id);
            BusinessLicense license = sqlSession.selectOne("com.itrus.portal.db.BusinessLicenseMapper.selectByExample", bl);
            if (license == null) {
                return "status403";
            }
            img = license.getImgFile();
            trueInfo = license.getEnterprise();
        } else if (type == 2) {
            OrgCodeExample bl = new OrgCodeExample();
            OrgCodeExample.Criteria criteria = bl.createCriteria();
            criteria.andIdEqualTo(id);
            OrgCode code = sqlSession.selectOne("com.itrus.portal.db.OrgCodeMapper.selectByExample", bl);
            if (code == null) {
                return "status403";
            }
            img = code.getImgFile();
            trueInfo = code.getEnterprise();
        } else if (type == 3) {
            TaxRegisterCertExample bl = new TaxRegisterCertExample();
            TaxRegisterCertExample.Criteria criteria = bl.createCriteria();
            criteria.andIdEqualTo(id);
            TaxRegisterCert cert = sqlSession.selectOne("com.itrus.portal.db.TaxRegisterCertMapper.selectByExample", bl);
            if (cert == null) {
                return "status403";
            }
            img = cert.getImgFile();
            trueInfo = cert.getEnterprise();
        } else if (type == 4) {
            IdentityCardExample bl = new IdentityCardExample();
            IdentityCardExample.Criteria criteria = bl.createCriteria();
            criteria.andIdEqualTo(id);
            IdentityCard card = sqlSession.selectOne("com.itrus.portal.db.IdentityCardMapper.selectByExample", bl);
            if (card == null) {
                return "status403";
            }
            if (num == 0) {
                img = card.getFrontImg();
            } else {
                img = card.getBackImg();
            }
            trueInfo = card.getEnterprise();
        } else if (type == 7) {
            AgentExample bl = new AgentExample();
            AgentExample.Criteria criteria = bl.createCriteria();
            criteria.andIdEqualTo(id);
            Agent at = sqlSession.selectOne("com.itrus.portal.db.AgentMapper.selectByExample", bl);
            if (at == null) {
                return "status403";
            }
            if (num == 0) {
                img = at.getFrontImg();
            } else {
                img = at.getBackImg();
            }
            trueInfo = at.getEnterprise();
        } else if (type == 5) {
            ProxyExample pe = new ProxyExample();
            ProxyExample.Criteria criteria = pe.createCriteria();
            criteria.andIdEqualTo(id);
            Proxy proxy = sqlSession.selectOne("com.itrus.portal.db.ProxyMapper.selectByExample", pe);
            if (proxy == null) {
                return "status403";
            }
            img = proxy.getImgFile();
            userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", proxy.getUserInfo());
            trueInfo = proxy.getEnterprise();
        }
        if (img == null || trueInfo == null) {
            return "status403";
        }
        Enterprise info = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", trueInfo);
        File file = new File(systemConfigService.getTrustDir().getPath() + File.separator + (type == 5 ? userInfo.getUniqueId() : info.getEnterpriseSn()));
        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 : IdentityCardExample(com.itrus.portal.db.IdentityCardExample) OutputStream(java.io.OutputStream) UserInfo(com.itrus.portal.db.UserInfo) Proxy(com.itrus.portal.db.Proxy) IdentityCard(com.itrus.portal.db.IdentityCard) Agent(com.itrus.portal.db.Agent) AgentExample(com.itrus.portal.db.AgentExample) HttpSession(javax.servlet.http.HttpSession) TaxRegisterCertExample(com.itrus.portal.db.TaxRegisterCertExample) IOException(java.io.IOException) FileInputStream(java.io.FileInputStream) IOException(java.io.IOException) JsonGenerationException(org.codehaus.jackson.JsonGenerationException) EncDecException(com.itrus.portal.exception.EncDecException) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) BusinessLicenseExample(com.itrus.portal.db.BusinessLicenseExample) ProxyExample(com.itrus.portal.db.ProxyExample) OrgCode(com.itrus.portal.db.OrgCode) BusinessLicense(com.itrus.portal.db.BusinessLicense) Enterprise(com.itrus.portal.db.Enterprise) CopyFile(com.itrus.portal.utils.CopyFile) File(java.io.File) TaxRegisterCert(com.itrus.portal.db.TaxRegisterCert) OrgCodeExample(com.itrus.portal.db.OrgCodeExample) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with IdentityCardExample

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

the class IdentityCardServiceImpl method getIdentityCardsNews.

/**
 * 根据企业id查找法人信息,按生成时间降序排序
 *
 * @param enterpriseId
 * @return
 * @throws Exception
 */
public List<IdentityCard> getIdentityCardsNews(Long enterpriseId) throws Exception {
    List<IdentityCard> identityCards = new ArrayList<IdentityCard>();
    IdentityCardExample example = new IdentityCardExample();
    example.setOrderByClause("create_time DESC");
    IdentityCardExample.Criteria criteria = example.or();
    criteria.andEnterpriseEqualTo(enterpriseId);
    identityCards = sqlSession.selectList("com.itrus.portal.db.IdentityCardMapper.selectByExample", example);
    return identityCards;
}
Also used : IdentityCardExample(com.itrus.portal.db.IdentityCardExample) ArrayList(java.util.ArrayList) IdentityCard(com.itrus.portal.db.IdentityCard)

Example 4 with IdentityCardExample

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

the class IdentityCardServiceImpl method getIdentityCardsNews2.

/**
 * 查询数据库中是否存在该用户,该企业,未关联订单和增值订单.并且认证通过的信息,按生成时间降序排序
 *
 * @param enterpriseId
 * @return
 * @throws Exception
 */
public IdentityCard getIdentityCardsNews2(Long enterpriseId, Long userinfoId) {
    List<IdentityCard> identityCards = new ArrayList<IdentityCard>();
    IdentityCardExample example = new IdentityCardExample();
    example.setOrderByClause("create_time DESC");
    IdentityCardExample.Criteria criteria = example.or();
    criteria.andEnterpriseEqualTo(enterpriseId);
    criteria.andUserInfoEqualTo(userinfoId);
    criteria.andBillIsNull();
    criteria.andExtraBillIsNull();
    identityCards = sqlSession.selectList("com.itrus.portal.db.IdentityCardMapper.selectByExample", example);
    if (null == identityCards || identityCards.isEmpty()) {
        return null;
    }
    return identityCards.get(0);
}
Also used : IdentityCardExample(com.itrus.portal.db.IdentityCardExample) ArrayList(java.util.ArrayList) IdentityCard(com.itrus.portal.db.IdentityCard)

Example 5 with IdentityCardExample

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

the class IdentityCardServiceImpl method getIdentityCardByExtraBillId.

/**
 * 根据增值订单id查询订单的法人信息
 *
 * @param billId
 * @param status
 *            营业执照状态
 * @return
 */
public IdentityCard getIdentityCardByExtraBillId(Long billId, Integer status) {
    IdentityCardExample example = new IdentityCardExample();
    IdentityCardExample.Criteria criteria = example.or();
    criteria.andExtraBillEqualTo(billId);
    if (null != status) {
        criteria.andItemStatusEqualTo(status);
    }
    IdentityCard identityCard = sqlSession.selectOne("com.itrus.portal.db.IdentityCardMapper.selectByExample", example);
    return identityCard;
}
Also used : IdentityCardExample(com.itrus.portal.db.IdentityCardExample) IdentityCard(com.itrus.portal.db.IdentityCard)

Aggregations

IdentityCardExample (com.itrus.portal.db.IdentityCardExample)5 IdentityCard (com.itrus.portal.db.IdentityCard)4 ArrayList (java.util.ArrayList)2 Agent (com.itrus.portal.db.Agent)1 AgentExample (com.itrus.portal.db.AgentExample)1 BusinessLicense (com.itrus.portal.db.BusinessLicense)1 BusinessLicenseExample (com.itrus.portal.db.BusinessLicenseExample)1 Enterprise (com.itrus.portal.db.Enterprise)1 OrgCode (com.itrus.portal.db.OrgCode)1 OrgCodeExample (com.itrus.portal.db.OrgCodeExample)1 Proxy (com.itrus.portal.db.Proxy)1 ProxyExample (com.itrus.portal.db.ProxyExample)1 TaxRegisterCert (com.itrus.portal.db.TaxRegisterCert)1 TaxRegisterCertExample (com.itrus.portal.db.TaxRegisterCertExample)1 UserInfo (com.itrus.portal.db.UserInfo)1 EncDecException (com.itrus.portal.exception.EncDecException)1 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)1 CopyFile (com.itrus.portal.utils.CopyFile)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1