Search in sources :

Example 21 with IdentityCard

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

the class ExtraBillReviewController method show.

// 显示详情
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) {
    // 管理员项目权限
    Long[] projectsOfAdmin = getProjectLongIdsOfAdmin();
    List<Long> projectsOfAdminList = Arrays.asList(projectsOfAdmin);
    ExtraBillExample billExample = new ExtraBillExample();
    ExtraBillExample.Criteria criteria = billExample.or();
    criteria.andIdEqualTo(id);
    criteria.andProjectIn(projectsOfAdminList);
    ExtraBill bill = sqlSession.selectOne("com.itrus.portal.db.ExtraBillMapper.selectByExample", billExample);
    if (null == bill) {
        uiModel.addAttribute("errorMsg", "未找到该订单");
        return "status403";
    }
    uiModel.addAttribute("bill", bill);
    // 项目
    Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", bill.getProject());
    uiModel.addAttribute("project", project);
    // 企业
    Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bill.getEnterprise());
    uiModel.addAttribute("enterprise", enterprise);
    // 产品
    ExtraProduct product = sqlSession.selectOne("com.itrus.portal.db.ExtraProductMapper.selectByPrimaryKey", bill.getExtraProduct());
    uiModel.addAttribute("product", product);
    // 规格
    ExtraProductSpec productSpec = sqlSession.selectOne("com.itrus.portal.db.ExtraProductSpecMapper.selectByPrimaryKey", bill.getExtraProductSpec());
    uiModel.addAttribute("productSpec", productSpec);
    // 服务商
    ServiceProvider serviceProvider = serviceProviderService.selectByPrimaryKey(product.getServiceProvider());
    uiModel.addAttribute("serviceProvider", serviceProvider);
    // 用户
    UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bill.getUniqueId());
    uiModel.addAttribute("userInfo", userInfo);
    // 第三方支付信息
    OnPayInfo onPayInfo = sqlSession.selectOne("com.itrus.portal.db.OnPayInfoMapper.selectByPrimaryKey", bill.getOnPayInfo());
    uiModel.addAttribute("onPayInfo", onPayInfo);
    // 电子发票
    Einvoice einvoice = sqlSession.selectOne("com.itrus.portal.db.EinvoiceMapper.selectByPrimaryKey", bill.geteInvoice());
    uiModel.addAttribute("einvoice", einvoice);
    // 其他附加信息
    // 营业执照
    BusinessLicense businessLicense = businessService.getBusinessByExtraBillId(id, null);
    uiModel.addAttribute("businessLicense", businessLicense);
    // 税务登记
    TaxRegisterCert taxRegisterCert = taxCertService.getTaxRegisterCertByExtraBillId(id, null);
    uiModel.addAttribute("taxRegisterCert", taxRegisterCert);
    // 组织机构代码
    OrgCode orgCode = orgCodeService.getOrgCodeByExtraBillId(id, null);
    uiModel.addAttribute("orgCode", orgCode);
    // 代理人
    Agent agent = agentService.getAgentByExtraBillId(id, null);
    uiModel.addAttribute("agent", agent);
    // 开户行信息
    OpenBankInfo openBankInfo = openBankInfoService.getOpenBankInfoByExtraBillId(id, null);
    uiModel.addAttribute("openBankInfo", openBankInfo);
    // 法人信息
    IdentityCard identityCard = identityCardService.getIdentityCardByExtraBillId(id, null);
    uiModel.addAttribute("identityCard", identityCard);
    // TODO 还需要补充订单对应的附加信息和第三方回调信息
    return "extrabillreview/show";
}
Also used : Agent(com.itrus.portal.db.Agent) ExtraBill(com.itrus.portal.db.ExtraBill) ExtraProductSpec(com.itrus.portal.db.ExtraProductSpec) UserInfo(com.itrus.portal.db.UserInfo) Einvoice(com.itrus.portal.db.Einvoice) ExtraBillExample(com.itrus.portal.db.ExtraBillExample) Project(com.itrus.portal.db.Project) ExtraProduct(com.itrus.portal.db.ExtraProduct) OrgCode(com.itrus.portal.db.OrgCode) BusinessLicense(com.itrus.portal.db.BusinessLicense) OnPayInfo(com.itrus.portal.db.OnPayInfo) OpenBankInfo(com.itrus.portal.db.OpenBankInfo) ServiceProvider(com.itrus.portal.db.ServiceProvider) Enterprise(com.itrus.portal.db.Enterprise) TaxRegisterCert(com.itrus.portal.db.TaxRegisterCert) IdentityCard(com.itrus.portal.db.IdentityCard) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 22 with IdentityCard

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

