Search in sources :

Example 91 with Enterprise

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

the class UIDInfoUtils method getUidInfo.

/**
 * 获取指定表中指定记录的指定属性值
 *
 * @param billId
 *            订单id
 * @param fields
 *            表名.属性名(businessLicense.enterpriseName)
 * @return 未找到返回null
 */
public String getUidInfo(Long billId, String fields) {
    // str[0]表名,str[1]字段名
    String[] strs = fields.split("\\.");
    BusinessLicense businessLicense = null;
    OrgCode orgCode = null;
    TaxRegisterCert taxRegisterCert = null;
    IdentityCard identityCard = null;
    UserInfo userInfo = null;
    Enterprise enterprise = null;
    switch(strs[0]) {
        case "businessLicense":
            businessLicense = blCache.get(billId);
            if (null == businessLicense) {
                businessLicense = businessService.getBusinessByBillId(billId, null);
                blCache.put(billId, businessLicense);
            }
            break;
        case "orgCode":
            orgCode = ocCache.get(billId);
            if (null == orgCode) {
                orgCode = orgCodeService.getOrgCodeByBillId(billId, null);
                ocCache.put(billId, orgCode);
            }
            break;
        case "taxRegisterCert":
            taxRegisterCert = trcCache.get(billId);
            if (null == taxRegisterCert) {
                taxRegisterCert = taxCertService.getTaxRegisterCertByBillId(billId, null);
                trcCache.put(billId, taxRegisterCert);
            }
            break;
        case "identityCard":
            identityCard = icCache.get(billId);
            if (null == identityCard) {
                identityCard = identityCardService.getIdentityCardByBillId(billId, null);
                icCache.put(billId, identityCard);
            }
            break;
        case "userInfo":
            userInfo = uiCache.get(billId);
            if (null == userInfo) {
                userInfo = userInfoService.getUserInfoByBillId(billId);
                uiCache.put(billId, userInfo);
            }
            break;
        case "enterprise":
            enterprise = eCache.get(billId);
            if (null == enterprise) {
                enterprise = enterpriseService.getEnterpriseByBillId(billId);
                eCache.put(billId, enterprise);
            }
            break;
        default:
            return null;
    }
    if (null != businessLicense) {
        return getBlFieldValue(businessLicense, strs[1]);
    }
    if (null != orgCode) {
        return getOcFieldValue(orgCode, strs[1]);
    }
    if (null != taxRegisterCert) {
        return getTcrFieldValue(taxRegisterCert, strs[1]);
    }
    if (null != identityCard) {
        return getIcFieldValue(identityCard, strs[1]);
    }
    if (null != userInfo) {
        return getUiFieldValue(userInfo, strs[1]);
    }
    if (null != enterprise) {
        return getEFieldValue(enterprise, strs[1]);
    }
    return null;
}
Also used : OrgCode(com.itrus.portal.db.OrgCode) BusinessLicense(com.itrus.portal.db.BusinessLicense) Enterprise(com.itrus.portal.db.Enterprise) UserInfo(com.itrus.portal.db.UserInfo) TaxRegisterCert(com.itrus.portal.db.TaxRegisterCert) IdentityCard(com.itrus.portal.db.IdentityCard)

Example 92 with Enterprise

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

the class PayWebControllerTest method multiNotfiyUrl.

@Test
public void multiNotfiyUrl() {
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
    System.out.println("开始时间:" + df.format(System.currentTimeMillis()));
    TestRunnable[] testRunnable = new TestRunnable[20];
    List<Bill> bills = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectByExample");
    for (int i = 0; i < testRunnable.length; i++) {
        if (i % 2 == 0) {
            System.out.println(bills.get(i).getBillId());
            Map<String, String> packageParams = new HashMap<String, String>();
            packageParams.put("appid", "112223");
            packageParams.put("nonce_str", "nonce_str");
            packageParams.put("body", "body");
            packageParams.put("out_trade_no", bills.get(i).getBillId());
            packageParams.put("transaction_id", UniqueIDUtils.genUUID());
            packageParams.put("pay_type", "1");
            packageParams.put("return_code", "SUCCESS");
            testRunnable[i] = new NotifyUrl(packageParams);
        } else {
            UserInfo userInfo = new UserInfo();
            userInfo.setmPhone("13yyy88986" + 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();
    } catch (Throwable e) {
        e.printStackTrace();
    }
    System.out.println("结束时间:" + df.format(System.currentTimeMillis()));
    System.out.println("成功数量" + SUCCESS_COUNT);
}
Also used : TestRunnable(net.sourceforge.groboutils.junit.v1.TestRunnable) HashMap(java.util.HashMap) UserInfo(com.itrus.portal.db.UserInfo) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) IOException(java.io.IOException) JsonGenerationException(org.codehaus.jackson.JsonGenerationException) FileNotFoundException(java.io.FileNotFoundException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) MultiThreadedTestRunner(net.sourceforge.groboutils.junit.v1.MultiThreadedTestRunner) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) Bill(com.itrus.portal.db.Bill) Enterprise(com.itrus.portal.db.Enterprise) SimpleDateFormat(java.text.SimpleDateFormat) Test(org.junit.Test)

