|
|
@@ -3,7 +3,13 @@ package com.ym.mec.web.controller;
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.biz.dal.dao.EmployeeDao;
|
|
|
+import com.ym.mec.biz.dal.dao.TeacherDao;
|
|
|
+import com.ym.mec.biz.dal.dto.PracticeGroupApplyBaseInfoDto;
|
|
|
+import com.ym.mec.biz.dal.dto.PracticeGroupApplyDto;
|
|
|
+import com.ym.mec.biz.dal.dto.VipGroupApplyBaseInfoDto;
|
|
|
+import com.ym.mec.biz.dal.dto.VipGroupApplyDto;
|
|
|
import com.ym.mec.biz.dal.entity.Employee;
|
|
|
+import com.ym.mec.biz.dal.entity.Teacher;
|
|
|
import com.ym.mec.biz.dal.enums.GroupType;
|
|
|
import com.ym.mec.biz.dal.page.PracticeGroupQueryInfo;
|
|
|
import com.ym.mec.biz.dal.page.StudentBuyPracticeQueryInfo;
|
|
|
@@ -17,14 +23,13 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
/**
|
|
|
* @Author Joburgess
|
|
|
@@ -45,6 +50,8 @@ public class PracticeGroupManageController extends BaseController {
|
|
|
private GroupClassService groupService;
|
|
|
@Autowired
|
|
|
private CourseScheduleEvaluateService courseScheduleEvaluateService;
|
|
|
+ @Autowired
|
|
|
+ private TeacherDao teacherDao;
|
|
|
|
|
|
@ApiOperation(value = "全查询")
|
|
|
@GetMapping("/queryAll")
|
|
|
@@ -54,17 +61,17 @@ public class PracticeGroupManageController extends BaseController {
|
|
|
if (sysUser == null) {
|
|
|
return failed("用户信息获取失败");
|
|
|
}
|
|
|
- Employee employee = employeeDao.get(sysUser.getId());
|
|
|
- if (StringUtils.isEmpty(queryInfo.getOrganId())) {
|
|
|
- queryInfo.setOrganId(employee.getOrganIdList());
|
|
|
- } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
|
|
|
- return failed("用户所在分部异常");
|
|
|
- } else {
|
|
|
- List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
|
|
|
- if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
|
|
|
- return failed("非法请求");
|
|
|
- }
|
|
|
+ Employee employee = employeeDao.get(sysUser.getId());
|
|
|
+ if (StringUtils.isEmpty(queryInfo.getOrganId())) {
|
|
|
+ queryInfo.setOrganId(employee.getOrganIdList());
|
|
|
+ } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
|
|
|
+ return failed("用户所在分部异常");
|
|
|
+ } else {
|
|
|
+ List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
|
|
|
+ if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
|
|
|
+ return failed("非法请求");
|
|
|
}
|
|
|
+ }
|
|
|
return succeed(practiceGroupService.findPracticeGroups(queryInfo));
|
|
|
}
|
|
|
|
|
|
@@ -155,4 +162,37 @@ public class PracticeGroupManageController extends BaseController {
|
|
|
}
|
|
|
return succeed(practiceGroupService.studentBuys(queryInfo));
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation("课酬总费用")
|
|
|
+ @PostMapping("/getPracticeGroupCostCount")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('practiceGroupManage/getPracticeGroupCostCount')")
|
|
|
+ public Object getPracticeGroupCostCount(@RequestBody PracticeGroupApplyBaseInfoDto practice){
|
|
|
+ Map results = practiceGroupService.countPracticeGroupPredictFee(practice,practice.getUserId(), null);
|
|
|
+ return succeed(results);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "网管课申请")
|
|
|
+ @PostMapping("/practiceGroupApply")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('practiceGroupManage/practiceGroupApply')")
|
|
|
+ public Object vipGroupApply(@RequestBody PracticeGroupApplyDto practiceGroupApplyDto){
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (sysUser == null) {
|
|
|
+ return failed("用户信息获取失败");
|
|
|
+ }
|
|
|
+ PracticeGroupApplyBaseInfoDto applyBaseInfoDto = practiceGroupApplyDto.getPracticeGroupApplyBaseInfoDto();
|
|
|
+ Integer userId = applyBaseInfoDto.getUserId();
|
|
|
+ Teacher teacher = teacherDao.get(userId);
|
|
|
+ if(Objects.isNull(teacher)){
|
|
|
+ return failed("请指定指导老师!");
|
|
|
+ }
|
|
|
+ if(Objects.isNull(applyBaseInfoDto.getOrganId())){
|
|
|
+ Integer firstStudentId = applyBaseInfoDto.getFirstStudentId();
|
|
|
+ SysUser student = teacherDao.getUser(firstStudentId);
|
|
|
+ if(Objects.isNull(student)||Objects.isNull(student.getOrganId())){
|
|
|
+ return failed("学员信息异常");
|
|
|
+ }
|
|
|
+ applyBaseInfoDto.setOrganId(student.getOrganId());
|
|
|
+ }
|
|
|
+ return practiceGroupService.createPracticeGroup(practiceGroupApplyDto);
|
|
|
+ }
|
|
|
}
|