the class IdentityCardServiceImpl method portUpdateIdentityCard.

/**
 * 法定代表人证件图片上传(接口)
 *
 * @param i_Id
 * @param enterpriseSn
 * @param identityCard
 * @return
 * @throws Exception
 */
public IdentityCard portUpdateIdentityCard(Long billId, String enterpriseSn, String image1, String image2) throws Exception {
    IdentityCard identityCard = this.getIdentityCardByBillId(billId, null);
    if (null == identityCard) {
        return null;
    }
    File imgDir = filePathUtils.getEnterpriseFile(enterpriseSn);
    if (StringUtils.isNotBlank(identityCard.getBackImg())) {
        FileUtils.deleteQuietly(new File(imgDir, identityCard.getBackImg()));
    }
    if (StringUtils.isNotBlank(identityCard.getFrontImg())) {
        FileUtils.deleteQuietly(new File(imgDir, identityCard.getFrontImg()));
    }
    // 正面(或者合成)图片
    if (StringUtils.isNotBlank(image1)) {
        File frontImg = filePathUtils.saveImg(imgDir, null, identityCard.getFrontImg(), IMG_DEFAULT_TYPE, IMG_NAME_ID_FRONT);
        if (frontImg != null && frontImg.isFile()) {
            identityCard.setFrontImg(frontImg.getName());
            identityCard.setFrontImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
        }
    }
    // 反面图片
    if (StringUtils.isNotBlank(image2)) {
        File backImg = filePathUtils.saveImg(imgDir, null, identityCard.getBackImg(), IMG_DEFAULT_TYPE, IMG_NAME_ID_BACK);
        if (backImg != null && backImg.isFile()) {
            identityCard.setBackImg(backImg.getName());
            identityCard.setBackImgHash(HMACSHA1.genSha1HashOfFile(backImg));
        }
    }
    sqlSession.update("com.itrus.portal.db.IdentityCardMapper.updateByPrimaryKeySelective", identityCard);
    sqlSession.flushStatements();
    return identityCard;
}
Also used : File(java.io.File) IdentityCard(com.itrus.portal.db.IdentityCard)

Example 23 with IdentityCard

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

the class IdentityCardServiceImpl method saveIdentityCardExtraBillFromUkey.

/**
 * 保存从ukey平台传递过来的法人信息
 * @param enterpriseId
 * @param enterpriseSn
 * @param billId
 * @param userInfoId
 * @param identityCard
 * @param itemStatus
 * @param old
 * @return
 * @throws Exception
 */
public IdentityCard saveIdentityCardExtraBillFromUkey(Long enterpriseId, String enterpriseSn, Long billId, Long userInfoId, IdentityCard identityCard, Integer itemStatus, IdentityCard old) throws Exception {
    // 若ukey平台的法人图片信息是合并上传,没有反面,则本平台存储为两张一样的图片
    if (null != identityCard.getBackImg() && identityCard.getBackImg().replaceAll(" ", "").toLowerCase().equals("null")) {
        identityCard.setBackImg(identityCard.getFrontImg());
    }
    if (null != identityCard.getBackImg() && identityCard.getBackImg().length() < 20) {
        identityCard.setBackImg(identityCard.getFrontImg());
    }
    File imgDir = filePathUtils.getEnterpriseFile(enterpriseSn);
    // 判断法人信息图片是否重新上传了,没有重新上传,则会提交法人信息的id,重新上传,还是按照下面的方法处理
    if (null != identityCard.getId()) {
        IdentityCard newIde = new IdentityCard();
        IdentityCard oldIde = sqlSession.selectOne("com.itrus.portal.db.IdentityCardMapper.selectByPrimaryKey", identityCard.getId());
        newIde.setEnterpriseName(identityCard.getEnterpriseName());
        newIde.setName(identityCard.getName());
        newIde.setCardType(identityCard.getCardType());
        newIde.setIdCode(identityCard.getIdCode());
        newIde.setCreateTime(new Date());
        newIde.setLastModify(new Date());
        // 审核状态:1未审核,2已审核,3已拒绝
        newIde.setItemStatus(oldIde.getItemStatus());
        newIde.setEnterprise(enterpriseId);
        newIde.setExtraBill(billId);
        newIde.setUserInfo(userInfoId);
        // 正面(或者合成)图片
        if (StringUtils.isNotBlank(identityCard.getFrontImg())) {
            File frontImg = filePathUtils.saveImg(imgDir, null, identityCard.getFrontImg(), IMG_DEFAULT_TYPE, IMG_NAME_ID_FRONT);
            if (frontImg != null && frontImg.isFile()) {
                newIde.setFrontImg(frontImg.getName());
                newIde.setFrontImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
            }
        } else {
            newIde.setFrontImg(oldIde.getFrontImg());
            newIde.setFrontImgHash(oldIde.getFrontImgHash());
        }
        if (StringUtils.isNotBlank(identityCard.getBackImg())) {
            File backImg = filePathUtils.saveImg(imgDir, null, identityCard.getBackImg(), IMG_DEFAULT_TYPE, IMG_NAME_ID_BACK);
            if (backImg != null && backImg.isFile()) {
                newIde.setBackImg(backImg.getName());
                newIde.setBackImgHash(HMACSHA1.genSha1HashOfFile(backImg));
            }
        } else {
            newIde.setBackImg(oldIde.getBackImg());
            newIde.setBackImgHash(oldIde.getBackImgHash());
        }
        sqlSession.insert("com.itrus.portal.db.IdentityCardMapper.insert", newIde);
        sqlSession.flushStatements();
        return newIde;
    }
    if (null == identityCard || StringUtils.isBlank(identityCard.getEnterpriseName()) || StringUtils.isBlank(identityCard.getName()) || StringUtils.isBlank(identityCard.getIdCode()) || StringUtils.isBlank(identityCard.getFrontImg())) {
        throw new UserInfoServiceException("请提交完整的法人信息");
    }
    identityCard.setCreateTime(new Date());
    identityCard.setLastModify(new Date());
    // 审核状态:1未审核,2已审核,3已拒绝
    identityCard.setItemStatus(itemStatus);
    identityCard.setEnterprise(enterpriseId);
    identityCard.setExtraBill(billId);
    identityCard.setUserInfo(userInfoId);
    // 正面(或者合成)图片
    if (StringUtils.isNotBlank(identityCard.getFrontImg()) && !identityCard.getFrontImg().equals(ComNames.USE_OLD_IMG)) {
        File frontImg = filePathUtils.saveImg(imgDir, null, identityCard.getFrontImg(), IMG_DEFAULT_TYPE, IMG_NAME_ID_FRONT);
        if (frontImg != null && frontImg.isFile()) {
            identityCard.setFrontImg(frontImg.getName());
            identityCard.setFrontImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
        }
    }
    // 反面图片
    if (StringUtils.isNotBlank(identityCard.getBackImg()) && !identityCard.getBackImg().equals(ComNames.USE_OLD_IMG)) {
        File backImg = filePathUtils.saveImg(imgDir, null, identityCard.getBackImg(), IMG_DEFAULT_TYPE, IMG_NAME_ID_BACK);
        if (backImg != null && backImg.isFile()) {
            identityCard.setBackImg(backImg.getName());
            identityCard.setBackImgHash(HMACSHA1.genSha1HashOfFile(backImg));
        }
    }
    if (old == null) {
        sqlSession.insert("com.itrus.portal.db.IdentityCardMapper.insert", identityCard);
    } else {
        identityCard.setId(old.getId());
        sqlSession.update("com.itrus.portal.db.IdentityCardMapper.updateByPrimaryKeySelective", identityCard);
    }
    sqlSession.flushStatements();
    return identityCard;
}
Also used : File(java.io.File) Date(java.util.Date) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) IdentityCard(com.itrus.portal.db.IdentityCard)

