This commit is contained in:
=
2026-06-05 11:02:05 +08:00
parent 0f20f35e1e
commit c337ad1716
2 changed files with 31 additions and 16 deletions
@@ -2,6 +2,7 @@ package io.v.nutz.hd.controller.wmhd;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.wizzer.framework.base.Result;
import io.v.nutz.annontation.ViReturn;
@@ -462,6 +463,9 @@ public class HdWmInfoController {
String zplb,
String union,
String unit,
String year,
String searchName,
String searchKeyword,
Integer isExcellent,
String stateId) {
Sql sql = Sqls.create("""
@@ -493,12 +497,15 @@ public class HdWmInfoController {
cnd.andEX("xx.hdzplx2", "=", zplb);
cnd.andEX("u.unionid", "=", union);
cnd.andEX("u.unitid", "=", unit);
cnd.andEX("YEAR(xx.hdsbsj)", "=", year);
cnd.andEX("xx.isExcellent", "=", isExcellent);
cnd.andEX("xx.auditState", "=", 4400);
if (!ShiroUtil.hasRole("A06") && !ShiroUtil.hasRole("sysadmin")) {
if (ShiroUtil.hasRole("H04")) {
cnd.andEX("u.unionid", "=", Vi.getUnionId());
}
cnd.andEX("xx.auditState", "=", stateId);
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
cnd.and("u.unionid", "=", Vi.getUnionId());
}
// 导出需与页面列表查询条件保持一致,避免按姓名或工号筛选后导出结果不一致。
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
cnd.and(Cnd.likeEX(searchName, searchKeyword));
}
cnd.asc("u.unionname").asc("u.unitname").asc("u.username").asc("xx.hdzplx");
sql.setCondition(cnd);
@@ -517,8 +524,10 @@ public class HdWmInfoController {
exportEntities.add(new ExcelExportEntity("点赞次数", "dz_num", 20));
try {
ViTool.excelResponse(response, hdname + ".xls");
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), exportEntities, list);
ViTool.excelResponse(response, hdname + ".xlsx");
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, list);
workbook.write(response.getOutputStream());
} catch (Exception e) {
e.printStackTrace();
@@ -567,7 +567,7 @@ layout("/layouts/platform.html"){
"&stateId=" + stateId);
},
exportExcel: function () {
let {hdid, hdlb, zplb, union, unit, stateId, isExcellent} = this.pageForm;
let {hdid, hdlb, zplb, union, unit, year, searchName, searchKeyword, stateId, isExcellent} = this.pageForm;
if (hdid === '') {
this.$message.warning('请先选择活动主题');
return;
@@ -576,14 +576,20 @@ layout("/layouts/platform.html"){
return o.value == hdid;
});
let hdname = hdarr[0].label;
window.open('/platform/hd/wmhd/exportExcel?hdid=' + hdid +
'&hdname=' + hdname +
"&hdlb=" + hdlb +
"&zplb=" + zplb +
"&union=" + union +
"&unit=" + unit +
"&isExcellent=" + isExcellent +
"&stateId=" + stateId);
let query = $.param({
hdid: hdid,
hdname: hdname,
hdlb: hdlb,
zplb: zplb,
union: union,
unit: unit,
year: year,
searchName: searchName,
searchKeyword: searchKeyword,
isExcellent: isExcellent,
stateId: stateId
});
window.open('/platform/hd/wmhd/exportExcel?' + query);
},
doSearch: function () {
this.pageForm.pageNumber = 1;