Search in sources :

Example 6 with PayInfo

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

the class PayController method update.

// 修改处理
@RequestMapping(value = "/update/{billid}/{id}", produces = "text/html")
public String update(@PathVariable("billid") Long billid, @PathVariable("id") Long id, @RequestParam(value = "status", required = false) Integer status, @Valid PayInfo payInfo, BindingResult bindingResult, Model uiModel) throws UnsupportedEncodingException {
    // DefaultTransactionDefinition def = new
    // DefaultTransactionDefinition();
    // def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    // TransactionStatus s = transactionManager.getTransaction(def);
    Bill bill = null;
    try {
        bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", billid);
        bill.setBillStatus(status);
        bill.setBillSum(payInfo.getPay());
        sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKeySelective", bill);
        PayInfo p = sqlSession.selectOne("com.itrus.portal.db.PayInfoMapper.selectByPrimaryKey", id);
        if (p != null) {
            p.setPay(payInfo.getPay());
            p.setName(payInfo.getName());
            p.setPayTime(payInfo.getPayTime());
            p.setComment(payInfo.getComment());
            if (status == 3) {
                p.setPayConfirmTime(new Date());
            }
            sqlSession.update("com.itrus.portal.db.PayInfoMapper.updateByPrimaryKeySelective", p);
        }
        if (status == 3) {
            LogUtil.adminlog(sqlSession, "订单确认到款", "订单号" + bill.getBillId());
        } else {
            sendsms(billid, null, "ZFYC");
            LogUtil.adminlog(sqlSession, "订单支付异常", "订单号" + bill.getBillId());
        }
        // transactionManager.commit(s);
        // 产品
        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);
                    sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKeySelective", bill);
                }
            }
        }
        // 解锁订单流程判断begin
        if (null != product.getKeyUnlockType()) {
            if (null != status && status.equals(ComNames.BILL_STATUS_3)) {
                bill = unLockKeyBillService.updateBillStatusWhileHasPay(bill, product);
            }
        }
    // 解锁订单流程判断end
    } catch (Exception e) {
        if (status == 3) {
            LogUtil.adminlog(sqlSession, "订单确认到款-异常", e.toString() + ",订单号" + bill.getBillId());
        } else {
            LogUtil.adminlog(sqlSession, "订单支付异常-异常", e.toString() + ",订单号" + bill.getBillId());
        }
    }
    // }
    return "redirect:/pay";
}
Also used : DigitalCert(com.itrus.portal.db.DigitalCert) OnPayInfo(com.itrus.portal.db.OnPayInfo) PayInfo(com.itrus.portal.db.PayInfo) Bill(com.itrus.portal.db.Bill) Product(com.itrus.portal.db.Product) Date(java.util.Date) UnsupportedEncodingException(java.io.UnsupportedEncodingException) IOException(java.io.IOException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 7 with PayInfo

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

the class PayController method show.

// 显示详情
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) {
    Map param = new HashMap();
    param.put("id", id);
    // 管理员项目权限
    Long[] projectsOfAdmin = getProjectLongIdsOfAdmin();
    param.put("hasProjects", Arrays.asList(projectsOfAdmin));
    Map bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByCondition", param);
    if (null == bill || bill.isEmpty()) {
        uiModel.addAttribute("errorMsg", "未找到该订单");
        return "status403";
    }
    uiModel.addAttribute("bill", bill);
    Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.get("product"));
    DigitalCert cert = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", product.getCert());
    uiModel.addAttribute("cert", cert);
    ProductSpec productSpec = null;
    // 判断是否属于组合产品
    if (product.getIsCombined() != null && product.getIsCombined().equals(1)) {
        Product productSub = null;
        // 得到三条组合产品的产品信息
        for (int i = 1; i < 4; i++) {
            if (bill.get("product" + i) == null) {
                continue;
            }
            productSub = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.get("product" + i));
            uiModel.addAttribute("product" + i, productSub);
            cert = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", productSub.getCert());
            uiModel.addAttribute("cert" + i, cert);
            // 获取产品规格
            if (bill.containsKey("product_spec" + i) && !"0".equals(bill.get("product_spec" + i))) {
                productSpec = productSpecService.getProductSpec((Long) bill.get("product_spec" + i));
            }
            uiModel.addAttribute("productSpec" + i, productSpec);
        }
        if (bill.get("bill_status").toString().equals("11")) {
            PayInfo pi = sqlSession.selectOne("com.itrus.portal.db.PayInfoMapper.selectByPrimaryKey", bill.get("pay_info"));
            uiModel.addAttribute("pi", pi);
        }
        return "pay/show";
    }
    // 获取产品规格
    if (bill.containsKey("product_spec") && !"0".equals(bill.get("product_spec"))) {
        productSpec = productSpecService.getProductSpec((Long) bill.get("product_spec"));
    }
    uiModel.addAttribute("productSpec", productSpec);
    if (bill.get("bill_status").toString().equals("11")) {
        PayInfo pi = sqlSession.selectOne("com.itrus.portal.db.PayInfoMapper.selectByPrimaryKey", bill.get("pay_info"));
        uiModel.addAttribute("pi", pi);
    }
    return "pay/show";
}
Also used : DigitalCert(com.itrus.portal.db.DigitalCert) OnPayInfo(com.itrus.portal.db.OnPayInfo) PayInfo(com.itrus.portal.db.PayInfo) HashMap(java.util.HashMap) Product(com.itrus.portal.db.Product) ProductSpec(com.itrus.portal.db.ProductSpec) Map(java.util.Map) HashMap(java.util.HashMap) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 8 with PayInfo

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

