|
@@ -3,20 +3,14 @@ package com.jpsoft.smart.modules.base.controller;
|
|
import com.github.pagehelper.Page;
|
|
import com.github.pagehelper.Page;
|
|
import com.jpsoft.smart.config.OSSConfig;
|
|
import com.jpsoft.smart.config.OSSConfig;
|
|
import com.jpsoft.smart.modules.base.dto.PersonInfoDTO;
|
|
import com.jpsoft.smart.modules.base.dto.PersonInfoDTO;
|
|
-import com.jpsoft.smart.modules.base.entity.DeviceInfo;
|
|
|
|
-import com.jpsoft.smart.modules.base.entity.PersonCompany;
|
|
|
|
-import com.jpsoft.smart.modules.base.entity.PersonDeviceRelation;
|
|
|
|
-import com.jpsoft.smart.modules.base.service.DeviceInfoService;
|
|
|
|
-import com.jpsoft.smart.modules.base.service.PersonCompanyService;
|
|
|
|
-import com.jpsoft.smart.modules.base.service.PersonDeviceRelationService;
|
|
|
|
|
|
+import com.jpsoft.smart.modules.base.entity.*;
|
|
|
|
+import com.jpsoft.smart.modules.base.service.*;
|
|
import com.jpsoft.smart.modules.common.utils.CheckIdCard;
|
|
import com.jpsoft.smart.modules.common.utils.CheckIdCard;
|
|
import com.jpsoft.smart.modules.common.utils.OSSUtil;
|
|
import com.jpsoft.smart.modules.common.utils.OSSUtil;
|
|
import com.jpsoft.smart.modules.common.utils.POIUtils;
|
|
import com.jpsoft.smart.modules.common.utils.POIUtils;
|
|
import com.jpsoft.smart.modules.common.utils.PojoUtils;
|
|
import com.jpsoft.smart.modules.common.utils.PojoUtils;
|
|
import com.jpsoft.smart.modules.common.dto.Sort;
|
|
import com.jpsoft.smart.modules.common.dto.Sort;
|
|
import com.jpsoft.smart.modules.common.dto.MessageResult;
|
|
import com.jpsoft.smart.modules.common.dto.MessageResult;
|
|
-import com.jpsoft.smart.modules.base.entity.PersonInfo;
|
|
|
|
-import com.jpsoft.smart.modules.base.service.PersonInfoService;
|
|
|
|
import com.jpsoft.smart.modules.lapi.service.ILapiService;
|
|
import com.jpsoft.smart.modules.lapi.service.ILapiService;
|
|
import com.jpsoft.smart.modules.lapi.vo.LapiMsgResult;
|
|
import com.jpsoft.smart.modules.lapi.vo.LapiMsgResult;
|
|
import com.jpsoft.smart.modules.sys.entity.User;
|
|
import com.jpsoft.smart.modules.sys.entity.User;
|
|
@@ -64,6 +58,10 @@ public class PersonInfoController {
|
|
private PersonDeviceRelationService personDeviceRelationService;
|
|
private PersonDeviceRelationService personDeviceRelationService;
|
|
@Autowired
|
|
@Autowired
|
|
private DeviceInfoService deviceInfoService;
|
|
private DeviceInfoService deviceInfoService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private CompanyInfoService companyInfoService;
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private PersonCompanyService personCompanyService;
|
|
private PersonCompanyService personCompanyService;
|
|
|
|
|
|
@@ -424,7 +422,8 @@ public class PersonInfoController {
|
|
@ApiImplicitParam(name = "name",value = "姓名", required = false, paramType = "form",dataType = "String"),
|
|
@ApiImplicitParam(name = "name",value = "姓名", required = false, paramType = "form",dataType = "String"),
|
|
@ApiImplicitParam(name = "idCard",value = "身份证", required = false, paramType = "form",dataType = "String"),
|
|
@ApiImplicitParam(name = "idCard",value = "身份证", required = false, paramType = "form",dataType = "String"),
|
|
@ApiImplicitParam(name = "phone",value = "手机号", required = false, paramType = "form",dataType = "String"),
|
|
@ApiImplicitParam(name = "phone",value = "手机号", required = false, paramType = "form",dataType = "String"),
|
|
- @ApiImplicitParam(name = "companyId",value = "企业id", required = false, paramType = "form",dataType = "String"),
|
|
|
|
|
|
+ @ApiImplicitParam(name = "companyCode",value = "企业编码", required = false, paramType = "form",dataType = "String"),
|
|
|
|
+ @ApiImplicitParam(name = "subordinate",value = "会否保护下级单位", required = false, paramType = "form",dataType = "String"),
|
|
@ApiImplicitParam(name = "position1",value = "一级位置", required = false, paramType = "form",dataType = "String"),
|
|
@ApiImplicitParam(name = "position1",value = "一级位置", required = false, paramType = "form",dataType = "String"),
|
|
@ApiImplicitParam(name = "position2",value = "二级位置", required = false, paramType = "form",dataType = "String"),
|
|
@ApiImplicitParam(name = "position2",value = "二级位置", required = false, paramType = "form",dataType = "String"),
|
|
@ApiImplicitParam(name = "position3",value = "三级位置", required = false, paramType = "form",dataType = "String"),
|
|
@ApiImplicitParam(name = "position3",value = "三级位置", required = false, paramType = "form",dataType = "String"),
|
|
@@ -437,7 +436,8 @@ public class PersonInfoController {
|
|
@RequestParam(value="name",defaultValue="") String name,
|
|
@RequestParam(value="name",defaultValue="") String name,
|
|
@RequestParam(value="idCard",defaultValue="") String idCard,
|
|
@RequestParam(value="idCard",defaultValue="") String idCard,
|
|
@RequestParam(value="phone",defaultValue="") String phone,
|
|
@RequestParam(value="phone",defaultValue="") String phone,
|
|
- @RequestParam(value="companyId",defaultValue="") String companyId,
|
|
|
|
|
|
+ @RequestParam(value="companyCode",defaultValue="") String companyCode,
|
|
|
|
+ @RequestParam(value="subordinate",defaultValue="false") Boolean subordinate,
|
|
@RequestParam(value="position1",defaultValue="") String position1,
|
|
@RequestParam(value="position1",defaultValue="") String position1,
|
|
@RequestParam(value="position2",defaultValue="") String position2,
|
|
@RequestParam(value="position2",defaultValue="") String position2,
|
|
@RequestParam(value="position3",defaultValue="") String position3,
|
|
@RequestParam(value="position3",defaultValue="") String position3,
|
|
@@ -452,6 +452,8 @@ public class PersonInfoController {
|
|
//当前用户ID
|
|
//当前用户ID
|
|
User user = userService.get(subject);
|
|
User user = userService.get(subject);
|
|
|
|
|
|
|
|
+ CompanyInfo companyInfo = companyInfoService.get(user.getCompanyId());
|
|
|
|
+
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
|
|
Map<String,Object> searchParams = new HashMap<>();
|
|
Map<String,Object> searchParams = new HashMap<>();
|
|
@@ -476,13 +478,24 @@ public class PersonInfoController {
|
|
searchParams.put("phone","%" + phone + "%");
|
|
searchParams.put("phone","%" + phone + "%");
|
|
}
|
|
}
|
|
|
|
|
|
- if (userService.hasRole(subject,"SYSADMIN")) {
|
|
|
|
- if(StringUtils.isNotEmpty(companyId)) {
|
|
|
|
- searchParams.put("companyId", companyId);
|
|
|
|
|
|
+ if (StringUtils.isEmpty(companyCode)){
|
|
|
|
+ if (!userService.hasRole(subject,"SYSADMIN")) {
|
|
|
|
+
|
|
|
|
+ if(subordinate){
|
|
|
|
+ searchParams.put("companyCode", companyInfo.getCode() + "%");
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ searchParams.put("companyCode", companyInfo.getCode());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else{
|
|
else{
|
|
- searchParams.put("companyId",user.getCompanyId());
|
|
|
|
|
|
+ if(subordinate){
|
|
|
|
+ searchParams.put("companyCode", companyCode + "%");
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ searchParams.put("companyCode", companyCode);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotEmpty(position1)) {
|
|
if (StringUtils.isNotEmpty(position1)) {
|