Search in sources :

Example 6 with Enterprise

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

the class ClientWebController method getProductInfoFromClient.

/**
 * 接收新服务型客户端传递的项目信息,用户信息,企业信息
 * @param type,类型.web.app,客户端,目前是客户端,跟发布平台的值相同:{1:"web", 2:"客户端", 3:"app"}
 * @param keySn
 * @param certSn
 * @param enterpriseName
 * @param session
 * @param uiModel
 * @return
 */
@RequestMapping("/getProductInfoFromClient")
public String getProductInfoFromClient(@RequestParam(value = "type", required = true) String type, @RequestParam(value = "keySn", required = false) String keySn, @RequestParam(value = "certSn", required = false) String certSn, @RequestParam(value = "enterpriseName", required = false) String enterpriseName, HttpSession session, Model uiModel) {
    try {
        UserInfo userInfo = (UserInfo) session.getAttribute(ComNames.WEB_USER_INFO);
        Enterprise enterprise = (Enterprise) session.getAttribute(ComNames.WEB_ENTERPRISE);
        if (null == userInfo || null == enterprise) {
            return ComNames.DENG_LU_CLIENT;
        }
        UserCert userCert = null;
        if (StringUtils.isNotBlank(certSn)) {
            userCert = userCertService.getUserCertByCertSn(certSn);
        } else if (null != session.getAttribute(ComNames.WEB_USER_CERT_SN)) {
            String certSnInSession = (String) session.getAttribute(ComNames.WEB_USER_CERT_SN);
            userCert = userCertService.getUserCertByCertSn(certSnInSession);
        }
        if (null != userCert) {
            uiModel.addAttribute("userCert", userCert);
        }
        Project project = null;
        if (StringUtils.isNotBlank(keySn)) {
            ProjectKeyInfo projectKeyInfo = cacheCustomer.findProjectByKey(keySn);
            project = projectService.selectByPrimaryKey(projectKeyInfo.getProject());
        } else {
            project = projectService.selectByPrimaryKey(userInfo.getProject());
        }
        if (null == project) {
            uiModel.addAttribute("errorMsg", "无法识别当前登录用户所属的项目,请重新登录!");
            return "client/errorpage";
        }
        // 返回增值产品信息
        List<ExtraProductRelease> extraProductReleases = extraProductReleaseService.getByprojectAndType(project.getId(), type);
        // 获取项目下所有的发布产品
        List<ExtraProduct> extraProducts = extraProductService.getproductByEPR(extraProductReleases);
        uiModel.addAttribute("webExtraProducts", extraProducts);
        // 增值产品的类型
        Set<Object> productTypeSet = new LinkedHashSet<>();
        for (ExtraProduct ep : extraProducts) {
            productTypeSet.add(ep.getAppType());
        }
        uiModel.addAttribute("webProductTypes", productTypeSet);
        session.setAttribute("isregister", 1);
    } catch (Exception e) {
        uiModel.addAttribute("errorMsg", "出现异常,异常信息:" + e.getMessage());
        return "client/errorpage";
    }
    return "client/yingyongzhanshi";
}
Also used : LinkedHashSet(java.util.LinkedHashSet) ExtraProductRelease(com.itrus.portal.db.ExtraProductRelease) ProjectKeyInfo(com.itrus.portal.db.ProjectKeyInfo) UserInfo(com.itrus.portal.db.UserInfo) IOException(java.io.IOException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) Project(com.itrus.portal.db.Project) ExtraProduct(com.itrus.portal.db.ExtraProduct) Enterprise(com.itrus.portal.db.Enterprise) UserinfoEnterprise(com.itrus.portal.db.UserinfoEnterprise) UserCert(com.itrus.portal.db.UserCert) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 7 with Enterprise

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

the class ClientWebController method downLoadLicenseByBillId.

