作者 linmadan

重构搜索功能,添加员工权限

@@ -304,6 +304,160 @@ @@ -304,6 +304,160 @@
304 ] 304 ]
305 } 305 }
306 }, 306 },
  307 + "/off-task-records/{offTaskRecordId}": {
  308 + "get": {
  309 + "tags": [
  310 + "offTaskRecord"
  311 + ],
  312 + "summary": "返回关闭任务记录",
  313 + "description": "返回关闭任务记录",
  314 + "operationId": "offTaskRecord#getOffTaskRecord",
  315 + "parameters": [
  316 + {
  317 + "name": "offTaskRecordId",
  318 + "in": "path",
  319 + "description": "关闭任务记录ID",
  320 + "required": true,
  321 + "type": "integer"
  322 + }
  323 + ],
  324 + "responses": {
  325 + "200": {
  326 + "description": "OK response.",
  327 + "schema": {
  328 + "$ref": "#/definitions/OffTaskRecordGetOffTaskRecordResponseBody"
  329 + }
  330 + }
  331 + },
  332 + "schemes": [
  333 + "http"
  334 + ]
  335 + }
  336 + },
  337 + "/off-task-records/search-off-task-record": {
  338 + "post": {
  339 + "tags": [
  340 + "offTaskRecord"
  341 + ],
  342 + "summary": "搜索关闭任务记录",
  343 + "description": "搜索关闭任务记录",
  344 + "operationId": "offTaskRecord#searchOffTaskRecord",
  345 + "parameters": [
  346 + {
  347 + "name": "SearchOffTaskRecordRequestBody",
  348 + "in": "body",
  349 + "required": true,
  350 + "schema": {
  351 + "$ref": "#/definitions/OffTaskRecordSearchOffTaskRecordRequestBody"
  352 + }
  353 + }
  354 + ],
  355 + "responses": {
  356 + "200": {
  357 + "description": "OK response.",
  358 + "schema": {
  359 + "$ref": "#/definitions/OffTaskRecordSearchOffTaskRecordResponseBody"
  360 + }
  361 + }
  362 + },
  363 + "schemes": [
  364 + "http"
  365 + ]
  366 + }
  367 + },
  368 + "/statistics/person-su-money": {
  369 + "post": {
  370 + "tags": [
  371 + "statistics"
  372 + ],
  373 + "summary": "获取个人素币统计",
  374 + "description": "获取个人素币统计",
  375 + "operationId": "statistics#personSuMoneyStatistics",
  376 + "parameters": [
  377 + {
  378 + "name": "PersonSuMoneyStatisticsRequestBody",
  379 + "in": "body",
  380 + "required": true,
  381 + "schema": {
  382 + "$ref": "#/definitions/StatisticsPersonSuMoneyStatisticsRequestBody"
  383 + }
  384 + }
  385 + ],
  386 + "responses": {
  387 + "200": {
  388 + "description": "OK response.",
  389 + "schema": {
  390 + "$ref": "#/definitions/StatisticsPersonSuMoneyStatisticsResponseBody"
  391 + }
  392 + }
  393 + },
  394 + "schemes": [
  395 + "http"
  396 + ]
  397 + }
  398 + },
  399 + "/statistics/person-task": {
  400 + "post": {
  401 + "tags": [
  402 + "statistics"
  403 + ],
  404 + "summary": "获取个人任务统计",
  405 + "description": "获取个人任务统计",
  406 + "operationId": "statistics#personTaskStatistics",
  407 + "parameters": [
  408 + {
  409 + "name": "PersonTaskStatisticsRequestBody",
  410 + "in": "body",
  411 + "required": true,
  412 + "schema": {
  413 + "$ref": "#/definitions/StatisticsPersonTaskStatisticsRequestBody"
  414 + }
  415 + }
  416 + ],
  417 + "responses": {
  418 + "200": {
  419 + "description": "OK response.",
  420 + "schema": {
  421 + "$ref": "#/definitions/StatisticsPersonTaskStatisticsResponseBody"
  422 + }
  423 + }
  424 + },
  425 + "schemes": [
  426 + "http"
  427 + ]
  428 + }
  429 + },
  430 + "/statistics/system-task": {
  431 + "post": {
  432 + "tags": [
  433 + "statistics"
  434 + ],
  435 + "summary": "获取系统任务统计",
  436 + "description": "获取系统任务统计",
  437 + "operationId": "statistics#systemTaskStatistics",
  438 + "parameters": [
  439 + {
  440 + "name": "SystemTaskStatisticsRequestBody",
  441 + "in": "body",
  442 + "required": true,
  443 + "schema": {
  444 + "$ref": "#/definitions/StatisticsSystemTaskStatisticsRequestBody"
  445 + }
  446 + }
  447 + ],
  448 + "responses": {
  449 + "200": {
  450 + "description": "OK response.",
  451 + "schema": {
  452 + "$ref": "#/definitions/StatisticsSystemTaskStatisticsResponseBody"
  453 + }
  454 + }
  455 + },
  456 + "schemes": [
  457 + "http"
  458 + ]
  459 + }
  460 + },
