mirror of
https://github.com/hpd840321/craftlabs-authorization-sdk.git
synced 2026-06-09 10:00:30 +08:00
feat(m1): add planned start/end dates and project manager to projects
This commit is contained in:
+34
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.OffsetDateTime;
|
||||
|
||||
@TableName("platform_project")
|
||||
@@ -26,6 +27,15 @@ public class PlatformProject {
|
||||
@TableField("updated_at")
|
||||
private OffsetDateTime updatedAt;
|
||||
|
||||
@TableField("planned_start_date")
|
||||
private LocalDate plannedStartDate;
|
||||
|
||||
@TableField("planned_end_date")
|
||||
private LocalDate plannedEndDate;
|
||||
|
||||
@TableField("project_manager")
|
||||
private String projectManager;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -73,4 +83,28 @@ public class PlatformProject {
|
||||
public void setUpdatedAt(OffsetDateTime updatedAt) {
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
|
||||
public LocalDate getPlannedStartDate() {
|
||||
return plannedStartDate;
|
||||
}
|
||||
|
||||
public void setPlannedStartDate(LocalDate plannedStartDate) {
|
||||
this.plannedStartDate = plannedStartDate;
|
||||
}
|
||||
|
||||
public LocalDate getPlannedEndDate() {
|
||||
return plannedEndDate;
|
||||
}
|
||||
|
||||
public void setPlannedEndDate(LocalDate plannedEndDate) {
|
||||
this.plannedEndDate = plannedEndDate;
|
||||
}
|
||||
|
||||
public String getProjectManager() {
|
||||
return projectManager;
|
||||
}
|
||||
|
||||
public void setProjectManager(String projectManager) {
|
||||
this.projectManager = projectManager;
|
||||
}
|
||||
}
|
||||
|
||||
+10
@@ -14,6 +14,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.List;
|
||||
@@ -53,6 +54,9 @@ public class ProjectService {
|
||||
p.setCustomerId(request.getCustomerId());
|
||||
p.setName(request.getName().trim());
|
||||
p.setPhase(resolvePhase(request.getPhase()));
|
||||
if (request.getPlannedStartDate() != null) p.setPlannedStartDate(LocalDate.parse(request.getPlannedStartDate()));
|
||||
if (request.getPlannedEndDate() != null) p.setPlannedEndDate(LocalDate.parse(request.getPlannedEndDate()));
|
||||
if (request.getProjectManager() != null) p.setProjectManager(request.getProjectManager().trim());
|
||||
p.setCreatedAt(now);
|
||||
p.setUpdatedAt(now);
|
||||
projectMapper.insert(p);
|
||||
@@ -80,6 +84,9 @@ public class ProjectService {
|
||||
if (StringUtils.hasText(request.getPhase())) {
|
||||
p.setPhase(request.getPhase().trim());
|
||||
}
|
||||
if (request.getPlannedStartDate() != null) p.setPlannedStartDate(LocalDate.parse(request.getPlannedStartDate()));
|
||||
if (request.getPlannedEndDate() != null) p.setPlannedEndDate(LocalDate.parse(request.getPlannedEndDate()));
|
||||
if (request.getProjectManager() != null) p.setProjectManager(request.getProjectManager().trim());
|
||||
p.setUpdatedAt(OffsetDateTime.now(ZoneOffset.UTC));
|
||||
projectMapper.updateById(p);
|
||||
return toResponse(p);
|
||||
@@ -104,6 +111,9 @@ public class ProjectService {
|
||||
r.setCustomerId(p.getCustomerId());
|
||||
r.setName(p.getName());
|
||||
r.setPhase(p.getPhase());
|
||||
r.setPlannedStartDate(p.getPlannedStartDate() != null ? p.getPlannedStartDate().toString() : null);
|
||||
r.setPlannedEndDate(p.getPlannedEndDate() != null ? p.getPlannedEndDate().toString() : null);
|
||||
r.setProjectManager(p.getProjectManager());
|
||||
r.setCreatedAt(p.getCreatedAt());
|
||||
r.setUpdatedAt(p.getUpdatedAt());
|
||||
return r;
|
||||
|
||||
+31
@@ -16,6 +16,13 @@ public class ProjectRequest {
|
||||
@Size(max = 64)
|
||||
private String phase;
|
||||
|
||||
@Size(max = 128)
|
||||
private String projectManager;
|
||||
|
||||
private String plannedStartDate;
|
||||
|
||||
private String plannedEndDate;
|
||||
|
||||
public Long getCustomerId() {
|
||||
return customerId;
|
||||
}
|
||||
@@ -39,4 +46,28 @@ public class ProjectRequest {
|
||||
public void setPhase(String phase) {
|
||||
this.phase = phase;
|
||||
}
|
||||
|
||||
public String getProjectManager() {
|
||||
return projectManager;
|
||||
}
|
||||
|
||||
public void setProjectManager(String projectManager) {
|
||||
this.projectManager = projectManager;
|
||||
}
|
||||
|
||||
public String getPlannedStartDate() {
|
||||
return plannedStartDate;
|
||||
}
|
||||
|
||||
public void setPlannedStartDate(String plannedStartDate) {
|
||||
this.plannedStartDate = plannedStartDate;
|
||||
}
|
||||
|
||||
public String getPlannedEndDate() {
|
||||
return plannedEndDate;
|
||||
}
|
||||
|
||||
public void setPlannedEndDate(String plannedEndDate) {
|
||||
this.plannedEndDate = plannedEndDate;
|
||||
}
|
||||
}
|
||||
|
||||
+27
@@ -8,6 +8,9 @@ public class ProjectResponse {
|
||||
private Long customerId;
|
||||
private String name;
|
||||
private String phase;
|
||||
private String plannedStartDate;
|
||||
private String plannedEndDate;
|
||||
private String projectManager;
|
||||
private OffsetDateTime createdAt;
|
||||
private OffsetDateTime updatedAt;
|
||||
|
||||
@@ -43,6 +46,30 @@ public class ProjectResponse {
|
||||
this.phase = phase;
|
||||
}
|
||||
|
||||
public String getPlannedStartDate() {
|
||||
return plannedStartDate;
|
||||
}
|
||||
|
||||
public void setPlannedStartDate(String plannedStartDate) {
|
||||
this.plannedStartDate = plannedStartDate;
|
||||
}
|
||||
|
||||
public String getPlannedEndDate() {
|
||||
return plannedEndDate;
|
||||
}
|
||||
|
||||
public void setPlannedEndDate(String plannedEndDate) {
|
||||
this.plannedEndDate = plannedEndDate;
|
||||
}
|
||||
|
||||
public String getProjectManager() {
|
||||
return projectManager;
|
||||
}
|
||||
|
||||
public void setProjectManager(String projectManager) {
|
||||
this.projectManager = projectManager;
|
||||
}
|
||||
|
||||
public OffsetDateTime getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user