@RequestMapping("/downLoadLicense")
@ResponseBody
public Map<String, Object> downLoadLicenseByBillId(@RequestParam(value = "billId", required = true) Long Id, HttpServletRequest request, HttpServletResponse response, Model uiModel) {
    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(Id);
    if (null == bill) {
        retMap.put("retMsg", "登录已经失效,订单不存在");
        return retMap;
    }
    if (!bill.getUniqueId().equals(webuserInfo.getId())) {
        retMap.put("retMsg", "您无权操作该订单");
        return retMap;
    }
    if (!(bill.getBillStatus().equals(ComNames.EXTRA_BILL_STATUS_6) || bill.getBillStatus().equals(ComNames.EXTRA_BILL_STATUS_7))) {
        retMap.put("retMsg", "订单尚未能下载注册码.请等待服务商审核通过或者订单完成之后才能下载");
        return retMap;
    }
    Bwdjrecord bwdjrecord = BWDJRecordService.getBwdjrecordByExtraBillId(Id);
    OutputStream os = null;
    try {
        String downLoadUrl = bwdjrecord.getDownLoadUrl();
        URL url = new URL(downLoadUrl);
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        // 设置超时间为3秒
        conn.setConnectTimeout(3 * 1000);
        // 防止屏蔽程序抓取而返回403错误
        conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
        // 得到输入流
        InputStream inputStream = conn.getInputStream();
        BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
        String license = "";
        String currentLine = "";
        while ((currentLine = reader.readLine()) != null) {
            license = license + currentLine.trim();
        }
        retMap.put("retCode", 1);
        retMap.put("license", license);
        return retMap;
    // 获取自己数组
    // byte[] getData = readInputStream(inputStream);
    // response.setHeader("Pragma", "no-cache");
    // response.setHeader("Cache-Control", "no-cache");
    // response.setDateHeader("Expires", 0);
    // os = response.getOutputStream();
    // os.write(getData);
    // os.close();
    } catch (Exception e) {
        log.error(e.getMessage());
        retMap.put("retMsg", "出现异常,请联系系统管理员,异常信息:" + e.getMessage());
        return retMap;
    } finally {
        // 关闭流!
        try {
            if (null != os) {
                os.close();
            }
        } catch (IOException e) {
        }
    }
}
Also used : Bwdjrecord(com.itrus.portal.db.Bwdjrecord) InputStreamReader(java.io.InputStreamReader) HashMap(java.util.HashMap) HttpSession(javax.servlet.http.HttpSession) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) ExtraBill(com.itrus.portal.db.ExtraBill) ByteArrayOutputStream(java.io.ByteArrayOutputStream) OutputStream(java.io.OutputStream) UserInfo(com.itrus.portal.db.UserInfo) IOException(java.io.IOException) URL(java.net.URL) IOException(java.io.IOException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) HttpURLConnection(java.net.HttpURLConnection) Enterprise(com.itrus.portal.db.Enterprise) UserinfoEnterprise(com.itrus.portal.db.UserinfoEnterprise) BufferedReader(java.io.BufferedReader) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 8 with Enterprise

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

the class ClientWebController method choiceExtraProduct.

/**
 * 用户点击购要购买某个产品,返回这个产品对应的信息.购买信息.对应于:应用详情页面
 *
 * @param productId
 *            ,增值产品id
 * @param old_billId
 * @param request
 * @param uiModel
 * @return
 */
