|
@@ -1,7 +1,7 @@
|
|
package com.yaoxiang.planning.service
|
|
package com.yaoxiang.planning.service
|
|
|
|
|
|
import com.yaoxiang.planning.domain.QuarterlyPlan
|
|
import com.yaoxiang.planning.domain.QuarterlyPlan
|
|
-import com.yaoxiang.planning.model.PlanType
|
|
|
|
|
|
+import com.yaoxiang.planning.model.PlanningType
|
|
import com.yaoxiang.planning.repository.QuarterlyPlanRepo
|
|
import com.yaoxiang.planning.repository.QuarterlyPlanRepo
|
|
import org.springframework.beans.factory.annotation.Autowired
|
|
import org.springframework.beans.factory.annotation.Autowired
|
|
import org.springframework.stereotype.Service
|
|
import org.springframework.stereotype.Service
|
|
@@ -16,22 +16,34 @@ class QuarterlyPlanService {
|
|
@Autowired
|
|
@Autowired
|
|
private lateinit var planningService: PlanningService
|
|
private lateinit var planningService: PlanningService
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private lateinit var departmentService: DepartmentService
|
|
|
|
+
|
|
|
|
|
|
- fun add(name: String, content: String, year: Int, quarter: Int,departmentId:Long?): Boolean {
|
|
|
|
|
|
+ fun add(name: String, content: String, year: Int, quarter: Int, departmentId: Long?): Boolean {
|
|
if (exists(year, quarter)) {
|
|
if (exists(year, quarter)) {
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
val planning = QuarterlyPlan()
|
|
val planning = QuarterlyPlan()
|
|
planning.quarter = quarter
|
|
planning.quarter = quarter
|
|
- planning.type = PlanType.QUARTERLY.ordinal
|
|
|
|
|
|
+ planning.type = PlanningType.QUARTERLY.ordinal
|
|
planning.startTime = Date()
|
|
planning.startTime = Date()
|
|
planning.endTime = Date()
|
|
planning.endTime = Date()
|
|
planning.departmentId = departmentId
|
|
planning.departmentId = departmentId
|
|
|
|
+ planning.departmentName = departmentService.getName(departmentId)
|
|
planningService.add(name, content, year, planning)
|
|
planningService.add(name, content, year, planning)
|
|
return true
|
|
return true
|
|
}
|
|
}
|
|
|
|
|
|
- fun update(id: Long, name: String, content: String, year: Int, quarter: Int, status: Int,departmentId: Long?): Boolean {
|
|
|
|
|
|
+ fun update(
|
|
|
|
+ id: Long,
|
|
|
|
+ name: String,
|
|
|
|
+ content: String,
|
|
|
|
+ year: Int,
|
|
|
|
+ quarter: Int,
|
|
|
|
+ status: Int,
|
|
|
|
+ departmentId: Long?
|
|
|
|
+ ): Boolean {
|
|
val optional = get(id)
|
|
val optional = get(id)
|
|
if (!optional.isPresent) {
|
|
if (!optional.isPresent) {
|
|
return false
|
|
return false
|
|
@@ -43,6 +55,7 @@ class QuarterlyPlanService {
|
|
planning.quarter = quarter
|
|
planning.quarter = quarter
|
|
planning.status = status
|
|
planning.status = status
|
|
planning.departmentId = departmentId
|
|
planning.departmentId = departmentId
|
|
|
|
+ planning.departmentName = departmentService.getName(departmentId)
|
|
quarterlyPlanRepo.save(planning)
|
|
quarterlyPlanRepo.save(planning)
|
|
return true
|
|
return true
|
|
}
|
|
}
|
|
@@ -69,11 +82,22 @@ class QuarterlyPlanService {
|
|
return true
|
|
return true
|
|
}
|
|
}
|
|
|
|
|
|
- fun list(year: Int,departmentId: Long?): List<QuarterlyPlan> {
|
|
|
|
- if(departmentId == null){
|
|
|
|
|
|
+ fun list(year: Int, departmentId: Long?): List<QuarterlyPlan> {
|
|
|
|
+ if (departmentId == null) {
|
|
return quarterlyPlanRepo.findByYear(year)
|
|
return quarterlyPlanRepo.findByYear(year)
|
|
}
|
|
}
|
|
- return quarterlyPlanRepo.findByYearAndDepartmentId(year,departmentId!!)
|
|
|
|
|
|
+ return quarterlyPlanRepo.findByYearAndDepartmentId(year, departmentId)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fun evaluate(id: Long, evaluation: String): Boolean {
|
|
|
|
+ val optional = get(id)
|
|
|
|
+ if (optional.isPresent) {
|
|
|
|
+ val plan = optional.get()
|
|
|
|
+ plan.evaluation = evaluation
|
|
|
|
+ quarterlyPlanRepo.save(plan)
|
|
|
|
+ return true
|
|
|
|
+ }
|
|
|
|
+ return false
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|