Search in sources :

Example 1 with BillExample

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

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

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

the class SubmitReviewServiceImpl method getQueryBill.

/**
 * 根据产品list 获取送审中的订单(状态为10送审中 的所有订单list)
 *
 * @param productList
 * @return
 */
public Map<Long, List<Bill>> getQueryBill(List<Product> productList) {
    Map<Long, List<Bill>> billListMap = new HashMap<Long, List<Bill>>();
    if (null != productList && !productList.isEmpty()) {
        for (Product product : productList) {
            BillExample example = new BillExample();
            BillExample.Criteria criteria = example.or();
            criteria.andProductEqualTo(product.getId());
            criteria.andBillStatusEqualTo(ComNames.BILL_STATUS_10);
            // 时间逆序排列
            example.setOrderByClause("create_time asc");
            List<Bill> billList = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectByExample", example);
            if (null != billList && !billList.isEmpty()) {
                billListMap.put(product.getId(), billList);
            }
        }
    }
    return billListMap;
}
Also used : BillExample(com.itrus.portal.db.BillExample) HashMap(java.util.HashMap) Bill(com.itrus.portal.db.Bill) Product(com.itrus.portal.db.Product) ArrayList(java.util.ArrayList) List(java.util.List)

Example 4 with BillExample

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

the class BillServiceImpl method getBill.

/**
 * 获取对应的订单
 *
 * @param enterpriseId
 * @param userInfoId
 * @param billStatus
 * @return
 */
public Bill getBill(Long enterpriseId, Long userInfoId, List<Integer> billStatus) {
    BillExample example = new BillExample();
    BillExample.Criteria criteria = example.or();
    criteria.andEnterpriseEqualTo(enterpriseId);
    criteria.andUniqueIdEqualTo(userInfoId);
    criteria.andIsDeleteEqualTo(false);
    if (null != billStatus && !billStatus.isEmpty())
        criteria.andBillStatusIn(billStatus);
    example.setOrderByClause("create_time desc");
    example.setLimit(1);
    return sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByExample", example);
}
Also used : BillExample(com.itrus.portal.db.BillExample)

Example 5 with BillExample

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

the class BillServiceImpl method getBillByUnlockUserCertId.

/**
 * 根据用户证书id,获取对应的解锁订单,只获取最新的一张
 * @param userCertId
 * @return
 */
public Bill getBillByUnlockUserCertId(Long userCertId) {
    Bill bill = null;
    BillExample example = new BillExample();
    example.or().andUnlockUserCertEqualTo(userCertId);
    example.setLimit(1);
    example.setOrderByClause("create_time desc");
    bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByExample", example);
    return bill;
}
Also used : BillExample(com.itrus.portal.db.BillExample) Bill(com.itrus.portal.db.Bill)

Aggregations

BillExample (com.itrus.portal.db.BillExample)21 Bill (com.itrus.portal.db.Bill)18 Product (com.itrus.portal.db.Product)10 HashMap (java.util.HashMap)8 Enterprise (com.itrus.portal.db.Enterprise)7 UserInfo (com.itrus.portal.db.UserInfo)7 ArrayList (java.util.ArrayList)7 Date (java.util.Date)6 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)5 DigitalCert (com.itrus.portal.db.DigitalCert)4 OnPayInfo (com.itrus.portal.db.OnPayInfo)4 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)4 Map (java.util.Map)4 TransactionStatus (org.springframework.transaction.TransactionStatus)4 DefaultTransactionDefinition (org.springframework.transaction.support.DefaultTransactionDefinition)4 JSONObject (com.alibaba.fastjson.JSONObject)3 Agent (com.itrus.portal.db.Agent)3 ApplicationInfo (com.itrus.portal.db.ApplicationInfo)3 ApplicationInfoExample (com.itrus.portal.db.ApplicationInfoExample)3 BusinessLicense (com.itrus.portal.db.BusinessLicense)3