Browse Source

20210508v1.0

recovery
zy_Java 4 years ago
parent
commit
22685dc619
  1. 4
      mt/src/main/java/com/ccsens/mt/bean/dto/ProvinceCompeteDto.java
  2. 11
      mt/src/main/java/com/ccsens/mt/bean/po/CompetePlayer.java
  3. 60
      mt/src/main/java/com/ccsens/mt/bean/po/CompetePlayerExample.java
  4. 8
      mt/src/main/java/com/ccsens/mt/bean/vo/ProvinceCompeteVo.java
  5. 69
      mt/src/main/java/com/ccsens/mt/service/ProvinceService.java
  6. 4
      mt/src/main/resources/application.yml
  7. 4
      mt/src/main/resources/mapper_dao/CompetePlayerDao.xml
  8. 27
      mt/src/main/resources/mapper_raw/CompetePlayerMapper.xml
  9. 4
      tall/src/main/resources/application.yml
  10. 44
      util/src/test/java/com/ccsens/util/OtherTest.java

4
mt/src/main/java/com/ccsens/mt/bean/dto/ProvinceCompeteDto.java

@ -82,6 +82,8 @@ public class ProvinceCompeteDto {
private Long healthRecord;
@ApiModelProperty("保险证明照片")
private Long insuranceRecord;
@ApiModelProperty("自愿参赛责任及风险告知书")
private Long responsibilityRiskFile;
// @ApiModelProperty("身份证正面照片")
// private Part idCardFront;
// @ApiModelProperty("身份证反面照片")
@ -89,7 +91,7 @@ public class ProvinceCompeteDto {
// @ApiModelProperty("证件照")
// private Part idPhone;
// @ApiModelProperty("学籍照片")
// private Part studentRecord;
// private Part studentRecord;0
// @ApiModelProperty("体检证明照片")
// private Part healthRecord;
// @ApiModelProperty("保险证明照片")

11
mt/src/main/java/com/ccsens/mt/bean/po/CompetePlayer.java

@ -50,6 +50,8 @@ public class CompetePlayer implements Serializable {
private Byte groupRemark;
private Long responsibilityRiskFile;
private static final long serialVersionUID = 1L;
public Long getId() {
@ -236,6 +238,14 @@ public class CompetePlayer implements Serializable {
this.groupRemark = groupRemark;
}
public Long getResponsibilityRiskFile() {
return responsibilityRiskFile;
}
public void setResponsibilityRiskFile(Long responsibilityRiskFile) {
this.responsibilityRiskFile = responsibilityRiskFile;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@ -265,6 +275,7 @@ public class CompetePlayer implements Serializable {
sb.append(", healthRecordFile=").append(healthRecordFile);
sb.append(", insuranceRecordFile=").append(insuranceRecordFile);
sb.append(", groupRemark=").append(groupRemark);
sb.append(", responsibilityRiskFile=").append(responsibilityRiskFile);
sb.append("]");
return sb.toString();
}

60
mt/src/main/java/com/ccsens/mt/bean/po/CompetePlayerExample.java

@ -1544,6 +1544,66 @@ public class CompetePlayerExample {
addCriterion("group_remark not between", value1, value2, "groupRemark");
return (Criteria) this;
}
public Criteria andResponsibilityRiskFileIsNull() {
addCriterion("responsibility_risk_file is null");
return (Criteria) this;
}
public Criteria andResponsibilityRiskFileIsNotNull() {
addCriterion("responsibility_risk_file is not null");
return (Criteria) this;
}
public Criteria andResponsibilityRiskFileEqualTo(Long value) {
addCriterion("responsibility_risk_file =", value, "responsibilityRiskFile");
return (Criteria) this;
}
public Criteria andResponsibilityRiskFileNotEqualTo(Long value) {
addCriterion("responsibility_risk_file <>", value, "responsibilityRiskFile");
return (Criteria) this;
}
public Criteria andResponsibilityRiskFileGreaterThan(Long value) {
addCriterion("responsibility_risk_file >", value, "responsibilityRiskFile");
return (Criteria) this;
}
public Criteria andResponsibilityRiskFileGreaterThanOrEqualTo(Long value) {
addCriterion("responsibility_risk_file >=", value, "responsibilityRiskFile");
return (Criteria) this;
}
public Criteria andResponsibilityRiskFileLessThan(Long value) {
addCriterion("responsibility_risk_file <", value, "responsibilityRiskFile");
return (Criteria) this;
}
public Criteria andResponsibilityRiskFileLessThanOrEqualTo(Long value) {
addCriterion("responsibility_risk_file <=", value, "responsibilityRiskFile");
return (Criteria) this;
}
public Criteria andResponsibilityRiskFileIn(List<Long> values) {
addCriterion("responsibility_risk_file in", values, "responsibilityRiskFile");
return (Criteria) this;
}
public Criteria andResponsibilityRiskFileNotIn(List<Long> values) {
addCriterion("responsibility_risk_file not in", values, "responsibilityRiskFile");
return (Criteria) this;
}
public Criteria andResponsibilityRiskFileBetween(Long value1, Long value2) {
addCriterion("responsibility_risk_file between", value1, value2, "responsibilityRiskFile");
return (Criteria) this;
}
public Criteria andResponsibilityRiskFileNotBetween(Long value1, Long value2) {
addCriterion("responsibility_risk_file not between", value1, value2, "responsibilityRiskFile");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

8
mt/src/main/java/com/ccsens/mt/bean/vo/ProvinceCompeteVo.java

@ -193,10 +193,10 @@ public class ProvinceCompeteVo {
private Long healthRecordId;
@ApiModelProperty("体检证明(浏览路径)")
private String healthRecord;
@ApiModelProperty("保险证明id")
private Long insuranceRecordId;
@ApiModelProperty("保险证明(浏览路径)")
private String insuranceRecord;
@ApiModelProperty("自愿参赛责任及风险告知书id")
private Long responsibilityRiskFileId;
@ApiModelProperty("自愿参赛责任及风险告知书(浏览路径)")
private String responsibilityRiskFile;
}

69
mt/src/main/java/com/ccsens/mt/service/ProvinceService.java

@ -2,6 +2,7 @@ package com.ccsens.mt.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Filter;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdcardUtil;
import cn.hutool.core.util.ObjectUtil;
@ -61,6 +62,9 @@ public class ProvinceService implements IProvinceService {
private CompetePlayerMapper competePlayerMapper;
@Resource
private CompeteGroupMapper competeGroupMapper;
@Resource
private CompeteProjectGroupMapper projectGroupMapper;
/**
* 查找当前用户填写的信息的概览
@ -87,7 +91,22 @@ public class ProvinceService implements IProvinceService {
if(ObjectUtil.isNotNull(company)){
type = company.getType();
}
return competeCompanyDao.queryPlayerByGroupId(type,param.getCompanyId(),param.getGroupId(),param.getProjectId());
List<ProvinceCompeteVo.GroupAndPlayer> groupAndPlayerList = competeCompanyDao.queryPlayerByGroupId(type,param.getCompanyId(),param.getGroupId(),param.getProjectId());
if(CollectionUtil.isNotEmpty(groupAndPlayerList) && ObjectUtil.isNotNull(param.getProjectId())){
//如果查出来的列表不为空,且项目id也不为空,查找哪些组别不可报名该项目
CompeteProjectGroupExample projectGroupExample = new CompeteProjectGroupExample();
projectGroupExample.createCriteria().andProjectIdEqualTo(param.getProjectId());
List<CompeteProjectGroup> projectGroupList = projectGroupMapper.selectByExample(projectGroupExample);
if(CollectionUtil.isNotEmpty(projectGroupList)){
List<ProvinceCompeteVo.GroupAndPlayer> groupAndPlayers = groupAndPlayerList;
for(CompeteProjectGroup projectGroup : projectGroupList){
//将不可报名的组别删掉
groupAndPlayers = CollectionUtil.filter(groupAndPlayers, (Filter<ProvinceCompeteVo.GroupAndPlayer>) aa -> !aa.getGroupId().equals(projectGroup.getGroupId()));
}
return groupAndPlayers;
}
}
return groupAndPlayerList;
}
@ -180,7 +199,7 @@ public class ProvinceService implements IProvinceService {
if(ObjectUtil.isNull(param.getIdPhone())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY.mtMsgPhoto("证件照")); }
if(ObjectUtil.isNull(param.getStudentRecord())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY.mtMsgPhoto("学籍证明")); }
if(ObjectUtil.isNull(param.getHealthRecord())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY.mtMsgPhoto("健康证明")); }
if(ObjectUtil.isNull(param.getInsuranceRecord())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY.mtMsgPhoto("保险证明")); }
// if(ObjectUtil.isNull(param.getInsuranceRecord())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY.mtMsgPhoto("保险证明")); }
player.setGender((byte) param.getGender());
player.setIdCard(param.getIdCard());
player.setCompanyId(param.getCompeteId());
@ -192,6 +211,7 @@ public class ProvinceService implements IProvinceService {
player.setStudentRecordFile(param.getStudentRecord());
player.setHealthRecordFile(param.getHealthRecord());
player.setInsuranceRecordFile(param.getInsuranceRecord());
player.setResponsibilityRiskFile(param.getResponsibilityRiskFile());
competePlayerDao.insertSelective(player);
log.info("新加参赛选手:{}",player);
}else {
@ -252,7 +272,8 @@ public class ProvinceService implements IProvinceService {
if(ObjectUtil.isNotNull(param.getIdPhone())){player.setIdPhotoFile(param.getIdPhone());}
if(ObjectUtil.isNotNull(param.getStudentRecord())){player.setStudentRecordFile(param.getStudentRecord());}
if(ObjectUtil.isNotNull(param.getHealthRecord())){player.setHealthRecordFile(param.getHealthRecord());}
if(ObjectUtil.isNotNull(param.getInsuranceRecord())){player.setInsuranceRecordFile(param.getInsuranceRecord());}
// if(ObjectUtil.isNotNull(param.getInsuranceRecord())){player.setInsuranceRecordFile(param.getInsuranceRecord());}
if(ObjectUtil.isNotNull(param.getResponsibilityRiskFile())){player.setResponsibilityRiskFile(param.getResponsibilityRiskFile());}
competePlayerDao.updateByPrimaryKeySelective(player);
}
}
@ -289,7 +310,12 @@ public class ProvinceService implements IProvinceService {
Long companyid = param.getCompanyId();
CompeteCompany competeCompany = new CompeteCompany();
//单位id为空,新增
if (ObjectUtil.isNull(companyid)){
if (ObjectUtil.isNull(companyid) || companyid == 0L){
int type = 0;
CompeteTime competeTime = competeTimeDao.selectByPrimaryKey(param.getCompeteTimeId());
if(ObjectUtil.isNotNull(competeTime)){
type = competeTime.getType();
}
//检查当前用户是否已经添加过单位,有的话直接返回
CompeteCompanyExample companyExample = new CompeteCompanyExample();
companyExample.createCriteria().andUserIdEqualTo(userId).andCompeteTimeIdEqualTo(param.getCompeteTimeId());
@ -315,6 +341,7 @@ public class ProvinceService implements IProvinceService {
competeCompany.setJoinNum(param.getPlayerNum());
competeCompany.setUserId(userId);
competeCompany.setCompeteTimeId(param.getCompeteTimeId());
competeCompany.setType((byte) type);
if (param.getAuthorization() != 1) {
throw new BaseException(CodeEnum.AUTHORIZATION_AGREE);
}
@ -475,11 +502,11 @@ public class ProvinceService implements IProvinceService {
CompeteCoachExample competeCoachExample = new CompeteCoachExample();
competeCoachExample.createCriteria().andCompanyIdEqualTo(param.getCompanyId()).andIdentityEqualTo((byte) param.getIdentity());
long count = competeCoachMapper.countByExample(competeCoachExample);
if (param.getIdentity() == 0 && count >= 2){
throw new BaseException(CodeEnum.COACH_NUM_FULL);
if (param.getIdentity() == 0 && count >= 1){
throw new BaseException(CodeEnum.LEADER_NUM_FULL);
}
if (param.getIdentity() == 1 && count >=3){
throw new BaseException(CodeEnum.LEADER_NUM_FULL);
throw new BaseException(CodeEnum.COACH_NUM_FULL);
}
//手机号不能为空,且正确
if(StrUtil.isEmpty(param.getPhone()) || !param.getPhone().matches(WebConstant.REGEX_PHONE)){
@ -496,7 +523,7 @@ public class ProvinceService implements IProvinceService {
}
//证件照判断
if (param.getIdentity() == 1 && ObjectUtil.isNull(param.getIdPhoto())){
if (ObjectUtil.isNull(param.getIdPhoto())){
throw new BaseException(CodeEnum.PHOTO_IS_EMPTY);
}
CompeteCoach competeCoach1 = new CompeteCoach();
@ -557,21 +584,21 @@ public class ProvinceService implements IProvinceService {
if (ObjectUtil.isNull(player)) {
throw new BaseException(CodeEnum.PARAM_ERROR);
}
//通级赛查找用户是否参加“30秒单摇”和“3分钟单摇”
if(competeProject.getCertificate() == 1){
CompeteProjectPlayerExample projectPlayerExample1 = new CompeteProjectPlayerExample();
projectPlayerExample1.createCriteria().andPlayerIdEqualTo(joinPlayer.getPlayerId())
.andProjectIdEqualTo(Constant.SINGLE_ROLL_30_S);
CompeteProjectPlayerExample projectPlayerExample2 = new CompeteProjectPlayerExample();
projectPlayerExample2.createCriteria().andPlayerIdEqualTo(joinPlayer.getPlayerId())
.andProjectIdEqualTo(Constant.SINGLE_ROLL_3_M);
if(projectPlayerMapper.countByExample(projectPlayerExample1) == 0 || projectPlayerMapper.countByExample(projectPlayerExample2) == 0){
throw new BaseException(CodeEnum.mtCertificate(player.getName()));
}
}
// //TODO 通级赛查找用户是否参加“30秒单摇”和“3分钟单摇”
// if(competeProject.getCertificate() == 1){
// CompeteProjectPlayerExample projectPlayerExample1 = new CompeteProjectPlayerExample();
// projectPlayerExample1.createCriteria().andPlayerIdEqualTo(joinPlayer.getPlayerId())
// .andProjectIdEqualTo(Constant.SINGLE_ROLL_30_S);
// CompeteProjectPlayerExample projectPlayerExample2 = new CompeteProjectPlayerExample();
// projectPlayerExample2.createCriteria().andPlayerIdEqualTo(joinPlayer.getPlayerId())
// .andProjectIdEqualTo(Constant.SINGLE_ROLL_3_M);
// if(projectPlayerMapper.countByExample(projectPlayerExample1) == 0 || projectPlayerMapper.countByExample(projectPlayerExample2) == 0){
// throw new BaseException(CodeEnum.mtCertificate(player.getName()));
// }
// }
//查找此公司此组别是否参加过这个项目
int num = competeCompanyDao.getNumByCompanyAndGroup(competeProject.getId(), player.getCompanyId(), player.getCompeteGroupId(), param.getCompeteTimeId());
if (num > 0) {
if (num >= 2) {
throw new BaseException(CodeEnum.JOIN_PROJECT_NUM_FULL.mtProjectMsg1("该项目该组别"));
}
//查找个人参赛数量是否符合(个人比赛3个)

4
mt/src/main/resources/application.yml

@ -1,6 +1,6 @@
spring:
profiles:
active: test
include: common, util-test
active: prod
include: common, util-prod

4
mt/src/main/resources/mapper_dao/CompetePlayerDao.xml

@ -209,8 +209,8 @@
(SELECT visit_location FROM t_common_file WHERE id = student_record_file) as studentRecord,
(SELECT id FROM t_common_file WHERE id = health_record_file) as healthRecordId,
(SELECT visit_location FROM t_common_file WHERE id = health_record_file) as healthRecord,
(SELECT id FROM t_common_file WHERE id = insurance_record_file) as insuranceRecordId,
(SELECT visit_location FROM t_common_file WHERE id = insurance_record_file) as insuranceRecord
(SELECT id FROM t_common_file WHERE id = responsibility_risk_file) as responsibilityRiskFileId,
(SELECT visit_location FROM t_common_file WHERE id = responsibility_risk_file) as responsibilityRiskFile
FROM
t_compete_player
WHERE

27
mt/src/main/resources/mapper_raw/CompetePlayerMapper.xml

@ -25,6 +25,7 @@
<result column="health_record_file" jdbcType="BIGINT" property="healthRecordFile" />
<result column="insurance_record_file" jdbcType="BIGINT" property="insuranceRecordFile" />
<result column="group_remark" jdbcType="TINYINT" property="groupRemark" />
<result column="responsibility_risk_file" jdbcType="BIGINT" property="responsibilityRiskFile" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -88,7 +89,7 @@
id, user_id, name, id_card, phone, gender, id_card_front, id_card_back, prove_img,
compete_group_id, company_id, authorization, created_at, updated_at, rec_status,
compete_time_id, id_card_front_file, id_card_back_file, id_photo_file, student_record_file,
health_record_file, insurance_record_file, group_remark
health_record_file, insurance_record_file, group_remark, responsibility_risk_file
</sql>
<select id="selectByExample" parameterType="com.ccsens.mt.bean.po.CompetePlayerExample" resultMap="BaseResultMap">
select
@ -128,7 +129,8 @@
created_at, updated_at, rec_status,
compete_time_id, id_card_front_file, id_card_back_file,
id_photo_file, student_record_file, health_record_file,
insurance_record_file, group_remark)
insurance_record_file, group_remark, responsibility_risk_file
)
values (#{id,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR},
#{idCard,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{gender,jdbcType=TINYINT},
#{idCardFront,jdbcType=VARCHAR}, #{idCardBack,jdbcType=VARCHAR}, #{proveImg,jdbcType=VARCHAR},
@ -136,7 +138,8 @@
#{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT},
#{competeTimeId,jdbcType=BIGINT}, #{idCardFrontFile,jdbcType=BIGINT}, #{idCardBackFile,jdbcType=BIGINT},
#{idPhotoFile,jdbcType=BIGINT}, #{studentRecordFile,jdbcType=BIGINT}, #{healthRecordFile,jdbcType=BIGINT},
#{insuranceRecordFile,jdbcType=BIGINT}, #{groupRemark,jdbcType=TINYINT})
#{insuranceRecordFile,jdbcType=BIGINT}, #{groupRemark,jdbcType=TINYINT}, #{responsibilityRiskFile,jdbcType=BIGINT}
)
</insert>
<insert id="insertSelective" parameterType="com.ccsens.mt.bean.po.CompetePlayer">
insert into t_compete_player
@ -210,6 +213,9 @@
<if test="groupRemark != null">
group_remark,
</if>
<if test="responsibilityRiskFile != null">
responsibility_risk_file,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -281,6 +287,9 @@
<if test="groupRemark != null">
#{groupRemark,jdbcType=TINYINT},
</if>
<if test="responsibilityRiskFile != null">
#{responsibilityRiskFile,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.ccsens.mt.bean.po.CompetePlayerExample" resultType="java.lang.Long">
@ -361,6 +370,9 @@
<if test="record.groupRemark != null">
group_remark = #{record.groupRemark,jdbcType=TINYINT},
</if>
<if test="record.responsibilityRiskFile != null">
responsibility_risk_file = #{record.responsibilityRiskFile,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -390,7 +402,8 @@
student_record_file = #{record.studentRecordFile,jdbcType=BIGINT},
health_record_file = #{record.healthRecordFile,jdbcType=BIGINT},
insurance_record_file = #{record.insuranceRecordFile,jdbcType=BIGINT},
group_remark = #{record.groupRemark,jdbcType=TINYINT}
group_remark = #{record.groupRemark,jdbcType=TINYINT},
responsibility_risk_file = #{record.responsibilityRiskFile,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -464,6 +477,9 @@
<if test="groupRemark != null">
group_remark = #{groupRemark,jdbcType=TINYINT},
</if>
<if test="responsibilityRiskFile != null">
responsibility_risk_file = #{responsibilityRiskFile,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
@ -490,7 +506,8 @@
student_record_file = #{studentRecordFile,jdbcType=BIGINT},
health_record_file = #{healthRecordFile,jdbcType=BIGINT},
insurance_record_file = #{insuranceRecordFile,jdbcType=BIGINT},
group_remark = #{groupRemark,jdbcType=TINYINT}
group_remark = #{groupRemark,jdbcType=TINYINT},
responsibility_risk_file = #{responsibilityRiskFile,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

4
tall/src/main/resources/application.yml

@ -1,5 +1,5 @@
spring:
profiles:
active: test
include: util-test,common
active: dev
include: util-dev,common

44
util/src/test/java/com/ccsens/util/OtherTest.java

@ -1,22 +1,18 @@
package com.ccsens.util;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Filter;
import cn.hutool.core.util.ImageUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.junit.Test;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import java.io.*;
import java.math.BigDecimal;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.*;
@ -204,4 +200,38 @@ public class OtherTest {
System.out.println(s);
}
@Test
public void test12(){
AA a1 = new AA(1,4);
AA a2 = new AA(2,3);
AA a3 = new AA(2,2);
AA a4 = new AA(4,1);
List<AA> aas = new ArrayList<>();
aas.add(a3);
aas.add(a4);
aas.add(a1);
aas.add(a2);
// for (Integer i : s){
// if(i == 1){
// s.remove(i);
// continue;
// }
// System.out.println(i);
// }
List<AA> filter = CollectionUtil.filter(aas, new Filter<AA>() {
@Override
public boolean accept(AA aa) {
return aa.getA() != 1;
}
});
System.out.println(aas);
System.out.println(filter);
}
}

Loading…
Cancel
Save