Search in sources :

Example 21 with ExtraBill

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

the class ExtraBillWebController method sendEmailToUserByExtraBillId.

@RequestMapping("/sendemailbw")
@ResponseBody
public Map<String, Object> sendEmailToUserByExtraBillId(@RequestParam(value = "billId", required = true) Long BillId, HttpServletRequest request) {
    Map<String, Object> retMap = new HashMap<>();
    retMap.put("retCode", 0);
    HttpSession session = request.getSession();
    Enterprise webenterprise = (Enterprise) session.getAttribute("webenterprise");
    UserInfo webuserInfo = (UserInfo) session.getAttribute("webuserInfo");
    if (null == webenterprise || null == webuserInfo) {
        retMap.put("retMsg", "登录失效");
        return retMap;
    }
    ExtraBill bill = extraBillService.selectByPrimaryKey(BillId);
    if (null == bill) {
        retMap.put("errorMsg", "未找到该订单");
        return retMap;
    }
    if (!bill.getUniqueId().equals(webuserInfo.getId())) {
        retMap.put("errorMsg", "您无权操作该订单");
        return retMap;
    }
    try {
        retMap = baiWangEmailService.sendEmailToUser(bill);
        retMap.put("email", webuserInfo.getEmail());
        UserLog userlog = new UserLog();
        userlog.setCreateTime(new Date());
        userlog.setHostId("未知");
        userlog.setInfo("订单号:" + bill.getBillId() + ",用户手机号:" + webuserInfo.getmPhone());
        userlog.setProject(bill.getProject());
        userlog.setType("发送邮件_百旺单机");
        userlog.setSn(null == webuserInfo.getUniqueId() ? null : webuserInfo.getUniqueId());
        LogUtil.userlog(sqlSession, userlog);
    } catch (Exception e) {
        UserLog userlog = new UserLog();
        userlog.setCreateTime(new Date());
        userlog.setHostId("未知");
        userlog.setInfo("出现异常,订单号:" + bill.getBillId() + "异常信息:" + e.getMessage());
        userlog.setProject(bill.getProject());
        userlog.setType("发送邮件_百旺单机");
        userlog.setSn(null == webuserInfo.getUniqueId() ? null : webuserInfo.getUniqueId());
        LogUtil.userlog(sqlSession, userlog);
        log.error(e.getMessage());
        retMap.put("retMsg", "服务端出现异常,请联系系统管理员,异常信息:" + e.getMessage());
        retMap.put("retCode", 0);
        return retMap;
    }
    return retMap;
}
Also used : HashMap(java.util.HashMap) HttpSession(javax.servlet.http.HttpSession) ExtraBill(com.itrus.portal.db.ExtraBill) Enterprise(com.itrus.portal.db.Enterprise) UserInfo(com.itrus.portal.db.UserInfo) UserLog(com.itrus.portal.db.UserLog) Date(java.util.Date) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 22 with ExtraBill

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

the class ExtraBillWebController method refuse.

