Export csv data
This commit is contained in:
@ -1,10 +1,12 @@
|
||||
package com.plannaplan.services;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.plannaplan.entities.Commision;
|
||||
import com.plannaplan.entities.User;
|
||||
import com.plannaplan.models.ExportData;
|
||||
import com.plannaplan.repositories.AssignmentRepository;
|
||||
import com.plannaplan.repositories.CommisionRepository;
|
||||
|
||||
@ -22,6 +24,8 @@ public class CommisionService {
|
||||
private CommisionRepository repo;
|
||||
@Autowired
|
||||
private AssignmentRepository aRepository;
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
public CommisionService() {
|
||||
}
|
||||
@ -77,4 +81,21 @@ public class CommisionService {
|
||||
public long getCommisionsAmmount() {
|
||||
return this.repo.count();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list of ExportData inmstancces keeping data to exprt to file
|
||||
*/
|
||||
public List<ExportData> getExportData() {
|
||||
final List<ExportData> response = new ArrayList<>();
|
||||
|
||||
this.userService.getAllStudents().forEach(student -> {
|
||||
student.getStudentRegisteredGrups().forEach(group -> {
|
||||
response.add(new ExportData(student.getUsosId(), Integer.toString(group.getZajCykId()),
|
||||
Integer.toString(group.getGrNr())));
|
||||
});
|
||||
});
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user