Search in sources :

Example 61 with Enterprise

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

the class ClientWebController method checkInvoce.

/**
 * retCode:0为失败,1为成功
 * 发票校验接口
 * @param FP_DM:发票代码
 * @param FP_HM:发票号码
 * @param JYM:发票校验码
 */
@RequestMapping("/fpjy")
@ResponseBody
public Map<String, Object> checkInvoce(@RequestParam(value = "FP_DM", required = true) String FP_DM, @RequestParam(value = "FP_HM", required = true) String FP_HM, @RequestParam(value = "JYM", required = true) String JYM, @RequestParam(value = "productId", required = true) Long productId, HttpServletRequest request) {
    HttpSession session = request.getSession();
    Map<String, Object> retMap = new HashMap<>();
    retMap.put("retCode", 0);
    UserInfo webuserInfo = (UserInfo) session.getAttribute("webuserInfo");
    Enterprise webenterprise = (Enterprise) session.getAttribute("webenterprise");
    if (null == webuserInfo || null == webenterprise) {
        retMap.put("retMsg", "用户登录信息已失效,请重新登录");
        return retMap;
    }
    // 
    Project project = (Project) session.getAttribute("webproject");
    if (null == project) {
        retMap.put("retMsg", "项目信息不存在");
        return retMap;
    }
    // 获取发票校验的应用
    ExtraProduct product = extraProductService.selectByPrimaryKey(productId);
    if (null == product) {
        retMap.put("retMsg", "产品信息不存在");
        return retMap;
    }
    if (StringUtils.isBlank(FP_DM) || StringUtils.isBlank(FP_HM) || StringUtils.isBlank(JYM)) {
        retMap.put("retMsg", "发票代码,发票号码,发票校验码三者都不能为空");
        return retMap;
    }
    Map<String, String> invoiceMap = baiWangService.verifyInvoice(FP_DM, FP_HM, JYM);
    retMap.putAll(invoiceMap);
    if (null != retMap.get("REPLYCODE") && retMap.get("REPLYCODE").equals("0000")) {
        retMap.put("retCode", 1);
        String info = invoiceMap.toString().replaceAll(" ", "");
        checkInvoiceLogService.insertCheckInvoiceLog(product.getAppName(), webenterprise.getEnterpriseName(), info, project.getId(), webuserInfo.getRealName());
        return retMap;
    } else {
        String REPLYMSG = (String) retMap.get("REPLYMSG");
        retMap.put("retMsg", REPLYMSG);
        return retMap;
    }
}
Also used : Project(com.itrus.portal.db.Project) ExtraProduct(com.itrus.portal.db.ExtraProduct) HashMap(java.util.HashMap) HttpSession(javax.servlet.http.HttpSession) Enterprise(com.itrus.portal.db.Enterprise) UserinfoEnterprise(com.itrus.portal.db.UserinfoEnterprise) UserInfo(com.itrus.portal.db.UserInfo) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 62 with Enterprise

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

the class DownLoadCertWebController method toPages.

/**
 * 跳转到下载成功或失败页面 2016年11月3日 下午4:52:36
 *
 * @param id
 *            订单id
 * @param ret
 *            参数 1 成功, 0失败
 * @return 逻辑视图
 */
