Commit a88c819a by liuyang

2024-08-31 新增回收站

parent 1186f766
......@@ -68,6 +68,8 @@ public class HGWD001A extends DaoEPBase {
public static final String UPDATE = "HGWD001A.update";
public static final String DELETE = "HGWD001A.delete";
public static final String DELETE_MAT_ID = "HGWD001A.deleteMatId";
public static final String QUERY_DELETE = "HGWD001A.queryDelete";
private Long id = new Long(0);
private String accountCode = " "; /* 企业编码*/
......
......@@ -60,6 +60,8 @@ public class HGWD099 extends DaoEPBase {
public static final String INSERT = "HGWD099.insert";
public static final String UPDATE = "HGWD099.update";
public static final String DELETE = "HGWD099.delete";
public static final String DELETE_DOC_ID = "HGWD099.deleteDocId";
private Long id = new Long(0);
private String accountCode = " "; /* 企业编码*/
......
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.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.utils.Iplat4jUtils;
import com.baosight.hggp.hg.sb.domain.HGSB002;
import com.baosight.hggp.hg.wd.constant.HgWdConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD001A;
import com.baosight.hggp.hg.wd.domain.HGWD099;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.StringUtil;
import com.baosight.hggp.util.StringUtils;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/8/31
* @description 回收站
*/
public class ServiceHGWD004 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_BOX_BLOCK_ID),new HashMap<String,Object>(){{
put(Org.FIELD_ORG_TYPE, OrgTypeEnum.COMPANY.getCode());
}});
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGWD001().eiMetadata);
}catch (Exception e){
LogUtils.setMsg(inInfo,e,"初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
EiBlock block = inInfo.getBlock(EiConstant.queryBlock);
if (block != null) {
String startDate = block.getCellStr(ACConstants.ROW_CODE_0,"createdTimeFrom");
String endDate = block.getCellStr(ACConstants.ROW_CODE_0,"createdTimeTo");
if (!startDate.isEmpty()) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, "createdTimeFrom", StringUtil.removeHorizontalLine(startDate));
}
if (!endDate.isEmpty()) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,"createdTimeTo", StringUtil.removeHorizontalLine(endDate));
}
}
return super.query(inInfo, HGWD001A.QUERY_DELETE,new HGWD001A());
}
@OperationLogAnnotation(operModul = "回收站", operType = "删除", operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HGWD001A hgwd001a = new HGWD001A();
hgwd001a.fromMap(map);
Iplat4jUtils.deleteFileByDocId(hgwd001a.getChangeStartCode()); //删除物理附件
//删除附件详情
DaoUtils.update(HGWD099.DELETE_DOC_ID,
new HashMap<String,String>(){{
put(HGWD099.FIELD_DOC_ID, hgwd001a.getChangeStartCode());
}}
);
DaoUtils.update(HGWD001A.DELETE, hgwd001a); //删除变更记录
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
LogUtils.setMsg(inInfo, e,"删除失败");
}
return inInfo;
}
}
......@@ -72,7 +72,7 @@
CHANGE_TYPE = #changeType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="changeContent">
CHANGE_CONTENT = #changeContent#
CHANGE_CONTENT like concat('%',#changeContent#,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="changeStartCode">
CHANGE_START_CODE = #changeStartCode#
......@@ -255,4 +255,42 @@
ID = #id#
</update>
<select id="queryDelete" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.wd.domain.HGWD001A">
SELECT
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-已删除 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
CHANGE_TYPE as "changeType", <!-- 变更类型 -->
CHANGE_CONTENT as "changeContent", <!-- 变更内容 -->
CHANGE_START_CODE as "changeStartCode",
CHANGE_START as "changeStart", <!-- 变更前 -->
CHANGE_END_CODE as "changeEndCode",
CHANGE_END as "changeEnd", <!-- 变更后 -->
MAT_ID as "matId"
FROM ${hggpSchema}.HGWD001A WHERE 1=1 and CHANGE_TYPE IN ('uploadUpdate','uploadDelete')
<include refid="BaseCondition.createdTimeCondition"/>
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID DESC
</isEmpty>
</dynamic>
</select>
</sqlMap>
......@@ -125,6 +125,10 @@
WHERE ID = #id#
</delete>
<delete id="deleteDocId">
DELETE FROM ${hggpSchema}.HGWD099 WHERE DOC_ID = #docId#
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGWD099
SET
......
......@@ -96,6 +96,7 @@
<!-- 文档库 -->
<sqlMap resource="com/baosight/hggp/hg/wd/sql/HGWD001.xml"/>
<sqlMap resource="com/baosight/hggp/hg/wd/sql/HGWD001A.xml"/>
<sqlMap resource="com/baosight/hggp/hg/wd/sql/HGWD002.xml"/>
<sqlMap resource="com/baosight/hggp/hg/wd/sql/HGWD003.xml"/>
<sqlMap resource="com/baosight/hggp/hg/wd/sql/HGWD099.xml"/>
......
$(function () {
$(".row").children().attr("class", "col-md-3");
IPLATUI.EFGrid = {
"result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: {
pageSize: 20,
pageSizes: [20, 50, 70, 100],
},
columns: [
{
field: "changeStartCode",
template: function (item) {
let template = item["changeStartCode"]
if (item.changeType == "uploadAdd" || item.changeType == "uploadDelete" || item.changeType == "uploadUpdate") {
template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'href="' + downloadHref(item.changeStartCode) + '" target="_blank">'+item.changeStart+'</a>';
}
return template;
}
}
],
loadComplete: function (grid) {},
onDelete: function (e) {
// 阻止默认请求,使用自定义删除
e.preventDefault();
deleteFunc();
},
}
}
// 查询
$("#QUERY").on("click", query);
$("#BATCH_DOWNLOAD").on("click", download); //批量下载
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
// 按键事件
downKeyUp();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 下载
*/
let download = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
for (let i = 0; i < rows.length; i++) {
window.open(downloadHref(rows[i]['changeStartCode']), '_blank');
}
}
/**
* 删除
*/
let deleteFunc = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGWD004", "delete", true,
function (e) {
if (e.getStatus() != -1){
query();
}
});
}
});
}
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/8/31
Time: 20:30
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<%@ page import="com.baosight.iplat4j.core.web.threadlocal.UserSession" %>
<%
String loginName = UserSession.getLoginName();
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="loginName" value="<%=loginName%>" />
<script type="text/javascript" src="${ctx}/common/js/dayjs.min.js"></script>
<EF:EFPage title="回收站">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFSelect blockId="inqu_status" row="0" ename="companyCode" cname="公司名称" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="companyBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFInput blockId="inqu_status" row="0" ename="projName" cname="项目名称" placeholder="模糊查询" colWidth="3"/>
<EF:EFDateSpan startCname="删除开始日期" endCname="删除结束日期" blockId="inqu_status" row="0" colWidth="3"
startName="createdTimeFrom" endName="createdTimeTo" role="date"
format="yyyy-MM-dd" satrtRatio="4:8" endRatio="4:8"/>
<EF:EFInput blockId="inqu_status" row="0" ename="changeContent" cname="文件名称" placeholder="模糊查询" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFComboColumn ename="companyCode" cname="公司名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="false" width="160" required="false"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="companyBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="projName" cname="项目名称" width="160" enable="true" readonly="false" align="left" required="false"/>
<EF:EFColumn ename="changeContent" cname="文件名称" width="160" enable="true" readonly="true" align="center" required="false"/>
<EF:EFColumn ename="changeStartCode" cname="附件ID" width="160" enable="true" readonly="false" align="center" required="false"/>
<EF:EFColumn ename="changeStart" cname="附件名称" width="160" enable="true" readonly="true" align="center" required="false"/>
<EF:EFColumn ename="createdName" cname="删除人" align="center" width="100" readonly="true" required="false"
enable="false"/>
<EF:EFColumn ename="createdTime" cname="删除时间" parseFormats="['yyyyMMddHHmmss']" editType="datetime"
dateFormat="yyyy-MM-dd HH:mm:ss" align="center" width="120" readonly="true" required="false"
enable="false"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
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