Commit 03376375 by 江和松

Merge remote-tracking branch 'origin/dev' into dev

parents abdb456c b01e502c
package com.baosight.hggp.core.interceptor;
import com.baosight.hggp.core.constant.EPCodeConstant;
import com.baosight.hggp.core.constant.S3Constant;
import com.baosight.hggp.core.tools.ServletTools;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.hggp.util.StringUtils;
......@@ -31,7 +32,9 @@ public class MyHandlerInterceptor implements HandlerInterceptor {
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object o) throws Exception {
try {
// 设置环境变量
request.setAttribute("projectEnv", ProjectInfo.getProjectEnv());
request.setAttribute("PROJECT_ENV", ProjectInfo.getProjectEnv());
// 设置文件上传位置
request.setAttribute("FILE_LOCATION", S3Constant.FILE_LOCATION);
// 校验接口权限
boolean isInterfaceAuth = this.checkUserInterfaceAuth(request, response);
if (!isInterfaceAuth) {
......
......@@ -3,6 +3,7 @@ package com.baosight.hggp.core.tools;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.iplat4j.common.ed.domain.TEDFA00;
import com.baosight.iplat4j.common.eu.domain.Teudm03;
import com.baosight.iplat4j.common.eu.domain.Teudm05;
import com.baosight.iplat4j.core.exception.PlatException;
import org.apache.commons.collections.CollectionUtils;
......@@ -69,6 +70,30 @@ public class Iplat4jTools {
}
/**
* 上传的文件
*
* @author:songx
* @date:2024/8/8,16:47
*/
public static class EuDm02 {
/**
* 查询页面信息
*
* @param docId
* @return
*/
public static Map getByDocId(String docId) {
AssertUtils.isEmpty(docId, "文件ID不能为空!");
Map<String, String> paramMap = new HashMap();
paramMap.put("docId", docId);
List<Map> results = DaoBase.getInstance().query("EUDM02.queryDocById", paramMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
}
/**
* 上传的文件
*
......@@ -83,7 +108,7 @@ public class Iplat4jTools {
* @param docId
* @return
*/
public static Teudm05 getDocByDocId(String docId) {
public static Teudm05 getByDocId(String docId) {
AssertUtils.isEmpty(docId, "文件ID不能为空!");
Map<String, String> paramMap = new HashMap();
paramMap.put("resId", docId);
......
......@@ -3,6 +3,7 @@ package com.baosight.hggp.core.utils;
import com.baosight.hggp.core.constant.S3Constant;
import com.baosight.hggp.core.tools.Iplat4jTools;
import com.baosight.hggp.util.FileUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.StringUtils;
import com.baosight.iplat4j.common.eu.domain.Teudm05;
import com.baosight.iplat4j.core.exception.PlatException;
......@@ -30,7 +31,7 @@ public class Iplat4jUtils {
// 判断文件上传的地址
String fileLocation = S3Constant.FILE_LOCATION;
if ("s3".equalsIgnoreCase(fileLocation)) {
Teudm05 dbDm05 = Iplat4jTools.EuDm05.getDocByDocId(docId);
Teudm05 dbDm05 = Iplat4jTools.EuDm05.getByDocId(docId);
if (dbDm05 == null) {
throw new PlatException("文件在服务器中不存在");
}
......@@ -49,10 +50,27 @@ public class Iplat4jUtils {
String docPath = document.get("realPath").toString();
String filePath = docPath + chgName;
// if (platFileUploader.deleteDocById(docId) > 0) {
return FileUtils.deleteFile(filePath);
return FileUtils.deleteFile(filePath);
// }
// return false;
}
}
/**
* 获取本地上传的文件
*
* @param docId
* @return
*/
public static Map getDoc02ById(String docId) {
Map dbDm02 = Iplat4jTools.EuDm02.getByDocId(docId);
if (MapUtils.isEmpty(dbDm02)) {
return null;
}
String chgName = dbDm02.get("chgName").toString();
String docPath = dbDm02.get("realPath").toString();
dbDm02.put("url", docPath + "/" + chgName);
return dbDm02;
}
}
......@@ -2,9 +2,15 @@ package com.baosight.hggp.core.utils;
import com.amazonaws.services.s3.AmazonS3;
import com.baosight.hggp.core.constant.S3Constant;
import com.baosight.hggp.core.tools.Iplat4jTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.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.net.URL;
/**
* OSS工具类
......@@ -15,6 +21,24 @@ import java.io.File;
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;
}
/**
* 上传文件
*
* @param key 默认不指定key的情况下,以文件内容的hash值作为文件名
......
package com.baosight.hggp.hg.wd.constant;
/**
* @author:songx
* @date:2024/8/16,15:51
*/
public class HgWdSqlConstant {
/**
* HGWD001 SQL定义
*
* @author:songx
* @date:2024/2/22,13:57
*/
public static class HgWd001 {
// 预览自增
public static final String PREVIEW_INCR = "HGWD001.previewIncr";
// 下载自增
public static final String DOWNLOAD_INCR = "HGWD001.downloadIncr";
}
}
......@@ -15,7 +15,7 @@ import com.baosight.iplat4j.core.util.StringUtils;
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-08-16 15:37:40 create
* @history 2024-08-19 14:34:38 create
*/
public class HGWD001 extends DaoEPBase {
......@@ -35,6 +35,7 @@ public class HGWD001 extends DaoEPBase {
public static final String FIELD_COMPANY_NAME = "companyName"; /* 公司名称*/
public static final String FIELD_PROJ_CODE = "projCode"; /* 项目编码*/
public static final String FIELD_PROJ_NAME = "projName"; /* 项目名称*/
public static final String FIELD_FILE_ID = "fileId"; /* 文件ID*/
public static final String FIELD_FILE_TYPE = "fileType"; /* 文件类型*/
public static final String FIELD_FILE_NAME = "fileName"; /* 文件名称*/
public static final String FIELD_DOC_ID = "docId"; /* 文件号*/
......@@ -42,6 +43,9 @@ public class HGWD001 extends DaoEPBase {
public static final String FIELD_DOC_VERSION = "docVersion"; /* 文件版本号*/
public static final String FIELD_STATUS = "status"; /* 状态*/
public static final String FIELD_REMARK = "remark"; /* 备注*/
public static final String FIELD_RELEASE_DATE = "releaseDate"; /* 发布时间*/
public static final String FIELD_PREVIEW_NUM = "previewNum"; /* 预览次数*/
public static final String FIELD_DOWNLOAD_NUM = "downloadNum"; /* 下载次数*/
public static final String COL_ID = "ID";
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/
......@@ -57,6 +61,7 @@ public class HGWD001 extends DaoEPBase {
public static final String COL_COMPANY_NAME = "COMPANY_NAME"; /* 公司名称*/
public static final String COL_PROJ_CODE = "PROJ_CODE"; /* 项目编码*/
public static final String COL_PROJ_NAME = "PROJ_NAME"; /* 项目名称*/
public static final String COL_FILE_ID = "FILE_ID"; /* 文件ID*/
public static final String COL_FILE_TYPE = "FILE_TYPE"; /* 文件类型*/
public static final String COL_FILE_NAME = "FILE_NAME"; /* 文件名称*/
public static final String COL_DOC_ID = "DOC_ID"; /* 文件号*/
......@@ -64,6 +69,9 @@ public class HGWD001 extends DaoEPBase {
public static final String COL_DOC_VERSION = "DOC_VERSION"; /* 文件版本号*/
public static final String COL_STATUS = "STATUS"; /* 状态*/
public static final String COL_REMARK = "REMARK"; /* 备注*/
public static final String COL_RELEASE_DATE = "RELEASE_DATE"; /* 发布时间*/
public static final String COL_PREVIEW_NUM = "PREVIEW_NUM"; /* 预览次数*/
public static final String COL_DOWNLOAD_NUM = "DOWNLOAD_NUM"; /* 下载次数*/
public static final String QUERY = "HGWD001.query";
public static final String COUNT = "HGWD001.count";
......@@ -85,6 +93,7 @@ public class HGWD001 extends DaoEPBase {
private String companyName = " "; /* 公司名称*/
private String projCode = " "; /* 项目编码*/
private String projName = " "; /* 项目名称*/
private String fileId = " "; /* 文件ID*/
private String fileType = " "; /* 文件类型*/
private String fileName = " "; /* 文件名称*/
private String docId = " "; /* 文件号*/
......@@ -92,6 +101,9 @@ public class HGWD001 extends DaoEPBase {
private Integer docVersion = new Integer(0); /* 文件版本号*/
private Integer status; /* 状态*/
private String remark = " "; /* 备注*/
private String releaseDate = " "; /* 发布时间*/
private Integer previewNum = new Integer(0); /* 预览次数*/
private Integer downloadNum = new Integer(0); /* 下载次数*/
/**
* initialize the metadata.
......@@ -156,6 +168,10 @@ public class HGWD001 extends DaoEPBase {
eiColumn.setDescName("项目名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_FILE_ID);
eiColumn.setDescName("文件ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_FILE_TYPE);
eiColumn.setDescName("文件类型");
eiMetadata.addMeta(eiColumn);
......@@ -184,6 +200,18 @@ public class HGWD001 extends DaoEPBase {
eiColumn.setDescName("备注");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_RELEASE_DATE);
eiColumn.setDescName("发布时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PREVIEW_NUM);
eiColumn.setDescName("预览次数");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DOWNLOAD_NUM);
eiColumn.setDescName("下载次数");
eiMetadata.addMeta(eiColumn);
}
......@@ -419,6 +447,22 @@ public class HGWD001 extends DaoEPBase {
this.projName = projName;
}
/**
* get the fileId - 文件ID.
* @return the fileId
*/
public String getFileId() {
return this.fileId;
}
/**
* set the fileId - 文件ID.
*
* @param fileId - 文件ID
*/
public void setFileId(String fileId) {
this.fileId = fileId;
}
/**
* get the fileType - 文件类型.
* @return the fileType
*/
......@@ -531,6 +575,54 @@ public class HGWD001 extends DaoEPBase {
this.remark = remark;
}
/**
* get the releaseDate - 发布时间.
* @return the releaseDate
*/
public String getReleaseDate() {
return this.releaseDate;
}
/**
* set the releaseDate - 发布时间.
*
* @param releaseDate - 发布时间
*/
public void setReleaseDate(String releaseDate) {
this.releaseDate = releaseDate;
}
/**
* get the previewNum - 预览次数.
* @return the previewNum
*/
public Integer getPreviewNum() {
return this.previewNum;
}
/**
* set the previewNum - 预览次数.
*
* @param previewNum - 预览次数
*/
public void setPreviewNum(Integer previewNum) {
this.previewNum = previewNum;
}
/**
* get the downloadNum - 下载次数.
* @return the downloadNum
*/
public Integer getDownloadNum() {
return this.downloadNum;
}
/**
* set the downloadNum - 下载次数.
*
* @param downloadNum - 下载次数
*/
public void setDownloadNum(Integer downloadNum) {
this.downloadNum = downloadNum;
}
/**
* get the value from Map.
*
* @param map - source data map
......@@ -552,6 +644,7 @@ public class HGWD001 extends DaoEPBase {
setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_NAME)), companyName));
setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode));
setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName));
setFileId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FILE_ID)), fileId));
setFileType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FILE_TYPE)), fileType));
setFileName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FILE_NAME)), fileName));
setDocId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DOC_ID)), docId));
......@@ -559,6 +652,9 @@ public class HGWD001 extends DaoEPBase {
setDocVersion(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DOC_VERSION)), docVersion));
setStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_STATUS)), status));
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARK)), remark));
setReleaseDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_RELEASE_DATE)), releaseDate));
setPreviewNum(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_PREVIEW_NUM)), previewNum));
setDownloadNum(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DOWNLOAD_NUM)), downloadNum));
}
/**
......@@ -582,6 +678,7 @@ public class HGWD001 extends DaoEPBase {
map.put(FIELD_COMPANY_NAME, StringUtils.toString(companyName, eiMetadata.getMeta(FIELD_COMPANY_NAME)));
map.put(FIELD_PROJ_CODE, StringUtils.toString(projCode, eiMetadata.getMeta(FIELD_PROJ_CODE)));
map.put(FIELD_PROJ_NAME, StringUtils.toString(projName, eiMetadata.getMeta(FIELD_PROJ_NAME)));
map.put(FIELD_FILE_ID, StringUtils.toString(fileId, eiMetadata.getMeta(FIELD_FILE_ID)));
map.put(FIELD_FILE_TYPE, StringUtils.toString(fileType, eiMetadata.getMeta(FIELD_FILE_TYPE)));
map.put(FIELD_FILE_NAME, StringUtils.toString(fileName, eiMetadata.getMeta(FIELD_FILE_NAME)));
map.put(FIELD_DOC_ID, StringUtils.toString(docId, eiMetadata.getMeta(FIELD_DOC_ID)));
......@@ -589,6 +686,9 @@ public class HGWD001 extends DaoEPBase {
map.put(FIELD_DOC_VERSION, StringUtils.toString(docVersion, eiMetadata.getMeta(FIELD_DOC_VERSION)));
map.put(FIELD_STATUS, StringUtils.toString(status, eiMetadata.getMeta(FIELD_STATUS)));
map.put(FIELD_REMARK, StringUtils.toString(remark, eiMetadata.getMeta(FIELD_REMARK)));
map.put(FIELD_RELEASE_DATE, StringUtils.toString(releaseDate, eiMetadata.getMeta(FIELD_RELEASE_DATE)));
map.put(FIELD_PREVIEW_NUM, StringUtils.toString(previewNum, eiMetadata.getMeta(FIELD_PREVIEW_NUM)));
map.put(FIELD_DOWNLOAD_NUM, StringUtils.toString(downloadNum, eiMetadata.getMeta(FIELD_DOWNLOAD_NUM)));
return map;
}
......
package com.baosight.hggp.hg.wd.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.wd.constant.HgWdConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD001B;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.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.ServiceBase;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/5/9,11:04
*/
public class ServiceHGWD001B extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "文档浏览", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
// 加载文件基础信息
this.setFileInfo(inInfo);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGWD001B().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, HGWD001.FIELD_FILE_ID);
if (StringUtils.isBlank(fileId)) {
return;
}
EiBlock block = new EiBlock(EiConstant.queryBlock);
block.addRow(HGWDTools.HgWd001.get(fileId));
block.addBlockMeta(new HGWD001().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, HGWD001B.QUERY, new HGWD001B());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 添加记录
*
* @param inInfo
* @return
*/
public EiInfo add(EiInfo inInfo) {
try {
List<HGWD001B> fWd001bs = MapUtils.toDaoEPBases(inInfo, HGWD001B.class);
for (HGWD001B fWd001b : fWd001bs) {
// 预览记录+1
HGWDTools.HgWd001.previewIncr(fWd001b.getFileId());
// 新增
DaoUtils.insert(HGWD001B.INSERT, fWd001b);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("操作成功");
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "操作失败");
}
return inInfo;
}
}
package com.baosight.hggp.hg.wd.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD001B;
import com.baosight.hggp.hg.wd.domain.HGWD001C;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.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.ServiceBase;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/5/9,11:04
*/
public class ServiceHGWD001C extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "文档浏览", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
// 加载文件基础信息
this.setFileInfo(inInfo);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGWD001C().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, HGWD001.FIELD_FILE_ID);
if (StringUtils.isBlank(fileId)) {
return;
}
EiBlock block = new EiBlock(EiConstant.queryBlock);
block.addRow(HGWDTools.HgWd001.get(fileId));
block.addBlockMeta(new HGWD001().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, HGWD001C.QUERY, new HGWD001C());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 添加记录
*
* @param inInfo
* @return
*/
public EiInfo add(EiInfo inInfo) {
try {
List<HGWD001C> fWd001cs = MapUtils.toDaoEPBases(inInfo, HGWD001C.class);
for (HGWD001C fWd001c : fWd001cs) {
// 下载记录+1
HGWDTools.HgWd001.previewIncr(fWd001c.getFileId());
// 新增
DaoUtils.insert(HGWD001C.INSERT, fWd001c);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("操作成功");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "操作失败");
}
return inInfo;
}
}
......@@ -17,13 +17,17 @@
COMPANY_NAME as "companyName", <!-- 公司名称 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
FILE_ID as "fileId", <!-- 文件ID -->
FILE_TYPE as "fileType", <!-- 文件类型 -->
FILE_NAME as "fileName", <!-- 文件名称 -->
DOC_ID as "docId", <!-- 文件号 -->
DOC_NAME as "docName", <!-- 文件附件名称 -->
DOC_VERSION as "docVersion", <!-- 文件版本号 -->
STATUS as "status", <!-- 状态 -->
REMARK as "remark" <!-- 备注 -->
REMARK as "remark", <!-- 备注 -->
RELEASE_DATE as "releaseDate", <!-- 发布时间 -->
PREVIEW_NUM as "previewNum", <!-- 预览次数 -->
DOWNLOAD_NUM as "downloadNum" <!-- 下载次数 -->
</sql>
<sql id="condition">
......@@ -69,6 +73,9 @@
<isNotEmpty prepend=" AND " property="projName">
PROJ_NAME LIKE CONCAT('%', #projName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fileId">
FILE_ID = #fileId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fileType">
FILE_TYPE = #fileType#
</isNotEmpty>
......@@ -129,6 +136,7 @@
COMPANY_CODE, <!-- 公司编码 -->
COMPANY_NAME, <!-- 公司名称 -->
PROJ_CODE, <!-- 项目编码 -->
FILE_ID, <!-- 文件ID -->
PROJ_NAME, <!-- 项目名称 -->
FILE_TYPE, <!-- 文件类型 -->
FILE_NAME, <!-- 文件名称 -->
......@@ -139,7 +147,8 @@
REMARK <!-- 备注 -->
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #companyCode#, #companyName#, #projCode#, #projName#, #fileType#, #fileName#,
#deleteFlag#, #companyCode#, #companyName#, #projCode#, #projName#,
#fileId#, #fileType#, #fileName#,
#docId#, #docName#, #docVersion#, #status#, #remark#
)
</insert>
......@@ -164,4 +173,23 @@
WHERE ID = #id#
</update>
<!-- 预览自增 -->
<update id="previewIncr">
UPDATE ${hggpSchema}.HGWD001
SET
PREVIEW_NUM = PREVIEW_NUM + 1,
<include refid="SqlBase.updateRevise"/>
WHERE FILE_ID = #fileId#
</update>
<!-- 下载自增 -->
<update id="downloadIncr">
UPDATE ${hggpSchema}.HGWD001
SET
DOWNLOAD_NUM = DOWNLOAD_NUM + 1,
<include refid="SqlBase.updateRevise"/>
WHERE FILE_ID = #fileId#
</update>
</sqlMap>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGWD001B">
<sql id="column">
ID as "id",
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
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 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</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>
</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.hggp.hg.wd.domain.HGWD001B">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGWD001B
WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGWD001B
WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGWD001B (
ACCOUNT_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
DELETE_FLAG, <!-- 0-未删除,1-已删除 -->
FILE_ID <!-- 文件ID -->
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #fileId#
)
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGWD001B WHERE ID = #id#
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGWD001B
SET
UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime#, <!-- 记录修改时间 -->
FILE_ID = #fileId# <!-- 文件ID -->
WHERE ID = #id#
</update>
</sqlMap>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGWD001C">
<sql id="column">
ID as "id",
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
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 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</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>
</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.hggp.hg.wd.domain.HGWD001C">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGWD001C
WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGWD001C
WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGWD001C (
ACCOUNT_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
DELETE_FLAG, <!-- 0-未删除,1-已删除 -->
FILE_ID <!-- 文件ID -->
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #fileId#
)
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGWD001C WHERE ID = #id#
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGWD001C
SET
UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime#, <!-- 记录修改时间 -->
FILE_ID = #fileId# <!-- 文件ID -->
WHEREID = #id#
</update>
</sqlMap>
package com.baosight.hggp.hg.wd.tools;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.sb.domain.HGSB002;
import com.baosight.hggp.hg.wd.constant.HgWdSqlConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.util.AssertUtils;
import org.apache.commons.collections.CollectionUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/8/19,14:57
*/
public class HGWDTools {
/**
* @author:songx
* @date:2024/8/19,14:57
*/
public static class HgWd001 {
/**
* @param fileId
* @return
*/
public static HGWD001 get(String fileId) {
AssertUtils.isNull(fileId, "文件ID不能为空");
Map queryMap = new HashMap();
queryMap.put(HGWD001.FIELD_FILE_ID, fileId);
List<HGWD001> results = DaoBase.getInstance().query(HGWD001.QUERY, queryMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
* 预览记录自增
*
* @param fileId
*/
public static void previewIncr(String fileId) {
AssertUtils.isNull(fileId, "文件ID不能为空");
Map queryMap = new HashMap();
queryMap.put(HGWD001.FIELD_FILE_ID, fileId);
DaoUtils.update(HgWdSqlConstant.HgWd001.PREVIEW_INCR, queryMap);
}
/**
* 下载记录自增
*
* @param fileId
*/
public static void downloadIncr(String fileId) {
AssertUtils.isNull(fileId, "文件ID不能为空");
Map queryMap = new HashMap();
queryMap.put(HGWD001.FIELD_FILE_ID, fileId);
DaoUtils.update(HgWdSqlConstant.HgWd001.DOWNLOAD_INCR, queryMap);
}
}
}
......@@ -83,7 +83,9 @@
(SELECT @CODES:=GROUP_CONCAT(ORG_ID)
FROM ${platSchema}.TXSOG01
WHERE FIND_IN_SET(PARENT_ORG_ID, @CODES)
AND ACCOUNT_CODE = #accountCode#
<isNotEqual property="accountCode" compareValue="ADMIN">
AND ACCOUNT_CODE = #accountCode#
</isNotEqual>
AND IS_DELETED = 0
) AS T1,
@LEVEL:=@LEVEL+1 AS LEVEL
......
......@@ -17,6 +17,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.file.Files;
......@@ -473,25 +474,53 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
}
/**
* 文件下载
*
* @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, HttpServletResponse response) throws IOException {
// 设置响应类型,图片和PDF直接预览
if ("jpg/jpeg/png/bmp/gif/tif/icon/ico".contains(
fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase())) {
response.setContentType("text/html; charset=UTF-8");
response.setContentType("image/jpeg");
} else {
response.setContentType("application/octet-stream;charset=UTF-8");
response.setHeader("Content-Disposition", "attachment;filename="
+ URLEncoder.encode(fileName, "UTF-8"));
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;
}
try (InputStream is = downloadStreamFromUrl(url);
OutputStream outputStream = new BufferedOutputStream(response.getOutputStream())) {
}
/**
* 下载文件
*
* @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);
......@@ -506,4 +535,37 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
}
}
/**
* 设置返回头
*
* @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 {
response.setContentType("application/octet-stream;charset=UTF-8");
response.setHeader("Content-Disposition", "attachment;filename="
+ URLEncoder.encode(fileName, "UTF-8"));
}
}
}
......@@ -64,6 +64,7 @@ public class ServiceXS0102 extends ServiceEPBase implements LoginConstants {
String mobile = (String) inInfoRowMap.get("mobile");
String email = (String) inInfoRowMap.get("email");
String idCard = (String) inInfoRowMap.get("idCard");
String accountCode = (String) inInfoRowMap.get("accountCode");
if ("on".equals(StringUtils.defaultIfEmpty(
PlatApplicationContext.getProperty("xservices.security.cryptoPasswordEnable"), "on"))) {
password = LoginRsaKeyUtil.decrypt(password);
......@@ -81,7 +82,10 @@ public class ServiceXS0102 extends ServiceEPBase implements LoginConstants {
inInfo.setMsg("注册失败!登录账号,用户姓名,密码,确认密码,手机及身份证信息都必须填写");
return inInfo;
}
AssertUtils.isTrue(!HGSCUtil.isValidChineseID(idCard), "请填写正确的身份证号!");
// 企业账号无需校验身份证 added by songx at 20240819
if (loginName.lastIndexOf("0000") < 0) {
AssertUtils.isTrue(!HGSCUtil.isValidChineseID(idCard), "请填写正确的身份证号!");
}
if (!rePass.equals(password)) {
inInfo.setStatus(-1);
inInfo.setMsg("注册失败!两次输入的密码不一致");
......
......@@ -19,7 +19,8 @@
}
</script>
<script type="text/javascript">
let projectEnv = "${projectEnv}";
let PROJECT_ENV = "${PROJECT_ENV}";
let FILE_LOCATION = "${FILE_LOCATION}";
</script>
<script src="${ctx}/common/js/common.js"></script>
<script src="${ctx}/common/js/jsUtils.js"></script>
......
$(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);
}
<!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"/>
<div class="row">
<EF:EFInput cname="公司名称" ename="projName" blockId="inqu_status" row="0" colWidth="3" readonly="true"/>
<EF:EFInput cname="项目名称" ename="projName" blockId="inqu_status" row="0" colWidth="3" readonly="true"/>
<EF:EFInput cname="文件名称" ename="fileName" blockId="inqu_status" row="0" colWidth="3" readonly="true"/>
<EF:EFSelect cname="文件类型" ename="fileType" blockId="inqu_status" row="0" colWidth="3" optionLabel=""
defultValue="" readonly="true">
<EF:EFCodeOption codeName="hggp.hgwd.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="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);
}
<!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"/>
<div class="row">
<EF:EFInput cname="公司名称" ename="projName" blockId="inqu_status" row="0" colWidth="3" readonly="true"/>
<EF:EFInput cname="项目名称" ename="projName" blockId="inqu_status" row="0" colWidth="3" readonly="true"/>
<EF:EFInput cname="文件名称" ename="fileName" blockId="inqu_status" row="0" colWidth="3" readonly="true"/>
<EF:EFSelect cname="文件类型" ename="fileType" blockId="inqu_status" row="0" colWidth="3" optionLabel=""
defultValue="" readonly="true">
<EF:EFCodeOption codeName="hggp.hgwd.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="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>
......@@ -13,11 +13,16 @@ $(function () {
template: function (model) {
let template = '';
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showQueryRecord(' + model.id + ')" >查询记录</a>';
+ 'onclick="showQueryRecord(\'' + model.fileId + '\')" >预览记录</a>';
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showExportRecord(' + model.id + ')" >导出记录</a>';
+ 'onclick="showDownloadRecord(\'' + model.fileId + '\')" >下载记录</a>';
return template;
}
}, {
field: "docVersion",
template: function (model) {
return "V" + model.docVersion;
}
}],
loadComplete: function (grid) {
}
......@@ -27,8 +32,11 @@ $(function () {
// 查询
$("#QUERY").on("click", query);
// 选择收货
$("#SELECT_RECEIVE").on("click", selectReceive);
// 预览
$("#PREVIEW").on("click", preview);
// 下载
$("#DOWNLOAD").on("click", download);
});
......@@ -52,115 +60,75 @@ let query = function () {
/**
* 显示查询记录
*/
let showQueryRecord = function (id) {
let showQueryRecord = function (fileId) {
JSColorbox.open({
href: "HGWD001B?inqu_status-0-fileId=" + fileId,
title: "<div style='text-align: center;'>预览记录</div>",
width: "80%",
height: "80%",
});
}
/**
* 显示导出记录
* 显示下载记录
*/
let showExportRecord = function (id) {
let showDownloadRecord = function (fileId) {
JSColorbox.open({
href: "HGWD001C?inqu_status-0-fileId=" + fileId,
title: "<div style='text-align: center;'>下载记录</div>",
width: "80%",
height: "80%",
});
}
/**
* 保存
* 预览
*/
let save = function () {
let preview = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
for (let i = 0; i < rows.length; i++) {
if (isBlank(rows[i]['whCode'])) {
message("勾选的第" + (i + 1) + "行仓库不能为空");
return;
}
if (rows[i]["submitStatus"] == 1) {
message("第" + (i + 1) + "行数据已提交,不能保存");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"预览\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGKC001", "save", true);
JSUtils.submitGridsData("result", "HGWD001B", "add", false,
function (res) {
if (res.status > -1) {
for (let i = 0; i < rows.length; i++) {
window.open(downloadHref(rows[i]['docId'], true), '_blank');
}
} else {
message(res.msg);
}
}
);
}
});
}
/**
* 删除
* 下载
*/
let remove = function () {
let download = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"下载\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGKC001", "remove", true);
}
});
}
/**
* 选择
*/
let selectReceive = function () {
JSColorbox.open({
href: "HGKC001A?methodName=initLoad",
title: "<div style='text-align: center;'>收货查询</div>",
width: "80%",
height: "80%",
callbackName: selectReceiveCallback
});
}
/**
* 选择回调
*/
let selectReceiveCallback = function () {
// 刷新页面
query();
// 关闭弹窗
JSColorbox.close();
}
/**
* 提交
* @param id
* @param status
*/
function updateSubmitStatus(id) {
let inEiInfo = new EiInfo();
inEiInfo.set("result-0-id", id);
JSUtils.confirm("确定提交此采购入库单吗? ", {
ok: function () {
EiCommunicator.send('HGKC001', 'updateSubmitStatus', inEiInfo, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
try {
query();
} catch (e) {
}
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else {
NotificationUtil(ei);
}
} else {
NotificationUtil(ei, "error");
JSUtils.submitGridsData("result", "HGWD001C", "add", false,
function (res) {
if (res.status > -1) {
for (let i = 0; i < rows.length; i++) {
window.open(downloadHref(rows[i]['docId']), '_blank');
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
} else {
message(res.msg);
}
}
);
}
});
}
......@@ -21,17 +21,18 @@
<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="operator" cname="操作" locked="true" width="120" enable="false" align="center"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" width="160" enable="false" align="center"/>
<EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="left"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="true" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="true" width="140" align="left"/>
<EF:EFColumn ename="fileId" cname="文件ID" enable="false" width="100" align="center"/>
<EF:EFComboColumn ename="fileType" cname="文件类型" enable="false" width="90" align="center">
<EF:EFCodeOption codeName="hggp.hgwd.fileType"/>
</EF:EFComboColumn>
<EF:EFColumn ename="fileName" cname="文件名" enable="false" width="100" align="left"/>
<EF:EFColumn ename="docVersion" cname="版本号" enable="false" width="100" align="center"/>
<EF:EFColumn ename="docId" cname="文件号" enable="false" width="100" align="center"/>
<EF:EFColumn ename="docId" cname="文件号" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="docName" cname="文件附件名称" enable="false" width="100" align="left"/>
</EF:EFGrid>
</EF:EFRegion>
......
......@@ -96,15 +96,16 @@ function message2(title,msg) {
* 文件下载路径
*
* @param docId
* @param isPreview 是否预览,true:预览
* @returns {string}
*/
function downloadHref(docId) {
// S3地址有外网
// return IPLATUI.CONTEXT_PATH + ("run" == projectEnv ? ('/docFileDownload/' + docId)
// : ('/EU/DM/EUDM06.jsp?docId=' + docId));
// S3地址无外
return IPLATUI.CONTEXT_PATH + ("run" == projectEnv ? ('/file/download/' + docId)
: ('/EU/DM/EUDM06.jsp?docId=' + docId));
function downloadHref(docId, isPreview) {
if (isPreview) {
return IPLATUI.CONTEXT_PATH + '/file/download/preview/' + docId;
} else {
// S3地址必须支持公
return IPLATUI.CONTEXT_PATH + '/file/download/' + docId;
}
}
/**
......
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