the class PayController method confirm.

// 显示详情
@RequestMapping(value = "/confirm/{id}", produces = "text/html")
public String confirm(@PathVariable("id") Long id, Model uiModel) {
    Map param = new HashMap();
    param.put("id", id);
    // 管理员项目权限
    Long[] projectsOfAdmin = getProjectLongIdsOfAdmin();
    param.put("hasProjects", Arrays.asList(projectsOfAdmin));
    Map bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByCondition", param);
    if (null == bill || bill.isEmpty()) {
        uiModel.addAttribute("errorMsg", "未找到该订单");
        return "status403";
    }
    uiModel.addAttribute("bill", bill);
    // 得到纳税人识别号
    if (bill.get("id") != null) {
        String taxesCode = getTaxesCode(Long.valueOf(bill.get("id").toString()));
        uiModel.addAttribute("taxesCode", taxesCode);
    }
    if (bill.get("on_pay_info") != null) {
        OnPayInfo onpayinfo = sqlSession.selectOne("com.itrus.portal.db.OnPayInfoMapper.selectByPrimaryKey", bill.get("on_pay_info"));
        uiModel.addAttribute("onpayinfo", onpayinfo);
        OnlinePay onlinepay = sqlSession.selectOne("com.itrus.portal.db.OnlinePayMapper.selectByPrimaryKey", bill.get("online_pay"));
        uiModel.addAttribute("onlinepay", onlinepay);
    }
    if (bill.get("price") != null && bill.get("product_num") != null) {
        uiModel.addAttribute("sum", Double.parseDouble(bill.get("price").toString()) * Integer.parseInt(bill.get("product_num").toString()));
    } else {
        uiModel.addAttribute("sum", 0);
    }
    ProductSpec productSpec = null;
    Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.get("product"));
    DigitalCert cert = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", product.getCert());
    uiModel.addAttribute("cert", cert);
    // 判断是否属于组合产品
    if (product.getIsCombined() != null && product.getIsCombined().equals(1)) {
        Product productSub = null;
        PreferentialRecord pr = null;
        // 得到三条组合产品的产品信息
        for (int i = 1; i < 4; i++) {
            if (bill.get("product" + i) == null) {
                continue;
            }
            productSub = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.get("product" + i));
            uiModel.addAttribute("product" + i, productSub);
            cert = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", productSub.getCert());
            uiModel.addAttribute("cert" + i, cert);
            // 获取产品规格
            if (bill.containsKey("product_spec" + i) && !"0".equals(bill.get("product_spec" + i))) {
                productSpec = productSpecService.getProductSpec((Long) bill.get("product_spec" + i));
            }
            uiModel.addAttribute("productSpec" + i, productSpec);
            // 该订单是否有价格优惠记录
            pr = preferentialRecordService.selectPreferentialRecordSByBillIdAndProductId(id, (Long) (bill.get("product" + i)));
            if (null != pr) {
                uiModel.addAttribute("preferentialrecord" + i, pr);
            }
        }
        PayInfo pi = sqlSession.selectOne("com.itrus.portal.db.PayInfoMapper.selectByPrimaryKey", bill.get("pay_info"));
        uiModel.addAttribute("pi", pi);
        return "pay/update";
    }
    // 获取产品规格
    if (bill.containsKey("product_spec") && !"0".equals(bill.get("product_spec"))) {
        productSpec = productSpecService.getProductSpec((Long) bill.get("product_spec"));
    }
    uiModel.addAttribute("productSpec", productSpec);
    PayInfo pi = sqlSession.selectOne("com.itrus.portal.db.PayInfoMapper.selectByPrimaryKey", bill.get("pay_info"));
    uiModel.addAttribute("pi", pi);
    // 该订单是否有价格优惠记录
    PreferentialRecord pr = preferentialRecordService.selectPreferentialRecordSByBillId(id);
    if (null != pr) {
        uiModel.addAttribute("preferentialrecord", pr);
    }
    return "pay/update";
}
Also used : HashMap(java.util.HashMap) Product(com.itrus.portal.db.Product) ProductSpec(com.itrus.portal.db.ProductSpec) PreferentialRecord(com.itrus.portal.db.PreferentialRecord) DigitalCert(com.itrus.portal.db.DigitalCert) OnPayInfo(com.itrus.portal.db.OnPayInfo) PayInfo(com.itrus.portal.db.PayInfo) OnPayInfo(com.itrus.portal.db.OnPayInfo) Map(java.util.Map) HashMap(java.util.HashMap) OnlinePay(com.itrus.portal.db.OnlinePay) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 9 with PayInfo

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

