Search in sources :

Example 11 with OnlinePay

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

the class ExtraBillPayController method show.

// 显示详情
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel, @RequestParam(value = "payStatus", required = false) Integer payStatus) {
    uiModel.addAttribute("payStatus", payStatus);
    // 管理员项目权限
    Long[] projectsOfAdmin = getProjectLongIdsOfAdmin();
    List<Long> projectsOfAdminList = Arrays.asList(projectsOfAdmin);
    ExtraBillExample billExample = new ExtraBillExample();
    ExtraBillExample.Criteria criteria = billExample.or();
    criteria.andIdEqualTo(id);
    criteria.andProjectIn(projectsOfAdminList);
    ExtraBill bill = sqlSession.selectOne("com.itrus.portal.db.ExtraBillMapper.selectByExample", billExample);
    if (null == bill) {
        uiModel.addAttribute("errorMsg", "未找到该订单");
        return "status403";
    }
    uiModel.addAttribute("bill", bill);
    // 项目
    Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", bill.getProject());
    uiModel.addAttribute("project", project);
    // 企业
    Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bill.getEnterprise());
    uiModel.addAttribute("enterprise", enterprise);
    // 产品
    ExtraProduct product = sqlSession.selectOne("com.itrus.portal.db.ExtraProductMapper.selectByPrimaryKey", bill.getExtraProduct());
    uiModel.addAttribute("product", product);
    // 规格
    ExtraProductSpec productSpec = sqlSession.selectOne("com.itrus.portal.db.ExtraProductSpecMapper.selectByPrimaryKey", bill.getExtraProductSpec());
    uiModel.addAttribute("productSpec", productSpec);
    // 服务商
    ServiceProvider serviceProvider = serviceProviderService.selectByPrimaryKey(product.getServiceProvider());
    uiModel.addAttribute("serviceProvider", serviceProvider);
    // 用户
    UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bill.getUniqueId());
    uiModel.addAttribute("userInfo", userInfo);
    // 第三方支付信息
    OnPayInfo onPayInfo = sqlSession.selectOne("com.itrus.portal.db.OnPayInfoMapper.selectByPrimaryKey", bill.getOnPayInfo());
    uiModel.addAttribute("onPayInfo", onPayInfo);
    if (onPayInfo != null && onPayInfo.getOnlinePay() != null) {
        // 在线支付
        OnlinePay onlinePay = sqlSession.selectOne("com.itrus.portal.db.OnlinePayMapper.selectByPrimaryKey", onPayInfo.getOnlinePay());
        uiModel.addAttribute("onlinePay", onlinePay);
    }
    // 电子发票
    Einvoice einvoice = sqlSession.selectOne("com.itrus.portal.db.EinvoiceMapper.selectByPrimaryKey", bill.geteInvoice());
    uiModel.addAttribute("einvoice", einvoice);
    // 其他附加信息
    // 营业执照
    BusinessLicense businessLicense = businessService.getBusinessByExtraBillId(id, null);
    uiModel.addAttribute("businessLicense", businessLicense);
    // 税务登记
    TaxRegisterCert taxRegisterCert = taxCertService.getTaxRegisterCertByExtraBillId(id, null);
    uiModel.addAttribute("taxRegisterCert", taxRegisterCert);
    // 组织机构代码
    OrgCode orgCode = orgCodeService.getOrgCodeByExtraBillId(id, null);
    uiModel.addAttribute("orgCode", orgCode);
    // 代理人
    Agent agent = agentService.getAgentByExtraBillId(id, null);
    uiModel.addAttribute("agent", agent);
    // 开户行信息
    OpenBankInfo openBankInfo = openBankInfoService.getOpenBankInfoByExtraBillId(id, null);
    uiModel.addAttribute("openBankInfo", openBankInfo);
    // 法人信息
    IdentityCard identityCard = identityCardService.getIdentityCardByExtraBillId(id, null);
    uiModel.addAttribute("identityCard", identityCard);
    // TODO 还需要补充订单对应的附加信息和第三方回调信息
    return "extrabillpay/show";
}
Also used : Agent(com.itrus.portal.db.Agent) ExtraBill(com.itrus.portal.db.ExtraBill) ExtraProductSpec(com.itrus.portal.db.ExtraProductSpec) UserInfo(com.itrus.portal.db.UserInfo) Einvoice(com.itrus.portal.db.Einvoice) ExtraBillExample(com.itrus.portal.db.ExtraBillExample) Project(com.itrus.portal.db.Project) ExtraProduct(com.itrus.portal.db.ExtraProduct) OrgCode(com.itrus.portal.db.OrgCode) BusinessLicense(com.itrus.portal.db.BusinessLicense) OnPayInfo(com.itrus.portal.db.OnPayInfo) OpenBankInfo(com.itrus.portal.db.OpenBankInfo) ServiceProvider(com.itrus.portal.db.ServiceProvider) Enterprise(com.itrus.portal.db.Enterprise) TaxRegisterCert(com.itrus.portal.db.TaxRegisterCert) OnlinePay(com.itrus.portal.db.OnlinePay) IdentityCard(com.itrus.portal.db.IdentityCard) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 12 with OnlinePay

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

