use of com.itrus.portal.db.ExtraProduct in project portal by ixinportal.
the class ExtraProductReleaseController method createForm.
// 新增页面
@RequestMapping(params = "form", produces = "text/html")
public String createForm(Model uimModel) throws Exception {
List<Project> projects = new ArrayList<>();
projects = projectService.getProjectByExample(null);
// 移除已经有了关联关系的项目
Iterator<Project> iterator = projects.iterator();
while (iterator.hasNext()) {
Project project = iterator.next();
List<ExtraProductRelease> extraProductReleases = new ArrayList<>();
extraProductReleases = extraProductReleaseService.getByprojectId(project.getId());
if (null != extraProductReleases && !extraProductReleases.isEmpty()) {
iterator.remove();
}
}
uimModel.addAttribute("projects", projects);
// 所有的增值产品信息,以id为主键.以便页面显示信息
Map<Long, ExtraProduct> extraProductMap = new HashMap<Long, ExtraProduct>();
extraProductMap = extraProductService.selectMapByExample(null);
// 所有的产品
uimModel.addAttribute("extraProductMap", extraProductMap);
return "extraproductrelease/create";
}
use of com.itrus.portal.db.ExtraProduct in project portal by ixinportal.
the class ExtraQueryBillController method show.
// 显示详情
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) {
// 管理员项目权限
Long[] projectsOfAdmin = getProjectLongIdsOfAdmin();
List<Long> projectsOfAdminList = Arrays.asList(projectsOfAdmin);
ExtraBillExample billExample = new ExtraBillExample();
ExtraBillExample.Criteria criteria = billExample.or();
criteria.andIdEqualTo(id);
criteria.andProjectIn(projectsOfAdminList);
ExtraBill bill = sqlSession.selectOne("com.itrus.portal.db.ExtraBillMapper.selectByExample", billExample);
if (null == bill) {
uiModel.addAttribute("errorMsg", "未找到该订单");
return "status403";
}
uiModel.addAttribute("bill", bill);
// 项目
Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", bill.getProject());
uiModel.addAttribute("project", project);
// 企业
Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bill.getEnterprise());
if (StringUtils.isNotBlank(enterprise.getProvince())) {
String province = sysRegionService.getProvince(enterprise.getProvince());
enterprise.setProvince(province);
}
if (StringUtils.isNotBlank(enterprise.getCity())) {
String city = sysRegionService.getCity(enterprise.getCity());
enterprise.setCity(city);
}
uiModel.addAttribute("enterprise", enterprise);
// 产品
ExtraProduct product = sqlSession.selectOne("com.itrus.portal.db.ExtraProductMapper.selectByPrimaryKey", bill.getExtraProduct());
uiModel.addAttribute("product", product);
// 规格
ExtraProductSpec productSpec = sqlSession.selectOne("com.itrus.portal.db.ExtraProductSpecMapper.selectByPrimaryKey", bill.getExtraProductSpec());
uiModel.addAttribute("productSpec", productSpec);
// 服务商
ServiceProvider serviceProvider = serviceProviderService.selectByPrimaryKey(product.getServiceProvider());
uiModel.addAttribute("serviceProvider", serviceProvider);
// 用户
UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bill.getUniqueId());
uiModel.addAttribute("userInfo", userInfo);
// 第三方支付信息
OnPayInfo onPayInfo = sqlSession.selectOne("com.itrus.portal.db.OnPayInfoMapper.selectByPrimaryKey", bill.getOnPayInfo());
uiModel.addAttribute("onPayInfo", onPayInfo);
if (onPayInfo != null) {
// 在线支付信息
OnlinePay onlinePay = sqlSession.selectOne("com.itrus.portal.db.OnlinePayMapper.selectByPrimaryKey", onPayInfo.getOnlinePay());
uiModel.addAttribute("onlinePay", onlinePay);
}
// 电子发票
Einvoice einvoice = sqlSession.selectOne("com.itrus.portal.db.EinvoiceMapper.selectByPrimaryKey", bill.geteInvoice());
uiModel.addAttribute("einvoice", einvoice);
// 电子发票类型
if (einvoice != null && einvoice.geteReiceipt() != null) {
Ereceipt ereceipt = sqlSession.selectOne("com.itrus.portal.db.EreceiptMapper.selectByPrimaryKey", einvoice.geteReiceipt());
uiModel.addAttribute("ereceipt", ereceipt);
}
// 其他附加信息
// 营业执照
BusinessLicense businessLicense = businessService.getBusinessByExtraBillId(id, null);
uiModel.addAttribute("bl", businessLicense);
// 税务登记
TaxRegisterCert taxRegisterCert = taxCertService.getTaxRegisterCertByExtraBillId(id, null);
uiModel.addAttribute("trc", taxRegisterCert);
// 组织机构代码
OrgCode orgCode = orgCodeService.getOrgCodeByExtraBillId(id, null);
uiModel.addAttribute("oc", orgCode);
// 代理人
Agent agent = agentService.getAgentByExtraBillId(id, null);
uiModel.addAttribute("agent", agent);
// 开户行信息
OpenBankInfo openBankInfo = openBankInfoService.getOpenBankInfoByExtraBillId(id, null);
uiModel.addAttribute("obi", openBankInfo);
// 法人信息
IdentityCard identityCard = identityCardService.getIdentityCardByExtraBillId(id, null);
uiModel.addAttribute("ic", identityCard);
// TODO 还需要补充订单对应的附加信息和第三方回调信息
return "extrabill/show";
}
use of com.itrus.portal.db.ExtraProduct 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";
}
use of com.itrus.portal.db.ExtraProduct in project portal by ixinportal.
the class ExtraBillPayController method show.
// 显示详情
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel, @RequestParam(value = "payStatus", required = false) Integer payStatus) {
uiModel.addAttribute("payStatus", payStatus);
// 管理员项目权限
Long[] projectsOfAdmin = getProjectLongIdsOfAdmin();
List<Long> projectsOfAdminList = Arrays.asList(projectsOfAdmin);
ExtraBillExample billExample = new ExtraBillExample();
ExtraBillExample.Criteria criteria = billExample.or();
criteria.andIdEqualTo(id);
criteria.andProjectIn(projectsOfAdminList);
ExtraBill bill = sqlSession.selectOne("com.itrus.portal.db.ExtraBillMapper.selectByExample", billExample);
if (null == bill) {
uiModel.addAttribute("errorMsg", "未找到该订单");
return "status403";
}
uiModel.addAttribute("bill", bill);
// 项目
Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", bill.getProject());
uiModel.addAttribute("project", project);
// 企业
Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bill.getEnterprise());
uiModel.addAttribute("enterprise", enterprise);
// 产品
ExtraProduct product = sqlSession.selectOne("com.itrus.portal.db.ExtraProductMapper.selectByPrimaryKey", bill.getExtraProduct());
uiModel.addAttribute("product", product);
// 规格
ExtraProductSpec productSpec = sqlSession.selectOne("com.itrus.portal.db.ExtraProductSpecMapper.selectByPrimaryKey", bill.getExtraProductSpec());
uiModel.addAttribute("productSpec", productSpec);
// 服务商
ServiceProvider serviceProvider = serviceProviderService.selectByPrimaryKey(product.getServiceProvider());
uiModel.addAttribute("serviceProvider", serviceProvider);
// 用户
UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bill.getUniqueId());
uiModel.addAttribute("userInfo", userInfo);
// 第三方支付信息
OnPayInfo onPayInfo = sqlSession.selectOne("com.itrus.portal.db.OnPayInfoMapper.selectByPrimaryKey", bill.getOnPayInfo());
uiModel.addAttribute("onPayInfo", onPayInfo);
if (onPayInfo != null && onPayInfo.getOnlinePay() != null) {
// 在线支付
OnlinePay onlinePay = sqlSession.selectOne("com.itrus.portal.db.OnlinePayMapper.selectByPrimaryKey", onPayInfo.getOnlinePay());
uiModel.addAttribute("onlinePay", onlinePay);
}
// 电子发票
Einvoice einvoice = sqlSession.selectOne("com.itrus.portal.db.EinvoiceMapper.selectByPrimaryKey", bill.geteInvoice());
uiModel.addAttribute("einvoice", einvoice);
// 其他附加信息
// 营业执照
BusinessLicense businessLicense = businessService.getBusinessByExtraBillId(id, null);
uiModel.addAttribute("businessLicense", businessLicense);
// 税务登记
TaxRegisterCert taxRegisterCert = taxCertService.getTaxRegisterCertByExtraBillId(id, null);
uiModel.addAttribute("taxRegisterCert", taxRegisterCert);
// 组织机构代码
OrgCode orgCode = orgCodeService.getOrgCodeByExtraBillId(id, null);
uiModel.addAttribute("orgCode", orgCode);
// 代理人
Agent agent = agentService.getAgentByExtraBillId(id, null);
uiModel.addAttribute("agent", agent);
// 开户行信息
OpenBankInfo openBankInfo = openBankInfoService.getOpenBankInfoByExtraBillId(id, null);
uiModel.addAttribute("openBankInfo", openBankInfo);
// 法人信息
IdentityCard identityCard = identityCardService.getIdentityCardByExtraBillId(id, null);
uiModel.addAttribute("identityCard", identityCard);
// TODO 还需要补充订单对应的附加信息和第三方回调信息
return "extrabillpay/show";
}
use of com.itrus.portal.db.ExtraProduct in project portal by ixinportal.
the class AppController method loadImg.
/**
* 根据主键id和类型返回相对应的图片信息
* @param type 1 代表应用管理 2 代表增值应用
* @param id
* @param response
* @return
*/
@RequestMapping(value = "/getImage/{id}/{type}")
public String loadImg(@PathVariable(value = "type") Long type, @PathVariable(value = "id") Long id, HttpServletResponse response, Model uiModel) {
String img = null;
Long n = 1l;
OutputStream os = null;
FileInputStream fis = null;
try {
if (n.equals(type)) {
App app = sqlSession.selectOne("com.itrus.portal.db.AppMapper.selectByPrimaryKey", id);
if (null == app) {
return "status403";
}
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
img = app.getAppIcon();
if (img == null) {
return "status403";
}
File filePath = appService.getFilePathById(app.getId());
if (!filePath.exists()) {
filePath.mkdir();
}
File file = new File(filePath, img);
fis = new FileInputStream(file);
} else {
ExtraProduct extraProduct = extraProductService.selectByPrimaryKey(id);
if (null == extraProduct) {
uiModel.addAttribute("errorMsg", "增值产品不存在");
return "client/errorpage";
}
img = extraProduct.getAppLogo();
if (img == null) {
uiModel.addAttribute("errorMsg", "图片不存");
return null;
}
File filePath = extraProductService.getFilePathById(id);
if (!filePath.exists()) {
filePath.mkdir();
}
File file = new File(filePath, img);
fis = new FileInputStream(file);
}
byte[] bb = IOUtils.toByteArray(fis);
os = response.getOutputStream();
os.write(bb);
os.flush();
} catch (IOException e) {
// 未找到
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
// 关闭流!
try {
if (null != fis) {
fis.close();
}
if (null != os) {
os.close();
}
} catch (IOException e) {
}
}
return null;
}
Aggregations