Search in sources :

Example 16 with DigitalCert

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

the class ReviewServiceImpl method queryAudit.

/**
 * 查询送审结果
 *
 * @param appsecret
 * @param appId
 * @param dataid
 * @return
 */
public boolean queryAudit(String appsecret, Long appId, String dataid, Bill bill) throws Exception {
    AuditSystemConfig auditSystemConfig = auditSystemConfigService.getAuditSystemConfig(new AuditSystemConfigExample());
    if (null == auditSystemConfig) {
        // 未配置第三方鉴证信息
        return false;
    }
    Map<String, Object> jsonMap = new HashMap<String, Object>();
    jsonMap.put("appId", appId);
    jsonMap.put("appsecret", appsecret);
    // 待查询的记录id
    jsonMap.put("dataid", dataid);
    String jsonString = jsonTool.writeValueAsString(jsonMap);
    String result = RequestUtils.post(auditSystemConfig.getAuditSystemUrl() + ComNames.QUERYAPIS, jsonString, appsecret);
    JsonNode respNode = jsonTool.readTree(result);
    if (200 == respNode.get("status").asInt()) {
        // 查询成功
        JsonNode statusNode = respNode.get("result");
        // 0是未通过,1是通过,2是审核中
        int auditstatus = statusNode.get("auditstatus").asInt();
        BusinessLicense bl = businessService.getBusinessByBillId(bill.getId(), null);
        OrgCode oc = orgCodeService.getOrgCodeByBillId(bill.getId(), null);
        TaxRegisterCert trc = taxCertService.getTaxRegisterCertByBillId(bill.getId(), null);
        IdentityCard ic = identityCardService.getIdentityCardByBillId(bill.getId(), null);
        Agent at = agentService.getAgentByBillId(bill.getId(), null);
        Proxy p = proxyService.getProxyByBillId(bill.getId());
        // 默认未审核
        Integer itemStatus = 1;
        String reason = null;
        Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bill.getEnterprise());
        if (0 == auditstatus) {
            // 未通过(审核拒绝)
            // 记录未通过原因
            reason = statusNode.get("auditresult").getTextValue();
            // 更新订单状态
            bill.setBillStatus(ComNames.BILL_STATUS_4);
            bill.setCancelReason(reason);
            bill.setCheckTime(new Date(statusNode.get("auditdate").asLong()));
            // 发送短信
            if (sendSmsBySHJJ(bill.getId())) {
                bill.setIsSms(true);
                bill.setSendTime(new Date());
            }
            // 更新认证项状态
            itemStatus = 3;
            // 添加系统日志
            LogUtil.syslog(sqlSession, "单条查询送审", "产品ID" + bill.getProduct() + "企业ID:" + bill.getEnterprise() + ",审核结果:审核拒绝");
        } else if (1 == auditstatus) {
            // 通过
            Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.getProduct());
            Product product1 = null;
            Product product2 = null;
            Product product3 = null;
            DigitalCert cert1 = null;
            DigitalCert cert2 = null;
            DigitalCert cert3 = null;
            if (null != bill.getProduct1()) {
                product1 = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.getProduct1());
                if (null != product1.getCert()) {
                    cert1 = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", product1.getCert());
                }
            }
            if (null != bill.getProduct2()) {
                product2 = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.getProduct2());
                if (null != product2.getCert()) {
                    cert2 = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", product2.getCert());
                }
            }
            if (null != bill.getProduct3()) {
                product3 = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.getProduct3());
                if (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());
            // 更新企业
            if (respNode.get("source") != null) {
                enterprise.setInfo(respNode.get("source").getTextValue().getBytes());
            }
            enterprise.setReviewTime(new Date());
            enterprise.setAuthenticationLevel(product.getAuthentication());
            // 更新订单状态
            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;
                }
            }
            bill.setCheckTime(new Date(statusNode.get("auditdate").asLong()));
            // 更新认证项状态
            itemStatus = 2;
            // 添加系统日志
            LogUtil.syslog(sqlSession, "单条查询送审", "产品ID" + bill.getProduct() + "企业ID:" + bill.getEnterprise() + ",审核结果:审核通过");
        } else if (2 == auditstatus) {
            // 审核中
            throw new UserInfoServiceException(statusNode.get("auditmessage").getTextValue());
        }
        if (null != bl) {
            bl.setItemStatus(itemStatus);
            saveBl(bl, respNode.get("source"));
            enterprise.setHasBl(bl.getId());
        }
        if (null != oc) {
            oc.setItemStatus(itemStatus);
            sqlSession.update("com.itrus.portal.db.OrgCodeMapper.updateByPrimaryKeySelective", oc);
            enterprise.setHasOrgCode(oc.getId());
        }
        if (null != trc) {
            trc.setItemStatus(itemStatus);
            sqlSession.update("com.itrus.portal.db.TaxRegisterCertMapper.updateByPrimaryKeySelective", trc);
            enterprise.setHasTaxCert(trc.getId());
        }
        if (null != ic) {
            ic.setItemStatus(itemStatus);
            sqlSession.update("com.itrus.portal.db.IdentityCardMapper.updateByPrimaryKeySelective", ic);
            enterprise.setHasIdCard(ic.getId());
        }
        if (null != at) {
            at.setItemStatus(itemStatus);
            sqlSession.update("com.itrus.portal.db.AgentMapper.updateByPrimaryKeySelective", at);
            enterprise.setHasAgent(at.getId());
        }
        if (null != p) {
            p.setItemStatus(itemStatus);
        }
        // 更新企业
        sqlSession.update("com.itrus.portal.db.EnterpriseMapper.updateByPrimaryKeyWithBLOBs", enterprise);
        // 更新订单
        sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKey", bill);
        // 生成鉴证记录
        reviewLogService.saveReviewLog(1, null, auditstatus == 1 ? 1 : 2, reason, bill.getEnterprise(), 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());
        return true;
    } else if (201 == respNode.get("status").asInt()) {
        // 查询失败
        String message = respNode.get("message").getTextValue();
        throw new UserInfoServiceException(message);
    }
    return false;
}
Also used : Agent(com.itrus.portal.db.Agent) HashMap(java.util.HashMap) 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) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) OrgCode(com.itrus.portal.db.OrgCode) DigitalCert(com.itrus.portal.db.DigitalCert) BusinessLicense(com.itrus.portal.db.BusinessLicense) Proxy(com.itrus.portal.db.Proxy) Enterprise(com.itrus.portal.db.Enterprise) JSONObject(com.alibaba.fastjson.JSONObject) TaxRegisterCert(com.itrus.portal.db.TaxRegisterCert) IdentityCard(com.itrus.portal.db.IdentityCard)

