/** * @Description: 保存分供方车型信息 * * @return String 跳转的页面 * @throws */ @RequestMapping(value = "/save", method = RequestMethod.POST) @ResponseBody public Map<String, Object> save(HttpServletRequest request, TSubCarStyle tSubCarStyle) { try { /** 验证重复性 */ TUser user = (TUser) request.getSession().getAttribute("user"); String subno = subService.get(user.getiArchive()).getVcSubno(); String[] properties = {"vcCarStyle", "NEnable", "vcSubno"}; Object[] values = {tSubCarStyle.getVcCarStyle(), 0, subno}; List<TSubCarStyle> tSubCarStyles = subCarStyleService.findByProperties(properties, values); if (tSubCarStyles != null && tSubCarStyles.size() > 0) { return AjaxUtil.getMap(false, "商品车【" + tSubCarStyle.getVcCarStyle() + "】重复!"); } if (tSubCarStyle.getId() == null) { tSubCarStyle.setVcSubno(subno); subCarStyleService.save(tSubCarStyle); return AjaxUtil.getMap(true, "成功!"); } else { subCarStyleService.update(tSubCarStyle); return AjaxUtil.getMap(true, "成功!"); } } catch (Exception e) { return AjaxUtil.getMapByException(e); } }
/** * @Description: 删除扣分类型 逻辑删除 不可见 * * @param request * @return String 返回值描述 * @author chenbin * @create_date 2014-8-11 下午1:20:51 */ @RequestMapping("/delIntegalAdds") public void delIntegalCuts(HttpServletRequest request, HttpServletResponse resp) { int inteCutAddID = Integer.parseInt(request.getParameter("inteCutAddID")); TIntegalAdd integalAdd = integalAddService.get(inteCutAddID); integalAdd.setNEnable(SystemConstants.SYS_DISABLE); try { integalAddService.update(integalAdd); AjaxUtil.rendJson(resp, true, "保存成功!"); } catch (Exception e) { // TODO: handle exception AjaxUtil.rendJson(resp, false, "保存失败,原因 :" + e.getMessage()); } }
/** * @Description: 新增 / 修改扣分类型 * * @param request * @return String 返回值描述 * @author chenbin * @create_date 2014-8-11 下午1:20:51 */ @RequestMapping("/save") public void save(HttpServletRequest request, HttpServletResponse resp, TIntegalAdd integalAdd) { HttpSession session = request.getSession(); TUser user = (TUser) session.getAttribute("user"); integalAdd.setNEnable(SystemConstants.SYS_ENABLE); integalAdd.setDtOpUser(new Date()); integalAdd.setIOpUserId(user.getId()); try { integalAddService.saveOrUpdate(integalAdd); AjaxUtil.rendJson(resp, true, "保存成功!"); } catch (Exception e) { // TODO: handle exception AjaxUtil.rendJson(resp, false, "保存失败,原因 :" + e.getMessage()); } }
/** * @Description: 删除分供方车型信息 * * @return String 跳转的页面 * @throws */ @RequestMapping("/del") @ResponseBody public Map<String, Object> del( HttpServletRequest request, HttpServletResponse response, String arkID) { HttpSession session = request.getSession(); TUser user = (TUser) session.getAttribute("user"); int archid = user.getIArchiveType(); // 该用户类型等于分供方 if (archid == SystemConstants.SYS_TARCHIVE_SUB) { try { int styID = Integer.parseInt(arkID); TSubCarStyle carsty = subCarStyleService.get(styID); carsty.setNEnable(1); subCarStyleService.update(carsty); return AjaxUtil.getMap(true, "成功!"); } catch (Exception e) { e.printStackTrace(); return AjaxUtil.getMapByException(e); } } return AjaxUtil.getMap(false, "当前用户不是承运方!"); }
/** * @Description: 获取该分供方所有的车型信息 * * @return String 跳转的页面 * @throws */ @RequestMapping(value = "/getAllSubCarStyle", method = RequestMethod.POST) @ResponseBody public Map<String, Object> getAllSubCarStyle(HttpServletRequest request) { HttpSession session = request.getSession(); TUser user = (TUser) session.getAttribute("user"); int archid = user.getIArchiveType(); String subno = subService.get(user.getiArchive()).getVcSubno(); Page page = ServiceUtil.getcurrPage(request); HqlHelper hql = new HqlHelper(TSubCarStyle.class); hql.addEqual("vcSubno", subno); // hql.addEqual( "NEnable" , SystemConstants.SYS_ENABLE ); hql.setQueryPage(page); Map<String, Object> resultMap = null; // 该用户类型等于分供方 if (archid == SystemConstants.SYS_TARCHIVE_SUB) { try { resultMap = subCarStyleService.findAllByHql(hql); return resultMap; } catch (Exception e) { return AjaxUtil.getMapByException(e); } } return resultMap; }