307 "/su-money/exchange": { 461 "/su-money/exchange": {
308 "post": { 462 "post": {
309 "tags": [ 463 "tags": [
@@ -385,7 +539,7 @@ @@ -385,7 +539,7 @@
385 { 539 {
386 "name": "sponsor", 540 "name": "sponsor",
387 "in": "query", 541 "in": "query",
388 - "description": "任务发起者", 542 + "description": "任务发起者UID",
389 "required": false, 543 "required": false,
390 "type": "integer", 544 "type": "integer",
391 "format": "int64" 545 "format": "int64"
@@ -442,7 +596,7 @@ @@ -442,7 +596,7 @@
442 { 596 {
443 "name": "receiver", 597 "name": "receiver",
444 "in": "query", 598 "in": "query",
445 - "description": "任务领取人", 599 + "description": "任务领取人UID",
446 "required": false, 600 "required": false,
447 "type": "integer", 601 "type": "integer",
448 "format": "int64" 602 "format": "int64"
@@ -450,7 +604,7 @@ @@ -450,7 +604,7 @@
450 { 604 {
451 "name": "participator", 605 "name": "participator",
452 "in": "query", 606 "in": "query",
453 - "description": "任务参与者", 607 + "description": "任务参与者UID",
454 "required": false, 608 "required": false,
455 "type": "integer", 609 "type": "integer",
456 "format": "int64" 610 "format": "int64"
@@ -1096,6 +1250,148 @@ @@ -1096,6 +1250,148 @@
1096 } 1250 }
1097 } 1251 }
1098 }, 1252 },
  1253 + "OffTaskRecordGetOffTaskRecordResponseBody": {
  1254 + "title": "Mediatype identifier: OffTaskRecordGetOffTaskRecordResponseBody",
  1255 + "type": "object",
  1256 + "properties": {
  1257 + "offTaskRecord": {
  1258 + "$ref": "#/definitions/offTaskRecordResponseBody"
  1259 + }
  1260 + }
  1261 + },
  1262 + "OffTaskRecordSearchOffTaskRecordRequestBody": {
  1263 + "title": "OffTaskRecordSearchOffTaskRecordRequestBody",
  1264 + "type": "object",
  1265 + "properties": {
  1266 + "companyId": {
  1267 + "type": "integer",
  1268 + "description": "公司ID",
  1269 + "required": [
  1270 + "companyId"
  1271 + ]
  1272 + },
  1273 + "customerValue": {
  1274 + "type": "string",
  1275 + "description": "客户价值"
  1276 + },
  1277 + "limit": {
  1278 + "type": "integer",
  1279 + "description": "查询限制",
  1280 + "format": "int64"
  1281 + },
  1282 + "offEndTime": {
  1283 + "type": "string",
  1284 + "description": "关闭任务时间区间-截止时间",
  1285 + "format": "datetime"
  1286 + },
  1287 + "offStartTime": {
  1288 + "type": "string",
  1289 + "description": "关闭任务时间区间-开始时间",
  1290 + "format": "datetime"
  1291 + },
  1292 + "offset": {
  1293 + "type": "integer",
  1294 + "description": "查询偏离量",
  1295 + "format": "int64"
  1296 + },
  1297 + "taskContentMatch": {
  1298 + "type": "string",
  1299 + "description": "任务内容匹配"
  1300 + },
  1301 + "taskNature": {
  1302 + "type": "string",
  1303 + "description": "任务性质"
  1304 + },
  1305 + "taskType": {
  1306 + "type": "integer",
  1307 + "description": "任务类型",
  1308 + "format": "int64"
  1309 + }
  1310 + }
  1311 + },
  1312 + "OffTaskRecordSearchOffTaskRecordResponseBody": {
  1313 + "title": "Mediatype identifier: OffTaskRecordSearchOffTaskRecordResponseBody",
  1314 + "type": "object",
  1315 + "properties": {
  1316 + "count": {
  1317 + "type": "integer",
  1318 + "description": "结果总数",
  1319 + "format": "int64"
  1320 + },
  1321 + "offTaskRecords": {
  1322 + "type": "array",
  1323 + "items": {
  1324 + "$ref": "#/definitions/offTaskRecordResponseBody"
  1325 + }
  1326 + }
  1327 + }
  1328 + },
  1329 + "StatisticsPersonSuMoneyStatisticsRequestBody": {
  1330 + "title": "StatisticsPersonSuMoneyStatisticsRequestBody",
  1331 + "type": "object",
  1332 + "properties": {
  1333 + "uid": {
  1334 + "type": "integer",
  1335 + "description": "统一用户UID",
  1336 + "required": [
  1337 + "uid"
  1338 + ]
  1339 + }
  1340 + }
  1341 + },
  1342 + "StatisticsPersonSuMoneyStatisticsResponseBody": {
  1343 + "title": "Mediatype identifier: StatisticsPersonSuMoneyStatisticsResponseBody",
  1344 + "type": "object",
  1345 + "properties": {
  1346 + "personSuMoneyStatistics": {
  1347 + "$ref": "#/definitions/personSuMoneyStatisticsResponseBody"
  1348 + }
  1349 + }
  1350 + },
  1351 + "StatisticsPersonTaskStatisticsRequestBody": {
  1352 + "title": "StatisticsPersonTaskStatisticsRequestBody",
  1353 + "type": "object",
  1354 + "properties": {
  1355 + "uid": {
  1356 + "type": "integer",
  1357 + "description": "统一用户UID",
  1358 + "required": [
  1359 + "uid"
  1360 + ]
  1361 + }
  1362 + }
  1363 + },
  1364 + "StatisticsPersonTaskStatisticsResponseBody": {
  1365 + "title": "Mediatype identifier: StatisticsPersonTaskStatisticsResponseBody",
  1366 + "type": "object",
  1367 + "properties": {
  1368 + "personTaskStatistics": {
  1369 + "$ref": "#/definitions/personTaskStatisticsResponseBody"
  1370 + }
  1371 + }
  1372 + },
  1373 + "StatisticsSystemTaskStatisticsRequestBody": {
  1374 + "title": "StatisticsSystemTaskStatisticsRequestBody",
  1375 + "type": "object",
  1376 + "properties": {
  1377 + "companyId": {
  1378 + "type": "integer",
  1379 + "description": "公司ID",
  1380 + "required": [
  1381 + "companyId"
  1382 + ]
  1383 + }
  1384 + }
  1385 + },
  1386 + "StatisticsSystemTaskStatisticsResponseBody": {
  1387 + "title": "Mediatype identifier: StatisticsSystemTaskStatisticsResponseBody",
  1388 + "type": "object",
  1389 + "properties": {
  1390 + "systemTaskStatistics": {
  1391 + "$ref": "#/definitions/systemTaskStatisticsResponseBody"
  1392 + }
  1393 + }
  1394 + },
1099 "SuMoneyExchangeSuMoneyRequestBody": { 1395 "SuMoneyExchangeSuMoneyRequestBody": {
1100 "title": "SuMoneyExchangeSuMoneyRequestBody", 1396 "title": "SuMoneyExchangeSuMoneyRequestBody",
1101 "type": "object", 1397 "type": "object",
@@ -1109,7 +1405,7 @@ @@ -1109,7 +1405,7 @@
1109 }, 1405 },
1110 "operator": { 1406 "operator": {
1111 "type": "integer", 1407 "type": "integer",
1112 - "description": "操作人UID(默认为系统操作)", 1408 + "description": "操作人UID",
1113 "format": "int64" 1409 "format": "int64"
1114 }, 1410 },
1115 "suMoney": { 1411 "suMoney": {
@@ -1151,6 +1447,11 @@ @@ -1151,6 +1447,11 @@
1151 "description": "查询偏离量", 1447 "description": "查询偏离量",
1152 "format": "int64" 1448 "format": "int64"
1153 }, 1449 },
  1450 + "operator": {
  1451 + "type": "integer",
  1452 + "description": "操作人UID",
  1453 + "format": "int64"
  1454 + },
1154 "recordType": { 1455 "recordType": {
1155 "type": "integer", 1456 "type": "integer",
1156 "description": "记录类型(1兑换,2任务奖励)", 1457 "description": "记录类型(1兑换,2任务奖励)",
@@ -1158,6 +1459,16 @@ @@ -1158,6 +1459,16 @@
1158 "recordType" 1459 "recordType"
1159 ] 1460 ]
1160 }, 1461 },
  1462 + "transactionEndTime": {
  1463 + "type": "string",
  1464 + "description": "事务时间区间-截止时间",
  1465 + "format": "datetime"
  1466 + },
  1467 + "transactionStartTime": {
  1468 + "type": "string",
  1469 + "description": "事务时间区间-开始时间",
  1470 + "format": "datetime"
  1471 + },
1161 "uid": { 1472 "uid": {
1162 "type": "integer", 1473 "type": "integer",
1163 "description": "统一用户UID", 1474 "description": "统一用户UID",
@@ -1588,6 +1899,11 @@ @@ -1588,6 +1899,11 @@
1588 "description": "竞标时间(1全部,2已截止,3未截止)", 1899 "description": "竞标时间(1全部,2已截止,3未截止)",
1589 "format": "int64" 1900 "format": "int64"
1590 }, 1901 },
  1902 + "bidder": {
  1903 + "type": "integer",
  1904 + "description": "竞标参与者UID",
  1905 + "format": "int64"
  1906 + },
1591 "companyId": { 1907 "companyId": {
1592 "type": "integer", 1908 "type": "integer",
1593 "description": "公司ID", 1909 "description": "公司ID",
@@ -1599,6 +1915,10 @@ @@ -1599,6 +1915,10 @@
1599 "type": "string", 1915 "type": "string",
1600 "description": "客户价值" 1916 "description": "客户价值"
1601 }, 1917 },
  1918 + "isFilterCloseStatus": {
  1919 + "type": "boolean",
  1920 + "description": "是否过滤关闭状态任务"
  1921 + },
1602 "isRewardTake": { 1922 "isRewardTake": {
1603 "type": "boolean", 1923 "type": "boolean",
1604 "description": "是否悬赏任务" 1924 "description": "是否悬赏任务"
@@ -1615,17 +1935,17 @@ @@ -1615,17 +1935,17 @@
1615 }, 1935 },
1616 "participator": { 1936 "participator": {
1617 "type": "integer", 1937 "type": "integer",
1618 - "description": "任务参与者", 1938 + "description": "任务参与者UID",
1619 "format": "int64" 1939 "format": "int64"
1620 }, 1940 },
1621 "receiver": { 1941 "receiver": {
1622 "type": "integer", 1942 "type": "integer",
1623 - "description": "任务领取人", 1943 + "description": "任务领取人UID",
1624 "format": "int64" 1944 "format": "int64"
1625 }, 1945 },
1626 "sponsor": { 1946 "sponsor": {
1627 "type": "integer", 1947 "type": "integer",
1628 - "description": "任务发起者", 1948 + "description": "任务发起者UID",
1629 "format": "int64" 1949 "format": "int64"
1630 }, 1950 },
1631 "taskContentMatch": { 1951 "taskContentMatch": {
@@ -1928,6 +2248,104 @@ @@ -1928,6 +2248,104 @@
1928 }, 2248 },
1929 "description": "关闭任务记录" 2249 "description": "关闭任务记录"
1930 }, 2250 },
  2251 + "personSuMoneyStatisticsResponseBody": {
  2252 + "title": "personSuMoneyStatisticsResponseBody",
  2253 + "type": "object",
  2254 + "properties": {
  2255 + "currentSuMoney": {
  2256 + "type": "number",
  2257 + "description": "当前素币",
  2258 + "required": [
  2259 + "currentSuMoney"
  2260 + ]
  2261 + },
  2262 + "incomeSuMoneyOfYesterday": {
  2263 + "type": "number",
  2264 + "description": "昨日收益",
  2265 + "required": [
  2266 + "incomeSuMoneyOfYesterday"
  2267 + ]
  2268 + }
  2269 + },
  2270 + "description": "个人素币统计"
  2271 + },
  2272 + "personTaskStatisticsResponseBody": {
  2273 + "title": "personTaskStatisticsResponseBody",
  2274 + "type": "object",
  2275 + "properties": {
  2276 + "bidAsParticipator": {
  2277 + "type": "integer",
  2278 + "description": "个人参与的竞标中任务",
  2279 + "required": [
  2280 + "bidAsParticipator"
  2281 + ]
  2282 + },
  2283 + "completedAsParticipator": {
  2284 + "type": "integer",
  2285 + "description": "个人参与的已完成任务",
  2286 + "required": [
  2287 + "completedAsParticipator"
  2288 + ]
  2289 + },
  2290 + "completedAsReceiver": {
  2291 + "type": "integer",
  2292 + "description": "个人领取的已完成任务",
  2293 + "required": [
  2294 + "completedAsReceiver"
  2295 + ]
  2296 + },
  2297 + "completedAsSponsor": {
  2298 + "type": "integer",
  2299 + "description": "个人发起的已完成任务",
  2300 + "required": [
  2301 + "completedAsSponsor"
  2302 + ]
  2303 + },
  2304 + "unAcceptanceAsReceiver": {
  2305 + "type": "integer",
  2306 + "description": "个人领取的待验收任务",
  2307 + "required": [
  2308 + "unAcceptanceAsReceiver"
  2309 + ]
  2310 + },
  2311 + "unAcceptanceAsSponsor": {
  2312 + "type": "integer",
  2313 + "description": "个人发起的待验收任务",
  2314 + "required": [
  2315 + "unAcceptanceAsSponsor"
  2316 + ]
  2317 + },
  2318 + "unClaimedAsSponsor": {
  2319 + "type": "integer",
  2320 + "description": "个人发起的待领取任务",
  2321 + "required": [
  2322 + "unClaimedAsSponsor"
  2323 + ]
  2324 + },
  2325 + "unReleasedAsSponsor": {
  2326 + "type": "integer",
  2327 + "description": "个人发起的待发布任务",
  2328 + "required": [
  2329 + "unReleasedAsSponsor"
  2330 + ]
  2331 + },
  2332 + "underwayAsReceiver": {
  2333 + "type": "integer",
  2334 + "description": "个人领取的进行中任务",
  2335 + "required": [
  2336 + "underwayAsReceiver"
  2337 + ]
  2338 + },
  2339 + "underwayAsSponsor": {
  2340 + "type": "integer",
  2341 + "description": "个人发起的进行中任务",
  2342 + "required": [
  2343 + "underwayAsSponsor"
  2344 + ]
  2345 + }
  2346 + },
  2347 + "description": "个人任务统计"
  2348 + },
1931 "referenceResourceItemRequestBody": { 2349 "referenceResourceItemRequestBody": {
1932 "title": "referenceResourceItemRequestBody", 2350 "title": "referenceResourceItemRequestBody",
1933 "type": "object", 2351 "type": "object",
@@ -2050,11 +2468,7 @@ @@ -2050,11 +2468,7 @@
2050 "$ref": "#/definitions/employeeInfoResponseBody" 2468 "$ref": "#/definitions/employeeInfoResponseBody"
2051 }, 2469 },
2052 "operator": { 2470 "operator": {
2053 - "type": "integer",  
2054 - "description": "操作人",  
2055 - "required": [  
2056 - "operator"  
2057 - ] 2471 + "$ref": "#/definitions/employeeInfoResponseBody"
2058 }, 2472 },
2059 "recordDescription": { 2473 "recordDescription": {
2060 "type": "string", 2474 "type": "string",
@@ -2077,6 +2491,13 @@ @@ -2077,6 +2491,13 @@
2077 "suMoney" 2491 "suMoney"
2078 ] 2492 ]
2079 }, 2493 },
  2494 + "suMoneyBeforeTransaction": {
  2495 + "type": "number",
  2496 + "description": "事务处理前素币值",
  2497 + "required": [
  2498 + "suMoneyBeforeTransaction"
  2499 + ]
  2500 + },
