|
@@ -2,7 +2,9 @@ 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.dto.VipGroupActivityAddDto;
|
|
|
+import com.ym.mec.biz.dal.entity.Employee;
|
|
|
import com.ym.mec.biz.dal.page.VipGroupActivityQueryInfo;
|
|
|
import com.ym.mec.biz.service.VipGroupActivityService;
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
@@ -11,10 +13,13 @@ import com.ym.mec.common.exception.BizException;
|
|
|
import io.swagger.annotations.Api;
|
|
|
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.*;
|
|
|
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
|
|
|
/**
|
|
@@ -31,6 +36,8 @@ public class VipGroupActivityController extends BaseController {
|
|
|
private VipGroupActivityService vipGroupActivityService;
|
|
|
@Autowired
|
|
|
private SysUserFeignService sysUserFeignService;
|
|
|
+ @Autowired
|
|
|
+ private EmployeeDao employeeDao;
|
|
|
|
|
|
@ApiOperation(value = "新增vip课活动方案")
|
|
|
@PostMapping("/addVipGroupActivity")
|
|
@@ -48,9 +55,19 @@ public class VipGroupActivityController extends BaseController {
|
|
|
if(sysUser == null){
|
|
|
return failed("用户信息获取失败");
|
|
|
}
|
|
|
- if(sysUser.getOrganId() != null){
|
|
|
- queryInfo.setOrganId(sysUser.getOrganId());
|
|
|
- }
|
|
|
+ if (!sysUser.getIsSuperAdmin()) {
|
|
|
+ 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.contains(queryInfo.getOrganId())){
|
|
|
+ return failed("用户所在分部异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return succeed(vipGroupActivityService.queryPage(queryInfo));
|
|
|
}
|
|
|
|