Search in sources :

Example 36 with BusinessLicense

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

the class BusinessServiceImpl method getBusinessLicenses.

/**
 * 根据企业名称查找营业执照信息
 *
 * @param enterpriseId
 * @return
 */
public List<BusinessLicense> getBusinessLicenses(Long enterpriseId) {
    List<BusinessLicense> bus = new ArrayList<BusinessLicense>();
    BusinessLicenseExample example = new BusinessLicenseExample();
    BusinessLicenseExample.Criteria criteria = example.or();
    criteria.andEnterpriseEqualTo(enterpriseId);
    bus = sqlSession.selectList("com.itrus.portal.db.BusinessLicenseMapper.selectByExample", example);
    return bus;
}
Also used : BusinessLicense(com.itrus.portal.db.BusinessLicense) ArrayList(java.util.ArrayList) BusinessLicenseExample(com.itrus.portal.db.BusinessLicenseExample)

Example 37 with BusinessLicense

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

the class BusinessServiceImpl method getBusinessByBillId.

/**
 * 根据订单id查询订单的营业执照信息
 *
 * @param billId
 * @param status
 *            营业执照状态
 * @return
 */
public BusinessLicense getBusinessByBillId(Long billId, Integer status) {
    BusinessLicenseExample example = new BusinessLicenseExample();
    BusinessLicenseExample.Criteria criteria = example.or();
    criteria.andBillEqualTo(billId);
    if (null != status) {
        criteria.andItemStatusEqualTo(status);
    }
    BusinessLicense businessLicense = sqlSession.selectOne("com.itrus.portal.db.BusinessLicenseMapper.selectByExample", example);
    return businessLicense;
}
Also used : BusinessLicense(com.itrus.portal.db.BusinessLicense) BusinessLicenseExample(com.itrus.portal.db.BusinessLicenseExample)

Example 38 with BusinessLicense

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

the class BusinessServiceImpl method updateBus.

/**
 * 修改营业执照中企业名称
 *
 * @param bus
 * @param enterpriseName
 */
public void updateBus(List<BusinessLicense> bus, Enterprise enterprise) {
    for (BusinessLicense b : bus) {
        b.setEnterpriseName(enterprise.getEnterpriseName());
        b.setLicenseNo(enterprise.getEnterpriseSn());
        sqlSession.update("com.itrus.portal.db.BusinessLicenseMapper.updateByPrimaryKeySelective", b);
    }
}
Also used : BusinessLicense(com.itrus.portal.db.BusinessLicense)

Example 39 with BusinessLicense

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

the class BusinessServiceImpl method updateBusiness.

/**
 * 修改营业执照图片
 *
 * @param b_Id
 * @param enterpriseSn
 * @param businessLicense
 * @return
 * @throws Exception
 */
public BusinessLicense updateBusiness(Long b_Id, String enterpriseSn, BusinessLicense businessLicense) throws Exception {
    if (null == businessLicense) {
        return null;
    }
    businessLicense.setId(b_Id);
    BusinessLicense businessLicense1 = sqlSession.selectOne("com.itrus.portal.db.BusinessLicenseMapper.selectByPrimaryKey", b_Id);
    File imgDir = filePathUtils.getEnterpriseFile(enterpriseSn);
    if (StringUtils.isNotBlank(businessLicense.getImgFile())) {
        FileUtils.deleteQuietly(new File(imgDir, businessLicense1.getImgFile()));
        File liceImg = filePathUtils.saveImg(imgDir, null, businessLicense.getImgFile(), IMG_DEFAULT_TYPE, IMG_NAME_BL);
        if (liceImg != null && liceImg.isFile()) {
            businessLicense.setImgFile(liceImg.getName());
            businessLicense.setImgFileHash(HMACSHA1.genSha1HashOfFile(liceImg));
        }
    } else {
        businessLicense.setImgFile(businessLicense1.getImgFile());
    }
    // 去除名称空格
    businessLicense.setEnterpriseName(businessLicense.getEnterpriseName().replaceAll(" ", ""));
    sqlSession.update("com.itrus.portal.db.BusinessLicenseMapper.updateByPrimaryKeySelective", businessLicense);
    sqlSession.flushStatements();
    return businessLicense;
}
Also used : BusinessLicense(com.itrus.portal.db.BusinessLicense) File(java.io.File)

