Search in sources :

Example 1 with Ereceipt

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

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

the class ClientWebController method bugExtraProduct.

// TODO
// 用户选择了产品中的某个规格,确认进行购买,对应于确认订单:根据产品是否需要附加信息,来决定用户提交的资料,判断后台是否有这个用户对应的这些附加信息,如果有就返回给页面
@RequestMapping("/buyExtraProduct")
public String bugExtraProduct(@RequestParam(value = "productId", required = true) Long productId, @RequestParam(value = "productSpecId", required = true) Long productSpecId, @RequestParam(value = "buyNumber", required = true) Long buyNumber, 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) {
        uiModel.addAttribute("errorMsg", "登录已经失效,请重新登录");
        return "client/errorpage";
    }
    try {
        ExtraProduct product = extraProductService.selectByPrimaryKey(productId);
        if (null == product) {
            uiModel.addAttribute("errorMsg", "增值产品不存在");
            return "client/errorpage";
        }
        uiModel.addAttribute("extraproduct", product);
        // 选择的规格信息
        ExtraProductSpec extraProductSpec = extraProductSpecService.selectByPrimaryKey(productSpecId);
        if (null == extraProductSpec) {
            uiModel.addAttribute("errorMsg", "增值产品规格不存在");
            return "client/errorpage";
        }
        uiModel.addAttribute("extraProductSpec", extraProductSpec);
        // 用户购买的数量:选择应该默认都是1
        uiModel.addAttribute("buyNumber", buyNumber);
        // 产品对应的服务商信息
        Long serviceProviderId = product.getServiceProvider();
        ServiceProvider serviceProvider = serviceProviderService.selectByPrimaryKey(serviceProviderId);
        uiModel.addAttribute("serviceProvider", serviceProvider);
        // 电子发票信息,看后台配置该产品是否能开票
        String eInvoceStr = product.getEinvoice();
        if (StringUtils.isNotBlank(eInvoceStr)) {
            // 电子开票服务
            Long[] ereceiptIds = StringTools.getLong(product.getEinvoice());
            Map<Long, Ereceipt> ereceiptMap = ereceiptService.getEreceiptMap(ereceiptIds);
            uiModel.addAttribute("ereceiptMap", ereceiptMap);
        }
        // 附加信息
        if (null != product.getExtraMessage()) {
            ExtraMessage extraMessage = extraMessageService.selectByPrimaryKey(product.getExtraMessage());
            // 用附加信息项的有无来判断是否需要用户填写附加信息,如果需要,则取附加信息项进行分割处理
            uiModel.addAttribute("extraMessage", extraMessage);
            // //企业信息 认证项(1.企业名称,2.统一社会信用代码/营业执照,3.组织机构代码,4.税务登记号)
            if (StringUtils.isNotBlank(extraMessage.getEnterpriseItems())) {
                if (StringUtils.isNotBlank(extraMessage.getEnterpriseItems())) {
                    if (extraMessage.getEnterpriseItems().contains("1")) {
                    }
                    if (extraMessage.getEnterpriseItems().contains("2")) {
                        List<BusinessLicense> businessLicenses = businessService.getBusinessLicensesNews(enterprise.getId());
                        if (null != businessLicenses && !businessLicenses.isEmpty()) {
                            session.setAttribute("webbusinessLicense", businessLicenses.get(0));
                        }
                    }
                    if (extraMessage.getEnterpriseItems().contains("3")) {
                        List<OrgCode> orgCodes = orgCodeService.getOrgCodesNews(enterprise.getId());
                        if (null != orgCodes && !orgCodes.isEmpty()) {
                            session.setAttribute("weborgCode", orgCodes.get(0));
                        }
                    }
                    if (extraMessage.getEnterpriseItems().contains("4")) {
                        List<TaxRegisterCert> taxRegisterCerts = taxCertService.getTaxRegisterCertsNews(enterprise.getId());
                        if (null != taxRegisterCerts && !taxRegisterCerts.isEmpty()) {
                            session.setAttribute("webtaxRegisterCert", taxRegisterCerts.get(0));
                        }
                    }
                }
            }
            // field string --fieldName agentItems
            if (StringUtils.isNotBlank(extraMessage.getAgentItems())) {
                List<Agent> agents = agentService.getAgentsNews(enterprise.getId());
                if (null != agents && !agents.isEmpty()) {
                    session.setAttribute("webagent", agents.get(0));
                }
            }
            // field string --fieldName bankItems
            if (StringUtils.isNotBlank(extraMessage.getBankItems())) {
                List<OpenBankInfo> openBankInfos = openBankInfoService.getOpenBankInfosNews(enterprise.getId());
                if (null != openBankInfos && !openBankInfos.isEmpty()) {
                    session.setAttribute("webopenBankInfo", openBankInfos.get(0));
                }
            }
            // 法人认证项
            if (StringUtils.isNotBlank(extraMessage.getIdentityCardItems())) {
                List<IdentityCard> identityCards = identityCardService.getIdentityCardsNews(enterprise.getId());
                if (null != identityCards && !identityCards.isEmpty()) {
                    session.setAttribute("webidentityCard", identityCards.get(0));
                }
            }
        }
    // logo和应用介绍信息,通过类似后台的回显方式进行加载
    } catch (Exception e) {
    // TODO: handle exception
    }
    return "client/querendingdan";
}
Also used : UserInfo(com.itrus.portal.db.UserInfo) OpenBankInfo(com.itrus.portal.db.OpenBankInfo) IdentityCard(com.itrus.portal.db.IdentityCard) Ereceipt(com.itrus.portal.db.Ereceipt) Agent(com.itrus.portal.db.Agent) HttpSession(javax.servlet.http.HttpSession) ExtraProductSpec(com.itrus.portal.db.ExtraProductSpec) IOException(java.io.IOException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) ExtraProduct(com.itrus.portal.db.ExtraProduct) OrgCode(com.itrus.portal.db.OrgCode) BusinessLicense(com.itrus.portal.db.BusinessLicense) ServiceProvider(com.itrus.portal.db.ServiceProvider) Enterprise(com.itrus.portal.db.Enterprise) UserinfoEnterprise(com.itrus.portal.db.UserinfoEnterprise) ExtraMessage(com.itrus.portal.db.ExtraMessage) TaxRegisterCert(com.itrus.portal.db.TaxRegisterCert) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with Ereceipt

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

