Search in sources :

Example 1 with ReviewLog

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

the class BillWebController method showTwo.

/**
 * 订单详情
 *
 * @param id
 * @param uiModel
 * @param autoShowPfxMessage 从订单信息页面 点击下载证书跳转到下载证书页面,若为 1 自动弹出短信输入框,
 * @return
 */
@RequestMapping(value = "/bill/{id}.html", produces = "text/html")
public String showTwo(@PathVariable("id") Long id, Model uiModel, @RequestParam(value = "typenum", required = false) String typenum, @RequestParam(value = "num", required = false) Long num, @RequestParam(value = "updateAuditBill", required = false) String updateAuditBill, @RequestParam(value = "autoShowPfxMessage", required = false) String autoShowPfxMessage, HttpServletRequest request) {
    HttpSession session = request.getSession();
    Boolean verifyCodeStatus = (Boolean) session.getAttribute("webverifyCodeStatus");
    Enterprise enterprise = (Enterprise) session.getAttribute("webenterprise");
    UserInfo userInfo = (UserInfo) session.getAttribute("webuserInfo");
    List<Map> billAll = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectDingdanByBill", id);
    if (billAll.size() == 0) {
        return "redirect:/userInfoWeb/denglu.html";
    }
    // 解析订单中uid信息{"ADDTIONAL_FIELD1_1":"","ADDTIONAL_FIELD3_1":"","ADDTIONAL_FIELD4_1":"G2016071301","inputName":"inputValue"}\
    Bill bill = billService.getBill(id);
    if (null != bill.getUid()) {
        uiModel.addAttribute("uid", bill.getUid().toString());
    }
    if (null != bill.getUid1()) {
        uiModel.addAttribute("uid1", bill.getUid1().toString());
    }
    if (null != bill.getUid2()) {
        uiModel.addAttribute("uid2", bill.getUid2().toString());
    }
    if (null != bill.getUid3()) {
        uiModel.addAttribute("uid3", bill.getUid3().toString());
    }
    /*if(!bill.getUid().equals("{}")){
			List<String> listStr = new ArrayList<String>();
			JSONObject uid = JSONObject.parseObject(bill.getUid().toString());
			for(int i= 0; i< (int)bill.getProductNum();i++){
				//uiModel.addAttribute("uid"+ (i+1), uid.get(("ADDTIONAL_FIELD"+ (i+ 1)) + "_1"));
				listStr.add(uid.get(("ADDTIONAL_FIELD1_"+ (i+ 1))).toString());
			}
			uiModel.addAttribute("listStr", listStr);
		}*/
    // 得到证书信息项
    Product pdt = productService.getProductById(bill.getProduct());
    uiModel.addAttribute("pdt", pdt);
    if (pdt.getCertinfo() != null) {
        uiModel.addAttribute("certinfoStr", escapeTool.javascript(pdt.getCertinfo()));
    } else {
        uiModel.addAttribute("certinfoStr", "[]");
    }
    PayInfoExample payInfoex = new PayInfoExample();
    Map<Long, PayInfo> payinfoMap = sqlSession.selectMap("com.itrus.portal.db.PayInfoMapper.selectByExample", payInfoex, "id");
    uiModel.addAttribute("payinfomap", payinfoMap);
    String descript = billAll.get(0).get("descript").toString().replace("\r\n", "<br/>");
    uiModel.addAttribute("descript", descript);
    // 如配置了产品规格,则将产品规格返回:产品期限、产品描述
    if (billAll.get(0).containsKey("product_spec") && !"0".equals(billAll.get(0).get("product_spec"))) {
        ProductSpec productSpec = productSpecService.getProductSpec((Long) billAll.get(0).get("product_spec"));
        descript = "产品期限:" + productSpec.getProductValid() + "年<br/>" + "产品描述:" + productSpec.getDescript().replace("\r\n", "<br/>");
        uiModel.addAttribute("descript", descript);
    }
    // 组合产品以及产品规格以及证书信息项
    String descript1 = "";
    String descript2 = "";
    String descript3 = "";
    if (billAll.get(0).containsKey("product_spec1") && !"0".equals(billAll.get(0).get("product_spec1"))) {
        ProductSpec productSpec1 = productSpecService.getProductSpec((Long) billAll.get(0).get("product_spec1"));
        descript1 = "产品期限:" + productSpec1.getProductValid() + "年<br/>" + "产品描述:" + productSpec1.getDescript().replace("\r\n", "<br/>");
        uiModel.addAttribute("descript1", descript1);
    }
    if (billAll.get(0).containsKey("product_spec2") && !"0".equals(billAll.get(0).get("product_spec2"))) {
        ProductSpec productSpec2 = productSpecService.getProductSpec((Long) billAll.get(0).get("product_spec2"));
        descript2 = "产品期限:" + productSpec2.getProductValid() + "年<br/>" + "产品描述:" + productSpec2.getDescript().replace("\r\n", "<br/>");
        uiModel.addAttribute("descript2", descript2);
    }
    if (billAll.get(0).containsKey("product_spec3") && !"0".equals(billAll.get(0).get("product_spec3"))) {
        ProductSpec productSpec3 = productSpecService.getProductSpec((Long) billAll.get(0).get("product_spec3"));
        descript3 = "产品期限:" + productSpec3.getProductValid() + "年<br/>" + "产品描述:" + productSpec3.getDescript().replace("\r\n", "<br/>");
        uiModel.addAttribute("descript3", descript3);
    }
    if (null != bill.getProduct1()) {
        Product product1 = productService.getProductById(bill.getProduct1());
        uiModel.addAttribute("product1", product1);
        if (product1.getCertinfo() != null) {
            uiModel.addAttribute("certinfoStr1", escapeTool.javascript(product1.getCertinfo()));
        } else {
            uiModel.addAttribute("certinfoStr1", "[]");
        }
    }
    if (null != bill.getProduct2()) {
        Product product2 = productService.getProductById(bill.getProduct2());
        uiModel.addAttribute("product2", product2);
        if (product2.getCertinfo() != null) {
            uiModel.addAttribute("certinfoStr2", escapeTool.javascript(product2.getCertinfo()));
        } else {
            uiModel.addAttribute("certinfoStr2", "[]");
        }
    }
    if (null != bill.getProduct3()) {
        Product product3 = productService.getProductById(bill.getProduct3());
        uiModel.addAttribute("product3", product3);
        if (product3.getCertinfo() != null) {
            uiModel.addAttribute("certinfoStr3", escapeTool.javascript(product3.getCertinfo()));
        } else {
            uiModel.addAttribute("certinfoStr3", "[]");
        }
    }
    if (null == verifyCodeStatus || !verifyCodeStatus || null == userInfo || !(billAll.get(0).get("enterprise").equals(enterprise.getId()))) {
        // 登录状态失效,跳转到登录页面
        return "redirect:/userInfoWeb/denglu.html";
    }
    // 获取订单在线支付方式
    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);
    }
    // 获取产品的认证等级需要认证的项
    Certification certification = sqlSession.selectOne("com.itrus.portal.db.CertificationMapper.selectByPrimaryKey", billAll.get(0).get("authentication"));
    List<Map> courierinfos = new ArrayList<Map>();
    if (billAll.get(0).get("delivery") != null) {
        courierinfos = sqlSession.selectList("com.itrus.portal.db.CourierInfoMapper.selectItemsByCourierInfo", billAll.get(0).get("id"));
        uiModel.addAttribute("courierinfos", courierinfos);
    }
    Map<Long, Receipt> receiptmap = sqlSession.selectMap("com.itrus.portal.db.ReceiptMapper.selectByExample", null, "id");
    Map<Long, Ereceipt> ereceiptmap = sqlSession.selectMap("com.itrus.portal.db.EreceiptMapper.selectByExample", null, "id");
    Map<Long, DigitalCert> certmap = sqlSession.selectMap("com.itrus.portal.db.DigitalCertMapper.selectByExample", null, "id");
    // 判断订单对应的产品是否配置有数字证书
    Product product = productService.getProductById((Long) billAll.get(0).get("product"));
    if (null == product.getCert()) {
        uiModel.addAttribute("billhasnotcert", 1);
        // 判断无数字证书的订单是否需要配送
        if (null != billAll.get(0).get("delivery")) {
            uiModel.addAttribute("billneedtodelivery", 1);
        } else {
            uiModel.addAttribute("billneedtodelivery", 0);
        }
    } else {
        uiModel.addAttribute("billhasnotcert", 0);
    }
    // 根据省市区code值获取省市区最新名称
    String regionCodes = billAll.get(0).get("d_codes") == null ? "" : billAll.get(0).get("d_codes").toString();
    String detailAdds = billAll.get(0).get("d_adds") == null ? "" : billAll.get(0).get("d_adds").toString();
    if (StringUtils.isNotBlank(regionCodes) && regionCodes.indexOf("@") >= 0) {
        String[] codes = regionCodes.split("@");
        String regionName = sysRegionService.getAllName(codes[1], codes[2], codes[3]);
        detailAdds = regionName + detailAdds;
    }
    uiModel.addAttribute("detailAdd", detailAdds);
    if (null != billAll.get(0).get("u_adds")) {
        String regionCodes1 = billAll.get(0).get("u_codes").toString();
        String detailAdds1 = billAll.get(0).get("u_adds").toString();
        if (StringUtils.isNotBlank(regionCodes1) && regionCodes1.indexOf("@") >= 0) {
            String[] codes1 = regionCodes1.split("@");
            String regionName1 = sysRegionService.getAllName(codes1[1], codes1[2], codes1[3]);
            detailAdds1 = regionName1 + detailAdds1;
        }
        uiModel.addAttribute("detailAdd1", detailAdds1);
    }
    int num1 = 0;
    if (num != null) {
        num1 = Integer.parseInt(num.toString());
    }
    // 该订单是否有价格优惠记录
    PreferentialRecord pr = preferentialRecordService.selectPreferentialRecordSByBillId(id);
    if (null != pr) {
        // 原价
        Double originalCost = pr.getOriginalPrice();
        // 优惠价
        Double preCost = pr.getPreferentialPrice();
        uiModel.addAttribute("originalCost", originalCost);
        uiModel.addAttribute("preCost", preCost);
    }
    uiModel.addAttribute("num", num1);
    uiModel.addAttribute("billAll", billAll);
    uiModel.addAttribute("receiptmap", receiptmap);
    uiModel.addAttribute("ereceiptmap", ereceiptmap);
    uiModel.addAttribute("certmap", certmap);
    uiModel.addAttribute("certification", certification);
    uiModel.addAttribute("product", product);
    // 根据订单id返回签章模版
    try {
        makeSeal((Long) billAll.get(0).get("id"), uiModel);
    } catch (EncDecException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    } catch (Exception e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    if (typenum == null)
        typenum = "0";
    // 判断是否是审核中进入的订单修改页面
    if (StringUtils.isNotBlank(updateAuditBill) && updateAuditBill.equals("1")) {
        // 判断订单状态是否1,2,3,10
        List<Integer> modifiedStatus = new ArrayList<Integer>();
        modifiedStatus.add(ComNames.BILL_STATUS_1);
        modifiedStatus.add(ComNames.BILL_STATUS_2);
        modifiedStatus.add(ComNames.BILL_STATUS_3);
        modifiedStatus.add(ComNames.BILL_STATUS_10);
        // 不在以上状态中
        if (modifiedStatus.indexOf(billAll.get(0).get("bill_status")) == -1) {
            // 重定向
            return "redirect:/billWeb/bill/" + id + ".html";
        }
        return "ixinweb/dingdanxiangqing_shenhezhong_chongxintijiao";
    }
    // 审核记录
    ReviewLog reviewLog = reviewLogService.getReviewLog(id);
    if (reviewLog != null) {
        uiModel.addAttribute("reviewLog", reviewLog);
    }
    // 支付待确认时间
    if (billAll.get(0).get("pay_info") != null) {
        List<PayInfo> pays = sqlSession.selectList("com.itrus.portal.db.PayInfoMapper.selectByPrimaryKey", billAll.get(0).get("pay_info"));
        PayInfo dp = pays.get(0);
        uiModel.addAttribute("pay_time", dp.getCreateTime());
        uiModel.addAttribute("pay_confirm_time", dp.getPayConfirmTime());
    }
    // 判断订单状态
    if (billAll.get(0).get("bill_status").equals(1) || billAll.get(0).get("bill_status").equals(2)) {
        // 更新证书前 ,显示旧证书
        if (billAll.get(0).get("old_user_cert") != null) {
            UserCert oldUserCert = sqlSession.selectOne("com.itrus.portal.db.UserCertMapper.selectByPrimaryKey", billAll.get(0).get("old_user_cert"));
            Object[] info = getCertInfo(oldUserCert);
            uiModel.addAttribute("remainingDays", info[0]);
            uiModel.addAttribute("owner", info[1]);
            uiModel.addAttribute("oldUserCert", oldUserCert);
            // 根据订单id返回签章模版
            try {
                makeSeal(oldUserCert.getBill(), uiModel);
            } catch (EncDecException e1) {
                e1.printStackTrace();
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }
        return "ixinweb/dingdanxiangqing_daizhifu";
    } else if (billAll.get(0).get("bill_status").equals(3) || billAll.get(0).get("bill_status").equals(4) || billAll.get(0).get("bill_status").equals(11) || billAll.get(0).get("bill_status").equals(10)) {
        // 更新证书前 ,显示旧证书
        if (billAll.get(0).get("old_user_cert") != null) {
            UserCert oldUserCert = sqlSession.selectOne("com.itrus.portal.db.UserCertMapper.selectByPrimaryKey", billAll.get(0).get("old_user_cert"));
            Object[] info = getCertInfo(oldUserCert);
            uiModel.addAttribute("remainingDays", info[0]);
            uiModel.addAttribute("owner", info[1]);
            uiModel.addAttribute("oldUserCert", oldUserCert);
            // 根据订单id返回签章模版
            try {
                makeSeal(oldUserCert.getBill(), uiModel);
            } catch (EncDecException e1) {
                e1.printStackTrace();
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }
        if (billAll.get(0).get("bill_status").equals(11)) {
            PayInfo payinfo = sqlSession.selectOne("com.itrus.portal.db.PayInfoMapper.selectByPrimaryKey", billAll.get(0).get("pay_info"));
            uiModel.addAttribute("payinfo", payinfo);
        }
        if (Integer.parseInt(typenum) == 1) {
            if (null != product && product.getProject() != null) {
                EnterpriseQqExample enterpriseE = new EnterpriseQqExample();
                EnterpriseQqExample.Criteria qqEx = enterpriseE.createCriteria();
                qqEx.andProjectIdEqualTo(product.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());
                }
            }
            return "ixinweb/dingdanxiangqing_chongxintijiao";
        } else {
            return "ixinweb/dingdanxiangqing_dengdaishenhe";
        }
    } else if (billAll.get(0).get("bill_status").equals(12)) {
        // 待更新
        List<UserCert> userCerts = sqlSession.selectList("com.itrus.portal.db.UserCertMapper.selectByPrimaryKey", billAll.get(0).get("old_user_cert"));
        if (userCerts.size() > 0) {
            UserCert userCert = userCerts.get(0);
            Object[] info = getCertInfo(userCert);
            uiModel.addAttribute("remainingDays", info[0]);
            uiModel.addAttribute("owner", info[1]);
            uiModel.addAttribute("userCert", userCerts.get(0));
            // 根据订单id返回签章模版
            try {
                makeSeal(userCert.getBill(), uiModel);
            } catch (EncDecException e1) {
                e1.printStackTrace();
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }
        return "ixinweb/dingdanxiangqing_gengxinshenhetongguo";
    } else if (billAll.get(0).get("bill_status").equals(5) || billAll.get(0).get("bill_status").equals(6) || billAll.get(0).get("bill_status").equals(7)) {
        // 初购产品 已制证 在订单详情显示 证书信息
        if ((Integer) billAll.get(0).get("bill_status") >= 6) {
            List<String> certStatus = new ArrayList<String>();
            List<UserCert> certs = userCertService.getUserCertByBill(id, certStatus);
            if (certs != null && certs.size() > 0) {
                certStatus.add(ComNames.CERT_STATUS_1);
                certStatus.add(ComNames.CERT_STATUS_2);
                UserCert userCert = certs.get(0);
                Object[] info = getCertInfo(userCert);
                uiModel.addAttribute("remainingDays", info[0]);
                uiModel.addAttribute("owner", info[1]);
                uiModel.addAttribute("userCert", userCert);
            }
        }
        // 返回老证书序列号
        if (billAll.get(0).get("old_user_cert") != null) {
            UserCert oldUserCert = sqlSession.selectOne("com.itrus.portal.db.UserCertMapper.selectByPrimaryKey", billAll.get(0).get("old_user_cert"));
            uiModel.addAttribute("oldCertSn", oldUserCert.getCertSn());
            try {
                List<String> allIssUerDn = new ArrayList<String>();
                allIssUerDn = sqlSession.selectList("com.itrus.portal.db.CrlContextMapper.selectAllIssUerDn");
                uiModel.addAttribute("allIssUerDn", jsonTool.writeValueAsString(allIssUerDn));
                makeSeal(oldUserCert.getBill(), uiModel);
            } catch (JsonGenerationException e) {
                e.printStackTrace();
            } catch (JsonMappingException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } catch (EncDecException e) {
                e.printStackTrace();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (courierinfos.size() > 0) {
            uiModel.addAttribute("couriercount", courierinfos.size());
            return "ixinweb/dingdanxiangqing_yifahuo";
        } else {
            return "ixinweb/dingdanxiangqing_dengdaifahuo";
        }
    } else if (billAll.get(0).get("bill_status").equals(8)) {
        List<String> certStatus = new ArrayList<String>();
        List<UserCert> certs = userCertService.getUserCertByBill(id, certStatus);
        if (certs != null && certs.size() > 0) {
            certStatus.add(ComNames.CERT_STATUS_1);
            certStatus.add(ComNames.CERT_STATUS_2);
            UserCert userCert = certs.get(0);
            Object[] info = getCertInfo(userCert);
            uiModel.addAttribute("remainingDays", info[0]);
            uiModel.addAttribute("owner", info[1]);
            uiModel.addAttribute("userCert", userCert);
        }
        // 返回老证书序列号
        if (billAll.get(0).get("old_user_cert") != null) {
            UserCert oldUserCert = sqlSession.selectOne("com.itrus.portal.db.UserCertMapper.selectByPrimaryKey", billAll.get(0).get("old_user_cert"));
            uiModel.addAttribute("oldCertSn", oldUserCert.getCertSn());
            try {
                List<String> allIssUerDn = new ArrayList<String>();
                allIssUerDn = sqlSession.selectList("com.itrus.portal.db.CrlContextMapper.selectAllIssUerDn");
                uiModel.addAttribute("allIssUerDn", jsonTool.writeValueAsString(allIssUerDn));
            } catch (JsonGenerationException e) {
                e.printStackTrace();
            } catch (JsonMappingException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return "ixinweb/dingdanxiangqing_yifahuo";
    // 下载证书
    } else if (billAll.get(0).get("bill_status").equals(13)) {
        uiModel.addAttribute("autoShowPfxMessage", autoShowPfxMessage);
        return "ixinweb/dingdanxiangqing_xiazaizhengshu";
    } else {
        return "ixinweb/dingdanxiangqing_yichuihui";
    }
}
Also used : ArrayList(java.util.ArrayList) Product(com.itrus.portal.db.Product) PreferentialRecord(com.itrus.portal.db.PreferentialRecord) DigitalCert(com.itrus.portal.db.DigitalCert) PayInfo(com.itrus.portal.db.PayInfo) OnPayInfo(com.itrus.portal.db.OnPayInfo) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) EnterpriseQqExample(com.itrus.portal.db.EnterpriseQqExample) ArrayList(java.util.ArrayList) List(java.util.List) Receipt(com.itrus.portal.db.Receipt) ProductSpec(com.itrus.portal.db.ProductSpec) Certification(com.itrus.portal.db.Certification) EditBill(com.itrus.portal.db.EditBill) Bill(com.itrus.portal.db.Bill) Map(java.util.Map) HashMap(java.util.HashMap) PayInfoExample(com.itrus.portal.db.PayInfoExample) UserInfo(com.itrus.portal.db.UserInfo) OnPayInfo(com.itrus.portal.db.OnPayInfo) OnlinePay(com.itrus.portal.db.OnlinePay) UserCert(com.itrus.portal.db.UserCert) Ereceipt(com.itrus.portal.db.Ereceipt) HttpSession(javax.servlet.http.HttpSession) EncDecException(com.itrus.portal.exception.EncDecException) IOException(java.io.IOException) 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) EnterpriseQq(com.itrus.portal.db.EnterpriseQq) Enterprise(com.itrus.portal.db.Enterprise) ReviewLog(com.itrus.portal.db.ReviewLog) JsonGenerationException(org.codehaus.jackson.JsonGenerationException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with ReviewLog

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

Example 3 with ReviewLog

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

the class RenewUserCertClientController 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(ComNames.WEB_USER_INFO);
    Enterprise enterprise = (Enterprise) session.getAttribute(ComNames.WEB_ENTERPRISE);
    if (null == userInfo || null == enterprise) {
        return ComNames.DENG_LU_CLIENT;
    }
    // 审核记录
    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);
    if (0 == billAll.size()) {
        return ComNames.DENG_LU_CLIENT;
    }
    uiModel.addAttribute("bills", billAll.get(0));
    // 获取数字证书
    Product product = productService.getProduct((Long) billAll.get(0).get("product"));
    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", ""));
    }
    // 判断是否有签章服务,有则显示授权
    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 "clientFW/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) EncDecException(com.itrus.portal.exception.EncDecException) 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) HashMap(java.util.HashMap) Map(java.util.Map) OnlinePay(com.itrus.portal.db.OnlinePay) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with ReviewLog

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

the class RenewUserCertClientController method toPages.

/**
 * 跳转到更新成功页面或是更新失败页面 certs为新证书,若不为空则更新成功,若为空则更新失败 szy 2016年9月7日 上午9:49:15
 *
 * @param id
 *            订单编号
 */
@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(ComNames.WEB_USER_INFO);
    Enterprise enterprise = (Enterprise) session.getAttribute(ComNames.WEB_ENTERPRISE);
    if (null == userInfo || null == enterprise) {
        return ComNames.DENG_LU_CLIENT;
    }
    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()) {
        uiModel.addAttribute("errorMsg", "更新订单不存在");
        return ComNames.CLIENTFW_ERRORPAGE;
    }
    // 审核记录
    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) {
        Map<Long, OnPayInfo> opiMap = sqlSession.selectMap("com.itrus.portal.db.OnPayInfoMapper.selectByExample", "id");
        uiModel.addAttribute("opiMap", opiMap);
    }
    PayInfoExample payInfoex = new PayInfoExample();
    Map<Long, PayInfo> payinfoMap = sqlSession.selectMap("com.itrus.portal.db.PayInfoMapper.selectByExample", payInfoex, "id");
    uiModel.addAttribute("payinfomap", payinfoMap);
    UserCertExample uce = new UserCertExample();
    UserCertExample.Criteria ucec = uce.or();
    ucec.andBillEqualTo(id);
    List<UserCert> certs = sqlSession.selectList("com.itrus.portal.db.UserCertMapper.selectByExample", uce);
    if (ret == 1) {
        // 更新成功页面
        UserCert userCert = certs.get(0);
        uiModel.addAttribute("doneTime", userCert.getCertStartTime());
        try {
            // 将客户端更新后的证书绑定给当前用户
            userCert.setUserinfo(userInfo.getId());
            userCertService.updateByPrimaryKeySelective(userCert);
        } catch (Exception e) {
        // TODO: handle exception
        }
        // 刷新session中的当前证书
        session.setAttribute(ComNames.WEB_USER_CERT_SN, userCert.getCertSn());
        return "clientFW/dingdanxiangqing_gengxinchenggong";
    } else {
        // 更新失败页面
        return "clientFW/dingdanxiangqing_gengxinshibai";
    }
}
Also used : PayInfoExample(com.itrus.portal.db.PayInfoExample) HashMap(java.util.HashMap) HttpSession(javax.servlet.http.HttpSession) UserCertExample(com.itrus.portal.db.UserCertExample) UserInfo(com.itrus.portal.db.UserInfo) EncDecException(com.itrus.portal.exception.EncDecException) 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) HashMap(java.util.HashMap) Map(java.util.Map) UserCert(com.itrus.portal.db.UserCert) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 5 with ReviewLog

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

