Exemplo n.º 1
0
  /**
   * 保存
   *
   * @param shareHref
   * @param op add:添加、modify:修改
   */
  @RequestMapping(value = "/save")
  public void save(@ModelAttribute ShareHref shareHref, @RequestParam String op) {

    Map<String, Object> map = new HashMap<String, Object>();
    map.put("code", "1");
    map.put("msg", "保存成功!");

    try {
      // 图片路径
      SysDictMain sysDictMain = DictUtil.getMainByCode("shareHref_path");

      if (sysDictMain != null && StringUtils.isNotBlank(sysDictMain.getDictValue())) {

        shareHref.setUnitId(getLoginUnitId());
        shareHref.setUnitType(getLoginUnit().getUnitType());
        shareHref.setZoneCode(getLoginUnit().getZoneCode());

        shareHrefService.save(request, shareHref, op, sysDictMain.getDictValue());
        addSaveLog(op, shareHref, OpRresult.success + "", "分享链接添加成功!");

      } else {
        map.put("code", "0");
        map.put("msg", "请维护推广活动图片上传路径,编码为:promoteActivity_path!");
      }

    } catch (Exception e) {
      logger.error(e.getMessage(), e);
      map.put("code", "0");
      map.put("msg", "保存失败!");
      addSaveLog(op, shareHref, OpRresult.fail + "", "分享链接添加失败!");
    }

    outJson(map);
  }
Exemplo n.º 2
0
  /**
   * 删除
   *
   * @return
   */
  @RequestMapping(value = "/delete")
  public void delete(@ModelAttribute ShareHref shareHref) {
    Map<String, Object> map = new HashMap<String, Object>();

    try {
      map.put("code", "1");
      map.put("msg", "删除成功!");

      ShareHref shareHref2 = shareHrefService.get(shareHref.getId());
      shareHref2.setHrefStatus(-1);
      shareHrefService.update(shareHref2);

      sysLogService.addLog(
          request,
          getLoginUser(),
          "分享链接",
          OpType.delete + "",
          OpRresult.success + "",
          "分享链接删除成功!",
          shareHref.getId() + "",
          BusinessTableName.shareHref.name);

    } catch (Exception e) {
      logger.error(e.getMessage(), e);
      map.put("code", "0");
      map.put("msg", "删除失败!");
      sysLogService.addLog(
          request,
          getLoginUser(),
          "分享链接",
          OpType.delete + "",
          OpRresult.fail + "",
          "分享链接删除失败!",
          shareHref.getId() + "",
          BusinessTableName.shareHref.name);
    }

    outJson(map);
  }
Exemplo n.º 3
0
  /**
   * 编辑页面初始化
   *
   * @param shareHref
   * @param op 操作类型,添加、修改
   * @return
   */
  @RequestMapping(value = "/add")
  public ModelAndView add(@ModelAttribute ShareHref shareHref, @RequestParam String op) {

    ModelAndView view = new ModelAndView();

    if (op.equals("modify")) {
      shareHref = shareHrefService.get(shareHref.getId());
    }

    view.addObject("shareHref", shareHref);
    view.addObject("op", op);
    view.setViewName("business/sharehref/add");
    view.addObject(
        "validationRules", sysValidationService.getValidationByCode("sharehref_validate"));
    return view;
  }
Exemplo n.º 4
0
  /** 获取列表 */
  @RequestMapping(value = "/getList")
  public void getList() {

    outJson(shareHrefService.getGridData(request, getLoginUnitId()));
  }