2080 "suMoneyTransactionRecordId": { 2501 "suMoneyTransactionRecordId": {
2081 "type": "integer", 2502 "type": "integer",
2082 "description": "素币事务记录ID", 2503 "description": "素币事务记录ID",
@@ -2087,6 +2508,30 @@ @@ -2087,6 +2508,30 @@
2087 }, 2508 },
2088 "description": "素币事务记录" 2509 "description": "素币事务记录"
2089 }, 2510 },
  2511 + "systemTaskStatisticsResponseBody": {
  2512 + "title": "systemTaskStatisticsResponseBody",
  2513 + "type": "object",
  2514 + "properties": {
  2515 + "completed": {
  2516 + "type": "integer",
  2517 + "description": "系统已完成任务",
  2518 + "format": "int64"
  2519 + },
  2520 + "released": {
  2521 + "type": "integer",
  2522 + "description": "系统已发布任务",
  2523 + "required": [
  2524 + "released"
  2525 + ]
  2526 + },
  2527 + "underway": {
  2528 + "type": "integer",
  2529 + "description": "系统进行中任务",
  2530 + "format": "int64"
  2531 + }
  2532 + },
  2533 + "description": "系统任务统计"
  2534 + },
2090 "taskPercentageItemRequestBody": { 2535 "taskPercentageItemRequestBody": {
2091 "title": "taskPercentageItemRequestBody", 2536 "title": "taskPercentageItemRequestBody",
2092 "type": "object", 2537 "type": "object",
@@ -2094,12 +2539,24 @@ @@ -2094,12 +2539,24 @@
2094 "contributor": { 2539 "contributor": {
2095 "$ref": "#/definitions/employeeInfoRequestBody" 2540 "$ref": "#/definitions/employeeInfoRequestBody"
2096 }, 2541 },
  2542 + "issueScore": {
  2543 + "type": "number",
  2544 + "description": "引用问题的得分",
  2545 + "format": "double"
  2546 + },
2097 "percentage": { 2547 "percentage": {
2098 "type": "integer", 2548 "type": "integer",
2099 "description": "任务贡献占比", 2549 "description": "任务贡献占比",
2100 "required": [ 2550 "required": [
2101 "percentage" 2551 "percentage"
2102 ] 2552 ]
  2553 + },
  2554 + "suMoney": {
  2555 + "type": "number",
  2556 + "description": "分配到的奖励素币",
  2557 + "required": [
  2558 + "suMoney"
  2559 + ]
2103 } 2560 }
2104 }, 2561 },
2105 "description": "任务贡献占比项" 2562 "description": "任务贡献占比项"
@@ -2111,12 +2568,24 @@ @@ -2111,12 +2568,24 @@
2111 "contributor": { 2568 "contributor": {
2112 "$ref": "#/definitions/employeeInfoResponseBody" 2569 "$ref": "#/definitions/employeeInfoResponseBody"
2113 }, 2570 },
  2571 + "issueScore": {
  2572 + "type": "number",
  2573 + "description": "引用问题的得分",
  2574 + "format": "double"
  2575 + },
2114 "percentage": { 2576 "percentage": {
2115 "type": "integer", 2577 "type": "integer",
2116 "description": "任务贡献占比", 2578 "description": "任务贡献占比",
2117 "required": [ 2579 "required": [
2118 "percentage" 2580 "percentage"
2119 ] 2581 ]
  2582 + },
  2583 + "suMoney": {
  2584 + "type": "number",
  2585 + "description": "分配到的奖励素币",
  2586 + "required": [
  2587 + "suMoney"
  2588 + ]
2120 } 2589 }
2121 }, 2590 },
2122 "description": "任务贡献占比项" 2591 "description": "任务贡献占比项"
@@ -204,6 +204,106 @@ paths: @@ -204,6 +204,106 @@ paths:
204 $ref: '#/definitions/EmployeeRemoveEmployeeResponseBody' 204 $ref: '#/definitions/EmployeeRemoveEmployeeResponseBody'
205 schemes: 205 schemes:
206 - http 206 - http
  207 + /off-task-records/{offTaskRecordId}:
  208 + get:
  209 + tags:
  210 + - offTaskRecord
  211 + summary: 返回关闭任务记录
  212 + description: 返回关闭任务记录
  213 + operationId: offTaskRecord#getOffTaskRecord
  214 + parameters:
  215 + - name: offTaskRecordId
  216 + in: path
  217 + description: 关闭任务记录ID
  218 + required: true
  219 + type: integer
  220 + responses:
  221 + "200":
  222 + description: OK response.
  223 + schema:
  224 + $ref: '#/definitions/OffTaskRecordGetOffTaskRecordResponseBody'
  225 + schemes:
  226 + - http
  227 + /off-task-records/search-off-task-record:
  228 + post:
  229 + tags:
  230 + - offTaskRecord
  231 + summary: 搜索关闭任务记录
  232 + description: 搜索关闭任务记录
  233 + operationId: offTaskRecord#searchOffTaskRecord
  234 + parameters:
  235 + - name: SearchOffTaskRecordRequestBody
  236 + in: body
  237 + required: true
  238 + schema:
  239 + $ref: '#/definitions/OffTaskRecordSearchOffTaskRecordRequestBody'
  240 + responses:
  241 + "200":
  242 + description: OK response.
  243 + schema:
  244 + $ref: '#/definitions/OffTaskRecordSearchOffTaskRecordResponseBody'
  245 + schemes:
  246 + - http
  247 + /statistics/person-su-money:
  248 + post:
  249 + tags:
  250 + - statistics
  251 + summary: 获取个人素币统计
  252 + description: 获取个人素币统计
  253 + operationId: statistics#personSuMoneyStatistics
  254 + parameters:
  255 + - name: PersonSuMoneyStatisticsRequestBody
  256 + in: body
  257 + required: true
  258 + schema:
  259 + $ref: '#/definitions/StatisticsPersonSuMoneyStatisticsRequestBody'
  260 + responses:
  261 + "200":
  262 + description: OK response.
  263 + schema:
  264 + $ref: '#/definitions/StatisticsPersonSuMoneyStatisticsResponseBody'
  265 + schemes:
  266 + - http
  267 + /statistics/person-task:
  268 + post:
  269 + tags:
  270 + - statistics
  271 + summary: 获取个人任务统计
  272 + description: 获取个人任务统计
  273 + operationId: statistics#personTaskStatistics
  274 + parameters:
  275 + - name: PersonTaskStatisticsRequestBody
  276 + in: body
  277 + required: true
  278 + schema:
  279 + $ref: '#/definitions/StatisticsPersonTaskStatisticsRequestBody'
  280 + responses:
  281 + "200":
  282 + description: OK response.
  283 + schema:
  284 + $ref: '#/definitions/StatisticsPersonTaskStatisticsResponseBody'
  285 + schemes:
  286 + - http
  287 + /statistics/system-task:
  288 + post:
  289 + tags:
  290 + - statistics
  291 + summary: 获取系统任务统计
  292 + description: 获取系统任务统计
  293 + operationId: statistics#systemTaskStatistics
  294 + parameters:
  295 + - name: SystemTaskStatisticsRequestBody
  296 + in: body
  297 + required: true
  298 + schema:
  299 + $ref: '#/definitions/StatisticsSystemTaskStatisticsRequestBody'
  300 + responses:
  301 + "200":
  302 + description: OK response.
  303 + schema:
  304 + $ref: '#/definitions/StatisticsSystemTaskStatisticsResponseBody'
  305 + schemes:
  306 + - http
