|
|
|
@ -150,12 +150,33 @@ public class DataEaseController extends Controller {
|
|
|
|
|
/**
|
|
|
|
|
* 下载模板Excel
|
|
|
|
|
*
|
|
|
|
|
* @param type_id 1:市州,2:县区
|
|
|
|
|
* @param id 数据集id
|
|
|
|
|
*/
|
|
|
|
|
@Before(GET.class)
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
|
public void downSampleExcel(int type_id) {
|
|
|
|
|
|
|
|
|
|
public void downSampleExcel(int id) throws IOException {
|
|
|
|
|
//根据当前登录人员的身份,获取对应的数据集名称
|
|
|
|
|
int identity_id = Integer.parseInt(CookieUtil.getValue(getRequest(), "identity_id"));
|
|
|
|
|
if (identity_id == 1) {
|
|
|
|
|
renderJson(CommonUtil.returnMessageJson(false, "省管理员不能下载模板!"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
String area_name = "";
|
|
|
|
|
//获取他是哪个城市的管理员
|
|
|
|
|
if (identity_id == 2) {
|
|
|
|
|
area_name = "昆明市";
|
|
|
|
|
}
|
|
|
|
|
//获取他是哪个县区的管理员
|
|
|
|
|
if (identity_id == 3) {
|
|
|
|
|
area_name = "寻甸县";
|
|
|
|
|
}
|
|
|
|
|
Record record = dm.getDataSetById(id);
|
|
|
|
|
String tableName = record.getStr("table_name");
|
|
|
|
|
String dataSetName = record.getStr("dataset_name");
|
|
|
|
|
//导出excel
|
|
|
|
|
String excelFileName = dm.exportExcel(identity_id, tableName, dataSetName, tempDir, area_name);
|
|
|
|
|
//renderFile
|
|
|
|
|
renderFile(excelFileName, "【" + area_name + "】" + dataSetName + "." + "xlsx");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|