|
@@ -12,6 +12,7 @@ import com.ffii.tsms.modules.project.entity.projections.InvoiceSearchInfo |
|
|
import com.ffii.tsms.modules.project.web.models.AssignedProject |
|
|
import com.ffii.tsms.modules.project.web.models.AssignedProject |
|
|
import com.ffii.tsms.modules.project.web.models.MilestoneInfo |
|
|
import com.ffii.tsms.modules.project.web.models.MilestoneInfo |
|
|
import com.ffii.tsms.modules.project.web.models.NewProjectRequest |
|
|
import com.ffii.tsms.modules.project.web.models.NewProjectRequest |
|
|
|
|
|
import com.ffii.tsms.modules.project.web.models.NewProjectResponse |
|
|
import org.springframework.stereotype.Service |
|
|
import org.springframework.stereotype.Service |
|
|
import org.springframework.transaction.annotation.Transactional |
|
|
import org.springframework.transaction.annotation.Transactional |
|
|
import java.time.LocalDate |
|
|
import java.time.LocalDate |
|
@@ -40,7 +41,7 @@ open class ProjectsService( |
|
|
private val projectTaskRepository: ProjectTaskRepository |
|
|
private val projectTaskRepository: ProjectTaskRepository |
|
|
) { |
|
|
) { |
|
|
open fun allProjects(): List<ProjectSearchInfo> { |
|
|
open fun allProjects(): List<ProjectSearchInfo> { |
|
|
return projectRepository.findProjectSearchInfoBy() |
|
|
|
|
|
|
|
|
return projectRepository.findProjectSearchInfoByOrderByCreatedDesc() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
open fun allInvoices(): List<InvoiceSearchInfo> { |
|
|
open fun allInvoices(): List<InvoiceSearchInfo> { |
|
@@ -87,7 +88,7 @@ open class ProjectsService( |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Transactional |
|
|
@Transactional |
|
|
open fun saveProject(request: NewProjectRequest): Project { |
|
|
|
|
|
|
|
|
open fun saveProject(request: NewProjectRequest): NewProjectResponse { |
|
|
val projectCategory = |
|
|
val projectCategory = |
|
|
projectCategoryRepository.findById(request.projectCategoryId).orElseThrow() |
|
|
projectCategoryRepository.findById(request.projectCategoryId).orElseThrow() |
|
|
val fundingType = fundingTypeRepository.findById(request.fundingTypeId).orElseThrow() |
|
|
val fundingType = fundingTypeRepository.findById(request.fundingTypeId).orElseThrow() |
|
@@ -184,7 +185,16 @@ open class ProjectsService( |
|
|
} } |
|
|
} } |
|
|
staffAllocationRepository.saveAll(staffAllocations) |
|
|
staffAllocationRepository.saveAll(staffAllocations) |
|
|
|
|
|
|
|
|
return savedProject |
|
|
|
|
|
|
|
|
return savedProject.let { |
|
|
|
|
|
NewProjectResponse( |
|
|
|
|
|
id = it.id, |
|
|
|
|
|
code = it.code, |
|
|
|
|
|
name = it.name, |
|
|
|
|
|
client = it.customer?.name, |
|
|
|
|
|
category = it.projectCategory?.name, |
|
|
|
|
|
team = it.teamLead?.team?.code |
|
|
|
|
|
) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
open fun allFundingTypes(): List<FundingType> { |
|
|
open fun allFundingTypes(): List<FundingType> { |
|
|