// 审核拒绝重新提交页面
@RequestMapping(value = "/resubmit/{id}", produces = "text/html")
public String refuse(@PathVariable("id") Long id, Model uiModel, HttpServletRequest request) {
    HttpSession session = request.getSession();
    Enterprise webenterprise = (Enterprise) session.getAttribute("webenterprise");
    UserInfo webuserInfo = (UserInfo) session.getAttribute("webuserInfo");
    if (null == webenterprise || null == webuserInfo) {
        uiModel.addAttribute("errorMsg", "登录失效");
        return "client/errorpage";
    }
    ExtraBill bill = extraBillService.selectByPrimaryKey(id);
    if (null == bill) {
        uiModel.addAttribute("errorMsg", "未找到该订单");
        return "client/errorpage";
    }
    if (!bill.getUniqueId().equals(webuserInfo.getId())) {
        uiModel.addAttribute("errorMsg", "您无权操作该订单");
        return "client/errorpage";
    }
    // 获取订单在线支付方式
    if (null != bill.getOnPayInfo()) {
        // 第三方在线支付记录信息
        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);
    }
    // 订单
    uiModel.addAttribute("bill", bill);
    // 产品
    ExtraProduct product = sqlSession.selectOne("com.itrus.portal.db.ExtraProductMapper.selectByPrimaryKey", bill.getExtraProduct());
    uiModel.addAttribute("product", product);
    // 用户
    UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bill.getUniqueId());
    uiModel.addAttribute("userInfo", userInfo);
    // 企业
    Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bill.getEnterprise());
    uiModel.addAttribute("enterprise", enterprise);
    FileInputStream fis = null;
    try {
        if (null != product.getExtraMessage()) {
            ExtraMessage extraMessage = extraMessageService.selectByPrimaryKey(product.getExtraMessage());
            // 用附加信息项的有无来判断是否需要用户填写附加信息,如果需要,则取附加信息项进行分割处理
            uiModel.addAttribute("extraMessage", extraMessage);
            File file = new File(systemConfigService.getTrustDir().getPath() + File.separator + enterprise.getEnterpriseSn());
            if (!file.exists()) {
                file.mkdir();
            }
            // //企业信息 认证项(1.企业名称,2.统一社会信用代码/营业执照,3.组织机构代码,4.税务登记号)
            if (StringUtils.isNotBlank(extraMessage.getEnterpriseItems())) {
                if (extraMessage.getEnterpriseItems().contains("2")) {
                    // 营业执照
                    BusinessLicense businessLicense = businessService.getBusinessByExtraBillId(id, null);
                    if (null != businessLicense) {
                        File imgFile = new File(file, businessLicense.getImgFile());
                        fis = new FileInputStream(imgFile);
                        businessLicense.setImgFile(ImageToBase64Utils.GetFileBase64(fis));
                        fis.close();
                        uiModel.addAttribute("businessLicense", businessLicense);
                    }
                }
                if (extraMessage.getEnterpriseItems().contains("3")) {
                    // 组织机构代码
                    OrgCode orgCode = orgCodeService.getOrgCodeByExtraBillId(id, null);
                    if (null != orgCode) {
                        File imgFile = new File(file, orgCode.getImgFile());
                        fis = new FileInputStream(imgFile);
                        orgCode.setImgFile(ImageToBase64Utils.GetFileBase64(fis));
                        fis.close();
                        uiModel.addAttribute("orgCode", orgCode);
                    }
                }
                if (extraMessage.getEnterpriseItems().contains("4")) {
                    // 税务登记
                    TaxRegisterCert taxRegisterCert = taxCertService.getTaxRegisterCertByExtraBillId(id, null);
                    if (null != taxRegisterCert) {
                        File imgFile = new File(file, taxRegisterCert.getImgFile());
                        fis = new FileInputStream(imgFile);
                        taxRegisterCert.setImgFile(ImageToBase64Utils.GetFileBase64(fis));
                        fis.close();
                        uiModel.addAttribute("taxRegisterCert", taxRegisterCert);
                    }
                }
            }
            // field string --fieldName agentItems
            if (StringUtils.isNotBlank(extraMessage.getAgentItems())) {
                Agent agent = agentService.getAgentByExtraBillId(id, null);
                if (null != agent) {
                    File imgFile = new File(file, agent.getFrontImg());
                    fis = new FileInputStream(imgFile);
                    agent.setFrontImg(ImageToBase64Utils.GetFileBase64(fis));
                    if (StringUtils.isNotBlank(agent.getBackImg())) {
                        File backImgFile = new File(file, agent.getBackImg());
                        fis = new FileInputStream(backImgFile);
                        agent.setBackImg(ImageToBase64Utils.GetFileBase64(fis));
                        fis.close();
                    }
                    uiModel.addAttribute("agent", agent);
                }
            }
            // field string --fieldName bankItems
            if (StringUtils.isNotBlank(extraMessage.getBankItems())) {
                OpenBankInfo openBankInfo = openBankInfoService.getOpenBankInfoByExtraBillId(id, null);
                if (null != openBankInfo) {
                    uiModel.addAttribute("openBankInfo", openBankInfo);
                }
            }
            // 法人认证项
            if (StringUtils.isNotBlank(extraMessage.getIdentityCardItems())) {
                IdentityCard identityCard = identityCardService.getIdentityCardByExtraBillId(id, null);
                if (null != identityCard) {
                    File imgFile = new File(file, identityCard.getFrontImg());
                    fis = new FileInputStream(imgFile);
                    identityCard.setFrontImg(ImageToBase64Utils.GetFileBase64(fis));
                    if (StringUtils.isNotBlank(identityCard.getBackImg())) {
                        File backImgFile = new File(file, identityCard.getBackImg());
                        fis = new FileInputStream(backImgFile);
                        identityCard.setBackImg(ImageToBase64Utils.GetFileBase64(fis));
                        fis.close();
                    }
                    uiModel.addAttribute("identityCard", identityCard);
                }
            }
        }
    } catch (Exception e) {
        // TODO: handle exception
        UserLog userlog = new UserLog();
        userlog.setProject(bill.getProject());
        userlog.setType("审核拒绝重新提交");
        userlog.setInfo("url:resubmit,详细错误:" + e.getMessage());
        userlog.setHostId("未知");
        userlog.setSn(null == webuserInfo.getUniqueId() ? null : webuserInfo.getUniqueId());
        LogUtil.userlog(sqlSession, userlog);
    } finally {
        if (null != fis) {
            try {
                fis.close();
            } catch (Exception e2) {
            // TODO: handle exception
            }
        }
    }
    return "client/shenhejujue_chongxintijiao";
}
Also used : Agent(com.itrus.portal.db.Agent) HttpSession(javax.servlet.http.HttpSession) ExtraBill(com.itrus.portal.db.ExtraBill) UserInfo(com.itrus.portal.db.UserInfo) UserLog(com.itrus.portal.db.UserLog) FileInputStream(java.io.FileInputStream) 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) Enterprise(com.itrus.portal.db.Enterprise) ExtraMessage(com.itrus.portal.db.ExtraMessage) File(java.io.File) 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 23 with ExtraBill

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

