Ver código fonte

部门画像--部门画像--能力画像头部

wangxx 3 semanas atrás
pai
commit
4f6592fb83

+ 26 - 0
airport-admin/src/main/java/com/sundot/airport/web/controller/score/DeptPortraitController.java

@@ -214,4 +214,30 @@ public class DeptPortraitController extends BaseController {
214 214
             return error("获取站团队画像统计失败:" + e.getMessage());
215 215
         }
216 216
     }
217
+
218
+
219
+    @ApiOperation("获取部门的团队画像统计")
220
+    @PostMapping("/team-stats")
221
+    public AjaxResult getTeamStats(@RequestBody DeptPortraitQueryDTO query) {
222
+        try {
223
+            // 参数校验
224
+            if (query == null || query.getDeptId() == null) {
225
+                return error("部门ID不能为空");
226
+            }
227
+
228
+            // 如果没有传日期范围,则默认为91天
229
+            if (query.getStartDate() == null || query.getEndDate() == null) {
230
+                java.time.LocalDate today = java.time.LocalDate.now();
231
+                query.setEndDate(today.toString());
232
+                query.setStartDate(today.minusDays(91).toString());
233
+            }
234
+
235
+            StationTeamStatsDTO stats = deptPortraitService.getTeamStats(query);
236
+
237
+            return success(stats);
238
+        } catch (Exception e) {
239
+            logger.error("获取团队画像统计失败", e);
240
+            return error("获取团队画像统计失败:" + e.getMessage());
241
+        }
242
+    }
217 243
 }

+ 7 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/service/IDeptPortraitService.java

@@ -68,4 +68,11 @@ public interface IDeptPortraitService {
68 68
      * @return 站下各部门的团队画像统计列表
69 69
      */
70 70
     List<StationTeamStatsDTO> getStationTeamStats(DeptPortraitQueryDTO query);
71
+
72
+    /**
73
+     * 获取部门下的团队画像统计
74
+     * @param query
75
+     * @return
76
+     */
77
+    StationTeamStatsDTO getTeamStats(DeptPortraitQueryDTO query);
71 78
 }

+ 10 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/service/impl/DeptPortraitServiceImpl.java

@@ -4,6 +4,7 @@ import com.sundot.airport.common.core.domain.entity.SysRole;
4 4
 import com.sundot.airport.common.core.domain.entity.SysUser;
5 5
 import com.sundot.airport.common.core.domain.entity.SysDept;
6 6
 import com.sundot.airport.common.enums.DeptTypeEnum;
7
+import com.sundot.airport.common.exception.ServiceException;
7 8
 import com.sundot.airport.ledger.domain.ScoreDimension;
8 9
 import com.sundot.airport.ledger.domain.ScoreEvent;
9 10
 import com.sundot.airport.ledger.dto.DeptMemberDistributionDTO;
@@ -402,6 +403,15 @@ public class DeptPortraitServiceImpl implements IDeptPortraitService {
402 403
         return result;
403 404
     }
404 405
 
406
+    @Override
407
+    public StationTeamStatsDTO getTeamStats(DeptPortraitQueryDTO query) {
408
+        SysDept sysDept = sysDeptMapper.selectDeptById(query.getDeptId());
409
+        if (sysDept == null) {
410
+            throw new ServiceException("部门不存在");
411
+        }
412
+        return calculateDeptStats(sysDept, query.getStartDate(), query.getEndDate());
413
+    }
414
+
405 415
     /**
406 416
      * 计算单个部门的团队画像统计信息
407 417
      */