the class UnlockKeyBillController method getUnlockProducts.

/**
 * 返回key对应的解锁产品列表
 *		1.证书有绑定的用户,用户选择自助解锁,不需要进行短信码校验,直接提交
 *		2.证书有绑定的用户,用户选择人工解锁(因为之前绑定的手机号可能没有了),进行短信校验后提交
 *		3.证书没有绑定的用户,用户只能选择人工解锁(后台不返回自助解锁的产品了),进行短信码校验后,直接提交
 * @param CertSn
 * @param keySn
 * @param uiModel
 * @param request
 * @return
 */
@RequestMapping("/getUnlockProducts")
public String getUnlockProducts(@RequestParam(value = "certBase64", required = true) String certBase64, @RequestParam("certSn") String certSn, @RequestParam("keySn") String keySn, @RequestParam("enterpriseName") String enterpriseName, Model uiModel, HttpServletRequest request) {
    UserCert userCert = userCertService.getUserCertByCertSn(certSn);
    if (null == userCert) {
        uiModel.addAttribute("errorMsg", "该证书尚未注册,请先注册后在使用");
        return ComNames.CLIENTFW_ERRORPAGE;
    }
    // if (null == userCert.getUserinfo()) {
    // uiModel.addAttribute("errorMsg", "该证书尚未绑定用户,请先绑定后再使用");
    // return ComNames.CLIENTFW_ERRORPAGE;
    // }
    UserInfo webUserInfo = null;
    uiModel.addAttribute("has_userInfo", 0);
    if (null != userCert.getUserinfo()) {
        webUserInfo = userInfoService.selectByPrimaryKey(userCert.getUserinfo());
        uiModel.addAttribute("userInfo", webUserInfo);
        uiModel.addAttribute("mPhone", webUserInfo.getmPhone());
        uiModel.addAttribute("has_userInfo", 1);
    }
    Enterprise enterprise = enterpriseService.getEntByName(enterpriseName);
    uiModel.addAttribute("has_enterpriseInfo", 0);
    if (null != enterprise) {
        uiModel.addAttribute("enterprise", enterprise);
        uiModel.addAttribute("has_enterpriseInfo", 1);
    }
    ProjectKeyInfo projectKeyInfo = cacheCustomer.findProjectByKey(keySn);
    if (null == projectKeyInfo) {
        uiModel.addAttribute("errorMsg", "无法识别该key:" + keySn + ", 请联系系统管理员");
        return ComNames.CLIENTFW_ERRORPAGE;
    }
    Project project = projectService.selectByPrimaryKey(projectKeyInfo.getProject());
    List<Product> products = productService.getKeyUnlockProducts(project.getId(), userCert.getUserinfo());
    if (null == products || products.isEmpty()) {
        uiModel.addAttribute("errorMsg", "key序列号为:" + keySn + " 对应的解锁产品不存在, 请联系系统管理员进行处理");
        return ComNames.CLIENTFW_ERRORPAGE;
    }
    uiModel.addAttribute("products", products);
    // 电子开票服务
    Long[] ereceiptIds = StringTools.getLong(products.get(0).geteBill());
    Map<Long, Ereceipt> ereceiptMap = ereceiptService.getEreceiptMap(ereceiptIds);
    if (null == products.get(0).geteBill()) {
        uiModel.addAttribute("ereceiptMapSize", 0);
    }
    uiModel.addAttribute("ereceiptMap", ereceiptMap);
    return "clientFW/unlock_out";
}
Also used : Ereceipt(com.itrus.portal.db.Ereceipt) Project(com.itrus.portal.db.Project) ProjectKeyInfo(com.itrus.portal.db.ProjectKeyInfo) Enterprise(com.itrus.portal.db.Enterprise) UserinfoEnterprise(com.itrus.portal.db.UserinfoEnterprise) Product(com.itrus.portal.db.Product) UserInfo(com.itrus.portal.db.UserInfo) UserCert(com.itrus.portal.db.UserCert) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with Ereceipt

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

