Commit 76db465b by 宋祥

Merge branch 'dev-sx' of http://129.211.46.84:8800/platform/hg-smart into dev

parents 87381168 6fab413e
......@@ -179,24 +179,23 @@ public class DaoUtils {
log.warn("写入创建人姓名失败", e);
}
// 创建人企业编码
try {
String accountCode = BeanUtils.getProperty(bean, "accountCode");
if (StringUtils.isBlank(accountCode)) {
accountCode = UserSessionUtils.getAccountCode();
String accountCode = UserSessionUtils.getAccountCode();
if (!"admin".equals(userId)) {
AssertUtils.isEmpty(accountCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
}
try {
BeanUtils.setProperty(bean, "accountCode", accountCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
// 创建人组织机构
try {
String depCode = BeanUtils.getProperty(bean, "depCode");
if (StringUtils.isBlank(depCode) && !"admin".equals(userId)) {
List<String> orgIds = UserSessionUtils.getOrgId();
if (!"admin".equals(userId)) {
AssertUtils.isEmpty(orgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
depCode = orgIds.get(0);
}
try {
// 此处应该不支持自定义部门,否则写入的部门信息不准确
String depCode = CollectionUtils.isEmpty(orgIds) ? "" : orgIds.get(0);
BeanUtils.setProperty(bean, "depCode", depCode);
} catch (Exception e) {
log.warn("写入创建人部门编码失败", e);
......@@ -247,24 +246,22 @@ public class DaoUtils {
map.put("createdName", userName);
map.put("updatedName", "");
// 创建人企业编码
try {
String accountCode = MapUtils.getString(map, "accountCode");
if (ObjectUtils.isNullBlank(accountCode)) {
accountCode = UserSessionUtils.getAccountCode();
String accountCode = UserSessionUtils.getAccountCode();
if (!"admin".equals(userId)) {
AssertUtils.isEmpty(accountCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
}
try {
map.put("accountCode", accountCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
// 创建人部门编码
try {
String depCode = MapUtils.getString(map, "depCode");
if (ObjectUtils.isNullBlank(depCode) && !"admin".equals(userId)) {
List<String> orgIds = UserSessionUtils.getOrgId();
if (!"admin".equals(userId)) {
AssertUtils.isEmpty(orgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
depCode = orgIds.get(0);
}
try {
String depCode = CollectionUtils.isEmpty(orgIds) ? "" : orgIds.get(0);
map.put("depCode", depCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
......
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.extapp.decheng.api.DcOpenApi;
import com.baosight.hggp.core.extapp.decheng.model.DcContract;
......@@ -207,7 +208,11 @@ public class ServiceHGSC101 extends ServiceEPBase {
// 设计来源
dbSc001.setProjectSource(getProjectSource(dcContract.getDesignSource()));
dbSc001.setContractNo(dcContract.getHtid());
DaoUtils.insert(HGSC001.INSERT, dbSc001);
dbSc001.setRecCreator("System");
dbSc001.setRecCreateTime(DateUtils.shortDateTime());
dbSc001.setRecRevisor("System");
dbSc001.setRecReviseTime(DateUtils.shortDateTime());
DaoBase.getInstance().insert(HGSC001.INSERT, dbSc001);
}
/**
......
......@@ -5,6 +5,7 @@ import com.baosight.hggp.common.ChangeTypeEnum;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.core.tools.FileTools;
......@@ -16,6 +17,7 @@ import com.baosight.hggp.hg.wd.constant.HgWdConstant;
import com.baosight.hggp.hg.wd.constant.HgWdSqlConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD001A;
import com.baosight.hggp.hg.wd.domain.HGWD001C;
import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.wd.domain.HGWD099;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
......@@ -586,38 +588,4 @@ public class ServiceHGWD001 extends ServiceEPBase {
return inInfo;
}
/**
* 批量下载
*
* @param inInfo
* @return
*/
public EiInfo batchDownload(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String fileName = MapUtils.getString(queryMap, HGWD001.FIELD_FILE_NAME);
String zipName = fileName + "_" + DateUtils.shortDateTime();
List<String> docIds = ObjectUtils.listKey(inInfo, HGWD099.FIELD_DOC_ID);
inInfo.set("downloadUrl", Iplat4jUtils.compressFile(docIds, zipName));
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "批量下载失败");
}
return inInfo;
}
/**
* 清理下载的文件
*
* @param inInfo
* @return
*/
public EiInfo clearDownload(EiInfo inInfo) {
try {
FileTools.clearZip();
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "清理下载的文件失败");
}
return inInfo;
}
}
......@@ -3,14 +3,20 @@ 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.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.tools.FileTools;
import com.baosight.hggp.core.utils.Iplat4jUtils;
import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD001C;
import com.baosight.hggp.hg.wd.domain.HGWD002;
import com.baosight.hggp.hg.wd.domain.HGWD099;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.hggp.util.StringUtils;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
......@@ -91,6 +97,42 @@ public class ServiceHGWD001C extends ServiceBase {
*/
public EiInfo add(EiInfo inInfo) {
try {
// 写入下载记录
this.saveData(inInfo);
inInfo.setMsg("操作成功");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "操作失败");
}
return inInfo;
}
/**
* 批量下载
*
* @param inInfo
* @return
*/
public EiInfo batchDownload(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String fileName = MapUtils.getString(queryMap, HGWD001.FIELD_FILE_NAME);
String zipName = fileName + "_" + DateUtils.shortDateTime();
List<String> docIds = ObjectUtils.listKey(inInfo, HGWD099.FIELD_DOC_ID);
inInfo.set("downloadUrl", Iplat4jUtils.compressFile(docIds, zipName));
// 写入下载记录
this.saveData(inInfo);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "批量下载失败");
}
return inInfo;
}
/**
* 保存数据
*
* @param inInfo
*/
private void saveData(EiInfo inInfo) {
List<HGWD001C> fWd001cs = MapUtils.toDaoEPBases(inInfo, HGWD001C.class);
for (HGWD001C fWd001c : fWd001cs) {
AssertUtils.isEmpty(fWd001c.getFileId(), "文件ID不能为空");
......@@ -100,10 +142,19 @@ public class ServiceHGWD001C extends ServiceBase {
fWd001c.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
DaoUtils.insert(HGWD001C.INSERT, fWd001c);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("操作成功");
}
/**
* 清理下载的文件
*
* @param inInfo
* @return
*/
public EiInfo clearDownload(EiInfo inInfo) {
try {
FileTools.clearZip();
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, 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.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.extapp.decheng.api.DcOpenApi;
......@@ -16,6 +17,7 @@ import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.wd.domain.HGWD005;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
......@@ -143,7 +145,11 @@ public class ServiceHGWD005 extends ServiceEPBase {
dbWd005.setUnit(dcProductList.getUnit());
dbWd005.setClassify(dcProductList.getFenlei());
dbWd005.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
DaoUtils.insert(HGWD005.INSERT, dbWd005);
dbWd005.setRecCreator("System");
dbWd005.setRecCreateTime(DateUtils.shortDateTime());
dbWd005.setRecRevisor("System");
dbWd005.setRecReviseTime(DateUtils.shortDateTime());
DaoBase.getInstance().insert(HGWD005.INSERT, dbWd005);
} else {
Map updateMap = new HashMap();
updateMap.put(HGWD005.FIELD_ID, dbWd005.getId());
......
......@@ -6,21 +6,23 @@ $(function () {
resultGrid.dataSource.page(1);
});
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 50, 70, 100],
},
columns: [
{
columns: [{
field: "operator",
template: function (item) {
let params = "'" + item.companyCode + "', '" + item.companyName + "', '"
+ item.id + "', '" + item.contractCode + "'";
let template = '';
if (item.companyCode) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showFunc(\'' + item.companyCode + '\',\'' + item.companyName + '\',\'' + item.id + '\',\'' + item.contractCode + '\')" >详情</a>';
+ 'onclick="showFunc(' + params + ')" >详情</a>';
}
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDoc(' + params + ')" >附件</a>';
return template;
}
}, {
......@@ -31,8 +33,7 @@ $(function () {
defaultValue: function () {
return currShortDate();
}
},
],
}],
beforeEdit: function (e) {
let item = e.model;
if(item.subStatus == '1'){
......@@ -177,4 +178,27 @@ function updateStatus() {
}
}
/**
* 展示附件
*
* @param contractCode
* @param companyName
* @param parentId
* @param contractCode
*/
let showDoc = function (companyCode, companyName, parentId, contractCode){
let params = {
"inqu_status-0-companyCode": companyCode,
"inqu_status-0-companyName": companyName,
"inqu_status-0-parentId": parentId,
"inqu_status-0-contractCode": contractCode
}
JSColorbox.open({
href: "HGWD002",
title: "<div style='text-align: center;'>文档管理</div>",
width: "100%",
height: "100%",
params: params
});
}
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/9/29
Time: 15:49
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page import="com.baosight.iplat4j.core.web.threadlocal.UserSession" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
......
......@@ -1066,7 +1066,7 @@ let batchDownload = function () {
message("请先勾选要下载的数据!");
return;
}
JSUtils.submitGridsData("result", "HGWD001", "batchDownload", false,
JSUtils.submitGridsData("result", "HGWD001C", "batchDownload", false,
function (res) {
if (res.status > -1) {
window.open(res.extAttr.downloadUrl, '_blank');
......
......@@ -31,7 +31,7 @@ $(function () {
if (document.getElementById("splitter").getElementsByClassName("k-splitbar").length !== 1) {
$("#splitter").kendoSplitter({
panes: [
{size: "30%", min: "25%", max: "75%", collapsible: true},
{size: "25%", min: "20%", max: "80%", collapsible: true},
{},
{collapsible: true}
]
......@@ -251,40 +251,6 @@ let showDownloadRecord = function (fileId, docId) {
}
/**
* 预览
*/
let preview = function () {
let url = "HGWD002A?inqu_status-0-fileId=" + $("#inqu_status-0-fileId").val();
window.open(url, '_blank');
}
/**
* 下载
*/
let download = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"下载\"操作? ", {
ok: function () {
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');
}
} else {
message(res.msg);
}
}
);
}
});
}
/**
* 设置树节点的值
*
* @param nodeData
......@@ -307,15 +273,23 @@ let showAuthButton = function () {
// C:目录
if (leafType && leafType > 0) {
$("#PREVIEW").attr("disabled", false);
// $("#DOWNLOAD").attr("disabled", false);
$("#DOWNLOAD").attr("disabled", false);
} else {
$("#PREVIEW").attr("disabled", true);
// $("#DOWNLOAD").attr("disabled", true);
$("#DOWNLOAD").attr("disabled", true);
}
}
/**
* 预览
*/
let preview = function () {
let url = "HGWD002A?inqu_status-0-fileId=" + $("#inqu_status-0-fileId").val();
window.open(url, '_blank');
}
/**
* 预览
*
* @param fileId
* @param docId
......@@ -323,11 +297,57 @@ let showAuthButton = function () {
* @param docName
*/
let showPreview = function (fileId, docId, docType, docName) {
if (isBlank(docId)) {
message("附件类型或ID不能为空");
addRecordWindow(fileId, docId, docType, docName);
}
/**
* 下载
*/
let download = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length == 0) {
message("请先勾选要下载的数据!");
return;
}
$("#previewFile").data("kendoWindow").center();
$("#previewFile").data("kendoWindow").open();
addRecord(fileId, docId, docType, docName);
if (rows.length == 1) {
singleDownload(rows[0]);
} else {
batchDownload();
}
}
/**
* 单个下载
*
* @param row
*/
let singleDownload = function (row) {
let inInfo = new EiInfo();
inInfo.set("result-0-fileId", row['fileId']);
inInfo.set("result-0-docId", row['docId']);
EiCommunicator.send("HGWD001C", "add", inInfo, {
onSuccess(res) {
if (res.status > -1) {
window.open(CommonUtils.downloadFile(row['docId'], false), '_blank');
} else {
message(res.msg);
}
}
}, {async: false})
}
/**
* 批量下载
*
* @param fileId
* @param docId
*/
let batchDownload = function () {
JSUtils.submitGridsData("result", "HGWD001C", "batchDownload", false,
function (res) {
if (res.status > -1) {
window.open(res.extAttr.downloadUrl, '_blank');
}
}
);
}
\ No newline at end of file
......@@ -5,12 +5,6 @@
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<script src="${ctx}/common/docxjs/jszip.min.js"></script>
<script src="${ctx}/common/docxjs/docx-preview.js"></script>
<script src="${ctx}/common/js/xlsx.full.min.js"></script>
<script src="${ctx}/HG/WD/HGWD002A1.js"></script>
<link rel="stylesheet" href="${ctx}/HG/WD/HGWD002A.css">
<EF:EFPage title="文档浏览">
<div id="splitter" class="i-fit-height">
<div id="left-pane" class="i-fit-height">
......@@ -72,25 +66,4 @@
</EF:EFPage>
<%-- 预览文件 --%>
<EF:EFWindow id="previewFile" title="附件预览" height="100%" width="100%">
<div id="descDiv" class="center-flex">
<span id="descSpan" style="font-weight: bold;font-size: 18px">附件预览区域...</span>
</div>
<%-- 文本预览 --%>
<div id="textContainer" class="left-flex" style="display: none;">
<pre id="textSpan" class="textSpan"></pre>
</div>
<%-- docx文件预览--%>
<div id="docxContainer" style="display: none;"></div>
<%-- IMAGE文件预览--%>
<div id="imageContainer" class="left-flex" style="display: none;">
<img id="image" src="" style="border: 1px solid gray;width: 100%;height: 100%;"/>
</div>
<%-- other --%>
<iframe id="previewFrame" src="" style="display: none;"></iframe>
</EF:EFWindow>
<%-- 图片放大区域 --%>
<div id="imageOuterDiv" class="imageOuterDiv">
<img id="bigImage" src=""/>
</div>
<jsp:include page="HGWD002A1.jsp" />
......@@ -9,12 +9,12 @@
<script src="${ctx}/common/docxjs/docx-preview.js"></script>
<script src="${ctx}/common/js/xlsx.full.min.js"></script>
<script src="${ctx}/HG/WD/HGWD002A1.js"></script>
<link rel="stylesheet" href="${ctx}/HG/WD/HGWD002A.css">
<EF:EFPage title="附件预览">
<link rel="stylesheet" href="${ctx}/HG/WD/HGWD002A1.css">
<EF:EFPage title="文档预览">
<div class="row" style="margin: 0 -10px;">
<div class="col-md-3">
<EF:EFRegion title="文目录树" id="tree" fitHeight="true">
<EF:EFInput ename="fileId" cname="文件ID" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFRegion title="文目录树" id="tree" fitHeight="true">
<EF:EFInput ename="fileId" cname="目录ID" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput ename="source" cname="来源" blockId="inqu_status" row="0" type="hidden"/>
<div id="menu" style="margin-top: 12px; margin-bottom: 8px">
<EF:EFTree bindId="docTree" ename="node" textField="text" valueField="label" hasChildren="leaf"
......
/**
* 弹窗预览
*
* @param fileId
* @param docId
* @param docType
* @param docName
*/
function addRecordWindow(fileId, docId, docType, docName) {
$("#previewFile").data("kendoWindow").center();
$("#previewFile").data("kendoWindow").open();
addRecord(fileId, docId, docType, docName);
}
/**
* 新增预览记录
*
* @param fileId
* @param docId
* @param docType
*/
function addRecord(fileId, docId, docType, docName){
function addRecord(fileId, docId, docType, docName) {
if (isBlank(docId)) {
message("附件类型或ID不能为空");
return;
}
// 隐藏预览区域
hideHtml();
IPLAT.progress($("body"), true);
......
<!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" %>
<script src="${ctx}/common/docxjs/jszip.min.js"></script>
<script src="${ctx}/common/docxjs/docx-preview.js"></script>
<script src="${ctx}/common/js/xlsx.full.min.js"></script>
<script src="${ctx}/HG/WD/HGWD002A1.js"></script>
<link rel="stylesheet" href="${ctx}/HG/WD/HGWD002A1.css">
<%-- 预览文件 --%>
<EF:EFWindow id="previewFile" title="附件预览" height="100%" width="100%">
<div id="descDiv" class="center-flex">
<span id="descSpan" style="font-weight: bold;font-size: 18px">附件预览区域...</span>
</div>
<%-- 文本预览 --%>
<div id="textContainer" class="left-flex" style="display: none;">
<pre id="textSpan" class="textSpan"></pre>
</div>
<%-- docx文件预览--%>
<div id="docxContainer" style="display: none;"></div>
<%-- IMAGE文件预览--%>
<div id="imageContainer" class="left-flex" style="display: none;">
<img id="image" src="" style="border: 1px solid gray;width: 100%;height: 100%;"/>
</div>
<%-- other --%>
<iframe id="previewFrame" src="" style="display: none;"></iframe>
</EF:EFWindow>
<%-- 图片放大区域 --%>
<div id="imageOuterDiv" class="imageOuterDiv">
<img id="bigImage" src=""/>
</div>
\ No newline at end of file
......@@ -628,7 +628,7 @@ function loadChange(grid,e,field) {
*
* @param bizType
* @param bizId
* @param
* @param callback
*/
let uploadFile = function (bizType, bizId, callback) {
let params = {
......@@ -650,14 +650,30 @@ function loadChange(grid,e,field) {
}
/**
* 文件下载路径
*
* @param docId
* @param isPreview 是否预览,true:预览
* @returns {string}
*/
let downloadFile = function (docId, isPreview) {
if (isPreview) {
return IPLATUI.CONTEXT_PATH + '/file/download/preview/' + docId;
} else {
// S3地址必须支持公网
return IPLATUI.CONTEXT_PATH + '/file/download/' + docId;
}
}
/**
* 预览
*
* @param docId 文件ID
* @param docName 文件名称必须带后缀
*/
function previewFile(docId, docName) {
let previewFile = function (docId, docName) {
let hostname = window.location.hostname;
let domain = hostname === "localhost" ? "http://129.211.46.84:8085": window.location.origin;
let domain = hostname === "localhost" ? "http://129.211.46.84:8085" : window.location.origin;
let url = domain + IPLATUI.CONTEXT_PATH + '/file/download/preview/' + docId
+ "?fullfilename=";
// Base64转码
......@@ -683,6 +699,7 @@ function loadChange(grid,e,field) {
$.extend(window, {
CommonUtils: {
uploadFile: uploadFile,
downloadFile: downloadFile,
previewFile: previewFile,
}
});
......
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