Search in sources :

Example 81 with Enterprise

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

the class EnterpriseServiceImpl method updateEnterprise.

/**
 * 更新企业信息(设置对应的认证项和认证等级)
 *
 * @param enterpriseId
 *            企业id
 * @param authenticationLevel
 *            认证等级
 * @param businessId
 *            营业执照id
 * @param orgCodeId
 *            组织机构代码id
 * @param taxRegisterCertId
 *            税务登记id
 * @param IdentityCardId
 *            法人id
 * @param AgentId
 *            代理人id
 * @return
 */
public Enterprise updateEnterprise(Long enterpriseId, Long authenticationLevel, Long businessId, Long orgCodeId, Long taxRegisterCertId, Long IdentityCardId, Long AgentId) {
    Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", enterpriseId);
    // 认证等级
    enterprise.setAuthenticationLevel(authenticationLevel);
    // 营业执照
    enterprise.setHasBl(businessId);
    // 组织机构代码
    enterprise.setHasOrgCode(orgCodeId);
    // 税务登记
    enterprise.setHasTaxCert(taxRegisterCertId);
    // 法人
    enterprise.setHasIdCard(IdentityCardId);
    // 代理人
    enterprise.setHasAgent(AgentId);
    sqlSession.update("com.itrus.portal.db.EnterpriseMapper.updateByPrimaryKey", enterprise);
    sqlSession.flushStatements();
    return enterprise;
}
Also used : Enterprise(com.itrus.portal.db.Enterprise)

Example 82 with Enterprise

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

the class EnterpriseServiceImpl method addEnterPrise.

/**
 * 如果根据企业名称能查询到企业,就修改 如果查不到就新建企业 szy 2016年8月22日 下午3:10:30
 *
 * @param enterprise
 * @return Enterprise
 */
public Enterprise addEnterPrise(Enterprise enterprise) {
    EnterpriseExample example = new EnterpriseExample();
    EnterpriseExample.Criteria criteria = example.or();
    criteria.andEnterpriseNameEqualTo(enterprise.getEnterpriseName());
    Enterprise enterprise0 = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByExample", example);
    if (null != enterprise0) {
        enterprise0.setEnterpriseSn(enterprise.getEnterpriseSn());
        enterprise0.setEnterpriseNature(enterprise.getEnterpriseNature());
        enterprise0.setOrgIndustry(enterprise.getOrgIndustry());
        sqlSession.update("com.itrus.portal.db.EnterpriseMapper.updateByPrimaryKey", enterprise0);
        sqlSession.flushStatements();
        return enterprise0;
    } else {
        // 新增
        enterprise.setCreateTime(new Date());
        // 设置企业标识
        sqlSession.insert("com.itrus.portal.db.EnterpriseMapper.insert", enterprise);
        sqlSession.flushStatements();
        return enterprise;
    }
}
Also used : EnterpriseExample(com.itrus.portal.db.EnterpriseExample) Enterprise(com.itrus.portal.db.Enterprise) Date(java.util.Date)

Example 83 with Enterprise

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

the class EnterpriseServiceImpl method getEntByEnterpriseSn.

/**
 * 根据企业sn,查找企业
 * @param enterpriseSn
 * @return
 */
public Enterprise getEntByEnterpriseSn(String enterpriseSn) {
    EnterpriseExample example = new EnterpriseExample();
    EnterpriseExample.Criteria criteria = example.or();
    criteria.andEnterpriseSnEqualTo(enterpriseSn);
    Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByExample", example);
    return enterprise;
}
Also used : EnterpriseExample(com.itrus.portal.db.EnterpriseExample) Enterprise(com.itrus.portal.db.Enterprise)

Example 84 with Enterprise

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

the class EnterpriseServiceImpl method saveOrUpdateEnterprise.

/**
 * 根据企业名称查看企业是否已经存在,存在则修改,不存在则添加
 *
 * @param enterprise
 * @return
 */
public Enterprise saveOrUpdateEnterprise(Enterprise enterprise) {
    EnterpriseExample example = new EnterpriseExample();
    EnterpriseExample.Criteria criteria = example.or();
    enterprise.setEnterpriseName(enterprise.getEnterpriseName().trim());
    criteria.andEnterpriseNameEqualTo(enterprise.getEnterpriseName());
    Enterprise enterprise0 = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByExample", example);
    if (null != enterprise0) {
        // 修改
        enterprise0.setEnterpriseNature(enterprise.getEnterpriseNature());
        enterprise0.setOrgIndustry(enterprise.getOrgIndustry());
        enterprise0.setAuthenticationLevel(null);
        enterprise0.setHasBl(null);
        enterprise0.setHasOrgCode(null);
        enterprise0.setHasTaxCert(null);
        enterprise0.setHasIdCard(null);
        enterprise0.setHasAgent(null);
        sqlSession.update("com.itrus.portal.db.EnterpriseMapper.updateByPrimaryKey", enterprise0);
        sqlSession.flushStatements();
        return enterprise0;
    } else {
        // 新增
        enterprise.setCreateTime(new Date());
        // 修复新增企业自动给企业生成唯一标识的bug
        if (StringUtils.isBlank(enterprise.getEnterpriseSn())) {
            // 设置企业标识
            enterprise.setEnterpriseSn(UniqueIDUtils.genEnterpriseUID(sqlSession));
        }
        sqlSession.insert("com.itrus.portal.db.EnterpriseMapper.insert", enterprise);
        sqlSession.flushStatements();
        return enterprise;
    }
}
Also used : EnterpriseExample(com.itrus.portal.db.EnterpriseExample) Enterprise(com.itrus.portal.db.Enterprise) Date(java.util.Date)

Example 85 with Enterprise

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

the class EnterpriseServiceImpl method getEntByName.

/**
 * 根据企业名称获取企业信息 szy 2016年8月24日 下午4:49:11
 *
 * @param enterpriseName
 * @return Enterprise
 */
public Enterprise getEntByName(String enterpriseName) {
    EnterpriseExample example = new EnterpriseExample();
    EnterpriseExample.Criteria criteria = example.or();
    criteria.andEnterpriseNameEqualTo(enterpriseName);
    example.setOrderByClause("create_time desc");
    example.setLimit(1);
    Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByExample", example);
    return enterprise;
}
Also used : EnterpriseExample(com.itrus.portal.db.EnterpriseExample) Enterprise(com.itrus.portal.db.Enterprise)

Aggregations

Enterprise (com.itrus.portal.db.Enterprise)94 UserInfo (com.itrus.portal.db.UserInfo)68 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)58 HashMap (java.util.HashMap)47 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)37 IOException (java.io.IOException)32 Product (com.itrus.portal.db.Product)27 HttpSession (javax.servlet.http.HttpSession)27 Bill (com.itrus.portal.db.Bill)26 BusinessLicense (com.itrus.portal.db.BusinessLicense)26 TaxRegisterCert (com.itrus.portal.db.TaxRegisterCert)25 ExtraProduct (com.itrus.portal.db.ExtraProduct)24 OrgCode (com.itrus.portal.db.OrgCode)23 IdentityCard (com.itrus.portal.db.IdentityCard)22 UserinfoEnterprise (com.itrus.portal.db.UserinfoEnterprise)22 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)22 ExtraBill (com.itrus.portal.db.ExtraBill)21 Project (com.itrus.portal.db.Project)20 UserCert (com.itrus.portal.db.UserCert)19 Agent (com.itrus.portal.db.Agent)18