Example 17 with DigitalCert

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

the class BillWebServiceImpl method getPfxCertBufByBills.

/**
 * 根据订单.判断订单是否该显示下载证书的按钮
 * @param bills
 * @return Map<Long, Long>,键为bill.id,值为certBuf.id;
 */
public Map<Long, Long> getPfxCertBufByBills(List<Bill> bills) {
    Map<Long, Long> map = new HashMap<Long, Long>();
    if (null == bills || bills.isEmpty()) {
        return map;
    }
    Date date = new Date();
    for (Bill bill : bills) {
        Product product = productService.getProduct(bill.getProduct());
        if (null == product.getCert()) {
            continue;
        }
        DigitalCert digitalCert = digitalCertService.getDigitalCert(product.getCert());
        Integer billStatus = bill.getBillStatus();
        // 判断订单是pfx类型的用户下载证书,且订单状态是678.
        boolean pfx_download = null != digitalCert && null != digitalCert.getCertType() && null != digitalCert.getInitBuy() && digitalCert.getCertType().equals(ComNames.DIGITALCERT_CERTTYPE_PFX) && digitalCert.getInitBuy().equals(ComNames.DIGITALCERT_INITBUYS_2) && (billStatus == ComNames.BILL_STATUS_6 || billStatus == ComNames.BILL_STATUS_7 || billStatus == ComNames.BILL_STATUS_8);
        if (pfx_download) {
            // 根据订单号,找到订单对应的证书信息
            CertBuf certBuf = sqlSession.selectOne("com.itrus.portal.db.CertBufMapper.selectPfxCertByBillId", bill.getId());
            // 获取证书第一次下载时间和当前时间比较,如果超过了十五天,则不允许下载
            int day = DateUtils.daysOfTwo(date, certBuf.getCreateTime());
            if (day < 16) {
                map.put(bill.getId(), certBuf.getId());
            }
        }
    }
    return map;
}
Also used : DigitalCert(com.itrus.portal.db.DigitalCert) HashMap(java.util.HashMap) Bill(com.itrus.portal.db.Bill) CertBuf(com.itrus.portal.db.CertBuf) Product(com.itrus.portal.db.Product) Date(java.util.Date)

Example 18 with DigitalCert

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

the class BillWebController method reNewCertConfirm.

// 订单详情,待更新确认
@RequestMapping(value = "/reNewCertConfirm/{id}", produces = "text/html")
public String reNewCertConfirm(@PathVariable("id") Long id, HttpServletRequest request, Model uiModel) {
    HttpSession session = request.getSession();
    UserInfo userInfo = (UserInfo) session.getAttribute("webuserInfo");
    Enterprise enterprise = (Enterprise) session.getAttribute("webenterprise");
    if (null == userInfo || null == enterprise) {
        return "redirect:/userInfoWeb/denglu.html";
    }
    // 审核记录
    ReviewLog reviewLog = reviewLogService.getReviewLog(id);
    if (reviewLog != null) {
        uiModel.addAttribute("reviewLog", reviewLog);
    }
    Map param = new HashMap();
    // 设置查询条件,选择属于当前用户,当前企业的订单
    param.put("id", id);
    // param.put("userinfoid", userInfo.getId());
    // param.put("enterpriseid", enterprise.getId());
    List<Map> billAll = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectProductBillCertById", param);
    log.error("--------获取订单数量-------" + billAll.size() + "*****获取订单信息***" + billAll);
    log.error("------获取订单id--------" + billAll.get(0).get("id"));
    log.error("========获取订单编号=========" + billAll.get(0).get("bill_id"));
    if (0 == billAll.size()) {
        return "redirect:/userInfoWeb/denglu.html";
    }
    uiModel.addAttribute("bills", billAll.get(0));
    // 获取数字证书
    Product product = productService.getProduct((Long) billAll.get(0).get("product"));
    log.error("****获取产品id*****" + product.getId());
    DigitalCert digitalCert = digitalCertService.getDigitalCert(product.getCert());
    // 获取订单在线支付方式
    if (billAll.get(0).get("on_pay_info") != null) {
        Map<Long, OnPayInfo> opiMap = sqlSession.selectMap("com.itrus.portal.db.OnPayInfoMapper.selectByExample", "id");
        uiModel.addAttribute("opiMap", opiMap);
        Map<Long, OnlinePay> opMap = sqlSession.selectMap("com.itrus.portal.db.OnlinePayMapper.selectByExample", "id");
        uiModel.addAttribute("opMap", opMap);
    }
    PayInfoExample payInfoex = new PayInfoExample();
    Map<Long, PayInfo> payinfoMap = sqlSession.selectMap("com.itrus.portal.db.PayInfoMapper.selectByExample", payInfoex, "id");
    uiModel.addAttribute("payinfomap", payinfoMap);
    // 获取产品规格
    ProductSpec productSpec = null;
    if (null != billAll.get(0).get("product_spec") && !"0".equals(billAll.get(0).get("product_spec"))) {
        productSpec = productSpecService.getProductSpec((Long) billAll.get(0).get("product_spec"));
    }
    uiModel.addAttribute("productSpec", productSpec);
    uiModel.addAttribute("digitalCert", digitalCert);
    // 返回订单对应的老证书的base64
    CertBuf certBuf = sqlSession.selectOne("com.itrus.portal.db.CertBufMapper.selectCertBufByBillId", id);
    if (null != certBuf) {
        uiModel.addAttribute("oldCertB64", certBuf.getCertBuf().replaceAll("\n", ""));
    }
    log.error("*********签章服务******" + product.getMakeSealServer());
    // 判断是否有签章服务,有则显示授权
    if (null != product.getMakeSealServer()) {
        uiModel.addAttribute("makesealserver", product.getMakeSealServer());
        uiModel.addAttribute("billId", billAll.get(0).get("id"));
        // 签章服务配置
        List<MakeSealConfig> makeSealConfigs = sqlSession.selectList("com.itrus.portal.db.MakeSealConfigMapper.selectByExample");
        if (!makeSealConfigs.isEmpty()) {
            MakeSealConfig makeSealConfig = makeSealConfigs.get(0);
            try {
                makeSealConfig.setAddressKey(AESencrp.decrypt(makeSealConfig.getAddressKey(), dbEncKey));
            } catch (EncDecException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            uiModel.addAttribute("makeSealConfig", makeSealConfig);
        }
    }
    return "ixinweb/dingdanxiangqing_gengxinqueren";
}
Also used : PayInfoExample(com.itrus.portal.db.PayInfoExample) HashMap(java.util.HashMap) HttpSession(javax.servlet.http.HttpSession) Product(com.itrus.portal.db.Product) EncDecException(com.itrus.portal.exception.EncDecException) UserInfo(com.itrus.portal.db.UserInfo) ProductSpec(com.itrus.portal.db.ProductSpec) IOException(java.io.IOException) JsonGenerationException(org.codehaus.jackson.JsonGenerationException) EncDecException(com.itrus.portal.exception.EncDecException) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) DigitalCert(com.itrus.portal.db.DigitalCert) MakeSealConfig(com.itrus.portal.db.MakeSealConfig) PayInfo(com.itrus.portal.db.PayInfo) OnPayInfo(com.itrus.portal.db.OnPayInfo) OnPayInfo(com.itrus.portal.db.OnPayInfo) Enterprise(com.itrus.portal.db.Enterprise) ReviewLog(com.itrus.portal.db.ReviewLog) CertBuf(com.itrus.portal.db.CertBuf) Map(java.util.Map) HashMap(java.util.HashMap) OnlinePay(com.itrus.portal.db.OnlinePay) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 19 with DigitalCert

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

