作者 linmadan

添加素币事务统计与详情接口

@@ -60,6 +60,27 @@ @@ -60,6 +60,27 @@
60 ] 60 ]
61 } 61 }
62 }, 62 },
  63 + "/config/employee-permissions": {
  64 + "get": {
  65 + "tags": [
  66 + "config"
  67 + ],
  68 + "summary": "返回员工权限字典列表(1任务管理,2素币管理,3成员管理)",
  69 + "description": "返回员工权限字典列表(1任务管理,2素币管理,3成员管理)",
  70 + "operationId": "config#listEmployeePermission",
  71 + "responses": {
  72 + "200": {
  73 + "description": "OK response.",
  74 + "schema": {
  75 + "$ref": "#/definitions/ConfigListEmployeePermissionResponseBody"
  76 + }
  77 + }
  78 + },
  79 + "schemes": [
  80 + "http"
  81 + ]
  82 + }
  83 + },
63 "/config/reference-resource-types": { 84 "/config/reference-resource-types": {
64 "get": { 85 "get": {
65 "tags": [ 86 "tags": [
@@ -154,6 +175,20 @@ @@ -154,6 +175,20 @@
154 "operationId": "employee#listEmployee", 175 "operationId": "employee#listEmployee",
155 "parameters": [ 176 "parameters": [
156 { 177 {
  178 + "name": "companyId",
  179 + "in": "query",
  180 + "description": "公司ID",
  181 + "required": false,
  182 + "type": "integer"
  183 + },
  184 + {
  185 + "name": "employeeNameMatch",
  186 + "in": "query",
  187 + "description": "员工姓名匹配",
  188 + "required": false,
  189 + "type": "string"
  190 + },
  191 + {
157 "name": "offset", 192 "name": "offset",
158 "in": "query", 193 "in": "query",
159 "description": "查询偏离量", 194 "description": "查询偏离量",
@@ -520,6 +555,67 @@ @@ -520,6 +555,67 @@
520 ] 555 ]
521 } 556 }
522 }, 557 },
  558 + "/su-money/su-money-transaction-record-statistics": {
  559 + "post": {
  560 + "tags": [
  561 + "suMoney"
  562 + ],
  563 + "summary": "素币事务记录统计",
  564 + "description": "素币事务记录统计",
  565 + "operationId": "suMoney#suMoneyTransactionRecordStatistics",
  566 + "parameters": [
  567 + {
  568 + "name": "SuMoneyTransactionRecordStatisticsRequestBody",
  569 + "in": "body",
  570 + "required": true,
  571 + "schema": {
  572 + "$ref": "#/definitions/SuMoneySuMoneyTransactionRecordStatisticsRequestBody"
  573 + }
  574 + }
  575 + ],
  576 + "responses": {
  577 + "200": {
  578 + "description": "OK response.",
  579 + "schema": {
  580 + "$ref": "#/definitions/SuMoneySuMoneyTransactionRecordStatisticsResponseBody"
  581 + }
  582 + }
  583 + },
  584 + "schemes": [
  585 + "http"
  586 + ]
  587 + }
  588 + },
  589 + "/su-money/su-money-transaction-records/{suMoneyTransactionRecordId}": {
  590 + "get": {
  591 + "tags": [
  592 + "suMoney"
  593 + ],
  594 + "summary": "返回素币事务记录",
  595 + "description": "返回素币事务记录",
  596 + "operationId": "suMoney#getSuMoneyTransactionRecord",
  597 + "parameters": [
  598 + {
  599 + "name": "suMoneyTransactionRecordId",
  600 + "in": "path",
  601 + "description": "素币事务记录ID",
  602 + "required": true,
  603 + "type": "integer"
  604 + }
  605 + ],
  606 + "responses": {
  607 + "200": {
  608 + "description": "OK response.",
  609 + "schema": {
  610 + "$ref": "#/definitions/SuMoneyGetSuMoneyTransactionRecordResponseBody"
  611 + }
  612 + }
  613 + },
  614 + "schemes": [
  615 + "http"
  616 + ]
  617 + }
  618 + },
523 "/tasks": { 619 "/tasks": {
524 "get": { 620 "get": {
525 "tags": [ 621 "tags": [
@@ -570,7 +666,11 @@ @@ -570,7 +666,11 @@
570 "in": "query", 666 "in": "query",
571 "description": "客户价值", 667 "description": "客户价值",
572 "required": false, 668 "required": false,
573 - "type": "string" 669 + "type": "array",
  670 + "items": {
  671 + "type": "string"
  672 + },
  673 + "collectionFormat": "multi"
574 }, 674 },
575 { 675 {
576 "name": "taskNature", 676 "name": "taskNature",
@@ -1114,6 +1214,18 @@ @@ -1114,6 +1214,18 @@
1114 } 1214 }
1115 } 1215 }
1116 }, 1216 },
  1217 + "ConfigListEmployeePermissionResponseBody": {
  1218 + "title": "Mediatype identifier: ConfigListEmployeePermissionResponseBody",
  1219 + "type": "object",
  1220 + "properties": {
  1221 + "employeePermissions": {
  1222 + "type": "array",
  1223 + "items": {
  1224 + "$ref": "#/definitions/configResponseBody"
  1225 + }
  1226 + }
  1227 + }
  1228 + },
1117 "ConfigListReferenceResourceTypeResponseBody": { 1229 "ConfigListReferenceResourceTypeResponseBody": {
1118 "title": "Mediatype identifier: ConfigListReferenceResourceTypeResponseBody", 1230 "title": "Mediatype identifier: ConfigListReferenceResourceTypeResponseBody",
1119 "type": "object", 1231 "type": "object",
@@ -1170,6 +1282,10 @@ @@ -1170,6 +1282,10 @@
1170 "type": "string", 1282 "type": "string",
1171 "description": "员工账号" 1283 "description": "员工账号"
1172 }, 1284 },
  1285 + "employeeAvatarUrl": {
  1286 + "type": "string",
  1287 + "description": "员工头像URL"
  1288 + },
1173 "employeeName": { 1289 "employeeName": {
1174 "type": "string", 1290 "type": "string",
1175 "description": "员工姓名" 1291 "description": "员工姓名"
@@ -1235,9 +1351,21 @@ @@ -1235,9 +1351,21 @@
1235 "type": "string", 1351 "type": "string",
1236 "description": "员工账号" 1352 "description": "员工账号"
1237 }, 1353 },
  1354 + "employeeAvatarUrl": {
  1355 + "type": "string",
  1356 + "description": "员工头像URL"
  1357 + },
1238 "employeeName": { 1358 "employeeName": {
1239 "type": "string", 1359 "type": "string",
1240 "description": "员工姓名" 1360 "description": "员工姓名"
  1361 + },
  1362 + "permissions": {
  1363 + "type": "array",
  1364 + "items": {
  1365 + "type": "integer",
  1366 + "format": "int64"
  1367 + },
  1368 + "description": "员工权限集合"
1241 } 1369 }
1242 } 1370 }
1243 }, 1371 },
@@ -1271,7 +1399,10 @@ @@ -1271,7 +1399,10 @@
1271 ] 1399 ]
1272 }, 1400 },
1273 "customerValue": { 1401 "customerValue": {
1274 - "type": "string", 1402 + "type": "array",
  1403 + "items": {
  1404 + "type": "string"
  1405 + },
1275 "description": "客户价值" 1406 "description": "客户价值"
1276 }, 1407 },
1277 "limit": { 1408 "limit": {
@@ -1433,6 +1564,15 @@ @@ -1433,6 +1564,15 @@
1433 } 1564 }
1434 } 1565 }
1435 }, 1566 },
  1567 + "SuMoneyGetSuMoneyTransactionRecordResponseBody": {
  1568 + "title": "Mediatype identifier: SuMoneyGetSuMoneyTransactionRecordResponseBody",
  1569 + "type": "object",
  1570 + "properties": {
  1571 + "suMoneyTransactionRecord": {
  1572 + "$ref": "#/definitions/suMoneyTransactionRecordResponseBody"
  1573 + }
  1574 + }
  1575 + },
