Browse Source

йй

master
esoe 2 years ago
parent
commit
f605bd414d
  1. BIN
      reports/report.xlsx
  2. 9
      src/main/java/ru/egspt/ReportTableModel.java
  3. 60
      src/main/java/ru/egspt/implant/ExtendedUser.java
  4. 60
      src/main/java/ru/egspt/implant/Implant.java
  5. 39
      src/main/java/ru/egspt/implant/Runner.java
  6. BIN
      target/classes/ru/egspt/ReportTableModel.class
  7. BIN
      target/classes/ru/egspt/implant/ExtendedUser$ExtendedUserBuilder.class
  8. BIN
      target/classes/ru/egspt/implant/ExtendedUser.class
  9. BIN
      target/classes/ru/egspt/implant/Implant.class
  10. BIN
      target/classes/ru/egspt/implant/Runner.class
  11. BIN
      target/moodle-anyreport-0.1-jar-with-dependencies.jar
  12. BIN
      target/moodle-anyreport-0.1.jar

BIN
reports/report.xlsx

Binary file not shown.

9
src/main/java/ru/egspt/ReportTableModel.java

@ -297,18 +297,9 @@ public class ReportTableModel extends AbstractTableModel{ @@ -297,18 +297,9 @@ public class ReportTableModel extends AbstractTableModel{
while (i < height){
if ((String)getData()[i][1] == row.getCell(0).getStringCellValue()){
//переписываем данные строки в модель
}
i++;
}
book.close();
}
}

60
src/main/java/ru/egspt/implant/ExtendedUser.java

@ -0,0 +1,60 @@ @@ -0,0 +1,60 @@
package ru.egspt.implant;
public class ExtendedUser {
private String fullname;
private String position;
private String psk;
private String username;
/**
* Основной конструктор полей расширенного пользователя
* @param builder
*/
private ExtendedUser(ExtendedUserBuilder builder){
fullname = builder.fullname;
position = builder.position;
psk = builder.psk;
username = builder.username;
}
/**
* Класс-строитель объектов ExtendedUser
*/
public static class ExtendedUserBuilder{
private String fullname;
private String position;
private String psk;
private String username;
/**
* Основной конструктор класса с обязательным полем username
* @param username
*/
public ExtendedUserBuilder(String username){
this.username = username;
}
/**
* @param fullname the fullname to set
*/
public ExtendedUserBuilder setFullname(String fullname) {
this.fullname = fullname;
return this;
}
/**
* @param position the position to set
*/
public ExtendedUserBuilder setPosition(String position) {
this.position = position;
return this;
}
/**
* @param psk the psk to set
*/
public ExtendedUserBuilder setPsk(String psk) {
this.psk = psk;
return this;
}
public ExtendedUser build(){
return new ExtendedUser(this);
}
}
}

60
src/main/java/ru/egspt/implant/Implant.java

@ -0,0 +1,60 @@ @@ -0,0 +1,60 @@
package ru.egspt.implant;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import ru.egspt.implant.ExtendedUser.ExtendedUserBuilder;
/**
* Данные из файлов excel, для консолидации с data при формировании полного отчета
*/
public class Implant {
ArrayList<ExtendedUser> users = new ArrayList<>();
public Implant(File file){
// создание самого excel файла в памяти
try(FileInputStream fis = new FileInputStream(file)){
XSSFWorkbook book = new XSSFWorkbook(new FileInputStream(file));
XSSFSheet sheet = book.getSheetAt(0);
for (Row row : sheet) {
if (row.getRowNum() == 0){
continue; //строка заголовков
}
String username = row.getCell(0).getStringCellValue();
String fullname = row.getCell(1).getStringCellValue();
String position = row.getCell(2).getStringCellValue();
String psk = row.getCell(3).getStringCellValue();
ExtendedUser eu = new ExtendedUserBuilder(username)
.setFullname(fullname)
.setPosition(position)
.setPsk(psk)
.build();
users.add(eu);
}
book.close();
}catch(IOException e){
System.out.println("Путь к исходному файлу указан не верно!");
System.out.println(e.getMessage());
}
}
/**
* @param users the users to set
*/
public void setUsers(ArrayList<ExtendedUser> users) {
this.users = users;
}
/**
* @return the users
*/
public ArrayList<ExtendedUser> getUsers() {
return users;
}
}

39
src/main/java/ru/egspt/implant/Runner.java

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
package ru.egspt.implant;
import java.util.ArrayList;
import ru.egspt.Base;
import ru.egspt.Data;
import ru.egspt.Quiz;
import ru.egspt.Result;
import ru.egspt.User;
public class Runner {
private Base base;
private Data data;
/**
* @param base the base to set
*/
public void setBase(Base base) {
this.base = base;
}
/**
* @return the base
*/
public Base getBase() {
return base;
}
public static void main(String[] args) {
Runner r = new Runner();
r.base = new Base("www.egspt.ru", "esoe", "psalm6912");
r.base.connect();
r.data = new Data();
ArrayList<Quiz> quizes = r.data.getQuizesFromBase(r.base);
ArrayList<Result> results = r.data.getResultsFromBase(r.base);
ArrayList<User> users = r.data.getUsersFromBase(r.base);
}
}

BIN
target/classes/ru/egspt/ReportTableModel.class

Binary file not shown.

BIN
target/classes/ru/egspt/implant/ExtendedUser$ExtendedUserBuilder.class

Binary file not shown.

BIN
target/classes/ru/egspt/implant/ExtendedUser.class

Binary file not shown.

BIN
target/classes/ru/egspt/implant/Implant.class

Binary file not shown.

BIN
target/classes/ru/egspt/implant/Runner.class

Binary file not shown.

BIN
target/moodle-anyreport-0.1-jar-with-dependencies.jar

Binary file not shown.

BIN
target/moodle-anyreport-0.1.jar

Binary file not shown.
Loading…
Cancel
Save