|
@@ -1,5 +1,6 @@
|
|
|
package com.jpsoft.shinestar.modules.base.controller;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.github.pagehelper.Page;
|
|
|
import com.jpsoft.shinestar.config.OSSConfig;
|
|
|
import com.jpsoft.shinestar.modules.base.dto.PersonInfoDTO;
|
|
@@ -1988,6 +1989,69 @@ public class PersonInfoController {
|
|
|
return messageResult;
|
|
|
}
|
|
|
|
|
|
+ @PostMapping(value="findPersonByName")
|
|
|
+ @ApiOperation(value = "查询人员")
|
|
|
+ public MessageResult<List> findPersonByName(@RequestBody JSONObject requestBody){
|
|
|
+ String initValue = requestBody.getString("initValue");
|
|
|
+ String query = requestBody.getString("query");
|
|
|
+
|
|
|
+ MessageResult<List> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ List<Map> mapList = new ArrayList<>();
|
|
|
+
|
|
|
+ Set<Long> personIdSet = new HashSet<>();
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(initValue)) {
|
|
|
+ String[] arr = initValue.split(",");
|
|
|
+
|
|
|
+ for (String personId : arr) {
|
|
|
+ PersonInfo personInfo = personInfoService.get(Long.valueOf(personId));
|
|
|
+
|
|
|
+ Map<String, Object> personMap = new HashMap<>();
|
|
|
+ personMap.put("personId", personInfo.getId());
|
|
|
+ personMap.put("strId", personInfo.getId().toString());
|
|
|
+ personMap.put("name", personInfo.getName() + "—" + personInfo.getCompanyName());
|
|
|
+
|
|
|
+ mapList.add(personMap);
|
|
|
+
|
|
|
+ personIdSet.add(personInfo.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(query)) {
|
|
|
+ searchParams.put("name", "%" + query + "%");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("a.name_","asc"));
|
|
|
+
|
|
|
+ Page<PersonInfo> page = personInfoService.pageSearch(searchParams,1,20,true,sortList);
|
|
|
+
|
|
|
+ for (PersonInfo personInfo : page.getResult()) {
|
|
|
+ if(!personIdSet.contains(personInfo.getId())) {
|
|
|
+ Map<String, Object> personMap = new HashMap<>();
|
|
|
+ personMap.put("personId", personInfo.getId());
|
|
|
+ personMap.put("strId", personInfo.getId().toString());
|
|
|
+ personMap.put("name", personInfo.getName() + "—" + personInfo.getCompanyName());
|
|
|
+
|
|
|
+ mapList.add(personMap);
|
|
|
+ personIdSet.add(personInfo.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ messageResult.setResult(true);
|
|
|
+ messageResult.setData(mapList);
|
|
|
+ }
|
|
|
+ catch (Exception ex){
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
|
|
|
@ApiOperation(value = "查询物业公司所在人员")
|
|
|
@PostMapping("findStrIdByCompanyCode")
|