|
@@ -16,28 +16,30 @@ import com.minto.app.space.bo.SpaceFileBO;
|
|
|
import com.minto.app.space.beans.SpaceFileBean;
|
|
|
import com.minto.app.task.util.TaskByTypeUtil;
|
|
|
import com.minto.core.common.AppContext;
|
|
|
+import com.minto.core.util.*;
|
|
|
import com.minto.tip.common.exceptions.BusinessException;
|
|
|
-import com.minto.core.util.CollectionUtil;
|
|
|
-import com.minto.core.util.DateUtil;
|
|
|
-import com.minto.core.util.ReqUtil;
|
|
|
-import com.minto.core.util.StringUtil;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.google.common.collect.Maps;
|
|
|
import org.hibernate.criterion.Criterion;
|
|
|
import org.hibernate.criterion.Restrictions;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.util.Arrays;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@Controller
|
|
|
@RequestMapping("/file")
|
|
|
public class FileController {
|
|
|
+ @Autowired
|
|
|
+ private ISpaceManager spaceManager;
|
|
|
|
|
|
/**
|
|
|
* 增加文件查看方式
|
|
@@ -53,7 +55,6 @@ public class FileController {
|
|
|
Map<String,Object> result= Maps.newHashMap();
|
|
|
Boolean openFlag= ReqUtil.getBoolean(request,"openFlag",false);
|
|
|
Long fileId=ReqUtil.getLong(request,"fileId");
|
|
|
- ISpaceManager spaceManager= AppContext.getBean(ISpaceManager.class);
|
|
|
IBehManager behManager=AppContext.getBean(IBehManager.class);
|
|
|
IOrgManager orgManager=AppContext.getBean(IOrgManager.class);
|
|
|
SpaceFileBean fileBean= spaceManager.findSpaceFileBean(fileId);
|
|
@@ -177,4 +178,28 @@ public class FileController {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ @GetMapping(value = "/isOnlineShow")
|
|
|
+ public void findFileType(HttpServletRequest request, HttpServletResponse response) throws Exception{
|
|
|
+ List<String> onShowTypes = Lists.newArrayList();
|
|
|
+ onShowTypes.addAll(Arrays.asList(KmEnum.ArcSummaryTypeEnum.Excel.getFtype().split(",")));
|
|
|
+ onShowTypes.addAll(Arrays.asList(KmEnum.ArcSummaryTypeEnum.Word.getFtype().split(",")));
|
|
|
+ onShowTypes.addAll(Arrays.asList(KmEnum.ArcSummaryTypeEnum.PPT.getFtype().split(",")));
|
|
|
+ onShowTypes.addAll(Arrays.asList(KmEnum.ArcSummaryTypeEnum.Pdf.getFtype().split(",")));
|
|
|
+ Map<String, Object> result = new HashMap<String, Object>();
|
|
|
+ try{
|
|
|
+ Long fileId = ReqUtil.getLong(request, "fileId");
|
|
|
+ SpaceFileBean fileBean = spaceManager.findSpaceFileBean(fileId);
|
|
|
+ if(fileBean == null){
|
|
|
+ throw new BusinessException("文件不存在");
|
|
|
+ }
|
|
|
+ result.put("onlineShow", onShowTypes.contains(fileBean.getFileType()));
|
|
|
+ result.put("state", "success");
|
|
|
+ } catch(Exception e){
|
|
|
+ result.put("state", "error");
|
|
|
+ result.put("message", "参数非法,修改失败");
|
|
|
+ } finally{
|
|
|
+ RespUtil.rendJson(response, result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|