职工福利-福利名单: 新增‘导出重复身份证号人员’按钮(仅超级管理员可见);

This commit is contained in:
dd3s_206
2026-06-09 18:04:11 +08:00
parent 21ae4889f0
commit fab3a22666
4 changed files with 95 additions and 0 deletions
@@ -116,6 +116,14 @@ public class WelfareListController {
welfareListService.exportAddress(pageForm, response);
}
@At
@SaCheckPermission("welfare.list.mange")
@ApiOperation("导出重复身份证号人员")
@Ok("void")
public void exportRepeatIdCard(WelfareListPageForm pageForm, HttpServletResponse response) {
welfareListService.exportRepeatIdCard(pageForm, response);
}
@At
@SaCheckPermission("welfare.list.mange")
@ApiOperation("导出")
@@ -53,6 +53,13 @@ public interface WelfareListService extends BaseService<WelfareList> {
*/
void exportAddress(WelfareListPageForm pageForm, HttpServletResponse response);
/**
* 导出重复身份证号人员
* @param pageForm
* @param response
*/
void exportRepeatIdCard(WelfareListPageForm pageForm, HttpServletResponse response);
/**
* 导出
* @param pageForm
@@ -629,6 +629,72 @@ public class WelfareListServiceImpl extends BaseServiceImpl<WelfareList> impleme
}
}
@Override
public void exportRepeatIdCard(WelfareListPageForm pageForm, HttpServletResponse response) {
Sql sql = Sqls.create("""
SELECT
t1.*,
t2.loginname,
t2.username,
t2.idCard,
t2.sex,
DATE_FORMAT(t2.birthday, '%Y-%m-%d') AS birthday
FROM
`welfare_list` t1
LEFT JOIN sys_user t2 ON t2.id = t1.userId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("t1.projectId", "=", pageForm.getProjectId());
cnd.and("t2.idCard", "in", Sqls.create("select idCard from sys_user where idCard is not null and idCard != '' group by idCard having count(1) > 1"));
if (StrUtil.isNotBlank(pageForm.getUserName())) {
cnd.where().andLike("t2.username", pageForm.getUserName());
}
if (StrUtil.isNotBlank(pageForm.getLoginName())) {
cnd.where().andLike("t2.loginname", pageForm.getLoginName());
}
cnd.andEX("t2.sex", "=", pageForm.getSex());
cnd.andEX("t2.birthday", "=", pageForm.getBirthday());
if (pageForm.getBirthMonths() != null && pageForm.getBirthMonths().length > 0) {
cnd.andEX("MONTH(t2.birthday)", "in", pageForm.getBirthMonths());
}
cnd.andEX("t1.welfareUnitId", "in", pageForm.getUnitIds());
cnd.andEX("t1.welfareUnionId", "=", pageForm.getUnionId());
cnd.andEX("t1.personType", "in", pageForm.getPersonTypes());
cnd.andEX("t1.preparedBy", "in", pageForm.getPreparedBys());
cnd.andEX("t1.userState", "in", pageForm.getUserStates());
cnd.asc("t2.idCard");
cnd.asc("t1.welfareUnionName");
cnd.asc("t1.welfareUnitName");
sql.setCondition(cnd);
List<NutMap> list = listMap(sql);
try {
List<ExcelExportEntity> exportEntities = new ArrayList<>();
exportEntities.add(new ExcelExportEntity("工号", "loginname", 20));
exportEntities.add(new ExcelExportEntity("姓名", "username", 20));
exportEntities.add(new ExcelExportEntity("身份证号", "idCard", 30));
exportEntities.add(new ExcelExportEntity("性别", "sex", 20));
exportEntities.add(new ExcelExportEntity("出生日期", "birthday", 20));
exportEntities.add(new ExcelExportEntity("人员类型", "personType", 20));
exportEntities.add(new ExcelExportEntity("聘用方式", "preparedBy", 20));
exportEntities.add(new ExcelExportEntity("在职状态", "userState", 20));
exportEntities.add(new ExcelExportEntity("所属工会", "welfareUnionName", 20));
exportEntities.add(new ExcelExportEntity("所属单位", "welfareUnitName", 30));
exportEntities.add(new ExcelExportEntity("备注", "remark", 30));
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, list);
CommonDownloadUtil.download("重复身份证号人员.xlsx", workbook, response);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void exportXlsx(WelfareListPageForm pageForm, HttpServletResponse response) {
Sql sql = Sqls.create("""
@@ -136,6 +136,16 @@ layout("/layouts/platform.html"){
<el-button :disabled="!pageForm.projectId" @click="openExport" icon="el-icon-download" size="small" type="primary">
导出名单
</el-button>
<el-button
v-if="$auth.hasRole('SYSADMIN')"
:disabled="!pageForm.projectId"
@click="exportRepeatIdCard"
icon="el-icon-download"
size="small"
type="primary"
>
导出重复身份证号人员
</el-button>
<el-button :disabled="!pageForm.projectId" @click="openImport" icon="el-icon-document-add" size="small" type="primary">
导入名单
</el-button>
@@ -329,6 +339,10 @@ layout("/layouts/platform.html"){
exportAddress() {
this.$downLoad("/platform/welfare/list/mange/exportAddress", this.pageForm)
},
// 导出重复身份证号人员
exportRepeatIdCard() {
this.$downLoad("/platform/welfare/list/mange/exportRepeatIdCard", this.pageForm)
},
// 导出名单
openExport() {
const pageForm = clone(this.pageForm)