feat(m2): add signing/effective/end date fields to contracts

This commit is contained in:
2026-05-25 14:46:02 +08:00
parent 1726f486fa
commit 4bbf1f552f
8 changed files with 145 additions and 6 deletions
@@ -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_contract")
@@ -25,6 +26,15 @@ public class PlatformContract {
private String status;
@TableField("signing_date")
private LocalDate signingDate;
@TableField("effective_date")
private LocalDate effectiveDate;
@TableField("end_date")
private LocalDate endDate;
@TableField("created_at")
private OffsetDateTime createdAt;
@@ -79,6 +89,30 @@ public class PlatformContract {
this.status = status;
}
public LocalDate getSigningDate() {
return signingDate;
}
public void setSigningDate(LocalDate signingDate) {
this.signingDate = signingDate;
}
public LocalDate getEffectiveDate() {
return effectiveDate;
}
public void setEffectiveDate(LocalDate effectiveDate) {
this.effectiveDate = effectiveDate;
}
public LocalDate getEndDate() {
return endDate;
}
public void setEndDate(LocalDate endDate) {
this.endDate = endDate;
}
public OffsetDateTime getCreatedAt() {
return createdAt;
}
@@ -27,6 +27,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.LinkedHashMap;
@@ -68,6 +69,9 @@ public class ContractService {
c.setProjectId(request.getProjectId());
c.setTitle(blankToNull(request.getTitle()));
c.setRemarks(blankToNull(request.getRemarks()));
if (request.getSigningDate() != null) c.setSigningDate(LocalDate.parse(request.getSigningDate()));
if (request.getEffectiveDate() != null) c.setEffectiveDate(LocalDate.parse(request.getEffectiveDate()));
if (request.getEndDate() != null) c.setEndDate(LocalDate.parse(request.getEndDate()));
c.setStatus(ContractStatus.DRAFT.name());
c.setCreatedAt(now);
c.setUpdatedAt(now);
@@ -122,6 +126,9 @@ public class ContractService {
if (request.getRemarks() != null) {
c.setRemarks(blankToNull(request.getRemarks()));
}
if (request.getSigningDate() != null) c.setSigningDate(LocalDate.parse(request.getSigningDate()));
if (request.getEffectiveDate() != null) c.setEffectiveDate(LocalDate.parse(request.getEffectiveDate()));
if (request.getEndDate() != null) c.setEndDate(LocalDate.parse(request.getEndDate()));
c.setUpdatedAt(OffsetDateTime.now(ZoneOffset.UTC));
contractMapper.updateById(c);
auditService.record(
@@ -321,6 +328,9 @@ public class ContractService {
m.put("projectId", c.getProjectId());
m.put("title", c.getTitle());
m.put("remarks", c.getRemarks());
m.put("signingDate", c.getSigningDate());
m.put("effectiveDate", c.getEffectiveDate());
m.put("endDate", c.getEndDate());
m.put("status", c.getStatus());
return m;
}
@@ -354,6 +364,9 @@ public class ContractService {
r.setTitle(c.getTitle());
r.setRemarks(c.getRemarks());
r.setStatus(c.getStatus());
r.setSigningDate(c.getSigningDate() != null ? c.getSigningDate().toString() : null);
r.setEffectiveDate(c.getEffectiveDate() != null ? c.getEffectiveDate().toString() : null);
r.setEndDate(c.getEndDate() != null ? c.getEndDate().toString() : null);
r.setCreatedAt(c.getCreatedAt());
r.setUpdatedAt(c.getUpdatedAt());
return r;
@@ -15,6 +15,12 @@ public class ContractCreateRequest {
@Size(max = 4000)
private String remarks;
private String signingDate;
private String effectiveDate;
private String endDate;
public Long getCustomerId() {
return customerId;
}
@@ -46,4 +52,28 @@ public class ContractCreateRequest {
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public String getSigningDate() {
return signingDate;
}
public void setSigningDate(String signingDate) {
this.signingDate = signingDate;
}
public String getEffectiveDate() {
return effectiveDate;
}
public void setEffectiveDate(String effectiveDate) {
this.effectiveDate = effectiveDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
}
@@ -13,6 +13,9 @@ public class ContractResponse {
private String title;
private String remarks;
private String status;
private String signingDate;
private String effectiveDate;
private String endDate;
private OffsetDateTime createdAt;
private OffsetDateTime updatedAt;
/** 仅详情接口填充;列表分页省略该字段。 */
@@ -67,6 +70,30 @@ public class ContractResponse {
this.status = status;
}
public String getSigningDate() {
return signingDate;
}
public void setSigningDate(String signingDate) {
this.signingDate = signingDate;
}
public String getEffectiveDate() {
return effectiveDate;
}
public void setEffectiveDate(String effectiveDate) {
this.effectiveDate = effectiveDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
public OffsetDateTime getCreatedAt() {
return createdAt;
}
@@ -10,6 +10,12 @@ public class ContractUpdateRequest {
@Size(max = 4000)
private String remarks;
private String signingDate;
private String effectiveDate;
private String endDate;
public String getTitle() {
return title;
}
@@ -25,4 +31,28 @@ public class ContractUpdateRequest {
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public String getSigningDate() {
return signingDate;
}
public void setSigningDate(String signingDate) {
this.signingDate = signingDate;
}
public String getEffectiveDate() {
return effectiveDate;
}
public void setEffectiveDate(String effectiveDate) {
this.effectiveDate = effectiveDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
}
@@ -0,0 +1,4 @@
ALTER TABLE platform_contract
ADD COLUMN signing_date DATE,
ADD COLUMN effective_date DATE,
ADD COLUMN end_date DATE;