|
|
@@ -19,6 +19,7 @@ open class ProjectsService( |
|
|
|
private val customerService: CustomerService, |
|
|
|
private val tasksService: TasksService, |
|
|
|
private val customerContactService: CustomerContactService, |
|
|
|
private val subsidiaryService: SubsidiaryService, |
|
|
|
private val projectCategoryRepository: ProjectCategoryRepository, |
|
|
|
private val staffRepository: StaffRepository, |
|
|
|
private val staffAllocationRepository: StaffAllocationRepository, |
|
|
@@ -66,8 +67,10 @@ open class ProjectsService( |
|
|
|
val teamLead = staffRepository.findById(request.projectLeadId).orElseThrow() |
|
|
|
val customer = customerService.findCustomer(request.clientId) |
|
|
|
val clientContact = customerContactService.findByContactId(request.clientContactId) |
|
|
|
val customerSubsidiary = request.clientSubsidiaryId?.let { subsidiaryService.findSubsidiary(it) } |
|
|
|
|
|
|
|
val allTasksMap = tasksService.allTasks().associateBy { it.id } |
|
|
|
val taskGroupMap = tasksService.allTaskGroups().associateBy { it.id } |
|
|
|
|
|
|
|
val project = |
|
|
|
Project().apply { |
|
|
@@ -90,6 +93,7 @@ open class ProjectsService( |
|
|
|
custLeadName = clientContact.name |
|
|
|
custLeadEmail = clientContact.email |
|
|
|
custLeadPhone = clientContact.phone |
|
|
|
this.customerSubsidiary = customerSubsidiary |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@@ -100,8 +104,9 @@ open class ProjectsService( |
|
|
|
Milestone().apply { |
|
|
|
val newMilestone = this |
|
|
|
this.project = project |
|
|
|
this.startDate = LocalDate.parse(requestMilestone.startDate) |
|
|
|
this.endDate = LocalDate.parse(requestMilestone.endDate) |
|
|
|
this.taskGroup = taskGroupMap[taskStageId] |
|
|
|
this.startDate = requestMilestone.startDate?.let { LocalDate.parse(it) } |
|
|
|
this.endDate = requestMilestone.endDate?.let { LocalDate.parse(it) } |
|
|
|
this.milestonePayments = requestMilestone.payments.map { |
|
|
|
MilestonePayment().apply { |
|
|
|
this.description = it.description |
|
|
|