Search in sources :

Example 36 with UserInfo

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

the class UnLockKeyBillServiceImpl method updateBillStatusWhileHasPay.

/**
 * 解锁订单支付之后,进行订单状态修改
 * 如果是自助解锁,则产生解锁码
 * @param bill
 * @param product
 * @return
 */
public Bill updateBillStatusWhileHasPay(Bill bill, Product product) {
    if (product.getKeyUnlockType().equals(ComNames.KEY_UNLOCK_TYPE_1)) {
        bill.setBillStatus(ComNames.BILL_STATUS_16);
        try {
            KeyUnlock keyunlock = keyUnlockService.getKeyUnlockByBillId(bill.getId());
            keyunlock = unlockKeyService.generateUnlockCode(null, null, keyunlock);
            UserInfo userInfo = userInfoService.getUserInfoById(bill.getUniqueId());
            if (dynamicCodeService.sendCodeZSJS(userInfo.getmPhone(), bill.getProject(), "ZSJS")) {
                bill.setIsSms(true);
                bill.setSendTime(new Date());
            }
        } catch (Exception e) {
            LogUtil.syslog(sqlSession, "自助生成解锁码异常", "异常信息:" + e.getMessage() + ",订单号:" + bill.getBillId());
        }
    } else {
        bill.setBillStatus(ComNames.BILL_STATUS_14);
    }
    return bill;
}
Also used : KeyUnlock(com.itrus.portal.db.KeyUnlock) UserInfo(com.itrus.portal.db.UserInfo) Date(java.util.Date)

Example 37 with UserInfo

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

the class ImageByBase64 method getImg.

/**
 * 获取图片文件File
 *
 * @param type
 *            类型:0营业执照图片,1组织机构代码图片,2税务登记图片,3授权书图片,4法人图片
 * @param id
 *            营业执照、组织机构代码、税务登记、授权书、法人中的某一项的id
 * @param num
 *            0表示正面,1标识反面图片
 * @return
 */
