|
|
@@ -999,4 +999,51 @@ public class SysLearningGrowthServiceImpl implements ISysLearningGrowthService {
|
|
999
|
999
|
List<SysLargeScreenLearningGrowthOrganizationalSupportDto> result = sysLearningGrowthMapper.organizationalSupport(dto);
|
|
1000
|
1000
|
return result;
|
|
1001
|
1001
|
}
|
|
|
1002
|
+
|
|
|
1003
|
+ /**
|
|
|
1004
|
+ * 首页-学习成长-平均分
|
|
|
1005
|
+ *
|
|
|
1006
|
+ * @param dto 上行参数
|
|
|
1007
|
+ * @return 首页-学习成长-平均分
|
|
|
1008
|
+ */
|
|
|
1009
|
+ @Override
|
|
|
1010
|
+ public BigDecimal learningGrowthAverage(BaseLargeScreenQueryParamDto dto) {
|
|
|
1011
|
+ if (ObjUtil.isNull(dto.getUserId()) && ObjUtil.isNull(dto.getDeptId())) {
|
|
|
1012
|
+ throw new ServiceException("用户ID和部门ID不能同时为空");
|
|
|
1013
|
+ }
|
|
|
1014
|
+ // 默认筛选条件
|
|
|
1015
|
+ if (ObjUtil.isNull(dto.getStartDate()) && ObjUtil.isNull(dto.getEndDate()) && ObjUtil.isNull(dto.getSpecifiedDate())) {
|
|
|
1016
|
+ dto.setEndDate(LargeScreenDateUtils.getCurrentDate());
|
|
|
1017
|
+ dto.setStartDate(LargeScreenDateUtils.getDateBeforeYears(1));
|
|
|
1018
|
+ }
|
|
|
1019
|
+ SysLargeScreenLearningGrowthQueryParamDto tempQueryParam = new SysLargeScreenLearningGrowthQueryParamDto();
|
|
|
1020
|
+ tempQueryParam.setSpecifiedDate(dto.getSpecifiedDate());
|
|
|
1021
|
+ tempQueryParam.setStartDate(dto.getStartDate());
|
|
|
1022
|
+ tempQueryParam.setEndDate(dto.getEndDate());
|
|
|
1023
|
+ if (ObjUtil.isNotNull(dto.getUserId())) {
|
|
|
1024
|
+ tempQueryParam.setUserId(dto.getUserId());
|
|
|
1025
|
+ } else {
|
|
|
1026
|
+ SysDept sysDept = sysDeptService.selectDeptById(dto.getDeptId());
|
|
|
1027
|
+ if (ObjUtil.isNull(sysDept)) {
|
|
|
1028
|
+ throw new ServiceException("部门不存在");
|
|
|
1029
|
+ }
|
|
|
1030
|
+ if (StrUtil.equals(DeptTypeEnum.STATION.getCode(), sysDept.getDeptType())) {
|
|
|
1031
|
+ tempQueryParam.setStationId(sysDept.getDeptId());
|
|
|
1032
|
+ } else if (StrUtil.equals(DeptTypeEnum.BRIGADE.getCode(), sysDept.getDeptType())) {
|
|
|
1033
|
+ tempQueryParam.setBrigadeId(sysDept.getDeptId());
|
|
|
1034
|
+ } else if (StrUtil.equals(DeptTypeEnum.MANAGER.getCode(), sysDept.getDeptType())) {
|
|
|
1035
|
+ tempQueryParam.setDepartmentId(sysDept.getDeptId());
|
|
|
1036
|
+ } else if (StrUtil.equals(DeptTypeEnum.TEAMS.getCode(), sysDept.getDeptType())) {
|
|
|
1037
|
+ tempQueryParam.setTeamId(sysDept.getDeptId());
|
|
|
1038
|
+ } else {
|
|
|
1039
|
+ return BigDecimal.ZERO;
|
|
|
1040
|
+ }
|
|
|
1041
|
+ }
|
|
|
1042
|
+ List<SysLargeScreenLearningGrowthSqlDto> target = sysLearningGrowthMapper.selectSysLearningGrowthListByCondition(tempQueryParam);
|
|
|
1043
|
+ if (CollUtil.isEmpty(target)) {
|
|
|
1044
|
+ return BigDecimal.ZERO;
|
|
|
1045
|
+ }
|
|
|
1046
|
+ BigDecimal sum = target.stream().map(SysLargeScreenLearningGrowthSqlDto::getExamScore).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
1047
|
+ return sum.divide(BigDecimal.valueOf(target.size()), 2, RoundingMode.HALF_UP);
|
|
|
1048
|
+ }
|
|
1002
|
1049
|
}
|