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;
@@ -10,7 +10,7 @@
</el-tag>
</div>
<div v-if="contract && isDraft" class="head-actions">
<el-button type="primary" :loading="saving" @click="saveHeader">保存</el-button>
<el-button v-permission="'contract:rw'" type="primary" :loading="saving" @click="saveHeader">保存</el-button>
</div>
</div>
</template>
@@ -39,6 +39,7 @@
<div v-if="transitionButtons.length" class="transition-bar">
<span class="label">状态操作</span>
<el-button
v-permission="'contract:rw'"
v-for="btn in transitionButtons"
:key="btn.status"
:type="btn.danger ? 'danger' : 'primary'"
@@ -51,7 +52,7 @@
<h3 class="section-title">合同明细</h3>
<div v-if="isDraft" class="line-toolbar">
<el-button type="primary" @click="openLineDialog()">添加明细</el-button>
<el-button v-permission="'contract:rw'" type="primary" @click="openLineDialog()">添加明细</el-button>
</div>
<el-table :data="lineRows" border stripe style="width: 100%">
<el-table-column prop="itemName" label="标的/行项" min-width="200" show-overflow-tooltip />
@@ -60,8 +61,8 @@
<el-table-column prop="amount" label="金额" width="120" />
<el-table-column v-if="isDraft" label="操作" width="140" fixed="right">
<template #default="{ row }">
<el-button type="primary" link @click="openLineDialog(row)">编辑</el-button>
<el-button type="danger" link @click="onDeleteLine(row)">删除</el-button>
<el-button v-permission="'contract:rw'" type="primary" link @click="openLineDialog(row)">编辑</el-button>
<el-button v-permission="'contract:rw'" type="danger" link @click="onDeleteLine(row)">删除</el-button>
</template>
</el-table-column>
</el-table>
@@ -75,7 +76,7 @@
:on-change="handleFileChange"
:accept="'.pdf,.doc,.docx,.xls,.xlsx,.zip'"
>
<el-button type="primary" v-if="isDraft || isEffective">上传附件</el-button>
<el-button v-permission="'contract:rw'" type="primary" v-if="isDraft || isEffective">上传附件</el-button>
</el-upload>
<el-table :data="attachments" stripe size="small" style="margin-top:8px">
<el-table-column prop="fileName" label="文件名" min-width="200" />
@@ -108,7 +108,7 @@
<div class="footer-actions">
<el-button v-if="step > 0" @click="step -= 1">上一步</el-button>
<el-button v-if="step < 2" type="primary" @click="nextStep">下一步</el-button>
<el-button v-if="step === 2" type="primary" :loading="submitting" @click="submit">提交创建草稿</el-button>
<el-button v-permission="'contract:rw'" v-if="step === 2" type="primary" :loading="submitting" @click="submit">提交创建草稿</el-button>
</div>
</el-card>
</template>