Search in sources :

Example 1 with UserInfoExample

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

the class EnterpriseController method updateEnterpriseUI.

/**
 * 修改企业信息
 *
 * @return
 */
@RequestMapping(value = "/updateEnterpriseUI/{id}")
public String updateEnterpriseUI(@PathVariable("id") Long id, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
    Enterprise enterprise = enterpriseService.getEnterpriseById(id);
    if (null == enterprise) {
        return "status403";
    }
    uiModel.addAttribute("enterprise", enterprise);
    if (page == null || page < 1) {
        page = 1;
    }
    if (size == null || size < 1) {
        size = 10;
    }
    // 总记录数
    Integer count = 0;
    // 当前页记录数
    Integer itemcount = 0;
    // 查询企业关联的用户
    List<UserInfo> userInfos = new ArrayList<UserInfo>();
    List<Long> userInfoIds = userInfoEnterpriseService.getUserInfoByEnterprise(enterprise.getId());
    if (null != userInfoIds && !userInfoIds.isEmpty()) {
        count = userInfoIds.size();
        UserInfoExample userInfoExample = new UserInfoExample();
        UserInfoExample.Criteria criteria = userInfoExample.or();
        criteria.andIdIn(userInfoIds);
        if (page > 1 && size * (page - 1) >= count) {
            page = (count + size - 1) / size;
        }
        Integer offset = size * (page - 1);
        userInfoExample.setOffset(offset);
        userInfoExample.setLimit(size);
        userInfoExample.setOrderByClause("create_time desc");
        userInfos = sqlSession.selectList("com.itrus.portal.db.UserInfoMapper.selectByExample", userInfoExample);
    }
    itemcount = userInfos.size();
    uiModel.addAttribute("userInfos", userInfos);
    uiModel.addAttribute("count", count);
    uiModel.addAttribute("pages", (count + size - 1) / size);
    uiModel.addAttribute("page", page);
    uiModel.addAttribute("size", size);
    uiModel.addAttribute("itemcount", itemcount);
    return "enterprise/update";
}
Also used : UserInfoExample(com.itrus.portal.db.UserInfoExample) Enterprise(com.itrus.portal.db.Enterprise) ArrayList(java.util.ArrayList) UserInfo(com.itrus.portal.db.UserInfo) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with UserInfoExample

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

the class EnterpriseController method detail.