Example 40 with BusinessLicense

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

the class ReviewServiceImpl method agreeBillReview.

/**
 * pfx证书,当不要审核的时候,自动生成审核记录
 * @param bill
 */
public void agreeBillReview(Bill bill) {
    if (null == bill) {
        return;
    }
    // 填充营业执照运营时间
    Enterprise enterpriseInBill = enterpriseService.getEnterpriseByBillId(bill.getId());
    String soperationStart = null;
    String soperationEnd = null;
    List<BusinessLicense> oldBusinessLicenses = businessService.getBusinessLicensesNews(bill.getEnterprise());
    if (null != oldBusinessLicenses && !oldBusinessLicenses.isEmpty()) {
        for (BusinessLicense businessLicense1 : oldBusinessLicenses) {
            if (null != businessLicense1.getOperationStart() || null != businessLicense1.getOperationEnd()) {
                SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
                if (null != businessLicense1.getOperationStart()) {
                    soperationStart = format.format(businessLicense1.getOperationStart());
                }
                if (null != businessLicense1.getOperationEnd()) {
                    soperationEnd = format.format(businessLicense1.getOperationEnd());
                }
                break;
            }
        }
    }
    Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.getProduct());
    DigitalCert cert = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", product.getCert());
    Certification certification = sqlSession.selectOne("com.itrus.portal.db.CertificationMapper.selectByPrimaryKey", product.getAuthentication());
    Project project = billService.getProjectByBillId(bill.getId());
    BusinessLicense businessLicense = businessService.getBusinessByBillId(bill.getId(), null);
    OrgCode orgCode = orgCodeService.getOrgCodeByBillId(bill.getId(), null);
    TaxRegisterCert taxregisterCert = taxCertService.getTaxRegisterCertByBillId(bill.getId(), null);
    IdentityCard identityCard = identityCardService.getIdentityCardByBillId(bill.getId(), null);
    Agent agent = agentService.getAgentByBillId(bill.getId(), null);
    Proxy proxy = proxyService.getProxyByBillId(bill.getId());
    // 更新管理员提交的认证项资料信息
    DefaultTransactionDefinition def = new DefaultTransactionDefinition();
    def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    TransactionStatus status = transactionManager.getTransaction(def);
    try {
        Long businessId = null;
        Long orgCodeId = null;
        Long taxregisterId = null;
        Long identityCardId = null;
        Long agentId = null;
        Long proxyId = null;
        // 更新营业执照信息
        if (null != businessLicense && null != businessLicense.getId()) {
            businessLicense = businessService.updateBusinessLicense(soperationStart, soperationEnd, businessLicense, ComNames.ITEM_STATUS_2, bill.getEnterprise(), bill.getId(), bill.getUniqueId(), null);
            businessId = businessLicense.getId();
        }
        // 更新组织机构代码
        if (null != orgCode && null != orgCode.getId()) {
            orgCode = orgCodeService.updateOrgCode(orgCode, ComNames.ITEM_STATUS_2, bill.getEnterprise(), bill.getId(), bill.getUniqueId(), null);
            orgCodeId = orgCode.getId();
        }
        // 更新税务登记
        if (null != taxregisterCert && null != taxregisterCert.getId()) {
            taxregisterCert = taxCertService.updateTaxRegisterCert(taxregisterCert, ComNames.ITEM_STATUS_2, bill.getEnterprise(), bill.getId(), bill.getUniqueId(), null);
            taxregisterId = taxregisterCert.getId();
        }
        // 更新法定代表人
        if (null != identityCard && null != identityCard.getId()) {
            identityCard = identityCardService.updateIdentityCard(identityCard, ComNames.ITEM_STATUS_2, bill.getEnterprise(), bill.getId(), bill.getUniqueId(), null);
            identityCardId = identityCard.getId();
        }
        // 更新代理人
        if (null != agent && null != agent.getId()) {
            agent = agentService.updateAgent(agent, ComNames.ITEM_STATUS_2, bill.getEnterprise(), bill.getId(), bill.getUniqueId(), null);
            agentId = agent.getId();
        }
        // 更新授权书
        if (null != proxy && null != proxy.getId()) {
            proxy = proxyService.updateProxy(proxy, ComNames.ITEM_STATUS_2, bill.getEnterprise(), bill.getId(), bill.getUniqueId(), null, project);
            proxyId = proxy.getId();
        }
        // 设置第一个admin账号
        AdminExample adminExample = new AdminExample();
        adminExample.setOrderByClause("create_time ASC");
        List<Admin> admins = sqlSession.selectList("com.itrus.portal.db.AdminMapper.selectByExample", adminExample);
        // 更新企业信息
        Enterprise enterprise = enterpriseService.updateEnterprise(bill.getEnterprise(), certification.getId(), businessId, orgCodeId, taxregisterId, identityCardId, agentId);
        // 生成认证记录
        reviewLogService.saveReviewLog(2, admins.get(0).getId(), 1, null, bill.getEnterprise(), bill.getId(), bill.getUniqueId(), businessId, orgCodeId, taxregisterId, identityCardId, agentId, proxyId);
        bill.setCheckTime(new Date());
        sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKey", bill);
        transactionManager.commit(status);
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        if (!status.isCompleted())
            transactionManager.rollback(status);
    }
}
Also used : Agent(com.itrus.portal.db.Agent) DefaultTransactionDefinition(org.springframework.transaction.support.DefaultTransactionDefinition) Product(com.itrus.portal.db.Product) TransactionStatus(org.springframework.transaction.TransactionStatus) Admin(com.itrus.portal.db.Admin) Certification(com.itrus.portal.db.Certification) Date(java.util.Date) ParseException(java.text.ParseException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) DigitalCert(com.itrus.portal.db.DigitalCert) Project(com.itrus.portal.db.Project) OrgCode(com.itrus.portal.db.OrgCode) BusinessLicense(com.itrus.portal.db.BusinessLicense) Proxy(com.itrus.portal.db.Proxy) Enterprise(com.itrus.portal.db.Enterprise) SimpleDateFormat(java.text.SimpleDateFormat) AdminExample(com.itrus.portal.db.AdminExample) TaxRegisterCert(com.itrus.portal.db.TaxRegisterCert) IdentityCard(com.itrus.portal.db.IdentityCard)

Aggregations

BusinessLicense (com.itrus.portal.db.BusinessLicense)43 TaxRegisterCert (com.itrus.portal.db.TaxRegisterCert)30 Enterprise (com.itrus.portal.db.Enterprise)26 OrgCode (com.itrus.portal.db.OrgCode)25 IdentityCard (com.itrus.portal.db.IdentityCard)24 UserInfo (com.itrus.portal.db.UserInfo)21 Agent (com.itrus.portal.db.Agent)20 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)16 HashMap (java.util.HashMap)14 OpenBankInfo (com.itrus.portal.db.OpenBankInfo)13 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)13 ExtraProduct (com.itrus.portal.db.ExtraProduct)12 Proxy (com.itrus.portal.db.Proxy)11 ExtraBill (com.itrus.portal.db.ExtraBill)10 File (java.io.File)10 Date (java.util.Date)10 ArrayList (java.util.ArrayList)9 TransactionStatus (org.springframework.transaction.TransactionStatus)9 DefaultTransactionDefinition (org.springframework.transaction.support.DefaultTransactionDefinition)9 Product (com.itrus.portal.db.Product)8