..
This commit is contained in:
@@ -7,6 +7,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
import org.nutz.dao.entity.annotation.*;
|
import org.nutz.dao.entity.annotation.*;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@@ -34,10 +35,15 @@ public class Client_user extends BaseModel implements Serializable {
|
|||||||
@Comment("手机号")
|
@Comment("手机号")
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
|
// @Column
|
||||||
|
// @ColDefine(type = ColType.VARCHAR, width = 18)
|
||||||
|
// @Comment("身份证")
|
||||||
|
// private String idCard;
|
||||||
|
|
||||||
@Column
|
@Column
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 18)
|
@ColDefine(type = ColType.DATE)
|
||||||
@Comment("身份证")
|
@Comment("生日")
|
||||||
private String idCard;
|
private Date birthday;
|
||||||
|
|
||||||
@Column
|
@Column
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||||
|
|||||||
@@ -70,8 +70,8 @@ public class ClientAuthServiceImpl implements ClientAuthService {
|
|||||||
validateService.checkSMSCode(registerBody.getPhone(), registerBody.getSmsCode());
|
validateService.checkSMSCode(registerBody.getPhone(), registerBody.getSmsCode());
|
||||||
|
|
||||||
Client_user user = BeanUtil.copyProperties(registerBody, Client_user.class);
|
Client_user user = BeanUtil.copyProperties(registerBody, Client_user.class);
|
||||||
int gender = IdcardUtil.getGenderByIdCard(user.getIdCard());
|
// int gender = IdcardUtil.getGenderByIdCard(user.getIdCard());
|
||||||
user.setSex(gender==1?"男":"女");
|
// user.setSex(gender==1?"男":"女");
|
||||||
dao.insert(user);
|
dao.insert(user);
|
||||||
StpClientUtil.STP.login(user.getId());
|
StpClientUtil.STP.login(user.getId());
|
||||||
StpClientUtil.STP.checkLogin();
|
StpClientUtil.STP.checkLogin();
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package com.budwk.app.client.auth.vo;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ClientRegisterBody {
|
public class ClientRegisterBody {
|
||||||
|
|
||||||
@@ -11,7 +13,8 @@ public class ClientRegisterBody {
|
|||||||
|
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
private String idCard;
|
// private String idCard;
|
||||||
|
private Date birthday;
|
||||||
|
|
||||||
private String avatar;
|
private String avatar;
|
||||||
|
|
||||||
|
|||||||
+13
-11
@@ -50,10 +50,10 @@ public class ClientActivityServiceImpl extends BaseServiceImpl<Activity> impleme
|
|||||||
List<ActUser> userList = signVO.getUserList();
|
List<ActUser> userList = signVO.getUserList();
|
||||||
|
|
||||||
// 检查是否有重复的身份证号
|
// 检查是否有重复的身份证号
|
||||||
boolean hasDuplicateIdCard = userList.stream()
|
// boolean hasDuplicateIdCard = userList.stream()
|
||||||
.collect(Collectors.groupingBy(ActUser::getIdCard, Collectors.counting()))
|
// .collect(Collectors.groupingBy(ActUser::getIdCard, Collectors.counting()))
|
||||||
.values().stream()
|
// .values().stream()
|
||||||
.anyMatch(count -> count > 1);
|
// .anyMatch(count -> count > 1);
|
||||||
|
|
||||||
// 检查是否有重复的手机号
|
// 检查是否有重复的手机号
|
||||||
boolean hasDuplicatePhone = userList.stream()
|
boolean hasDuplicatePhone = userList.stream()
|
||||||
@@ -61,9 +61,9 @@ public class ClientActivityServiceImpl extends BaseServiceImpl<Activity> impleme
|
|||||||
.values().stream()
|
.values().stream()
|
||||||
.anyMatch(count -> count > 1);
|
.anyMatch(count -> count > 1);
|
||||||
|
|
||||||
if(hasDuplicateIdCard){
|
// if(hasDuplicateIdCard){
|
||||||
throw new BaseException("身份证号重复");
|
// throw new BaseException("身份证号重复");
|
||||||
}
|
// }
|
||||||
|
|
||||||
if(hasDuplicatePhone){
|
if(hasDuplicatePhone){
|
||||||
throw new BaseException("手机号重复");
|
throw new BaseException("手机号重复");
|
||||||
@@ -76,17 +76,19 @@ public class ClientActivityServiceImpl extends BaseServiceImpl<Activity> impleme
|
|||||||
|
|
||||||
// 首先检查报名人员是否已经在用户表中
|
// 首先检查报名人员是否已经在用户表中
|
||||||
for (ActUser user : userList) {
|
for (ActUser user : userList) {
|
||||||
Client_user clientUser = dao().fetch(Client_user.class, Cnd.where(Client_user::getIdCard, "=", user.getIdCard()).or(Client_user::getPhone, "=", user.getPhone()));
|
Client_user clientUser = dao().fetch(Client_user.class, Cnd.where(Client_user::getPhone, "=", user.getPhone()));
|
||||||
if (clientUser == null) {
|
if (clientUser == null) {
|
||||||
// 创建用户
|
// 创建用户
|
||||||
clientUser = new Client_user();
|
clientUser = new Client_user();
|
||||||
clientUser.setUserName(user.getUserName());
|
clientUser.setUserName(user.getUserName());
|
||||||
clientUser.setSex(user.getSex());
|
clientUser.setSex(user.getSex());
|
||||||
clientUser.setPhone(user.getPhone());
|
clientUser.setPhone(user.getPhone());
|
||||||
clientUser.setIdCard(user.getIdCard());
|
clientUser.setBirthday(user.getBirthday());
|
||||||
|
// clientUser.setIdCard(user.getIdCard());
|
||||||
clientUser.setUnitId(selfUser.getUnitId());
|
clientUser.setUnitId(selfUser.getUnitId());
|
||||||
int gender = IdcardUtil.getGenderByIdCard(clientUser.getIdCard());
|
// int gender = IdcardUtil.getGenderByIdCard(clientUser.getIdCard());
|
||||||
clientUser.setSex(gender==1?"男":"女");
|
// clientUser.setSex(gender==1?"男":"女");
|
||||||
|
clientUser.setSex(user.getSex());
|
||||||
dao().insert(clientUser);
|
dao().insert(clientUser);
|
||||||
} else {
|
} else {
|
||||||
// 验证用户之前是不是已经报名 别人帮报 自己报 管理员报
|
// 验证用户之前是不是已经报名 别人帮报 自己报 管理员报
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
import org.nutz.dao.entity.annotation.*;
|
import org.nutz.dao.entity.annotation.*;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
@@ -60,10 +61,15 @@ public class ActUser extends BaseModel {
|
|||||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||||
private String position;
|
private String position;
|
||||||
|
|
||||||
|
// @Column
|
||||||
|
// @Comment("身份证号码")
|
||||||
|
// @ColDefine(type = ColType.VARCHAR, width = 20)
|
||||||
|
// private String idCard;
|
||||||
|
|
||||||
@Column
|
@Column
|
||||||
@Comment("身份证号码")
|
@Comment("出生日期")
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
@ColDefine(type = ColType.DATE)
|
||||||
private String idCard;
|
private Date birthday;
|
||||||
|
|
||||||
@Column
|
@Column
|
||||||
@Comment("联系方式")
|
@Comment("联系方式")
|
||||||
|
|||||||
+4
-1
@@ -1,6 +1,7 @@
|
|||||||
package com.budwk.app.module.activity.service.impl;
|
package com.budwk.app.module.activity.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.IdcardUtil;
|
import cn.hutool.core.util.IdcardUtil;
|
||||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||||
import com.budwk.app.module.activity.models.*;
|
import com.budwk.app.module.activity.models.*;
|
||||||
@@ -368,8 +369,10 @@ public class ActGroupServiceImpl extends BaseServiceImpl<ActGroup> implements Ac
|
|||||||
private static double calculateTotalVariance(List<List<ActUser>> groups) {
|
private static double calculateTotalVariance(List<List<ActUser>> groups) {
|
||||||
if (groups.isEmpty()) return 0.0;
|
if (groups.isEmpty()) return 0.0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
double[] ageSums = groups.stream()
|
double[] ageSums = groups.stream()
|
||||||
.mapToDouble(g -> g.stream().mapToDouble(v -> IdcardUtil.getAgeByIdCard(v.getIdCard())).sum())
|
.mapToDouble(g -> g.stream().mapToDouble(v -> DateUtil.ageOfNow(v.getBirthday())).sum())
|
||||||
.toArray();
|
.toArray();
|
||||||
double[] weightSums = groups.stream()
|
double[] weightSums = groups.stream()
|
||||||
.mapToDouble(g -> g.stream().mapToDouble(ActUser::getWeight).sum())
|
.mapToDouble(g -> g.stream().mapToDouble(ActUser::getWeight).sum())
|
||||||
|
|||||||
@@ -101,10 +101,10 @@
|
|||||||
:rules="[{required:true,message: '请输入职务'}]">
|
:rules="[{required:true,message: '请输入职务'}]">
|
||||||
<t-input v-model="user.position" borderless placeholder="请输入职务"></t-input>
|
<t-input v-model="user.position" borderless placeholder="请输入职务"></t-input>
|
||||||
</t-form-item>
|
</t-form-item>
|
||||||
<t-form-item label="身份证号" :name="`userList[${index}].idCard`"
|
<!-- <t-form-item label="身份证号" :name="`userList[${index}].idCard`"-->
|
||||||
:rules="[{required:true,message: '请输入身份证号码'},{idcard:true, message: '请输入正确的身份证号码'}]">
|
<!-- :rules="[{required:true,message: '请输入身份证号码'},{idcard:true, message: '请输入正确的身份证号码'}]">-->
|
||||||
<t-input v-model="user.idCard" borderless placeholder="请输入身份证号码"></t-input>
|
<!-- <t-input v-model="user.idCard" borderless placeholder="请输入身份证号码"></t-input>-->
|
||||||
</t-form-item>
|
<!-- </t-form-item>-->
|
||||||
<t-form-item label="联系电话" :name="`userList[${index}].phone`"
|
<t-form-item label="联系电话" :name="`userList[${index}].phone`"
|
||||||
:rules="[{required:true,message: '请输入联系电话'},{telnumber:true, message: '请输入正确的联系电话'}]">
|
:rules="[{required:true,message: '请输入联系电话'},{telnumber:true, message: '请输入正确的联系电话'}]">
|
||||||
<t-input v-model="user.phone" borderless placeholder="请输入联系电话"></t-input>
|
<t-input v-model="user.phone" borderless placeholder="请输入联系电话"></t-input>
|
||||||
@@ -275,7 +275,7 @@ function addNewUser() {
|
|||||||
sex: null,
|
sex: null,
|
||||||
unitName: userStore?.userInfo?.unit?.name,
|
unitName: userStore?.userInfo?.unit?.name,
|
||||||
position: null,
|
position: null,
|
||||||
idCard: null,
|
// idCard: null,
|
||||||
phone: null,
|
phone: null,
|
||||||
isStay: null,
|
isStay: null,
|
||||||
isContacts: false,
|
isContacts: false,
|
||||||
@@ -397,7 +397,7 @@ onLoad(async (option) => {
|
|||||||
sex: userStore.userInfo.sex,
|
sex: userStore.userInfo.sex,
|
||||||
unitName: userStore?.userInfo?.unit?.name,
|
unitName: userStore?.userInfo?.unit?.name,
|
||||||
position: null,
|
position: null,
|
||||||
idCard: userStore.userInfo.idCard,
|
// idCard: userStore.userInfo.idCard,
|
||||||
phone: userStore.userInfo.phone,
|
phone: userStore.userInfo.phone,
|
||||||
isStay: null
|
isStay: null
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -95,18 +95,51 @@
|
|||||||
<t-icon name="chevron-right" size="20px" class="arrow-icon"/>
|
<t-icon name="chevron-right" size="20px" class="arrow-icon"/>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 身份证输入框 -->
|
<!-- <!– 身份证输入框 –>-->
|
||||||
|
<!-- <view class="input-box">-->
|
||||||
|
<!-- <t-icon name="creditcard" size="20px" class="input-icon"/>-->
|
||||||
|
<!-- <input-->
|
||||||
|
<!-- class="input"-->
|
||||||
|
<!-- type="text"-->
|
||||||
|
<!-- v-model="formData.idCard"-->
|
||||||
|
<!-- placeholder="请输入身份证号码"-->
|
||||||
|
<!-- maxlength="18"-->
|
||||||
|
<!-- />-->
|
||||||
|
<!-- </view>-->
|
||||||
|
|
||||||
|
<!-- 性别 -->
|
||||||
|
<view class="input-box">
|
||||||
|
<t-icon name="gender-female" size="20px" class="input-icon"></t-icon>
|
||||||
|
<t-radio-group v-model="formData.sex">
|
||||||
|
<t-radio :block="false" name="radio" value="男" label="男" />
|
||||||
|
<t-radio :block="false" name="radio" value="女" label="女" />
|
||||||
|
</t-radio-group>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 出生年月输入框 -->
|
||||||
<view class="input-box">
|
<view class="input-box">
|
||||||
<t-icon name="creditcard" size="20px" class="input-icon"/>
|
<t-icon name="creditcard" size="20px" class="input-icon"/>
|
||||||
<input
|
<input
|
||||||
class="input"
|
class="input"
|
||||||
type="text"
|
v-model="formData.birthday"
|
||||||
v-model="formData.idCard"
|
placeholder="选择出生日期"
|
||||||
placeholder="请输入身份证号码"
|
@click="showBirthdayPicker = true"
|
||||||
maxlength="18"
|
>
|
||||||
|
<t-popup v-model="showBirthdayPicker" placement="bottom">
|
||||||
|
<t-date-time-picker
|
||||||
|
:value="formData.birthday"
|
||||||
|
:mode="['date']"
|
||||||
|
title="出生日期"
|
||||||
|
start="1940-01-01"
|
||||||
|
end="2025-01-01"
|
||||||
|
format="YYYY-MM-DD"
|
||||||
|
@confirm="onBirthdayConfirm"
|
||||||
|
@cancel="onBirthdayCancel"
|
||||||
/>
|
/>
|
||||||
|
</t-popup>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<!-- 验证码输入框 -->
|
<!-- 验证码输入框 -->
|
||||||
<view class="input-box">
|
<view class="input-box">
|
||||||
<t-icon name="shield-error" size="20px" class="input-icon"/>
|
<t-icon name="shield-error" size="20px" class="input-icon"/>
|
||||||
@@ -215,7 +248,8 @@ const formData = reactive({
|
|||||||
phone: '',
|
phone: '',
|
||||||
unitId: '',
|
unitId: '',
|
||||||
unitName: '',
|
unitName: '',
|
||||||
idCard: '',
|
// idCard: '',
|
||||||
|
birthday: '',
|
||||||
smsCode: ''
|
smsCode: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -273,6 +307,19 @@ const clearSearch = () => {
|
|||||||
searchKeyword.value = '';
|
searchKeyword.value = '';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 生日选择器
|
||||||
|
const showBirthdayPicker = ref(false);
|
||||||
|
|
||||||
|
const onBirthdayConfirm = (date) => {
|
||||||
|
formData.birthday = date;
|
||||||
|
showBirthdayPicker.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onBirthdayCancel = () => {
|
||||||
|
showBirthdayPicker.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
// 选择单位
|
// 选择单位
|
||||||
const selectUnit = (unit) => {
|
const selectUnit = (unit) => {
|
||||||
selectedUnitId.value = unit.id;
|
selectedUnitId.value = unit.id;
|
||||||
@@ -365,18 +412,22 @@ const handleRegister = async () => {
|
|||||||
Toast('请输入正确的手机号码');
|
Toast('请输入正确的手机号码');
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!formData.idCard) {
|
// if (!formData.idCard) {
|
||||||
Toast('请输入身份证号');
|
// Toast('请输入身份证号');
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
if (!formData.birthday) {
|
||||||
|
Toast('请选择出生日期');
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!formData.unitId) {
|
if (!formData.unitId) {
|
||||||
Toast('请选择单位');
|
Toast('请选择单位');
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!formData.idCard.match(/^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/)) {
|
// if (!formData.idCard.match(/^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/)) {
|
||||||
Toast('请输入正确的身份证号');
|
// Toast('请输入正确的身份证号');
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
if (!formData.smsCode) {
|
if (!formData.smsCode) {
|
||||||
Toast('请输入验证码');
|
Toast('请输入验证码');
|
||||||
return
|
return
|
||||||
@@ -696,6 +747,21 @@ onMounted(() => {
|
|||||||
color: #f45a5a;
|
color: #f45a5a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.t-radio-group{
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.t-radio{
|
||||||
|
background: transparent;
|
||||||
|
margin-right: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .t-radio .t-radio__icon-circle::after{
|
||||||
|
/*border-color: #ffffff;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.empty-result {
|
.empty-result {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
Reference in New Issue
Block a user