the class UnlockKeyBillController method getUnlockProductsByLogin.

/**
 * 用户登录后点击解锁,返回key对应的解锁产品列表
 * @param CertSn
 * @param keySn
 * @param uiModel
 * @param request
 * @return
 */
@RequestMapping(value = "/getUnlockProductsByLogin")
public String getUnlockProductsByLogin(@RequestParam("certSn") String certSn, @RequestParam("keySn") String keySn, Model uiModel, HttpServletRequest request) {
    UserCert userCert = userCertService.getUserCertByCertSn(certSn);
    if (null == userCert) {
        uiModel.addAttribute("errorMsg", "该证书尚未注册,请先注册后在使用");
        return ComNames.CLIENTFW_ERRORPAGE;
    }
    UserInfo webUserInfo = (UserInfo) request.getSession().getAttribute(ComNames.WEB_USER_INFO);
    if (null == webUserInfo) {
        uiModel.addAttribute("errorMsg", "登录已经失效,请重新登录");
        return ComNames.CLIENTFW_ERRORPAGE;
    }
    Enterprise enterprise = (Enterprise) request.getSession().getAttribute(ComNames.WEB_ENTERPRISE);
    if (null == enterprise) {
        uiModel.addAttribute("errorMsg", "登录已经失效,请重新登录");
        return ComNames.CLIENTFW_ERRORPAGE;
    }
    ProjectKeyInfo projectKeyInfo = cacheCustomer.findProjectByKey(keySn);
    if (null == projectKeyInfo) {
        uiModel.addAttribute("errorMsg", "无法识别该key:" + keySn + ", 请联系系统管理员");
        return ComNames.CLIENTFW_ERRORPAGE;
    }
    HttpSession session = request.getSession();
    Integer has_enterpriseInfoInsession = (Integer) session.getAttribute("has_enterpriseInfo");
    Integer hhas_userInfoInsession = (Integer) session.getAttribute("has_userInfo");
    if (null == hhas_userInfoInsession) {
        uiModel.addAttribute("has_userInfo", 0);
        if (null != userCert.getUserinfo()) {
            webUserInfo = userInfoService.selectByPrimaryKey(userCert.getUserinfo());
            uiModel.addAttribute("userInfo", webUserInfo);
            uiModel.addAttribute("mPhone", webUserInfo.getmPhone());
            uiModel.addAttribute("has_userInfo", 1);
        }
    }
    if (null == has_enterpriseInfoInsession) {
        uiModel.addAttribute("has_enterpriseInfo", 0);
        if (null != enterprise) {
            uiModel.addAttribute("enterprise", enterprise);
            uiModel.addAttribute("has_enterpriseInfo", 1);
        }
    }
    Project project = projectService.selectByPrimaryKey(projectKeyInfo.getProject());
    List<Product> products = productService.getKeyUnlockProducts(project.getId(), userCert.getUserinfo());
    if (null == products || products.isEmpty()) {
        uiModel.addAttribute("errorMsg", "key序列号为:" + keySn + " 对应的解锁产品不存在, 请联系系统管理员进行处理");
        return ComNames.CLIENTFW_ERRORPAGE;
    }
    uiModel.addAttribute("products", products);
    uiModel.addAttribute("mPhone", webUserInfo.getmPhone());
    // 电子开票服务
    Long[] ereceiptIds = StringTools.getLong(products.get(0).geteBill());
    Map<Long, Ereceipt> ereceiptMap = ereceiptService.getEreceiptMap(ereceiptIds);
    if (null == products.get(0).geteBill()) {
        uiModel.addAttribute("ereceiptMapSize", 0);
    }
    uiModel.addAttribute("ereceiptMap", ereceiptMap);
    return "clientFW/unlock_out";
}
Also used : Ereceipt(com.itrus.portal.db.Ereceipt) ProjectKeyInfo(com.itrus.portal.db.ProjectKeyInfo) HttpSession(javax.servlet.http.HttpSession) Product(com.itrus.portal.db.Product) UserInfo(com.itrus.portal.db.UserInfo) Project(com.itrus.portal.db.Project) 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 5 with Ereceipt

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

