|
@@ -1,7 +1,6 @@
|
|
|
package com.ym.mec.web.controller.education;
|
|
|
|
|
|
|
|
|
-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.StudentInstrumentDao;
|
|
@@ -14,7 +13,6 @@ import com.ym.mec.biz.dal.page.*;
|
|
|
import com.ym.mec.biz.service.*;
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
|
import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
-import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.page.PageInfo;
|
|
|
import com.ym.mec.common.page.QueryInfo;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
@@ -36,7 +34,7 @@ import java.util.Objects;
|
|
|
public class EduRepairController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
- private SysUserFeignService sysUserFeignService;
|
|
|
+ private SysUserService sysUserService;
|
|
|
@Autowired
|
|
|
private EmployeeDao employeeDao;
|
|
|
@Autowired
|
|
@@ -59,15 +57,12 @@ public class EduRepairController extends BaseController {
|
|
|
@ApiOperation("获取学生列表")
|
|
|
@GetMapping(value = "/getStudents")
|
|
|
public HttpResponseResult<PageInfo<BasicUserDto>> getStudents(RepairStudentQueryInfo queryInfo) {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if (sysUser == null) {
|
|
|
- return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
- }
|
|
|
- Employee employee = employeeDao.get(sysUser.getId());
|
|
|
+ Integer userId = sysUserService.getUserId();
|
|
|
+ Employee employee = employeeDao.get(userId);
|
|
|
if (Objects.isNull(employee)) {
|
|
|
return failed(HttpStatus.NOT_ACCEPTABLE, "员工信息不存在");
|
|
|
}
|
|
|
- queryInfo.setEmployeeId(sysUser.getId());
|
|
|
+ queryInfo.setEmployeeId(userId);
|
|
|
queryInfo.setOrganIdList(employee.getOrganIdList());
|
|
|
return succeed(studentRepairService.getStudents(queryInfo));
|
|
|
}
|
|
@@ -81,10 +76,6 @@ public class EduRepairController extends BaseController {
|
|
|
@ApiOperation("添加商品销售订单")
|
|
|
@PostMapping(value = "/addGoodsSellOrder")
|
|
|
public HttpResponseResult addGoodsSellOrder(@RequestBody StudentGoodsSell studentGoodsSell) throws Exception {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if (sysUser == null) {
|
|
|
- throw new BizException("请登录");
|
|
|
- }
|
|
|
if (studentGoodsSell.getIsRepeatPay() == false) {
|
|
|
List<StudentPaymentOrder> list = studentPaymentOrderService.queryByCondition(GroupType.GOODS_SELL, null,studentGoodsSell.getUserId(), DealStatusEnum.ING,
|
|
|
OrderTypeEnum.RENEW);
|
|
@@ -92,8 +83,9 @@ public class EduRepairController extends BaseController {
|
|
|
return failed(HttpStatus.CONTINUE, "该学员有待支付的订单");
|
|
|
}
|
|
|
}
|
|
|
- studentGoodsSell.setTeacherId(sysUser.getId());
|
|
|
- studentGoodsSell.setAuthorUser(sysUser.getId());
|
|
|
+ Integer userId = sysUserService.getUserId();
|
|
|
+ studentGoodsSell.setTeacherId(userId);
|
|
|
+ studentGoodsSell.setAuthorUser(userId);
|
|
|
Map map = studentRepairService.addGoodsSellOrder(studentGoodsSell);
|
|
|
if(map.containsKey("tradeState")){
|
|
|
return failed(HttpStatus.CREATED, map,"恭喜您,购买成功!");
|
|
@@ -104,10 +96,7 @@ public class EduRepairController extends BaseController {
|
|
|
@ApiOperation("添加维修单")
|
|
|
@PostMapping(value = "/addRepair")
|
|
|
public HttpResponseResult addRepair(@RequestBody StudentRepair repairInfo) throws Exception {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if (sysUser == null) {
|
|
|
- return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
- }
|
|
|
+ SysUser sysUser = sysUserService.getUser();
|
|
|
repairInfo.setEmployeeId(sysUser.getId());
|
|
|
repairInfo.setEmployeeName(sysUser.getRealName());
|
|
|
// if(repairInfo.getSendType().equals(1)){
|
|
@@ -122,11 +111,7 @@ public class EduRepairController extends BaseController {
|
|
|
@ApiOperation("获取学生的维修记录")
|
|
|
@GetMapping(value = "/getStudentRepairList")
|
|
|
public HttpResponseResult getStudentRepairList(RepairStudentQueryInfo queryInfo) {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if (sysUser == null) {
|
|
|
- return failed("用户信息获取失败");
|
|
|
- }
|
|
|
- queryInfo.setEmployeeId(sysUser.getId());
|
|
|
+ queryInfo.setEmployeeId(sysUserService.getUserId());
|
|
|
queryInfo.setPayStatus(2);
|
|
|
return succeed(studentRepairService.queryPage(queryInfo));
|
|
|
}
|
|
@@ -134,30 +119,18 @@ public class EduRepairController extends BaseController {
|
|
|
@ApiOperation("获取乐器种类")
|
|
|
@GetMapping(value = "/findSubSubjects")
|
|
|
public HttpResponseResult findSubSubjects() {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if (sysUser == null) {
|
|
|
- return failed("用户信息获取失败");
|
|
|
- }
|
|
|
return succeed(subjectService.findSubSubjects( null));
|
|
|
}
|
|
|
|
|
|
@ApiOperation("获取学生信息")
|
|
|
@GetMapping(value = "/getStudentInfo")
|
|
|
public HttpResponseResult getStudentInfo(Integer studentId) {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if (sysUser == null) {
|
|
|
- return failed("用户信息获取失败");
|
|
|
- }
|
|
|
return succeed(studentRepairService.getStudentInfo(studentId));
|
|
|
}
|
|
|
|
|
|
@ApiOperation("获取维修记录详情")
|
|
|
@GetMapping(value = "/getRepairInfo")
|
|
|
public HttpResponseResult getRepairInfo(Integer id) {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if (sysUser == null) {
|
|
|
- return failed("用户信息获取失败");
|
|
|
- }
|
|
|
return succeed(studentRepairService.getRepairInfo(id));
|
|
|
}
|
|
|
|
|
@@ -165,11 +138,7 @@ public class EduRepairController extends BaseController {
|
|
|
@ApiOperation("获取维修列表")
|
|
|
@GetMapping(value = "/queryPage")
|
|
|
public HttpResponseResult queryPage(RepairStudentQueryInfo queryInfo) {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if (sysUser == null) {
|
|
|
- return failed("用户信息获取失败");
|
|
|
- }
|
|
|
- queryInfo.setEmployeeId(sysUser.getId());
|
|
|
+ queryInfo.setEmployeeId(sysUserService.getUserId());
|
|
|
Date endTime = queryInfo.getEndTime();
|
|
|
if(endTime != null){
|
|
|
queryInfo.setEndTime(DateUtil.addDays(endTime, 1));
|
|
@@ -190,11 +159,7 @@ public class EduRepairController extends BaseController {
|
|
|
@GetMapping("/queryGoodsPage")
|
|
|
public Object queryPage(GoodsQueryInfo queryInfo){
|
|
|
queryInfo.setOrganId(null);
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if (sysUser == null) {
|
|
|
- return failed("用户信息获取失败");
|
|
|
- }
|
|
|
- Employee employee = employeeDao.get(sysUser.getId());
|
|
|
+ Employee employee = employeeDao.get(sysUserService.getUserId());
|
|
|
if (queryInfo.getStudentShowOrganId() == null &&
|
|
|
queryInfo.getEducationShowOrganId() == null &&
|
|
|
queryInfo.getCourseFeeShowOrganId() == null &&
|
|
@@ -216,11 +181,7 @@ public class EduRepairController extends BaseController {
|
|
|
@ApiOperation(value = "分页查询教务老师关联的学员商品订单")
|
|
|
@GetMapping("/queryStudentGoodsOrders")
|
|
|
public Object queryStudentGoodsOrders(GoodsSellQueryInfo queryInfo) {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if (sysUser == null) {
|
|
|
- return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
- }
|
|
|
- queryInfo.setTeacherId(sysUser.getId());
|
|
|
+ queryInfo.setTeacherId(sysUserService.getUserId());
|
|
|
return succeed(studentGoodsSellService.queryStudentGoodsOrders(queryInfo));
|
|
|
}
|
|
|
|