@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) {
    Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", id);
    if (null == enterprise) {
        return "status403";
    }
    uiModel.addAttribute("enterprise", enterprise);
    if (page == null || page < 1) {
        page = 1;
    }
    if (size == null || size < 1) {
        size = 10;
    }
    // 总记录数
    Integer count = 0;
    // 当前页记录数
    Integer itemcount = 0;
    // ===0认证信息、1关联用户、2订单列表
    if (null == item || 0 == item) {
        item = 0;
        // 认证信息
        BusinessLicense businessLicense = null;
        OrgCode orgCode = null;
        TaxRegisterCert taxRegisterCert = null;
        IdentityCard identityCard = null;
        if (null != enterprise.getAuthenticationLevel()) {
            // 审核通过:
            // 获取企业的认证等级
            Certification certification = sqlSession.selectOne("com.itrus.portal.db.CertificationMapper.selectByPrimaryKey", enterprise.getAuthenticationLevel());
            uiModel.addAttribute("certification", certification);
        }
        if (null != enterprise.getHasBl()) {
            businessLicense = sqlSession.selectOne("com.itrus.portal.db.BusinessLicenseMapper.selectByPrimaryKey", enterprise.getHasBl());
        }
        if (null != enterprise.getHasOrgCode()) {
            orgCode = sqlSession.selectOne("com.itrus.portal.db.OrgCodeMapper.selectByPrimaryKey", enterprise.getHasOrgCode());
        }
        if (null != enterprise.getHasTaxCert()) {
            taxRegisterCert = sqlSession.selectOne("com.itrus.portal.db.TaxRegisterCertMapper.selectByPrimaryKey", enterprise.getHasTaxCert());
        }
        if (null != enterprise.getHasIdCard()) {
            identityCard = sqlSession.selectOne("com.itrus.portal.db.IdentityCardMapper.selectByPrimaryKey", enterprise.getHasIdCard());
        }
        uiModel.addAttribute("businessLicense", businessLicense);
        uiModel.addAttribute("orgCode", orgCode);
        uiModel.addAttribute("taxRegisterCert", taxRegisterCert);
        uiModel.addAttribute("identityCard", identityCard);
        // 查询增值订单中开户行信息
        OpenBankInfoExample obie = new OpenBankInfoExample();
        Criteria obiec = obie.createCriteria();
        obiec.andEnterpriseEqualTo(enterprise.getId());
        obie.setOrderByClause("create_time desc");
        List<OpenBankInfo> openBankInfos = sqlSession.selectList("com.itrus.portal.db.OpenBankInfoMapper.selectByExample", obie);
        if (openBankInfos != null && openBankInfos.size() > 0) {
            uiModel.addAttribute("openBankInfos", openBankInfos);
        }
    } else if (1 == item) {
        item = 1;
        // 关联用户
        List<UserInfo> userInfos = new ArrayList<UserInfo>();
        List<Long> userInfoIds = userInfoEnterpriseService.getUserInfoByEnterprise(enterprise.getId());
        if (null != userInfoIds && !userInfoIds.isEmpty()) {
            count = userInfoIds.size();
            UserInfoExample userInfoExample = new UserInfoExample();
            UserInfoExample.Criteria criteria = userInfoExample.or();
            criteria.andIdIn(userInfoIds);
            if (page > 1 && size * (page - 1) >= count) {
                page = (count + size - 1) / size;
            }
            Integer offset = size * (page - 1);
            userInfoExample.setOffset(offset);
            userInfoExample.setLimit(size);
            userInfoExample.setOrderByClause("create_time desc");
            userInfos = sqlSession.selectList("com.itrus.portal.db.UserInfoMapper.selectByExample", userInfoExample);
        }
        itemcount = userInfos.size();
        uiModel.addAttribute("userInfos", userInfos);
    } else if (2 == item) {
        item = 2;
        // 订单列表
        BillExample billExample = new BillExample();
        BillExample.Criteria criteria = billExample.or();
        criteria.andEnterpriseEqualTo(enterprise.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.getProjectMapByEnterpriseId(enterprise.getId());
        uiModel.addAttribute("projectMap", projectMap);
        Map<Long, Product> productMap = billService.getProductMapByEnterpriseId(enterprise.getId());
        uiModel.addAttribute("productMap", productMap);
        Map<Long, UserInfo> userInfoMap = billService.getUserInfoMapByEnterpriseId(enterprise.getId());
        uiModel.addAttribute("userInfoMap", userInfoMap);
    } else if (3 == item) {
        item = 3;
        // 增值订单列表
        ExtraBillExample extraBillExample = new ExtraBillExample();
        ExtraBillExample.Criteria criteria = extraBillExample.or();
        criteria.andEnterpriseEqualTo(enterprise.getId());
        criteria.andIsDeleteEqualTo(false);
        count = sqlSession.selectOne("com.itrus.portal.db.ExtraBillMapper.countByExample", extraBillExample);
        if (page > 1 && size * (page - 1) >= count) {
            page = (count + size - 1) / size;
        }
        Integer offset = size * (page - 1);
        extraBillExample.setOffset(offset);
        extraBillExample.setLimit(size);
        extraBillExample.setOrderByClause("create_time desc");
        List<ExtraBill> extraBillList = sqlSession.selectList("com.itrus.portal.db.ExtraBillMapper.selectByExample", extraBillExample);
        itemcount = extraBillList.size();
        uiModel.addAttribute("billList", extraBillList);
        Map<Long, Project> projectMap = extraBillService.getProjectMapByEnterpriseId(enterprise.getId());
        uiModel.addAttribute("projectMap", projectMap);
        Map<Long, ExtraProduct> productMap = extraBillService.getProductMapByEnterpriseId(enterprise.getId());
        uiModel.addAttribute("productMap", productMap);
        Map<Long, UserInfo> userInfoMap = extraBillService.getUserInfoMapByEnterpriseId(enterprise.getId());
        uiModel.addAttribute("userInfoMap", userInfoMap);
    }
    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 "enterprise/detail";
}
Also used : Product(com.itrus.portal.db.Product) ExtraProduct(com.itrus.portal.db.ExtraProduct) UserInfo(com.itrus.portal.db.UserInfo) Criteria(com.itrus.portal.db.OpenBankInfoExample.Criteria) OpenBankInfo(com.itrus.portal.db.OpenBankInfo) BillExample(com.itrus.portal.db.BillExample) ExtraBillExample(com.itrus.portal.db.ExtraBillExample) ArrayList(java.util.ArrayList) List(java.util.List) IdentityCard(com.itrus.portal.db.IdentityCard) UserInfoExample(com.itrus.portal.db.UserInfoExample) Certification(com.itrus.portal.db.Certification) ExtraBillExample(com.itrus.portal.db.ExtraBillExample) OrgCode(com.itrus.portal.db.OrgCode) Project(com.itrus.portal.db.Project) BusinessLicense(com.itrus.portal.db.BusinessLicense) Enterprise(com.itrus.portal.db.Enterprise) ExtraBill(com.itrus.portal.db.ExtraBill) Bill(com.itrus.portal.db.Bill) OpenBankInfoExample(com.itrus.portal.db.OpenBankInfoExample) HashMap(java.util.HashMap) Map(java.util.Map) TaxRegisterCert(com.itrus.portal.db.TaxRegisterCert) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with UserInfoExample

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

the class UserInfoController method list.

/**
 * 用户列表
 *
 * @param userSn
 *            用户ID
 * @param mPhone
 *            手机号
 * @param userPosition
 *            所属岗位
 * @param realName
 *            真实姓名
 * @param email
 *            邮箱
 * @param page
 * @param size
 * @param queryDate1
 * @param queryDate2
 * @param uiModel
 * @return
 */
@RequestMapping(produces = "text/html")
public String list(@RequestParam(value = "userSn", required = false) String userSn, @RequestParam(value = "mPhone", required = false) String mPhone, @RequestParam(value = "userPosition", required = false) String userPosition, @RequestParam(value = "realName", required = false) String realName, @RequestParam(value = "email", required = false) String email, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, @RequestParam(value = "queryDate1", required = false) Date queryDate1, @RequestParam(value = "queryDate2", required = false) Date queryDate2, Model uiModel) {
    if (queryDate1 == null && queryDate2 == null) {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DATE, 1);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        calendar.add(Calendar.MILLISECOND, -1);
        queryDate2 = calendar.getTime();
        calendar.add(Calendar.MILLISECOND, 1);
        calendar.add(Calendar.MONTH, -1);
        queryDate1 = calendar.getTime();
    }
    uiModel.addAttribute("userSn", userSn);
    uiModel.addAttribute("mPhone", mPhone);
    uiModel.addAttribute("userPosition", userPosition);
    uiModel.addAttribute("realName", realName);
    uiModel.addAttribute("email", email);
    uiModel.addAttribute("queryDate1", queryDate1);
    uiModel.addAttribute("queryDate2", queryDate2);
    if (page == null || page < 1) {
        page = 1;
    }
    if (size == null || size < 1) {
        size = 10;
    }
    // 只能查询当前管理员管理范围内的用户
    Long[] manageProjectIds = getProjectLongIdsOfAdmin();
    UserInfoExample userInfoExample = new UserInfoExample();
    UserInfoExample.Criteria criteria = userInfoExample.or();
    criteria.andProjectIn(Arrays.asList(manageProjectIds));
    // userSn
    if (StringUtils.isNotBlank(userSn)) {
        criteria.andUniqueIdLike("%" + userSn + "%");
    }
    // mPone
    if (StringUtils.isNotBlank(mPhone)) {
        criteria.andMPhoneLike("%" + mPhone + "%");
    }
    // userPosition
    if (StringUtils.isNotBlank(userPosition)) {
        criteria.andUserPositionLike("%" + userPosition + "%");
    }
    // realName
    if (StringUtils.isNotBlank(realName)) {
        criteria.andRealNameLike("%" + realName + "%");
    }
    // email
    if (StringUtils.isNotBlank(email)) {
        criteria.andEmailLike("%" + email + "%");
    }
    // queryDate1
    if (null != queryDate1) {
        criteria.andCreateTimeGreaterThanOrEqualTo(queryDate1);
    }
    if (null != queryDate2) {
        criteria.andCreateTimeLessThanOrEqualTo(queryDate2);
    }
    Integer count = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.countByExample", userInfoExample);
    if (page > 1 && size * (page - 1) >= count) {
        page = (count + size - 1) / size;
    }
    uiModel.addAttribute("count", count);
    uiModel.addAttribute("pages", (count + size - 1) / size);
    uiModel.addAttribute("page", page);
    uiModel.addAttribute("size", size);
    Integer offset = size * (page - 1);
    userInfoExample.setOffset(offset);
    userInfoExample.setLimit(size);
    userInfoExample.setOrderByClause("create_time desc");
    List<UserInfo> userInfoall = sqlSession.selectList("com.itrus.portal.db.UserInfoMapper.selectByExample", userInfoExample);
    uiModel.addAttribute("userInfoall", userInfoall);
    uiModel.addAttribute("itemcount", userInfoall.size());
    return "userInfo/list";
}
Also used : UserInfoExample(com.itrus.portal.db.UserInfoExample) Calendar(java.util.Calendar) UserInfo(com.itrus.portal.db.UserInfo) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with UserInfoExample

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

the class ExtraBillServiceImpl method getUserInfoMapByEnterpriseId.

/**
 * 根据企业id查询企业的所有代理人Map
 *
 * @param enterprise
 * @return
 */
public Map<Long, UserInfo> getUserInfoMapByEnterpriseId(Long enterprise) {
    Map<Long, UserInfo> enterpriseMap = new HashMap<Long, UserInfo>();
    List<Long> userInfoIds = sqlSession.selectList("com.itrus.portal.db.ExtraBillMapper.selectUserInfosByEnterprise", enterprise);
    if (null != userInfoIds && !userInfoIds.isEmpty()) {
        UserInfoExample example = new UserInfoExample();
        UserInfoExample.Criteria criteria = example.or();
        criteria.andIdIn(userInfoIds);
        enterpriseMap = sqlSession.selectMap("com.itrus.portal.db.UserInfoMapper.selectByExample", example, "id");
    }
    return enterpriseMap;
}
Also used : UserInfoExample(com.itrus.portal.db.UserInfoExample) HashMap(java.util.HashMap) UserInfo(com.itrus.portal.db.UserInfo)

Example 5 with UserInfoExample

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

the class BillServiceImpl method getUserInfoMapByEnterpriseId.

/**
 * 根据企业id查询企业的所有代理人Map
 *
 * @param enterprise
 * @return
 */
