diff --git a/mt/src/main/java/com/ccsens/mt/bean/dto/CompeteDto.java b/mt/src/main/java/com/ccsens/mt/bean/dto/CompeteDto.java index 78e8ee62..837868a6 100644 --- a/mt/src/main/java/com/ccsens/mt/bean/dto/CompeteDto.java +++ b/mt/src/main/java/com/ccsens/mt/bean/dto/CompeteDto.java @@ -87,7 +87,6 @@ public class CompeteDto { @NotNull @ApiModelProperty("参加的组别的id") private Long groupId; - @NotEmpty @ApiModelProperty("参赛单位的名字") private String companyName; @ApiModelProperty("身份证正面照文件的路径/户口本照片") @@ -96,6 +95,8 @@ public class CompeteDto { private String idCardBack; @ApiModelProperty("声明文件的路径") private String proveImg; + @ApiModelProperty("其他参赛人员(亲子组需要)") + private String family; } @Data diff --git a/mt/src/main/java/com/ccsens/mt/bean/po/CompetePlayerFamily.java b/mt/src/main/java/com/ccsens/mt/bean/po/CompetePlayerFamily.java new file mode 100644 index 00000000..9429ae08 --- /dev/null +++ b/mt/src/main/java/com/ccsens/mt/bean/po/CompetePlayerFamily.java @@ -0,0 +1,95 @@ +package com.ccsens.mt.bean.po; + +import java.io.Serializable; +import java.util.Date; + +public class CompetePlayerFamily implements Serializable { + private Long id; + + private Long playerId; + + private Long childrenId; + + private String description; + + private Date createdAt; + + private Date updatedAt; + + private Byte recStatus; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getPlayerId() { + return playerId; + } + + public void setPlayerId(Long playerId) { + this.playerId = playerId; + } + + public Long getChildrenId() { + return childrenId; + } + + public void setChildrenId(Long childrenId) { + this.childrenId = childrenId; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description == null ? null : description.trim(); + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Date getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(Date updatedAt) { + this.updatedAt = updatedAt; + } + + public Byte getRecStatus() { + return recStatus; + } + + public void setRecStatus(Byte recStatus) { + this.recStatus = recStatus; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", playerId=").append(playerId); + sb.append(", childrenId=").append(childrenId); + sb.append(", description=").append(description); + sb.append(", createdAt=").append(createdAt); + sb.append(", updatedAt=").append(updatedAt); + sb.append(", recStatus=").append(recStatus); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/mt/src/main/java/com/ccsens/mt/bean/po/CompetePlayerFamilyExample.java b/mt/src/main/java/com/ccsens/mt/bean/po/CompetePlayerFamilyExample.java new file mode 100644 index 00000000..5e1b56e6 --- /dev/null +++ b/mt/src/main/java/com/ccsens/mt/bean/po/CompetePlayerFamilyExample.java @@ -0,0 +1,631 @@ +package com.ccsens.mt.bean.po; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class CompetePlayerFamilyExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public CompetePlayerFamilyExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andPlayerIdIsNull() { + addCriterion("player_id is null"); + return (Criteria) this; + } + + public Criteria andPlayerIdIsNotNull() { + addCriterion("player_id is not null"); + return (Criteria) this; + } + + public Criteria andPlayerIdEqualTo(Long value) { + addCriterion("player_id =", value, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdNotEqualTo(Long value) { + addCriterion("player_id <>", value, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdGreaterThan(Long value) { + addCriterion("player_id >", value, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdGreaterThanOrEqualTo(Long value) { + addCriterion("player_id >=", value, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdLessThan(Long value) { + addCriterion("player_id <", value, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdLessThanOrEqualTo(Long value) { + addCriterion("player_id <=", value, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdIn(List values) { + addCriterion("player_id in", values, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdNotIn(List values) { + addCriterion("player_id not in", values, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdBetween(Long value1, Long value2) { + addCriterion("player_id between", value1, value2, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdNotBetween(Long value1, Long value2) { + addCriterion("player_id not between", value1, value2, "playerId"); + return (Criteria) this; + } + + public Criteria andChildrenIdIsNull() { + addCriterion("children_id is null"); + return (Criteria) this; + } + + public Criteria andChildrenIdIsNotNull() { + addCriterion("children_id is not null"); + return (Criteria) this; + } + + public Criteria andChildrenIdEqualTo(Long value) { + addCriterion("children_id =", value, "childrenId"); + return (Criteria) this; + } + + public Criteria andChildrenIdNotEqualTo(Long value) { + addCriterion("children_id <>", value, "childrenId"); + return (Criteria) this; + } + + public Criteria andChildrenIdGreaterThan(Long value) { + addCriterion("children_id >", value, "childrenId"); + return (Criteria) this; + } + + public Criteria andChildrenIdGreaterThanOrEqualTo(Long value) { + addCriterion("children_id >=", value, "childrenId"); + return (Criteria) this; + } + + public Criteria andChildrenIdLessThan(Long value) { + addCriterion("children_id <", value, "childrenId"); + return (Criteria) this; + } + + public Criteria andChildrenIdLessThanOrEqualTo(Long value) { + addCriterion("children_id <=", value, "childrenId"); + return (Criteria) this; + } + + public Criteria andChildrenIdIn(List values) { + addCriterion("children_id in", values, "childrenId"); + return (Criteria) this; + } + + public Criteria andChildrenIdNotIn(List values) { + addCriterion("children_id not in", values, "childrenId"); + return (Criteria) this; + } + + public Criteria andChildrenIdBetween(Long value1, Long value2) { + addCriterion("children_id between", value1, value2, "childrenId"); + return (Criteria) this; + } + + public Criteria andChildrenIdNotBetween(Long value1, Long value2) { + addCriterion("children_id not between", value1, value2, "childrenId"); + return (Criteria) this; + } + + public Criteria andDescriptionIsNull() { + addCriterion("description is null"); + return (Criteria) this; + } + + public Criteria andDescriptionIsNotNull() { + addCriterion("description is not null"); + return (Criteria) this; + } + + public Criteria andDescriptionEqualTo(String value) { + addCriterion("description =", value, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionNotEqualTo(String value) { + addCriterion("description <>", value, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionGreaterThan(String value) { + addCriterion("description >", value, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionGreaterThanOrEqualTo(String value) { + addCriterion("description >=", value, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionLessThan(String value) { + addCriterion("description <", value, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionLessThanOrEqualTo(String value) { + addCriterion("description <=", value, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionLike(String value) { + addCriterion("description like", value, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionNotLike(String value) { + addCriterion("description not like", value, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionIn(List values) { + addCriterion("description in", values, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionNotIn(List values) { + addCriterion("description not in", values, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionBetween(String value1, String value2) { + addCriterion("description between", value1, value2, "description"); + return (Criteria) this; + } + + public Criteria andDescriptionNotBetween(String value1, String value2) { + addCriterion("description not between", value1, value2, "description"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNull() { + addCriterion("created_at is null"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNotNull() { + addCriterion("created_at is not null"); + return (Criteria) this; + } + + public Criteria andCreatedAtEqualTo(Date value) { + addCriterion("created_at =", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotEqualTo(Date value) { + addCriterion("created_at <>", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThan(Date value) { + addCriterion("created_at >", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("created_at >=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThan(Date value) { + addCriterion("created_at <", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThanOrEqualTo(Date value) { + addCriterion("created_at <=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtIn(List values) { + addCriterion("created_at in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotIn(List values) { + addCriterion("created_at not in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtBetween(Date value1, Date value2) { + addCriterion("created_at between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotBetween(Date value1, Date value2) { + addCriterion("created_at not between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNull() { + addCriterion("updated_at is null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNotNull() { + addCriterion("updated_at is not null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtEqualTo(Date value) { + addCriterion("updated_at =", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotEqualTo(Date value) { + addCriterion("updated_at <>", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThan(Date value) { + addCriterion("updated_at >", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("updated_at >=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThan(Date value) { + addCriterion("updated_at <", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThanOrEqualTo(Date value) { + addCriterion("updated_at <=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIn(List values) { + addCriterion("updated_at in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotIn(List values) { + addCriterion("updated_at not in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtBetween(Date value1, Date value2) { + addCriterion("updated_at between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotBetween(Date value1, Date value2) { + addCriterion("updated_at not between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNull() { + addCriterion("rec_status is null"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNotNull() { + addCriterion("rec_status is not null"); + return (Criteria) this; + } + + public Criteria andRecStatusEqualTo(Byte value) { + addCriterion("rec_status =", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotEqualTo(Byte value) { + addCriterion("rec_status <>", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThan(Byte value) { + addCriterion("rec_status >", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThanOrEqualTo(Byte value) { + addCriterion("rec_status >=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThan(Byte value) { + addCriterion("rec_status <", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThanOrEqualTo(Byte value) { + addCriterion("rec_status <=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusIn(List values) { + addCriterion("rec_status in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotIn(List values) { + addCriterion("rec_status not in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusBetween(Byte value1, Byte value2) { + addCriterion("rec_status between", value1, value2, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotBetween(Byte value1, Byte value2) { + addCriterion("rec_status not between", value1, value2, "recStatus"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/mt/src/main/java/com/ccsens/mt/persist/mapper/CompetePlayerFamilyMapper.java b/mt/src/main/java/com/ccsens/mt/persist/mapper/CompetePlayerFamilyMapper.java new file mode 100644 index 00000000..e9363a35 --- /dev/null +++ b/mt/src/main/java/com/ccsens/mt/persist/mapper/CompetePlayerFamilyMapper.java @@ -0,0 +1,30 @@ +package com.ccsens.mt.persist.mapper; + +import com.ccsens.mt.bean.po.CompetePlayerFamily; +import com.ccsens.mt.bean.po.CompetePlayerFamilyExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface CompetePlayerFamilyMapper { + long countByExample(CompetePlayerFamilyExample example); + + int deleteByExample(CompetePlayerFamilyExample example); + + int deleteByPrimaryKey(Long id); + + int insert(CompetePlayerFamily record); + + int insertSelective(CompetePlayerFamily record); + + List selectByExample(CompetePlayerFamilyExample example); + + CompetePlayerFamily selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") CompetePlayerFamily record, @Param("example") CompetePlayerFamilyExample example); + + int updateByExample(@Param("record") CompetePlayerFamily record, @Param("example") CompetePlayerFamilyExample example); + + int updateByPrimaryKeySelective(CompetePlayerFamily record); + + int updateByPrimaryKey(CompetePlayerFamily record); +} \ No newline at end of file diff --git a/mt/src/main/java/com/ccsens/mt/service/CompeteService.java b/mt/src/main/java/com/ccsens/mt/service/CompeteService.java index 08b360d2..8b764640 100644 --- a/mt/src/main/java/com/ccsens/mt/service/CompeteService.java +++ b/mt/src/main/java/com/ccsens/mt/service/CompeteService.java @@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.lang.Snowflake; import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import com.ccsens.mt.bean.dto.CompeteDto; import com.ccsens.mt.bean.dto.LevelDto; import com.ccsens.mt.bean.po.*; @@ -55,6 +56,8 @@ public class CompeteService implements ICompeteService{ private CompeteGroupMapper competeGroupMapper; @Resource private ILevelUpService levelUpService; + @Resource + private CompetePlayerFamilyMapper competePlayerFamilyMapper; /** @@ -118,13 +121,13 @@ public class CompeteService implements ICompeteService{ CompeteDto.CompetePlayerInfo competePlayerInfo = params.getParam(); Long userId = params.getUserId(); -// //检查验证码是否正确 -// if (!redisUtil.hasKey(RedisKeyManager.getSigninSmsKey(competePlayerInfo.getPhone()))) { -// throw new BaseException(CodeEnum.SMS_CODE_CORRECT); -// } -// if (!competePlayerInfo.getSmsCode().equals(redisUtil.get(RedisKeyManager.getSigninSmsKey(competePlayerInfo.getPhone())).toString())) { -// throw new BaseException(CodeEnum.SMS_CODE_CORRECT); -// } + //检查验证码是否正确 + if (!redisUtil.hasKey(RedisKeyManager.getSigninSmsKey(competePlayerInfo.getPhone()))) { + throw new BaseException(CodeEnum.SMS_CODE_CORRECT); + } + if (!competePlayerInfo.getSmsCode().equals(redisUtil.get(RedisKeyManager.getSigninSmsKey(competePlayerInfo.getPhone())).toString())) { + throw new BaseException(CodeEnum.SMS_CODE_CORRECT); + } //检查此用户是否已经报名 CompetePlayerExample playerExample = new CompetePlayerExample(); playerExample.createCriteria().andUserIdEqualTo(userId); @@ -137,24 +140,25 @@ public class CompeteService implements ICompeteService{ throw new BaseException(CodeEnum.PARAM_ERROR); } //检查参赛单位是否存在,不存在则添加 - CompeteCompany company; - CompeteCompanyExample competeCompanyExample = new CompeteCompanyExample(); - competeCompanyExample.createCriteria().andNameEqualTo(competePlayerInfo.getCompanyName()); - List companyList = competeCompanyMapper.selectByExample(competeCompanyExample); - if(CollectionUtil.isEmpty(companyList)){ - company = new CompeteCompany(); - company.setId(snowflake.nextId()); - company.setType((byte) competePlayerInfo.getType()); - company.setName(competePlayerInfo.getCompanyName()); - competeCompanyMapper.insertSelective(company); - //更新缓存 - String key = competePlayerInfo.getType() + Constant.Redis.COMPETE_COMPANY; - CompeteVo.CompeteCompany competeCompany = new CompeteVo.CompeteCompany(); - competeCompany.setGroupId(company.getId()); - competeCompany.setGroupName(company.getName()); - redisUtil.lSet(key,competeCompany,Constant.Redis.COMPETE_COMPANY_TIME); - }else { - company = companyList.get(0); + CompeteCompany company = new CompeteCompany(); + if(StrUtil.isNotEmpty(competePlayerInfo.getCompanyName())) { + CompeteCompanyExample competeCompanyExample = new CompeteCompanyExample(); + competeCompanyExample.createCriteria().andNameEqualTo(competePlayerInfo.getCompanyName()); + List companyList = competeCompanyMapper.selectByExample(competeCompanyExample); + if (CollectionUtil.isEmpty(companyList)) { + company.setId(snowflake.nextId()); + company.setType((byte) competePlayerInfo.getType()); + company.setName(competePlayerInfo.getCompanyName()); + competeCompanyMapper.insertSelective(company); + //更新缓存 + String key = competePlayerInfo.getType() + Constant.Redis.COMPETE_COMPANY; + CompeteVo.CompeteCompany competeCompany = new CompeteVo.CompeteCompany(); + competeCompany.setGroupId(company.getId()); + competeCompany.setGroupName(company.getName()); + redisUtil.lSet(key, competeCompany, Constant.Redis.COMPETE_COMPANY_TIME); + } else { + company = companyList.get(0); + } } //添加基本信息 CompetePlayer player = new CompetePlayer(); @@ -162,8 +166,31 @@ public class CompeteService implements ICompeteService{ player.setId(snowflake.nextId()); player.setUserId(userId); player.setCompeteGroupId(competePlayerInfo.getGroupId()); - player.setCompanyId(company.getId()); + if(ObjectUtil.isNotNull(company)) { + player.setCompanyId(company.getId()); + } competePlayerDao.insertSelective(player); + //添加亲子组其他参赛人员信息 + if(StrUtil.isNotEmpty(competePlayerInfo.getFamily())){ + String names = StringUtil.replaceComma(competePlayerInfo.getFamily()); + String[] familyNames = names.split(","); + if (ObjectUtil.isNotNull(familyNames)) { + for (String familyName : familyNames) { + CompetePlayer family = new CompetePlayer(); + family.setId(snowflake.nextId()); + family.setName(familyName); + family.setCompeteGroupId(competePlayerInfo.getGroupId()); + competePlayerDao.insertSelective(family); + //添加选手和其他参赛选手的关联信息 + CompetePlayerFamily competePlayerFamily = new CompetePlayerFamily(); + competePlayerFamily.setId(snowflake.nextId()); + competePlayerFamily.setPlayerId(player.getId()); + competePlayerFamily.setChildrenId(family.getId()); + competePlayerFamilyMapper.insertSelective(competePlayerFamily); + } + } + } + // TODO LevelDto.LevelUserDto levelUserDto = new LevelDto.LevelUserDto(player.getId(),null,player.getName(),null); diff --git a/mt/src/main/resources/mapper_raw/CompetePlayerFamilyMapper.xml b/mt/src/main/resources/mapper_raw/CompetePlayerFamilyMapper.xml new file mode 100644 index 00000000..1e18a9e6 --- /dev/null +++ b/mt/src/main/resources/mapper_raw/CompetePlayerFamilyMapper.xml @@ -0,0 +1,243 @@ + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, player_id, children_id, description, created_at, updated_at, rec_status + + + + + delete from t_compete_player_family + where id = #{id,jdbcType=BIGINT} + + + delete from t_compete_player_family + + + + + + insert into t_compete_player_family (id, player_id, children_id, + description, created_at, updated_at, + rec_status) + values (#{id,jdbcType=BIGINT}, #{playerId,jdbcType=BIGINT}, #{childrenId,jdbcType=BIGINT}, + #{description,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, + #{recStatus,jdbcType=TINYINT}) + + + insert into t_compete_player_family + + + id, + + + player_id, + + + children_id, + + + description, + + + created_at, + + + updated_at, + + + rec_status, + + + + + #{id,jdbcType=BIGINT}, + + + #{playerId,jdbcType=BIGINT}, + + + #{childrenId,jdbcType=BIGINT}, + + + #{description,jdbcType=VARCHAR}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{recStatus,jdbcType=TINYINT}, + + + + + + update t_compete_player_family + + + id = #{record.id,jdbcType=BIGINT}, + + + player_id = #{record.playerId,jdbcType=BIGINT}, + + + children_id = #{record.childrenId,jdbcType=BIGINT}, + + + description = #{record.description,jdbcType=VARCHAR}, + + + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{record.recStatus,jdbcType=TINYINT}, + + + + + + + + update t_compete_player_family + set id = #{record.id,jdbcType=BIGINT}, + player_id = #{record.playerId,jdbcType=BIGINT}, + children_id = #{record.childrenId,jdbcType=BIGINT}, + description = #{record.description,jdbcType=VARCHAR}, + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{record.recStatus,jdbcType=TINYINT} + + + + + + update t_compete_player_family + + + player_id = #{playerId,jdbcType=BIGINT}, + + + children_id = #{childrenId,jdbcType=BIGINT}, + + + description = #{description,jdbcType=VARCHAR}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{recStatus,jdbcType=TINYINT}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_compete_player_family + set player_id = #{playerId,jdbcType=BIGINT}, + children_id = #{childrenId,jdbcType=BIGINT}, + description = #{description,jdbcType=VARCHAR}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{recStatus,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/util/src/test/java/com/ccsens/util/TestQrCord.java b/util/src/test/java/com/ccsens/util/TestQrCord.java index 77db8709..9faf516d 100644 --- a/util/src/test/java/com/ccsens/util/TestQrCord.java +++ b/util/src/test/java/com/ccsens/util/TestQrCord.java @@ -29,8 +29,10 @@ public class TestQrCord { // String text = "https://www.tall.wiki/pt-dev/respond?groupId="+i+"&groupName="+i+"组"; // String text = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx7af1bf1e14facf82&redirect_uri=http://www.tall.wiki/pt-dev/vote&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"; - String text = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx7af1bf1e14facf82&redirect_uri=https://www.tall.wiki/compete-province&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"; - String fileName = "zzz/" + "远程比赛-省赛(生产).png"; +// String text = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx7af1bf1e14facf82&redirect_uri=https://www.tall.wiki/compete-province&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"; +// String fileName = "zzz/" + "远程比赛-省赛(生产).png"; + String text = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx7af1bf1e14facf82&redirect_uri=https://www.tall.wiki/compete-people&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"; + String fileName = "zzz/" + "远程比赛-全民健身跳绳大赛(生产).png"; QRCodeWriter qrCodeWriter = new QRCodeWriter();