the class PayController method loadImg.

@RequestMapping(value = "/img/{bid}/{id}")
public String loadImg(@PathVariable("bid") String bid, @PathVariable("id") Long id, HttpServletResponse response) {
    String img = null;
    OutputStream os = null;
    FileInputStream fis = null;
    try {
        response.setHeader("Pragma", "no-cache");
        response.setHeader("Cache-Control", "no-cache");
        response.setDateHeader("Expires", 0);
        PayInfo pi = sqlSession.selectOne("com.itrus.portal.db.PayInfoMapper.selectByPrimaryKey", id);
        if (pi == null) {
            return "status403";
        }
        img = pi.getImgFile();
        if (img == null) {
            return "status403";
        }
        File file = filePathUtils.getBillFile(bid);
        if (!file.exists()) {
            file.mkdir();
        }
        File imgFile = new File(file, img);
        fis = new FileInputStream(imgFile);
        byte[] bb = IOUtils.toByteArray(fis);
        os = response.getOutputStream();
        os.write(bb);
        os.flush();
    } catch (IOException e) {
        // 未找到
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        // 关闭流!
        try {
            if (null != fis) {
                fis.close();
            }
            if (null != os) {
                os.close();
            }
        } catch (IOException e) {
        }
    }
    return null;
}
Also used : OnPayInfo(com.itrus.portal.db.OnPayInfo) PayInfo(com.itrus.portal.db.PayInfo) OutputStream(java.io.OutputStream) IOException(java.io.IOException) File(java.io.File) FileInputStream(java.io.FileInputStream) UnsupportedEncodingException(java.io.UnsupportedEncodingException) IOException(java.io.IOException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 10 with PayInfo

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

Aggregations

OnPayInfo (com.itrus.portal.db.OnPayInfo)12 PayInfo (com.itrus.portal.db.PayInfo)12 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)12 Enterprise (com.itrus.portal.db.Enterprise)8 UserInfo (com.itrus.portal.db.UserInfo)8 HashMap (java.util.HashMap)8 Map (java.util.Map)8 DigitalCert (com.itrus.portal.db.DigitalCert)7 Product (com.itrus.portal.db.Product)7 HttpSession (javax.servlet.http.HttpSession)7 OnlinePay (com.itrus.portal.db.OnlinePay)6 PayInfoExample (com.itrus.portal.db.PayInfoExample)6 ProductSpec (com.itrus.portal.db.ProductSpec)6 ReviewLog (com.itrus.portal.db.ReviewLog)6 IOException (java.io.IOException)5 EncDecException (com.itrus.portal.exception.EncDecException)4 Bill (com.itrus.portal.db.Bill)3 Ereceipt (com.itrus.portal.db.Ereceipt)3 Receipt (com.itrus.portal.db.Receipt)3 UserCert (com.itrus.portal.db.UserCert)3