Search in sources :

Example 61 with UserInfoServiceException

use of com.itrus.portal.exception.UserInfoServiceException in project portal by ixinportal.

the class TaxCertServiceImpl method updateTaxCertExtraBill.

/**
 * 增值订单重新提交税务登记证
 * @param enterpriseId
 * @param enterpriseSn
 * @param billId
 * @param userInfoId
 * @param taxRegisterCert
 * @param itemStatus
 * @param old
 * @return
 * @throws Exception
 */
public TaxRegisterCert updateTaxCertExtraBill(Long enterpriseId, String enterpriseSn, Long billId, Long userInfoId, TaxRegisterCert taxRegisterCert, Integer itemStatus, TaxRegisterCert old) throws Exception {
    File imgDir = filePathUtils.getEnterpriseFile(enterpriseSn);
    if (null == taxRegisterCert || StringUtils.isBlank(taxRegisterCert.getEnterpriseName()) || StringUtils.isBlank(taxRegisterCert.getCertNo())) {
        throw new UserInfoServiceException("请提交完整的税务登记证信息");
    }
    taxRegisterCert.setLastModify(new Date());
    taxRegisterCert.setEnterprise(enterpriseId);
    taxRegisterCert.setExtraBill(billId);
    taxRegisterCert.setUserInfo(userInfoId);
    // 审核状态:1未审核,2已审核,3已拒绝
    taxRegisterCert.setItemStatus(itemStatus);
    if (StringUtils.isNotBlank(taxRegisterCert.getImgFile()) && !ComNames.USE_OLD_IMG.equals(taxRegisterCert.getImgFile())) {
        File liceImg = filePathUtils.saveImg(imgDir, null, taxRegisterCert.getImgFile(), IMG_DEFAULT_TYPE, IMG_NAME_TAX);
        if (liceImg != null && liceImg.isFile()) {
            taxRegisterCert.setImgFile(liceImg.getName());
            taxRegisterCert.setImgFileHash(HMACSHA1.genSha1HashOfFile(liceImg));
        }
    }
    sqlSession.update("com.itrus.portal.db.TaxRegisterCertMapper.updateByPrimaryKeySelective", taxRegisterCert);
    sqlSession.flushStatements();
    return taxRegisterCert;
}
Also used : File(java.io.File) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) Date(java.util.Date)

Example 62 with UserInfoServiceException

use of com.itrus.portal.exception.UserInfoServiceException in project portal by ixinportal.

the class TaxCertServiceImpl method saveTaxCertExtraBill.

/**
 * 增值订单保存税务登记证
 * @param enterpriseId
 * @param enterpriseSn
 * @param billId
 * @param userInfoId
 * @param taxRegisterCert
 * @param itemStatus
 * @param old
 * @return
 * @throws Exception
 */
