This commit is contained in:
=
2026-05-22 08:50:20 +08:00
8 changed files with 105 additions and 26 deletions
@@ -126,6 +126,7 @@ public class SysDataUserPullServiceImpl extends BaseServiceImpl<Sys_user_source>
httpRequest.body(JSONUtil.toJsonStr(Map.of()));
String resBody = httpRequest.execute().body();
log.info("接口返回数据: {}", resBody);
JSONObject jsonBody = JSONUtil.parseObj(resBody);
if (jsonBody.getInt("code") != 200) {
@@ -323,6 +323,7 @@ public class HealthCheckupSingleController {
$projectCnd $condition
""");
cnd.and("hcu.projectId", "=", projectId);
sql.setVar("projectCnd",
"AND u.id NOT IN ( SELECT selectUserId FROM `health_checkup_user_selection` WHERE projectId = '" + projectId + "' AND selectUserId IS NOT NULL )");
cnd.groupBy("u.loginname");
@@ -330,11 +331,13 @@ public class HealthCheckupSingleController {
List<NutMap> mapList = healthCheckupSingleService.listMap(sql);
if(CollectionUtil.isEmpty(mapList)) return Result.success();
List<String> userIds = mapList.stream().map(v -> v.getString("id")).toList();
List<String> userIds = mapList.stream().map(v -> v.getString("id")).filter(Strings::isNotBlank).toList();
//去年项目的人
List<HealthCheckupUserSelection> lastYearSelectionList = dao.query(HealthCheckupUserSelection.class, Cnd.where(HealthCheckupUserSelection::getProjectId, "=", lastYearProject.getId())
.and(HealthCheckupUserSelection::getSelectUserId, "in", userIds));
Cnd aNew = Cnd.NEW();
aNew.and(HealthCheckupUserSelection::getProjectId, "=", lastYearProject.getId())
.and(HealthCheckupUserSelection::getSelectUserId, "in", userIds);
List<HealthCheckupUserSelection> lastYearSelectionList = dao.query(HealthCheckupUserSelection.class, aNew);
//去年项目下的医院
List<HealthCheckupProjectSubject> lastYearSubjectList = dao.query(HealthCheckupProjectSubject.class,
@@ -132,7 +132,7 @@ public class MutualInsuranceRosterController {
@At
@ApiOperation("按勾选人员删除名单")
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("mutualInsurance.roster")
@SaCheckPermission("mutualInsurance.roster.delete")
@SLog(type = "mutualInsurance", tag = "省级互助保障", msg = "按勾选人员删除名单")
public Result deleteSelected(String ids) {
String[] idArray = parseIds(ids);
@@ -146,11 +146,13 @@ public class MutualInsuranceRosterController {
@At
@Ok("void")
@ApiOperation("下载人员名单导入模板")
@SaCheckPermission("mutualInsurance.roster")
@SaCheckPermission("mutualInsurance.roster.import")
public void downloadTem(HttpServletResponse response) {
List<ExcelExportEntity> entities = new ArrayList<>();
entities.add(new ExcelExportEntity("工号", "loginName", 20));
entities.add(new ExcelExportEntity("姓名", "userName", 20));
entities.add(new ExcelExportEntity("证件类型", "idCardType", 20));
entities.add(new ExcelExportEntity("手机号", "mobile", 20));
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entities, Collections.emptyList());
@@ -231,8 +233,8 @@ public class MutualInsuranceRosterController {
entityList.add(new ExcelExportEntity("性别", "sex", 20));
entityList.add(new ExcelExportEntity("所属工会", "unionName", 20));
entityList.add(new ExcelExportEntity("所属单位", "unitName", 20));
entityList.add(new ExcelExportEntity("事项名称", "projectName", 30));
entityList.add(new ExcelExportEntity("手机号", "mobile", 20));
entityList.add(new ExcelExportEntity("证件类型", "idCardType", 20));
entityList.add(new ExcelExportEntity("身份证号", "idCard", 25));
entityList.add(new ExcelExportEntity("是否确认", "isAuditText", 20));
entityList.add(new ExcelExportEntity("确认时间", "auditTimeText", 25));
@@ -85,6 +85,11 @@ public class MutualInsuranceRosterUser extends BaseModel implements Serializable
@ColDefine(type = ColType.VARCHAR, width = 50)
private String mobile;
@Column
@Comment("证件类型")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String idCardType;
@Column
@Comment("身份证号")
@ColDefine(type = ColType.VARCHAR, width = 20)
@@ -43,6 +43,9 @@ public class MutualInsuranceRosterUserPageForm extends PageForm {
@ApiModelProperty("人员类型")
private String[] personTypes;
@ApiModelProperty("证件类型")
private String[] idCardTypes;
@ApiModelProperty("聘用方式")
private String[] preparedBys;
@@ -32,10 +32,13 @@ import java.io.File;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@IocBean(args = {"refer:dao"})
public class MutualInsuranceRosterUserServiceImpl extends BaseServiceImpl<MutualInsuranceRosterUser> implements MutualInsuranceRosterUserService {
private static final Pattern MOBILE_PATTERN = Pattern.compile("^1[3456789]\\d{9}$");
public MutualInsuranceRosterUserServiceImpl(Dao dao) {
super(dao);
}
@@ -100,6 +103,10 @@ public class MutualInsuranceRosterUserServiceImpl extends BaseServiceImpl<Mutual
row.setErrInfo("导入文件中工号重复", i + 1);
continue;
}
if (!isValidImportMobile(row.getMobile())) {
row.setErrInfo("手机号格式不正确", i + 1);
continue;
}
View_user user = users.stream()
.filter(item -> loginName.equals(item.getLoginname()))
.findFirst()
@@ -108,7 +115,7 @@ public class MutualInsuranceRosterUserServiceImpl extends BaseServiceImpl<Mutual
row.setErrInfo("工号在系统中不存在", i + 1);
continue;
}
upsertRosterUser(project, user);
upsertRosterUser(project, user, row);
successCount++;
}
fillImportResult(result, importRows, successCount);
@@ -131,7 +138,8 @@ public class MutualInsuranceRosterUserServiceImpl extends BaseServiceImpl<Mutual
u.unitName,
u.unionId,
u.unionName,
u.member
u.member,
u.idCardType
FROM vw_user u
LEFT JOIN mutual_insurance_roster_user info ON u.id = info.userId
AND info.projectId = @projectId
@@ -162,6 +170,7 @@ public class MutualInsuranceRosterUserServiceImpl extends BaseServiceImpl<Mutual
u.unionId,
u.unionName,
u.mobile,
u.idCardType,
u.idCard
FROM vw_user u
$condition
@@ -255,12 +264,33 @@ public class MutualInsuranceRosterUserServiceImpl extends BaseServiceImpl<Mutual
private Sql buildRosterSql(Integer year, String projectId, String unionId, String unitId,
String searchKeyword, String isAudit) {
// 列表和导出需展示用户表当前证件类型,避免历史名单快照为空时页面缺失。
Sql sql = Sqls.create("""
SELECT
info.*,
info.id,
info.year,
info.projectId,
info.projectName,
info.userId,
info.loginName,
info.userName,
info.sex,
info.unionId,
info.unionName,
info.unitId,
info.unitName,
info.mobile,
u.idCardType AS idCardType,
info.idCard,
info.importTime,
info.isAudit,
info.auditTime,
info.auditUser,
info.createdAt,
project.year AS projectYear
FROM mutual_insurance_roster_user info
LEFT JOIN mutual_insurance_project project ON project.id = info.projectId
LEFT JOIN sys_user u ON u.id = info.userId
$condition
""");
Cnd cnd = Cnd.NEW();
@@ -295,7 +325,7 @@ public class MutualInsuranceRosterUserServiceImpl extends BaseServiceImpl<Mutual
return sql;
}
private void upsertRosterUser(MutualInsuranceProject project, View_user user) {
private void upsertRosterUser(MutualInsuranceProject project, View_user user, MutualInsuranceUserImportTemp row) {
MutualInsuranceRosterUser info = dao().fetch(MutualInsuranceRosterUser.class,
Cnd.where("projectId", "=", project.getId()).and("userId", "=", user.getId()));
if (info == null) {
@@ -315,7 +345,9 @@ public class MutualInsuranceRosterUserServiceImpl extends BaseServiceImpl<Mutual
info.setUnitName(user.getUnitName());
info.setUnionId(user.getUnionId());
info.setUnionName(user.getUnionName());
info.setMobile(user.getMobile());
// 导入名单时手机号允许按 Excel 覆盖;未填写时继续使用系统用户档案中的手机号。
info.setMobile(StrUtil.blankToDefault(Strings.trim(row.getMobile()), user.getMobile()));
info.setIdCardType(user.getIdCardType());
info.setIdCard(user.getIdCard());
dao().insertOrUpdate(info);
}
@@ -341,6 +373,7 @@ public class MutualInsuranceRosterUserServiceImpl extends BaseServiceImpl<Mutual
info.setUnionId(user.getString("unionId"));
info.setUnionName(user.getString("unionName"));
info.setMobile(user.getString("mobile"));
info.setIdCardType(user.getString("idCardType"));
info.setIdCard(user.getString("idCard"));
dao().insertOrUpdate(info);
}
@@ -378,6 +411,7 @@ public class MutualInsuranceRosterUserServiceImpl extends BaseServiceImpl<Mutual
cnd.andEX("u.unionId", "=", pageForm.getUnionId());
cnd.andEX("u.unitId", "in", pageForm.getUnitIds());
cnd.andEX("u.personType", "in", pageForm.getPersonTypes());
cnd.andEX("u.idCardType", "in", pageForm.getIdCardTypes());
cnd.andEX("u.preparedBy", "in", pageForm.getPreparedBys());
cnd.andEX("u.userState", "in", pageForm.getUserStates());
cnd.andEX("u.member", "=", pageForm.getIsMember());
@@ -419,4 +453,12 @@ public class MutualInsuranceRosterUserServiceImpl extends BaseServiceImpl<Mutual
result.setErrorDetails(rows.stream().filter(row -> StrUtil.isNotBlank(row.getErrMsg())).collect(Collectors.toList()));
result.setFailedCount(result.getErrorDetails().size());
}
/**
* 导入手机号允许为空,非空时必须是 11 位中国大陆手机号,避免错误联系方式写入名单快照。
*/
private boolean isValidImportMobile(String mobile) {
String value = Strings.trim(mobile);
return StrUtil.isBlank(value) || MOBILE_PATTERN.matcher(value).matches();
}
}
@@ -20,4 +20,10 @@ public class MutualInsuranceUserImportTemp extends ExcelImportError {
@ExcelProperty("姓名")
private String userName;
@ExcelProperty("证件类型")
private String idCardType;
@ExcelProperty("手机号")
private String mobile;
}
@@ -30,7 +30,7 @@ layout("/layouts/platform.html"){
<search-item label="姓名/工号">
<el-input v-model="pageForm.searchKeyword" clearable placeholder="请输入姓名或工号"></el-input>
</search-item>
<search-item label="所属工会" v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN'])">
<search-item label="所属工会" v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN'])">
<el-select v-model="pageForm.unionId"
placeholder="请选择所属工会"
clearable
@@ -67,18 +67,26 @@ layout("/layouts/platform.html"){
<el-card shadow="never" class="mt10">
<table-tool label="人员名单">
<el-button type="primary" size="small" @click="openFeedback">问题反馈</el-button>
<el-button type="primary" size="small" @click="openFeedback"
v-if="$auth.hasRoleOr(['BRANCH_UNION_CHAIRMAN'])">问题反馈</el-button>
<el-button type="primary"
size="small"
@click="openImport"
v-if="$auth.hasPermissionOr(['mutualInsurance.roster.import'])">导入名单</el-button>
<el-button type="primary" size="small" @click="openAddUser">添加人员</el-button>
<el-button type="primary"
size="small"
@click="openAddUser"
v-if="$auth.hasPermissionOr(['mutualInsurance.roster.import'])">添加人员</el-button>
<el-button type="primary" size="small" @click="exportData">导出</el-button>
<el-button type="primary" size="small" :disabled="!pageForm.projectId" @click="doAuditByUnion(true)">按工会确认</el-button>
<el-button type="danger" size="small" :disabled="!pageForm.projectId" @click="doAuditByUnion(false)">按工会取消确认</el-button>
<el-button type="primary" size="small" :disabled="selectedIds.length === 0" @click="doAuditSelected(true)">勾选确认</el-button>
<el-button type="danger" size="small" :disabled="selectedIds.length === 0" @click="doAuditSelected(false)">勾选取消确认</el-button>
<el-button type="danger" size="small" :disabled="selectedIds.length === 0" @click="deleteSelected">批量删除</el-button>
<el-button type="danger"
size="small"
:disabled="selectedIds.length === 0"
@click="deleteSelected"
v-if="$auth.hasPermissionOr(['mutualInsurance.roster.delete'])">批量删除</el-button>
</table-tool>
<el-table :data="tableData"
@@ -97,8 +105,8 @@ layout("/layouts/platform.html"){
<el-table-column prop="sex" label="性别" align="center" header-align="center"></el-table-column>
<el-table-column prop="unionName" label="所属工会" align="center" header-align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="unitName" label="所属单位" align="center" header-align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="projectName" label="事项名称" min-width="180px" align="center" header-align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="mobile" label="手机号" align="center" header-align="center"></el-table-column>
<el-table-column prop="idCardType" label="证件类型" min-width="170px" align="center" header-align="center"></el-table-column>
<el-table-column prop="idCard" label="身份证号" min-width="170px" align="center" header-align="center"></el-table-column>
<el-table-column prop="isAudit" label="确认状态" align="center" header-align="center">
<template slot-scope="{row}">
@@ -205,6 +213,14 @@ layout("/layouts/platform.html"){
placeholder="请选择人员类型"
v-model="addUserPageForm.personTypes"></dict-select>
</search-item>
<search-item label="证件类型">
<dict-select clearable
code="USER_IDENTITY_TYPE"
multiple
collapse-tags
placeholder="请选择证件类型"
v-model="addUserPageForm.idCardTypes"></dict-select>
</search-item>
<search-item label="编制类别">
<dict-select clearable
code="USER_PREPARED_BY_TYPE"
@@ -244,6 +260,7 @@ layout("/layouts/platform.html"){
<el-table-column prop="personType" label="人员类型" align="center" header-align="center"></el-table-column>
<el-table-column prop="preparedBy" label="编制类别" align="center" header-align="center"></el-table-column>
<el-table-column prop="userState" label="在职状态" align="center" header-align="center"></el-table-column>
<el-table-column prop="idCardType" label="证件类型" min-width="120px" align="center" header-align="center"></el-table-column>
<el-table-column prop="unionName" label="所属工会" align="center" header-align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="unitName" label="所属单位" align="center" header-align="center" show-overflow-tooltip></el-table-column>
</el-table>
@@ -279,7 +296,7 @@ layout("/layouts/platform.html"){
<script>
const vue = new Vue({
el: "#app",
mixins: [initTableMixins],
mixins: [initTableMixins],
data() {
return {
pageForm: {
@@ -319,6 +336,7 @@ layout("/layouts/platform.html"){
unionId: "",
unitIds: [],
personTypes: [],
idCardTypes: [],
preparedBys: [],
userStates: [],
isMember: null
@@ -422,6 +440,7 @@ layout("/layouts/platform.html"){
unionId: "",
unitIds: [],
personTypes: [],
idCardTypes: [],
preparedBys: [],
userStates: [],
isMember: null
@@ -545,8 +564,8 @@ layout("/layouts/platform.html"){
"&isAudit=" + encodeURIComponent(form.isAudit || ""))
},
validateFeedbackCondition() {
if (!this.pageForm.year || !this.pageForm.projectId || !this.pageForm.unionId) {
this.notifyWarning("请先选择年度、事项、所属工会")
if (!this.pageForm.year || !this.pageForm.projectId) {
this.notifyWarning("请先选择年度、事项")
return false
}
return true
@@ -632,13 +651,11 @@ layout("/layouts/platform.html"){
})
}
},
created() {
this.$businessTool.listUnion().then((res) => {
this.unions = res
if (!this.pageForm.unionId && this.unions && this.unions.length === 1) {
this.pageForm.unionId = this.unions[0].id
}
})
async created() {
this.unions = await this.$businessTool.listUnion()
if (!this.pageForm.unionId && this.unions && this.unions.length === 1) {
this.pageForm.unionId = this.unions[0].id
}
this.flushUnits()
this.yearChange()
}