Search in sources :

Example 71 with Bill

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

the class SubmitReviewTask method query.

/**
 * 查询送审
 */
public void query() {
    if (!isRun()) {
        return;
    }
    // 获取第三方鉴证配置信息
    AuditSystemConfig auditSystemConfig = auditSystemConfigService.getAuditSystemConfig(new AuditSystemConfigExample());
    // 未配置第三方鉴证信息、未开启查询送审、未配置查询送审时间间隔,直接返回
    if (null == auditSystemConfig || !auditSystemConfig.getIsQuery() || null == auditSystemConfig.getQueryInterval()) {
        log.debug("未配置第三方鉴证信息、未开启查询送审、未配置查询送审时间间隔--返回");
        return;
    }
    // 上次查询送审时间为空,或者上次查询送审时间大于当前时间,则重新设置上次查询送审时间为当前时间的毫秒数
    if (null == auditSystemConfig.getQueryStartTime() || auditSystemConfig.getQueryStartTime() > System.currentTimeMillis()) {
        auditSystemConfig.setQueryStartTime(System.currentTimeMillis());
        auditSystemConfigService.updateAuditSystemConfig(auditSystemConfig);
    }
    // 判断是否在查询送审的时间间隔内(当前时间小于 上次查询送审时间加上送审时间间隔)
    if (System.currentTimeMillis() < auditSystemConfig.getQueryStartTime() + (auditSystemConfig.getQueryInterval() * 1000)) {
        log.debug("不在查询送审时间内");
        return;
    }
    // 设置本次送审时间
    auditSystemConfig.setQueryStartTime(System.currentTimeMillis());
    auditSystemConfigService.updateAuditSystemConfig(auditSystemConfig);
    // TransactionStatus s = null;
    try {
        // 获取送审中的订单
        Map<Long, List<Bill>> billListMap = submitReviewService.getQueryBill(submitReviewService.getAuditProduct());
        // 根据产品来提交信息
        Product product = null;
        Enterprise ent = null;
        JSONObject jsonMap = null;
        JSONObject data = null;
        BusinessLicense bl = null;
        OrgCode oc = null;
        TaxRegisterCert trc = null;
        IdentityCard ic = null;
        Agent at = null;
        Proxy p = null;
        Product product1 = null;
        Product product2 = null;
        Product product3 = null;
        int count;
        int reject;
        for (Long productId : billListMap.keySet()) {
            List<Bill> billList = billListMap.get(productId);
            product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", productId);
            DigitalCert cert1 = null;
            DigitalCert cert2 = null;
            DigitalCert cert3 = null;
            if (null != product.getIsCombined() && product.getIsCombined() == 1) {
                if (null != product.getCombinedId()) {
                    String[] comb = product.getCombinedId().split(",");
                    product1 = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", Long.parseLong(comb[0]));
                    product2 = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", Long.parseLong(comb[1]));
                    if (comb.length == 3) {
                        product3 = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", Long.parseLong(comb[2]));
                    }
                }
                if (null != product1 && null != product1.getCert()) {
                    // 产品关联的数字证书
                    cert1 = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", product1.getCert());
                }
                if (null != product2 && null != product2.getCert()) {
                    // 产品关联的数字证书
                    cert2 = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", product2.getCert());
                }
                if (null != product3 && null != product3.getCert()) {
                    // 产品关联的数字证书
                    cert3 = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", product3.getCert());
                }
            }
            DigitalCert cert = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", product.getCert());
            count = 0;
            reject = 0;
            for (Bill bill : billList) {
                ent = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bill.getEnterprise());
                if (null == jsonMap) {
                    jsonMap = new JSONObject();
                }
                jsonMap.put("appId", product.getAppId());
                jsonMap.put("appsecret", product.getAppsecret());
                // 待查询的记录id
                jsonMap.put("dataid", bill.getDataId());
                String result = RequestUtils.post(auditSystemConfig.getAuditSystemUrl() + queryUrl, jsonMap.toString(), product.getAppsecret());
                // log.info(result);
                data = JSON.parseObject(result);
                if (data.getInteger("status") != 200) {
                    continue;
                }
                data = data.getJSONObject("result");
                // 将返回信息同步至订单状态
                // 0是未通过,1是通过,2是审核中
                int status = data.getInteger("auditstatus");
                // data.getString("auditmessage");
                if (status == 2 || status == 1003) {
                    continue;
                }
                // DefaultTransactionDefinition def = new
                // DefaultTransactionDefinition();
                // def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
                // s = transactionManager.getTransaction(def);
                String reason = data.getString("auditresult");
                bill.setBillStatus(ComNames.BILL_STATUS_4);
                bill.setCheckTime(new Date(data.getLong("auditdate")));
                bill.setCancelReason(reason);
                bl = businessService.getBusinessByBillId(bill.getId(), null);
                oc = orgCodeService.getOrgCodeByBillId(bill.getId(), null);
                trc = taxCertService.getTaxRegisterCertByBillId(bill.getId(), null);
                ic = identityCardService.getIdentityCardByBillId(bill.getId(), null);
                at = agentService.getAgentByBillId(bill.getId(), null);
                // 默认未审核
                Integer itemStatus = 1;
                JsonNode respNode = jsonTool.readTree(result);
                if (status == 1) {
                    if (respNode.get("source") != null) {
                        ent.setInfo(respNode.get("source").getTextValue().getBytes());
                    }
                    bill.setBillStatus(ComNames.BILL_STATUS_5);
                    if (bill.getOldUserCert() != null) {
                        bill.setBillStatus(ComNames.BILL_STATUS_12);
                    }
                    // 数字证书操作方式为用户下载(2)的,订单状态设置为待下载
                    if (null != cert && null != cert.getInitBuy() && "2".equals(cert.getInitBuy())) {
                        bill.setBillStatus(ComNames.BILL_STATUS_13);
                    }
                    // 当产品没有配置有数字证书的时候
                    if (null == cert && null == cert1 && null == cert2 && null == cert3) {
                        // 根据订单判断订单是否需要开票:0标识不需要开票,1需要开纸质发票,2需要开电子发票
                        int type = billService.getBillInvoiceType(bill);
                        switch(type) {
                            case 0:
                                bill.setBillStatus(ComNames.BILL_STATUS_8);
                                break;
                            case 1:
                                if (null != bill.getIsInvoiced() && bill.getIsInvoiced().equals(1)) {
                                    bill.setBillStatus(ComNames.BILL_STATUS_7);
                                } else {
                                    bill.setBillStatus(ComNames.BILL_STATUS_6);
                                }
                                break;
                            case 2:
                                if (null != bill.getIsInvoiced() && bill.getIsInvoiced().equals(1)) {
                                    bill.setBillStatus(ComNames.BILL_STATUS_8);
                                } else {
                                    bill.setBillStatus(ComNames.BILL_STATUS_6);
                                }
                                break;
                            default:
                                break;
                        }
                    }
                    ent.setAuthenticationLevel(product.getAuthentication());
                    ent.setReviewTime(new Date());
                    // 设置状态
                    itemStatus = 2;
                    count++;
                } else if (status == 0) {
                    // 审核拒绝
                    itemStatus = 3;
                    // 发送短信
                    if (reviewService.sendSmsBySHJJ(bill.getId())) {
                        bill.setIsSms(true);
                        bill.setSendTime(new Date());
                    }
                    reject++;
                }
                // 更新认证项
                if (null != bl) {
                    bl.setItemStatus(itemStatus);
                    reviewService.saveBl(bl, respNode.get("source"));
                    ent.setHasBl(bl.getId());
                    if (status == 1 && respNode.get("source") == null) {
                        // 通过 无值
                        String pid = systemConfigService.getReviewProjectId();
                        if (null != pid && Long.valueOf(pid) == bill.getProject()) {
                            // 用友
                            bill.setBillStatus(ComNames.BILL_STATUS_10);
                            LogUtil.syslog(this.sqlSession, "查询送审", "错误:" + bill.getBillId() + respNode.toString());
                        }
                    }
                }
                if (null != oc) {
                    oc.setItemStatus(itemStatus);
                    sqlSession.update("com.itrus.portal.db.OrgCodeMapper.updateByPrimaryKeySelective", oc);
                    ent.setHasOrgCode(oc.getId());
                }
                if (null != trc) {
                    trc.setItemStatus(itemStatus);
                    sqlSession.update("com.itrus.portal.db.TaxRegisterCertMapper.updateByPrimaryKeySelective", trc);
                    ent.setHasTaxCert(trc.getId());
                }
                if (null != ic) {
                    ic.setItemStatus(itemStatus);
                    sqlSession.update("com.itrus.portal.db.IdentityCardMapper.updateByPrimaryKeySelective", ic);
                    ent.setHasIdCard(ic.getId());
                }
                if (null != at) {
                    at.setItemStatus(itemStatus);
                    sqlSession.update("com.itrus.portal.db.AgentMapper.updateByPrimaryKeySelective", at);
                    ent.setHasAgent(at.getId());
                }
                // 更新企业
                sqlSession.update("com.itrus.portal.db.EnterpriseMapper.updateByPrimaryKeyWithBLOBs", ent);
                p = proxyService.getProxyByBillId(bill.getId());
                if (p != null) {
                    p.setItemStatus(2);
                    sqlSession.update("com.itrus.portal.db.ProxyMapper.updateByPrimaryKeySelective", p);
                }
                sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKeySelective", bill);
                reviewLogService.saveReviewLog(1, null, status == 1 ? 1 : 2, reason, ent.getId(), bill.getId(), bill.getUniqueId(), bl == null ? null : bl.getId(), oc == null ? null : oc.getId(), trc == null ? null : trc.getId(), ic == null ? null : ic.getId(), at == null ? null : at.getId(), p == null ? null : p.getId());
            // transactionManager.commit(s);
            }
            LogUtil.syslog(sqlSession, "批量查询送审结果", "产品名称:" + product.getName() + ",订单" + billList.size() + "条,审核通过" + count + "条,审核拒绝" + reject + "条");
        }
        log.debug("查询送审结果结束");
    } catch (Exception e) {
        log.error("ERRORLOG查询送审 {}", e.getMessage());
        e.printStackTrace();
        return;
    }