public TaxRegisterCert saveTaxCertExtraBill(Long enterpriseId, String enterpriseSn, Long billId, Long userInfoId, TaxRegisterCert taxRegisterCert, Integer itemStatus, TaxRegisterCert old) throws Exception {
    File imgDir = filePathUtils.getEnterpriseFile(enterpriseSn);
    // 判断税务登记证图片是否重新上传了,没有重新上传,则会提交税务登记证的id,重新上传,还是按照下面的方法处理
    if (null != taxRegisterCert.getId()) {
        TaxRegisterCert newTax = new TaxRegisterCert();
        TaxRegisterCert oldTax = sqlSession.selectOne("com.itrus.portal.db.TaxRegisterCertMapper.selectByPrimaryKey", taxRegisterCert.getId());
        newTax.setEnterpriseName(taxRegisterCert.getEnterpriseName());
        newTax.setCertNo(taxRegisterCert.getCertNo());
        newTax.setCreateTime(new Date());
        newTax.setLastModify(new Date());
        newTax.setEnterprise(enterpriseId);
        newTax.setExtraBill(billId);
        newTax.setUserInfo(userInfoId);
        // 审核状态:1未审核,2已审核,3已拒绝
        newTax.setItemStatus(oldTax.getItemStatus());
        if (StringUtils.isNotBlank(taxRegisterCert.getImgFile())) {
            File liceImg = filePathUtils.saveImg(imgDir, null, taxRegisterCert.getImgFile(), IMG_DEFAULT_TYPE, IMG_NAME_TAX);
            if (liceImg != null && liceImg.isFile()) {
                newTax.setImgFile(liceImg.getName());
                newTax.setImgFileHash(HMACSHA1.genSha1HashOfFile(liceImg));
            }
        } else {
            newTax.setImgFile(oldTax.getImgFile());
            newTax.setImgFileHash(oldTax.getImgFileHash());
        }
        sqlSession.insert("com.itrus.portal.db.TaxRegisterCertMapper.insert", newTax);
        sqlSession.flushStatements();
        return newTax;
    }
    if (null == taxRegisterCert || StringUtils.isBlank(taxRegisterCert.getEnterpriseName()) || StringUtils.isBlank(taxRegisterCert.getCertNo())) {
        throw new UserInfoServiceException("请提交完整的税务登记证信息");
    }
    taxRegisterCert.setCreateTime(new Date());
    taxRegisterCert.setLastModify(new Date());
    taxRegisterCert.setEnterprise(enterpriseId);
    taxRegisterCert.setExtraBill(billId);
    taxRegisterCert.setUserInfo(userInfoId);
    // 审核状态:1未审核,2已审核,3已拒绝
    taxRegisterCert.setItemStatus(itemStatus);
    if (StringUtils.isNotBlank(taxRegisterCert.getImgFile()) && !ComNames.USE_OLD_IMG.equals(taxRegisterCert.getImgFile())) {
        File liceImg = filePathUtils.saveImg(imgDir, null, taxRegisterCert.getImgFile(), IMG_DEFAULT_TYPE, IMG_NAME_TAX);
        if (liceImg != null && liceImg.isFile()) {
            taxRegisterCert.setImgFile(liceImg.getName());
            taxRegisterCert.setImgFileHash(HMACSHA1.genSha1HashOfFile(liceImg));
        }
    }
    if (old == null) {
        sqlSession.insert("com.itrus.portal.db.TaxRegisterCertMapper.insert", taxRegisterCert);
    } else {
        taxRegisterCert.setId(old.getId());
        sqlSession.update("com.itrus.portal.db.TaxRegisterCertMapper.updateByPrimaryKeySelective", taxRegisterCert);
    }
    sqlSession.flushStatements();
    return taxRegisterCert;
}
Also used : File(java.io.File) TaxRegisterCert(com.itrus.portal.db.TaxRegisterCert) Date(java.util.Date) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException)

Example 63 with UserInfoServiceException

use of com.itrus.portal.exception.UserInfoServiceException in project portal by ixinportal.

the class ReviewServiceImpl method audit.

/**
 * 送审
 *
 * @param bill
 * @return
 * @throws Exception
 */
