更新数据筛选在职状态,不更新退休人员吗,增加两个在职状态字段
This commit is contained in:
@@ -366,6 +366,22 @@ public class Sys_user extends BaseModel implements Serializable {
|
|||||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||||
private String userState;
|
private String userState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据中心 ZZZTM 原始代码;源数据全量保存,人员更新仅处理代码为 100 的记录。
|
||||||
|
*/
|
||||||
|
@Column
|
||||||
|
@Comment("源人员状态代码(ZZZTM)")
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||||
|
private String zzztm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据中心 ZZZTMC 原始名称,与 zzztm 配对保存,不替代现有 userState 字典值。
|
||||||
|
*/
|
||||||
|
@Column
|
||||||
|
@Comment("源人员状态名称(ZZZTMC)")
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||||
|
private String zzztmc;
|
||||||
|
|
||||||
@Column
|
@Column
|
||||||
@Comment("人员类型")
|
@Comment("人员类型")
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ public interface SourceData {
|
|||||||
put("SFZJH", new String[]{"idcard"}); // 身份证件号
|
put("SFZJH", new String[]{"idcard"}); // 身份证件号
|
||||||
put("ZZMMM", new String[]{"political"}); // 政治面貌码
|
put("ZZMMM", new String[]{"political"}); // 政治面貌码
|
||||||
put("DQZTM", new String[]{"userState", "personalStatus"}); // 在职状态码
|
put("DQZTM", new String[]{"userState", "personalStatus"}); // 在职状态码
|
||||||
|
put("ZZZTM", new String[]{"zzztm"}); // 保留源代码,供人员更新阶段筛选
|
||||||
|
put("ZZZTMC", new String[]{"zzztmc"}); // 保留源名称,不做字典转换
|
||||||
put("RYFLMC", new String[]{"personType"}); // 人员类型码
|
put("RYFLMC", new String[]{"personType"}); // 人员类型码
|
||||||
put("ZGXLM", new String[]{"education"}); // 最高学历码
|
put("ZGXLM", new String[]{"education"}); // 最高学历码
|
||||||
put("ZGXWM", new String[]{"academicDegree"}); // 最高学位码
|
put("ZGXWM", new String[]{"academicDegree"}); // 最高学位码
|
||||||
@@ -104,11 +106,7 @@ public interface SourceData {
|
|||||||
// checkSuccess(map);
|
// checkSuccess(map);
|
||||||
List<NutMap> data = map.getAsList("data", NutMap.class);
|
List<NutMap> data = map.getAsList("data", NutMap.class);
|
||||||
for (NutMap row : data) {
|
for (NutMap row : data) {
|
||||||
// 手动及定时拉取只保留源字段 ZZZTM 为 100 的人员,缺失或其他值均跳过。
|
// 源人员全量保存,包括非 100 和状态缺失的记录;筛选统一放在人员更新阶段。
|
||||||
// 分页仍按源接口 totalCount 推进,当前页全部被过滤也必须继续读取后续页。
|
|
||||||
if (!"100".equals(row.getString("ZZZTM"))) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Map entity = new HashMap(500);
|
Map entity = new HashMap(500);
|
||||||
|
|
||||||
row.forEach((k, v) -> {
|
row.forEach((k, v) -> {
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
|
|||||||
/**
|
/**
|
||||||
* 先同步单位并校验人员引用,再按现有配置生成记录和更新人员。
|
* 先同步单位并校验人员引用,再按现有配置生成记录和更新人员。
|
||||||
* @param pullTime 已拉取人员数据的批次时间
|
* @param pullTime 已拉取人员数据的批次时间
|
||||||
* @param sourceType all 全部更新、add 新增人员、part 按组别及过滤字段更新
|
* @param sourceType all 全部更新、add 新增人员、part 按组别及过滤字段更新,三种方式均只处理 zzztm=100
|
||||||
* @param columnNames 部分更新时忽略的字段名,可为空
|
* @param columnNames 部分更新时忽略的字段名,可为空
|
||||||
* @param isUpSet 保留现有接口参数,当前方法不使用
|
* @param isUpSet 保留现有接口参数,当前方法不使用
|
||||||
* @param partGroupId 更新组别 ID,为空时使用整个批次
|
* @param partGroupId 更新组别 ID,为空时使用整个批次
|
||||||
@@ -131,19 +131,21 @@ public class SourceUserServiceImpl extends ViServiceImpl<UserSource> implements
|
|||||||
sysUnitService.syncSourceUnits();
|
sysUnitService.syncSourceUnits();
|
||||||
List<UserSource> sources = new ArrayList<>();
|
List<UserSource> sources = new ArrayList<>();
|
||||||
Map<String, String> userPartMap = new HashMap<>();
|
Map<String, String> userPartMap = new HashMap<>();
|
||||||
|
// 三种更新方式及定时更新共用筛选;先于分组、单位校验和会员变更,其他源记录仍保留。
|
||||||
|
Cnd sourceCnd = Cnd.where("pullTime", "=", pullTime).and("zzztm", "=", "100");
|
||||||
if (Strings.isNotBlank(partGroupId)) {
|
if (Strings.isNotBlank(partGroupId)) {
|
||||||
//如果为true,更新组别之外人员
|
//如果为true,更新组别之外人员
|
||||||
Sql sql = Sqls.create("select u.loginname from user_part up left join `user` u on u.id=up.userId where up.groupId = @groupId").setParam("groupId", partGroupId);
|
Sql sql = Sqls.create("select u.loginname from user_part up left join `user` u on u.id=up.userId where up.groupId = @groupId").setParam("groupId", partGroupId);
|
||||||
List<String> loginNameList = userPatUpService.listMap(sql).stream().map(o -> o.getString("loginname")).collect(Collectors.toList());
|
List<String> loginNameList = userPatUpService.listMap(sql).stream().map(o -> o.getString("loginname")).collect(Collectors.toList());
|
||||||
if (isInvert) {
|
if (isInvert) {
|
||||||
sources = query(Cnd.where("pullTime", "=", pullTime).and("loginname", "not in", loginNameList).groupBy("loginname"));
|
sources = query(sourceCnd.and("loginname", "not in", loginNameList).groupBy("loginname"));
|
||||||
userPartMap = sources.stream().collect(Collectors.toMap(Sys_user::getLoginname, Sys_user::getLoginname));
|
userPartMap = sources.stream().collect(Collectors.toMap(Sys_user::getLoginname, Sys_user::getLoginname));
|
||||||
} else {
|
} else {
|
||||||
userPartMap = userPatUpService.query(Cnd.where("groupId", "=", partGroupId)).stream().collect(Collectors.toMap(UserPartUp::getLoginname, UserPartUp::getLoginname));
|
userPartMap = userPatUpService.query(Cnd.where("groupId", "=", partGroupId)).stream().collect(Collectors.toMap(UserPartUp::getLoginname, UserPartUp::getLoginname));
|
||||||
sources = query(Cnd.where("pullTime", "=", pullTime).and("loginname", "in", loginNameList).groupBy("loginname"));
|
sources = query(sourceCnd.and("loginname", "in", loginNameList).groupBy("loginname"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sources = query(Cnd.where("pullTime", "=", pullTime).groupBy("loginname"));
|
sources = query(sourceCnd.groupBy("loginname"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询所有用户,判断是否需要更新
|
// 查询所有用户,判断是否需要更新
|
||||||
|
|||||||
@@ -232,13 +232,17 @@ layout("/layouts/platform.html"){
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async getLatelyUpdateTimes() {
|
getLatelyUpdateTimes() {
|
||||||
const resp = await $.get("/platform/data/user/update/latelyUpdateTimes")
|
// 批次查询失败只提示刷新异常,不改变已经确认的拉取结果。
|
||||||
if(resp.code===0){
|
return $.get("/platform/data/user/update/latelyUpdateTimes").then((resp) => {
|
||||||
this.latelyDeleteTimes = resp.data
|
if (resp && resp.code === 0) {
|
||||||
}else{
|
this.latelyDeleteTimes = resp.data
|
||||||
this.$message.warning(resp.msg)
|
} else {
|
||||||
}
|
this.$message.warning((resp && resp.msg) || '拉取批次刷新失败,请刷新页面查看')
|
||||||
|
}
|
||||||
|
}, () => {
|
||||||
|
this.$message.warning('拉取批次刷新失败,请刷新页面查看')
|
||||||
|
})
|
||||||
},
|
},
|
||||||
openDeleteUser() {
|
openDeleteUser() {
|
||||||
if (!this.latelyDeleteTimes.length) {
|
if (!this.latelyDeleteTimes.length) {
|
||||||
@@ -276,20 +280,44 @@ layout("/layouts/platform.html"){
|
|||||||
this.selection = val;
|
this.selection = val;
|
||||||
},
|
},
|
||||||
pull(isIncrement) {
|
pull(isIncrement) {
|
||||||
|
// 请求未结束时禁止重复提交,避免同一人员数据被重复拉取成多个批次。
|
||||||
|
if (this.pullLoading) {
|
||||||
|
return
|
||||||
|
}
|
||||||
this.$confirm('确定要从数据中心拉取数据吗?', '提示', {
|
this.$confirm('确定要从数据中心拉取数据吗?', '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(async () => {
|
}).then(() => {
|
||||||
this.pullLoading = true
|
if (this.pullLoading) {
|
||||||
const resp = await $.post(loc() + '/pull')
|
return
|
||||||
this.pullLoading = false
|
|
||||||
if(resp.code===0){
|
|
||||||
await this.getLatelyUpdateTimes()
|
|
||||||
this.pageData()
|
|
||||||
}else{
|
|
||||||
this.$message.warning(resp.msg)
|
|
||||||
}
|
}
|
||||||
|
this.pullLoading = true
|
||||||
|
// 无请求参数;code=0 表示后端已完成拉取,msg 为业务失败说明。
|
||||||
|
// HTTP 异常不能证明后台失败,提示核对批次,不自动重试。
|
||||||
|
$.post(loc() + '/pull').then((resp) => {
|
||||||
|
if (resp && resp.code === 0) {
|
||||||
|
this.$message.success('人员数据拉取成功')
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
this.$message.warning((resp && resp.msg) || '未收到有效的拉取结果,请刷新核对最新批次,避免重复拉取')
|
||||||
|
return false
|
||||||
|
}, () => {
|
||||||
|
this.$message.warning('未收到拉取完成确认,请刷新核对最新批次,避免重复拉取')
|
||||||
|
return false
|
||||||
|
}).always(() => {
|
||||||
|
this.pullLoading = false
|
||||||
|
}).done((success) => {
|
||||||
|
// 先结束拉取 loading,再独立刷新批次和列表,刷新异常不误报拉取失败。
|
||||||
|
if (success) {
|
||||||
|
this.getLatelyUpdateTimes()
|
||||||
|
this.pageData().fail(() => {
|
||||||
|
this.$message.warning('人员数据已拉取成功,但列表刷新失败,请刷新页面查看')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, () => {
|
||||||
|
// 用户取消确认时未提交拉取请求,无需显示请求失败提示。
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user