207 /su-money/exchange: 307 /su-money/exchange:
208 post: 308 post:
209 tags: 309 tags:
@@ -259,7 +359,7 @@ paths: @@ -259,7 +359,7 @@ paths:
259 type: integer 359 type: integer
260 - name: sponsor 360 - name: sponsor
261 in: query 361 in: query
262 - description: 任务发起者 362 + description: 任务发起者UID
263 required: false 363 required: false
264 type: integer 364 type: integer
265 format: int64 365 format: int64
@@ -300,13 +400,13 @@ paths: @@ -300,13 +400,13 @@ paths:
300 type: integer 400 type: integer
301 - name: receiver 401 - name: receiver
302 in: query 402 in: query
303 - description: 任务领取人 403 + description: 任务领取人UID
304 required: false 404 required: false
305 type: integer 405 type: integer
306 format: int64 406 format: int64
307 - name: participator 407 - name: participator
308 in: query 408 in: query
309 - description: 任务参与者 409 + description: 任务参与者UID
310 required: false 410 required: false
311 type: integer 411 type: integer
312 format: int64 412 format: int64
@@ -734,6 +834,107 @@ definitions: @@ -734,6 +834,107 @@ definitions:
734 properties: 834 properties:
735 employee: 835 employee:
736 $ref: '#/definitions/employeeResponseBody' 836 $ref: '#/definitions/employeeResponseBody'
  837 + OffTaskRecordGetOffTaskRecordResponseBody:
  838 + title: 'Mediatype identifier: OffTaskRecordGetOffTaskRecordResponseBody'
  839 + type: object
  840 + properties:
  841 + offTaskRecord:
  842 + $ref: '#/definitions/offTaskRecordResponseBody'
  843 + OffTaskRecordSearchOffTaskRecordRequestBody:
  844 + title: OffTaskRecordSearchOffTaskRecordRequestBody
  845 + type: object
  846 + properties:
  847 + companyId:
  848 + type: integer
  849 + description: 公司ID
  850 + required:
  851 + - companyId
  852 + customerValue:
  853 + type: string
  854 + description: 客户价值
  855 + limit:
  856 + type: integer
  857 + description: 查询限制
  858 + format: int64
  859 + offEndTime:
  860 + type: string
  861 + description: 关闭任务时间区间-截止时间
  862 + format: datetime
  863 + offStartTime:
  864 + type: string
  865 + description: 关闭任务时间区间-开始时间
  866 + format: datetime
  867 + offset:
  868 + type: integer
  869 + description: 查询偏离量
  870 + format: int64
  871 + taskContentMatch:
  872 + type: string
  873 + description: 任务内容匹配
  874 + taskNature:
  875 + type: string
  876 + description: 任务性质
  877 + taskType:
  878 + type: integer
  879 + description: 任务类型
  880 + format: int64
  881 + OffTaskRecordSearchOffTaskRecordResponseBody:
  882 + title: 'Mediatype identifier: OffTaskRecordSearchOffTaskRecordResponseBody'
  883 + type: object
  884 + properties:
  885 + count:
  886 + type: integer
  887 + description: 结果总数
  888 + format: int64
  889 + offTaskRecords:
  890 + type: array
  891 + items:
  892 + $ref: '#/definitions/offTaskRecordResponseBody'
  893 + StatisticsPersonSuMoneyStatisticsRequestBody:
  894 + title: StatisticsPersonSuMoneyStatisticsRequestBody
  895 + type: object
  896 + properties:
  897 + uid:
  898 + type: integer
  899 + description: 统一用户UID
  900 + required:
  901 + - uid
  902 + StatisticsPersonSuMoneyStatisticsResponseBody:
  903 + title: 'Mediatype identifier: StatisticsPersonSuMoneyStatisticsResponseBody'
  904 + type: object
  905 + properties:
  906 + personSuMoneyStatistics:
  907 + $ref: '#/definitions/personSuMoneyStatisticsResponseBody'
  908 + StatisticsPersonTaskStatisticsRequestBody:
  909 + title: StatisticsPersonTaskStatisticsRequestBody
  910 + type: object
  911 + properties:
  912 + uid:
  913 + type: integer
  914 + description: 统一用户UID
  915 + required:
  916 + - uid
  917 + StatisticsPersonTaskStatisticsResponseBody:
  918 + title: 'Mediatype identifier: StatisticsPersonTaskStatisticsResponseBody'
  919 + type: object
  920 + properties:
  921 + personTaskStatistics:
  922 + $ref: '#/definitions/personTaskStatisticsResponseBody'
  923 + StatisticsSystemTaskStatisticsRequestBody:
  924 + title: StatisticsSystemTaskStatisticsRequestBody
  925 + type: object
  926 + properties:
  927 + companyId:
  928 + type: integer
  929 + description: 公司ID
  930 + required:
  931 + - companyId
  932 + StatisticsSystemTaskStatisticsResponseBody:
  933 + title: 'Mediatype identifier: StatisticsSystemTaskStatisticsResponseBody'
  934 + type: object
  935 + properties:
  936 + systemTaskStatistics:
  937 + $ref: '#/definitions/systemTaskStatisticsResponseBody'
737 SuMoneyExchangeSuMoneyRequestBody: 938 SuMoneyExchangeSuMoneyRequestBody:
738 title: SuMoneyExchangeSuMoneyRequestBody 939 title: SuMoneyExchangeSuMoneyRequestBody
739 type: object 940 type: object
@@ -745,7 +946,7 @@ definitions: @@ -745,7 +946,7 @@ definitions:
745 - exchangeDescription 946 - exchangeDescription
746 operator: 947 operator:
747 type: integer 948 type: integer
748 - description: 操作人UID(默认为系统操作) 949 + description: 操作人UID
749 format: int64 950 format: int64
750 suMoney: 951 suMoney:
751 type: number 952 type: number
@@ -775,11 +976,23 @@ definitions: @@ -775,11 +976,23 @@ definitions:
775 type: integer 976 type: integer
776 description: 查询偏离量 977 description: 查询偏离量
777 format: int64 978 format: int64
  979 + operator:
  980 + type: integer
  981 + description: 操作人UID
  982 + format: int64
778 recordType: 983 recordType:
779 type: integer 984 type: integer
780 description: 记录类型(1兑换,2任务奖励) 985 description: 记录类型(1兑换,2任务奖励)
781 required: 986 required:
782 - recordType 987 - recordType
  988 + transactionEndTime:
  989 + type: string
  990 + description: 事务时间区间-截止时间
  991 + format: datetime
  992 + transactionStartTime:
  993 + type: string
  994 + description: 事务时间区间-开始时间
  995 + format: datetime
783 uid: 996 uid:
784 type: integer 997 type: integer
785 description: 统一用户UID 998 description: 统一用户UID
@@ -1084,6 +1297,10 @@ definitions: @@ -1084,6 +1297,10 @@ definitions:
1084 type: integer 1297 type: integer
1085 description: 竞标时间(1全部,2已截止,3未截止) 1298 description: 竞标时间(1全部,2已截止,3未截止)
1086 format: int64 1299 format: int64
  1300 + bidder:
  1301 + type: integer
  1302 + description: 竞标参与者UID
  1303 + format: int64
1087 companyId: 1304 companyId:
1088 type: integer 1305 type: integer
1089 description: 公司ID 1306 description: 公司ID
@@ -1092,6 +1309,9 @@ definitions: @@ -1092,6 +1309,9 @@ definitions:
1092 customerValue: 1309 customerValue:
1093 type: string 1310 type: string
1094 description: 客户价值 1311 description: 客户价值
  1312 + isFilterCloseStatus:
  1313 + type: boolean
  1314 + description: 是否过滤关闭状态任务
1095 isRewardTake: 1315 isRewardTake:
1096 type: boolean 1316 type: boolean
1097 description: 是否悬赏任务 1317 description: 是否悬赏任务
@@ -1105,15 +1325,15 @@ definitions: @@ -1105,15 +1325,15 @@ definitions:
1105 format: int64 1325 format: int64
1106 participator: 1326 participator:
1107 type: integer 1327 type: integer
1108 - description: 任务参与者 1328 + description: 任务参与者UID
1109 format: int64 1329 format: int64
1110 receiver: 1330 receiver:
1111 type: integer 1331 type: integer
1112 - description: 任务领取人 1332 + description: 任务领取人UID
1113 format: int64 1333 format: int64
1114 sponsor: 1334 sponsor:
1115 type: integer 1335 type: integer
1116 - description: 任务发起者 1336 + description: 任务发起者UID
1117 format: int64 1337 format: int64
1118 taskContentMatch: 1338 taskContentMatch:
1119 type: string 1339 type: string
@@ -1330,6 +1550,76 @@ definitions: @@ -1330,6 +1550,76 @@ definitions:
1330 task: 1550 task:
1331 $ref: '#/definitions/taskResponseBody' 1551 $ref: '#/definitions/taskResponseBody'
1332 description: 关闭任务记录 1552 description: 关闭任务记录
  1553 + personSuMoneyStatisticsResponseBody:
  1554 + title: personSuMoneyStatisticsResponseBody
  1555 + type: object
  1556 + properties:
  1557 + currentSuMoney:
  1558 + type: number
  1559 + description: 当前素币
  1560 + required:
  1561 + - currentSuMoney
  1562 + incomeSuMoneyOfYesterday:
  1563 + type: number
  1564 + description: 昨日收益
  1565 + required:
  1566 + - incomeSuMoneyOfYesterday
  1567 + description: 个人素币统计
  1568 + personTaskStatisticsResponseBody:
  1569 + title: personTaskStatisticsResponseBody
  1570 + type: object
  1571 + properties:
  1572 + bidAsParticipator:
  1573 + type: integer
  1574 + description: 个人参与的竞标中任务
  1575 + required:
  1576 + - bidAsParticipator
  1577 + completedAsParticipator:
  1578 + type: integer
  1579 + description: 个人参与的已完成任务
  1580 + required:
  1581 + - completedAsParticipator
  1582 + completedAsReceiver:
  1583 + type: integer
  1584 + description: 个人领取的已完成任务
  1585 + required:
  1586 + - completedAsReceiver
  1587 + completedAsSponsor:
  1588 + type: integer
  1589 + description: 个人发起的已完成任务
  1590 + required:
  1591 + - completedAsSponsor
  1592 + unAcceptanceAsReceiver:
  1593 + type: integer
  1594 + description: 个人领取的待验收任务
  1595 + required:
  1596 + - unAcceptanceAsReceiver
  1597 + unAcceptanceAsSponsor:
  1598 + type: integer
  1599 + description: 个人发起的待验收任务
  1600 + required:
  1601 + - unAcceptanceAsSponsor
  1602 + unClaimedAsSponsor:
  1603 + type: integer
  1604 + description: 个人发起的待领取任务
  1605 + required:
  1606 + - unClaimedAsSponsor
  1607 + unReleasedAsSponsor:
  1608 + type: integer
  1609 + description: 个人发起的待发布任务
  1610 + required:
  1611 + - unReleasedAsSponsor
  1612 + underwayAsReceiver:
  1613 + type: integer
  1614 + description: 个人领取的进行中任务
  1615 + required:
  1616 + - underwayAsReceiver
  1617 + underwayAsSponsor:
  1618 + type: integer
  1619 + description: 个人发起的进行中任务
  1620 + required:
  1621 + - underwayAsSponsor
  1622 + description: 个人任务统计
