作者 linmadan

完成申请完成任务接口,配置k8s部署文件

@@ -6,12 +6,10 @@ WORKDIR $APP_DIR/ @@ -6,12 +6,10 @@ WORKDIR $APP_DIR/
6 COPY ./pkg pkg 6 COPY ./pkg pkg
7 COPY ./conf conf 7 COPY ./conf conf
8 COPY ./go.mod go.mod 8 COPY ./go.mod go.mod
9 -COPY ./go.sum go.sum  
10 COPY ./main.go main.go 9 COPY ./main.go main.go
11 RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"] 10 RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"]
12 ENV GO111MODULE on 11 ENV GO111MODULE on
13 ENV GOPROXY https://goproxy.io 12 ENV GOPROXY https://goproxy.io
14 RUN ["go","mod","tidy"] 13 RUN ["go","mod","tidy"]
15 -RUN ["ls"]  
16 RUN ["go","build"] 14 RUN ["go","build"]
17 ENTRYPOINT ["./mmm-worth"] 15 ENTRYPOINT ["./mmm-worth"]
1 #!/bin/bash 1 #!/bin/bash
2 export PATH=/root/local/bin:$PATH 2 export PATH=/root/local/bin:$PATH
3 -kubectl -n <replace-your-k8s-namespace> get pods | grep -q mmm-worth 3 +kubectl -n mmm-worth-dev get pods | grep -q mmm-worth
4 if [ "$?" == "1" ];then 4 if [ "$?" == "1" ];then
5 kubectl create -f /tmp/dev/mmm-worth/mmm-worth.yaml --record 5 kubectl create -f /tmp/dev/mmm-worth/mmm-worth.yaml --record
6 - kubectl -n <replace-your-k8s-namespace> get svc | grep -q mmm-worth 6 + kubectl -n mmm-worth-dev get svc | grep -q mmm-worth
7 if [ "$?" == "0" ];then 7 if [ "$?" == "0" ];then
8 echo "mmm-worth service install success!" 8 echo "mmm-worth service install success!"
9 else 9 else
10 echo "mmm-worth service install fail!" 10 echo "mmm-worth service install fail!"
11 fi 11 fi
12 - kubectl -n <replace-your-k8s-namespace> get pods | grep -q mmm-worth 12 + kubectl -n mmm-worth-dev get pods | grep -q mmm-worth
13 if [ "$?" == "0" ];then 13 if [ "$?" == "0" ];then
14 echo "mmm-worth deployment install success!" 14 echo "mmm-worth deployment install success!"
15 else 15 else
@@ -17,24 +17,24 @@ if [ "$?" == "1" ];then @@ -17,24 +17,24 @@ if [ "$?" == "1" ];then
17 fi 17 fi
18 else 18 else
19 kubectl delete -f /tmp/dev/mmm-worth/mmm-worth.yaml 19 kubectl delete -f /tmp/dev/mmm-worth/mmm-worth.yaml
20 - kubectl -n <replace-your-k8s-namespace> get svc | grep -q mmm-worth 20 + kubectl -n mmm-worth-dev get svc | grep -q mmm-worth
21 while [ "$?" == "0" ] 21 while [ "$?" == "0" ]
22 do 22 do
23 - kubectl -n <replace-your-k8s-namespace> get svc | grep -q mmm-worth 23 + kubectl -n mmm-worth-dev get svc | grep -q mmm-worth
24 done 24 done
25 - kubectl -n <replace-your-k8s-namespace> get pods | grep -q mmm-worth 25 + kubectl -n mmm-worth-dev get pods | grep -q mmm-worth
26 while [ "$?" == "0" ] 26 while [ "$?" == "0" ]
27 do 27 do
28 - kubectl -n <replace-your-k8s-namespace> get pods | grep -q mmm-worth 28 + kubectl -n mmm-worth-dev get pods | grep -q mmm-worth
29 done 29 done
30 kubectl create -f /tmp/dev/mmm-worth/mmm-worth.yaml --record 30 kubectl create -f /tmp/dev/mmm-worth/mmm-worth.yaml --record
31 - kubectl -n <replace-your-k8s-namespace> get svc | grep -q mmm-worth 31 + kubectl -n mmm-worth-dev get svc | grep -q mmm-worth
32 if [ "$?" == "0" ];then 32 if [ "$?" == "0" ];then
33 echo "mmm-worth service update success!" 33 echo "mmm-worth service update success!"
34 else 34 else
35 echo "mmm-worth service update fail!" 35 echo "mmm-worth service update fail!"
36 fi 36 fi
37 - kubectl -n <replace-your-k8s-namespace> get pods | grep -q mmm-worth 37 + kubectl -n mmm-worth-dev get pods | grep -q mmm-worth
38 if [ "$?" == "0" ];then 38 if [ "$?" == "0" ];then
39 echo "mmm-worth deployment update success!" 39 echo "mmm-worth deployment update success!"
40 else 40 else
@@ -2,7 +2,7 @@ apiVersion: v1 @@ -2,7 +2,7 @@ apiVersion: v1
2 kind: Service 2 kind: Service
3 metadata: 3 metadata:
4 name: mmm-worth 4 name: mmm-worth
5 - namespace: <replace-your-k8s-namespace> 5 + namespace: mmm-worth-dev
6 labels: 6 labels:
7 k8s-app: mmm-worth 7 k8s-app: mmm-worth
8 spec: 8 spec:
@@ -17,7 +17,7 @@ apiVersion: extensions/v1beta1 @@ -17,7 +17,7 @@ apiVersion: extensions/v1beta1
17 kind: Deployment 17 kind: Deployment
18 metadata: 18 metadata:
19 name: mmm-worth 19 name: mmm-worth
20 - namespace: <replace-your-k8s-namespace> 20 + namespace: mmm-worth-dev
21 labels: 21 labels:
22 k8s-app: mmm-worth 22 k8s-app: mmm-worth
23 spec: 23 spec:
@@ -52,6 +52,16 @@ spec: @@ -52,6 +52,16 @@ spec:
52 - mountPath: /opt/logs 52 - mountPath: /opt/logs
53 name: accesslogs 53 name: accesslogs
54 env: 54 env:
  55 + - name: POSTGRESQL_DB_NAME
  56 + value: "mmm-worth"
  57 + - name: POSTGRESQL_USER
  58 + value: "postgres"
  59 + - name: POSTGRESQL_PASSWORD
  60 + value: "postgres_15432"
  61 + - name: POSTGRESQL_HOST
  62 + value: "101.37.68.23"
  63 + - name: POSTGRESQL_PORT
  64 + value: "15432"
