|
@@ -1,6 +1,16 @@
|
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
+import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
+import com.ym.mec.auth.api.entity.SysUser;
|
|
|
+import com.ym.mec.auth.api.entity.SysUserRole;
|
|
|
+import com.ym.mec.biz.dal.dao.EmployeeDao;
|
|
|
+import com.ym.mec.biz.dal.entity.Employee;
|
|
|
+import com.ym.mec.biz.dal.page.MusicGroupPerformanceQueryInfo;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
+import com.ym.mec.common.exception.BizException;
|
|
|
+import com.ym.mec.common.page.PageInfo;
|
|
|
+import com.ym.mec.util.collection.MapUtil;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.biz.dal.entity.MusicGroupPerformance;
|
|
@@ -8,15 +18,64 @@ import com.ym.mec.biz.service.MusicGroupPerformanceService;
|
|
|
import com.ym.mec.biz.dal.dao.MusicGroupPerformanceDao;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
@Service
|
|
|
public class MusicGroupPerformanceServiceImpl extends BaseServiceImpl<Integer, MusicGroupPerformance> implements MusicGroupPerformanceService {
|
|
|
|
|
|
@Autowired
|
|
|
private MusicGroupPerformanceDao musicGroupPerformanceDao;
|
|
|
+ @Autowired
|
|
|
+ private SysUserFeignService sysUserFeignService;
|
|
|
+ @Autowired
|
|
|
+ private EmployeeDao employeeDao;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Integer, MusicGroupPerformance> getDAO() {
|
|
|
return musicGroupPerformanceDao;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Object queryNoStartPage(MusicGroupPerformanceQueryInfo queryInfo) {
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (sysUser == null) {
|
|
|
+ throw new BizException("用户信息获取失败");
|
|
|
+ }
|
|
|
+ Employee employee = employeeDao.get(sysUser.getId());
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isEmpty(queryInfo.getOrganId())) {
|
|
|
+ queryInfo.setOrganId(employee.getOrganIdList());
|
|
|
+ } else if (org.apache.commons.lang3.StringUtils.isEmpty(employee.getOrganIdList())) {
|
|
|
+ throw new BizException("用户所在分部异常");
|
|
|
+ } else {
|
|
|
+ List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
|
|
|
+ if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
|
|
|
+ throw new BizException("非法请求");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //当前用户是否是分部经理
|
|
|
+ List<Integer> userRole = employeeDao.queryUserRole(sysUser.getId());
|
|
|
+ Integer educationUserId = null;
|
|
|
+ if (!sysUser.getIsSuperAdmin() && userRole.size() == 1 && userRole.contains(SysUserRole.EDUCATIONAL_TEACHER)) {
|
|
|
+ //获取教务老师关联的班级列表
|
|
|
+ educationUserId = sysUser.getId();
|
|
|
+ }
|
|
|
+ PageInfo<MusicGroupPerformance> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
|
|
|
+ Map<String, Object> params = new HashMap<String, Object>();
|
|
|
+ MapUtil.populateMap(params, queryInfo);
|
|
|
+ params.put("educationUserId",educationUserId);
|
|
|
+
|
|
|
+ List<MusicGroupPerformance> dataList = null;
|
|
|
+ int count = musicGroupPerformanceDao.countNoStart(params);
|
|
|
+ if (count > 0) {
|
|
|
+ pageInfo.setTotal(count);
|
|
|
+ params.put("offset", pageInfo.getOffset());
|
|
|
+ dataList = musicGroupPerformanceDao.queryNoStart(params);
|
|
|
+ }
|
|
|
+ if (count == 0) {
|
|
|
+ dataList = new ArrayList<>();
|
|
|
+ }
|
|
|
+ pageInfo.setRows(dataList);
|
|
|
+ return pageInfo;
|
|
|
+ }
|
|
|
}
|