1333 referenceResourceItemRequestBody: 1623 referenceResourceItemRequestBody:
1334 title: referenceResourceItemRequestBody 1624 title: referenceResourceItemRequestBody
1335 type: object 1625 type: object
@@ -1418,10 +1708,7 @@ definitions: @@ -1418,10 +1708,7 @@ definitions:
1418 employee: 1708 employee:
1419 $ref: '#/definitions/employeeInfoResponseBody' 1709 $ref: '#/definitions/employeeInfoResponseBody'
1420 operator: 1710 operator:
1421 - type: integer  
1422 - description: 操作人  
1423 - required:  
1424 - - operator 1711 + $ref: '#/definitions/employeeInfoResponseBody'
1425 recordDescription: 1712 recordDescription:
1426 type: string 1713 type: string
1427 description: 素币事务记录描述 1714 description: 素币事务记录描述
@@ -1437,23 +1724,55 @@ definitions: @@ -1437,23 +1724,55 @@ definitions:
1437 description: 事务素币值 1724 description: 事务素币值
1438 required: 1725 required:
1439 - suMoney 1726 - suMoney
  1727 + suMoneyBeforeTransaction:
  1728 + type: number
  1729 + description: 事务处理前素币值
  1730 + required:
  1731 + - suMoneyBeforeTransaction
1440 suMoneyTransactionRecordId: 1732 suMoneyTransactionRecordId:
1441 type: integer 1733 type: integer
1442 description: 素币事务记录ID 1734 description: 素币事务记录ID
1443 required: 1735 required:
1444 - suMoneyTransactionRecordId 1736 - suMoneyTransactionRecordId
1445 description: 素币事务记录 1737 description: 素币事务记录
  1738 + systemTaskStatisticsResponseBody:
  1739 + title: systemTaskStatisticsResponseBody
  1740 + type: object
  1741 + properties:
  1742 + completed:
  1743 + type: integer
  1744 + description: 系统已完成任务
  1745 + format: int64
  1746 + released:
  1747 + type: integer
  1748 + description: 系统已发布任务
  1749 + required:
  1750 + - released
  1751 + underway:
  1752 + type: integer
  1753 + description: 系统进行中任务
  1754 + format: int64
  1755 + description: 系统任务统计
1446 taskPercentageItemRequestBody: 1756 taskPercentageItemRequestBody:
1447 title: taskPercentageItemRequestBody 1757 title: taskPercentageItemRequestBody
1448 type: object 1758 type: object
1449 properties: 1759 properties:
1450 contributor: 1760 contributor:
1451 $ref: '#/definitions/employeeInfoRequestBody' 1761 $ref: '#/definitions/employeeInfoRequestBody'
  1762 + issueScore:
  1763 + type: number
  1764 + description: 引用问题的得分
  1765 + format: double
1452 percentage: 1766 percentage:
1453 type: integer 1767 type: integer
1454 description: 任务贡献占比 1768 description: 任务贡献占比
1455 required: 1769 required:
1456 - percentage 1770 - percentage
  1771 + suMoney:
  1772 + type: number
  1773 + description: 分配到的奖励素币
  1774 + required:
  1775 + - suMoney
1457 description: 任务贡献占比项 1776 description: 任务贡献占比项
1458 taskPercentageItemResponseBody: 1777 taskPercentageItemResponseBody:
1459 title: taskPercentageItemResponseBody 1778 title: taskPercentageItemResponseBody
@@ -1461,11 +1780,20 @@ definitions: @@ -1461,11 +1780,20 @@ definitions:
1461 properties: 1780 properties:
1462 contributor: 1781 contributor:
1463 $ref: '#/definitions/employeeInfoResponseBody' 1782 $ref: '#/definitions/employeeInfoResponseBody'
  1783 + issueScore:
  1784 + type: number
  1785 + description: 引用问题的得分
  1786 + format: double
1464 percentage: 1787 percentage:
1465 type: integer 1788 type: integer
1466 description: 任务贡献占比 1789 description: 任务贡献占比
1467 required: 1790 required:
1468 - percentage 1791 - percentage
  1792 + suMoney:
  1793 + type: number
  1794 + description: 分配到的奖励素币
  1795 + required:
  1796 + - suMoney
1469 description: 任务贡献占比项 1797 description: 任务贡献占比项
1470 taskResponseBody: 1798 taskResponseBody:
1471 title: taskResponseBody 1799 title: taskResponseBody
  1 +package query
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "github.com/astaxie/beego/validation"
  7 +)
  8 +
  9 +type ListEmployeePermissionQuery struct {
  10 +}
  11 +
  12 +func (listEmployeePermissionQuery *ListEmployeePermissionQuery) ValidateQuery() error {
  13 + valid := validation.Validation{}
  14 + b, err := valid.Valid(listEmployeePermissionQuery)
  15 + if err != nil {
  16 + return err
  17 + }
  18 + if !b {
  19 + for _, validErr := range valid.Errors {
  20 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  21 + }
  22 + }
  23 + return nil
  24 +}
@@ -163,6 +163,28 @@ func (configService *ConfigService) ListBidTimeMatch(listBidTimeMatchQuery *quer @@ -163,6 +163,28 @@ func (configService *ConfigService) ListBidTimeMatch(listBidTimeMatchQuery *quer
163 }, nil 163 }, nil
164 } 164 }
165 165
  166 +// 返回员工权限字典列表(1任务管理,2素币管理,3成员管理)
  167 +func (configService *ConfigService) ListEmployeePermission(listEmployeePermissionQuery *query.ListEmployeePermissionQuery) (interface{}, error) {
  168 + if err := listEmployeePermissionQuery.ValidateQuery(); err != nil {
  169 + return nil, application.ThrowError(application.ARG_ERROR, err.Error())
  170 + }
  171 + employeePermissionMap := map[int]string{
  172 + 1: "任务管理",
  173 + 2: "素币管理",
  174 + 3: "成员管理",
  175 + }
  176 + var list []map[string]interface{}
  177 + for key, value := range employeePermissionMap {
  178 + list = append(list, map[string]interface{}{
  179 + "id": key,
  180 + "name": value,
  181 + })
  182 + }
  183 + return map[string]interface{}{
  184 + "employeePermissions": list,
  185 + }, nil
  186 +}
  187 +
166 func NewConfigService(options map[string]interface{}) *ConfigService { 188 func NewConfigService(options map[string]interface{}) *ConfigService {
167 newConfigService := &ConfigService{} 189 newConfigService := &ConfigService{}
168 return newConfigService 190 return newConfigService
@@ -2,15 +2,19 @@ package command @@ -2,15 +2,19 @@ package command
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
  5 +
5 "github.com/astaxie/beego/validation" 6 "github.com/astaxie/beego/validation"
6 ) 7 )
7 8
8 type CreateEmployeeCommand struct { 9 type CreateEmployeeCommand struct {
  10 + // 统一用户UID
9 Uid int64 `json:"uid" valid:"Required"` 11 Uid int64 `json:"uid" valid:"Required"`
10 // 员工姓名 12 // 员工姓名
11 - EmployeeName string `json:"employeeName" valid:"Required"` 13 + EmployeeName string `json:"employeeName,omitempty"`
12 // 员工账号 14 // 员工账号
13 - EmployeeAccount string `json:"employeeAccount" valid:"Required"` 15 + EmployeeAccount string `json:"employeeAccount,omitempty"`
  16 + // 员工头像URL
  17 + EmployeeAvatarUrl string `json:"employeeAvatarUrl,omitempty"`
14 } 18 }
15 19
16 func (createEmployeeCommand *CreateEmployeeCommand) ValidateCommand() error { 20 func (createEmployeeCommand *CreateEmployeeCommand) ValidateCommand() error {
@@ -2,6 +2,7 @@ package command @@ -2,6 +2,7 @@ package command
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
  5 +
5 "github.com/astaxie/beego/validation" 6 "github.com/astaxie/beego/validation"
6 ) 7 )
7 8
@@ -2,6 +2,7 @@ package command @@ -2,6 +2,7 @@ package command
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
  5 +
5 "github.com/astaxie/beego/validation" 6 "github.com/astaxie/beego/validation"
6 ) 7 )
7 8
@@ -12,6 +13,10 @@ type UpdateEmployeeCommand struct { @@ -12,6 +13,10 @@ type UpdateEmployeeCommand struct {
12 EmployeeName string `json:"employeeName,omitempty"` 13 EmployeeName string `json:"employeeName,omitempty"`
13 // 员工账号 14 // 员工账号
14 EmployeeAccount string `json:"employeeAccount,omitempty"` 15 EmployeeAccount string `json:"employeeAccount,omitempty"`
  16 + // 员工头像URL
  17 + EmployeeAvatarUrl string `json:"employeeAvatarUrl,omitempty"`
  18 + // 员工权限集合
  19 + Permissions []int `json:"permissions,omitempty"`
15 } 20 }
16 21
17 func (updateEmployeeCommand *UpdateEmployeeCommand) ValidateCommand() error { 22 func (updateEmployeeCommand *UpdateEmployeeCommand) ValidateCommand() error {
@@ -2,6 +2,7 @@ package query @@ -2,6 +2,7 @@ package query
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
  5 +
5 "github.com/astaxie/beego/validation" 6 "github.com/astaxie/beego/validation"
6 ) 7 )
7 8
@@ -2,10 +2,15 @@ package query @@ -2,10 +2,15 @@ package query
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
  5 +