@RequestMapping("/choiceExtraProduct")
public String choiceExtraProduct(@RequestParam(value = "productId", required = true) Long productId, // enterpriseId,
@RequestParam(value = "old_billId", required = false) Long old_billId, HttpServletRequest request, Model uiModel) {
    HttpSession session = request.getSession();
    // 判断用户和企业信息是否存在了,不存在不能购买
    Enterprise enterprise = (Enterprise) session.getAttribute("webenterprise");
    UserInfo userInfo = (UserInfo) session.getAttribute("webuserInfo");
    if (null == enterprise || null == userInfo) {
        return "";
    }
    ExtraProduct product = null;
    try {
        product = extraProductService.selectByPrimaryKey(productId);
        if (null == product) {
            uiModel.addAttribute("errorMsg", "产品不存在");
            return "client/errorpage";
        }
        uiModel.addAttribute("webExtraproduct", product);
        // 产品对应的服务商信息
        Long serviceProviderId = product.getServiceProvider();
        ServiceProvider serviceProvider = serviceProviderService.selectByPrimaryKey(serviceProviderId);
        uiModel.addAttribute("webServiceProvider", serviceProvider);
        // 服务商对应的网点信息
        List<ServiceHall> serviceHalls = new ArrayList<>();
        serviceHalls = serviceHallService.getServiceHalls(serviceProviderId);
        uiModel.addAttribute("webServiceHalls", serviceHalls);
        // 产品对应的规格信息
        List<ExtraProductSpec> extraProductSpecs = extraProductSpecService.getSpecByProductIdValid(product.getId());
        uiModel.addAttribute("extraProductSpecs", extraProductSpecs);
        Set<String> periodSet = new LinkedHashSet<>();
        Set<String> specSet = new LinkedHashSet<>();
        Map<String, Map<String, Object>> specPeriodMap = new HashMap<>();
        for (ExtraProductSpec eps : extraProductSpecs) {
            Map<String, Object> map = new HashMap<>();
            map.put("id", eps.getId());
            map.put("price", eps.getPrice());
            specPeriodMap.put(eps.getSpec() + "||" + eps.getCycle1() + ";" + eps.getCycleUnit(), map);
            String spec = eps.getSpec();
            specSet.add(spec);
            periodSet.add(eps.getCycle1() + ";" + eps.getCycleUnit());
        }
        ObjectMapper objectMapper = new ObjectMapper();
        uiModel.addAttribute("specSet", specSet);
        uiModel.addAttribute("periodSet", periodSet);
        uiModel.addAttribute("specPeriodMapJson", objectMapper.writeValueAsString(specPeriodMap));
    } catch (Exception e) {
    // TODO: handle exception
    }
    // 仅用户授权产品.发票校验产品,直接跳转发票校验
    if (null != product.getProductOpenType() && product.getProductOpenType().equals(ComNames.PRODUCT_OPEN_TYPE_1)) {
        // 查询用户是否曾经买过了该产品对于的订单,如果买了,则提示只能购买一次
        List<ExtraBill> bills = extraBillService.getHasByExtraBill(userInfo.getId(), enterprise.getId(), productId);
        if (null != bills && bills.size() > 0) {
            uiModel.addAttribute("ifHasOpen", 1);
        }
        return "client/yingyongxiangqing_jyhsq";
    }
    return "client/yingyongxiangqing";
}
Also used : LinkedHashSet(java.util.LinkedHashSet) HashMap(java.util.HashMap) HttpSession(javax.servlet.http.HttpSession) ExtraBill(com.itrus.portal.db.ExtraBill) ArrayList(java.util.ArrayList) ExtraProductSpec(com.itrus.portal.db.ExtraProductSpec) UserInfo(com.itrus.portal.db.UserInfo) IOException(java.io.IOException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) ExtraProduct(com.itrus.portal.db.ExtraProduct) ServiceProvider(com.itrus.portal.db.ServiceProvider) Enterprise(com.itrus.portal.db.Enterprise) UserinfoEnterprise(com.itrus.portal.db.UserinfoEnterprise) ServiceHall(com.itrus.portal.db.ServiceHall) Map(java.util.Map) HashMap(java.util.HashMap) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 9 with Enterprise

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

the class DownLoadCertWebController method downloadPfxCert.

/**
 * 用户下载pfx证书的接口
 * @param id,订单id
 * @param session
 * @param request
 * @param response
 * @return
 */
