|
|
@@ -6,6 +6,7 @@ import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.fs.common.annotation.RepeatSubmit;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
+import com.fs.common.core.domain.model.LoginUser;
|
|
|
import com.fs.common.enums.DataSourceType;
|
|
|
import com.fs.common.utils.SecurityUtils;
|
|
|
import com.fs.common.utils.ServletUtils;
|
|
|
@@ -87,16 +88,15 @@ public class FsCompanyController extends BaseController {
|
|
|
@GetMapping("/list")
|
|
|
public TableDataInfo list(Company company)
|
|
|
{
|
|
|
-// startPage();
|
|
|
-// com.fs.framework.security.LoginUser loginUser = (com.fs.framework.security.LoginUser) tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
-// String json = configService.selectConfigByKey("course.config");
|
|
|
-// CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
-// if(!loginUser.isAdmin() && config.getDept() != null && config.getDept()){
|
|
|
-// company.setDeptId(loginUser.getDeptId());
|
|
|
-// }
|
|
|
-// List<CompanyVO> list = companyService.selectCompanyListVO(company);
|
|
|
-// return getDataTable(list);
|
|
|
- throw new RuntimeException("未实现");
|
|
|
+ startPage();
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ String json = configService.selectConfigByKey("course.config");
|
|
|
+ CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
+ if(!loginUser.isAdmin() && config.getDept() != null && config.getDept()){
|
|
|
+ company.setDeptId(loginUser.getDeptId());
|
|
|
+ }
|
|
|
+ List<CompanyVO> list = companyService.selectCompanyListVO(company);
|
|
|
+ return getDataTable(list);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/companyList")
|
|
|
@@ -161,18 +161,17 @@ public class FsCompanyController extends BaseController {
|
|
|
@PostMapping
|
|
|
public R add(@RequestBody Company company, HttpServletRequest request)
|
|
|
{
|
|
|
-// com.fs.framework.security.LoginUser loginUser = (com.fs.framework.security.LoginUser) tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
-// String json = configService.selectConfigByKey("course.config");
|
|
|
-// CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
-// if(!loginUser.isAdmin() && config.getDept() != null && config.getDept()){
|
|
|
-// company.setDeptId(loginUser.getDeptId());
|
|
|
-// }
|
|
|
-//
|
|
|
-// if (isQuantityExceeded(request)){
|
|
|
-// return R.error("公司数量已达上限");
|
|
|
-// }
|
|
|
-// return companyService.insertCompany(company);
|
|
|
- throw new RuntimeException("未实现");
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ String json = configService.selectConfigByKey("course.config");
|
|
|
+ CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
+ if(!loginUser.isAdmin() && config.getDept() != null && config.getDept()){
|
|
|
+ company.setDeptId(loginUser.getDeptId());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isQuantityExceeded(request)){
|
|
|
+ return R.error("公司数量已达上限");
|
|
|
+ }
|
|
|
+ return companyService.insertCompany(company);
|
|
|
}
|
|
|
|
|
|
/**
|