1436 "SuMoneySearchSuMoneyTransactionRecordRequestBody": { 1576 "SuMoneySearchSuMoneyTransactionRecordRequestBody": {
1437 "title": "SuMoneySearchSuMoneyTransactionRecordRequestBody", 1577 "title": "SuMoneySearchSuMoneyTransactionRecordRequestBody",
1438 "type": "object", 1578 "type": "object",
@@ -1495,6 +1635,49 @@ @@ -1495,6 +1635,49 @@
1495 } 1635 }
1496 } 1636 }
1497 }, 1637 },
  1638 + "SuMoneySuMoneyTransactionRecordStatisticsRequestBody": {
  1639 + "title": "SuMoneySuMoneyTransactionRecordStatisticsRequestBody",
  1640 + "type": "object",
  1641 + "properties": {
  1642 + "transactionEndTime": {
  1643 + "type": "string",
  1644 + "description": "事务时间区间-截止时间",
  1645 + "format": "datetime"
  1646 + },
  1647 + "transactionStartTime": {
  1648 + "type": "string",
  1649 + "description": "事务时间区间-开始时间",
  1650 + "format": "datetime"
  1651 + },
  1652 + "uid": {
  1653 + "type": "integer",
  1654 + "description": "统一用户UID",
  1655 + "required": [
  1656 + "uid"
  1657 + ]
  1658 + }
  1659 + }
  1660 + },
  1661 + "SuMoneySuMoneyTransactionRecordStatisticsResponseBody": {
  1662 + "title": "Mediatype identifier: SuMoneySuMoneyTransactionRecordStatisticsResponseBody",
  1663 + "type": "object",
  1664 + "properties": {
  1665 + "expendSuMoney": {
  1666 + "type": "number",
  1667 + "description": "支出素币",
  1668 + "required": [
  1669 + "expendSuMoney"
  1670 + ]
  1671 + },
  1672 + "incomeSuMoney": {
  1673 + "type": "number",
  1674 + "description": "收入素币",
  1675 + "required": [
  1676 + "incomeSuMoney"
  1677 + ]
  1678 + }
  1679 + }
  1680 + },
1498 "TaskAcceptanceTaskRequestBody": { 1681 "TaskAcceptanceTaskRequestBody": {
1499 "title": "TaskAcceptanceTaskRequestBody", 1682 "title": "TaskAcceptanceTaskRequestBody",
1500 "type": "object", 1683 "type": "object",
@@ -1514,6 +1697,13 @@ @@ -1514,6 +1697,13 @@
1514 }, 1697 },
1515 "description": "任务参与者UID列表" 1698 "description": "任务参与者UID列表"
1516 }, 1699 },
  1700 + "referenceResourceScore": {
  1701 + "type": "array",
  1702 + "items": {
  1703 + "$ref": "#/definitions/referenceResourceItemRequestBody"
  1704 + },
  1705 + "description": "引用资源解决分"
  1706 + },
1517 "solvePictureUrls": { 1707 "solvePictureUrls": {
1518 "type": "array", 1708 "type": "array",
1519 "items": { 1709 "items": {
@@ -1640,6 +1830,13 @@ @@ -1640,6 +1830,13 @@
1640 "description": "竞标开始时间", 1830 "description": "竞标开始时间",
1641 "format": "datetime" 1831 "format": "datetime"
1642 }, 1832 },
  1833 + "companyId": {
  1834 + "type": "integer",
  1835 + "description": "公司ID",
  1836 + "required": [
  1837 + "companyId"
  1838 + ]
  1839 + },
1643 "customerValue": { 1840 "customerValue": {
1644 "type": "array", 1841 "type": "array",
1645 "items": { 1842 "items": {
@@ -1835,7 +2032,10 @@ @@ -1835,7 +2032,10 @@
1835 ] 2032 ]
1836 }, 2033 },
1837 "customerValue": { 2034 "customerValue": {
1838 - "type": "string", 2035 + "type": "array",
  2036 + "items": {
  2037 + "type": "string"
  2038 + },
1839 "description": "客户价值" 2039 "description": "客户价值"
1840 }, 2040 },
1841 "limit": { 2041 "limit": {
@@ -1912,13 +2112,20 @@ @@ -1912,13 +2112,20 @@
1912 ] 2112 ]
1913 }, 2113 },
1914 "customerValue": { 2114 "customerValue": {
1915 - "type": "string", 2115 + "type": "array",
  2116 + "items": {
  2117 + "type": "string"
  2118 + },
1916 "description": "客户价值" 2119 "description": "客户价值"
1917 }, 2120 },
1918 "isFilterCloseStatus": { 2121 "isFilterCloseStatus": {
1919 "type": "boolean", 2122 "type": "boolean",
1920 "description": "是否过滤关闭状态任务" 2123 "description": "是否过滤关闭状态任务"
1921 }, 2124 },
  2125 + "isFilterUnReleasedStatus": {
  2126 + "type": "boolean",
  2127 + "description": "是否过滤待发布状态任务"
  2128 + },
1922 "isRewardTake": { 2129 "isRewardTake": {
1923 "type": "boolean", 2130 "type": "boolean",
1924 "description": "是否悬赏任务" 2131 "description": "是否悬赏任务"
@@ -2136,6 +2343,10 @@ @@ -2136,6 +2343,10 @@
2136 "type": "string", 2343 "type": "string",
2137 "description": "员工账号" 2344 "description": "员工账号"
2138 }, 2345 },
  2346 + "employeeAvatarUrl": {
  2347 + "type": "string",
  2348 + "description": "员工头像URL"
  2349 + },
2139 "employeeName": { 2350 "employeeName": {
2140 "type": "string", 2351 "type": "string",
2141 "description": "员工姓名", 2352 "description": "员工姓名",
@@ -2161,6 +2372,10 @@ @@ -2161,6 +2372,10 @@
2161 "type": "string", 2372 "type": "string",
2162 "description": "员工账号" 2373 "description": "员工账号"
2163 }, 2374 },
  2375 + "employeeAvatarUrl": {
  2376 + "type": "string",
  2377 + "description": "员工头像URL"
  2378 + },
