代码提交

This commit is contained in:
yujh 2024-09-02 10:12:07 +08:00
parent 8b36fd38db
commit e97a0bab32
5 changed files with 72 additions and 57 deletions

View File

@ -7078,6 +7078,7 @@ y7fdOgAAAABJRU5ErkJggk==
<w:t>${table4.post}</w:t>
<#else>
<w:t>${table4.role}</w:t>
</#if>
</w:r>
</w:p>
</w:tc>

View File

@ -323,6 +323,8 @@ function initHtml() {
' background-color: #f9f9f9; \n' +
' border: 1px solid #ddd; \n' +
' border-radius: 4px; \n' +
' max-height: 400px; \n' +
' overflow-y: auto; \n' +
' box-shadow: 0 2px 4px rgba(0,0,0,0.1); \n' +
' color: #333; \n' +
' font-size: 14px; \n' +
@ -2513,6 +2515,9 @@ function searchProcess(type) {
//先向后台请求完整tree数据
if (type == 'new') {
var data = getAllTreeData();
data = data.filter(function(obj) {
return obj.category === 'process';
});
for (var i = 0; i < data.length; i++) {
var text = data[i].name;
if (text.indexOf(name) > -1) {

View File

@ -13,12 +13,35 @@ import java.util.List;
@Controller
public class YiliWpsController {
public final static LogAPI logAPI = SDK.getLogAPI();
/**
* 打开可编辑的页面
* @param me
* @param palId
* @param fileName
* @return
* @throws Exception
*/
@Mapping("com.awspaas.user.apps.yiliwps.previewUrl")
public String getWPSOnlineFilePreviewUrl(UserContext me,String palId,String fileName) throws Exception{
WpsWeb web =new WpsWeb(me);
return web.getWPSOnlineFilePreviewUrl(palId,fileName);
}
/**
* 打开制度的页面
* @param me
* @param palId
* @param fileName
* @return
* @throws Exception
*/
@Mapping("com.awspaas.user.apps.yiliwps.readOnlyUrl")
public String getWPSOnlineFileReadOnlyUrl(UserContext me,String palId,String fileName) throws Exception{
WpsWeb web =new WpsWeb(me);
return web.getWPSOnlineFileReadOnlyUrl(palId,fileName);
}
/**
* 获取新的pal模型文件
* @param me

View File

@ -87,15 +87,13 @@ public class YiliWpsApi {
@Path("/v1/3rd/file/history")
@POST
public String histoty(@QueryParam("_w_boId") String boId,
@QueryParam("_w_boItemName") String boItemName,
@QueryParam("_w_sid") String sid){
@QueryParam("_w_third_palId") String palId,
@QueryParam("_w_third_queryFileId") String queryFileId,
@QueryParam("_w_third_sid") String sid,
@QueryParam("_w_third_fname") String fileName){
System.out.println(">>>>>>文件历史调用成功:"+System.currentTimeMillis());
JSONObject params = new JSONObject();
params.put("boItemName", boItemName);
params.put("boId", boId);
params.put("sid", sid);
WpsWeb web = new WpsWeb();
return web.getHistoryFileInfo(params);
return web.getHistoryFileInfo(queryFileId,fileName);
}
@Path("/v1/3rd/file/version/{version}")
@ -124,7 +122,6 @@ public class YiliWpsApi {
@Path("/test/{name}")
@POST
public String sayHelloparam(@PathParam("name") String name) {
return "test,hello,world!-param " + name;
}
}

View File

@ -19,6 +19,7 @@ import com.actionsoft.bpms.server.conf.portal.AWSPortalConf;
import com.actionsoft.bpms.server.fs.DCContext;
import com.actionsoft.bpms.server.fs.dc.DCProfileManager;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.bpms.util.UUIDGener;
import com.actionsoft.sdk.local.SDK;
import com.actionsoft.sdk.local.api.LogAPI;
import com.alibaba.fastjson.JSONArray;
@ -45,7 +46,7 @@ public class WpsWeb extends ActionWeb {
}
/**
*
* 打开在线编辑页
* @param
* @return
*/
@ -61,6 +62,23 @@ public class WpsWeb extends ActionWeb {
return HttpPostUtil.sendGetRequest(YiliWpsConst.HOST+"/open"+url,headers);
}
/**
* 打开只读页面
* @param
* @return
*/
public String getWPSOnlineFileReadOnlyUrl(String palId,String fileName) throws Exception{
//先判断该fileId有无附件
String querySql = " SELECT ID FROM " + YiliWpsConst.APP_ACT_COE_PAL_UPFILE+" WHERE PALREPOSITORYID = ? ORDER BY CREATETIME DESC";
String fileId = DBSql.getString(querySql, new Object[]{palId});
DCContext sourceDc = getFileDCContext(fileId,fileName);
WPS4Util.initAppInfo(YiliWpsConst.AK, YiliWpsConst.SK);
String url = String.format("/api/preview/v1/files/%s/link?type=%s&preview_mode=%s&_w_third_sid=%s&_w_third_palId=%s&_w_third_queryFileId=%s&_w_third_fname=%s",fileId,"w","ordinary",this.getContext().getSessionId(),palId,fileId,URLEncoder.encode(sourceDc.getFileName()));
Map<String,String> headers = WPS4Util.getSignatureHeaders(url, HttpMethod.GET,null, YiliWpsConst.CONTENT_TYPE);
logAPI.consoleInfo(">>>>>headers"+headers);
return HttpPostUtil.sendGetRequest(YiliWpsConst.HOST+"/open"+url,headers);
}
public String getFileInfo(String sid,String palId,String fileId,String fileName){
String sourceFileName = null;
try {
@ -157,57 +175,30 @@ public class WpsWeb extends ActionWeb {
/**
* 获取历史版本文件
* @param params
* @return
*/
public String getHistoryFileInfo(JSONObject params){
public String getHistoryFileInfo(String queryFileId,String fileName){
JSONObject resultJson =new JSONObject();
JSONArray historyArray =new JSONArray();
String boId = params.getString("boId");
String boItemName = params.getString("boItemName").toString();
String sid = params.getString("sid");
UserContext uc = UserContext.fromSessionId(sid);
String sql = "SELECT * FROM WFC_FORMFILES WHERE BOID=? AND BOFIELDNAME=? ORDER BY ORDERINDEX DESC";
List<FormFile> list = DBSql.query(sql, new FormFileDao().rowMapper(), new Object[]{boId,boItemName});
if(null != list && list.size()>1){
for (int i = 1; i < list.size(); i++) {//因为第一个是现版本所以从第二个开始
JSONObject fileJson = new JSONObject();
FormFile formFile = list.get(i);
DCContext fileDCContext = SDK.getBOAPI().getFileDCContext(formFile);
fileDCContext.setSession(uc);
String fileName = fileDCContext.getFileName();
int orderIndex = formFile.getOrderIndex()+1;//wps历史版本从1开始
String id = formFile.getId();
long fileSize = formFile.getFileSize();
String downloadUrl = fileDCContext.getDownloadURL();
downloadUrl = downloadUrl.replace("sid=ck", "sid="+sid);
downloadUrl = AWSPortalConf.getUrl()+ "/r"+ downloadUrl.substring(1,downloadUrl.length());
downloadUrl += "%version=" +orderIndex;
long createTime = formFile.getCreateDate().getTime();
//获取编辑人信息
JSONObject userJson =new JSONObject();
String createUser = formFile.getCreateUser();
UserModel user = SDK.getORGAPI().getUser(createUser);
String userName = user.getUserName();
String userPhoto = SDK.getPortalAPI().getUserPhoto(uc, createUser);
String avatar_url = AWSPortalConf.getUrl() +"/r" + userPhoto.substring(1,userPhoto.length());
//组装json
userJson.put("id",createUser);
userJson.put("name",userName);
userJson.put("avatar_url",avatar_url);
fileJson.put("id",id);
fileJson.put("name",fileName);
fileJson.put("version",orderIndex);
fileJson.put("size",fileSize);
fileJson.put("download_url",downloadUrl);
fileJson.put("create_time",createTime);
fileJson.put("modify_time",createTime);
fileJson.put("creator",userJson);
fileJson.put("modifier",userJson);
historyArray.add(fileJson);
}
}
JSONObject fileJson = new JSONObject();
DCContext sourceDc = getFileDCContext(queryFileId,fileName);
//组装json
JSONObject userJson =new JSONObject();
userJson.put("id","admin");
userJson.put("name","对不起,暂不支持显示历史版本");
userJson.put("avatar_url","");
fileJson.put("id", UUIDGener.getUUID());
fileJson.put("name","对不起,暂不支持显示历史版本");
fileJson.put("version",1);
fileJson.put("size",sourceDc.getFileLength());
fileJson.put("download_url",sourceDc.getDownloadURL());
fileJson.put("create_time",System.currentTimeMillis()/1000);
fileJson.put("modify_time",System.currentTimeMillis()/1000);
fileJson.put("creator",userJson);
fileJson.put("modifier",userJson);
historyArray.add(fileJson);
resultJson.put("histories",historyArray);
System.out.println("historyArray = " + historyArray.toString());
return resultJson.toString();
}
@ -279,9 +270,7 @@ public class WpsWeb extends ActionWeb {
FormFile formFile = files.get(0);
sourceDc = SDK.getBOAPI().getFileDCContext(formFile, repositoryName);
sourceDc.setSession(this.getContext());
//往附件表中写入一个附件
return sourceDc;
}
}