public File getImg(Long type, Long id, Long num) {
    File imgFile = null;
    String img = null;
    Long enterpriseId = null;
    Long userInfoId = null;
    try {
        if (type == ComNames.BUSINESS_ITEM) {
            BusinessLicense license = sqlsession.selectOne("com.itrus.portal.db.BusinessLicenseMapper.selectByPrimaryKey", id);
            if (license == null) {
                return null;
            }
            img = license.getImgFile();
            enterpriseId = license.getEnterprise();
        } else if (type == ComNames.ORG_CODE_ITEM) {
            OrgCode code = sqlsession.selectOne("com.itrus.portal.db.OrgCodeMapper.selectByPrimaryKey", id);
            if (code == null) {
                return null;
            }
            img = code.getImgFile();
            enterpriseId = code.getEnterprise();
        } else if (type == ComNames.TAX_CERT_ITEM) {
            TaxRegisterCert cert = sqlsession.selectOne("com.itrus.portal.db.TaxRegisterCertMapper.selectByPrimaryKey", id);
            if (cert == null) {
                return null;
            }
            img = cert.getImgFile();
            enterpriseId = cert.getEnterprise();
        } else if (type == ComNames.IDENTITY_CARD_ITEM) {
            IdentityCard card = sqlsession.selectOne("com.itrus.portal.db.IdentityCardMapper.selectByPrimaryKey", id);
            if (card == null) {
                return null;
            }
            if (num == 0) {
                img = card.getFrontImg();
            } else {
                img = card.getBackImg();
            }
            enterpriseId = card.getEnterprise();
        } else if (type == ComNames.PROXY_ITEM) {
            Proxy proxy = sqlsession.selectOne("com.itrus.portal.db.ProxyMapper.selectByPrimaryKey", id);
            if (proxy == null) {
                return null;
            }
            img = proxy.getImgFile();
            // 授权书图片存放在用户唯一标识目录下
            userInfoId = proxy.getUserInfo();
        } else if (type == ComNames.AGENT_ITEM) {
            Agent agent = sqlsession.selectOne("com.itrus.portal.db.AgentMapper.selectByPrimaryKey", id);
            if (agent == null) {
                return null;
            }
            if (num == 0) {
                img = agent.getFrontImg();
            } else {
                img = agent.getBackImg();
            }
            enterpriseId = agent.getEnterprise();
        }
        if (img == null) {
            return null;
        }
        File file = null;
        if (null != enterpriseId) {
            Enterprise enterprise = sqlsession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", enterpriseId);
            file = filePathUtils.getEnterpriseFile(enterprise.getEnterpriseSn());
        } else if (null != userInfoId) {
            // 授权书图片存放在用户唯一标识目录下
            UserInfo userInfo = sqlsession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", userInfoId);
            file = filePathUtils.getUserInfoFIle(userInfo.getUniqueId());
        } else {
            return null;
        }
        if (!file.exists()) {
            file.mkdirs();
        }
        imgFile = new File(file, img);
    } catch (IOException e) {
        // 未找到
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return imgFile;
}
Also used : Agent(com.itrus.portal.db.Agent) UserInfo(com.itrus.portal.db.UserInfo) IOException(java.io.IOException) ServiceNullException(com.itrus.portal.exception.ServiceNullException) IOException(java.io.IOException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) OrgCode(com.itrus.portal.db.OrgCode) BusinessLicense(com.itrus.portal.db.BusinessLicense) Proxy(com.itrus.portal.db.Proxy) Enterprise(com.itrus.portal.db.Enterprise) File(java.io.File) TaxRegisterCert(com.itrus.portal.db.TaxRegisterCert) IdentityCard(com.itrus.portal.db.IdentityCard)

Example 38 with UserInfo

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

the class PayWebControllerTest method testMultRegister.

// ********************用户注册和第三方支付并行测试
@Test
public void testMultRegister() throws Throwable {
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
    System.out.println("开始时间:" + df.format(System.currentTimeMillis()));
    TestRunnable[] testRunnable = new TestRunnable[200];
    for (int i = 0; i < testRunnable.length; i++) {
        UserInfo userInfo = new UserInfo();
        userInfo.setmPhone("13yy588986" + i);
        Enterprise enterprise = new Enterprise();
        enterprise.setEnterpriseName("yaliqiyeyy" + i);
        testRunnable[i] = new RegisterUserThread2(userInfo, enterprise);
    }
    MultiThreadedTestRunner mttr = new MultiThreadedTestRunner(testRunnable);
    try {
        mttr.runTestRunnables();
    } catch (Exception e) {
        e.printStackTrace();
    }
    System.out.println("结束时间:" + df.format(System.currentTimeMillis()));
    System.out.println("成功数量" + SUCCESS_COUNT);
}
Also used : TestRunnable(net.sourceforge.groboutils.junit.v1.TestRunnable) MultiThreadedTestRunner(net.sourceforge.groboutils.junit.v1.MultiThreadedTestRunner) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) Enterprise(com.itrus.portal.db.Enterprise) UserInfo(com.itrus.portal.db.UserInfo) SimpleDateFormat(java.text.SimpleDateFormat) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) IOException(java.io.IOException) JsonGenerationException(org.codehaus.jackson.JsonGenerationException) FileNotFoundException(java.io.FileNotFoundException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) Test(org.junit.Test)

Example 39 with UserInfo

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

the class UserInfoWebControllerTest method testMultRegister.