public boolean audit(Bill bill) throws Exception {
    AuditSystemConfig auditSystemConfig = auditSystemConfigService.getAuditSystemConfig(new AuditSystemConfigExample());
    if (null == auditSystemConfig) {
        // 未配置第三方鉴证信息
        return false;
    }
    String jsonString = submitReviewService.getAuditJsonParam(bill);
    String appsecret = submitReviewService.getProductAppsecret(bill.getProduct());
    String result = RequestUtils.post(auditSystemConfig.getAuditSystemUrl() + ComNames.APIS, jsonString, appsecret);
    // 将返回信息同步至订单状态
    JsonNode respNode = jsonTool.readTree(result);
    if (200 == respNode.get("status").asInt()) {
        String dataId = respNode.get("result").get("dataid").getTextValue();
        // 提交成功
        // 设置为送审中的状态
        bill.setBillStatus(ComNames.BILL_STATUS_10);
        bill.setCheckTime(new Date());
        // 设置送审系统中返回的企业的唯一标识
        bill.setDataId(dataId);
        sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKey", bill);
        // 添加系统日志
        LogUtil.syslog(sqlSession, "单条送审", "产品ID" + bill.getProduct() + "企业ID:" + bill.getEnterprise());
        return true;
    } else if (201 == respNode.get("status").asInt()) {
        String message = respNode.get("message").getTextValue();
        throw new UserInfoServiceException(message);
    }
    return false;
}
Also used : AuditSystemConfig(com.itrus.portal.db.AuditSystemConfig) AuditSystemConfigExample(com.itrus.portal.db.AuditSystemConfigExample) JsonNode(org.codehaus.jackson.JsonNode) Date(java.util.Date) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException)

Example 64 with UserInfoServiceException

use of com.itrus.portal.exception.UserInfoServiceException in project portal by ixinportal.

the class UserInfoServiceImpl method registerUserInfo.

/**
 * 注册用户(第一步)
 *
 * @param mPhone
 * @param password
 * @param projectId
 * @return
 * @throws UserInfoServiceException
 */
public synchronized UserInfo registerUserInfo(String mPhone, String password, Long projectId) throws UserInfoServiceException {
    UserInfo userInfo0 = getUserInfoByMphone(mPhone);
    if (null != userInfo0)
        throw new UserInfoServiceException("该手机号已经注册过用户,请重新登录");
    UserInfo userInfo = new UserInfo();
    userInfo.setCreateTime(new Date());
    userInfo.setLastModify(new Date());
    userInfo.setProject(projectId);
    userInfo.setmPhone(mPhone);
    userInfo.setPassword(passwordEncoder.encodePassword(password, ComNames.SALT));
    // 设置用户唯一标识
    userInfo.setUniqueId(UniqueIDUtils.genUserInfoUID(sqlSession));
    userInfo.setTrustMPhone(true);
    userInfo.setTrustEmail(false);
    sqlSession.insert("com.itrus.portal.db.UserInfoMapper.insert", userInfo);
    sqlSession.flushStatements();
    // 更新用户唯一标识
    userInfo.setUniqueId(UniqueIDUtils.genUserInfoUID(userInfo));
    sqlSession.update("com.itrus.portal.db.UserInfoMapper.updateByPrimaryKey", userInfo);
    return userInfo;
}
Also used : UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) Date(java.util.Date)

Example 65 with UserInfoServiceException

use of com.itrus.portal.exception.UserInfoServiceException in project portal by ixinportal.

the class OrgCodeServiceImpl method saveOrgCode1.

