Commit 72a18a6d by liuyang

Merge branch 'dev' of http://git.pseer.com:8800/platform/hg-smart into dev-ly

 Conflicts:
	src/main/java/com/baosight/hggp/hg/wd/domain/HGWD001.java
	src/main/java/com/baosight/hggp/hg/wd/sql/HGWD001.xml
parents 0640485c 03376375
package com.baosight.hggp.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baosight.hggp.core.tools.ThreadLocalTools;
import com.baosight.hggp.core.constant.S3Constant;
import com.baosight.hggp.core.utils.Iplat4jUtils;
import com.baosight.hggp.core.utils.S3Utils;
import com.baosight.hggp.util.FileUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.StringUtils;
import com.baosight.iplat4j.config.AdminFactoryConfig;
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.soa.XServiceManager;
import com.baosight.iplat4j.eu.dm.document.bos.s3.api.signed.SignedBosHelp;
import com.baosight.iplat4j.eu.dm.document.bos.s3.param.BosParamHelp;
import com.baosight.iplat4j.eu.dm.util.IFileUploader;
import com.google.common.base.Joiner;
import org.activiti.engine.impl.util.json.JSONString;
import org.springframework.beans.factory.annotation.Autowired;
import com.baosight.iplat4j.common.eu.domain.Teudm05;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URL;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Iterator;
import java.io.File;
import java.io.IOException;
import java.util.Map;
import java.util.Set;
import lombok.extern.slf4j.Slf4j;
......@@ -44,177 +28,79 @@ import lombok.extern.slf4j.Slf4j;
@CrossOrigin
@RequestMapping({"/file/download"})
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下载文件
*
* @param docId
* @param request
* @param response
* @throws IOException
*/
@RequestMapping({"/{docId}"})
public void downloadUrl(@PathVariable String docId, HttpServletRequest request, HttpServletResponse response)
throws IOException {
response.setContentType("text/plain; charset=UTF-8");
public void download(@PathVariable String docId, HttpServletResponse response) throws IOException {
try {
EiInfo queryDocMapInfo = new EiInfo();
queryDocMapInfo.set("docId", docId);
queryDocMapInfo.set(EiConstant.serviceId, "S_EU_0102");
EiInfo returnInfo = XServiceManager.call(queryDocMapInfo);
Map docMap = returnInfo.getMap("docMap");
String s3UrlPrefix = MapUtils.getString(docMap, "url");
String fileName = MapUtils.getString(docMap, "resCname");
String returnUrlPrefix = BosParamHelp.disposeUrl(s3UrlPrefix);
Map<String, String[]> parameterMap = request.getParameterMap();
String returnUrl = this.getReturnUrlByParam(parameterMap, returnUrlPrefix);
if (StringUtils.isBlank(returnUrl)) {
String seconds = request.getHeader("seconds");
if (StringUtils.isBlank(seconds)) {
seconds = request.getParameter("seconds");
}
returnUrl = this.buildReturnUrl(seconds, fileName, returnUrlPrefix, s3UrlPrefix);
}
// 下载文件
if (StringUtils.isNotBlank(returnUrl)) {
FileUtils.downloadUrlFile(returnUrl, fileName, response);
if ("s3".equalsIgnoreCase(S3Constant.FILE_LOCATION)) {
Teudm05 dbDm05 = S3Utils.buildUrl(docId);
// S3地址有公网
response.sendRedirect(dbDm05.getUrl());
// S3地址无公网
// FileUtils.downloadUrlFile(dbDm05.getUrl(), dbDm05.getResCname(), false, response);
} else {
throw new PlatException("文件地址异常");
Map dbDm02 = Iplat4jUtils.getDoc02ById(docId);
String returnUrl = MapUtils.getString(dbDm02, "url");
String fileName = MapUtils.getString(dbDm02, "docName");
FileUtils.downloadFile(new File(returnUrl), fileName, false, response);
}
} catch (Exception e) {
String msg = String.format("下载文件【%s】失败!原因:%s", docId, LogUtils.getMsg(e));
response.getWriter().write(msg);
}
}
/**
* 下载本地文件
*
* @param docId
* @param response
* @throws IOException
*/
@RequestMapping({"docId/{docId}"})
public void downloadUrls(@PathVariable String docId, HttpServletRequest request, HttpServletResponse response) throws IOException {
String docJson = AdminFactoryConfig.getFileUpLoadInterface().getDocJSONById(docId);
Map document = (Map) JSON.parseObject(docJson, Map.class);
String docName = document.get("docName").toString();
String chgName = document.get("chgName").toString();
String docPath = document.get("realPath").toString();
String filePath = docPath + "/" + chgName;
public void downloadUrls(@PathVariable String docId, HttpServletResponse response)
throws IOException {
try {
this.httpDownload(response, filePath, docName);
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)
throws UnsupportedEncodingException {
String returnUrl2 = "";
Map<String, String> paramMap = this.getParamMap(parameterMap);
paramMap.remove("code");
paramMap.remove("access_token");
paramMap.remove("seconds");
if (!paramMap.isEmpty() && paramMap.containsKey("X-Amz-Signature")) {
String queryString = this.buildQueryString(paramMap);
returnUrl2 = returnUrl + "?" + queryString;
}
return returnUrl2;
}
private String buildReturnUrl(String seconds, String fileName, String returnUrlPrefix, String s3UrlPrefix)
throws Exception {
URL s3Url = SignedBosHelp.getDownloadTempUrl(s3UrlPrefix, fileName, seconds);
String s3UrlParam = StringUtils.defaultIfEmpty(s3Url.getQuery(), "");
String returnUrl = returnUrlPrefix + "?" + s3UrlParam;
return com.baosight.iplat4j.eu.dm.util.FileUtils.returnDocUrlByEncodeFileName(returnUrl);
}
private Map<String, String> getParamMap(Map<String, String[]> parameterMap) {
Map paramMap = new HashMap();
Set<String> parameterSet = parameterMap.keySet();
Iterator parameterIterator = parameterSet.iterator();
while (parameterIterator.hasNext()) {
String next = (String) parameterIterator.next();
String[] valueArray = (String[]) parameterMap.get(next);
if (valueArray != null && valueArray.length != 0) {
String value = Joiner.on(",").join(valueArray);
paramMap.put(next, value);
}
}
return paramMap;
}
private String buildQueryString(Map<String, String> parameterMap) throws UnsupportedEncodingException {
StringBuilder strBuilder = new StringBuilder();
String rcd = MapUtils.getString(parameterMap, "response-content-disposition");
parameterMap.remove("response-content-disposition");
String next;
for (Iterator iterator = parameterMap.keySet().iterator(); iterator.hasNext();
strBuilder.append(next).append("=").append((String) parameterMap.get(next))) {
next = (String) iterator.next();
if (strBuilder.length() > 0) {
strBuilder.append("&");
}
}
if (StringUtils.isNotBlank(rcd)) {
strBuilder.append("&").append("response-content-disposition").append("=").append(
URLEncoder.encode(rcd, "UTF-8"));
}
return strBuilder.toString();
}
private void httpDownload(HttpServletResponse response, String filePath, String downloadFileName) throws Exception {
File file = new File(filePath);
FileInputStream fileInputStream = new FileInputStream(file);
Throwable var6 = null;
try {
OutputStream outputStream = response.getOutputStream();
Throwable var8 = null;
try {
downloadFileName = URLEncoder.encode(downloadFileName, "UTF-8");
downloadFileName = downloadFileName.replaceAll("\\+", "%20");
response.reset();
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename*=utf-8''" + downloadFileName);
byte[] buffer = new byte[1024];
int i;
while((i = fileInputStream.read(buffer)) > 0) {
outputStream.write(buffer, 0, i);
}
} catch (Throwable var32) {
var8 = var32;
throw var32;
} finally {
if (outputStream != null) {
if (var8 != null) {
try {
outputStream.close();
} catch (Throwable var31) {
var8.addSuppressed(var31);
}
} else {
outputStream.close();
}
}
}
} catch (Throwable var34) {
var6 = var34;
throw var34;
} finally {
if (fileInputStream != null) {
if (var6 != null) {
try {
fileInputStream.close();
} catch (Throwable var30) {
var6.addSuppressed(var30);
}
} else {
fileInputStream.close();
}
}
}
}
}
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,7 +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 = " "; /*文件ID*/
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"; /* 文件号*/
......@@ -44,6 +44,8 @@ public class HGWD001 extends DaoEPBase {
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"; /* 企业编码*/
......@@ -59,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"; /* 文件号*/
......@@ -66,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";
......@@ -88,7 +94,7 @@ public class HGWD001 extends DaoEPBase {
private String companyName = " "; /* 公司名称*/
private String projCode = " "; /* 项目编码*/
private String projName = " "; /* 项目名称*/
private String fileId = " ";
private String fileId = " "; /* 文件ID*/
private String fileType = " "; /* 文件类型*/
private String fileName = " "; /* 文件名称*/
private String docId = " "; /* 文件号*/
......@@ -96,7 +102,9 @@ public class HGWD001 extends DaoEPBase {
private Integer docVersion = new Integer(0); /* 文件版本号*/
private Integer status; /* 状态*/
private String remark = " "; /* 备注*/
private String releaseDate = " ";
private String releaseDate = " "; /* 发布时间*/
private Integer previewNum = new Integer(0); /* 预览次数*/
private Integer downloadNum = new Integer(0); /* 下载次数*/
/**
* initialize the metadata.
......@@ -197,6 +205,14 @@ public class HGWD001 extends DaoEPBase {
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);
}
......@@ -431,15 +447,22 @@ public class HGWD001 extends DaoEPBase {
public void setProjName(String projName) {
this.projName = projName;
}
/**
* get the fileId - 文件ID.
* @return the fileId
*/
public String getFileId() {
return fileId;
return this.fileId;
}
/**
* set the fileId - 文件ID.
*
* @param fileId - 文件ID
*/
public void setFileId(String fileId) {
this.fileId = fileId;
}
/**
* get the fileType - 文件类型.
* @return the fileType
......@@ -552,16 +575,55 @@ public class HGWD001 extends DaoEPBase {
public void setRemark(String remark) {
this.remark = remark;
}
/**
* get the releaseDate - 发布时间.
* @return the releaseDate
*/
public String getReleaseDate() {
return releaseDate;
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
......@@ -592,6 +654,8 @@ public class HGWD001 extends DaoEPBase {
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));
}
/**
......@@ -624,6 +688,8 @@ public class HGWD001 extends DaoEPBase {
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.domain;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.data.DaoEPBase;
import java.util.HashMap;
import java.util.Map;
import com.baosight.iplat4j.core.util.StringUtils;
/**
* Project: <br>
* Title:Hgwd001b.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-08-19 14:31:56 create
*/
public class HGWD001B extends DaoEPBase {
private static final long serialVersionUID = 1L;
public static final String FIELD_ID = "id";
public static final String FIELD_ACCOUNT_CODE = "accountCode"; /* 企业编码*/
public static final String FIELD_DEP_CODE = "depCode"; /* 部门编码*/
public static final String FIELD_CREATED_BY = "createdBy"; /* 记录创建者*/
public static final String FIELD_CREATED_NAME = "createdName"; /* 记录创建名称*/
public static final String FIELD_CREATED_TIME = "createdTime"; /* 记录创建时间*/
public static final String FIELD_UPDATED_BY = "updatedBy"; /* 记录修改者*/
public static final String FIELD_UPDATED_NAME = "updatedName"; /* 记录修改名称*/
public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 记录修改时间*/
public static final String FIELD_DELETE_FLAG = "deleteFlag"; /* 0-未删除,1-已删除*/
public static final String FIELD_FILE_ID = "fileId"; /* 文件ID*/
public static final String COL_ID = "ID";
public static final String COL_ACCOUNT_CODE = "ACCOUNT_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_NAME = "CREATED_NAME"; /* 记录创建名称*/
public static final String COL_CREATED_TIME = "CREATED_TIME"; /* 记录创建时间*/
public static final String COL_UPDATED_BY = "UPDATED_BY"; /* 记录修改者*/
public static final String COL_UPDATED_NAME = "UPDATED_NAME"; /* 记录修改名称*/
public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 记录修改时间*/
public static final String COL_DELETE_FLAG = "DELETE_FLAG"; /* 0-未删除,1-已删除*/
public static final String COL_FILE_ID = "FILE_ID"; /* 文件ID*/
public static final String QUERY = "HGWD001B.query";
public static final String COUNT = "HGWD001B.count";
public static final String INSERT = "HGWD001B.insert";
public static final String UPDATE = "HGWD001B.update";
public static final String DELETE = "HGWD001B.delete";
private Long id = new Long(0);
private String accountCode = " "; /* 企业编码*/
private String depCode = " "; /* 部门编码*/
private String createdBy = " "; /* 记录创建者*/
private String createdName = " "; /* 记录创建名称*/
private String createdTime = " "; /* 记录创建时间*/
private String updatedBy = " "; /* 记录修改者*/
private String updatedName = " "; /* 记录修改名称*/
private String updatedTime = " "; /* 记录修改时间*/
private Integer deleteFlag; /* 0-未删除,1-已删除*/
private String fileId = " "; /* 文件ID*/
/**
* initialize the metadata.
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_ID);
eiColumn.setPrimaryKey(true);
eiColumn.setDescName(" ");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ACCOUNT_CODE);
eiColumn.setDescName("企业编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DEP_CODE);
eiColumn.setDescName("部门编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_BY);
eiColumn.setDescName("记录创建者");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_NAME);
eiColumn.setDescName("记录创建名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_TIME);
eiColumn.setDescName("记录创建时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_BY);
eiColumn.setDescName("记录修改者");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_NAME);
eiColumn.setDescName("记录修改名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_TIME);
eiColumn.setDescName("记录修改时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DELETE_FLAG);
eiColumn.setDescName("0-未删除,1-已删除");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_FILE_ID);
eiColumn.setDescName("文件ID");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HGWD001B() {
initMetaData();
}
/**
* get the id .
* @return the id
*/
public Long getId() {
return this.id;
}
/**
* set the id .
*
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* get the accountCode - 企业编码.
* @return the accountCode
*/
public String getAccountCode() {
return this.accountCode;
}
/**
* set the accountCode - 企业编码.
*
* @param accountCode - 企业编码
*/
public void setAccountCode(String accountCode) {
this.accountCode = accountCode;
}
/**
* get the depCode - 部门编码.
* @return the depCode
*/
public String getDepCode() {
return this.depCode;
}
/**
* set the depCode - 部门编码.
*
* @param depCode - 部门编码
*/
public void setDepCode(String depCode) {
this.depCode = depCode;
}
/**
* get the createdBy - 记录创建者.
* @return the createdBy
*/
public String getCreatedBy() {
return this.createdBy;
}
/**
* set the createdBy - 记录创建者.
*
* @param createdBy - 记录创建者
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
/**
* get the createdName - 记录创建名称.
* @return the createdName
*/
public String getCreatedName() {
return this.createdName;
}
/**
* set the createdName - 记录创建名称.
*
* @param createdName - 记录创建名称
*/
public void setCreatedName(String createdName) {
this.createdName = createdName;
}
/**
* get the createdTime - 记录创建时间.
* @return the createdTime
*/
public String getCreatedTime() {
return this.createdTime;
}
/**
* set the createdTime - 记录创建时间.
*
* @param createdTime - 记录创建时间
*/
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
/**
* get the updatedBy - 记录修改者.
* @return the updatedBy
*/
public String getUpdatedBy() {
return this.updatedBy;
}
/**
* set the updatedBy - 记录修改者.
*
* @param updatedBy - 记录修改者
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
/**
* get the updatedName - 记录修改名称.
* @return the updatedName
*/
public String getUpdatedName() {
return this.updatedName;
}
/**
* set the updatedName - 记录修改名称.
*
* @param updatedName - 记录修改名称
*/
public void setUpdatedName(String updatedName) {
this.updatedName = updatedName;
}
/**
* get the updatedTime - 记录修改时间.
* @return the updatedTime
*/
public String getUpdatedTime() {
return this.updatedTime;
}
/**
* set the updatedTime - 记录修改时间.
*
* @param updatedTime - 记录修改时间
*/
public void setUpdatedTime(String updatedTime) {
this.updatedTime = updatedTime;
}
/**
* get the deleteFlag - 0-未删除,1-已删除.
* @return the deleteFlag
*/
public Integer getDeleteFlag() {
return this.deleteFlag;
}
/**
* set the deleteFlag - 0-未删除,1-已删除.
*
* @param deleteFlag - 0-未删除,1-已删除
*/
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
/**
* 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 value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
setId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_ID)), id));
setAccountCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ACCOUNT_CODE)), accountCode));
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_CODE)), depCode));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy));
setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName));
setCreatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_TIME)), createdTime));
setUpdatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_BY)), updatedBy));
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
setDeleteFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DELETE_FLAG)), deleteFlag));
setFileId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FILE_ID)), fileId));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = new HashMap();
map.put(FIELD_ID, StringUtils.toString(id, eiMetadata.getMeta(FIELD_ID)));
map.put(FIELD_ACCOUNT_CODE, StringUtils.toString(accountCode, eiMetadata.getMeta(FIELD_ACCOUNT_CODE)));
map.put(FIELD_DEP_CODE, StringUtils.toString(depCode, eiMetadata.getMeta(FIELD_DEP_CODE)));
map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY)));
map.put(FIELD_CREATED_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME)));
map.put(FIELD_CREATED_TIME, StringUtils.toString(createdTime, eiMetadata.getMeta(FIELD_CREATED_TIME)));
map.put(FIELD_UPDATED_BY, StringUtils.toString(updatedBy, eiMetadata.getMeta(FIELD_UPDATED_BY)));
map.put(FIELD_UPDATED_NAME, StringUtils.toString(updatedName, eiMetadata.getMeta(FIELD_UPDATED_NAME)));
map.put(FIELD_UPDATED_TIME, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_UPDATED_TIME)));
map.put(FIELD_DELETE_FLAG, StringUtils.toString(deleteFlag, eiMetadata.getMeta(FIELD_DELETE_FLAG)));
map.put(FIELD_FILE_ID, StringUtils.toString(fileId, eiMetadata.getMeta(FIELD_FILE_ID)));
return map;
}
}
package com.baosight.hggp.hg.wd.domain;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.data.DaoEPBase;
import java.util.HashMap;
import java.util.Map;
import com.baosight.iplat4j.core.util.StringUtils;
/**
* Project: <br>
* Title:Hgwd001c.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-08-19 14:31:58 create
*/
public class HGWD001C extends DaoEPBase {
private static final long serialVersionUID = 1L;
public static final String FIELD_ID = "id";
public static final String FIELD_ACCOUNT_CODE = "accountCode"; /* 企业编码*/
public static final String FIELD_DEP_CODE = "depCode"; /* 部门编码*/
public static final String FIELD_CREATED_BY = "createdBy"; /* 记录创建者*/
public static final String FIELD_CREATED_NAME = "createdName"; /* 记录创建名称*/
public static final String FIELD_CREATED_TIME = "createdTime"; /* 记录创建时间*/
public static final String FIELD_UPDATED_BY = "updatedBy"; /* 记录修改者*/
public static final String FIELD_UPDATED_NAME = "updatedName"; /* 记录修改名称*/
public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 记录修改时间*/
public static final String FIELD_DELETE_FLAG = "deleteFlag"; /* 0-未删除,1-已删除*/
public static final String FIELD_FILE_ID = "fileId"; /* 文件ID*/
public static final String COL_ID = "ID";
public static final String COL_ACCOUNT_CODE = "ACCOUNT_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_NAME = "CREATED_NAME"; /* 记录创建名称*/
public static final String COL_CREATED_TIME = "CREATED_TIME"; /* 记录创建时间*/
public static final String COL_UPDATED_BY = "UPDATED_BY"; /* 记录修改者*/
public static final String COL_UPDATED_NAME = "UPDATED_NAME"; /* 记录修改名称*/
public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 记录修改时间*/
public static final String COL_DELETE_FLAG = "DELETE_FLAG"; /* 0-未删除,1-已删除*/
public static final String COL_FILE_ID = "FILE_ID"; /* 文件ID*/
public static final String QUERY = "HGWD001C.query";
public static final String COUNT = "HGWD001C.count";
public static final String INSERT = "HGWD001C.insert";
public static final String UPDATE = "HGWD001C.update";
public static final String DELETE = "HGWD001C.delete";
private Long id = new Long(0);
private String accountCode = " "; /* 企业编码*/
private String depCode = " "; /* 部门编码*/
private String createdBy = " "; /* 记录创建者*/
private String createdName = " "; /* 记录创建名称*/
private String createdTime = " "; /* 记录创建时间*/
private String updatedBy = " "; /* 记录修改者*/
private String updatedName = " "; /* 记录修改名称*/
private String updatedTime = " "; /* 记录修改时间*/
private Integer deleteFlag; /* 0-未删除,1-已删除*/
private String fileId = " "; /* 文件ID*/
/**
* initialize the metadata.
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_ID);
eiColumn.setPrimaryKey(true);
eiColumn.setDescName(" ");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ACCOUNT_CODE);
eiColumn.setDescName("企业编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DEP_CODE);
eiColumn.setDescName("部门编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_BY);
eiColumn.setDescName("记录创建者");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_NAME);
eiColumn.setDescName("记录创建名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_TIME);
eiColumn.setDescName("记录创建时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_BY);
eiColumn.setDescName("记录修改者");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_NAME);
eiColumn.setDescName("记录修改名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_TIME);
eiColumn.setDescName("记录修改时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DELETE_FLAG);
eiColumn.setDescName("0-未删除,1-已删除");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_FILE_ID);
eiColumn.setDescName("文件ID");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HGWD001C() {
initMetaData();
}
/**
* get the id .
* @return the id
*/
public Long getId() {
return this.id;
}
/**
* set the id .
*
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* get the accountCode - 企业编码.
* @return the accountCode
*/
public String getAccountCode() {
return this.accountCode;
}
/**
* set the accountCode - 企业编码.
*
* @param accountCode - 企业编码
*/
public void setAccountCode(String accountCode) {
this.accountCode = accountCode;
}
/**
* get the depCode - 部门编码.
* @return the depCode
*/
public String getDepCode() {
return this.depCode;
}
/**
* set the depCode - 部门编码.
*
* @param depCode - 部门编码
*/
public void setDepCode(String depCode) {
this.depCode = depCode;
}
/**
* get the createdBy - 记录创建者.
* @return the createdBy
*/
public String getCreatedBy() {
return this.createdBy;
}
/**
* set the createdBy - 记录创建者.
*
* @param createdBy - 记录创建者
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
/**
* get the createdName - 记录创建名称.
* @return the createdName
*/
public String getCreatedName() {
return this.createdName;
}
/**
* set the createdName - 记录创建名称.
*
* @param createdName - 记录创建名称
*/
public void setCreatedName(String createdName) {
this.createdName = createdName;
}
/**
* get the createdTime - 记录创建时间.
* @return the createdTime
*/
public String getCreatedTime() {
return this.createdTime;
}
/**
* set the createdTime - 记录创建时间.
*
* @param createdTime - 记录创建时间
*/
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
/**
* get the updatedBy - 记录修改者.
* @return the updatedBy
*/
public String getUpdatedBy() {
return this.updatedBy;
}
/**
* set the updatedBy - 记录修改者.
*
* @param updatedBy - 记录修改者
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
/**
* get the updatedName - 记录修改名称.
* @return the updatedName
*/
public String getUpdatedName() {
return this.updatedName;
}
/**
* set the updatedName - 记录修改名称.
*
* @param updatedName - 记录修改名称
*/
public void setUpdatedName(String updatedName) {
this.updatedName = updatedName;
}
/**
* get the updatedTime - 记录修改时间.
* @return the updatedTime
*/
public String getUpdatedTime() {
return this.updatedTime;
}
/**
* set the updatedTime - 记录修改时间.
*
* @param updatedTime - 记录修改时间
*/
public void setUpdatedTime(String updatedTime) {
this.updatedTime = updatedTime;
}
/**
* get the deleteFlag - 0-未删除,1-已删除.
* @return the deleteFlag
*/
public Integer getDeleteFlag() {
return this.deleteFlag;
}
/**
* set the deleteFlag - 0-未删除,1-已删除.
*
* @param deleteFlag - 0-未删除,1-已删除
*/
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
/**
* 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 value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
setId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_ID)), id));
setAccountCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ACCOUNT_CODE)), accountCode));
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_CODE)), depCode));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy));
setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName));
setCreatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_TIME)), createdTime));
setUpdatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_BY)), updatedBy));
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
setDeleteFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DELETE_FLAG)), deleteFlag));
setFileId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FILE_ID)), fileId));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = new HashMap();
map.put(FIELD_ID, StringUtils.toString(id, eiMetadata.getMeta(FIELD_ID)));
map.put(FIELD_ACCOUNT_CODE, StringUtils.toString(accountCode, eiMetadata.getMeta(FIELD_ACCOUNT_CODE)));
map.put(FIELD_DEP_CODE, StringUtils.toString(depCode, eiMetadata.getMeta(FIELD_DEP_CODE)));
map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY)));
map.put(FIELD_CREATED_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME)));
map.put(FIELD_CREATED_TIME, StringUtils.toString(createdTime, eiMetadata.getMeta(FIELD_CREATED_TIME)));
map.put(FIELD_UPDATED_BY, StringUtils.toString(updatedBy, eiMetadata.getMeta(FIELD_UPDATED_BY)));
map.put(FIELD_UPDATED_NAME, StringUtils.toString(updatedName, eiMetadata.getMeta(FIELD_UPDATED_NAME)));
map.put(FIELD_UPDATED_TIME, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_UPDATED_TIME)));
map.put(FIELD_DELETE_FLAG, StringUtils.toString(deleteFlag, eiMetadata.getMeta(FIELD_DELETE_FLAG)));
map.put(FIELD_FILE_ID, StringUtils.toString(fileId, eiMetadata.getMeta(FIELD_FILE_ID)));
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,7 +17,7 @@
COMPANY_NAME as "companyName", <!-- 公司名称 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
FILE_ID as "fileId",
FILE_ID as "fileId", <!-- 文件ID -->
FILE_TYPE as "fileType", <!-- 文件类型 -->
FILE_NAME as "fileName", <!-- 文件名称 -->
DOC_ID as "docId", <!-- 文件号 -->
......@@ -25,7 +25,9 @@
DOC_VERSION as "docVersion", <!-- 文件版本号 -->
STATUS as "status", <!-- 状态 -->
REMARK as "remark", <!-- 备注 -->
RELEASE_DATE as "releaseDate"
RELEASE_DATE as "releaseDate", <!-- 发布时间 -->
PREVIEW_NUM as "previewNum", <!-- 预览次数 -->
DOWNLOAD_NUM as "downloadNum" <!-- 下载次数 -->
</sql>
<sql id="condition">
......@@ -72,8 +74,8 @@
PROJ_NAME LIKE CONCAT('%', #projName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fileId">
FILE_ID = #fileId#
</isNotEmpty>
FILE_ID = #fileId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fileType">
FILE_TYPE = #fileType#
</isNotEmpty>
......@@ -137,8 +139,8 @@
COMPANY_CODE, <!-- 公司编码 -->
COMPANY_NAME, <!-- 公司名称 -->
PROJ_CODE, <!-- 项目编码 -->
FILE_ID, <!-- 文件ID -->
PROJ_NAME, <!-- 项目名称 -->
FILE_ID, <!-- 文件ID -->,
FILE_TYPE, <!-- 文件类型 -->
FILE_NAME, <!-- 文件名称 -->
DOC_ID, <!-- 文件号 -->
......@@ -149,7 +151,8 @@
RELEASE_DATE
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #companyCode#, #companyName#, #projCode#, #projName#, #fileId#, #fileType#, #fileName#,
#deleteFlag#, #companyCode#, #companyName#, #projCode#, #projName#,
#fileId#, #fileType#, #fileName#,
#docId#, #docName#, #docVersion#, #status#, #remark#, #releaseDate#
)
</insert>
......@@ -184,4 +187,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>
......
......@@ -140,13 +140,6 @@ $(window).load(function () {
$(".k-grid-cancel-changes").hide();
$(".k-grid-delete").hide();
}else {
//合同选择的存货不让新增、删除
var source = $("#source").val();
if(source === '0'){
$(".k-grid-save-changes").hide();
$(".k-grid-delete").hide();
}
}
//合同选择的存货不让新增、删除
var source = $("#source").val();
......
$(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