use of com.itrus.portal.db.ServiceProvider in project portal by ixinportal.
the class ClientWebController method bugExtraProduct.
// TODO
// 用户选择了产品中的某个规格,确认进行购买,对应于确认订单:根据产品是否需要附加信息,来决定用户提交的资料,判断后台是否有这个用户对应的这些附加信息,如果有就返回给页面
@RequestMapping("/buyExtraProduct")
public String bugExtraProduct(@RequestParam(value = "productId", required = true) Long productId, @RequestParam(value = "productSpecId", required = true) Long productSpecId, @RequestParam(value = "buyNumber", required = true) Long buyNumber, HttpServletRequest request, Model uiModel) {
HttpSession session = request.getSession();
// 判断用户和企业信息是否存在了,不存在不能购买
Enterprise enterprise = (Enterprise) session.getAttribute("webenterprise");
UserInfo userInfo = (UserInfo) session.getAttribute("webuserInfo");
if (null == enterprise || null == userInfo) {
uiModel.addAttribute("errorMsg", "登录已经失效,请重新登录");
return "client/errorpage";
}
try {
ExtraProduct product = extraProductService.selectByPrimaryKey(productId);
if (null == product) {
uiModel.addAttribute("errorMsg", "增值产品不存在");
return "client/errorpage";
}
uiModel.addAttribute("extraproduct", product);
// 选择的规格信息
ExtraProductSpec extraProductSpec = extraProductSpecService.selectByPrimaryKey(productSpecId);
if (null == extraProductSpec) {
uiModel.addAttribute("errorMsg", "增值产品规格不存在");
return "client/errorpage";
}
uiModel.addAttribute("extraProductSpec", extraProductSpec);
// 用户购买的数量:选择应该默认都是1
uiModel.addAttribute("buyNumber", buyNumber);
// 产品对应的服务商信息
Long serviceProviderId = product.getServiceProvider();
ServiceProvider serviceProvider = serviceProviderService.selectByPrimaryKey(serviceProviderId);
uiModel.addAttribute("serviceProvider", serviceProvider);
// 电子发票信息,看后台配置该产品是否能开票
String eInvoceStr = product.getEinvoice();
if (StringUtils.isNotBlank(eInvoceStr)) {
// 电子开票服务
Long[] ereceiptIds = StringTools.getLong(product.getEinvoice());
Map<Long, Ereceipt> ereceiptMap = ereceiptService.getEreceiptMap(ereceiptIds);
uiModel.addAttribute("ereceiptMap", ereceiptMap);
}
// 附加信息
if (null != product.getExtraMessage()) {
ExtraMessage extraMessage = extraMessageService.selectByPrimaryKey(product.getExtraMessage());
// 用附加信息项的有无来判断是否需要用户填写附加信息,如果需要,则取附加信息项进行分割处理
uiModel.addAttribute("extraMessage", extraMessage);
// //企业信息 认证项(1.企业名称,2.统一社会信用代码/营业执照,3.组织机构代码,4.税务登记号)
if (StringUtils.isNotBlank(extraMessage.getEnterpriseItems())) {
if (StringUtils.isNotBlank(extraMessage.getEnterpriseItems())) {
if (extraMessage.getEnterpriseItems().contains("1")) {
}
if (extraMessage.getEnterpriseItems().contains("2")) {
List<BusinessLicense> businessLicenses = businessService.getBusinessLicensesNews(enterprise.getId());
if (null != businessLicenses && !businessLicenses.isEmpty()) {
session.setAttribute("webbusinessLicense", businessLicenses.get(0));
}
}
if (extraMessage.getEnterpriseItems().contains("3")) {
List<OrgCode> orgCodes = orgCodeService.getOrgCodesNews(enterprise.getId());
if (null != orgCodes && !orgCodes.isEmpty()) {
session.setAttribute("weborgCode", orgCodes.get(0));
}
}
if (extraMessage.getEnterpriseItems().contains("4")) {
List<TaxRegisterCert> taxRegisterCerts = taxCertService.getTaxRegisterCertsNews(enterprise.getId());
if (null != taxRegisterCerts && !taxRegisterCerts.isEmpty()) {
session.setAttribute("webtaxRegisterCert", taxRegisterCerts.get(0));
}
}
}
}
// field string --fieldName agentItems
if (StringUtils.isNotBlank(extraMessage.getAgentItems())) {
List<Agent> agents = agentService.getAgentsNews(enterprise.getId());
if (null != agents && !agents.isEmpty()) {
session.setAttribute("webagent", agents.get(0));
}
}
// field string --fieldName bankItems
if (StringUtils.isNotBlank(extraMessage.getBankItems())) {
List<OpenBankInfo> openBankInfos = openBankInfoService.getOpenBankInfosNews(enterprise.getId());
if (null != openBankInfos && !openBankInfos.isEmpty()) {
session.setAttribute("webopenBankInfo", openBankInfos.get(0));
}
}
// 法人认证项
if (StringUtils.isNotBlank(extraMessage.getIdentityCardItems())) {
List<IdentityCard> identityCards = identityCardService.getIdentityCardsNews(enterprise.getId());
if (null != identityCards && !identityCards.isEmpty()) {
session.setAttribute("webidentityCard", identityCards.get(0));
}
}
}
// logo和应用介绍信息,通过类似后台的回显方式进行加载
} catch (Exception e) {
// TODO: handle exception
}
return "client/querendingdan";
}
use of com.itrus.portal.db.ServiceProvider in project portal by ixinportal.
the class ClientWebController method choiceExtraProduct.
/**
* 用户点击购要购买某个产品,返回这个产品对应的信息.购买信息.对应于:应用详情页面
*
* @param productId
* ,增值产品id
* @param old_billId
* @param request
* @param uiModel
* @return
*/
@RequestMapping("/choiceExtraProduct")
public String choiceExtraProduct(@RequestParam(value = "productId", required = true) Long productId, // enterpriseId,
@RequestParam(value = "old_billId", required = false) Long old_billId, HttpServletRequest request, Model uiModel) {
HttpSession session = request.getSession();
// 判断用户和企业信息是否存在了,不存在不能购买
Enterprise enterprise = (Enterprise) session.getAttribute("webenterprise");
UserInfo userInfo = (UserInfo) session.getAttribute("webuserInfo");
if (null == enterprise || null == userInfo) {
return "";
}
ExtraProduct product = null;
try {
product = extraProductService.selectByPrimaryKey(productId);
if (null == product) {
uiModel.addAttribute("errorMsg", "产品不存在");
return "client/errorpage";
}
uiModel.addAttribute("webExtraproduct", product);
// 产品对应的服务商信息
Long serviceProviderId = product.getServiceProvider();
ServiceProvider serviceProvider = serviceProviderService.selectByPrimaryKey(serviceProviderId);
uiModel.addAttribute("webServiceProvider", serviceProvider);
// 服务商对应的网点信息
List<ServiceHall> serviceHalls = new ArrayList<>();
serviceHalls = serviceHallService.getServiceHalls(serviceProviderId);
uiModel.addAttribute("webServiceHalls", serviceHalls);
// 产品对应的规格信息
List<ExtraProductSpec> extraProductSpecs = extraProductSpecService.getSpecByProductIdValid(product.getId());
uiModel.addAttribute("extraProductSpecs", extraProductSpecs);
Set<String> periodSet = new LinkedHashSet<>();
Set<String> specSet = new LinkedHashSet<>();
Map<String, Map<String, Object>> specPeriodMap = new HashMap<>();
for (ExtraProductSpec eps : extraProductSpecs) {
Map<String, Object> map = new HashMap<>();
map.put("id", eps.getId());
map.put("price", eps.getPrice());
specPeriodMap.put(eps.getSpec() + "||" + eps.getCycle1() + ";" + eps.getCycleUnit(), map);
String spec = eps.getSpec();
specSet.add(spec);
periodSet.add(eps.getCycle1() + ";" + eps.getCycleUnit());
}
ObjectMapper objectMapper = new ObjectMapper();
uiModel.addAttribute("specSet", specSet);
uiModel.addAttribute("periodSet", periodSet);
uiModel.addAttribute("specPeriodMapJson", objectMapper.writeValueAsString(specPeriodMap));
} catch (Exception e) {
// TODO: handle exception
}
// 仅用户授权产品.发票校验产品,直接跳转发票校验
if (null != product.getProductOpenType() && product.getProductOpenType().equals(ComNames.PRODUCT_OPEN_TYPE_1)) {
// 查询用户是否曾经买过了该产品对于的订单,如果买了,则提示只能购买一次
List<ExtraBill> bills = extraBillService.getHasByExtraBill(userInfo.getId(), enterprise.getId(), productId);
if (null != bills && bills.size() > 0) {
uiModel.addAttribute("ifHasOpen", 1);
}
return "client/yingyongxiangqing_jyhsq";
}
return "client/yingyongxiangqing";
}
use of com.itrus.portal.db.ServiceProvider in project portal by ixinportal.
the class ExtraProductController method show.
// 显示详情页面
@RequestMapping(value = "/show/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) throws Exception {
ExtraProduct extraProduct = extraProductService.selectByPrimaryKey(id);
uiModel.addAttribute("extraProduct", extraProduct);
List<ExtraProductSpec> extraProductSpecs = extraProductSpecService.getSpecByProductId(id);
uiModel.addAttribute("extraProductSpecs", extraProductSpecs);
// 服务提供商组成的map
Map<Long, ServiceProvider> serviceProviderMap = serviceProviderService.selectMapByExample(null);
uiModel.addAttribute("serviceProviderMap", serviceProviderMap);
// 在线支付的map:微信和支付宝
List<OnlinePay> onlinepays = sqlSession.selectList("com.itrus.portal.db.OnlinePayMapper.selectByExample", null);
uiModel.addAttribute("onlinepays", onlinepays);
// 银行付款的List
List<Transfer> bankPays = sqlSession.selectList("com.itrus.portal.db.TransferMapper.selectByExample", null);
uiModel.addAttribute("bankPays", bankPays);
// 电子发票的list
List<Ereceipt> einvoices = sqlSession.selectList("com.itrus.portal.db.EreceiptMapper.selectByExample", null);
uiModel.addAttribute("einvoices", einvoices);
// 附加项的list
List<ExtraMessage> extraMessages = extraMessageService.selectByExample(null);
uiModel.addAttribute("extraMessages", extraMessages);
return "extraproduct/show";
}
use of com.itrus.portal.db.ServiceProvider in project portal by ixinportal.
the class ExtraProductController method updatePage.
// 修改基础信息和产品规格信息页面
@RequestMapping(value = "/update/{id}", produces = "text/html")
public String updatePage(@PathVariable("id") Long id, Model uiModel) throws Exception {
ExtraProduct extraProduct = extraProductService.selectByPrimaryKey(id);
uiModel.addAttribute("extraProduct", extraProduct);
List<ExtraProductSpec> extraProductSpecs = extraProductSpecService.getSpecByProductId(id);
uiModel.addAttribute("extraProductSpecs", extraProductSpecs);
// 服务提供商组成的map
Map<Long, ServiceProvider> serviceProviderMap = serviceProviderService.selectMapByExample(null);
uiModel.addAttribute("serviceProviderMap", serviceProviderMap);
// 在线支付的map:微信和支付宝
List<OnlinePay> onlinepays = sqlSession.selectList("com.itrus.portal.db.OnlinePayMapper.selectByExample", null);
uiModel.addAttribute("onlinepays", onlinepays);
// 银行付款的List
List<Transfer> bankPays = sqlSession.selectList("com.itrus.portal.db.TransferMapper.selectByExample", null);
uiModel.addAttribute("bankPays", bankPays);
// 电子发票的list
List<Ereceipt> einvoices = sqlSession.selectList("com.itrus.portal.db.EreceiptMapper.selectByExample", null);
uiModel.addAttribute("einvoices", einvoices);
return "extraproduct/update";
}
use of com.itrus.portal.db.ServiceProvider 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";
}
Aggregations