@RequestMapping(value = "/toPages/{id}", produces = "text/html")
public String toPages(@PathVariable("id") Long id, @RequestParam(value = "ret", required = false) int ret, 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";
    }
    Map<String, Object> param = new HashMap<String, Object>();
    // 设置查询条件,选择属于当前用户,当前企业的订单
    param.put("id", id);
    List<Map<String, Object>> billAll = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectProductBillCertById", param);
    if (0 == billAll.size()) {
        return "redirect:/userInfoWeb/denglu.html";
    }
    // 审核记录
    ReviewLog reviewLog = reviewLogService.getReviewLog(id);
    if (reviewLog != null) {
        uiModel.addAttribute("reviewLog", reviewLog);
    }
    uiModel.addAttribute("bills", billAll.get(0));
    // 获取订单在线支付方式
    if (billAll.get(0).get("on_pay_info") != null) {
        OnPayInfo onPayInfo = sqlSession.selectOne("com.itrus.portal.db.OnPayInfoMapper.selectByPrimaryKey", billAll.get(0).get("on_pay_info"));
        uiModel.addAttribute("onPayInfo", onPayInfo);
    } else if (billAll.get(0).get("pay_info") != null) {
        PayInfo payInfo = sqlSession.selectOne("com.itrus.portal.db.PayInfoMapper.selectByPrimaryKey", billAll.get(0).get("pay_info"));
        uiModel.addAttribute("payInfo", payInfo);
    }
    UserCertExample uce = new UserCertExample();
    UserCertExample.Criteria ucec = uce.or();
    ucec.andBillEqualTo(id);
    List<String> certStatus = new ArrayList<String>();
    List<UserCert> certs = userCertService.getUserCertByBill(id, certStatus);
    certStatus.add(ComNames.CERT_STATUS_1);
    certStatus.add(ComNames.CERT_STATUS_2);
    if (ret == 1) {
        // 下载成功页面
        if (certs != null && certs.size() > 0) {
            UserCert userCert = certs.get(0);
            uiModel.addAttribute("doneTime", userCert.getCertStartTime());
        }
        return "ixinweb/dingdanxiangqing_xiazaichenggong";
    } else {
        // 下载失败页面
        return "ixinweb/dingdanxiangqing_xiazaishibai";
    }
}
Also used : HashMap(java.util.HashMap) HttpSession(javax.servlet.http.HttpSession) UserCertExample(com.itrus.portal.db.UserCertExample) ArrayList(java.util.ArrayList) UserInfo(com.itrus.portal.db.UserInfo) OnPayInfo(com.itrus.portal.db.OnPayInfo) PayInfo(com.itrus.portal.db.PayInfo) OnPayInfo(com.itrus.portal.db.OnPayInfo) Enterprise(com.itrus.portal.db.Enterprise) ReviewLog(com.itrus.portal.db.ReviewLog) JSONObject(com.alibaba.fastjson.JSONObject) Map(java.util.Map) HashMap(java.util.HashMap) UserCert(com.itrus.portal.db.UserCert) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 63 with Enterprise

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

the class DownLoadCertWebController method downLoadCert.

