活动二次修整

This commit is contained in:
chuyan 2020-02-14 15:07:12 +08:00 committed by yourtree
parent 9cc8f77c4e
commit 6943b7425b
6 changed files with 216 additions and 83 deletions

View File

@ -107,6 +107,12 @@
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.10</version>
</dependency>
</dependencies>
<build>

View File

@ -0,0 +1,174 @@
package com.codesdream.ase.model.activity;
import com.codesdream.ase.model.permission.User;
import lombok.Data;
import org.dom4j.QName;
import org.hibernate.annotations.CollectionId;
import org.hibernate.annotations.WhereJoinTable;
import org.springframework.context.annotation.EnableMBeanExport;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.Set;
@Data
@Entity
@Table(name = "activity",
indexes = {
@Index(name = "act_index1", columnList = "title", unique = true),
@Index(name = "act_index2", columnList = "creator")
}
)
public class Activity {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
//活动标题
@Column(nullable = false, unique = true)
private String title;
//创建人
@Column(nullable = false)
private String creator;
//活动类型1qa
@Column(nullable = false)
private String type;
//活动描述
@Column(nullable = true)
private String description;
//自愿参与人列表
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name = "act_volunteer")
private Set<User> volunteers;
//参与人列表
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name = "act_participate",
joinColumns = {
@JoinColumn(name = "act_id")
},
inverseJoinColumns = {
@JoinColumn(name = "participate_id")
}
)
private Set<User> participateGroup;
//实际参与人列表
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name = "act_participated",
joinColumns = {
@JoinColumn(name = "act_id" )
},
inverseJoinColumns = {
@JoinColumn(name = "participated_id")
}
)
private Set<User> participatedGroup;
//可报名人员列表
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name = "act_sign",
joinColumns = {
@JoinColumn(name = "act_id")
},
inverseJoinColumns = {
@JoinColumn(name = "sign_id")
}
)
private Set<User> signGroup;
//已报名人员列表
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name = "act_signed",
joinColumns = {
@JoinColumn(name = "act_id")
},
inverseJoinColumns = {
@JoinColumn(name = "signed_id")
}
)
private Set<User> signedGroup;
//可见人员人员列表
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name = "act_vis",
joinColumns = {
@JoinColumn(name = "act_id")
},
inverseJoinColumns = {
@JoinColumn(name = "vis_id")
}
)
private Set<User> visibleGroup;
//通知人员列表
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name = "act_inform",
joinColumns = {
@JoinColumn(name = "act_id")
},
inverseJoinColumns = {
@JoinColumn(name = "inform_id")
}
)
private Set<User> informGroup;
//已通知人员列表
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name = "act_informed",
joinColumns = {
@JoinColumn(name = "act_id")
},
inverseJoinColumns = {
@JoinColumn(name = "informed_id")
}
)
private Set<User> informedGroup;
//计划开始时间
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "plan_period")
private Period planPeriod;
//实际开始时间
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "real_period")
private Period realPeriod;
//提前提醒时间
@Column(name = "remind_time", nullable = true)
private Date remindTime;
//附件组
@ElementCollection(targetClass = java.lang.String.class)
private List<String> enclosures;
//主要负责人
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "chief_manager", nullable = false)
private User chiefManager;
//次要负责人
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "act_id")
private List<User> assistManagers;
//是否开始
@JoinColumn(name = "is_on", nullable = false)
boolean isOn;
//是否结束
@JoinColumn(name = "is_off", nullable = false)
boolean isOff;
//考勤安排
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "attendance")
private Attendance attendance;
}

View File

@ -0,0 +1,34 @@
package com.codesdream.ase.model.activity;
import lombok.Data;
import javax.persistence.*;
import java.util.List;
import java.util.Set;
@Data
@Entity
@Table(name = "attendance")
public class Attendance {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
//二维码url
@Column(name = "qr_code", nullable = false, unique = true)
private String qrCode;
//是否在线
@Column(name = "is_online", nullable = false)
private boolean isOnline;
//打卡时段列表
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "attendance")
@JoinColumn(name = "a_id")
private Set<Period> clockInPeriods;
//打卡方式0表示被扫1表示扫
@Column(nullable = false)
private boolean means;
}

View File

@ -1,4 +1,4 @@
package com.codesdream.ase.model.permission;
package com.codesdream.ase.model.activity;
import lombok.Data;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
@ -23,14 +23,8 @@ public class Period {
@Column(name = "end_time", nullable = false)
private Date endTime;
//启用状
//启用状
@Column(name = "enabled", nullable = false)
private boolean enabled;
public Period(Date startTime, Date endTime, boolean enabled) {
this.startTime = startTime;
this.endTime = endTime;
this.enabled = enabled;
}
}

View File

@ -1,74 +0,0 @@
package com.codesdream.ase.model.permission;
import jdk.jfr.DataAmount;
import lombok.Data;
import org.hibernate.annotations.Cascade;
import sun.security.x509.DNSName;
import javax.persistence.*;
import java.util.Set;
@Entity
@Table(name = "activity_container")
@Data
public class Activity {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
//活动标题
@Column(nullable = false)
private String title;
//创建人
@Column(nullable = false)
private String creator;
//活动类型1qa
@Column(nullable = false)
private String type;
//活动描述
@Column(nullable = true)
private String description;
//自愿参与人列表
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name = "act_volunteer")
private Set<User> volunteers;
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name = "act_participate", joinColumns = {
@JoinColumn(name = "act_id")
})
private Set<User> participateGroup;
private Set<User> participatedGroup;
private Set<User> signGroup;
private Set<User> signedGroup;
private Set<User> visibleGroup;
private Set<User> informGroup;
private Set<User> informedGroup;
private Period planPeriod;
private Period realPe
/*
participated_group list<long>
sign_group list<long>
signed_group list<long>
visible_group list<long>
inform_group list<long>
informed_group list<long>
plan_t_id long
real_t_id long
remind_time string
enclosure_id list<long>
chief_manager long
assist_manager list<long>
is_on bool
is_finished bool
c_id long
*/
}

View File

@ -1,7 +1,6 @@
package com.codesdream.ase.model.permission;
import javax.persistence.*;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;