Example 24 with IdentityCard

use of com.itrus.portal.db.IdentityCard 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 25 with IdentityCard

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

the class IdentityCardServiceImpl method updateIdentityCard.

/**
 * 修改法定代表人信息
 *
 * @param i_Id
 * @param enterpriseSn
 * @param identityCard
 * @return
 * @throws Exception
 */
public IdentityCard updateIdentityCard(Long i_Id, String enterpriseSn, IdentityCard identityCard) throws Exception {
    if (null == identityCard) {
        return null;
    }
    identityCard.setId(i_Id);
    IdentityCard identityCard1 = sqlSession.selectOne("com.itrus.portal.db.IdentityCardMapper.selectByPrimaryKey", i_Id);
    File imgDir = filePathUtils.getEnterpriseFile(enterpriseSn);
    if (StringUtils.isNotBlank(identityCard.getBackImg())) {
        FileUtils.deleteQuietly(new File(imgDir, identityCard1.getBackImg()));
    }
    if (StringUtils.isNotBlank(identityCard.getFrontImg())) {
        FileUtils.deleteQuietly(new File(imgDir, identityCard1.getFrontImg()));
    }
    // 正面(或者合成)图片
    if (StringUtils.isNotBlank(identityCard.getFrontImg())) {
        File frontImg = filePathUtils.saveImg(imgDir, null, identityCard.getFrontImg(), IMG_DEFAULT_TYPE, IMG_NAME_ID_FRONT);
        if (frontImg != null && frontImg.isFile()) {
            identityCard.setFrontImg(frontImg.getName());
            identityCard.setFrontImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
        }
    } else {
        identityCard.setFrontImg(identityCard1.getFrontImg());
    }
    // 反面图片
    if (StringUtils.isNotBlank(identityCard.getBackImg())) {
        File backImg = filePathUtils.saveImg(imgDir, null, identityCard.getBackImg(), IMG_DEFAULT_TYPE, IMG_NAME_ID_BACK);
        if (backImg != null && backImg.isFile()) {
            identityCard.setBackImg(backImg.getName());
            identityCard.setBackImgHash(HMACSHA1.genSha1HashOfFile(backImg));
        }
    } else {
        identityCard.setBackImg(identityCard1.getBackImg());
    }
    sqlSession.update("com.itrus.portal.db.IdentityCardMapper.updateByPrimaryKeySelective", identityCard);
    sqlSession.flushStatements();
    return identityCard;
}
Also used : File(java.io.File) IdentityCard(com.itrus.portal.db.IdentityCard)

Aggregations

IdentityCard (com.itrus.portal.db.IdentityCard)33 BusinessLicense (com.itrus.portal.db.BusinessLicense)24 TaxRegisterCert (com.itrus.portal.db.TaxRegisterCert)24 Enterprise (com.itrus.portal.db.Enterprise)22 OrgCode (com.itrus.portal.db.OrgCode)22 UserInfo (com.itrus.portal.db.UserInfo)19 Agent (com.itrus.portal.db.Agent)18 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)17 ExtraProduct (com.itrus.portal.db.ExtraProduct)11 OpenBankInfo (com.itrus.portal.db.OpenBankInfo)11 Proxy (com.itrus.portal.db.Proxy)11 File (java.io.File)11 HashMap (java.util.HashMap)11 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)11 ExtraBill (com.itrus.portal.db.ExtraBill)9 Project (com.itrus.portal.db.Project)8 Date (java.util.Date)8 ExtraProductSpec (com.itrus.portal.db.ExtraProductSpec)7 Product (com.itrus.portal.db.Product)7 UserinfoEnterprise (com.itrus.portal.db.UserinfoEnterprise)7