5 "github.com/astaxie/beego/validation" 6 "github.com/astaxie/beego/validation"
6 ) 7 )
7 8
8 type ListEmployeeQuery struct { 9 type ListEmployeeQuery struct {
  10 + // 公司ID
  11 + CompanyId int64 `json:"companyId" valid:"Required"`
  12 + // 员工姓名匹配
  13 + EmployeeNameMatch string `json:"employeeNameMatch,omitempty"`
9 // 查询偏离量 14 // 查询偏离量
10 Offset int `json:"offset,omitempty"` 15 Offset int `json:"offset,omitempty"`
11 // 查询限制 16 // 查询限制
@@ -15,7 +15,7 @@ type SearchOffTaskRecordCommand struct { @@ -15,7 +15,7 @@ type SearchOffTaskRecordCommand struct {
15 // 任务类型 15 // 任务类型
16 TaskType int `json:"taskType,omitempty"` 16 TaskType int `json:"taskType,omitempty"`
17 // 客户价值 17 // 客户价值
18 - CustomerValue string `json:"customerValue,omitempty"` 18 + CustomerValue []string `json:"customerValue,omitempty"`
19 // 任务性质 19 // 任务性质
20 TaskNature string `json:"taskNature,omitempty"` 20 TaskNature string `json:"taskNature,omitempty"`
21 // 关闭任务时间区间-开始时间 21 // 关闭任务时间区间-开始时间
@@ -18,7 +18,7 @@ type SearchTaskCommand struct { @@ -18,7 +18,7 @@ type SearchTaskCommand struct {
18 // 任务状态 18 // 任务状态
19 TaskStatus int `json:"taskStatus,omitempty"` 19 TaskStatus int `json:"taskStatus,omitempty"`
20 // 客户价值 20 // 客户价值
21 - CustomerValue string `json:"customerValue,omitempty"` 21 + CustomerValue []string `json:"customerValue,omitempty"`
22 // 任务性质 22 // 任务性质
23 TaskNature string `json:"taskNature,omitempty"` 23 TaskNature string `json:"taskNature,omitempty"`
24 // 是否悬赏任务 24 // 是否悬赏任务
@@ -20,7 +20,7 @@ type ListTaskQuery struct { @@ -20,7 +20,7 @@ type ListTaskQuery struct {
20 // 任务状态 20 // 任务状态
21 TaskStatus int `json:"taskStatus,omitempty"` 21 TaskStatus int `json:"taskStatus,omitempty"`
22 // 客户价值 22 // 客户价值
23 - CustomerValue string `json:"customerValue,omitempty"` 23 + CustomerValue []string `json:"customerValue,omitempty"`
24 // 任务性质 24 // 任务性质
25 TaskNature string `json:"taskNature,omitempty"` 25 TaskNature string `json:"taskNature,omitempty"`
26 // 是否悬赏任务 26 // 是否悬赏任务
@@ -12,6 +12,8 @@ type Employee struct { @@ -12,6 +12,8 @@ type Employee struct {
12 SuMoney float64 `json:"suMoney"` 12 SuMoney float64 `json:"suMoney"`
13 // 员工状态(启用或者禁用) 13 // 员工状态(启用或者禁用)
14 Status int `json:"status"` 14 Status int `json:"status"`
  15 + // 员工权限集合
  16 + Permissions []int `json:"permissions"`
15 } 17 }
16 18
17 type EmployeeRepository interface { 19 type EmployeeRepository interface {
@@ -38,6 +40,9 @@ func (employee *Employee) Update(data map[string]interface{}) error { @@ -38,6 +40,9 @@ func (employee *Employee) Update(data map[string]interface{}) error {
38 if status, ok := data["status"]; ok { 40 if status, ok := data["status"]; ok {
39 employee.Status = status.(int) 41 employee.Status = status.(int)
40 } 42 }
  43 + if permissions, ok := data["permissions"]; ok {
  44 + employee.Permissions = permissions.([]int)
  45 + }
41 return nil 46 return nil
42 } 47 }
43 48
@@ -8,4 +8,6 @@ type EmployeeInfo struct { @@ -8,4 +8,6 @@ type EmployeeInfo struct {
8 EmployeeName string `json:"employeeName"` 8 EmployeeName string `json:"employeeName"`
9 // 员工账号 9 // 员工账号
10 EmployeeAccount string `json:"employeeAccount"` 10 EmployeeAccount string `json:"employeeAccount"`
  11 + // 员工头像URL
  12 + EmployeeAvatarUrl string `json:"employeeAvatarUrl"`
11 } 13 }
@@ -12,8 +12,12 @@ type Employee struct { @@ -12,8 +12,12 @@ type Employee struct {
12 EmployeeName string 12 EmployeeName string
13 // 员工账号 13 // 员工账号
14 EmployeeAccount string 14 EmployeeAccount string
  15 + // 员工头像URL
  16 + EmployeeAvatarUrl string
15 // 当前素币 17 // 当前素币
16 SuMoney float64 18 SuMoney float64
17 // 员工状态(启用或者禁用) 19 // 员工状态(启用或者禁用)
18 Status int 20 Status int
  21 + // 员工权限集合
  22 + Permissions []int `pg:",array"`
19 } 23 }
@@ -30,16 +30,16 @@ func (repository *EmployeeRepository) Save(employee *domain.Employee) (*domain.E @@ -30,16 +30,16 @@ func (repository *EmployeeRepository) Save(employee *domain.Employee) (*domain.E
30 return employee, err 30 return employee, err
31 } 31 }
32 if _, err := tx.QueryOne( 32 if _, err := tx.QueryOne(
33 - pg.Scan(&employee.EmployeeId, &employee.CompanyId, &employee.EmployeeInfo.Uid, &employee.EmployeeInfo.EmployeeName, &employee.EmployeeInfo.EmployeeAccount, &employee.SuMoney, &employee.Status),  
34 - "INSERT INTO employees (id, company_id, uid, employee_name, employee_account, su_money, status) VALUES (?, ?, ?, ?, ?, ?, ?) RETURNING id, company_id, uid, employee_name, employee_account, su_money, status",  
35 - employee.EmployeeId, employee.CompanyId, employee.EmployeeInfo.Uid, employee.EmployeeInfo.EmployeeName, employee.EmployeeInfo.EmployeeAccount, employee.SuMoney, employee.Status); err != nil { 33 + pg.Scan(&employee.EmployeeId, &employee.CompanyId, &employee.EmployeeInfo.Uid, &employee.EmployeeInfo.EmployeeName, &employee.EmployeeInfo.EmployeeAccount, &employee.EmployeeInfo.EmployeeAvatarUrl, &employee.SuMoney, &employee.Status, pg.Array(&employee.Permissions)),
  34 + "INSERT INTO employees (id, company_id, uid, employee_name, employee_account, employee_avatar_url, su_money, status, permissions) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id, company_id, uid, employee_name, employee_account, employee_avatar_url, su_money, status, permissions",
  35 + employee.EmployeeId, employee.CompanyId, employee.EmployeeInfo.Uid, employee.EmployeeInfo.EmployeeName, employee.EmployeeInfo.EmployeeAccount, employee.EmployeeInfo.EmployeeAvatarUrl, employee.SuMoney, employee.Status, pg.Array(employee.Permissions)); err != nil {
36 return employee, err 36 return employee, err
37 } 37 }
38 } else { 38 } else {
39 if _, err := tx.QueryOne( 39 if _, err := tx.QueryOne(
40 - pg.Scan(&employee.EmployeeId, &employee.CompanyId, &employee.EmployeeInfo.Uid, &employee.EmployeeInfo.EmployeeName, &employee.EmployeeInfo.EmployeeAccount, &employee.SuMoney, &employee.Status),  
41 - "UPDATE employees SET employee_name=?, employee_account=?, su_money=?, status=? WHERE uid=? RETURNING id, company_id, uid, employee_name, employee_account, su_money, status",  
42 - employee.EmployeeInfo.EmployeeName, employee.EmployeeInfo.EmployeeAccount, employee.SuMoney, employee.Status, employee.EmployeeInfo.Uid); err != nil { 40 + pg.Scan(&employee.EmployeeId, &employee.CompanyId, &employee.EmployeeInfo.Uid, &employee.EmployeeInfo.EmployeeName, &employee.EmployeeInfo.EmployeeAccount, &employee.EmployeeInfo.EmployeeAvatarUrl, &employee.SuMoney, &employee.Status, pg.Array(&employee.Permissions)),
  41 + "UPDATE employees SET employee_name=?, employee_account=?, employee_avatar_url=?, su_money=?, status=?, permissions=? WHERE uid=? RETURNING id, company_id, uid, employee_name, employee_account, employee_avatar_url, su_money, status, permissions",
  42 + employee.EmployeeInfo.EmployeeName, employee.EmployeeInfo.EmployeeAccount, &employee.EmployeeInfo.EmployeeAvatarUrl, employee.SuMoney, employee.Status, pg.Array(employee.Permissions), employee.EmployeeInfo.Uid); err != nil {
43 return employee, err 43 return employee, err
44 } 44 }
45 } 45 }
@@ -82,6 +82,12 @@ func (repository *EmployeeRepository) Find(queryOptions map[string]interface{}) @@ -82,6 +82,12 @@ func (repository *EmployeeRepository) Find(queryOptions map[string]interface{})
82 var employeeModels []*models.Employee 82 var employeeModels []*models.Employee
83 employees := make([]*domain.Employee, 0) 83 employees := make([]*domain.Employee, 0)
84 query := tx.Model(&employeeModels) 84 query := tx.Model(&employeeModels)
  85 + if companyId, ok := queryOptions["companyId"]; ok {
  86 + query = query.Where("employee.company_id = ?", companyId)
  87 + }
  88 + if employeeNameMatch, ok := queryOptions["employeeNameMatch"]; ok && (employeeNameMatch != "") {
  89 + query = query.Where("employee.employee_name LIKE ?", fmt.Sprintf("%%%s%%", employeeNameMatch.(string)))
  90 + }
85 if offset, ok := queryOptions["offset"]; ok { 91 if offset, ok := queryOptions["offset"]; ok {
86 offset := offset.(int) 92 offset := offset.(int)
87 if offset > -1 { 93 if offset > -1 {
@@ -120,9 +126,11 @@ func (repository *EmployeeRepository) transformPgModelToDomainModel(employeeMode @@ -120,9 +126,11 @@ func (repository *EmployeeRepository) transformPgModelToDomainModel(employeeMode
120 Uid: employeeModel.Uid, 126 Uid: employeeModel.Uid,
121 EmployeeName: employeeModel.EmployeeName, 127 EmployeeName: employeeModel.EmployeeName,
122 EmployeeAccount: employeeModel.EmployeeAccount, 128 EmployeeAccount: employeeModel.EmployeeAccount,
  129 + EmployeeAvatarUrl: employeeModel.EmployeeAvatarUrl,
123 }, 130 },
124 SuMoney: employeeModel.SuMoney, 131 SuMoney: employeeModel.SuMoney,
125 Status: employeeModel.Status, 132 Status: employeeModel.Status,
  133 + Permissions: employeeModel.Permissions,
126 }, nil 134 }, nil
127 } 135 }
128 136
@@ -114,8 +114,13 @@ func (repository *TaskRepository) Find(queryOptions map[string]interface{}) (int @@ -114,8 +114,13 @@ func (repository *TaskRepository) Find(queryOptions map[string]interface{}) (int
114 if taskNature, ok := queryOptions["taskNature"]; ok && (taskNature != "") { 114 if taskNature, ok := queryOptions["taskNature"]; ok && (taskNature != "") {
115 query = query.Where(`task.task_nature = ?`, taskNature) 115 query = query.Where(`task.task_nature = ?`, taskNature)
116 } 116 }
117 - if customerValue, ok := queryOptions["customerValue"]; ok && (customerValue != "") {  
118 - query = query.Where("task.customer_value @> ?", pg.Array([]string{customerValue.(string)})) 117 + if customerValue, ok := queryOptions["customerValue"]; ok && len(customerValue.([]string)) != 0 {
  118 + query = query.WhereGroup(func(q *orm.Query) (*orm.Query, error) {
  119 + for _, value := range customerValue.([]string) {
  120 + q = q.WhereOr("task.customer_value @> ?", pg.Array([]string{value}))
  121 + }
  122 + return q, nil
  123 + })
119 } 124 }
120 if taskContentMatch, ok := queryOptions["taskContentMatch"]; ok && (taskContentMatch != "") { 125 if taskContentMatch, ok := queryOptions["taskContentMatch"]; ok && (taskContentMatch != "") {
121 query = query.WhereGroup(func(q *orm.Query) (*orm.Query, error) { 126 query = query.WhereGroup(func(q *orm.Query) (*orm.Query, error) {
@@ -94,3 +94,17 @@ func (controller *ConfigController) ListBidTimeMatch() { @@ -94,3 +94,17 @@ func (controller *ConfigController) ListBidTimeMatch() {
94 controller.Data["json"] = response 94 controller.Data["json"] = response
95 controller.ServeJSON() 95 controller.ServeJSON()
96 } 96 }
  97 +
  98 +func (controller *ConfigController) ListEmployeePermission() {
  99 + configService := service.NewConfigService(nil)
  100 + listEmployeePermissionQuery := &query.ListEmployeePermissionQuery{}
  101 + data, err := configService.ListEmployeePermission(listEmployeePermissionQuery)
  102 + var response utils.JsonResponse
  103 + if err != nil {
  104 + response = utils.ResponseError(controller.Ctx, err)
  105 + } else {
  106 + response = utils.ResponseData(controller.Ctx, data)
  107 + }
  108 + controller.Data["json"] = response
  109 + controller.ServeJSON()
  110 +}
@@ -2,6 +2,7 @@ package controllers @@ -2,6 +2,7 @@ package controllers
2 2
3 import ( 3 import (
4 "encoding/json" 4 "encoding/json"
  5 +
5 "github.com/astaxie/beego" 6 "github.com/astaxie/beego"
6 "github.com/linmadan/egglib-go/web/beego/utils" 7 "github.com/linmadan/egglib-go/web/beego/utils"
7 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/employee/command" 8 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/employee/command"
@@ -80,6 +81,10 @@ func (controller *EmployeeController) RemoveEmployee() { @@ -80,6 +81,10 @@ func (controller *EmployeeController) RemoveEmployee() {
80 func (controller *EmployeeController) ListEmployee() { 81 func (controller *EmployeeController) ListEmployee() {
81 employeeService := service.NewEmployeeService(nil) 82 employeeService := service.NewEmployeeService(nil)
82 listEmployeeQuery := &query.ListEmployeeQuery{} 83 listEmployeeQuery := &query.ListEmployeeQuery{}
  84 + companyId, _ := controller.GetInt64("companyId")
  85 + listEmployeeQuery.CompanyId = companyId
  86 + employeeNameMatch := controller.GetString("employeeNameMatch")
  87 + listEmployeeQuery.EmployeeNameMatch = employeeNameMatch
83 offset, _ := controller.GetInt("offset") 88 offset, _ := controller.GetInt("offset")
84 listEmployeeQuery.Offset = offset 89 listEmployeeQuery.Offset = offset
85 limit, _ := controller.GetInt("limit") 90 limit, _ := controller.GetInt("limit")
@@ -228,8 +228,6 @@ func (controller *TaskController) ListTask() { @@ -228,8 +228,6 @@ func (controller *TaskController) ListTask() {
228 listTaskQuery.TaskType = taskType 228 listTaskQuery.TaskType = taskType
229 taskStatus, _ := controller.GetInt("taskStatus") 229 taskStatus, _ := controller.GetInt("taskStatus")
230 listTaskQuery.TaskStatus = taskStatus 230 listTaskQuery.TaskStatus = taskStatus
231 - customerValue := controller.GetString("customerValue")  
232 - listTaskQuery.CustomerValue = customerValue  
233 taskNature := controller.GetString("taskNature") 231 taskNature := controller.GetString("taskNature")
234 listTaskQuery.TaskNature = taskNature 232 listTaskQuery.TaskNature = taskNature
235 isRewardTake, _ := controller.GetBool("isRewardTake") 233 isRewardTake, _ := controller.GetBool("isRewardTake")
@@ -12,4 +12,5 @@ func init() { @@ -12,4 +12,5 @@ func init() {
12 beego.Router("/config/customer-values", &controllers.ConfigController{}, "Get:ListCustomerValue") 12 beego.Router("/config/customer-values", &controllers.ConfigController{}, "Get:ListCustomerValue")
13 beego.Router("/config/reference-resource-types", &controllers.ConfigController{}, "Get:ListReferenceResourceType") 13 beego.Router("/config/reference-resource-types", &controllers.ConfigController{}, "Get:ListReferenceResourceType")
14 beego.Router("/config/bid-time-matchs", &controllers.ConfigController{}, "Get:ListBidTimeMatch") 14 beego.Router("/config/bid-time-matchs", &controllers.ConfigController{}, "Get:ListBidTimeMatch")
  15 + beego.Router("/config/employee-permissions", &controllers.ConfigController{}, "Get:ListEmployeePermission")
15 } 16 }
  1 +package config
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/gavv/httpexpect"
  7 + . "github.com/onsi/ginkgo"
  8 +)
  9 +
  10 +var _ = Describe("返回员工权限字典列表(1任务管理,2素币管理,3成员管理)", func() {
  11 + Describe("返回员工权限字典列表(1任务管理,2素币管理,3成员管理)", func() {
  12 + Context("", func() {
  13 + It("", func() {
  14 + httpExpect := httpexpect.New(GinkgoT(), server.URL)
  15 + httpExpect.GET("/config/employee-permissions").
  16 + Expect().
  17 + Status(http.StatusOK).
  18 + JSON().
  19 + Object().
  20 + ContainsKey("code").ValueEqual("code", 0).
  21 + ContainsKey("msg").ValueEqual("msg", "ok").
  22 + ContainsKey("data").Value("data").Object()
  23 + })
  24 + })
  25 + })
  26 +})
1 package employee 1 package employee
2 2
3 import ( 3 import (
  4 + "net/http"
  5 +
4 "github.com/gavv/httpexpect" 6 "github.com/gavv/httpexpect"
5 . "github.com/onsi/ginkgo" 7 . "github.com/onsi/ginkgo"
6 . "github.com/onsi/gomega" 8 . "github.com/onsi/gomega"
7 pG "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/pg" 9 pG "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/pg"
8 - "net/http"  
9 ) 10 )
10 11
11 var _ = Describe("创建新员工", func() { 12 var _ = Describe("创建新员工", func() {
@@ -14,11 +15,10 @@ var _ = Describe("创建新员工", func() { @@ -14,11 +15,10 @@ var _ = Describe("创建新员工", func() {
14 It("返回员工数据", func() { 15 It("返回员工数据", func() {
15 httpExpect := httpexpect.New(GinkgoT(), server.URL) 16 httpExpect := httpexpect.New(GinkgoT(), server.URL)
16 body := map[string]interface{}{ 17 body := map[string]interface{}{
17 - "uid": 123456,  
18 - "companyId": 101,  
19 - "employeeName": "蔡晓生",  
20 - "employeeAccount": "13799999999",  
21 - "status": 1, 18 + "uid": 2499036607974745088,
  19 + "employeeName": "employeeName",
  20 + "employeeAccount": "employeeAccount",
  21 + "employeeAvatarUrl": "employeeAvatarUrl",
22 } 22 }
23 httpExpect.POST("/employees/"). 23 httpExpect.POST("/employees/").
24 WithJSON(body). 24 WithJSON(body).
1 package employee 1 package employee
2 2
3 import ( 3 import (
  4 + "net/http"
  5 +
4 "github.com/gavv/httpexpect" 6 "github.com/gavv/httpexpect"
5 "github.com/go-pg/pg" 7 "github.com/go-pg/pg"
6 . "github.com/onsi/ginkgo" 8 . "github.com/onsi/ginkgo"
7 . "github.com/onsi/gomega" 9 . "github.com/onsi/gomega"
8 pG "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/pg" 10 pG "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/pg"
9 - "net/http"  
10 ) 11 )
11 12
12 var _ = Describe("返回员工", func() { 13 var _ = Describe("返回员工", func() {
@@ -14,15 +15,15 @@ var _ = Describe("返回员工", func() { @@ -14,15 +15,15 @@ var _ = Describe("返回员工", func() {
14 BeforeEach(func() { 15 BeforeEach(func() {
15 _, err := pG.DB.QueryOne( 16 _, err := pG.DB.QueryOne(
16 pg.Scan(&employeeId), 17 pg.Scan(&employeeId),
17 - "INSERT INTO employees (id, company_id, uid, employee_name, employee_account, su_money) VALUES (?, ?, ?, ?, ?, ?) RETURNING id",  
18 - 1, 101, 123456, "testEmployeeName", "testEmployeeAccount", 0) 18 + "INSERT INTO employees (id, company_id, uid, employee_name, employee_account, employee_avatar_url, su_money, status, permissions) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id",
  19 + 1, 101, 2499036607974745088, "employee_name", "employee_account", "employee_avatar_url", 1000.00, 1, pg.Array([]int{1, 3}))
19 Expect(err).NotTo(HaveOccurred()) 20 Expect(err).NotTo(HaveOccurred())
20 }) 21 })
21 - Describe("根据uid参数返回员工", func() {  
22 - Context("传入有效的uid", func() { 22 + Describe("根据employeeId参数返回员工", func() {
  23 + Context("传入有效的employeeId", func() {
23 It("返回员工数据", func() { 24 It("返回员工数据", func() {
24 httpExpect := httpexpect.New(GinkgoT(), server.URL) 25 httpExpect := httpexpect.New(GinkgoT(), server.URL)
25 - httpExpect.GET("/employees/123456"). 26 + httpExpect.GET("/employees/2499036607974745088").
26 Expect(). 27 Expect().
27 Status(http.StatusOK). 28 Status(http.StatusOK).
28 JSON(). 29 JSON().
1 package employee 1 package employee
2 2
3 import ( 3 import (
  4 + "net/http"
  5 +
4 "github.com/gavv/httpexpect" 6 "github.com/gavv/httpexpect"
5 "github.com/go-pg/pg" 7 "github.com/go-pg/pg"
6 . "github.com/onsi/ginkgo" 8 . "github.com/onsi/ginkgo"
7 . "github.com/onsi/gomega" 9 . "github.com/onsi/gomega"
8 pG "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/pg" 10 pG "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/pg"
9 - "net/http"  
10 ) 11 )
11 12
12 var _ = Describe("返回员工列表", func() { 13 var _ = Describe("返回员工列表", func() {
@@ -14,8 +15,8 @@ var _ = Describe("返回员工列表", func() { @@ -14,8 +15,8 @@ var _ = Describe("返回员工列表", func() {
14 BeforeEach(func() { 15 BeforeEach(func() {
15 _, err := pG.DB.QueryOne( 16 _, err := pG.DB.QueryOne(
16 pg.Scan(&employeeId), 17 pg.Scan(&employeeId),
17 - "INSERT INTO employees (id, company_id, uid, employee_name, employee_account, su_money) VALUES (?, ?, ?, ?, ?, ?) RETURNING id",  
18 - 1, 101, 123456, "testEmployeeName", "testEmployeeAccount", 0) 18 + "INSERT INTO employees (id, company_id, uid, employee_name, employee_account, employee_avatar_url, su_money, status, permissions) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id",
  19 + 1, 101, 2499036607974745088, "employee_name", "employee_account", "employee_avatar_url", 1000.00, 1, pg.Array([]int{1, 3}))
19 Expect(err).NotTo(HaveOccurred()) 20 Expect(err).NotTo(HaveOccurred())
20 }) 21 })
21 Describe("根据参数返回员工列表", func() { 22 Describe("根据参数返回员工列表", func() {
@@ -23,8 +24,9 @@ var _ = Describe("返回员工列表", func() { @@ -23,8 +24,9 @@ var _ = Describe("返回员工列表", func() {
23 It("返回员工数据列表", func() { 24 It("返回员工数据列表", func() {
24 httpExpect := httpexpect.New(GinkgoT(), server.URL) 25 httpExpect := httpexpect.New(GinkgoT(), server.URL)
25 httpExpect.GET("/employees/"). 26 httpExpect.GET("/employees/").
  27 + WithQuery("companyId", 101).
26 WithQuery("offset", 0). 28 WithQuery("offset", 0).
27 - WithQuery("limit", 20). 29 + WithQuery("limit", 1).
28 Expect(). 30 Expect().
29 Status(http.StatusOK). 31 Status(http.StatusOK).
30 JSON(). 32 JSON().
@@ -15,15 +15,15 @@ var _ = Describe("移除员工", func() { @@ -15,15 +15,15 @@ var _ = Describe("移除员工", func() {
15 BeforeEach(func() { 15 BeforeEach(func() {
16 _, err := pG.DB.QueryOne( 16 _, err := pG.DB.QueryOne(
17 pg.Scan(&employeeId), 17 pg.Scan(&employeeId),
18 - "INSERT INTO employees (id, company_id, uid, employee_name, employee_account, su_money) VALUES (?, ?, ?, ?, ?, ?) RETURNING id",  
19 - 1, 101, 123456, "testEmployeeName", "testEmployeeAccount", 0) 18 + "INSERT INTO employees (id, company_id, uid, employee_name, employee_account, employee_avatar_url, su_money, status, permissions) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id",
  19 + 1, 101, 2499036607974745088, "employee_name", "employee_account", "employee_avatar_url", 1000.00, 1, pg.Array([]int{1, 3}))
20 Expect(err).NotTo(HaveOccurred()) 20 Expect(err).NotTo(HaveOccurred())
21 }) 21 })
22 Describe("根据参数移除员工", func() { 22 Describe("根据参数移除员工", func() {
23 - Context("传入有效的uid", func() { 23 + Context("传入有效的employeeId", func() {
24 It("返回被移除员工的数据", func() { 24 It("返回被移除员工的数据", func() {
25 httpExpect := httpexpect.New(GinkgoT(), server.URL) 25 httpExpect := httpexpect.New(GinkgoT(), server.URL)
26 - httpExpect.DELETE("/employees/123456"). 26 + httpExpect.DELETE("/employees/2499036607974745088").
27 Expect(). 27 Expect().
28 Status(http.StatusOK). 28 Status(http.StatusOK).
29 JSON(). 29 JSON().
@@ -15,8 +15,8 @@ var _ = Describe("更新员工", func() { @@ -15,8 +15,8 @@ var _ = Describe("更新员工", func() {
15 BeforeEach(func() { 15 BeforeEach(func() {
16 _, err := pG.DB.QueryOne( 16 _, err := pG.DB.QueryOne(
17 pg.Scan(&employeeId), 17 pg.Scan(&employeeId),
18 - "INSERT INTO employees (id, company_id, uid, employee_name, employee_account, su_money) VALUES (?, ?, ?, ?, ?, ?) RETURNING id",  
19 - 1, 101, 123456, "testEmployeeName", "testEmployeeAccount", 0) 18 + "INSERT INTO employees (id, company_id, uid, employee_name, employee_account, employee_avatar_url, su_money, status, permissions) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id",
  19 + 1, 101, 2499036607974745088, "employee_name", "employee_account", "employee_avatar_url", 1000.00, 1, pg.Array([]int{1, 3}))
20 Expect(err).NotTo(HaveOccurred()) 20 Expect(err).NotTo(HaveOccurred())
21 }) 21 })
22 Describe("提交数据更新员工", func() { 22 Describe("提交数据更新员工", func() {
@@ -24,10 +24,12 @@ var _ = Describe("更新员工", func() { @@ -24,10 +24,12 @@ var _ = Describe("更新员工", func() {
24 It("返回更新后的员工数据", func() { 24 It("返回更新后的员工数据", func() {
25 httpExpect := httpexpect.New(GinkgoT(), server.URL) 25 httpExpect := httpexpect.New(GinkgoT(), server.URL)
26 body := map[string]interface{}{ 26 body := map[string]interface{}{
27 - "employeeName": "updateEmployeeName",  
28 - "employeeAccount": "updateEmployeeAccount", 27 + "employeeName": "employeeName",
  28 + "employeeAccount": "employeeAccount",
  29 + "employeeAvatarUrl": "employeeAvatarUrl",
  30 + "permissions": []int{1, 2},
29 } 31 }
30 - httpExpect.PUT("/employees/123456"). 32 + httpExpect.PUT("/employees/2499036607974745088").
31 WithJSON(body). 33 WithJSON(body).
32 Expect(). 34 Expect().
33 Status(http.StatusOK). 35 Status(http.StatusOK).
@@ -29,6 +29,20 @@ var _ = Describe("搜索任务", func() { @@ -29,6 +29,20 @@ var _ = Describe("搜索任务", func() {
29 }, 29 },
30 }, "null", "", pg.Array([]string{}), 2499036607974745099, time.Now(), time.Now().Add(dayAfter)) 30 }, "null", "", pg.Array([]string{}), 2499036607974745099, time.Now(), time.Now().Add(dayAfter))
31 Expect(err).NotTo(HaveOccurred()) 31 Expect(err).NotTo(HaveOccurred())
  32 + _, err1 := pG.DB.QueryOne(
  33 + pg.Scan(),
  34 + "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, create_time, release_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
  35 + 2, 101, "抢单任务2", 1, &domain.EmployeeInfo{
  36 + Uid: 2499036607974745088,
  37 + }, 1, "null", pg.Array([]string{"口感", "售后服务"}), "面", 1000.00, "验收标准1", "任务描述1", pg.Array([]string{}), false, "null", "null", "", pg.Array([]string{}), time.Now(), time.Now().Add(dayAfter))
  38 + Expect(err1).NotTo(HaveOccurred())
  39 + _, err2 := pG.DB.QueryOne(
  40 + pg.Scan(),
  41 + "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, create_time, release_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
  42 + 3, 101, "竞标任务1", 2, &domain.EmployeeInfo{
  43 + Uid: 2499036607974745088,
  44 + }, 1, "null", pg.Array([]string{"口感", "便利", "品牌"}), "面", 1000.00, "验收标准1", "任务描述1", pg.Array([]string{}), true, "null", "null", "", pg.Array([]string{}), time.Now(), time.Now().Add(dayAfter))
  45 + Expect(err2).NotTo(HaveOccurred())
32 }) 46 })
33 Describe("搜索任务", func() { 47 Describe("搜索任务", func() {
34 Context("", func() { 48 Context("", func() {
@@ -37,6 +51,11 @@ var _ = Describe("搜索任务", func() { @@ -37,6 +51,11 @@ var _ = Describe("搜索任务", func() {
37 body := map[string]interface{}{ 51 body := map[string]interface{}{
38 "companyId": 101, 52 "companyId": 101,
39 "sponsor": 2499036607974745088, 53 "sponsor": 2499036607974745088,
  54 + "customerValue": []string{
  55 + "售后服务",
  56 + "口感",
  57 + "品牌",
  58 + },
40 "offset": 0, 59 "offset": 0,
41 "limit": 20, 60 "limit": 20,
42 } 61 }