55 - name: LOG_LEVEL 65 - name: LOG_LEVEL
56 value: "debug" 66 value: "debug"
57 - name: ERROR_BASE_CODE 67 - name: ERROR_BASE_CODE
  1 +{
  2 + "swagger": "2.0",
  3 + "info": {
  4 + "title": "",
  5 + "description": "买买买价值系统",
  6 + "contact": {
  7 + "name": "linmadan",
  8 + "email": "772181827@qq.com"
  9 + },
  10 + "version": "0.0.1"
  11 + },
  12 + "consumes": [
  13 + "application/json",
  14 + "application/xml"
  15 + ],
  16 + "produces": [
  17 + "application/json",
  18 + "application/xml"
  19 + ],
  20 + "paths": {
  21 + "/employees": {
  22 + "get": {
  23 + "tags": [
  24 + "employee"
  25 + ],
  26 + "summary": "返回员工列表",
  27 + "description": "返回员工列表",
  28 + "operationId": "employee#listEmployee",
  29 + "parameters": [
  30 + {
  31 + "name": "offset",
  32 + "in": "query",
  33 + "description": "查询偏离量",
  34 + "required": false,
  35 + "type": "integer"
  36 + },
  37 + {
  38 + "name": "limit",
  39 + "in": "query",
  40 + "description": "查询限制",
  41 + "required": false,
  42 + "type": "integer"
  43 + }
  44 + ],
  45 + "responses": {
  46 + "200": {
  47 + "description": "OK response.",
  48 + "schema": {
  49 + "$ref": "#/definitions/EmployeeListEmployeeResponseBody"
  50 + }
  51 + }
  52 + },
  53 + "schemes": [
  54 + "http"
  55 + ]
  56 + },
  57 + "post": {
  58 + "tags": [
  59 + "employee"
  60 + ],
  61 + "summary": "创建新员工",
  62 + "description": "创建新员工",
  63 + "operationId": "employee#createEmployee",
  64 + "parameters": [
  65 + {
  66 + "name": "CreateEmployeeRequestBody",
  67 + "in": "body",
  68 + "required": true,
  69 + "schema": {
  70 + "$ref": "#/definitions/EmployeeCreateEmployeeRequestBody"
  71 + }
  72 + }
  73 + ],
  74 + "responses": {
  75 + "200": {
  76 + "description": "OK response.",
  77 + "schema": {
  78 + "$ref": "#/definitions/EmployeeCreateEmployeeResponseBody"
  79 + }
  80 + }
  81 + },
  82 + "schemes": [
  83 + "http"
  84 + ]
  85 + }
  86 + },
  87 + "/employees/{uid}": {
  88 + "get": {
  89 + "tags": [
  90 + "employee"
  91 + ],
  92 + "summary": "返回员工",
  93 + "description": "返回员工",
  94 + "operationId": "employee#getEmployee",
  95 + "parameters": [
  96 + {
  97 + "name": "uid",
  98 + "in": "path",
  99 + "description": "统一用户UID",
  100 + "required": true,
  101 + "type": "integer"
  102 + }
  103 + ],
  104 + "responses": {
  105 + "200": {
  106 + "description": "OK response.",
  107 + "schema": {
  108 + "$ref": "#/definitions/EmployeeGetEmployeeResponseBody"
  109 + }
  110 + }
  111 + },
  112 + "schemes": [
  113 + "http"
  114 + ]
  115 + },
  116 + "put": {
  117 + "tags": [
  118 + "employee"
  119 + ],
  120 + "summary": "更新员工",
  121 + "description": "更新员工",
  122 + "operationId": "employee#updateEmployee",
  123 + "parameters": [
  124 + {
  125 + "name": "uid",
  126 + "in": "path",
  127 + "description": "统一用户UID",
  128 + "required": true,
  129 + "type": "integer"
  130 + },
  131 + {
  132 + "name": "UpdateEmployeeRequestBody",
  133 + "in": "body",
  134 + "required": true,
  135 + "schema": {
  136 + "$ref": "#/definitions/EmployeeUpdateEmployeeRequestBody"
  137 + }
  138 + }
  139 + ],
  140 + "responses": {
  141 + "200": {
  142 + "description": "OK response.",
  143 + "schema": {
  144 + "$ref": "#/definitions/EmployeeUpdateEmployeeResponseBody"
  145 + }
  146 + }
  147 + },
  148 + "schemes": [
  149 + "http"
  150 + ]
  151 + },
  152 + "delete": {
  153 + "tags": [
  154 + "employee"
  155 + ],
  156 + "summary": "移除员工",
  157 + "description": "移除员工",
  158 + "operationId": "employee#removeEmployee",
  159 + "parameters": [
  160 + {
  161 + "name": "uid",
  162 + "in": "path",
  163 + "description": "统一用户UID",
  164 + "required": true,
  165 + "type": "integer"
  166 + }
  167 + ],
  168 + "responses": {
  169 + "200": {
  170 + "description": "OK response.",
  171 + "schema": {
  172 + "$ref": "#/definitions/EmployeeRemoveEmployeeResponseBody"
  173 + }
  174 + }
  175 + },
  176 + "schemes": [
  177 + "http"
  178 + ]
  179 + }
  180 + },
  181 + "/tasks": {
  182 + "get": {
  183 + "tags": [
  184 + "task"
  185 + ],
  186 + "summary": "返回任务列表",
  187 + "description": "返回任务列表",
  188 + "operationId": "task#listTask",
  189 + "parameters": [
  190 + {
  191 + "name": "companyId",
  192 + "in": "query",
  193 + "description": "公司ID",
  194 + "required": false,
  195 + "type": "integer"
  196 + },
  197 + {
  198 + "name": "sponsor",
  199 + "in": "query",
  200 + "description": "任务发起者",
  201 + "required": false,
  202 + "type": "integer",
  203 + "format": "int64"
  204 + },
  205 + {
  206 + "name": "taskContentMatch",
  207 + "in": "query",
  208 + "description": "任务内容匹配",
  209 + "required": false,
  210 + "type": "string"
  211 + },
  212 + {
  213 + "name": "taskType",
  214 + "in": "query",
  215 + "description": "任务类型",
  216 + "required": false,
  217 + "type": "integer"
  218 + },
  219 + {
  220 + "name": "taskStatus",
  221 + "in": "query",
  222 + "description": "任务状态",
  223 + "required": false,
  224 + "type": "integer"
  225 + },
  226 + {
  227 + "name": "customerValue",
  228 + "in": "query",
  229 + "description": "客户价值",
  230 + "required": false,
  231 + "type": "string"
  232 + },
  233 + {
  234 + "name": "taskNature",
  235 + "in": "query",
  236 + "description": "任务性质",
  237 + "required": false,
  238 + "type": "string"
  239 + },
  240 + {
  241 + "name": "isRewardTake",
  242 + "in": "query",
  243 + "description": "是否悬赏任务",
  244 + "required": false,
  245 + "type": "boolean"
  246 + },
  247 + {
  248 + "name": "bidTimeMatch",
  249 + "in": "query",
  250 + "description": "竞标时间(1全部,2已截止,3未截止)",
  251 + "required": false,
  252 + "type": "integer"
  253 + },
  254 + {
  255 + "name": "receiver",
  256 + "in": "query",
  257 + "description": "任务领取人",
  258 + "required": false,
  259 + "type": "integer",
  260 + "format": "int64"
  261 + },
  262 + {
  263 + "name": "participator",
  264 + "in": "query",
  265 + "description": "任务参与者",
  266 + "required": false,
  267 + "type": "integer",
  268 + "format": "int64"
  269 + },
  270 + {
  271 + "name": "offset",
  272 + "in": "query",
  273 + "description": "查询偏离量",
  274 + "required": false,
  275 + "type": "integer"
  276 + },
  277 + {
  278 + "name": "limit",
  279 + "in": "query",
  280 + "description": "查询限制",
  281 + "required": false,
  282 + "type": "integer"
  283 + }
  284 + ],
  285 + "responses": {
  286 + "200": {
  287 + "description": "OK response.",
  288 + "schema": {
  289 + "$ref": "#/definitions/TaskListTaskResponseBody"
  290 + }
  291 + }
  292 + },
  293 + "schemes": [
  294 + "http"
  295 + ]
  296 + },
  297 + "post": {
  298 + "tags": [
  299 + "task"
  300 + ],
  301 + "summary": "创建新任务",
  302 + "description": "创建新任务",
  303 + "operationId": "task#createTask",
  304 + "parameters": [
  305 + {
  306 + "name": "CreateTaskRequestBody",
  307 + "in": "body",
  308 + "required": true,
  309 + "schema": {
  310 + "$ref": "#/definitions/TaskCreateTaskRequestBody"
  311 + }
  312 + }
  313 + ],
  314 + "responses": {
  315 + "200": {
  316 + "description": "OK response.",
  317 + "schema": {
  318 + "$ref": "#/definitions/TaskCreateTaskResponseBody"
  319 + }
  320 + }
  321 + },
  322 + "schemes": [
  323 + "http"
  324 + ]
  325 + }
  326 + },
  327 + "/tasks/{taskId}": {
  328 + "get": {
  329 + "tags": [
  330 + "task"
  331 + ],
  332 + "summary": "返回任务",
  333 + "description": "返回任务",
  334 + "operationId": "task#getTask",
  335 + "parameters": [
  336 + {
  337 + "name": "taskId",
  338 + "in": "path",
  339 + "description": "任务ID",
  340 + "required": true,
  341 + "type": "integer"
  342 + }
  343 + ],
  344 + "responses": {
  345 + "200": {
  346 + "description": "OK response.",
  347 + "schema": {
  348 + "$ref": "#/definitions/TaskGetTaskResponseBody"
  349 + }
  350 + }
  351 + },
  352 + "schemes": [
  353 + "http"
  354 + ]
  355 + },
  356 + "put": {
  357 + "tags": [
  358 + "task"
  359 + ],
  360 + "summary": "更新任务",
  361 + "description": "更新任务",
  362 + "operationId": "task#updateTask",
  363 + "parameters": [
  364 + {
  365 + "name": "taskId",
  366 + "in": "path",
  367 + "description": "任务ID",
  368 + "required": true,
  369 + "type": "integer"
  370 + },
  371 + {
  372 + "name": "UpdateTaskRequestBody",
  373 + "in": "body",
  374 + "required": true,
  375 + "schema": {
  376 + "$ref": "#/definitions/TaskUpdateTaskRequestBody"
  377 + }
  378 + }
  379 + ],
  380 + "responses": {
  381 + "200": {
  382 + "description": "OK response.",
  383 + "schema": {
  384 + "$ref": "#/definitions/TaskUpdateTaskResponseBody"
  385 + }
  386 + }
  387 + },
  388 + "schemes": [
  389 + "http"
  390 + ]
  391 + },
  392 + "delete": {
  393 + "tags": [
  394 + "task"
  395 + ],
  396 + "summary": "移除任务",
  397 + "description": "移除任务",
  398 + "operationId": "task#removeTask",
  399 + "parameters": [
  400 + {
  401 + "name": "taskId",
  402 + "in": "path",
  403 + "description": "任务ID",
  404 + "required": true,
  405 + "type": "integer"
  406 + }
  407 + ],
  408 + "responses": {
  409 + "200": {
  410 + "description": "OK response.",
  411 + "schema": {
  412 + "$ref": "#/definitions/TaskRemoveTaskResponseBody"
  413 + }
  414 + }
  415 + },
  416 + "schemes": [
  417 + "http"
  418 + ]
  419 + }
  420 + },
  421 + "/tasks/{taskId}/acceptance": {
  422 + "post": {
  423 + "tags": [
  424 + "task"
  425 + ],
  426 + "summary": "验收任务",
  427 + "description": "验收任务",
  428 + "operationId": "task#acceptanceTask",
  429 + "parameters": [
  430 + {
  431 + "name": "taskId",
  432 + "in": "path",
  433 + "description": "任务ID",
  434 + "required": true,
  435 + "type": "integer"
  436 + },
  437 + {
  438 + "name": "AcceptanceTaskRequestBody",
  439 + "in": "body",
  440 + "required": true,
  441 + "schema": {
  442 + "$ref": "#/definitions/TaskAcceptanceTaskRequestBody"
  443 + }
  444 + }
  445 + ],
  446 + "responses": {
  447 + "200": {
  448 + "description": "OK response.",
  449 + "schema": {
  450 + "$ref": "#/definitions/TaskAcceptanceTaskResponseBody"
  451 + }
  452 + }
  453 + },
  454 + "schemes": [
  455 + "http"
  456 + ]
  457 + }
  458 + },
  459 + "/tasks/{taskId}/apply-complete": {
  460 + "post": {
  461 + "tags": [
  462 + "task"
  463 + ],
  464 + "summary": "申请完成任务",
  465 + "description": "申请完成任务",
  466 + "operationId": "task#applyCompleteTask",
  467 + "parameters": [
  468 + {
  469 + "name": "taskId",
  470 + "in": "path",
  471 + "description": "任务ID",
  472 + "required": true,
  473 + "type": "integer"
  474 + },
  475 + {
  476 + "name": "ApplyCompleteTaskRequestBody",
  477 + "in": "body",
  478 + "required": true,
  479 + "schema": {
  480 + "$ref": "#/definitions/TaskApplyCompleteTaskRequestBody"
  481 + }
  482 + }
  483 + ],
  484 + "responses": {
  485 + "200": {
  486 + "description": "OK response.",
  487 + "schema": {
  488 + "$ref": "#/definitions/TaskApplyCompleteTaskResponseBody"
  489 + }
  490 + }
  491 + },
  492 + "schemes": [
  493 + "http"
  494 + ]
  495 + }
  496 + },
  497 + "/tasks/{taskId}/bid": {
  498 + "post": {
  499 + "tags": [
  500 + "task"
  501 + ],
  502 + "summary": "对任务进行竞标",
  503 + "description": "对任务进行竞标",
  504 + "operationId": "task#bidTask",
  505 + "parameters": [
  506 + {
  507 + "name": "taskId",
  508 + "in": "path",
  509 + "description": "任务ID",
  510 + "required": true,
  511 + "type": "integer"
  512 + },
  513 + {
  514 + "name": "BidTaskRequestBody",
  515 + "in": "body",
  516 + "required": true,
  517 + "schema": {
  518 + "$ref": "#/definitions/TaskBidTaskRequestBody"
  519 + }
  520 + }
  521 + ],
  522 + "responses": {
  523 + "200": {
  524 + "description": "OK response.",
  525 + "schema": {
  526 + "$ref": "#/definitions/TaskBidTaskResponseBody"
  527 + }
  528 + }
  529 + },
  530 + "schemes": [
  531 + "http"
  532 + ]
  533 + }
  534 + },
  535 + "/tasks/{taskId}/choose-successful-bidder": {
  536 + "post": {
  537 + "tags": [
  538 + "task"
  539 + ],
  540 + "summary": "选择竞标任务的中标人",
  541 + "description": "选择竞标任务的中标人",
  542 + "operationId": "task#chooseSuccessfulBidder",
  543 + "parameters": [
  544 + {
  545 + "name": "taskId",
  546 + "in": "path",
  547 + "description": "任务ID",
  548 + "required": true,
  549 + "type": "integer"
  550 + },
  551 + {
  552 + "name": "ChooseSuccessfulBidderRequestBody",
  553 + "in": "body",
  554 + "required": true,
  555 + "schema": {
  556 + "$ref": "#/definitions/TaskChooseSuccessfulBidderRequestBody"
  557 + }
  558 + }
  559 + ],
  560 + "responses": {
  561 + "200": {
  562 + "description": "OK response.",
  563 + "schema": {
  564 + "$ref": "#/definitions/TaskChooseSuccessfulBidderResponseBody"
  565 + }
  566 + }
  567 + },
  568 + "schemes": [
  569 + "http"
  570 + ]
  571 + }
  572 + },
  573 + "/tasks/{taskId}/dff": {
  574 + "post": {
  575 + "tags": [
  576 + "task"
  577 + ],
  578 + "summary": "关闭任务",
  579 + "description": "关闭任务",
  580 + "operationId": "task#offTask",
  581 + "parameters": [
  582 + {
  583 + "name": "taskId",
  584 + "in": "path",
  585 + "description": "任务ID",
  586 + "required": true,
  587 + "type": "integer"
  588 + },
  589 + {
  590 + "name": "OffTaskRequestBody",
  591 + "in": "body",
  592 + "required": true,
  593 + "schema": {
  594 + "$ref": "#/definitions/TaskOffTaskRequestBody"
  595 + }
  596 + }
  597 + ],
  598 + "responses": {
  599 + "200": {
  600 + "description": "OK response.",
  601 + "schema": {
  602 + "$ref": "#/definitions/TaskOffTaskResponseBody"
  603 + }
  604 + }
  605 + },
  606 + "schemes": [
  607 + "http"
  608 + ]
  609 + }
  610 + },
  611 + "/tasks/{taskId}/release": {
  612 + "post": {
  613 + "tags": [
  614 + "task"
  615 + ],
  616 + "summary": "发布任务",
  617 + "description": "发布任务",
  618 + "operationId": "task#releaseTask",
  619 + "parameters": [
  620 + {
  621 + "name": "taskId",
  622 + "in": "path",
  623 + "description": "任务ID",
  624 + "required": true,
  625 + "type": "integer"
  626 + },
  627 + {
  628 + "name": "ReleaseTaskRequestBody",
  629 + "in": "body",
  630 + "required": true,
  631 + "schema": {
  632 + "$ref": "#/definitions/TaskReleaseTaskRequestBody"
  633 + }
  634 + }
  635 + ],
  636 + "responses": {
  637 + "200": {
  638 + "description": "OK response.",
  639 + "schema": {
  640 + "$ref": "#/definitions/TaskReleaseTaskResponseBody"
  641 + }
  642 + }
  643 + },
  644 + "schemes": [
  645 + "http"
  646 + ]
  647 + }
  648 + },
  649 + "/tasks/{taskId}/rob": {
  650 + "post": {
  651 + "tags": [
  652 + "task"
  653 + ],
  654 + "summary": "对任务进行抢单",
  655 + "description": "对任务进行抢单",
  656 + "operationId": "task#robTask",
  657 + "parameters": [
  658 + {
  659 + "name": "taskId",
  660 + "in": "path",
  661 + "description": "任务ID",
  662 + "required": true,
  663 + "type": "integer"
  664 + },
  665 + {
  666 + "name": "RobTaskRequestBody",
  667 + "in": "body",
  668 + "required": true,
  669 + "schema": {
  670 + "$ref": "#/definitions/TaskRobTaskRequestBody"
  671 + }
  672 + }
  673 + ],
  674 + "responses": {
  675 + "200": {
  676 + "description": "OK response.",
  677 + "schema": {
  678 + "$ref": "#/definitions/TaskRobTaskResponseBody"
  679 + }
  680 + }
  681 + },
  682 + "schemes": [
  683 + "http"
  684 + ]
  685 + }
  686 + },
  687 + "/tasks/search": {
  688 + "post": {
  689 + "tags": [
  690 + "task"
  691 + ],
  692 + "summary": "搜索任务",
  693 + "description": "搜索任务",
  694 + "operationId": "task#searchTask",
  695 + "parameters": [
  696 + {
  697 + "name": "SearchTaskRequestBody",
  698 + "in": "body",
  699 + "required": true,
  700 + "schema": {
  701 + "$ref": "#/definitions/TaskSearchTaskRequestBody"
  702 + }
  703 + }
  704 + ],
  705 + "responses": {
  706 + "200": {
  707 + "description": "OK response.",
  708 + "schema": {
  709 + "$ref": "#/definitions/TaskSearchTaskResponseBody"
  710 + }
  711 + }
  712 + },
  713 + "schemes": [
  714 + "http"
  715 + ]
  716 + }
  717 + }
  718 + },
  719 + "definitions": {
  720 + "EmployeeCreateEmployeeRequestBody": {
  721 + "title": "EmployeeCreateEmployeeRequestBody",
  722 + "type": "object",
  723 + "properties": {
  724 + "employeeAccount": {
  725 + "type": "string",
  726 + "description": "员工账号"
  727 + },
  728 + "employeeName": {
  729 + "type": "string",
  730 + "description": "员工姓名"
  731 + },
  732 + "uid": {
  733 + "type": "integer",
  734 + "description": "统一用户UID",
  735 + "required": [
  736 + "uid"
  737 + ]
  738 + }
  739 + }
  740 + },
  741 + "EmployeeCreateEmployeeResponseBody": {
  742 + "title": "Mediatype identifier: EmployeeCreateEmployeeResponseBody",
  743 + "type": "object",
  744 + "properties": {
  745 + "employee": {
  746 + "$ref": "#/definitions/employeeResponseBody"
  747 + }
  748 + }
  749 + },
  750 + "EmployeeGetEmployeeResponseBody": {
  751 + "title": "Mediatype identifier: EmployeeGetEmployeeResponseBody",
  752 + "type": "object",
  753 + "properties": {
  754 + "employee": {
  755 + "$ref": "#/definitions/employeeResponseBody"
  756 + }
  757 + }
  758 + },
  759 + "EmployeeListEmployeeResponseBody": {
  760 + "title": "Mediatype identifier: EmployeeListEmployeeResponseBody",
  761 + "type": "object",
  762 + "properties": {
  763 + "count": {
  764 + "type": "integer",
  765 + "description": "结果总数",
  766 + "format": "int64"
  767 + },
  768 + "employees": {
  769 + "type": "array",
  770 + "items": {
  771 + "$ref": "#/definitions/employeeResponseBody"
  772 + }
  773 + }
  774 + }
  775 + },
  776 + "EmployeeRemoveEmployeeResponseBody": {
  777 + "title": "Mediatype identifier: EmployeeRemoveEmployeeResponseBody",
  778 + "type": "object",
  779 + "properties": {
  780 + "employee": {
  781 + "$ref": "#/definitions/employeeResponseBody"
  782 + }
  783 + }
  784 + },
  785 + "EmployeeUpdateEmployeeRequestBody": {
  786 + "title": "EmployeeUpdateEmployeeRequestBody",
  787 + "type": "object",
  788 + "properties": {
  789 + "employeeAccount": {
  790 + "type": "string",
  791 + "description": "员工账号"
  792 + },
  793 + "employeeName": {
  794 + "type": "string",
  795 + "description": "员工姓名"
  796 + }
  797 + }
  798 + },
  799 + "EmployeeUpdateEmployeeResponseBody": {
  800 + "title": "Mediatype identifier: EmployeeUpdateEmployeeResponseBody",
  801 + "type": "object",
  802 + "properties": {
  803 + "employee": {
  804 + "$ref": "#/definitions/employeeResponseBody"
  805 + }
  806 + }
  807 + },
  808 + "TaskAcceptanceTaskRequestBody": {
  809 + "title": "TaskAcceptanceTaskRequestBody",
  810 + "type": "object",
  811 + "properties": {
  812 + "operator": {
  813 + "type": "integer",
  814 + "description": "操作人uid",
  815 + "required": [
  816 + "operator"
  817 + ]
  818 + },
  819 + "participators": {
  820 + "type": "array",
  821 + "items": {
  822 + "type": "integer",
  823 + "format": "int64"
  824 + },
  825 + "description": "任务参与者UID列表"
  826 + },
  827 + "solvePictureUrls": {
  828 + "type": "array",
  829 + "items": {
  830 + "type": "string"
  831 + },
  832 + "description": "解决图片URL列表"
  833 + },
  834 + "solveReport": {
  835 + "type": "string",
  836 + "description": "解决报告"
  837 + },
  838 + "taskPercentage": {
  839 + "type": "array",
  840 + "items": {
  841 + "$ref": "#/definitions/taskPercentageItemRequestBody"
  842 + },
  843 + "description": "任务贡献占比",
  844 + "required": [
  845 + "taskPercentage"
  846 + ]
  847 + }
  848 + }
  849 + },
  850 + "TaskAcceptanceTaskResponseBody": {
  851 + "title": "Mediatype identifier: TaskAcceptanceTaskResponseBody",
  852 + "type": "object",
  853 + "properties": {
  854 + "task": {
  855 + "$ref": "#/definitions/taskResponseBody"
  856 + }
  857 + }
  858 + },
  859 + "TaskApplyCompleteTaskRequestBody": {
  860 + "title": "TaskApplyCompleteTaskRequestBody",
  861 + "type": "object",
  862 + "properties": {
  863 + "receiver": {
  864 + "type": "integer",
  865 + "description": "领取人或者中标人uid",
  866 + "required": [
  867 + "receiver"
  868 + ]
  869 + }
  870 + }
  871 + },
  872 + "TaskApplyCompleteTaskResponseBody": {
  873 + "title": "Mediatype identifier: TaskApplyCompleteTaskResponseBody",
  874 + "type": "object",
  875 + "properties": {
  876 + "task": {
  877 + "$ref": "#/definitions/taskResponseBody"
  878 + }
  879 + }
  880 + },
  881 + "TaskBidTaskRequestBody": {
  882 + "title": "TaskBidTaskRequestBody",
  883 + "type": "object",
  884 + "properties": {
  885 + "bidder": {
  886 + "type": "integer",
  887 + "description": "竞标人uid",
  888 + "required": [
  889 + "bidder"
  890 + ]
  891 + }
  892 + }
  893 + },
  894 + "TaskBidTaskResponseBody": {
  895 + "title": "Mediatype identifier: TaskBidTaskResponseBody",
  896 + "type": "object",
  897 + "properties": {
  898 + "task": {
  899 + "$ref": "#/definitions/taskResponseBody"
  900 + }
  901 + }
  902 + },
  903 + "TaskChooseSuccessfulBidderRequestBody": {
  904 + "title": "TaskChooseSuccessfulBidderRequestBody",
  905 + "type": "object",
  906 + "properties": {
  907 + "operator": {
  908 + "type": "integer",
  909 + "description": "操作人uid",
  910 + "required": [
  911 + "operator"
  912 + ]
  913 + },
  914 + "successfulBidder": {
  915 + "type": "integer",
  916 + "description": "中标者uid",
  917 + "required": [
  918 + "successfulBidder"
  919 + ]
  920 + }
  921 + }
  922 + },
  923 + "TaskChooseSuccessfulBidderResponseBody": {
  924 + "title": "Mediatype identifier: TaskChooseSuccessfulBidderResponseBody",
  925 + "type": "object",
  926 + "properties": {
  927 + "task": {
  928 + "$ref": "#/definitions/taskResponseBody"
  929 + }
  930 + }
  931 + },
  932 + "TaskCreateTaskRequestBody": {
  933 + "title": "TaskCreateTaskRequestBody",
  934 + "type": "object",
  935 + "properties": {
  936 + "acceptanceStandard": {
  937 + "type": "string",
  938 + "description": "验收标准",
  939 + "required": [
  940 + "acceptanceStandard"
  941 + ]
  942 + },
  943 + "bidEndTime": {
  944 + "type": "string",
  945 + "description": "竞标结束时间",
  946 + "format": "datetime"
  947 + },
  948 + "bidStartTime": {
  949 + "type": "string",
  950 + "description": "竞标开始时间",
  951 + "format": "datetime"
  952 + },
  953 + "customerValue": {
  954 + "type": "array",
  955 + "items": {
  956 + "type": "string"
  957 + },
  958 + "description": "客户价值列表",
  959 + "required": [
  960 + "customerValue"
  961 + ]
  962 + },
  963 + "isRewardTake": {
  964 + "type": "boolean",
  965 + "description": "是否悬赏任务"
  966 + },
  967 + "referenceResource": {
  968 + "$ref": "#/definitions/referenceResourceRequestBody"
  969 + },
  970 + "sponsor": {
  971 + "type": "integer",
  972 + "description": "任务发起者uid",
  973 + "required": [
  974 + "sponsor"
  975 + ]
  976 + },
  977 + "suMoney": {
  978 + "type": "number",
  979 + "description": "奖励素币",
  980 + "format": "double"
  981 + },
  982 + "taskDescription": {
  983 + "type": "string",
  984 + "description": "任务描述",
  985 + "required": [
  986 + "taskDescription"
  987 + ]
  988 + },
  989 + "taskName": {
  990 + "type": "string",
  991 + "description": "任务名称",
  992 + "required": [
  993 + "taskName"
  994 + ]
  995 + },
  996 + "taskNature": {
  997 + "type": "string",
  998 + "description": "任务性质",
  999 + "required": [
  1000 + "taskNature"
  1001 + ]
  1002 + },
  1003 + "taskPictureUrls": {
  1004 + "type": "array",
  1005 + "items": {
  1006 + "type": "string"
  1007 + },
  1008 + "description": "任务图片URL列表"
  1009 + },
  1010 + "taskType": {
  1011 + "type": "integer",
  1012 + "description": "任务类型",
  1013 + "required": [
  1014 + "taskType"
  1015 + ]
  1016 + }
  1017 + }
  1018 + },
  1019 + "TaskCreateTaskResponseBody": {
  1020 + "title": "Mediatype identifier: TaskCreateTaskResponseBody",
  1021 + "type": "object",
  1022 + "properties": {
  1023 + "task": {
  1024 + "$ref": "#/definitions/taskResponseBody"
  1025 + }
  1026 + }
  1027 + },
  1028 + "TaskGetTaskResponseBody": {
  1029 + "title": "Mediatype identifier: TaskGetTaskResponseBody",
  1030 + "type": "object",
  1031 + "properties": {
  1032 + "task": {
  1033 + "$ref": "#/definitions/taskResponseBody"
  1034 + }
  1035 + }
  1036 + },
  1037 + "TaskListTaskResponseBody": {
  1038 + "title": "Mediatype identifier: TaskListTaskResponseBody",
  1039 + "type": "object",
  1040 + "properties": {
  1041 + "count": {
  1042 + "type": "integer",
  1043 + "description": "结果总数",
  1044 + "format": "int64"
  1045 + },
  1046 + "tasks": {
  1047 + "type": "array",
  1048 + "items": {
  1049 + "$ref": "#/definitions/taskResponseBody"
  1050 + }
  1051 + }
  1052 + }
  1053 + },
  1054 + "TaskOffTaskRequestBody": {
  1055 + "title": "TaskOffTaskRequestBody",
  1056 + "type": "object",
  1057 + "properties": {
  1058 + "offReason": {
  1059 + "type": "string",
  1060 + "description": "关闭理由",
  1061 + "required": [
  1062 + "offReason"
  1063 + ]
  1064 + },
  1065 + "operator": {
  1066 + "type": "integer",
  1067 + "description": "操作人uid",
  1068 + "required": [
  1069 + "operator"
  1070 + ]
  1071 + }
  1072 + }
  1073 + },
  1074 + "TaskOffTaskResponseBody": {
  1075 + "title": "Mediatype identifier: TaskOffTaskResponseBody",
  1076 + "type": "object",
  1077 + "properties": {
  1078 + "task": {
  1079 + "$ref": "#/definitions/taskResponseBody"
  1080 + }
  1081 + }
  1082 + },
  1083 + "TaskReleaseTaskRequestBody": {
  1084 + "title": "TaskReleaseTaskRequestBody",
  1085 + "type": "object",
  1086 + "properties": {
  1087 + "operator": {
  1088 + "type": "integer",
  1089 + "description": "操作人uid",
  1090 + "required": [
  1091 + "operator"
  1092 + ]
  1093 + }
  1094 + }
  1095 + },
  1096 + "TaskReleaseTaskResponseBody": {
  1097 + "title": "Mediatype identifier: TaskReleaseTaskResponseBody",
  1098 + "type": "object",
  1099 + "properties": {
  1100 + "task": {
  1101 + "$ref": "#/definitions/taskResponseBody"
  1102 + }
  1103 + }
  1104 + },
  1105 + "TaskRemoveTaskResponseBody": {
  1106 + "title": "Mediatype identifier: TaskRemoveTaskResponseBody",
  1107 + "type": "object",
  1108 + "properties": {
  1109 + "task": {
  1110 + "$ref": "#/definitions/taskResponseBody"
  1111 + }
  1112 + }
  1113 + },
  1114 + "TaskRobTaskRequestBody": {
  1115 + "title": "TaskRobTaskRequestBody",
  1116 + "type": "object",
  1117 + "properties": {
  1118 + "receiver": {
  1119 + "type": "integer",
  1120 + "description": "领取人uid",
  1121 + "required": [
  1122 + "receiver"
  1123 + ]
  1124 + }
  1125 + }
  1126 + },
  1127 + "TaskRobTaskResponseBody": {
  1128 + "title": "Mediatype identifier: TaskRobTaskResponseBody",
  1129 + "type": "object",
  1130 + "properties": {
  1131 + "task": {
  1132 + "$ref": "#/definitions/taskResponseBody"
  1133 + }
  1134 + }
  1135 + },
  1136 + "TaskSearchTaskRequestBody": {
  1137 + "title": "TaskSearchTaskRequestBody",
  1138 + "type": "object",
  1139 + "properties": {
  1140 + "bidTimeMatch": {
  1141 + "type": "integer",
  1142 + "description": "竞标时间(1全部,2已截止,3未截止)",
  1143 + "format": "int64"
  1144 + },
  1145 + "companyId": {
  1146 + "type": "integer",
  1147 + "description": "公司ID",
  1148 + "required": [
  1149 + "companyId"
  1150 + ]
  1151 + },
  1152 + "customerValue": {
  1153 + "type": "string",
  1154 + "description": "客户价值"
  1155 + },
  1156 + "isRewardTake": {
  1157 + "type": "boolean",
  1158 + "description": "是否悬赏任务"
  1159 + },
  1160 + "limit": {
  1161 + "type": "integer",
  1162 + "description": "查询限制",
  1163 + "format": "int64"
  1164 + },
  1165 + "offset": {
  1166 + "type": "integer",
  1167 + "description": "查询偏离量",
  1168 + "format": "int64"
  1169 + },
  1170 + "participator": {
  1171 + "type": "integer",
  1172 + "description": "任务参与者",
  1173 + "format": "int64"
  1174 + },
  1175 + "receiver": {
  1176 + "type": "integer",
  1177 + "description": "任务领取人",
  1178 + "format": "int64"
  1179 + },
  1180 + "sponsor": {
  1181 + "type": "integer",
  1182 + "description": "任务发起者",
  1183 + "format": "int64"
  1184 + },
  1185 + "taskContentMatch": {
  1186 + "type": "string",
  1187 + "description": "任务内容匹配"
  1188 + },
  1189 + "taskNature": {
  1190 + "type": "string",
  1191 + "description": "任务性质"
  1192 + },
  1193 + "taskStatus": {
  1194 + "type": "integer",
  1195 + "description": "任务状态",
  1196 + "format": "int64"
  1197 + },
  1198 + "taskType": {
  1199 + "type": "integer",
  1200 + "description": "任务类型",
  1201 + "format": "int64"
  1202 + }
  1203 + }
  1204 + },
  1205 + "TaskSearchTaskResponseBody": {
  1206 + "title": "Mediatype identifier: TaskSearchTaskResponseBody",
  1207 + "type": "object",
  1208 + "properties": {
  1209 + "count": {
  1210 + "type": "integer",
  1211 + "description": "结果总数",
  1212 + "format": "int64"
  1213 + },
  1214 + "tasks": {
  1215 + "type": "array",
  1216 + "items": {
  1217 + "$ref": "#/definitions/taskResponseBody"
  1218 + }
  1219 + }
  1220 + }
  1221 + },
  1222 + "TaskUpdateTaskRequestBody": {
  1223 + "title": "TaskUpdateTaskRequestBody",
  1224 + "type": "object",
  1225 + "properties": {
  1226 + "acceptanceStandard": {
  1227 + "type": "string",
  1228 + "description": "验收标准"
  1229 + },
  1230 + "bidEndTime": {
  1231 + "type": "string",
  1232 + "description": "竞标结束时间",
  1233 + "format": "datetime"
  1234 + },
  1235 + "bidStartTime": {
  1236 + "type": "string",
  1237 + "description": "竞标开始时间",
  1238 + "format": "datetime"
  1239 + },
  1240 + "customerValue": {
  1241 + "type": "array",
  1242 + "items": {
  1243 + "type": "string"
  1244 + },
  1245 + "description": "客户价值列表"
  1246 + },
  1247 + "isRewardTake": {
  1248 + "type": "boolean",
  1249 + "description": "是否悬赏任务"
  1250 + },
  1251 + "referenceResource": {
  1252 + "$ref": "#/definitions/referenceResourceRequestBody"
  1253 + },
  1254 + "suMoney": {
  1255 + "type": "number",
  1256 + "description": "奖励素币",
  1257 + "format": "double"
  1258 + },
  1259 + "taskDescription": {
  1260 + "type": "string",
  1261 + "description": "任务描述"
  1262 + },
  1263 + "taskName": {
  1264 + "type": "string",
  1265 + "description": "任务名称"
  1266 + },
  1267 + "taskNature": {
  1268 + "type": "string",
  1269 + "description": "任务性质"
  1270 + },
  1271 + "taskPictureUrls": {
  1272 + "type": "array",
  1273 + "items": {
  1274 + "type": "string"
  1275 + },
  1276 + "description": "任务图片URL列表"
  1277 + }
  1278 + }
  1279 + },
  1280 + "TaskUpdateTaskResponseBody": {
  1281 + "title": "Mediatype identifier: TaskUpdateTaskResponseBody",
  1282 + "type": "object",
  1283 + "properties": {
  1284 + "task": {
  1285 + "$ref": "#/definitions/taskResponseBody"
  1286 + }
  1287 + }
  1288 + },
  1289 + "bidInfoResponseBody": {
  1290 + "title": "bidInfoResponseBody",
  1291 + "type": "object",
  1292 + "properties": {
  1293 + "bidEndTime": {
  1294 + "type": "string",
  1295 + "description": "竞标结束时间",
  1296 + "required": [
  1297 + "bidEndTime"
  1298 + ]
  1299 + },
  1300 + "bidStartTime": {
  1301 + "type": "string",
  1302 + "description": "竞标开始时间",
  1303 + "required": [
  1304 + "bidStartTime"
  1305 + ]
  1306 + },
  1307 + "bidderInfos": {
  1308 + "type": "array",
  1309 + "items": {
  1310 + "$ref": "#/definitions/bidderInfoResponseBody"
  1311 + },
  1312 + "description": "竞标人员列表"
  1313 + },
  1314 + "successfulBidder": {
  1315 + "$ref": "#/definitions/employeeInfoResponseBody"
  1316 + },
  1317 + "winBidTime": {
  1318 + "type": "string",
  1319 + "description": "中标时间",
  1320 + "required": [
  1321 + "winBidTime"
  1322 + ]
  1323 + }
  1324 + },
  1325 + "description": "竞标任务信息"
  1326 + },
  1327 + "bidderInfoResponseBody": {
  1328 + "title": "bidderInfoResponseBody",
  1329 + "type": "object",
  1330 + "properties": {
  1331 + "bidTime": {
  1332 + "type": "string",
  1333 + "description": "竞标时间",
  1334 + "required": [
  1335 + "bidTime"
  1336 + ]
  1337 + },
  1338 + "bidder": {
  1339 + "$ref": "#/definitions/employeeInfoResponseBody"
  1340 + }
  1341 + },
  1342 + "description": "竞标人员信息"
  1343 + },
  1344 + "employeeInfoRequestBody": {
  1345 + "title": "employeeInfoRequestBody",
  1346 + "type": "object",
  1347 + "properties": {
  1348 + "employeeAccount": {
  1349 + "type": "string",
  1350 + "description": "员工账号"
  1351 + },
  1352 + "employeeName": {
  1353 + "type": "string",
  1354 + "description": "员工姓名",
  1355 + "required": [
  1356 + "employeeName"
  1357 + ]
  1358 + },
  1359 + "uid": {
  1360 + "type": "integer",
  1361 + "description": "统一用户UID",
  1362 + "required": [
  1363 + "uid"
  1364 + ]
  1365 + }
  1366 + },
  1367 + "description": "员工信息"
  1368 + },
  1369 + "employeeInfoResponseBody": {
  1370 + "title": "employeeInfoResponseBody",
  1371 + "type": "object",
  1372 + "properties": {
  1373 + "employeeAccount": {
  1374 + "type": "string",
  1375 + "description": "员工账号"
  1376 + },
  1377 + "employeeName": {
  1378 + "type": "string",
  1379 + "description": "员工姓名",
  1380 + "required": [
  1381 + "employeeName"
  1382 + ]
  1383 + },
  1384 + "uid": {
  1385 + "type": "integer",
  1386 + "description": "统一用户UID",
  1387 + "required": [
  1388 + "uid"
  1389 + ]
  1390 + }
  1391 + },
  1392 + "description": "员工信息"
  1393 + },
  1394 + "employeeResponseBody": {
  1395 + "title": "employeeResponseBody",
  1396 + "type": "object",
  1397 + "properties": {
  1398 + "companyId": {
  1399 + "type": "integer",
  1400 + "description": "公司ID",
  1401 + "required": [
  1402 + "companyId"
  1403 + ]
  1404 + },
  1405 + "employeeId": {
  1406 + "type": "integer",
  1407 + "description": "员工ID",
  1408 + "required": [
  1409 + "employeeId"
  1410 + ]
  1411 + },
  1412 + "employeeInfo": {
  1413 + "$ref": "#/definitions/employeeInfoResponseBody"
  1414 + },
  1415 + "status": {
  1416 + "type": "integer",
  1417 + "description": "员工状态(启用或者禁用)",
  1418 + "format": "int64"
  1419 + },
  1420 + "suMoney": {
  1421 + "type": "number",
  1422 + "description": "当前素币",
  1423 + "required": [
  1424 + "suMoney"
  1425 + ]
  1426 + }
  1427 + },
  1428 + "description": "员工"
  1429 + },
  1430 + "referenceResourceItemRequestBody": {
  1431 + "title": "referenceResourceItemRequestBody",
  1432 + "type": "object",
  1433 + "properties": {
  1434 + "serialNumber": {
  1435 + "type": "integer",
  1436 + "description": "编号",
  1437 + "required": [
  1438 + "serialNumber"
  1439 + ]
  1440 + },
  1441 + "title": {
  1442 + "type": "string",
  1443 + "description": "标题",
  1444 + "required": [
  1445 + "title"
  1446 + ]
  1447 + }
  1448 + },
  1449 + "description": "引用资源项"
  1450 + },
  1451 + "referenceResourceItemResponseBody": {
  1452 + "title": "referenceResourceItemResponseBody",
  1453 + "type": "object",
  1454 + "properties": {
  1455 + "serialNumber": {
  1456 + "type": "integer",
  1457 + "description": "编号",
  1458 + "required": [
  1459 + "serialNumber"
  1460 + ]
  1461 + },
  1462 + "title": {
  1463 + "type": "string",
  1464 + "description": "标题",
  1465 + "required": [
  1466 + "title"
  1467 + ]
  1468 + }
  1469 + },
  1470 + "description": "引用资源项"
  1471 + },
  1472 + "referenceResourceRequestBody": {
  1473 + "title": "referenceResourceRequestBody",
  1474 + "type": "object",
  1475 + "properties": {
  1476 + "referenceResourceItems": {
  1477 + "type": "array",
  1478 + "items": {
  1479 + "$ref": "#/definitions/referenceResourceItemRequestBody"
  1480 + },
  1481 + "description": "引用资源项列表",
  1482 + "required": [
  1483 + "referenceResourceItems"
  1484 + ]
  1485 + },
  1486 + "referenceResourceType": {
  1487 + "type": "integer",
  1488 + "description": "引用类型",
  1489 + "required": [
  1490 + "referenceResourceType"
  1491 + ]
  1492 + }
  1493 + },
  1494 + "description": "引用资源"
  1495 + },
  1496 + "referenceResourceResponseBody": {
  1497 + "title": "referenceResourceResponseBody",
  1498 + "type": "object",
  1499 + "properties": {
  1500 + "referenceResourceItems": {
  1501 + "type": "array",
  1502 + "items": {
  1503 + "$ref": "#/definitions/referenceResourceItemResponseBody"
  1504 + },
  1505 + "description": "引用资源项列表",
  1506 + "required": [
  1507 + "referenceResourceItems"
  1508 + ]
  1509 + },
  1510 + "referenceResourceType": {
  1511 + "type": "integer",
  1512 + "description": "引用类型",
  1513 + "required": [
  1514 + "referenceResourceType"
  1515 + ]
  1516 + }
  1517 + },
  1518 + "description": "引用资源"
  1519 + },
  1520 + "robInfoResponseBody": {
  1521 + "title": "robInfoResponseBody",
  1522 + "type": "object",
  1523 + "properties": {
  1524 + "receiveTime": {
  1525 + "type": "string",
  1526 + "description": "领取时间",
  1527 + "required": [
  1528 + "receiveTime"
  1529 + ]
  1530 + },
  1531 + "receiver": {
  1532 + "$ref": "#/definitions/employeeInfoResponseBody"
  1533 + }
  1534 + },
  1535 + "description": "抢单任务信息"
  1536 + },
  1537 + "taskPercentageItemRequestBody": {
  1538 + "title": "taskPercentageItemRequestBody",
  1539 + "type": "object",
  1540 + "properties": {
  1541 + "contributor": {
  1542 + "$ref": "#/definitions/employeeInfoRequestBody"
  1543 + },
  1544 + "percentage": {
  1545 + "type": "integer",
  1546 + "description": "任务贡献占比",
  1547 + "required": [
  1548 + "percentage"
  1549 + ]
  1550 + }
  1551 + },
  1552 + "description": "任务贡献占比项"
  1553 + },
  1554 + "taskPercentageItemResponseBody": {
  1555 + "title": "taskPercentageItemResponseBody",
  1556 + "type": "object",
  1557 + "properties": {
  1558 + "contributor": {
  1559 + "$ref": "#/definitions/employeeInfoResponseBody"
  1560 + },
  1561 + "percentage": {
  1562 + "type": "integer",
  1563 + "description": "任务贡献占比",
  1564 + "required": [
  1565 + "percentage"
  1566 + ]
  1567 + }
  1568 + },
  1569 + "description": "任务贡献占比项"
  1570 + },
  1571 + "taskResponseBody": {
  1572 + "title": "taskResponseBody",
  1573 + "type": "object",
  1574 + "properties": {
  1575 + "acceptanceStandard": {
  1576 + "type": "string",
  1577 + "description": "验收标准",
  1578 + "required": [
  1579 + "acceptanceStandard"
  1580 + ]
  1581 + },
  1582 + "bidInfo": {
  1583 + "$ref": "#/definitions/bidInfoResponseBody"
  1584 + },
  1585 + "companyId": {
  1586 + "type": "integer",
  1587 + "description": "公司ID",
  1588 + "required": [
  1589 + "companyId"
  1590 + ]
  1591 + },
  1592 + "createTime": {
  1593 + "type": "string",
  1594 + "description": "创建时间",
  1595 + "required": [
  1596 + "createTime"
  1597 + ]
  1598 + },
  1599 + "customerValue": {
  1600 + "type": "array",
  1601 + "items": {
  1602 + "type": "string"
  1603 + },
  1604 + "description": "客户价值列表",
  1605 + "required": [
  1606 + "customerValue"
  1607 + ]
  1608 + },
  1609 + "isRewardTake": {
  1610 + "type": "boolean",
  1611 + "description": "是否悬赏任务"
  1612 + },
  1613 + "participators": {
  1614 + "type": "array",
  1615 + "items": {
  1616 + "$ref": "#/definitions/employeeInfoResponseBody"
  1617 + },
  1618 + "description": "任务参与者列表"
  1619 + },
  1620 + "referenceResource": {
  1621 + "$ref": "#/definitions/referenceResourceResponseBody"
  1622 + },
  1623 + "releaseTime": {
  1624 + "type": "string",
  1625 + "description": "发布时间",
  1626 + "format": "datetime"
  1627 + },
  1628 + "robInfo": {
  1629 + "$ref": "#/definitions/robInfoResponseBody"
  1630 + },
  1631 + "solvePictureUrls": {
  1632 + "type": "array",
  1633 + "items": {
  1634 + "type": "string"
  1635 + },
  1636 + "description": "解决图片URL列表"
  1637 + },
  1638 + "solveReport": {
  1639 + "type": "string",
  1640 + "description": "解决报告"
  1641 + },
  1642 + "sponsor": {
  1643 + "$ref": "#/definitions/employeeInfoResponseBody"
  1644 + },
  1645 + "suMoney": {
  1646 + "type": "number",
  1647 + "description": "奖励素币",
  1648 + "required": [
  1649 + "suMoney"
  1650 + ]
  1651 + },
  1652 + "taskDescription": {
  1653 + "type": "string",
  1654 + "description": "任务描述",
  1655 + "required": [
  1656 + "taskDescription"
  1657 + ]
  1658 + },
  1659 + "taskId": {
  1660 + "type": "integer",
  1661 + "description": "任务ID",
  1662 + "required": [
  1663 + "taskId"
  1664 + ]
  1665 + },
  1666 + "taskName": {
  1667 + "type": "string",
  1668 + "description": "任务名称",
  1669 + "required": [
  1670 + "taskName"
  1671 + ]
  1672 + },
  1673 + "taskNature": {
  1674 + "type": "string",
  1675 + "description": "任务性质",
  1676 + "required": [
  1677 + "taskNature"
  1678 + ]
  1679 + },
  1680 + "taskPercentage": {
  1681 + "type": "array",
  1682 + "items": {
  1683 + "$ref": "#/definitions/taskPercentageItemResponseBody"
  1684 + },
  1685 + "description": "任务贡献占比"
  1686 + },
  1687 + "taskPictureUrls": {
  1688 + "type": "array",
  1689 + "items": {
  1690 + "type": "string"
  1691 + },
  1692 + "description": "任务图片URL列表"
  1693 + },
  1694 + "taskStatus": {
  1695 + "type": "integer",
  1696 + "description": "任务状态",
  1697 + "required": [
  1698 + "taskStatus"
  1699 + ]
  1700 + },
  1701 + "taskType": {
  1702 + "type": "integer",
  1703 + "description": "任务类型",
  1704 + "required": [
  1705 + "taskType"
  1706 + ]
  1707 + }
  1708 + },
  1709 + "description": "任务"
  1710 + }
  1711 + }
  1712 +}
  1 +swagger: "2.0"
  2 +info:
  3 + title: ""
  4 + description: 买买买价值系统
  5 + contact:
  6 + name: linmadan
  7 + email: 772181827@qq.com
  8 + home: www.madannet.com
  9 + version: 0.0.1
  10 +consumes:
  11 + - application/json
  12 + - application/xml
  13 +produces:
  14 + - application/json
  15 + - application/xml
  16 +paths:
  17 + /employees:
  18 + get:
  19 + tags:
  20 + - employee
  21 + summary: 返回员工列表
  22 + description: 返回员工列表
  23 + operationId: employee#listEmployee
  24 + parameters:
  25 + - name: offset
  26 + in: query
  27 + description: 查询偏离量
  28 + required: false
  29 + type: integer
  30 + - name: limit
  31 + in: query
  32 + description: 查询限制
  33 + required: false
  34 + type: integer
  35 + responses:
  36 + "200":
  37 + description: OK response.
  38 + schema:
  39 + $ref: '#/definitions/EmployeeListEmployeeResponseBody'
  40 + schemes:
  41 + - http
  42 + post:
  43 + tags:
  44 + - employee
  45 + summary: 创建新员工
  46 + description: 创建新员工
  47 + operationId: employee#createEmployee
  48 + parameters:
  49 + - name: CreateEmployeeRequestBody
  50 + in: body
  51 + required: true
  52 + schema:
  53 + $ref: '#/definitions/EmployeeCreateEmployeeRequestBody'
  54 + responses:
  55 + "200":
  56 + description: OK response.
  57 + schema:
  58 + $ref: '#/definitions/EmployeeCreateEmployeeResponseBody'
  59 + schemes:
  60 + - http
  61 + /employees/{uid}:
  62 + get:
  63 + tags:
  64 + - employee
  65 + summary: 返回员工
  66 + description: 返回员工
  67 + operationId: employee#getEmployee
  68 + parameters:
  69 + - name: uid
  70 + in: path
  71 + description: 统一用户UID
  72 + required: true
  73 + type: integer
  74 + responses:
  75 + "200":
  76 + description: OK response.
  77 + schema:
  78 + $ref: '#/definitions/EmployeeGetEmployeeResponseBody'
  79 + schemes:
  80 + - http
  81 + put:
  82 + tags:
  83 + - employee
  84 + summary: 更新员工
  85 + description: 更新员工
  86 + operationId: employee#updateEmployee
  87 + parameters:
  88 + - name: uid
  89 + in: path
  90 + description: 统一用户UID
  91 + required: true
  92 + type: integer
  93 + - name: UpdateEmployeeRequestBody
  94 + in: body
  95 + required: true
  96 + schema:
  97 + $ref: '#/definitions/EmployeeUpdateEmployeeRequestBody'
  98 + responses:
  99 + "200":
  100 + description: OK response.
  101 + schema:
  102 + $ref: '#/definitions/EmployeeUpdateEmployeeResponseBody'
  103 + schemes:
  104 + - http
  105 + delete:
  106 + tags:
  107 + - employee
  108 + summary: 移除员工
  109 + description: 移除员工
  110 + operationId: employee#removeEmployee
  111 + parameters:
  112 + - name: uid
  113 + in: path
  114 + description: 统一用户UID
  115 + required: true
  116 + type: integer
  117 + responses:
  118 + "200":
  119 + description: OK response.
  120 + schema:
  121 + $ref: '#/definitions/EmployeeRemoveEmployeeResponseBody'
  122 + schemes:
  123 + - http
  124 + /tasks:
  125 + get:
  126 + tags:
  127 + - task
  128 + summary: 返回任务列表
  129 + description: 返回任务列表
  130 + operationId: task#listTask
  131 + parameters:
  132 + - name: companyId
  133 + in: query
  134 + description: 公司ID
  135 + required: false
  136 + type: integer
  137 + - name: sponsor
  138 + in: query
  139 + description: 任务发起者
  140 + required: false
  141 + type: integer
  142 + format: int64
  143 + - name: taskContentMatch
  144 + in: query
  145 + description: 任务内容匹配
  146 + required: false
  147 + type: string
  148 + - name: taskType
  149 + in: query
  150 + description: 任务类型
  151 + required: false
  152 + type: integer
  153 + - name: taskStatus
  154 + in: query
  155 + description: 任务状态
  156 + required: false
  157 + type: integer
  158 + - name: customerValue
  159 + in: query
  160 + description: 客户价值
  161 + required: false
  162 + type: string
  163 + - name: taskNature
  164 + in: query
  165 + description: 任务性质
  166 + required: false
  167 + type: string
  168 + - name: isRewardTake
  169 + in: query
  170 + description: 是否悬赏任务
  171 + required: false
  172 + type: boolean
  173 + - name: bidTimeMatch
  174 + in: query
  175 + description: 竞标时间(1全部,2已截止,3未截止)
  176 + required: false
  177 + type: integer
  178 + - name: receiver
  179 + in: query
  180 + description: 任务领取人
  181 + required: false
  182 + type: integer
  183 + format: int64
  184 + - name: participator
  185 + in: query
  186 + description: 任务参与者
  187 + required: false
  188 + type: integer
  189 + format: int64
  190 + - name: offset
  191 + in: query
  192 + description: 查询偏离量
  193 + required: false
  194 + type: integer
  195 + - name: limit
  196 + in: query
  197 + description: 查询限制
  198 + required: false
  199 + type: integer
  200 + responses:
  201 + "200":
  202 + description: OK response.
  203 + schema:
  204 + $ref: '#/definitions/TaskListTaskResponseBody'
  205 + schemes:
  206 + - http
  207 + post:
  208 + tags:
  209 + - task
  210 + summary: 创建新任务
  211 + description: 创建新任务
  212 + operationId: task#createTask
  213 + parameters:
  214 + - name: CreateTaskRequestBody
  215 + in: body
  216 + required: true
  217 + schema:
  218 + $ref: '#/definitions/TaskCreateTaskRequestBody'
  219 + responses:
  220 + "200":
  221 + description: OK response.
  222 + schema:
  223 + $ref: '#/definitions/TaskCreateTaskResponseBody'
  224 + schemes:
  225 + - http
  226 + /tasks/{taskId}:
  227 + get:
  228 + tags:
  229 + - task
  230 + summary: 返回任务
  231 + description: 返回任务
  232 + operationId: task#getTask
  233 + parameters:
  234 + - name: taskId
  235 + in: path
  236 + description: 任务ID
  237 + required: true
  238 + type: integer
  239 + responses:
  240 + "200":
  241 + description: OK response.
  242 + schema:
  243 + $ref: '#/definitions/TaskGetTaskResponseBody'
  244 + schemes:
  245 + - http
  246 + put:
  247 + tags:
  248 + - task
  249 + summary: 更新任务
  250 + description: 更新任务
  251 + operationId: task#updateTask
  252 + parameters:
  253 + - name: taskId
  254 + in: path
  255 + description: 任务ID
  256 + required: true
  257 + type: integer
  258 + - name: UpdateTaskRequestBody
  259 + in: body
  260 + required: true
  261 + schema:
  262 + $ref: '#/definitions/TaskUpdateTaskRequestBody'
  263 + responses:
  264 + "200":
  265 + description: OK response.
  266 + schema:
  267 + $ref: '#/definitions/TaskUpdateTaskResponseBody'
  268 + schemes:
  269 + - http
  270 + delete:
  271 + tags:
  272 + - task
  273 + summary: 移除任务
  274 + description: 移除任务
  275 + operationId: task#removeTask
  276 + parameters:
  277 + - name: taskId
  278 + in: path
  279 + description: 任务ID
  280 + required: true
  281 + type: integer
  282 + responses:
  283 + "200":
  284 + description: OK response.
  285 + schema:
  286 + $ref: '#/definitions/TaskRemoveTaskResponseBody'
  287 + schemes:
  288 + - http
  289 + /tasks/{taskId}/acceptance:
  290 + post:
  291 + tags:
  292 + - task
  293 + summary: 验收任务
  294 + description: 验收任务
  295 + operationId: task#acceptanceTask
  296 + parameters:
  297 + - name: taskId
  298 + in: path
  299 + description: 任务ID
  300 + required: true
  301 + type: integer
  302 + - name: AcceptanceTaskRequestBody
  303 + in: body
  304 + required: true
  305 + schema:
  306 + $ref: '#/definitions/TaskAcceptanceTaskRequestBody'
  307 + responses:
  308 + "200":
  309 + description: OK response.
  310 + schema:
  311 + $ref: '#/definitions/TaskAcceptanceTaskResponseBody'
  312 + schemes:
  313 + - http
  314 + /tasks/{taskId}/apply-complete:
  315 + post:
  316 + tags:
  317 + - task
  318 + summary: 申请完成任务
  319 + description: 申请完成任务
  320 + operationId: task#applyCompleteTask
  321 + parameters:
  322 + - name: taskId
  323 + in: path
  324 + description: 任务ID
  325 + required: true
  326 + type: integer
  327 + - name: ApplyCompleteTaskRequestBody
  328 + in: body
  329 + required: true
  330 + schema:
  331 + $ref: '#/definitions/TaskApplyCompleteTaskRequestBody'
  332 + responses:
  333 + "200":
  334 + description: OK response.
  335 + schema:
  336 + $ref: '#/definitions/TaskApplyCompleteTaskResponseBody'
  337 + schemes:
  338 + - http
  339 + /tasks/{taskId}/bid:
  340 + post:
  341 + tags:
  342 + - task
  343 + summary: 对任务进行竞标
  344 + description: 对任务进行竞标
  345 + operationId: task#bidTask
  346 + parameters:
  347 + - name: taskId
  348 + in: path
  349 + description: 任务ID
  350 + required: true
  351 + type: integer
  352 + - name: BidTaskRequestBody
  353 + in: body
  354 + required: true
  355 + schema:
  356 + $ref: '#/definitions/TaskBidTaskRequestBody'
  357 + responses:
  358 + "200":
  359 + description: OK response.
  360 + schema:
  361 + $ref: '#/definitions/TaskBidTaskResponseBody'
  362 + schemes:
  363 + - http
  364 + /tasks/{taskId}/choose-successful-bidder:
  365 + post:
  366 + tags:
  367 + - task
  368 + summary: 选择竞标任务的中标人
  369 + description: 选择竞标任务的中标人
  370 + operationId: task#chooseSuccessfulBidder
  371 + parameters:
  372 + - name: taskId
  373 + in: path
  374 + description: 任务ID
  375 + required: true
  376 + type: integer
  377 + - name: ChooseSuccessfulBidderRequestBody
  378 + in: body
  379 + required: true
  380 + schema:
  381 + $ref: '#/definitions/TaskChooseSuccessfulBidderRequestBody'
  382 + responses:
  383 + "200":
  384 + description: OK response.
  385 + schema:
  386 + $ref: '#/definitions/TaskChooseSuccessfulBidderResponseBody'
  387 + schemes:
  388 + - http
  389 + /tasks/{taskId}/dff:
  390 + post:
  391 + tags:
  392 + - task
  393 + summary: 关闭任务
  394 + description: 关闭任务
  395 + operationId: task#offTask
  396 + parameters:
  397 + - name: taskId
  398 + in: path
  399 + description: 任务ID
  400 + required: true
  401 + type: integer
  402 + - name: OffTaskRequestBody
  403 + in: body
  404 + required: true
  405 + schema:
  406 + $ref: '#/definitions/TaskOffTaskRequestBody'
  407 + responses:
  408 + "200":
  409 + description: OK response.
  410 + schema:
  411 + $ref: '#/definitions/TaskOffTaskResponseBody'
  412 + schemes:
  413 + - http
  414 + /tasks/{taskId}/release:
  415 + post:
  416 + tags:
  417 + - task
  418 + summary: 发布任务
  419 + description: 发布任务
  420 + operationId: task#releaseTask
  421 + parameters:
  422 + - name: taskId
  423 + in: path
  424 + description: 任务ID
  425 + required: true
  426 + type: integer
  427 + - name: ReleaseTaskRequestBody
  428 + in: body
  429 + required: true
  430 + schema:
  431 + $ref: '#/definitions/TaskReleaseTaskRequestBody'
  432 + responses:
  433 + "200":
  434 + description: OK response.
  435 + schema:
  436 + $ref: '#/definitions/TaskReleaseTaskResponseBody'
  437 + schemes:
  438 + - http
  439 + /tasks/{taskId}/rob:
  440 + post:
  441 + tags:
  442 + - task
  443 + summary: 对任务进行抢单
  444 + description: 对任务进行抢单
  445 + operationId: task#robTask
  446 + parameters:
  447 + - name: taskId
  448 + in: path
  449 + description: 任务ID
  450 + required: true
  451 + type: integer
  452 + - name: RobTaskRequestBody
  453 + in: body
  454 + required: true
  455 + schema:
  456 + $ref: '#/definitions/TaskRobTaskRequestBody'
  457 + responses:
  458 + "200":
  459 + description: OK response.
  460 + schema:
  461 + $ref: '#/definitions/TaskRobTaskResponseBody'
  462 + schemes:
  463 + - http
  464 + /tasks/search:
  465 + post:
  466 + tags:
  467 + - task
  468 + summary: 搜索任务
  469 + description: 搜索任务
  470 + operationId: task#searchTask
  471 + parameters:
  472 + - name: SearchTaskRequestBody
  473 + in: body
  474 + required: true
  475 + schema:
  476 + $ref: '#/definitions/TaskSearchTaskRequestBody'
  477 + responses:
  478 + "200":
  479 + description: OK response.
  480 + schema:
  481 + $ref: '#/definitions/TaskSearchTaskResponseBody'
  482 + schemes:
  483 + - http
  484 +definitions:
  485 + EmployeeCreateEmployeeRequestBody:
  486 + title: EmployeeCreateEmployeeRequestBody
  487 + type: object
  488 + properties:
  489 + employeeAccount:
  490 + type: string
  491 + description: 员工账号
  492 + employeeName:
  493 + type: string
  494 + description: 员工姓名
  495 + uid:
  496 + type: integer
  497 + description: 统一用户UID
  498 + required:
  499 + - uid
  500 + EmployeeCreateEmployeeResponseBody:
  501 + title: 'Mediatype identifier: EmployeeCreateEmployeeResponseBody'
  502 + type: object
  503 + properties:
  504 + employee:
  505 + $ref: '#/definitions/employeeResponseBody'
  506 + EmployeeGetEmployeeResponseBody:
  507 + title: 'Mediatype identifier: EmployeeGetEmployeeResponseBody'
  508 + type: object
  509 + properties:
  510 + employee:
  511 + $ref: '#/definitions/employeeResponseBody'
  512 + EmployeeListEmployeeResponseBody:
  513 + title: 'Mediatype identifier: EmployeeListEmployeeResponseBody'
  514 + type: object
  515 + properties:
  516 + count:
  517 + type: integer
  518 + description: 结果总数
  519 + format: int64
  520 + employees:
  521 + type: array
  522 + items:
  523 + $ref: '#/definitions/employeeResponseBody'
  524 + EmployeeRemoveEmployeeResponseBody:
  525 + title: 'Mediatype identifier: EmployeeRemoveEmployeeResponseBody'
  526 + type: object
  527 + properties:
  528 + employee:
  529 + $ref: '#/definitions/employeeResponseBody'
  530 + EmployeeUpdateEmployeeRequestBody:
  531 + title: EmployeeUpdateEmployeeRequestBody
  532 + type: object
  533 + properties:
  534 + employeeAccount:
  535 + type: string
  536 + description: 员工账号
  537 + employeeName:
  538 + type: string
  539 + description: 员工姓名
  540 + EmployeeUpdateEmployeeResponseBody:
  541 + title: 'Mediatype identifier: EmployeeUpdateEmployeeResponseBody'
  542 + type: object
  543 + properties:
  544 + employee:
  545 + $ref: '#/definitions/employeeResponseBody'
  546 + TaskAcceptanceTaskRequestBody:
  547 + title: TaskAcceptanceTaskRequestBody
  548 + type: object
  549 + properties:
  550 + operator:
  551 + type: integer
  552 + description: 操作人uid
  553 + required:
  554 + - operator
  555 + participators:
  556 + type: array
  557 + items:
  558 + type: integer
  559 + format: int64
  560 + description: 任务参与者UID列表
  561 + solvePictureUrls:
  562 + type: array
  563 + items:
  564 + type: string
  565 + description: 解决图片URL列表
  566 + solveReport:
  567 + type: string
  568 + description: 解决报告
  569 + taskPercentage:
  570 + type: array
  571 + items:
  572 + $ref: '#/definitions/taskPercentageItemRequestBody'
  573 + description: 任务贡献占比
  574 + required:
  575 + - taskPercentage
  576 + TaskAcceptanceTaskResponseBody:
  577 + title: 'Mediatype identifier: TaskAcceptanceTaskResponseBody'
  578 + type: object
  579 + properties:
  580 + task:
  581 + $ref: '#/definitions/taskResponseBody'
  582 + TaskApplyCompleteTaskRequestBody:
  583 + title: TaskApplyCompleteTaskRequestBody
  584 + type: object
  585 + properties:
  586 + receiver:
  587 + type: integer
  588 + description: 领取人或者中标人uid
  589 + required:
  590 + - receiver
  591 + TaskApplyCompleteTaskResponseBody:
  592 + title: 'Mediatype identifier: TaskApplyCompleteTaskResponseBody'
  593 + type: object
  594 + properties:
  595 + task:
  596 + $ref: '#/definitions/taskResponseBody'
  597 + TaskBidTaskRequestBody:
  598 + title: TaskBidTaskRequestBody
  599 + type: object
  600 + properties:
  601 + bidder:
  602 + type: integer
  603 + description: 竞标人uid
  604 + required:
  605 + - bidder
  606 + TaskBidTaskResponseBody:
  607 + title: 'Mediatype identifier: TaskBidTaskResponseBody'
  608 + type: object
  609 + properties:
  610 + task:
  611 + $ref: '#/definitions/taskResponseBody'
  612 + TaskChooseSuccessfulBidderRequestBody:
  613 + title: TaskChooseSuccessfulBidderRequestBody
  614 + type: object
  615 + properties:
  616 + operator:
  617 + type: integer
  618 + description: 操作人uid
  619 + required:
  620 + - operator
  621 + successfulBidder:
  622 + type: integer
  623 + description: 中标者uid
  624 + required:
  625 + - successfulBidder
  626 + TaskChooseSuccessfulBidderResponseBody:
  627 + title: 'Mediatype identifier: TaskChooseSuccessfulBidderResponseBody'
  628 + type: object
  629 + properties:
  630 + task:
  631 + $ref: '#/definitions/taskResponseBody'
  632 + TaskCreateTaskRequestBody:
  633 + title: TaskCreateTaskRequestBody
  634 + type: object
  635 + properties:
  636 + acceptanceStandard:
  637 + type: string
  638 + description: 验收标准
  639 + required:
  640 + - acceptanceStandard
  641 + bidEndTime:
  642 + type: string
  643 + description: 竞标结束时间
  644 + format: datetime
  645 + bidStartTime:
  646 + type: string
  647 + description: 竞标开始时间
  648 + format: datetime
  649 + customerValue:
  650 + type: array
  651 + items:
  652 + type: string
  653 + description: 客户价值列表
  654 + required:
  655 + - customerValue
  656 + isRewardTake:
  657 + type: boolean
  658 + description: 是否悬赏任务
  659 + referenceResource:
  660 + $ref: '#/definitions/referenceResourceRequestBody'
  661 + sponsor:
  662 + type: integer
  663 + description: 任务发起者uid
  664 + required:
  665 + - sponsor
  666 + suMoney:
  667 + type: number
  668 + description: 奖励素币
  669 + format: double
  670 + taskDescription:
  671 + type: string
  672 + description: 任务描述
  673 + required:
  674 + - taskDescription
  675 + taskName:
  676 + type: string
  677 + description: 任务名称
  678 + required:
  679 + - taskName
  680 + taskNature:
  681 + type: string
  682 + description: 任务性质
  683 + required:
  684 + - taskNature
  685 + taskPictureUrls:
  686 + type: array
  687 + items:
  688 + type: string
  689 + description: 任务图片URL列表
  690 + taskType:
  691 + type: integer
  692 + description: 任务类型
  693 + required:
  694 + - taskType
  695 + TaskCreateTaskResponseBody:
  696 + title: 'Mediatype identifier: TaskCreateTaskResponseBody'
  697 + type: object
  698 + properties:
  699 + task:
  700 + $ref: '#/definitions/taskResponseBody'
  701 + TaskGetTaskResponseBody:
  702 + title: 'Mediatype identifier: TaskGetTaskResponseBody'
  703 + type: object
  704 + properties:
  705 + task:
  706 + $ref: '#/definitions/taskResponseBody'
  707 + TaskListTaskResponseBody:
  708 + title: 'Mediatype identifier: TaskListTaskResponseBody'
  709 + type: object
  710 + properties:
  711 + count:
  712 + type: integer
  713 + description: 结果总数
  714 + format: int64
  715 + tasks:
  716 + type: array
  717 + items:
  718 + $ref: '#/definitions/taskResponseBody'
  719 + TaskOffTaskRequestBody:
  720 + title: TaskOffTaskRequestBody
  721 + type: object
  722 + properties:
  723 + offReason:
  724 + type: string
  725 + description: 关闭理由
  726 + required:
  727 + - offReason
  728 + operator:
  729 + type: integer
  730 + description: 操作人uid
  731 + required:
  732 + - operator
  733 + TaskOffTaskResponseBody:
  734 + title: 'Mediatype identifier: TaskOffTaskResponseBody'
  735 + type: object
  736 + properties:
  737 + task:
  738 + $ref: '#/definitions/taskResponseBody'
  739 + TaskReleaseTaskRequestBody:
  740 + title: TaskReleaseTaskRequestBody
  741 + type: object
  742 + properties:
  743 + operator:
  744 + type: integer
  745 + description: 操作人uid
  746 + required:
  747 + - operator
  748 + TaskReleaseTaskResponseBody:
  749 + title: 'Mediatype identifier: TaskReleaseTaskResponseBody'
  750 + type: object
  751 + properties:
  752 + task:
  753 + $ref: '#/definitions/taskResponseBody'
  754 + TaskRemoveTaskResponseBody:
  755 + title: 'Mediatype identifier: TaskRemoveTaskResponseBody'
  756 + type: object
  757 + properties:
  758 + task:
  759 + $ref: '#/definitions/taskResponseBody'
  760 + TaskRobTaskRequestBody:
  761 + title: TaskRobTaskRequestBody
  762 + type: object
  763 + properties:
  764 + receiver:
  765 + type: integer
  766 + description: 领取人uid
  767 + required:
  768 + - receiver
  769 + TaskRobTaskResponseBody:
  770 + title: 'Mediatype identifier: TaskRobTaskResponseBody'
  771 + type: object
  772 + properties:
  773 + task:
  774 + $ref: '#/definitions/taskResponseBody'
  775 + TaskSearchTaskRequestBody:
  776 + title: TaskSearchTaskRequestBody
  777 + type: object
  778 + properties:
  779 + bidTimeMatch:
  780 + type: integer
  781 + description: 竞标时间(1全部,2已截止,3未截止)
  782 + format: int64
  783 + companyId:
  784 + type: integer
  785 + description: 公司ID
  786 + required:
  787 + - companyId
  788 + customerValue:
  789 + type: string
  790 + description: 客户价值
  791 + isRewardTake:
  792 + type: boolean
  793 + description: 是否悬赏任务
  794 + limit:
  795 + type: integer
  796 + description: 查询限制
  797 + format: int64
  798 + offset:
  799 + type: integer
  800 + description: 查询偏离量
  801 + format: int64
  802 + participator:
  803 + type: integer
  804 + description: 任务参与者
  805 + format: int64
  806 + receiver:
  807 + type: integer
  808 + description: 任务领取人
  809 + format: int64
  810 + sponsor:
  811 + type: integer
  812 + description: 任务发起者
  813 + format: int64
  814 + taskContentMatch:
  815 + type: string
  816 + description: 任务内容匹配
  817 + taskNature:
  818 + type: string
  819 + description: 任务性质
  820 + taskStatus:
  821 + type: integer
  822 + description: 任务状态
  823 + format: int64
  824 + taskType:
  825 + type: integer
  826 + description: 任务类型
  827 + format: int64
  828 + TaskSearchTaskResponseBody:
  829 + title: 'Mediatype identifier: TaskSearchTaskResponseBody'
  830 + type: object
  831 + properties:
  832 + count:
  833 + type: integer
  834 + description: 结果总数
  835 + format: int64
  836 + tasks:
  837 + type: array
  838 + items:
  839 + $ref: '#/definitions/taskResponseBody'
  840 + TaskUpdateTaskRequestBody:
  841 + title: TaskUpdateTaskRequestBody
  842 + type: object
  843 + properties:
  844 + acceptanceStandard:
  845 + type: string
  846 + description: 验收标准
  847 + bidEndTime:
  848 + type: string
  849 + description: 竞标结束时间
  850 + format: datetime
  851 + bidStartTime:
  852 + type: string
  853 + description: 竞标开始时间
  854 + format: datetime
  855 + customerValue:
  856 + type: array
  857 + items:
  858 + type: string
  859 + description: 客户价值列表
  860 + isRewardTake:
  861 + type: boolean
  862 + description: 是否悬赏任务
  863 + referenceResource:
  864 + $ref: '#/definitions/referenceResourceRequestBody'
  865 + suMoney:
  866 + type: number
  867 + description: 奖励素币
  868 + format: double
  869 + taskDescription:
  870 + type: string
  871 + description: 任务描述
  872 + taskName:
  873 + type: string
  874 + description: 任务名称
  875 + taskNature:
  876 + type: string
  877 + description: 任务性质
  878 + taskPictureUrls:
  879 + type: array
  880 + items:
  881 + type: string
  882 + description: 任务图片URL列表
  883 + TaskUpdateTaskResponseBody:
  884 + title: 'Mediatype identifier: TaskUpdateTaskResponseBody'
  885 + type: object
  886 + properties:
  887 + task:
  888 + $ref: '#/definitions/taskResponseBody'
  889 + bidInfoResponseBody:
  890 + title: bidInfoResponseBody
  891 + type: object
  892 + properties:
  893 + bidEndTime:
  894 + type: string
  895 + description: 竞标结束时间
  896 + required:
  897 + - bidEndTime
  898 + bidStartTime:
  899 + type: string
  900 + description: 竞标开始时间
  901 + required:
  902 + - bidStartTime
  903 + bidderInfos:
  904 + type: array
  905 + items:
  906 + $ref: '#/definitions/bidderInfoResponseBody'
  907 + description: 竞标人员列表
  908 + successfulBidder:
  909 + $ref: '#/definitions/employeeInfoResponseBody'
  910 + winBidTime:
  911 + type: string
  912 + description: 中标时间
  913 + required:
  914 + - winBidTime
  915 + description: 竞标任务信息
  916 + bidderInfoResponseBody:
  917 + title: bidderInfoResponseBody
  918 + type: object
  919 + properties:
  920 + bidTime:
  921 + type: string
  922 + description: 竞标时间
  923 + required:
  924 + - bidTime
  925 + bidder:
  926 + $ref: '#/definitions/employeeInfoResponseBody'
  927 + description: 竞标人员信息
  928 + employeeInfoRequestBody:
  929 + title: employeeInfoRequestBody
  930 + type: object
  931 + properties:
  932 + employeeAccount:
  933 + type: string
  934 + description: 员工账号
  935 + employeeName:
  936 + type: string
  937 + description: 员工姓名
  938 + required:
  939 + - employeeName
  940 + uid:
  941 + type: integer
  942 + description: 统一用户UID
  943 + required:
  944 + - uid
  945 + description: 员工信息
  946 + employeeInfoResponseBody:
  947 + title: employeeInfoResponseBody
  948 + type: object
  949 + properties:
  950 + employeeAccount:
  951 + type: string
  952 + description: 员工账号
  953 + employeeName:
  954 + type: string
  955 + description: 员工姓名
  956 + required:
  957 + - employeeName
  958 + uid:
  959 + type: integer
  960 + description: 统一用户UID
  961 + required:
  962 + - uid
  963 + description: 员工信息
  964 + employeeResponseBody:
  965 + title: employeeResponseBody
  966 + type: object
  967 + properties:
  968 + companyId:
  969 + type: integer
  970 + description: 公司ID
  971 + required:
  972 + - companyId
  973 + employeeId:
  974 + type: integer
  975 + description: 员工ID
  976 + required:
  977 + - employeeId
  978 + employeeInfo:
  979 + $ref: '#/definitions/employeeInfoResponseBody'
  980 + status:
  981 + type: integer
  982 + description: 员工状态(启用或者禁用)
  983 + format: int64
  984 + suMoney:
  985 + type: number
  986 + description: 当前素币
  987 + required:
  988 + - suMoney
  989 + description: 员工
  990 + referenceResourceItemRequestBody:
  991 + title: referenceResourceItemRequestBody
  992 + type: object
  993 + properties:
  994 + serialNumber:
  995 + type: integer
  996 + description: 编号
  997 + required:
  998 + - serialNumber
  999 + title:
  1000 + type: string
  1001 + description: 标题
  1002 + required:
  1003 + - title
  1004 + description: 引用资源项
  1005 + referenceResourceItemResponseBody:
  1006 + title: referenceResourceItemResponseBody
  1007 + type: object
  1008 + properties:
  1009 + serialNumber:
  1010 + type: integer
  1011 + description: 编号
  1012 + required:
  1013 + - serialNumber
  1014 + title:
  1015 + type: string
  1016 + description: 标题
  1017 + required:
  1018 + - title
  1019 + description: 引用资源项
  1020 + referenceResourceRequestBody:
  1021 + title: referenceResourceRequestBody
  1022 + type: object
  1023 + properties:
  1024 + referenceResourceItems:
  1025 + type: array
  1026 + items:
  1027 + $ref: '#/definitions/referenceResourceItemRequestBody'
  1028 + description: 引用资源项列表
  1029 + required:
  1030 + - referenceResourceItems
  1031 + referenceResourceType:
  1032 + type: integer
  1033 + description: 引用类型
  1034 + required:
  1035 + - referenceResourceType
  1036 + description: 引用资源
  1037 + referenceResourceResponseBody:
  1038 + title: referenceResourceResponseBody
  1039 + type: object
  1040 + properties:
  1041 + referenceResourceItems:
  1042 + type: array
  1043 + items:
  1044 + $ref: '#/definitions/referenceResourceItemResponseBody'
  1045 + description: 引用资源项列表
  1046 + required:
  1047 + - referenceResourceItems
  1048 + referenceResourceType:
  1049 + type: integer
  1050 + description: 引用类型
  1051 + required:
  1052 + - referenceResourceType
  1053 + description: 引用资源
  1054 + robInfoResponseBody:
  1055 + title: robInfoResponseBody
  1056 + type: object
  1057 + properties:
  1058 + receiveTime:
  1059 + type: string
  1060 + description: 领取时间
  1061 + required:
  1062 + - receiveTime
  1063 + receiver:
  1064 + $ref: '#/definitions/employeeInfoResponseBody'
  1065 + description: 抢单任务信息
  1066 + taskPercentageItemRequestBody:
  1067 + title: taskPercentageItemRequestBody
  1068 + type: object
  1069 + properties:
  1070 + contributor:
  1071 + $ref: '#/definitions/employeeInfoRequestBody'
  1072 + percentage:
  1073 + type: integer
  1074 + description: 任务贡献占比
  1075 + required:
  1076 + - percentage
  1077 + description: 任务贡献占比项
  1078 + taskPercentageItemResponseBody:
  1079 + title: taskPercentageItemResponseBody
  1080 + type: object
  1081 + properties:
  1082 + contributor:
  1083 + $ref: '#/definitions/employeeInfoResponseBody'
  1084 + percentage:
  1085 + type: integer
  1086 + description: 任务贡献占比
  1087 + required:
  1088 + - percentage
  1089 + description: 任务贡献占比项
  1090 + taskResponseBody:
  1091 + title: taskResponseBody
  1092 + type: object
  1093 + properties:
  1094 + acceptanceStandard:
  1095 + type: string
  1096 + description: 验收标准
  1097 + required:
  1098 + - acceptanceStandard
  1099 + bidInfo:
  1100 + $ref: '#/definitions/bidInfoResponseBody'
  1101 + companyId:
  1102 + type: integer
  1103 + description: 公司ID
  1104 + required:
  1105 + - companyId
  1106 + createTime:
  1107 + type: string
  1108 + description: 创建时间
  1109 + required:
  1110 + - createTime
  1111 + customerValue:
  1112 + type: array
  1113 + items:
  1114 + type: string
  1115 + description: 客户价值列表
  1116 + required:
  1117 + - customerValue
  1118 + isRewardTake:
  1119 + type: boolean
  1120 + description: 是否悬赏任务
  1121 + participators:
  1122 + type: array
  1123 + items:
  1124 + $ref: '#/definitions/employeeInfoResponseBody'
  1125 + description: 任务参与者列表
  1126 + referenceResource:
  1127 + $ref: '#/definitions/referenceResourceResponseBody'
  1128 + releaseTime:
  1129 + type: string
  1130 + description: 发布时间
  1131 + format: datetime
  1132 + robInfo:
  1133 + $ref: '#/definitions/robInfoResponseBody'
  1134 + solvePictureUrls:
  1135 + type: array
  1136 + items:
  1137 + type: string
  1138 + description: 解决图片URL列表
  1139 + solveReport:
  1140 + type: string
  1141 + description: 解决报告
  1142 + sponsor:
  1143 + $ref: '#/definitions/employeeInfoResponseBody'
  1144 + suMoney:
  1145 + type: number
  1146 + description: 奖励素币
  1147 + required:
  1148 + - suMoney
  1149 + taskDescription:
  1150 + type: string
  1151 + description: 任务描述
  1152 + required:
  1153 + - taskDescription
  1154 + taskId:
  1155 + type: integer
  1156 + description: 任务ID
  1157 + required:
  1158 + - taskId
  1159 + taskName:
  1160 + type: string
  1161 + description: 任务名称
  1162 + required:
  1163 + - taskName
  1164 + taskNature:
  1165 + type: string
  1166 + description: 任务性质
  1167 + required:
  1168 + - taskNature
  1169 + taskPercentage:
  1170 + type: array
  1171 + items:
  1172 + $ref: '#/definitions/taskPercentageItemResponseBody'
  1173 + description: 任务贡献占比
  1174 + taskPictureUrls:
  1175 + type: array
  1176 + items:
  1177 + type: string
  1178 + description: 任务图片URL列表
  1179 + taskStatus:
  1180 + type: integer
  1181 + description: 任务状态
  1182 + required:
  1183 + - taskStatus
  1184 + taskType:
  1185 + type: integer
  1186 + description: 任务类型
  1187 + required:
  1188 + - taskType
  1189 + description: 任务
