完善配送合同关联信息展示与归属校验
三端合同页面改为优先显示用户、气站和配送点业务名称,并保留标识与合同编号复制能力。 平台端增加气站与直属配送点联动,后端禁止平台主管及跨气站配送点绑定合同,同时补充测试和中文文档。
This commit is contained in:
@@ -739,7 +739,12 @@ func deliveryBelongsToGas(deliveryID, gasID uint64) bool {
|
||||
}
|
||||
var delivery models.DeliveryBasic
|
||||
return impl.DBService.Select("gas_basic_id").First(&delivery, deliveryID).Error == nil &&
|
||||
(delivery.GasBasicID == 0 || delivery.GasBasicID == gasID)
|
||||
contractDeliveryMatchesGas(delivery.GasBasicID, gasID)
|
||||
}
|
||||
|
||||
// contractDeliveryMatchesGas 校验合同配送点必须直属于合同气站;平台主管配送点不能绑定到气站合同。
|
||||
func contractDeliveryMatchesGas(deliveryGasID, contractGasID uint64) bool {
|
||||
return deliveryGasID != 0 && deliveryGasID == contractGasID
|
||||
}
|
||||
|
||||
func gasorderStatusRecord(orderID uint64, from, to int, reason, operatorIdentity, operatorName string) *models.GasorderStatus {
|
||||
|
||||
@@ -106,6 +106,18 @@ func TestContractRevisionKeepsSingleContractHistory(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestContractDeliveryRequiresDirectGasOwnership(t *testing.T) {
|
||||
if !contractDeliveryMatchesGas(10, 10) {
|
||||
t.Fatal("合同气站的直属配送点被错误拒绝")
|
||||
}
|
||||
if contractDeliveryMatchesGas(0, 10) {
|
||||
t.Fatal("平台主管配送点不应绑定到气站合同")
|
||||
}
|
||||
if contractDeliveryMatchesGas(11, 10) {
|
||||
t.Fatal("其他气站配送点不应绑定到当前气站合同")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGasorderSensitiveContactsAreMasked(t *testing.T) {
|
||||
value := map[string]any{
|
||||
"contact_name": "张三",
|
||||
|
||||
Reference in New Issue
Block a user