use of com.itrus.portal.db.OpenBankInfoExample.Criteria 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";
}
Aggregations