|
@@ -13,6 +13,7 @@ import com.jpsoft.smart.modules.sys.entity.User;
|
|
|
import com.jpsoft.smart.modules.sys.service.DataDictionaryService;
|
|
|
import com.jpsoft.smart.modules.sys.service.UserService;
|
|
|
import com.rabbitmq.client.AMQP;
|
|
|
+import com.sun.rmi.rmid.ExecOptionPermission;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
@@ -348,6 +349,8 @@ public class CompanyInfoController {
|
|
|
return msgResult;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
@ApiOperation(value="列表")
|
|
|
@RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
|
public MessageResult<Map> pageList(
|
|
@@ -362,11 +365,6 @@ public class CompanyInfoController {
|
|
|
|
|
|
Map<String,Object> searchParams = new HashMap<>();
|
|
|
|
|
|
- User user = userService.get(subject);
|
|
|
- if(!userService.hasRole(user.getId(),"SYSADMIN")) {
|
|
|
- searchParams.put("bindCompanyId",user.getCompanyId());
|
|
|
- }
|
|
|
-
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
sortList.add(new Sort("sort_no","asc"));
|
|
|
sortList.add(new Sort("name_","asc"));
|
|
@@ -388,8 +386,22 @@ public class CompanyInfoController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ User user = userService.get(subject);
|
|
|
+
|
|
|
+ if(!userService.hasRole(user.getId(),"SYSADMIN")) {
|
|
|
+ CompanyInfo companyInfo = companyInfoService.get(user.getCompanyId());
|
|
|
+ searchParams.put("bindCompanyCode",companyInfo.getCode() + "%");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if (StringUtils.isEmpty(name) && StringUtils.isEmpty(parentId)) {
|
|
|
+ //系统管理员,如果查询条件为空则只查根目录
|
|
|
+ searchParams.put("root", true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
Page<CompanyInfo> page = companyInfoService.pageSearch(searchParams,pageIndex,pageSize,sortList);
|
|
|
Page<CompanyInfoDTO> pageDTO = PojoUtils.convertPage(page, CompanyInfoDTO.class);
|
|
|
+
|
|
|
for(CompanyInfoDTO li : pageDTO.getResult()){
|
|
|
Map<String,Object> searchParams1 = new HashMap<>();
|
|
|
searchParams1.put("companyId",li.getId());
|
|
@@ -405,10 +417,13 @@ public class CompanyInfoController {
|
|
|
li.setPosition5Name(page1.get(0).getPosition5Name());
|
|
|
}
|
|
|
|
|
|
-
|
|
|
String typeN = dataDictionaryService.findNameByCatalogNameAndValue("单位性质",li.getType());
|
|
|
li.setTypeN(typeN);
|
|
|
|
|
|
+ //查询是否有子单位
|
|
|
+ Boolean hasChildren = companyInfoService.hasChildren(li.getId());
|
|
|
+
|
|
|
+ li.setHasChildren(hasChildren);
|
|
|
}
|
|
|
|
|
|
msgResult.setResult(true);
|
|
@@ -417,6 +432,38 @@ public class CompanyInfoController {
|
|
|
return msgResult;
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value="查询子单位")
|
|
|
+ @RequestMapping(value = "children",method = RequestMethod.POST)
|
|
|
+ public MessageResult<List<CompanyInfoDTO>> children(String parentId){
|
|
|
+ MessageResult<List<CompanyInfoDTO>> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ List<CompanyInfo> list = companyInfoService.findByParentId(parentId);
|
|
|
+
|
|
|
+ List<CompanyInfoDTO> dtoList = new ArrayList<>();
|
|
|
+
|
|
|
+ for (CompanyInfo companyInfo : list) {
|
|
|
+ CompanyInfoDTO dto = new CompanyInfoDTO();
|
|
|
+
|
|
|
+ PojoUtils.map(companyInfo,dto);
|
|
|
+
|
|
|
+// Boolean hasChildren = companyInfoService.hasChildren(companyInfo.getId());
|
|
|
+// dto.setHasChildren(hasChildren);
|
|
|
+
|
|
|
+ dtoList.add(dto);
|
|
|
+ }
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(dtoList);
|
|
|
+ }
|
|
|
+ catch (Exception ex){
|
|
|
+ msgResult.setResult(false);
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation(value="所有单位列表")
|
|
|
@RequestMapping(value = "list",method = RequestMethod.POST)
|
|
|
@ApiImplicitParams({
|