建模导引首次创建模型逻辑优化

This commit is contained in:
wangpf 2023-06-14 21:11:45 +08:00
parent 38a6156f85
commit 84404ab69a
3 changed files with 36 additions and 11 deletions

View File

@ -2,6 +2,9 @@ package com.actionsoft.apps.coe.pal.pal.repository.designer.relation.web;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@ -74,6 +77,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.hssf.record.DVALRecord;
public class DesignerRelationShapeWeb extends ActionWeb {
private UserContext _uc;
@ -4045,7 +4049,7 @@ public class DesignerRelationShapeWeb extends ActionWeb {
.append(" ")
.append("style='height: 310px;width: 510px'></iframe></div>");
popover.put("description", urlSb.toString());
//导引每一步的class目前用不到
//导引每一步的class目前用不到
/*}else{
popover.put("className","step");
}*/
@ -4062,14 +4066,15 @@ public class DesignerRelationShapeWeb extends ActionWeb {
/**
* 建模导引轮播图页面
*9
* @param step 步骤
* 9
*
* @param step 步骤
* @param modelType 模型类型
* @return {@link String}
*/
public String getModelingGuideCarousel(String step, String modelType) {
Map<String, Object> macroLibraries = new HashMap<>();
BO bo = SDK.getBOAPI().query("BO_ACT_PAL_MODELING_GUIDANCE").addQuery("step=", step).addQuery("MODELTYPE=" , modelType).detail();
BO bo = SDK.getBOAPI().query("BO_ACT_PAL_MODELING_GUIDANCE").addQuery("step=", step).addQuery("MODELTYPE=", modelType).detail();
String boId = bo == null ? "" : bo.getId();
JSONArray filePathArray = new JSONArray();
//附件列表
@ -4081,12 +4086,12 @@ public class DesignerRelationShapeWeb extends ActionWeb {
JSONObject jo = new JSONObject();
String fileName = fileDCContext.getFileName();
//视频支持mp4类型
if(fileName.contains("mp4")){
jo.put("video" , downloadURL);
}else if(fileName.contains("png") || fileName.contains("gif") || fileName.contains("jpg")){
jo.put("picture" , downloadURL);
if (fileName.contains("mp4")) {
jo.put("video", downloadURL);
} else if (fileName.contains("png") || fileName.contains("gif") || fileName.contains("jpg")) {
jo.put("picture", downloadURL);
}
jo.put("picTitle" , fileName.split("\\.")[0]);
jo.put("picTitle", fileName.split("\\.")[0]);
filePathArray.add(jo);
}
macroLibraries.put("filePaths", filePathArray);
@ -4099,12 +4104,32 @@ public class DesignerRelationShapeWeb extends ActionWeb {
* @param methodId 模型类型
* @return {@link String}
*/
public String checkUserFirstCreateModel(String methodId){
public String checkUserFirstCreateModel(String methodId) {
ResponseObject ro = ResponseObject.newOkResponse();
String sql = "SELECT COUNT(1) FROM APP_ACT_COE_PAL_REPOSITORY WHERE CREATEUSER=? AND PLMETHODID=?";
String uid = _uc.getUID();
int anInt = DBSql.getInt(sql, new Object[]{uid, methodId});
ro.put("isFirst" , anInt > 0 ? false : true);
//只有一条记录的时候判断是否第一次创建对应模型
if (anInt == 1) {
String getCreateDateSql = "SELECT CREATEDATE FROM APP_ACT_COE_PAL_REPOSITORY WHERE CREATEUSER='" + uid + "' AND PLMETHODID='" + methodId + "'";
long currentTimeMillis = System.currentTimeMillis();
Timestamp createDateTimestamp = DBSql.getTimestamp(getCreateDateSql, "CREATEDATE");
long createTimeMillis = createDateTimestamp.getTime();
long diff = (currentTimeMillis - createTimeMillis) / 1000 / 60;
//相隔时间小于等于1说明是第一次创建这个类型的模型
if (diff <= 1) {
ro.put("isFirst", true);
} else {
ro.put("isFirst", false);
}
} else if (anInt > 1) {
ro.put("isFirst", false);
} else {
ro.put("isFirst", true);
}
return ro.toString();
}
}