作者 linmadan

添加配置字典api

@@ -18,6 +18,90 @@ @@ -18,6 +18,90 @@
18 "application/xml" 18 "application/xml"
19 ], 19 ],
20 "paths": { 20 "paths": {
  21 + "/config/customer-values": {
  22 + "get": {
  23 + "tags": [
  24 + "config"
  25 + ],
  26 + "summary": "返回客户价值列表",
  27 + "description": "返回客户价值列表",
  28 + "operationId": "config#listCustomerValues",
  29 + "responses": {
  30 + "200": {
  31 + "description": "OK response.",
  32 + "schema": {
  33 + "$ref": "#/definitions/ConfigListCustomerValuesResponseBody"
  34 + }
  35 + }
  36 + },
  37 + "schemes": [
  38 + "http"
  39 + ]
  40 + }
  41 + },
  42 + "/config/task-natures": {
  43 + "get": {
  44 + "tags": [
  45 + "config"
  46 + ],
  47 + "summary": "返回任务性质列表",
  48 + "description": "返回任务性质列表",
  49 + "operationId": "config#listTaskNatures",
  50 + "responses": {
  51 + "200": {
  52 + "description": "OK response.",
  53 + "schema": {
  54 + "$ref": "#/definitions/ConfigListTaskNaturesResponseBody"
  55 + }
  56 + }
  57 + },
  58 + "schemes": [
  59 + "http"
  60 + ]
  61 + }
  62 + },
  63 + "/config/task-statuses": {
  64 + "get": {
  65 + "tags": [
  66 + "config"
  67 + ],
  68 + "summary": "返回任务状态列表",
  69 + "description": "返回任务状态列表",
  70 + "operationId": "config#listTaskStatus",
  71 + "responses": {
  72 + "200": {
  73 + "description": "OK response.",
  74 + "schema": {
  75 + "$ref": "#/definitions/ConfigListTaskStatusResponseBody"
  76 + }
  77 + }
  78 + },
  79 + "schemes": [
  80 + "http"
  81 + ]
  82 + }
  83 + },
  84 + "/config/task-types": {
  85 + "get": {
  86 + "tags": [
  87 + "config"
  88 + ],
  89 + "summary": "返回任务类型列表",
  90 + "description": "返回任务类型列表",
  91 + "operationId": "config#listTaskTypes",
  92 + "responses": {
  93 + "200": {
  94 + "description": "OK response.",
  95 + "schema": {
  96 + "$ref": "#/definitions/ConfigListTaskTypesResponseBody"
  97 + }
  98 + }
  99 + },
  100 + "schemes": [
  101 + "http"
  102 + ]
  103 + }
  104 + },
21 "/employees": { 105 "/employees": {
22 "get": { 106 "get": {
23 "tags": [ 107 "tags": [
@@ -714,9 +798,88 @@ @@ -714,9 +798,88 @@
714 "http" 798 "http"
715 ] 799 ]
716 } 800 }
  801 + },
  802 + "/tasks/search-off-task-record": {
  803 + "post": {
  804 + "tags": [
  805 + "task"
  806 + ],
  807 + "summary": "搜索关闭任务记录",
  808 + "description": "搜索关闭任务记录",
  809 + "operationId": "task#searchOffTaskRecord",
  810 + "parameters": [
  811 + {
  812 + "name": "SearchOffTaskRecordRequestBody",
  813 + "in": "body",
  814 + "required": true,
  815 + "schema": {
  816 + "$ref": "#/definitions/TaskSearchOffTaskRecordRequestBody"
  817 + }
  818 + }
  819 + ],
  820 + "responses": {
  821 + "200": {
  822 + "description": "OK response.",
  823 + "schema": {
  824 + "$ref": "#/definitions/TaskSearchOffTaskRecordResponseBody"
  825 + }
  826 + }
  827 + },
  828 + "schemes": [
  829 + "http"
  830 + ]
  831 + }
717 } 832 }
718 }, 833 },
719 "definitions": { 834 "definitions": {
  835 + "ConfigListCustomerValuesResponseBody": {
  836 + "title": "Mediatype identifier: ConfigListCustomerValuesResponseBody",
  837 + "type": "object",
  838 + "properties": {
  839 + "customerValues": {
  840 + "type": "array",
  841 + "items": {
  842 + "$ref": "#/definitions/configResponseBody"
  843 + }
  844 + }
  845 + }
  846 + },
  847 + "ConfigListTaskNaturesResponseBody": {
  848 + "title": "Mediatype identifier: ConfigListTaskNaturesResponseBody",
  849 + "type": "object",
  850 + "properties": {
  851 + "taskNatures": {
  852 + "type": "array",
  853 + "items": {
  854 + "$ref": "#/definitions/configResponseBody"
  855 + }
  856 + }
  857 + }
  858 + },
  859 + "ConfigListTaskStatusResponseBody": {
  860 + "title": "Mediatype identifier: ConfigListTaskStatusResponseBody",
  861 + "type": "object",
  862 + "properties": {
  863 + "taskStatuses": {
  864 + "type": "array",
  865 + "items": {
  866 + "$ref": "#/definitions/configResponseBody"
  867 + }
  868 + }
  869 + }
  870 + },
  871 + "ConfigListTaskTypesResponseBody": {
  872 + "title": "Mediatype identifier: ConfigListTaskTypesResponseBody",
  873 + "type": "object",
  874 + "properties": {
  875 + "taskTypes": {
  876 + "type": "array",
  877 + "items": {
  878 + "$ref": "#/definitions/configResponseBody"
  879 + }
  880 + }
  881 + }
  882 + },
720 "EmployeeCreateEmployeeRequestBody": { 883 "EmployeeCreateEmployeeRequestBody": {
721 "title": "EmployeeCreateEmployeeRequestBody", 884 "title": "EmployeeCreateEmployeeRequestBody",
722 "type": "object", 885 "type": "object",
@@ -1133,6 +1296,73 @@ @@ -1133,6 +1296,73 @@
1133 } 1296 }
1134 } 1297 }
1135 }, 1298 },
  1299 + "TaskSearchOffTaskRecordRequestBody": {
  1300 + "title": "TaskSearchOffTaskRecordRequestBody",
  1301 + "type": "object",
  1302 + "properties": {
  1303 + "companyId": {
  1304 + "type": "integer",
  1305 + "description": "公司ID",
  1306 + "required": [
  1307 + "companyId"
  1308 + ]
  1309 + },
  1310 + "customerValue": {
  1311 + "type": "string",
  1312 + "description": "客户价值"
  1313 + },
  1314 + "limit": {
  1315 + "type": "integer",
  1316 + "description": "查询限制",
  1317 + "format": "int64"
  1318 + },
  1319 + "offEndTime": {
  1320 + "type": "string",
  1321 + "description": "关闭任务时间区间-截止时间",
  1322 + "format": "datetime"
  1323 + },
  1324 + "offStartTime": {
  1325 + "type": "string",
  1326 + "description": "关闭任务时间区间-开始时间",
  1327 + "format": "datetime"
  1328 + },
  1329 + "offset": {
  1330 + "type": "integer",
  1331 + "description": "查询偏离量",
  1332 + "format": "int64"
  1333 + },
  1334 + "taskContentMatch": {
  1335 + "type": "string",
  1336 + "description": "任务内容匹配"
  1337 + },
  1338 + "taskNature": {
  1339 + "type": "string",
  1340 + "description": "任务性质"
  1341 + },
  1342 + "taskType": {
  1343 + "type": "integer",
  1344 + "description": "任务类型",
  1345 + "format": "int64"
  1346 + }
  1347 + }
  1348 + },
  1349 + "TaskSearchOffTaskRecordResponseBody": {
  1350 + "title": "Mediatype identifier: TaskSearchOffTaskRecordResponseBody",
  1351 + "type": "object",
  1352 + "properties": {
  1353 + "count": {
  1354 + "type": "integer",
  1355 + "description": "结果总数",
  1356 + "format": "int64"
  1357 + },
  1358 + "offTaskRecords": {
  1359 + "type": "array",
  1360 + "items": {
  1361 + "$ref": "#/definitions/offTaskRecordResponseBody"
  1362 + }
  1363 + }
  1364 + }
  1365 + },
