作者 linmadan

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

... ... @@ -6,12 +6,10 @@ WORKDIR $APP_DIR/
COPY ./pkg pkg
COPY ./conf conf
COPY ./go.mod go.mod
COPY ./go.sum go.sum
COPY ./main.go main.go
RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"]
ENV GO111MODULE on
ENV GOPROXY https://goproxy.io
RUN ["go","mod","tidy"]
RUN ["ls"]
RUN ["go","build"]
ENTRYPOINT ["./mmm-worth"]
\ No newline at end of file
... ...
#!/bin/bash
export PATH=/root/local/bin:$PATH
kubectl -n <replace-your-k8s-namespace> get pods | grep -q mmm-worth
kubectl -n mmm-worth-dev get pods | grep -q mmm-worth
if [ "$?" == "1" ];then
kubectl create -f /tmp/dev/mmm-worth/mmm-worth.yaml --record
kubectl -n <replace-your-k8s-namespace> get svc | grep -q mmm-worth
kubectl -n mmm-worth-dev get svc | grep -q mmm-worth
if [ "$?" == "0" ];then
echo "mmm-worth service install success!"
else
echo "mmm-worth service install fail!"
fi
kubectl -n <replace-your-k8s-namespace> get pods | grep -q mmm-worth
kubectl -n mmm-worth-dev get pods | grep -q mmm-worth
if [ "$?" == "0" ];then
echo "mmm-worth deployment install success!"
else
... ... @@ -17,24 +17,24 @@ if [ "$?" == "1" ];then
fi
else
kubectl delete -f /tmp/dev/mmm-worth/mmm-worth.yaml
kubectl -n <replace-your-k8s-namespace> get svc | grep -q mmm-worth
kubectl -n mmm-worth-dev get svc | grep -q mmm-worth
while [ "$?" == "0" ]
do
kubectl -n <replace-your-k8s-namespace> get svc | grep -q mmm-worth
kubectl -n mmm-worth-dev get svc | grep -q mmm-worth
done
kubectl -n <replace-your-k8s-namespace> get pods | grep -q mmm-worth
kubectl -n mmm-worth-dev get pods | grep -q mmm-worth
while [ "$?" == "0" ]
do
kubectl -n <replace-your-k8s-namespace> get pods | grep -q mmm-worth
kubectl -n mmm-worth-dev get pods | grep -q mmm-worth
done
kubectl create -f /tmp/dev/mmm-worth/mmm-worth.yaml --record
kubectl -n <replace-your-k8s-namespace> get svc | grep -q mmm-worth
kubectl -n mmm-worth-dev get svc | grep -q mmm-worth
if [ "$?" == "0" ];then
echo "mmm-worth service update success!"
else
echo "mmm-worth service update fail!"
fi
kubectl -n <replace-your-k8s-namespace> get pods | grep -q mmm-worth
kubectl -n mmm-worth-dev get pods | grep -q mmm-worth
if [ "$?" == "0" ];then
echo "mmm-worth deployment update success!"
else
... ...
... ... @@ -2,7 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: mmm-worth
namespace: <replace-your-k8s-namespace>
namespace: mmm-worth-dev
labels:
k8s-app: mmm-worth
spec:
... ... @@ -17,7 +17,7 @@ apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: mmm-worth
namespace: <replace-your-k8s-namespace>
namespace: mmm-worth-dev
labels:
k8s-app: mmm-worth
spec:
... ... @@ -52,6 +52,16 @@ spec:
- mountPath: /opt/logs
name: accesslogs
env:
- name: POSTGRESQL_DB_NAME
value: "mmm-worth"
- name: POSTGRESQL_USER
value: "postgres"
- name: POSTGRESQL_PASSWORD
value: "postgres_15432"
- name: POSTGRESQL_HOST
value: "101.37.68.23"
- name: POSTGRESQL_PORT
value: "15432"
- name: LOG_LEVEL
value: "debug"
- name: ERROR_BASE_CODE
... ...
{
"swagger": "2.0",
"info": {
"title": "",
"description": "买买买价值系统",
"contact": {
"name": "linmadan",
"email": "772181827@qq.com"
},
"version": "0.0.1"
},
"consumes": [
"application/json",
"application/xml"
],
"produces": [
"application/json",
"application/xml"
],
"paths": {
"/employees": {
"get": {
"tags": [
"employee"
],
"summary": "返回员工列表",
"description": "返回员工列表",
"operationId": "employee#listEmployee",
"parameters": [
{
"name": "offset",
"in": "query",
"description": "查询偏离量",
"required": false,
"type": "integer"
},
{
"name": "limit",
"in": "query",
"description": "查询限制",
"required": false,
"type": "integer"
}
],
"responses": {
"200": {
"description": "OK response.",
"schema": {
"$ref": "#/definitions/EmployeeListEmployeeResponseBody"
}
}
},
"schemes": [
"http"
]
},
"post": {
"tags": [
"employee"
],
"summary": "创建新员工",
"description": "创建新员工",
"operationId": "employee#createEmployee",
"parameters": [
{
"name": "CreateEmployeeRequestBody",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/EmployeeCreateEmployeeRequestBody"
}
}
],
"responses": {
"200": {
"description": "OK response.",
"schema": {
"$ref": "#/definitions/EmployeeCreateEmployeeResponseBody"
}
}
},
"schemes": [
"http"
]
}
},
"/employees/{uid}": {
"get": {
"tags": [
"employee"
],
"summary": "返回员工",
"description": "返回员工",
"operationId": "employee#getEmployee",
"parameters": [
{
"name": "uid",
"in": "path",
"description": "统一用户UID",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "OK response.",
"schema": {
"$ref": "#/definitions/EmployeeGetEmployeeResponseBody"
}
}
},
"schemes": [
"http"
]
},
"put": {
"tags": [
"employee"
],
"summary": "更新员工",
"description": "更新员工",
"operationId": "employee#updateEmployee",
"parameters": [
{
"name": "uid",
"in": "path",
"description": "统一用户UID",
"required": true,
"type": "integer"
},
{
"name": "UpdateEmployeeRequestBody",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/EmployeeUpdateEmployeeRequestBody"
}
}
],
"responses": {
"200": {
"description": "OK response.",
"schema": {
"$ref": "#/definitions/EmployeeUpdateEmployeeResponseBody"
}
}
},
"schemes": [
"http"
]
},
"delete": {
"tags": [
"employee"
],
"summary": "移除员工",
"description": "移除员工",
"operationId": "employee#removeEmployee",
"parameters": [
{
"name": "uid",
"in": "path",
"description": "统一用户UID",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "OK response.",
"schema": {
"$ref": "#/definitions/EmployeeRemoveEmployeeResponseBody"
}
}
},
"schemes": [
"http"
]
}
},
"/tasks": {
"get": {
"tags": [
"task"
],
"summary": "返回任务列表",
"description": "返回任务列表",
"operationId": "task#listTask",
"parameters": [
{
"name": "companyId",
"in": "query",
"description": "公司ID",
"required": false,
"type": "integer"
},
{
"name": "sponsor",
"in": "query",
"description": "任务发起者",
"required": false,
"type": "integer",
"format": "int64"
},
{
"name": "taskContentMatch",
"in": "query",
"description": "任务内容匹配",
"required": false,
"type": "string"
},
{
"name": "taskType",
"in": "query",
"description": "任务类型",
"required": false,
"type": "integer"
},
{
"name": "taskStatus",
"in": "query",
"description": "任务状态",
"required": false,
"type": "integer"
},
{
"name": "customerValue",
"in": "query",
"description": "客户价值",
"required": false,
"type": "string"
},
{
"name": "taskNature",
"in": "query",
"description": "任务性质",
"required": false,
"type": "string"
},
{
"name": "isRewardTake",
"in": "query",
"description": "是否悬赏任务",
"required": false,
"type": "boolean"
},
{
"name": "bidTimeMatch",
"in": "query",
"description": "竞标时间(1全部,2已截止,3未截止)",
"required": false,
"type": "integer"
},
{
"name": "receiver",
"in": "query",
"description": "任务领取人",
"required": false,
"type": "integer",
"format": "int64"
},
{
"name": "participator",
"in": "query",
"description": "任务参与者",
"required": false,
"type": "integer",
"format": "int64"
},
{
"name": "offset",
"in": "query",
"description": "查询偏离量",
"required": false,
"type": "integer"
},
{
"name": "limit",
"in": "query",
"description": "查询限制",
"required": false,
"type": "integer"
}
],
"responses": {
"200": {
"description": "OK response.",
"schema": {
"$ref": "#/definitions/TaskListTaskResponseBody"
}
}
},
"schemes": [
"http"
]
},
"post": {
"tags": [
"task"
],
"summary": "创建新任务",
"description": "创建新任务",
"operationId": "task#createTask",
"parameters": [
{
"name": "CreateTaskRequestBody",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/TaskCreateTaskRequestBody"
}
}
],
"responses": {
"200": {
"description": "OK response.",
"schema": {
"$ref": "#/definitions/TaskCreateTaskResponseBody"
}
}
},
"schemes": [
"http"
]
}
},
"/tasks/{taskId}": {
"get": {
"tags": [
"task"
],
"summary": "返回任务",
"description": "返回任务",
"operationId": "task#getTask",
"parameters": [
{
"name": "taskId",
"in": "path",
"description": "任务ID",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "OK response.",
"schema": {
"$ref": "#/definitions/TaskGetTaskResponseBody"
}
}
},
"schemes": [
"http"
]
},
"put": {
"tags": [
"task"
],
"summary": "更新任务",
"description": "更新任务",
"operationId": "task#updateTask",
"parameters": [
{
"name": "taskId",
"in": "path",
"description": "任务ID",
"required": true,
"type": "integer"
},
{
"name": "UpdateTaskRequestBody",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/TaskUpdateTaskRequestBody"
}
}
],
"responses": {
"200": {
"description": "OK response.",
"schema": {
"$ref": "#/definitions/TaskUpdateTaskResponseBody"
}
}
},
"schemes": [
"http"
]
},
"delete": {
"tags": [
"task"
],
"summary": "移除任务",
"description": "移除任务",
"operationId": "task#removeTask",
"parameters": [
{
"name": "taskId",
"in": "path",
"description": "任务ID",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "OK response.",
"schema": {
"$ref": "#/definitions/TaskRemoveTaskResponseBody"
}
}
},
"schemes": [
"http"
]
}
},
"/tasks/{taskId}/acceptance": {
"post": {
"tags": [
"task"
],
"summary": "验收任务",
"description": "验收任务",
"operationId": "task#acceptanceTask",
"parameters": [
{
"name": "taskId",
"in": "path",
"description": "任务ID",
"required": true,
"type": "integer"
},
{
"name": "AcceptanceTaskRequestBody",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/TaskAcceptanceTaskRequestBody"
}
}
],
"responses": {
"200": {
"description": "OK response.",
"schema": {
"$ref": "#/definitions/TaskAcceptanceTaskResponseBody"
}
}
},
"schemes": [
"http"
]
}
},
"/tasks/{taskId}/apply-complete": {
"post": {
"tags": [
"task"
],
"summary": "申请完成任务",
"description": "申请完成任务",
"operationId": "task#applyCompleteTask",
"parameters": [
{
"name": "taskId",
"in": "path",
"description": "任务ID",
"required": true,
"type": "integer"
},
{
"name": "ApplyCompleteTaskRequestBody",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/TaskApplyCompleteTaskRequestBody"
}
}
],
"responses": {
"200": {
"description": "OK response.",
"schema": {
"$ref": "#/definitions/TaskApplyCompleteTaskResponseBody"
}
}
},
"schemes": [
"http"
]
}
},
"/tasks/{taskId}/bid": {
"post": {
"tags": [
"task"
],
"summary": "对任务进行竞标",
"description": "对任务进行竞标",
"operationId": "task#bidTask",
"parameters": [
{
"name": "taskId",
"in": "path",
"description": "任务ID",
"required": true,
"type": "integer"
},
{
"name": "BidTaskRequestBody",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/TaskBidTaskRequestBody"
}
}
],
"responses": {
"200": {
"description": "OK response.",
"schema": {
"$ref": "#/definitions/TaskBidTaskResponseBody"
}
}
},
"schemes": [
"http"
]
}
},
"/tasks/{taskId}/choose-successful-bidder": {
"post": {
"tags": [
"task"
],
"summary": "选择竞标任务的中标人",
"description": "选择竞标任务的中标人",
"operationId": "task#chooseSuccessfulBidder",
"parameters": [
{
"name": "taskId",
"in": "path",
"description": "任务ID",
"required": true,
"type": "integer"
},
{
"name": "ChooseSuccessfulBidderRequestBody",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/TaskChooseSuccessfulBidderRequestBody"
}
}
],
"responses": {
"200": {
"description": "OK response.",
"schema": {
"$ref": "#/definitions/TaskChooseSuccessfulBidderResponseBody"
}
}
},
"schemes": [
"http"
]
}
},
"/tasks/{taskId}/dff": {
"post": {
"tags": [
"task"
],
"summary": "关闭任务",
"description": "关闭任务",
"operationId": "task#offTask",
"parameters": [
{
"name": "taskId",
"in": "path",
"description": "任务ID",
"required": true,
"type": "integer"
},
{
"name": "OffTaskRequestBody",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/TaskOffTaskRequestBody"
}
}
],
"responses": {
"200": {
"description": "OK response.",
"schema": {
"$ref": "#/definitions/TaskOffTaskResponseBody"
}
}
},
"schemes": [
"http"
]
}
},
"/tasks/{taskId}/release": {
"post": {
"tags": [
"task"
],
"summary": "发布任务",
"description": "发布任务",
"operationId": "task#releaseTask",
"parameters": [
{
"name": "taskId",
"in": "path",
"description": "任务ID",
"required": true,
"type": "integer"
},
{
"name": "ReleaseTaskRequestBody",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/TaskReleaseTaskRequestBody"
}
}
],
"responses": {
"200": {
"description": "OK response.",
"schema": {
"$ref": "#/definitions/TaskReleaseTaskResponseBody"
}
}
},
"schemes": [
"http"
]
}
},
"/tasks/{taskId}/rob": {
"post": {
"tags": [
"task"
],
"summary": "对任务进行抢单",
"description": "对任务进行抢单",
"operationId": "task#robTask",
"parameters": [
{
"name": "taskId",
"in": "path",
"description": "任务ID",
"required": true,
"type": "integer"
},
{
"name": "RobTaskRequestBody",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/TaskRobTaskRequestBody"
}
}
],
"responses": {
"200": {
"description": "OK response.",
"schema": {
"$ref": "#/definitions/TaskRobTaskResponseBody"
}
}
},
"schemes": [
"http"
]
}
},
"/tasks/search": {
"post": {
"tags": [
"task"
],
"summary": "搜索任务",
"description": "搜索任务",
"operationId": "task#searchTask",
"parameters": [
{
"name": "SearchTaskRequestBody",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/TaskSearchTaskRequestBody"
}
}
],
"responses": {
"200": {
"description": "OK response.",
"schema": {
"$ref": "#/definitions/TaskSearchTaskResponseBody"
}
}
},
"schemes": [
"http"
]
}
}
},
"definitions": {
"EmployeeCreateEmployeeRequestBody": {
"title": "EmployeeCreateEmployeeRequestBody",
"type": "object",
"properties": {
"employeeAccount": {
"type": "string",
"description": "员工账号"
},
"employeeName": {
"type": "string",
"description": "员工姓名"
},
"uid": {
"type": "integer",
"description": "统一用户UID",
"required": [
"uid"
]
}
}
},
"EmployeeCreateEmployeeResponseBody": {
"title": "Mediatype identifier: EmployeeCreateEmployeeResponseBody",
"type": "object",
"properties": {
"employee": {
"$ref": "#/definitions/employeeResponseBody"
}
}
},
"EmployeeGetEmployeeResponseBody": {
"title": "Mediatype identifier: EmployeeGetEmployeeResponseBody",
"type": "object",
"properties": {
"employee": {
"$ref": "#/definitions/employeeResponseBody"
}
}
},
"EmployeeListEmployeeResponseBody": {
"title": "Mediatype identifier: EmployeeListEmployeeResponseBody",
"type": "object",
"properties": {
"count": {
"type": "integer",
"description": "结果总数",
"format": "int64"
},
"employees": {
"type": "array",
"items": {
"$ref": "#/definitions/employeeResponseBody"
}
}
}
},
"EmployeeRemoveEmployeeResponseBody": {
"title": "Mediatype identifier: EmployeeRemoveEmployeeResponseBody",
"type": "object",
"properties": {
"employee": {
"$ref": "#/definitions/employeeResponseBody"
}
}
},
"EmployeeUpdateEmployeeRequestBody": {
"title": "EmployeeUpdateEmployeeRequestBody",
"type": "object",
"properties": {
"employeeAccount": {
"type": "string",
"description": "员工账号"
},
"employeeName": {
"type": "string",
"description": "员工姓名"
}
}
},
"EmployeeUpdateEmployeeResponseBody": {
"title": "Mediatype identifier: EmployeeUpdateEmployeeResponseBody",
"type": "object",
"properties": {
"employee": {
"$ref": "#/definitions/employeeResponseBody"
}
}
},
"TaskAcceptanceTaskRequestBody": {
"title": "TaskAcceptanceTaskRequestBody",
"type": "object",
"properties": {
"operator": {
"type": "integer",
"description": "操作人uid",
"required": [
"operator"
]
},
"participators": {
"type": "array",
"items": {
"type": "integer",
"format": "int64"
},
"description": "任务参与者UID列表"
},
"solvePictureUrls": {
"type": "array",
"items": {
"type": "string"
},
"description": "解决图片URL列表"
},
"solveReport": {
"type": "string",
"description": "解决报告"
},
"taskPercentage": {
"type": "array",
"items": {
"$ref": "#/definitions/taskPercentageItemRequestBody"
},
"description": "任务贡献占比",
"required": [
"taskPercentage"
]
}
}
},
"TaskAcceptanceTaskResponseBody": {
"title": "Mediatype identifier: TaskAcceptanceTaskResponseBody",
"type": "object",
"properties": {
"task": {
"$ref": "#/definitions/taskResponseBody"
}
}
},
"TaskApplyCompleteTaskRequestBody": {
"title": "TaskApplyCompleteTaskRequestBody",
"type": "object",
"properties": {
"receiver": {
"type": "integer",
"description": "领取人或者中标人uid",
"required": [
"receiver"
]
}
}
},
"TaskApplyCompleteTaskResponseBody": {
"title": "Mediatype identifier: TaskApplyCompleteTaskResponseBody",
"type": "object",
"properties": {
"task": {
"$ref": "#/definitions/taskResponseBody"
}
}
},
"TaskBidTaskRequestBody": {
"title": "TaskBidTaskRequestBody",
"type": "object",
"properties": {
"bidder": {
"type": "integer",
"description": "竞标人uid",
"required": [
"bidder"
]
}
}
},
"TaskBidTaskResponseBody": {
"title": "Mediatype identifier: TaskBidTaskResponseBody",
"type": "object",
"properties": {
"task": {
"$ref": "#/definitions/taskResponseBody"
}
}
},
"TaskChooseSuccessfulBidderRequestBody": {
"title": "TaskChooseSuccessfulBidderRequestBody",
"type": "object",
"properties": {
"operator": {
"type": "integer",
"description": "操作人uid",
"required": [
"operator"
]
},
"successfulBidder": {
"type": "integer",
"description": "中标者uid",
"required": [
"successfulBidder"
]
}
}
},
"TaskChooseSuccessfulBidderResponseBody": {
"title": "Mediatype identifier: TaskChooseSuccessfulBidderResponseBody",
"type": "object",
"properties": {
"task": {
"$ref": "#/definitions/taskResponseBody"
}
}
},
"TaskCreateTaskRequestBody": {
"title": "TaskCreateTaskRequestBody",
"type": "object",
"properties": {
"acceptanceStandard": {
"type": "string",
"description": "验收标准",
"required": [
"acceptanceStandard"
]
},
"bidEndTime": {
"type": "string",
"description": "竞标结束时间",
"format": "datetime"
},
"bidStartTime": {
"type": "string",
"description": "竞标开始时间",
"format": "datetime"
},
"customerValue": {
"type": "array",
"items": {
"type": "string"
},
"description": "客户价值列表",
"required": [
"customerValue"
]
},
"isRewardTake": {
"type": "boolean",
"description": "是否悬赏任务"
},
"referenceResource": {
"$ref": "#/definitions/referenceResourceRequestBody"
},
"sponsor": {
"type": "integer",
"description": "任务发起者uid",
"required": [
"sponsor"
]
},
"suMoney": {
"type": "number",
"description": "奖励素币",
"format": "double"
},
"taskDescription": {
"type": "string",
"description": "任务描述",
"required": [
"taskDescription"
]
},
"taskName": {
"type": "string",
"description": "任务名称",
"required": [
"taskName"
]
},
"taskNature": {
"type": "string",
"description": "任务性质",
"required": [
"taskNature"
]
},
"taskPictureUrls": {
"type": "array",
"items": {
"type": "string"
},
"description": "任务图片URL列表"
},
"taskType": {
"type": "integer",
"description": "任务类型",
"required": [
"taskType"
]
}
}
},
"TaskCreateTaskResponseBody": {
"title": "Mediatype identifier: TaskCreateTaskResponseBody",
"type": "object",
"properties": {
"task": {
"$ref": "#/definitions/taskResponseBody"
}
}
},
"TaskGetTaskResponseBody": {
"title": "Mediatype identifier: TaskGetTaskResponseBody",
"type": "object",
"properties": {
"task": {
"$ref": "#/definitions/taskResponseBody"
}
}
},
"TaskListTaskResponseBody": {
"title": "Mediatype identifier: TaskListTaskResponseBody",
"type": "object",
"properties": {
"count": {
"type": "integer",
"description": "结果总数",
"format": "int64"
},
"tasks": {
"type": "array",
"items": {
"$ref": "#/definitions/taskResponseBody"
}
}
}
},
"TaskOffTaskRequestBody": {
"title": "TaskOffTaskRequestBody",
"type": "object",
"properties": {
"offReason": {
"type": "string",
"description": "关闭理由",
"required": [
"offReason"
]
},
"operator": {
"type": "integer",
"description": "操作人uid",
"required": [
"operator"
]
}
}
},
"TaskOffTaskResponseBody": {
"title": "Mediatype identifier: TaskOffTaskResponseBody",
"type": "object",
"properties": {
"task": {
"$ref": "#/definitions/taskResponseBody"
}
}
},
"TaskReleaseTaskRequestBody": {
"title": "TaskReleaseTaskRequestBody",
"type": "object",
"properties": {
"operator": {
"type": "integer",
"description": "操作人uid",
"required": [
"operator"
]
}
}
},
"TaskReleaseTaskResponseBody": {
"title": "Mediatype identifier: TaskReleaseTaskResponseBody",
"type": "object",
"properties": {
"task": {
"$ref": "#/definitions/taskResponseBody"
}
}
},
"TaskRemoveTaskResponseBody": {
"title": "Mediatype identifier: TaskRemoveTaskResponseBody",
"type": "object",
"properties": {
"task": {
"$ref": "#/definitions/taskResponseBody"
}
}
},
"TaskRobTaskRequestBody": {
"title": "TaskRobTaskRequestBody",
"type": "object",
"properties": {
"receiver": {
"type": "integer",
"description": "领取人uid",
"required": [
"receiver"
]
}
}
},
"TaskRobTaskResponseBody": {
"title": "Mediatype identifier: TaskRobTaskResponseBody",
"type": "object",
"properties": {
"task": {
"$ref": "#/definitions/taskResponseBody"
}
}
},
"TaskSearchTaskRequestBody": {
"title": "TaskSearchTaskRequestBody",
"type": "object",
"properties": {
"bidTimeMatch": {
"type": "integer",
"description": "竞标时间(1全部,2已截止,3未截止)",
"format": "int64"
},
"companyId": {
"type": "integer",
"description": "公司ID",
"required": [
"companyId"
]
},
"customerValue": {
"type": "string",
"description": "客户价值"
},
"isRewardTake": {
"type": "boolean",
"description": "是否悬赏任务"
},
"limit": {
"type": "integer",
"description": "查询限制",
"format": "int64"
},
"offset": {
"type": "integer",
"description": "查询偏离量",
"format": "int64"
},
"participator": {
"type": "integer",
"description": "任务参与者",
"format": "int64"
},
"receiver": {
"type": "integer",
"description": "任务领取人",
"format": "int64"
},
"sponsor": {
"type": "integer",
"description": "任务发起者",
"format": "int64"
},
"taskContentMatch": {
"type": "string",
"description": "任务内容匹配"
},
"taskNature": {
"type": "string",
"description": "任务性质"
},
"taskStatus": {
"type": "integer",
"description": "任务状态",
"format": "int64"
},
"taskType": {
"type": "integer",
"description": "任务类型",
"format": "int64"
}
}
},
"TaskSearchTaskResponseBody": {
"title": "Mediatype identifier: TaskSearchTaskResponseBody",
"type": "object",
"properties": {
"count": {
"type": "integer",
"description": "结果总数",
"format": "int64"
},
"tasks": {
"type": "array",
"items": {
"$ref": "#/definitions/taskResponseBody"
}
}
}
},
"TaskUpdateTaskRequestBody": {
"title": "TaskUpdateTaskRequestBody",
"type": "object",
"properties": {
"acceptanceStandard": {
"type": "string",
"description": "验收标准"
},
"bidEndTime": {
"type": "string",
"description": "竞标结束时间",
"format": "datetime"
},
"bidStartTime": {
"type": "string",
"description": "竞标开始时间",
"format": "datetime"
},
"customerValue": {
"type": "array",
"items": {
"type": "string"
},
"description": "客户价值列表"
},
"isRewardTake": {
"type": "boolean",
"description": "是否悬赏任务"
},
"referenceResource": {
"$ref": "#/definitions/referenceResourceRequestBody"
},
"suMoney": {
"type": "number",
"description": "奖励素币",
"format": "double"
},
"taskDescription": {
"type": "string",
"description": "任务描述"
},
"taskName": {
"type": "string",
"description": "任务名称"
},
"taskNature": {
"type": "string",
"description": "任务性质"
},
"taskPictureUrls": {
"type": "array",
"items": {
"type": "string"
},
"description": "任务图片URL列表"
}
}
},
"TaskUpdateTaskResponseBody": {
"title": "Mediatype identifier: TaskUpdateTaskResponseBody",
"type": "object",
"properties": {
"task": {
"$ref": "#/definitions/taskResponseBody"
}
}
},
"bidInfoResponseBody": {
"title": "bidInfoResponseBody",
"type": "object",
"properties": {
"bidEndTime": {
"type": "string",
"description": "竞标结束时间",
"required": [
"bidEndTime"
]
},
"bidStartTime": {
"type": "string",
"description": "竞标开始时间",
"required": [
"bidStartTime"
]
},
"bidderInfos": {
"type": "array",
"items": {
"$ref": "#/definitions/bidderInfoResponseBody"
},
"description": "竞标人员列表"
},
"successfulBidder": {
"$ref": "#/definitions/employeeInfoResponseBody"
},
"winBidTime": {
"type": "string",
"description": "中标时间",
"required": [
"winBidTime"
]
}
},
"description": "竞标任务信息"
},
"bidderInfoResponseBody": {
"title": "bidderInfoResponseBody",
"type": "object",
"properties": {
"bidTime": {
"type": "string",
"description": "竞标时间",
"required": [
"bidTime"
]
},
"bidder": {
"$ref": "#/definitions/employeeInfoResponseBody"
}
},
"description": "竞标人员信息"
},
"employeeInfoRequestBody": {
"title": "employeeInfoRequestBody",
"type": "object",
"properties": {
"employeeAccount": {
"type": "string",
"description": "员工账号"
},
"employeeName": {
"type": "string",
"description": "员工姓名",
"required": [
"employeeName"
]
},
"uid": {
"type": "integer",
"description": "统一用户UID",
"required": [
"uid"
]
}
},
"description": "员工信息"
},
"employeeInfoResponseBody": {
"title": "employeeInfoResponseBody",
"type": "object",
"properties": {
"employeeAccount": {
"type": "string",
"description": "员工账号"
},
"employeeName": {
"type": "string",
"description": "员工姓名",
"required": [
"employeeName"
]
},
"uid": {
"type": "integer",
"description": "统一用户UID",
"required": [
"uid"
]
}
},
"description": "员工信息"
},
"employeeResponseBody": {
"title": "employeeResponseBody",
"type": "object",
"properties": {
"companyId": {
"type": "integer",
"description": "公司ID",
"required": [
"companyId"
]
},
"employeeId": {
"type": "integer",
"description": "员工ID",
"required": [
"employeeId"
]
},
"employeeInfo": {
"$ref": "#/definitions/employeeInfoResponseBody"
},
"status": {
"type": "integer",
"description": "员工状态(启用或者禁用)",
"format": "int64"
},
"suMoney": {
"type": "number",
"description": "当前素币",
"required": [
"suMoney"
]
}
},
"description": "员工"
},
"referenceResourceItemRequestBody": {
"title": "referenceResourceItemRequestBody",
"type": "object",
"properties": {
"serialNumber": {
"type": "integer",
"description": "编号",
"required": [
"serialNumber"
]
},
"title": {
"type": "string",
"description": "标题",
"required": [
"title"
]
}
},
"description": "引用资源项"
},
"referenceResourceItemResponseBody": {
"title": "referenceResourceItemResponseBody",
"type": "object",
"properties": {
"serialNumber": {
"type": "integer",
"description": "编号",
"required": [
"serialNumber"
]
},
"title": {
"type": "string",
"description": "标题",
"required": [
"title"
]
}
},
"description": "引用资源项"
},
"referenceResourceRequestBody": {
"title": "referenceResourceRequestBody",
"type": "object",
"properties": {
"referenceResourceItems": {
"type": "array",
"items": {
"$ref": "#/definitions/referenceResourceItemRequestBody"
},
"description": "引用资源项列表",
"required": [
"referenceResourceItems"
]
},
"referenceResourceType": {
"type": "integer",
"description": "引用类型",
"required": [
"referenceResourceType"
]
}
},
"description": "引用资源"
},
"referenceResourceResponseBody": {
"title": "referenceResourceResponseBody",
"type": "object",
"properties": {
"referenceResourceItems": {
"type": "array",
"items": {
"$ref": "#/definitions/referenceResourceItemResponseBody"
},
"description": "引用资源项列表",
"required": [
"referenceResourceItems"
]
},
"referenceResourceType": {
"type": "integer",
"description": "引用类型",
"required": [
"referenceResourceType"
]
}
},
"description": "引用资源"
},
"robInfoResponseBody": {
"title": "robInfoResponseBody",
"type": "object",
"properties": {
"receiveTime": {
"type": "string",
"description": "领取时间",
"required": [
"receiveTime"
]
},
"receiver": {
"$ref": "#/definitions/employeeInfoResponseBody"
}
},
"description": "抢单任务信息"
},
"taskPercentageItemRequestBody": {
"title": "taskPercentageItemRequestBody",
"type": "object",
"properties": {
"contributor": {
"$ref": "#/definitions/employeeInfoRequestBody"
},
"percentage": {
"type": "integer",
"description": "任务贡献占比",
"required": [
"percentage"
]
}
},
"description": "任务贡献占比项"
},
"taskPercentageItemResponseBody": {
"title": "taskPercentageItemResponseBody",
"type": "object",
"properties": {
"contributor": {
"$ref": "#/definitions/employeeInfoResponseBody"
},
"percentage": {
"type": "integer",
"description": "任务贡献占比",
"required": [
"percentage"
]
}
},
"description": "任务贡献占比项"
},
"taskResponseBody": {
"title": "taskResponseBody",
"type": "object",
"properties": {
"acceptanceStandard": {
"type": "string",
"description": "验收标准",
"required": [
"acceptanceStandard"
]
},
"bidInfo": {
"$ref": "#/definitions/bidInfoResponseBody"
},
"companyId": {
"type": "integer",
"description": "公司ID",
"required": [
"companyId"
]
},
"createTime": {
"type": "string",
"description": "创建时间",
"required": [
"createTime"
]
},
"customerValue": {
"type": "array",
"items": {
"type": "string"
},
"description": "客户价值列表",
"required": [
"customerValue"
]
},
"isRewardTake": {
"type": "boolean",
"description": "是否悬赏任务"
},
"participators": {
"type": "array",
"items": {
"$ref": "#/definitions/employeeInfoResponseBody"
},
"description": "任务参与者列表"
},
"referenceResource": {
"$ref": "#/definitions/referenceResourceResponseBody"
},
"releaseTime": {
"type": "string",
"description": "发布时间",
"format": "datetime"
},
"robInfo": {
"$ref": "#/definitions/robInfoResponseBody"
},
"solvePictureUrls": {
"type": "array",
"items": {
"type": "string"
},
"description": "解决图片URL列表"
},
"solveReport": {
"type": "string",
"description": "解决报告"
},
"sponsor": {
"$ref": "#/definitions/employeeInfoResponseBody"
},
"suMoney": {
"type": "number",
"description": "奖励素币",
"required": [
"suMoney"
]
},
"taskDescription": {
"type": "string",
"description": "任务描述",
"required": [
"taskDescription"
]
},
"taskId": {
"type": "integer",
"description": "任务ID",
"required": [
"taskId"
]
},
"taskName": {
"type": "string",
"description": "任务名称",
"required": [
"taskName"
]
},
"taskNature": {
"type": "string",
"description": "任务性质",
"required": [
"taskNature"
]
},
"taskPercentage": {
"type": "array",
"items": {
"$ref": "#/definitions/taskPercentageItemResponseBody"
},
"description": "任务贡献占比"
},
"taskPictureUrls": {
"type": "array",
"items": {
"type": "string"
},
"description": "任务图片URL列表"
},
"taskStatus": {
"type": "integer",
"description": "任务状态",
"required": [
"taskStatus"
]
},
"taskType": {
"type": "integer",
"description": "任务类型",
"required": [
"taskType"
]
}
},
"description": "任务"
}
}
}
\ No newline at end of file
... ...
swagger: "2.0"
info:
title: ""
description: 买买买价值系统
contact:
name: linmadan
email: 772181827@qq.com
home: www.madannet.com
version: 0.0.1
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
paths:
/employees:
get:
tags:
- employee
summary: 返回员工列表
description: 返回员工列表
operationId: employee#listEmployee
parameters:
- name: offset
in: query
description: 查询偏离量
required: false
type: integer
- name: limit
in: query
description: 查询限制
required: false
type: integer
responses:
"200":
description: OK response.
schema:
$ref: '#/definitions/EmployeeListEmployeeResponseBody'
schemes:
- http
post:
tags:
- employee
summary: 创建新员工
description: 创建新员工
operationId: employee#createEmployee
parameters:
- name: CreateEmployeeRequestBody
in: body
required: true
schema:
$ref: '#/definitions/EmployeeCreateEmployeeRequestBody'
responses:
"200":
description: OK response.
schema:
$ref: '#/definitions/EmployeeCreateEmployeeResponseBody'
schemes:
- http
/employees/{uid}:
get:
tags:
- employee
summary: 返回员工
description: 返回员工
operationId: employee#getEmployee
parameters:
- name: uid
in: path
description: 统一用户UID
required: true
type: integer
responses:
"200":
description: OK response.
schema:
$ref: '#/definitions/EmployeeGetEmployeeResponseBody'
schemes:
- http
put:
tags:
- employee
summary: 更新员工
description: 更新员工
operationId: employee#updateEmployee
parameters:
- name: uid
in: path
description: 统一用户UID
required: true
type: integer
- name: UpdateEmployeeRequestBody
in: body
required: true
schema:
$ref: '#/definitions/EmployeeUpdateEmployeeRequestBody'
responses:
"200":
description: OK response.
schema:
$ref: '#/definitions/EmployeeUpdateEmployeeResponseBody'
schemes:
- http
delete:
tags:
- employee
summary: 移除员工
description: 移除员工
operationId: employee#removeEmployee
parameters:
- name: uid
in: path
description: 统一用户UID
required: true
type: integer
responses:
"200":
description: OK response.
schema:
$ref: '#/definitions/EmployeeRemoveEmployeeResponseBody'
schemes:
- http
/tasks:
get:
tags:
- task
summary: 返回任务列表
description: 返回任务列表
operationId: task#listTask
parameters:
- name: companyId
in: query
description: 公司ID
required: false
type: integer
- name: sponsor
in: query
description: 任务发起者
required: false
type: integer
format: int64
- name: taskContentMatch
in: query
description: 任务内容匹配
required: false
type: string
- name: taskType
in: query
description: 任务类型
required: false
type: integer
- name: taskStatus
in: query
description: 任务状态
required: false
type: integer
- name: customerValue
in: query
description: 客户价值
required: false
type: string
- name: taskNature
in: query
description: 任务性质
required: false
type: string
- name: isRewardTake
in: query
description: 是否悬赏任务
required: false
type: boolean
- name: bidTimeMatch
in: query
description: 竞标时间(1全部,2已截止,3未截止)
required: false
type: integer
- name: receiver
in: query
description: 任务领取人
required: false
type: integer
format: int64
- name: participator
in: query
description: 任务参与者
required: false
type: integer
format: int64
- name: offset
in: query
description: 查询偏离量
required: false
type: integer
- name: limit
in: query
description: 查询限制
required: false
type: integer
responses:
"200":
description: OK response.
schema:
$ref: '#/definitions/TaskListTaskResponseBody'
schemes:
- http
post:
tags:
- task
summary: 创建新任务
description: 创建新任务
operationId: task#createTask
parameters:
- name: CreateTaskRequestBody
in: body
required: true
schema:
$ref: '#/definitions/TaskCreateTaskRequestBody'
responses:
"200":
description: OK response.
schema:
$ref: '#/definitions/TaskCreateTaskResponseBody'
schemes:
- http
/tasks/{taskId}:
get:
tags:
- task
summary: 返回任务
description: 返回任务
operationId: task#getTask
parameters:
- name: taskId
in: path
description: 任务ID
required: true
type: integer
responses:
"200":
description: OK response.
schema:
$ref: '#/definitions/TaskGetTaskResponseBody'
schemes:
- http
put:
tags:
- task
summary: 更新任务
description: 更新任务
operationId: task#updateTask
parameters:
- name: taskId
in: path
description: 任务ID
required: true
type: integer
- name: UpdateTaskRequestBody
in: body
required: true
schema:
$ref: '#/definitions/TaskUpdateTaskRequestBody'
responses:
"200":
description: OK response.
schema:
$ref: '#/definitions/TaskUpdateTaskResponseBody'
schemes:
- http
delete:
tags:
- task
summary: 移除任务
description: 移除任务
operationId: task#removeTask
parameters:
- name: taskId
in: path
description: 任务ID
required: true
type: integer
responses:
"200":
description: OK response.
schema:
$ref: '#/definitions/TaskRemoveTaskResponseBody'
schemes:
- http
/tasks/{taskId}/acceptance:
post:
tags:
- task
summary: 验收任务
description: 验收任务
operationId: task#acceptanceTask
parameters:
- name: taskId
in: path
description: 任务ID
required: true
type: integer
- name: AcceptanceTaskRequestBody
in: body
required: true
schema:
$ref: '#/definitions/TaskAcceptanceTaskRequestBody'
responses:
"200":
description: OK response.
schema:
$ref: '#/definitions/TaskAcceptanceTaskResponseBody'
schemes:
- http
/tasks/{taskId}/apply-complete:
post:
tags:
- task
summary: 申请完成任务
description: 申请完成任务
operationId: task#applyCompleteTask
parameters:
- name: taskId
in: path
description: 任务ID
required: true
type: integer
- name: ApplyCompleteTaskRequestBody
in: body
required: true
schema:
$ref: '#/definitions/TaskApplyCompleteTaskRequestBody'
responses:
"200":
description: OK response.
schema:
$ref: '#/definitions/TaskApplyCompleteTaskResponseBody'
schemes:
- http
/tasks/{taskId}/bid:
post:
tags:
- task
summary: 对任务进行竞标
description: 对任务进行竞标
operationId: task#bidTask
parameters:
- name: taskId
in: path
description: 任务ID
required: true
type: integer
- name: BidTaskRequestBody
in: body
required: true
schema:
$ref: '#/definitions/TaskBidTaskRequestBody'
responses:
"200":
description: OK response.
schema:
$ref: '#/definitions/TaskBidTaskResponseBody'
schemes:
- http
/tasks/{taskId}/choose-successful-bidder:
post:
tags:
- task
summary: 选择竞标任务的中标人
description: 选择竞标任务的中标人
operationId: task#chooseSuccessfulBidder
parameters:
- name: taskId
in: path
description: 任务ID
required: true
type: integer
- name: ChooseSuccessfulBidderRequestBody
in: body
required: true
schema:
$ref: '#/definitions/TaskChooseSuccessfulBidderRequestBody'
responses:
"200":
description: OK response.
schema:
$ref: '#/definitions/TaskChooseSuccessfulBidderResponseBody'
schemes:
- http
/tasks/{taskId}/dff:
post:
tags:
- task
summary: 关闭任务
description: 关闭任务
operationId: task#offTask
parameters:
- name: taskId
in: path
description: 任务ID
required: true
type: integer
- name: OffTaskRequestBody
in: body
required: true
schema:
$ref: '#/definitions/TaskOffTaskRequestBody'
responses:
"200":
description: OK response.
schema:
$ref: '#/definitions/TaskOffTaskResponseBody'
schemes:
- http
/tasks/{taskId}/release:
post:
tags:
- task
summary: 发布任务
description: 发布任务
operationId: task#releaseTask
parameters:
- name: taskId
in: path
description: 任务ID
required: true
type: integer
- name: ReleaseTaskRequestBody
in: body
required: true
schema:
$ref: '#/definitions/TaskReleaseTaskRequestBody'
responses:
"200":
description: OK response.
schema:
$ref: '#/definitions/TaskReleaseTaskResponseBody'
schemes:
- http
/tasks/{taskId}/rob:
post:
tags:
- task
summary: 对任务进行抢单
description: 对任务进行抢单
operationId: task#robTask
parameters:
- name: taskId
in: path
description: 任务ID
required: true
type: integer
- name: RobTaskRequestBody
in: body
required: true
schema:
$ref: '#/definitions/TaskRobTaskRequestBody'
responses:
"200":
description: OK response.
schema:
$ref: '#/definitions/TaskRobTaskResponseBody'
schemes:
- http
/tasks/search:
post:
tags:
- task
summary: 搜索任务
description: 搜索任务
operationId: task#searchTask
parameters:
- name: SearchTaskRequestBody
in: body
required: true
schema:
$ref: '#/definitions/TaskSearchTaskRequestBody'
responses:
"200":
description: OK response.
schema:
$ref: '#/definitions/TaskSearchTaskResponseBody'
schemes:
- http
definitions:
EmployeeCreateEmployeeRequestBody:
title: EmployeeCreateEmployeeRequestBody
type: object
properties:
employeeAccount:
type: string
description: 员工账号
employeeName:
type: string
description: 员工姓名
uid:
type: integer
description: 统一用户UID
required:
- uid
EmployeeCreateEmployeeResponseBody:
title: 'Mediatype identifier: EmployeeCreateEmployeeResponseBody'
type: object
properties:
employee:
$ref: '#/definitions/employeeResponseBody'
EmployeeGetEmployeeResponseBody:
title: 'Mediatype identifier: EmployeeGetEmployeeResponseBody'
type: object
properties:
employee:
$ref: '#/definitions/employeeResponseBody'
EmployeeListEmployeeResponseBody:
title: 'Mediatype identifier: EmployeeListEmployeeResponseBody'
type: object
properties:
count:
type: integer
description: 结果总数
format: int64
employees:
type: array
items:
$ref: '#/definitions/employeeResponseBody'
EmployeeRemoveEmployeeResponseBody:
title: 'Mediatype identifier: EmployeeRemoveEmployeeResponseBody'
type: object
properties:
employee:
$ref: '#/definitions/employeeResponseBody'
EmployeeUpdateEmployeeRequestBody:
title: EmployeeUpdateEmployeeRequestBody
type: object
properties:
employeeAccount:
type: string
description: 员工账号
employeeName:
type: string
description: 员工姓名
EmployeeUpdateEmployeeResponseBody:
title: 'Mediatype identifier: EmployeeUpdateEmployeeResponseBody'
type: object
properties:
employee:
$ref: '#/definitions/employeeResponseBody'
TaskAcceptanceTaskRequestBody:
title: TaskAcceptanceTaskRequestBody
type: object
properties:
operator:
type: integer
description: 操作人uid
required:
- operator
participators:
type: array
items:
type: integer
format: int64
description: 任务参与者UID列表
solvePictureUrls:
type: array
items:
type: string
description: 解决图片URL列表
solveReport:
type: string
description: 解决报告
taskPercentage:
type: array
items:
$ref: '#/definitions/taskPercentageItemRequestBody'
description: 任务贡献占比
required:
- taskPercentage
TaskAcceptanceTaskResponseBody:
title: 'Mediatype identifier: TaskAcceptanceTaskResponseBody'
type: object
properties:
task:
$ref: '#/definitions/taskResponseBody'
TaskApplyCompleteTaskRequestBody:
title: TaskApplyCompleteTaskRequestBody
type: object
properties:
receiver:
type: integer
description: 领取人或者中标人uid
required:
- receiver
TaskApplyCompleteTaskResponseBody:
title: 'Mediatype identifier: TaskApplyCompleteTaskResponseBody'
type: object
properties:
task:
$ref: '#/definitions/taskResponseBody'
TaskBidTaskRequestBody:
title: TaskBidTaskRequestBody
type: object
properties:
bidder:
type: integer
description: 竞标人uid
required:
- bidder
TaskBidTaskResponseBody:
title: 'Mediatype identifier: TaskBidTaskResponseBody'
type: object
properties:
task:
$ref: '#/definitions/taskResponseBody'
TaskChooseSuccessfulBidderRequestBody:
title: TaskChooseSuccessfulBidderRequestBody
type: object
properties:
operator:
type: integer
description: 操作人uid
required:
- operator
successfulBidder:
type: integer
description: 中标者uid
required:
- successfulBidder
TaskChooseSuccessfulBidderResponseBody:
title: 'Mediatype identifier: TaskChooseSuccessfulBidderResponseBody'
type: object
properties:
task:
$ref: '#/definitions/taskResponseBody'
TaskCreateTaskRequestBody:
title: TaskCreateTaskRequestBody
type: object
properties:
acceptanceStandard:
type: string
description: 验收标准
required:
- acceptanceStandard
bidEndTime:
type: string
description: 竞标结束时间
format: datetime
bidStartTime:
type: string
description: 竞标开始时间
format: datetime
customerValue:
type: array
items:
type: string
description: 客户价值列表
required:
- customerValue
isRewardTake:
type: boolean
description: 是否悬赏任务
referenceResource:
$ref: '#/definitions/referenceResourceRequestBody'
sponsor:
type: integer
description: 任务发起者uid
required:
- sponsor
suMoney:
type: number
description: 奖励素币
format: double
taskDescription:
type: string
description: 任务描述
required:
- taskDescription
taskName:
type: string
description: 任务名称
required:
- taskName
taskNature:
type: string
description: 任务性质
required:
- taskNature
taskPictureUrls:
type: array
items:
type: string
description: 任务图片URL列表
taskType:
type: integer
description: 任务类型
required:
- taskType
TaskCreateTaskResponseBody:
title: 'Mediatype identifier: TaskCreateTaskResponseBody'
type: object
properties:
task:
$ref: '#/definitions/taskResponseBody'
TaskGetTaskResponseBody:
title: 'Mediatype identifier: TaskGetTaskResponseBody'
type: object
properties:
task:
$ref: '#/definitions/taskResponseBody'
TaskListTaskResponseBody:
title: 'Mediatype identifier: TaskListTaskResponseBody'
type: object
properties:
count:
type: integer
description: 结果总数
format: int64
tasks:
type: array
items:
$ref: '#/definitions/taskResponseBody'
TaskOffTaskRequestBody:
title: TaskOffTaskRequestBody
type: object
properties:
offReason:
type: string
description: 关闭理由
required:
- offReason
operator:
type: integer
description: 操作人uid
required:
- operator
TaskOffTaskResponseBody:
title: 'Mediatype identifier: TaskOffTaskResponseBody'
type: object
properties:
task:
$ref: '#/definitions/taskResponseBody'
TaskReleaseTaskRequestBody:
title: TaskReleaseTaskRequestBody
type: object
properties:
operator:
type: integer
description: 操作人uid
required:
- operator
TaskReleaseTaskResponseBody:
title: 'Mediatype identifier: TaskReleaseTaskResponseBody'
type: object
properties:
task:
$ref: '#/definitions/taskResponseBody'
TaskRemoveTaskResponseBody:
title: 'Mediatype identifier: TaskRemoveTaskResponseBody'
type: object
properties:
task:
$ref: '#/definitions/taskResponseBody'
TaskRobTaskRequestBody:
title: TaskRobTaskRequestBody
type: object
properties:
receiver:
type: integer
description: 领取人uid
required:
- receiver
TaskRobTaskResponseBody:
title: 'Mediatype identifier: TaskRobTaskResponseBody'
type: object
properties:
task:
$ref: '#/definitions/taskResponseBody'
TaskSearchTaskRequestBody:
title: TaskSearchTaskRequestBody
type: object
properties:
bidTimeMatch:
type: integer
description: 竞标时间(1全部,2已截止,3未截止)
format: int64
companyId:
type: integer
description: 公司ID
required:
- companyId
customerValue:
type: string
description: 客户价值
isRewardTake:
type: boolean
description: 是否悬赏任务
limit:
type: integer
description: 查询限制
format: int64
offset:
type: integer
description: 查询偏离量
format: int64
participator:
type: integer
description: 任务参与者
format: int64
receiver:
type: integer
description: 任务领取人
format: int64
sponsor:
type: integer
description: 任务发起者
format: int64
taskContentMatch:
type: string
description: 任务内容匹配
taskNature:
type: string
description: 任务性质
taskStatus:
type: integer
description: 任务状态
format: int64
taskType:
type: integer
description: 任务类型
format: int64
TaskSearchTaskResponseBody:
title: 'Mediatype identifier: TaskSearchTaskResponseBody'
type: object
properties:
count:
type: integer
description: 结果总数
format: int64
tasks:
type: array
items:
$ref: '#/definitions/taskResponseBody'
TaskUpdateTaskRequestBody:
title: TaskUpdateTaskRequestBody
type: object
properties:
acceptanceStandard:
type: string
description: 验收标准
bidEndTime:
type: string
description: 竞标结束时间
format: datetime
bidStartTime:
type: string
description: 竞标开始时间
format: datetime
customerValue:
type: array
items:
type: string
description: 客户价值列表
isRewardTake:
type: boolean
description: 是否悬赏任务
referenceResource:
$ref: '#/definitions/referenceResourceRequestBody'
suMoney:
type: number
description: 奖励素币
format: double
taskDescription:
type: string
description: 任务描述
taskName:
type: string
description: 任务名称
taskNature:
type: string
description: 任务性质
taskPictureUrls:
type: array
items:
type: string
description: 任务图片URL列表
TaskUpdateTaskResponseBody:
title: 'Mediatype identifier: TaskUpdateTaskResponseBody'
type: object
properties:
task:
$ref: '#/definitions/taskResponseBody'
bidInfoResponseBody:
title: bidInfoResponseBody
type: object
properties:
bidEndTime:
type: string
description: 竞标结束时间
required:
- bidEndTime
bidStartTime:
type: string
description: 竞标开始时间
required:
- bidStartTime
bidderInfos:
type: array
items:
$ref: '#/definitions/bidderInfoResponseBody'
description: 竞标人员列表
successfulBidder:
$ref: '#/definitions/employeeInfoResponseBody'
winBidTime:
type: string
description: 中标时间
required:
- winBidTime
description: 竞标任务信息
bidderInfoResponseBody:
title: bidderInfoResponseBody
type: object
properties:
bidTime:
type: string
description: 竞标时间
required:
- bidTime
bidder:
$ref: '#/definitions/employeeInfoResponseBody'
description: 竞标人员信息
employeeInfoRequestBody:
title: employeeInfoRequestBody
type: object
properties:
employeeAccount:
type: string
description: 员工账号
employeeName:
type: string
description: 员工姓名
required:
- employeeName
uid:
type: integer
description: 统一用户UID
required:
- uid
description: 员工信息
employeeInfoResponseBody:
title: employeeInfoResponseBody
type: object
properties:
employeeAccount:
type: string
description: 员工账号
employeeName:
type: string
description: 员工姓名
required:
- employeeName
uid:
type: integer
description: 统一用户UID
required:
- uid
description: 员工信息
employeeResponseBody:
title: employeeResponseBody
type: object
properties:
companyId:
type: integer
description: 公司ID
required:
- companyId
employeeId:
type: integer
description: 员工ID
required:
- employeeId
employeeInfo:
$ref: '#/definitions/employeeInfoResponseBody'
status:
type: integer
description: 员工状态(启用或者禁用)
format: int64
suMoney:
type: number
description: 当前素币
required:
- suMoney
description: 员工
referenceResourceItemRequestBody:
title: referenceResourceItemRequestBody
type: object
properties:
serialNumber:
type: integer
description: 编号
required:
- serialNumber
title:
type: string
description: 标题
required:
- title
description: 引用资源项
referenceResourceItemResponseBody:
title: referenceResourceItemResponseBody
type: object
properties:
serialNumber:
type: integer
description: 编号
required:
- serialNumber
title:
type: string
description: 标题
required:
- title
description: 引用资源项
referenceResourceRequestBody:
title: referenceResourceRequestBody
type: object
properties:
referenceResourceItems:
type: array
items:
$ref: '#/definitions/referenceResourceItemRequestBody'
description: 引用资源项列表
required:
- referenceResourceItems
referenceResourceType:
type: integer
description: 引用类型
required:
- referenceResourceType
description: 引用资源
referenceResourceResponseBody:
title: referenceResourceResponseBody
type: object
properties:
referenceResourceItems:
type: array
items:
$ref: '#/definitions/referenceResourceItemResponseBody'
description: 引用资源项列表
required:
- referenceResourceItems
referenceResourceType:
type: integer
description: 引用类型
required:
- referenceResourceType
description: 引用资源
robInfoResponseBody:
title: robInfoResponseBody
type: object
properties:
receiveTime:
type: string
description: 领取时间
required:
- receiveTime
receiver:
$ref: '#/definitions/employeeInfoResponseBody'
description: 抢单任务信息
taskPercentageItemRequestBody:
title: taskPercentageItemRequestBody
type: object
properties:
contributor:
$ref: '#/definitions/employeeInfoRequestBody'
percentage:
type: integer
description: 任务贡献占比
required:
- percentage
description: 任务贡献占比项
taskPercentageItemResponseBody:
title: taskPercentageItemResponseBody
type: object
properties:
contributor:
$ref: '#/definitions/employeeInfoResponseBody'
percentage:
type: integer
description: 任务贡献占比
required:
- percentage
description: 任务贡献占比项
taskResponseBody:
title: taskResponseBody
type: object
properties:
acceptanceStandard:
type: string
description: 验收标准
required:
- acceptanceStandard
bidInfo:
$ref: '#/definitions/bidInfoResponseBody'
companyId:
type: integer
description: 公司ID
required:
- companyId
createTime:
type: string
description: 创建时间
required:
- createTime
customerValue:
type: array
items:
type: string
description: 客户价值列表
required:
- customerValue
isRewardTake:
type: boolean
description: 是否悬赏任务
participators:
type: array
items:
$ref: '#/definitions/employeeInfoResponseBody'
description: 任务参与者列表
referenceResource:
$ref: '#/definitions/referenceResourceResponseBody'
releaseTime:
type: string
description: 发布时间
format: datetime
robInfo:
$ref: '#/definitions/robInfoResponseBody'
solvePictureUrls:
type: array
items:
type: string
description: 解决图片URL列表
solveReport:
type: string
description: 解决报告
sponsor:
$ref: '#/definitions/employeeInfoResponseBody'
suMoney:
type: number
description: 奖励素币
required:
- suMoney
taskDescription:
type: string
description: 任务描述
required:
- taskDescription
taskId:
type: integer
description: 任务ID
required:
- taskId
taskName:
type: string
description: 任务名称
required:
- taskName
taskNature:
type: string
description: 任务性质
required:
- taskNature
taskPercentage:
type: array
items:
$ref: '#/definitions/taskPercentageItemResponseBody'
description: 任务贡献占比
taskPictureUrls:
type: array
items:
type: string
description: 任务图片URL列表
taskStatus:
type: integer
description: 任务状态
required:
- taskStatus
taskType:
type: integer
description: 任务类型
required:
- taskType
description: 任务
... ...
package main
import "fmt"
import (
"github.com/astaxie/beego"
_ "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/pg"
_ "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/port/beego"
)
func main() {
fmt.Print("")
beego.Run()
}
... ...
... ... @@ -45,3 +45,11 @@ func CreateChooseSuccessfulBidderService(options map[string]interface{}) (servic
}
return domainService.NewChooseSuccessfulBidderService(transactionContext)
}
func CreateApplyCompleteTaskService(options map[string]interface{}) (service.ApplyCompleteTaskService, error) {
var transactionContext *pgTransaction.TransactionContext
if value, ok := options["transactionContext"]; ok {
transactionContext = value.(*pgTransaction.TransactionContext)
}
return domainService.NewApplyCompleteTaskService(transactionContext)
}
... ...
... ... @@ -130,10 +130,22 @@ func (taskService *TaskService) ApplyCompleteTask(applyCompleteTaskCommand *comm
defer func() {
transactionContext.RollbackTransaction()
}()
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
var applyCompleteTaskService service.ApplyCompleteTaskService
if value, err := factory.CreateApplyCompleteTaskService(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
applyCompleteTaskService = value
}
if task, err := applyCompleteTaskService.ApplyComplete(applyCompleteTaskCommand.TaskId, applyCompleteTaskCommand.Receiver); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return task, nil
}
return nil, nil
}
// 发布任务
... ...
package service
import "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
type ApplyCompleteTaskService interface {
ApplyComplete(taskId int64, receiverUid int64) (*domain.Task, error)
}
... ...
... ... @@ -3,5 +3,5 @@ package service
import "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
type RobTaskService interface {
Rob(taskId int64, bidderUid int64) (*domain.Task, error)
Rob(taskId int64, receiverUid int64) (*domain.Task, error)
}
... ...
package domain_service
import (
"fmt"
coreDomain "github.com/linmadan/egglib-go/core/domain"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/repository"
)
type ApplyCompleteTaskService struct {
coreDomain.BaseEventPublisher
transactionContext *pgTransaction.TransactionContext
}
func (service *ApplyCompleteTaskService) ApplyComplete(taskId int64, receiverUid int64) (*domain.Task, error) {
var employeeRepository domain.EmployeeRepository
var taskRepository domain.TaskRepository
if repository, err := repository.NewEmployeeRepository(service.transactionContext); err != nil {
return nil, err
} else {
employeeRepository = repository
}
if repository, err := repository.NewTaskRepository(service.transactionContext); err != nil {
return nil, err
} else {
taskRepository = repository
}
receiver, err := employeeRepository.FindOne(map[string]interface{}{
"uid": receiverUid,
})
if err != nil {
return nil, err
}
if receiver == nil {
return nil, fmt.Errorf("无效的领取人")
}
task, err := taskRepository.FindOne(map[string]interface{}{
"taskId": taskId,
})
if err != nil {
return nil, err
}
if task == nil {
return nil, fmt.Errorf("无效的任务")
}
if task.TaskType == domain.TASK_TYPE_ROB {
if receiver.EmployeeInfo.Uid != task.RobInfo.Receiver.Uid {
return nil, fmt.Errorf("无法申请完成别人领取的任务")
}
}
if task.TaskType == domain.TASK_TYPE_BID {
if receiver.EmployeeInfo.Uid != task.BidInfo.SuccessfulBidder.Uid {
return nil, fmt.Errorf("无法申请完成别人领取的任务")
}
}
if err := task.ApplyComplete(); err != nil {
return nil, err
}
if task, err := taskRepository.Save(task); err != nil {
return nil, err
} else {
return task, nil
}
}
func NewApplyCompleteTaskService(transactionContext *pgTransaction.TransactionContext) (*ApplyCompleteTaskService, error) {
if transactionContext == nil {
return nil, fmt.Errorf("transactionContext参数不能为nil")
} else {
return &ApplyCompleteTaskService{
transactionContext: transactionContext,
}, nil
}
}
... ...
package task
import (
"github.com/go-pg/pg"
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
"net/http"
"time"
"github.com/gavv/httpexpect"
"github.com/go-pg/pg"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/pg"
)
var _ = Describe("申请完成任务", func() {
var taskId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&taskId),
"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",
"testTaskId", "testCompanyId", "testTaskName", "testTaskType", "testSponsor", "testTaskStatus", "testReferenceResource", "testCustomerValue", "testTaskNature", "testSuMoney", "testAcceptanceStandard", "testTaskDescription", "testTaskPictureUrls", "testIsRewardTake", "testRobInfo", "testBidInfo", "testParticipators", "testTaskPercentage", "testSolveReport", "testSolvePictureUrls", "testCreateTime", "testReleaseTime")
Expect(err).NotTo(HaveOccurred())
})
Describe("申请完成任务", func() {
Context("", func() {
It("", func() {
Context("领取人对进行中的任务进行抢单", func() {
BeforeEach(func() {
dayAfter, _ := time.ParseDuration("72h")
_, err := pG.DB.QueryOne(
pg.Scan(),
"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 (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
1, 101, "抢单任务1", 1, &domain.EmployeeInfo{
Uid: 2499036607974745088,
}, 3, "null", pg.Array([]string{"口感", "便利", "品牌", "售后服务"}), "面", 1000.00, "验收标准1", "任务描述1", pg.Array([]string{}), true, []*domain.EmployeeInfo{
{
Uid: 2499036607974745077,
},
{
Uid: 2499036607974745066,
},
}, "null", "", pg.Array([]string{}), 2499036607974745099, time.Now(), time.Now().Add(dayAfter))
Expect(err).NotTo(HaveOccurred())
_, err1 := pG.DB.QueryOne(
pg.Scan(),
"INSERT INTO employees (id, company_id, uid, employee_name, employee_account, su_money) VALUES (?, ?, ?, ?, ?, ?)",
1, 101, 2499036607974745088, "testEmployeeName", "testEmployeeAccount", 0)
Expect(err1).NotTo(HaveOccurred())
_, err2 := pG.DB.QueryOne(
pg.Scan(),
"INSERT INTO employees (id, company_id, uid, employee_name, employee_account, su_money) VALUES (?, ?, ?, ?, ?, ?)",
2, 101, 2499036607974745099, "testEmployeeName", "testEmployeeAccount", 0)
Expect(err2).NotTo(HaveOccurred())
_, err3 := pG.DB.QueryOne(
pg.Scan(),
"INSERT INTO rob_infos (id, task_id ,receiver) VALUES (?, ?, ?)",
1, 1, &domain.EmployeeInfo{
Uid: 2499036607974745099,
})
Expect(err3).NotTo(HaveOccurred())
})
It("申请完成成功", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"receiver": "int64",
"receiver": 2499036607974745099,
}
httpExpect.POST("/tasks/{taskId}/apply-complete").
httpExpect.POST("/tasks/1/apply-complete").
WithJSON(body).
Expect().
Status(http.StatusOK).
... ... @@ -34,12 +62,21 @@ var _ = Describe("申请完成任务", func() {
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
ContainsKey("data").Value("data").Object().
ContainsKey("taskStatus").ValueEqual("taskStatus", 4)
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM tasks WHERE true")
Expect(err).NotTo(HaveOccurred())
_, err1 := pG.DB.Exec("DELETE FROM bid_infos WHERE true")
Expect(err1).NotTo(HaveOccurred())
_, err2 := pG.DB.Exec("DELETE FROM bidder_infos WHERE true")
Expect(err2).NotTo(HaveOccurred())
_, err3 := pG.DB.Exec("DELETE FROM employees WHERE true")
Expect(err3).NotTo(HaveOccurred())
_, err4 := pG.DB.Exec("DELETE FROM rob_infos WHERE true")
Expect(err4).NotTo(HaveOccurred())
})
})
... ...