三方客户

master
e 2018-09-17 00:34:43 +08:00
parent dec62fb392
commit f37b3ac2d4
6 changed files with 52 additions and 16 deletions

View File

@ -13,10 +13,13 @@ import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.hibernate.loader.custom.Return;
import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.online.def.CgReportConstant;
import org.jeecgframework.core.online.exception.CgReportNotFoundException;
import org.jeecgframework.core.online.util.CgReportQueryParamUtil;
import org.jeecgframework.core.util.DynamicDBUtil;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.SqlUtil;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.params.ExcelExportEntity;
@ -26,10 +29,16 @@ import org.jeecgframework.web.cgreport.service.core.CgReportServiceI;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.exception.BusinessException;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.web.system.pojo.base.TSRole;
import org.jeecgframework.web.system.pojo.base.TSRoleUser;
import org.jeecgframework.web.system.pojo.base.TSUser;
import org.jeecgframework.web.system.service.SystemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
/**
*
* @Title:ExportExcelController
@ -43,6 +52,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
public class CgExportExcelController extends BaseController {
@Autowired
private CgReportServiceI cgReportService;
@Autowired
private SystemService systemService;
/**
* excel
* @param request
@ -50,9 +61,31 @@ public class CgExportExcelController extends BaseController {
*/
@SuppressWarnings("all")
@RequestMapping(params = "exportXls")
public void exportXls(HttpServletRequest request,
public ModelAndView exportXls(HttpServletRequest request,
HttpServletResponse response,ModelMap modelMap) {
AjaxJson ex = new AjaxJson();
//step.1 设置,获取配置信息
TSUser user = ResourceUtil.getSessionUserName();
String roles = "";
if (user != null) {
List<TSRoleUser> rUsers = systemService.findByProperty(TSRoleUser.class, "TSUser.id", user.getId());
for (TSRoleUser ru : rUsers) {
TSRole role = ru.getTSRole();
roles += role.getRoleCode() + ",";
}
if (roles.length() > 0) {
roles = roles.substring(0, roles.length() - 1);
}
if(roles.equals("QUERY")){
return new ModelAndView("common/noAuth");
}
}
//权限判断
String codedFileName = "报表";
String sheetName="导出信息";
if (StringUtil.isNotEmpty(request.getParameter("configId"))) {
@ -301,5 +334,8 @@ public class CgExportExcelController extends BaseController {
} else {
throw new BusinessException("参数错误");
}
return null;
}
}

View File

@ -121,7 +121,7 @@ $(function(){$('#${config_id}List').datagrid(
</#list>
</div>
<div style="height:30px;" class="datagrid-toolbar">
<span style="float:left;" >
<span style="float:left;" operationCode="onlineexport">
<a href="#" class="easyui-linkbutton" plain="true" icon="icon-putout" onclick="exportXls();">导出excel</a>
</span>

View File

@ -8,15 +8,15 @@
<t:dgCol title="所属客户" field="suoShuKeHu" queryMode="group" width="120"></t:dgCol>
<t:dgCol title="客户编码" field="cusCode" queryMode="group" width="120"></t:dgCol>
<t:dgCol title="cusName" field="cusName" queryMode="group" width="120"></t:dgCol>
<t:dgCol title="操作" field="opt" width="100"></t:dgCol>
<t:dgDelOpt title="删除" url="mvCusOtherController.do?doDel&id={id}" urlclass="ace_button" urlfont="fa-trash-o"/>
<t:dgToolBar title="录入" icon="icon-add" url="mvCusOtherController.do?goAdd" funname="add"></t:dgToolBar>
<t:dgToolBar title="编辑" icon="icon-edit" url="mvCusOtherController.do?goUpdate" funname="update"></t:dgToolBar>
<t:dgToolBar title="批量删除" icon="icon-remove" url="mvCusOtherController.do?doBatchDel" funname="deleteALLSelect"></t:dgToolBar>
<t:dgToolBar title="查看" icon="icon-search" url="mvCusOtherController.do?goUpdate" funname="detail"></t:dgToolBar>
<t:dgToolBar title="导入" icon="icon-put" funname="ImportXls"></t:dgToolBar>
<t:dgToolBar title="导出" icon="icon-putout" funname="ExportXls"></t:dgToolBar>
<t:dgToolBar title="模板下载" icon="icon-putout" funname="ExportXlsByT"></t:dgToolBar>
<%--<t:dgCol title="操作" field="opt" width="100"></t:dgCol>--%>
<%--<t:dgDelOpt title="删除" url="mvCusOtherController.do?doDel&id={id}" urlclass="ace_button" urlfont="fa-trash-o"/>--%>
<%--<t:dgToolBar title="录入" icon="icon-add" url="mvCusOtherController.do?goAdd" funname="add"></t:dgToolBar>--%>
<%--<t:dgToolBar title="编辑" icon="icon-edit" url="mvCusOtherController.do?goUpdate" funname="update"></t:dgToolBar>--%>
<%--<t:dgToolBar title="批量删除" icon="icon-remove" url="mvCusOtherController.do?doBatchDel" funname="deleteALLSelect"></t:dgToolBar>--%>
<%--<t:dgToolBar title="查看" icon="icon-search" url="mvCusOtherController.do?goUpdate" funname="detail"></t:dgToolBar>--%>
<%--<t:dgToolBar title="导入" icon="icon-put" funname="ImportXls"></t:dgToolBar>--%>
<%--<t:dgToolBar title="导出" icon="icon-putout" funname="ExportXls"></t:dgToolBar>--%>
<%--<t:dgToolBar title="模板下载" icon="icon-putout" funname="ExportXlsByT"></t:dgToolBar>--%>
</t:datagrid>
</div>
</div>

View File

@ -28,7 +28,7 @@
<%-- <t:dgToolBar title="批量删除" icon="icon-remove" url="mvStockYjController.do?doBatchDel" funname="deleteALLSelect"></t:dgToolBar> --%>
<%-- <t:dgToolBar title="查看" icon="icon-search" url="mvStockYjController.do?goUpdate" funname="detail"></t:dgToolBar> --%>
<%-- <t:dgToolBar title="导入" icon="icon-put" funname="ImportXls"></t:dgToolBar> --%>
<t:dgToolBar title="导出" icon="icon-putout" funname="ExportXls"></t:dgToolBar>
<%--<t:dgToolBar operationCode="export" title="导出" icon="icon-putout" funname="ExportXls"></t:dgToolBar>--%>
<%-- <t:dgToolBar title="模板下载" icon="icon-putout" funname="ExportXlsByT"></t:dgToolBar> --%>
</t:datagrid>
</div>

View File

@ -36,7 +36,7 @@
<%-- <t:dgToolBar title="批量删除" icon="icon-remove" url="mvStockCusController.do?doBatchDel" funname="deleteALLSelect"></t:dgToolBar> --%>
<%-- <t:dgToolBar title="查看" icon="icon-search" url="mvStockCusController.do?goUpdate" funname="detail"></t:dgToolBar> --%>
<%-- <t:dgToolBar title="导入" icon="icon-put" funname="ImportXls"></t:dgToolBar> --%>
<t:dgToolBar title="导出" icon="icon-putout" funname="ExportXls"></t:dgToolBar>
<%--<t:dgToolBar title="导出" icon="icon-putout" funname="ExportXls"></t:dgToolBar>--%>
<%-- <t:dgToolBar title="模板下载" icon="icon-putout" funname="ExportXlsByT"></t:dgToolBar> --%>
</t:datagrid>
</div>