Search in sources :

Example 11 with Enterprise

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

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

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

the class APIService method upload.

/**
 * 证件图片上传
 *
 * @param authHmac
 *            hmac签名值,采用HmacSHA1算法
 * @param appId
 *            应用标识
 * @param orderNumber
 *            申请流水号
 * @param image1
 *            证件图片, base64形式
 * @param image2
 *            证件图片反面, base64形式(法定代表人和代理人证件类型为身份证时,必填)
 * @param type
 *            图片类型 1.营业执照或事业单位法人证书 2.组织机构代码证 3.税务登记证 4.法定代表人证件 5.代理人证件 6.授权书
 * @return
 */
@PostMapping(value = "/auth/upload")
@ResponseBody
public Map<String, Object> upload(@RequestHeader("Content-Signature") String authHmac, @RequestParam(value = "appId", required = false) String appId, @RequestParam(value = "orderNumber", required = false) String orderNumber, @RequestParam(value = "image1", required = false) String image1, @RequestParam(value = "image2", required = false) String image2, @RequestParam(value = "type", required = false) String type, HttpServletRequest request) {
    Map<String, Object> result = new HashMap<String, Object>();
    result.put("status", 0);
    // 验证参数是否完整
    if (StringUtils.isEmpty(authHmac) || StringUtils.isEmpty(appId) || StringUtils.isEmpty(type) || StringUtils.isEmpty(orderNumber) || StringUtils.isEmpty(image1)) {
        result.put("message", "提交的参数信息不完整");
        return result;
    }
    try {
        Bill bill = billService.getBillByOrderNumber(orderNumber);
        if (bill == null) {
            result.put("message", "申请流水号不存在");
            return result;
        }
        UserInfo userInfo = userInfoService.getUserInfoByBillId(bill.getId());
        // 得到应用信息 改成service
        Map<String, ApplicationInfo> appInfoMap = CacheCustomer.getAPP_INFO_MAP();
        ApplicationInfo applicationInfo = appInfoMap.get(appId);
        if (applicationInfo == null) {
            ApplicationInfoExample applicationInfoExample = new ApplicationInfoExample();
            ApplicationInfoExample.Criteria appInfoExampleCriteria = applicationInfoExample.createCriteria();
            appInfoExampleCriteria.andAppIdEqualTo(appId);
            applicationInfo = sqlSession.selectOne("com.itrus.portal.db.ApplicationInfoMapper.selectByExample", applicationInfoExample);
        }
        if (applicationInfo == null) {
            result.put("message", "应用标识不存在");
            return result;
        }
        if (!applicationInfo.getAccessIp().contains(request.getRemoteAddr()) && "1".equals(applicationInfo.getIsIpStatus())) {
            result.put("status", -1);
            result.put("message", "没有此服务权限");
            log.error("APIService_AccsessIp : " + request.getRemoteAddr());
            return result;
        }
        // 验证hmac有效性
        try {
            String macVal = CertService.hmacSha1(applicationInfo.getSecretKey().getBytes(), (appId + orderNumber + image1 + image2 + type).getBytes("utf-8"));
            // sc.getAddressKey()), false);
            if (!authHmac.equals("HMAC-SHA1 " + macVal)) {
                result.put("status", -2);
                result.put("message", "服务密钥错误");
                return result;
            }
        } catch (Exception e) {
            result.put("status", -3);
            result.put("message", "Hmac验证错误");
            e.printStackTrace();
            return result;
        }
        Enterprise enterprise = enterpriseService.getEnterpriseById(bill.getEnterprise());
        // 1、订单状态为:未支付、支付待确认、已支付待审核、送审中的状态,其余状态不能继续往下执行
        List<Integer> modifiedStatus = new ArrayList<Integer>();
        modifiedStatus.add(ComNames.BILL_STATUS_3);
        modifiedStatus.add(ComNames.BILL_STATUS_4);
        modifiedStatus.add(ComNames.BILL_STATUS_10);
        // 不在以上状态中
        if (modifiedStatus.indexOf(bill.getBillStatus()) == -1) {
            result.put("message", "该订单不能上传图片");
            return result;
        }
        // 1.营业执照或事业单位法人证书 2.组织机构代码证 3.税务登记证 4.法定代表人证件 5.代理人证件 6.授权书
        if (type.equals("1")) {
            BusinessLicense lc = businessService.getBusinessByBillId(bill.getId(), null);
            if (lc == null) {
                result.put("message", "不需要上传营业执照或(事业单位)法人证书图片");
                return result;
            }
            BusinessLicense business = businessService.portUpdateBusiness(bill.getId(), enterprise.getEnterpriseSn(), image1);
            if (business == null) {
                result.put("message", "营业执照或(事业单位)法人证书图片上传失败");
                return result;
            }
            result.put("status", 1);
            result.put("message", "营业执照或(事业单位)法人证书图片图片上传成功");
            return result;
        } else if (type.equals("2")) {
            OrgCode oc = orgCodeService.getOrgCodeByBillId(bill.getId(), null);
            if (oc == null) {
                result.put("message", "不需要上传组织机构代码证书图片");
                return result;
            }
            OrgCode orgCode = orgCodeService.portUpdateOrgCode(bill.getId(), enterprise.getEnterpriseSn(), image1);
            if (orgCode == null) {
                result.put("message", "组织机构代码证书图片上传失败");
                return result;
            }
            result.put("status", 1);
            result.put("message", "组织机构代码证书图片上传成功");
            return result;
        } else if (type.equals("3")) {
            TaxRegisterCert tc = taxCertService.getTaxRegisterCertByBillId(bill.getId(), null);
            if (tc == null) {
                result.put("message", "不需要上传税务登记证图片");
                return result;
            }
            TaxRegisterCert taxRegisterCert = taxCertService.portUpdateTaxCert(bill.getId(), enterprise.getEnterpriseSn(), image1);
            if (taxRegisterCert == null) {
                result.put("message", "税务登记证图片上传失败");
                return result;
            }
            result.put("status", 1);
            result.put("message", "税务登记证图片上传成功");
            return result;
        } else if (type.equals("4")) {
            IdentityCard ic = identityCardService.getIdentityCardByBillId(bill.getId(), null);
            if (ic == null) {
                result.put("message", "不需要上传法定代表人证件图片");
                return result;
            }
            if (ic.getCardType().equals(1) && StringUtils.isEmpty(image2)) {
                result.put("message", "提交的参数信息不完整");
                return result;
            }
            IdentityCard identityCard = identityCardService.portUpdateIdentityCard(bill.getId(), enterprise.getEnterpriseSn(), image1, image2);
            if (identityCard == null) {
                result.put("message", "法定代表人证件图片上传失败");
                return result;
            }
            result.put("status", 1);
            result.put("message", "法定代表人证件图片上传成功");
            return result;
        } else if (type.equals("5")) {
            Agent at = agentService.getAgentByBillId(bill.getId(), null);
            if (at == null) {
                result.put("message", "不需要上传代理人证件图片");
                return result;
            }
            if (at.getCardType().equals(1) && StringUtils.isEmpty(image2)) {
                result.put("message", "提交的参数信息不完整");
                return result;
            }
            Agent agent = agentService.portUpdateAgent(bill.getId(), enterprise.getEnterpriseSn(), image1, image2);
            if (agent == null) {
                result.put("message", "代理人证件图片上传失败");
                return result;
            }
            result.put("status", 1);
            result.put("message", "代理人证件图片上传成功");
            return result;
        } else if (type.equals("6")) {
            Proxy py = proxyService.getProxyByBillId(bill.getId());
            if (py == null) {
                result.put("message", "不需要上传授权书图片");
                return result;
            }
            Proxy proxy = proxyService.portUpdateProxy(bill.getId(), userInfo.getUniqueId(), image1);
            if (proxy == null) {
                result.put("message", "授权书图片上传失败");
                return result;
            }
            result.put("status", 1);
            result.put("message", "授权书图片上传成功");
            return result;
        } else {
            result.put("message", "图片类型参数输入有误");
            return result;
        }
    } catch (Exception e) {
        e.printStackTrace();
        if (e.getMessage().contains("图片大小不能")) {
            result.put("status", 0);
            result.put("message", e.getMessage());
            return result;
        }
        // TODO Auto-generated catch block
        result.put("status", 0);
        result.put("message", "服务端出现未知错误,请联系管理员");
        return result;
    }
}
Also used : ApplicationInfoExample(com.itrus.portal.db.ApplicationInfoExample) Agent(com.itrus.portal.db.Agent) HashMap(java.util.HashMap) ApplicationInfo(com.itrus.portal.db.ApplicationInfo) ArrayList(java.util.ArrayList) UserInfo(com.itrus.portal.db.UserInfo) JSONException(org.json.JSONException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) OrgCode(com.itrus.portal.db.OrgCode) BusinessLicense(com.itrus.portal.db.BusinessLicense) Proxy(com.itrus.portal.db.Proxy) Bill(com.itrus.portal.db.Bill) Enterprise(com.itrus.portal.db.Enterprise) UserinfoEnterprise(com.itrus.portal.db.UserinfoEnterprise) JSONObject(com.alibaba.fastjson.JSONObject) TaxRegisterCert(com.itrus.portal.db.TaxRegisterCert) IdentityCard(com.itrus.portal.db.IdentityCard) PostMapping(org.springframework.web.bind.annotation.PostMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 14 with Enterprise

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

the class UserInfoController method detail.

/**
 * 查看用户详情
 *
 * @param id
 *            用户id
 * @param item
 *            用户关联的项(0企业、1证书、2订单、3认证)
 * @param page
 * @param size
 * @param uiModel
 * @return
 */
@RequestMapping("/detail")
public String detail(@RequestParam(value = "id", required = true) Long id, @RequestParam(value = "item", required = false) Integer item, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
    UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", id);
    // 判断查询的用户是否属于当前管理员所管理的范围
    Long[] manageProjectIds = getProjectLongIdsOfAdmin();
    // 默认不属于当前管理员管理范围
    boolean flag = false;
    for (Long projectId : manageProjectIds) {
        if (userInfo.getProject() == projectId) {
            flag = true;
        }
    }
    if (!flag) {
        // 没有管理权限
        return "status403";
    }
    // 根据省市区code值获取省市区最新名称
    String regionCodes = userInfo.getRegionCodes();
    String userAdds = userInfo.getUserAdds();
    if (StringUtils.isNotBlank(regionCodes) && regionCodes.indexOf("@") >= 0) {
        String[] codes = regionCodes.split("@");
        String regionName = sysRegionService.getAllName(codes[1], codes[2], codes[3]);
        userAdds = regionName + userAdds;
        userInfo.setUserAdds(userAdds);
    }
    uiModel.addAttribute("userInfo", userInfo);
    if (page == null || page < 1) {
        page = 1;
    }
    if (size == null || size < 1) {
        size = 10;
    }
    // 总记录数
    Integer count = 0;
    // 当前页记录数
    Integer itemcount = 0;
    // null、0关联企业,1证书信息,2订单列表
    if (null == item || 0 == item) {
        item = 0;
        // 关联企业
        List<Enterprise> enterprises = new ArrayList<Enterprise>();
        List<Long> enterpriseIds = userInfoEnterpriseService.getEnterpriseByUserInfo(userInfo.getId());
        if (null != enterpriseIds && !enterpriseIds.isEmpty()) {
            count = enterpriseIds.size();
            EnterpriseExample enterpriseExample = new EnterpriseExample();
            EnterpriseExample.Criteria criteria = enterpriseExample.or();
            criteria.andIdIn(enterpriseIds);
            if (page > 1 && size * (page - 1) >= count) {
                page = (count + size - 1) / size;
            }
            Integer offset = size * (page - 1);
            enterpriseExample.setOffset(offset);
            enterpriseExample.setLimit(size);
            enterpriseExample.setOrderByClause("create_time desc");
            enterprises = sqlSession.selectList("com.itrus.portal.db.EnterpriseMapper.selectByExample", enterpriseExample);
        }
        itemcount = enterprises.size();
        uiModel.addAttribute("enterprises", enterprises);
    } else if (1 == item) {
        item = 1;
        // TODO 证书信息
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("id", userInfo.getId());
        count = sqlSession.selectOne("com.itrus.portal.db.UserCertMapper.countByUserInfoID", userInfo.getId());
        if (page > 1 && size * (page - 1) >= count) {
            page = (count + size - 1) / size;
        }
        Integer offset = size * (page - 1);
        map.put("offset", offset);
        map.put("limit", size);
        List<UserCert> userCertList = sqlSession.selectList("com.itrus.portal.db.UserCertMapper.selectByUserInfoID", map);
        itemcount = userCertList.size();
        uiModel.addAttribute("userCertList", userCertList);
    } else if (2 == item) {
        item = 2;
        // 订单列表
        BillExample billExample = new BillExample();
        BillExample.Criteria criteria = billExample.or();
        criteria.andUniqueIdEqualTo(userInfo.getId());
        // criteria.andIsDeleteEqualTo(false);
        count = sqlSession.selectOne("com.itrus.portal.db.BillMapper.countByExample", billExample);
        if (page > 1 && size * (page - 1) >= count) {
            page = (count + size - 1) / size;
        }
        Integer offset = size * (page - 1);
        billExample.setOffset(offset);
        billExample.setLimit(size);
        billExample.setOrderByClause("create_time desc");
        List<Bill> billList = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectByExample", billExample);
        itemcount = billList.size();
        uiModel.addAttribute("billList", billList);
        Map<Long, Project> projectMap = billService.getProjectMapByUserInfoId(userInfo.getId());
        uiModel.addAttribute("projectMap", projectMap);
        Map<Long, Product> productMap = billService.getProductMapByUserInfoId(userInfo.getId());
        uiModel.addAttribute("productMap", productMap);
        Map<Long, Enterprise> enterpriseMap = billService.getEnterpriseMapByUserInfoId(userInfo.getId());
        uiModel.addAttribute("enterpriseMap", enterpriseMap);
    } else if (3 == item) {
        item = 3;
        Agent agent = sqlSession.selectOne("com.itrus.portal.db.AgentMapper.selectNewAgentByUserId", id);
        uiModel.addAttribute("agent", agent);
    }
    uiModel.addAttribute("count", count);
    uiModel.addAttribute("pages", (count + size - 1) / size);
    uiModel.addAttribute("page", page);
    uiModel.addAttribute("size", size);
    uiModel.addAttribute("itemcount", itemcount);
    uiModel.addAttribute("item", item);
    return "userInfo/detail";
}
Also used : ArrayList(java.util.ArrayList) Product(com.itrus.portal.db.Product) UserInfo(com.itrus.portal.db.UserInfo) BillExample(com.itrus.portal.db.BillExample) ArrayList(java.util.ArrayList) List(java.util.List) Agent(com.itrus.portal.db.Agent) Project(com.itrus.portal.db.Project) EnterpriseExample(com.itrus.portal.db.EnterpriseExample) Enterprise(com.itrus.portal.db.Enterprise) Bill(com.itrus.portal.db.Bill) HashMap(java.util.HashMap) Map(java.util.Map) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 15 with Enterprise

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

the class CertificateServiceController method securityCenter.

// 选出当前用户当前企业的所有证书和证书所绑定的用户信息
@RequestMapping("/securityCenter")
public String securityCenter(@RequestParam(value = "certSn", required = false) String certSn, HttpSession session, Model uiModel) {
    UserInfo userInfos = (UserInfo) session.getAttribute(ComNames.WEB_USER_INFO);
    Enterprise enterprise = (Enterprise) session.getAttribute(ComNames.WEB_ENTERPRISE);
    if (null == userInfos || null == enterprise) {
        // 登录状态失效,跳转到注册页面
        return ComNames.DENG_LU_CLIENT;
    }
    if (StringUtils.isNotBlank(certSn) && certSn.length() > 10) {
        uiModel.addAttribute("certSn", certSn);
    } else if (null != session.getAttribute(ComNames.WEB_USER_CERT_SN)) {
        uiModel.addAttribute("certSn", session.getAttribute(ComNames.WEB_USER_CERT_SN));
    }
    Map param = new HashMap();
    param.put("userinfoid", userInfos.getId());
    param.put("enterpriseid", enterprise.getId());
    uiModel.addAttribute("userInfos", userInfos);
    uiModel.addAttribute("enterprise", enterprise);
    List<Map<String, Object>> userCertList = sqlSession.selectList("com.itrus.portal.db.UserCertMapper.selectByUserInfoAndEnterprise", param);
    if (null != userCertList && !userCertList.isEmpty()) {
        for (int i = 0; i < userCertList.size(); i++) {
            if (null != userCertList.get(i).get("bill_status") && (userCertList.get(i).get("bill_status").equals(ComNames.BILL_STATUS_8) || userCertList.get(i).get("bill_status").equals(ComNames.BILL_STATUS_7) || userCertList.get(i).get("bill_status").equals(ComNames.BILL_STATUS_6)) && userCertList.get(i).containsKey("renewBillId")) {
                // 状态为已完成的订单并且订单包含旧证书id
                Bill bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", userCertList.get(i).get("renewBillId"));
                if (null != bill.getOldUserCert()) {
                    UserCert oldUserCert = sqlSession.selectOne("com.itrus.portal.db.UserCertMapper.selectByPrimaryKey", bill.getOldUserCert());
                    userCertList.get(i).put("oldCertSn", oldUserCert.getCertSn());
                }
            }
        }
    }
    Map<Long, List<Map<String, Object>>> userCertMap = new HashMap();
    for (Map<String, Object> map : userCertList) {
        Long key = (Long) map.get("product");
        List<Map<String, Object>> list = null;
        if (userCertMap.containsKey(key)) {
            list = userCertMap.get(key);
        } else {
            list = new ArrayList<>();
        }
        list.add(map);
        userCertMap.put(key, list);
    }
    uiModel.addAttribute("userCertMap", userCertMap);
    try {
        String usercertsString = jsonTool.writeValueAsString(userCertList);
        uiModel.addAttribute("usercerts", usercertsString);
        List<String> allIssUerDn = new ArrayList<String>();
        allIssUerDn = sqlSession.selectList("com.itrus.portal.db.CrlContextMapper.selectAllIssUerDn");
        uiModel.addAttribute("allIssUerDn", jsonTool.writeValueAsString(allIssUerDn));
    } catch (JsonGenerationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (JsonMappingException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return "clientFW/zhengshufuwu";
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) UserInfo(com.itrus.portal.db.UserInfo) IOException(java.io.IOException) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) Enterprise(com.itrus.portal.db.Enterprise) Bill(com.itrus.portal.db.Bill) ArrayList(java.util.ArrayList) List(java.util.List) JsonGenerationException(org.codehaus.jackson.JsonGenerationException) HashMap(java.util.HashMap) Map(java.util.Map) UserCert(com.itrus.portal.db.UserCert) 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