From 67c554b33cc0550929b6ec4855c52e7ca374ccee Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期日, 13 八月 2023 14:41:30 +0800
Subject: [PATCH] 完善商品退货单
---
model/model.go | 20 +
model/salesDetails.go | 4
model/salesReturn.go | 33 +-
model/salesReturnStatus.go | 6
model/request/salesReturn.go | 25 +
docs/swagger.yaml | 139 +++++++++++-
docs/docs.go | 197 ++++++++++++++++-
service/salesReturn.go | 2
api/v1/salesReturn.go | 14
docs/swagger.json | 197 ++++++++++++++++-
constvar/salesReturn.go | 7
11 files changed, 557 insertions(+), 87 deletions(-)
diff --git a/api/v1/salesReturn.go b/api/v1/salesReturn.go
index 20b1949..e0c7990 100644
--- a/api/v1/salesReturn.go
+++ b/api/v1/salesReturn.go
@@ -99,7 +99,6 @@
}
-
func checkSalesReturnParams(salesReturn request.SalesReturn) (errCode int, s model.SalesReturn) {
//if salesReturn.Number == "" {
// return ecode.InvalidParams, s
@@ -113,17 +112,12 @@
// return ecode.InvalidParams, s
//}
- t, err := checkTimeFormat(salesReturn.ReturnDate)
- if err != nil {
- return ecode.InvalidParams, s
- }
-
s.ClientId = salesReturn.ClientId
- s.ReturnDate = t
+ s.ReturnDate = salesReturn.ReturnDate
s.Number = salesReturn.Number
s.Repository = salesReturn.Repository
s.MemberId = salesReturn.MemberId
- s.SalesReturnStatus = salesReturn.Status
+ s.SalesReturnStatusId = salesReturn.SalesReturnStatusId
s.Reason = salesReturn.Reason
s.Products = salesReturn.Products
@@ -152,7 +146,7 @@
}
ctx.OkWithDetailed(response.SalesReturnResponse{
- List: salesReturns,
+ List: salesReturns,
Count: int(total),
})
-}
\ No newline at end of file
+}
diff --git a/constvar/salesReturn.go b/constvar/salesReturn.go
new file mode 100644
index 0000000..f86185f
--- /dev/null
+++ b/constvar/salesReturn.go
@@ -0,0 +1,7 @@
+package constvar
+
+type SalesReturnSourceType int
+
+const (
+ SalesReturnSourceTypeSaleDetails SalesReturnSourceType = 1 //閿�鍞槑缁�
+)
diff --git a/docs/docs.go b/docs/docs.go
index e018b2a..23edc3c 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -9841,18 +9841,36 @@
"BankAccountQueryClassExpireLessThen60Days"
]
},
- "constvar.CollectionStatus": {
+ "constvar.CollectionSourceType": {
"type": "integer",
"enum": [
1,
2
],
"x-enum-comments": {
+ "CollectionSourceTypeSaleDetails": "閿�鍞槑缁�",
+ "CollectionSourceTypeServiceContract": "鏈嶅姟鍚堝悓"
+ },
+ "x-enum-varnames": [
+ "CollectionSourceTypeSaleDetails",
+ "CollectionSourceTypeServiceContract"
+ ]
+ },
+ "constvar.CollectionStatus": {
+ "type": "integer",
+ "enum": [
+ 1,
+ 2,
+ 3
+ ],
+ "x-enum-comments": {
"CollectionStatusCollected": "宸叉敹娆�",
+ "CollectionStatusSubCollected": "閮ㄥ垎鏀舵",
"CollectionStatusUnCollected": "寰呮敹娆�"
},
"x-enum-varnames": [
"CollectionStatusUnCollected",
+ "CollectionStatusSubCollected",
"CollectionStatusCollected"
]
},
@@ -9993,6 +10011,23 @@
"ReceiptQueryClassExpireLessThen60Days"
]
},
+ "constvar.ReceiptSourceType": {
+ "type": "integer",
+ "enum": [
+ 1,
+ 2,
+ 3,
+ 4,
+ 5
+ ],
+ "x-enum-varnames": [
+ "ReceiptSourceTypeSalesDetails",
+ "ReceiptSourceTypeServiceContract",
+ "ReceiptSourceTypeInvoice",
+ "ReceiptSourceTypeCollectionPlan",
+ "ReceiptSourceTypeChuKuDan"
+ ]
+ },
"constvar.SalesDetailsKeywordType": {
"type": "string",
"enum": [
@@ -10008,6 +10043,18 @@
"SalesDetailsKeywordTypeSignTime",
"SalesDetailsKeywordTypePrincipal",
"SalesDetailsKeywordTypeProductName"
+ ]
+ },
+ "constvar.SalesReturnSourceType": {
+ "type": "integer",
+ "enum": [
+ 1
+ ],
+ "x-enum-comments": {
+ "SalesReturnSourceTypeSaleDetails": "閿�鍞槑缁�"
+ },
+ "x-enum-varnames": [
+ "SalesReturnSourceTypeSaleDetails"
]
},
"constvar.SalesStatus": {
@@ -11233,7 +11280,7 @@
"properties": {
"amount": {
"description": "鏀舵閲戦",
- "type": "string"
+ "type": "number"
},
"bankAccountId": {
"description": "璐︽埛id",
@@ -11276,7 +11323,11 @@
},
"sourceType": {
"description": "鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級",
- "type": "integer"
+ "allOf": [
+ {
+ "$ref": "#/definitions/constvar.ReceiptSourceType"
+ }
+ ]
}
}
},
@@ -11499,6 +11550,9 @@
"model.SalesDetails": {
"type": "object",
"properties": {
+ "Member": {
+ "$ref": "#/definitions/model.User"
+ },
"address": {
"type": "string"
},
@@ -11517,6 +11571,10 @@
"description": "宸叉敹閲戦",
"type": "number"
},
+ "amountTotal": {
+ "description": "浠风◣鍚堣",
+ "type": "number"
+ },
"amountUnInvoiced": {
"description": "鏈紑绁ㄩ噾棰�",
"type": "number"
@@ -11528,6 +11586,15 @@
"type": "integer"
},
"conditions": {
+ "type": "string"
+ },
+ "createTime": {
+ "type": "string"
+ },
+ "creatorId": {
+ "type": "integer"
+ },
+ "creatorName": {
"type": "string"
},
"deliveryDate": {
@@ -11692,8 +11759,28 @@
"model.SalesReturn": {
"type": "object",
"properties": {
+ "Member": {
+ "$ref": "#/definitions/model.User"
+ },
+ "SalesReturnStatus": {
+ "description": "閫�璐х姸鎬�",
+ "allOf": [
+ {
+ "$ref": "#/definitions/model.SalesReturnStatus"
+ }
+ ]
+ },
+ "client": {
+ "$ref": "#/definitions/model.Client"
+ },
"clientId": {
"type": "integer"
+ },
+ "createTime": {
+ "type": "string"
+ },
+ "creatorName": {
+ "type": "string"
},
"id": {
"type": "integer"
@@ -11705,22 +11792,38 @@
"type": "string"
},
"products": {
+ "description": "閫�璐т骇鍝�",
"type": "array",
"items": {
"$ref": "#/definitions/model.Product"
}
},
"reason": {
+ "description": "閫�璐у師鍥�",
"type": "string"
},
"repository": {
"type": "string"
},
"returnDate": {
+ "description": "閫�璐ф棩鏈�",
"type": "string"
},
- "salesReturnStatus": {
+ "salesReturnStatusId": {
+ "description": "閫�璐х姸鎬乮d",
"type": "integer"
+ },
+ "sourceId": {
+ "description": "婧愬崟id",
+ "type": "integer"
+ },
+ "sourceType": {
+ "description": "婧愬崟绫诲瀷锛�1閿�鍞槑缁嗭級",
+ "allOf": [
+ {
+ "$ref": "#/definitions/constvar.SalesReturnSourceType"
+ }
+ ]
}
}
},
@@ -11764,6 +11867,18 @@
"description": "閲戦",
"type": "number"
},
+ "amountReceivable": {
+ "description": "搴旀敹閲戦",
+ "type": "number"
+ },
+ "amountReceived": {
+ "description": "宸叉敹閲戦",
+ "type": "number"
+ },
+ "amountTotal": {
+ "description": "鎬婚",
+ "type": "number"
+ },
"collectionDate": {
"description": "璁″垝鏀舵鏃ユ湡",
"type": "string"
@@ -11801,10 +11916,14 @@
},
"sourceType": {
"description": "婧愬崟绫诲瀷锛�1閿�鍞槑缁�2鏈嶅姟鍚堝悓3閿�鍞彂绁級",
- "type": "integer"
+ "allOf": [
+ {
+ "$ref": "#/definitions/constvar.CollectionSourceType"
+ }
+ ]
},
"status": {
- "description": "鐘舵�侊紙1鏈敹2宸叉敹锛�",
+ "description": "鐘舵�侊紙1鏈敹2閮ㄥ垎宸叉敹3宸叉敹锛�",
"allOf": [
{
"$ref": "#/definitions/constvar.CollectionStatus"
@@ -11833,6 +11952,10 @@
},
"amountReceived": {
"description": "宸叉敹閲戦",
+ "type": "number"
+ },
+ "amountTotal": {
+ "description": "浠风◣鍚堣",
"type": "number"
},
"amountUnInvoiced": {
@@ -12150,6 +12273,10 @@
"serviceOrderStatus": {
"$ref": "#/definitions/model.ServiceOrderStatus"
},
+ "serviceOrderStatusId": {
+ "description": "澶勭悊鐘舵��",
+ "type": "integer"
+ },
"serviceType": {
"$ref": "#/definitions/model.ServiceType"
},
@@ -12167,10 +12294,6 @@
"solutionRemark": {
"description": "鍐呴儴澶囨敞",
"type": "string"
- },
- "status": {
- "description": "澶勭悊鐘舵��",
- "type": "integer"
},
"subject": {
"description": "涓婚",
@@ -13062,7 +13185,7 @@
"properties": {
"amount": {
"description": "鏀舵閲戦",
- "type": "string"
+ "type": "number"
},
"bankAccountId": {
"description": "璐︽埛id",
@@ -13105,7 +13228,11 @@
},
"sourceType": {
"description": "鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級",
- "type": "integer"
+ "allOf": [
+ {
+ "$ref": "#/definitions/constvar.ReceiptSourceType"
+ }
+ ]
}
}
},
@@ -14851,22 +14978,38 @@
"type": "string"
},
"products": {
+ "description": "閫�璐т骇鍝�",
"type": "array",
"items": {
"$ref": "#/definitions/model.Product"
}
},
"reason": {
+ "description": "閫�璐у師鍥�",
"type": "string"
},
"repository": {
"type": "string"
},
"returnDate": {
+ "description": "閫�璐ф棩鏈�",
"type": "string"
},
- "status": {
+ "salesReturnStatusId": {
+ "description": "閫�璐х姸鎬乮d",
"type": "integer"
+ },
+ "sourceId": {
+ "description": "婧愬崟id",
+ "type": "integer"
+ },
+ "sourceType": {
+ "description": "婧愬崟绫诲瀷锛�1閿�鍞槑缁嗭級",
+ "allOf": [
+ {
+ "$ref": "#/definitions/constvar.SalesReturnSourceType"
+ }
+ ]
}
}
},
@@ -15922,7 +16065,7 @@
"properties": {
"amount": {
"description": "鏀舵閲戦",
- "type": "string"
+ "type": "number"
},
"bankAccountId": {
"description": "璐︽埛id",
@@ -15965,7 +16108,11 @@
},
"sourceType": {
"description": "鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級",
- "type": "integer"
+ "allOf": [
+ {
+ "$ref": "#/definitions/constvar.ReceiptSourceType"
+ }
+ ]
}
}
},
@@ -16480,6 +16627,18 @@
"description": "閲戦",
"type": "number"
},
+ "amountReceivable": {
+ "description": "搴旀敹閲戦",
+ "type": "number"
+ },
+ "amountReceived": {
+ "description": "宸叉敹閲戦",
+ "type": "number"
+ },
+ "amountTotal": {
+ "description": "鎬婚",
+ "type": "number"
+ },
"collectionDate": {
"description": "璁″垝鏀舵鏃ユ湡",
"type": "string"
@@ -16517,10 +16676,14 @@
},
"sourceType": {
"description": "婧愬崟绫诲瀷锛�1閿�鍞槑缁�2鏈嶅姟鍚堝悓3閿�鍞彂绁級",
- "type": "integer"
+ "allOf": [
+ {
+ "$ref": "#/definitions/constvar.CollectionSourceType"
+ }
+ ]
},
"status": {
- "description": "鐘舵�侊紙1鏈敹2宸叉敹锛�",
+ "description": "鐘舵�侊紙1鏈敹2閮ㄥ垎宸叉敹3宸叉敹锛�",
"allOf": [
{
"$ref": "#/definitions/constvar.CollectionStatus"
diff --git a/docs/swagger.json b/docs/swagger.json
index ed88e15..cc9cc72 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -9829,18 +9829,36 @@
"BankAccountQueryClassExpireLessThen60Days"
]
},
- "constvar.CollectionStatus": {
+ "constvar.CollectionSourceType": {
"type": "integer",
"enum": [
1,
2
],
"x-enum-comments": {
+ "CollectionSourceTypeSaleDetails": "閿�鍞槑缁�",
+ "CollectionSourceTypeServiceContract": "鏈嶅姟鍚堝悓"
+ },
+ "x-enum-varnames": [
+ "CollectionSourceTypeSaleDetails",
+ "CollectionSourceTypeServiceContract"
+ ]
+ },
+ "constvar.CollectionStatus": {
+ "type": "integer",
+ "enum": [
+ 1,
+ 2,
+ 3
+ ],
+ "x-enum-comments": {
"CollectionStatusCollected": "宸叉敹娆�",
+ "CollectionStatusSubCollected": "閮ㄥ垎鏀舵",
"CollectionStatusUnCollected": "寰呮敹娆�"
},
"x-enum-varnames": [
"CollectionStatusUnCollected",
+ "CollectionStatusSubCollected",
"CollectionStatusCollected"
]
},
@@ -9981,6 +9999,23 @@
"ReceiptQueryClassExpireLessThen60Days"
]
},
+ "constvar.ReceiptSourceType": {
+ "type": "integer",
+ "enum": [
+ 1,
+ 2,
+ 3,
+ 4,
+ 5
+ ],
+ "x-enum-varnames": [
+ "ReceiptSourceTypeSalesDetails",
+ "ReceiptSourceTypeServiceContract",
+ "ReceiptSourceTypeInvoice",
+ "ReceiptSourceTypeCollectionPlan",
+ "ReceiptSourceTypeChuKuDan"
+ ]
+ },
"constvar.SalesDetailsKeywordType": {
"type": "string",
"enum": [
@@ -9996,6 +10031,18 @@
"SalesDetailsKeywordTypeSignTime",
"SalesDetailsKeywordTypePrincipal",
"SalesDetailsKeywordTypeProductName"
+ ]
+ },
+ "constvar.SalesReturnSourceType": {
+ "type": "integer",
+ "enum": [
+ 1
+ ],
+ "x-enum-comments": {
+ "SalesReturnSourceTypeSaleDetails": "閿�鍞槑缁�"
+ },
+ "x-enum-varnames": [
+ "SalesReturnSourceTypeSaleDetails"
]
},
"constvar.SalesStatus": {
@@ -11221,7 +11268,7 @@
"properties": {
"amount": {
"description": "鏀舵閲戦",
- "type": "string"
+ "type": "number"
},
"bankAccountId": {
"description": "璐︽埛id",
@@ -11264,7 +11311,11 @@
},
"sourceType": {
"description": "鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級",
- "type": "integer"
+ "allOf": [
+ {
+ "$ref": "#/definitions/constvar.ReceiptSourceType"
+ }
+ ]
}
}
},
@@ -11487,6 +11538,9 @@
"model.SalesDetails": {
"type": "object",
"properties": {
+ "Member": {
+ "$ref": "#/definitions/model.User"
+ },
"address": {
"type": "string"
},
@@ -11505,6 +11559,10 @@
"description": "宸叉敹閲戦",
"type": "number"
},
+ "amountTotal": {
+ "description": "浠风◣鍚堣",
+ "type": "number"
+ },
"amountUnInvoiced": {
"description": "鏈紑绁ㄩ噾棰�",
"type": "number"
@@ -11516,6 +11574,15 @@
"type": "integer"
},
"conditions": {
+ "type": "string"
+ },
+ "createTime": {
+ "type": "string"
+ },
+ "creatorId": {
+ "type": "integer"
+ },
+ "creatorName": {
"type": "string"
},
"deliveryDate": {
@@ -11680,8 +11747,28 @@
"model.SalesReturn": {
"type": "object",
"properties": {
+ "Member": {
+ "$ref": "#/definitions/model.User"
+ },
+ "SalesReturnStatus": {
+ "description": "閫�璐х姸鎬�",
+ "allOf": [
+ {
+ "$ref": "#/definitions/model.SalesReturnStatus"
+ }
+ ]
+ },
+ "client": {
+ "$ref": "#/definitions/model.Client"
+ },
"clientId": {
"type": "integer"
+ },
+ "createTime": {
+ "type": "string"
+ },
+ "creatorName": {
+ "type": "string"
},
"id": {
"type": "integer"
@@ -11693,22 +11780,38 @@
"type": "string"
},
"products": {
+ "description": "閫�璐т骇鍝�",
"type": "array",
"items": {
"$ref": "#/definitions/model.Product"
}
},
"reason": {
+ "description": "閫�璐у師鍥�",
"type": "string"
},
"repository": {
"type": "string"
},
"returnDate": {
+ "description": "閫�璐ф棩鏈�",
"type": "string"
},
- "salesReturnStatus": {
+ "salesReturnStatusId": {
+ "description": "閫�璐х姸鎬乮d",
"type": "integer"
+ },
+ "sourceId": {
+ "description": "婧愬崟id",
+ "type": "integer"
+ },
+ "sourceType": {
+ "description": "婧愬崟绫诲瀷锛�1閿�鍞槑缁嗭級",
+ "allOf": [
+ {
+ "$ref": "#/definitions/constvar.SalesReturnSourceType"
+ }
+ ]
}
}
},
@@ -11752,6 +11855,18 @@
"description": "閲戦",
"type": "number"
},
+ "amountReceivable": {
+ "description": "搴旀敹閲戦",
+ "type": "number"
+ },
+ "amountReceived": {
+ "description": "宸叉敹閲戦",
+ "type": "number"
+ },
+ "amountTotal": {
+ "description": "鎬婚",
+ "type": "number"
+ },
"collectionDate": {
"description": "璁″垝鏀舵鏃ユ湡",
"type": "string"
@@ -11789,10 +11904,14 @@
},
"sourceType": {
"description": "婧愬崟绫诲瀷锛�1閿�鍞槑缁�2鏈嶅姟鍚堝悓3閿�鍞彂绁級",
- "type": "integer"
+ "allOf": [
+ {
+ "$ref": "#/definitions/constvar.CollectionSourceType"
+ }
+ ]
},
"status": {
- "description": "鐘舵�侊紙1鏈敹2宸叉敹锛�",
+ "description": "鐘舵�侊紙1鏈敹2閮ㄥ垎宸叉敹3宸叉敹锛�",
"allOf": [
{
"$ref": "#/definitions/constvar.CollectionStatus"
@@ -11821,6 +11940,10 @@
},
"amountReceived": {
"description": "宸叉敹閲戦",
+ "type": "number"
+ },
+ "amountTotal": {
+ "description": "浠风◣鍚堣",
"type": "number"
},
"amountUnInvoiced": {
@@ -12138,6 +12261,10 @@
"serviceOrderStatus": {
"$ref": "#/definitions/model.ServiceOrderStatus"
},
+ "serviceOrderStatusId": {
+ "description": "澶勭悊鐘舵��",
+ "type": "integer"
+ },
"serviceType": {
"$ref": "#/definitions/model.ServiceType"
},
@@ -12155,10 +12282,6 @@
"solutionRemark": {
"description": "鍐呴儴澶囨敞",
"type": "string"
- },
- "status": {
- "description": "澶勭悊鐘舵��",
- "type": "integer"
},
"subject": {
"description": "涓婚",
@@ -13050,7 +13173,7 @@
"properties": {
"amount": {
"description": "鏀舵閲戦",
- "type": "string"
+ "type": "number"
},
"bankAccountId": {
"description": "璐︽埛id",
@@ -13093,7 +13216,11 @@
},
"sourceType": {
"description": "鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級",
- "type": "integer"
+ "allOf": [
+ {
+ "$ref": "#/definitions/constvar.ReceiptSourceType"
+ }
+ ]
}
}
},
@@ -14839,22 +14966,38 @@
"type": "string"
},
"products": {
+ "description": "閫�璐т骇鍝�",
"type": "array",
"items": {
"$ref": "#/definitions/model.Product"
}
},
"reason": {
+ "description": "閫�璐у師鍥�",
"type": "string"
},
"repository": {
"type": "string"
},
"returnDate": {
+ "description": "閫�璐ф棩鏈�",
"type": "string"
},
- "status": {
+ "salesReturnStatusId": {
+ "description": "閫�璐х姸鎬乮d",
"type": "integer"
+ },
+ "sourceId": {
+ "description": "婧愬崟id",
+ "type": "integer"
+ },
+ "sourceType": {
+ "description": "婧愬崟绫诲瀷锛�1閿�鍞槑缁嗭級",
+ "allOf": [
+ {
+ "$ref": "#/definitions/constvar.SalesReturnSourceType"
+ }
+ ]
}
}
},
@@ -15910,7 +16053,7 @@
"properties": {
"amount": {
"description": "鏀舵閲戦",
- "type": "string"
+ "type": "number"
},
"bankAccountId": {
"description": "璐︽埛id",
@@ -15953,7 +16096,11 @@
},
"sourceType": {
"description": "鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級",
- "type": "integer"
+ "allOf": [
+ {
+ "$ref": "#/definitions/constvar.ReceiptSourceType"
+ }
+ ]
}
}
},
@@ -16468,6 +16615,18 @@
"description": "閲戦",
"type": "number"
},
+ "amountReceivable": {
+ "description": "搴旀敹閲戦",
+ "type": "number"
+ },
+ "amountReceived": {
+ "description": "宸叉敹閲戦",
+ "type": "number"
+ },
+ "amountTotal": {
+ "description": "鎬婚",
+ "type": "number"
+ },
"collectionDate": {
"description": "璁″垝鏀舵鏃ユ湡",
"type": "string"
@@ -16505,10 +16664,14 @@
},
"sourceType": {
"description": "婧愬崟绫诲瀷锛�1閿�鍞槑缁�2鏈嶅姟鍚堝悓3閿�鍞彂绁級",
- "type": "integer"
+ "allOf": [
+ {
+ "$ref": "#/definitions/constvar.CollectionSourceType"
+ }
+ ]
},
"status": {
- "description": "鐘舵�侊紙1鏈敹2宸叉敹锛�",
+ "description": "鐘舵�侊紙1鏈敹2閮ㄥ垎宸叉敹3宸叉敹锛�",
"allOf": [
{
"$ref": "#/definitions/constvar.CollectionStatus"
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index bd69224..787e7f1 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -11,16 +11,30 @@
type: string
x-enum-varnames:
- BankAccountQueryClassExpireLessThen60Days
- constvar.CollectionStatus:
+ constvar.CollectionSourceType:
enum:
- 1
- 2
type: integer
x-enum-comments:
+ CollectionSourceTypeSaleDetails: 閿�鍞槑缁�
+ CollectionSourceTypeServiceContract: 鏈嶅姟鍚堝悓
+ x-enum-varnames:
+ - CollectionSourceTypeSaleDetails
+ - CollectionSourceTypeServiceContract
+ constvar.CollectionStatus:
+ enum:
+ - 1
+ - 2
+ - 3
+ type: integer
+ x-enum-comments:
CollectionStatusCollected: 宸叉敹娆�
+ CollectionStatusSubCollected: 閮ㄥ垎鏀舵
CollectionStatusUnCollected: 寰呮敹娆�
x-enum-varnames:
- CollectionStatusUnCollected
+ - CollectionStatusSubCollected
- CollectionStatusCollected
constvar.CourierCompanyKeywordType:
enum:
@@ -114,6 +128,20 @@
type: string
x-enum-varnames:
- ReceiptQueryClassExpireLessThen60Days
+ constvar.ReceiptSourceType:
+ enum:
+ - 1
+ - 2
+ - 3
+ - 4
+ - 5
+ type: integer
+ x-enum-varnames:
+ - ReceiptSourceTypeSalesDetails
+ - ReceiptSourceTypeServiceContract
+ - ReceiptSourceTypeInvoice
+ - ReceiptSourceTypeCollectionPlan
+ - ReceiptSourceTypeChuKuDan
constvar.SalesDetailsKeywordType:
enum:
- 瀹㈡埛鍚嶇О
@@ -128,6 +156,14 @@
- SalesDetailsKeywordTypeSignTime
- SalesDetailsKeywordTypePrincipal
- SalesDetailsKeywordTypeProductName
+ constvar.SalesReturnSourceType:
+ enum:
+ - 1
+ type: integer
+ x-enum-comments:
+ SalesReturnSourceTypeSaleDetails: 閿�鍞槑缁�
+ x-enum-varnames:
+ - SalesReturnSourceTypeSaleDetails
constvar.SalesStatus:
enum:
- 0
@@ -965,7 +1001,7 @@
properties:
amount:
description: 鏀舵閲戦
- type: string
+ type: number
bankAccountId:
description: 璐︽埛id
type: integer
@@ -996,8 +1032,9 @@
description: 婧愬崟id
type: integer
sourceType:
+ allOf:
+ - $ref: '#/definitions/constvar.ReceiptSourceType'
description: 鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級
- type: integer
type: object
model.RefundMethod:
properties:
@@ -1142,6 +1179,8 @@
type: object
model.SalesDetails:
properties:
+ Member:
+ $ref: '#/definitions/model.User'
address:
type: string
addressee:
@@ -1155,6 +1194,9 @@
amountReceived:
description: 宸叉敹閲戦
type: number
+ amountTotal:
+ description: 浠风◣鍚堣
+ type: number
amountUnInvoiced:
description: 鏈紑绁ㄩ噾棰�
type: number
@@ -1163,6 +1205,12 @@
clientId:
type: integer
conditions:
+ type: string
+ createTime:
+ type: string
+ creatorId:
+ type: integer
+ creatorName:
type: string
deliveryDate:
type: string
@@ -1271,8 +1319,20 @@
type: object
model.SalesReturn:
properties:
+ Member:
+ $ref: '#/definitions/model.User'
+ SalesReturnStatus:
+ allOf:
+ - $ref: '#/definitions/model.SalesReturnStatus'
+ description: 閫�璐х姸鎬�
+ client:
+ $ref: '#/definitions/model.Client'
clientId:
type: integer
+ createTime:
+ type: string
+ creatorName:
+ type: string
id:
type: integer
memberId:
@@ -1280,17 +1340,28 @@
number:
type: string
products:
+ description: 閫�璐т骇鍝�
items:
$ref: '#/definitions/model.Product'
type: array
reason:
+ description: 閫�璐у師鍥�
type: string
repository:
type: string
returnDate:
+ description: 閫�璐ф棩鏈�
type: string
- salesReturnStatus:
+ salesReturnStatusId:
+ description: 閫�璐х姸鎬乮d
type: integer
+ sourceId:
+ description: 婧愬崟id
+ type: integer
+ sourceType:
+ allOf:
+ - $ref: '#/definitions/constvar.SalesReturnSourceType'
+ description: 婧愬崟绫诲瀷锛�1閿�鍞槑缁嗭級
type: object
model.SalesReturnStatus:
properties:
@@ -1317,6 +1388,15 @@
properties:
amount:
description: 閲戦
+ type: number
+ amountReceivable:
+ description: 搴旀敹閲戦
+ type: number
+ amountReceived:
+ description: 宸叉敹閲戦
+ type: number
+ amountTotal:
+ description: 鎬婚
type: number
collectionDate:
description: 璁″垝鏀舵鏃ユ湡
@@ -1345,12 +1425,13 @@
description: 婧愬崟id
type: integer
sourceType:
+ allOf:
+ - $ref: '#/definitions/constvar.CollectionSourceType'
description: 婧愬崟绫诲瀷锛�1閿�鍞槑缁�2鏈嶅姟鍚堝悓3閿�鍞彂绁級
- type: integer
status:
allOf:
- $ref: '#/definitions/constvar.CollectionStatus'
- description: 鐘舵�侊紙1鏈敹2宸叉敹锛�
+ description: 鐘舵�侊紙1鏈敹2閮ㄥ垎宸叉敹3宸叉敹锛�
term:
description: 鏈熸
type: integer
@@ -1367,6 +1448,9 @@
type: number
amountReceived:
description: 宸叉敹閲戦
+ type: number
+ amountTotal:
+ description: 浠风◣鍚堣
type: number
amountUnInvoiced:
description: 鏈紑绁ㄩ噾棰�
@@ -1585,6 +1669,9 @@
type: string
serviceOrderStatus:
$ref: '#/definitions/model.ServiceOrderStatus'
+ serviceOrderStatusId:
+ description: 澶勭悊鐘舵��
+ type: integer
serviceType:
$ref: '#/definitions/model.ServiceType'
serviceTypeId:
@@ -1598,9 +1685,6 @@
solutionRemark:
description: 鍐呴儴澶囨敞
type: string
- status:
- description: 澶勭悊鐘舵��
- type: integer
subject:
description: 涓婚
type: string
@@ -2198,7 +2282,7 @@
properties:
amount:
description: 鏀舵閲戦
- type: string
+ type: number
bankAccountId:
description: 璐︽埛id
type: integer
@@ -2229,8 +2313,9 @@
description: 婧愬崟id
type: integer
sourceType:
+ allOf:
+ - $ref: '#/definitions/constvar.ReceiptSourceType'
description: 鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級
- type: integer
type: object
request.AddRefundMethod:
properties:
@@ -3427,17 +3512,28 @@
number:
type: string
products:
+ description: 閫�璐т骇鍝�
items:
$ref: '#/definitions/model.Product'
type: array
reason:
+ description: 閫�璐у師鍥�
type: string
repository:
type: string
returnDate:
+ description: 閫�璐ф棩鏈�
type: string
- status:
+ salesReturnStatusId:
+ description: 閫�璐х姸鎬乮d
type: integer
+ sourceId:
+ description: 婧愬崟id
+ type: integer
+ sourceType:
+ allOf:
+ - $ref: '#/definitions/constvar.SalesReturnSourceType'
+ description: 婧愬崟绫诲瀷锛�1閿�鍞槑缁嗭級
type: object
request.SetAuthorityMenu:
properties:
@@ -4148,7 +4244,7 @@
properties:
amount:
description: 鏀舵閲戦
- type: string
+ type: number
bankAccountId:
description: 璐︽埛id
type: integer
@@ -4179,8 +4275,9 @@
description: 婧愬崟id
type: integer
sourceType:
+ allOf:
+ - $ref: '#/definitions/constvar.ReceiptSourceType'
description: 鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級
- type: integer
type: object
request.UpdateRefundMethod:
properties:
@@ -4521,6 +4618,15 @@
amount:
description: 閲戦
type: number
+ amountReceivable:
+ description: 搴旀敹閲戦
+ type: number
+ amountReceived:
+ description: 宸叉敹閲戦
+ type: number
+ amountTotal:
+ description: 鎬婚
+ type: number
collectionDate:
description: 璁″垝鏀舵鏃ユ湡
type: string
@@ -4548,12 +4654,13 @@
description: 婧愬崟id
type: integer
sourceType:
+ allOf:
+ - $ref: '#/definitions/constvar.CollectionSourceType'
description: 婧愬崟绫诲瀷锛�1閿�鍞槑缁�2鏈嶅姟鍚堝悓3閿�鍞彂绁級
- type: integer
status:
allOf:
- $ref: '#/definitions/constvar.CollectionStatus'
- description: 鐘舵�侊紙1鏈敹2宸叉敹锛�
+ description: 鐘舵�侊紙1鏈敹2閮ㄥ垎宸叉敹3宸叉敹锛�
term:
description: 鏈熸
type: integer
diff --git a/model/model.go b/model/model.go
new file mode 100644
index 0000000..284a594
--- /dev/null
+++ b/model/model.go
@@ -0,0 +1,20 @@
+package model
+
+import (
+ "gorm.io/gorm"
+ "time"
+)
+
+type CrmModel struct {
+ gorm.Model `json:"-"`
+ CreatorId int `json:"-" gorm:"column:creator_id;type:int;comment:鍒涘缓浜篿d"`
+ Creator User `json:"-" gorm:"foreignKey:CreatorId"`
+ CreateTime time.Time `json:"createTime" gorm:"-"`
+ CreatorName string `json:"creatorName" gorm:"-"`
+}
+
+func (slf *CrmModel) AfterFind(tx *gorm.DB) (err error) {
+ slf.CreatorName = slf.Creator.Username
+ slf.CreateTime = slf.CreatedAt
+ return nil
+}
diff --git a/model/request/salesReturn.go b/model/request/salesReturn.go
index a31794c..8da7dbc 100644
--- a/model/request/salesReturn.go
+++ b/model/request/salesReturn.go
@@ -1,20 +1,27 @@
package request
-import "aps_crm/model"
+import (
+ "aps_crm/constvar"
+ "aps_crm/model"
+)
type AddSalesReturnRequest struct {
SalesReturn SalesReturn
}
type SalesReturn struct {
- ClientId int `json:"clientId" gorm:"column:client_id;type:int;comment:瀹㈡埛id"`
- Number string `json:"number" gorm:"column:number;type:varchar(255);comment:閫�璐у崟鍙�"`
- Repository string `json:"repository" gorm:"column:repository;type:varchar(255);comment:浠撳簱"`
- MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:璐熻矗浜篿d"`
- ReturnDate string `json:"returnDate" gorm:"column:return_date;type:datetime;comment:閫�璐ф棩鏈�"`
- Status int `json:"status" gorm:"column:status;type:int;comment:閫�璐х姸鎬�"`
- Reason string `json:"reason" gorm:"column:reason;type:varchar(255);comment:閫�璐у師鍥�"`
- Products []model.Product `json:"products" gorm:"many2many:salesReturn_product;"`
+ ClientId int `json:"clientId" gorm:"column:client_id;type:int;comment:瀹㈡埛id"`
+ SourceType constvar.SalesReturnSourceType `gorm:"source_type" json:"sourceType"` // 婧愬崟绫诲瀷锛�1閿�鍞槑缁嗭級
+ SourceId int `gorm:"source_id" json:"sourceId"` // 婧愬崟id
+ Number string `json:"number" gorm:"column:number;type:varchar(255);comment:閫�璐у崟鍙�"`
+ Repository string `json:"repository" gorm:"column:repository;type:varchar(255);comment:浠撳簱"`
+ MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:璐熻矗浜篿d"`
+ ReturnDate string `json:"returnDate" gorm:"column:return_date;type:datetime(3);comment:閫�璐ф棩鏈�"` //閫�璐ф棩鏈�
+ SalesReturnStatusId int `json:"salesReturnStatusId" gorm:"column:sales_return_status;type:int;comment:閫�璐х姸鎬�"` //閫�璐х姸鎬乮d
+ CreatorId int `json:"-" gorm:"column:creator_id;type:int;comment:鍒涘缓浜篿d"` //鍒涘缓浜篒D
+ Creator User `json:"-" gorm:"foreignKey:CreatorId"` //鍒涘缓浜轰俊鎭�
+ Reason string `json:"reason" gorm:"column:reason;type:varchar(255);comment:閫�璐у師鍥�"` //閫�璐у師鍥�
+ Products []*model.Product `json:"products" gorm:"many2many:salesReturn_product;"` //閫�璐т骇鍝�
}
type UpdateSalesReturnRequest struct {
diff --git a/model/salesDetails.go b/model/salesDetails.go
index 25211e3..be63cf7 100644
--- a/model/salesDetails.go
+++ b/model/salesDetails.go
@@ -20,6 +20,7 @@
SaleType int `json:"saleType" gorm:"column:sale_type;type:int;comment:閿�鍞被鍨�"`
SignTime string `json:"signTime" gorm:"column:sign_time;type:varchar(255);comment:绛惧崟鏃堕棿"`
MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:璐熻矗浜篿d"`
+ Member User `json:"Member" gorm:"foreignKey:MemberId"`
DeliveryDate string `json:"deliveryDate" gorm:"column:delivery_date;type:varchar(255);comment:浜よ揣鏃ユ湡"`
WechatOrderStatusId int `json:"wechatOrderStatusId" gorm:"column:wechat_order_status;type:int;comment:寰俊璁㈠崟鐘舵��"`
WechatOrderStatus WechatOrderStatus `json:"wechatOrderStatus" gorm:"foreignKey:WechatOrderStatusId"`
@@ -27,6 +28,7 @@
Phone string `json:"phone" gorm:"column:phone;type:varchar(255);comment:鐢佃瘽"`
Addressee string `json:"addressee" gorm:"column:addressee;type:varchar(255);comment:鏀朵欢浜�"`
Conditions string `json:"conditions" gorm:"column:conditions;type:text;comment:鏉′欢"`
+ CreatorId int `json:"creatorId" gorm:"column:creator_id;type:int;comment:鍒涘缓浜篿d"`
Remark string `json:"remark" gorm:"column:remark;type:text;comment:澶囨敞"`
Products []*Product `json:"products" gorm:"many2many:sales_details_product;"`
LogisticCompany string `json:"logisticCompany" gorm:"column:logistic_company;type:varchar(255);comment:鐗╂祦鍏徃"`
@@ -37,7 +39,7 @@
AmountInvoiced decimal.Decimal `gorm:"column:amount_invoiced;type:decimal(12,2);comment:宸插紑绁ㄩ噾棰�" json:"amountInvoiced"` // 宸插紑绁ㄩ噾棰�
AmountUnInvoiced decimal.Decimal `gorm:"column:amount_not_invoiced;type:decimal(12,2);comment:鏈紑绁ㄩ噾棰�" json:"amountUnInvoiced"` // 鏈紑绁ㄩ噾棰�
AmountTotal decimal.Decimal `gorm:"column:amount_total;type:decimal(12,2);comment:浠风◣鍚堣" json:"amountTotal"` // 浠风◣鍚堣
- gorm.Model `json:"-"`
+ CrmModel
}
SalesDetailsSearch struct {
diff --git a/model/salesReturn.go b/model/salesReturn.go
index 94e1232..d4a64a7 100644
--- a/model/salesReturn.go
+++ b/model/salesReturn.go
@@ -1,22 +1,30 @@
package model
import (
+ "aps_crm/constvar"
"aps_crm/pkg/mysqlx"
"gorm.io/gorm"
- "time"
)
type (
SalesReturn struct {
- Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
- ClientId int `json:"clientId" gorm:"column:client_id;type:int;comment:瀹㈡埛id"`
- Number string `json:"number" gorm:"column:number;type:varchar(255);comment:閫�璐у崟鍙�"`
- Repository string `json:"repository" gorm:"column:repository;type:varchar(255);comment:浠撳簱"`
- MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:璐熻矗浜篿d"`
- ReturnDate time.Time `json:"returnDate" gorm:"column:return_date;type:datetime;comment:閫�璐ф棩鏈�"`
- SalesReturnStatus int `json:"salesReturnStatus" gorm:"column:sales_return_status;type:int;comment:閫�璐х姸鎬�"`
- Reason string `json:"reason" gorm:"column:reason;type:varchar(255);comment:閫�璐у師鍥�"`
- Products []Product `json:"products" gorm:"many2many:salesReturn_product;"`
+ Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
+ ClientId int `json:"clientId" gorm:"column:client_id;type:int;comment:瀹㈡埛id"`
+ Client Client `json:"client" gorm:"foreignKey:ClientId"`
+ SourceType constvar.SalesReturnSourceType `gorm:"source_type" json:"sourceType"` // 婧愬崟绫诲瀷锛�1閿�鍞槑缁嗭級
+ SourceId int `gorm:"source_id" json:"sourceId"` // 婧愬崟id
+ Number string `json:"number" gorm:"column:number;type:varchar(255);comment:閫�璐у崟鍙�"`
+ Repository string `json:"repository" gorm:"column:repository;type:varchar(255);comment:浠撳簱"`
+ MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:璐熻矗浜篿d"`
+ Member User `json:"Member" gorm:"foreignKey:MemberId"`
+ ReturnDate string `json:"returnDate" gorm:"column:return_date;type:datetime(3);comment:閫�璐ф棩鏈�"` //閫�璐ф棩鏈�
+ SalesReturnStatusId int `json:"salesReturnStatusId" gorm:"column:sales_return_status;type:int;comment:閫�璐х姸鎬�"` //閫�璐х姸鎬乮d
+ SalesReturnStatus SalesReturnStatus `json:"SalesReturnStatus" gorm:"foreignKey:SalesReturnStatusId"` //閫�璐х姸鎬�
+ CreatorId int `json:"-" gorm:"column:creator_id;type:int;comment:鍒涘缓浜篿d"` //鍒涘缓浜篒D
+ Creator User `json:"-" gorm:"foreignKey:CreatorId"` //鍒涘缓浜轰俊鎭�
+ Reason string `json:"reason" gorm:"column:reason;type:varchar(255);comment:閫�璐у師鍥�"` //閫�璐у師鍥�
+ Products []*Product `json:"products" gorm:"many2many:salesReturn_product;"` //閫�璐т骇鍝�
+ CrmModel
}
SalesReturnSearch struct {
@@ -30,10 +38,9 @@
}
)
-func (SalesReturn) TableName() string {
+func (*SalesReturn) TableName() string {
return "sales_return"
}
-
func NewSalesReturnSearch() *SalesReturnSearch {
return &SalesReturnSearch{
Orm: mysqlx.GetDB(),
@@ -107,4 +114,4 @@
func (slf *SalesReturnSearch) SetOrder(order string) *SalesReturnSearch {
slf.OrderBy = order
return slf
-}
\ No newline at end of file
+}
diff --git a/model/salesReturnStatus.go b/model/salesReturnStatus.go
index 8f3d538..10d15d9 100644
--- a/model/salesReturnStatus.go
+++ b/model/salesReturnStatus.go
@@ -6,12 +6,12 @@
)
type (
- // SalesReturnStatus 鍟嗘満闃舵
+ // SalesReturnStatus 閫�璐х姸鎬�
SalesReturnStatus struct {
Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
- Name string `json:"name" gorm:"column:name;type:varchar(255);comment:鍟嗘満闃舵鍚嶇О"`
+ Name string `json:"name" gorm:"column:name;type:varchar(255);comment:閫�璐х姸鎬佸悕绉�"`
}
-
+
SalesReturnStatusSearch struct {
SalesReturnStatus
Orm *gorm.DB
diff --git a/service/salesReturn.go b/service/salesReturn.go
index 655e2f8..6a4bab0 100644
--- a/service/salesReturn.go
+++ b/service/salesReturn.go
@@ -7,7 +7,7 @@
type SalesReturnService struct{}
-func (SalesReturnService) AddSalesReturn(salesReturn *model.SalesReturn) int {
+func (slf SalesReturnService) AddSalesReturn(salesReturn *model.SalesReturn) int {
err := model.NewSalesReturnSearch().Create(salesReturn)
if err != nil {
return ecode.SalesReturnExist
--
Gitblit v1.8.0