Example #1
0
  /**
   * @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);
    }
  }
Example #2
0
 /**
  * @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, "当前用户不是承运方!");
 }