the class ReviewLogServiceImpl method saveReviewLog.

/**
 * 生成认证记录
 *
 * @param reviewType
 *            认证的类型:1送审系统认证,2管理员认证
 * @param adminId
 *            认证的管理员id
 * @param reviewStatus
 *            认证后的状态:1审核通过,2审核拒绝
 * @param reason
 *            拒绝原因
 * @param enterprise
 *            企业id
 * @param bill
 *            订单id
 * @param userInfo
 *            用户id
 * @return
 */
public ReviewLog saveReviewLog(Integer reviewType, Long adminId, Integer reviewStatus, String reason, Long enterprise, Long bill, Long userInfo, Long businessId, Long orgCodeId, Long taxregisterCertId, Long identityCardId, Long agentId, Long proxyId) {
    // 判断该订单是否已经鉴证过
    ReviewLog log = getReviewLog(bill);
    if (null != log) {
        log.setReviewType(reviewType);
        log.setReviewStatus(reviewStatus);
        log.setReason(reason);
        log.setCreateTime(new Date());
        log.setHasBl(businessId);
        log.setHasOrgCode(orgCodeId);
        log.setHasTaxCert(taxregisterCertId);
        log.setHasIdCard(identityCardId);
        log.setHasProxy(proxyId);
        log.setHasAgent(agentId);
        sqlSession.update("com.itrus.portal.db.ReviewLogMapper.updateByPrimaryKey", log);
        return log;
    }
    ReviewLog reviewLog = new ReviewLog();
    reviewLog.setReviewType(reviewType);
    reviewLog.setAdminId(adminId);
    reviewLog.setReviewStatus(reviewStatus);
    reviewLog.setReason(reason);
    reviewLog.setEnterprise(enterprise);
    reviewLog.setBill(bill);
    reviewLog.setUserInfo(userInfo);
    reviewLog.setHasBl(businessId);
    reviewLog.setHasOrgCode(orgCodeId);
    reviewLog.setHasTaxCert(taxregisterCertId);
    reviewLog.setHasIdCard(identityCardId);
    reviewLog.setHasProxy(proxyId);
    reviewLog.setHasAgent(agentId);
    reviewLog.setCreateTime(new Date());
    sqlSession.insert("com.itrus.portal.db.ReviewLogMapper.insert", reviewLog);
    sqlSession.flushStatements();
    return reviewLog;
}
Also used : ReviewLog(com.itrus.portal.db.ReviewLog) Date(java.util.Date)

Aggregations

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