Commit bc8f28c2 by liuyang

2024-09-26 复制德诚图文管理功能

parent b90a3719
package com.baosight.hpjx.common;
/**
* @author LiuYang
* @version 1.0 2024/9/18
* @description 变更类型
*/
public enum ChangeTypeEnum {
ADD("add", "添加"),
UPDATE("update", "修改"),
DELETE("delete", "删除"),
UPLOAD_ADD("uploadAdd", "附件添加"),
UPLOAD_UPDATE("uploadUpdate", "附件变更"),
UPLOAD_DELETE("uploadDelete", "附件删除"),
RELEASE("release", "发布"),
;
private String code;
private String value;
ChangeTypeEnum(String code, String value) {
this.code = code;
this.value = value;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
package com.baosight.hpjx.common;
/**
* @author LiuYang
* @version 1.0 2024/9/18
* @description
*/
public enum DeleteFlagEnum {
UN_REMOVE(0, "未删除"),
REMOVE(1, "已删除"),
;
private Integer code;
private String name;
DeleteFlagEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
package com.baosight.hpjx.controller; package com.baosight.hpjx.controller;
import com.baosight.hpjx.core.constant.S3Constant;
import com.baosight.hpjx.core.tools.ThreadLocalTools; import com.baosight.hpjx.core.tools.ThreadLocalTools;
import com.baosight.hpjx.core.utils.Iplat4jUtils;
import com.baosight.hpjx.core.utils.S3Utils;
import com.baosight.hpjx.util.FileUtils; import com.baosight.hpjx.util.FileUtils;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils; import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.StringUtils; import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.common.eu.domain.Teudm05;
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;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
...@@ -19,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -19,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URL; import java.net.URL;
...@@ -39,6 +44,31 @@ import lombok.extern.slf4j.Slf4j; ...@@ -39,6 +44,31 @@ import lombok.extern.slf4j.Slf4j;
@CrossOrigin @CrossOrigin
@RequestMapping({"/file/download"}) @RequestMapping({"/file/download"})
public class FileDownloadController { public class FileDownloadController {
/**
* 预览文件
*
* @param docId
* @param response
* @throws IOException
*/
@RequestMapping({"/preview/{docId}"})
public void preview(@PathVariable String docId, HttpServletResponse response) throws IOException {
try {
if ("s3".equalsIgnoreCase(S3Constant.FILE_LOCATION)) {
Teudm05 dbDm05 = S3Utils.buildUrl(docId);
FileUtils.downloadUrlFile(dbDm05.getUrl(), dbDm05.getResCname(), true, response);
} else {
Map dbDm02 = Iplat4jUtils.getDoc02ById(docId);
String returnUrl = MapUtils.getString(dbDm02, "url");
String fileName = MapUtils.getString(dbDm02, "docName");
FileUtils.downloadFile(new File(returnUrl), fileName, true, response);
}
} catch (Exception e) {
String msg = String.format("预览文件【%s】失败!原因:%s", docId, LogUtils.getMsg(e));
response.getWriter().write(msg);
}
}
/** /**
* 更具docId下载文件 * 更具docId下载文件
...@@ -81,6 +111,27 @@ public class FileDownloadController { ...@@ -81,6 +111,27 @@ public class FileDownloadController {
response.getWriter().write(msg); response.getWriter().write(msg);
} }
} }
/**
* 下载本地文件
*
* @param docId
* @param response
* @throws IOException
*/
@RequestMapping({"docId/{docId}"})
public void downloadUrls(@PathVariable String docId, HttpServletResponse response)
throws IOException {
try {
Map dbDm02 = Iplat4jUtils.getDoc02ById(docId);
String url = MapUtils.getString(dbDm02, "url");
String fileName = MapUtils.getString(dbDm02, "docName");
FileUtils.downloadFile(new File(url), fileName, false, response);
} catch (Exception e) {
String msg = String.format("下载文件【%s】失败!原因:%s", docId, LogUtils.getMsg(e));
response.getWriter().write(msg);
}
}
private String getReturnUrlByParam(Map<String, String[]> parameterMap, String returnUrl) private String getReturnUrlByParam(Map<String, String[]> parameterMap, String returnUrl)
throws UnsupportedEncodingException { throws UnsupportedEncodingException {
......
...@@ -86,8 +86,18 @@ public class CommonConstant { ...@@ -86,8 +86,18 @@ public class CommonConstant {
public static final String PRODUCTTION_ORDER_NO = "productionOrderNo"; public static final String PRODUCTTION_ORDER_NO = "productionOrderNo";
// ROOT // ROOT
public static final String ROOT = "root"; public static final String ROOT = "root";
// ROOT2
public static final String ROOT2 = "$";
// NODE
public static final String NODE = "node";
// 项目档案ID // 项目档案ID
public static final String PROJ_ID = "projId"; public static final String PROJ_ID = "projId";
// 企业管理员
public static final String COMPANY_MANAGE = "companyManage";
// ADMIN
public static final String ADMIN = "ADMIN";
public static final String ENAME = "ename";
} }
/** /**
......
...@@ -12,6 +12,7 @@ import org.apache.commons.collections.CollectionUtils; ...@@ -12,6 +12,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -56,6 +57,37 @@ public class DaoUtils { ...@@ -56,6 +57,37 @@ public class DaoUtils {
} }
DaoBase.getInstance().insert(sql, obj); DaoBase.getInstance().insert(sql, obj);
} }
/**
* insertBatch method.
*
* @param sql
* @param rows
*/
public static void batchInsert(String sql, List rows) {
// 创建人部门
List<String> orgIds = UserSessionUtils.getOrgId();
AssertUtils.isEmpty(orgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
String depCode = orgIds.get(0);
for (Object row : rows) {
if (row instanceof DaoEPBase) {
DaoEPBase daoEPBase = (DaoEPBase) row;
try {
BeanUtils.setProperty(daoEPBase, "depCode", depCode);
} catch (Exception e) {
log.warn("写入创建人部门编码失败", e);
}
setCreator(daoEPBase);
} else if (row instanceof Map) {
Map map = (Map) row;
map.put("depCode", depCode);
setCreator(map);
}
}
Map paramMap = new HashMap();
paramMap.put("rows", rows);
DaoBase.getInstance().insert(sql, paramMap);
}
/** /**
* update method. * update method.
......
...@@ -37,6 +37,18 @@ ...@@ -37,6 +37,18 @@
</isNotEmpty> </isNotEmpty>
</sql> </sql>
<sql id="authConditionA">
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
A.DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<!-- 公共修改字段 --> <!-- 公共修改字段 -->
<sql id="updateRevise"> <sql id="updateRevise">
......
...@@ -90,5 +90,19 @@ public class Iplat4jTools { ...@@ -90,5 +90,19 @@ public class Iplat4jTools {
List<Teudm05> results = DaoBase.getInstance().query("EUDM05.getDocByDocId", paramMap); List<Teudm05> results = DaoBase.getInstance().query("EUDM05.getDocByDocId", paramMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0); return CollectionUtils.isEmpty(results) ? null : results.get(0);
} }
/**
* 查询页面信息
*
* @param docId
* @return
*/
public static Teudm05 getByDocId(String docId) {
AssertUtils.isEmpty(docId, "文件ID不能为空!");
Map<String, String> paramMap = new HashMap();
paramMap.put("resId", docId);
List<Teudm05> results = DaoBase.getInstance().query("EUDM05.getDocByDocId", paramMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
} }
} }
...@@ -3,6 +3,7 @@ package com.baosight.hpjx.core.utils; ...@@ -3,6 +3,7 @@ package com.baosight.hpjx.core.utils;
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.FileUtils; import com.baosight.hpjx.util.FileUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.StringUtils; import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.common.eu.domain.Teudm05; import com.baosight.iplat4j.common.eu.domain.Teudm05;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
...@@ -55,5 +56,22 @@ public class Iplat4jUtils { ...@@ -55,5 +56,22 @@ public class Iplat4jUtils {
// return false; // return false;
} }
} }
/**
* 获取本地上传的文件
*
* @param docId
* @return
*/
public static Map getDoc02ById(String docId) {
Map document = platFileUploader.getDocument(docId);
if (MapUtils.isEmpty(document)) {
return null;
}
String chgName = document.get("chgName").toString();
String docPath = document.get("realPath").toString();
document.put("url", docPath + "/" + chgName);
return document;
}
} }
...@@ -2,9 +2,15 @@ package com.baosight.hpjx.core.utils; ...@@ -2,9 +2,15 @@ package com.baosight.hpjx.core.utils;
import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.AmazonS3;
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.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.common.eu.domain.Teudm05;
import com.baosight.iplat4j.eu.dm.document.bos.s3.api.signed.SignedBosHelp;
import com.baosight.iplat4j.eu.dm.document.bos.s3.param.BosParamHelp;
import java.io.File; import java.io.File;
import java.net.URL;
/** /**
* OSS工具类 * OSS工具类
...@@ -13,6 +19,24 @@ import java.io.File; ...@@ -13,6 +19,24 @@ import java.io.File;
* @date:2023/8/28,11:25 * @date:2023/8/28,11:25
*/ */
public class S3Utils { public class S3Utils {
/**
* 根据docId换取临时下载地址
*
* @param docId
* @return
*/
public static Teudm05 buildUrl(String docId) throws Exception {
Teudm05 dbDm05 = Iplat4jTools.EuDm05.getByDocId(docId);
String s3UrlPrefix = dbDm05.getUrl();
String fileName = dbDm05.getResCname();
String returnUrlPrefix = BosParamHelp.disposeUrl(s3UrlPrefix);
URL s3Url = SignedBosHelp.getDownloadTempUrl(s3UrlPrefix, fileName, null);
String s3UrlParam = StringUtils.defaultIfEmpty(s3Url.getQuery(), "");
String returnUrl = returnUrlPrefix + "?" + s3UrlParam;
dbDm05.setUrl(com.baosight.iplat4j.eu.dm.util.FileUtils.returnDocUrlByEncodeFileName(returnUrl));
return dbDm05;
}
/** /**
* 上传文件 * 上传文件
......
...@@ -95,6 +95,8 @@ public class HPConstant { ...@@ -95,6 +95,8 @@ public class HPConstant {
public static final String HPCW001_BILL_NUMBER = "HPCW001_BILL_NUMBER"; public static final String HPCW001_BILL_NUMBER = "HPCW001_BILL_NUMBER";
//发票单号 //发票单号
public static final String HPCW002_BILL_NUMBER = "HPCW002_BILL_NUMBER"; public static final String HPCW002_BILL_NUMBER = "HPCW002_BILL_NUMBER";
public static final String WD_FILE_ID = "WD_FILE_ID";
} }
/** /**
......
...@@ -45,7 +45,7 @@ public class HPSB003A extends DaoEPBase { ...@@ -45,7 +45,7 @@ public class HPSB003A extends DaoEPBase {
public static final String FIELD_DOC_NAME = "docName"; public static final String FIELD_DOC_NAME = "docName";
public static final String COL_ID = "ID"; /* ID*/ public static final String COL_ID = "ID"; /* ID*/
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 账套*/ public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 账套*/
public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码*/ public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码*/
public static final String COL_CREATED_BY = "CREATED_BY"; /* 创建人*/ public static final String COL_CREATED_BY = "CREATED_BY"; /* 创建人*/
public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 创建人名称*/ public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 创建人名称*/
......
...@@ -129,8 +129,8 @@ ...@@ -129,8 +129,8 @@
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
A.ID = #id# A.ID = #id#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode"> <isNotEmpty prepend=" AND " property="companyCode">
A.ACCOUNT_CODE = #accountCode# A.COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode"> <isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode# DEP_CODE = #depCode#
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
DEP_CODE as "depCode", <!-- 部门编码 --> DEP_CODE as "depCode", <!-- 部门编码 -->
REMARK as "remark", <!-- 备注 --> REMARK as "remark", <!-- 备注 -->
MATERIAL_STATUS as "materialStatus" MATERIAL_STATUS as "materialStatus"
FROM ${hpjxSchema}.t_hpsc001 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">
ID = #id# ID = #id#
...@@ -65,6 +65,10 @@ ...@@ -65,6 +65,10 @@
<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="userId">
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#)
</isNotEmpty>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$order$ $order$
......
...@@ -532,7 +532,7 @@ ...@@ -532,7 +532,7 @@
$orderBy$ $orderBy$
</isNotEmpty> </isNotEmpty>
<isEmpty property="orderBy"> <isEmpty property="orderBy">
CREATED_TIME desc USER_ID desc
</isEmpty> </isEmpty>
</dynamic> </dynamic>
</select> </select>
......
...@@ -283,6 +283,17 @@ public class HPSCTools { ...@@ -283,6 +283,17 @@ public class HPSCTools {
} }
/** /**
* @param projCodes
* @return
*/
public static List<HPSC001> queryByCode(List<String> projCodes) {
AssertUtils.isEmpty(projCodes, "项目Code不能为空!");
Map queryMap = new HashMap();
queryMap.put("projCodes", projCodes);
return DaoBase.getInstance().query("HPSC001.query", queryMap);
}
/**
* 查询 * 查询
* *
* @param id * @param id
......
package com.baosight.hpjx.hp.wd.constant;
/**
* @author LiuYang
* @version 1.0 2024/9/18
* @description
*/
public class HpWdConstant {
/**
* 文件状态
*
* @author:songx
* @date:2024/2/22,13:57
*/
public static class FileStatus {
// 待发布
public static final Integer S_0 = 0;
// 已发布
public static final Integer S_1 = 1;
}
/**
* 树节点类型
*
* @author:songx
* @date:2024/8/28,16:27
*/
public static class LeafType {
// 项目
public static final String P = "P";
// 目录
public static final String C = "C";
// 文件
public static final String F = "F";
}
/**
* 操作状态
*/
public static class OperStatus {
//新增
public static final Integer S_0 = 0;
//变更
public static final Integer S_1 = 1;
}
}
package com.baosight.hpjx.hp.wd.constant;
/**
* @author LiuYang
* @version 1.0 2024/9/18
* @description
*/
public class HpWdSqlConstant {
/**
* HGWD001 SQL定义
*
* @author:songx
* @date:2024/2/22,13:57
*/
public static class HpWd001 {
// 模块
public static final String MODULE = "HPWD001.";
// 根据父节点统计
public static final String COUNT_BY_PARENT = MODULE + "countByParent";
// 搜索树节点
public static final String SEARCH_TREE_NODE = MODULE + "searchTreeNode";
//查询项目
public static final String QUERY_PROJCODE = MODULE + "queryProjCode";
//查询所以项目
public static final String QUERY_PROJCODE_ALL = MODULE + "queryProjCodeAll";
}
/**
* @author:songx
* @date:2024/9/3,10:57
*/
public static class HpWd003 {
// 模块
public static final String MODULE = "HPWD003.";
// 查询
public static final String GET_BY_USER = MODULE + "getByUser";
// 修改信息
public static final String UPDATE_INFO = MODULE + "updateInfo";
// 批量写入
public static final String BATCH_INSERT = MODULE + "batchInsert";
}
/**
* HGCW009 SQL定义
*
* @author:songx
* @date:2024/2/22,13:57
*/
public static class HpWd009 {
// 模块
public static final String MODULE = "HPWD009.";
// 查询
public static final String QUERY = MODULE + "query";
}
/**
* HGCW999 SQL定义
*
* @author:songx
* @date:2024/2/22,13:57
*/
public static class HpWd099 {
// 预览自增
public static final String PREVIEW_INCR = "HPWD099.previewIncr";
// 下载自增
public static final String DOWNLOAD_INCR = "HPWD099.downloadIncr";
// 发布
public static final String RELEASE_DATE = "HPWD099.updateReleaseDate";
}
}
package com.baosight.hpjx.hp.wd.service;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.hp.wd.domain.HPWD001;
import com.baosight.hpjx.hp.wd.domain.HPWD001A;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
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.Arrays;
import java.util.HashMap;
/**
* @author LiuYang
* @version 1.0 2024/9/18
* @description 文档库
*/
public class ServiceHPWD001A extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HPWD001A.QUERY,new HPWD001A());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BLOCK_ID,DdynamicEnum.FACTORY_RECORD_BLOCK_ID),null);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPWD001().eiMetadata);
}catch (Exception e){
LogUtils.setMsg(inInfo,e,"初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
EiBlock block = inInfo.getBlock(EiConstant.queryBlock);
if (block != null) {
String createdTime = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HPWD001A.FIELD_CREATED_TIME);
if (StringUtils.isNotEmpty(createdTime)){
block.setCell(ACConstants.ROW_CODE_0,HPWD001A.FIELD_CREATED_TIME, StringUtil.removeHorizontalLine(createdTime.toString()));
}
}
return super.query(inInfo, HPWD001A.QUERY,new HPWD001A());
}
}
package com.baosight.hpjx.hp.wd.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DeleteFlagEnum;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.wd.domain.HPWD001B;
import com.baosight.hpjx.hp.wd.domain.HPWD002;
import com.baosight.hpjx.hp.wd.tools.HPWDTools;
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.EiBlock;
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.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/9/18
* @description 文档库
*/
public class ServiceHPWD001B extends ServiceEPBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "文档浏览", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
// 加载文件基础信息
this.setFileInfo(inInfo);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPWD001B().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 设置物料信息
*
* @param inInfo
*/
public void setFileInfo(EiInfo inInfo) {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String fileId = MapUtils.getString(queryRow, HPWD002.FIELD_FILE_ID);
String docId = MapUtils.getString(queryRow, HPWD002.FIELD_DOC_ID);
if (StringUtils.isBlank(fileId) || StringUtils.isBlank(docId)) {
return;
}
EiBlock block = new EiBlock(EiConstant.queryBlock);
block.addRow(HPWDTools.HpWd002.get(fileId, docId));
block.addBlockMeta(new HPWD002().eiMetadata);
inInfo.setBlock(block);
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "文档浏览", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
inInfo = super.query(inInfo, HPWD001B.QUERY, new HPWD001B());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 添加记录
*
* @param inInfo
* @return
*/
public EiInfo add(EiInfo inInfo) {
try {
List<HPWD001B> fWd001bs = MapUtils.toDaoEPBases(inInfo, HPWD001B.class);
for (HPWD001B fWd001b : fWd001bs) {
// AssertUtils.isEmpty(fWd001b.getFileId(), "文件ID不能为空");
// 预览记录+1
HPWDTools.HpWd099.previewIncr(fWd001b.getDocId());
// 新增
fWd001b.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
DaoUtils.insert(HPWD001B.INSERT, fWd001b);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("操作成功");
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "操作失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.wd.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DeleteFlagEnum;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.wd.domain.HPWD001C;
import com.baosight.hpjx.hp.wd.domain.HPWD002;
import com.baosight.hpjx.hp.wd.tools.HPWDTools;
import com.baosight.hpjx.util.*;
import com.baosight.iplat4j.core.ei.EiBlock;
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.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/9/18
* @description 文档库
*/
public class ServiceHPWD001C extends ServiceEPBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "文档浏览", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
// 加载文件基础信息
this.setFileInfo(inInfo);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPWD001C().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 设置物料信息
*
* @param inInfo
*/
public void setFileInfo(EiInfo inInfo) {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String fileId = MapUtils.getString(queryRow, HPWD002.FIELD_FILE_ID);
String docId = MapUtils.getString(queryRow, HPWD002.FIELD_DOC_ID);
if (StringUtils.isBlank(fileId) || StringUtils.isBlank(docId)) {
return;
}
EiBlock block = new EiBlock(EiConstant.queryBlock);
block.addRow(HPWDTools.HpWd002.get(fileId, docId));
block.addBlockMeta(new HPWD002().eiMetadata);
inInfo.setBlock(block);
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "文档浏览", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
inInfo = super.query(inInfo, HPWD001C.QUERY, new HPWD001C());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 添加记录
*
* @param inInfo
* @return
*/
public EiInfo add(EiInfo inInfo) {
try {
List<HPWD001C> fWd001cs = MapUtils.toDaoEPBases(inInfo, HPWD001C.class);
for (HPWD001C fWd001c : fWd001cs) {
AssertUtils.isEmpty(fWd001c.getFileId(), "文件ID不能为空");
// 下载记录+1
HPWDTools.HpWd099.downloadIncr(fWd001c.getDocId());
// 新增
fWd001c.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
DaoUtils.insert(HPWD001C.INSERT, fWd001c);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("操作成功");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "操作失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.wd.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.ChangeTypeEnum;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.tools.Iplat4jTools;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.wd.constant.HpWdConstant;
import com.baosight.hpjx.hp.wd.domain.HPWD001;
import com.baosight.hpjx.hp.wd.domain.HPWD001A;
import com.baosight.hpjx.hp.wd.tools.HPWDTools;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author LiuYang
* @version 1.0 2024/9/18
* @description 新增文档
*/
public class ServiceHPWD001E extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BLOCK_ID, DdynamicEnum.FACTORY_RECORD_BLOCK_ID), null);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPWD001().eiMetadata);
}catch (Exception e){
LogUtils.setMsg(inInfo,e,"初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPWD001.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
/*String parentId = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPWD001.FIELD_PARENT_ID);
if (parentId.indexOf("Q")==0){
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPWD001.FIELD_ACCOUNT_CODE, parentId);
}else if (parentId.indexOf("R")==0){
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPWD001.FIELD_COMPANY_CODE, parentId);
}*/
return super.query(inInfo, HPWD001.QUERY,new HPWD001());
}
/**
* 保存操作
*/
@OperationLogAnnotation(operModul = "文档库",operType = "保存",operDesc = "保存操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<Map<String, Object>> edcm01List = Iplat4jTools.EdCm01.list("hpjx.hpwd.fileType");
List<HPWD001> hgwd001s = new ArrayList<>();
// 写入数据
for (Map resultRow : resultRows) {
HPWD001 hgwd001 = new HPWD001();
hgwd001.fromMap(resultRow);
hgwd001.setStatus(HpWdConstant.FileStatus.S_0);
if (hgwd001.getId() == null || hgwd001.getId() == 0) {
this.add(hgwd001);
} else {
this.modify(hgwd001,edcm01List);
}
hgwd001s.add(hgwd001);
}
inInfo.getBlock(EiConstant.resultBlock).setRows(hgwd001s);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPWD001 hgwd001) {
hgwd001.setFileId(SequenceGenerator.getNextSequence(HPConstant.SequenceId.WD_FILE_ID));
hgwd001.setDocVersion(hgwd001.getDocVersion() + 1);
DaoUtils.insert(HPWD001.INSERT, hgwd001);
HPWD001A hgwd001a = new HPWD001A();
hgwd001a.setFactoryCode(hgwd001.getFactoryCode());
hgwd001a.setFactoryName(hgwd001.getFactoryName());
hgwd001a.setProjCode(hgwd001.getProjCode());
hgwd001a.setProjName(hgwd001.getProjName());
hgwd001a.setChangeType(ChangeTypeEnum.ADD.getCode());
hgwd001a.setChangeContent("文件名称");
hgwd001a.setChangeEnd(hgwd001.getFileName());
hgwd001a.setMatId(hgwd001.getId());
HPWDTools.HpWd001.addHPWD001A(hgwd001a);
}
/**
* 修改操作
*/
public void modify(HPWD001 hgwd001,List<Map<String, Object>> edcm01List) {
HPWD001 wd001 =HPWDTools.HpWd001.get(hgwd001.getId());
HPWD001A hgwd001a = new HPWD001A();
hgwd001a.setFactoryCode(hgwd001.getFactoryCode());
hgwd001a.setFactoryName(hgwd001.getFactoryName());
hgwd001a.setProjCode(hgwd001.getProjCode());
hgwd001a.setProjName(hgwd001.getProjName());
hgwd001a.setChangeType(ChangeTypeEnum.UPDATE.getCode());
hgwd001a.setMatId(hgwd001.getId());
if (wd001 != null && !wd001.getFileName().equals(hgwd001.getFileName())){
hgwd001a.setChangeContent("文件名称");
hgwd001a.setChangeStart(wd001.getFileName());
hgwd001a.setChangeEnd(hgwd001.getFileName());
HPWDTools.HpWd001.addHPWD001A(hgwd001a);
}else if (wd001 != null && !wd001.getFileType().equals(hgwd001.getFileType())){
List<Map> fileType1 = edcm01List.stream().filter(map -> map.get("itemCode").equals(wd001.getFileType())).collect(Collectors.toList());
List<Map> fileType2 = edcm01List.stream().filter(map -> map.get("itemCode").equals(hgwd001.getFileType())).collect(Collectors.toList());
hgwd001a.setChangeContent("文件类型");
hgwd001a.setChangeStart(fileType1.get(0).get("itemCname").toString());
hgwd001a.setChangeEnd(fileType2.get(0).get("itemCname").toString());
HPWDTools.HpWd001.addHPWD001A(hgwd001a);
}
DaoUtils.update(HPWD001.UPDATE, hgwd001);
}
}
package com.baosight.hpjx.hp.wd.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.ChangeTypeEnum;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.tools.Iplat4jTools;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.wd.constant.HpWdConstant;
import com.baosight.hpjx.hp.wd.domain.HPWD001;
import com.baosight.hpjx.hp.wd.domain.HPWD001A;
import com.baosight.hpjx.hp.wd.tools.HPWDTools;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author LiuYang
* @version 1.0 2024/9/18
* @description 修改文档库
*/
public class ServiceHPWD001F extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BLOCK_ID, DdynamicEnum.FACTORY_RECORD_BLOCK_ID), null);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPWD001().eiMetadata);
}catch (Exception e){
LogUtils.setMsg(inInfo,e,"初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPWD001.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo, HPWD001.QUERY,new HPWD001());
}
/**
* 保存操作
*/
@OperationLogAnnotation(operModul = "文档库",operType = "保存",operDesc = "保存操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<Map<String, Object>> edcm01List = Iplat4jTools.EdCm01.list("hpjx.hpwd.fileType");
// 写入数据
for (Map resultRow : resultRows) {
HPWD001 hpwd001 = new HPWD001();
hpwd001.fromMap(resultRow);
hpwd001.setStatus(HpWdConstant.FileStatus.S_0);
if (hpwd001.getId() == null || hpwd001.getId() == 0) {
this.add(hpwd001);
} else {
this.modify(hpwd001,edcm01List);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPWD001 hpwd001) {
hpwd001.setFileId(SequenceGenerator.getNextSequence(HPConstant.SequenceId.WD_FILE_ID));
hpwd001.setDocVersion(hpwd001.getDocVersion() + 1);
DaoUtils.insert(HPWD001.INSERT, hpwd001);
HPWD001A hpwd001a = new HPWD001A();
hpwd001a.setFactoryCode(hpwd001.getFactoryCode());
hpwd001a.setFactoryName(hpwd001.getFactoryName());
hpwd001a.setProjCode(hpwd001.getProjCode());
hpwd001a.setProjName(hpwd001.getProjName());
hpwd001a.setChangeType(ChangeTypeEnum.ADD.getCode());
hpwd001a.setChangeContent("文件名称");
hpwd001a.setChangeEnd(hpwd001.getFileName());
hpwd001a.setMatId(hpwd001.getId());
HPWDTools.HpWd001.addHPWD001A(hpwd001a);
}
/**
* 修改操作
*/
public void modify(HPWD001 hgwd001,List<Map<String, Object>> edcm01List) {
HPWD001 wd001 =HPWDTools.HpWd001.get(hgwd001.getId());
HPWD001A hpwd001a = new HPWD001A();
hpwd001a.setFactoryCode(hgwd001.getFactoryCode());
hpwd001a.setFactoryName(hgwd001.getFactoryName());
hpwd001a.setProjCode(hgwd001.getProjCode());
hpwd001a.setProjName(hgwd001.getProjName());
hpwd001a.setChangeType(ChangeTypeEnum.UPDATE.getCode());
hpwd001a.setMatId(hgwd001.getId());
if (wd001 != null && !wd001.getFileName().equals(hgwd001.getFileName())){
hpwd001a.setChangeContent("文件名称");
hpwd001a.setChangeStart(wd001.getFileName());
hpwd001a.setChangeEnd(hgwd001.getFileName());
HPWDTools.HpWd001.addHPWD001A(hpwd001a);
}else if (wd001 != null && !wd001.getFileType().equals(hgwd001.getFileType())){
List<Map> fileType1 = edcm01List.stream().filter(map -> map.get("itemCode").equals(wd001.getFileType())).collect(Collectors.toList());
List<Map> fileType2 = edcm01List.stream().filter(map -> map.get("itemCode").equals(hgwd001.getFileType())).collect(Collectors.toList());
hpwd001a.setChangeContent("文件类型");
hpwd001a.setChangeStart(fileType1.get(0).get("itemCname").toString());
hpwd001a.setChangeEnd(fileType2.get(0).get("itemCname").toString());
HPWDTools.HpWd001.addHPWD001A(hpwd001a);
}
DaoUtils.update(HPWD001.UPDATE, hgwd001);
}
}
package com.baosight.hpjx.hp.wd.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.wd.constant.HpWdConstant;
import com.baosight.hpjx.hp.wd.domain.HPWD001;
import com.baosight.hpjx.hp.wd.domain.HPWD002;
import com.baosight.hpjx.hp.xs.domain.User;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.contants.ACConstants;
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.Arrays;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/9/18
* @description 文档浏览
*/
public class ServiceHPWD002 extends ServiceEPBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "文档浏览", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BLOCK_ID,DdynamicEnum.FACTORY_RECORD_BLOCK_ID),null);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPWD002().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "文档浏览", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
// 仅查询已发布的文件
queryRow.put(HPWD001.FIELD_STATUS, HpWdConstant.FileStatus.S_1);
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, User.FIELD_USER_ID, UserSessionUtils.getUserId());
builder(inInfo);
inInfo = super.query(inInfo, HPWD002.QUERY, new HPWD002());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
public void builder(EiInfo eiInfo){
String[] orderBy = eiInfo.getBlock(EiConstant.resultBlock).getString("orderBy").split(",");
if (orderBy.length>0){
StringBuilder orderByStr= new StringBuilder();
for (int i = 0; i < orderBy.length; i++) {
if (i != 0 && i != orderByStr.length() - 1) {
orderByStr.append(",");
}
switch (orderBy[i]) {
case "fileType asc":
orderByStr.append(orderBy[i].replace("fileType asc", "a.fileType asc"));
break;
case "docId asc":
orderByStr.append(orderBy[i].replace("docId asc", "b.docId asc"));
break;
case "docName asc":
orderByStr.append(orderBy[i].replace("docName asc", "b.docName asc"));
break;
case "docVersion asc":
orderByStr.append(orderBy[i].replace("docVersion asc", "b.docVersion asc"));
break;
case "createdTime asc":
orderByStr.append(orderBy[i].replace("createdTime asc", "b.createdTime asc"));
break;
case "previewNum asc":
orderByStr.append(orderBy[i].replace("previewNum asc", "b.previewNum asc"));
break;
case "downloadNum asc":
orderByStr.append(orderBy[i].replace("downloadNum asc", "b.downloadNum asc"));
break;
case "fileType desc":
orderByStr.append(orderBy[i].replace("fileType desc", "a.fileType desc"));
break;
case "docId desc":
orderByStr.append(orderBy[i].replace("docId desc", "b.docId desc"));
break;
case "docName desc":
orderByStr.append(orderBy[i].replace("docName desc", "b.docName desc"));
break;
case "docVersion desc":
orderByStr.append(orderBy[i].replace("docVersion desc", "b.docVersion desc"));
break;
case "createdTime desc":
orderByStr.append(orderBy[i].replace("createdTime desc", "b.createdTime desc"));
break;
case "previewNum desc":
orderByStr.append(orderBy[i].replace("previewNum desc", "b.previewNum desc"));
break;
case "downloadNum desc":
orderByStr.append(orderBy[i].replace("downloadNum desc", "b.downloadNum desc"));
break;
default:
if (!orderBy[i].isEmpty()){
orderByStr.append(orderBy[i]);
}else {
orderByStr.append(orderBy[i]);
}
break;
}
}
eiInfo.getBlock(EiConstant.resultBlock).set("orderBy",orderByStr);
}
}
}
package com.baosight.hpjx.hp.wd.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.wd.constant.HpWdConstant;
import com.baosight.hpjx.hp.wd.domain.HPWD001;
import com.baosight.hpjx.hp.wd.domain.HPWD002;
import com.baosight.hpjx.hp.wd.utils.HpWdUtils;
import com.baosight.hpjx.hp.xs.domain.User;
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.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import org.springframework.util.CollectionUtils;
import java.util.*;
/**
* @author LiuYang
* @version 1.0 2024/9/18
* @description 浏览文档库
*/
public class ServiceHPWD002A extends ServiceEPBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "文档浏览", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 树节点查询
*
* @param inInfo
* @return
*/
public EiInfo queryTree(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String fileId = MapUtils.getString(queryMap, HPWD001.FIELD_FILE_ID);
String node = MapUtils.getString(queryMap, CommonConstant.Field.NODE);
if (CommonConstant.Field.ROOT.equals(node) || CommonConstant.Field.ROOT2.equals(node)) {
inInfo.addBlock(node).setRows(queryTopNode(node, fileId));
} else {
inInfo.addBlock(node).setRows(queryChildNode(node));
}
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询节点失败");
}
return inInfo;
}
/**
* 查询树根
*
* @param parentId
* @param fileId
* @return
*/
public List queryTopNode(String parentId, String fileId) {
List<Map> results = new ArrayList();
Map queryMap = new HashMap();
queryMap.put(HPWD001.FIELD_FILE_ID, fileId);
List<HPWD001> dbWd001s = dao.query(HPWD001.QUERY, queryMap);
if (CollectionUtils.isEmpty(dbWd001s)) {
return results;
}
for (HPWD001 dbWd001 : dbWd001s) {
results.add(buildLeaf(parentId, dbWd001.getFileId(), dbWd001.getFileName(),
HpWdConstant.LeafType.C, "", 0));
}
return results;
}
/**
* 查询叶子节点
*
* @param parentId
* @return
*/
public List queryChildNode(String parentId) {
List<Map> results = new ArrayList();
Map queryMap = new HashMap();
queryMap.put("parentId", parentId);
String userId = UserSessionUtils.getLoginName();
if (!HpWdUtils.HpWd009.isManager(userId)) {
queryMap.put(User.FIELD_USER_ID, userId);
}else {
queryMap.put(HPWD001.FIELD_STATUS, HpWdConstant.FileStatus.S_1);
}
List<HPWD002> dbWd002s = dao.query(HPWD002.QUERY, queryMap);
if (CollectionUtils.isEmpty(dbWd002s)) {
return results;
}
for (HPWD002 dbWd002 : dbWd002s) {
results.add(buildLeaf(parentId, dbWd002.getDocId(), dbWd002.getDocName(),
HpWdConstant.LeafType.F, dbWd002.getDocType(), 1));
}
return results;
}
/**
* 构建叶子节点
*
* @param parentId
* @param label
* @param text
* @param leaf
*/
private HashMap buildLeaf(String parentId, String label, String text, String leafType, String docType,
Integer leaf) {
HashMap<String, Object> leafMap = new HashMap();
leafMap.put("parentId", parentId);
leafMap.put("label", label);
leafMap.put("text", text);
leafMap.put("leafType", leafType);
leafMap.put("docType", docType);
leafMap.put("leaf", leaf);
return leafMap;
}
}
package com.baosight.hpjx.hp.wd.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DeleteFlagEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
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.HpWdSqlConstant;
import com.baosight.hpjx.hp.wd.domain.HPWD001;
import com.baosight.hpjx.hp.wd.domain.HPWD003;
import com.baosight.hpjx.hp.wd.utils.HpWdUtils;
import com.baosight.hpjx.util.*;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author LiuYang
* @version 1.0 2024/9/18
* @description 文档权限
*/
public class ServiceHPWD003 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;
}
/**
* 搜索树节点
*
* @param inInfo
* @return
*/
public EiInfo searchNode(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
List<HPWD001> dbWd001s = DaoBase.getInstance().query(HpWdSqlConstant.HpWd001.SEARCH_TREE_NODE, queryMap);
// 设置一级项目节点信息
List<Map> nodes = this.buildProjInfo(dbWd001s);
inInfo.addBlock(CommonConstant.Field.ROOT2).setRows(nodes);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "搜索节点失败");
}
return inInfo;
}
/**
* 设置一级项目节点信息
*
* @param dbWd001s
*/
private List<Map> buildProjInfo(List<HPWD001> dbWd001s) {
List<Map> results = new ArrayList();
if (CollectionUtils.isEmpty(dbWd001s)) {
return results;
}
for (HPWD001 dbWd001 : dbWd001s) {
results.add(buildLeaf(dbWd001.getParentId(), dbWd001.getFileId(), dbWd001.getFileName(),
HpWdConstant.LeafType.C));
}
// 项目信息
List<String> projCodes = dbWd001s.stream().filter(item -> item.getLeafLevel() == 1)
.map(HPWD001::getParentId).collect(Collectors.toList());
List<HPSC001> dbSc001s = HPSCTools.HpSc001.queryByCode(projCodes);
for (HPSC001 dbSc001 : dbSc001s) {
results.add(buildLeaf(CommonConstant.Field.ROOT2, dbSc001.getProjCode(), dbSc001.getProjName(),
HpWdConstant.LeafType.P));
}
return results;
}
/**
* 构建叶子节点
*
* @param parentLabel
* @param label
* @param text
*/
private HashMap buildLeaf(String parentLabel, String label, String text, String leafType) {
HashMap<String, String> leafMap = new HashMap();
leafMap.put("parent", parentLabel);
leafMap.put("label", label);
leafMap.put("text", text);
leafMap.put("leafType", leafType);
return leafMap;
}
/**
* 删除用户
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "文档权限", operType = "保存", operDesc = "操作")
public EiInfo removeUser(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
// 获取FILE_ID
String fileId = MapUtils.getString(queryMap, HPWD003.FIELD_FILE_ID);
AssertUtils.isEmpty(fileId, "请选择目录");
// 判断是否是管理员或项目经理
AssertUtils.isTrue(!HpWdUtils.HpWd003.isManager(fileId), "操作失败,非项目经理不能进行删除");
List<HPWD003> fWd003s = MapUtils.toDaoEPBases(inInfo, HPWD003.class);
for (HPWD003 fWd003 : fWd003s) {
fWd003.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.insert(HPWD003.DELETE, fWd003);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fWd003s.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 保存
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "文档权限", operType = "保存", operDesc = "操作")
public EiInfo save(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
// 获取FILE_ID
String fileId = MapUtils.getString(queryMap, HPWD003.FIELD_FILE_ID);
AssertUtils.isEmpty(fileId, "请选择目录");
// 判断是否是管理员或项目经理
AssertUtils.isTrue(!HpWdUtils.HpWd009.isManager(), "操作失败,非管理员不能进行修改");
List<HPWD003> fWd003s = MapUtils.toDaoEPBases(inInfo, HPWD003.class);
for (HPWD003 fWd003 : fWd003s) {
DaoUtils.update(HpWdSqlConstant.HpWd003.UPDATE_INFO, fWd003);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fWd003s.size() + "]条数据修改成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/** 是否项目经理
*
* @param inInfo
* @return
*/
public EiInfo isProjectManager(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
// 文档管理员不做校验
if (HpWdUtils.HpWd009.isManager()) {
inInfo.set("isManager", CommonConstant.YesNo.YES_1);
return inInfo;
} else {
inInfo.set("isManager", CommonConstant.YesNo.NO_0);
}
queryMap.put(HPWD003.FIELD_USER_ID, UserSessionUtils.getLoginName());
List<HPWD003> dbWd003s = dao.query(HpWdSqlConstant.HpWd003.GET_BY_USER, queryMap);
if (CollectionUtils.isNotEmpty(dbWd003s)) {
HPWD003 dbWd003 = dbWd003s.get(0);
inInfo.set("isProjectManager", dbWd003.getIsProjectManager());
} else {
inInfo.set("isProjectManager", CommonConstant.YesNo.NO_0);
}
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "是否项目经理失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.wd.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.wd.domain.HPWD003;
import com.baosight.hpjx.hp.wd.utils.HpWdUtils;
import com.baosight.hpjx.hp.xs.domain.User;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiBlockMeta;
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.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/9/18
* @description 文档权限
*/
public class ServiceHPWD003A extends ServiceEPBase {
private EiBlockMeta eiMetadata = null;
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "文档权限", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new User().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);
inInfo = super.query(inInfo, "HPWD003A.query", new User());
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询节点失败");
}
return inInfo;
}
/**
* 保存
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "文档权限", operType = "保存", operDesc = "操作")
public EiInfo authUser(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
// 获取FILE_ID
String fileId = MapUtils.getString(queryMap, HPWD003.FIELD_FILE_ID);
AssertUtils.isEmpty(fileId, "请选择目录");
// 判断是否是管理员或项目经理
AssertUtils.isTrue(!HpWdUtils.HpWd003.isManager(fileId), "操作失败,非项目经理不能授权人员");
List<HPWD003> fWd003s = MapUtils.toDaoEPBases(inInfo, HPWD003.class);
for (HPWD003 fWd003 : fWd003s) {
fWd003.setFileId(fileId);
fWd003.setFactoryCode(fWd003.getDepCode());
DaoUtils.insert(HPWD003.INSERT, fWd003);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fWd003s.size() + "]条数据授权成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "授权失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.wd.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
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.tools.HPWDTools;
import com.baosight.hpjx.hp.wd.utils.HpWdUtils;
import com.baosight.hpjx.util.*;
import com.baosight.iplat4j.core.ei.EiBlockMeta;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author LiuYang
* @version 1.0 2024/9/18
* @description 文档权限
*/
public class ServiceHPWD003B extends ServiceEPBase {
private EiBlockMeta eiMetadata = null;
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "文档权限", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPWD001().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 userId = UserSessionUtils.getLoginName();
if (!HpWdUtils.HpWd009.isManager(userId)) {
queryMap.put("managerUserId", userId);
}
inInfo = super.query(inInfo, HPWD001.QUERY, new HPWD001());
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询节点失败");
}
return inInfo;
}
/**
* 复制用户
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "文档权限", operType = "保存", operDesc = "操作")
public EiInfo copyUser(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
// 获取FILE_ID信息
String mainFileId = MapUtils.getString(queryMap, "mainFileId");
// 判断是否是管理员或项目经理
AssertUtils.isTrue(!HpWdUtils.HpWd003.isManager(mainFileId), "操作失败,非管理员或项目经理不能进行复制");
HPWD001 dbWd001 = HPWDTools.HpWd001.get(mainFileId);
AssertUtils.isNull(dbWd001, String.format("【%s】文档目录不存在", mainFileId));
// 获取FILE_ID授权信息
List<HPWD003> dbMainWd003s = HPWDTools.HpWd003.listByFile(mainFileId);
AssertUtils.isEmpty(dbMainWd003s, String.format("文档目录【%s】还未授权用户,请授权后再进行复制", dbWd001.getFileName()));
// 复制授权信息
List<HPWD001> fWd001s = MapUtils.toDaoEPBases(inInfo, HPWD001.class);
this.copyAuthUser(fWd001s, dbMainWd003s);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("复制授权用户成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "复制授权用户失败");
}
return inInfo;
}
/**
* 复制授权用户
*
* @param fWd001s
* @param dbMainWd003s
*/
private void copyAuthUser(List<HPWD001> fWd001s, List<HPWD003> dbMainWd003s) {
// 已授权信息
Map<String, List<HPWD003>> dbWd003Map = HPWDTools.HpWd003.map(
ObjectUtils.listEpKey(fWd001s, HPWD001.FIELD_FILE_ID));
for (HPWD001 fWd001 : fWd001s) {
String fileId = fWd001.getFileId();
// 已存在的授权用户信息
List<HPWD003> dbWd003s = dbWd003Map == null ? null : dbWd003Map.get(fileId);
List<String> userIds = CollectionUtils.isEmpty(dbWd003s) ? new ArrayList<>()
: dbWd003s.stream().map(HPWD003::getUserId).collect(Collectors.toList());
// 过滤出未授权的用户,并重新赋值FILE_ID
List<HPWD003> filterWd003s = dbMainWd003s.stream()
.filter(dbMainWd003 -> !userIds.contains(dbMainWd003.getUserId()))
.map(dbMainWd003 -> {
dbMainWd003.setFileId(fWd001.getFileId());
return dbMainWd003;
}).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(filterWd003s)) {
filterWd003s.forEach(hpwd003 -> {
DaoUtils.insert(HPWD003.INSERT, hpwd003);
});
}
}
}
}
package com.baosight.hpjx.hp.wd.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.ChangeTypeEnum;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.utils.Iplat4jUtils;
import com.baosight.hpjx.hp.wd.domain.HPWD001;
import com.baosight.hpjx.hp.wd.domain.HPWD001A;
import com.baosight.hpjx.hp.wd.domain.HPWD099;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author LiuYang
* @version 1.0 2024/9/18
* @description
*/
public class ServiceHPWD004 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BLOCK_ID,DdynamicEnum.FACTORY_RECORD_BLOCK_ID), null);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPWD001().eiMetadata);
}catch (Exception e){
LogUtils.setMsg(inInfo,e,"初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
EiBlock block = inInfo.getBlock(EiConstant.queryBlock);
if (block != null) {
String startDate = block.getCellStr(ACConstants.ROW_CODE_0,"createdTimeFrom");
String endDate = block.getCellStr(ACConstants.ROW_CODE_0,"createdTimeTo");
if (!startDate.isEmpty()) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, "createdTimeFrom", StringUtil.removeHorizontalLine(startDate));
}
if (!endDate.isEmpty()) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,"createdTimeTo", StringUtil.removeHorizontalLine(endDate));
}
}
return super.query(inInfo, HPWD001A.QUERY_DELETE,new HPWD001A());
}
@OperationLogAnnotation(operModul = "回收站", operType = "删除", operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
List<HPWD099> hgwd099s = DaoBase.getInstance().query(HPWD099.QUERY,
new HashMap<String,Object>(){{
put(HPWD099.FIELD_DELETE_FLAG, Arrays.asList(CommonConstant.YesNo.NO_0,CommonConstant.YesNo.YES_1));
}}
);
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HPWD001A hpwd001a = new HPWD001A();
hpwd001a.fromMap(map);
String docId = hpwd001a.getChangeType().equals(ChangeTypeEnum.UPLOAD_UPDATE.getCode()) ? hpwd001a.getChangeStartCode() : hpwd001a.getChangeEndCode();
List<HPWD099> cw099List = hgwd099s.stream().filter(hgwd099 -> hgwd099.getDocId().equals(docId)).collect(Collectors.toList());
if (cw099List.size() <= 1){
//删除物理附件
Iplat4jUtils.deleteFileByDocId(docId);
}
//删除附件详情
if (hpwd001a.getChangeType().equals(ChangeTypeEnum.UPLOAD_DELETE.getCode())) {
DaoUtils.update(HPWD099.DELETE_ID, new HashMap<String,String>(){{put(HPWD099.FIELD_ID, hpwd001a.getAcceId());}});
}
//删除变更记录
DaoUtils.update(HPWD001A.DELETE, hpwd001a);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
LogUtils.setMsg(inInfo, e,"删除失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.wd.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DeleteFlagEnum;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.wd.domain.HPWD009;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
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.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/9/25
* @description 文档管理员
*/
public class ServiceHPWD009 extends ServiceEPBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "文档权限", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPWD009().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);
inInfo = super.query(inInfo, HPWD009.QUERY, new HPWD009());
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询节点失败");
}
return inInfo;
}
/**
* 删除用户
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "文档权限", operType = "保存", operDesc = "操作")
public EiInfo removeUser(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
List<HPWD009> fWd009s = MapUtils.toDaoEPBases(inInfo, HPWD009.class);
for (HPWD009 fWd009 : fWd009s) {
fWd009.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.insert(HPWD009.DELETE, fWd009);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fWd009s.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.wd.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DeleteFlagEnum;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.wd.domain.HPWD009;
import com.baosight.hpjx.hp.xs.domain.User;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiBlockMeta;
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.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/9/25
* @description 文档管理员
*/
public class ServiceHPWD009A extends ServiceEPBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "文档权限", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new User().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);
inInfo = super.query(inInfo, "HPWD009A.query", new User());
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询节点失败");
}
return inInfo;
}
/**
* 保存
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "文档权限", operType = "保存", operDesc = "操作")
public EiInfo authUser(EiInfo inInfo) {
try {
List<HPWD009> fWd009s = MapUtils.toDaoEPBases(inInfo, HPWD009.class);
for (HPWD009 fWd009 : fWd009s) {
fWd009.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
fWd009.setFactoryCode(fWd009.getDepCode());
DaoUtils.insert(HPWD009.INSERT, fWd009);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fWd009s.size() + "]条数据添加成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "授权失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.wd.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
/**
* @author LiuYang
* @version 1.0 2024/9/18
* @description
*/
public class ServiceHPWD098 extends ServiceEPBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "word预览", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.wd.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.ChangeTypeEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.wd.constant.HpWdConstant;
import com.baosight.hpjx.hp.wd.domain.HPWD001;
import com.baosight.hpjx.hp.wd.domain.HPWD001A;
import com.baosight.hpjx.hp.wd.domain.HPWD099;
import com.baosight.hpjx.hp.wd.tools.HPWDTools;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/9/18
* @description
*/
public class ServiceHPWD099 extends ServiceEPBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "附件清单",operType = "查询",operDesc = "文档库-附件清单A-初始化")
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPWD099().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "附件清单",operType = "查询",operDesc = "文档库-附件清单A-查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
if (StringUtils.isNotEmpty(queryRow.get(HPWD001.FIELD_PARENT_ID).toString())){
inInfo = super.query(inInfo, HPWD099.QUERY, new HPWD099());
}
} catch (Throwable e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 新增操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "附件清单",operType = "新增",operDesc = "文档库-附件清单A-新增操作")
@Override
public EiInfo insert(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
HPWD001 hgwd001 = HPWDTools.HpWd001.get(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPWD001.FIELD_FILE_ID));
StringBuilder strFileName = new StringBuilder();
strFileName.append("本次上传文件名称:");
for (Map resultRow : resultRows) {
HPWD099 hgdm099 = new HPWD099();
hgdm099.fromMap(resultRow);
hgdm099.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPWD099.INSERT, hgdm099);
strFileName.append(hgdm099.getDocName()).append(",");
if (hgwd001 != null) {
HPWD001A hgwd001a = new HPWD001A();
hgwd001a.setFactoryCode(hgwd001.getFactoryCode());
hgwd001a.setFactoryName(hgwd001.getFactoryName());
hgwd001a.setProjCode(hgwd001.getProjCode());
hgwd001a.setProjName(hgwd001.getProjName());
hgwd001a.setChangeType(ChangeTypeEnum.UPLOAD_ADD.getCode());
hgwd001a.setChangeContent(hgwd001.getFileName());
hgwd001a.setChangeEnd(hgdm099.getDocName());
hgwd001a.setChangeEndCode(hgdm099.getDocId());
hgwd001a.setMatId(hgwd001.getId());
HPWDTools.HpWd001.addHPWD001A(hgwd001a);
hgwd001.setStatus(HpWdConstant.FileStatus.S_0);
HPWDTools.HpWd001.updateStatus(hgwd001);
}
}
//HPWDTools.interaction(hgwd001,strFileName.substring(0, strFileName.length() - 1));
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "新增失败");
}
return inInfo;
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "附件清单",operType = "删除",operDesc = "文档库-附件清单A-删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultRow : resultRows) {
HPWD099 hpdm099 = new HPWD099();
hpdm099.fromMap(resultRow);
DaoUtils.update(HPWD099.DELETE, hpdm099); //逻辑删除
HPWD001 hpwd001 = HPWDTools.HpWd001.get(hpdm099.getBizId());
if (hpwd001 != null) {
HPWD001A hgwd001a = new HPWD001A();
hgwd001a.setFactoryCode(hpwd001.getFactoryCode());
hgwd001a.setFactoryName(hpwd001.getFactoryName());
hgwd001a.setProjCode(hpwd001.getProjCode());
hgwd001a.setProjName(hpwd001.getProjName());
hgwd001a.setChangeType(ChangeTypeEnum.UPLOAD_DELETE.getCode());
hgwd001a.setChangeContent(hpwd001.getFileName());
hgwd001a.setChangeEnd(hpdm099.getDocName());
hgwd001a.setChangeEndCode(hpdm099.getDocId());
hgwd001a.setMatId(hpwd001.getId());
hgwd001a.setAcceId(hpdm099.getId().toString());
HPWDTools.HpWd001.addHPWD001A(hgwd001a);
hpwd001.setStatus(HpWdConstant.FileStatus.S_0);
HPWDTools.HpWd001.updateStatus(hpwd001);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.wd.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
/**
* @author LiuYang
* @version 1.0 2024/9/18
* @description 附件上传
*/
public class ServiceHPWD099A extends ServiceEPBase {
/**
* 画面初始化.
*/
@OperationLogAnnotation(operModul = "附件上传",operType = "查询",operDesc = "初始化")
@Override
public EiInfo initLoad(EiInfo inInfo) {
return inInfo;
}
/**
* 附件上传.
*/
@OperationLogAnnotation(operModul = "附件上传",operType = "上传",operDesc = "附件上传")
public EiInfo form(EiInfo inInfo) {
return inInfo;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="HPWD001B">
<typeAlias alias="HPWD001B" type="com.baosight.hpjx.hp.wd.domain.HPWD001B"/>
<sql id="column">
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
CREATED_BY as "createdBy", <!-- 记录创建者 -->
CREATED_NAME as "createdName", <!-- 记录创建名称 -->
CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
FILE_ID as "fileId", <!-- 文件ID -->
DOC_ID as "docId" <!-- 附件ID -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fileId">
FILE_ID = #fileId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docId">
DOC_ID = #docId#
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="HPWD001B">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPWD001B
WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPWD001B
WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPWD001B (
COMPANY_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
DELETE_FLAG, <!-- 0-未删除,1-已删除 -->
FILE_ID, <!-- 文件ID -->
DOC_ID <!-- 附件ID -->
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #fileId#, #docId#
)
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPWD001B WHERE ID = #id#
</delete>
<update id="update">
UPDATE ${hpjxSchema}.T_HPWD001B
SET
UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime#, <!-- 记录修改时间 -->
FILE_ID = #fileId# <!-- 文件ID -->
WHERE ID = #id#
</update>
</sqlMap>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="HPWD001C">
<sql id="column">
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
CREATED_BY as "createdBy", <!-- 记录创建者 -->
CREATED_NAME as "createdName", <!-- 记录创建名称 -->
CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
FILE_ID as "fileId", <!-- 文件ID -->
DOC_ID as "docId" <!-- 附件ID -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fileId">
FILE_ID = #fileId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docId">
DOC_ID = #docId#
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.wd.domain.HPWD001C">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPWD001C
WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPWD001C
WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPWD001C (
COMPANY_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
DELETE_FLAG, <!-- 0-未删除,1-已删除 -->
FILE_ID, <!-- 文件ID -->
DOC_ID <!-- 附件ID -->
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #fileId#, #docId#
)
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPWD001C WHERE ID = #id#
</delete>
<update id="update">
UPDATE ${hpjxSchema}.T_HPWD001C
SET
UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime#, <!-- 记录修改时间 -->
FILE_ID = #fileId# <!-- 文件ID -->
WHEREID = #id#
</update>
</sqlMap>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="HPWD002">
<sql id="column">
A.ID as "id",
A.COMPANY_CODE as "companyCode", <!-- 企业编码 -->
A.DEP_CODE as "depCode", <!-- 部门编码 -->
A.FACTORY_CODE as "factoryCode", <!-- 公司编码 -->
A.FACTORY_NAME as "factoryName", <!-- 公司名称 -->
A.PROJ_CODE as "projCode", <!-- 项目编码 -->
A.PROJ_NAME as "projName", <!-- 项目名称 -->
A.FILE_ID as "fileId", <!-- 文件ID -->
A.FILE_TYPE as "fileType", <!-- 文件类型 -->
A.FILE_NAME as "fileName", <!-- 文件名称 -->
B.DOC_VERSION as "docVersion", <!-- 文件版本号 -->
B.RELEASE_DATE as "releaseDate", <!-- 发布时间 -->
B.DOC_ID as "docId", <!-- 文件号 -->
B.DOC_NAME as "docName", <!-- 文件附件名称 -->
B.DOC_TYPE as "docType", <!-- 文件类型 -->
B.PREVIEW_NUM as "previewNum", <!-- 预览次数 -->
B.DOWNLOAD_NUM as "downloadNum", <!-- 下载次数 -->
B.CREATED_BY as "createdBy", <!-- 创建人 -->
B.CREATED_NAME as "createdName", <!-- 创建人名称 -->
B.CREATED_TIME as "createdTime" <!-- 创建时间 -->
</sql>
<sql id="condition">
AND A.DELETE_FLAG = 0
AND B.DELETE_FLAG = 0
AND B.BIZ_TYPE = 'WD'
<include refid="SqlBase.authConditionA"/>
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName">
A.FACTORY_NAME LIKE CONCAT('%', #factoryName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
A.PROJ_NAME LIKE CONCAT('%', #projName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fileId">
A.FILE_ID = #fileId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fileType">
A.FILE_TYPE = #fileType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fileName">
A.FILE_NAME LIKE CONCAT('%', #fileName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
B.STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docId">
B.DOC_ID = #docId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docName">
B.DOC_NAME LIKE CONCAT('%', #docName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentId">
B.BIZ_ID IN (
select FILE_ID from ${hpjxSchema}.T_HPWD003
where FILE_ID = #parentId#
<isNotEmpty prepend=" AND " property="userId">
USER_ID = #userId#
</isNotEmpty>
)
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
LEFT(B.CREATED_TIME,8) = replace(#createdTime#,'-','')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docType">
B.DOC_TYPE = #docType#
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
A.ID DESC, B.ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.wd.domain.HPWD002">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPWD001 A
INNER JOIN ${hpjxSchema}.T_HPWD099 B ON A.FILE_ID = B.BIZ_ID
WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*)
FROM ${hpjxSchema}.T_HPWD001 A
INNER JOIN ${hpjxSchema}.T_HPWD099 B ON A.FILE_ID = B.BIZ_ID
WHERE 1=1
<include refid="condition"/>
</select>
</sqlMap>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="HPWD003">
<sql id="column">
A.ID as "id",
A.COMPANY_CODE as "companyCode", <!-- 企业编码 -->
A.DEP_CODE as "depCode", <!-- 部门编码 -->
A.CREATED_BY as "createdBy", <!-- 记录创建者 -->
A.CREATED_NAME as "createdName", <!-- 记录创建名称 -->
A.CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
A.UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
A.UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
A.UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
A.DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
A.FILE_ID as "fileId", <!-- 文件ID -->
A.USER_ID as "userId", <!-- 用户ID -->
A.REMARK as "remark", <!-- 备注 -->
A.IS_PROJECT_MANAGER as "isProjectManager", <!-- 是否项目经理,0=否,1=是 -->
A.FACTORY_CODE as "factoryCode"
<!--A.EXT_ID as "extId" 外部系统ID -->
</sql>
<sql id="columnB">
B.USER_NAME as "userName"
</sql>
<sql id="columnD">
D.ORG_ID as "orgId",
D.ORG_CNAME as "orgCname"
</sql>
<sql id="condition">
AND A.DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fileId">
A.FILE_ID = #fileId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
A.USER_ID LIKE CONCAT('%', #userId#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fileIds">
A.FILE_ID IN <iterate close=")" open="(" conjunction="," property="fileIds">#fileIds[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
A.FACTORY_CODE = #factoryCode#
</isNotEmpty>
</sql>
<sql id="conditionB">
<isNotEmpty prepend=" AND " property="userName">
B.USER_NAME LIKE CONCAT('%', #userName#, '%')
</isNotEmpty>
</sql>
<sql id="conditionD">
<isNotEmpty prepend=" AND " property="orgCname">
D.ORG_CNAME LIKE CONCAT('%', #orgCname#, '%')
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
A.ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="getByUser" resultClass="com.baosight.hpjx.hp.wd.domain.HPWD003">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPWD003 A
WHERE 1=1
AND A.FILE_ID = #fileId#
AND A.USER_ID = #userId#
</select>
<select id="query" resultClass="com.baosight.hpjx.hp.wd.domain.HPWD003">
SELECT
<include refid="column"/>,
<include refid="columnB"/>,
<include refid="columnD"/>
FROM ${hpjxSchema}.T_HPWD003 A
INNER JOIN ${platSchema}.XS_USER B ON A.USER_ID = B.LOGIN_NAME
LEFT JOIN ${platSchema}.TXSOG01 D ON D.ORG_ID = A.FACTORY_CODE
WHERE 1=1
<include refid="condition"/>
<include refid="conditionB"/>
<include refid="conditionD"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*)
FROM ${hpjxSchema}.T_HPWD001 A
INNER JOIN ${platSchema}.XS_USER B ON A.USER_ID = B.LOGIN_NAME
LEFT JOIN ${platSchema}.TXSOG01 D ON D.ORG_ID = A.FACTORY_CODE
WHERE 1=1
<include refid="condition"/>
<include refid="conditionB"/>
<include refid="conditionD"/>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPWD003 (
COMPANY_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
FILE_ID, <!-- 文件ID -->
USER_ID, <!-- 用户ID -->
REMARK, <!-- 备注 -->
IS_PROJECT_MANAGER,
FACTORY_CODE
<!--EXT_ID 外部系统ID -->
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#fileId#, #userId#, #remark#, #isProjectManager#, #factoryCode#
)
</insert>
<!-- 批量写入 -->
<insert id="batchInsert">
INSERT INTO ${hpjxSchema}.HPWD003 (
COMPANY_CODE, DEP_CODE, CREATED_BY, CREATED_NAME, CREATED_TIME,
FILE_ID, USER_ID, REMARK, IS_PROJECT_MANAGER, FACTORY_CODE
) VALUES
<iterate open="(" conjunction="), (" close=")" property="rows">
#rows[].companyCode, #rows[].depCode#, #rows[].createdBy#, #rows[].createdName#,
#rows[].createdTime#, #rows[].fileId#, #rows[].userId#, #rows[].remark#,
#rows[].isProjectManager#, #rows[].factoryCode#
</iterate>
</insert>
<!-- 逻辑删除 -->
<delete id="delete">
UPDATE ${hpjxSchema}.T_HPWD003 SET DELETE_FLAG = 1 WHERE ID = #id#
</delete>
<!-- 修改信息 -->
<update id="updateInfo">
UPDATE ${hpjxSchema}.T_HPWD003
SET
IS_PROJECT_MANAGER = #isProjectManager#,
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id#
</update>
</sqlMap>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="HPWD003A">
<sql id="column">
A.USER_ID as "userId", <!-- 用户id -->
A.USER_NAME as "userName", <!-- 用户名 -->
A.LOGIN_NAME as "loginName", <!-- 登录id -->
A.GENDER as "gender", <!-- 性别 -->
A.MOBILE as "mobile", <!-- 手机号 -->
A.EMAIL as "email", <!-- 邮箱 -->
A.COMPANY_CODE as "companyCode" <!-- 企业编码 -->
<!--A.EXT_ID as "extId" 外部系统主键ID -->
</sql>
<sql id="columnB">
C.ORG_ID as "depCode", <!-- 部门编码-->
C.ORG_CNAME as "depName" <!-- 部门名称-->
</sql>
<sql id="condition">
<!-- 过滤已经添加的用户 -->
AND NOT EXISTS (SELECT * FROM ${hpjxSchema}.T_HPWD003 T WHERE A.LOGIN_NAME = T.USER_ID
AND T.DELETE_FLAG = 0 AND T.FILE_ID = #fileId#
)
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="loginName">
A.LOGIN_NAME = #loginName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
A.USER_ID LIKE CONCAT('%', #userId#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userName">
A.USER_NAME LIKE CONCAT('%', #userName#, '%')
</isNotEmpty>
</sql>
<sql id="conditionC">
<isNotEmpty prepend=" AND " property="depName">
C.ORG_CNAME LIKE CONCAT('%', #depName#, '%')
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
A.REC_CREATE_TIME DESC
</isEmpty>
</dynamic>
</sql>
<!-- 查询用户信息 -->
<select id="query" resultClass="com.baosight.hpjx.hp.xs.domain.User">
SELECT
<include refid="column"/>,
<include refid="columnB"/>
FROM ${platSchema}.XS_USER A
LEFT JOIN ${platSchema}.TXSOG02 B ON A.USER_ID = B.USER_ID
LEFT JOIN ${platSchema}.TXSOG01 C ON B.ORG_ID = C.ORG_ID
WHERE 1=1
<include refid="condition"/>
<include refid="conditionC"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*)
FROM ${platSchema}.XS_USER A
LEFT JOIN ${platSchema}.TXSOG02 B ON A.USER_ID = B.USER_ID
LEFT JOIN ${platSchema}.TXSOG01 C ON B.ORG_ID = C.ORG_ID
WHERE 1=1
<include refid="condition"/>
<include refid="conditionC"/>
</select>
</sqlMap>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="HPWD009">
<sql id="column">
T.ID as "id",
T.COMPANY_CODE as "companyCode", <!-- 企业编码 -->
T.DEP_CODE as "depCode", <!-- 部门编码 -->
T.CREATED_BY as "createdBy", <!-- 记录创建者 -->
T.CREATED_NAME as "createdName", <!-- 记录创建名称 -->
T.CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
T.UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
T.UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
T.UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
T.DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
T.USER_ID as "userId", <!-- 用户ID -->
T.USER_NAME as "userName", <!-- 用户姓名 -->
T.REMARK as "remark", <!-- 备注 -->
T.FACTORY_CODE as "factoryCode"
</sql>
<sql id="columnD">
D.ORG_ID as "orgId",
D.ORG_CNAME as "orgCname"
</sql>
<sql id="condition">
AND T.DELETE_FLAG = 0
<include refid="conditionD"/>
<isNotEmpty prepend=" AND " property="id">
T.ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
T.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
T.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
T.USER_ID LIKE CONCAT('%', #userId#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userName">
T.USER_NAME LIKE CONCAT('%', #userName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
T.FACTORY_CODE = #factoryCode#
</isNotEmpty>
</sql>
<sql id="conditionD">
<isNotEmpty prepend=" AND " property="orgCname">
D.ORG_CNAME LIKE CONCAT('%', #orgCname#, '%')
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
T.ID asc
</isEmpty>
</dynamic>
</sql>
<select id="getByUser" resultClass="com.baosight.hpjx.hp.wd.domain.HPWD009">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPWD009 T
WHERE 1=1
AND USER_ID = #userId#
</select>
<select id="query" resultClass="com.baosight.hpjx.hp.wd.domain.HPWD009">
SELECT
<include refid="column"/>,
<include refid="columnD"/>
FROM ${hpjxSchema}.T_HPWD009 T
INNER JOIN ${platSchema}.XS_USER B ON T.USER_ID = B.LOGIN_NAME
LEFT JOIN ${platSchema}.TXSOG02 C ON B.USER_ID = C.USER_ID
LEFT JOIN ${platSchema}.TXSOG01 D ON C.ORG_ID = D.ORG_ID
WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPWD009 T
INNER JOIN ${platSchema}.XS_USER B ON T.USER_ID = B.LOGIN_NAME
LEFT JOIN ${platSchema}.TXSOG02 C ON B.USER_ID = C.USER_ID
LEFT JOIN ${platSchema}.TXSOG01 D ON C.ORG_ID = D.ORG_ID
WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPWD009 (
COMPANY_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
DELETE_FLAG, <!-- 0-未删除,1-已删除 -->
USER_ID, <!-- 用户ID -->
USER_NAME, <!-- 用户姓名 -->
REMARK, <!-- 备注 -->
FACTORY_CODE
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #userId#, #userName#, #remark#, #factoryCode#
)
</insert>
<delete id="delete">
UPDATE ${hpjxSchema}.T_HPWD009 SET DELETE_FLAG = 1 WHERE ID = #id#
</delete>
<update id="update">
UPDATE ${hpjxSchema}.T_HPWD009
SET
USER_ID = #userId#, <!-- 用户ID -->
USER_NAME = #userName#, <!-- 用户姓名 -->
REMARK = #remark#, <!-- 备注 -->
FACTORY_CODE = #factoryCode#,
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id#
</update>
</sqlMap>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="HPWD009A">
<sql id="column">
A.USER_ID as "userId", <!-- 用户id -->
A.USER_NAME as "userName", <!-- 用户名 -->
A.LOGIN_NAME as "loginName", <!-- 登录id -->
A.GENDER as "gender", <!-- 性别 -->
A.MOBILE as "mobile", <!-- 手机号 -->
A.EMAIL as "email", <!-- 邮箱 -->
A.COMPANY_CODE as "companyCode" <!-- 企业编码 -->
</sql>
<sql id="columnB">
C.ORG_ID as "depCode", <!-- 部门编码-->
C.ORG_CNAME as "depName" <!-- 部门名称-->
</sql>
<sql id="condition">
<!-- 过滤已经添加的用户 -->
AND NOT EXISTS (SELECT * FROM ${hpjxSchema}.T_HPWD009 T WHERE A.LOGIN_NAME = T.USER_ID
AND T.DELETE_FLAG = 0
)
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="loginName">
A.LOGIN_NAME = #loginName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
A.USER_ID LIKE CONCAT('%', #userId#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userName">
A.USER_NAME LIKE CONCAT('%', #userName#, '%')
</isNotEmpty>
</sql>
<sql id="conditionC">
<isNotEmpty prepend=" AND " property="depName">
C.ORG_CNAME LIKE CONCAT('%', #depName#, '%')
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
A.REC_CREATE_TIME DESC
</isEmpty>
</dynamic>
</sql>
<!-- 查询用户信息 -->
<select id="query" resultClass="com.baosight.hpjx.hp.xs.domain.User">
SELECT
<include refid="column"/>,
<include refid="columnB"/>
FROM ${platSchema}.XS_USER A
LEFT JOIN ${platSchema}.TXSOG02 B ON A.USER_ID = B.USER_ID
LEFT JOIN ${platSchema}.TXSOG01 C ON B.ORG_ID = C.ORG_ID
WHERE 1=1
<include refid="condition"/>
<include refid="conditionC"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*)
FROM ${platSchema}.XS_USER A
LEFT JOIN ${platSchema}.TXSOG02 B ON A.USER_ID = B.USER_ID
LEFT JOIN ${platSchema}.TXSOG01 C ON B.ORG_ID = C.ORG_ID
WHERE 1=1
<include refid="condition"/>
<include refid="conditionC"/>
</select>
</sqlMap>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="HPWD099">
<sql id="column">
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 预留 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 修改人 -->
UPDATED_NAME as "updatedName", <!-- 修改人名称 -->
UPDATED_TIME as "updatedTime", <!-- 修改时间 -->
BIZ_TYPE as "bizType", <!-- 业务类型 -->
BIZ_ID as "bizId", <!-- 业务ID -->
DOC_ID as "docId", <!-- 文件ID -->
DOC_NAME as "docName", <!-- 文件名称 -->
DOC_TYPE as "docType", <!-- 文件类型 -->
STATUS as "status",
PREVIEW_NUM as "previewNum", <!-- 预览次数 -->
DOWNLOAD_NUM as "downloadNum", <!-- 下载次数 -->
DOC_VERSION as "docVersion", <!-- 文件版本号 -->
RELEASE_DATE as "releaseDate", <!-- 发布时间 -->
OPER_STATUS as "operStatus"
</sql>
<sql id="condition">
<include refid="SqlBase.authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="bizType">
BIZ_TYPE = #bizType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="bizId">
BIZ_ID = #bizId#
</isNotEmpty>
<!--<isNotEmpty prepend=" AND " property="fileId">
BIZ_ID IN (select FILE_ID from ${hpjxSchema}.hgwd003 where USER_ID = #userId# and FILE_ID = #fileId# )
</isNotEmpty>-->
<isNotEmpty prepend=" AND " property="docId">
DOC_ID = #docId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docType">
DOC_TYPE = #docType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docVersion">
DOC_VERSION = #docVersion#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="releaseDate">
RELEASE_DATE = #releaseDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentId">
BIZ_ID = #parentId#
</isNotEmpty>
<isEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = 0
</isEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG in <iterate close=")" open="(" conjunction="," property="deleteFlag">#deleteFlag[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="operStatus">
OPER_STATUS = #operStatus#
</isNotEmpty>
</sql>
<sql id="customCondition">
<include refid="condition"/>
<isNotEmpty prepend=" AND " property="docName">
DOC_NAME LIKE CONCAT('%', #docName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdDateFrom">
CREATED_TIME &gt;= CONCAT(REPLACE(#createdDateFrom#, '-', ''), '000000')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdDateTo">
CREATED_TIME &lt;= CONCAT(REPLACE(#createdDateTo#, '-', ''), '235959')
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.wd.domain.HPWD099">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPWD099
WHERE 1=1
<include refid="customCondition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*)
FROM ${hpjxSchema}.T_HPWD099
WHERE 1=1
<include refid="customCondition"/>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPWD099 (
COMPANY_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
DELETE_FLAG, <!-- 是否删除 -->
BIZ_TYPE, <!-- 业务类型 -->
BIZ_ID, <!-- 业务ID -->
DOC_ID, <!-- 文件ID -->
DOC_NAME, <!-- 文件名称 -->
DOC_TYPE, <!-- 文件名称 -->
STATUS,
DOC_VERSION,
RELEASE_DATE,
OPER_STATUS
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #bizType#, #bizId#, #docId#, #docName#, #docType#, #status#, #docVersion#, #releaseDate#, #operStatus#
)
</insert>
<delete id="deleteBizId">
UPDATE ${hpjxSchema}.T_HPWD099
SET DELETE_FLAG = 1
WHERE BIZ_ID = #bizId#
</delete>
<delete id="delete">
UPDATE ${hpjxSchema}.T_HPWD099
SET DELETE_FLAG = 1
WHERE ID = #id#
</delete>
<delete id="deleteDocId">
DELETE FROM ${hpjxSchema}.T_HPWD099 WHERE DOC_ID = #docId#
</delete>
<delete id="deleteId">
DELETE FROM ${hpjxSchema}.T_HPWD099 WHERE ID = #id#
</delete>
<update id="update">
UPDATE ${hpjxSchema}.T_HPWD099
SET
DOC_ID = #docId#, <!-- 文件ID -->
DOC_NAME = #docName#, <!-- 文件名称 -->
DOC_TYPE = #docType#, <!-- 文件类型 -->
STATUS = #status#,
DOC_VERSION = DOC_VERSION + 1, <!--版本号-->
RELEASE_DATE = #releaseDate#, <!--发布时间-->
OPER_STATUS = #operStatus#,
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_NAME = #updatedName#, <!-- 修改人名称 -->
UPDATED_TIME = #updatedTime# <!-- 修改时间 -->
WHERE ID = #id#
</update>
<update id="updateStatus">
UPDATE ${hpjxSchema}.T_HPWD099
SET
STATUS = #status#, <!-- 状态 -->
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_NAME = #updatedName#, <!-- 修改人名称 -->
UPDATED_TIME = #updatedTime# <!-- 修改时间 -->
WHERE ID = #id#
</update>
<update id="updateReleaseDate">
UPDATE ${hpjxSchema}.T_HPWD099
SET
RELEASE_DATE = #releaseDate#, <!--发布时间-->
DOC_VERSION = DOC_VERSION + 1, <!--版本号-->
STATUS = #status#, <!-- 状态 -->
OPER_STATUS = #operStatus#,
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id#
</update>
<update id="batchUpdate">
UPDATE ${hpjxSchema}.T_HPWD099
SET
BIZ_ID = #bizId#, <!-- 物料ID -->
<include refid="SqlBase.updateRevise"/>
WHERE DOC_ID IN <iterate close=")" open="(" conjunction="," property="docIds">#docIds[]#</iterate>
</update>
<!-- 预览自增 -->
<update id="previewIncr">
UPDATE ${hpjxSchema}.T_HPWD099
SET
PREVIEW_NUM = PREVIEW_NUM + 1,
<include refid="SqlBase.updateRevise"/>
WHERE DOC_ID = #docId#
</update>
<!-- 下载自增 -->
<update id="downloadIncr">
UPDATE ${hpjxSchema}.T_HPWD099
SET
DOWNLOAD_NUM = DOWNLOAD_NUM + 1,
<include refid="SqlBase.updateRevise"/>
WHERE DOC_ID = #docId#
</update>
</sqlMap>
\ No newline at end of file
package com.baosight.hpjx.hp.wd.utils;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.hp.wd.domain.HPWD003;
import com.baosight.hpjx.hp.wd.tools.HPWDTools;
/**
* @author LiuYang
* @version 1.0 2024/9/25
* @description
*/
public class HpWdUtils {
/**
* @author:songx
* @date:2024/8/19,14:57
*/
public static class HpWd003 {
/**
* 是否项目经理
*
* @param fileId
* @return
*/
public static boolean isProjectManager(String fileId) {
HPWD003 dbWd003 = HPWDTools.HpWd003.getByUser(fileId);
if (dbWd003 == null) {
return false;
}
return CommonConstant.YesNo.YES_1.equals(dbWd003.getIsProjectManager());
}
/**
* 是否项目经理或管理员
*
* @param fileId
* @return
*/
public static boolean isManager(String fileId) {
if (isProjectManager(fileId)) {
return true;
}
return HpWd009.isManager();
}
}
/**
* @author:songx
* @date:2024/8/19,14:57
*/
public static class HpWd009 {
/**
* 是否管理员
*
* @return
*/
public static boolean isManager() {
return HPWDTools.HpWd009.getByUser() != null;
}
/**
* 是否管理员
*
* @return
*/
public static boolean isManager(String userId) {
return HPWDTools.HpWd009.getByUser(userId) != null;
}
}
}
...@@ -15,6 +15,8 @@ public class User extends DaoEPBase { ...@@ -15,6 +15,8 @@ public class User extends DaoEPBase {
public static final String FIELD_MOBILE = "mobile"; /* 手机号*/ public static final String FIELD_MOBILE = "mobile"; /* 手机号*/
public static final String FIELD_EMAIL = "email"; /* 邮箱*/ public static final String FIELD_EMAIL = "email"; /* 邮箱*/
public static final String FIELD_COMPANY_CODE = "companyCode"; /* 企业代码*/ public static final String FIELD_COMPANY_CODE = "companyCode"; /* 企业代码*/
public static final String FIELD_DEP_CODE = "depCode"; /* 部门编码*/
public static final String FIELD_DEP_NAME = "depName"; /* 部门名称*/
/** /**
* 用户ID * 用户ID
...@@ -50,6 +52,16 @@ public class User extends DaoEPBase { ...@@ -50,6 +52,16 @@ public class User extends DaoEPBase {
* 企业代码 * 企业代码
*/ */
private String companyCode; private String companyCode;
/**
* 部门编码
*/
private String depCode;
/**
* 部门名称
*/
private String depName;
public String getUserId() { public String getUserId() {
return userId; return userId;
...@@ -106,4 +118,20 @@ public class User extends DaoEPBase { ...@@ -106,4 +118,20 @@ public class User extends DaoEPBase {
public void setGender(String gender) { public void setGender(String gender) {
this.gender = gender; this.gender = gender;
} }
public String getDepCode() {
return depCode;
}
public void setDepCode(String depCode) {
this.depCode = depCode;
}
public String getDepName() {
return depName;
}
public void setDepName(String depName) {
this.depName = depName;
}
} }
...@@ -3,20 +3,7 @@ package com.baosight.hpjx.util; ...@@ -3,20 +3,7 @@ package com.baosight.hpjx.util;
import com.baosight.hpjx.core.constant.OSConstant; import com.baosight.hpjx.core.constant.OSConstant;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.BufferedInputStream; import java.io.*;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.URL; import java.net.URL;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.file.Files; import java.nio.file.Files;
...@@ -471,6 +458,106 @@ public class FileUtils extends org.apache.commons.io.FileUtils { ...@@ -471,6 +458,106 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
URL httpUrl = new URL(url); URL httpUrl = new URL(url);
return httpUrl.openStream(); return httpUrl.openStream();
} }
/**
* 文件下载
*
* @param file
* @param fileName
* @param response
* @throws IOException
*/
public static void downloadFile(File file, String fileName, boolean isPreview, HttpServletResponse response)
throws IOException {
try (InputStream is = new FileInputStream(file)) {
downloadFile(is, fileName, isPreview, response);
} catch (Exception e) {
throw e;
}
}
/**
* 下载文件到前端
*
* @param url
* @param fileName
* @param response
*/
public static void downloadUrlFile(String url, String fileName, boolean isPreview, HttpServletResponse response)
throws IOException {
try (InputStream is = downloadStreamFromUrl(url);) {
downloadFile(is, fileName, isPreview, response);
} catch (Exception e) {
throw e;
}
}
/**
* 下载文件
*
* @param is
* @param fileName
* @param isPreview
* @param response
* @throws IOException
*/
private static void downloadFile(InputStream is, String fileName, boolean isPreview, HttpServletResponse response)
throws IOException {
response.reset();
// 设置响应类型
setResponseHeader(fileName, isPreview, response);
try (OutputStream outputStream = new BufferedOutputStream(response.getOutputStream())) {
byte[] buffer = new byte[1024];
while (true) {
int len = is.read(buffer);
if (len == -1) {
break;
}
outputStream.write(buffer, 0, len);
}
outputStream.flush();
} catch (IOException e) {
throw e;
}
}
/**
* 设置返回头
*
* @param fileName
* @param isPreview
* @param response
* @throws UnsupportedEncodingException
*/
private static void setResponseHeader(String fileName, boolean isPreview, HttpServletResponse response)
throws UnsupportedEncodingException {
// 下载文件
if (!isPreview) {
response.setContentType("application/octet-stream;charset=UTF-8");
response.setHeader("Content-Disposition", "attachment;filename="
+ URLEncoder.encode(fileName, "UTF-8"));
return;
}
// 预览文件
String fileType = FileUtils.getFileType(fileName);
if ("jpg/jpeg/png/bmp/gif/tif/icon/ico/".contains(fileType)) {
response.setContentType("text/html; charset=UTF-8");
response.setContentType("image/jpeg");
} else if ("pdf".contains(fileType)) {
response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "inline; filename="
+ URLEncoder.encode(fileName, "UTF-8"));
} else if ("txt".contains(fileType)){
response.setContentType("text/plain; charset=UTF-8");
response.setHeader("Content-Disposition", "inline; filename="
+ URLEncoder.encode(fileName, "UTF-8"));
} else {
response.setContentType("application/octet-stream;charset=UTF-8");
response.setHeader("Content-Disposition", "attachment;filename="
+ URLEncoder.encode(fileName, "UTF-8"));
}
}
/** /**
* 下载文件到前端 * 下载文件到前端
...@@ -481,6 +568,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils { ...@@ -481,6 +568,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
*/ */
public static void downloadUrlFile(String url, String fileName, HttpServletResponse response) throws IOException { public static void downloadUrlFile(String url, String fileName, HttpServletResponse response) throws IOException {
// 设置响应类型,图片和PDF直接预览 // 设置响应类型,图片和PDF直接预览
// 设置响应类型,图片和PDF直接预览
if ("jpg/jpeg/png/bmp/gif/tif/icon/ico".contains( if ("jpg/jpeg/png/bmp/gif/tif/icon/ico".contains(
fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase())) { fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase())) {
response.setContentType("text/html; charset=UTF-8"); response.setContentType("text/html; charset=UTF-8");
...@@ -491,7 +579,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils { ...@@ -491,7 +579,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
+ URLEncoder.encode(fileName, "UTF-8")); + URLEncoder.encode(fileName, "UTF-8"));
} }
try (InputStream is = downloadStreamFromUrl(url); try (InputStream is = downloadStreamFromUrl(url);
OutputStream outputStream = new BufferedOutputStream(response.getOutputStream())) { OutputStream outputStream = new BufferedOutputStream(response.getOutputStream())) {
byte[] buffer = new byte[1024]; byte[] buffer = new byte[1024];
while (true) { while (true) {
int len = is.read(buffer); int len = is.read(buffer);
......
...@@ -32,4 +32,12 @@ ...@@ -32,4 +32,12 @@
<sqlMap resource="com/baosight/hpjx/hp/zl/sql/HPZL004.xml"/> <sqlMap resource="com/baosight/hpjx/hp/zl/sql/HPZL004.xml"/>
<sqlMap resource="com/baosight/hpjx/hp/zl/sql/HPZL004A.xml"/> <sqlMap resource="com/baosight/hpjx/hp/zl/sql/HPZL004A.xml"/>
<!--文档库服务-->
<sqlMap resource="com/baosight/hpjx/hp/wd/sql/HPWD001.xml"/>
<sqlMap resource="com/baosight/hpjx/hp/wd/sql/HPWD001A.xml"/>
<sqlMap resource="com/baosight/hpjx/hp/wd/sql/HPWD002.xml"/>
<sqlMap resource="com/baosight/hpjx/hp/wd/sql/HPWD003.xml"/>
<sqlMap resource="com/baosight/hpjx/hp/wd/sql/HPWD009.xml"/>
<sqlMap resource="com/baosight/hpjx/hp/wd/sql/HPWD099.xml"/>
</sqlMapConfig> </sqlMapConfig>
$(function () {
IPLATUI.EFGrid = {
"result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: {
pageSize: 10,
pageSizes: [20, 50, 70, 100],
},
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",
template: function (item) {
let template = item["changeStart"]
/* if (item.changeType == "uploadAdd" || item.changeType == "uploadDelete") {
template = "";
}*/
return template;
}
},{
field: "changeEnd",
template: function (item) {
let template = item["changeEnd"]
/*if (item.changeType == "uploadAdd" || item.changeType == "uploadDelete") {
template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'href="' + downloadHref(item.changeStart) + '" target="_blank">'+item.changeEnd+'</a>';
}*/
return template;
}
}],
loadComplete: function (grid) {
}
}
}
// 查询
$("#QUERY").on("click", query);
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/9/18
Time: 9:26
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<%@ page import="com.baosight.iplat4j.core.web.threadlocal.UserSession" %>
<%
String loginName = UserSession.getLoginName();
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="loginName" value="<%=loginName%>" />
<script type="text/javascript" src="${ctx}/common/js/dayjs.min.js"></script>
<EF:EFPage title="变更记录">
<EF:EFRegion id="inqu" title="查询条件">
<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:EFOption label="全部" value=""/>
<EF:EFOptions blockId="proj_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect blockId="inqu_status" row="0" ename="changeType" cname="变更类型" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpwd.changeType"/>
</EF:EFSelect>
<EF:EFInput blockId="inqu_status" row="0" ename="createdName" cname="创建人" placeholder="模糊查询" colWidth="3"/>
<EF:EFDatePicker cname="创建时间" blockId="inqu_status" ename="createdTime" row="0" colWidth="3"
format="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFInput blockId="inqu_status" row="0" ename="matId" cname="上级ID" type="hidden" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="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:EFComboColumn ename="projCode" cname="所属项目" blockName="proj_record_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="false" width="200" required="true"
align="center" filter="contains" sort="true" />--%>
<EF:EFComboColumn ename="changeType" cname="变更类型" width="100" align="center" readonly="true" required="false" defaultValue="20">
<EF:EFCodeOption codeName="hpjx.hpwd.changeType"/>
</EF:EFComboColumn>
<EF:EFColumn ename="changeContent" cname="变更内容" width="160" enable="true" readonly="true" align="center" required="false"/>
<EF:EFColumn ename="changeStart" cname="变更前" width="160" enable="true" readonly="false" align="center" required="false"/>
<EF:EFColumn ename="changeEnd" cname="变更后" width="160" enable="true" readonly="true" align="center" required="false"/>
<EF:EFColumn ename="createdName" cname="创建人" align="center" width="100" readonly="true" required="false"
enable="false"/>
<EF:EFColumn ename="createdTime" cname="创建时间" parseFormats="['yyyyMMddHHmmss']" editType="datetime"
dateFormat="yyyy-MM-dd HH:mm:ss" align="center" width="120" readonly="true" required="false"
enable="false"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFGrid = {
"result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: {
pageSize: 20,
pageSizes: [20, 50, 70, 100],
},
columns: [],
loadComplete: function (grid) {
}
}
}
// 查询
$("#QUERY").on("click", query);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
// 按键事件
downKeyUp();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/9/18
Time: 9:26
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 id="inqu" title="查询条件">
<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"/>
<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"
readonly="true"/>
</div>
<div class="row">
<EF:EFInput cname="文件名称" ename="fileName" blockId="inqu_status" row="0" colWidth="6" ratio="2:10"
readonly="true"/>
<EF:EFSelect cname="文件类型" ename="fileType" blockId="inqu_status" row="0" colWidth="6" ratio="2:10"
optionLabel="" defultValue="" readonly="true">
<EF:EFCodeOption codeName="hpjx.hpwd.fileType"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" 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="createdName" cname="预览人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="预览时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFGrid = {
"result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: {
pageSize: 20,
pageSizes: [20, 50, 70, 100],
},
columns: [],
loadComplete: function (grid) {
}
}
}
// 查询
$("#QUERY").on("click", query);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
// 按键事件
downKeyUp();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/9/18
Time: 9:27
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 id="inqu" title="查询条件">
<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"/>
<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"
readonly="true"/>
</div>
<div class="row">
<EF:EFInput cname="文件名称" ename="fileName" blockId="inqu_status" row="0" colWidth="6" ratio="2:10"
readonly="true"/>
<EF:EFSelect cname="文件类型" ename="fileType" blockId="inqu_status" row="0" colWidth="6" ratio="2:10"
optionLabel="" defultValue="" readonly="true">
<EF:EFCodeOption codeName="hpjx.hpwd.fileType"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" 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="createdName" cname="下载人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="下载时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
var factoryCodeBox = __eiInfo.getBlock("factory_record_block_id").getMappedRows();
var projCodeBox = __eiInfo.getBlock("proj_record_block_id").getMappedRows();
$("#QUERY").on("click", query);
IPLATUI.EFGrid= {
"result": {
pageable: {
pageSize: 10,
pageSizes: [10, 20, 50, 100],
},
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"];
}
}, {
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"];
}
}
],
exportGrid: {
exportFileName: function (gridInstance) {
// 导出的文件名包含时间戳 yyyy-MM-dd HH:mm:ss
return "文档库_" + kendo.toString(new Date(), IPLAT.FORMAT.DATE_14_PR);
},
exportFileType: "xls", // 默认值是xls,可选值为pdf[规划中]
exportBlockId: "result", // 默认值和blockId相同,导出的EiInfo中的指定数据块被导出
},
loadComplete: function(grid) {
//console.log(dayjs,"dayjs")
// 此 grid 对象
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
grid.dataSource.bind("change", function(e) {
// 判断父级节点是否发生变化
if (e.field === "projCode") {
let item = e.items[0];
for (let i = 0; i < projCodeBox.length; i++) {
if (projCodeBox[i]["valueField"] === item["projCode"]) {
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;
}
}
}
});
},
onAdd: function (e) {
$.each(e.items, function (index, item) {
let factoryCode = $("#inqu_status-0-factoryCode").val();
let projCode = $("#inqu_status-0-projCode").val();
if (!isBlank(factoryCode)){
item['factoryCode'] = factoryCode;
}
if (!isBlank(projCode)){
item['projCode'] = projCode;
}
item['parentId'] = $("#inqu_status-0-parentId").val();
item['leafLevel'] = $("#inqu_status-0-leafLevel").val();
});
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
let btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
save(btnNode);
},
onDelete: function (e) {
// 阻止默认请求,使用自定义删除
//e.preventDefault();
//deleteFunc();
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
query();
}
},
onRowClick: function (e) {
}
}
}
});
$(window).load(function () {
// 初始化查询
query();
});
/**
* 查询
*/
var query = function (e) {
resultGrid.dataSource.page(1);
};
/**
* 保存
*/
let save = function (btnNode) {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let factoryCode= item.get("factoryCode");
let projCode= item.get("projCode");
if(isBlank(factoryCode)){
message("选中的第"+(index+1)+"行\"公司\",不能为空!");
flag = false;
return false;
}
if(isBlank(projCode)){
message("选中的第"+(index+1)+"行\"所属项目\",不能为空!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPWD001E", "save", true,
function (e) {
var status = e.status;
if (status !== -1) {
let parentId = $("#inqu_status-0-parentId").val();
parent.JSColorbox.setValueCallback(e.getBlock("result").getMappedRows());
}
});
btnNode.attr("disabled", false);
}
});
}
}
/**
* 显示详情
*/
function showDetail(id,factoryCode) {
let url = "HPWD001A?methodName=initLoad&inqu_status-0-matId="+id+"&inqu_status-0-factoryCode="+factoryCode;
JSColorbox.open({
href: url,
title: "<div style='text-align: center;'>变更记录</div>",
width: "75%",
height: "95%",
});
}
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/9/18
Time: 9:28
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<%@ page import="com.baosight.iplat4j.core.web.threadlocal.UserSession" %>
<%
String loginName = UserSession.getLoginName();
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="loginName" value="<%=loginName%>" />
<script type="text/javascript" src="${ctx}/common/js/dayjs.min.js"></script>
<EF:EFPage title="文档库">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<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="factoryCode" 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:EFSelect blockId="inqu_status" row="0" ename="fileType" cname="文件类型" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpwd.fileType"/>
</EF:EFSelect>
<EF:EFInput blockId="inqu_status" row="0" ename="fileName" cname="文件名称" placeholder="模糊查询" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<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="parentId" cname="上级ID" hidden="true"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center" defaultValue="0" hidden="true">
<EF:EFCodeOption codeName="hpjx.hpwd.status"/>
</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"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="200" required="true"
align="left" filter="contains" sort="true"/>
<EF:EFColumn ename="projName" cname="所属项目" width="160" enable="true" readonly="true" align="center"
required="true" hidden="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:EFColumn ename="fileName" cname="文件名称" width="160" enable="true" readonly="false" align="left"
required="true"/>
<EF:EFColumn ename="fileId" cname="文件号" width="100" enable="false" readonly="true" align="center"
required="false"/>
<EF:EFColumn ename="createdName" cname="创建人" align="center" width="100" readonly="true" required="false"
enable="false"/>
<EF:EFColumn ename="createdTime" cname="创建时间" parseFormats="['yyyyMMddHHmmss']" editType="datetime"
dateFormat="yyyy-MM-dd HH:mm:ss" align="center" width="120" readonly="true" required="false"
enable="false"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
var factoryCodeBox = __eiInfo.getBlock("factory_record_block_id").getMappedRows();
var projCodeBox = __eiInfo.getBlock("proj_record_block_id").getMappedRows();
$("#QUERY").on("click", query);
IPLATUI.EFGrid= {
"result": {
pageable: {
pageSize: 10,
pageSizes: [10, 20, 50, 100],
},
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: {
exportFileName: function (gridInstance) {
// 导出的文件名包含时间戳 yyyy-MM-dd HH:mm:ss
return "文档库_" + kendo.toString(new Date(), IPLAT.FORMAT.DATE_14_PR);
},
exportFileType: "xls", // 默认值是xls,可选值为pdf[规划中]
exportBlockId: "result", // 默认值和blockId相同,导出的EiInfo中的指定数据块被导出
},
loadComplete: function(grid) {
//console.log(dayjs,"dayjs")
// 此 grid 对象
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
$("#RELEASE").click("click",updateRelease)
grid.dataSource.bind("change", function(e) {
// 判断父级节点是否发生变化
if (e.field === "projCode") {
let item = e.items[0];
for (let i = 0; i < projCodeBox.length; i++) {
if (projCodeBox[i]["valueField"] === item["projCode"]) {
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;
}
}
}
});
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
let btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
save(btnNode);
},
onDelete: function (e) {
// 阻止默认请求,使用自定义删除
//e.preventDefault();
//deleteFunc();
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
query();
}
},
onRowClick: function (e) {
}
}
}
});
$(window).load(function () {
// 初始化查询
query();
});
/**
* 查询
*/
var query = function (e) {
resultGrid.dataSource.page(1);
};
/**
* 保存
*/
let save = function (btnNode) {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let factoryCode= item.get("factoryCode");
let projCode= item.get("projName");
if(isBlank(factoryCode)){
message("选中的第"+(index+1)+"行\"公司\",不能为空!");
flag = false;
return false;
}
if(isBlank(projCode)){
message("选中的第"+(index+1)+"行\"所属项目\",不能为空!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPWD001F", "save", true,
function (e) {
var status = e.status;
if (status !== -1) {
let fileId = $("#inqu_status-0-fileId").val();
parent.JSColorbox.setValueCallback(fileId);
}
}
);
btnNode.attr("disabled", false);
}
});
}
}
/**
* 发布
*/
function updateRelease() {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let inEiInfo = new EiInfo();
inEiInfo.addBlock(JSUtils.checkedRows2Block("result"))
EiCommunicator.send('HPWD001', 'updateRelease', inEiInfo, {
onSuccess(response) {
if (response.status != -1) {
NotificationUtil(response.msg);
query();
} else {
NotificationUtil(response.msg, "error");
}
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
}, {
async: false
}
);
}
/**
* 显示详情
*/
function showDetail(id,factoryCode) {
let url = "HPWD001A?methodName=initLoad&inqu_status-0-matId="+id+"&inqu_status-0-factoryCode="+factoryCode;
JSColorbox.open({
href: url,
title: "<div style='text-align: center;'>变更记录</div>",
width: "75%",
height: "95%",
});
}
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/9/18
Time: 9:29
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<%@ page import="com.baosight.iplat4j.core.web.threadlocal.UserSession" %>
<%
String loginName = UserSession.getLoginName();
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="loginName" value="<%=loginName%>" />
<script type="text/javascript" src="${ctx}/common/js/dayjs.min.js"></script>
<EF:EFPage title="文档库">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<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="factoryCode" 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:EFSelect blockId="inqu_status" row="0" ename="fileType" cname="文件类型" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpwd.fileType"/>
</EF:EFSelect>
<EF:EFInput blockId="inqu_status" row="0" ename="fileName" cname="文件名称" placeholder="模糊查询" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<%--<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:EFCodeOption codeName="hggp.hgwd.status"/>
</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"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="200" required="true"
align="left" filter="contains" sort="true"/>
<EF:EFColumn ename="projName" cname="所属项目" width="160" enable="true" readonly="true" align="center"
required="true" hidden="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:EFColumn ename="fileName" cname="文件名称" width="160" enable="true" readonly="false" align="left"
required="true"/>
<EF:EFColumn ename="fileId" cname="文件号" width="100" enable="false" readonly="true" align="center"
required="false"/>
<EF:EFColumn ename="createdName" cname="创建人" align="center" width="100" readonly="true" required="false"
enable="false"/>
<EF:EFColumn ename="createdTime" cname="创建时间" parseFormats="['yyyyMMddHHmmss']" editType="datetime"
dateFormat="yyyy-MM-dd HH:mm:ss" align="center" width="120" readonly="true" required="false"
enable="false"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/9/18
Time: 18:09
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="文档浏览">
<div id="splitter" class="i-fit-height">
<div id="left-pane" class="i-fit-height">
<EF:EFRegion title="文档目录树" id="tree" fitHeight="true">
<div id="menu" style="margin-top: 12px; margin-bottom: 8px">
<EF:EFTree bindId="docTree" ename="tree_name" textField="text" valueField="label"
hasChildren="leaf" pid="parentId" serviceName="HPWD001D" methodName="queryTree"
expandLevel="1">
</EF:EFTree>
</div>
</EF:EFRegion>
</div>
<div id="right-pane" class="i-fit-height">
<EF:EFRegion id="inqu" title="查询条件">
<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="文档库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="类型" ename="type" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="层级" ename="leafLevel" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="文档库名称" ename="fileName" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="业务类型" ename="bizType" blockId="inqu_status" row="0" type="hidden" value="WD"/>
<EF:EFSelect blockId="inqu_status" row="0" ename="fileType" cname="文件分类" colWidth="3"
filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpwd.fileType"/>
</EF:EFSelect>
<EF:EFInput cname="文件名称" ename="docName" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFDatePicker blockId="inqu_status" row="0" ename="createdTime" cname="上传时间" role="date"
format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" queryMethod="query" sort="setted" checkMode="row">
<EF:EFColumn ename="id" cname="ID" hidden="true"/>
<EF:EFColumn ename="fileId" cname="ID" hidden="true"/>
<EF:EFColumn ename="docId" cname="文件ID" enable="false" width="200" align="center" sort="false"
hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" enable="false" width="140" align="center" sort="false"/>
<EF:EFComboColumn ename="fileType" cname="文件分类" enable="false" width="90" align="center">
<EF:EFCodeOption codeName="hpjx.hpwd.fileType"/>
</EF:EFComboColumn>
<EF:EFColumn ename="docName" cname="文件名称" enable="false" width="220" sort="true"/>
<EF:EFColumn ename="docType" cname="文件后缀" enable="false" width="110" align="center" sort="true"/>
<EF:EFColumn ename="docVersion" cname="版本号" enable="false" width="90" align="center" sort="true"/>
<EF:EFColumn ename="createdTime" cname="上传时间" parseFormats="['yyyyMMddHHmmss']" editType="datetime"
dateFormat="yyyy-MM-dd HH:mm:ss" align="center" width="140" readonly="true"
required="false" enable="false" sort="true"/>
<EF:EFColumn ename="previewNum" cname="预览次数" enable="false" width="100" align="right" sort="true"/>
<EF:EFColumn ename="downloadNum" cname="下载次数" enable="false" width="100" align="right" sort="true"/>
</EF:EFGrid>
</EF:EFRegion>
</div>
</div>
</EF:EFPage>
$(function () {
IPLATUI.EFTree = {
"docTree": {
query: function (inInfo, model) {
inInfo.set("inqu_status-0-fileId", $("#inqu_status-0-fileId").val());
return inInfo;
},
select: function (e) {
var nodeData = this.dataItem(e.node);
let label = nodeData.label;
let leafType = nodeData.leafType;
IPLATUI.EFTree.docTree.selectNode.treeId = label;
IPLATUI.EFTree.docTree.selectNode.leaf = nodeData.leaf;
IPLATUI.EFTree.docTree.selectNode.leafType = leafType;
// 添加预览记录
add(label, leafType, nodeData.docType);
},
template: function (node) {
var item = node.item;
let icon = 'fa fa-globe'
switch (item.leafType) {
case 'P':
icon = 'fa fa-clipboard'
break;
case 'C':
icon = 'fa fa-folder'
break;
}
return '<span class="' + icon + '" style="padding-right: 8px"> </span>'
+ '<span class="titleClass" title="' + item.label + '">'
+ item.text + '</span>'
},
loadComplete: function (options) {
// 保持结点展开状态
let fileId = $("#inqu_status-0-fileId").val();
let tree = $("#docTree").data("kendoTreeView");
expandTreeNode(tree, fileId);
},
selectNode: {
treeId: '',
leaf: false,
leafType: '',
}
// ROOT: {label: "root", text: "系统菜单", leaf: true}
}
};
});
/**
* 页面加载完后执行
*/
$(window).load(function () {
// 鼠标滚动
imageMouseListener();
});
/**
* 图片鼠标事件监听
*/
function imageMouseListener() {
document.getElementById('imageContainer').addEventListener('mousewheel', function (event) {
var scale = event.wheelDelta / 1000;
var newScale = Math.max(Math.min(this.scale || 1, 3), 0.1);
newScale += scale;
this.style.transform = 'scale(' + newScale + ')';
this.scale = newScale;
event.preventDefault();
});
}
/**
* 批量展开树节点
*
* @param tree
* @param node
*/
function expandTreeNode(tree, node) {
if (node == null || tree == null) {
return;
}
let barDataItem = tree.dataSource.get(node);
if (barDataItem) {
tree.expandPath([node])
} else {
setTimeout(() => {
expandTreeNode(tree, node)
}, 100)
}
}
/**
* 预览
*
* @param label docId
* @param leafType 节点类型:C=目录,F=文件
* @param docType
*/
function add(docId, leafType, docType) {
if (isBlank(leafType) || isBlank(docId)) {
message("文件类型或ID不能为空");
return;
}
// 隐藏预览区域
hideHtml();
// 第一级目录
if (leafType === "C") {
otherDownload(true, null);
return;
}
IPLAT.progress($("body"), true);
let inInfo = new EiInfo();
inInfo.set("result-0-fileId", $("#inqu_status-0-fileId").val());
inInfo.set("result-0-docId", docId);
EiCommunicator.send('HPWD001B', 'add', inInfo, {
onSuccess: function (res) {
if (res.getStatus() >= 0) {
try {
preview(docId, docType);
} catch (e) {
}
} else {
message(res.getMsg());
}
IPLAT.progress($("body"), false);
},
onFail: function (res) {
NotificationUtil("操作失败,原因[" + res.getMsg() + "]", "error");
IPLAT.progress($("body"), false);
}
});
}
/**
* 新增记录后回调
*
* @param docId
* @param docType
*/
function preview(docId, docType) {
// 隐藏文本描述
$("#descDiv").css('display', 'none');
if (isText(docType)) {
previewText(docId);
} else if (isXml(docType)) {
previewXml(docId);
} else if (isExcel(docType)) {
previewExcel(docId);
} else if (isWord(docType)) {
previewDocx(docId);
} else if (isImage(docType)) {
previewFrame(docId);
} else if (isFrame(docType)) {
previewFrame(docId);
} else {
otherDownload(false, docId);
}
}
/**
* 隐藏显示区域
*/
function hideHtml() {
$("#textContainer").css('display', 'none');
$("#textSpan").html("");
$("#docxContainer").css('display', 'none');
$("#imageContainer").css('display', 'none');
$("#image").attr('src', "");
$("#previewFrame").css('display', 'none');
$("#previewFrame").attr("src", "");
}
/**
* 是否文本
*
* @param fileName
* @returns {boolean}
*/
function isText(docType) {
if (isBlank(docType)) {
return false;
}
const extensions = ['txt'];
return extensions.includes(docType.toLowerCase());
}
/**
* 文件预览
*
* @param docId
*/
function previewText(docId) {
fetch(downloadHref(docId, true)).then(res => {
return res.text();
}).then(data => {
let container = document.getElementById("textContainer");
container.style.display = 'block';
// 使用new TextDecoder()指定编码
// const utf8Decoder = new TextDecoder('UTF-8', {ignoreBOM: true});
// const decodedText = utf8Decoder.decode(arrayBuffer);
$("#textSpan").text(data);
});
}
/**
* 是否文本
*
* @param fileName
* @returns {boolean}
*/
function isXml(docType) {
if (isBlank(docType)) {
return false;
}
const extensions = ['xml'];
return extensions.includes(docType.toLowerCase());
}
/**
* xml文件预览
*
* @param docId
*/
function previewXml(docId) {
fetch(downloadHref(docId, true)).then(res => {
return res.text();
}).then(data => {
let container = document.getElementById("textContainer");
container.style.display = 'block';
$("#textSpan").text(data);
});
}
/**
* 是否excel
*
* @param fileName
* @returns {boolean}
*/
function isExcel(docType) {
if (isBlank(docType)) {
return false;
}
const extensions = ['xls', 'xlsx'];
return extensions.includes(docType.toLowerCase());
}
/**
* 文件预览
*
* @param docId
*/
function previewExcel(docId) {
fetch(downloadHref(docId, true)).then(res => {
return res.blob();
}).then(blob => {
let container = document.getElementById("textContainer");
container.style.display = 'block';
// 使用new TextDecoder()指定编码
// const utf8Decoder = new TextDecoder('GBK', {ignoreBOM: true});
// const text = utf8Decoder.decode(arrayBuffer);
// $("#textSpan").html(text.replace(/\r\n?/g, '\n').replace(/\n/g, '<br/>'));
const reader = new FileReader();
reader.readAsArrayBuffer(blob);
reader.onload = function(e) {
let textSpan = document.getElementById('textSpan');
// 清空内容
textSpan.innerHTML = "";
let result = new Uint8Array(e.target.result);
let workbook = XLSX.read(result, {type: 'array'});
let sheetNames = workbook.SheetNames;
for (let i = 0; i < sheetNames.length; i++) {
// 假设我们只需要第一个工作表
var worksheet = workbook.Sheets[sheetNames[i]];
var data = XLSX.utils.sheet_to_html(worksheet);
// 在页面上显示JSON数据
textSpan.innerHTML += data + "<br/>";
}
};
});
}
/**
* 是否WORD
*
* @param fileName
* @returns {boolean}
*/
function isWord(docType) {
if (isBlank(docType)) {
return false;
}
const extensions = ['docx'];
return extensions.includes(docType.toLowerCase());
}
/**
* docx预览
*
* @param docId
*/
function previewDocx(docId) {
fetch(downloadHref(docId, true)).then(res => {
return res.arrayBuffer();
}).then(arrayBuffer => {
let container = document.getElementById("docxContainer");
container.style.display = 'block';
docx.renderAsync(arrayBuffer, container).then((x) => {
console.log("docx: finished")
});
});
}
/**
* 判断是否是图片
*
* @param fileName
* @returns {boolean}
*/
function isImage(docType) {
if (isBlank(docType)) {
return false;
}
const extensions = ['jpg', 'jpeg', 'png', 'gif', 'webp', 'bmp'];
return extensions.includes(docType.toLowerCase());
}
/**
* image预览
*
* @param docId
*/
function previewImage(docId) {
$("#image").attr('src', downloadHref(docId, true));
$("#imageContainer").css('display', '');
}
/**
* 判断是否frame预览
*
* @param fileName
* @returns {boolean}
*/
function isFrame(docType) {
if (isBlank(docType)) {
return false;
}
const extensions = ['pdf'];
return extensions.includes(docType.toLowerCase());
}
/**
* frame预览
*
* @param docId
*/
function previewFrame(docId) {
$("#previewFrame").css('display', '');
$("#previewFrame").attr("src", downloadHref(docId, true));
}
/**
* 其他下载
*
* @param isRoot
* @param docId
*/
function otherDownload(isRoot, docId) {
$("#descDiv").css('display', '');
if (isRoot) {
$("#descSpan").html("文件预览区域...");
} else {
$("#descSpan").html("该文件暂不支持预览,点击<a href='" + downloadHref(docId, false)
+ "' target='_blank'>下载</a>");
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
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