the class BillWebController method billList.

/**
 * 订单列表
 *
 * @param billStatus
 *            0未完成订单,1已完成订单
 * @param request
 * @param uiModel
 * @return
 */
@RequestMapping(produces = "text/html")
public String billList(@RequestParam(value = "billStatus", required = false) Integer billStatus, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, @RequestParam(value = "page2", required = false) Integer page2, @RequestParam(value = "size2", required = false) Integer size2, HttpServletRequest request, Model uiModel) {
    HttpSession session = request.getSession();
    Boolean verifyCodeStatus = (Boolean) session.getAttribute("webverifyCodeStatus");
    Enterprise enterprise = (Enterprise) session.getAttribute("webenterprise");
    UserInfo userInfo = (UserInfo) session.getAttribute("webuserInfo");
    if (null == verifyCodeStatus || !verifyCodeStatus || null == userInfo) {
        // 登录状态失效,跳转到登录页面
        return "redirect:/userInfoWeb/denglu.html";
    }
    if (userInfo != null && enterprise == null) {
        // 登录未获取到企业信息,跳转到选择企业页面
        return "redirect:/userInfoWeb/choiceEnterprise";
    }
    uiModel.addAttribute("billStatus", billStatus);
    if (page == null || page < 1) {
        page = 1;
    }
    if (size == null || size < 1) {
        size = 5;
    }
    BillExample billExampl = new BillExample();
    BillExample.Criteria criteria = billExampl.or();
    // web页面不显示解锁的订单产品
    List<Long> keyUnlockProductIds = productService.getKeyUnlockProductIds();
    if (null != keyUnlockProductIds && !keyUnlockProductIds.isEmpty()) {
        criteria.andProductNotIn(keyUnlockProductIds);
    }
    // 查询当前用户当前企业的订单
    // 当前用户
    criteria.andUniqueIdEqualTo(userInfo.getId());
    // 当前企业 v 76
    criteria.andEnterpriseEqualTo(enterprise.getId());
    if (null == billStatus || 0 == billStatus) {
        // 未完成订单:订单状态不为8
        criteria.andBillStatusNotEqualTo(ComNames.BILL_STATUS_8);
        criteria.andIsDeleteEqualTo(false);
    } else if (1 == billStatus) {
        // 订单状态为已完成
        criteria.andBillStatusEqualTo(ComNames.BILL_STATUS_8);
    }
    Integer count = sqlSession.selectOne("com.itrus.portal.db.BillMapper.countByExample", billExampl);
    if (page > 1 && size * (page - 1) >= count) {
        page = (count + size - 1) / size;
    }
    uiModel.addAttribute("count", count);
    uiModel.addAttribute("pages", (count + size - 1) / size);
    uiModel.addAttribute("page", page);
    uiModel.addAttribute("size", size);
    Integer offset = size * (page - 1);
    billExampl.setOffset(offset);
    billExampl.setLimit(size);
    billExampl.setOrderByClause("create_time desc");
    List<Bill> billList = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectByExample", billExampl);
    uiModel.addAttribute("billList", billList);
    uiModel.addAttribute("itemcount", billList.size());
    Map<Long, Delivery> deliveryMap = sqlSession.selectMap("com.itrus.portal.db.DeliveryMapper.selectByExample", null, "id");
    uiModel.addAttribute("deliveryMap", deliveryMap);
    // 填写中订单
    if (page2 == null || page2 < 1) {
        page2 = 1;
    }
    if (size2 == null || size2 < 1) {
        size2 = 5;
    }
    EditBillExample ebEx = new EditBillExample();
    EditBillExample.Criteria criteria2 = ebEx.or();
    // 查询当前用户当前企业的订单
    // 当前用户
    criteria2.andUserInfoIdEqualTo(userInfo.getId());
    // 
    criteria2.andEnterpriseIdEqualTo(enterprise.getId());
    Integer count2 = sqlSession.selectOne("com.itrus.portal.db.EditBillMapper.countByExample", ebEx);
    if (page2 > 1 && size2 * (page2 - 1) >= count2) {
        page2 = (count2 + size2 - 1) / size2;
    }
    uiModel.addAttribute("count2", count2);
    uiModel.addAttribute("pages2", (count2 + size2 - 1) / size2);
    uiModel.addAttribute("page2", page2);
    uiModel.addAttribute("size2", size2);
    Integer offset2 = size2 * (page2 - 1);
    // 产品信息:
    /*Map<Long, Product> productMap = billService
				.getProductMapByUserInfoId(userInfo.getId());*/
    // if ((null == billStatus || billStatus.equals(2)) && count2 != 0) {
    Map<Long, Product> productMap = sqlSession.selectMap("com.itrus.portal.db.ProductMapper.selectByExample", "id");
    // }
    uiModel.addAttribute("productMap", productMap);
    // 获取产品关联的数字证书id
    Set<Long> certIds = productService.getDigitalCertIds(productMap);
    // 产品关联的数字证书:
    Map<Long, DigitalCert> digitalCertMap = digitalCertService.getDigitalCertByProductMap(certIds);
    uiModel.addAttribute("digitalCertMap", digitalCertMap);
    // 获取订单对应的产品规格
    Map<Long, ProductSpec> productSpecMap = productSpecService.getProductSpec(billList);
    uiModel.addAttribute("productSpecMap", productSpecMap);
    ebEx.setOffset(offset2);
    ebEx.setLimit(size2);
    ebEx.setOrderByClause("create_time desc");
    List<EditBill> editBillList = sqlSession.selectList("com.itrus.portal.db.EditBillMapper.selectByExample", ebEx);
    // 获取填写中订单对应的产品规格
    Map<Long, ProductSpec> editBill_productSpecMap = productSpecService.getEditBillProductSpec(editBillList);
    uiModel.addAttribute("editBill_productSpecMap", editBill_productSpecMap);
    uiModel.addAttribute("editBillList", editBillList);
    uiModel.addAttribute("itemcount2", editBillList.size());
    // 订单是否对应的pfx的用户下载证书.
    Map<Long, Long> pfxMap = billWebService.getPfxCertBufByBills(billList);
    uiModel.addAttribute("pfxmap", pfxMap);
    session.removeAttribute("sessionPlist");
    session.removeAttribute("enterpriseqqE");
    System.out.println(enterprise.getId());
    Map param = new HashMap();
    param.put("id", enterprise.getId());
    if (userInfo.getmPhone() != null) {
        param.put("phone", userInfo.getmPhone());
    }
    List<Map<String, Object>> plist = sqlSession.selectList("com.itrus.portal.db.ProjectMapper.selectProjectId", param);
    Map<Long, EnterpriseQq> qqMap = new HashMap<Long, EnterpriseQq>();
    for (int i = 0; i < plist.size(); i++) {
        EnterpriseQqExample enterpriseQ = new EnterpriseQqExample();
        EnterpriseQqExample.Criteria qqEx = enterpriseQ.createCriteria();
        // System.out.println(plist.get(i));
        Long pid = Long.parseLong(plist.get(i).get("id").toString());
        // System.out.println(pid);
        qqEx.andProjectIdEqualTo(pid);
        EnterpriseQq enterpriseqq = sqlSession.selectOne("com.itrus.portal.db.EnterpriseQqMapper.selectByExample", enterpriseQ);
        if (enterpriseqq != null) {
            // uiModel.addAttribute("eid", enterpriseqq.getId());
            qqMap.put(pid, enterpriseqq);
        // session.setAttribute("enterpriseqqE", enterpriseqq.getEnterpriseQqLinks());
        }
    }
    session.setAttribute("sessionqqMap", qqMap);
    session.setAttribute("sessionPlist", plist);
    return "ixinweb/zhanghuguanli_dingdanxinxi";
}
Also used : HashMap(java.util.HashMap) Product(com.itrus.portal.db.Product) UserInfo(com.itrus.portal.db.UserInfo) EditBillExample(com.itrus.portal.db.EditBillExample) DigitalCert(com.itrus.portal.db.DigitalCert) EditBillExample(com.itrus.portal.db.EditBillExample) BillExample(com.itrus.portal.db.BillExample) EnterpriseQqExample(com.itrus.portal.db.EnterpriseQqExample) EditBill(com.itrus.portal.db.EditBill) HttpSession(javax.servlet.http.HttpSession) ProductSpec(com.itrus.portal.db.ProductSpec) EnterpriseQq(com.itrus.portal.db.EnterpriseQq) Enterprise(com.itrus.portal.db.Enterprise) EditBill(com.itrus.portal.db.EditBill) Bill(com.itrus.portal.db.Bill) Delivery(com.itrus.portal.db.Delivery) Map(java.util.Map) HashMap(java.util.HashMap) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 20 with DigitalCert

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

