Commit c04d3f93 by liuyang

2024-03-26 企业log管理添加企业名称

parent ab35b494
...@@ -24,6 +24,7 @@ public class HPXS003 extends DaoEPBase { ...@@ -24,6 +24,7 @@ public class HPXS003 extends DaoEPBase {
public static final String FIELD_ID = "id"; /* ID*/ public static final String FIELD_ID = "id"; /* ID*/
public static final String FIELD_COMPANY_CODE = "companyCode"; /* 企业编码 预留*/ public static final String FIELD_COMPANY_CODE = "companyCode"; /* 企业编码 预留*/
public static final String FIELD_COMPANY_NAME = "companyName"; /* 企业编码 预留*/
public static final String FIELD_DEP_CODE = "depCode"; /* 部门编码 预留*/ public static final String FIELD_DEP_CODE = "depCode"; /* 部门编码 预留*/
public static final String FIELD_DOC_ID = "docId"; /* 文件标识*/ public static final String FIELD_DOC_ID = "docId"; /* 文件标识*/
public static final String FIELD_DIR_ID = "dirId"; /* 目录标识*/ public static final String FIELD_DIR_ID = "dirId"; /* 目录标识*/
...@@ -42,6 +43,7 @@ public class HPXS003 extends DaoEPBase { ...@@ -42,6 +43,7 @@ public class HPXS003 extends DaoEPBase {
public static final String COL_ID = "ID"; /* ID*/ public static final String COL_ID = "ID"; /* ID*/
public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码 预留*/ public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码 预留*/
public static final String COL_COMPANY_NAME = "COMPANY_NAME"; /* 企业编码 预留*/
public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码 预留*/ public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码 预留*/
public static final String COL_DOC_ID = "DOC_ID"; /* 文件标识*/ public static final String COL_DOC_ID = "DOC_ID"; /* 文件标识*/
public static final String COL_DIR_ID = "DIR_ID"; /* 目录标识*/ public static final String COL_DIR_ID = "DIR_ID"; /* 目录标识*/
...@@ -67,6 +69,7 @@ public class HPXS003 extends DaoEPBase { ...@@ -67,6 +69,7 @@ public class HPXS003 extends DaoEPBase {
private Long id = new Long(0); /* ID*/ private Long id = new Long(0); /* ID*/
private String companyCode = " "; /* 企业编码 预留*/ private String companyCode = " "; /* 企业编码 预留*/
private String companyName = " "; /* 企业编码 预留*/
private String depCode = " "; /* 部门编码 预留*/ private String depCode = " "; /* 部门编码 预留*/
private String docId = " "; /* 文件标识*/ private String docId = " "; /* 文件标识*/
private String dirId = " "; /* 目录标识*/ private String dirId = " "; /* 目录标识*/
...@@ -98,6 +101,10 @@ public class HPXS003 extends DaoEPBase { ...@@ -98,6 +101,10 @@ public class HPXS003 extends DaoEPBase {
eiColumn.setDescName("企业编码 预留"); eiColumn.setDescName("企业编码 预留");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_COMPANY_NAME);
eiColumn.setDescName("企业名称 预留");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DEP_CODE); eiColumn = new EiColumn(FIELD_DEP_CODE);
eiColumn.setDescName("部门编码 预留"); eiColumn.setDescName("部门编码 预留");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -203,6 +210,15 @@ public class HPXS003 extends DaoEPBase { ...@@ -203,6 +210,15 @@ public class HPXS003 extends DaoEPBase {
public void setCompanyCode(String companyCode) { public void setCompanyCode(String companyCode) {
this.companyCode = companyCode; this.companyCode = companyCode;
} }
public String getCompanyName() {
return companyName;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
/** /**
* get the depCode - 部门编码 预留. * get the depCode - 部门编码 预留.
* @return the depCode * @return the depCode
...@@ -446,6 +462,7 @@ public class HPXS003 extends DaoEPBase { ...@@ -446,6 +462,7 @@ public class HPXS003 extends DaoEPBase {
setId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_ID)), id)); setId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_ID)), id));
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_CODE)), companyCode)); setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_CODE)), companyCode));
setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_NAME)), companyName));
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_CODE)), depCode)); setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_CODE)), depCode));
setDocId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DOC_ID)), docId)); setDocId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DOC_ID)), docId));
setDirId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DIR_ID)), dirId)); setDirId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DIR_ID)), dirId));
...@@ -472,6 +489,7 @@ public class HPXS003 extends DaoEPBase { ...@@ -472,6 +489,7 @@ public class HPXS003 extends DaoEPBase {
Map map = new HashMap(); Map map = new HashMap();
map.put(FIELD_ID, StringUtils.toString(id, eiMetadata.getMeta(FIELD_ID))); map.put(FIELD_ID, StringUtils.toString(id, eiMetadata.getMeta(FIELD_ID)));
map.put(FIELD_COMPANY_CODE, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_COMPANY_CODE))); map.put(FIELD_COMPANY_CODE, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_COMPANY_CODE)));
map.put(FIELD_COMPANY_NAME, StringUtils.toString(companyName, eiMetadata.getMeta(FIELD_COMPANY_NAME)));
map.put(FIELD_DEP_CODE, StringUtils.toString(depCode, eiMetadata.getMeta(FIELD_DEP_CODE))); map.put(FIELD_DEP_CODE, StringUtils.toString(depCode, eiMetadata.getMeta(FIELD_DEP_CODE)));
map.put(FIELD_DOC_ID, StringUtils.toString(docId, eiMetadata.getMeta(FIELD_DOC_ID))); map.put(FIELD_DOC_ID, StringUtils.toString(docId, eiMetadata.getMeta(FIELD_DOC_ID)));
map.put(FIELD_DIR_ID, StringUtils.toString(dirId, eiMetadata.getMeta(FIELD_DIR_ID))); map.put(FIELD_DIR_ID, StringUtils.toString(dirId, eiMetadata.getMeta(FIELD_DIR_ID)));
......
...@@ -21,6 +21,7 @@ import com.baosight.iplat4j.core.resource.I18nMessages; ...@@ -21,6 +21,7 @@ import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase; import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.core.service.soa.XServiceManager; import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.core.util.StringUtils; import com.baosight.iplat4j.core.util.StringUtils;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -39,8 +40,6 @@ import java.util.Map; ...@@ -39,8 +40,6 @@ import java.util.Map;
*/ */
public class ServiceHPXS003 extends ServiceEPBase { public class ServiceHPXS003 extends ServiceEPBase {
private final String[] IMAGE_LIST = new String[]{"bmp", "gif", "jpg", "jpeg", "tiff", "png"};
@Override @Override
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPXS003.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0); inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPXS003.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);
...@@ -126,11 +125,17 @@ public class ServiceHPXS003 extends ServiceEPBase { ...@@ -126,11 +125,17 @@ public class ServiceHPXS003 extends ServiceEPBase {
try { try {
HPXS003 hpxs003 = new HPXS003(); HPXS003 hpxs003 = new HPXS003();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
String userName;
try {
userName = UserSession.getLoginCName();
} catch (Exception e) {
userName = "System";
}
for (i = 0; i < eiBlock.getRowCount(); i++) { for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i); Map<?, ?> map = eiBlock.getRow(i);
hpxs003.fromMap(map); hpxs003.fromMap(map);
hpxs003.setDeleteFlag(CommonConstant.YesNo.NO_0); hpxs003.setDeleteFlag(CommonConstant.YesNo.NO_0);
hpxs003.setCompanyName(userName);
DaoUtils.insert(HPXS003.INSERT, hpxs003); DaoUtils.insert(HPXS003.INSERT, hpxs003);
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo.setStatus(EiConstant.STATUS_SUCCESS);
...@@ -186,98 +191,4 @@ public class ServiceHPXS003 extends ServiceEPBase { ...@@ -186,98 +191,4 @@ public class ServiceHPXS003 extends ServiceEPBase {
this.dao.delete(HPDS002.DELETE,map); this.dao.delete(HPDS002.DELETE,map);
} }
} }
public void getImage(PageContext pageContext) throws Exception {
HttpServletResponse response = (HttpServletResponse)pageContext.getResponse();
HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
String docId = request.getParameter("docId");
Map document = getDocument(docId);
String docName = document.get("docName").toString();
String chgName = document.get("chgName").toString();
String docPath = document.get("realPath").toString();
String filePath = docPath + "/" + chgName;
response.reset();
OutputStream outputStream = response.getOutputStream();
String imageType = docName.substring(docName.lastIndexOf(".") + 1);
if (StringUtils.isNotEmpty(docName) && this.indexOf(this.IMAGE_LIST, imageType.toLowerCase()) > -1) {
response.setContentType("image/" + imageType);
response.setHeader("ragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0L);
File file = new File(filePath);
try {
FileInputStream fileInputStream = new FileInputStream(file);
Throwable var14 = null;
try {
byte[] buffer = new byte[1024];
int i;
while((i = fileInputStream.read(buffer)) > 0) {
outputStream.write(buffer, 0, i);
}
} catch (Throwable var33) {
var14 = var33;
throw var33;
} finally {
if (fileInputStream != null) {
if (var14 != null) {
try {
fileInputStream.close();
} catch (Throwable var32) {
var14.addSuppressed(var32);
}
} else {
fileInputStream.close();
}
}
}
} catch (IOException var35) {
logError("下载文件在服务器中不存在", var35.getMessage());
} finally {
outputStream.flush();
outputStream.close();
}
} else {
outputStream.flush();
outputStream.close();
}
}
public Map getDocument(String docId) {
String ROOT_PATH= "";
Map hashMap = new HashMap();
hashMap.put("fkey","docRootDir");
List<Map> queryPath = DaoBase.getInstance().query("EDCC03.query",hashMap);
if (queryPath.get(0).get("fvalue")!=null) {
ROOT_PATH= (String) queryPath.get(0).get("fvalue");
}
HashMap<String, String> docMap = new HashMap();
docMap.put("docId", docId);
List docList = this.dao.query("EUDM02.queryDocById", docMap);
if (null != docList && docList.size() != 0) {
Map document = (Map)docList.get(0);
document.put("realPath", ROOT_PATH + "/" + document.get("realPath"));
return document;
} else {
throw new PlatException("文件在服务器中不存在");
}
}
private int indexOf(String[] list, String element) {
int result = -1;
int i = 0;
for(int length = list.length; i < length; ++i) {
if (list[i].equals(element)) {
result = i;
break;
}
}
return result;
}
} }
...@@ -94,6 +94,7 @@ ...@@ -94,6 +94,7 @@
SELECT SELECT
ID as "id", <!-- ID --> ID as "id", <!-- ID -->
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 --> COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
COMPANY_NAME as "companyName", <!-- 企业编码 预留 -->
DEP_CODE as "depCode", <!-- 部门编码 预留 --> DEP_CODE as "depCode", <!-- 部门编码 预留 -->
DOC_ID as "docId", <!-- 文件标识 --> DOC_ID as "docId", <!-- 文件标识 -->
DIR_ID as "dirId", <!-- 目录标识 --> DIR_ID as "dirId", <!-- 目录标识 -->
...@@ -126,6 +127,7 @@ ...@@ -126,6 +127,7 @@
SELECT SELECT
ID as "id", <!-- ID --> ID as "id", <!-- ID -->
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 --> COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
COMPANY_NAME as "companyName", <!-- 企业编码 预留 -->
DEP_CODE as "depCode", <!-- 部门编码 预留 --> DEP_CODE as "depCode", <!-- 部门编码 预留 -->
DOC_ID as "docId", <!-- 文件标识 --> DOC_ID as "docId", <!-- 文件标识 -->
DIR_ID as "dirId", <!-- 目录标识 --> DIR_ID as "dirId", <!-- 目录标识 -->
...@@ -212,6 +214,7 @@ ...@@ -212,6 +214,7 @@
<insert id="insert"> <insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPXS003 (ID, <!-- ID --> INSERT INTO ${hpjxSchema}.T_HPXS003 (ID, <!-- ID -->
COMPANY_CODE, <!-- 企业编码 预留 --> COMPANY_CODE, <!-- 企业编码 预留 -->
COMPANY_NAME, <!-- 企业编码 预留 -->
DEP_CODE, <!-- 部门编码 预留 --> DEP_CODE, <!-- 部门编码 预留 -->
DOC_ID, <!-- 文件标识 --> DOC_ID, <!-- 文件标识 -->
DIR_ID, <!-- 目录标识 --> DIR_ID, <!-- 目录标识 -->
...@@ -228,7 +231,7 @@ ...@@ -228,7 +231,7 @@
UPDATED_TIME, <!-- 修改人名称 --> UPDATED_TIME, <!-- 修改人名称 -->
UPDATED_NAME <!-- 修改时间 --> UPDATED_NAME <!-- 修改时间 -->
) )
VALUES (#id#, #companyCode#, #depCode#, #docId#, #dirId#, #docName#, #chgName#, #docSize#, #docTag#, #realPath#, VALUES (#id#, #companyCode#, #companyName#, #depCode#, #docId#, #dirId#, #docName#, #chgName#, #docSize#, #docTag#, #realPath#,
#deleteFlag#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedTime#, #updatedName#) #deleteFlag#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedTime#, #updatedName#)
</insert> </insert>
......
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