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.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.OffsetDateTime;
|
import java.time.OffsetDateTime;
|
||||||
|
|
||||||
@TableName("platform_project")
|
@TableName("platform_project")
|
||||||
@@ -26,6 +27,15 @@ public class PlatformProject {
|
|||||||
@TableField("updated_at")
|
@TableField("updated_at")
|
||||||
private OffsetDateTime updatedAt;
|
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() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -73,4 +83,28 @@ public class PlatformProject {
|
|||||||
public void setUpdatedAt(OffsetDateTime updatedAt) {
|
public void setUpdatedAt(OffsetDateTime updatedAt) {
|
||||||
this.updatedAt = 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.util.StringUtils;
|
||||||
import org.springframework.web.server.ResponseStatusException;
|
import org.springframework.web.server.ResponseStatusException;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.OffsetDateTime;
|
import java.time.OffsetDateTime;
|
||||||
import java.time.ZoneOffset;
|
import java.time.ZoneOffset;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -53,6 +54,9 @@ public class ProjectService {
|
|||||||
p.setCustomerId(request.getCustomerId());
|
p.setCustomerId(request.getCustomerId());
|
||||||
p.setName(request.getName().trim());
|
p.setName(request.getName().trim());
|
||||||
p.setPhase(resolvePhase(request.getPhase()));
|
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.setCreatedAt(now);
|
||||||
p.setUpdatedAt(now);
|
p.setUpdatedAt(now);
|
||||||
projectMapper.insert(p);
|
projectMapper.insert(p);
|
||||||
@@ -80,6 +84,9 @@ public class ProjectService {
|
|||||||
if (StringUtils.hasText(request.getPhase())) {
|
if (StringUtils.hasText(request.getPhase())) {
|
||||||
p.setPhase(request.getPhase().trim());
|
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));
|
p.setUpdatedAt(OffsetDateTime.now(ZoneOffset.UTC));
|
||||||
projectMapper.updateById(p);
|
projectMapper.updateById(p);
|
||||||
return toResponse(p);
|
return toResponse(p);
|
||||||
@@ -104,6 +111,9 @@ public class ProjectService {
|
|||||||
r.setCustomerId(p.getCustomerId());
|
r.setCustomerId(p.getCustomerId());
|
||||||
r.setName(p.getName());
|
r.setName(p.getName());
|
||||||
r.setPhase(p.getPhase());
|
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.setCreatedAt(p.getCreatedAt());
|
||||||
r.setUpdatedAt(p.getUpdatedAt());
|
r.setUpdatedAt(p.getUpdatedAt());
|
||||||
return r;
|
return r;
|
||||||
|
|||||||
+31
@@ -16,6 +16,13 @@ public class ProjectRequest {
|
|||||||
@Size(max = 64)
|
@Size(max = 64)
|
||||||
private String phase;
|
private String phase;
|
||||||
|
|
||||||
|
@Size(max = 128)
|
||||||
|
private String projectManager;
|
||||||
|
|
||||||
|
private String plannedStartDate;
|
||||||
|
|
||||||
|
private String plannedEndDate;
|
||||||
|
|
||||||
public Long getCustomerId() {
|
public Long getCustomerId() {
|
||||||
return customerId;
|
return customerId;
|
||||||
}
|
}
|
||||||
@@ -39,4 +46,28 @@ public class ProjectRequest {
|
|||||||
public void setPhase(String phase) {
|
public void setPhase(String phase) {
|
||||||
this.phase = 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 Long customerId;
|
||||||
private String name;
|
private String name;
|
||||||
private String phase;
|
private String phase;
|
||||||
|
private String plannedStartDate;
|
||||||
|
private String plannedEndDate;
|
||||||
|
private String projectManager;
|
||||||
private OffsetDateTime createdAt;
|
private OffsetDateTime createdAt;
|
||||||
private OffsetDateTime updatedAt;
|
private OffsetDateTime updatedAt;
|
||||||
|
|
||||||
@@ -43,6 +46,30 @@ public class ProjectResponse {
|
|||||||
this.phase = phase;
|
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() {
|
public OffsetDateTime getCreatedAt() {
|
||||||
return createdAt;
|
return createdAt;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,6 +85,15 @@
|
|||||||
<el-option v-for="p in phaseOptions" :key="p.code" :label="p.label" :value="p.code" />
|
<el-option v-for="p in phaseOptions" :key="p.code" :label="p.label" :value="p.code" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="计划开始">
|
||||||
|
<el-date-picker v-model="form.plannedStartDate" type="date" value-format="YYYY-MM-DD" placeholder="选填" style="width:100%" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="计划结束">
|
||||||
|
<el-date-picker v-model="form.plannedEndDate" type="date" value-format="YYYY-MM-DD" placeholder="选填" style="width:100%" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="项目经理">
|
||||||
|
<el-input v-model="form.projectManager" maxlength="128" placeholder="选填" />
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<el-button @click="dialogVisible = false">取消</el-button>
|
<el-button @click="dialogVisible = false">取消</el-button>
|
||||||
@@ -129,6 +138,9 @@ const form = reactive({
|
|||||||
customerId: undefined,
|
customerId: undefined,
|
||||||
name: "",
|
name: "",
|
||||||
phase: "",
|
phase: "",
|
||||||
|
plannedStartDate: "",
|
||||||
|
plannedEndDate: "",
|
||||||
|
projectManager: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
const rules = {
|
const rules = {
|
||||||
@@ -254,6 +266,9 @@ function openEdit(row) {
|
|||||||
form.name = row.name ?? "";
|
form.name = row.name ?? "";
|
||||||
const ph = row.phase;
|
const ph = row.phase;
|
||||||
form.phase = ph == null ? "" : String(ph);
|
form.phase = ph == null ? "" : String(ph);
|
||||||
|
form.plannedStartDate = row.plannedStartDate ?? "";
|
||||||
|
form.plannedEndDate = row.plannedEndDate ?? "";
|
||||||
|
form.projectManager = row.projectManager ?? "";
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,6 +276,9 @@ function resetForm() {
|
|||||||
form.customerId = undefined;
|
form.customerId = undefined;
|
||||||
form.name = "";
|
form.name = "";
|
||||||
form.phase = "";
|
form.phase = "";
|
||||||
|
form.plannedStartDate = "";
|
||||||
|
form.plannedEndDate = "";
|
||||||
|
form.projectManager = "";
|
||||||
formRef.value?.resetFields?.();
|
formRef.value?.resetFields?.();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,6 +295,9 @@ async function submit() {
|
|||||||
customerId: form.customerId,
|
customerId: form.customerId,
|
||||||
name: form.name.trim(),
|
name: form.name.trim(),
|
||||||
phase: form.phase,
|
phase: form.phase,
|
||||||
|
plannedStartDate: form.plannedStartDate || null,
|
||||||
|
plannedEndDate: form.plannedEndDate || null,
|
||||||
|
projectManager: form.projectManager || null,
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
if (editingId.value != null) {
|
if (editingId.value != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user