福利整改,拉取手机号
This commit is contained in:
@@ -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)
|
||||
|
||||
+2
-3
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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("选择成功");
|
||||
}
|
||||
|
||||
+17
@@ -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<WelfareLis
|
||||
*/
|
||||
void completeReminderTodo(String projectId, String userId);
|
||||
|
||||
/**
|
||||
* 获取福利手机号;未设置福利手机号时回退到用户基础手机号。
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 优先返回福利手机号,均未设置时返回空字符串
|
||||
*/
|
||||
String getPreferredMobile(String userId);
|
||||
|
||||
/**
|
||||
* 保存本次福利选择填写的手机号,仅更新福利手机号字段,避免覆盖数据中心同步的基础手机号。
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param selections 本次福利选择记录
|
||||
*/
|
||||
void updateWelfareMobile(String userId, WelfareUserSelection[] selections);
|
||||
|
||||
}
|
||||
|
||||
+30
@@ -26,11 +26,13 @@ import com.budwk.app.zhgh.welfare.model.WelfareList;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareProject;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareProjectSubjectOption;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareReminderTodo;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareUserSelection;
|
||||
import com.budwk.app.zhgh.welfare.param.WelfareSelectionSituationPageForm;
|
||||
import com.budwk.app.zhgh.welfare.service.WelfareSelectionSituationService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
@@ -63,6 +65,34 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
|
||||
private SmsService smsService;
|
||||
@Inject
|
||||
private SchoolOaTodoService schoolOaTodoService;
|
||||
|
||||
@Override
|
||||
public String getPreferredMobile(String userId) {
|
||||
Sys_user user = dao().fetch(Sys_user.class, userId);
|
||||
if (user == null) {
|
||||
return "";
|
||||
}
|
||||
return StrUtil.isNotBlank(user.getWelfareMobile()) ? user.getWelfareMobile() : StrUtil.blankToDefault(user.getMobile(), "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateWelfareMobile(String userId, WelfareUserSelection[] selections) {
|
||||
if (StrUtil.isBlank(userId) || selections == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 同一批福利选项共用一个联系电话,取本次提交的第一个非空手机号保存。
|
||||
String mobile = Arrays.stream(selections)
|
||||
.filter(Objects::nonNull)
|
||||
.map(WelfareUserSelection::getMobile)
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (StrUtil.isNotBlank(mobile)) {
|
||||
dao().update(Sys_user.class, Chain.make("welfareMobile", mobile), Cnd.where(Sys_user::getId, "=", userId));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(WelfareSelectionSituationPageForm pageForm) {
|
||||
Sql sql = Sqls.create("""
|
||||
|
||||
@@ -270,7 +270,6 @@ layout("/layouts/platform.html"){
|
||||
formRules: {
|
||||
name: [{ required: true, message: "必填", trigger: ["blur", "change"] }],
|
||||
festival: [{ required: true, message: "必选", trigger: ["blur", "change"] }],
|
||||
provideTime: [{ required: true, message: "必选", trigger: ["blur", "change"] }],
|
||||
choiceTime: [{ required: true, message: "必选", trigger: ["blur", "change"] }],
|
||||
provideAddress: [{ required: true, message: "必选", trigger: ["blur", "change"] }],
|
||||
provideMode: [{ required: true, message: "必选", trigger: ["blur", "change"] }],
|
||||
|
||||
@@ -32,22 +32,26 @@ const optionSelect = {
|
||||
<div class="info-label">项目名称</div>
|
||||
<div class="info-value">{{ projectInfo.name }}</div>
|
||||
</div>
|
||||
<!--
|
||||
<div class="info-item">
|
||||
<div class="info-label">节日信息</div>
|
||||
<div class="info-value">{{ projectInfo.festival }} · {{ projectInfo.year }}年</div>
|
||||
</div>
|
||||
-->
|
||||
<div class="info-item">
|
||||
<div class="info-label">选择时间</div>
|
||||
<div class="info-value">{{ formatTimeRange(projectInfo.choiceTimeStart,
|
||||
projectInfo.choiceTimeEnd) }}
|
||||
</div>
|
||||
</div>
|
||||
<!--
|
||||
<div class="info-item">
|
||||
<div class="info-label">发放时间</div>
|
||||
<div class="info-value">{{ formatTimeRange(projectInfo.provideTimeStart,
|
||||
projectInfo.provideTimeEnd) }}
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
<div class="info-item">
|
||||
<div class="info-label">发放部门</div>
|
||||
<div class="info-value">{{ projectInfo.provideAddress }}</div>
|
||||
@@ -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 {
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user