1136 "TaskSearchTaskRequestBody": { 1366 "TaskSearchTaskRequestBody": {
1137 "title": "TaskSearchTaskRequestBody", 1367 "title": "TaskSearchTaskRequestBody",
1138 "type": "object", 1368 "type": "object",
@@ -1341,6 +1571,27 @@ @@ -1341,6 +1571,27 @@
1341 }, 1571 },
1342 "description": "竞标人员信息" 1572 "description": "竞标人员信息"
1343 }, 1573 },
  1574 + "configResponseBody": {
  1575 + "title": "configResponseBody",
  1576 + "type": "object",
  1577 + "properties": {
  1578 + "id": {
  1579 + "type": "integer",
  1580 + "description": "ID",
  1581 + "required": [
  1582 + "id"
  1583 + ]
  1584 + },
  1585 + "name": {
  1586 + "type": "string",
  1587 + "description": "名称",
  1588 + "required": [
  1589 + "name"
  1590 + ]
  1591 + }
  1592 + },
  1593 + "description": "配置字典"
  1594 + },
1344 "employeeInfoRequestBody": { 1595 "employeeInfoRequestBody": {
1345 "title": "employeeInfoRequestBody", 1596 "title": "employeeInfoRequestBody",
1346 "type": "object", 1597 "type": "object",
@@ -1427,6 +1678,40 @@ @@ -1427,6 +1678,40 @@
1427 }, 1678 },
1428 "description": "员工" 1679 "description": "员工"
1429 }, 1680 },
  1681 + "offTaskRecordResponseBody": {
  1682 + "title": "offTaskRecordResponseBody",
  1683 + "type": "object",
  1684 + "properties": {
  1685 + "createTime": {
  1686 + "type": "string",
  1687 + "description": "创建时间",
  1688 + "required": [
  1689 + "createTime"
  1690 + ]
  1691 + },
  1692 + "offReason": {
  1693 + "type": "string",
  1694 + "description": "关闭理由",
  1695 + "required": [
  1696 + "offReason"
  1697 + ]
  1698 + },
  1699 + "offTaskRecordId": {
  1700 + "type": "integer",
  1701 + "description": "关闭任务记录ID",
  1702 + "required": [
  1703 + "offTaskRecordId"
  1704 + ]
  1705 + },
  1706 + "operator": {
  1707 + "$ref": "#/definitions/employeeInfoResponseBody"
  1708 + },
  1709 + "task": {
  1710 + "$ref": "#/definitions/taskResponseBody"
  1711 + }
  1712 + },
  1713 + "description": "关闭任务记录"
  1714 + },
