2020-06-09 18:14:49 +02:00
|
|
|
package com.plannaplan;
|
|
|
|
|
2020-12-05 16:28:02 +01:00
|
|
|
import java.io.InputStream;
|
2020-12-09 16:43:29 +01:00
|
|
|
import java.sql.Date;
|
2020-12-05 16:28:02 +01:00
|
|
|
|
|
|
|
import com.plannaplan.models.ConfigData;
|
2020-12-09 16:43:29 +01:00
|
|
|
import com.plannaplan.models.TourData;
|
2020-09-14 12:39:25 +02:00
|
|
|
import com.plannaplan.entities.User;
|
|
|
|
import com.plannaplan.services.UserService;
|
|
|
|
import com.plannaplan.types.UserRoles;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
2020-12-05 16:28:02 +01:00
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
2020-06-09 18:14:49 +02:00
|
|
|
import org.springframework.boot.SpringApplication;
|
|
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
2020-09-14 12:39:25 +02:00
|
|
|
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
2020-11-04 15:06:24 +01:00
|
|
|
|
2020-11-04 15:09:44 +01:00
|
|
|
import org.springframework.context.event.EventListener;
|
2020-12-05 16:28:02 +01:00
|
|
|
import com.plannaplan.services.ConfiguratorService;
|
2020-06-09 18:14:49 +02:00
|
|
|
|
|
|
|
@SpringBootApplication
|
|
|
|
public class App {
|
2020-06-10 10:53:22 +02:00
|
|
|
|
2020-10-01 16:46:45 +02:00
|
|
|
public final static String API_VERSION = "v1";
|
|
|
|
|
2020-12-05 16:28:02 +01:00
|
|
|
@Autowired
|
|
|
|
private ConfiguratorService contrl;
|
|
|
|
|
2020-10-01 16:46:45 +02:00
|
|
|
@Autowired
|
|
|
|
UserService userService;
|
|
|
|
|
2020-12-05 16:28:02 +01:00
|
|
|
@Value("${plannaplan.dev}")
|
|
|
|
private boolean isDev;
|
|
|
|
|
2020-10-01 16:46:45 +02:00
|
|
|
public static void main(String[] args) {
|
|
|
|
Logo logo = new Logo("beta");
|
|
|
|
System.out.println(logo.getLogo());
|
|
|
|
System.out.println(
|
|
|
|
"|=============================================================================================|");
|
|
|
|
SpringApplication.run(App.class, args);
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventListener(ApplicationReadyEvent.class)
|
|
|
|
public void importData() {
|
2020-12-05 16:28:02 +01:00
|
|
|
System.out.println(Logo.getInitInfo(isDev));
|
|
|
|
|
|
|
|
if (this.isDev) {
|
|
|
|
InputStream inputStream = getClass().getClassLoader().getResourceAsStream("Zajecia.xlsx");
|
2020-12-09 16:43:29 +01:00
|
|
|
ConfigData data = new ConfigData(
|
|
|
|
new TourData(new Date(System.currentTimeMillis()),
|
|
|
|
new Date(System.currentTimeMillis())),
|
|
|
|
new TourData(new Date(System.currentTimeMillis()),
|
|
|
|
new Date(System.currentTimeMillis())),
|
|
|
|
inputStream);
|
2020-12-05 16:28:02 +01:00
|
|
|
this.contrl.config(data);
|
|
|
|
|
|
|
|
User newuser = new User();
|
|
|
|
newuser.setEmail("tommy@st.amu.edu.pl");
|
|
|
|
newuser.setName("Tomek");
|
|
|
|
newuser.setSurname("Atomek");
|
|
|
|
newuser.setRole(UserRoles.STUDENT);
|
|
|
|
this.userService.save(newuser);
|
|
|
|
|
|
|
|
newuser = new User();
|
|
|
|
newuser.setEmail("robercik@st.amu.edu.pl");
|
|
|
|
newuser.setName("Robert");
|
|
|
|
newuser.setSurname("Głowacki");
|
|
|
|
newuser.setRole(UserRoles.STUDENT);
|
|
|
|
this.userService.save(newuser);
|
|
|
|
|
|
|
|
newuser = new User();
|
|
|
|
newuser.setEmail("mewa@st.amu.edu.pl");
|
|
|
|
newuser.setName("Poznanska");
|
|
|
|
newuser.setSurname("Mewa");
|
|
|
|
newuser.setRole(UserRoles.STUDENT);
|
|
|
|
this.userService.save(newuser);
|
|
|
|
|
|
|
|
newuser = new User();
|
|
|
|
newuser.setEmail("tkul2@st.amu.edu.pl");
|
|
|
|
newuser.setName("Tomasz");
|
|
|
|
newuser.setSurname("Kula");
|
|
|
|
newuser.setRole(UserRoles.STUDENT);
|
|
|
|
this.userService.save(newuser);
|
|
|
|
|
|
|
|
newuser = new User();
|
|
|
|
newuser.setEmail("annana@st.amu.edu.pl");
|
|
|
|
newuser.setName("Anna");
|
|
|
|
newuser.setSurname("Na");
|
|
|
|
newuser.setRole(UserRoles.STUDENT);
|
|
|
|
this.userService.save(newuser);
|
|
|
|
|
|
|
|
newuser = new User();
|
|
|
|
newuser.setEmail("mnart@st.amu.edu.pl");
|
|
|
|
newuser.setName("Marta");
|
|
|
|
newuser.setSurname("Narta");
|
|
|
|
newuser.setRole(UserRoles.STUDENT);
|
|
|
|
this.userService.save(newuser);
|
|
|
|
|
|
|
|
newuser = new User();
|
|
|
|
newuser.setEmail("zmineniane@st.amu.edu.pl");
|
|
|
|
newuser.setName("Tutaj");
|
|
|
|
newuser.setSurname("Koncza");
|
|
|
|
newuser.setRole(UserRoles.STUDENT);
|
|
|
|
this.userService.save(newuser);
|
|
|
|
|
|
|
|
newuser = new User();
|
|
|
|
newuser.setEmail("mi@st.amu.edu.pl");
|
|
|
|
newuser.setName("Mi");
|
|
|
|
newuser.setSurname("Sie");
|
|
|
|
newuser.setRole(UserRoles.STUDENT);
|
|
|
|
this.userService.save(newuser);
|
|
|
|
|
|
|
|
newuser = new User();
|
|
|
|
newuser.setEmail("pms@st.amu.edu.pl");
|
|
|
|
newuser.setName("Pomysly");
|
|
|
|
newuser.setSurname("Sad");
|
|
|
|
newuser.setRole(UserRoles.STUDENT);
|
|
|
|
this.userService.save(newuser);
|
|
|
|
}
|
|
|
|
|
|
|
|
System.out.println(Logo.getStartedInfo(isDev));
|
|
|
|
|
2020-10-01 16:46:45 +02:00
|
|
|
}
|
2020-06-09 18:14:49 +02:00
|
|
|
}
|