@RequestMapping("/{id}")
@ResponseBody
public Map<String, Object> downLoadCert(@PathVariable(value = "id") Long id, @RequestParam(value = "uidIdx", required = true) Integer uidIdx, @RequestParam(value = "csr", required = true) String csr, @RequestParam(value = "keySn", required = false) String keySn, HttpSession session) {
    Map<String, Object> retMap = new HashMap<String, Object>();
    retMap.put("retCode", 0);
    UserInfo webuserInfo = (UserInfo) session.getAttribute("webuserInfo");
    Enterprise webenterprise = (Enterprise) session.getAttribute("webenterprise");
    if (null == webuserInfo || null == webenterprise) {
        // 2标识登录已经失效,需跳转到登录页面
        retMap.put("retCode", 2);
        retMap.put("retMsg", "登录状态失效");
        return retMap;
    }
    Bill bill = billService.getBill(id);
    if (null == bill) {
        retMap.put("retMsg", "该订单不存在");
        return retMap;
    }
    // 订单是否为当前用户当前企业
    if (!webuserInfo.getId().equals(bill.getUniqueId()) || !webenterprise.getId().equals(bill.getEnterprise())) {
        retMap.put("retMsg", "您不能操作该订单");
        return retMap;
    }
    // 判断该订单状态是否为待下载,是否已经关联了证书
    List<String> certStatus = new ArrayList<String>();
    certStatus.add(ComNames.CERT_STATUS_1);
    certStatus.add(ComNames.CERT_STATUS_2);
    List<UserCert> userCerts = userCertService.getUserCertByBill(bill.getId(), certStatus);
    if (!bill.getBillStatus().equals(ComNames.BILL_STATUS_13) || !userCerts.isEmpty()) {
        retMap.put("retMsg", "该证书状态为已下载或订单还未审核");
        return retMap;
    }
    Product product = productService.getProduct(bill.getProduct());
    DigitalCert digitalCert = digitalCertService.getDigitalCert(product.getCert());
    RaAccount ra = raAccountService.getRaAccount(product.getRa());
    // 下载证书
    String autoidType = "";
    Integer autoidValue = 0;
    try {
        // 下载证书
        CertInfo racertinfo = downLoadCertService.downLoadCert(product, ra, bill, digitalCert, uidIdx, csr, autoidType, autoidValue);
        // 保存证书
        downLoadCertService.saveCertInfo(racertinfo, bill, ra.getId(), uidIdx, keySn, autoidType, autoidValue);
        // 返回数字证书
        retMap.put("retCode", 1);
        retMap.put("certChain", racertinfo.getCertSignBufP7());
        retMap.put("certSn", racertinfo.getCertSerialNumber());
        retMap.put("certSignBuf", racertinfo.getCertSignBuf());
        retMap.put("certKmcRep1", racertinfo.getCertKmcRep1());
        retMap.put("certKmcRep2", racertinfo.getCertKmcRep2());
        // 加密证书
        retMap.put("encUserCert", racertinfo.getCertSignBufKmc());
        // 记录日志
        UserLog userlog = new UserLog();
        userlog.setProject(webuserInfo.getProject());
        userlog.setType("用户下载证书");
        userlog.setInfo(webenterprise.getEnterpriseName() + "下载证书成功");
        userlog.setHostId("未知");
        userlog.setSn(null == webuserInfo.getUniqueId() ? null : webuserInfo.getUniqueId());
        LogUtil.userlog(sqlSession, userlog);
    } catch (Exception e) {
        e.printStackTrace();
        retMap.put("retMsg", e.getMessage());
        // 记录日志
        UserLog userlog = new UserLog();
        userlog.setProject(webuserInfo.getProject());
        userlog.setType("用户下载证书");
        userlog.setInfo("url:downLoadCert,详细错误:" + e.getMessage());
        userlog.setHostId("未知");
        userlog.setSn(null == webuserInfo.getUniqueId() ? null : webuserInfo.getUniqueId());
        LogUtil.userlog(sqlSession, userlog);
        return retMap;
    }
    return retMap;
}
Also used : CertInfo(cn.topca.tca.ra.service.CertInfo) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Product(com.itrus.portal.db.Product) UserInfo(com.itrus.portal.db.UserInfo) UserLog(com.itrus.portal.db.UserLog) GenP10Exception(com.itrus.Exception.GenP10Exception) IOException(java.io.IOException) DigitalCert(com.itrus.portal.db.DigitalCert) RaAccount(com.itrus.portal.db.RaAccount) Enterprise(com.itrus.portal.db.Enterprise) Bill(com.itrus.portal.db.Bill) JSONObject(com.alibaba.fastjson.JSONObject) UserCert(com.itrus.portal.db.UserCert) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 64 with Enterprise

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

the class ExtraBillWebController method billList.

/**
 * 订单列表
 *
 * @param billStatus
 *            0未完成订单,1已完成订单
 * @param request
 * @param uiModel
 * @return
 * @throws Exception
 */