1 package main 1 package main
2 2
3 -import "fmt" 3 +import (
  4 + "github.com/astaxie/beego"
  5 + _ "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/pg"
  6 + _ "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/port/beego"
  7 +)
4 8
5 func main() { 9 func main() {
6 - fmt.Print("") 10 + beego.Run()
7 } 11 }
@@ -45,3 +45,11 @@ func CreateChooseSuccessfulBidderService(options map[string]interface{}) (servic @@ -45,3 +45,11 @@ func CreateChooseSuccessfulBidderService(options map[string]interface{}) (servic
45 } 45 }
46 return domainService.NewChooseSuccessfulBidderService(transactionContext) 46 return domainService.NewChooseSuccessfulBidderService(transactionContext)
47 } 47 }
  48 +
  49 +func CreateApplyCompleteTaskService(options map[string]interface{}) (service.ApplyCompleteTaskService, error) {
  50 + var transactionContext *pgTransaction.TransactionContext
  51 + if value, ok := options["transactionContext"]; ok {
  52 + transactionContext = value.(*pgTransaction.TransactionContext)
  53 + }
  54 + return domainService.NewApplyCompleteTaskService(transactionContext)
  55 +}
@@ -130,10 +130,22 @@ func (taskService *TaskService) ApplyCompleteTask(applyCompleteTaskCommand *comm @@ -130,10 +130,22 @@ func (taskService *TaskService) ApplyCompleteTask(applyCompleteTaskCommand *comm
130 defer func() { 130 defer func() {
131 transactionContext.RollbackTransaction() 131 transactionContext.RollbackTransaction()
132 }() 132 }()
133 - if err := transactionContext.CommitTransaction(); err != nil {  
134 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 133 + var applyCompleteTaskService service.ApplyCompleteTaskService
  134 + if value, err := factory.CreateApplyCompleteTaskService(map[string]interface{}{
  135 + "transactionContext": transactionContext,
  136 + }); err != nil {
  137 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  138 + } else {
  139 + applyCompleteTaskService = value
  140 + }
  141 + if task, err := applyCompleteTaskService.ApplyComplete(applyCompleteTaskCommand.TaskId, applyCompleteTaskCommand.Receiver); err != nil {
  142 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  143 + } else {
  144 + if err := transactionContext.CommitTransaction(); err != nil {
  145 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  146 + }
  147 + return task, nil
135 } 148 }
136 - return nil, nil  
137 } 149 }
138 150
139 // 发布任务 151 // 发布任务
  1 +package service
  2 +
  3 +import "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
  4 +
  5 +type ApplyCompleteTaskService interface {
  6 + ApplyComplete(taskId int64, receiverUid int64) (*domain.Task, error)
  7 +}