public OrgCode saveOrgCode1(Long enterPriseId, String enterpriseSn, Long billId, Long userInfoId, OrgCode orgCode, Integer itemStatus, OrgCode old) throws Exception {
    File imgDir = filePathUtils.getEnterpriseFile(enterpriseSn);
    Enterprise ent = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", enterPriseId);
    // 判断组织机构代码图片是否重新上传了,没有重新上传,则会提交组织机构代码的id,重新上传,还是按照下面的方法处理
    if (null != orgCode.getId()) {
        OrgCode newOrgCode = new OrgCode();
        OrgCode oldOrgCode = sqlSession.selectOne("com.itrus.portal.db.OrgCodeMapper.selectByPrimaryKey", orgCode.getId());
        newOrgCode.setEnterpriseName(orgCode.getEnterpriseName());
        newOrgCode.setOrgCode(orgCode.getOrgCode());
        newOrgCode.setCreateTime(new Date());
        newOrgCode.setLastModify(new Date());
        newOrgCode.setEnterprise(enterPriseId);
        newOrgCode.setBill(billId);
        newOrgCode.setUserInfo(userInfoId);
        // 审核状态:1未审核,2已审核,3已拒绝
        newOrgCode.setItemStatus(oldOrgCode.getItemStatus());
        if (null != orgCode.getOrgCodeType())
            newOrgCode.setOrgCodeType(orgCode.getOrgCodeType());
        if (StringUtils.isNotBlank(orgCode.getImgFile())) {
            File liceImg = filePathUtils.saveImg(imgDir, null, orgCode.getImgFile(), IMG_DEFAULT_TYPE, IMG_NAME_ORG);
            if (liceImg != null && liceImg.isFile()) {
                newOrgCode.setImgFile(liceImg.getName());
                newOrgCode.setImgFileHash(HMACSHA1.genSha1HashOfFile(liceImg));
            }
        } else {
            newOrgCode.setImgFile(oldOrgCode.getImgFile());
            newOrgCode.setImgFileHash(oldOrgCode.getImgFileHash());
        }
        sqlSession.insert("com.itrus.portal.db.OrgCodeMapper.insert", newOrgCode);
        sqlSession.flushStatements();
        return newOrgCode;
    }
    if ((null == orgCode || StringUtils.isBlank(orgCode.getEnterpriseName()) || StringUtils.isBlank(orgCode.getOrgCode())) && ent.getEnterpriseNature() != 2) {
        throw new UserInfoServiceException("请提交完整的组织机构代码信息");
    }
    orgCode.setCreateTime(new Date());
    orgCode.setLastModify(new Date());
    orgCode.setEnterprise(enterPriseId);
    orgCode.setBill(billId);
    orgCode.setUserInfo(userInfoId);
    // 审核状态:1未审核,2已审核,3已拒绝
    orgCode.setItemStatus(itemStatus);
    if (StringUtils.isNotBlank(orgCode.getImgFile()) && !ComNames.USE_OLD_IMG.equals(orgCode.getImgFile())) {
        File liceImg = filePathUtils.saveImg(imgDir, null, orgCode.getImgFile(), IMG_DEFAULT_TYPE, IMG_NAME_ORG);
        if (liceImg != null && liceImg.isFile()) {
            orgCode.setImgFile(liceImg.getName());
            orgCode.setImgFileHash(HMACSHA1.genSha1HashOfFile(liceImg));
        }
    }
    if (old == null) {
        sqlSession.insert("com.itrus.portal.db.OrgCodeMapper.insert", orgCode);
    } else {
        orgCode.setId(old.getId());
        sqlSession.update("com.itrus.portal.db.OrgCodeMapper.updateByPrimaryKey", orgCode);
    }
    sqlSession.flushStatements();
    return orgCode;
}
Also used : OrgCode(com.itrus.portal.db.OrgCode) Enterprise(com.itrus.portal.db.Enterprise) File(java.io.File) Date(java.util.Date) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException)

Aggregations

UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)73 Date (java.util.Date)39 HashMap (java.util.HashMap)31 File (java.io.File)26 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)22 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)21 Enterprise (com.itrus.portal.db.Enterprise)19 IOException (java.io.IOException)19 UserInfo (com.itrus.portal.db.UserInfo)17 TransactionStatus (org.springframework.transaction.TransactionStatus)14 DefaultTransactionDefinition (org.springframework.transaction.support.DefaultTransactionDefinition)14 SigningServerException (com.itrus.cryptorole.SigningServerException)11 IdentityCard (com.itrus.portal.db.IdentityCard)11 CertificateException (java.security.cert.CertificateException)11 BusinessLicense (com.itrus.portal.db.BusinessLicense)10 JsonGenerationException (org.codehaus.jackson.JsonGenerationException)10 JsonMappingException (org.codehaus.jackson.map.JsonMappingException)10 Agent (com.itrus.portal.db.Agent)9 OrgCode (com.itrus.portal.db.OrgCode)9 TaxRegisterCert (com.itrus.portal.db.TaxRegisterCert)9