diff options
| author | wangwei <[email protected]> | 2019-06-23 18:19:06 +0800 |
|---|---|---|
| committer | wangwei <[email protected]> | 2019-06-23 18:19:06 +0800 |
| commit | c812bebb2d6e21432a0b7a5145f130a4b8db01c3 (patch) | |
| tree | 0a69837eabde414b97a8cc300b108e38ca8e0abc | |
| parent | 30ec0dc379189a49f3908de177e398f646f07c45 (diff) | |
ResponsePage增加导出功能
6 files changed, 122 insertions, 26 deletions
diff --git a/src/main/java/com/nis/domain/callback/ProxyFileResponsePageCfg.java b/src/main/java/com/nis/domain/callback/ProxyFileResponsePageCfg.java index 4f09d4a72..720d871f6 100644 --- a/src/main/java/com/nis/domain/callback/ProxyFileResponsePageCfg.java +++ b/src/main/java/com/nis/domain/callback/ProxyFileResponsePageCfg.java @@ -1,6 +1,7 @@ package com.nis.domain.callback;
import com.nis.domain.configuration.BaseCfg;
+import com.nis.util.excel.ExcelField;
/**
* http代理文件策略
* @author nanfang
@@ -11,8 +12,11 @@ public class ProxyFileResponsePageCfg extends BaseCfg<ProxyFileResponsePageCfg> private static final long serialVersionUID = -1989406217948847813L;
public final static String TABLE_NAME = "pxy_profile_response_pages";//对应表名
private String indexTable = "pxy_profile_response_pages";
+ @ExcelField(title="file_desc",sort=1)
private String fileDesc;//文件描述
+ @ExcelField(title="response_file",sort=2)
private String url;//文件保存的url
+ @ExcelField(title="format",sort=3)
private String contentType;//内容类型,如text/html,取字典表contentType
private String md5;//文件md5值
private Long contentLength;//文件长度
diff --git a/src/main/java/com/nis/web/controller/configuration/proxy/FileResponsePageController.java b/src/main/java/com/nis/web/controller/configuration/proxy/FileResponsePageController.java index c1dd788d2..d11dee65d 100644 --- a/src/main/java/com/nis/web/controller/configuration/proxy/FileResponsePageController.java +++ b/src/main/java/com/nis/web/controller/configuration/proxy/FileResponsePageController.java @@ -9,7 +9,10 @@ package com.nis.web.controller.configuration.proxy;
import java.io.File;
+import java.util.ArrayList;
import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
@@ -26,11 +29,14 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes; import com.google.common.collect.Maps;
import com.nis.domain.Page;
+import com.nis.domain.callback.ProxyFileHijackCfg;
import com.nis.domain.callback.ProxyFileResponsePageCfg;
+import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.maat.ToMaatResult;
import com.nis.domain.maat.ToMaatResult.ResponseData;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
+import com.nis.util.Constants;
import com.nis.util.FileUtils;
import com.nis.util.JsonMapper;
import com.nis.util.LogUtils;
@@ -219,4 +225,62 @@ public class FileResponsePageController extends CommonController { }
return "redirect:" + adminPath +"/proxy/fileResponsePage/list?functionId="+functionId;
}
+ @RequestMapping(value = "exportFileResponsePage")
+ public void exportPxy(Model model, HttpServletRequest request, HttpServletResponse response,
+ @ModelAttribute("cfg") ProxyFileResponsePageCfg entity, String ids, RedirectAttributes redirectAttributes) {
+ try {
+ // export data info
+ List<String> titleList = new ArrayList<String>();
+ Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
+ Map<String, List> dataMap = new HashMap<String, List>();
+ Map<String, String> noExportMap = new HashMap<String, String>();
+
+ List<ProxyFileResponsePageCfg> ipLists = new ArrayList<ProxyFileResponsePageCfg>();
+ // 导出选中记录
+ if (!StringUtil.isEmpty(ids)) {
+ ipLists = proxyFileResponsePageService.findByList(ids);
+ } else {
+ entity.setTableName(IpPortCfg.getTablename());
+ Page<ProxyFileResponsePageCfg> pageInfo = new Page<ProxyFileResponsePageCfg>(request, response, "a");
+ pageInfo.setPageNo(1);
+ pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
+ Page<ProxyFileResponsePageCfg> page = proxyFileResponsePageService.findPage(pageInfo, entity);
+ ipLists = page.getList();
+ }
+ titleList.add(entity.getMenuNameCode());
+ classMap.put(entity.getMenuNameCode(), ProxyFileResponsePageCfg.class);
+ String cfgIndexInfoNoExport = ",config_describe,whether_area_block,block_type,do_log,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
+
+ // 时间过滤
+ if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
+ cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
+ }
+ if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
+ cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
+ }
+ if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
+ cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
+ }
+ if (!StringUtil.isEmpty(entity.gethColumns())) {
+ cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
+ }
+
+ noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
+ dataMap.put(entity.getMenuNameCode(), ipLists);
+
+ String timeRange = initTimeMap(entity);
+ noExportMap.put("timeRange", timeRange);
+ if ("csv".equals(entity.getExType())) {
+ this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
+ classMap, dataMap, noExportMap);
+ } else {
+ this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
+ classMap, dataMap, noExportMap);
+ }
+ } catch (Exception e) {
+ logger.error("proxyFileHijack export failed", e);
+ addMessage(redirectAttributes, "error", "export_failed");
+ LogUtils.saveLog(request, null, e, null);
+ }
+ }
}
diff --git a/src/main/java/com/nis/web/dao/configuration/ProxyFileResponsePageDao.java b/src/main/java/com/nis/web/dao/configuration/ProxyFileResponsePageDao.java index 17c1148df..6c419324b 100644 --- a/src/main/java/com/nis/web/dao/configuration/ProxyFileResponsePageDao.java +++ b/src/main/java/com/nis/web/dao/configuration/ProxyFileResponsePageDao.java @@ -20,6 +20,6 @@ public interface ProxyFileResponsePageDao { public ProxyFileResponsePageCfg getCfgById(@Param("cfgId")Long cfgId);
public void insert(ProxyFileResponsePageCfg entity);
public void update(ProxyFileResponsePageCfg entity);
-
+ List<ProxyFileResponsePageCfg> findByList(@Param("ids")String ids);
}
diff --git a/src/main/java/com/nis/web/dao/configuration/ProxyFileResponsePageDao.xml b/src/main/java/com/nis/web/dao/configuration/ProxyFileResponsePageDao.xml index 56cdc6d08..777104fb2 100644 --- a/src/main/java/com/nis/web/dao/configuration/ProxyFileResponsePageDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/ProxyFileResponsePageDao.xml @@ -326,7 +326,21 @@ </set>
where cfg_id = #{cfgId,jdbcType=BIGINT}
</update>
-
+ <!-- 查出所有 有效数据-->
+ <select id="findByList" resultMap="ProxyFileResponsePageCfg">
+ SELECT
+ <include refid="ProxyFileResponsePageCfgColumn"/>
+ <trim prefix="," prefixOverrides=",">
+ ,s.name as creator_name,e.name as editor_name,u.name as auditor_name
+ ,ri.request_title as requestName
+ </trim>
+ FROM pxy_profile_response_pages a
+ left join sys_user s on a.creator_id=s.id
+ left join sys_user e on a.editor_id=e.id
+ left join sys_user u on a.auditor_id=u.id
+ left join request_info ri on a.request_id=ri.id
+ where a.CFG_ID in (${ids})
+ </select>
</mapper>
\ No newline at end of file diff --git a/src/main/java/com/nis/web/service/configuration/ProxyFileResponsePageService.java b/src/main/java/com/nis/web/service/configuration/ProxyFileResponsePageService.java index a19104328..515c64bd8 100644 --- a/src/main/java/com/nis/web/service/configuration/ProxyFileResponsePageService.java +++ b/src/main/java/com/nis/web/service/configuration/ProxyFileResponsePageService.java @@ -132,5 +132,9 @@ public class ProxyFileResponsePageService extends BaseService{ List<ProxyFileResponsePageCfg> list=proxyFileDao.findPage(entity);
return list;
}
+ public List<ProxyFileResponsePageCfg> findByList(String ids) {
+ List<ProxyFileResponsePageCfg> list=proxyFileDao.findByList(ids);
+ return list;
+ }
}
diff --git a/src/main/webapp/WEB-INF/views/cfg/proxy/fileResponsePage/list.jsp b/src/main/webapp/WEB-INF/views/cfg/proxy/fileResponsePage/list.jsp index 2076a6d97..3fb6f4381 100644 --- a/src/main/webapp/WEB-INF/views/cfg/proxy/fileResponsePage/list.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/proxy/fileResponsePage/list.jsp @@ -121,6 +121,16 @@ <sys:delRow url="${ctx}/proxy/fileResponsePage/form" id="contentTable" label="update"></sys:delRow>
<sys:delRow url="${ctx}/proxy/fileResponsePage/delete?isValid=-1&functionId=${cfg.functionId }" id="contentTable" label="delete"></sys:delRow>
</shiro:hasPermission>
+ <div class="btn-group">
+ <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+ <i class="fa fa-wrench"></i> <spring:message code="export"></spring:message>
+ <i class="fa fa-angle-down"></i>
+ </button>
+ <ul class="dropdown-menu pull-right" style="min-width: 110px;" >
+ <li><sys:delRow url="${ctx}/proxy/fileResponsePage/exportFileResponsePage?functionId=${cfg.functionId }&exType=excel" searchUrl="${ctx}/proxy/fileHijack/list?functionId=${cfg.functionId}" id="contentTable" maxRow="10000" label="cfg_excel"></sys:delRow></li>
+ <li><sys:delRow url="${ctx}/proxy/fileResponsePage/exportFileResponsePage?functionId=${cfg.functionId }&exType=csv" searchUrl="${ctx}/proxy/fileHijack/list?functionId=${cfg.functionId}" id="contentTable" maxRow="10000" label="cfg_csv"></sys:delRow></li>
+ </ul>
+ </div>
<shiro:hasPermission name="proxy:fileResponsePage:confirm">
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
@@ -280,22 +290,22 @@ <thead>
<tr>
<th><input type="checkbox" class="i-checks" id="checkAll"></th>
- <th class="sort-column a.compile_id" style="display: none;"><spring:message code="cfg_id"/></th>
- <th class="sort-column a.cfg_desc"><spring:message code="file_desc"/></th>
- <th class="sort-column a.url"><spring:message code="response_file"/></th>
- <th class="sort-column a.content_type"><spring:message code="format"/></th>
- <th><spring:message code="letter"/></th>
- <th><spring:message code="classification"/></th>
- <th><spring:message code="attribute"/></th>
- <th><spring:message code="label"/></th>
- <th class="sort-column a.is_valid"><spring:message code="valid_identifier"/></th>
- <th><spring:message code="is_audit"/></th>
- <th><spring:message code="creator"/></th>
- <th class="sort-column a.create_time"><spring:message code="config_time"/></th>
- <th><spring:message code="editor"/></th>
- <th class="sort-column a.edit_time"><spring:message code="edit_time"/></th>
- <th><spring:message code="auditor"/></th>
- <th class="sort-column a.audit_time"><spring:message code="audit_time"/></th>
+ <th column="cfg_id" class="sort-column a.compile_id" style="display: none;"><spring:message code="cfg_id"/></th>
+ <th column="file_desc" class="sort-column a.cfg_desc"><spring:message code="file_desc"/></th>
+ <th column="response_file" class="sort-column a.url"><spring:message code="response_file"/></th>
+ <th column="format" class="sort-column a.content_type"><spring:message code="format"/></th>
+ <th column="is_audit"><spring:message code="is_audit"/></th>
+ <th column="letter"><spring:message code="letter"/></th>
+ <th column="classification"><spring:message code="classification"/></th>
+ <th column="attribute"><spring:message code="attribute"/></th>
+ <th column="label"><spring:message code="label"/></th>
+ <th column="valid_identifier" class="sort-column a.is_valid"><spring:message code="valid_identifier"/></th>
+ <th column="creator"><spring:message code="creator"/></th>
+ <th column="config_time" class="sort-column a.create_time"><spring:message code="config_time"/></th>
+ <th column="editor"><spring:message code="editor"/></th>
+ <th column="edit_time" class="sort-column a.edit_time"><spring:message code="edit_time"/></th>
+ <th column="auditor"><spring:message code="auditor"/></th>
+ <th column="audit_time" class="sort-column a.audit_time"><spring:message code="audit_time"/></th>
</tr>
</thead>
<tbody>
@@ -311,6 +321,14 @@ ${fn:substring(indexCfg.url,0,20) }</a>
</td>
<td>${indexCfg.contentType }</td>
+ <td>
+ <c:choose>
+ <c:when test="${indexCfg.isAudit eq '0'}"><span class="label label-danger"><spring:message code="created"></spring:message></span></c:when>
+ <c:when test="${indexCfg.isAudit eq '1'}"><span class="label label-success"><spring:message code="approved"></spring:message></span></c:when>
+ <c:when test="${indexCfg.isAudit eq '2'}"><span class="label label-warning"><spring:message code="unapproved"></spring:message></span></c:when>
+ <c:when test="${indexCfg.isAudit eq '3'}"><span indexTable="${indexCfg.indexTable}" data-placement="right" data-original-title="<spring:message code='letter_cancel_info'/>: " class="label le-ca-fo label-warning tooltips" data-icon=""> <spring:message code="cancel_approved"/></span></c:when>
+ </c:choose>
+ </td>
<td>${indexCfg.requestName }</td>
<td>
<c:set var="classify"></c:set>
@@ -375,14 +393,6 @@ <c:if test="${indexCfg.isValid==1}"><spring:message code="yes"/></c:if>
<c:if test="${indexCfg.isValid==-1}"><spring:message code="deleted"/></c:if>
</td>
- <td>
- <c:choose>
- <c:when test="${indexCfg.isAudit eq '0'}"><span class="label label-danger"><spring:message code="created"></spring:message></span></c:when>
- <c:when test="${indexCfg.isAudit eq '1'}"><span class="label label-success"><spring:message code="approved"></spring:message></span></c:when>
- <c:when test="${indexCfg.isAudit eq '2'}"><span class="label label-warning"><spring:message code="unapproved"></spring:message></span></c:when>
- <c:when test="${indexCfg.isAudit eq '3'}"><span indexTable="${indexCfg.indexTable}" data-placement="right" data-original-title="<spring:message code='letter_cancel_info'/>: " class="label le-ca-fo label-warning tooltips" data-icon=""> <spring:message code="cancel_approved"/></span></c:when>
- </c:choose>
- </td>
<td>${indexCfg.creatorName }</td>
<td><fmt:formatDate value="${indexCfg.createTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
<td>${indexCfg.editorName }</td>
|