@@ -3,5 +3,5 @@ package service @@ -3,5 +3,5 @@ package service
3 import "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain" 3 import "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
4 4
5 type RobTaskService interface { 5 type RobTaskService interface {
6 - Rob(taskId int64, bidderUid int64) (*domain.Task, error) 6 + Rob(taskId int64, receiverUid int64) (*domain.Task, error)
7 } 7 }
  1 +package domain_service
  2 +
  3 +import (
  4 + "fmt"
  5 + coreDomain "github.com/linmadan/egglib-go/core/domain"
  6 + pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
  7 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
  8 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/repository"
  9 +)
  10 +
  11 +type ApplyCompleteTaskService struct {
  12 + coreDomain.BaseEventPublisher
  13 + transactionContext *pgTransaction.TransactionContext
  14 +}
  15 +
  16 +func (service *ApplyCompleteTaskService) ApplyComplete(taskId int64, receiverUid int64) (*domain.Task, error) {
  17 + var employeeRepository domain.EmployeeRepository
  18 + var taskRepository domain.TaskRepository
  19 + if repository, err := repository.NewEmployeeRepository(service.transactionContext); err != nil {
  20 + return nil, err
  21 + } else {
  22 + employeeRepository = repository
  23 + }
  24 + if repository, err := repository.NewTaskRepository(service.transactionContext); err != nil {
  25 + return nil, err
  26 + } else {
  27 + taskRepository = repository
  28 + }
  29 + receiver, err := employeeRepository.FindOne(map[string]interface{}{
  30 + "uid": receiverUid,
  31 + })
  32 + if err != nil {
  33 + return nil, err
  34 + }
  35 + if receiver == nil {
  36 + return nil, fmt.Errorf("无效的领取人")
  37 + }
  38 + task, err := taskRepository.FindOne(map[string]interface{}{
  39 + "taskId": taskId,
  40 + })
  41 + if err != nil {
  42 + return nil, err
  43 + }
  44 + if task == nil {
  45 + return nil, fmt.Errorf("无效的任务")
  46 + }
  47 + if task.TaskType == domain.TASK_TYPE_ROB {
  48 + if receiver.EmployeeInfo.Uid != task.RobInfo.Receiver.Uid {
  49 + return nil, fmt.Errorf("无法申请完成别人领取的任务")
  50 + }
  51 + }
  52 + if task.TaskType == domain.TASK_TYPE_BID {
  53 + if receiver.EmployeeInfo.Uid != task.BidInfo.SuccessfulBidder.Uid {
  54 + return nil, fmt.Errorf("无法申请完成别人领取的任务")
  55 + }
  56 + }
  57 + if err := task.ApplyComplete(); err != nil {
  58 + return nil, err
  59 + }
  60 + if task, err := taskRepository.Save(task); err != nil {
  61 + return nil, err
  62 + } else {
  63 + return task, nil
  64 + }
  65 +}
  66 +
  67 +func NewApplyCompleteTaskService(transactionContext *pgTransaction.TransactionContext) (*ApplyCompleteTaskService, error) {
  68 + if transactionContext == nil {
  69 + return nil, fmt.Errorf("transactionContext参数不能为nil")
  70 + } else {
  71 + return &ApplyCompleteTaskService{
  72 + transactionContext: transactionContext,
  73 + }, nil
  74 + }
  75 +}
