|
|
@@ -7,12 +7,10 @@ import com.ffii.tsms.modules.project.entity.projections.ProjectSearchInfo |
|
|
|
import com.ffii.tsms.modules.data.service.CustomerService |
|
|
|
import com.ffii.tsms.modules.data.service.GradeService |
|
|
|
import com.ffii.tsms.modules.project.entity.* |
|
|
|
import com.ffii.tsms.modules.project.entity.Milestone |
|
|
|
import com.ffii.tsms.modules.project.entity.projections.InvoiceInfoSearchInfo |
|
|
|
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.MilestoneInfo |
|
|
|
import com.ffii.tsms.modules.project.web.models.NewProjectRequest |
|
|
|
import com.ffii.tsms.modules.project.web.models.NewProjectResponse |
|
|
|
import com.ffii.tsms.modules.project.web.models.* |
|
|
|
import org.springframework.stereotype.Service |
|
|
|
import org.springframework.transaction.annotation.Transactional |
|
|
|
import java.time.LocalDate |
|
|
@@ -197,6 +195,37 @@ open class ProjectsService( |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
open fun getProjectDetails(projectId: Long): EditProjectDetails? { |
|
|
|
val project = projectRepository.findById(projectId) |
|
|
|
|
|
|
|
return project.getOrNull()?.let { |
|
|
|
val customerContact = it.customer?.id?.let { customerId -> customerContactService.findAllByCustomerId(customerId) } ?: emptyList() |
|
|
|
|
|
|
|
EditProjectDetails( |
|
|
|
projectCode = it.code, |
|
|
|
projectName = it.name, |
|
|
|
projectCategoryId = it.projectCategory?.id, |
|
|
|
projectDescription = it.description, |
|
|
|
projectLeadId = it.teamLead?.id, |
|
|
|
serviceTypeId = it.serviceType?.id, |
|
|
|
fundingTypeId = it.fundingType?.id, |
|
|
|
contractTypeId = it.contractType?.id, |
|
|
|
locationId = it.location?.id, |
|
|
|
buildingTypeIds = it.buildingTypes.mapNotNull { buildingType -> buildingType.id }, |
|
|
|
workNatureIds = it.workNatures.mapNotNull { workNature -> workNature.id }, |
|
|
|
clientId = it.customer?.id, |
|
|
|
clientContactId = customerContact.find { contact -> contact.name == it.custLeadName }?.id, |
|
|
|
clientSubsidiaryId = it.customerSubsidiary?.id, |
|
|
|
totalManhour = it.totalManhour, |
|
|
|
manhourPercentageByGrade = emptyMap(), |
|
|
|
taskGroups = emptyMap(), |
|
|
|
allocatedStaffIds = emptyList(), |
|
|
|
milestones = emptyMap(), |
|
|
|
expectedProjectFee = it.expectedTotalFee |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
open fun allFundingTypes(): List<FundingType> { |
|
|
|
return fundingTypeRepository.findAll() |
|
|
|
} |
|
|
|