diff --git a/src/main/java/com/budwk/app/sys/models/Sys_user.java b/src/main/java/com/budwk/app/sys/models/Sys_user.java index 1389df0..0869852 100644 --- a/src/main/java/com/budwk/app/sys/models/Sys_user.java +++ b/src/main/java/com/budwk/app/sys/models/Sys_user.java @@ -109,9 +109,14 @@ public class Sys_user extends BaseModel implements Serializable { @Column @Comment("手机号码") @ColDefine(type = ColType.VARCHAR, width = 32) - @DataCenterColumn(name = "手机号码", key = "SJH") + @DataCenterColumn(name = "手机号码", key = "YDDH") private String mobile; + @Column + @Comment("福利手机号") + @ColDefine(type = ColType.VARCHAR, width = 32) + private String welfareMobile; + @Column @Comment("学历") @ColDefine(type = ColType.VARCHAR, width = 20) diff --git a/src/main/java/com/budwk/app/zhgh/welfare/controller/WelfareSelectionSituationController.java b/src/main/java/com/budwk/app/zhgh/welfare/controller/WelfareSelectionSituationController.java index 1399a80..10b691b 100644 --- a/src/main/java/com/budwk/app/zhgh/welfare/controller/WelfareSelectionSituationController.java +++ b/src/main/java/com/budwk/app/zhgh/welfare/controller/WelfareSelectionSituationController.java @@ -6,7 +6,6 @@ import cn.hutool.core.util.StrUtil; import com.budwk.app.base.annotation.SLog; import com.budwk.app.base.page.Pagination; import com.budwk.app.base.result.Result; -import com.budwk.app.sys.models.Sys_user; import com.budwk.app.zhgh.welfare.model.WelfareList; import com.budwk.app.zhgh.welfare.model.WelfareUserSelection; import com.budwk.app.zhgh.welfare.param.WelfareSelectionSituationPageForm; @@ -95,6 +94,7 @@ public class WelfareSelectionSituationController { welfareUserSelection.setSelectTime(new Date()); } dao.insert(selections); + situationService.updateWelfareMobile(userId, selections); situationService.completeReminderTodo(projectId, userId); return Result.success("选择成功"); } @@ -141,8 +141,7 @@ public class WelfareSelectionSituationController { @At @SaCheckLogin public Result getMobileByUserId(String userId) { - Sys_user user = dao.fetch(Sys_user.class, userId); - return Result.success().addData(user.getMobile()); + return Result.success().addData(situationService.getPreferredMobile(userId)); } } diff --git a/src/main/java/com/budwk/app/zhgh/welfare/controller/WelfareUserSelectController.java b/src/main/java/com/budwk/app/zhgh/welfare/controller/WelfareUserSelectController.java index 28feebe..d403c6f 100644 --- a/src/main/java/com/budwk/app/zhgh/welfare/controller/WelfareUserSelectController.java +++ b/src/main/java/com/budwk/app/zhgh/welfare/controller/WelfareUserSelectController.java @@ -106,6 +106,7 @@ public class WelfareUserSelectController { welfareUserSelection.setSelectTime(new Date()); } dao.insert(selections); + situationService.updateWelfareMobile(SecurityUtil.getUserId(), selections); situationService.completeReminderTodo(projectId, SecurityUtil.getUserId()); return Result.success("选择成功"); } diff --git a/src/main/java/com/budwk/app/zhgh/welfare/service/WelfareSelectionSituationService.java b/src/main/java/com/budwk/app/zhgh/welfare/service/WelfareSelectionSituationService.java index 076dd36..a69e6ba 100644 --- a/src/main/java/com/budwk/app/zhgh/welfare/service/WelfareSelectionSituationService.java +++ b/src/main/java/com/budwk/app/zhgh/welfare/service/WelfareSelectionSituationService.java @@ -3,6 +3,7 @@ package com.budwk.app.zhgh.welfare.service; import com.budwk.app.base.page.Pagination; import com.budwk.app.base.service.BaseService; import com.budwk.app.zhgh.welfare.model.WelfareList; +import com.budwk.app.zhgh.welfare.model.WelfareUserSelection; import com.budwk.app.zhgh.welfare.param.WelfareSelectionSituationPageForm; import org.nutz.lang.util.NutMap; @@ -42,4 +43,20 @@ public interface WelfareSelectionSituationService extends BaseService项目名称
{{ projectInfo.name }}
+
选择时间
{{ formatTimeRange(projectInfo.choiceTimeStart, projectInfo.choiceTimeEnd) }}
+
发放部门
{{ projectInfo.provideAddress }}
@@ -395,6 +399,9 @@ const optionSelect = { if (!this.isProxySelect && this.$store.state.user && this.$store.state.user.username) { this.$set(this.contactForm, "userName", this.$store.state.user.username) } + if (!this.isProxySelect && this.$store.state.user) { + this.$set(this.contactForm, "mobile", this.$store.state.user.welfareMobile || this.$store.state.user.mobile || "") + } this.getProjectInfo() }, @@ -444,7 +451,20 @@ const optionSelect = { this.hasSubmittedBefore = this.userSelection.length > 0 if (this.userSelection && this.userSelection.length > 0) { - this.$set(this.contactForm, "mobile", this.userSelection[0]?.mobile || "") + const selectionMobile = this.userSelection[0]?.mobile || "" + if (!this.isProxySelect && this.$store.state.user) { + this.$set(this.contactForm, "mobile", this.$store.state.user.welfareMobile || this.$store.state.user.mobile || selectionMobile) + } else if (this.isProxySelect) { + // 代选场景通过接口读取目标用户的福利手机号,回调完成前保留历史选择手机号。 + this.$set(this.contactForm, "mobile", selectionMobile) + $.post("/platform/welfare/selection/situation/getMobileByUserId", {userId: this.userId}).then((res) => { + if (res.code === 0) { + this.$set(this.contactForm, "mobile", res.data || selectionMobile) + } + }) + } else { + this.$set(this.contactForm, "mobile", selectionMobile) + } // 已有选择记录时优先回显历史收货人;历史记录为空时保留本人默认值。 if (this.userSelection[0]?.userName) { this.$set(this.contactForm, "userName", this.userSelection[0].userName) @@ -455,7 +475,7 @@ const optionSelect = { // 否则使用默认手机号 $.post("/platform/welfare/selection/situation/getMobileByUserId", {userId: this.userId}).then((res) => { if (res.code === 0) { - this.contactForm.mobile = res.data + this.$set(this.contactForm, "mobile", res.data || "") } }) } @@ -468,7 +488,6 @@ const optionSelect = { // this.contactForm.userName = this.userSelection[0].userName; // this.contactForm.mobile = this.userSelection[0].mobile; this.$set(this.contactForm, "userName", this.userSelection[0].userName) - this.$set(this.contactForm, "mobile", this.userSelection[0].mobile) } } @@ -555,6 +574,9 @@ if (this.isSubmitting) return if (res.code === 0) { this.showConfirmDialog = false + if (!this.isProxySelect && this.$store.state.user) { + this.$set(this.$store.state.user, "welfareMobile", this.contactForm.mobile) + } this.$message.success("选择成功") this.$emit("refresh") } else { diff --git a/src/main/resources/views/platform/zhghh5/welfare/select/index.html b/src/main/resources/views/platform/zhghh5/welfare/select/index.html index 35e2896..4ce499f 100644 --- a/src/main/resources/views/platform/zhghh5/welfare/select/index.html +++ b/src/main/resources/views/platform/zhghh5/welfare/select/index.html @@ -958,20 +958,26 @@ layout("/layouts/platform_h5.html"){ this.userSelection = resp.data this.hasSubmittedBefore = this.userSelection.length > 0 - // 如果有用户选择数据,从中获取手机号 - if (this.userSelection && this.userSelection.length > 0 && this.userSelection[0].mobile) { - this.formData.mobile = this.userSelection[0].mobile - this.formData.userName = this.userSelection[0].userName + const selectionMobile = this.userSelection && this.userSelection.length > 0 ? this.userSelection[0].mobile || "" : "" + const userPreferredMobile = this.$store.state.user ? this.$store.state.user.welfareMobile || this.$store.state.user.mobile || "" : "" + + // 福利手机号优先于数据中心手机号,历史选择手机号仅作为兼容兜底。 + if (this.userSelection && this.userSelection.length > 0) { + this.$set(this.formData, "mobile", userPreferredMobile || selectionMobile) + this.$set(this.formData, "userName", this.userSelection[0].userName) // 获取签名信息(如果有) if (this.userSelection[0].userSign) { - this.formData.userSign = this.userSelection[0].userSign + this.$set(this.formData, "userSign", this.userSelection[0].userSign) + } + } else { + if (userPreferredMobile) { + // 如果没有选择过,优先使用福利手机号,没有时使用数据中心手机号。 + this.$set(this.formData, "mobile", userPreferredMobile) + } + if (this.$store.state.user && this.$store.state.user.username) { + this.$set(this.formData, "userName", this.$store.state.user.username) } - } else if (this.$store.state.user && this.$store.state.user.mobile) { - // 如果没有选择过,使用store中的默认手机号 - this.formData.mobile = this.$store.state.user.mobile - }else if (this.$store.state.user && this.$store.state.user.username){ - this.formData.userName = this.$store.state.user.username } // 地址回显 @@ -1093,6 +1099,9 @@ layout("/layouts/platform_h5.html"){ this.isSubmitting = false if (res.code === 0) { + if (this.$store.state.user) { + this.$set(this.$store.state.user, "welfareMobile", this.formData.mobile) + } this.$toast.success("选择成功") setTimeout(() => { this.$pjaxReplace("/platform/h5/welfare/userSelect/success")