// finally{
// if (s != null && !s.isCompleted()) {
// transactionManager.rollback(s);
// }
// }
}
Also used : Agent(com.itrus.portal.db.Agent) AuditSystemConfig(com.itrus.portal.db.AuditSystemConfig) AuditSystemConfigExample(com.itrus.portal.db.AuditSystemConfigExample) Product(com.itrus.portal.db.Product) JsonNode(org.codehaus.jackson.JsonNode) Date(java.util.Date) UnknownHostException(java.net.UnknownHostException) OrgCode(com.itrus.portal.db.OrgCode) DigitalCert(com.itrus.portal.db.DigitalCert) BusinessLicense(com.itrus.portal.db.BusinessLicense) Proxy(com.itrus.portal.db.Proxy) JSONObject(com.alibaba.fastjson.JSONObject) Enterprise(com.itrus.portal.db.Enterprise) Bill(com.itrus.portal.db.Bill) List(java.util.List) TaxRegisterCert(com.itrus.portal.db.TaxRegisterCert) IdentityCard(com.itrus.portal.db.IdentityCard)

Example 72 with Bill

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

the class SubmitReviewTask method audit.

/**
 * 送审
 */
public synchronized void audit() {
    // start------------处理双机互斥----------
    // 系统是否配置同步任务的主机名
    SysConfig sysConfigHost = sqlSession.selectOne("com.itrus.portal.db.SysConfigMapper.selectByType", "raInfoHost");
    if (null == sysConfigHost) {
        // 没有配置,直接返回
        return;
    }
    String host = sysConfigHost.getConfig();
    host = host.replaceAll(" ", "");
    String[] hosts = host.split(",");
    // 获取本机主机名称
    InetAddress ia = null;
    try {
        ia = ia.getLocalHost();
    } catch (UnknownHostException e1) {
        e1.printStackTrace();
        return;
    }
    String hostName = ia.getHostName();
    boolean flag = false;
    for (String str : hosts) {
        if (hostName.equals(str.replaceAll(" ", ""))) {
            flag = true;
        }
    }
    // 判断本地主机名称是否与系统配置的同步主机名称一致,不一致则返回
    if (!flag) {
        // LogUtil.syslog(sqlSession, type, info);
        return;
    }
    // end------------处理双机互斥----------
    // 获取第三方鉴证配置信息
    AuditSystemConfig auditSystemConfig = auditSystemConfigService.getAuditSystemConfig(new AuditSystemConfigExample());
    // 未配置第三方鉴证信息、未开启送审、未配置送审时间间隔,直接返回
    if (null == auditSystemConfig || !auditSystemConfig.getIsAudit() || null == auditSystemConfig.getAuditInterval()) {
        log.debug("未配置第三方鉴证信息、未开启送审、未配置送审时间间隔--返回");
        return;
    }
    // 上次送审时间为空,或者上次送审时间大于当前时间,则重新设置上次送审时间为当前时间的毫秒数
    if (null == auditSystemConfig.getAudiStartTime() || auditSystemConfig.getAudiStartTime() > System.currentTimeMillis()) {
        auditSystemConfig.setAudiStartTime(System.currentTimeMillis());
        auditSystemConfigService.updateAuditSystemConfig(auditSystemConfig);
    }
    // 判断是否在送审的时间间隔内(当前时间小于 上次送审时间加上送审时间间隔)
    if (System.currentTimeMillis() < auditSystemConfig.getAudiStartTime() + (auditSystemConfig.getAuditInterval() * 1000)) {
        log.debug("不在送审时间内");
        return;
    }
    log.debug("送审任务开始--");
    // 设置本次送审时间
    auditSystemConfig.setAudiStartTime(System.currentTimeMillis());
    auditSystemConfigService.updateAuditSystemConfig(auditSystemConfig);
    try {
        // 获取需要送审的订单
        Map<Long, List<Bill>> billListMap = submitReviewService.getAuditBill(submitReviewService.getAuditProduct());
        if (billListMap.isEmpty() || billListMap.size() == 0) {
            // 没有需要送审的订单
            return;
        }
        // 根据产品来批量提交企业的认证信息
        for (Long productId : billListMap.keySet()) {
            // 发送给送审系统的json数据
            List<Bill> billList = billListMap.get(productId);
            String jsonString = submitReviewService.getAuditJsonParams(billList);
            String appsecret = submitReviewService.getProductAppsecret(productId);
            String result = RequestUtils.post(auditSystemConfig.getAuditSystemUrl() + auditUrl, jsonString, appsecret);
            // 将返回信息同步至订单状态
            JsonNode respNode = jsonTool.readTree(result);
            for (int i = 0; i < respNode.size(); i++) {
                if (200 == respNode.get(i).get("status").asInt()) {
                    String dataId = respNode.get(i).get("result").get("dataid").toString();
                    if (dataId.indexOf("\"") == 0)
                        // 去掉第一个
                        dataId = dataId.substring(1, dataId.length());
                    if (dataId.lastIndexOf("\"") == (dataId.length() - 1))
                        // 去掉最后一个
                        dataId = dataId.substring(0, dataId.length() - 1);
                    // 提交成功
                    Bill bill = billList.get(i);
                    // 设置为送审中的状态
                    bill.setBillStatus(ComNames.BILL_STATUS_10);
                    // 设置送审系统中返回的企业的唯一标识
                    bill.setDataId(dataId);
                    sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKey", bill);
                }
            }
            Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", productId);
            LogUtil.syslog(sqlSession, "批量送审", "产品名称" + product.getName() + ",订单" + billList.size() + "条");
            log.debug("送审结束");
        }
    } catch (Exception e) {
        log.error("ERRORLOG送审 {}", e.getMessage());
        e.printStackTrace();
        return;
    }
}
Also used : SysConfig(com.itrus.portal.db.SysConfig) UnknownHostException(java.net.UnknownHostException) AuditSystemConfig(com.itrus.portal.db.AuditSystemConfig) AuditSystemConfigExample(com.itrus.portal.db.AuditSystemConfigExample) Product(com.itrus.portal.db.Product) JsonNode(org.codehaus.jackson.JsonNode) UnknownHostException(java.net.UnknownHostException) Bill(com.itrus.portal.db.Bill) List(java.util.List) InetAddress(java.net.InetAddress)

