..
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())
|
||||
|
||||
Reference in New Issue
Block a user