use of com.itrus.portal.db.ServiceHall 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.ServiceHall in project portal by ixinportal.
the class ServiceHallServiceImpl method selectByExample.
public List<ServiceHall> selectByExample(ServiceHallExample example) throws Exception {
ServiceHallMapper mapper = sqlSession.getMapper(ServiceHallMapper.class);
List<ServiceHall> list = mapper.selectByExample(example);
return list;
}
use of com.itrus.portal.db.ServiceHall in project portal by ixinportal.
the class ServiceProviderController method show.
// 显示详情页面
@RequestMapping(value = "/show/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) throws Exception {
ServiceProvider serviceProvider = ServiceProviderService.selectByPrimaryKey(id);
uiModel.addAttribute("serviceProvider", serviceProvider);
List<ServiceHall> serviceHalls = serviceHallService.getServiceHalls(serviceProvider.getId());
uiModel.addAttribute("serviceHalls", serviceHalls);
List<ExtraProduct> products = extraProductService.getProductsByServiceProviderId(serviceProvider.getId());
uiModel.addAttribute("products", products);
return "serviceprovider/show";
}
use of com.itrus.portal.db.ServiceHall in project portal by ixinportal.
the class ServiceProviderController method update.
// 修改页面
@RequestMapping(value = "/{id}", params = "form", produces = "text/html")
public String update(@PathVariable("id") Long id, Model uiModel) throws Exception {
ServiceProvider serviceProvider = ServiceProviderService.selectByPrimaryKey(id);
uiModel.addAttribute("serviceProvider", serviceProvider);
List<ServiceHall> serviceHalls = serviceHallService.getServiceHalls(serviceProvider.getId());
uiModel.addAttribute("serviceHalls", serviceHalls);
return "serviceprovider/update";
}
use of com.itrus.portal.db.ServiceHall in project portal by ixinportal.
the class ServiceProviderController method delete.
// 删除服务商
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = "text/html")
@ResponseBody
public String delete(@PathVariable("id") Long id) {
ServiceProvider serviceProvider = ServiceProviderService.selectByPrimaryKey(id);
if (null == serviceProvider) {
return "未找到要删除的服务商";
} else {
try {
ServiceProviderService.deleteByPrimaryKey(id);
List<ServiceHall> serviceHalls = serviceHallService.getServiceHalls(id);
if (null != serviceHalls && !serviceHalls.isEmpty()) {
List<Long> list = new ArrayList<>();
for (ServiceHall serviceHall : serviceHalls) {
list.add(serviceHall.getId());
}
ServiceHallExample example = new ServiceHallExample();
ServiceHallExample.Criteria criteria = example.or();
criteria.andServiceProviderIn(list);
serviceHallService.deleteByExample(example);
}
} catch (Exception e) {
return "要删除的服务商:" + serviceProvider.getName() + "存在关联,无法删除";
}
}
return null;
}
Aggregations