作者 linmadan

添加素币相关功能

正在显示 23 个修改的文件 包含 1046 行增加75 行删除
@@ -18,19 +18,61 @@ @@ -18,19 +18,61 @@
18 "application/xml" 18 "application/xml"
19 ], 19 ],
20 "paths": { 20 "paths": {
  21 + "/config/bid-time-matchs": {
  22 + "get": {
  23 + "tags": [
  24 + "config"
  25 + ],
  26 + "summary": "返回竞标时间字典列表(1全部,2已截止,3未截止)",
  27 + "description": "返回竞标时间字典列表(1全部,2已截止,3未截止)",
  28 + "operationId": "config#listBidTimeMatch",
  29 + "responses": {
  30 + "200": {
  31 + "description": "OK response.",
  32 + "schema": {
  33 + "$ref": "#/definitions/ConfigListBidTimeMatchResponseBody"
  34 + }
  35 + }
  36 + },
  37 + "schemes": [
  38 + "http"
  39 + ]
  40 + }
  41 + },
21 "/config/customer-values": { 42 "/config/customer-values": {
22 "get": { 43 "get": {
23 "tags": [ 44 "tags": [
24 "config" 45 "config"
25 ], 46 ],
26 - "summary": "返回客户价值列表",  
27 - "description": "返回客户价值列表",  
28 - "operationId": "config#listCustomerValues", 47 + "summary": "返回客户价值字典列表",
  48 + "description": "返回客户价值字典列表",
  49 + "operationId": "config#listCustomerValue",
29 "responses": { 50 "responses": {
30 "200": { 51 "200": {
31 "description": "OK response.", 52 "description": "OK response.",
32 "schema": { 53 "schema": {
33 - "$ref": "#/definitions/ConfigListCustomerValuesResponseBody" 54 + "$ref": "#/definitions/ConfigListCustomerValueResponseBody"
  55 + }
  56 + }
  57 + },
  58 + "schemes": [
  59 + "http"
  60 + ]
  61 + }
  62 + },
  63 + "/config/reference-resource-types": {
  64 + "get": {
  65 + "tags": [
  66 + "config"
  67 + ],
  68 + "summary": "返回任务引用资源类型字典列表",
  69 + "description": "返回任务引用资源类型字典列表",
  70 + "operationId": "config#listReferenceResourceType",
  71 + "responses": {
  72 + "200": {
  73 + "description": "OK response.",
  74 + "schema": {
  75 + "$ref": "#/definitions/ConfigListReferenceResourceTypeResponseBody"
34 } 76 }
35 } 77 }
36 }, 78 },
@@ -44,14 +86,14 @@ @@ -44,14 +86,14 @@
44 "tags": [ 86 "tags": [
45 "config" 87 "config"
46 ], 88 ],
47 - "summary": "返回任务性质列表",  
48 - "description": "返回任务性质列表",  
49 - "operationId": "config#listTaskNatures", 89 + "summary": "返回任务性质字典列表",
  90 + "description": "返回任务性质字典列表",
  91 + "operationId": "config#listTaskNature",
50 "responses": { 92 "responses": {
51 "200": { 93 "200": {
52 "description": "OK response.", 94 "description": "OK response.",
53 "schema": { 95 "schema": {
54 - "$ref": "#/definitions/ConfigListTaskNaturesResponseBody" 96 + "$ref": "#/definitions/ConfigListTaskNatureResponseBody"
55 } 97 }
56 } 98 }
57 }, 99 },
@@ -65,8 +107,8 @@ @@ -65,8 +107,8 @@
65 "tags": [ 107 "tags": [
66 "config" 108 "config"
67 ], 109 ],
68 - "summary": "返回任务状态列表",  
69 - "description": "返回任务状态列表", 110 + "summary": "返回任务状态字典列表",
  111 + "description": "返回任务状态字典列表",
70 "operationId": "config#listTaskStatus", 112 "operationId": "config#listTaskStatus",
71 "responses": { 113 "responses": {
72 "200": { 114 "200": {
@@ -86,14 +128,14 @@ @@ -86,14 +128,14 @@
86 "tags": [ 128 "tags": [
87 "config" 129 "config"
88 ], 130 ],
89 - "summary": "返回任务类型列表",  
90 - "description": "返回任务类型列表",  
91 - "operationId": "config#listTaskTypes", 131 + "summary": "返回任务类型字典列表",
  132 + "description": "返回任务类型字典列表",
  133 + "operationId": "config#listTaskType",
92 "responses": { 134 "responses": {
93 "200": { 135 "200": {
94 "description": "OK response.", 136 "description": "OK response.",
95 "schema": { 137 "schema": {
96 - "$ref": "#/definitions/ConfigListTaskTypesResponseBody" 138 + "$ref": "#/definitions/ConfigListTaskTypeResponseBody"
97 } 139 }
98 } 140 }
99 }, 141 },
@@ -262,6 +304,68 @@ @@ -262,6 +304,68 @@
262 ] 304 ]
263 } 305 }
264 }, 306 },
  307 + "/su-money/exchange": {
  308 + "post": {
  309 + "tags": [
  310 + "suMoney"
  311 + ],
  312 + "summary": "素币兑换",
  313 + "description": "素币兑换",
  314 + "operationId": "suMoney#exchangeSuMoney",
  315 + "parameters": [
  316 + {
  317 + "name": "ExchangeSuMoneyRequestBody",
  318 + "in": "body",
  319 + "required": true,
  320 + "schema": {
  321 + "$ref": "#/definitions/SuMoneyExchangeSuMoneyRequestBody"
  322 + }
  323 + }
  324 + ],
  325 + "responses": {
  326 + "200": {
  327 + "description": "OK response.",
  328 + "schema": {
  329 + "$ref": "#/definitions/SuMoneyExchangeSuMoneyResponseBody"
  330 + }
  331 + }
  332 + },
  333 + "schemes": [
  334 + "http"
  335 + ]
  336 + }
  337 + },
  338 + "/su-money/search-su-money-transaction-record": {
  339 + "post": {
  340 + "tags": [
  341 + "suMoney"
  342 + ],
  343 + "summary": "搜索素币事务记录",
  344 + "description": "搜索素币事务记录",
  345 + "operationId": "suMoney#searchSuMoneyTransactionRecord",
  346 + "parameters": [
  347 + {
  348 + "name": "SearchSuMoneyTransactionRecordRequestBody",
  349 + "in": "body",
  350 + "required": true,
  351 + "schema": {
  352 + "$ref": "#/definitions/SuMoneySearchSuMoneyTransactionRecordRequestBody"
  353 + }
  354 + }
  355 + ],
  356 + "responses": {
  357 + "200": {
  358 + "description": "OK response.",
  359 + "schema": {
  360 + "$ref": "#/definitions/SuMoneySearchSuMoneyTransactionRecordResponseBody"
  361 + }
  362 + }
  363 + },
  364 + "schemes": [
  365 + "http"
  366 + ]
  367 + }
  368 + },
265 "/tasks": { 369 "/tasks": {
266 "get": { 370 "get": {
267 "tags": [ 371 "tags": [
@@ -832,8 +936,20 @@ @@ -832,8 +936,20 @@
832 } 936 }
833 }, 937 },
834 "definitions": { 938 "definitions": {
835 - "ConfigListCustomerValuesResponseBody": {  
836 - "title": "Mediatype identifier: ConfigListCustomerValuesResponseBody", 939 + "ConfigListBidTimeMatchResponseBody": {
  940 + "title": "Mediatype identifier: ConfigListBidTimeMatchResponseBody",
  941 + "type": "object",
  942 + "properties": {
  943 + "bidTimeMatchs": {
  944 + "type": "array",
  945 + "items": {
  946 + "$ref": "#/definitions/configResponseBody"
  947 + }
  948 + }
  949 + }
  950 + },
  951 + "ConfigListCustomerValueResponseBody": {
  952 + "title": "Mediatype identifier: ConfigListCustomerValueResponseBody",
837 "type": "object", 953 "type": "object",
838 "properties": { 954 "properties": {
839 "customerValues": { 955 "customerValues": {
@@ -844,8 +960,20 @@ @@ -844,8 +960,20 @@
844 } 960 }
845 } 961 }
846 }, 962 },
847 - "ConfigListTaskNaturesResponseBody": {  
848 - "title": "Mediatype identifier: ConfigListTaskNaturesResponseBody", 963 + "ConfigListReferenceResourceTypeResponseBody": {
  964 + "title": "Mediatype identifier: ConfigListReferenceResourceTypeResponseBody",
  965 + "type": "object",
  966 + "properties": {
  967 + "referenceResourceTypes": {
  968 + "type": "array",
  969 + "items": {
  970 + "$ref": "#/definitions/configResponseBody"
  971 + }
  972 + }
  973 + }
  974 + },
  975 + "ConfigListTaskNatureResponseBody": {
  976 + "title": "Mediatype identifier: ConfigListTaskNatureResponseBody",
849 "type": "object", 977 "type": "object",
850 "properties": { 978 "properties": {
851 "taskNatures": { 979 "taskNatures": {
@@ -868,8 +996,8 @@ @@ -868,8 +996,8 @@
868 } 996 }
869 } 997 }
870 }, 998 },
871 - "ConfigListTaskTypesResponseBody": {  
872 - "title": "Mediatype identifier: ConfigListTaskTypesResponseBody", 999 + "ConfigListTaskTypeResponseBody": {
  1000 + "title": "Mediatype identifier: ConfigListTaskTypeResponseBody",
873 "type": "object", 1001 "type": "object",
874 "properties": { 1002 "properties": {
875 "taskTypes": { 1003 "taskTypes": {
@@ -968,6 +1096,94 @@ @@ -968,6 +1096,94 @@
968 } 1096 }
969 } 1097 }
970 }, 1098 },
  1099 + "SuMoneyExchangeSuMoneyRequestBody": {
  1100 + "title": "SuMoneyExchangeSuMoneyRequestBody",
  1101 + "type": "object",
  1102 + "properties": {
  1103 + "exchangeDescription": {
  1104 + "type": "string",
  1105 + "description": "兑换描述",
  1106 + "required": [
  1107 + "exchangeDescription"
  1108 + ]
  1109 + },
  1110 + "operator": {
  1111 + "type": "integer",
  1112 + "description": "操作人UID(默认为系统操作)",
  1113 + "format": "int64"
  1114 + },
  1115 + "suMoney": {
  1116 + "type": "number",
  1117 + "description": "素币值",
  1118 + "required": [
  1119 + "suMoney"
  1120 + ]
  1121 + },
  1122 + "uid": {
  1123 + "type": "integer",
  1124 + "description": "兑换人UID",
  1125 + "required": [
  1126 + "uid"
  1127 + ]
  1128 + }
  1129 + }
  1130 + },
  1131 + "SuMoneyExchangeSuMoneyResponseBody": {
  1132 + "title": "Mediatype identifier: SuMoneyExchangeSuMoneyResponseBody",
  1133 + "type": "object",
  1134 + "properties": {
  1135 + "suMoneyTransactionRecord": {
  1136 + "$ref": "#/definitions/suMoneyTransactionRecordResponseBody"
  1137 + }
  1138 + }
  1139 + },
  1140 + "SuMoneySearchSuMoneyTransactionRecordRequestBody": {
  1141 + "title": "SuMoneySearchSuMoneyTransactionRecordRequestBody",
  1142 + "type": "object",
  1143 + "properties": {
  1144 + "limit": {
  1145 + "type": "integer",
  1146 + "description": "查询限制",
  1147 + "format": "int64"
  1148 + },
  1149 + "offset": {
  1150 + "type": "integer",
  1151 + "description": "查询偏离量",
  1152 + "format": "int64"
  1153 + },
  1154 + "recordType": {
  1155 + "type": "integer",
  1156 + "description": "记录类型(1兑换,2任务奖励)",
  1157 + "required": [
  1158 + "recordType"
  1159 + ]
  1160 + },
  1161 + "uid": {
  1162 + "type": "integer",
  1163 + "description": "统一用户UID",
  1164 + "required": [
  1165 + "uid"
  1166 + ]
  1167 + }
  1168 + }
  1169 + },
  1170 + "SuMoneySearchSuMoneyTransactionRecordResponseBody": {
  1171 + "title": "Mediatype identifier: SuMoneySearchSuMoneyTransactionRecordResponseBody",
  1172 + "type": "object",
  1173 + "properties": {
  1174 + "count": {
  1175 + "type": "integer",
  1176 + "description": "结果总数",
  1177 + "format": "int64"
  1178 + },
  1179 + "suMoneyTransactionRecords": {
  1180 + "type": "array",
  1181 + "items": {
  1182 + "$ref": "#/definitions/suMoneyTransactionRecordResponseBody"
  1183 + }
  1184 + }
  1185 + }
  1186 + },
971 "TaskAcceptanceTaskRequestBody": { 1187 "TaskAcceptanceTaskRequestBody": {
972 "title": "TaskAcceptanceTaskRequestBody", 1188 "title": "TaskAcceptanceTaskRequestBody",
973 "type": "object", 1189 "type": "object",
@@ -1819,6 +2035,58 @@ @@ -1819,6 +2035,58 @@
1819 }, 2035 },
1820 "description": "抢单任务信息" 2036 "description": "抢单任务信息"
1821 }, 2037 },
  2038 + "suMoneyTransactionRecordResponseBody": {
  2039 + "title": "suMoneyTransactionRecordResponseBody",
  2040 + "type": "object",
  2041 + "properties": {
  2042 + "createTime": {
  2043 + "type": "string",
  2044 + "description": "创建时间",
  2045 + "required": [
  2046 + "createTime"
  2047 + ]
  2048 + },
  2049 + "employee": {
  2050 + "$ref": "#/definitions/employeeInfoResponseBody"
  2051 + },
  2052 + "operator": {
  2053 + "type": "integer",
  2054 + "description": "操作人",
  2055 + "required": [
  2056 + "operator"
  2057 + ]
  2058 + },
  2059 + "recordDescription": {
  2060 + "type": "string",
  2061 + "description": "素币事务记录描述",
  2062 + "required": [
  2063 + "recordDescription"
  2064 + ]
  2065 + },
  2066 + "recordType": {
  2067 + "type": "integer",
  2068 + "description": "记录类型(1兑换,2任务奖励)",
  2069 + "required": [
  2070 + "recordType"
  2071 + ]
  2072 + },
  2073 + "suMoney": {
  2074 + "type": "number",
  2075 + "description": "事务素币值",
  2076 + "required": [
  2077 + "suMoney"
  2078 + ]
  2079 + },
  2080 + "suMoneyTransactionRecordId": {
  2081 + "type": "integer",
  2082 + "description": "素币事务记录ID",
  2083 + "required": [
  2084 + "suMoneyTransactionRecordId"
  2085 + ]
  2086 + }
  2087 + },
  2088 + "description": "素币事务记录"
  2089 + },
1822 "taskPercentageItemRequestBody": { 2090 "taskPercentageItemRequestBody": {
1823 "title": "taskPercentageItemRequestBody", 2091 "title": "taskPercentageItemRequestBody",
1824 "type": "object", 2092 "type": "object",
@@ -13,40 +13,68 @@ produces: @@ -13,40 +13,68 @@ produces:
13 - application/json 13 - application/json
14 - application/xml 14 - application/xml
15 paths: 15 paths:
  16 + /config/bid-time-matchs:
  17 + get:
  18 + tags:
  19 + - config
  20 + summary: 返回竞标时间字典列表(1全部,2已截止,3未截止)
  21 + description: 返回竞标时间字典列表(1全部,2已截止,3未截止)
  22 + operationId: config#listBidTimeMatch
  23 + responses:
  24 + "200":
  25 + description: OK response.
  26 + schema:
  27 + $ref: '#/definitions/ConfigListBidTimeMatchResponseBody'
  28 + schemes:
  29 + - http
16 /config/customer-values: 30 /config/customer-values:
17 get: 31 get:
18 tags: 32 tags:
19 - config 33 - config
20 - summary: 返回客户价值列表  
21 - description: 返回客户价值列表  
22 - operationId: config#listCustomerValues 34 + summary: 返回客户价值字典列表
  35 + description: 返回客户价值字典列表
  36 + operationId: config#listCustomerValue
  37 + responses:
  38 + "200":
  39 + description: OK response.
  40 + schema:
  41 + $ref: '#/definitions/ConfigListCustomerValueResponseBody'
  42 + schemes:
  43 + - http
  44 + /config/reference-resource-types:
  45 + get:
  46 + tags:
  47 + - config
  48 + summary: 返回任务引用资源类型字典列表
  49 + description: 返回任务引用资源类型字典列表
  50 + operationId: config#listReferenceResourceType
23 responses: 51 responses:
24 "200": 52 "200":
25 description: OK response. 53 description: OK response.
26 schema: 54 schema:
27 - $ref: '#/definitions/ConfigListCustomerValuesResponseBody' 55 + $ref: '#/definitions/ConfigListReferenceResourceTypeResponseBody'
28 schemes: 56 schemes:
29 - http 57 - http
30 /config/task-natures: 58 /config/task-natures:
31 get: 59 get:
32 tags: 60 tags:
33 - config 61 - config
34 - summary: 返回任务性质列表  
35 - description: 返回任务性质列表  
36 - operationId: config#listTaskNatures 62 + summary: 返回任务性质字典列表
  63 + description: 返回任务性质字典列表
  64 + operationId: config#listTaskNature
37 responses: 65 responses:
38 "200": 66 "200":
39 description: OK response. 67 description: OK response.
40 schema: 68 schema:
41 - $ref: '#/definitions/ConfigListTaskNaturesResponseBody' 69 + $ref: '#/definitions/ConfigListTaskNatureResponseBody'
42 schemes: 70 schemes:
43 - http 71 - http
44 /config/task-statuses: 72 /config/task-statuses:
45 get: 73 get:
46 tags: 74 tags:
47 - config 75 - config
48 - summary: 返回任务状态列表  
49 - description: 返回任务状态列表 76 + summary: 返回任务状态字典列表
  77 + description: 返回任务状态字典列表
50 operationId: config#listTaskStatus 78 operationId: config#listTaskStatus
51 responses: 79 responses:
52 "200": 80 "200":
@@ -59,14 +87,14 @@ paths: @@ -59,14 +87,14 @@ paths:
59 get: 87 get:
60 tags: 88 tags:
61 - config 89 - config
62 - summary: 返回任务类型列表  
63 - description: 返回任务类型列表  
64 - operationId: config#listTaskTypes 90 + summary: 返回任务类型字典列表
  91 + description: 返回任务类型字典列表
  92 + operationId: config#listTaskType
65 responses: 93 responses:
66 "200": 94 "200":
67 description: OK response. 95 description: OK response.
68 schema: 96 schema:
69 - $ref: '#/definitions/ConfigListTaskTypesResponseBody' 97 + $ref: '#/definitions/ConfigListTaskTypeResponseBody'
70 schemes: 98 schemes:
71 - http 99 - http
72 /employees: 100 /employees:
@@ -176,6 +204,46 @@ paths: @@ -176,6 +204,46 @@ paths:
176 $ref: '#/definitions/EmployeeRemoveEmployeeResponseBody' 204 $ref: '#/definitions/EmployeeRemoveEmployeeResponseBody'
177 schemes: 205 schemes:
178 - http 206 - http
  207 + /su-money/exchange:
  208 + post:
  209 + tags:
  210 + - suMoney
  211 + summary: 素币兑换
  212 + description: 素币兑换
  213 + operationId: suMoney#exchangeSuMoney
  214 + parameters:
  215 + - name: ExchangeSuMoneyRequestBody
  216 + in: body
  217 + required: true
  218 + schema:
  219 + $ref: '#/definitions/SuMoneyExchangeSuMoneyRequestBody'
  220 + responses:
  221 + "200":
  222 + description: OK response.
  223 + schema:
  224 + $ref: '#/definitions/SuMoneyExchangeSuMoneyResponseBody'
  225 + schemes:
  226 + - http
  227 + /su-money/search-su-money-transaction-record:
  228 + post:
  229 + tags:
  230 + - suMoney
  231 + summary: 搜索素币事务记录
  232 + description: 搜索素币事务记录
  233 + operationId: suMoney#searchSuMoneyTransactionRecord
  234 + parameters:
  235 + - name: SearchSuMoneyTransactionRecordRequestBody
  236 + in: body
  237 + required: true
  238 + schema:
  239 + $ref: '#/definitions/SuMoneySearchSuMoneyTransactionRecordRequestBody'
  240 + responses:
  241 + "200":
  242 + description: OK response.
  243 + schema:
  244 + $ref: '#/definitions/SuMoneySearchSuMoneyTransactionRecordResponseBody'
  245 + schemes:
  246 + - http
179 /tasks: 247 /tasks:
180 get: 248 get:
181 tags: 249 tags:
@@ -557,16 +625,32 @@ paths: @@ -557,16 +625,32 @@ paths:
557 schemes: 625 schemes:
558 - http 626 - http
559 definitions: 627 definitions:
560 - ConfigListCustomerValuesResponseBody:  
561 - title: 'Mediatype identifier: ConfigListCustomerValuesResponseBody' 628 + ConfigListBidTimeMatchResponseBody:
  629 + title: 'Mediatype identifier: ConfigListBidTimeMatchResponseBody'
  630 + type: object
  631 + properties:
  632 + bidTimeMatchs:
  633 + type: array
  634 + items:
  635 + $ref: '#/definitions/configResponseBody'
  636 + ConfigListCustomerValueResponseBody:
  637 + title: 'Mediatype identifier: ConfigListCustomerValueResponseBody'
562 type: object 638 type: object
563 properties: 639 properties:
564 customerValues: 640 customerValues:
565 type: array 641 type: array
566 items: 642 items:
567 $ref: '#/definitions/configResponseBody' 643 $ref: '#/definitions/configResponseBody'
568 - ConfigListTaskNaturesResponseBody:  
569 - title: 'Mediatype identifier: ConfigListTaskNaturesResponseBody' 644 + ConfigListReferenceResourceTypeResponseBody:
  645 + title: 'Mediatype identifier: ConfigListReferenceResourceTypeResponseBody'
  646 + type: object
  647 + properties:
  648 + referenceResourceTypes:
  649 + type: array
  650 + items:
  651 + $ref: '#/definitions/configResponseBody'
  652 + ConfigListTaskNatureResponseBody:
  653 + title: 'Mediatype identifier: ConfigListTaskNatureResponseBody'
570 type: object 654 type: object
571 properties: 655 properties:
572 taskNatures: 656 taskNatures:
@@ -581,8 +665,8 @@ definitions: @@ -581,8 +665,8 @@ definitions:
581 type: array 665 type: array
582 items: 666 items:
583 $ref: '#/definitions/configResponseBody' 667 $ref: '#/definitions/configResponseBody'
584 - ConfigListTaskTypesResponseBody:  
585 - title: 'Mediatype identifier: ConfigListTaskTypesResponseBody' 668 + ConfigListTaskTypeResponseBody:
  669 + title: 'Mediatype identifier: ConfigListTaskTypeResponseBody'
586 type: object 670 type: object
587 properties: 671 properties:
588 taskTypes: 672 taskTypes:
@@ -650,6 +734,69 @@ definitions: @@ -650,6 +734,69 @@ definitions:
650 properties: 734 properties:
651 employee: 735 employee:
652 $ref: '#/definitions/employeeResponseBody' 736 $ref: '#/definitions/employeeResponseBody'
  737 + SuMoneyExchangeSuMoneyRequestBody:
  738 + title: SuMoneyExchangeSuMoneyRequestBody
  739 + type: object
  740 + properties:
  741 + exchangeDescription:
  742 + type: string
  743 + description: 兑换描述
  744 + required:
  745 + - exchangeDescription
  746 + operator:
  747 + type: integer
  748 + description: 操作人UID(默认为系统操作)
  749 + format: int64
  750 + suMoney:
  751 + type: number
  752 + description: 素币值
  753 + required:
  754 + - suMoney
  755 + uid:
  756 + type: integer
  757 + description: 兑换人UID
  758 + required:
  759 + - uid
  760 + SuMoneyExchangeSuMoneyResponseBody:
  761 + title: 'Mediatype identifier: SuMoneyExchangeSuMoneyResponseBody'
  762 + type: object
  763 + properties:
  764 + suMoneyTransactionRecord:
  765 + $ref: '#/definitions/suMoneyTransactionRecordResponseBody'
  766 + SuMoneySearchSuMoneyTransactionRecordRequestBody:
  767 + title: SuMoneySearchSuMoneyTransactionRecordRequestBody
  768 + type: object
  769 + properties:
  770 + limit:
  771 + type: integer
  772 + description: 查询限制
  773 + format: int64
  774 + offset:
  775 + type: integer
  776 + description: 查询偏离量
  777 + format: int64
  778 + recordType:
  779 + type: integer
  780 + description: 记录类型(1兑换,2任务奖励)
  781 + required:
  782 + - recordType
  783 + uid:
  784 + type: integer
  785 + description: 统一用户UID
  786 + required:
  787 + - uid
  788 + SuMoneySearchSuMoneyTransactionRecordResponseBody:
  789 + title: 'Mediatype identifier: SuMoneySearchSuMoneyTransactionRecordResponseBody'
  790 + type: object
  791 + properties:
  792 + count:
  793 + type: integer
  794 + description: 结果总数
  795 + format: int64
  796 + suMoneyTransactionRecords:
  797 + type: array
  798 + items:
  799 + $ref: '#/definitions/suMoneyTransactionRecordResponseBody'
653 TaskAcceptanceTaskRequestBody: 800 TaskAcceptanceTaskRequestBody:
654 title: TaskAcceptanceTaskRequestBody 801 title: TaskAcceptanceTaskRequestBody
655 type: object 802 type: object
@@ -1259,6 +1406,43 @@ definitions: @@ -1259,6 +1406,43 @@ definitions:
1259 receiver: 1406 receiver:
1260 $ref: '#/definitions/employeeInfoResponseBody' 1407 $ref: '#/definitions/employeeInfoResponseBody'
1261 description: 抢单任务信息 1408 description: 抢单任务信息
  1409 + suMoneyTransactionRecordResponseBody:
  1410 + title: suMoneyTransactionRecordResponseBody
  1411 + type: object
  1412 + properties:
  1413 + createTime:
  1414 + type: string
  1415 + description: 创建时间
  1416 + required:
  1417 + - createTime
  1418 + employee:
  1419 + $ref: '#/definitions/employeeInfoResponseBody'
  1420 + operator:
  1421 + type: integer
  1422 + description: 操作人
  1423 + required:
  1424 + - operator
  1425 + recordDescription:
  1426 + type: string
  1427 + description: 素币事务记录描述
  1428 + required:
  1429 + - recordDescription
  1430 + recordType:
  1431 + type: integer
  1432 + description: 记录类型(1兑换,2任务奖励)
  1433 + required:
  1434 + - recordType
  1435 + suMoney:
  1436 + type: number
  1437 + description: 事务素币值
  1438 + required:
  1439 + - suMoney
  1440 + suMoneyTransactionRecordId:
  1441 + type: integer
  1442 + description: 素币事务记录ID
  1443 + required:
  1444 + - suMoneyTransactionRecordId
  1445 + description: 素币事务记录
1262 taskPercentageItemRequestBody: 1446 taskPercentageItemRequestBody:
1263 title: taskPercentageItemRequestBody 1447 title: taskPercentageItemRequestBody
1264 type: object 1448 type: object
@@ -6,12 +6,12 @@ import ( @@ -6,12 +6,12 @@ import (
6 "github.com/astaxie/beego/validation" 6 "github.com/astaxie/beego/validation"
7 ) 7 )
8 8
9 -type ListCustomerValuesQuery struct { 9 +type ListBidTimeMatchQuery struct {
10 } 10 }
11 11
12 -func (listCustomerValuesQuery *ListCustomerValuesQuery) ValidateQuery() error { 12 +func (listBidTimeMatchQuery *ListBidTimeMatchQuery) ValidateQuery() error {
13 valid := validation.Validation{} 13 valid := validation.Validation{}
14 - b, err := valid.Valid(listCustomerValuesQuery) 14 + b, err := valid.Valid(listBidTimeMatchQuery)
15 if err != nil { 15 if err != nil {
16 return err 16 return err
17 } 17 }
@@ -6,12 +6,12 @@ import ( @@ -6,12 +6,12 @@ import (
6 "github.com/astaxie/beego/validation" 6 "github.com/astaxie/beego/validation"
7 ) 7 )
8 8
9 -type ListTaskNaturesQuery struct { 9 +type ListCustomerValueQuery struct {
10 } 10 }
11 11
12 -func (listTaskNaturesQuery *ListTaskNaturesQuery) ValidateQuery() error { 12 +func (listCustomerValueQuery *ListCustomerValueQuery) ValidateQuery() error {
13 valid := validation.Validation{} 13 valid := validation.Validation{}
14 - b, err := valid.Valid(listTaskNaturesQuery) 14 + b, err := valid.Valid(listCustomerValueQuery)
15 if err != nil { 15 if err != nil {
16 return err 16 return err
17 } 17 }
  1 +package query
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "github.com/astaxie/beego/validation"
  7 +)
  8 +
  9 +type ListReferenceResourceTypeQuery struct {
  10 +}
  11 +
  12 +func (listReferenceResourceTypeQuery *ListReferenceResourceTypeQuery) ValidateQuery() error {
  13 + valid := validation.Validation{}
  14 + b, err := valid.Valid(listReferenceResourceTypeQuery)
  15 + if err != nil {
  16 + return err
  17 + }
  18 + if !b {
  19 + for _, validErr := range valid.Errors {
  20 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  21 + }
  22 + }
  23 + return nil
  24 +}
@@ -6,12 +6,12 @@ import ( @@ -6,12 +6,12 @@ import (
6 "github.com/astaxie/beego/validation" 6 "github.com/astaxie/beego/validation"
7 ) 7 )
8 8
9 -type ListTaskTypesQuery struct { 9 +type ListTaskNatureQuery struct {
10 } 10 }
11 11
12 -func (listTaskTypesQuery *ListTaskTypesQuery) ValidateQuery() error { 12 +func (listTaskNatureQuery *ListTaskNatureQuery) ValidateQuery() error {
13 valid := validation.Validation{} 13 valid := validation.Validation{}
14 - b, err := valid.Valid(listTaskTypesQuery) 14 + b, err := valid.Valid(listTaskNatureQuery)
15 if err != nil { 15 if err != nil {
16 return err 16 return err
17 } 17 }
  1 +package query
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "github.com/astaxie/beego/validation"
  7 +)
  8 +
  9 +type ListTaskTypeQuery struct {
  10 +}
  11 +
  12 +func (listTaskTypeQuery *ListTaskTypeQuery) ValidateQuery() error {
  13 + valid := validation.Validation{}
  14 + b, err := valid.Valid(listTaskTypeQuery)
  15 + if err != nil {
  16 + return err
  17 + }
  18 + if !b {
  19 + for _, validErr := range valid.Errors {
  20 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  21 + }
  22 + }
  23 + return nil
  24 +}
@@ -14,55 +14,76 @@ func (configService *ConfigService) ListTaskStatus(listTaskStatusQuery *query.Li @@ -14,55 +14,76 @@ func (configService *ConfigService) ListTaskStatus(listTaskStatusQuery *query.Li
14 if err := listTaskStatusQuery.ValidateQuery(); err != nil { 14 if err := listTaskStatusQuery.ValidateQuery(); err != nil {
15 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 15 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
16 } 16 }
17 - taskStatuses := map[int]string{ 17 + taskStatusMap := map[int]string{
18 1: "待发布", 18 1: "待发布",
19 2: "待领取", 19 2: "待领取",
20 3: "进行中", 20 3: "进行中",
21 4: "待验收", 21 4: "待验收",
22 5: "已完成", 22 5: "已完成",
23 } 23 }
  24 + var list []map[string]interface{}
  25 + for key, value := range taskStatusMap {
  26 + list = append(list, map[string]interface{}{
  27 + "id": key,
  28 + "name": value,
  29 + })
  30 + }
24 return map[string]interface{}{ 31 return map[string]interface{}{
25 - "taskStatuses": taskStatuses, 32 + "taskStatuses": list,
26 }, nil 33 }, nil
27 } 34 }
28 35
29 // 返回任务类型列表 36 // 返回任务类型列表
30 -func (configService *ConfigService) ListTaskTypes(listTaskTypesQuery *query.ListTaskTypesQuery) (interface{}, error) {  
31 - if err := listTaskTypesQuery.ValidateQuery(); err != nil { 37 +func (configService *ConfigService) ListTaskType(listTaskTypeQuery *query.ListTaskTypeQuery) (interface{}, error) {
  38 + if err := listTaskTypeQuery.ValidateQuery(); err != nil {
32 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 39 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
33 } 40 }
34 - taskTypes := map[int]string{ 41 + taskTypeMap := map[int]string{
35 1: "抢单任务", 42 1: "抢单任务",
36 2: "竞标任务", 43 2: "竞标任务",
37 } 44 }
  45 + var list []map[string]interface{}
  46 + for key, value := range taskTypeMap {
  47 + list = append(list, map[string]interface{}{
  48 + "id": key,
  49 + "name": value,
  50 + })
  51 + }
38 return map[string]interface{}{ 52 return map[string]interface{}{
39 - "taskTypes": taskTypes, 53 + "taskTypes": list,
40 }, nil 54 }, nil
41 } 55 }
42 56
43 // 返回任务性质列表 57 // 返回任务性质列表
44 -func (configService *ConfigService) ListTaskNatures(listTaskNaturesQuery *query.ListTaskNaturesQuery) (interface{}, error) {  
45 - if err := listTaskNaturesQuery.ValidateQuery(); err != nil { 58 +func (configService *ConfigService) ListTaskNature(listTaskNatureQuery *query.ListTaskNatureQuery) (interface{}, error) {
  59 + if err := listTaskNatureQuery.ValidateQuery(); err != nil {
46 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 60 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
47 } 61 }
48 - taskNatures := map[int]string{ 62 + taskNatureMap := map[int]string{
49 1: "点", 63 1: "点",
50 2: "线", 64 2: "线",
51 3: "面", 65 3: "面",
52 4: "链", 66 4: "链",
53 5: "网", 67 5: "网",
54 } 68 }
  69 + var list []map[string]interface{}
  70 + for key, value := range taskNatureMap {
  71 + list = append(list, map[string]interface{}{
  72 + "id": key,
  73 + "name": value,
  74 + })
  75 + }
55 return map[string]interface{}{ 76 return map[string]interface{}{
56 - "taskNatures": taskNatures, 77 + "taskNatures": list,
57 }, nil 78 }, nil
58 } 79 }
59 80
60 // 返回客户价值列表 81 // 返回客户价值列表
61 -func (configService *ConfigService) ListCustomerValues(listCustomerValuesQuery *query.ListCustomerValuesQuery) (interface{}, error) {  
62 - if err := listCustomerValuesQuery.ValidateQuery(); err != nil { 82 +func (configService *ConfigService) ListCustomerValue(listCustomerValueQuery *query.ListCustomerValueQuery) (interface{}, error) {
  83 + if err := listCustomerValueQuery.ValidateQuery(); err != nil {
63 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 84 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
64 } 85 }
65 - customerValues := map[int]string{ 86 + customerValueMap := map[int]string{
66 1: "口味", 87 1: "口味",
67 2: "口感", 88 2: "口感",
68 3: "色泽", 89 3: "色泽",
@@ -87,8 +108,58 @@ func (configService *ConfigService) ListCustomerValues(listCustomerValuesQuery * @@ -87,8 +108,58 @@ func (configService *ConfigService) ListCustomerValues(listCustomerValuesQuery *
87 22: "品牌", 108 22: "品牌",
88 23: "合同", 109 23: "合同",
89 } 110 }
  111 + var list []map[string]interface{}
  112 + for key, value := range customerValueMap {
  113 + list = append(list, map[string]interface{}{
  114 + "id": key,
  115 + "name": value,
  116 + })
  117 + }
  118 + return map[string]interface{}{
  119 + "customerValues": list,
  120 + }, nil
  121 +}
  122 +
  123 +// 返回任务引用资源类型字典列表
  124 +func (configService *ConfigService) ListReferenceResourceType(listReferenceResourceTypeQuery *query.ListReferenceResourceTypeQuery) (interface{}, error) {
  125 + if err := listReferenceResourceTypeQuery.ValidateQuery(); err != nil {
  126 + return nil, application.ThrowError(application.ARG_ERROR, err.Error())
  127 + }
  128 + referenceResourceTypeMap := map[int]string{
  129 + 1: "问题",
  130 + 2: "机会",
  131 + }
  132 + var list []map[string]interface{}
  133 + for key, value := range referenceResourceTypeMap {
  134 + list = append(list, map[string]interface{}{
  135 + "id": key,
  136 + "name": value,
  137 + })
  138 + }
  139 + return map[string]interface{}{
  140 + "referenceResourceTypes": list,
  141 + }, nil
  142 +}
  143 +
  144 +// 返回竞标时间字典列表(1全部,2已截止,3未截止)
  145 +func (configService *ConfigService) ListBidTimeMatch(listBidTimeMatchQuery *query.ListBidTimeMatchQuery) (interface{}, error) {
  146 + if err := listBidTimeMatchQuery.ValidateQuery(); err != nil {
  147 + return nil, application.ThrowError(application.ARG_ERROR, err.Error())
  148 + }
  149 + bidTimeMatchMap := map[int]string{
  150 + 1: "全部",
  151 + 2: "已截止",
  152 + 3: "未截止",
  153 + }
  154 + var list []map[string]interface{}
  155 + for key, value := range bidTimeMatchMap {
  156 + list = append(list, map[string]interface{}{
  157 + "id": key,
  158 + "name": value,
  159 + })
  160 + }
90 return map[string]interface{}{ 161 return map[string]interface{}{
91 - "customerValues": customerValues, 162 + "bidTimeMatchs": list,
92 }, nil 163 }, nil
93 } 164 }
94 165
@@ -29,3 +29,11 @@ func CreateOffTaskRecordRepository(options map[string]interface{}) (domain.OffTa @@ -29,3 +29,11 @@ func CreateOffTaskRecordRepository(options map[string]interface{}) (domain.OffTa
29 } 29 }
30 return repository.NewOffTaskRecordRepository(transactionContext) 30 return repository.NewOffTaskRecordRepository(transactionContext)
31 } 31 }
  32 +
  33 +func CreateSuMoneyTransactionRecordRepository(options map[string]interface{}) (domain.SuMoneyTransactionRecordRepository, error) {
  34 + var transactionContext *pg.TransactionContext
  35 + if value, ok := options["transactionContext"]; ok {
  36 + transactionContext = value.(*pg.TransactionContext)
  37 + }
  38 + return repository.NewSuMoneyTransactionRecordRepository(transactionContext)
  39 +}
  1 +package command
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "github.com/astaxie/beego/validation"
  7 +)
  8 +
  9 +type ExchangeSuMoneyCommand struct {
  10 + // 兑换人UID
  11 + Uid int64 `json:"uid" valid:"Required"`
  12 + // 素币值
  13 + SuMoney float64 `json:"suMoney" valid:"Required"`
  14 + // 操作人UID(默认为系统操作)
  15 + Operator int64 `json:"operator,omitempty"`
  16 + // 兑换描述
  17 + ExchangeDescription string `json:"exchangeDescription" valid:"Required"`
  18 +}
  19 +
  20 +func (exchangeSuMoneyCommand *ExchangeSuMoneyCommand) ValidateCommand() error {
  21 + valid := validation.Validation{}
  22 + b, err := valid.Valid(exchangeSuMoneyCommand)
  23 + if err != nil {
  24 + return err
  25 + }
  26 + if !b {
  27 + for _, validErr := range valid.Errors {
  28 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  29 + }
  30 + }
  31 + return nil
  32 +}
  1 +package command
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "github.com/astaxie/beego/validation"
  7 +)
  8 +
  9 +type SearchSuMoneyTransactionRecordCommand struct {
  10 + // 统一用户UID
  11 + Uid int64 `json:"uid" valid:"Required"`
  12 + // 记录类型(1兑换,2任务奖励)
  13 + RecordType int `json:"recordType" valid:"Required"`
  14 + // 查询偏离量
  15 + Offset int `json:"offset,omitempty"`
  16 + // 查询限制
  17 + Limit int `json:"limit,omitempty"`
  18 +}
  19 +
  20 +func (searchSuMoneyTransactionRecordCommand *SearchSuMoneyTransactionRecordCommand) ValidateCommand() error {
  21 + valid := validation.Validation{}
  22 + b, err := valid.Valid(searchSuMoneyTransactionRecordCommand)
  23 + if err != nil {
  24 + return err
  25 + }
  26 + if !b {
  27 + for _, validErr := range valid.Errors {
  28 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  29 + }
  30 + }
  31 + return nil
  32 +}
  1 +package service
  2 +
  3 +import (
  4 + "github.com/linmadan/egglib-go/core/application"
  5 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/factory"
  6 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/command"
  7 +)
  8 +
  9 +// 素币服务
  10 +type SuMoneyService struct {
  11 +}
  12 +
  13 +// 素币兑换
  14 +func (suMoneyService *SuMoneyService) ExchangeSuMoney(exchangeSuMoneyCommand *command.ExchangeSuMoneyCommand) (interface{}, error) {
  15 + if err := exchangeSuMoneyCommand.ValidateCommand(); err != nil {
  16 + return nil, application.ThrowError(application.ARG_ERROR, err.Error())
  17 + }
  18 + transactionContext, err := factory.CreateTransactionContext(nil)
  19 + if err != nil {
  20 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  21 + }
  22 + if err := transactionContext.StartTransaction(); err != nil {
  23 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  24 + }
  25 + defer func() {
  26 + transactionContext.RollbackTransaction()
  27 + }()
  28 + if err := transactionContext.CommitTransaction(); err != nil {
  29 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  30 + }
  31 + return nil, nil
  32 +}
  33 +
  34 +// 搜索素币事务记录
  35 +func (suMoneyService *SuMoneyService) SearchSuMoneyTransactionRecord(searchSuMoneyTransactionRecordCommand *command.SearchSuMoneyTransactionRecordCommand) (interface{}, error) {
  36 + if err := searchSuMoneyTransactionRecordCommand.ValidateCommand(); err != nil {
  37 + return nil, application.ThrowError(application.ARG_ERROR, err.Error())
  38 + }
  39 + transactionContext, err := factory.CreateTransactionContext(nil)
  40 + if err != nil {
  41 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  42 + }
  43 + if err := transactionContext.StartTransaction(); err != nil {
  44 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  45 + }
  46 + defer func() {
  47 + transactionContext.RollbackTransaction()
  48 + }()
  49 + if err := transactionContext.CommitTransaction(); err != nil {
  50 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  51 + }
  52 + return nil, nil
  53 +}
  54 +
  55 +func NewSuMoneyService(options map[string]interface{}) *SuMoneyService {
  56 + newSuMoneyService := &SuMoneyService{}
  57 + return newSuMoneyService
  58 +}
  1 +package domain
  2 +
  3 +import "time"
  4 +
  5 +// 素币事务记录
  6 +type SuMoneyTransactionRecord struct {
  7 + // 素币事务记录ID
  8 + SuMoneyTransactionRecordId int64 `json:"suMoneyTransactionRecordId"`
  9 + // 记录类型
  10 + RecordType int `json:"recordType"`
  11 + // 记录关联员工
  12 + Employee *EmployeeInfo `json:"employeeInfo"`
  13 + // 事务素币值
  14 + SuMoney float64 `json:"suMoney"`
  15 + // 操作人
  16 + Operator int64 `json:"operator"`
  17 + // 素币事务记录描述
  18 + RecordDescription string `json:"recordDescription"`
  19 + // 创建时间
  20 + CreateTime time.Time `json:"createTime"`
  21 +}
  22 +
  23 +type SuMoneyTransactionRecordRepository interface {
  24 + Save(suMoneyTransactionRecord *SuMoneyTransactionRecord) (*SuMoneyTransactionRecord, error)
  25 + Remove(suMoneyTransactionRecord *SuMoneyTransactionRecord) (*SuMoneyTransactionRecord, error)
  26 + FindOne(queryOptions map[string]interface{}) (*SuMoneyTransactionRecord, error)
  27 + Find(queryOptions map[string]interface{}) (int64, []*SuMoneyTransactionRecord, error)
  28 +}
  29 +
  30 +func (suMoneyTransactionRecord *SuMoneyTransactionRecord) Identify() interface{} {
  31 + if suMoneyTransactionRecord.SuMoneyTransactionRecordId == 0 {
  32 + return nil
  33 + }
  34 + return suMoneyTransactionRecord.SuMoneyTransactionRecordId
  35 +}
@@ -29,6 +29,7 @@ func init() { @@ -29,6 +29,7 @@ func init() {
29 (*models.BidInfo)(nil), 29 (*models.BidInfo)(nil),
30 (*models.Task)(nil), 30 (*models.Task)(nil),
31 (*models.OffTaskRecord)(nil), 31 (*models.OffTaskRecord)(nil),
  32 + (*models.SuMoneyTransactionRecord)(nil),
32 } { 33 } {
33 err := DB.CreateTable(model, &orm.CreateTableOptions{ 34 err := DB.CreateTable(model, &orm.CreateTableOptions{
34 Temp: false, 35 Temp: false,
  1 +package models
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
  5 + "time"
  6 +)
  7 +
  8 +type SuMoneyTransactionRecord struct {
  9 + TableName string `pg:"su_money_transaction_records,alias:su_money_transaction_record"`
  10 + // 素币事务记录ID
  11 + Id int64 `pg:",pk"`
  12 + // 记录类型
  13 + RecordType int
  14 + // 记录关联员工
  15 + Employee *domain.EmployeeInfo
  16 + // 事务素币值
  17 + SuMoney float64
  18 + // 操作人
  19 + Operator int64
  20 + // 素币事务记录描述
  21 + RecordDescription string
  22 + // 创建时间
  23 + CreateTime time.Time
  24 +}
  1 +package repository
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "github.com/go-pg/pg"
  7 + pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
  8 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
  9 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/pg/models"
  10 +)
  11 +
  12 +type SuMoneyTransactionRecordRepository struct {
  13 + transactionContext *pgTransaction.TransactionContext
  14 +}
  15 +
  16 +func (repository *SuMoneyTransactionRecordRepository) nextIdentify() (int64, error) {
  17 + return 0, nil
  18 +}
  19 +func (repository *SuMoneyTransactionRecordRepository) Save(suMoneyTransactionRecord *domain.SuMoneyTransactionRecord) (*domain.SuMoneyTransactionRecord, error) {
  20 + tx := repository.transactionContext.PgTx
  21 + if suMoneyTransactionRecord.Identify() == nil {
  22 + _, err := repository.nextIdentify()
  23 + if err != nil {
  24 + return suMoneyTransactionRecord, err
  25 + }
  26 + if _, err := tx.QueryOne(
  27 + pg.Scan(&suMoneyTransactionRecord.SuMoneyTransactionRecordId, &suMoneyTransactionRecord.RecordType, &suMoneyTransactionRecord.Employee, &suMoneyTransactionRecord.SuMoney, &suMoneyTransactionRecord.Operator, &suMoneyTransactionRecord.RecordDescription, &suMoneyTransactionRecord.CreateTime),
  28 + "INSERT INTO su_money_transaction_records (id, record_type, employee, su_money, operator, record_description, create_time) VALUES (?, ?, ?, ?, ?, ?, ?) RETURNING su_money_transaction_record_id, record_type, employee, su_money, operator, record_description, create_time",
  29 + suMoneyTransactionRecord.SuMoneyTransactionRecordId, suMoneyTransactionRecord.RecordType, suMoneyTransactionRecord.Employee, suMoneyTransactionRecord.SuMoney, suMoneyTransactionRecord.Operator, suMoneyTransactionRecord.RecordDescription, suMoneyTransactionRecord.CreateTime); err != nil {
  30 + return suMoneyTransactionRecord, err
  31 + }
  32 + } else {
  33 + if _, err := tx.QueryOne(
  34 + pg.Scan(&suMoneyTransactionRecord.SuMoneyTransactionRecordId, &suMoneyTransactionRecord.RecordType, &suMoneyTransactionRecord.Employee, &suMoneyTransactionRecord.SuMoney, &suMoneyTransactionRecord.Operator, &suMoneyTransactionRecord.RecordDescription, &suMoneyTransactionRecord.CreateTime),
  35 + "UPDATE su_money_transaction_records SET record_type=?, employee=?, su_money=?, operator=?, record_description=?, create_time=? WHERE id=? RETURNING su_money_transaction_record_id, record_type, employee, su_money, operator, record_description, create_time",
  36 + suMoneyTransactionRecord.RecordType, suMoneyTransactionRecord.Employee, suMoneyTransactionRecord.SuMoney, suMoneyTransactionRecord.Operator, suMoneyTransactionRecord.RecordDescription, suMoneyTransactionRecord.CreateTime, suMoneyTransactionRecord.SuMoneyTransactionRecordId); err != nil {
  37 + return suMoneyTransactionRecord, err
  38 + }
  39 + }
  40 + return suMoneyTransactionRecord, nil
  41 +}
  42 +func (repository *SuMoneyTransactionRecordRepository) Remove(suMoneyTransactionRecord *domain.SuMoneyTransactionRecord) (*domain.SuMoneyTransactionRecord, error) {
  43 + tx := repository.transactionContext.PgTx
  44 + suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord)
  45 + suMoneyTransactionRecordModel.Id = suMoneyTransactionRecord.Identify().(int64)
  46 + if _, err := tx.Model(suMoneyTransactionRecordModel).WherePK().Delete(); err != nil {
  47 + return suMoneyTransactionRecord, err
  48 + }
  49 + return suMoneyTransactionRecord, nil
  50 +}
  51 +func (repository *SuMoneyTransactionRecordRepository) FindOne(queryOptions map[string]interface{}) (*domain.SuMoneyTransactionRecord, error) {
  52 + tx := repository.transactionContext.PgTx
  53 + suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord)
  54 + query := tx.Model(suMoneyTransactionRecordModel)
  55 + if suMoneyTransactionRecordId, ok := queryOptions["suMoneyTransactionRecordId"]; ok {
  56 + query = query.Where("su_money_transaction_record.id = ?", suMoneyTransactionRecordId)
  57 + }
  58 + if err := query.First(); err != nil {
  59 + if err.Error() == "pg: no rows in result set" {
  60 + return nil, fmt.Errorf("没有此资源")
  61 + } else {
  62 + return nil, err
  63 + }
  64 + }
  65 + if suMoneyTransactionRecordModel.Id == 0 {
  66 + return nil, nil
  67 + } else {
  68 + return repository.transformPgModelToDomainModel(suMoneyTransactionRecordModel)
  69 + }
  70 +}
  71 +func (repository *SuMoneyTransactionRecordRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.SuMoneyTransactionRecord, error) {
  72 + tx := repository.transactionContext.PgTx
  73 + var suMoneyTransactionRecordModels []*models.SuMoneyTransactionRecord
  74 + suMoneyTransactionRecords := make([]*domain.SuMoneyTransactionRecord, 0)
  75 + query := tx.Model(&suMoneyTransactionRecordModels)
  76 + if employeeUid, ok := queryOptions["employeeUid"]; ok && (employeeUid != int64(0)) {
  77 + query = query.Where(`task.employee @> '{"uid":?}'`, employeeUid)
  78 + }
  79 + if offset, ok := queryOptions["offset"]; ok {
  80 + offset := offset.(int)
  81 + if offset > -1 {
  82 + query = query.Offset(offset)
  83 + }
  84 + } else {
  85 + query = query.Offset(0)
  86 + }
  87 + if limit, ok := queryOptions["limit"]; ok {
  88 + limit := limit.(int)
  89 + if limit > -1 {
  90 + query = query.Limit(limit)
  91 + }
  92 + } else {
  93 + query = query.Limit(20)
  94 + }
  95 + if count, err := query.Order("id DESC").SelectAndCount(); err != nil {
  96 + return 0, suMoneyTransactionRecords, err
  97 + } else {
  98 + for _, suMoneyTransactionRecordModel := range suMoneyTransactionRecordModels {
  99 + if suMoneyTransactionRecord, err := repository.transformPgModelToDomainModel(suMoneyTransactionRecordModel); err != nil {
  100 + return 0, suMoneyTransactionRecords, err
  101 + } else {
  102 + suMoneyTransactionRecords = append(suMoneyTransactionRecords, suMoneyTransactionRecord)
  103 + }
  104 + suMoneyTransactionRecords = append(suMoneyTransactionRecords, &domain.SuMoneyTransactionRecord{})
  105 + }
  106 + return int64(count), suMoneyTransactionRecords, nil
  107 + }
  108 +}
  109 +func (repository *SuMoneyTransactionRecordRepository) transformPgModelToDomainModel(suMoneyTransactionRecordModel *models.SuMoneyTransactionRecord) (*domain.SuMoneyTransactionRecord, error) {
  110 + return &domain.SuMoneyTransactionRecord{
  111 + SuMoneyTransactionRecordId: suMoneyTransactionRecordModel.Id,
  112 + RecordType: suMoneyTransactionRecordModel.RecordType,
  113 + Employee: suMoneyTransactionRecordModel.Employee,
  114 + SuMoney: suMoneyTransactionRecordModel.SuMoney,
  115 + Operator: suMoneyTransactionRecordModel.Operator,
  116 + RecordDescription: suMoneyTransactionRecordModel.RecordDescription,
  117 + CreateTime: suMoneyTransactionRecordModel.CreateTime,
  118 + }, nil
  119 +}
  120 +func NewSuMoneyTransactionRecordRepository(transactionContext *pgTransaction.TransactionContext) (*SuMoneyTransactionRecordRepository, error) {
  121 + if transactionContext == nil {
  122 + return nil, fmt.Errorf("transactionContext参数不能为nil")
  123 + } else {
  124 + return &SuMoneyTransactionRecordRepository{
  125 + transactionContext: transactionContext,
  126 + }, nil
  127 + }
  128 +}
@@ -25,10 +25,10 @@ func (controller *ConfigController) ListTaskStatus() { @@ -25,10 +25,10 @@ func (controller *ConfigController) ListTaskStatus() {
25 controller.ServeJSON() 25 controller.ServeJSON()
26 } 26 }
27 27
28 -func (controller *ConfigController) ListTaskTypes() { 28 +func (controller *ConfigController) ListTaskType() {
29 configService := service.NewConfigService(nil) 29 configService := service.NewConfigService(nil)
30 - listTaskTypesQuery := &query.ListTaskTypesQuery{}  
31 - data, err := configService.ListTaskTypes(listTaskTypesQuery) 30 + listTaskTypeQuery := &query.ListTaskTypeQuery{}
  31 + data, err := configService.ListTaskType(listTaskTypeQuery)
32 var response utils.JsonResponse 32 var response utils.JsonResponse
33 if err != nil { 33 if err != nil {
34 response = utils.ResponseError(controller.Ctx, err) 34 response = utils.ResponseError(controller.Ctx, err)
@@ -39,10 +39,10 @@ func (controller *ConfigController) ListTaskTypes() { @@ -39,10 +39,10 @@ func (controller *ConfigController) ListTaskTypes() {
39 controller.ServeJSON() 39 controller.ServeJSON()
40 } 40 }
41 41
42 -func (controller *ConfigController) ListTaskNatures() { 42 +func (controller *ConfigController) ListTaskNature() {
43 configService := service.NewConfigService(nil) 43 configService := service.NewConfigService(nil)
44 - listTaskNaturesQuery := &query.ListTaskNaturesQuery{}  
45 - data, err := configService.ListTaskNatures(listTaskNaturesQuery) 44 + listTaskNatureQuery := &query.ListTaskNatureQuery{}
  45 + data, err := configService.ListTaskNature(listTaskNatureQuery)
46 var response utils.JsonResponse 46 var response utils.JsonResponse
47 if err != nil { 47 if err != nil {
48 response = utils.ResponseError(controller.Ctx, err) 48 response = utils.ResponseError(controller.Ctx, err)
@@ -53,10 +53,38 @@ func (controller *ConfigController) ListTaskNatures() { @@ -53,10 +53,38 @@ func (controller *ConfigController) ListTaskNatures() {
53 controller.ServeJSON() 53 controller.ServeJSON()
54 } 54 }
55 55
56 -func (controller *ConfigController) ListCustomerValues() { 56 +func (controller *ConfigController) ListCustomerValue() {
57 configService := service.NewConfigService(nil) 57 configService := service.NewConfigService(nil)
58 - listCustomerValuesQuery := &query.ListCustomerValuesQuery{}  
59 - data, err := configService.ListCustomerValues(listCustomerValuesQuery) 58 + listCustomerValueQuery := &query.ListCustomerValueQuery{}
  59 + data, err := configService.ListCustomerValue(listCustomerValueQuery)
  60 + var response utils.JsonResponse
  61 + if err != nil {
  62 + response = utils.ResponseError(controller.Ctx, err)
  63 + } else {
  64 + response = utils.ResponseData(controller.Ctx, data)
  65 + }
  66 + controller.Data["json"] = response
  67 + controller.ServeJSON()
  68 +}
  69 +
  70 +func (controller *ConfigController) ListReferenceResourceType() {
  71 + configService := service.NewConfigService(nil)
  72 + listReferenceResourceTypeQuery := &query.ListReferenceResourceTypeQuery{}
  73 + data, err := configService.ListReferenceResourceType(listReferenceResourceTypeQuery)
  74 + var response utils.JsonResponse
  75 + if err != nil {
  76 + response = utils.ResponseError(controller.Ctx, err)
  77 + } else {
  78 + response = utils.ResponseData(controller.Ctx, data)
  79 + }
  80 + controller.Data["json"] = response
  81 + controller.ServeJSON()
  82 +}
  83 +
  84 +func (controller *ConfigController) ListBidTimeMatch() {
  85 + configService := service.NewConfigService(nil)
  86 + listBidTimeMatchQuery := &query.ListBidTimeMatchQuery{}
  87 + data, err := configService.ListBidTimeMatch(listBidTimeMatchQuery)
60 var response utils.JsonResponse 88 var response utils.JsonResponse
61 if err != nil { 89 if err != nil {
62 response = utils.ResponseError(controller.Ctx, err) 90 response = utils.ResponseError(controller.Ctx, err)
@@ -7,7 +7,9 @@ import ( @@ -7,7 +7,9 @@ import (
7 7
8 func init() { 8 func init() {
9 beego.Router("/config/task-statuses", &controllers.ConfigController{}, "Get:ListTaskStatus") 9 beego.Router("/config/task-statuses", &controllers.ConfigController{}, "Get:ListTaskStatus")
10 - beego.Router("/config/task-types", &controllers.ConfigController{}, "Get:ListTaskTypes")  
11 - beego.Router("/config/task-natures", &controllers.ConfigController{}, "Get:ListTaskNatures")  
12 - beego.Router("/config/customer-values", &controllers.ConfigController{}, "Get:ListCustomerValues") 10 + beego.Router("/config/task-types", &controllers.ConfigController{}, "Get:ListTaskType")
  11 + beego.Router("/config/task-natures", &controllers.ConfigController{}, "Get:ListTaskNature")
  12 + beego.Router("/config/customer-values", &controllers.ConfigController{}, "Get:ListCustomerValue")
  13 + beego.Router("/config/reference-resource-types", &controllers.ConfigController{}, "Get:ListReferenceResourceType")
  14 + beego.Router("/config/bid-time-matchs", &controllers.ConfigController{}, "Get:ListBidTimeMatch")
13 } 15 }
  1 +package config
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/gavv/httpexpect"
  7 + . "github.com/onsi/ginkgo"
  8 +)
  9 +
  10 +var _ = Describe("返回竞标时间字典列表(1全部,2已截止,3未截止)", func() {
  11 + Describe("返回竞标时间字典列表(1全部,2已截止,3未截止)", func() {
  12 + Context("", func() {
  13 + It("", func() {
  14 + httpExpect := httpexpect.New(GinkgoT(), server.URL)
  15 + httpExpect.GET("/config/bid-time-matchs").
  16 + Expect().
  17 + Status(http.StatusOK).
  18 + JSON().
  19 + Object().
  20 + ContainsKey("code").ValueEqual("code", 0).
  21 + ContainsKey("msg").ValueEqual("msg", "ok").
  22 + ContainsKey("data").Value("data").Object()
  23 + })
  24 + })
  25 + })
  26 +})
  1 +package config
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/gavv/httpexpect"
  7 + . "github.com/onsi/ginkgo"
  8 +)
  9 +
  10 +var _ = Describe("返回任务引用资源类型字典列表", func() {
  11 + Describe("返回任务引用资源类型字典列表", func() {
  12 + Context("", func() {
  13 + It("", func() {
  14 + httpExpect := httpexpect.New(GinkgoT(), server.URL)
  15 + httpExpect.GET("/config/reference-resource-types").
  16 + Expect().
  17 + Status(http.StatusOK).
  18 + JSON().
  19 + Object().
  20 + ContainsKey("code").ValueEqual("code", 0).
  21 + ContainsKey("msg").ValueEqual("msg", "ok").
  22 + ContainsKey("data").Value("data").Object()
  23 + })
  24 + })
  25 + })
  26 +})