/**
   * 页面初始化
   *
   * @return
   * @throws Exception
   */
  @RequestMapping(value = "/init")
  public ModelAndView init() {

    ModelAndView view = new ModelAndView();
    view.setViewName("business/sharehref/init");

    SysUser sysUser = getLoginUser();
    view.addObject(
        "toolbar", sysButtonService.getMenuButtons(request, getLoginSysRoleId(), sysUser));
    view.addObject("gridComluns", sysGridColumnsService.getGridColumsByRequest(request));
    view.addObject(
        "conditionHtml",
        sysQueryItemService.getConditionHtmlByRequest(request, sysUser.getUnitId()));
    return view;
  }
  /**
   * 保存操作
   *
   * @param request 访问对象
   * @param op 操作类型 add:添加 modify:修改
   * @param findActivity 活动对象
   * @param dictPath 字典维护的保存路径
   */
  @Transactional(rollbackFor = Exception.class)
  public void save(
      HttpServletRequest request,
      String op,
      FindActivity findActivity,
      String dictPath,
      SysUser sysUser) {

    String[] goodsId_array = request.getParameterValues("goodsId");
    String[] file_array = request.getParameterValues("activity_file");

    if (op.equals("add")) {

      findActivity.setUnitId(sysUser.getUnitId());
      findActivity.setUserId(sysUser.getId());
      findActivity.setActivityStatus(0);
      findActivity.setCreateDate(DateUtil.getSystemTime());
      // 图片
      setFileData(file_array, findActivity, dictPath);
      findActivityDao.add(findActivity);
    } else {

      FindActivity findActivity2 = findActivityDao.get(findActivity.getId());
      findActivity.setCreateDate(findActivity2.getCreateDate());
      findActivity.setUpdateDate(DateUtil.getSystemTime());
      findActivity.setUserId(sysUser.getId());
      findActivity.setUnitId(sysUser.getUnitId());
      findActivity.setActivityStatus(0);

      findActivity.setFileName(findActivity2.getFileName());
      findActivity.setDiskFileName(findActivity2.getDiskFileName());
      findActivity.setRootPath(findActivity2.getRootPath());
      findActivity.setRelativePath(findActivity2.getRelativePath());
      findActivity.setFileSize(findActivity2.getFileSize());
      findActivity.setFileSuffix(findActivity2.getFileSuffix());

      // 图片
      setFileData(file_array, findActivity, dictPath);
      int flag = findActivityDao.update(findActivity);

      // 删除原消息推送
      if (flag > 0) {
        Map<String, Object> postMap = new HashMap<String, Object>();
        postMap.put("sourceType", PushUtil.PushLoginType.datasourceType.value);
        postMap.put("sourceId", findActivity.getId());
        DataRequestUtil.getRequestData("msg/deleteUnpushedMsg.htm", postMap);
      }

      // 删除商品关联
      // findActivityGoodsDao.deleteByActivityId(findActivity.getId());
    }

    // 添加活动商品关联,暂时不用关联商品
    if (null != goodsId_array && goodsId_array.length > 0) {

      List<FindActivityGoods> activityGoodsList = new ArrayList<FindActivityGoods>();
      for (String goodsId : goodsId_array) {
        FindActivityGoods findActivityGoods = new FindActivityGoods();
        findActivityGoods.setActivityId(findActivity.getId());
        findActivityGoods.setGoodsId(Long.valueOf(goodsId));
        activityGoodsList.add(findActivityGoods);
      }
      findActivityGoodsDao.addBatch(activityGoodsList);
    }

    // 消息推送
    if (1 == findActivity.getIfSetPush() && 0 == findActivity.getActivityStatus()) {
      pushMsg(findActivity);
    }
  }