|
@@ -102,7 +102,7 @@ public class LapiServiceImpl implements ILapiService {
|
|
|
map1.put("PersonID",personInfo.getId());
|
|
|
map1.put("LastChange",new Date().getTime());
|
|
|
map1.put("PersonCode",personInfo.getId().toString());
|
|
|
- map1.put("PersonName",personInfo.getName());
|
|
|
+ map1.put("PersonName",personInfo.getName()+"_"+personInfo.getId().toString());
|
|
|
map1.put("Remarks",companyInfo.getName());
|
|
|
|
|
|
//TimeTemplateNum 首字符必须大写
|
|
@@ -188,4 +188,62 @@ public class LapiServiceImpl implements ILapiService {
|
|
|
}
|
|
|
return faceDbId;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<LapiMsgResult> deletePerson(Long id) throws Exception{
|
|
|
+
|
|
|
+ PersonInfo personInfo = personInfoService.get(id);
|
|
|
+ if (personInfo == null){
|
|
|
+ throw new Exception("人员不存在");
|
|
|
+ }
|
|
|
+ List<PersonDeviceRelation> listRelation = personDeviceRelationService.findByPersonId(id);
|
|
|
+ if (listRelation.size()<=0){
|
|
|
+ throw new Exception("人员未绑定设备");
|
|
|
+ }
|
|
|
+ CompanyInfo companyInfo = companyInfoService.get(personInfo.getCompanyId());
|
|
|
+ List<DeviceInfo> deviceList = new ArrayList<>();
|
|
|
+ for (PersonDeviceRelation personDeviceRelation:listRelation){
|
|
|
+ DeviceInfo deviceInfo = deviceInfoService.get(personDeviceRelation.getDeviceId());
|
|
|
+ if (deviceInfo!=null){
|
|
|
+ deviceList.add(deviceInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (deviceList.size()<=0){
|
|
|
+ throw new Exception("人员与设备绑定错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<LapiMsgResult> lapiMsgResults = new ArrayList<>();
|
|
|
+ for (DeviceInfo deviceInfo : deviceList){
|
|
|
+
|
|
|
+ try{
|
|
|
+ //获取人员人脸库id
|
|
|
+ String faceDbId = getFaceDbId(deviceInfo,companyInfo.getName());
|
|
|
+ JSONObject jsonObject = LApiUtil.DeletRequest(deviceInfo.getIpAddress()+":"+deviceInfo.getPort()+LApiConstant.DELETEPERSON+faceDbId+"/People/"+personInfo.getId()+"?LastChange="+new Date().getTime());
|
|
|
+ JSONObject dataJson = jsonObject.getJSONObject("Response");
|
|
|
+ JSONObject response = LApiUtil.getResponse(dataJson);
|
|
|
+ if (dataJson.getInteger("ResponseCode") ==0 && dataJson.getInteger("StatusCode") == 0){
|
|
|
+ LapiMsgResult lapiMsgResult = new LapiMsgResult();
|
|
|
+ lapiMsgResult.setPersonName(personInfo.getName());
|
|
|
+ lapiMsgResult.setSuccess(true);
|
|
|
+ lapiMsgResult.setAliasName(deviceInfo.getAliasName());
|
|
|
+ lapiMsgResults.add(lapiMsgResult);
|
|
|
+ }
|
|
|
+
|
|
|
+ }catch (Exception e){
|
|
|
+
|
|
|
+ log.error(e.getMessage());
|
|
|
+ LapiMsgResult lapiMsgResult = new LapiMsgResult();
|
|
|
+ lapiMsgResult.setPersonName(personInfo.getName());
|
|
|
+ lapiMsgResult.setSuccess(false);
|
|
|
+ lapiMsgResult.setMsg(e.getMessage());
|
|
|
+ lapiMsgResult.setAliasName(deviceInfo.getAliasName());
|
|
|
+ lapiMsgResults.add(lapiMsgResult);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return lapiMsgResults;
|
|
|
+ }
|
|
|
}
|