|
@@ -1,7 +1,5 @@
|
|
|
package com.ym.mec.teacher.controller;
|
|
|
|
|
|
-import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
-import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.biz.dal.dto.BasicUserDto;
|
|
|
import com.ym.mec.biz.dal.entity.StudentGoodsSell;
|
|
|
import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
|
|
@@ -15,7 +13,6 @@ import com.ym.mec.biz.dal.page.GoodsSellQueryInfo;
|
|
|
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 io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
@@ -35,7 +32,7 @@ import java.util.Objects;
|
|
|
public class EduRepairController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
- private SysUserFeignService sysUserFeignService;
|
|
|
+ private SysUserService sysUserService;
|
|
|
@Autowired
|
|
|
private TeacherService teacherService;
|
|
|
@Autowired
|
|
@@ -63,10 +60,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);
|
|
@@ -74,8 +67,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, "恭喜您,购买成功!");
|
|
@@ -86,10 +80,6 @@ public class EduRepairController extends BaseController {
|
|
|
@ApiOperation("获取学生信息")
|
|
|
@GetMapping(value = "/getStudentInfo")
|
|
|
public HttpResponseResult getStudentInfo(Integer studentId) {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if (sysUser == null) {
|
|
|
- return failed("用户信息获取失败");
|
|
|
- }
|
|
|
return succeed(studentRepairService.getStudentInfo(studentId));
|
|
|
}
|
|
|
|
|
@@ -97,19 +87,16 @@ public class EduRepairController extends BaseController {
|
|
|
@GetMapping("/queryGoodsPage")
|
|
|
public Object queryPage(GoodsQueryInfo queryInfo) {
|
|
|
queryInfo.setOrganId(null);
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if (sysUser == null) {
|
|
|
- return failed("用户信息获取失败");
|
|
|
+ Teacher teacher = teacherService.get(sysUserService.getUserId());
|
|
|
+ if (Objects.isNull(teacher.getTeacherOrganId())) {
|
|
|
+ return failed("用户所在分部异常");
|
|
|
}
|
|
|
- Teacher teacher = teacherService.get(sysUser.getId());
|
|
|
if (queryInfo.getStudentShowOrganId() == null &&
|
|
|
queryInfo.getEducationShowOrganId() == null &&
|
|
|
queryInfo.getCourseFeeShowOrganId() == null &&
|
|
|
queryInfo.getMemberFeeShowOrganId() == null &&
|
|
|
queryInfo.getReplacementShowOrganId() == null) {
|
|
|
- queryInfo.setEducationShowOrganId(teacher.getOrganId().toString());
|
|
|
- } else if (Objects.isNull(teacher.getOrganId())) {
|
|
|
- return failed("用户所在分部异常");
|
|
|
+ queryInfo.setEducationShowOrganId(teacher.getTeacherOrganId().toString());
|
|
|
}
|
|
|
return succeed(goodsService.queryPage(queryInfo));
|
|
|
}
|
|
@@ -123,11 +110,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));
|
|
|
}
|
|
|
|