the class ExtraBillWebController method refusePage.

// 审核拒绝页面
@RequestMapping(value = "/refusebill/{id}.html", produces = "text/html")
public String refusePage(@PathVariable("id") Long id, @RequestParam(value = "processProgress", required = false) Long processProgress, Model uiModel, HttpServletRequest request) {
    HttpSession session = request.getSession();
    Enterprise enterprise = (Enterprise) session.getAttribute("webenterprise");
    UserInfo userInfo = (UserInfo) session.getAttribute("webuserInfo");
    if (null == enterprise || null == userInfo) {
        uiModel.addAttribute("errorMsg", "登录失效");
        return "client/errorpage";
    }
    ExtraBill bill = extraBillService.selectByPrimaryKey(id);
    if (null == bill) {
        uiModel.addAttribute("errorMsg", "订单不存在");
        return "client/errorpage";
    }
    uiModel.addAttribute("bill", bill);
    if (!bill.getUniqueId().equals(userInfo.getId())) {
        uiModel.addAttribute("errorMsg", "您无权操作该订单");
        return "client/errorpage";
    }
    // 订单对应的产品信息
    ExtraProduct product = extraProductService.selectByPrimaryKey(bill.getExtraProduct());
    uiModel.addAttribute("product", product);
    // 订单对应的规格信息
    ExtraProductSpec productSpec = extraProductSpecService.selectByPrimaryKey(bill.getExtraProductSpec());
    uiModel.addAttribute("productSpec", productSpec);
    // 银行卡支付记录信息
    PayInfoExample payInfoex = new PayInfoExample();
    Map<Long, PayInfo> payinfoMap = sqlSession.selectMap("com.itrus.portal.db.PayInfoMapper.selectByExample", payInfoex, "id");
    uiModel.addAttribute("payinfomap", payinfoMap);
    // 获取订单在线支付方式
    if (null != bill.getOnPayInfo()) {
        // 第三方在线支付记录信息
        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);
    }
    // 电子发票信息
    if (null != bill.geteInvoice()) {
        Einvoice einvoice = sqlSession.selectOne("com.itrus.portal.db.EinvoiceMapper.selectByPrimaryKey", bill.geteInvoice());
        uiModel.addAttribute("einvoice", einvoice);
    }
    // 纸票模版
    Map<Long, Receipt> receiptmap = sqlSession.selectMap("com.itrus.portal.db.ReceiptMapper.selectByExample", null, "id");
    uiModel.addAttribute("receiptmap", receiptmap);
    // 电票开票模版
    Map<Long, Ereceipt> ereceiptmap = sqlSession.selectMap("com.itrus.portal.db.EreceiptMapper.selectByExample", null, "id");
    uiModel.addAttribute("ereceiptmap", ereceiptmap);
    return "client/shenhejujue";
}
Also used : Ereceipt(com.itrus.portal.db.Ereceipt) PayInfoExample(com.itrus.portal.db.PayInfoExample) Receipt(com.itrus.portal.db.Receipt) HttpSession(javax.servlet.http.HttpSession) ExtraBill(com.itrus.portal.db.ExtraBill) ExtraProductSpec(com.itrus.portal.db.ExtraProductSpec) UserInfo(com.itrus.portal.db.UserInfo) Einvoice(com.itrus.portal.db.Einvoice) ExtraProduct(com.itrus.portal.db.ExtraProduct) OnPayInfo(com.itrus.portal.db.OnPayInfo) PayInfo(com.itrus.portal.db.PayInfo) OnPayInfo(com.itrus.portal.db.OnPayInfo) Enterprise(com.itrus.portal.db.Enterprise) OnlinePay(com.itrus.portal.db.OnlinePay) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 24 with ExtraBill

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

the class PayExtraBillWebController method generatePayInfo.