the class ClientPayWebController method updatePayInfo.

private void updatePayInfo(String billId, Long payConfigId, String transactionId, String payType, String payTime) throws Exception {
    DefaultTransactionDefinition def = new DefaultTransactionDefinition();
    def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    TransactionStatus s = null;
    try {
        s = transactionManager.getTransaction(def);
        BillExample be = new BillExample();
        BillExample.Criteria bc = be.createCriteria();
        bc.andBillIdEqualTo(billId);
        bc.andBillStatusIn(Arrays.asList(new Integer[] { 1, 11 }));
        Bill bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByExample", be);
        if (null == bill) {
            return;
        }
        bill.setBillStatus(3);
        bill.setPayTime(new Date(Long.parseLong(payTime)));
        // 产品
        Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.getProduct());
        // pfx流程判断begin
        DigitalCert digitalCert = null;
        if (null != product.getCert()) {
            digitalCert = digitalCertService.getDigitalCert(product.getCert());
            if (null != digitalCert && null != digitalCert.getCertType() && digitalCert.getCertType().equals(ComNames.DIGITALCERT_CERTTYPE_PFX)) {
                // 这个用户,这个企业,这个项目,有通过了实名认证的订单,则直接进入待下载,
                List<Bill> bills = billService.hasAuthticationLevel(bill.getUniqueId(), bill.getEnterprise(), product.getProject());
                if (null != bills && bills.size() > 0 && digitalCert.getInitBuy().equals(ComNames.DIGITALCERT_INITBUYS_2)) {
                    bill.setBillStatus(ComNames.BILL_STATUS_13);
                    // 新增审核通过的记录
                    reviewService.agreeBillReview(bill);
                }
            }
        }
        // 解锁产品流程判断gegin
        if (null != product.getKeyUnlockType()) {
            bill = unLockKeyBillService.updateBillStatusWhileHasPay(bill, product);
        }
        // 解锁产品流程判断end
        sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKeySelective", bill);
        OnPayInfo payInfo = sqlSession.selectOne("com.itrus.portal.db.OnPayInfoMapper.selectByPrimaryKey", bill.getOnPayInfo());
        payInfo.setPayStatus(1);
        payInfo.setWcTime(bill.getPayTime());
        payInfo.setPayNo(transactionId);
        OnlinePayExample ope = new OnlinePayExample();
        OnlinePayExample.Criteria opc = ope.createCriteria();
        opc.andPayConfigEqualTo(payConfigId);
        // 1支付宝 2微信
        opc.andWayEqualTo((Integer.parseInt(payType) == 0 ? 1 : 2));
        OnlinePay onlinePay = sqlSession.selectOne("com.itrus.portal.db.OnlinePayMapper.selectByExample", ope);
        payInfo.setOnlinePay(onlinePay.getId());
        // payInfo.setComment(m.get("return_msg"));
        sqlSession.update("com.itrus.portal.db.OnPayInfoMapper.updateByPrimaryKeySelective", payInfo);
        transactionManager.commit(s);
    } catch (Exception e) {
        LogUtil.syslog(sqlSession, "在线支付", billId + "回调更新数据库错误:" + e.toString());
        throw new Exception(billId + "回调更新数据库错误:" + e.toString());
    } finally {
        if (null != s && !s.isCompleted()) {
            transactionManager.rollback(s);
        }
    }
}
Also used : DefaultTransactionDefinition(org.springframework.transaction.support.DefaultTransactionDefinition) OnlinePayExample(com.itrus.portal.db.OnlinePayExample) TransactionStatus(org.springframework.transaction.TransactionStatus) Product(com.itrus.portal.db.Product) Date(java.util.Date) DigitalCert(com.itrus.portal.db.DigitalCert) BillExample(com.itrus.portal.db.BillExample) OnPayInfo(com.itrus.portal.db.OnPayInfo) Bill(com.itrus.portal.db.Bill) OnlinePay(com.itrus.portal.db.OnlinePay)

Aggregations

DigitalCert (com.itrus.portal.db.DigitalCert)31 Product (com.itrus.portal.db.Product)24 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)22 HashMap (java.util.HashMap)20 Bill (com.itrus.portal.db.Bill)15 Enterprise (com.itrus.portal.db.Enterprise)14 JSONObject (com.alibaba.fastjson.JSONObject)11 ProductSpec (com.itrus.portal.db.ProductSpec)11 UserInfo (com.itrus.portal.db.UserInfo)10 Date (java.util.Date)10 IOException (java.io.IOException)9 OnPayInfo (com.itrus.portal.db.OnPayInfo)8 Map (java.util.Map)8 CertBuf (com.itrus.portal.db.CertBuf)7 ArrayList (java.util.ArrayList)7 CertInfo (cn.topca.tca.ra.service.CertInfo)6 OnlinePay (com.itrus.portal.db.OnlinePay)6 PayInfo (com.itrus.portal.db.PayInfo)6 RaAccount (com.itrus.portal.db.RaAccount)6 UserCert (com.itrus.portal.db.UserCert)6