@RequestMapping("/pfx/{id}")
public String downloadPfxCert(@PathVariable(value = "id") Long id, HttpSession session, HttpServletRequest request, HttpServletResponse response) {
    UserInfo webuserInfo = (UserInfo) session.getAttribute("webuserInfo");
    Enterprise webenterprise = (Enterprise) session.getAttribute("webenterprise");
    if (null == webuserInfo || null == webenterprise) {
        return null;
    }
    Integer uidIdx = 1;
    Bill bill = billService.getBill(id);
    if (null == bill) {
        return null;
    }
    boolean billFlag = webuserInfo.getId().equals(bill.getUniqueId()) && webenterprise.getId().equals(bill.getEnterprise());
    if (!billFlag) {
        return null;
    }
    // 用户已经下载过了,再次下载
    boolean downLoadFlag = bill.getBillStatus().equals(ComNames.BILL_STATUS_6) || bill.getBillStatus().equals(ComNames.BILL_STATUS_7) || bill.getBillStatus().equals(ComNames.BILL_STATUS_8);
    if (downLoadFlag) {
        // 根据订单号,找到订单对应的证书信息
        CertBuf certBuf = sqlSession.selectOne("com.itrus.portal.db.CertBufMapper.selectPfxCertByBillId", bill.getId());
        Date date = new Date();
        // 获取证书第一次下载时间和当前时间比较,如果超过了十五天,则不允许下载
        int day = DateUtils.daysOfTwo(date, certBuf.getCreateTime());
        if (day > 16) {
            return null;
        }
        // 从数据库中取出数据,返回给客户端.
        // 重置response对象中的缓冲区,该方法可以不写,但是你要保证response缓冲区没有其他数据,否则导出可能会出现问题,建议加上
        response.reset();
        String filename = webenterprise.getEnterpriseName() + "功能证书.pfx";
        filename = encodeFilename(filename, request);
        response.setHeader("Content-disposition", "attachment;filename=" + filename);
        response.setCharacterEncoding("utf-8");
        // 由于导出格式是pfx的文件,设置导出文件的响应头部信息
        response.setContentType("application/x-pkcs12");
        OutputStream os = null;
        try {
            os = response.getOutputStream();
            // 清理刷新缓冲区,将缓存中的数据将数据导出excel
            byte[] byteCert = Base64.decode(certBuf.getPfxCert());
            os.write(byteCert);
            os.flush();
            // 关闭os
            if (os != null) {
                os.close();
            }
            certBuf.setLastDownloadTime(new Date());
            certBuf.setCertDownloadNumber(certBuf.getCertDownloadNumber() + 1);
            downLoadCertService.updatePfxCert(certBuf);
            // 记录日志
            UserLog userlog = new UserLog();
            userlog.setProject(webuserInfo.getProject());
            userlog.setType("用户下载证书pfx");
            userlog.setInfo(webenterprise.getEnterpriseName() + "下载证书成功");
            userlog.setHostId("未知");
            userlog.setSn(null == webuserInfo.getUniqueId() ? null : webuserInfo.getUniqueId());
            LogUtil.userlog(sqlSession, userlog);
            return null;
        } catch (IOException e) {
            UserLog userlog = new UserLog();
            userlog.setProject(bill.getProject());
            userlog.setType("用户下载证书pfx");
            userlog.setInfo(webenterprise.getEnterpriseName() + "失败,错误信息:" + e.getMessage());
            userlog.setHostId("未知");
            userlog.setSn(null == webuserInfo.getUniqueId() ? null : webuserInfo.getUniqueId());
            LogUtil.userlog(sqlSession, userlog);
        }
    } else {
        // 用户未下载过,第一次下载
        if (bill.getBillStatus().equals(ComNames.BILL_STATUS_13)) {
            // 查询项目产品
            Product product = productService.getProduct(bill.getProduct());
            // 企业
            Enterprise enterprise = enterpriseService.getEnterpriseById(bill.getEnterprise());
            // 获取产品、RA配置
            RaAccount ra = raAccountService.getRaAccount(product.getRa());
            // 证书配置
            DigitalCert digitalcert = digitalCertService.getDigitalCert(product.getCert());
            // 下载证书
            String autoidType = "";
            Integer autoidValue = 0;
            String pfxCert = "";
            // 用户ID,用来最终匹配公钥证书和密钥对
            String userid = bill.getBillId() + (Math.random() * 1000 + 9000);
            // TODO 20170410pfx私钥证书保护密码:需要根据产品配置的密码或获取
            String certPass = product.getPassword();
            // 产生CSR证书请求
            String certReqBuf = "";
            // 算法
            String algorithm = digitalCertService.getAlgorithm(digitalcert);
            // 下载证书
            CertInfo racertinfo = null;
            try {
                certReqBuf = GenUtil.GenP10(userid, "", algorithm);
                racertinfo = downLoadCertService.downLoadCert(product, ra, bill, digitalcert, uidIdx, certReqBuf, autoidType, autoidValue);
                // pfxCert = GenUtil.GenPFX(userid, certPass,
                // racertinfo.getCertSignBuf(), false);
                // pfxCert = GenUtil2.GenPFX(userid, certPass, racertinfo.getCertSignBuf(), pfxCert, false, enterprise.getEnterpriseName());
                pfxCert = GenUtil.GenPFX(userid, certPass, racertinfo.getCertSignBuf(), false, enterprise.getEnterpriseName());
                // 保存证书
                downLoadCertService.savePfxCertInfo(racertinfo, bill, ra.getId(), uidIdx, "", autoidType, autoidValue, pfxCert);
                // 从数据库中取出数据,返回给客户端.
                // 重置response对象中的缓冲区,该方法可以不写,但是你要保证response缓冲区没有其他数据,否则导出可能会出现问题,建议加上
                response.reset();
                String filename = webenterprise.getEnterpriseName() + "通讯证书.pfx";
                filename = encodeFilename(filename, request);
                response.setHeader("Content-disposition", "attachment;filename=" + filename);
                response.setCharacterEncoding("utf-8");
                // 由于导出格式是pfx的文件,设置导出文件的响应头部信息
                response.setContentType("application/x-pkcs12");
                OutputStream os = null;
                os = response.getOutputStream();
                // 清理刷新缓冲区,将缓存中的数据将数据导出excel
                byte[] byteCert = Base64.decode(pfxCert);
                os.write(byteCert);
                os.flush();
                // 关闭os
                if (os != null) {
                    os.close();
                }
                // 记录日志
                UserLog userlog = new UserLog();
                userlog.setProject(bill.getProject());
                userlog.setType("用户下载证书pfx");
                userlog.setInfo(webenterprise.getEnterpriseName() + "下载证书成功,企业名称:" + webenterprise.getEnterpriseName());
                userlog.setHostId("未知");
                userlog.setSn(null == webuserInfo.getUniqueId() ? null : webuserInfo.getUniqueId());
                LogUtil.userlog(sqlSession, userlog);
                return null;
            } catch (Exception e) {
                // 记录日志
                UserLog userlog = new UserLog();
                userlog.setProject(bill.getProject());
                userlog.setType("用户下载证书pfx");
                userlog.setInfo(webenterprise.getEnterpriseName() + "失败,错误信息:" + e.getMessage());
                userlog.setHostId("未知");
                userlog.setSn(null == webuserInfo.getUniqueId() ? null : webuserInfo.getUniqueId());
                LogUtil.userlog(sqlSession, userlog);
            }
        }
    }
    return null;
}
Also used : CertInfo(cn.topca.tca.ra.service.CertInfo) OutputStream(java.io.OutputStream) Product(com.itrus.portal.db.Product) UserInfo(com.itrus.portal.db.UserInfo) UserLog(com.itrus.portal.db.UserLog) IOException(java.io.IOException) Date(java.util.Date) 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) CertBuf(com.itrus.portal.db.CertBuf) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 10 with Enterprise

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