public Map<Long, UserInfo> getUserInfoMapByEnterpriseId(Long enterprise) {
    Map<Long, UserInfo> enterpriseMap = new HashMap<Long, UserInfo>();
    List<Long> userInfoIds = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectUserInfosByEnterprise", enterprise);
    if (null != userInfoIds && !userInfoIds.isEmpty()) {
        UserInfoExample example = new UserInfoExample();
        UserInfoExample.Criteria criteria = example.or();
        criteria.andIdIn(userInfoIds);
        enterpriseMap = sqlSession.selectMap("com.itrus.portal.db.UserInfoMapper.selectByExample", example, "id");
    }
    return enterpriseMap;
}
Also used : UserInfoExample(com.itrus.portal.db.UserInfoExample) HashMap(java.util.HashMap) UserInfo(com.itrus.portal.db.UserInfo)

Aggregations

UserInfo (com.itrus.portal.db.UserInfo)5 UserInfoExample (com.itrus.portal.db.UserInfoExample)5 HashMap (java.util.HashMap)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 Enterprise (com.itrus.portal.db.Enterprise)2 ArrayList (java.util.ArrayList)2 Bill (com.itrus.portal.db.Bill)1 BillExample (com.itrus.portal.db.BillExample)1 BusinessLicense (com.itrus.portal.db.BusinessLicense)1 Certification (com.itrus.portal.db.Certification)1 ExtraBill (com.itrus.portal.db.ExtraBill)1 ExtraBillExample (com.itrus.portal.db.ExtraBillExample)1 ExtraProduct (com.itrus.portal.db.ExtraProduct)1 IdentityCard (com.itrus.portal.db.IdentityCard)1 OpenBankInfo (com.itrus.portal.db.OpenBankInfo)1 OpenBankInfoExample (com.itrus.portal.db.OpenBankInfoExample)1 Criteria (com.itrus.portal.db.OpenBankInfoExample.Criteria)1 OrgCode (com.itrus.portal.db.OrgCode)1 Product (com.itrus.portal.db.Product)1 Project (com.itrus.portal.db.Project)1