提交 3a33137d 编写于 作者: sq3536's avatar sq3536

codelist接管

上级 bd400a19
......@@ -92,6 +92,7 @@ public class DevBootSecurityConfig extends WebSecurityConfigurerAdapter {
).permitAll()
.antMatchers("/ibzou/org/**").permitAll()
.antMatchers("/ibzemployees/**/oumaps").permitAll()
.antMatchers("/dictionarys/**").permitAll()
//放行登录请求
.antMatchers( HttpMethod.POST,"/"+loginPath).permitAll()
.anyRequest().authenticated()
......
......@@ -8,6 +8,7 @@ import cn.ibizlab.core.ou.service.IIBZDepartmentService;
import cn.ibizlab.core.ou.service.IIBZOrganizationService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
......@@ -218,7 +219,7 @@ public class OUModelService
}
//@CacheEvict( value="ibzou-model",allEntries = true)
@CacheEvict( value="ibzou-model",allEntries = true)
public synchronized void refreshModel()
{
......
......@@ -120,6 +120,7 @@ public class apiSecurityConfig extends WebSecurityConfigurerAdapter {
//开放组织机构关系查询
.antMatchers("/ibzemployees/**/oumaps").permitAll()
.antMatchers("/ibzorganizations/**/suborg/picker").permitAll()
.antMatchers("/dictionarys/**").permitAll()
// 所有请求都需要认证
.anyRequest().authenticated()
// 防止iframe 造成跨域
......
package cn.ibizlab.api.rest.extensions;
import cn.ibizlab.core.ou.domain.IBZDepartment;
import cn.ibizlab.core.ou.domain.IBZOrganization;
import cn.ibizlab.core.ou.extensions.domain.*;
import cn.ibizlab.core.ou.extensions.service.OUCoreService;
import cn.ibizlab.core.ou.domain.IBZEmployee;
import cn.ibizlab.core.ou.service.IIBZDepartmentService;
import cn.ibizlab.core.ou.service.IIBZEmployeeService;
import cn.ibizlab.core.ou.service.IIBZOrganizationService;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.sql.Wrapper;
import java.util.*;
@RestController
......@@ -24,6 +31,14 @@ public class OUCoreResource
@Autowired
private IIBZEmployeeService iibzEmployeeService;
@Autowired
private IIBZOrganizationService iibzOrganizationService;
@Autowired
private IIBZDepartmentService iibzDepartmentService;
@GetMapping("/ibzemployees/{userId}/oumaps")
public ResponseEntity<Map<String, Set<String>>> getOUMapsByUserId(@PathVariable("userId") String userId)
{
......@@ -171,4 +186,66 @@ public class OUCoreResource
}
@Cacheable( value="ibzou-model",key = "'catalog:'+#p0")
@RequestMapping(method = RequestMethod.GET, value = "/dictionarys/catalogs/{catalog}")
public ResponseEntity<JSONObject> getCatalog(@PathVariable("catalog") String catalog) {
return getOptions(catalog);
}
@Cacheable( value="ibzou-model",key = "'codelist:'+#p0")
@RequestMapping(method = RequestMethod.GET, value = "/dictionarys/codelist/{catalog}")
public ResponseEntity<JSONObject> getCodeList(@PathVariable("catalog") String catalog) {
return getOptions(catalog);
}
public ResponseEntity<JSONObject> getOptions(String catalog) {
JSONObject jo=new JSONObject();
jo.put("srfkey",catalog);
jo.put("emptytext","");
List<JSONObject> list=new ArrayList<>();
if("IbzouOrg".equalsIgnoreCase(catalog))
{
iibzOrganizationService.list(Wrappers.<IBZOrganization>query().orderByAsc("showorder")).forEach(item -> {
JSONObject option=new JSONObject();
option.put("id",item.getOrgid());
option.put("value",item.getOrgid());
option.put("label",item.getOrgname());
option.put("text",item.getOrgname());
list.add(option);
});
}
else if("IbzouDept".equalsIgnoreCase(catalog)||"IbzouOrgSector".equalsIgnoreCase(catalog))
{
iibzDepartmentService.list(Wrappers.<IBZDepartment>query().orderByAsc("showorder")).forEach(item -> {
JSONObject option=new JSONObject();
option.put("id",item.getDeptid());
option.put("value",item.getDeptid());
option.put("label",item.getDeptname());
option.put("text",item.getDeptname());
list.add(option);
});
}
else if("IbzouUser".equalsIgnoreCase(catalog)||"IbzouOperator".equalsIgnoreCase(catalog)||"IbzouEmp".equalsIgnoreCase(catalog)||"IbzouPerson".equalsIgnoreCase(catalog))
{
iibzEmployeeService.list(Wrappers.<IBZEmployee>query().orderByAsc("showorder")).forEach(item -> {
JSONObject option=new JSONObject();
option.put("id",item.getUserid());
option.put("value",item.getUserid());
option.put("label",item.getPersonname());
option.put("text",item.getPersonname());
list.add(option);
});
}
jo.put("items",list);
return ResponseEntity.status(HttpStatus.OK).body(jo);
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册