1430 "referenceResourceItemRequestBody": { 1715 "referenceResourceItemRequestBody": {
1431 "title": "referenceResourceItemRequestBody", 1716 "title": "referenceResourceItemRequestBody",
1432 "type": "object", 1717 "type": "object",
@@ -5,7 +5,6 @@ info: @@ -5,7 +5,6 @@ info:
5 contact: 5 contact:
6 name: linmadan 6 name: linmadan
7 email: 772181827@qq.com 7 email: 772181827@qq.com
8 - home: www.madannet.com  
9 version: 0.0.1 8 version: 0.0.1
10 consumes: 9 consumes:
11 - application/json 10 - application/json
@@ -14,6 +13,62 @@ produces: @@ -14,6 +13,62 @@ produces:
14 - application/json 13 - application/json
15 - application/xml 14 - application/xml
16 paths: 15 paths:
  16 + /config/customer-values:
  17 + get:
  18 + tags:
  19 + - config
  20 + summary: 返回客户价值列表
  21 + description: 返回客户价值列表
  22 + operationId: config#listCustomerValues
  23 + responses:
  24 + "200":
  25 + description: OK response.
  26 + schema:
  27 + $ref: '#/definitions/ConfigListCustomerValuesResponseBody'
  28 + schemes:
  29 + - http
  30 + /config/task-natures:
  31 + get:
  32 + tags:
  33 + - config
  34 + summary: 返回任务性质列表
  35 + description: 返回任务性质列表
  36 + operationId: config#listTaskNatures
  37 + responses:
  38 + "200":
  39 + description: OK response.
  40 + schema:
  41 + $ref: '#/definitions/ConfigListTaskNaturesResponseBody'
  42 + schemes:
  43 + - http
  44 + /config/task-statuses:
  45 + get:
  46 + tags:
  47 + - config
  48 + summary: 返回任务状态列表
  49 + description: 返回任务状态列表
  50 + operationId: config#listTaskStatus
  51 + responses:
  52 + "200":
  53 + description: OK response.
  54 + schema:
  55 + $ref: '#/definitions/ConfigListTaskStatusResponseBody'
  56 + schemes:
  57 + - http
  58 + /config/task-types:
  59 + get:
  60 + tags:
  61 + - config
  62 + summary: 返回任务类型列表
  63 + description: 返回任务类型列表
  64 + operationId: config#listTaskTypes
  65 + responses:
  66 + "200":
  67 + description: OK response.
  68 + schema:
  69 + $ref: '#/definitions/ConfigListTaskTypesResponseBody'
  70 + schemes:
  71 + - http
17 /employees: 72 /employees:
18 get: 73 get:
19 tags: 74 tags:
@@ -481,7 +536,59 @@ paths: @@ -481,7 +536,59 @@ paths:
481 $ref: '#/definitions/TaskSearchTaskResponseBody' 536 $ref: '#/definitions/TaskSearchTaskResponseBody'
482 schemes: 537 schemes:
483 - http 538 - http
  539 + /tasks/search-off-task-record:
  540 + post:
  541 + tags:
  542 + - task
  543 + summary: 搜索关闭任务记录
  544 + description: 搜索关闭任务记录
  545 + operationId: task#searchOffTaskRecord
  546 + parameters:
  547 + - name: SearchOffTaskRecordRequestBody
  548 + in: body
  549 + required: true
  550 + schema:
  551 + $ref: '#/definitions/TaskSearchOffTaskRecordRequestBody'
  552 + responses:
  553 + "200":
  554 + description: OK response.
  555 + schema:
  556 + $ref: '#/definitions/TaskSearchOffTaskRecordResponseBody'
  557 + schemes:
  558 + - http
484 definitions: 559 definitions:
  560 + ConfigListCustomerValuesResponseBody:
  561 + title: 'Mediatype identifier: ConfigListCustomerValuesResponseBody'
  562 + type: object
  563 + properties:
  564 + customerValues:
  565 + type: array
  566 + items:
  567 + $ref: '#/definitions/configResponseBody'
  568 + ConfigListTaskNaturesResponseBody:
  569 + title: 'Mediatype identifier: ConfigListTaskNaturesResponseBody'
  570 + type: object
  571 + properties:
  572 + taskNatures:
  573 + type: array
  574 + items:
  575 + $ref: '#/definitions/configResponseBody'
  576 + ConfigListTaskStatusResponseBody:
  577 + title: 'Mediatype identifier: ConfigListTaskStatusResponseBody'
  578 + type: object
  579 + properties:
  580 + taskStatuses:
  581 + type: array
  582 + items:
  583 + $ref: '#/definitions/configResponseBody'
  584 + ConfigListTaskTypesResponseBody:
  585 + title: 'Mediatype identifier: ConfigListTaskTypesResponseBody'
  586 + type: object
  587 + properties:
  588 + taskTypes:
  589 + type: array
  590 + items:
  591 + $ref: '#/definitions/configResponseBody'
485 EmployeeCreateEmployeeRequestBody: 592 EmployeeCreateEmployeeRequestBody:
486 title: EmployeeCreateEmployeeRequestBody 593 title: EmployeeCreateEmployeeRequestBody
487 type: object 594 type: object
@@ -772,6 +879,56 @@ definitions: @@ -772,6 +879,56 @@ definitions:
772 properties: 879 properties:
773 task: 880 task:
774 $ref: '#/definitions/taskResponseBody' 881 $ref: '#/definitions/taskResponseBody'
  882 + TaskSearchOffTaskRecordRequestBody:
  883 + title: TaskSearchOffTaskRecordRequestBody
  884 + type: object
  885 + properties:
  886 + companyId:
  887 + type: integer
  888 + description: 公司ID
  889 + required:
  890 + - companyId
  891 + customerValue:
  892 + type: string
  893 + description: 客户价值
  894 + limit:
  895 + type: integer
  896 + description: 查询限制
  897 + format: int64
  898 + offEndTime:
  899 + type: string
  900 + description: 关闭任务时间区间-截止时间
  901 + format: datetime
  902 + offStartTime:
  903 + type: string
  904 + description: 关闭任务时间区间-开始时间
  905 + format: datetime
  906 + offset:
  907 + type: integer
  908 + description: 查询偏离量
  909 + format: int64
  910 + taskContentMatch:
  911 + type: string
  912 + description: 任务内容匹配
  913 + taskNature:
  914 + type: string
  915 + description: 任务性质
  916 + taskType:
  917 + type: integer
  918 + description: 任务类型
  919 + format: int64
  920 + TaskSearchOffTaskRecordResponseBody:
  921 + title: 'Mediatype identifier: TaskSearchOffTaskRecordResponseBody'
  922 + type: object
  923 + properties:
  924 + count:
  925 + type: integer
  926 + description: 结果总数
  927 + format: int64
  928 + offTaskRecords:
  929 + type: array
  930 + items:
  931 + $ref: '#/definitions/offTaskRecordResponseBody'
775 TaskSearchTaskRequestBody: 932 TaskSearchTaskRequestBody:
776 title: TaskSearchTaskRequestBody 933 title: TaskSearchTaskRequestBody
777 type: object 934 type: object
@@ -925,6 +1082,21 @@ definitions: @@ -925,6 +1082,21 @@ definitions:
925 bidder: 1082 bidder:
926 $ref: '#/definitions/employeeInfoResponseBody' 1083 $ref: '#/definitions/employeeInfoResponseBody'
927 description: 竞标人员信息 1084 description: 竞标人员信息
  1085 + configResponseBody:
  1086 + title: configResponseBody
  1087 + type: object
  1088 + properties:
  1089 + id:
  1090 + type: integer
  1091 + description: ID
  1092 + required:
  1093 + - id
  1094 + name:
  1095 + type: string
  1096 + description: 名称
  1097 + required:
  1098 + - name
  1099 + description: 配置字典
928 employeeInfoRequestBody: 1100 employeeInfoRequestBody:
929 title: employeeInfoRequestBody 1101 title: employeeInfoRequestBody
930 type: object 1102 type: object
@@ -987,6 +1159,30 @@ definitions: @@ -987,6 +1159,30 @@ definitions:
987 required: 1159 required:
988 - suMoney 1160 - suMoney
989 description: 员工 1161 description: 员工
  1162 + offTaskRecordResponseBody:
  1163 + title: offTaskRecordResponseBody
  1164 + type: object
  1165 + properties:
  1166 + createTime:
  1167 + type: string
  1168 + description: 创建时间
  1169 + required:
  1170 + - createTime
  1171 + offReason:
  1172 + type: string
  1173 + description: 关闭理由
  1174 + required:
  1175 + - offReason
  1176 + offTaskRecordId:
  1177 + type: integer
  1178 + description: 关闭任务记录ID
  1179 + required:
  1180 + - offTaskRecordId
  1181 + operator:
  1182 + $ref: '#/definitions/employeeInfoResponseBody'
  1183 + task:
  1184 + $ref: '#/definitions/taskResponseBody'
  1185 + description: 关闭任务记录
990 referenceResourceItemRequestBody: 1186 referenceResourceItemRequestBody:
991 title: referenceResourceItemRequestBody 1187 title: referenceResourceItemRequestBody
992 type: object 1188 type: object
  1 +package query
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "github.com/astaxie/beego/validation"
  7 +)
  8 +
  9 +type ListCustomerValuesQuery struct {
  10 +}
  11 +
  12 +func (listCustomerValuesQuery *ListCustomerValuesQuery) ValidateQuery() error {
  13 + valid := validation.Validation{}
  14 + b, err := valid.Valid(listCustomerValuesQuery)
  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 +}
  1 +package query
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "github.com/astaxie/beego/validation"
  7 +)
  8 +
  9 +type ListTaskNaturesQuery struct {
  10 +}
  11 +
  12 +func (listTaskNaturesQuery *ListTaskNaturesQuery) ValidateQuery() error {
  13 + valid := validation.Validation{}
  14 + b, err := valid.Valid(listTaskNaturesQuery)
  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 +}
  1 +package query
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "github.com/astaxie/beego/validation"
  7 +)
  8 +
  9 +type ListTaskStatusQuery struct {
  10 +}
  11 +
  12 +func (listTaskStatusQuery *ListTaskStatusQuery) ValidateQuery() error {
  13 + valid := validation.Validation{}
  14 + b, err := valid.Valid(listTaskStatusQuery)
  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 +}
  1 +package query
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "github.com/astaxie/beego/validation"
  7 +)
  8 +
  9 +type ListTaskTypesQuery struct {
  10 +}
  11 +
  12 +func (listTaskTypesQuery *ListTaskTypesQuery) ValidateQuery() error {
  13 + valid := validation.Validation{}
  14 + b, err := valid.Valid(listTaskTypesQuery)
  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 +}
  1 +package service
  2 +
  3 +import (
  4 + "github.com/linmadan/egglib-go/core/application"
  5 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/config/query"
  6 +)
  7 +
  8 +// 配置服务
  9 +type ConfigService struct {
  10 +}
  11 +
  12 +// 返回任务状态列表
  13 +func (configService *ConfigService) ListTaskStatus(listTaskStatusQuery *query.ListTaskStatusQuery) (interface{}, error) {
  14 + if err := listTaskStatusQuery.ValidateQuery(); err != nil {
  15 + return nil, application.ThrowError(application.ARG_ERROR, err.Error())
  16 + }
  17 + taskStatuses := map[int]string{
  18 + 1: "待发布",
  19 + 2: "待领取",
  20 + 3: "进行中",
  21 + 4: "待验收",
  22 + 5: "已完成",
  23 + }
  24 + return map[string]interface{}{
  25 + "taskStatuses": taskStatuses,
  26 + }, nil
  27 +}
  28 +
  29 +// 返回任务类型列表
  30 +func (configService *ConfigService) ListTaskTypes(listTaskTypesQuery *query.ListTaskTypesQuery) (interface{}, error) {
  31 + if err := listTaskTypesQuery.ValidateQuery(); err != nil {
  32 + return nil, application.ThrowError(application.ARG_ERROR, err.Error())
  33 + }
  34 + taskTypes := map[int]string{
  35 + 1: "抢单任务",
  36 + 2: "竞标任务",
  37 + }
  38 + return map[string]interface{}{
  39 + "taskTypes": taskTypes,
  40 + }, nil
  41 +}
  42 +
  43 +// 返回任务性质列表
  44 +func (configService *ConfigService) ListTaskNatures(listTaskNaturesQuery *query.ListTaskNaturesQuery) (interface{}, error) {
  45 + if err := listTaskNaturesQuery.ValidateQuery(); err != nil {
  46 + return nil, application.ThrowError(application.ARG_ERROR, err.Error())
  47 + }
  48 + taskNatures := map[int]string{
  49 + 1: "点",
  50 + 2: "线",
  51 + 3: "面",
  52 + 4: "链",
  53 + 5: "网",
  54 + }
  55 + return map[string]interface{}{
  56 + "taskNatures": taskNatures,
  57 + }, nil
  58 +}
  59 +
  60 +// 返回客户价值列表
  61 +func (configService *ConfigService) ListCustomerValues(listCustomerValuesQuery *query.ListCustomerValuesQuery) (interface{}, error) {
  62 + if err := listCustomerValuesQuery.ValidateQuery(); err != nil {
  63 + return nil, application.ThrowError(application.ARG_ERROR, err.Error())
  64 + }
  65 + customerValues := map[int]string{
  66 + 1: "口味",
  67 + 2: "口感",
  68 + 3: "色泽",
  69 + 4: "卖相",
  70 + 5: "包装",
  71 + 6: "储存",
  72 + 7: "运输",
  73 + 8: "价格",
  74 + 9: "应用",
  75 + 10: "便利",
  76 + 11: "交期",
  77 + 12: "数量",
  78 + 13: "账期",
  79 + 14: "品质",
  80 + 15: "新鲜度",
  81 + 16: "推广",
  82 + 17: "规格",
  83 + 18: "人情关系",
  84 + 19: "商务服务",
  85 + 20: "售后服务",
  86 + 21: "新品",
  87 + 22: "品牌",
  88 + 23: "合同",
  89 + }
  90 + return map[string]interface{}{
  91 + "customerValues": customerValues,
  92 + }, nil
  93 +}
  94 +
  95 +func NewConfigService(options map[string]interface{}) *ConfigService {
  96 + newConfigService := &ConfigService{}
  97 + return newConfigService
  98 +}
  1 +package controllers
  2 +
  3 +import (
  4 + "github.com/astaxie/beego"
  5 + "github.com/linmadan/egglib-go/web/beego/utils"
  6 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/config/query"
  7 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/config/service"
  8 +)
  9 +
  10 +type ConfigController struct {
  11 + beego.Controller
  12 +}
  13 +
  14 +func (controller *ConfigController) ListTaskStatus() {
  15 + configService := service.NewConfigService(nil)
  16 + listTaskStatusQuery := &query.ListTaskStatusQuery{}
  17 + data, err := configService.ListTaskStatus(listTaskStatusQuery)
  18 + var response utils.JsonResponse
  19 + if err != nil {
  20 + response = utils.ResponseError(controller.Ctx, err)
  21 + } else {
  22 + response = utils.ResponseData(controller.Ctx, data)
  23 + }
  24 + controller.Data["json"] = response
  25 + controller.ServeJSON()
  26 +}
  27 +
  28 +func (controller *ConfigController) ListTaskTypes() {
  29 + configService := service.NewConfigService(nil)
  30 + listTaskTypesQuery := &query.ListTaskTypesQuery{}
  31 + data, err := configService.ListTaskTypes(listTaskTypesQuery)
  32 + var response utils.JsonResponse
  33 + if err != nil {
  34 + response = utils.ResponseError(controller.Ctx, err)
  35 + } else {
  36 + response = utils.ResponseData(controller.Ctx, data)
  37 + }
  38 + controller.Data["json"] = response
  39 + controller.ServeJSON()
  40 +}
  41 +
  42 +func (controller *ConfigController) ListTaskNatures() {
  43 + configService := service.NewConfigService(nil)
  44 + listTaskNaturesQuery := &query.ListTaskNaturesQuery{}
  45 + data, err := configService.ListTaskNatures(listTaskNaturesQuery)
  46 + var response utils.JsonResponse
  47 + if err != nil {
  48 + response = utils.ResponseError(controller.Ctx, err)
  49 + } else {
  50 + response = utils.ResponseData(controller.Ctx, data)
  51 + }
  52 + controller.Data["json"] = response
  53 + controller.ServeJSON()
  54 +}
  55 +
  56 +func (controller *ConfigController) ListCustomerValues() {
  57 + configService := service.NewConfigService(nil)
  58 + listCustomerValuesQuery := &query.ListCustomerValuesQuery{}
  59 + data, err := configService.ListCustomerValues(listCustomerValuesQuery)
  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 +}
  1 +package routers
  2 +
  3 +import (
  4 + "github.com/astaxie/beego"
  5 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/port/beego/controllers"
  6 +)
  7 +
  8 +func init() {
  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")
  13 +}
  1 +package config
  2 +
  3 +import (
  4 + "net/http"
  5 + "net/http/httptest"
  6 + "testing"
  7 +
  8 + "github.com/astaxie/beego"
  9 + . "github.com/onsi/ginkgo"
  10 + . "github.com/onsi/gomega"
  11 + _ "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/pg"
  12 + _ "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/port/beego"
  13 +)
  14 +
  15 +func TestConfig(t *testing.T) {
  16 + RegisterFailHandler(Fail)
  17 + RunSpecs(t, "Beego Port Config Correlations Test Case Suite")
  18 +}
  19 +
  20 +var handler http.Handler
  21 +var server *httptest.Server
  22 +
  23 +var _ = BeforeSuite(func() {
  24 + handler = beego.BeeApp.Handlers
  25 + server = httptest.NewServer(handler)
  26 +})
  27 +
  28 +var _ = AfterSuite(func() {
  29 + server.Close()
  30 +})
  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/customer-values").
  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/task-natures").
  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/task-statuses").
  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/task-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 +})