Merge branch 'apps_dev' of https://e.coding.net/yilidev/yilipalkaifa/apps into apps_dev

This commit is contained in:
zhaol 2024-10-16 20:40:05 +08:00
commit 52ab49755d
6 changed files with 70 additions and 14 deletions

View File

@ -6,8 +6,10 @@ import com.actionsoft.apps.coe.pal.publisher.constant.FilePermConstant;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance;
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.TaskInstance;
import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.commons.mvc.view.ActionWeb;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.sdk.local.SDK;
import com.actionsoft.sdk.local.api.ProcessExecuteQuery;
@ -27,6 +29,12 @@ public class FilePermWeb extends ActionWeb {
bo.set("APPLYTYPE","单一权限申请");
bo.set("APPLYFILEIDS",palVersionId);
bo.set("APPLYFILES",model.getName());
String querySql = "SELECT PUBLISHDEPTID,CREATEUSER FROM BO_ACT_PUBLISH_PERM_SCOPE WHERE PALVERSIONID = ?";
RowMap map = DBSql.getMap(querySql, new Object[]{palVersionId});
if(null != map){
bo.set("DYPUBLISHER",map.getString("CREATEUSER"));
bo.set("DYPUBLISHDEPT",map.getString("PUBLISHDEPTID"));
}
SDK.getBOAPI().create(FilePermConstant.BO_ACT_FILE_PERM,bo,processInstance.getId(),uid);
ProcessExecuteQuery start = SDK.getProcessAPI().start(processInstance);
TaskInstance taskInstance = start.fetchActiveTasks().get(0);

View File

@ -2273,7 +2273,7 @@ function updateAttributeById(objId, va, shapeId) {
"cmd": "com.actionsoft.apps.coe.pal_pl_repository_designer_message"
}];
}
var isCriticalControlPoint="";
var isCriticalControlPoint="";
attributesJsonArray.forEach(obj => {
// 检查id是否匹配
if (obj.id === 'isCriticalControlPoint') {
@ -2292,7 +2292,7 @@ function updateAttributeById(objId, va, shapeId) {
];
shape.dataAttributes[13]["dataShowConfig"].config = dataArray;
}else{
}else if(isCriticalControlPoint === "否"){
var dataArray = [
{
"horizontal": "right",

View File

@ -63,10 +63,17 @@ public class TemplateWeb extends ActionWeb {
ResponseObject ro =ResponseObject.newOkResponse();
UserContext me = super.getContext();
ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance(TemplateConstant.mapping_dw_id,me.getUID(), "新增");
BO bo =new BO();
bo.set("TPLID",tplId);
bo.set("PALID",palId);
SDK.getBOAPI().create(TemplateConstant.BO_EU_TPL_PAL_MAPPING, bo, processInstance, me);
BO bo = SDK.getBOAPI().query(TemplateConstant.BO_EU_TPL_PAL_MAPPING).addQuery("CREATEUSER=", me.getUID()).addQuery("PALID=", palId).orderByCreated().desc().detail();
if(null!=bo){//存在则走更新不存在则走修改
bo.set("TPLID",tplId);
bo.set("PALID",palId);
SDK.getBOAPI().update(TemplateConstant.BO_EU_TPL_PAL_MAPPING, bo);
}else{
bo =new BO();
bo.set("TPLID",tplId);
bo.set("PALID",palId);
SDK.getBOAPI().create(TemplateConstant.BO_EU_TPL_PAL_MAPPING, bo, processInstance, me);
}
return ro.toString();
}
}

View File

@ -53,4 +53,16 @@ public class YiliWpsController {
WpsWeb web =new WpsWeb(me);
return web.getCoeDefinition(palId);
}
/**
* 判断文件大小是否超过设定值
* @param me
* @param palId
* @return
*/
@Mapping("com.awspaas.user.apps.yiliwps.checkFileSize")
public String checkFileSize(UserContext me,String palId){
WpsWeb web =new WpsWeb(me);
return web.checkFileSize(palId);
}
}

View File

@ -93,7 +93,7 @@ public class YiliWpsApi {
@QueryParam("_w_third_fname") String fileName){
System.out.println(">>>>>>文件历史调用成功:"+System.currentTimeMillis());
WpsWeb web = new WpsWeb();
return web.getHistoryFileInfo(queryFileId,fileName);
return web.getHistoryFileInfo(queryFileId);
}
@Path("/v1/3rd/file/version/{version}")

View File

@ -1,5 +1,6 @@
package com.awspaas.user.apps.yiliwps.web;
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
import com.actionsoft.apps.coe.pal.pal.repository.designer.CoeDesignerShapeAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.designer.manage.CoeDesignerAPIManager;
@ -13,6 +14,7 @@ import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.commons.formfile.dao.FormFileDao;
import com.actionsoft.bpms.commons.formfile.model.delegate.FormFile;
import com.actionsoft.bpms.commons.mvc.view.ActionWeb;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.org.model.UserModel;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.server.conf.portal.AWSPortalConf;
@ -20,6 +22,7 @@ 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.bpms.util.UtilNumber;
import com.actionsoft.sdk.local.SDK;
import com.actionsoft.sdk.local.api.LogAPI;
import com.alibaba.fastjson.JSONArray;
@ -54,7 +57,7 @@ public class WpsWeb extends ActionWeb {
public String getWPSOnlineFilePreviewUrl(String palId,String fileName) throws Exception{
//先判断该fileId有无附件
String fileId = getFileIdByPalId(palId);
DCContext sourceDc = getFileDCContext(fileId,fileName);
DCContext sourceDc = getFileDCContext(fileId);
WPS4Util.initAppInfo(YiliWpsConst.AK, YiliWpsConst.SK);
String url = String.format("/api/edit/v1/files/%s/link?type=%s&_w_third_sid=%s&_w_third_palId=%s&_w_third_queryFileId=%s&_w_third_fname=%s",fileId,"w",this.getContext().getSessionId(),palId,fileId,URLEncoder.encode(sourceDc.getFileName()));
Map<String,String> headers = WPS4Util.getSignatureHeaders(url, HttpMethod.GET,null, YiliWpsConst.CONTENT_TYPE);
@ -70,7 +73,7 @@ public class WpsWeb extends ActionWeb {
public String getWPSOnlineFileReadOnlyUrl(String palId,String fileName) throws Exception{
//先判断该fileId有无附件
String fileId = getFileIdByPalId(palId);
DCContext sourceDc = getFileDCContext(fileId,fileName);
DCContext sourceDc = getFileDCContext(fileId);
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);
@ -85,7 +88,7 @@ public class WpsWeb extends ActionWeb {
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
DCContext sourceDc = getFileDCContext(fileId,sourceFileName);
DCContext sourceDc = getFileDCContext(fileId);
JSONObject jsonObject = new JSONObject();
JSONObject file = new JSONObject();
JSONObject user = new JSONObject();
@ -149,7 +152,7 @@ public class WpsWeb extends ActionWeb {
//CallASLPUtil aslpUtil =new CallASLPUtil();
//aslpUtil.callTranslateDocASLP(me,palId,fileName,fileInputStream);
//只写入新文件
DCContext sourceDc = getFileDCContext(fileId,fileName);
DCContext sourceDc = getFileDCContext(fileId);
sourceDc.setSession(me);
SDK.getDCAPI().write(fileInputStream,sourceDc);
//在重新获取下fileId
@ -178,11 +181,11 @@ public class WpsWeb extends ActionWeb {
* 获取历史版本文件
* @return
*/
public String getHistoryFileInfo(String queryFileId,String fileName){
public String getHistoryFileInfo(String queryFileId){
JSONObject resultJson =new JSONObject();
JSONArray historyArray =new JSONArray();
JSONObject fileJson = new JSONObject();
DCContext sourceDc = getFileDCContext(queryFileId,fileName);
DCContext sourceDc = getFileDCContext(queryFileId);
//组装json
JSONObject userJson =new JSONObject();
userJson.put("id","admin");
@ -243,7 +246,7 @@ public class WpsWeb extends ActionWeb {
* @param palId
* @return
*/
public DCContext getFileDCContext(String palId,String fileName){
public DCContext getFileDCContext(String palId){
DCContext sourceDc = null;
//先判断该fileId有无附件
String querySql = " SELECT PALREPOSITORYID,SHAPEID,FILETYPE,FILENAME FROM " + YiliWpsConst.APP_ACT_COE_PAL_UPFILE+" WHERE ID = ? ORDER BY CREATETIME DESC";
@ -299,6 +302,32 @@ public class WpsWeb extends ActionWeb {
return model.getDefinition();
}
/**
* 校验正文文件大小
* @return
*/
public String checkFileSize(String palId){
ResponseObject ro = ResponseObject.newOkResponse();
//判断用户上传的文件的大小有多大
String fileId = getFileIdByPalId(palId);
DCContext sourceDc = getFileDCContext(fileId);
if(null == sourceDc){
ro.put("state",false);
}
String fileLength = String.valueOf(sourceDc.length());
String maxFileLength = SDK.getAppAPI().getProperty(CoEConstant.APP_ID, "wps_export_file_size");
String maxFileLength_B = UtilNumber.mul(UtilNumber.mul(maxFileLength, "1024.0"),"1024.0");
System.out.println(">>fileLength = " + fileLength);
System.out.println(">>maxFileLength_B = " + maxFileLength_B);
if(Double.parseDouble(UtilNumber.sub(fileLength,maxFileLength_B))>0){//大于设置的值则走wps逻辑
ro.put("maxFileLength",maxFileLength);
ro.put("state",true);
}else{
ro.put("state",false);
}
return ro.toString();
}
/**
* 通过文件ID获取主要模型块的附件ID