2164 "employeeName": { 2379 "employeeName": {
2165 "type": "string", 2380 "type": "string",
2166 "description": "员工姓名", 2381 "description": "员工姓名",
@@ -2199,6 +2414,17 @@ @@ -2199,6 +2414,17 @@
2199 "employeeInfo": { 2414 "employeeInfo": {
2200 "$ref": "#/definitions/employeeInfoResponseBody" 2415 "$ref": "#/definitions/employeeInfoResponseBody"
2201 }, 2416 },
  2417 + "permissions": {
  2418 + "type": "array",
  2419 + "items": {
  2420 + "type": "integer",
  2421 + "format": "int64"
  2422 + },
  2423 + "description": "员工权限集合",
  2424 + "required": [
  2425 + "permissions"
  2426 + ]
  2427 + },
2202 "status": { 2428 "status": {
2203 "type": "integer", 2429 "type": "integer",
2204 "description": "员工状态(启用或者禁用)", 2430 "description": "员工状态(启用或者禁用)",
@@ -2350,6 +2576,25 @@ @@ -2350,6 +2576,25 @@
2350 "title": "referenceResourceItemRequestBody", 2576 "title": "referenceResourceItemRequestBody",
2351 "type": "object", 2577 "type": "object",
2352 "properties": { 2578 "properties": {
  2579 + "content": {
  2580 + "type": "string",
  2581 + "description": "内容",
  2582 + "required": [
  2583 + "content"
  2584 + ]
  2585 + },
  2586 + "issueScore": {
  2587 + "type": "number",
  2588 + "description": "问题总分",
  2589 + "format": "double"
  2590 + },
  2591 + "referenceResourceId": {
  2592 + "type": "integer",
  2593 + "description": "引用资源ID",
  2594 + "required": [
  2595 + "referenceResourceId"
  2596 + ]
  2597 + },
2353 "serialNumber": { 2598 "serialNumber": {
2354 "type": "integer", 2599 "type": "integer",
2355 "description": "编号", 2600 "description": "编号",
@@ -2357,6 +2602,13 @@ @@ -2357,6 +2602,13 @@
2357 "serialNumber" 2602 "serialNumber"
2358 ] 2603 ]
2359 }, 2604 },
  2605 + "solveScore": {
  2606 + "type": "array",
  2607 + "items": {
  2608 + "$ref": "#/definitions/solveScoreItemRequestBody"
  2609 + },
  2610 + "description": "解决评分明细"
  2611 + },
2360 "title": { 2612 "title": {
2361 "type": "string", 2613 "type": "string",
2362 "description": "标题", 2614 "description": "标题",
@@ -2371,6 +2623,25 @@ @@ -2371,6 +2623,25 @@
2371 "title": "referenceResourceItemResponseBody", 2623 "title": "referenceResourceItemResponseBody",
2372 "type": "object", 2624 "type": "object",
2373 "properties": { 2625 "properties": {
  2626 + "content": {
  2627 + "type": "string",
  2628 + "description": "内容",
  2629 + "required": [
  2630 + "content"
  2631 + ]
  2632 + },
  2633 + "issueScore": {
  2634 + "type": "number",
  2635 + "description": "问题总分",
  2636 + "format": "double"
  2637 + },
  2638 + "referenceResourceId": {
  2639 + "type": "integer",
  2640 + "description": "引用资源ID",
  2641 + "required": [
  2642 + "referenceResourceId"
  2643 + ]
  2644 + },
2374 "serialNumber": { 2645 "serialNumber": {
2375 "type": "integer", 2646 "type": "integer",
2376 "description": "编号", 2647 "description": "编号",
@@ -2378,6 +2649,13 @@ @@ -2378,6 +2649,13 @@
2378 "serialNumber" 2649 "serialNumber"
2379 ] 2650 ]
2380 }, 2651 },
  2652 + "solveScore": {
  2653 + "type": "array",
  2654 + "items": {
  2655 + "$ref": "#/definitions/solveScoreItemResponseBody"
  2656 + },
  2657 + "description": "解决评分明细"
  2658 + },
2381 "title": { 2659 "title": {
2382 "type": "string", 2660 "type": "string",
2383 "description": "标题", 2661 "description": "标题",
@@ -2453,6 +2731,68 @@ @@ -2453,6 +2731,68 @@
2453 }, 2731 },
2454 "description": "抢单任务信息" 2732 "description": "抢单任务信息"
2455 }, 2733 },
  2734 + "solveScoreItemRequestBody": {
  2735 + "title": "solveScoreItemRequestBody",
  2736 + "type": "object",
  2737 + "properties": {
  2738 + "contributor": {
  2739 + "$ref": "#/definitions/employeeInfoRequestBody"
  2740 + },
  2741 + "isReceiver": {
  2742 + "type": "boolean",
  2743 + "description": "是否领取人",
  2744 + "required": [
  2745 + "isReceiver"
  2746 + ]
  2747 + },
  2748 + "percentage": {
  2749 + "type": "integer",
  2750 + "description": "解决占比",
  2751 + "required": [
  2752 + "percentage"
  2753 + ]
  2754 + },
  2755 + "score": {
  2756 + "type": "number",
  2757 + "description": "解决评分",
  2758 + "required": [
  2759 + "score"
  2760 + ]
  2761 + }
  2762 + },
  2763 + "description": "解决评分项"
  2764 + },
  2765 + "solveScoreItemResponseBody": {
  2766 + "title": "solveScoreItemResponseBody",
  2767 + "type": "object",
  2768 + "properties": {
  2769 + "contributor": {
  2770 + "$ref": "#/definitions/employeeInfoResponseBody"
  2771 + },
  2772 + "isReceiver": {
  2773 + "type": "boolean",
  2774 + "description": "是否领取人",
  2775 + "required": [
  2776 + "isReceiver"
  2777 + ]
  2778 + },
  2779 + "percentage": {
  2780 + "type": "integer",
  2781 + "description": "解决占比",
  2782 + "required": [
  2783 + "percentage"
  2784 + ]
  2785 + },
  2786 + "score": {
  2787 + "type": "number",
  2788 + "description": "解决评分",
  2789 + "required": [
  2790 + "score"
  2791 + ]
  2792 + }
  2793 + },
  2794 + "description": "解决评分项"
  2795 + },
2456 "suMoneyTransactionRecordResponseBody": { 2796 "suMoneyTransactionRecordResponseBody": {
2457 "title": "suMoneyTransactionRecordResponseBody", 2797 "title": "suMoneyTransactionRecordResponseBody",
2458 "type": "object", 2798 "type": "object",
@@ -2539,10 +2879,12 @@ @@ -2539,10 +2879,12 @@
2539 "contributor": { 2879 "contributor": {
2540 "$ref": "#/definitions/employeeInfoRequestBody" 2880 "$ref": "#/definitions/employeeInfoRequestBody"
2541 }, 2881 },
2542 - "issueScore": {  
2543 - "type": "number",  
2544 - "description": "引用问题的得分",  
2545 - "format": "double" 2882 + "isReceiver": {
  2883 + "type": "boolean",
  2884 + "description": "是否领取人",
  2885 + "required": [
  2886 + "isReceiver"
  2887 + ]
2546 }, 2888 },
2547 "percentage": { 2889 "percentage": {
2548 "type": "integer", 2890 "type": "integer",
@@ -2568,10 +2910,12 @@ @@ -2568,10 +2910,12 @@
2568 "contributor": { 2910 "contributor": {
2569 "$ref": "#/definitions/employeeInfoResponseBody" 2911 "$ref": "#/definitions/employeeInfoResponseBody"
2570 }, 2912 },
2571 - "issueScore": {  
2572 - "type": "number",  
2573 - "description": "引用问题的得分",  
2574 - "format": "double" 2913 + "isReceiver": {
  2914 + "type": "boolean",
  2915 + "description": "是否领取人",
  2916 + "required": [
  2917 + "isReceiver"
  2918 + ]
2575 }, 2919 },
2576 "percentage": { 2920 "percentage": {
2577 "type": "integer", 2921 "type": "integer",
@@ -41,6 +41,20 @@ paths: @@ -41,6 +41,20 @@ paths:
41 $ref: '#/definitions/ConfigListCustomerValueResponseBody' 41 $ref: '#/definitions/ConfigListCustomerValueResponseBody'
42 schemes: 42 schemes:
43 - http 43 - http
  44 + /config/employee-permissions:
  45 + get:
  46 + tags:
  47 + - config
  48 + summary: 返回员工权限字典列表(1任务管理,2素币管理,3成员管理)
  49 + description: 返回员工权限字典列表(1任务管理,2素币管理,3成员管理)
  50 + operationId: config#listEmployeePermission
  51 + responses:
  52 + "200":
  53 + description: OK response.
  54 + schema:
  55 + $ref: '#/definitions/ConfigListEmployeePermissionResponseBody'
  56 + schemes:
  57 + - http
44 /config/reference-resource-types: 58 /config/reference-resource-types:
45 get: 59 get:
46 tags: 60 tags:
@@ -105,6 +119,16 @@ paths: @@ -105,6 +119,16 @@ paths:
105 description: 返回员工列表 119 description: 返回员工列表
106 operationId: employee#listEmployee 120 operationId: employee#listEmployee
107 parameters: 121 parameters:
  122 + - name: companyId
  123 + in: query
  124 + description: 公司ID
  125 + required: false
  126 + type: integer
  127 + - name: employeeNameMatch
  128 + in: query
  129 + description: 员工姓名匹配
  130 + required: false
  131 + type: string
108 - name: offset 132 - name: offset
109 in: query 133 in: query
110 description: 查询偏离量 134 description: 查询偏离量
@@ -344,6 +368,46 @@ paths: @@ -344,6 +368,46 @@ paths:
344 $ref: '#/definitions/SuMoneySearchSuMoneyTransactionRecordResponseBody' 368 $ref: '#/definitions/SuMoneySearchSuMoneyTransactionRecordResponseBody'
345 schemes: 369 schemes:
346 - http 370 - http
  371 + /su-money/su-money-transaction-record-statistics:
  372 + post:
  373 + tags:
  374 + - suMoney
  375 + summary: 素币事务记录统计
  376 + description: 素币事务记录统计
  377 + operationId: suMoney#suMoneyTransactionRecordStatistics
  378 + parameters:
  379 + - name: SuMoneyTransactionRecordStatisticsRequestBody
  380 + in: body
  381 + required: true
  382 + schema:
  383 + $ref: '#/definitions/SuMoneySuMoneyTransactionRecordStatisticsRequestBody'
  384 + responses:
  385 + "200":
  386 + description: OK response.
  387 + schema:
  388 + $ref: '#/definitions/SuMoneySuMoneyTransactionRecordStatisticsResponseBody'
  389 + schemes:
  390 + - http
  391 + /su-money/su-money-transaction-records/{suMoneyTransactionRecordId}:
  392 + get:
  393 + tags:
  394 + - suMoney
  395 + summary: 返回素币事务记录
  396 + description: 返回素币事务记录
  397 + operationId: suMoney#getSuMoneyTransactionRecord
  398 + parameters:
  399 + - name: suMoneyTransactionRecordId
  400 + in: path
  401 + description: 素币事务记录ID
  402 + required: true
  403 + type: integer
  404 + responses:
  405 + "200":
  406 + description: OK response.
  407 + schema:
  408 + $ref: '#/definitions/SuMoneyGetSuMoneyTransactionRecordResponseBody'
  409 + schemes:
  410 + - http
347 /tasks: 411 /tasks:
348 get: 412 get:
349 tags: 413 tags:
@@ -382,7 +446,10 @@ paths: @@ -382,7 +446,10 @@ paths:
382 in: query 446 in: query
383 description: 客户价值 447 description: 客户价值
384 required: false 448 required: false
385 - type: string 449 + type: array
  450 + items:
  451 + type: string
  452 + collectionFormat: multi
386 - name: taskNature 453 - name: taskNature
387 in: query 454 in: query
388 description: 任务性质 455 description: 任务性质
@@ -741,6 +808,14 @@ definitions: @@ -741,6 +808,14 @@ definitions:
741 type: array 808 type: array
742 items: 809 items:
743 $ref: '#/definitions/configResponseBody' 810 $ref: '#/definitions/configResponseBody'
  811 + ConfigListEmployeePermissionResponseBody:
  812 + title: 'Mediatype identifier: ConfigListEmployeePermissionResponseBody'
  813 + type: object
  814 + properties:
  815 + employeePermissions:
  816 + type: array
  817 + items:
  818 + $ref: '#/definitions/configResponseBody'
744 ConfigListReferenceResourceTypeResponseBody: 819 ConfigListReferenceResourceTypeResponseBody:
745 title: 'Mediatype identifier: ConfigListReferenceResourceTypeResponseBody' 820 title: 'Mediatype identifier: ConfigListReferenceResourceTypeResponseBody'
746 type: object 821 type: object
@@ -780,6 +855,9 @@ definitions: @@ -780,6 +855,9 @@ definitions:
780 employeeAccount: 855 employeeAccount:
781 type: string 856 type: string
782 description: 员工账号 857 description: 员工账号
  858 + employeeAvatarUrl:
  859 + type: string
  860 + description: 员工头像URL
783 employeeName: 861 employeeName:
784 type: string 862 type: string
785 description: 员工姓名 863 description: 员工姓名
@@ -825,9 +903,18 @@ definitions: @@ -825,9 +903,18 @@ definitions:
825 employeeAccount: 903 employeeAccount:
826 type: string 904 type: string
827 description: 员工账号 905 description: 员工账号
  906 + employeeAvatarUrl:
  907 + type: string
  908 + description: 员工头像URL
828 employeeName: 909 employeeName:
829 type: string 910 type: string
830 description: 员工姓名 911 description: 员工姓名
  912 + permissions:
  913 + type: array
  914 + items:
  915 + type: integer
  916 + format: int64
  917 + description: 员工权限集合
831 EmployeeUpdateEmployeeResponseBody: 918 EmployeeUpdateEmployeeResponseBody:
832 title: 'Mediatype identifier: EmployeeUpdateEmployeeResponseBody' 919 title: 'Mediatype identifier: EmployeeUpdateEmployeeResponseBody'
833 type: object 920 type: object
@@ -850,7 +937,9 @@ definitions: @@ -850,7 +937,9 @@ definitions:
850 required: 937 required:
851 - companyId 938 - companyId
852 customerValue: 939 customerValue:
853 - type: string 940 + type: array
  941 + items:
  942 + type: string
854 description: 客户价值 943 description: 客户价值
855 limit: 944 limit:
856 type: integer 945 type: integer
@@ -964,6 +1053,12 @@ definitions: @@ -964,6 +1053,12 @@ definitions:
964 properties: 1053 properties:
965 suMoneyTransactionRecord: 1054 suMoneyTransactionRecord:
966 $ref: '#/definitions/suMoneyTransactionRecordResponseBody' 1055 $ref: '#/definitions/suMoneyTransactionRecordResponseBody'
  1056 + SuMoneyGetSuMoneyTransactionRecordResponseBody:
  1057 + title: 'Mediatype identifier: SuMoneyGetSuMoneyTransactionRecordResponseBody'
  1058 + type: object
  1059 + properties:
  1060 + suMoneyTransactionRecord:
  1061 + $ref: '#/definitions/suMoneyTransactionRecordResponseBody'
967 SuMoneySearchSuMoneyTransactionRecordRequestBody: 1062 SuMoneySearchSuMoneyTransactionRecordRequestBody:
968 title: SuMoneySearchSuMoneyTransactionRecordRequestBody 1063 title: SuMoneySearchSuMoneyTransactionRecordRequestBody
969 type: object 1064 type: object
@@ -1010,6 +1105,37 @@ definitions: @@ -1010,6 +1105,37 @@ definitions:
1010 type: array 1105 type: array
1011 items: 1106 items:
1012 $ref: '#/definitions/suMoneyTransactionRecordResponseBody' 1107 $ref: '#/definitions/suMoneyTransactionRecordResponseBody'
  1108 + SuMoneySuMoneyTransactionRecordStatisticsRequestBody:
  1109 + title: SuMoneySuMoneyTransactionRecordStatisticsRequestBody
  1110 + type: object
  1111 + properties:
  1112 + transactionEndTime:
  1113 + type: string
  1114 + description: 事务时间区间-截止时间
  1115 + format: datetime
  1116 + transactionStartTime:
  1117 + type: string
  1118 + description: 事务时间区间-开始时间
  1119 + format: datetime
  1120 + uid:
  1121 + type: integer
  1122 + description: 统一用户UID
  1123 + required:
  1124 + - uid
  1125 + SuMoneySuMoneyTransactionRecordStatisticsResponseBody:
  1126 + title: 'Mediatype identifier: SuMoneySuMoneyTransactionRecordStatisticsResponseBody'
  1127 + type: object
  1128 + properties:
  1129 + expendSuMoney:
  1130 + type: number
  1131 + description: 支出素币
  1132 + required:
  1133 + - expendSuMoney
  1134 + incomeSuMoney:
  1135 + type: number
  1136 + description: 收入素币
  1137 + required:
  1138 + - incomeSuMoney
1013 TaskAcceptanceTaskRequestBody: 1139 TaskAcceptanceTaskRequestBody:
1014 title: TaskAcceptanceTaskRequestBody 1140 title: TaskAcceptanceTaskRequestBody
1015 type: object 1141 type: object
@@ -1025,6 +1151,11 @@ definitions: @@ -1025,6 +1151,11 @@ definitions:
1025 type: integer 1151 type: integer
1026 format: int64 1152 format: int64
1027 description: 任务参与者UID列表 1153 description: 任务参与者UID列表
  1154 + referenceResourceScore:
  1155 + type: array
  1156 + items:
  1157 + $ref: '#/definitions/referenceResourceItemRequestBody'
  1158 + description: 引用资源解决分
1028 solvePictureUrls: 1159 solvePictureUrls:
1029 type: array 1160 type: array
1030 items: 1161 items:
@@ -1113,6 +1244,11 @@ definitions: @@ -1113,6 +1244,11 @@ definitions:
1113 type: string 1244 type: string
1114 description: 竞标开始时间 1245 description: 竞标开始时间
1115 format: datetime 1246 format: datetime
  1247 + companyId:
  1248 + type: integer
  1249 + description: 公司ID
  1250 + required:
  1251 + - companyId
1116 customerValue: 1252 customerValue:
1117 type: array 1253 type: array
1118 items: 1254 items:
@@ -1249,7 +1385,9 @@ definitions: @@ -1249,7 +1385,9 @@ definitions:
1249 required: 1385 required:
1250 - companyId 1386 - companyId
1251 customerValue: 1387 customerValue:
1252 - type: string 1388 + type: array
  1389 + items:
  1390 + type: string
1253 description: 客户价值 1391 description: 客户价值
1254 limit: 1392 limit:
1255 type: integer 1393 type: integer
@@ -1307,11 +1445,16 @@ definitions: @@ -1307,11 +1445,16 @@ definitions:
1307 required: 1445 required:
1308 - companyId 1446 - companyId
1309 customerValue: 1447 customerValue:
1310 - type: string 1448 + type: array
  1449 + items:
  1450 + type: string
1311 description: 客户价值 1451 description: 客户价值
1312 isFilterCloseStatus: 1452 isFilterCloseStatus:
1313 type: boolean 1453 type: boolean
1314 description: 是否过滤关闭状态任务 1454 description: 是否过滤关闭状态任务
  1455 + isFilterUnReleasedStatus:
  1456 + type: boolean
  1457 + description: 是否过滤待发布状态任务
1315 isRewardTake: 1458 isRewardTake:
1316 type: boolean 1459 type: boolean
1317 description: 是否悬赏任务 1460 description: 是否悬赏任务
@@ -1471,6 +1614,9 @@ definitions: @@ -1471,6 +1614,9 @@ definitions:
1471 employeeAccount: 1614 employeeAccount:
1472 type: string 1615 type: string
1473 description: 员工账号 1616 description: 员工账号
  1617 + employeeAvatarUrl:
  1618 + type: string
  1619 + description: 员工头像URL
1474 employeeName: 1620 employeeName:
1475 type: string 1621 type: string
1476 description: 员工姓名 1622 description: 员工姓名
@@ -1489,6 +1635,9 @@ definitions: @@ -1489,6 +1635,9 @@ definitions:
1489 employeeAccount: 1635 employeeAccount:
1490 type: string 1636 type: string
1491 description: 员工账号 1637 description: 员工账号
  1638 + employeeAvatarUrl:
  1639 + type: string
  1640 + description: 员工头像URL
1492 employeeName: 1641 employeeName:
1493 type: string 1642 type: string
1494 description: 员工姓名 1643 description: 员工姓名
@@ -1516,6 +1665,14 @@ definitions: @@ -1516,6 +1665,14 @@ definitions:
1516 - employeeId 1665 - employeeId
1517 employeeInfo: 1666 employeeInfo:
1518 $ref: '#/definitions/employeeInfoResponseBody' 1667 $ref: '#/definitions/employeeInfoResponseBody'
  1668 + permissions:
  1669 + type: array
  1670 + items:
  1671 + type: integer
  1672 + format: int64
  1673 + description: 员工权限集合
  1674 + required:
  1675 + - permissions
1519 status: 1676 status:
1520 type: integer 1677 type: integer
1521 description: 员工状态(启用或者禁用) 1678 description: 员工状态(启用或者禁用)
@@ -1624,11 +1781,30 @@ definitions: @@ -1624,11 +1781,30 @@ definitions:
1624 title: referenceResourceItemRequestBody 1781 title: referenceResourceItemRequestBody
1625 type: object 1782 type: object
1626 properties: 1783 properties:
  1784 + content:
  1785 + type: string
  1786 + description: 内容
  1787 + required:
  1788 + - content
  1789 + issueScore:
  1790 + type: number
  1791 + description: 问题总分
  1792 + format: double
  1793 + referenceResourceId:
  1794 + type: integer
  1795 + description: 引用资源ID
  1796 + required:
  1797 + - referenceResourceId
1627 serialNumber: 1798 serialNumber:
1628 type: integer 1799 type: integer
1629 description: 编号 1800 description: 编号
1630 required: 1801 required:
1631 - serialNumber 1802 - serialNumber
  1803 + solveScore:
  1804 + type: array
  1805 + items:
  1806 + $ref: '#/definitions/solveScoreItemRequestBody'
  1807 + description: 解决评分明细
1632 title: 1808 title:
1633 type: string 1809 type: string
1634 description: 标题 1810 description: 标题
@@ -1639,11 +1815,30 @@ definitions: @@ -1639,11 +1815,30 @@ definitions:
1639 title: referenceResourceItemResponseBody 1815 title: referenceResourceItemResponseBody
1640 type: object 1816 type: object
1641 properties: 1817 properties:
  1818 + content:
  1819 + type: string
  1820 + description: 内容
  1821 + required:
  1822 + - content
  1823 + issueScore:
  1824 + type: number
  1825 + description: 问题总分
  1826 + format: double
  1827 + referenceResourceId:
  1828 + type: integer
  1829 + description: 引用资源ID
  1830 + required:
  1831 + - referenceResourceId
1642 serialNumber: 1832 serialNumber:
1643 type: integer 1833 type: integer
1644 description: 编号 1834 description: 编号
1645 required: 1835 required:
1646 - serialNumber 1836 - serialNumber
  1837 + solveScore:
  1838 + type: array
  1839 + items:
  1840 + $ref: '#/definitions/solveScoreItemResponseBody'
  1841 + description: 解决评分明细
1647 title: 1842 title:
1648 type: string 1843 type: string
1649 description: 标题 1844 description: 标题
@@ -1696,6 +1891,50 @@ definitions: @@ -1696,6 +1891,50 @@ definitions:
1696 receiver: 1891 receiver:
1697 $ref: '#/definitions/employeeInfoResponseBody' 1892 $ref: '#/definitions/employeeInfoResponseBody'
1698 description: 抢单任务信息 1893 description: 抢单任务信息
  1894 + solveScoreItemRequestBody:
  1895 + title: solveScoreItemRequestBody
  1896 + type: object
  1897 + properties:
  1898 + contributor:
  1899 + $ref: '#/definitions/employeeInfoRequestBody'
  1900 + isReceiver:
  1901 + type: boolean
  1902 + description: 是否领取人
  1903 + required:
  1904 + - isReceiver
  1905 + percentage:
  1906 + type: integer
  1907 + description: 解决占比
  1908 + required:
  1909 + - percentage
  1910 + score:
  1911 + type: number
  1912 + description: 解决评分
  1913 + required:
  1914 + - score
  1915 + description: 解决评分项
  1916 + solveScoreItemResponseBody:
  1917 + title: solveScoreItemResponseBody
  1918 + type: object
  1919 + properties:
  1920 + contributor:
  1921 + $ref: '#/definitions/employeeInfoResponseBody'
  1922 + isReceiver:
  1923 + type: boolean
  1924 + description: 是否领取人
  1925 + required:
  1926 + - isReceiver
  1927 + percentage:
  1928 + type: integer
  1929 + description: 解决占比
  1930 + required:
  1931 + - percentage
  1932 + score:
  1933 + type: number
  1934 + description: 解决评分
  1935 + required:
  1936 + - score
  1937 + description: 解决评分项
1699 suMoneyTransactionRecordResponseBody: 1938 suMoneyTransactionRecordResponseBody:
1700 title: suMoneyTransactionRecordResponseBody 1939 title: suMoneyTransactionRecordResponseBody
1701 type: object 1940 type: object
@@ -1759,10 +1998,11 @@ definitions: @@ -1759,10 +1998,11 @@ definitions:
1759 properties: 1998 properties:
1760 contributor: 1999 contributor:
1761 $ref: '#/definitions/employeeInfoRequestBody' 2000 $ref: '#/definitions/employeeInfoRequestBody'
1762 - issueScore:  
1763 - type: number  
1764 - description: 引用问题的得分  
1765 - format: double 2001 + isReceiver:
  2002 + type: boolean
  2003 + description: 是否领取人
  2004 + required:
  2005 + - isReceiver
1766 percentage: 2006 percentage:
1767 type: integer 2007 type: integer
1768 description: 任务贡献占比 2008 description: 任务贡献占比
@@ -1780,10 +2020,11 @@ definitions: @@ -1780,10 +2020,11 @@ definitions:
1780 properties: 2020 properties:
1781 contributor: 2021 contributor:
1782 $ref: '#/definitions/employeeInfoResponseBody' 2022 $ref: '#/definitions/employeeInfoResponseBody'
1783 - issueScore:  
1784 - type: number  
1785 - description: 引用问题的得分  
1786 - format: double 2023 + isReceiver:
  2024 + type: boolean
  2025 + description: 是否领取人
  2026 + required:
  2027 + - isReceiver
1787 percentage: 2028 percentage:
1788 type: integer 2029 type: integer
1789 description: 任务贡献占比 2030 description: 任务贡献占比
  1 +package command
  2 +
  3 +import (
  4 + "fmt"
  5 + "time"
  6 +
  7 + "github.com/astaxie/beego/validation"
  8 +)
  9 +
  10 +type SuMoneyTransactionRecordStatisticsCommand struct {
  11 + // 统一用户UID
  12 + Uid int64 `json:"uid" valid:"Required"`
  13 + // 事务时间区间-开始时间
  14 + TransactionStartTime time.Time `json:"transactionStartTime,omitempty"`
  15 + // 事务时间区间-截止时间
  16 + TransactionEndTime time.Time `json:"transactionEndTime,omitempty"`
  17 +}
  18 +
  19 +func (suMoneyTransactionRecordStatisticsCommand *SuMoneyTransactionRecordStatisticsCommand) ValidateCommand() error {
  20 + valid := validation.Validation{}
  21 + b, err := valid.Valid(suMoneyTransactionRecordStatisticsCommand)
  22 + if err != nil {
  23 + return err
  24 + }
  25 + if !b {
  26 + for _, validErr := range valid.Errors {
  27 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  28 + }
  29 + }
  30 + return nil
  31 +}
  1 +package query
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "github.com/astaxie/beego/validation"
  7 +)
  8 +
  9 +type GetSuMoneyTransactionRecordQuery struct {
  10 + // 素币事务记录ID
  11 + SuMoneyTransactionRecordId int64 `json:"suMoneyTransactionRecordId" valid:"Required"`
  12 +}
  13 +
  14 +func (getSuMoneyTransactionRecordQuery *GetSuMoneyTransactionRecordQuery) ValidateQuery() error {
  15 + valid := validation.Validation{}
  16 + b, err := valid.Valid(getSuMoneyTransactionRecordQuery)
  17 + if err != nil {
  18 + return err
  19 + }
  20 + if !b {
  21 + for _, validErr := range valid.Errors {
  22 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  23 + }
  24 + }
  25 + return nil
  26 +}
@@ -5,14 +5,49 @@ import ( @@ -5,14 +5,49 @@ import (
5 "github.com/linmadan/egglib-go/utils/tool_funs" 5 "github.com/linmadan/egglib-go/utils/tool_funs"
6 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/factory" 6 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/factory"
7 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/command" 7 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/command"
  8 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/query"
8 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain" 9 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
9 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain/service" 10 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain/service"
  11 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/dao"
10 ) 12 )
11 13
12 // 素币服务 14 // 素币服务
13 type SuMoneyService struct { 15 type SuMoneyService struct {
14 } 16 }
15 17
  18 +// 返回素币事务记录
  19 +func (suMoneyService *SuMoneyService) GetSuMoneyTransactionRecord(getSuMoneyTransactionRecordQuery *query.GetSuMoneyTransactionRecordQuery) (interface{}, error) {
  20 + if err := getSuMoneyTransactionRecordQuery.ValidateQuery(); err != nil {
  21 + return nil, application.ThrowError(application.ARG_ERROR, err.Error())
  22 + }
  23 + transactionContext, err := factory.CreateTransactionContext(nil)
  24 + if err != nil {
  25 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  26 + }
  27 + if err := transactionContext.StartTransaction(); err != nil {
  28 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  29 + }
  30 + defer func() {
  31 + transactionContext.RollbackTransaction()
  32 + }()
  33 + var suMoneyTransactionRecordRepository domain.SuMoneyTransactionRecordRepository
  34 + if value, err := factory.CreateSuMoneyTransactionRecordRepository(map[string]interface{}{
  35 + "transactionContext": transactionContext,
  36 + }); err != nil {
  37 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  38 + } else {
  39 + suMoneyTransactionRecordRepository = value
  40 + }
  41 + if suMoneyTransactionRecord, err := suMoneyTransactionRecordRepository.FindOne(map[string]interface{}{"suMoneyTransactionRecordId": getSuMoneyTransactionRecordQuery.SuMoneyTransactionRecordId}); err != nil {
  42 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  43 + } else {
  44 + if err := transactionContext.CommitTransaction(); err != nil {
  45 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  46 + }
  47 + return suMoneyTransactionRecord, nil
  48 + }
  49 +}
  50 +
16 // 素币兑换 51 // 素币兑换
17 func (suMoneyService *SuMoneyService) ExchangeSuMoney(exchangeSuMoneyCommand *command.ExchangeSuMoneyCommand) (interface{}, error) { 52 func (suMoneyService *SuMoneyService) ExchangeSuMoney(exchangeSuMoneyCommand *command.ExchangeSuMoneyCommand) (interface{}, error) {
18 if err := exchangeSuMoneyCommand.ValidateCommand(); err != nil { 53 if err := exchangeSuMoneyCommand.ValidateCommand(); err != nil {
@@ -82,6 +117,39 @@ func (suMoneyService *SuMoneyService) SearchSuMoneyTransactionRecord(searchSuMon @@ -82,6 +117,39 @@ func (suMoneyService *SuMoneyService) SearchSuMoneyTransactionRecord(searchSuMon
82 } 117 }
83 } 118 }
84 119
  120 +// 素币事务记录统计
  121 +func (suMoneyService *SuMoneyService) SuMoneyTransactionRecordStatistics(suMoneyTransactionRecordStatisticsCommand *command.SuMoneyTransactionRecordStatisticsCommand) (interface{}, error) {
  122 + if err := suMoneyTransactionRecordStatisticsCommand.ValidateCommand(); err != nil {
  123 + return nil, application.ThrowError(application.ARG_ERROR, err.Error())
  124 + }
  125 + transactionContext, err := factory.CreateTransactionContext(nil)
  126 + if err != nil {
  127 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  128 + }
  129 + if err := transactionContext.StartTransaction(); err != nil {
  130 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  131 + }
  132 + defer func() {
  133 + transactionContext.RollbackTransaction()
  134 + }()
  135 + var employeeDao *dao.EmployeeDao
  136 + if value, err := factory.CreateEmployeeDao(map[string]interface{}{
  137 + "transactionContext": transactionContext,
  138 + }); err != nil {
  139 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  140 + } else {
  141 + employeeDao = value
  142 + }
  143 + if calculateResult, err := employeeDao.CalculateSuMoneyTransactionRecord(suMoneyTransactionRecordStatisticsCommand.Uid, suMoneyTransactionRecordStatisticsCommand.TransactionStartTime, suMoneyTransactionRecordStatisticsCommand.TransactionEndTime); err != nil {
  144 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  145 + } else {
  146 + if err := transactionContext.CommitTransaction(); err != nil {
  147 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  148 + }
  149 + return calculateResult, nil
  150 + }
  151 +}
  152 +
85 func NewSuMoneyService(options map[string]interface{}) *SuMoneyService { 153 func NewSuMoneyService(options map[string]interface{}) *SuMoneyService {
86 newSuMoneyService := &SuMoneyService{} 154 newSuMoneyService := &SuMoneyService{}
87 return newSuMoneyService 155 return newSuMoneyService
@@ -40,6 +40,35 @@ func (dao *EmployeeDao) CalculatePersonSuMoney(uid int64) (*domain.PersonSuMoney @@ -40,6 +40,35 @@ func (dao *EmployeeDao) CalculatePersonSuMoney(uid int64) (*domain.PersonSuMoney
40 } 40 }
41 } 41 }
42 42
  43 +func (dao *EmployeeDao) CalculateSuMoneyTransactionRecord(uid int64, transactionStartTime time.Time, transactionEndTime time.Time) (map[string]interface{}, error) {
  44 + tx := dao.transactionContext.PgTx
  45 + suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord)
  46 + var incomeSuMoney float64
  47 + var expendSuMoney float64
  48 + if err := tx.Model(suMoneyTransactionRecordModel).
  49 + ColumnExpr("sum(su_money_transaction_record.su_money) AS income_su_money").
  50 + Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid).
  51 + Where(`su_money_transaction_record.record_type = ?`, 2).
  52 + Where(`su_money_transaction_record.create_time > ?`, transactionStartTime).
  53 + Where(`su_money_transaction_record.create_time < ?`, transactionEndTime).
  54 + Select(&incomeSuMoney); err != nil {
  55 + return nil, err
  56 + }
  57 + if err := tx.Model(suMoneyTransactionRecordModel).
  58 + ColumnExpr("sum(su_money_transaction_record.su_money) AS expend_su_money").
  59 + Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid).
  60 + Where(`su_money_transaction_record.record_type = ?`, 1).
  61 + Where(`su_money_transaction_record.create_time > ?`, transactionStartTime).
  62 + Where(`su_money_transaction_record.create_time < ?`, transactionEndTime).
  63 + Select(&expendSuMoney); err != nil {
  64 + return nil, err
  65 + }
  66 + return map[string]interface{}{
  67 + "incomeSuMoney": incomeSuMoney,
  68 + "expendSuMoney": expendSuMoney,
  69 + }, nil
  70 +}
  71 +
43 func NewEmployeeDao(transactionContext *pgTransaction.TransactionContext) (*EmployeeDao, error) { 72 func NewEmployeeDao(transactionContext *pgTransaction.TransactionContext) (*EmployeeDao, error) {
44 if transactionContext == nil { 73 if transactionContext == nil {
45 return nil, fmt.Errorf("transactionContext参数不能为nil") 74 return nil, fmt.Errorf("transactionContext参数不能为nil")
@@ -6,6 +6,7 @@ import ( @@ -6,6 +6,7 @@ import (
6 "github.com/astaxie/beego" 6 "github.com/astaxie/beego"
7 "github.com/linmadan/egglib-go/web/beego/utils" 7 "github.com/linmadan/egglib-go/web/beego/utils"
8 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/command" 8 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/command"
  9 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/query"
9 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/service" 10 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/service"
10 ) 11 )
11 12
@@ -13,6 +14,22 @@ type SuMoneyController struct { @@ -13,6 +14,22 @@ type SuMoneyController struct {
13 beego.Controller 14 beego.Controller
14 } 15 }
15 16
  17 +func (controller *SuMoneyController) GetSuMoneyTransactionRecord() {
  18 + suMoneyService := service.NewSuMoneyService(nil)
  19 + getSuMoneyTransactionRecordQuery := &query.GetSuMoneyTransactionRecordQuery{}
  20 + suMoneyTransactionRecordId, _ := controller.GetInt64(":suMoneyTransactionRecordId")
  21 + getSuMoneyTransactionRecordQuery.SuMoneyTransactionRecordId = suMoneyTransactionRecordId
  22 + data, err := suMoneyService.GetSuMoneyTransactionRecord(getSuMoneyTransactionRecordQuery)
  23 + var response utils.JsonResponse
  24 + if err != nil {
  25 + response = utils.ResponseError(controller.Ctx, err)
  26 + } else {
  27 + response = utils.ResponseData(controller.Ctx, data)
  28 + }
  29 + controller.Data["json"] = response
  30 + controller.ServeJSON()
  31 +}
  32 +
16 func (controller *SuMoneyController) ExchangeSuMoney() { 33 func (controller *SuMoneyController) ExchangeSuMoney() {
17 suMoneyService := service.NewSuMoneyService(nil) 34 suMoneyService := service.NewSuMoneyService(nil)
18 exchangeSuMoneyCommand := &command.ExchangeSuMoneyCommand{} 35 exchangeSuMoneyCommand := &command.ExchangeSuMoneyCommand{}
@@ -42,3 +59,18 @@ func (controller *SuMoneyController) SearchSuMoneyTransactionRecord() { @@ -42,3 +59,18 @@ func (controller *SuMoneyController) SearchSuMoneyTransactionRecord() {
42 controller.Data["json"] = response 59 controller.Data["json"] = response
43 controller.ServeJSON() 60 controller.ServeJSON()
44 } 61 }
  62 +
  63 +func (controller *SuMoneyController) SuMoneyTransactionRecordStatistics() {
  64 + suMoneyService := service.NewSuMoneyService(nil)
  65 + suMoneyTransactionRecordStatisticsCommand := &command.SuMoneyTransactionRecordStatisticsCommand{}
  66 + json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), suMoneyTransactionRecordStatisticsCommand)
  67 + data, err := suMoneyService.SuMoneyTransactionRecordStatistics(suMoneyTransactionRecordStatisticsCommand)
  68 + var response utils.JsonResponse
  69 + if err != nil {
  70 + response = utils.ResponseError(controller.Ctx, err)
  71 + } else {
  72 + response = utils.ResponseData(controller.Ctx, data)
  73 + }
  74 + controller.Data["json"] = response
  75 + controller.ServeJSON()
  76 +}
@@ -6,6 +6,8 @@ import ( @@ -6,6 +6,8 @@ import (
6 ) 6 )
7 7
8 func init() { 8 func init() {
  9 + beego.Router("/su-money/su-money-transaction-records/:suMoneyTransactionRecordId", &controllers.SuMoneyController{}, "Get:GetSuMoneyTransactionRecord")
9 beego.Router("/su-money/exchange", &controllers.SuMoneyController{}, "Post:ExchangeSuMoney") 10 beego.Router("/su-money/exchange", &controllers.SuMoneyController{}, "Post:ExchangeSuMoney")
10 beego.Router("/su-money/search-su-money-transaction-record", &controllers.SuMoneyController{}, "Post:SearchSuMoneyTransactionRecord") 11 beego.Router("/su-money/search-su-money-transaction-record", &controllers.SuMoneyController{}, "Post:SearchSuMoneyTransactionRecord")
  12 + beego.Router("/su-money/su-money-transaction-record-statistics", &controllers.SuMoneyController{}, "Post:SuMoneyTransactionRecordStatistics")
11 } 13 }
  1 +package su_money
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
  5 + "net/http"
  6 + "time"
  7 +
  8 + "github.com/gavv/httpexpect"
  9 + "github.com/go-pg/pg"
  10 + . "github.com/onsi/ginkgo"
  11 + . "github.com/onsi/gomega"
  12 + pG "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/pg"
  13 +)
  14 +
  15 +var _ = Describe("返回素币事务记录", func() {
  16 + BeforeEach(func() {
  17 + _, err := pG.DB.QueryOne(
  18 + pg.Scan(),
  19 + "INSERT INTO su_money_transaction_records (id, record_type, employee, su_money, operator, record_description, create_time) VALUES (?, ?, ?, ?, ?, ?, ?)",
  20 + 1, 1, &domain.EmployeeInfo{
  21 + Uid: 2499036607974745088,
  22 + }, 100.00, &domain.EmployeeInfo{
  23 + Uid: 2499036607974745099,
  24 + }, "testRecordDescription", time.Now())
  25 + Expect(err).NotTo(HaveOccurred())
  26 + })
  27 + Describe("返回素币事务记录", func() {
  28 + Context("", func() {
  29 + It("", func() {
  30 + httpExpect := httpexpect.New(GinkgoT(), server.URL)
  31 + httpExpect.GET("/su-money/su-money-transaction-records/1").
  32 + Expect().
  33 + Status(http.StatusOK).
  34 + JSON().
  35 + Object().
  36 + ContainsKey("code").ValueEqual("code", 0).
  37 + ContainsKey("msg").ValueEqual("msg", "ok").
  38 + ContainsKey("data").Value("data").Object()
  39 + })
  40 + })
  41 + })
  42 + AfterEach(func() {
  43 + _, err := pG.DB.Exec("DELETE FROM su_money_transaction_records WHERE true")
  44 + Expect(err).NotTo(HaveOccurred())
  45 + })
  46 +})
  1 +package su_money
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
  5 + "net/http"
  6 + "time"
  7 +
  8 + "github.com/gavv/httpexpect"
  9 + "github.com/go-pg/pg"
  10 + . "github.com/onsi/ginkgo"
  11 + . "github.com/onsi/gomega"
  12 + pG "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/pg"
  13 +)
  14 +
  15 +var _ = Describe("素币事务记录统计", func() {
  16 + var suMoneyTransactionRecordId int64
  17 + BeforeEach(func() {
  18 + _, err := pG.DB.QueryOne(
  19 + pg.Scan(&suMoneyTransactionRecordId),
  20 + "INSERT INTO su_money_transaction_records (id, record_type, employee, su_money, operator, record_description, create_time) VALUES (?, ?, ?, ?, ?, ?, ?) RETURNING id",
  21 + 1, 1, &domain.EmployeeInfo{
  22 + Uid: 2499036607974745088,
  23 + }, 100.00, &domain.EmployeeInfo{
  24 + Uid: 2499036607974745099,
  25 + }, "testRecordDescription", time.Now())
  26 + Expect(err).NotTo(HaveOccurred())
  27 + })
  28 + Describe("素币事务记录统计", func() {
  29 + Context("", func() {
  30 + It("", func() {
  31 + httpExpect := httpexpect.New(GinkgoT(), server.URL)
  32 + body := map[string]interface{}{
  33 + "uid": 2499036607974745088,
  34 + "transactionStartTime": time.Date(2020, time.Month(4), 5, 8, 0, 0, 0, time.Now().Location()),
  35 + "transactionEndTime": time.Date(2030, time.Month(4), 5, 8, 0, 0, 0, time.Now().Location()),
  36 + }
  37 + httpExpect.POST("/su-money/su-money-transaction-record-statistics").
  38 + WithJSON(body).
  39 + Expect().
  40 + Status(http.StatusOK).
  41 + JSON().
  42 + Object().
  43 + ContainsKey("code").ValueEqual("code", 0).
  44 + ContainsKey("msg").ValueEqual("msg", "ok").
  45 + ContainsKey("data").Value("data").Object()
  46 + })
  47 + })
  48 + })
  49 + AfterEach(func() {
  50 + _, err := pG.DB.Exec("DELETE FROM su_money_transaction_records WHERE true")
  51 + Expect(err).NotTo(HaveOccurred())
  52 + })
  53 +})