the class ExtraBillWebController method showDetail.

/**
 * 增值订单详细接口
 *
 * @param id
 * @param processProgress 服务提供商
 *     1默认进度,2为内嵌页面
 * @param uiModel
 * @param request
 * @return
 */
@RequestMapping(value = "/bill/{id}.html", produces = "text/html")
public String showDetail(@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");
    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);
    // 企业
    Enterprise billEnterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bill.getEnterprise());
    if (StringUtils.isNotBlank(billEnterprise.getProvince())) {
        String province = sysRegionService.getProvince(billEnterprise.getProvince());
        billEnterprise.setProvince(province);
    }
    if (StringUtils.isNotBlank(billEnterprise.getCity())) {
        String city = sysRegionService.getCity(billEnterprise.getCity());
        billEnterprise.setCity(city);
    }
    uiModel.addAttribute("enterprise", billEnterprise);
    // 开户行信息
    OpenBankInfo openBankInfo = openBankInfoService.getOpenBankInfoByExtraBillId(id, null);
    uiModel.addAttribute("openBankInfo", openBankInfo);
    // 根据订单所处状态,返回不同的页面,或者先统一用一个页面.
    if (processProgress != null && processProgress.intValue() == 2) {
        return "client/banlijindu_neiqian";
    }
    return "client/banlijindu_moren";
}
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) OpenBankInfo(com.itrus.portal.db.OpenBankInfo) Enterprise(com.itrus.portal.db.Enterprise) OnlinePay(com.itrus.portal.db.OnlinePay) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

Ereceipt (com.itrus.portal.db.Ereceipt)13 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)11 Enterprise (com.itrus.portal.db.Enterprise)8 ExtraProduct (com.itrus.portal.db.ExtraProduct)8 ExtraProductSpec (com.itrus.portal.db.ExtraProductSpec)8 UserInfo (com.itrus.portal.db.UserInfo)8 OnlinePay (com.itrus.portal.db.OnlinePay)7 ServiceProvider (com.itrus.portal.db.ServiceProvider)6 Einvoice (com.itrus.portal.db.Einvoice)5 OnPayInfo (com.itrus.portal.db.OnPayInfo)5 HttpSession (javax.servlet.http.HttpSession)5 ExtraBill (com.itrus.portal.db.ExtraBill)4 OpenBankInfo (com.itrus.portal.db.OpenBankInfo)4 Project (com.itrus.portal.db.Project)4 Agent (com.itrus.portal.db.Agent)3 BusinessLicense (com.itrus.portal.db.BusinessLicense)3 ExtraMessage (com.itrus.portal.db.ExtraMessage)3 IdentityCard (com.itrus.portal.db.IdentityCard)3 OrgCode (com.itrus.portal.db.OrgCode)3 PayInfo (com.itrus.portal.db.PayInfo)3