the class DownLoadCertWebController method downLoadCertPage.

// 进入下载证书页面
@RequestMapping("/downLoadCertPage/{id}")
public String downLoadCertPage(@PathVariable(value = "id") Long id, HttpSession session, Model uiModel) {
    // 是否登录
    UserInfo webuserInfo = (UserInfo) session.getAttribute("webuserInfo");
    Enterprise webenterprise = (Enterprise) session.getAttribute("webenterprise");
    if (null == webuserInfo || null == webenterprise) {
        // 登录状态失效,跳转到注册页面
        return "redirect:/userInfoWeb/denglu.html";
    }
    Bill bill = billService.getBill(id);
    if (null == bill) {
        logger.error("id为" + id + "的订单不存在");
        return "redirect:/userInfoWeb/denglu.html";
    }
    // 订单是否为当前用户当前企业
    if (!webuserInfo.getId().equals(bill.getUniqueId()) || !webenterprise.getId().equals(bill.getEnterprise())) {
        logger.error(webuserInfo.getmPhone() + "不能操作订单" + bill.getBillId());
        return "redirect:/userInfoWeb/denglu.html";
    }
    Product product = productService.getProduct(bill.getProduct());
    DigitalCert digitalCert = digitalCertService.getDigitalCert(product.getCert());
    // 获取产品规格
    ProductSpec productSpec = null;
    if (null != bill.getProductSpec() && !"0".equals(bill.getProductSpec())) {
        productSpec = productSpecService.getProductSpec(bill.getProductSpec());
    }
    // 获取订单在线支付方式
    if (bill.getOnPayInfo() != null) {
        OnPayInfo onPayInfo = sqlSession.selectOne("com.itrus.portal.db.OnPayInfoMapper.selectByPrimaryKey", bill.getOnPayInfo());
        uiModel.addAttribute("onPayInfo", onPayInfo);
    } else if (bill.getPayInfo() != null) {
        PayInfo payInfo = sqlSession.selectOne("com.itrus.portal.db.PayInfoMapper.selectByPrimaryKey", bill.getPayInfo());
        uiModel.addAttribute("payInfo", payInfo);
    }
    // 审核记录信息
    ReviewLog reviewLog = reviewLogService.getReviewLog(id);
    if (reviewLog != null) {
        uiModel.addAttribute("reviewLog", reviewLog);
    }
    uiModel.addAttribute("bill", bill);
    uiModel.addAttribute("product", product);
    uiModel.addAttribute("digitalCert", digitalCert);
    uiModel.addAttribute("productSpec", productSpec);
    // 当是pfx证书的时候,告知页面
    boolean pfxFlag = digitalCert.getCertType().equals(ComNames.DIGITALCERT_CERTTYPE_PFX) && digitalCert.getInitBuy().equals(ComNames.DIGITALCERT_INITBUYS_2);
    if (pfxFlag) {
        uiModel.addAttribute("ispfx", 1);
    }
    List<Map> makecerts = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectBillByMakecert", id);
    List<Map> makecertexall = sqlSession.selectList("com.itrus.portal.db.UserCertMapper.selectByPrimaryBillKey", id);
    uiModel.addAttribute("makecerts", makecerts);
    uiModel.addAttribute("enterpriseSn", makecerts.get(0).get("enterprise_sn"));
    DigitalCert digitalcert = null;
    Map<String, Object> params = new HashMap<String, Object>();
    uiModel.addAttribute("makecertexall", makecertexall);
    digitalcert = sqlSession.selectOne("com.itrus.portal.db.DigitalCertMapper.selectByPrimaryKey", makecerts.get(0).get("cert"));
    uiModel.addAttribute("digitalcert", digitalcert);
    if (makecerts.get(0).containsKey("product_spec") && !"0".equals(makecerts.get(0).get("product_spec"))) {
        productSpec = productSpecService.getProductSpec((Long) makecerts.get(0).get("product_spec"));
    }
    uiModel.addAttribute("productSpec", productSpec);
    product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", makecerts.get(0).get("product"));
    uiModel.addAttribute("product", product);
    try {
        uiModel.addAttribute("billStr", jsonTool.writeValueAsString(makecerts.get(0)));
        uiModel.addAttribute("usercertallStr", jsonTool.writeValueAsString(makecertexall));
        uiModel.addAttribute("digitalcertStr", jsonTool.writeValueAsString(digitalcert));
        uiModel.addAttribute("productStr", jsonTool.writeValueAsString(product));
        uiModel.addAttribute("productSpecStr", jsonTool.writeValueAsString(productSpec));
    } catch (Exception e) {
        e.printStackTrace();
    }
    // System.out.println(makecerts.get(0).get("product_num"));
    // 处理autoid自动编号信息
    // 解析项目产品中,certinfo配置信息
    JSONArray certinfo = JSONArray.parseArray(product.getCertinfo());
    for (int i = 0; certinfo != null && i < certinfo.size(); i++) {
        JSONObject obj = certinfo.getJSONObject(i);
        String autoid = obj.getString("autoid");
        if (autoid == null)
            continue;
        String autoidType = obj.getString("autoidType");
        String autoidPrev = obj.getString("autoidPrev");
        String autoidPrevDate = obj.getString("autoidPrevDate");
        String autoidLength = obj.getString("autoidLength");
        // 从user_cert表查询,该autoidType的最大值,如果没有最大值,则设置为0
        Map param = new HashMap();
        String enterpriseId = makecerts.get(0).get("enterprise").toString();
        param.put("enterpriseId", makecerts.get(0).get("enterprise"));
        param.put("type", autoidType);
        Integer autoidValue = null;
        if (autoidPrevDate == null)
            autoidValue = sqlSession.selectOne("com.itrus.portal.db.UserCertMapper.selectByConditon", param);
        else
            autoidValue = sqlSession.selectOne("com.itrus.portal.db.UserCertMapper.selectByConditonDate", param);
        if (autoidValue == null)
            autoidValue = 0;
        uiModel.addAttribute("enterpriseId", enterpriseId);
        uiModel.addAttribute("autoidType", autoidType);
        uiModel.addAttribute("autoidPrev", autoidPrev);
        uiModel.addAttribute("autoidLength", autoidLength);
        uiModel.addAttribute("autoidValue", autoidValue);
        break;
    }
    return "ixinweb/dingdanxiangqing_xiazaiqueren";
}
Also used : HashMap(java.util.HashMap) JSONArray(com.alibaba.fastjson.JSONArray) Product(com.itrus.portal.db.Product) UserInfo(com.itrus.portal.db.UserInfo) ProductSpec(com.itrus.portal.db.ProductSpec) GenP10Exception(com.itrus.Exception.GenP10Exception) IOException(java.io.IOException) DigitalCert(com.itrus.portal.db.DigitalCert) OnPayInfo(com.itrus.portal.db.OnPayInfo) PayInfo(com.itrus.portal.db.PayInfo) OnPayInfo(com.itrus.portal.db.OnPayInfo) JSONObject(com.alibaba.fastjson.JSONObject) Enterprise(com.itrus.portal.db.Enterprise) Bill(com.itrus.portal.db.Bill) ReviewLog(com.itrus.portal.db.ReviewLog) JSONObject(com.alibaba.fastjson.JSONObject) Map(java.util.Map) HashMap(java.util.HashMap) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

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