会员-按分工会/单位导出
This commit is contained in:
+48
@@ -1,8 +1,16 @@
|
|||||||
package com.budwk.app.zhgh.staffmanage.member.controller.statistics;
|
package com.budwk.app.zhgh.staffmanage.member.controller.statistics;
|
||||||
|
|
||||||
|
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.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.budwk.app.base.result.Result;
|
import com.budwk.app.base.result.Result;
|
||||||
|
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||||
import com.budwk.app.zhgh.staffmanage.member.service.MemberStatisticsService;
|
import com.budwk.app.zhgh.staffmanage.member.service.MemberStatisticsService;
|
||||||
|
import com.budwk.app.zhgh.user.singleTeacher.param.SingleTeacherPageForm;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
@@ -80,4 +88,44 @@ public class MemberSummaryController {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@At
|
||||||
|
@Ok("void")
|
||||||
|
@SaCheckPermission("member.statistics.summary")
|
||||||
|
@ApiOperation("导出Excel")
|
||||||
|
public void exportExcel(@Param("queryId") String queryId, @Param("queryType") String queryType,
|
||||||
|
@Param("currentYear") Integer currentYear, HttpServletResponse response) {
|
||||||
|
if (currentYear == null) {
|
||||||
|
currentYear = DateUtil.thisYear();
|
||||||
|
}
|
||||||
|
List<NutMap> list = new ArrayList<>();
|
||||||
|
if ("fgh".equals(queryType)) {
|
||||||
|
list = memberStatisticsService.getUnionStatisticsData(queryId, currentYear);
|
||||||
|
} else {
|
||||||
|
list = memberStatisticsService.getUnitStatisticsData(queryId, currentYear);
|
||||||
|
}
|
||||||
|
|
||||||
|
NutMap totalMap = NutMap.NEW();
|
||||||
|
totalMap.put("单位名称", "合计");
|
||||||
|
totalMap.put("总人数", list.stream().mapToInt(v -> v.getInt("totalNumber", 0)).sum());
|
||||||
|
list.add(totalMap);
|
||||||
|
|
||||||
|
List<ExcelExportEntity> entities = new ArrayList<>();
|
||||||
|
if ("fgh".equals(queryType)) {
|
||||||
|
entities.add(new ExcelExportEntity("分工会", "unionName", 20));
|
||||||
|
} else {
|
||||||
|
entities.add(new ExcelExportEntity("单位", "unitName", 20));
|
||||||
|
entities.add(new ExcelExportEntity("分工会", "unionName", 20));
|
||||||
|
}
|
||||||
|
entities.add(new ExcelExportEntity("总人数", "totalNumber", 15));
|
||||||
|
|
||||||
|
try {
|
||||||
|
ExportParams exportParams = new ExportParams();
|
||||||
|
exportParams.setType(ExcelType.XSSF);
|
||||||
|
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entities, list);
|
||||||
|
CommonDownloadUtil.download("会员人数统计.xlsx", workbook, response);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -362,6 +362,7 @@ public class MemberStatisticsServiceImpl extends BaseServiceImpl<Sys_user> imple
|
|||||||
un.id,
|
un.id,
|
||||||
un.unitcode AS unitCode,
|
un.unitcode AS unitCode,
|
||||||
un.`name` AS unitName,
|
un.`name` AS unitName,
|
||||||
|
uni.`name`AS unionName,
|
||||||
SUM(CASE WHEN TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) <= 40 $personCnd $yearCnd THEN 1 ELSE 0 END) AS smallForty,
|
SUM(CASE WHEN TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) <= 40 $personCnd $yearCnd THEN 1 ELSE 0 END) AS smallForty,
|
||||||
SUM(CASE WHEN TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) >= 41 AND TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) <= 50 $personCnd $yearCnd THEN 1 ELSE 0 END) AS smallFifty,
|
SUM(CASE WHEN TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) >= 41 AND TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) <= 50 $personCnd $yearCnd THEN 1 ELSE 0 END) AS smallFifty,
|
||||||
SUM(CASE WHEN TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) >= 51 AND TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) <= 55 $personCnd $yearCnd THEN 1 ELSE 0 END) AS smallFiftyFive,
|
SUM(CASE WHEN TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) >= 51 AND TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) <= 55 $personCnd $yearCnd THEN 1 ELSE 0 END) AS smallFiftyFive,
|
||||||
@@ -371,6 +372,7 @@ public class MemberStatisticsServiceImpl extends BaseServiceImpl<Sys_user> imple
|
|||||||
SUM(CASE WHEN sex = '女' $personCnd $yearCnd THEN 1 ELSE 0 END) AS femaleMember
|
SUM(CASE WHEN sex = '女' $personCnd $yearCnd THEN 1 ELSE 0 END) AS femaleMember
|
||||||
FROM
|
FROM
|
||||||
sys_unit un
|
sys_unit un
|
||||||
|
LEFT JOIN sys_union uni ON uni.id = un.unionId
|
||||||
JOIN $table u ON u.unitId = un.id AND u.member = 1
|
JOIN $table u ON u.unitId = un.id AND u.member = 1
|
||||||
$condition
|
$condition
|
||||||
""");
|
""");
|
||||||
|
|||||||
+10
-1
@@ -42,7 +42,9 @@ layout("/layouts/platform.html"){
|
|||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<el-card shadow="never" class="mt10">
|
<el-card shadow="never" class="mt10">
|
||||||
<table-tool label="会员统计"></table-tool>
|
<table-tool label="会员统计">
|
||||||
|
<el-button size="mini" type="primary" icon="el-icon-download" @click="exportExcel">导出</el-button>
|
||||||
|
</table-tool>
|
||||||
<el-table :data="tableData" show-summary>
|
<el-table :data="tableData" show-summary>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
align="center"
|
align="center"
|
||||||
@@ -90,6 +92,13 @@ layout("/layouts/platform.html"){
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
exportExcel() {
|
||||||
|
this.$downLoad("/platform/member/statistics/summary/exportExcel", {
|
||||||
|
queryId: this.pageForm.queryId,
|
||||||
|
queryType: this.pageForm.queryType,
|
||||||
|
currentYear: this.pageForm.currentYear
|
||||||
|
})
|
||||||
|
},
|
||||||
doExport() {},
|
doExport() {},
|
||||||
initData() {
|
initData() {
|
||||||
if (this.$auth.hasRoleOr(["SYSADMIN", "SCHOOL_UNION_ADMIN"])) {
|
if (this.$auth.hasRoleOr(["SYSADMIN", "SCHOOL_UNION_ADMIN"])) {
|
||||||
|
|||||||
Reference in New Issue
Block a user