@Test
public void testMultRegister() throws Throwable {
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
    System.out.println("开始时间:" + df.format(System.currentTimeMillis()));
    TestRunnable[] testRunnable = new TestRunnable[200];
    for (int i = 0; i < testRunnable.length; i++) {
        UserInfo userInfo = new UserInfo();
        userInfo.setmPhone("13yy588986" + i);
        Enterprise enterprise = new Enterprise();
        enterprise.setEnterpriseName("yaliqiyeyy" + i);
        testRunnable[i] = new RegisterUserThread(userInfo, enterprise);
    }
    MultiThreadedTestRunner mttr = new MultiThreadedTestRunner(testRunnable);
    try {
        mttr.runTestRunnables();
    } catch (Exception e) {
        e.printStackTrace();
    }
    System.out.println("结束时间:" + df.format(System.currentTimeMillis()));
    System.out.println("成功数量" + SUCCESS_COUNT);
}
Also used : TestRunnable(net.sourceforge.groboutils.junit.v1.TestRunnable) MultiThreadedTestRunner(net.sourceforge.groboutils.junit.v1.MultiThreadedTestRunner) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) Enterprise(com.itrus.portal.db.Enterprise) UserInfo(com.itrus.portal.db.UserInfo) SimpleDateFormat(java.text.SimpleDateFormat) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) Test(org.junit.Test)

Example 40 with UserInfo

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

the class ReviewServiceImpl method sendSmsBySHJJ.

// 拒绝后台的订单,发送短信通知
/**
 * 发送审核拒绝短信通知(模版类型:SHJJ)
 *
 * @param billId
 * @return
 */
public boolean sendSmsBySHJJ(Long billId) {
    if (null == billId) {
        return false;
    }
    Bill bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", billId);
    if (null == bill) {
        return false;
    }
    // 查询短信模版
    // 查找对应项目的消息模版:SHJJ
    MessageTemplate messageTemplate = messageTemplateService.getMsgTemp(bill.getProject(), "SHJJ");
    if (null == messageTemplate) {
        logger.error("发送短信失败,未找到对应的鉴证审核消息模版");
        return false;
    }
    Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bill.getEnterprise());
    Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.getProduct());
    Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", bill.getProject());
    UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bill.getUniqueId());
    String content = messageTemplate.getMessageContent();
    // 替换特定内容:企业名称:enterpriseName,产品名称:productName,项目名称:projectName,拒绝原因:reason
    if (content.contains("enterpriseName")) {
        content = content.replaceAll("enterpriseName", enterprise.getEnterpriseName());
    }
    if (content.contains("productName")) {
        content = content.replaceAll("productName", product.getName());
    }
    if (content.contains("projectName")) {
        content = content.replaceAll("projectName", project.getName());
    }
    if (content.contains("reason")) {
        content = content.replaceAll("reason", bill.getCancelReason());
    }
    // 发送短信
    try {
        if (smsSendService.sendRefuseReview(userInfo.getmPhone(), content, "SHJJ", project.getId(), userInfo.getUniqueId(), bill.getBillId())) {
            // 发送成功
            return true;
        } else {
            return false;
        }
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
}
Also used : MessageTemplate(com.itrus.portal.db.MessageTemplate) Project(com.itrus.portal.db.Project) Bill(com.itrus.portal.db.Bill) Enterprise(com.itrus.portal.db.Enterprise) Product(com.itrus.portal.db.Product) UserInfo(com.itrus.portal.db.UserInfo) ParseException(java.text.ParseException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException)

Aggregations

UserInfo (com.itrus.portal.db.UserInfo)99 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)79 Enterprise (com.itrus.portal.db.Enterprise)68 HashMap (java.util.HashMap)52 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)40 IOException (java.io.IOException)39 HttpSession (javax.servlet.http.HttpSession)37 Bill (com.itrus.portal.db.Bill)31 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)31 Product (com.itrus.portal.db.Product)26 ExtraProduct (com.itrus.portal.db.ExtraProduct)24 Project (com.itrus.portal.db.Project)24 UserCert (com.itrus.portal.db.UserCert)24 BusinessLicense (com.itrus.portal.db.BusinessLicense)21 ExtraBill (com.itrus.portal.db.ExtraBill)20 TaxRegisterCert (com.itrus.portal.db.TaxRegisterCert)20 UserLog (com.itrus.portal.db.UserLog)20 IdentityCard (com.itrus.portal.db.IdentityCard)19 OrgCode (com.itrus.portal.db.OrgCode)19 UserinfoEnterprise (com.itrus.portal.db.UserinfoEnterprise)19