Example 73 with Bill

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

the class UserBillServiceTask method run.

/**
 * 用户信息推送
 */
@Override
public void run() {
    /*if(!isRun()) {
			return;
		}*/
    List<Map> makecertexall = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectAutoMakeCert");
    SignatureConfig sc = null;
    JSONObject data = null;
    JSONObject result = null;
    Bill bill = null;
    Map param;
    Map map;
    try {
        // for (Map<String,String> dataMap:makecertexall) {
        if (makecertexall.isEmpty()) {
            return;
        }
        int index = (int) (Math.random() * makecertexall.size());
        Map dataMap = makecertexall.get(index);
        param = new HashMap();
        param.put("id", dataMap.get("id"));
        map = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByAllMakeCert", param);
        // sc = scs.get(map.get("signature"));
        if (sc == null) {
            sc = sqlSession.selectOne("com.itrus.portal.db.SignatureConfigMapper.selectByPrimaryKey", map.get("signature"));
        }
        if (null == sc || sc.getPush() != 1 || null == sc.getSntTime()) {
            // 未配置信息、未开启、未配置时间间隔
            log.debug("未配置信息、未开启、未配置时间间隔");
            return;
        }
        // 上次时间为空,或者上次时间大于当前时间,则重新设置上次时间为当前时间的毫秒数
        if (null == sc.getCreateTime() || sc.getCreateTime().getTime() > System.currentTimeMillis()) {
            sc.setCreateTime(new Date());
            sqlSession.update("com.itrus.portal.db.SignatureConfigMapper.updateByPrimaryKeySelective", sc);
        }
        // 判断是否在时间间隔内(当前时间小于 上次时间加上时间间隔)
        if (System.currentTimeMillis() < sc.getCreateTime().getTime() + (Integer.parseInt(sc.getSntTime()) * 1000)) {
            log.debug("不在时间内");
            sc = null;
            return;
        }
        log.debug("任务开始");
        // BusinessLicense bl = businessService.getBusinessByBillId(Long.parseLong(String.valueOf(map.get("id"))), null);
        UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", map.get("unique_id"));
        Agent agent = agentService.getAgentByBillId(Long.parseLong(String.valueOf(map.get("id"))), null);
        Map<String, Object> treeMap = Maps.newTreeMap();
        /*if(data == null) {
					data = new JSONObject();
				}*/
        treeMap.put("app_id", sc.getAppId());
        treeMap.put("order_number", map.get("bill_id"));
        treeMap.put("user_name", map.get("enterprise_name"));
        treeMap.put("user_email", userInfo.getEmail());
        treeMap.put("user_phone", userInfo.getmPhone());
        treeMap.put("user_type", "organization");
        String cardType = null;
        String sn = null;
        BusinessLicense businessLicense = businessService.getBusinessByBillId(Long.parseLong(String.valueOf(map.get("id"))), null);
        if (businessLicense != null && businessLicense.getBusinessType() == 1) {
            sn = businessLicense.getLicenseNo();
            cardType = "UniformSocialCreditCode";
        }
        if (businessLicense == null || businessLicense.getBusinessType() != 1) {
            // 不是五证合一
            OrgCode oc = orgCodeService.getOrgCodeByBillId(Long.parseLong(String.valueOf(map.get("id"))), null);
            if (oc != null) {
                sn = oc.getOrgCode();
                cardType = "OrganizationCode";
            }
        }
        /*if(businessLicense == null || businessLicense.getBusinessType()!=1) {//不是五证合一
					TaxRegisterCert tc = taxCertService.getTaxRegisterCertByBillId(Long.parseLong(String.valueOf(map.get("id"))), null);
					if(tc != null){
						sn = tc.getCertNo();
						
					}
				}*/
        /*if(agent.getCardType()==1){
					cardType = "IdentityCard";
				}else if(agent.getCardType()==2){
					cardType = "NationalPassport";
				}else{
					cardType = "Other";
				}*/
        treeMap.put("identity_type", cardType);
        // agent.getIdCode()
        treeMap.put("identification_number", sn);
        String jsondata = JSONObject.toJSONString(treeMap);
        String data1 = mapToQueryString(treeMap);
        // String content = "{\"autoCert\":true,\"timestamp\":1472105170418,\"apiId\":\"test\",\"autoSeal\":true,\"user\":{\"transactorIdCardNum\":\"120102198904025625\",\"transactorMobile\":\"15822452770\",\"orgCode\":\"120116328553325\",\"papersType\":\"营销执照\",\"businessNum\":\"022-88956296\",\"realInfoUid\":\"151\",\"fullName\":\"天津瑞普生物技术股份有限公司空港经济区分公司\",\"legalPersonName\":\"刘建\",\"transactorName\":\"李洋\",\"realInfoOrder\":\"TWCX20160824170928580820\",\"userType\":1}}";
        bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", map.get("id"));
        if (bill.getBillStatus() >= 8) {
            return;
        }
        if (bill.getMcstatus() != null && bill.getMcstatus() == 1) {
            return;
        }
        result = JSONObject.parseObject(RequestUtils.post1(sc.getAddress(), jsondata.toString(), data1, sc.getAddressKey(), "HMAC-SHA256"));
        log.error("SignServiceTask_user_result :" + result);
        /*if(result.getBoolean("isOK") && result.getIntValue("code") == 101) {//用户已存在 改成已撤销
					bill.setMcstatus(1);
					bill.setBillStatus(9);
					sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKey", bill);
					return;
				}*/
        if (result.getString("code") != null && "SUCCESS".equals(result.getString("code").toString())) {
            // temp.put(String.valueOf(dataMap.get("id")), "");
            LogUtil.syslog(sqlSession, "推送华侨城", Thread.currentThread().getName() + bill.getBillId() + "企业名称:" + map.get("enterprise_name"));
            bill.setMcstatus(1);
            bill.setBillStatus(8);
            sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKey", bill);
            sqlSession.flushStatements();
            return;
        }
        LogUtil.syslog(sqlSession, "推送华侨城", bill.getBillId() + "企业名称:" + map.get("enterprise_name") + "错误:" + result.getString("message"));
        // }
        if (null != sc) {
            // 设置本次时间
            sc.setCreateTime(new Date());
            sqlSession.update("com.itrus.portal.db.SignatureConfigMapper.updateByPrimaryKeySelective", sc);
        }
        log.debug("任务结束");
    } catch (Exception e) {
        // log.error("ERRORLOG用户推送 {}", e.getMessage());
        StackTraceElement stackTraceElement = e.getStackTrace()[e.getStackTrace().length - 1];
        LogUtil.syslog(sqlSession, "推送华侨城", "错误:" + stackTraceElement.getLineNumber() + e.getMessage());
    }
}
Also used : Agent(com.itrus.portal.db.Agent) HashMap(java.util.HashMap) SignatureConfig(com.itrus.portal.db.SignatureConfig) UserInfo(com.itrus.portal.db.UserInfo) Date(java.util.Date) UnknownHostException(java.net.UnknownHostException) OrgCode(com.itrus.portal.db.OrgCode) BusinessLicense(com.itrus.portal.db.BusinessLicense) JSONObject(com.alibaba.fastjson.JSONObject) Bill(com.itrus.portal.db.Bill) JSONObject(com.alibaba.fastjson.JSONObject) HashMap(java.util.HashMap) Map(java.util.Map)

Example 74 with Bill

use of com.itrus.portal.db.Bill 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)

Aggregations

Bill (com.itrus.portal.db.Bill)74 HashMap (java.util.HashMap)45 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)42 Product (com.itrus.portal.db.Product)39 UserInfo (com.itrus.portal.db.UserInfo)32 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)27 Enterprise (com.itrus.portal.db.Enterprise)26 UserCert (com.itrus.portal.db.UserCert)22 JSONObject (com.alibaba.fastjson.JSONObject)21 Date (java.util.Date)20 ArrayList (java.util.ArrayList)19 BillExample (com.itrus.portal.db.BillExample)18 IOException (java.io.IOException)18 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)16 DigitalCert (com.itrus.portal.db.DigitalCert)15 Map (java.util.Map)12 TransactionStatus (org.springframework.transaction.TransactionStatus)10 DefaultTransactionDefinition (org.springframework.transaction.support.DefaultTransactionDefinition)10 OnPayInfo (com.itrus.portal.db.OnPayInfo)9 Proxy (com.itrus.portal.db.Proxy)9