/** 得到活动图片下载对象 */
  public FileDownMode getFileInfo(HttpServletRequest request, String id) {

    FindActivity findActivity = findActivityDao.get(Long.valueOf(id));

    FileDownMode fileDownMode = new FileDownMode();
    fileDownMode.setSaveName(findActivity.getFileName());
    fileDownMode.setFilePath(
        findActivity.getRootPath()
            + findActivity.getRelativePath()
            + findActivity.getDiskFileName());
    return fileDownMode;
  }
 public FindActivity get(long id) {
   // TODO Auto-generated method stub
   return findActivityDao.get(id);
 }
  /**
   * 保存操作
   *
   * @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);
    }
  }