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