@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, HttpServletRequest request, Model uiModel) throws Exception {
    HttpSession session = request.getSession();
    Enterprise enterprise = (Enterprise) session.getAttribute("webenterprise");
    UserInfo userInfo = (UserInfo) session.getAttribute("webuserInfo");
    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;
    }
    // 获取仅用户授权产品,不返回该类型产品的订单
    List<Long> productOpenTypes = extraProductService.getProductOpenType(ComNames.PRODUCT_OPEN_TYPE_1);
    ExtraBillExample billExampl0 = new ExtraBillExample();
    ExtraBillExample.Criteria criteria0 = billExampl0.or();
    // 查询当前用户当前企业的订单
    // 当前用户
    criteria0.andUniqueIdEqualTo(userInfo.getId());
    // 当前企业
    criteria0.andEnterpriseEqualTo(enterprise.getId());
    criteria0.andIsDeleteNotEqualTo(true);
    ExtraBillExample billExampl1 = new ExtraBillExample();
    ExtraBillExample.Criteria criteria1 = billExampl1.or();
    // 查询当前用户当前企业的订单
    // 当前用户
    criteria1.andUniqueIdEqualTo(userInfo.getId());
    // 当前企业
    criteria1.andEnterpriseEqualTo(enterprise.getId());
    criteria1.andIsDeleteNotEqualTo(true);
    if (null != productOpenTypes && !productOpenTypes.isEmpty()) {
        criteria0.andExtraProductNotIn(productOpenTypes);
        criteria1.andExtraProductNotIn(productOpenTypes);
    }
    // if (null == billStatus || 0 == billStatus) {
    // // 未完成订单:订单状态不为7
    // criteria.andBillStatusNotEqualTo(ComNames.EXTRA_BILL_STATUS_7);
    // criteria.andIsDeleteEqualTo(false);
    // } else if (1 == billStatus) {
    // criteria.andBillStatusEqualTo(ComNames.EXTRA_BILL_STATUS_7);// 订单状态为已完成
    // }
    // 未完成订单:订单状态不为7
    criteria0.andBillStatusNotEqualTo(ComNames.EXTRA_BILL_STATUS_7);
    criteria0.andIsDeleteEqualTo(false);
    // 订单状态为已完成
    criteria1.andBillStatusEqualTo(ComNames.EXTRA_BILL_STATUS_7);
    // Integer count = extraBillService.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);
    billExampl0.setOrderByClause("create_time desc");
    List<ExtraBill> billList0 = extraBillService.selectByExample(billExampl0);
    uiModel.addAttribute("billList0", billList0);
    // uiModel.addAttribute("itemcount", billList.size());
    // 获取订单对应的产品规格
    Map<Long, ExtraProductSpec> productSpecMap0 = extraProductSpecService.getProductSpec(billList0);
    uiModel.addAttribute("productSpecMap0", productSpecMap0);
    List<ExtraBill> billList1 = extraBillService.selectByExample(billExampl1);
    uiModel.addAttribute("billList1", billList1);
    // uiModel.addAttribute("itemcount", billList.size());
    // 获取订单对应的产品规格
    Map<Long, ExtraProductSpec> productSpecMap1 = extraProductSpecService.getProductSpec(billList1);
    uiModel.addAttribute("productSpecMap1", productSpecMap1);
    // 增值产品信息:
    Map<Long, ExtraProduct> productMap = sqlSession.selectMap("com.itrus.portal.db.ExtraProductMapper.selectByExample", "id");
    uiModel.addAttribute("productMap", productMap);
    // 返回订单列表
    return "client/dingdanliebiao";
}
Also used : HttpSession(javax.servlet.http.HttpSession) ExtraBill(com.itrus.portal.db.ExtraBill) ExtraProductSpec(com.itrus.portal.db.ExtraProductSpec) UserInfo(com.itrus.portal.db.UserInfo) ExtraBillExample(com.itrus.portal.db.ExtraBillExample) ExtraProduct(com.itrus.portal.db.ExtraProduct) Enterprise(com.itrus.portal.db.Enterprise) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 65 with Enterprise

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

Aggregations

Enterprise (com.itrus.portal.db.Enterprise)94 UserInfo (com.itrus.portal.db.UserInfo)68 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)58 HashMap (java.util.HashMap)47 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)37 IOException (java.io.IOException)32 Product (com.itrus.portal.db.Product)27 HttpSession (javax.servlet.http.HttpSession)27 Bill (com.itrus.portal.db.Bill)26 BusinessLicense (com.itrus.portal.db.BusinessLicense)26 TaxRegisterCert (com.itrus.portal.db.TaxRegisterCert)25 ExtraProduct (com.itrus.portal.db.ExtraProduct)24 OrgCode (com.itrus.portal.db.OrgCode)23 IdentityCard (com.itrus.portal.db.IdentityCard)22 UserinfoEnterprise (com.itrus.portal.db.UserinfoEnterprise)22 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)22 ExtraBill (com.itrus.portal.db.ExtraBill)21 Project (com.itrus.portal.db.Project)20 UserCert (com.itrus.portal.db.UserCert)19 Agent (com.itrus.portal.db.Agent)18