Commit 6ec05079 by liuyang

2024-10-16 修改文档管理

parent 4ee9cd8e
...@@ -40,5 +40,10 @@ public class OSConstant { ...@@ -40,5 +40,10 @@ public class OSConstant {
* 二维码目录 * 二维码目录
*/ */
public final static String QRCODE_DIR = USER_DIR + SEPARATOR + "qrcode"; public final static String QRCODE_DIR = USER_DIR + SEPARATOR + "qrcode";
/**
* 压缩包目录
*/
public final static String ZIP_DIR = USER_DIR + SEPARATOR + "file" + SEPARATOR + "zip";
} }
...@@ -20,7 +20,12 @@ public class S3Constant { ...@@ -20,7 +20,12 @@ public class S3Constant {
* endpoint * endpoint
*/ */
public static String ENDPOINT = PlatApplicationContext.getProperty("iplat4j.admin.objectStorage.s3.endpoint"); public static String ENDPOINT = PlatApplicationContext.getProperty("iplat4j.admin.objectStorage.s3.endpoint");
/**
* resource
*/
public static String RESOURCE = PlatApplicationContext.getProperty("iplat4j.admin.objectStorage.s3.resource");
/** /**
* bucket名称 * bucket名称
*/ */
......
package com.baosight.hpjx.core.tools;
import com.baosight.hpjx.core.constant.OSConstant;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.FileUtils;
import lombok.extern.slf4j.Slf4j;
import java.io.File;
import java.time.LocalDate;
/**
* @author LiuYang
* @version 1.0 2024/10/16
* @description
*/
@Slf4j
public class FileTools {
/**
* 清理ZIP文件
*/
public static void clearZip() {
File zipFolder = new File(OSConstant.ZIP_DIR);
File[] zipFolderFiles = zipFolder.listFiles();
if (zipFolderFiles.length == 0) {
log.warn("清理ZIP文件:无有效的文件");
}
for (File zipFolderFile : zipFolderFiles) {
String folderName = zipFolderFile.getName();
// 当天以前的文件夹全部删除
if (LocalDate.parse(folderName, DateUtils.SHORT_DATE).isBefore(LocalDate.now())) {
FileUtils.deleteFiles(zipFolderFile);
}
}
log.info("清理ZIP文件成功!!!");
}
}
package com.baosight.hpjx.core.utils; package com.baosight.hpjx.core.utils;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.constant.OSConstant;
import com.baosight.hpjx.core.constant.S3Constant; import com.baosight.hpjx.core.constant.S3Constant;
import com.baosight.hpjx.core.tools.Iplat4jTools; import com.baosight.hpjx.core.tools.Iplat4jTools;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.FileUtils; import com.baosight.hpjx.util.FileUtils;
import com.baosight.hpjx.util.MapUtils; import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.StringUtils; import com.baosight.hpjx.util.StringUtils;
...@@ -10,6 +13,7 @@ import com.baosight.iplat4j.core.exception.PlatException; ...@@ -10,6 +13,7 @@ import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext; import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext;
import com.baosight.iplat4j.eu.dm.util.PlatFileUploader; import com.baosight.iplat4j.eu.dm.util.PlatFileUploader;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -73,5 +77,43 @@ public class Iplat4jUtils { ...@@ -73,5 +77,43 @@ public class Iplat4jUtils {
document.put("url", docPath + "/" + chgName); document.put("url", docPath + "/" + chgName);
return document; return document;
} }
/**
* 压缩文件
*
* @param docIds
* @param zipName
* @return
*/
public static String compressFile(List<String> docIds, String zipName) throws Exception {
String zipFolderPath = OSConstant.ZIP_DIR + OSConstant.SEPARATOR + DateUtils.shortDate()
+ OSConstant.SEPARATOR + zipName;
FileUtils.createDirs(zipFolderPath);
String zipFilePath = zipFolderPath + ".zip";
if (CommonConstant.FileLocation.S3.equalsIgnoreCase(S3Constant.FILE_LOCATION)) {
for (String docId : docIds) {
Teudm05 dbDm05 = S3Utils.buildUrl(docId);
// 文件路径:压缩包路径+文件名称
String localFilePath = zipFolderPath + OSConstant.SEPARATOR + dbDm05.getResCname();
FileUtils.downloadUrlFile(dbDm05.getUrl(), localFilePath);
}
} else {
for (String docId : docIds) {
Map dbDm02 = Iplat4jUtils.getDoc02ById(docId);
String returnUrl = MapUtils.getString(dbDm02, "url");
String docName = MapUtils.getString(dbDm02, "docName");
// 文件路径:压缩包路径+文件名称
String localFilePath = zipFolderPath + OSConstant.SEPARATOR + docName;
FileUtils.fileCopy(returnUrl, localFilePath);
}
}
// 开始压缩
FileUtils.zip(zipFolderPath, zipFilePath);
// 压缩完删除本地文件
FileUtils.deleteFiles(zipFolderPath);
// 替换成HTTP地址
return S3Constant.RESOURCE + zipFilePath.replace(OSConstant.USER_DIR, "")
.replace(OSConstant.SEPARATOR, "/");
}
} }
...@@ -11,8 +11,10 @@ import java.util.Map; ...@@ -11,8 +11,10 @@ import java.util.Map;
public class HPSC001 extends DaoEPBase { public class HPSC001 extends DaoEPBase {
public static final String FIELD_DELIVERY_DATE = "deliveryDate"; public static final String FIELD_DELIVERY_DATE = "deliveryDate";
public static final String FIELD_project_source = "projectSource"; /* 项目来源*/
public static final String COL_DELIVERY_DATE = "deliveryDate"; public static final String COL_DELIVERY_DATE = "deliveryDate";
public static final String COL_project_source = "project_source"; /* 项目来源*/
private Long id = 0L; private Long id = 0L;
private String companyCode = " "; /* 企业编码 预留*/ private String companyCode = " "; /* 企业编码 预留*/
...@@ -33,6 +35,7 @@ public class HPSC001 extends DaoEPBase { ...@@ -33,6 +35,7 @@ public class HPSC001 extends DaoEPBase {
private String remark = " "; /* 备注*/ private String remark = " "; /* 备注*/
private Integer materialStatus = 0; /* 物料提交状态0-未提交,1部分提交,2全部提交*/ private Integer materialStatus = 0; /* 物料提交状态0-未提交,1部分提交,2全部提交*/
private String projectSource = " "; /* 项目来源*/
/** /**
* initialize the metadata * initialize the metadata
*/ */
...@@ -111,6 +114,10 @@ public class HPSC001 extends DaoEPBase { ...@@ -111,6 +114,10 @@ public class HPSC001 extends DaoEPBase {
eiColumn = new EiColumn("materialStatus"); eiColumn = new EiColumn("materialStatus");
eiColumn.setDescName("物料提交状态0-未提交,1部分提交,2全部提交"); eiColumn.setDescName("物料提交状态0-未提交,1部分提交,2全部提交");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_project_source);
eiColumn.setDescName("项目来源");
eiMetadata.addMeta(eiColumn);
} }
/** /**
* the constructor * the constructor
...@@ -356,6 +363,23 @@ public class HPSC001 extends DaoEPBase { ...@@ -356,6 +363,23 @@ public class HPSC001 extends DaoEPBase {
return this.materialStatus; return this.materialStatus;
} }
/** /**
* get the projectSource - 项目来源.
* @return the projectSource
*/
public String getProjectSource() {
return this.projectSource;
}
/**
* set the projectSource - 项目来源.
*
* @param projectSource - 项目来源
*/
public void setProjectSource(String projectSource) {
this.projectSource = projectSource;
}
/**
* get the value from Map * get the value from Map
*/ */
public void fromMap(Map map) { public void fromMap(Map map) {
...@@ -378,6 +402,7 @@ public class HPSC001 extends DaoEPBase { ...@@ -378,6 +402,7 @@ public class HPSC001 extends DaoEPBase {
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("depCode")), depCode)); setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("depCode")), depCode));
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("remark")), remark)); setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("remark")), remark));
setMaterialStatus(NumberUtils.toInteger(StringUtils.toString(map.get("materialStatus")), materialStatus)); setMaterialStatus(NumberUtils.toInteger(StringUtils.toString(map.get("materialStatus")), materialStatus));
setProjectSource(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_project_source)), projectSource));
} }
...@@ -405,6 +430,7 @@ public class HPSC001 extends DaoEPBase { ...@@ -405,6 +430,7 @@ public class HPSC001 extends DaoEPBase {
map.put("depCode",StringUtils.toString(depCode, eiMetadata.getMeta("depCode"))); map.put("depCode",StringUtils.toString(depCode, eiMetadata.getMeta("depCode")));
map.put("remark",StringUtils.toString(remark, eiMetadata.getMeta("remark"))); map.put("remark",StringUtils.toString(remark, eiMetadata.getMeta("remark")));
map.put("materialStatus",StringUtils.toString(materialStatus, eiMetadata.getMeta("materialStatus"))); map.put("materialStatus",StringUtils.toString(materialStatus, eiMetadata.getMeta("materialStatus")));
map.put(FIELD_project_source, StringUtils.toString(projectSource, eiMetadata.getMeta(FIELD_project_source)));
return map; return map;
......
package com.baosight.hpjx.hp.sc.enums;
/**
* @author LiuYang
* @version 1.0 2024/10/16
* @description
*/
public enum ProjectSourceEnum {
ENGINEERING("engineering", "工程设计图"),
FOREIGN("foreign", "外来涉密图"),
SPARE("spare", "备件制造图"),
OTHER("other", "其他"),
;
/**
* 编码
*/
private String code;
/**
* 名称
*/
private String name;
/**
* code 是否存在
*
* @param code
* @return
*/
public static boolean contains(String code) {
for (ProjectSourceEnum value : values()) {
if (value.getCode().equals(code)) {
return true;
}
}
return false;
}
/**
* 根据名称查询
*
* @param name
* @return
*/
public static ProjectSourceEnum getByName(String name) {
for (ProjectSourceEnum value : values()) {
if (value.getName().equals(name)) {
return value;
}
}
return null;
}
ProjectSourceEnum(String code, String name) {
this.code = code;
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
...@@ -29,7 +29,8 @@ ...@@ -29,7 +29,8 @@
UPDATED_TIME as "updatedTime", <!-- 更新时间 --> UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
DEP_CODE as "depCode", <!-- 部门编码 --> DEP_CODE as "depCode", <!-- 部门编码 -->
REMARK as "remark", <!-- 备注 --> REMARK as "remark", <!-- 备注 -->
MATERIAL_STATUS as "materialStatus" MATERIAL_STATUS as "materialStatus",
project_source as "projectSource" <!-- 项目来源 -->
FROM ${hpjxSchema}.t_hpsc001 T WHERE 1=1 FROM ${hpjxSchema}.t_hpsc001 T WHERE 1=1
<include refid="authCondition"/> <include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
...@@ -69,6 +70,9 @@ ...@@ -69,6 +70,9 @@
EXISTS (SELECT A.PROJ_CODE FROM ${hpjxSchema}.T_HPWD001 A, ${hpjxSchema}.T_HPWD003 B EXISTS (SELECT A.PROJ_CODE FROM ${hpjxSchema}.T_HPWD001 A, ${hpjxSchema}.T_HPWD003 B
WHERE A.FILE_ID = B.FILE_ID AND A.PROJ_CODE = T.PROJ_CODE AND B.USER_ID = #userId#) WHERE A.FILE_ID = B.FILE_ID AND A.PROJ_CODE = T.PROJ_CODE AND B.USER_ID = #userId#)
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="projectSource">
project_source = #projectSource#
</isNotEmpty>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$order$ $order$
...@@ -114,6 +118,9 @@ ...@@ -114,6 +118,9 @@
<isNotEmpty prepend=" AND " property="projCodes"> <isNotEmpty prepend=" AND " property="projCodes">
PROJ_CODE IN <iterate close=")" open="(" conjunction="," property="projCodes">#projCodes[]#</iterate> PROJ_CODE IN <iterate close=")" open="(" conjunction="," property="projCodes">#projCodes[]#</iterate>
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="projectSource">
project_source = #projectSource#
</isNotEmpty>
</select> </select>
<!-- <!--
...@@ -160,23 +167,28 @@ ...@@ -160,23 +167,28 @@
<insert id="insert"> <insert id="insert">
INSERT INTO ${hpjxSchema}.t_hpsc001 (ID, INSERT INTO ${hpjxSchema}.t_hpsc001 (ID,
COMPANY_CODE, <!-- 企业编码 预留 --> COMPANY_CODE, <!-- 企业编码 预留 -->
PROJ_TYPE, <!-- 项目类型 --> PROJ_TYPE, <!-- 项目类型 -->
PROJ_CODE, <!-- 项目编码 --> PROJ_CODE, <!-- 项目编码 -->
PROJ_NAME, <!-- 项目名称 --> PROJ_NAME, <!-- 项目名称 -->
PRINC1, <!-- 本公司项目负责人 --> PRINC1, <!-- 本公司项目负责人 -->
PRINC2, <!-- 客户项目负责人 --> PRINC2, <!-- 客户项目负责人 -->
DELIVERY_DATE, DELIVERY_DATE,
STATUS, <!-- 状态 0-未提交,1-已提交 --> STATUS, <!-- 状态 0-未提交,1-已提交 -->
MATERIAL_STATUS, MATERIAL_STATUS,
CREATED_BY, <!-- 创建人 --> CREATED_BY, <!-- 创建人 -->
CREATED_TIME, <!-- 创建时间 --> CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 更新人 --> UPDATED_BY, <!-- 更新人 -->
UPDATED_TIME, <!-- 更新时间 --> UPDATED_TIME, <!-- 更新时间 -->
DEP_CODE, <!-- 部门编码 --> DEP_CODE, <!-- 部门编码 -->
REMARK REMARK,
) project_source
VALUES (#id#, #companyCode#, #projType#, #projCode#, #projName#, #princ1#, #princ2#, #deliveryDate#, #status#, 0, #createdBy#, #createdTime#, #updatedBy#, #updatedTime#, #depCode#, #remark#) )
VALUES (#id#, #companyCode#, #projType#, #projCode#, #projName#, #princ1#, #princ2#, #deliveryDate#, #status#,
0, #createdBy#, #createdTime#, #updatedBy#, #updatedTime#, #depCode#, #remark#, #projectSource#)
<selectKey resultClass="long" keyProperty="id">
SELECT MAX(ID) AS "id" FROM ${hpjxSchema}.t_hpsc001
</selectKey>
</insert> </insert>
<delete id="delete"> <delete id="delete">
...@@ -201,7 +213,8 @@ ...@@ -201,7 +213,8 @@
UPDATED_BY = #updatedBy#, <!-- 更新人 --> UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 --> UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DEP_CODE = #depCode#, <!-- 部门编码 --> DEP_CODE = #depCode#, <!-- 部门编码 -->
REMARK = #remark# <!-- 备注 --> REMARK = #remark#, <!-- 备注 -->
project_source = #projectSource#
WHERE WHERE
ID = #id# ID = #id#
</update> </update>
...@@ -266,7 +279,8 @@ ...@@ -266,7 +279,8 @@
UPDATED_TIME as "updatedTime", <!-- 更新时间 --> UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
DEP_CODE as "depCode", <!-- 部门编码 --> DEP_CODE as "depCode", <!-- 部门编码 -->
REMARK as "remark", <!-- 备注 --> REMARK as "remark", <!-- 备注 -->
MATERIAL_STATUS as "materialStatus" MATERIAL_STATUS as "materialStatus",
PROJECT_SOURCE as "projectSource",
FROM ${hpjxSchema}.t_hpsc001 WHERE 1=1 FROM ${hpjxSchema}.t_hpsc001 WHERE 1=1
<include refid="authCondition"/> <include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
...@@ -302,7 +316,8 @@ ...@@ -302,7 +316,8 @@
UPDATED_BY as "updatedBy", <!-- 更新人 --> UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 --> UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
DEP_CODE as "depCode", <!-- 部门编码 --> DEP_CODE as "depCode", <!-- 部门编码 -->
REMARK as "remark" <!-- 备注 --> REMARK as "remark", <!-- 备注 -->
PROJECT_SOURCE as "projectSource"
FROM ${hpjxSchema}.t_hpsc001 WHERE 1=1 FROM ${hpjxSchema}.t_hpsc001 WHERE 1=1
<include refid="authCondition"/> <include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
......
...@@ -19,12 +19,18 @@ public class HpWdSqlConstant { ...@@ -19,12 +19,18 @@ public class HpWdSqlConstant {
public static final String MODULE = "HPWD001."; public static final String MODULE = "HPWD001.";
// 根据父节点统计 // 根据父节点统计
public static final String COUNT_BY_PARENT = MODULE + "countByParent"; public static final String COUNT_BY_PARENT = MODULE + "countByParent";
// 根据来源统计
public static final String COUNT_BY_SOURCE = MODULE + "countBySource";
// 搜索树节点 // 搜索树节点
public static final String SEARCH_TREE_NODE = MODULE + "searchTreeNode"; public static final String SEARCH_TREE_NODE = MODULE + "searchTreeNode";
//查询项目 //查询项目
public static final String QUERY_PROJCODE = MODULE + "queryProjCode"; public static final String QUERY_PROJCODE = MODULE + "queryProjCode";
//查询所以项目 //查询所以项目
public static final String QUERY_PROJCODE_ALL = MODULE + "queryProjCodeAll"; public static final String QUERY_PROJCODE_ALL = MODULE + "queryProjCodeAll";
// 查询全部
public static final String QUERY_ALL = "HPWD001.queryAll";
//查询子级
public static final String QUERY_FILE_CHILD = MODULE + "queryFileChild";
} }
/** /**
......
...@@ -36,6 +36,7 @@ public class HPWD001 extends DaoEPBase { ...@@ -36,6 +36,7 @@ public class HPWD001 extends DaoEPBase {
public static final String FIELD_FACTORY_NAME = "factoryName"; /* 工厂*/ public static final String FIELD_FACTORY_NAME = "factoryName"; /* 工厂*/
public static final String FIELD_PROJ_CODE = "projCode"; /* 项目编码*/ public static final String FIELD_PROJ_CODE = "projCode"; /* 项目编码*/
public static final String FIELD_PROJ_NAME = "projName"; /* 项目名称*/ public static final String FIELD_PROJ_NAME = "projName"; /* 项目名称*/
public static final String FIELD_PROJECT_SOURCE = "projectSource"; /* 项目来源*/
public static final String FIELD_LEAF_LEVEL = "leafLevel"; /* 节点层级*/ public static final String FIELD_LEAF_LEVEL = "leafLevel"; /* 节点层级*/
public static final String FIELD_PARENT_ID = "parentId"; /* 父级ID*/ public static final String FIELD_PARENT_ID = "parentId"; /* 父级ID*/
public static final String FIELD_FILE_ID = "fileId"; /* 文件ID*/ public static final String FIELD_FILE_ID = "fileId"; /* 文件ID*/
...@@ -60,6 +61,7 @@ public class HPWD001 extends DaoEPBase { ...@@ -60,6 +61,7 @@ public class HPWD001 extends DaoEPBase {
public static final String COL_FACTORY_NAME = "FACTORY_NAME"; /* 工厂*/ public static final String COL_FACTORY_NAME = "FACTORY_NAME"; /* 工厂*/
public static final String COL_PROJ_CODE = "PROJ_CODE"; /* 项目编码*/ public static final String COL_PROJ_CODE = "PROJ_CODE"; /* 项目编码*/
public static final String COL_PROJ_NAME = "PROJ_NAME"; /* 项目名称*/ public static final String COL_PROJ_NAME = "PROJ_NAME"; /* 项目名称*/
public static final String COL_PROJECT_SOURCE = "PROJECT_SOURCE"; /* 项目来源*/
public static final String COL_PARENT_ID = "PARENT_ID"; /* 节点层级*/ public static final String COL_PARENT_ID = "PARENT_ID"; /* 节点层级*/
public static final String COL_LEAF_LEVEL = "LEAF_LEVEL"; /* 父级ID*/ public static final String COL_LEAF_LEVEL = "LEAF_LEVEL"; /* 父级ID*/
public static final String COL_FILE_ID = "FILE_ID"; /* 文件ID*/ public static final String COL_FILE_ID = "FILE_ID"; /* 文件ID*/
...@@ -76,7 +78,7 @@ public class HPWD001 extends DaoEPBase { ...@@ -76,7 +78,7 @@ public class HPWD001 extends DaoEPBase {
public static final String UPDATE = "HPWD001.update"; public static final String UPDATE = "HPWD001.update";
public static final String DELETE = "HPWD001.delete"; public static final String DELETE = "HPWD001.delete";
public static final String RELEASE_DATE = "HPWD001.updateReleaseDate"; public static final String RELEASE_DATE = "HPWD001.updateReleaseDate";
private Long id = new Long(0); private Long id = new Long(0);
private String companyCode = " "; /* 企业编码 预留*/ private String companyCode = " "; /* 企业编码 预留*/
private String depCode = " "; /* 部门编码*/ private String depCode = " "; /* 部门编码*/
...@@ -91,6 +93,7 @@ public class HPWD001 extends DaoEPBase { ...@@ -91,6 +93,7 @@ public class HPWD001 extends DaoEPBase {
private String factoryName = " "; /* 工厂*/ private String factoryName = " "; /* 工厂*/
private String projCode = " "; /* 项目编码*/ private String projCode = " "; /* 项目编码*/
private String projName = " "; /* 项目名称*/ private String projName = " "; /* 项目名称*/
private String projectSource = " "; /* 项目来源*/
private Integer leafLevel = new Integer(0); private Integer leafLevel = new Integer(0);
private String parentId = " "; private String parentId = " ";
private String fileId = " "; /* 文件ID*/ private String fileId = " "; /* 文件ID*/
...@@ -164,6 +167,10 @@ public class HPWD001 extends DaoEPBase { ...@@ -164,6 +167,10 @@ public class HPWD001 extends DaoEPBase {
eiColumn.setDescName("项目名称"); eiColumn.setDescName("项目名称");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PROJECT_SOURCE);
eiColumn.setDescName("项目来源");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_LEAF_LEVEL); eiColumn = new EiColumn(FIELD_LEAF_LEVEL);
eiColumn.setDescName("节点层级"); eiColumn.setDescName("节点层级");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -435,6 +442,14 @@ public class HPWD001 extends DaoEPBase { ...@@ -435,6 +442,14 @@ public class HPWD001 extends DaoEPBase {
this.projName = projName; this.projName = projName;
} }
public String getProjectSource() {
return projectSource;
}
public void setProjectSource(String projectSource) {
this.projectSource = projectSource;
}
/** /**
* get the leafLevel - 层级 * get the leafLevel - 层级
* @return 层级 * @return 层级
...@@ -599,6 +614,7 @@ public class HPWD001 extends DaoEPBase { ...@@ -599,6 +614,7 @@ public class HPWD001 extends DaoEPBase {
setFactoryName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FACTORY_NAME)), factoryName)); setFactoryName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FACTORY_NAME)), factoryName));
setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode)); setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode));
setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName)); setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName));
setProjectSource(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJECT_SOURCE)), projectSource));
setLeafLevel(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_LEAF_LEVEL)), leafLevel)); setLeafLevel(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_LEAF_LEVEL)), leafLevel));
setParentId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PARENT_ID)), parentId)); setParentId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PARENT_ID)), parentId));
setFileId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FILE_ID)), fileId)); setFileId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FILE_ID)), fileId));
...@@ -631,6 +647,7 @@ public class HPWD001 extends DaoEPBase { ...@@ -631,6 +647,7 @@ public class HPWD001 extends DaoEPBase {
map.put(FIELD_FACTORY_NAME, StringUtils.toString(factoryName, eiMetadata.getMeta(FIELD_FACTORY_NAME))); map.put(FIELD_FACTORY_NAME, StringUtils.toString(factoryName, eiMetadata.getMeta(FIELD_FACTORY_NAME)));
map.put(FIELD_PROJ_CODE, StringUtils.toString(projCode, eiMetadata.getMeta(FIELD_PROJ_CODE))); map.put(FIELD_PROJ_CODE, StringUtils.toString(projCode, eiMetadata.getMeta(FIELD_PROJ_CODE)));
map.put(FIELD_PROJ_NAME, StringUtils.toString(projName, eiMetadata.getMeta(FIELD_PROJ_NAME))); map.put(FIELD_PROJ_NAME, StringUtils.toString(projName, eiMetadata.getMeta(FIELD_PROJ_NAME)));
map.put(FIELD_PROJECT_SOURCE, StringUtils.toString(projectSource, eiMetadata.getMeta(FIELD_PROJECT_SOURCE)));
map.put(FIELD_LEAF_LEVEL, StringUtils.toString(leafLevel, eiMetadata.getMeta(FIELD_LEAF_LEVEL))); map.put(FIELD_LEAF_LEVEL, StringUtils.toString(leafLevel, eiMetadata.getMeta(FIELD_LEAF_LEVEL)));
map.put(FIELD_PARENT_ID, StringUtils.toString(parentId, eiMetadata.getMeta(FIELD_PARENT_ID))); map.put(FIELD_PARENT_ID, StringUtils.toString(parentId, eiMetadata.getMeta(FIELD_PARENT_ID)));
map.put(FIELD_FILE_ID, StringUtils.toString(fileId, eiMetadata.getMeta(FIELD_FILE_ID))); map.put(FIELD_FILE_ID, StringUtils.toString(fileId, eiMetadata.getMeta(FIELD_FILE_ID)));
......
...@@ -3,9 +3,13 @@ package com.baosight.hpjx.hp.wd.service; ...@@ -3,9 +3,13 @@ package com.baosight.hpjx.hp.wd.service;
import com.baosight.hpjx.core.constant.CommonConstant; import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoBase; import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.security.UserSessionUtils; import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.core.tools.CodeValueTools;
import com.baosight.hpjx.hp.sc.domain.HPSC001; import com.baosight.hpjx.hp.sc.domain.HPSC001;
import com.baosight.hpjx.hp.sc.enums.ProjectSourceEnum;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.hp.wd.constant.HpWdConstant; import com.baosight.hpjx.hp.wd.constant.HpWdConstant;
import com.baosight.hpjx.hp.wd.domain.HPWD001; import com.baosight.hpjx.hp.wd.domain.HPWD001;
import com.baosight.hpjx.hp.wd.domain.HPWD003;
import com.baosight.hpjx.hp.wd.tools.HPWDTools; import com.baosight.hpjx.hp.wd.tools.HPWDTools;
import com.baosight.hpjx.hp.wd.utils.HpWdUtils; import com.baosight.hpjx.hp.wd.utils.HpWdUtils;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
...@@ -21,6 +25,7 @@ import org.springframework.util.CollectionUtils; ...@@ -21,6 +25,7 @@ import org.springframework.util.CollectionUtils;
import com.baosight.hpjx.util.EiInfoUtils; import com.baosight.hpjx.util.EiInfoUtils;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* @author LiuYang * @author LiuYang
...@@ -205,10 +210,13 @@ public class ServiceHPWD001D extends TreeService { ...@@ -205,10 +210,13 @@ public class ServiceHPWD001D extends TreeService {
Map queryMap = EiInfoUtils.getFirstRow(inInfo); Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String node = MapUtils.getString(queryMap, CommonConstant.Field.NODE); String node = MapUtils.getString(queryMap, CommonConstant.Field.NODE);
String ename = MapUtils.getString(queryMap, CommonConstant.Field.ENAME); String ename = MapUtils.getString(queryMap, CommonConstant.Field.ENAME);
String projCode = MapUtils.getString(queryMap, HPWD001.FIELD_PROJ_CODE);
if (CommonConstant.Field.ROOT.equals(node) || CommonConstant.Field.ROOT2.equals(node)) { if (CommonConstant.Field.ROOT.equals(node) || CommonConstant.Field.ROOT2.equals(node)) {
inInfo.addBlock(node).setRows(queryTopNode(node, ename)); inInfo.addBlock(node).setRows(queryTopNode(node, ename));
} else if (ProjectSourceEnum.contains(node)) {
inInfo.addBlock(node).setRows(queryFirstNode(node, ename));
} else { } else {
inInfo.addBlock(node).setRows(queryChildNode(node,ename)); inInfo.addBlock(node).setRows(queryChildNode(projCode, node, ename));
} }
} catch (Exception e) { } catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询节点失败"); LogUtils.setMsg(inInfo, e, "查询节点失败");
...@@ -221,6 +229,30 @@ public class ServiceHPWD001D extends TreeService { ...@@ -221,6 +229,30 @@ public class ServiceHPWD001D extends TreeService {
* *
* @return * @return
*/ */
public List queryTopNode(String parentId) {
List<Map> results = new ArrayList();
List<Map> codesetMaps = CodeValueTools.getCodeValues("app.sc.projectSource");
if (CollectionUtils.isEmpty(codesetMaps)) {
return results;
}
for (Map codesetMap : codesetMaps) {
String label = MapUtils.getString(codesetMap, "value");
String text = MapUtils.getString(codesetMap, "label");
Map leafMap = buildLeaf(parentId, label, text, HpWdConstant.LeafType.P);
leafMap.put("type", "-1");
leafMap.put("leafLevel", "-1");
results.add(leafMap);
}
// 设置叶子节点
setTreeNodeLeaf(results, false);
return results;
}
/**
* 查询树根
*
* @return
*/
public List queryTopNode(String parentId, String ename) { public List queryTopNode(String parentId, String ename) {
List<Map> results = new ArrayList(); List<Map> results = new ArrayList();
Map queryMap = new HashMap<>(); Map queryMap = new HashMap<>();
...@@ -234,28 +266,81 @@ public class ServiceHPWD001D extends TreeService { ...@@ -234,28 +266,81 @@ public class ServiceHPWD001D extends TreeService {
if (CollectionUtils.isEmpty(dbSc001s)) { if (CollectionUtils.isEmpty(dbSc001s)) {
return results; return results;
} }
List<String> projCodes = dbSc001s.stream().map(HPSC001::getProjCode).distinct().collect(Collectors.toList());
List<HPWD003> hgwd003s = HPWDTools.HpWd003.list(projCodes);
for (HPSC001 dbSc001 : dbSc001s) { for (HPSC001 dbSc001 : dbSc001s) {
String text = "[" + dbSc001.getProjCode() + "]" + dbSc001.getProjName(); String text = "[" + dbSc001.getProjCode() + "]" + dbSc001.getProjName();
Map leafMap = buildLeaf(parentId, dbSc001.getProjCode(), text, HpWdConstant.LeafType.P); Map leafMap = buildLeaf(parentId, dbSc001.getProjCode(), text, HpWdConstant.LeafType.P);
Long count = hgwd003s.stream().filter(hgwd003 -> hgwd003.getFileId().equals(dbSc001.getProjCode())).count();
leafMap.put("projCode", dbSc001.getProjCode());
leafMap.put("projName", dbSc001.getProjName());
leafMap.put("ename", dbSc001.getProjCode());
leafMap.put("type", "1");
leafMap.put("leafLevel", "0");
leafMap.put("count", count);
leafMap.put("isAuth", "0");
results.add(leafMap);
}
// 设置叶子节点
setTreeNodeLeaf(results,false);
return results;
}
/**
* 查询一级节点
*
* @param parentId
* @param ename
* @return
*/
public List queryFirstNode(String parentId, String ename) {
boolean isAuth = !ProjectSourceEnum.SPARE.getCode().equals(parentId);
List<Map> results = new ArrayList();
Map queryMap = new HashMap<>();
queryMap.put("ename", ename);
queryMap.put("projectSource", parentId);
// 非管理员仅查询自己有权限的项目
String userId = UserSessionUtils.getLoginName();
if (isAuth && !HpWdUtils.HpWd009.isManager(userId)) {
queryMap.put("userId", userId);
}
List<HPSC001> dbSc001s = dao.query("HPSC001.query", queryMap);
if (CollectionUtils.isEmpty(dbSc001s)) {
return results;
}
List<String> projCodes = dbSc001s.stream().map(HPSC001::getProjCode).distinct().collect(Collectors.toList());
List<HPWD003> hgwd003s = HPWDTools.HpWd003.list(projCodes);
for (HPSC001 dbSc001 : dbSc001s) {
String text = dbSc001.getProjName() + "(" + dbSc001.getProjCode() + ")";
Map leafMap = buildLeaf(parentId, dbSc001.getProjCode(), text, HpWdConstant.LeafType.P);
Long count = hgwd003s.stream().filter(hgwd003 -> hgwd003.getFileId().equals(dbSc001.getProjCode())).count();
leafMap.put("projCode", dbSc001.getProjCode()); leafMap.put("projCode", dbSc001.getProjCode());
leafMap.put("projName", dbSc001.getProjName()); leafMap.put("projName", dbSc001.getProjName());
leafMap.put("ename", dbSc001.getProjCode()); leafMap.put("ename", dbSc001.getProjCode());
leafMap.put("type", "1"); leafMap.put("type", "1");
leafMap.put("leafLevel", "0"); leafMap.put("leafLevel", "0");
leafMap.put("count", count);
leafMap.put("isAuth", isAuth ? "1" : "0");
results.add(leafMap); results.add(leafMap);
} }
// 设置叶子节点 // 设置叶子节点
setTreeNodeLeaf(results); setTreeNodeLeaf(results, false);
return results; return results;
} }
/** /**
* 查询叶子节点 * 查询叶子节点
* *
* @param projCode
* @param parentId * @param parentId
* @param ename
* @return * @return
*/ */
public List queryChildNode(String parentId,String ename) { public List queryChildNode(String projCode, String parentId, String ename) {
// 查询项目来源
//HPSC001 dbSc001 = HPSCTools.HpSc001.get(projCode);
//boolean isAuth = !ProjectSourceEnum.SPARE.getCode().equals(dbSc001.getProjectSource());
List<Map> results = new ArrayList(); List<Map> results = new ArrayList();
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put("parentId", parentId); queryMap.put("parentId", parentId);
...@@ -264,17 +349,22 @@ public class ServiceHPWD001D extends TreeService { ...@@ -264,17 +349,22 @@ public class ServiceHPWD001D extends TreeService {
if (CollectionUtils.isEmpty(dbWd001s)) { if (CollectionUtils.isEmpty(dbWd001s)) {
return results; return results;
} }
List<String> fileIds = dbWd001s.stream().map(HPWD001::getFileId).distinct().collect(Collectors.toList());
List<HPWD003> hgwd003s = HPWDTools.HpWd003.list(fileIds);
for (HPWD001 dbWd001 : dbWd001s) { for (HPWD001 dbWd001 : dbWd001s) {
Map leafMap = buildLeaf(parentId, dbWd001.getFileId(), dbWd001.getFileName(), HpWdConstant.LeafType.C); Map leafMap = buildLeaf(parentId, dbWd001.getFileId(), dbWd001.getFileName(), HpWdConstant.LeafType.C);
Long count = hgwd003s.stream().filter(hgwd003 -> hgwd003.getFileId().equals(dbWd001.getFileId())).count();
leafMap.put("projCode", dbWd001.getProjCode()); leafMap.put("projCode", dbWd001.getProjCode());
leafMap.put("projName", dbWd001.getProjName()); leafMap.put("projName", dbWd001.getProjName());
leafMap.put("ename", dbWd001.getProjCode()); leafMap.put("ename", dbWd001.getProjCode());
leafMap.put("type", dbWd001.getFileType()); leafMap.put("type", dbWd001.getFileType());
leafMap.put("leafLevel", dbWd001.getLeafLevel()); leafMap.put("leafLevel", dbWd001.getLeafLevel());
leafMap.put("count", count);
leafMap.put("isAuth", "0");
results.add(leafMap); results.add(leafMap);
} }
// 设置叶子节点 // 设置叶子节点
setTreeNodeLeaf(results); setTreeNodeLeaf(results, false);
return results; return results;
} }
...@@ -282,13 +372,19 @@ public class ServiceHPWD001D extends TreeService { ...@@ -282,13 +372,19 @@ public class ServiceHPWD001D extends TreeService {
* 设置叶子节点是否可以展开 * 设置叶子节点是否可以展开
* *
* @param nodes * @param nodes
* @param isType
*/ */
private void setTreeNodeLeaf(List<Map> nodes) { private void setTreeNodeLeaf(List<Map> nodes, boolean isType) {
if (CollectionUtils.isEmpty(nodes)) { if (CollectionUtils.isEmpty(nodes)) {
return; return;
} }
List<String> labels = ObjectUtils.listKey(nodes, "label"); List<String> labels = ObjectUtils.listKey(nodes, "label");
Map<String, Integer> resultMap = HPWDTools.HpWd001.countByParent(labels); Map<String, Integer> resultMap = null;
if (isType) {
resultMap = HPWDTools.HpWd001.countBySource(labels);
} else {
resultMap = HPWDTools.HpWd001.countByParent(labels);
}
for (Map node : nodes) { for (Map node : nodes) {
Integer cnt = resultMap == null ? null : resultMap.get(node.get("label")); Integer cnt = resultMap == null ? null : resultMap.get(node.get("label"));
node.put("leaf", cnt == null || cnt == 0 ? 1 : 0); node.put("leaf", cnt == null || cnt == 0 ? 1 : 0);
......
...@@ -7,10 +7,13 @@ import com.baosight.hpjx.core.constant.CommonConstant; ...@@ -7,10 +7,13 @@ import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.tools.Iplat4jTools; import com.baosight.hpjx.core.tools.Iplat4jTools;
import com.baosight.hpjx.hp.constant.HPConstant; import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.sc.domain.HPSC001;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.hp.wd.constant.HpWdConstant; import com.baosight.hpjx.hp.wd.constant.HpWdConstant;
import com.baosight.hpjx.hp.wd.domain.HPWD001; import com.baosight.hpjx.hp.wd.domain.HPWD001;
import com.baosight.hpjx.hp.wd.domain.HPWD001A; import com.baosight.hpjx.hp.wd.domain.HPWD001A;
import com.baosight.hpjx.hp.wd.tools.HPWDTools; import com.baosight.hpjx.hp.wd.tools.HPWDTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.contants.ACConstants; import com.baosight.hpjx.util.contants.ACConstants;
...@@ -68,6 +71,8 @@ public class ServiceHPWD001E extends ServiceEPBase { ...@@ -68,6 +71,8 @@ public class ServiceHPWD001E extends ServiceEPBase {
HPWD001 hgwd001 = new HPWD001(); HPWD001 hgwd001 = new HPWD001();
hgwd001.fromMap(resultRow); hgwd001.fromMap(resultRow);
hgwd001.setStatus(HpWdConstant.FileStatus.S_0); hgwd001.setStatus(HpWdConstant.FileStatus.S_0);
// 设置项目信息
this.setProjectInfo(hgwd001);
if (hgwd001.getId() == null || hgwd001.getId() == 0) { if (hgwd001.getId() == null || hgwd001.getId() == 0) {
this.add(hgwd001); this.add(hgwd001);
} else { } else {
...@@ -131,4 +136,18 @@ public class ServiceHPWD001E extends ServiceEPBase { ...@@ -131,4 +136,18 @@ public class ServiceHPWD001E extends ServiceEPBase {
DaoUtils.update(HPWD001.UPDATE, hgwd001); DaoUtils.update(HPWD001.UPDATE, hgwd001);
} }
/**
* 设置项目信息
*
* @param fWd001
*/
private void setProjectInfo(HPWD001 fWd001) {
AssertUtils.isEmpty(fWd001.getProjCode(), "项目不能为空");
HPSC001 dbSc001 = HPSCTools.HpSc001.get(fWd001.getProjCode());
AssertUtils.isNull(dbSc001, String.format("项目【%s】不存在", fWd001.getProjCode()));
fWd001.setProjName(dbSc001.getProjName());
fWd001.setProjectSource(dbSc001.getProjectSource());
}
} }
package com.baosight.hpjx.hp.wd.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.hp.wd.domain.HPWD003;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/10/16
* @description
*/
public class ServiceHPWD001H extends ServiceEPBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "文档浏览", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPWD003().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询
*
* @param inInfo
* @return
*/
@Override
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String fileId = MapUtils.getString(queryMap, HPWD003.FIELD_FILE_ID);
if (StringUtils.isBlank(fileId)) {
return inInfo;
}
inInfo = super.query(inInfo, HPWD003.QUERY, new HPWD003());
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询节点失败");
}
return inInfo;
}
}
...@@ -9,9 +9,7 @@ import com.baosight.hpjx.hp.wd.domain.HPWD002; ...@@ -9,9 +9,7 @@ import com.baosight.hpjx.hp.wd.domain.HPWD002;
import com.baosight.hpjx.hp.wd.domain.HPWD099; import com.baosight.hpjx.hp.wd.domain.HPWD099;
import com.baosight.hpjx.hp.wd.utils.HpWdUtils; import com.baosight.hpjx.hp.wd.utils.HpWdUtils;
import com.baosight.hpjx.hp.xs.domain.User; import com.baosight.hpjx.hp.xs.domain.User;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.*;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.contants.ACConstants; import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
...@@ -56,13 +54,15 @@ public class ServiceHPWD002 extends ServiceEPBase { ...@@ -56,13 +54,15 @@ public class ServiceHPWD002 extends ServiceEPBase {
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo); Map queryRow = EiInfoUtils.getFirstRow(inInfo);
// 仅查询已发布的文件 // 未选择文件目录时,返回空
String fileId = MapUtils.getString(queryRow, HPWD001.FIELD_FILE_ID);
if (StringUtils.isBlank(fileId)) {
return inInfo;
}
queryRow.put(HPWD001.FIELD_STATUS, HpWdConstant.FileStatus.S_1); queryRow.put(HPWD001.FIELD_STATUS, HpWdConstant.FileStatus.S_1);
// 非管理员仅查询自己有权限的项目 // 管理员、无权限的目录不做权限验证
String userId = UserSessionUtils.getLoginName(); if (!HpWdUtils.HpWd009.isManager()) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, User.FIELD_USER_ID, UserSessionUtils.getUserId()); queryRow.put(User.FIELD_USER_ID, UserSessionUtils.getUserId());
if (HpWdUtils.HpWd009.isManager(userId)) {
queryRow.remove(HPWD001.FIELD_PARENT_ID);
} }
builder(inInfo); builder(inInfo);
inInfo = super.query(inInfo, HPWD002.QUERY, new HPWD002()); inInfo = super.query(inInfo, HPWD002.QUERY, new HPWD002());
...@@ -97,6 +97,9 @@ public class ServiceHPWD002 extends ServiceEPBase { ...@@ -97,6 +97,9 @@ public class ServiceHPWD002 extends ServiceEPBase {
case "createdTime asc": case "createdTime asc":
orderByStr.append(orderBy[i].replace("createdTime asc", "b.createdTime asc")); orderByStr.append(orderBy[i].replace("createdTime asc", "b.createdTime asc"));
break; break;
case "updatedTime asc":
orderByStr.append(orderBy[i].replace("updatedTime asc", "b.updatedTime asc"));
break;
case "previewNum asc": case "previewNum asc":
orderByStr.append(orderBy[i].replace("previewNum asc", "b.previewNum asc")); orderByStr.append(orderBy[i].replace("previewNum asc", "b.previewNum asc"));
break; break;
...@@ -124,6 +127,9 @@ public class ServiceHPWD002 extends ServiceEPBase { ...@@ -124,6 +127,9 @@ public class ServiceHPWD002 extends ServiceEPBase {
case "downloadNum desc": case "downloadNum desc":
orderByStr.append(orderBy[i].replace("downloadNum desc", "b.downloadNum desc")); orderByStr.append(orderBy[i].replace("downloadNum desc", "b.downloadNum desc"));
break; break;
case "updatedTime desc":
orderByStr.append(orderBy[i].replace("updatedTime desc", "b.updatedTime desc"));
break;
default: default:
if (!orderBy[i].isEmpty()){ if (!orderBy[i].isEmpty()){
orderByStr.append(orderBy[i]); orderByStr.append(orderBy[i]);
......
...@@ -52,10 +52,11 @@ public class ServiceHPWD002A extends ServiceEPBase { ...@@ -52,10 +52,11 @@ public class ServiceHPWD002A extends ServiceEPBase {
Map queryMap = EiInfoUtils.getFirstRow(inInfo); Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String fileId = MapUtils.getString(queryMap, HPWD001.FIELD_FILE_ID); String fileId = MapUtils.getString(queryMap, HPWD001.FIELD_FILE_ID);
String node = MapUtils.getString(queryMap, CommonConstant.Field.NODE); String node = MapUtils.getString(queryMap, CommonConstant.Field.NODE);
String status = MapUtils.getString(queryMap, HPWD001.FIELD_STATUS);
if (CommonConstant.Field.ROOT.equals(node) || CommonConstant.Field.ROOT2.equals(node)) { if (CommonConstant.Field.ROOT.equals(node) || CommonConstant.Field.ROOT2.equals(node)) {
inInfo.addBlock(node).setRows(queryTopNode(node, fileId)); inInfo.addBlock(node).setRows(queryTopNode(node, fileId));
} else { } else {
inInfo.addBlock(node).setRows(queryChildNode(node)); inInfo.addBlock(node).setRows(queryChildNode(node,status));
} }
} catch (Exception e) { } catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询节点失败"); LogUtils.setMsg(inInfo, e, "查询节点失败");
...@@ -91,17 +92,20 @@ public class ServiceHPWD002A extends ServiceEPBase { ...@@ -91,17 +92,20 @@ public class ServiceHPWD002A extends ServiceEPBase {
* @param parentId * @param parentId
* @return * @return
*/ */
public List queryChildNode(String parentId) { public List queryChildNode(String parentId, String status) {
List<Map> results = new ArrayList(); List<Map> results = new ArrayList();
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put("fileId", parentId);
queryMap.put("parentId", parentId); queryMap.put("parentId", parentId);
String userId = UserSessionUtils.getLoginName(); // 是否备件制造图
if (!HpWdUtils.HpWd009.isManager(userId)) { if (!HpWdUtils.HpWd009.isManager()) {
queryMap.put(User.FIELD_USER_ID, userId); queryMap.put("userId", UserSessionUtils.getLoginName());
}else { }
if (StringUtils.isEmpty(status) || !status.equals(HpWdConstant.FileStatus.S_0.toString())){
queryMap.put(HPWD001.FIELD_STATUS, HpWdConstant.FileStatus.S_1); queryMap.put(HPWD001.FIELD_STATUS, HpWdConstant.FileStatus.S_1);
} }
queryMap.put("orderBy", "B.DOC_TYPE ASC, B.DOC_NAME ASC");
List<HPWD002> dbWd002s = dao.query(HPWD002.QUERY, queryMap); List<HPWD002> dbWd002s = dao.query(HPWD002.QUERY, queryMap);
if (CollectionUtils.isEmpty(dbWd002s)) { if (CollectionUtils.isEmpty(dbWd002s)) {
return results; return results;
......
package com.baosight.hpjx.hp.wd.service; package com.baosight.hpjx.hp.wd.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation; import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.wd.constant.HpWdSqlConstant;
import com.baosight.hpjx.hp.wd.domain.HPWD001;
import com.baosight.hpjx.hp.wd.domain.HPWD003; import com.baosight.hpjx.hp.wd.domain.HPWD003;
import com.baosight.hpjx.hp.wd.tools.HPWDTools;
import com.baosight.hpjx.hp.wd.utils.HpWdUtils; import com.baosight.hpjx.hp.wd.utils.HpWdUtils;
import com.baosight.hpjx.hp.xs.domain.User; import com.baosight.hpjx.hp.xs.domain.User;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
...@@ -14,8 +18,10 @@ import com.baosight.iplat4j.core.ei.EiConstant; ...@@ -14,8 +18,10 @@ import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase; import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @author LiuYang * @author LiuYang
...@@ -73,13 +79,22 @@ public class ServiceHPWD003A extends ServiceEPBase { ...@@ -73,13 +79,22 @@ public class ServiceHPWD003A extends ServiceEPBase {
// 获取FILE_ID // 获取FILE_ID
String fileId = MapUtils.getString(queryMap, HPWD003.FIELD_FILE_ID); String fileId = MapUtils.getString(queryMap, HPWD003.FIELD_FILE_ID);
AssertUtils.isEmpty(fileId, "请选择目录"); AssertUtils.isEmpty(fileId, "请选择目录");
List<Map> mapList = DaoBase.getInstance().query(HpWdSqlConstant.HpWd001.QUERY_FILE_CHILD,new HashMap<String,String>(){{
put("parentId",fileId);
}});
List<String> fileIds = mapList.stream().map(map -> MapUtils.getString(map, HPWD001.FIELD_FILE_ID)).collect(Collectors.toList());
List<HPWD003> hgwd003s = HPWDTools.HpWd003.list(fileIds);
// 判断是否是管理员或项目经理 // 判断是否是管理员或项目经理
AssertUtils.isTrue(!HpWdUtils.HpWd003.isManager(fileId), "操作失败,非项目经理不能授权人员"); AssertUtils.isTrue(!HpWdUtils.HpWd003.isManager(fileId), "操作失败,非项目经理不能授权人员");
List<HPWD003> fWd003s = MapUtils.toDaoEPBases(inInfo, HPWD003.class); List<HPWD003> fWd003s = MapUtils.toDaoEPBases(inInfo, HPWD003.class);
for (HPWD003 fWd003 : fWd003s) { for (Map resultMap: mapList) {
fWd003.setFileId(fileId); for (HPWD003 fWd003:fWd003s) {
fWd003.setFactoryCode(fWd003.getDepCode()); long count = hgwd003s.stream().filter(hgwd003 -> hgwd003.getFileId().equals(resultMap.get(HPWD003.FIELD_FILE_ID)) && hgwd003.getUserId().equals(fWd003.getUserId())).count();
DaoUtils.insert(HPWD003.INSERT, fWd003); if (count == 0){
fWd003.setFileId(resultMap.get(HPWD003.FIELD_FILE_ID).toString());
DaoUtils.insert(HPWD003.INSERT, fWd003);
}
}
} }
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......
...@@ -10,9 +10,7 @@ import com.baosight.hpjx.core.utils.Iplat4jUtils; ...@@ -10,9 +10,7 @@ import com.baosight.hpjx.core.utils.Iplat4jUtils;
import com.baosight.hpjx.hp.wd.domain.HPWD001; import com.baosight.hpjx.hp.wd.domain.HPWD001;
import com.baosight.hpjx.hp.wd.domain.HPWD001A; import com.baosight.hpjx.hp.wd.domain.HPWD001A;
import com.baosight.hpjx.hp.wd.domain.HPWD099; import com.baosight.hpjx.hp.wd.domain.HPWD099;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.*;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.hpjx.util.contants.ACConstants; import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
...@@ -21,10 +19,7 @@ import com.baosight.iplat4j.core.exception.PlatException; ...@@ -21,10 +19,7 @@ import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages; import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase; import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.Arrays; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -98,4 +93,36 @@ public class ServiceHPWD004 extends ServiceEPBase { ...@@ -98,4 +93,36 @@ public class ServiceHPWD004 extends ServiceEPBase {
} }
return inInfo; return inInfo;
} }
/**
* 批量下载
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "回收站", operType = "下载", operDesc = "批量操作")
public EiInfo batchDownload(EiInfo inInfo) {
try {
List<HPWD001A> hgwd001AList = MapUtils.toDaoEPBases(inInfo, HPWD001A.class);
if (hgwd001AList.size()>0){
HPWD001A hgwd001A = hgwd001AList.get(0);
String fileName = hgwd001A.getChangeContent();
String zipName = fileName + "_" + DateUtils.shortDateTime();
List<String> docIds = new ArrayList<>();
for (HPWD001A hgwd001 : hgwd001AList){
String docId = hgwd001.getChangeStartCode();
if ("uploadAdd".equals(hgwd001.getChangeType()) || "uploadDelete".equals(hgwd001.getChangeType())) {
docId = hgwd001.getChangeEndCode();
}
docIds.add(docId);
}
inInfo.set("downloadUrl", Iplat4jUtils.compressFile(docIds, zipName));
}
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "批量下载失败");
}
return inInfo;
}
} }
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
FACTORY_NAME as "factoryName", <!-- 公司名称 --> FACTORY_NAME as "factoryName", <!-- 公司名称 -->
PROJ_CODE as "projCode", <!-- 项目编码 --> PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 --> PROJ_NAME as "projName", <!-- 项目名称 -->
PROJECT_SOURCE as "projectSource", <!-- 项目来源 -->
LEAF_LEVEL as "leafLevel", <!--节点层级--> LEAF_LEVEL as "leafLevel", <!--节点层级-->
PARENT_ID as "parentId", <!--父级ID--> PARENT_ID as "parentId", <!--父级ID-->
FILE_ID as "fileId", <!-- 文件ID --> FILE_ID as "fileId", <!-- 文件ID -->
...@@ -112,6 +113,11 @@ ...@@ -112,6 +113,11 @@
AND M.USER_ID = #managerUserId# AND M.USER_ID = #managerUserId#
AND M.IS_PROJECT_MANAGER = 1) AND M.IS_PROJECT_MANAGER = 1)
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="userId" open="(" close=")">
EXISTS (SELECT FILE_ID FROM ${hpjxSchema}.T_HPWD003 M WHERE T.FILE_ID = M.FILE_ID
AND M.USER_ID = #userId#
) OR PROJECT_SOURCE = 'spare'
</isNotEmpty>
</sql> </sql>
<sql id="orderBy"> <sql id="orderBy">
...@@ -150,6 +156,23 @@ ...@@ -150,6 +156,23 @@
GROUP BY PARENT_ID GROUP BY PARENT_ID
</select> </select>
<!-- 更具父级节点统计 -->
<select id="countBySource" resultClass="java.util.HashMap">
SELECT B.PROJECT_SOURCE, COUNT(1) AS CNT
FROM ${hpjxSchema}.T_HPWD001 A, ${hpjxSchema}.T_HPSC001 B
WHERE 1=1
AND A.PROJ_CODE = B.PROJ_CODE
AND A.DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projectSources">
B.PROJECT_SOURCE IN <iterate close=")" open="(" conjunction="," property="projectSources">#projectSources[]#</iterate>
</isNotEmpty>
AND A.DELETE_FLAG = 0
GROUP BY B.PROJECT_SOURCE
</select>
<!-- 搜索树节点 --> <!-- 搜索树节点 -->
<select id="searchTreeNode" resultClass="HPWD001"> <select id="searchTreeNode" resultClass="HPWD001">
SELECT DISTINCT SELECT DISTINCT
...@@ -188,6 +211,7 @@ ...@@ -188,6 +211,7 @@
FACTORY_NAME, <!-- 公司名称 --> FACTORY_NAME, <!-- 公司名称 -->
PROJ_CODE, <!-- 项目编码 --> PROJ_CODE, <!-- 项目编码 -->
PROJ_NAME, <!-- 项目名称 --> PROJ_NAME, <!-- 项目名称 -->
PROJECT_SOURCE, <!-- 项目来源 -->
LEAF_LEVEL, <!--节点层级--> LEAF_LEVEL, <!--节点层级-->
PARENT_ID, <!--父级ID--> PARENT_ID, <!--父级ID-->
FILE_ID, <!-- 文件ID --> FILE_ID, <!-- 文件ID -->
...@@ -199,7 +223,7 @@ ...@@ -199,7 +223,7 @@
RELEASE_DATE RELEASE_DATE
) VALUES ( ) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #factoryCode#, #factoryName#, #projCode#, #projName#,#leafLevel#,#parentId#, #deleteFlag#, #factoryCode#, #factoryName#, #projCode#, #projName#, #projectSource#, #leafLevel#, #parentId#,
#fileId#, #fileType#, #fileName#, #fileId#, #fileType#, #fileName#,
#docVersion#, #status#, #remark#, #releaseDate# #docVersion#, #status#, #remark#, #releaseDate#
<selectKey resultClass="long" keyProperty="id"> <selectKey resultClass="long" keyProperty="id">
...@@ -258,6 +282,7 @@ ...@@ -258,6 +282,7 @@
FACTORY_NAME as "factoryName", <!-- 公司名称 --> FACTORY_NAME as "factoryName", <!-- 公司名称 -->
PROJ_CODE as "projCode", <!-- 项目编码 --> PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 --> PROJ_NAME as "projName", <!-- 项目名称 -->
PROJECT_SOURCE as "projectSource", <!-- 项目来源 -->
LEAF_LEVEL as "leafLevel", <!--节点层级--> LEAF_LEVEL as "leafLevel", <!--节点层级-->
PARENT_ID as "pId", <!--父级ID--> PARENT_ID as "pId", <!--父级ID-->
FILE_ID as "fileId", <!-- 文件ID --> FILE_ID as "fileId", <!-- 文件ID -->
...@@ -322,23 +347,26 @@ ...@@ -322,23 +347,26 @@
SELECT SELECT
T3.ID as "id", T3.FILE_ID AS "fileId",T3.FILE_TYPE AS "fileType", T3.PARENT_ID as "parentId" T3.ID as "id", T3.FILE_ID AS "fileId",T3.FILE_TYPE AS "fileType", T3.PARENT_ID as "parentId"
FROM ( FROM (
SELECT SELECT
@CODES AS CODES, @CODES AS CODES,
( (
SELECT @CODES:=GROUP_CONCAT(FILE_ID) SELECT @CODES:=GROUP_CONCAT(FILE_ID)
FROM ${hpjxSchema}.T_HPWD001 FROM ${hpjxSchema}.T_HPWD001
WHERE FIND_IN_SET(PARENT_ID, @CODES) WHERE FIND_IN_SET(PARENT_ID, @CODES)
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
AND DELETE_FLAG = 0 AND DELETE_FLAG = 0
) AS T1, ) AS T1,
@LEVEL:=@LEVEL+1 AS LEVEL @LEVEL:=@LEVEL+1 AS LEVEL
FROM ${hpjxSchema}.T_HPWD001, FROM ${hpjxSchema}.T_HPWD001,
<isNotEmpty property="parentId"> <isNotEmpty property="parentId">
(SELECT @CODES:=#parentId#, @LEVEL:= 0) T4 (SELECT @CODES:=#parentId#, @LEVEL:= 0) T4
</isNotEmpty> </isNotEmpty>
WHERE @CODES IS NOT NULL <isEmpty property="parentId">
(SELECT @CODES:='root', @LEVEL:= 0) T4
</isEmpty>
WHERE @CODES IS NOT NULL
) T2, ) T2,
${hpjxSchema}.T_HPWD001 T3 ${hpjxSchema}.T_HPWD001 T3
WHERE T3.DELETE_FLAG = 0 WHERE T3.DELETE_FLAG = 0
...@@ -384,4 +412,56 @@ ...@@ -384,4 +412,56 @@
</isNotEmpty> </isNotEmpty>
</select> </select>
<select id="queryAll" resultClass="HPWD001">
select
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
PROJECT_SOURCE as "projectSource", <!-- 项目来源 -->
PARENT_ID as "parentId", <!--父级ID-->
FILE_ID as "fileId", <!-- 文件ID -->
FILE_TYPE as "fileType", <!-- 文件类型 -->
FILE_NAME as "fileName" <!-- 文件名称 -->
from (
SELECT
PROJ_CODE, <!-- 项目编码 -->
PROJ_NAME, <!-- 项目名称 -->
PROJECT_SOURCE, <!-- 项目来源 -->
PROJ_CODE as "PARENT_ID", <!--父级ID-->
'' as "FILE_ID", <!-- 文件ID -->
'' as "FILE_TYPE", <!-- 文件类型 -->
'' as "FILE_NAME" <!-- 文件名称 -->
FROM ${hpjxSchema}.t_hpsc001 T WHERE 1=1
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
proj_code like concat('%', #projCode#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
proj_name like concat('%', #projName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
EXISTS (SELECT FILE_ID FROM ${hggpSchema}.HGWD003 M WHERE T.PROJ_CODE = M.FILE_ID
AND M.USER_ID = #userId#
)
</isNotEmpty>
union all
SELECT
PROJ_CODE, <!-- 项目编码 -->
PROJ_NAME, <!-- 项目名称 -->
PROJECT_SOURCE, <!-- 项目来源 -->
PARENT_ID, <!--父级ID-->
FILE_ID, <!-- 文件ID -->
FILE_TYPE, <!-- 文件类型 -->
FILE_NAME <!-- 文件名称 -->
FROM ${hpjxSchema}.T_HPWD001 T WHERE 1=1
<include refid="condition"/>
) a
order by a.PROJ_CODE DESC, a.PARENT_ID asc
</select>
</sqlMap> </sqlMap>
\ No newline at end of file
...@@ -72,6 +72,15 @@ ...@@ -72,6 +72,15 @@
<isNotEmpty prepend=" AND " property="docType"> <isNotEmpty prepend=" AND " property="docType">
B.DOC_TYPE = #docType# B.DOC_TYPE = #docType#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
B.BIZ_ID IN (SELECT FILE_ID FROM ${hpjxSchema}.T_HPWD003 WHERE USER_ID = #userId#)
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdDateFrom">
B.CREATED_TIME &gt;= CONCAT(REPLACE(#createdDateFrom#, '-', ''), '000000')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdDateTo">
B.CREATED_TIME &lt;= CONCAT(REPLACE(#createdDateTo#, '-', ''), '235959')
</isNotEmpty>
</sql> </sql>
<sql id="orderBy"> <sql id="orderBy">
......
...@@ -79,6 +79,15 @@ ...@@ -79,6 +79,15 @@
<isNotEmpty prepend=" AND " property="createdDateTo"> <isNotEmpty prepend=" AND " property="createdDateTo">
CREATED_TIME &lt;= CONCAT(REPLACE(#createdDateTo#, '-', ''), '235959') CREATED_TIME &lt;= CONCAT(REPLACE(#createdDateTo#, '-', ''), '235959')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="updateDateFrom">
UPDATED_TIME &gt;= CONCAT(REPLACE(#updateDateFrom#, '-', ''), '000000')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updateDateTo">
UPDATED_TIME &lt;= CONCAT(REPLACE(#updateDateTo#, '-', ''), '235959')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="bizIds">
BIZ_ID in <iterate close=")" open="(" conjunction="," property="bizIds">#bizIds[]#</iterate>
</isNotEmpty>
</sql> </sql>
<sql id="orderBy"> <sql id="orderBy">
......
...@@ -114,6 +114,24 @@ public class HPWDTools { ...@@ -114,6 +114,24 @@ public class HPWDTools {
} }
/** /**
* 根据类型统计
*
* @param projectSources
* @return
*/
public static Map<String, Integer> countBySource(List<String> projectSources) {
AssertUtils.isEmpty(projectSources, "项目来源不能为空");
Map queryMap = new HashMap();
queryMap.put("projectSources", projectSources);
List<Map> results = DaoBase.getInstance().query(HpWdSqlConstant.HpWd001.COUNT_BY_SOURCE, queryMap);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.toMap(item -> MapUtils.getString(item, HPWD001.COL_PROJECT_SOURCE),
item -> MapUtils.getInteger(item, "CNT")));
}
/**
* 搜索树节点 * 搜索树节点
* *
* @param fileName * @param fileName
......
...@@ -4,9 +4,12 @@ import com.baosight.hpjx.core.constant.OSConstant; ...@@ -4,9 +4,12 @@ import com.baosight.hpjx.core.constant.OSConstant;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.file.DirectoryStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -16,6 +19,8 @@ import java.util.List; ...@@ -16,6 +19,8 @@ import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -169,6 +174,40 @@ public class FileUtils extends org.apache.commons.io.FileUtils { ...@@ -169,6 +174,40 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
LocalDateTime dateTime = LocalDateTime.ofEpochSecond(lastModified / 1000, 0, ZoneOffset.ofHours(8)); LocalDateTime dateTime = LocalDateTime.ofEpochSecond(lastModified / 1000, 0, ZoneOffset.ofHours(8));
return dateTime.format(DateUtils.SHORT_DATETIME); return dateTime.format(DateUtils.SHORT_DATETIME);
} }
/**
* 删除目录及文件
*
* @param path
* @return
*/
public static boolean deleteFiles(String path) {
return deleteFiles(Paths.get(path));
}
/**
* 删除目录及文件
*
* @param path
* @return
*/
public static boolean deleteFiles(Path path) {
try {
if (Files.isDirectory(path)) {
try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(path)) {
for (Path entry : directoryStream) {
deleteFiles(entry);
}
} catch (Exception e) {
log.error("删除文件失败,读取目录子文件失败:{}", e.getMessage(), e);
}
}
} catch (Exception e) {
log.error("删除文件失败:{}", e.getMessage(), e);
return false;
}
return deleteFile(path);
}
/** /**
* 删除目录及文件 * 删除目录及文件
...@@ -202,7 +241,25 @@ public class FileUtils extends org.apache.commons.io.FileUtils { ...@@ -202,7 +241,25 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
// 路径为文件且不为空则进行删除 // 路径为文件且不为空则进行删除
return deleteFile(new File(path)); return deleteFile(new File(path));
} }
/**
* 删除单个文件或目录
*
* @param path 被删除的文件
* @return
*/
public static boolean deleteFile(Path path) {
Objects.requireNonNull(path);
// 路径为文件且不为空则进行删除
try {
Files.delete(path);
} catch (Exception e) {
log.error("删除文件失败:{}", e.getMessage(), e);
return false;
}
return true;
}
/** /**
* 删除单个文件或目录 * 删除单个文件或目录
* *
...@@ -244,6 +301,30 @@ public class FileUtils extends org.apache.commons.io.FileUtils { ...@@ -244,6 +301,30 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
throw e; throw e;
} }
} }
/**
* 复制文件
*
* @param filePath
* @param targetPath
* @throws IOException
*/
public static void fileCopy(String filePath, String targetPath) throws IOException {
File targetFile = new File(targetPath);
creatFiles(targetPath);
try (FileInputStream fis = new FileInputStream(filePath);
FileOutputStream fos = new FileOutputStream(targetFile)) {
byte[] buffer = new byte[1024];
int len;
//将文件流信息读取文件缓存区,如果读取结果不为-1就代表文件没有读取完毕,反之已经读取完毕
while ((len = fis.read(buffer)) != -1) {
fos.write(buffer, 0, len);
fos.flush();
}
} catch (Exception e) {
throw e;
}
}
/** /**
* 复制文件 * 复制文件
...@@ -477,6 +558,32 @@ public class FileUtils extends org.apache.commons.io.FileUtils { ...@@ -477,6 +558,32 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
} }
/** /**
* 下载文件到本地
*
* @param httpUrl
* @param localFilePath
*/
public static void downloadUrlFile(String httpUrl, String localFilePath) throws IOException {
// 创建文件
FileUtils.creatFiles(localFilePath);
URL url = new URL(httpUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
try (InputStream is = connection.getInputStream();
OutputStream os = new FileOutputStream(localFilePath)) {
// 这里也很关键每次读取的大小为5M,不一次性读取完
byte[] buffer = new byte[1024 * 1024 * 1];
int len = 0;
while ((len = is.read(buffer)) != -1) {
os.write(buffer, 0, len);
}
} catch (IOException e) {
throw e;
} finally {
connection.disconnect();
}
}
/**
* 下载文件到前端 * 下载文件到前端
* *
* @param url * @param url
...@@ -593,5 +700,43 @@ public class FileUtils extends org.apache.commons.io.FileUtils { ...@@ -593,5 +700,43 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
throw e; throw e;
} }
} }
/**
* 压缩文件夹.
*
* @param sourceFilePath 源文件夹路径
* @param zipFilePath 压缩包路径
*/
public static void zip(String sourceFilePath, String zipFilePath) throws IOException {
File zipFile = new File(zipFilePath);
if (zipFile.exists()) {
zipFile.delete();
}
try (FileOutputStream fos = new FileOutputStream(zipFile);
ZipOutputStream zos = new ZipOutputStream(fos)) {
File[] sourceFiles = new File(sourceFilePath).listFiles();
if (null == sourceFiles || sourceFiles.length < 1) {
log.info("待压缩的文件目录:" + sourceFilePath + "里面不存在文件,无需压缩.");
}
byte[] buffs = new byte[1024 * 10];
for (File sourceFile : sourceFiles) {
// 创建ZIP实体,并添加进压缩包
ZipEntry zipEntry = new ZipEntry(sourceFile.getName());
zos.putNextEntry(zipEntry);
// 读取待压缩的文件并写进压缩包里
try (FileInputStream fis = new FileInputStream(sourceFile);
BufferedInputStream bis = new BufferedInputStream(fis, 1024 * 10)) {
int read = 0;
while ((read = bis.read(buffs, 0, 1024 * 10)) != -1) {
zos.write(buffs, 0, read);
}
} catch (IOException e) {
throw e;
}
}
} catch (IOException e) {
throw e;
}
}
} }
package com.baosight.hpjx.util; package com.baosight.hpjx.util;
import com.baosight.iplat4j.core.data.DaoEPBase; import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.util.Collection; import java.util.Collection;
...@@ -120,6 +122,22 @@ public class ObjectUtils extends org.apache.commons.lang.ObjectUtils { ...@@ -120,6 +122,22 @@ public class ObjectUtils extends org.apache.commons.lang.ObjectUtils {
return items.stream().map(item -> (T) item.get(keyName)).filter(ObjectUtils::isNotBlank).distinct() return items.stream().map(item -> (T) item.get(keyName)).filter(ObjectUtils::isNotBlank).distinct()
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
/**
* 从集合MAP中取KEY
*
* @param inInfo
* @param keyName
* @return
*/
public static <T> List<T> listKey(EiInfo inInfo, String keyName) {
List<Map> items = inInfo.getBlock(EiConstant.resultBlock).getRows();
if (CollectionUtils.isEmpty(items)) {
return null;
}
return items.stream().map(item -> (T) item.get(keyName)).filter(ObjectUtils::isNotBlank).distinct()
.collect(Collectors.toList());
}
/** /**
* 从DaoEPBase中取KEY * 从DaoEPBase中取KEY
......
...@@ -4,21 +4,10 @@ $(function () { ...@@ -4,21 +4,10 @@ $(function () {
"result": { "result": {
exportGrid: false, // 隐藏右侧自定义导出按钮 exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: { pageable: {
pageSize: 10, pageSize: 500,
pageSizes: [20, 50, 70, 100], pageSizes: [20, 50, 100, 250, 500],
}, },
columns: [/*{ columns: [{
field: "operator",
title: "操作",
template: function (model) {
let template = '';
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showQueryRecord(\'' + model.fileId + '\')" >预览记录</a>';
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDownloadRecord(\'' + model.fileId + '\')" >下载记录</a>';
return template;
}
}, */{
field: "changeStart", field: "changeStart",
template: function (item) { template: function (item) {
let template = item["changeStart"] let template = item["changeStart"]
......
...@@ -20,10 +20,6 @@ ...@@ -20,10 +20,6 @@
<EF:EFPage title="变更记录"> <EF:EFPage title="变更记录">
<EF:EFRegion id="inqu" title="查询条件"> <EF:EFRegion id="inqu" title="查询条件">
<div class="row"> <div class="row">
<EF:EFSelect blockId="inqu_status" row="0" ename="factoryCode" cname="工厂名称" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="factory_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect blockId="inqu_status" row="0" ename="projCode" cname="项目名称" colWidth="3" filter="contains" readonly="true"> <EF:EFSelect blockId="inqu_status" row="0" ename="projCode" cname="项目名称" colWidth="3" filter="contains" readonly="true">
<EF:EFOption label="全部" value=""/> <EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="proj_record_block_id" textField="textField" valueField="valueField"/> <EF:EFOptions blockId="proj_record_block_id" textField="textField" valueField="valueField"/>
...@@ -39,16 +35,9 @@ ...@@ -39,16 +35,9 @@
</div> </div>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true"> <EF:EFGrid blockId="result" autoDraw="override" showCount="true" height="73vh" isFloat="true">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/> <EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFComboColumn ename="factoryCode" cname="工厂名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="false" width="160" required="false"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="factory_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="projName" cname="所属项目" width="160" enable="true" readonly="false" align="center" required="false"/> <EF:EFColumn ename="projName" cname="所属项目" width="160" enable="true" readonly="false" align="center" required="false"/>
<%-- <EF:EFComboColumn ename="projCode" cname="所属项目" blockName="proj_record_block_id" <%-- <EF:EFComboColumn ename="projCode" cname="所属项目" blockName="proj_record_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#" columnTemplate="#=textField#" itemTemplate="#=textField#"
......
...@@ -4,8 +4,8 @@ $(function () { ...@@ -4,8 +4,8 @@ $(function () {
"result": { "result": {
exportGrid: false, // 隐藏右侧自定义导出按钮 exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: { pageable: {
pageSize: 20, pageSize: 500,
pageSizes: [20, 50, 70, 100], pageSizes: [20, 50, 100, 250, 500],
}, },
columns: [], columns: [],
loadComplete: function (grid) { loadComplete: function (grid) {
...@@ -33,4 +33,4 @@ $(window).load(function () { ...@@ -33,4 +33,4 @@ $(window).load(function () {
*/ */
let query = function () { let query = function () {
resultGrid.dataSource.page(1); resultGrid.dataSource.page(1);
} }
\ No newline at end of file
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
<EF:EFInput cname="文件ID" ename="fileId" blockId="inqu_status" row="0" colWidth="3" type="hidden"/> <EF:EFInput cname="文件ID" ename="fileId" blockId="inqu_status" row="0" colWidth="3" type="hidden"/>
<EF:EFInput cname="附件ID" ename="docId" blockId="inqu_status" row="0" colWidth="3" type="hidden"/> <EF:EFInput cname="附件ID" ename="docId" blockId="inqu_status" row="0" colWidth="3" type="hidden"/>
<div class="row"> <div class="row">
<EF:EFInput cname="工厂名称" ename="factoryName" blockId="inqu_status" row="0" colWidth="6" ratio="2:10"
readonly="true"/>
<EF:EFInput cname="项目名称" ename="projName" blockId="inqu_status" row="0" colWidth="6" ratio="2:10" <EF:EFInput cname="项目名称" ename="projName" blockId="inqu_status" row="0" colWidth="6" ratio="2:10"
readonly="true"/> readonly="true"/>
</div> </div>
...@@ -32,8 +30,8 @@ ...@@ -32,8 +30,8 @@
</div> </div>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row"> <EF:EFGrid blockId="result" autoDraw="override" showCount="true" height="73vh" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/> <EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="fileId" cname="文件ID" enable="false" width="100" align="center" hidden="true"/> <EF:EFColumn ename="fileId" cname="文件ID" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="docId" cname="附件ID" enable="false" width="100" align="center" hidden="true"/> <EF:EFColumn ename="docId" cname="附件ID" enable="false" width="100" align="center" hidden="true"/>
...@@ -43,5 +41,4 @@ ...@@ -43,5 +41,4 @@
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
</EF:EFPage> </EF:EFPage>
\ No newline at end of file
...@@ -4,8 +4,8 @@ $(function () { ...@@ -4,8 +4,8 @@ $(function () {
"result": { "result": {
exportGrid: false, // 隐藏右侧自定义导出按钮 exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: { pageable: {
pageSize: 20, pageSize: 500,
pageSizes: [20, 50, 70, 100], pageSizes: [20, 50, 100, 200, 500],
}, },
columns: [], columns: [],
loadComplete: function (grid) { loadComplete: function (grid) {
......
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
<EF:EFInput cname="文件ID" ename="fileId" blockId="inqu_status" row="0" colWidth="3" type="hidden"/> <EF:EFInput cname="文件ID" ename="fileId" blockId="inqu_status" row="0" colWidth="3" type="hidden"/>
<EF:EFInput cname="附件ID" ename="docId" blockId="inqu_status" row="0" colWidth="3" type="hidden"/> <EF:EFInput cname="附件ID" ename="docId" blockId="inqu_status" row="0" colWidth="3" type="hidden"/>
<div class="row"> <div class="row">
<EF:EFInput cname="工厂名称" ename="factoryName" blockId="inqu_status" row="0" colWidth="6" ratio="2:10"
readonly="true"/>
<EF:EFInput cname="项目名称" ename="projName" blockId="inqu_status" row="0" colWidth="6" ratio="2:10" <EF:EFInput cname="项目名称" ename="projName" blockId="inqu_status" row="0" colWidth="6" ratio="2:10"
readonly="true"/> readonly="true"/>
</div> </div>
...@@ -32,8 +30,8 @@ ...@@ -32,8 +30,8 @@
</div> </div>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row"> <EF:EFGrid blockId="result" autoDraw="override" showCount="true" height="73vh" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/> <EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="fileId" cname="文件ID" enable="false" width="100" align="center" hidden="true"/> <EF:EFColumn ename="fileId" cname="文件ID" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="docId" cname="附件ID" enable="false" width="100" align="center" hidden="true"/> <EF:EFColumn ename="docId" cname="附件ID" enable="false" width="100" align="center" hidden="true"/>
...@@ -43,5 +41,4 @@ ...@@ -43,5 +41,4 @@
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
</EF:EFPage> </EF:EFPage>
\ No newline at end of file
$(function () { $(function () {
var factoryCodeBox = __eiInfo.getBlock("factory_record_block_id").getMappedRows();
var projCodeBox = __eiInfo.getBlock("proj_record_block_id").getMappedRows(); var projCodeBox = __eiInfo.getBlock("proj_record_block_id").getMappedRows();
$("#QUERY").on("click", query); $("#QUERY").on("click", query);
IPLATUI.EFGrid= { IPLATUI.EFGrid= {
"result": { "result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: { pageable: {
pageSize: 10, pageSize: 500,
pageSizes: [10, 20, 50, 100], pageSizes: [20, 50, 100, 250, 500],
}, },
columns: [ columns: [{
/*{ field: "projCode",
field: "operator", title: "所属项目",
title: "操作", template: function (dataItem) {
template: function (item) { for (let i = 0; i < projCodeBox.length; i++) {
let auditStatus = item.deviceStatus; if (projCodeBox[i]['valueField'] === dataItem['projCode']) {
let template = ''; dataItem['projName'] = projCodeBox[i]['textField']
if (item.id) { return projCodeBox[i]['textField'];
/!*template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="uploadFile(' + item.id + ')" >附件上传</a>';*!/
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id + ',\''+item.factoryCode+'\')" >变更记录</a>';
} }
return template;
}
},*/ {
field: "factoryCode",
title: "工厂名称",
filter: function (option) {
return _.filter(option.values, function (item) {
return item["param1Field"]!="root";
})
},
template: function (dataItem) {
for (let i = 0; i < factoryCodeBox.length; i++) {
if (factoryCodeBox[i]['valueField'] === dataItem['factoryCode']){
dataItem['factoryName'] = factoryCodeBox[i]['textField']
return factoryCodeBox[i]['textField'];
}
}
return dataItem["factoryCode"];
}
}, {
field: "projCode",
title: "所属项目",
filter: function (option) {
let factoryCode = option['factoryCode'];
if (factoryCode){
return _.filter(option.values, function (item) {
return item["param1Field"]=factoryCode;
})
}
return option.values;
},
template: function (dataItem) {
for (let i = 0; i < projCodeBox.length; i++) {
if (projCodeBox[i]['valueField'] === dataItem['projCode']){
dataItem['projName'] = projCodeBox[i]['textField']
return projCodeBox[i]['textField'];
}
}
return dataItem["projCode"];
} }
return dataItem["projCode"];
} }
}
], ],
exportGrid: { exportGrid: {
exportFileName: function (gridInstance) { exportFileName: function (gridInstance) {
...@@ -85,16 +44,6 @@ $(function () { ...@@ -85,16 +44,6 @@ $(function () {
for (let i = 0; i < projCodeBox.length; i++) { for (let i = 0; i < projCodeBox.length; i++) {
if (projCodeBox[i]["valueField"] === item["projCode"]) { if (projCodeBox[i]["valueField"] === item["projCode"]) {
resultGrid.setCellValue(item, 'projName', projCodeBox[i]["textField"]); resultGrid.setCellValue(item, 'projName', projCodeBox[i]["textField"]);
if (isBlank(item["factoryCode"])) {
resultGrid.setCellValue(item, 'factoryCode',
projCodeBox[i]["param1Field"] == "null"
? "" : projCodeBox[i]["param1Field"]
);
resultGrid.setCellValue(item, 'factoryName',
projCodeBox[i]["param2Field"] == "null"
? "" : projCodeBox[i]["param2Field"]
);
}
break; break;
} }
} }
...@@ -103,11 +52,7 @@ $(function () { ...@@ -103,11 +52,7 @@ $(function () {
}, },
onAdd: function (e) { onAdd: function (e) {
$.each(e.items, function (index, item) { $.each(e.items, function (index, item) {
let factoryCode = $("#inqu_status-0-factoryCode").val();
let projCode = $("#inqu_status-0-projCode").val(); let projCode = $("#inqu_status-0-projCode").val();
if (!isBlank(factoryCode)){
item['factoryCode'] = factoryCode;
}
if (!isBlank(projCode)){ if (!isBlank(projCode)){
item['projCode'] = projCode; item['projCode'] = projCode;
} }
...@@ -161,13 +106,7 @@ let save = function (btnNode) { ...@@ -161,13 +106,7 @@ let save = function (btnNode) {
} }
let flag = true; let flag = true;
$.each(rows, function(index, item) { $.each(rows, function(index, item) {
let factoryCode= item.get("factoryCode");
let projCode= item.get("projCode"); let projCode= item.get("projCode");
if(isBlank(factoryCode)){
message("选中的第"+(index+1)+"行\"公司\",不能为空!");
flag = false;
return false;
}
if(isBlank(projCode)){ if(isBlank(projCode)){
message("选中的第"+(index+1)+"行\"所属项目\",不能为空!"); message("选中的第"+(index+1)+"行\"所属项目\",不能为空!");
flag = false; flag = false;
...@@ -195,12 +134,12 @@ let save = function (btnNode) { ...@@ -195,12 +134,12 @@ let save = function (btnNode) {
/** /**
* 显示详情 * 显示详情
*/ */
function showDetail(id,factoryCode) { function showDetail(id) {
let url = "HPWD001A?methodName=initLoad&inqu_status-0-matId="+id+"&inqu_status-0-factoryCode="+factoryCode; let url = "HPWD001A?methodName=initLoad&inqu_status-0-matId="+id;
JSColorbox.open({ JSColorbox.open({
href: url, href: url,
title: "<div style='text-align: center;'>变更记录</div>", title: "<div style='text-align: center;'>变更记录</div>",
width: "75%", width: "75%",
height: "95%", height: "95%",
}); });
} }
\ No newline at end of file
...@@ -22,33 +22,23 @@ ...@@ -22,33 +22,23 @@
<div class="row"> <div class="row">
<EF:EFInput cname="上级组织Id" blockId="inqu_status" ename="parentId" row="0" type="hidden"/> <EF:EFInput cname="上级组织Id" blockId="inqu_status" ename="parentId" row="0" type="hidden"/>
<EF:EFInput cname="上级组织编码" blockId="inqu_status" ename="fileId" row="0" type="hidden"/> <EF:EFInput cname="上级组织编码" blockId="inqu_status" ename="fileId" row="0" type="hidden"/>
<EF:EFInput cname="公司代码" blockId="inqu_status" ename="factoryCode" row="0" type="hidden"/>
<EF:EFInput cname="项目代码" blockId="inqu_status" ename="projCode" row="0" type="hidden"/> <EF:EFInput cname="项目代码" blockId="inqu_status" ename="projCode" row="0" type="hidden"/>
<EF:EFInput cname="层级" blockId="inqu_status" ename="leafLevel" row="0" type="hidden"/> <EF:EFInput cname="层级" blockId="inqu_status" ename="leafLevel" row="0" type="hidden"/>
<EF:EFSelect blockId="inqu_status" row="0" ename="fileType" cname="文件类型" colWidth="3" filter="contains"> <EF:EFSelect blockId="inqu_status" row="0" ename="fileType" cname="目录类型" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/> <EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpwd.fileType"/> <EF:EFCodeOption codeName="hpjx.hpwd.fileType"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFInput blockId="inqu_status" row="0" ename="fileName" cname="文件名称" placeholder="模糊查询" colWidth="3"/> <EF:EFInput blockId="inqu_status" row="0" ename="fileName" cname="目录名称" placeholder="模糊查询" colWidth="3"/>
</div> </div>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row"> <EF:EFGrid blockId="result" autoDraw="override" showCount="true" height="73vh" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/> <EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<%--<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="160" align="center"/>--%> <%--<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="160" align="center"/>--%>
<EF:EFColumn ename="parentId" cname="上级ID" hidden="true"/> <EF:EFColumn ename="parentId" cname="上级ID" hidden="true"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center" defaultValue="0" hidden="true"> <EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center" defaultValue="0" hidden="true">
<EF:EFCodeOption codeName="hpjx.hpwd.status"/> <EF:EFCodeOption codeName="hpjx.hpwd.status"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFComboColumn ename="factoryCode" cname="工厂名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="160" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="factory_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="factoryName" cname="工厂名称" width="160" enable="true" readonly="true" align="center"
required="true" hidden="true"/>
<EF:EFComboColumn ename="projCode" cname="所属项目" blockName="proj_record_block_id" <EF:EFComboColumn ename="projCode" cname="所属项目" blockName="proj_record_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#" columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField" textField="textField" valueField="valueField"
...@@ -56,13 +46,13 @@ ...@@ -56,13 +46,13 @@
align="left" filter="contains" sort="true"/> align="left" filter="contains" sort="true"/>
<EF:EFColumn ename="projName" cname="所属项目" width="160" enable="true" readonly="true" align="center" <EF:EFColumn ename="projName" cname="所属项目" width="160" enable="true" readonly="true" align="center"
required="true" hidden="true"/> required="true" hidden="true"/>
<EF:EFComboColumn ename="fileType" cname="文件类型" width="100" align="center" readonly="false" required="true" <EF:EFComboColumn ename="fileType" cname="目录类型" width="100" align="center" readonly="false" required="true"
defaultValue="20"> defaultValue="20">
<EF:EFCodeOption codeName="hpjx.hpwd.fileType"/> <EF:EFCodeOption codeName="hpjx.hpwd.fileType"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="fileName" cname="文件名称" width="160" enable="true" readonly="false" align="left" <EF:EFColumn ename="fileName" cname="目录名称" width="160" enable="true" readonly="false" align="left"
required="true"/> required="true"/>
<EF:EFColumn ename="fileId" cname="文件号" width="100" enable="false" readonly="true" align="center" <EF:EFColumn ename="fileId" cname="目录号" width="100" enable="false" readonly="true" align="center"
required="false"/> required="false"/>
<EF:EFColumn ename="createdName" cname="创建人" align="center" width="100" readonly="true" required="false" <EF:EFColumn ename="createdName" cname="创建人" align="center" width="100" readonly="true" required="false"
enable="false"/> enable="false"/>
......
$(function () { $(function () {
var factoryCodeBox = __eiInfo.getBlock("factory_record_block_id").getMappedRows();
var projCodeBox = __eiInfo.getBlock("proj_record_block_id").getMappedRows(); var projCodeBox = __eiInfo.getBlock("proj_record_block_id").getMappedRows();
$("#QUERY").on("click", query); $("#QUERY").on("click", query);
IPLATUI.EFGrid= { IPLATUI.EFGrid= {
"result": { "result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: { pageable: {
pageSize: 10, pageSize: 500,
pageSizes: [10, 20, 50, 100], pageSizes: [20, 50, 100, 250, 500],
}, },
columns: [ columns: [],
/*{
field: "operator",
title: "操作",
template: function (item) {
let auditStatus = item.deviceStatus;
let template = '';
if (item.id) {
/!*template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="uploadFile(' + item.id + ')" >附件上传</a>';*!/
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id + ',\''+item.factoryCode+'\')" >变更记录</a>';
}
return template;
}
},*/ {
field: "factoryCode",
title: "工厂名称",
filter: function (option) {
return _.filter(option.values, function (item) {
return item["param1Field"]!="root";
})
},
template: function (dataItem) {
for (let i = 0; i < factoryCodeBox.length; i++) {
if (factoryCodeBox[i]['valueField'] === dataItem['factoryCode']){
dataItem['factoryName'] = factoryCodeBox[i]['textField']
return factoryCodeBox[i]['textField'];
}
}
return dataItem["factoryCode"];
}
}
],
exportGrid: { exportGrid: {
exportFileName: function (gridInstance) { exportFileName: function (gridInstance) {
// 导出的文件名包含时间戳 yyyy-MM-dd HH:mm:ss // 导出的文件名包含时间戳 yyyy-MM-dd HH:mm:ss
...@@ -65,16 +32,6 @@ $(function () { ...@@ -65,16 +32,6 @@ $(function () {
for (let i = 0; i < projCodeBox.length; i++) { for (let i = 0; i < projCodeBox.length; i++) {
if (projCodeBox[i]["valueField"] === item["projCode"]) { if (projCodeBox[i]["valueField"] === item["projCode"]) {
resultGrid.setCellValue(item, 'projName', projCodeBox[i]["textField"]); resultGrid.setCellValue(item, 'projName', projCodeBox[i]["textField"]);
if (isBlank(item["factoryCode"])) {
resultGrid.setCellValue(item, 'factoryCode',
projCodeBox[i]["param1Field"] == "null"
? "" : projCodeBox[i]["param1Field"]
);
resultGrid.setCellValue(item, 'factoryName',
projCodeBox[i]["param2Field"] == "null"
? "" : projCodeBox[i]["param2Field"]
);
}
break; break;
} }
} }
...@@ -129,13 +86,7 @@ let save = function (btnNode) { ...@@ -129,13 +86,7 @@ let save = function (btnNode) {
} }
let flag = true; let flag = true;
$.each(rows, function(index, item) { $.each(rows, function(index, item) {
let factoryCode= item.get("factoryCode");
let projCode= item.get("projName"); let projCode= item.get("projName");
if(isBlank(factoryCode)){
message("选中的第"+(index+1)+"行\"公司\",不能为空!");
flag = false;
return false;
}
if(isBlank(projCode)){ if(isBlank(projCode)){
message("选中的第"+(index+1)+"行\"所属项目\",不能为空!"); message("选中的第"+(index+1)+"行\"所属项目\",不能为空!");
flag = false; flag = false;
...@@ -192,12 +143,12 @@ function updateRelease() { ...@@ -192,12 +143,12 @@ function updateRelease() {
/** /**
* 显示详情 * 显示详情
*/ */
function showDetail(id,factoryCode) { function showDetail(id) {
let url = "HPWD001A?methodName=initLoad&inqu_status-0-matId="+id+"&inqu_status-0-factoryCode="+factoryCode; let url = "HPWD001A?methodName=initLoad&inqu_status-0-matId="+id;
JSColorbox.open({ JSColorbox.open({
href: url, href: url,
title: "<div style='text-align: center;'>变更记录</div>", title: "<div style='text-align: center;'>变更记录</div>",
width: "75%", width: "75%",
height: "95%", height: "95%",
}); });
} }
\ No newline at end of file
...@@ -22,32 +22,22 @@ ...@@ -22,32 +22,22 @@
<div class="row"> <div class="row">
<EF:EFInput cname="上级组织编码" blockId="inqu_status" ename="parentId" row="0" type="hidden"/> <EF:EFInput cname="上级组织编码" blockId="inqu_status" ename="parentId" row="0" type="hidden"/>
<EF:EFInput cname="组织编码" blockId="inqu_status" ename="fileId" row="0" type="hidden"/> <EF:EFInput cname="组织编码" blockId="inqu_status" ename="fileId" row="0" type="hidden"/>
<EF:EFInput cname="工厂代码" blockId="inqu_status" ename="factoryCode" row="0" type="hidden"/>
<EF:EFInput cname="项目代码" blockId="inqu_status" ename="projCode" row="0" type="hidden"/> <EF:EFInput cname="项目代码" blockId="inqu_status" ename="projCode" row="0" type="hidden"/>
<EF:EFInput cname="层级" blockId="inqu_status" ename="leafLevel" row="0" type="hidden"/> <EF:EFInput cname="层级" blockId="inqu_status" ename="leafLevel" row="0" type="hidden"/>
<EF:EFSelect blockId="inqu_status" row="0" ename="fileType" cname="文件类型" colWidth="3" filter="contains"> <EF:EFSelect blockId="inqu_status" row="0" ename="fileType" cname="目录类型" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/> <EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpwd.fileType"/> <EF:EFCodeOption codeName="hggp.hgwd.fileType"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFInput blockId="inqu_status" row="0" ename="fileName" cname="文件名称" placeholder="模糊查询" colWidth="3"/> <EF:EFInput blockId="inqu_status" row="0" ename="fileName" cname="目录名称" placeholder="模糊查询" colWidth="3"/>
</div> </div>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row"> <EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row" showCount="true" height="73vh">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/> <EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<%--<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="160" align="center"/> <%--<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="160" align="center"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center" defaultValue="0"> <EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center" defaultValue="0">
<EF:EFCodeOption codeName="hggp.hgwd.status"/> <EF:EFCodeOption codeName="hggp.hgwd.status"/>
</EF:EFComboColumn>--%> </EF:EFComboColumn>--%>
<EF:EFComboColumn ename="factoryCode" cname="公司名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="160" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="factory_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="factoryName" cname="所属项目" width="160" enable="true" readonly="true" align="center"
required="true" hidden="true"/>
<EF:EFComboColumn ename="projCode" cname="所属项目" blockName="proj_record_block_id" <EF:EFComboColumn ename="projCode" cname="所属项目" blockName="proj_record_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#" columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField" textField="textField" valueField="valueField"
...@@ -55,13 +45,13 @@ ...@@ -55,13 +45,13 @@
align="left" filter="contains" sort="true"/> align="left" filter="contains" sort="true"/>
<EF:EFColumn ename="projName" cname="所属项目" width="160" enable="true" readonly="true" align="center" <EF:EFColumn ename="projName" cname="所属项目" width="160" enable="true" readonly="true" align="center"
required="true" hidden="true"/> required="true" hidden="true"/>
<EF:EFComboColumn ename="fileType" cname="文件类型" width="100" align="center" readonly="false" required="true" <EF:EFComboColumn ename="fileType" cname="目录类型" width="100" align="center" readonly="false" required="true"
defaultValue="20"> defaultValue="20">
<EF:EFCodeOption codeName="hpjx.hpwd.fileType"/> <EF:EFCodeOption codeName="hggp.hgwd.fileType"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="fileName" cname="文件名称" width="160" enable="true" readonly="false" align="left" <EF:EFColumn ename="fileName" cname="目录名称" width="160" enable="true" readonly="false" align="left"
required="true"/> required="true"/>
<EF:EFColumn ename="fileId" cname="文件号" width="100" enable="false" readonly="true" align="center" <EF:EFColumn ename="fileId" cname="目录号" width="100" enable="false" readonly="true" align="center"
required="false"/> required="false"/>
<EF:EFColumn ename="createdName" cname="创建人" align="center" width="100" readonly="true" required="false" <EF:EFColumn ename="createdName" cname="创建人" align="center" width="100" readonly="true" required="false"
enable="false"/> enable="false"/>
......
$(function () {
IPLATUI.EFGrid = {
"result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: {
pageSize: 500,
pageSizes: [20, 50, 100, 250, 500],
},
loadComplete: function (grid) {
}
}
}
// 查询
$("#QUERY").on("click", query);
// 保存
$("#SAVE").on("click", save);
// 授权
$("#AUTH").on("click", auth);
// 删除用户
$("#REMOVE_USER").on("click", removeUser);
// 复制用户
$("#COPY_USER").on("click", copyUser);
});
/**
* 页面加载
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 保存
*/
let save = function () {
if (!checkSelectMain()) {
return;
}
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPWD003", "save", true,
function (e) {
var status = e.status;
if (status !== -1) {
let fileId = $("#inqu_status-0-fileId").val();
parent.JSColorbox.setValueCallback(fileId);
}
});
}
});
}
/**
* 授权
*/
let auth = function () {
if (!checkSelectMain()) {
return;
}
let fileId = $("#inqu_status-0-fileId").val();
let fileName = $("#inqu_status-0-fileName").val();
let params = {
"inqu_status-0-fileId": fileId
}
JSColorbox.open({
href: "HPWD003A",
title: "<div style='text-align: center;'>正在为:【" + fileName + "】授权用户</div>",
width: "70%",
height: "80%",
params: params,
callbackName: authCallback
});
}
/**
* 授权回调
*/
let authCallback = function (res) {
parent.JSColorbox.setValueCallback();
// 刷新页面
query();
}
/**
* 删除授权用户
*/
let removeUser = function () {
if (!checkSelectMain()) {
return;
}
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"取消授权用户\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPWD003", "removeUser",
true
);
}
});
}
/**
* 复制授权用户
*/
let copyUser = function () {
if (!checkSelectMain()) {
return;
}
let fileId = $("#inqu_status-0-fileId").val();
let fileName = $("#inqu_status-0-fileName").val();
let params = {
"inqu_status-0-mainFileId": fileId
}
JSColorbox.open({
href: "HPWD003B",
title: "<div style='text-align: center;'>正在复制:【" + fileName + "】的授权用户...</div>",
width: "70%",
height: "80%",
params: params,
callbackName: copyUserCallback
});
}
/**
* 授权回调
*/
let copyUserCallback = function (res) {
}
/**
* 校验是否选择的目录
*/
let checkSelectMain = function () {
let fileId = $("#inqu_status-0-fileId").val();
if (isBlank(fileId)) {
message("请选择需要目录");
return false;
}
return true;
}
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/10/16
Time: 8:46
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="文档权限管理">
<EF:EFRegion title="查询区" id="inqu">
<EF:EFInput cname="文件ID" ename="fileId" blockId="inqu_status" row="0" type="hidden"/>
<div class="row">
<EF:EFInput cname="文件名称" ename="fileName" blockId="inqu_status" row="0" colWidth="3"
readonly="true"/>
<EF:EFInput cname="部门名称" ename="orgCname" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="用户账号" ename="userId" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="用户姓名" ename="userName" blockId="inqu_status" row="0" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion title="已授权用户结果集" id="result" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row" showCount="true" height="73vh">
<EF:EFColumn ename="id" cname="ID" hidden="true"/>
<EF:EFColumn ename="orgCname" cname="部门名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="userId" cname="用户账号" enable="false" width="100" align="center"/>
<EF:EFColumn ename="userName" cname="用户姓名" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="isProjectManager" cname="是否项目经理" width="100" align="center"
required="true" copy="true">
<EF:EFCodeOption codeName="hpjx.common.yesNo"/>
</EF:EFComboColumn>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
...@@ -162,8 +162,8 @@ $(function () { ...@@ -162,8 +162,8 @@ $(function () {
"result": { "result": {
exportGrid: false, // 隐藏右侧自定义导出按钮 exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: { pageable: {
pageSize: 20, pageSize: 500,
pageSizes: [20, 50, 70, 100], pageSizes: [20, 50, 100, 200, 500],
}, },
columns: [{ columns: [{
field: "operator", field: "operator",
...@@ -255,7 +255,7 @@ let showDownloadRecord = function (fileId, docId) { ...@@ -255,7 +255,7 @@ let showDownloadRecord = function (fileId, docId) {
} }
let preview = function () { let preview = function () {
let url = "HPWD002A?inqu_status-0-fileId=" + $("#inqu_status-0-fileId").val(); let url = "HPWD002A?inqu_status-0-fileId=" + $("#inqu_status-0-fileId").val()+"&inqu_status-0-status=1";
window.open(url, '_blank'); window.open(url, '_blank');
} }
......
...@@ -4,6 +4,7 @@ $(function () { ...@@ -4,6 +4,7 @@ $(function () {
"docTree": { "docTree": {
query: function (inInfo, model) { query: function (inInfo, model) {
inInfo.set("inqu_status-0-fileId", $("#inqu_status-0-fileId").val()); inInfo.set("inqu_status-0-fileId", $("#inqu_status-0-fileId").val());
inInfo.set("inqu_status-0-status", $("#inqu_status-0-status").val());
return inInfo; return inInfo;
}, },
select: function (e) { select: function (e) {
......
...@@ -68,6 +68,7 @@ ...@@ -68,6 +68,7 @@
<div class="col-md-3"> <div class="col-md-3">
<EF:EFRegion title="文件目录树" id="tree" fitHeight="true"> <EF:EFRegion title="文件目录树" id="tree" fitHeight="true">
<EF:EFInput ename="fileId" cname="文件ID" blockId="inqu_status" row="0" type="hidden"/> <EF:EFInput ename="fileId" cname="文件ID" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput ename="status" cname="状态" blockId="inqu_status" row="0" type="hidden"/>
<div id="menu" style="margin-top: 12px; margin-bottom: 8px"> <div id="menu" style="margin-top: 12px; margin-bottom: 8px">
<EF:EFTree bindId="docTree" ename="node" textField="text" valueField="label" hasChildren="leaf" <EF:EFTree bindId="docTree" ename="node" textField="text" valueField="label" hasChildren="leaf"
serviceName="HPWD002A" methodName="queryTree" expandLevel="1"> serviceName="HPWD002A" methodName="queryTree" expandLevel="1">
......
...@@ -48,6 +48,10 @@ $(function () { ...@@ -48,6 +48,10 @@ $(function () {
IPLATUI.EFGrid = { IPLATUI.EFGrid = {
"result": { "result": {
exportGrid: false, // 隐藏右侧自定义导出按钮 exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: {
pageSize: 500,
pageSizes: [20, 50, 100, 250, 500],
},
loadComplete: function (grid) { loadComplete: function (grid) {
} }
} }
......
...@@ -4,8 +4,8 @@ $(function () { ...@@ -4,8 +4,8 @@ $(function () {
"result": { "result": {
exportGrid: false, // 隐藏右侧自定义导出按钮 exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: { pageable: {
pageSize: 20, pageSize: 500,
pageSizes: [20, 50, 100, 150], pageSizes: [20, 50, 100, 250, 500],
}, },
loadComplete: function (grid) { loadComplete: function (grid) {
} }
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="记录集" fitHeight="true"> <EF:EFRegion id="result" title="记录集" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row" height="69vh"> <EF:EFGrid blockId="result" autoDraw="override" checkMode="row" showCount="true" height="69vh">
<EF:EFColumn ename="userId" cname="用户ID" hidden="true" primaryKey="true"/> <EF:EFColumn ename="userId" cname="用户ID" hidden="true" primaryKey="true"/>
<EF:EFColumn ename="depName" cname="部门名称" enable="false" width="120" align="center"/> <EF:EFColumn ename="depName" cname="部门名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="loginName" cname="用户账号" enable="false" width="120" align="center"/> <EF:EFColumn ename="loginName" cname="用户账号" enable="false" width="120" align="center"/>
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="记录集" fitHeight="true"> <EF:EFRegion id="result" title="记录集" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row" height="69vh"> <EF:EFGrid blockId="result" autoDraw="override" checkMode="row" showCount="true" height="69vh">
<EF:EFColumn ename="fileId" cname="目录ID" hidden="true" primaryKey="true"/> <EF:EFColumn ename="fileId" cname="目录ID" hidden="true" primaryKey="true"/>
<EF:EFColumn ename="projCode" cname="项目编号" enable="false" width="120" align="center"/> <EF:EFColumn ename="projCode" cname="项目编号" enable="false" width="120" align="center"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="180" align="left"/> <EF:EFColumn ename="projName" cname="项目名称" enable="false" width="180" align="left"/>
......
...@@ -73,8 +73,20 @@ let download = function () { ...@@ -73,8 +73,20 @@ let download = function () {
message("请选择数据"); message("请选择数据");
return; return;
} }
for (let i = 0; i < rows.length; i++) { if (rows.length == 1){
window.open(downloadHref(rows[i]['changeStartCode']), '_blank'); let docId = rows[0]['changeStartCode'];
if (rows[0]['changeType'] === "uploadAdd" || rows[0]['changeType'] === "uploadDelete") {
docId = rows[0]['changeEndCode'];
}
window.open(downloadHref(docId), '_blank');
}else {
JSUtils.submitGridsData("result", "HPWD004", "batchDownload", false,
function (res) {
if (res.status > -1) {
window.open(res.extAttr.downloadUrl, '_blank');
}
}
);
} }
} }
......
...@@ -20,30 +20,21 @@ ...@@ -20,30 +20,21 @@
<EF:EFPage title="回收站"> <EF:EFPage title="回收站">
<EF:EFRegion id="inqu" title="查询条件"> <EF:EFRegion id="inqu" title="查询条件">
<div class="row"> <div class="row">
<EF:EFSelect blockId="inqu_status" row="0" ename="factoryCode" cname="工厂名称" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="factory_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFInput blockId="inqu_status" row="0" ename="projName" cname="项目名称" placeholder="模糊查询" colWidth="3"/> <EF:EFInput blockId="inqu_status" row="0" ename="projName" cname="项目名称" placeholder="模糊查询" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="changeContent" cname="文件名称" placeholder="模糊查询" colWidth="3"/>
<EF:EFDateSpan startCname="删除开始日期" endCname="删除结束日期" blockId="inqu_status" row="0" colWidth="3" <EF:EFDateSpan startCname="删除开始日期" endCname="删除结束日期" blockId="inqu_status" row="0" colWidth="3"
startName="createdTimeFrom" endName="createdTimeTo" role="date" startName="createdTimeFrom" endName="createdTimeTo" role="date"
format="yyyy-MM-dd" satrtRatio="4:8" endRatio="4:8"/> format="yyyy-MM-dd" satrtRatio="4:8" endRatio="4:8"/>
<EF:EFInput blockId="inqu_status" row="0" ename="changeContent" cname="文件名称" placeholder="模糊查询" colWidth="3"/>
</div> </div>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true"> <EF:EFGrid blockId="result" autoDraw="override" isFloat="true" showCount="true" height="74vh">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/> <EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFComboColumn ename="factoryCode" cname="工厂名称" <EF:EFColumn ename="projCode" cname="项目编码" width="160" enable="true" readonly="false" align="center" required="false"/>
columnTemplate="#=textField#" itemTemplate="#=textField#" <EF:EFColumn ename="projName" cname="项目名称" width="160" enable="true" readonly="false" align="center" required="false"/>
textField="textField" valueField="valueField" <EF:EFColumn ename="changeContent" cname="文件名称" width="160" enable="true" readonly="true" align="center" required="false"/>
maxLength="16" readonly="true" width="160" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="factory_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="projName" cname="项目名称" width="160" enable="true" readonly="false" align="left" required="false"/>
<EF:EFColumn ename="changeContent" cname="文件名称" width="160" enable="true" readonly="true" align="left" required="false"/> <EF:EFColumn ename="changeContent" cname="文件名称" width="160" enable="true" readonly="true" align="left" required="false"/>
<%--<EF:EFColumn ename="changeStartCode" cname="附件ID" width="160" enable="true" readonly="false" align="center" required="false"/>--%> <%--<EF:EFColumn ename="changeStartCode" cname="附件ID" width="160" enable="true" readonly="false" align="center" required="false"/>--%>
<EF:EFColumn ename="changeStart" cname="附件名称" width="160" enable="true" readonly="true" align="left" required="false"/> <EF:EFColumn ename="changeStart" cname="附件名称" width="160" enable="true" readonly="true" align="left" required="false"/>
......
...@@ -2,6 +2,10 @@ $(function () { ...@@ -2,6 +2,10 @@ $(function () {
IPLATUI.EFGrid = { IPLATUI.EFGrid = {
"result": { "result": {
pageable: {
pageSize: 500,
pageSizes: [20, 50, 100, 200, 500],
},
exportGrid: false, // 隐藏右侧自定义导出按钮 exportGrid: false, // 隐藏右侧自定义导出按钮
loadComplete: function (grid) { loadComplete: function (grid) {
} }
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion title="结果集" id="result"> <EF:EFRegion title="结果集" id="result">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row"> <EF:EFGrid blockId="result" autoDraw="override" checkMode="row" showCount="true" height="74vh">
<EF:EFColumn ename="id" cname="ID" hidden="true"/> <EF:EFColumn ename="id" cname="ID" hidden="true"/>
<EF:EFColumn ename="orgCname" cname="部门名称" enable="false" width="120" align="center"/> <EF:EFColumn ename="orgCname" cname="部门名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="userId" cname="用户账号" enable="false" width="100" align="center"/> <EF:EFColumn ename="userId" cname="用户账号" enable="false" width="100" align="center"/>
......
...@@ -4,8 +4,8 @@ $(function () { ...@@ -4,8 +4,8 @@ $(function () {
"result": { "result": {
exportGrid: false, // 隐藏右侧自定义导出按钮 exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: { pageable: {
pageSize: 20, pageSize: 500,
pageSizes: [20, 50, 100, 150], pageSizes: [20, 50, 100, 250, 500],
}, },
loadComplete: function (grid) { loadComplete: function (grid) {
} }
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="记录集" fitHeight="true"> <EF:EFRegion id="result" title="记录集" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row" height="69vh"> <EF:EFGrid blockId="result" autoDraw="override" checkMode="row" showCount="true" height="69vh">
<EF:EFColumn ename="userId" cname="用户ID" hidden="true" primaryKey="true"/> <EF:EFColumn ename="userId" cname="用户ID" hidden="true" primaryKey="true"/>
<EF:EFColumn ename="depName" cname="部门名称" enable="false" width="120" align="center"/> <EF:EFColumn ename="depName" cname="部门名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="loginName" cname="用户账号" enable="false" width="120" align="center"/> <EF:EFColumn ename="loginName" cname="用户账号" enable="false" width="120" align="center"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment