|
|
@@ -12,6 +12,8 @@ import com.sundot.airport.ledger.service.IGroupPortraitService;
|
|
12
|
12
|
import io.swagger.annotations.Api;
|
|
13
|
13
|
import io.swagger.annotations.ApiOperation;
|
|
14
|
14
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
15
|
+import org.springframework.cache.annotation.CacheEvict;
|
|
|
16
|
+import org.springframework.cache.annotation.Cacheable;
|
|
15
|
17
|
import org.springframework.web.bind.annotation.*;
|
|
16
|
18
|
|
|
17
|
19
|
import java.util.List;
|
|
|
@@ -46,6 +48,7 @@ public class DeptPortraitController extends BaseController {
|
|
46
|
48
|
*/
|
|
47
|
49
|
@ApiOperation("获取部门内所有成员列表")
|
|
48
|
50
|
@PostMapping("/members")
|
|
|
51
|
+ @Cacheable(value = "dept:members", key = "#query.deptId + ':' + (#query.startDate ?: 'default') + ':' + (#query.endDate ?: 'default')")
|
|
49
|
52
|
public AjaxResult getDeptMembers(@RequestBody DeptPortraitQueryDTO query) {
|
|
50
|
53
|
try {
|
|
51
|
54
|
// 参数校验
|
|
|
@@ -83,6 +86,7 @@ public class DeptPortraitController extends BaseController {
|
|
83
|
86
|
*/
|
|
84
|
87
|
@ApiOperation("获取部门成员基本情况分布")
|
|
85
|
88
|
@PostMapping("/distribution")
|
|
|
89
|
+ @Cacheable(value = "dept:distribution", key = "#query.deptId + ':' + (#query.startDate ?: 'default') + ':' + (#query.endDate ?: 'default')")
|
|
86
|
90
|
public AjaxResult getMemberDistribution(@RequestBody DeptPortraitQueryDTO query) {
|
|
87
|
91
|
try {
|
|
88
|
92
|
// 参数校验
|
|
|
@@ -120,6 +124,7 @@ public class DeptPortraitController extends BaseController {
|
|
120
|
124
|
*/
|
|
121
|
125
|
@ApiOperation("获取部门成员职位情况分布")
|
|
122
|
126
|
@PostMapping("/position-distribution")
|
|
|
127
|
+ @Cacheable(value = "dept:position", key = "#query.deptId + ':' + (#query.startDate ?: 'default') + ':' + (#query.endDate ?: 'default')")
|
|
123
|
128
|
public AjaxResult getPositionDistribution(@RequestBody DeptPortraitQueryDTO query) {
|
|
124
|
129
|
try {
|
|
125
|
130
|
// 参数校验
|
|
|
@@ -156,6 +161,7 @@ public class DeptPortraitController extends BaseController {
|
|
156
|
161
|
*/
|
|
157
|
162
|
@ApiOperation("维度得分一览")
|
|
158
|
163
|
@PostMapping("/group-portrait")
|
|
|
164
|
+ @Cacheable(value = "portrait", key = "#query.deptId + ':' + (#query.startDate ?: 'default') + ':' + (#query.endDate ?: 'default')")
|
|
159
|
165
|
public AjaxResult getGroupPortrait(@RequestBody DeptPortraitQueryDTO query) {
|
|
160
|
166
|
try {
|
|
161
|
167
|
// 参数校验
|
|
|
@@ -180,6 +186,21 @@ public class DeptPortraitController extends BaseController {
|
|
180
|
186
|
}
|
|
181
|
187
|
|
|
182
|
188
|
/**
|
|
|
189
|
+ * 清空所有画像相关缓存
|
|
|
190
|
+ * <p>
|
|
|
191
|
+ * 当录入新的事件数据后,调用此接口清空缓存,确保下次查询时重新计算
|
|
|
192
|
+ * </p>
|
|
|
193
|
+ *
|
|
|
194
|
+ * @return 操作结果
|
|
|
195
|
+ */
|
|
|
196
|
+ @ApiOperation("清空所有画像缓存")
|
|
|
197
|
+ @PostMapping("/clear-cache")
|
|
|
198
|
+ @CacheEvict(value = {"dept:members", "dept:distribution", "dept:position", "portrait"}, allEntries = true)
|
|
|
199
|
+ public AjaxResult clearPortraitCache() {
|
|
|
200
|
+ return success("缓存已清空");
|
|
|
201
|
+ }
|
|
|
202
|
+
|
|
|
203
|
+ /**
|
|
183
|
204
|
* 获取站级别下所有部门的团队画像统计
|
|
184
|
205
|
* <p>
|
|
185
|
206
|
* 展示站下各部门的:
|
|
|
@@ -192,6 +213,7 @@ public class DeptPortraitController extends BaseController {
|
|
192
|
213
|
*/
|
|
193
|
214
|
@ApiOperation("获取站级别下所有部门的团队画像统计")
|
|
194
|
215
|
@PostMapping("/station-team-stats")
|
|
|
216
|
+ @Cacheable(value = "station:stats", key = "#query.deptId + ':' + (#query.startDate ?: 'default') + ':' + (#query.endDate ?: 'default')")
|
|
195
|
217
|
public AjaxResult getStationTeamStats(@RequestBody DeptPortraitQueryDTO query) {
|
|
196
|
218
|
try {
|
|
197
|
219
|
// 参数校验
|
|
|
@@ -218,6 +240,7 @@ public class DeptPortraitController extends BaseController {
|
|
218
|
240
|
|
|
219
|
241
|
@ApiOperation("获取部门的团队画像统计")
|
|
220
|
242
|
@PostMapping("/team-stats")
|
|
|
243
|
+ @Cacheable(value = "team:stats", key = "#query.deptId + ':' + (#query.startDate ?: 'default') + ':' + (#query.endDate ?: 'default')")
|
|
221
|
244
|
public AjaxResult getTeamStats(@RequestBody DeptPortraitQueryDTO query) {
|
|
222
|
245
|
try {
|
|
223
|
246
|
// 参数校验
|