|
@@ -1,37 +1,26 @@
|
|
|
package com.ym.mec.web.controller.education;
|
|
|
|
|
|
-import io.swagger.annotations.Api;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
-
|
|
|
-import java.math.BigDecimal;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-
|
|
|
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.CooperationOrganDao;
|
|
|
-import com.ym.mec.biz.dal.dao.EmployeeDao;
|
|
|
-import com.ym.mec.biz.dal.dao.MusicGroupDao;
|
|
|
-import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
|
|
|
-import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
|
|
|
-import com.ym.mec.biz.dal.dao.StudentPreRegistrationDao;
|
|
|
-import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
|
|
|
+import com.ym.mec.biz.dal.dao.*;
|
|
|
import com.ym.mec.biz.dal.dto.Mapper;
|
|
|
import com.ym.mec.biz.dal.dto.MusicGroupRegAndMoneyDto;
|
|
|
import com.ym.mec.biz.dal.entity.CooperationOrgan;
|
|
|
-import com.ym.mec.biz.dal.entity.Employee;
|
|
|
-import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
|
|
|
+import com.ym.mec.biz.dal.enums.SysUserRoleEnum;
|
|
|
+import com.ym.mec.biz.service.OrganizationService;
|
|
|
+import com.ym.mec.biz.service.SysEmployeePositionService;
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
|
import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
import com.ym.mec.common.tenant.TenantContextHolder;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@RequestMapping("eduRegister")
|
|
|
@Api(tags = "乐团报名回款统计(教务端)")
|
|
@@ -47,40 +36,28 @@ public class EduRegisterController extends BaseController {
|
|
|
@Autowired
|
|
|
private StudentRegistrationDao studentRegistrationDao;
|
|
|
@Autowired
|
|
|
- private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
|
|
|
- @Autowired
|
|
|
private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
|
|
|
@Autowired
|
|
|
private StudentPaymentOrderDao studentPaymentOrderDao;
|
|
|
@Autowired
|
|
|
- private EmployeeDao employeeDao;
|
|
|
- @Autowired
|
|
|
private CooperationOrganDao cooperationOrganDao;
|
|
|
+ @Autowired
|
|
|
+ private SysEmployeePositionService employeePositionService;
|
|
|
+ @Autowired
|
|
|
+ private OrganizationService organizationService;
|
|
|
|
|
|
@ApiOperation(value = "获取分部报名、回款统计")
|
|
|
@GetMapping("/getRegAndMoney")
|
|
|
public HttpResponseResult<List<MusicGroupRegAndMoneyDto>> getRegAndMoney(String organId, String musicGroupName) {
|
|
|
- String organIds = null;
|
|
|
SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
if (sysUser == null) {
|
|
|
return failed("用户信息获取失败");
|
|
|
}
|
|
|
- Employee employee = employeeDao.get(sysUser.getId());
|
|
|
- if (StringUtils.isEmpty(organId)) {
|
|
|
- organIds = employee.getOrganIdList();
|
|
|
- } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
|
|
|
- return failed("用户所在分部异常");
|
|
|
- } else {
|
|
|
- List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
|
|
|
- if (!list.containsAll(Arrays.asList(organId.split(",")))) {
|
|
|
- return failed("非法请求");
|
|
|
- }
|
|
|
- organIds = organId;
|
|
|
- }
|
|
|
+ organId = organizationService.getEmployeeOrgan(sysUser.getId(), organId, sysUser.getIsSuperAdmin());
|
|
|
//是乐团主管,不是分部经理
|
|
|
List<Integer> cooperationOrganIds = null;
|
|
|
- List<Integer> userRole = employeeDao.queryUserRole(sysUser.getId());
|
|
|
- if (!sysUser.getIsSuperAdmin() && !userRole.contains(SysUserRole.SECTION_MANAGER)) {
|
|
|
+ Boolean onlyForRole = employeePositionService.onlyForRole(SysUserRoleEnum.EDUCATION, sysUser.getId(), sysUser.getIsSuperAdmin());
|
|
|
+ if (onlyForRole) {
|
|
|
List<CooperationOrgan> cooperationOrgans = cooperationOrganDao.getCooperationOrganByEduTeacherId(sysUser.getId());
|
|
|
if (cooperationOrgans.size() > 0) {
|
|
|
cooperationOrganIds = cooperationOrgans.stream().map(CooperationOrgan::getId).collect(Collectors.toList());
|
|
@@ -89,7 +66,7 @@ public class EduRegisterController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- List<MusicGroupRegAndMoneyDto> musicGroups = musicGroupDao.getMusicGroupByStatus(organIds, cooperationOrganIds, musicGroupName, TenantContextHolder.getTenantId());
|
|
|
+ List<MusicGroupRegAndMoneyDto> musicGroups = musicGroupDao.getMusicGroupByStatus(organId, cooperationOrganIds, musicGroupName, TenantContextHolder.getTenantId());
|
|
|
if (musicGroups.size() <= 0) {
|
|
|
return succeed();
|
|
|
}
|