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)));
......
...@@ -6,9 +6,12 @@ import com.baosight.hpjx.common.DdynamicEnum; ...@@ -6,9 +6,12 @@ import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant; 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.security.UserSessionUtils; import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.core.tools.FileTools;
import com.baosight.hpjx.core.tools.Iplat4jTools; import com.baosight.hpjx.core.tools.Iplat4jTools;
import com.baosight.hpjx.core.utils.Iplat4jUtils;
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.domain.HPSC001;
import com.baosight.hpjx.hp.sc.enums.ProjectSourceEnum;
import com.baosight.hpjx.hp.wd.constant.HpWdConstant; import com.baosight.hpjx.hp.wd.constant.HpWdConstant;
import com.baosight.hpjx.hp.wd.constant.HpWdSqlConstant; import com.baosight.hpjx.hp.wd.constant.HpWdSqlConstant;
import com.baosight.hpjx.hp.wd.domain.HPWD001; import com.baosight.hpjx.hp.wd.domain.HPWD001;
...@@ -55,6 +58,12 @@ public class ServiceHPWD001 extends ServiceEPBase { ...@@ -55,6 +58,12 @@ public class ServiceHPWD001 extends ServiceEPBase {
@Override @Override
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
// 未选择文件目录时,返回空
String fileId = MapUtils.getString(queryRow, HPWD001.FIELD_FILE_ID);
if (StringUtils.isBlank(fileId)) {
return inInfo;
}
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPWD001.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0); inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPWD001.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo, HPWD001.QUERY,new HPWD001()); return super.query(inInfo, HPWD001.QUERY,new HPWD001());
} }
...@@ -64,14 +73,14 @@ public class ServiceHPWD001 extends ServiceEPBase { ...@@ -64,14 +73,14 @@ public class ServiceHPWD001 extends ServiceEPBase {
public EiInfo delete(EiInfo inInfo) { public EiInfo delete(EiInfo inInfo) {
int i = 0; int i = 0;
try { try {
HPWD001 hpwd001 = new HPWD001(); HPWD001 hgwd001 = new HPWD001();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) { for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i); Map<?, ?> map = eiBlock.getRow(i);
hpwd001.fromMap(map); hgwd001.fromMap(map);
hpwd001.setDeleteFlag(CommonConstant.YesNo.YES_1); hgwd001.setDeleteFlag(CommonConstant.YesNo.YES_1);
Map map1 = new HashMap(); Map map1 = new HashMap();
map1.put(HPWD001A.FIELD_MAT_ID, hpwd001.getId()); map1.put(HPWD001A.FIELD_MAT_ID, hgwd001.getId());
/*List<HPWD001A> hgwd001AList = DaoBase.getInstance().query(HPWD001A.QUERY, map1); /*List<HPWD001A> hgwd001AList = DaoBase.getInstance().query(HPWD001A.QUERY, map1);
for (HPWD001A hgwd001A:hgwd001AList) { for (HPWD001A hgwd001A:hgwd001AList) {
if (hgwd001A.getChangeType().equals(ChangeTypeEnum.UPLOAD_ADD.getCode()) if (hgwd001A.getChangeType().equals(ChangeTypeEnum.UPLOAD_ADD.getCode())
...@@ -80,10 +89,12 @@ public class ServiceHPWD001 extends ServiceEPBase { ...@@ -80,10 +89,12 @@ public class ServiceHPWD001 extends ServiceEPBase {
} }
}*/ }*/
DaoUtils.update("HPWD099.deleteBizId", DaoUtils.update("HPWD099.deleteBizId",
new HashMap<String,String>(){{put(HPWD099.FIELD_BIZ_ID, hpwd001.getId().toString());}}); //删除附件记录 new HashMap<String, String>() {{
put(HPWD099.FIELD_BIZ_ID, hgwd001.getId().toString());
}}); //删除附件记录
//DaoUtils.update(HPWD001A.DELETE_MAT_ID, map1); //删除变更记录 //DaoUtils.update(HPWD001A.DELETE_MAT_ID, map1); //删除变更记录
hpwd001.setStatus(HpWdConstant.FileStatus.S_0); hgwd001.setStatus(HpWdConstant.FileStatus.S_0);
DaoUtils.update(HPWD001.DELETE, hpwd001); DaoUtils.update(HPWD001.DELETE, hgwd001);
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")}); inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
...@@ -197,8 +208,9 @@ public class ServiceHPWD001 extends ServiceEPBase { ...@@ -197,8 +208,9 @@ public class ServiceHPWD001 extends ServiceEPBase {
} }
} }
// 非管理员仅查询自己有权限的项目 // 非管理员仅查询自己有权限的项目
boolean isAuth = !ProjectSourceEnum.SPARE.getCode().equals(hgwd001.getProjectSource());
String userId = UserSessionUtils.getLoginName(); String userId = UserSessionUtils.getLoginName();
if (!HpWdUtils.HpWd009.isManager(userId)) { if (isAuth && !HpWdUtils.HpWd009.isManager(userId)) {
HPWDTools.HpWd003.checkProjectManager(hgwd001.getFileId()); HPWDTools.HpWd003.checkProjectManager(hgwd001.getFileId());
} }
...@@ -227,12 +239,12 @@ public class ServiceHPWD001 extends ServiceEPBase { ...@@ -227,12 +239,12 @@ public class ServiceHPWD001 extends ServiceEPBase {
strFileName.append(",").append("变更内容:").append(changeContent); strFileName.append(",").append("变更内容:").append(changeContent);
} }
//获取文件下的权限人员 //获取文件下的权限人员
//List<HPWD003> listByFile = HPWDTools.HpWd003.listByFile(hgwd001.getFileId()); /*List<HPWD003> listByFile = HPWDTools.HpWd003.listByFile(hgwd001.getFileId());
//排除登录用户 //排除登录用户
/*List<String> userIds = listByFile.stream().filter(item -> !item.getUserId().equals(UserSessionUtils.getUserId())) List<String> userIds = listByFile.stream().filter(item -> !item.getUserId().equals(UserSessionUtils.getUserId()))
.map(HPWD003::getExtId) .map(HPWD003::getExtId)
.filter(ObjectUtils::isNotBlank).distinct().collect(Collectors.toList());*/ .filter(ObjectUtils::isNotBlank).distinct().collect(Collectors.toList());
//HPWDTools.interaction(String.format("[%s]项目发布通知",hgwd001.getProjName()),strFileName.toString(),userIds); HPWDTools.interaction(String.format("[%s]项目发布通知",hgwd001.getProjName()),strFileName.toString(),userIds);*/
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "发布成功")}); inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "发布成功")});
...@@ -422,17 +434,32 @@ public class ServiceHPWD001 extends ServiceEPBase { ...@@ -422,17 +434,32 @@ public class ServiceHPWD001 extends ServiceEPBase {
*/ */
public EiInfo query2(EiInfo inInfo) { public EiInfo query2(EiInfo inInfo) {
try { try {
Map queryRow =EiInfoUtils.getFirstRow(inInfo, "inqu_status2"); Map queryRow = EiInfoUtils.getFirstRow(inInfo, "inqu_status2");
queryRow.put(HPWD001.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
// 非管理员仅查询自己有权限的项目
String userId = UserSessionUtils.getLoginName();
if (!HpWdUtils.HpWd009.isManager(userId)) {
queryRow.put(User.FIELD_USER_ID, userId);
}
inInfo = super.query(inInfo, HPWD001.QUERY, new HPWD001(), false, new HPWD001().eiMetadata, "inqu_status2",
"result2", "result2", null);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询失败");
}
return inInfo;
}
public EiInfo queryDetail2(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo, "inqu_status2");
queryRow.put(HPWD001.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0); queryRow.put(HPWD001.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
// 非管理员仅查询自己有权限的项目 // 非管理员仅查询自己有权限的项目
String userId = UserSessionUtils.getLoginName(); String userId = UserSessionUtils.getLoginName();
if (!HpWdUtils.HpWd009.isManager(userId)) { if (!HpWdUtils.HpWd009.isManager(userId)) {
queryRow.put(User.FIELD_USER_ID, userId); queryRow.put(User.FIELD_USER_ID, userId);
inInfo.getBlock("inqu_status2").setRows(Collections.singletonList(queryRow));
return super.query(inInfo, HpWdSqlConstant.HpWd001.QUERY_PROJCODE, (DaoEPBase)null, false, (EiBlockMeta)null, "inqu_status2","result2","result2");
} }
inInfo.getBlock("inqu_status2").setRows(Collections.singletonList(queryRow)); inInfo = super.query(inInfo, HpWdSqlConstant.HpWd001.QUERY_ALL, new HPWD001(), false, new HPWD001().eiMetadata, "inqu_status2",
inInfo = super.query(inInfo, HpWdSqlConstant.HpWd001.QUERY_PROJCODE_ALL, (DaoEPBase)null, false, (EiBlockMeta)null, "inqu_status2","result2","result2"); "detail2", "detail2", null);
} catch (Exception e) { } catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询失败"); LogUtils.setMsg(inInfo, e, "查询失败");
} }
...@@ -442,27 +469,27 @@ public class ServiceHPWD001 extends ServiceEPBase { ...@@ -442,27 +469,27 @@ public class ServiceHPWD001 extends ServiceEPBase {
@OperationLogAnnotation(operModul = "文档库",operType = "复制项目",operDesc = "文档库-复制项目-复制项目操作") @OperationLogAnnotation(operModul = "文档库",operType = "复制项目",operDesc = "文档库-复制项目-复制项目操作")
public EiInfo save2(EiInfo inInfo) { public EiInfo save2(EiInfo inInfo) {
try { try {
Map<String,String> queryMap= EiInfoUtils.getFirstRow(inInfo,EiConstant.queryBlock); Map<String, String> queryMap = EiInfoUtils.getFirstRow(inInfo, EiConstant.queryBlock);
List<HPWD001> result1Rows = MapUtils.toDaoEPBases(inInfo.getBlock("result2").getRows(), HPWD001.class); //来源目录
List<HPWD001> hgwd001List = HPWDTools.HpWd001.queryByParentId(queryMap.get(HPWD001.FIELD_PROJ_CODE),queryMap.get(HPWD001.FIELD_PARENT_ID)); List<HPWD001> result2Rows = MapUtils.toDaoEPBases(inInfo.getBlock("result2").getRows(), HPWD001.class);
if (queryMap.get("leafType").equals(HpWdConstant.LeafType.P)){ //目标目录
hgwd001List = HPWDTools.HpWd001.queryByProjCode(queryMap.get(HPWD001.FIELD_PROJ_CODE),queryMap.get(HPWD001.FIELD_PARENT_ID)); List<HPWD001> detail2Rows = MapUtils.toDaoEPBases(inInfo.getBlock("detail2").getRows(), HPWD001.class);
} /*List<HPWD001> hgwd001List = HPWDTools.HgWd001.queryByParentId(queryMap.get(HPWD001.FIELD_PROJ_CODE),
// 要复制项目 queryMap.get(HPWD001.FIELD_PARENT_ID));
String projCode = result1Rows.get(0).getProjCode(); if (queryMap.get("leafType").equals(HgWdConstant.LeafType.P)) {
String projName = result1Rows.get(0).getProjName(); hgwd001List = HPWDTools.HgWd001.queryByProjCode(queryMap.get(HPWD001.FIELD_PROJ_CODE),
String factoryCode = result1Rows.get(0).getFactoryCode(); queryMap.get(HPWD001.FIELD_PARENT_ID));
String factoryName = result1Rows.get(0).getFactoryName(); }*/
if (!StringUtils.isNull(hgwd001List)){ // 要复制目录集合
hgwd001List.forEach(hgwd001 -> { if (Objects.nonNull(detail2Rows)){
hgwd001.setFactoryCode(factoryCode); String parentId = detail2Rows.get(0).getFileId().length()>0?detail2Rows.get(0).getFileId():detail2Rows.get(0).getProjCode();
hgwd001.setFactoryName(factoryName); if (!StringUtils.isNull(result2Rows)) {
hgwd001.setProjCode(projCode); result2Rows.forEach(hgwd001 -> {
hgwd001.setProjName(projName); hgwd001.setParentId(parentId);
hgwd001.setParentId(projCode); });
}); // 查询添加子节点
// 查询添加子节点 addNode(result2Rows);
addNode(hgwd001List); }
} }
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
...@@ -533,6 +560,40 @@ public class ServiceHPWD001 extends ServiceEPBase { ...@@ -533,6 +560,40 @@ public class ServiceHPWD001 extends ServiceEPBase {
return inInfo; return inInfo;
} }
/**
* 批量下载
*
* @param inInfo
* @return
*/
public EiInfo batchDownload(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String fileName = MapUtils.getString(queryMap, HPWD001.FIELD_FILE_NAME);
String zipName = fileName + "_" + DateUtils.shortDateTime();
List<String> docIds = ObjectUtils.listKey(inInfo, HPWD099.FIELD_DOC_ID);
inInfo.set("downloadUrl", Iplat4jUtils.compressFile(docIds, zipName));
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "批量下载失败");
}
return inInfo;
}
/**
* 清理下载的文件
*
* @param inInfo
* @return
*/
public EiInfo clearDownload(EiInfo inInfo) {
try {
FileTools.clearZip();
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "清理下载的文件失败");
}
return inInfo;
}
private static void cleanBaseInfo(HPWD099 hpwd099){ private static void cleanBaseInfo(HPWD099 hpwd099){
hpwd099.setCreatedBy(null); hpwd099.setCreatedBy(null);
hpwd099.setCreatedName(null); hpwd099.setCreatedName(null);
......
...@@ -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
......
$(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();
const init = () => { const init = () => {
$("#HPWD001").css("padding-bottom", "8px") $("#HPWD001").css("padding-bottom", "8px")
sessionStorage.removeItem("__user_id__") sessionStorage.removeItem("__user_id__")
setTimeout(() => { setTimeout(() => {
resultGrid.dataSource.page(1);
// 显示授权按钮 // 显示授权按钮
showAuthButton(); showAuthButton();
}, 1000); }, 1000);
// 查询 // 查询
$("#QUERY").on("click", function (e) { $("#QUERY").on("click", query);
resultGrid.dataSource.page(1);
}); $("#QUERY1").on("click", query1);
$("#QUERY1").on("click", function (e) {
result1Grid.dataSource.page(1);
});
$("#QUERY2").on("click", function (e) { $("#QUERY2").on("click", function (e) {
result2Grid.dataSource.page(1); //result2Grid.dataSource.page(1);
detail2Grid.dataSource.page(1);
}); });
// 分割线组件 // 分割线组件
(function () { (function () {
...@@ -97,6 +94,10 @@ $(function () { ...@@ -97,6 +94,10 @@ $(function () {
IPLATUI.EFTree = { IPLATUI.EFTree = {
"categoryTree": { "categoryTree": {
query: function (inInfo, model) {
inInfo.set("inqu_status-0-projCode", $("#inqu_status-0-projCode").val());
return inInfo;
},
select: function (e) { select: function (e) {
var _data = this.dataItem(e.node); var _data = this.dataItem(e.node);
var labelValue = _data.label; var labelValue = _data.label;
...@@ -107,7 +108,6 @@ $(function () { ...@@ -107,7 +108,6 @@ $(function () {
$("[name = 'inqu_status-0-fileId']").val(eNameValue); $("[name = 'inqu_status-0-fileId']").val(eNameValue);
$("[name = 'inqu_status-0-leafLevel']").val(_data.leafLevel==null?0:_data.leafLevel); $("[name = 'inqu_status-0-leafLevel']").val(_data.leafLevel==null?0:_data.leafLevel);
$("[name = 'inqu_status-0-projCode']").val(_data.projCode); $("[name = 'inqu_status-0-projCode']").val(_data.projCode);
$("[name = 'inqu_status-0-companyCode']").val(_data.companyCode);
$("[name = 'inqu_status-0-type']").val(typeValue); $("[name = 'inqu_status-0-type']").val(typeValue);
$("[name = 'inqu_status-0-fileName']").val(_data.text); $("[name = 'inqu_status-0-fileName']").val(_data.text);
$("[name = 'inqu_status-0-leafType']").val(_data.leafType); $("[name = 'inqu_status-0-leafType']").val(_data.leafType);
...@@ -121,16 +121,21 @@ $(function () { ...@@ -121,16 +121,21 @@ $(function () {
template: function (node) { template: function (node) {
var item = node.item; var item = node.item;
var title = item.text; var title = item.text;
let count = item.count;
let icon = 'fa fa-globe' let icon = 'fa fa-globe'
if (item.label !== 'root') { switch (item.leafType) {
switch (item.leafType) { case 'P':
case 'P': icon = 'fa fa-clipboard'
icon = 'fa fa-clipboard' if (count>0){
break; icon = 'fa fa-clipboard text-success'
case 'C': }
icon = 'fa fa-folder' break;
break; case 'C':
} icon = 'fa fa-folder'
if (count>0){
icon = 'fa fa-folder text-success'
}
break;
} }
return ' <span class="' + icon + '" style="padding-right: 8px"> </span> <span class="titleClass" title="' + item.label + '">' + title + '</span>' return ' <span class="' + icon + '" style="padding-right: 8px"> </span> <span class="titleClass" title="' + item.label + '">' + title + '</span>'
...@@ -192,32 +197,19 @@ $(function () { ...@@ -192,32 +197,19 @@ $(function () {
$("#add").on("click", () => { $("#add").on("click", () => {
const parentId = $("#inqu_status-0-parentId").val(); const parentId = $("#inqu_status-0-parentId").val();
let projCode = $("#inqu_status-0-projCode").val(); let projCode = $("#inqu_status-0-projCode").val();
let companyCode = $("#inqu_status-0-companyCode").val();
let leafLevel = parseInt($("#inqu_status-0-leafLevel").val())+1; let leafLevel = parseInt($("#inqu_status-0-leafLevel").val())+1;
let type = $("#inqu_status-0-type").val(); let type = $("#inqu_status-0-type").val();
if (null == parentId || "" === parentId) { if (null == parentId || "" === parentId) {
message( "请在文档目录树选择任意节点后新增文档目录"); message( "请在文档目录树选择任意节点后新增文档目录");
return return
} }
/*if (type == "company"){
let params = "&inqu_status-0-parentId=" + parentId+"&inqu_status-0-companyCode="+companyCode+"" +
"&inqu_status-0-projCode="+projCode+"&inqu_status-0-leafLevel="+leafLevel;
JSColorbox.open({
href: "HGWD001G?methodName=initLoad" + params,
title: "<div style='text-align: center;'>新增项目</div>",
width: "70%",
height: "70%",
callbackName: addCallback
});
}*/
let params = "&inqu_status-0-parentId=" + parentId+ "" + let params = "&inqu_status-0-parentId=" + parentId+ "" +
"&inqu_status-0-companyCode="+companyCode+"" +
"&inqu_status-0-projCode="+projCode+"&inqu_status-0-leafLevel="+leafLevel; "&inqu_status-0-projCode="+projCode+"&inqu_status-0-leafLevel="+leafLevel;
JSColorbox.open({ JSColorbox.open({
href: "HPWD001E?methodName=initLoad" + params, href: "HPWD001E?methodName=initLoad" + params,
title: "<div style='text-align: center;'>新增文件</div>", title: "<div style='text-align: center;'>新增文件</div>",
width: "70%", width: "85%",
height: "70%", height: "85%",
callbackName: addCallback callbackName: addCallback
}); });
...@@ -287,7 +279,6 @@ $(function () { ...@@ -287,7 +279,6 @@ $(function () {
$("#edit").on("click", () => { $("#edit").on("click", () => {
const orgId = $("#inqu_status-0-parentId").val(); const orgId = $("#inqu_status-0-parentId").val();
let projCode = $("#inqu_status-0-projCode").val(); let projCode = $("#inqu_status-0-projCode").val();
let companyCode = $("#inqu_status-0-companyCode").val();
let leafLevel = parseInt($("#inqu_status-0-leafLevel").val())+1; let leafLevel = parseInt($("#inqu_status-0-leafLevel").val())+1;
let type = $("#inqu_status-0-type").val(); let type = $("#inqu_status-0-type").val();
if (null == orgId || "" === orgId || "root" === orgId) { if (null == orgId || "" === orgId || "root" === orgId) {
...@@ -298,7 +289,7 @@ $(function () { ...@@ -298,7 +289,7 @@ $(function () {
message2("提示", "项目无法编辑!"); message2("提示", "项目无法编辑!");
return return
} }
let params = "&inqu_status-0-fileId=" + orgId +"&inqu_status-0-companyCode="+companyCode+"&inqu_status-0-projCode="+projCode; let params = "&inqu_status-0-fileId=" + orgId +"&inqu_status-0-projCode="+projCode;
JSColorbox.open({ JSColorbox.open({
href: "HPWD001F?methodName=initLoad" + params, href: "HPWD001F?methodName=initLoad" + params,
title: "<div style='text-align: center;'>编辑文件</div>", title: "<div style='text-align: center;'>编辑文件</div>",
...@@ -306,28 +297,39 @@ $(function () { ...@@ -306,28 +297,39 @@ $(function () {
height: "70%", height: "70%",
callbackName: editCallback callbackName: editCallback
}); });
/*if (leafLevel == "2"){ })
let params = "&inqu_status-0-fileId="+orgId+"&inqu_status-0-companyCode="+companyCode+"&inqu_status-0-projCode="+projCode;
JSColorbox.open({ $("#auth").on("click", () => {
href: "HGWD001G?methodName=initLoad" + params, const orgId = $("#inqu_status-0-parentId").val();
title: "<div style='text-align: center;'>编辑项目</div>", let fileName = $("#inqu_status-0-fileName").val();
width: "70%", if (null == orgId || "" === orgId || "root" === orgId) {
height: "70%", message2("提示", "请在文档目录树选择公司节点后编辑文档目录");
callbackName: addCallback return
}); }
}*/ let params = "&inqu_status-0-fileId=" + orgId +"&inqu_status-0-fileName="+fileName;
JSColorbox.open({
href: "HPWD001H?methodName=initLoad" + params,
title: "<div style='text-align: center;'>文档权限管理</div>",
width: "90%",
height: "90%",
callbackName: editCallback
});
}) })
$("#categoryTree").mousedown(function (e) { $("#categoryTree").mousedown(function (e) {
if (e.button !== 2) { if (e.button !== 2) {
return return
} }
if ("组织机构" === e.target.textContent) { if ("工程设计图" === e.target.textContent || "外来制造图" === e.target.textContent || "其他" === e.target.textContent) {
$("#isAdd").css('display', 'none');
$("#isDel").css('display', 'none'); $("#isDel").css('display', 'none');
$("#isEdit").css('display', 'none'); $("#isEdit").css('display', 'none');
$("#isAuth").css('display', 'none');
} else { } else {
$("#isAdd").css('display', 'block');
$("#isDel").css('display', 'block'); $("#isDel").css('display', 'block');
$("#isEdit").css('display', 'block'); $("#isEdit").css('display', 'block');
$("#isAuth").css('display', 'block');
} }
} }
); );
...@@ -346,12 +348,10 @@ $(function () { ...@@ -346,12 +348,10 @@ $(function () {
// 设置当前选中的节点信息 // 设置当前选中的节点信息
$("[name = 'inqu_status-0-parentId']").val(orgId); $("[name = 'inqu_status-0-parentId']").val(orgId);
$("[name = 'inqu_status-0-projCode']").val(data.projCode); $("[name = 'inqu_status-0-projCode']").val(data.projCode);
$("[name = 'inqu_status-0-companyCode']").val(data.companyCode);
$("[name = 'inqu_status-0-type']").val(data.type); $("[name = 'inqu_status-0-type']").val(data.type);
/*$("[name = 'inqu_status-0-fileId']").val(data.ename);*/ /*$("[name = 'inqu_status-0-fileId']").val(data.ename);*/
$("[name = 'inqu_status-0-fileName']").val(data.text); $("[name = 'inqu_status-0-fileName']").val(data.text);
$("[name = 'inqu_status-0-leafLevel']").val(data.leafLevel==null?0:data.leafLevel); $("[name = 'inqu_status-0-leafLevel']").val(data.leafLevel==null?0:data.leafLevel);
$("[name = 'inqu_status-0-leafType']").val(data.leafType);
resultGrid.dataSource.page(1); resultGrid.dataSource.page(1);
// 编辑、删除树节点时,需要刷新的树节点 // 编辑、删除树节点时,需要刷新的树节点
$("[name = 'inqu_status-0-orgParentId']").val(parentOrgId); $("[name = 'inqu_status-0-orgParentId']").val(parentOrgId);
...@@ -365,6 +365,9 @@ $(function () { ...@@ -365,6 +365,9 @@ $(function () {
if (button.data("type") === "edit") { if (button.data("type") === "edit") {
$("#edit").click() $("#edit").click()
} }
if (button.data("type") === "auth") {
$("#auth").click()
}
} }
}); });
...@@ -379,7 +382,7 @@ $(function () { ...@@ -379,7 +382,7 @@ $(function () {
companyCode: '', companyCode: '',
leafLevel: '', leafLevel: '',
leafType: '', leafType: '',
isAuth: '1',
}, },
// expandLevel:1, // expandLevel:1,
/** /**
...@@ -390,12 +393,11 @@ $(function () { ...@@ -390,12 +393,11 @@ $(function () {
} }
}; };
IPLATUI.EFGrid = { IPLATUI.EFGrid = {
"result": { "result": {
exportGrid: false,
pageable: { pageable: {
pageSize: 20, pageSize: 500,
pageSizes: [20, 50, 100, 200, 500], pageSizes: [20, 50, 100, 200, 500],
}, },
loadComplete: function (grid) { loadComplete: function (grid) {
...@@ -445,8 +447,8 @@ $(function () { ...@@ -445,8 +447,8 @@ $(function () {
onSuccess(ei) { onSuccess(ei) {
if (!isBlank(ei.getBlock("result"))){ if (!isBlank(ei.getBlock("result"))){
let rows = ei.getBlock("result").getMappedRows(); let rows = ei.getBlock("result").getMappedRows();
if (rows.length <= 1){ if (rows.length <= 0){
message("文件未分配人员,请先分配人员!"); message("目录未分配人员,请先分配人员!");
return; return;
}else { }else {
$("#releaseWindow").data("kendoWindow").center() $("#releaseWindow").data("kendoWindow").center()
...@@ -469,7 +471,7 @@ $(function () { ...@@ -469,7 +471,7 @@ $(function () {
$("#CHANGE_RECORD").on("click", changeResord); $("#CHANGE_RECORD").on("click", changeResord);
// 复制附件 // 复制附件
$("#COPY_FILE").on("click", copyFile); $("#COPY_FILE").on("click", copyFile);
// 复制文件 // 复制目录
$("#COPY_PROT_FILE").on("click", copyProtFile); $("#COPY_PROT_FILE").on("click", copyProtFile);
// 预览 // 预览
$("#PREVIEW").on("click", preview); $("#PREVIEW").on("click", preview);
...@@ -486,9 +488,9 @@ $(function () { ...@@ -486,9 +488,9 @@ $(function () {
readonly: true, readonly: true,
template: function (item) { template: function (item) {
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'href="' + downloadHref(item.docId) + '">附件下载</a>'; + 'href="' + downloadHref(item.docId) + '">下载</a>';
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="changeFile(\'' + item.docId + '\',\''+item.bizId+'\')" target="_blank">附件变更</a>'; + 'onclick="changeFile(\'' + item.docId + '\',\''+item.bizId+'\')" target="_blank">变更</a>';
return template; return template;
} }
}, { }, {
...@@ -512,25 +514,37 @@ $(function () { ...@@ -512,25 +514,37 @@ $(function () {
pageSize: 10, pageSize: 10,
pageSizes: [10, 20, 50, 100], pageSizes: [10, 20, 50, 100],
}, },
checkMode: "single", // 行的勾选模式 query: function (e) {
loadComplete: function (grid) { let inEiInfo = new EiInfo();
let fileId = IPLATUI.EFTree.categoryTree.selectTreeNode.parentId;
grid.dataSource.bind("change", function(e) { inEiInfo.set("inqu_status2-0-parentId", fileId);
// 判断父级节点是否发生变化 return inEiInfo;
if (e.field === "factoryCode") { }
let item = e.items[0]; },
for (let i = 0; i < factoryCodeBox.length; i++) { "detail2":{
if (factoryCodeBox[i]["valueField"] === item["factoryCode"]) { exportGrid: false, // 隐藏右侧自定义导出按钮
result2Grid.setCellValue(item, 'factoryName', factoryCodeBox[i]["textField"]); pageable: {
break; pageSize: 5,
} pageSizes: [5, 10, 20, 50, 100],
}
}
});
}, },
} }
}; };
IPLATUI.EFWindow = {
"selectProjWindow": {
close: function (e) {
// 刷新表格
resultGrid.dataSource.page(1);
}
},
"releaseWindow": {
close: function (e) {
// 刷新表格
resultGrid.dataSource.page(1);
}
}
};
downKeyUp(); downKeyUp();
// 查询 // 查询
...@@ -539,12 +553,18 @@ $(function () { ...@@ -539,12 +553,18 @@ $(function () {
$("#SAVE2").on("click", saveProtFunc); $("#SAVE2").on("click", saveProtFunc);
//确认发布 //确认发布
$("#confirmRelease").on("click", updateRelease); $("#confirmRelease").on("click", updateRelease);
// 批量下载
$("#BATCH_DOWNLOAD").on("click", batchDownload);
}); });
let query = function () { let query = function () {
resultGrid.dataSource.page(1); resultGrid.dataSource.page(1);
} }
let query1 = function () {
result1Grid.dataSource.page(1);
}
/** /**
* 新增组织机构回调 * 新增组织机构回调
*/ */
...@@ -577,7 +597,12 @@ let addCallback = function (rows) { ...@@ -577,7 +597,12 @@ let addCallback = function (rows) {
*/ */
let editCallback = function (parentOrgId) { let editCallback = function (parentOrgId) {
// 回填父级ID // 回填父级ID
//$("#inqu_status-0-orgParentId").val(parentOrgId); if (parentOrgId != null){
$("#inqu_status-0-orgParentId").val(parentOrgId);
}else {
let parentId = IPLATUI.EFTree.categoryTree.selectTreeNode.parentId;
$("#inqu_status-0-orgParentId").val(parentId);
}
refreshTree(); refreshTree();
} }
...@@ -690,6 +715,7 @@ let setTreeNodeValue = function (nodeData) { ...@@ -690,6 +715,7 @@ let setTreeNodeValue = function (nodeData) {
IPLATUI.EFTree.categoryTree.selectTreeNode.projCode = nodeData.projCode; IPLATUI.EFTree.categoryTree.selectTreeNode.projCode = nodeData.projCode;
IPLATUI.EFTree.categoryTree.selectTreeNode.leafLevel = nodeData.leafLevel; IPLATUI.EFTree.categoryTree.selectTreeNode.leafLevel = nodeData.leafLevel;
IPLATUI.EFTree.categoryTree.selectTreeNode.leafType = nodeData.leafType; IPLATUI.EFTree.categoryTree.selectTreeNode.leafType = nodeData.leafType;
IPLATUI.EFTree.categoryTree.selectTreeNode.isAuth = nodeData.isAuth;
} }
/** /**
...@@ -831,18 +857,33 @@ function updateRelease(operStatus) { ...@@ -831,18 +857,33 @@ function updateRelease(operStatus) {
let showAuthButton = function () { let showAuthButton = function () {
let leafType = IPLATUI.EFTree.categoryTree.selectTreeNode.leafType; let leafType = IPLATUI.EFTree.categoryTree.selectTreeNode.leafType;
let parentId = IPLATUI.EFTree.categoryTree.selectTreeNode.fileId; let parentId = IPLATUI.EFTree.categoryTree.selectTreeNode.fileId;
let leafLevel = IPLATUI.EFTree.categoryTree.selectTreeNode.leafLevel;
let isAuth = IPLATUI.EFTree.categoryTree.selectTreeNode.isAuth;
let changeRecord = $("#CHANGE_RECORD").hide();
if (!isBlank(leafLevel) && leafLevel == 0){
changeRecord.show();
}
// C:目录 // C:目录
if (isBlank(leafType) || leafType=="P") { if (isBlank(leafType) || leafType != "C") {
$("#RELEASE").attr("disabled", true); $("#RELEASE").hide();
$("#UPLOAD_FILE").attr("disabled", true); $("#UPLOAD_FILE").hide();
$("#CHANGE_RECORD").attr("disabled", false); $("#COPY_FILE").hide();
$("#COPY_FILE").attr("disabled", true); $("#COPY_PROT_FILE").hide();
$("#PREVIEW").attr("disabled", true); $("#PREVIEW").hide();
}else { $("#BATCH_DOWNLOAD").hide();
$("#CHANGE_RECORD").attr("disabled", true); return
isProjectManager(parentId); }
// 0:不授权
if (isAuth == 0) {
$("#RELEASE").show();
$("#UPLOAD_FILE").show();
$("#COPY_FILE").show();
$("#COPY_PROT_FILE").show();
$("#PREVIEW").show();
$("#BATCH_DOWNLOAD").show();
return;
} }
isProjectManager(parentId);
} }
/** /**
...@@ -864,7 +905,7 @@ function changeResord() { ...@@ -864,7 +905,7 @@ function changeResord() {
} }
/** /**
* 复制 * 复制
*/ */
let copyFile = function () { let copyFile = function () {
let rowsDate = resultGrid.getCheckedRows(); let rowsDate = resultGrid.getCheckedRows();
...@@ -879,7 +920,7 @@ let copyFile = function () { ...@@ -879,7 +920,7 @@ let copyFile = function () {
} }
/** /**
* 复制 * 复制
*/ */
function saveFunc() { function saveFunc() {
var rows = result1Grid.getCheckedRows(); var rows = result1Grid.getCheckedRows();
...@@ -894,7 +935,6 @@ function saveFunc() { ...@@ -894,7 +935,6 @@ function saveFunc() {
if (ei.getStatus() >= 0) { if (ei.getStatus() >= 0) {
try { try {
$("#selectOrgWindow").data("kendoWindow").close() $("#selectOrgWindow").data("kendoWindow").close()
$("#inqu_status1-0-companyCode").val('');
$("#inqu_status1-0-projName").val(''); $("#inqu_status1-0-projName").val('');
$("#inqu_status1-0-fileType").val(''); $("#inqu_status1-0-fileType").val('');
$("#inqu_status1-0-fileName").val(''); $("#inqu_status1-0-fileName").val('');
...@@ -916,7 +956,7 @@ function saveFunc() { ...@@ -916,7 +956,7 @@ function saveFunc() {
} }
/** /**
* 复制项目 * 复制目录
*/ */
let copyProtFile = function () { let copyProtFile = function () {
let parentId = IPLATUI.EFTree.categoryTree.selectTreeNode.parentId; let parentId = IPLATUI.EFTree.categoryTree.selectTreeNode.parentId;
...@@ -928,95 +968,107 @@ let copyProtFile = function () { ...@@ -928,95 +968,107 @@ let copyProtFile = function () {
selectOrgWindow.data("kendoWindow").center(); selectOrgWindow.data("kendoWindow").center();
selectOrgWindow.data("kendoWindow").open(); selectOrgWindow.data("kendoWindow").open();
result2Grid.dataSource.page(1); result2Grid.dataSource.page(1);
detail2Grid.dataSource.page(1);
} }
/** /**
* 复制项目 * 复制目录
*/ */
function saveProtFunc() { function saveProtFunc() {
let rows = result2Grid.getCheckedRows(); let resultRows = result2Grid.getCheckedRows();
if (rows.length == 0) { let detailRows = detail2Grid.getCheckedRows();
message("请勾选数据文件!"); if (resultRows.length == 0) {
message("请勾选来源项目目录文件!");
return; return;
} }
let flag = true; if (detailRows.length == 0){
rows.forEach(function (row, index) { message("请勾选目标项目目录文件!");
if (isBlank(row.factoryCode)) { return;
message("选中的第"+(index+1)+"行请选择工厂名称"); }
flag = false; let parentId = detailRows[0].parentId
} JSUtils.confirm("确定对勾选中的[" + resultRows.length + "]条数据\"确认\"操作?", {
}) ok: function () {
if (flag){ JSUtils.submitGridsData("result2,detail2", "HPWD001", "save2", true,
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据\"确认\"操作?", { function (ei) {
ok: function () { if (ei.getStatus() >= 0) {
JSUtils.submitGridsData("result2", "HPWD001", "save2", true, try {
function (ei) { $("#selectProjWindow").data("kendoWindow").close()
if (ei.getStatus() >= 0) { $("#inqu_status2-0-projName").val('');
try { const tree = $('#categoryTree').data('kendoTreeView');
$("#selectProjWindow").data("kendoWindow").close() // 刷新树节点
$("#inqu_status2-0-companyCode").val(''); tree.reload(parentId)
$("#inqu_status2-0-projName").val(''); tree.select();
var tree = $('#categoryTree').data('kendoTreeView');
$("#inqu_status-0-orgParentId").val("$") } catch (e) {
// 刷新树节点 // TODO: handle exception
tree.select(); }
refreshTree(); if (ei.getStatus() == 0) {
} catch (e) { NotificationUtil(ei, 'warning');
// TODO: handle exception
}
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else {
NotificationUtil(ei);
}
} else { } else {
NotificationUtil(ei, "error"); NotificationUtil(ei);
} }
}); } else {
} NotificationUtil(ei, "error");
}) }
} });
}
})
} }
/**
* 预览
*/
let preview = function () { let preview = function () {
let url = "HPWD002A?inqu_status-0-fileId=" + $("#inqu_status-0-parentId").val(); let fileId = IPLATUI.EFTree.categoryTree.selectTreeNode.fileId;
let url = "HPWD002A?inqu_status-0-fileId=" + fileId+"&inqu_status-0-status=0";
window.open(url, '_blank'); window.open(url, '_blank');
} }
let isProjectManager = function (parentId) { let isProjectManager = function (parentId) {
let inEiInfo = new EiInfo(); let inEiInfo = new EiInfo();
inEiInfo.set("inqu_status-0-fileId", parentId); inEiInfo.set("inqu_status-0-fileId", parentId);
//inEiInfo.set("inqu_status-0-userId", $("#inqu_status-0-userId").val()); $("#COPY_PROT_FILE").show();
$("#BATCH_DOWNLOAD").show();
$("#RELEASE").show();
$("#UPLOAD_FILE").show();
$("#COPY_FILE").show();
$("#PREVIEW").show();
EiCommunicator.send("HPWD001", "queryProjectManager", inEiInfo, { EiCommunicator.send("HPWD001", "queryProjectManager", inEiInfo, {
onSuccess(ei) { onSuccess(ei) {
if (ei.status != -1){ if (ei.status != -1){
switch (ei.extAttr.isManager) { switch (ei.extAttr.isManager) {
case 1: case 1:
$("#RELEASE").attr("disabled", false);
$("#UPLOAD_FILE").attr("disabled", false);
$("#COPY_FILE").attr("disabled", false);
$("#PREVIEW").attr("disabled", false);
break;
case 2: case 2:
$("#RELEASE").attr("disabled", false); break
$("#UPLOAD_FILE").attr("disabled", false);
$("#COPY_FILE").attr("disabled", false);
$("#PREVIEW").attr("disabled", false);
break;
case 3: case 3:
$("#RELEASE").attr("disabled", true); $("#RELEASE").hide();
$("#UPLOAD_FILE").attr("disabled", false);
$("#COPY_FILE").attr("disabled", false);
$("#PREVIEW").attr("disabled", false);
break break
default: default:
$("#RELEASE").attr("disabled", true); $("#RELEASE").hide();
$("#UPLOAD_FILE").attr("disabled", true); $("#UPLOAD_FILE").hide();
$("#COPY_FILE").attr("disabled", true); $("#COPY_FILE").hide();
$("#PREVIEW").attr("disabled", true); $("#PREVIEW").hide();
$("#COPY_PROT_FILE").hide();
} }
} }
} }
}, { }, {async: false})
async: false }
})
} /**
\ No newline at end of file * 批量下载
*/
let batchDownload = function () {
var rows = resultGrid.getCheckedRows();
if (rows.length == 0) {
message("请先勾选要下载的数据!");
return;
}
JSUtils.submitGridsData("result", "HPWD001", "batchDownload", false,
function (res) {
if (res.status > -1) {
window.open(res.extAttr.downloadUrl, '_blank');
}
}
);
}
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
<EF:EFButton ename="add" class="fa fa-plus" layout="2"/> <EF:EFButton ename="add" class="fa fa-plus" layout="2"/>
<EF:EFButton ename="remove" class="fa fa-trash-o" layout="2"/> <EF:EFButton ename="remove" class="fa fa-trash-o" layout="2"/>
<EF:EFButton ename="edit" class="fa fa-pencil" layout="2"/> <EF:EFButton ename="edit" class="fa fa-pencil" layout="2"/>
<EF:EFButton ename="auth" class="fa fa-pencil" layout="2"/>
</div> </div>
</div> </div>
...@@ -42,8 +43,8 @@ ...@@ -42,8 +43,8 @@
</EF:EFTree> </EF:EFTree>
</div> </div>
<ul id="menumenu" style="width:90px;display: none"> <ul id="menumenu" style="width:100px;display: none">
<li data-type="create"> <li data-type="create" id="isAdd">
<span style="font-size: 16px; width: 16px; vertical-align: middle;" class="fa fa-plus"></span>新增 <span style="font-size: 16px; width: 16px; vertical-align: middle;" class="fa fa-plus"></span>新增
</li> </li>
<li data-type="delete" id="isDel"> <li data-type="delete" id="isDel">
...@@ -52,34 +53,44 @@ ...@@ -52,34 +53,44 @@
<li data-type="edit" id="isEdit"> <li data-type="edit" id="isEdit">
<span style="font-size: 16px; width: 16px; vertical-align: middle;" class="fa fa-pencil"></span>编辑 <span style="font-size: 16px; width: 16px; vertical-align: middle;" class="fa fa-pencil"></span>编辑
</li> </li>
<li data-type="auth" id="isAuth">
<span style="font-size: 16px; width: 16px; vertical-align: middle;" class="fa fa-pencil"></span>文档权限
</li>
</ul> </ul>
</EF:EFRegion> </EF:EFRegion>
</div> </div>
<div id="right-pane" class="i-fit-height"> <div id="right-pane" class="i-fit-height">
<EF:EFRegion id="inqu" title="查询条件"> <EF:EFRegion id="inqu" title="查询条件">
<div class="row"> <div class="row">
<EF:EFInput cname="工厂代码" ename="factoryCode" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="项目代码" ename="projCode" blockId="inqu_status" row="0" type="hidden"/> <EF:EFInput cname="项目代码" ename="projCode" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="文档库id" ename="parentId" blockId="inqu_status" row="0" type="hidden"/> <EF:EFInput cname="文档库id" ename="parentId" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="文档库id" ename="fileId" blockId="inqu_status" row="0" type="hidden"/> <EF:EFInput cname="文档库id" ename="fileId" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="类型" ename="type" blockId="inqu_status" row="0" type="hidden"/> <EF:EFInput cname="类型" ename="type" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="是否是文件" ename="leafType" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="层级" ename="leafLevel" blockId="inqu_status" row="0" type="hidden"/> <EF:EFInput cname="层级" ename="leafLevel" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="是否是文件" ename="leafType" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="文档库名称" ename="fileName" blockId="inqu_status" row="0" type="hidden"/> <EF:EFInput cname="文档库名称" ename="fileName" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="父级Id" ename="orgParentId" blockId="inqu_status" row="0" type="hidden"/> <EF:EFInput cname="父级Id" ename="orgParentId" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="登录用户" ename="userId" blockId="inqu_status" row="0" colWidth="3" value="${loginName}" type="hidden"/> <EF:EFInput cname="登录用户" ename="userId" blockId="inqu_status" row="0" colWidth="3" value="${loginName}" type="hidden"/>
<EF:EFInput cname="业务类型" ename="bizType" blockId="inqu_status" row="0" type="hidden" value="WD"/> <EF:EFInput cname="业务类型" ename="bizType" blockId="inqu_status" row="0" type="hidden" value="WD"/>
<EF:EFInput cname="文件名称" ename="docName" blockId="inqu_status" row="0" colWidth="3" /> <EF:EFInput cname="附件名称" ename="docName" blockId="inqu_status" row="0" colWidth="3" />
<EF:EFSelect blockId="inqu_status" row="0" ename="status" cname="状态" colWidth="3">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpwd.status"/>
</EF:EFSelect>
<EF:EFDateSpan startCname="修改时间" endCname="至" blockId="inqu_status" row="0"
startName="updateDateFrom" endName="updateDateTo" role="date"
format="yyyy-MM-dd" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="false">
</EF:EFDateSpan>
</div> </div>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="明细信息" fitHeight="true"> <EF:EFRegion id="result" title="明细信息" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="no" personal="true" serviceName="HPWD099" queryMethod="query" <EF:EFGrid blockId="result" autoDraw="no" autoBind="false" showCount="true" height="74vh" sort="all"
deleteMethod="delete"> serviceName="HPWD099" queryMethod="query" deleteMethod="delete">
<EF:EFColumn ename="id" cname="ID" hidden="true"/> <EF:EFColumn ename="id" cname="ID" hidden="true"/>
<EF:EFColumn ename="docId" cname="文件ID" enable="false" width="180" hidden="true"/> <EF:EFColumn ename="docId" cname="文件ID" enable="false" width="180" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" enable="false" width="140" align="center" sort="false"/> <EF:EFColumn ename="operator" cname="操作" enable="false" width="100" align="center" sort="false"/>
<EF:EFColumn ename="docName" cname="件名称" enable="false" width="180"/> <EF:EFColumn ename="docName" cname="件名称" enable="false" width="180"/>
<EF:EFColumn ename="docType" cname="件类型" enable="false" width="110" align="center"/> <EF:EFColumn ename="docType" cname="件类型" enable="false" width="110" align="center"/>
<EF:EFColumn ename="docVersion" cname="版本号" enable="false" width="90" align="center" sort="true"/> <EF:EFColumn ename="docVersion" cname="版本号" enable="false" width="90" align="center" sort="true"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="100" align="center" <EF:EFComboColumn ename="status" cname="状态" enable="false" width="100" align="center"
defaultValue="0" hidden="false"> defaultValue="0" hidden="false">
...@@ -109,14 +120,10 @@ ...@@ -109,14 +120,10 @@
</div> </div>
</EF:EFWindow> </EF:EFWindow>
<%--复制附件--%>
<EF:EFWindow id="selectOrgWindow" width="70%" height="70%" title="选择文档"> <EF:EFWindow id="selectOrgWindow" width="70%" height="70%" title="选择文档">
<EF:EFRegion id="inqu1" title="查询条件"> <EF:EFRegion id="inqu1" title="查询条件">
<div class="row"> <div class="row">
<EF:EFSelect blockId="inqu_status1" 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_status1" row="0" ename="projName" cname="项目名称" colWidth="3" placeholder="模糊查询项目名称"/> <EF:EFInput blockId="inqu_status1" row="0" ename="projName" cname="项目名称" colWidth="3" placeholder="模糊查询项目名称"/>
<EF:EFSelect blockId="inqu_status1" row="0" ename="fileType" cname="文件类型" colWidth="3" filter="contains"> <EF:EFSelect blockId="inqu_status1" row="0" ename="fileType" cname="文件类型" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/> <EF:EFOption label="全部" value=""/>
...@@ -126,77 +133,86 @@ ...@@ -126,77 +133,86 @@
</div> </div>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result1" title="明细信息" > <EF:EFRegion id="result1" title="明细信息" >
<EF:EFGrid blockId="result1" autoDraw="override" isFloat="true" checkMode="row" queryMethod="query1"> <EF:EFGrid blockId="result1" autoDraw="override" autoBind="false" isFloat="true" checkMode="row"
queryMethod="query1">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/> <EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="parentId" cname="上级ID" hidden="true"/> <EF:EFColumn ename="parentId" cname="上级ID" hidden="true"/>
<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"
maxLength="16" readonly="true" width="200" required="true" maxLength="16" readonly="true" width="200" required="true"
align="center" 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="left"
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="center" <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:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
</EF:EFWindow> </EF:EFWindow>
<%--复制项目下的所以文件--%> <%--复制目录--%>
<EF:EFWindow id="selectProjWindow" width="70%" height="70%" title="选择文档"> <EF:EFWindow id="selectProjWindow" width="70%" height="90%" title="选择文档">
<EF:EFRegion id="inqu2" title="查询条件"> <EF:EFRegion id="inqu2" title="查询条件">
<div class="row"> <div class="row">
<EF:EFSelect blockId="inqu_status2" row="0" ename="factoryCode" cname="工厂名称" colWidth="3" filter="contains"> <EF:EFInput blockId="inqu_status2" row="0" ename="projCode" cname="项目编码" colWidth="3" placeholder="模糊查询项目编码"/>
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="factory_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFInput blockId="inqu_status2" row="0" ename="projName" cname="项目名称" colWidth="3" placeholder="模糊查询项目名称"/> <EF:EFInput blockId="inqu_status2" row="0" ename="projName" cname="项目名称" colWidth="3" placeholder="模糊查询项目名称"/>
<EF:EFInput blockId="inqu_status2" row="0" ename="fileName" cname="目录名称" colWidth="3" placeholder="模糊查询目录名称"/>
</div> </div>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result2" title="明细信息" > <EF:EFRegion id="detail2" title="目标目录信息" >
<EF:EFGrid blockId="result2" autoDraw="override" isFloat="true" queryMethod="query2"> <EF:EFGrid blockId="detail2" autoDraw="override" autoBind="false" isFloat="true" checkMode="single" queryMethod="queryDetail2">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/> <EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="parentId" cname="上级ID" hidden="true"/> <EF:EFColumn ename="parentId" cname="上级ID" hidden="true"/>
<EF:EFComboColumn ename="factoryCode" cname="工厂名称" <%--<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"
maxLength="16" readonly="false" width="160" required="true" maxLength="16" readonly="true" width="200" required="true"
align="center" filter="contains" sort="true"> align="center" filter="contains" sort="true"/>--%>
<EF:EFOptions blockId="factory_record_block_id" textField="textField" valueField="valueField"/> <EF:EFColumn ename="projCode" cname="项目编码" width="160" enable="true" readonly="true" align="center"
required="true"/>
<EF:EFColumn ename="projName" cname="项目名称" width="160" enable="true" readonly="true" align="center"
required="true"/>
<EF:EFComboColumn ename="fileType" cname="目录类型" width="100" align="center" readonly="false" required="true" defaultValue="20">
<EF:EFCodeOption codeName="hpjx.hpwd.fileType"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="factoryName" cname="公司名称" width="160" enable="true" readonly="true" align="center" <EF:EFColumn ename="fileName" cname="目录名称" width="160" enable="true" readonly="false" align="center" required="true"/>
required="true" hidden="true"/> <EF:EFColumn ename="fileId" cname="目录号" width="100" enable="false" readonly="true" align="center" required="false"/>
<EF:EFComboColumn ename="projCode" cname="项目名称" blockName="proj_record_block_id" </EF:EFGrid>
</EF:EFRegion>
<EF:EFRegion id="result2" title="来源目录信息" >
<EF:EFGrid blockId="result2" autoDraw="override" autoBind="false" isFloat="true" checkMode="row " queryMethod="query2">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="parentId" cname="上级ID" hidden="true"/>
<%--<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"
maxLength="16" readonly="true" width="200" required="true" maxLength="16" readonly="true" width="200" required="true"
align="center" filter="contains" sort="true"/> align="center" filter="contains" sort="true"/>--%>
<EF:EFColumn ename="projCode" cname="项目编码" width="160" enable="true" readonly="true" align="center"
required="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"/>
<EF:EFComboColumn ename="fileType" cname="目录类型" width="100" align="center" readonly="false" required="true"
defaultValue="20">
<EF:EFCodeOption codeName="hggp.hgwd.fileType"/>
</EF:EFComboColumn>
<EF:EFColumn ename="fileName" cname="目录名称" width="160" enable="true" readonly="false" align="center"
required="true"/>
<EF:EFColumn ename="fileId" cname="目录号" width="100" enable="false" readonly="true" align="center"
required="false"/>
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
</EF:EFWindow> </EF:EFWindow>
<EF:EFWindow id="releaseWindow" title="发布变更" width="50%" height="30%"> <EF:EFWindow id="releaseWindow" title="发布变更" width="50%" height="30%">
<EF:EFRegion id="inqu2" title=""> <EF:EFRegion id="inqu3" title="">
<EF:EFInput blockId="inqu_status" row="0" ename="changeContent" cname="变更内容" type="textarea" <EF:EFInput blockId="inqu_status" row="0" ename="changeContent" cname="变更内容" type="textarea" colWidth="12" ratio="2:10" required="true"/>
colWidth="12" ratio="2:10" required="true" style="height:100px"/>
</EF:EFRegion> </EF:EFRegion>
<div style="display: flex;justify-content: flex-end;"> <div style="display: flex;justify-content: flex-end;">
<EF:EFButton ename="confirmRelease" cname="确认发布"/> <EF:EFButton ename="confirmRelease" cname="确认发布"/>
......
...@@ -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