the class OnlinePayServiceImpl method removeOnlinePayWithOutClientFw.

/**
 * 移除不属于服务型客户的在线支付,只返回服务型客户的在线支付
 * @return
 */
public String[] removeOnlinePayWithOutClientFw(String[] onpay) {
    String ClientFwPayConfigId = systemConfigService.getClientfwPayConfigIds();
    if (StringUtils.isNotBlank(ClientFwPayConfigId)) {
        String[] ClientFwPayConfigIds = ClientFwPayConfigId.split(",");
        List<Long> payConfigIds = new ArrayList<>();
        for (String string : ClientFwPayConfigIds) {
            payConfigIds.add(Long.valueOf(string));
        }
        OnlinePayExample example = new OnlinePayExample();
        OnlinePayExample.Criteria criteria = example.or();
        criteria.andPayConfigIn(payConfigIds);
        List<OnlinePay> onlinePayList = selectByExample(example);
        if (null == onlinePayList || onlinePayList.isEmpty()) {
            return onpay;
        }
        List<Long> onlinePayIds = new ArrayList<>();
        for (OnlinePay onlinePay : onlinePayList) {
            onlinePayIds.add(onlinePay.getId());
        }
        // 将要匹配的服务型客户端的支付加入数组中,然后返回
        List<String> newOnpayList = new ArrayList<>();
        for (String string : onpay) {
            if (onlinePayIds.contains(Long.valueOf(string))) {
                newOnpayList.add(string);
            }
        }
        String[] strings = new String[newOnpayList.size()];
        return newOnpayList.toArray(strings);
    } else {
        return onpay;
    }
}
Also used : OnlinePayExample(com.itrus.portal.db.OnlinePayExample) ArrayList(java.util.ArrayList) OnlinePay(com.itrus.portal.db.OnlinePay)

Example 13 with OnlinePay

use of com.itrus.portal.db.OnlinePay 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 14 with OnlinePay

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

Example 15 with OnlinePay

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

the class ClientWebController method zhifuPage.

/**
 * 进入增值订单支付页面,若未配置支付且订单价格为0,则不需要支付
 *
 * @param billId
 *            ,增值订单id
 * @param request
 * @param uiModel
 * @return
 */
@RequestMapping("/zhifu/{billId}")
public String zhifuPage(@PathVariable("billId") Long billId, HttpServletRequest request, Model uiModel) {
    HttpSession session = request.getSession();
    String ip = request.getRemoteAddr();
    UserInfo currentUserInfo = (UserInfo) session.getAttribute("webuserInfo");
    uiModel.addAttribute("ip", ip);
    // 增值订单
    ExtraBill bill = extraBillService.selectByPrimaryKey(billId);
    if (null == bill || !currentUserInfo.getId().equals(bill.getUniqueId())) {
        return "resourceNotFound";
    }
    // 增值产品
    ExtraProduct product = extraProductService.selectByPrimaryKey(bill.getExtraProduct());
    if (null == product) {
        // 产品不存在
        uiModel.addAttribute("errorMsg", "您购买的产品不存在");
        return "client/errorpage";
    }
    // 未配置支付方式,或者订单价格为0,则不用支付
    if (StringUtils.isBlank(product.getBankPay()) && StringUtils.isBlank(product.getOnlinePay()) && (null == bill.getBillSum() || bill.getBillSum().equals(0))) {
        // 跳转到订单支付成功页面,并将订单状态设置为3已支付 待审核
        bill.setBillStatus(ComNames.EXTRA_BILL_STATUS_3);
        // TODO 跳转到支付成功或者订单列表页面
        return "client/zhifuchenggong";
    }
    // 获取产品对应的线上支付服务
    if (product.getOnlinePay() != null && product.getOnlinePay() != "") {
        List<Long> onlinepays = new ArrayList<Long>();
        String[] onpay = (product.getOnlinePay()).split(",");
        Map<Integer, String> map = new HashMap<Integer, String>();
        for (int i = 0; i < onpay.length; i++) {
            OnlinePay op = sqlSession.selectOne("com.itrus.portal.db.OnlinePayMapper.selectByPrimaryKey", onpay[i]);
            map.put(op.getSort(), onpay[i]);
        }
        Set<Integer> set = map.keySet();
        Object[] obj = set.toArray();
        Arrays.sort(obj);
        for (int i = (onpay.length - 1); i >= 0; i--) {
            String a = map.get(obj[i]);
            onlinepays.add(Long.parseLong(a));
        }
        Map<Long, OnlinePay> opMap = sqlSession.selectMap("com.itrus.portal.db.OnlinePayMapper.selectByExample", "id");
        uiModel.addAttribute("opMap", opMap);
        uiModel.addAttribute("onlinepays", onlinepays);
        Map<Long, PayConfig> pcMap = sqlSession.selectMap("com.itrus.portal.db.PayConfigMapper.selectByExample", "id");
        uiModel.addAttribute("pcMap", pcMap);
    }
    // 获取产品对应的银行汇款服务
    if (!StringUtils.isBlank(product.getBankPay())) {
        Transfer transfer = sqlSession.selectOne("com.itrus.portal.db.TransferMapper.selectByPrimaryKey", Long.parseLong(product.getBankPay()));
        uiModel.addAttribute("transfer", transfer);
    }
    if (null != product.getBankRemarks()) {
        product.setBankRemarks(product.getBankRemarks().replace("\r\n", "<br/><span ></span>"));
    }
    uiModel.addAttribute("product", product);
    session.setAttribute("webbill", bill);
    if (null != bill.getExtraProductSpec()) {
        uiModel.addAttribute("productSpec", extraProductSpecService.selectByPrimaryKey(bill.getExtraProductSpec()));
    }
    if (currentUserInfo != null) {
        currentUserInfo = userInfoService.getUserInfoById(currentUserInfo.getId());
        EnterpriseQqExample enterpriseE = new EnterpriseQqExample();
        EnterpriseQqExample.Criteria qqEx = enterpriseE.createCriteria();
        qqEx.andProjectIdEqualTo(currentUserInfo.getProject());
        EnterpriseQq enterpriseqq = sqlSession.selectOne("com.itrus.portal.db.EnterpriseQqMapper.selectByExample", enterpriseE);
        if (enterpriseqq != null && enterpriseqq.getEnterpriseQqLinks() != null) {
            uiModel.addAttribute("enterpriseqq", enterpriseqq.getEnterpriseQqLinks());
            session.setAttribute("enterpriseqqE", enterpriseqq.getEnterpriseQqLinks());
        }
    }
    // TODO 跳转到支付页面
    return "client/zhifu";
}
Also used : PayConfig(com.itrus.portal.db.PayConfig) HashMap(java.util.HashMap) HttpSession(javax.servlet.http.HttpSession) ExtraBill(com.itrus.portal.db.ExtraBill) ArrayList(java.util.ArrayList) UserInfo(com.itrus.portal.db.UserInfo) ExtraProduct(com.itrus.portal.db.ExtraProduct) EnterpriseQq(com.itrus.portal.db.EnterpriseQq) Transfer(com.itrus.portal.db.Transfer) EnterpriseQqExample(com.itrus.portal.db.EnterpriseQqExample) OnlinePay(com.itrus.portal.db.OnlinePay) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

OnlinePay (com.itrus.portal.db.OnlinePay)25 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)20 OnPayInfo (com.itrus.portal.db.OnPayInfo)12 Enterprise (com.itrus.portal.db.Enterprise)9 ExtraProduct (com.itrus.portal.db.ExtraProduct)9 UserInfo (com.itrus.portal.db.UserInfo)9 HttpSession (javax.servlet.http.HttpSession)8 Ereceipt (com.itrus.portal.db.Ereceipt)7 ExtraBill (com.itrus.portal.db.ExtraBill)7 ExtraProductSpec (com.itrus.portal.db.ExtraProductSpec)7 ArrayList (java.util.ArrayList)7 HashMap (java.util.HashMap)7 DigitalCert (com.itrus.portal.db.DigitalCert)6 PayInfo (com.itrus.portal.db.PayInfo)6 Product (com.itrus.portal.db.Product)6 PayConfig (com.itrus.portal.db.PayConfig)5 PayInfoExample (com.itrus.portal.db.PayInfoExample)5 ServiceProvider (com.itrus.portal.db.ServiceProvider)5 Transfer (com.itrus.portal.db.Transfer)5 Bill (com.itrus.portal.db.Bill)4