feat(sync): expose contract display context

This commit is contained in:
jiashumeng
2026-09-15 20:18:43 +09:30
parent 6d8093fa14
commit 025ee7ffa6
6 changed files with 25 additions and 9 deletions
@@ -114,10 +114,12 @@ public class ContractsSyncEntity extends AbstractSyncEntity implements SyncEntit
Date effective = row.getModifyTime() != null ? row.getModifyTime() : row.getCreateTime();
return SyncChangeSchemas.toMap(new SyncChangeSchemas.ContractChange(
stableId(row.getId()), row.getContractNo(), row.getContractName(),
row.getPropertyName(), row.getCustomerNo(), row.getCustomerName(),
publicStatus(row.getContractStatus()), ChangesEngine.iso(row.getStartDate()),
ChangesEngine.iso(row.getEndDate()), toMinor(row.getAmount()),
row.getPropertyId() == null ? null : customerIds.get(row.getPropertyId()),
stableId(row.getPropertyId()), stableId(row.getSaleId()),
row.getSaleName(),
Integer.valueOf(1).equals(row.getExpireRemind()), row.getRemindDays(),
ChangesEngine.iso(effective), mt, deleted ? ChangesEngine.iso(effective) : null));
}
@@ -57,6 +57,9 @@ final class SyncChangeSchemas {
@JsonProperty("contract_id") String contractId,
@JsonProperty("contract_no") String contractNo,
@JsonProperty("contract_name") String contractName,
@JsonProperty("property_name") String propertyName,
@JsonProperty("customer_no") String customerNo,
@JsonProperty("customer_name") String customerName,
String status,
@JsonProperty("start_at") String startAt,
@JsonProperty("end_at") String endAt,
@@ -64,6 +67,7 @@ final class SyncChangeSchemas {
@JsonProperty("customer_id") String customerId,
@JsonProperty("property_id") String propertyId,
@JsonProperty("owner_user_id") String ownerUserId,
@JsonProperty("owner_name") String ownerName,
@JsonProperty("expire_remind") boolean expireRemind,
@JsonProperty("remind_days") Integer remindDays,
@JsonProperty("updated_at") String updatedAt,
@@ -79,7 +79,8 @@ public class ChangesTools implements ToolObject {
@Tool(name = "contracts.changes.list", description = "增量同步合同主数据(m2.contract_new)。" + PROTOCOL_DESC
+ "items 字段:contract_id/contract_no/contract_name/status(PENDING/REJECTED/ACTIVE/EXPIRED/TERMINATED)/"
+ "start_at/end_at(带时区)/amount_minor(金额,分)/customer_id/property_id/"
+ "owner_user_id(负责人稳定 user.id)/expire_remind/remind_days/updated_at/version/deleted_at。"
+ "property_name/customer_no/customer_name/owner_user_id(负责人稳定 user.id)/owner_name/"
+ "expire_remind/remind_days/updated_at/version/deleted_at。"
+ "行级权限跟随 Token 绑定的人(与 contract.list.query 同一 ACL)。")
public Map<String, Object> contractsChangesList(
@ToolParam(required = false, description = SYNC_TOKEN_DESC) String syncToken,