private void generatePayInfo(Long userId, String orderNo, String payid, String money) throws Exception {
    DefaultTransactionDefinition def = new DefaultTransactionDefinition();
    def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    TransactionStatus s = transactionManager.getTransaction(def);
    try {
        ExtraBill bill = extraBillService.getExtraBillByBillId(orderNo);
        OnPayInfo payInfo;
        if (bill.getOnPayInfo() == null) {
            payInfo = new OnPayInfo();
            payInfo.setOnlinePay(Long.parseLong(payid));
            payInfo.setPaySum(Double.parseDouble(money));
            payInfo.setPayStatus(0);
            payInfo.setDyTime(new Date());
            payInfo.setName(String.valueOf(userId));
            sqlSession.insert("com.itrus.portal.db.OnPayInfoMapper.insert", payInfo);
            sqlSession.flushStatements();
            if (payInfo.getId() == null) {
                throw new Exception(orderNo + "生成支付记录报错。");
            }
            bill.setOnPayInfo(payInfo.getId());
            extraBillService.updateByPrimaryKeySelective(bill);
        } else {
            payInfo = sqlSession.selectOne("com.itrus.portal.db.OnPayInfoMapper.selectByPrimaryKey", bill.getOnPayInfo());
            payInfo.setOnlinePay(Long.parseLong(payid));
            payInfo.setPaySum(Double.parseDouble(money));
            payInfo.setDyTime(new Date());
            payInfo.setName(String.valueOf(userId));
            sqlSession.update("com.itrus.portal.db.OnPayInfoMapper.updateByPrimaryKeySelective", payInfo);
        }
        transactionManager.commit(s);
    } catch (Exception e) {
        LogUtil.syslog(sqlSession, "在线支付_增值订单", orderNo + "在线支付生成支付记录错误:" + e.toString());
        throw new Exception(orderNo + "在线支付_增值订单生成支付记录错误:" + e.toString());
    } finally {
        if (!s.isCompleted()) {
            transactionManager.rollback(s);
        }
    }
}
Also used : DefaultTransactionDefinition(org.springframework.transaction.support.DefaultTransactionDefinition) OnPayInfo(com.itrus.portal.db.OnPayInfo) ExtraBill(com.itrus.portal.db.ExtraBill) TransactionStatus(org.springframework.transaction.TransactionStatus) Date(java.util.Date)

Example 25 with ExtraBill

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

the class PayExtraBillWebController 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);
        ExtraBill bill = extraBillService.getExtraBillByBillId(billId);
        if (null == bill) {
            return;
        }
        bill.setBillStatus(ComNames.EXTRA_BILL_STATUS_3);
        bill.setPayTime(new Date(Long.parseLong(payTime)));
        extraBillService.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支付宝
        opc.andWayEqualTo((Integer.parseInt(payType) == 0 ? 1 : 2));
        // 2微信
        OnlinePay onlinePay = sqlSession.selectOne("com.itrus.portal.db.OnlinePayMapper.selectByExample", ope);
        payInfo.setOnlinePay(onlinePay.getId());
        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) OnPayInfo(com.itrus.portal.db.OnPayInfo) OnlinePayExample(com.itrus.portal.db.OnlinePayExample) ExtraBill(com.itrus.portal.db.ExtraBill) TransactionStatus(org.springframework.transaction.TransactionStatus) Date(java.util.Date) OnlinePay(com.itrus.portal.db.OnlinePay)

Aggregations

ExtraBill (com.itrus.portal.db.ExtraBill)41 ExtraProduct (com.itrus.portal.db.ExtraProduct)25 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)24 HashMap (java.util.HashMap)22 Enterprise (com.itrus.portal.db.Enterprise)21 UserInfo (com.itrus.portal.db.UserInfo)20 HttpSession (javax.servlet.http.HttpSession)12 ExtraProductSpec (com.itrus.portal.db.ExtraProductSpec)11 OpenBankInfo (com.itrus.portal.db.OpenBankInfo)11 Date (java.util.Date)11 Map (java.util.Map)11 TransactionStatus (org.springframework.transaction.TransactionStatus)11 DefaultTransactionDefinition (org.springframework.transaction.support.DefaultTransactionDefinition)11 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)11 BusinessLicense (com.itrus.portal.db.BusinessLicense)10 TaxRegisterCert (com.itrus.portal.db.TaxRegisterCert)10 ExtraBillExample (com.itrus.portal.db.ExtraBillExample)9 IdentityCard (com.itrus.portal.db.IdentityCard)9 OnPayInfo (com.itrus.portal.db.OnPayInfo)9 ArrayList (java.util.ArrayList)9