11 changed files with 161 additions and 9 deletions
@ -0,0 +1,55 @@
|
||||
package com.fr.plugin.decision.request.handler; |
||||
|
||||
import com.finebi.common.api.cell.context.CellCreator; |
||||
import com.finebi.common.authority.api.FineAuthorityUtils; |
||||
import com.finebi.common.authority.decision.role.FineAuthorityUser; |
||||
import com.finebi.common.impl.vo.table.FineBusinessTable; |
||||
import com.finebi.common.impl.vo.table.FineExcelBusinessTable; |
||||
import com.finebi.direct.common.impl.engine.BurgerTableDataCellImpl; |
||||
import com.finebi.burger.api.bean.configuration.table.page.ConfLimitInfo; |
||||
import com.finebi.burger.api.bean.configuration.table.page.ConfPageInfo; |
||||
import com.finebi.foundation.api.structure.result.BIDetailResult; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.web.utils.WebUtils; |
||||
|
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
import java.util.Optional; |
||||
|
||||
public class CheckSizeHandler extends HWAbstractHandler { |
||||
public static final String PATH="/excelmng/check/size"; |
||||
@Override |
||||
protected void deal(HttpServletRequest req, HttpServletResponse res, JSONObject para, JSONObject result) throws Exception { |
||||
JSONObject finalResult = JSONObject.create(); |
||||
|
||||
ArrayList<JSONObject> excelList = new ArrayList<JSONObject>(); |
||||
|
||||
List<FineBusinessTable> allTables = CellCreator.getCellProvider().tableCell().getAllTableWithoutAuth(); |
||||
allTables.forEach(fineBusinessTable -> { |
||||
if (fineBusinessTable instanceof FineExcelBusinessTable) { |
||||
try { |
||||
|
||||
FineAuthorityUser authorityUser = FineAuthorityUtils.getAuth(req); |
||||
Optional<BIDetailResult> data = new BurgerTableDataCellImpl().getRealDataWithAuth(fineBusinessTable, new ConfLimitInfo(30000, new ConfPageInfo()), authorityUser); |
||||
BIDetailResult detailResult = data.get(); |
||||
|
||||
JSONObject excel = JSONObject.create(); |
||||
excel.put("transferName", fineBusinessTable.getTransferName()). |
||||
put("rowCount", detailResult.totalRowSize()); |
||||
excelList.add(excel); |
||||
} catch(Exception e){ |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
WebUtils.printAsJSON(res, finalResult.put("data", excelList)); |
||||
} |
||||
|
||||
@Override |
||||
public String getPath() { |
||||
return PATH; |
||||
} |
||||
} |
@ -0,0 +1,66 @@
|
||||
!(function () { |
||||
var UpgradePane = BI.inherit(BI.Widget, { |
||||
props: { |
||||
baseCls: "dec-mng-check" |
||||
}, |
||||
|
||||
_store: function () { |
||||
return BI.Models.getModel("dec.model.mng.check"); |
||||
}, |
||||
|
||||
watch: { |
||||
result: function (items) { |
||||
this.list.populate(this._createItems(items)); |
||||
this.count.setText("excel表总数: " + BI.size(items)); |
||||
} |
||||
}, |
||||
|
||||
render: function () { |
||||
var self = this; |
||||
return { |
||||
type: "bi.vertical", |
||||
width: 640, |
||||
hgap: 50, |
||||
vgap: 50, |
||||
items: [{ |
||||
type: "bi.center_adapt", |
||||
items: [{ |
||||
type: "bi.button", |
||||
width: 200, |
||||
text: "检测所有excel的大小", |
||||
handler: self.store.getResult |
||||
}] |
||||
}, { |
||||
type: "bi.center_adapt", |
||||
items: [{ |
||||
type: "bi.label", |
||||
text: "excel表总数: 0", |
||||
ref: function (_ref) { |
||||
self.count = _ref; |
||||
} |
||||
}] |
||||
}, { |
||||
type: "bi.vertical", |
||||
ref: function (_ref) { |
||||
self.list = _ref; |
||||
} |
||||
}] |
||||
}; |
||||
}, |
||||
|
||||
_createItems: function (items) { |
||||
return BI.map(items, function (idx, item) { |
||||
var text = "【" + item.transferName + "】数据量: " + item.rowCount; |
||||
return { |
||||
type: "bi.horizontal", |
||||
items: [{ |
||||
type: "bi.label", |
||||
textAlign: "left", |
||||
text: text |
||||
}] |
||||
} |
||||
}); |
||||
} |
||||
}); |
||||
BI.shortcut("dec.mng.check", UpgradePane); |
||||
})(); |
@ -0,0 +1,19 @@
|
||||
!(function () { |
||||
var Model = BI.inherit(Fix.Model, { |
||||
state: function () { |
||||
return { |
||||
result: [] |
||||
}; |
||||
}, |
||||
|
||||
actions: { |
||||
getResult: function () { |
||||
var self = this; |
||||
Dec.HW.checkSize({}, function (res) { |
||||
self.model.result = res.data; |
||||
}); |
||||
} |
||||
} |
||||
}); |
||||
BI.model("dec.model.mng.check", Model); |
||||
})(); |
Loading…
Reference in new issue