Example 93 with Enterprise

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

the class EnterpriseServiceTest method test.

@Test
public void test() {
    try {
        Enterprise enterprise = enterpriseServiceImpl.getEnterpriseById(606L);
        Enterprise enterprise2 = new Enterprise();
        enterprise2.setId(enterprise.getId());
        // enterprise2.setEnterpriseName(enterprise.getEnterpriseName());
        enterpriseServiceImpl.updateByPrimaryKeySelective(enterprise2);
    } catch (Exception e) {
        // TODO: handle exception
        e.printStackTrace();
    /**
     * org.springframework.jdbc.UncategorizedSQLException:
     *### Error updating database.  Cause: java.sql.SQLException: sql injection violation, syntax error: syntax error, error in :'
     *    where id = ?',expect SET, actual WHERE where : update enterprise
     *
     *    where id = ?
     *### SQL: update enterprise            where id = ?
     *### Cause: java.sql.SQLException: sql injection violation, syntax error: syntax error, error in :'
     *    where id = ?',expect SET, actual WHERE where : update enterprise
     *
     *    where id = ?
     *; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; sql injection violation, syntax error: syntax error, error in :'
     *    where id = ?',expect SET, actual WHERE where : update enterprise
     *
     *    where id = ?; nested exception is java.sql.SQLException: sql injection violation, syntax error: syntax error, error in :'
     *    where id = ?',expect SET, actual WHERE where : update enterprise
     *
     *    where id = ?
     */
    }
}
Also used : Enterprise(com.itrus.portal.db.Enterprise) AbstractTest(com.itrus.portal.abstracttest.test.AbstractTest) Test(org.junit.Test)

Example 94 with Enterprise

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

the class ReadJsonStr method testGetJsonObject.

@Test
public void testGetJsonObject() throws JsonProcessingException, IOException {
    jsonTool.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    String jsonStr = "{\"editEnterpriseInfo\" : {\"enterpriseName\" : \"企业名称\",\"enterpriseNature\" : \"1\",\"orgIndustry\" : \"1\"},\"editUserInfo\" : {\"realName\" : \"姓名\",\"mPhone\" : \"1234\",\"email\" : \"邮箱\",\"telephone\" : \"固定电话\",\"userPosition\" : \"职位\",\"editUID\" : \"证书uid\"},\"editDelivery\" : {\"courier\" : \"快递方式\",\"cost\" : \"费用\",\"regionCodes\" : \"省市区代码\",\"detailAdds\" : \"详细地址\"},\"editInvoice\" : {\"name\" : \"企业名称\",\"receipt\" : \"发票类型\"},\"editBusinessLicense\" : {\"enterpriseName\" : \"企业名称\",\"licenseNo\" : \"营业执照号\",\"businessType\" : \"1三证合一0不是\",\"imgFile\" : \"图片base64或url\",\"id\" : \"12\"},\"editOrgCode\" : {\"enterpriseName\" : \"企业名称\",\"orgCode\" : \"组织机构代码\",\"imgFile\" : \"图片base64或url\",\"id\" : \"组织机构代码id\"},\"editTaxregisterCert\" : {\"enterpriseName\" : \"企业名称\",\"certNo\" : \"税务登记号\",\"imgFile\" : \"图片base64或url\",\"id\" : \"税务登记号id\"},\"editIdentityCard\" : {\"enterpriseName\" : \"企业名称\",\"name\" : \"法人姓名\",\"idCode\" : \"证件号\",\"frontImg\" : \"证件正面图片\",\"backImg\" : \"证件反面图片\",\"cardType\" : \"证件类型\",\"id\" : \"法代表人id\"},\"editProxy\" : {\"id\" : \"授权书id\",\"imgFile\" : \"图片base或url\"},\"editUID\" : \"证书uid\"}";
    JsonNode jsonNode = jsonTool.readTree(jsonStr);
    JsonNode editEnterpriseInfo = jsonNode.get("editEnterpriseInfo");
    Enterprise enterprise = jsonTool.readValue(editEnterpriseInfo, Enterprise.class);
    System.out.println(enterprise.getEnterpriseName());
    JsonNode editUserInfo = jsonNode.get("editUserInfo");
    UserInfo userInfo = jsonTool.readValue(editUserInfo, UserInfo.class);
    System.out.println(userInfo.getmPhone());
}
Also used : Enterprise(com.itrus.portal.db.Enterprise) JsonNode(org.codehaus.jackson.JsonNode) UserInfo(com.itrus.portal.db.UserInfo) Test(org.junit.Test)

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