1 package task 1 package task
2 2
3 import ( 3 import (
  4 + "github.com/go-pg/pg"
  5 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
4 "net/http" 6 "net/http"
  7 + "time"
5 8
6 "github.com/gavv/httpexpect" 9 "github.com/gavv/httpexpect"
7 - "github.com/go-pg/pg"  
8 . "github.com/onsi/ginkgo" 10 . "github.com/onsi/ginkgo"
9 . "github.com/onsi/gomega" 11 . "github.com/onsi/gomega"
10 pG "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/pg" 12 pG "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/pg"
11 ) 13 )
12 14
13 var _ = Describe("申请完成任务", func() { 15 var _ = Describe("申请完成任务", func() {
14 - var taskId int64  
15 - BeforeEach(func() {  
16 - _, err := pG.DB.QueryOne(  
17 - pg.Scan(&taskId),  
18 - "INSERT INTO tasks (task_id, company_id, task_name, task_type, sponsor, task_status, reference_resource, customer_value, task_nature, su_money, acceptance_standard, task_description, task_picture_urls, is_reward_take, rob_info, bid_info, participators, task_percentage, solve_report, solve_picture_urls, create_time, release_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id",  
19 - "testTaskId", "testCompanyId", "testTaskName", "testTaskType", "testSponsor", "testTaskStatus", "testReferenceResource", "testCustomerValue", "testTaskNature", "testSuMoney", "testAcceptanceStandard", "testTaskDescription", "testTaskPictureUrls", "testIsRewardTake", "testRobInfo", "testBidInfo", "testParticipators", "testTaskPercentage", "testSolveReport", "testSolvePictureUrls", "testCreateTime", "testReleaseTime")  
20 - Expect(err).NotTo(HaveOccurred())  
21 - })  
22 Describe("申请完成任务", func() { 16 Describe("申请完成任务", func() {
23 - Context("", func() {  
24 - It("", func() { 17 + Context("领取人对进行中的任务进行抢单", func() {
  18 + BeforeEach(func() {
  19 + dayAfter, _ := time.ParseDuration("72h")
  20 + _, err := pG.DB.QueryOne(
  21 + pg.Scan(),
  22 + "INSERT INTO tasks (id, company_id, task_name, task_type, sponsor, task_status, reference_resource, customer_value, task_nature, su_money, acceptance_standard, task_description, task_picture_urls, is_reward_take, participators, task_percentage, solve_report, solve_picture_urls, receiver_uid, create_time, release_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
  23 + 1, 101, "抢单任务1", 1, &domain.EmployeeInfo{
  24 + Uid: 2499036607974745088,
  25 + }, 3, "null", pg.Array([]string{"口感", "便利", "品牌", "售后服务"}), "面", 1000.00, "验收标准1", "任务描述1", pg.Array([]string{}), true, []*domain.EmployeeInfo{
  26 + {
  27 + Uid: 2499036607974745077,
  28 + },
  29 + {
  30 + Uid: 2499036607974745066,
  31 + },
  32 + }, "null", "", pg.Array([]string{}), 2499036607974745099, time.Now(), time.Now().Add(dayAfter))
  33 + Expect(err).NotTo(HaveOccurred())
  34 + _, err1 := pG.DB.QueryOne(
  35 + pg.Scan(),
  36 + "INSERT INTO employees (id, company_id, uid, employee_name, employee_account, su_money) VALUES (?, ?, ?, ?, ?, ?)",
  37 + 1, 101, 2499036607974745088, "testEmployeeName", "testEmployeeAccount", 0)
  38 + Expect(err1).NotTo(HaveOccurred())
  39 + _, err2 := pG.DB.QueryOne(
  40 + pg.Scan(),
  41 + "INSERT INTO employees (id, company_id, uid, employee_name, employee_account, su_money) VALUES (?, ?, ?, ?, ?, ?)",
  42 + 2, 101, 2499036607974745099, "testEmployeeName", "testEmployeeAccount", 0)
  43 + Expect(err2).NotTo(HaveOccurred())
  44 + _, err3 := pG.DB.QueryOne(
  45 + pg.Scan(),
  46 + "INSERT INTO rob_infos (id, task_id ,receiver) VALUES (?, ?, ?)",
  47 + 1, 1, &domain.EmployeeInfo{
  48 + Uid: 2499036607974745099,
  49 + })
  50 + Expect(err3).NotTo(HaveOccurred())
  51 + })
  52 + It("申请完成成功", func() {
25 httpExpect := httpexpect.New(GinkgoT(), server.URL) 53 httpExpect := httpexpect.New(GinkgoT(), server.URL)
26 body := map[string]interface{}{ 54 body := map[string]interface{}{
27 - "receiver": "int64", 55 + "receiver": 2499036607974745099,
28 } 56 }
29 - httpExpect.POST("/tasks/{taskId}/apply-complete"). 57 + httpExpect.POST("/tasks/1/apply-complete").
30 WithJSON(body). 58 WithJSON(body).
31 Expect(). 59 Expect().
32 Status(http.StatusOK). 60 Status(http.StatusOK).
@@ -34,12 +62,21 @@ var _ = Describe("申请完成任务", func() { @@ -34,12 +62,21 @@ var _ = Describe("申请完成任务", func() {
34 Object(). 62 Object().
35 ContainsKey("code").ValueEqual("code", 0). 63 ContainsKey("code").ValueEqual("code", 0).
36 ContainsKey("msg").ValueEqual("msg", "ok"). 64 ContainsKey("msg").ValueEqual("msg", "ok").
37 - ContainsKey("data").Value("data").Object() 65 + ContainsKey("data").Value("data").Object().
  66 + ContainsKey("taskStatus").ValueEqual("taskStatus", 4)
38 }) 67 })
39 }) 68 })
40 }) 69 })
41 AfterEach(func() { 70 AfterEach(func() {
42 _, err := pG.DB.Exec("DELETE FROM tasks WHERE true") 71 _, err := pG.DB.Exec("DELETE FROM tasks WHERE true")
43 Expect(err).NotTo(HaveOccurred()) 72 Expect(err).NotTo(HaveOccurred())
  73 + _, err1 := pG.DB.Exec("DELETE FROM bid_infos WHERE true")
  74 + Expect(err1).NotTo(HaveOccurred())
  75 + _, err2 := pG.DB.Exec("DELETE FROM bidder_infos WHERE true")
  76 + Expect(err2).NotTo(HaveOccurred())
  77 + _, err3 := pG.DB.Exec("DELETE FROM employees WHERE true")
  78 + Expect(err3).NotTo(HaveOccurred())
  79 + _, err4 := pG.DB.Exec("DELETE FROM rob_infos WHERE true")
  80 + Expect(err4).NotTo(HaveOccurred())
44 }) 81 })
45 }) 82 })