|
@@ -229,7 +229,53 @@ public class LapiServiceImpl implements ILapiService {
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
- log.error(e.getMessage());
|
|
|
+ log.error(e.getMessage(),e);
|
|
|
+ LapiMsgResult lapiMsgResult = new LapiMsgResult();
|
|
|
+ lapiMsgResult.setPersonName(personInfo.getName());
|
|
|
+ lapiMsgResult.setSuccess(false);
|
|
|
+ lapiMsgResult.setMsg(e.getMessage());
|
|
|
+ lapiMsgResult.setAliasName(deviceInfo.getAliasName());
|
|
|
+ lapiMsgResults.add(lapiMsgResult);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return lapiMsgResults;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<LapiMsgResult> deleteDevicePerson(Long id,String deviceIds) throws Exception {
|
|
|
+ if (StringUtils.isBlank(deviceIds)){
|
|
|
+ throw new Exception("相关设备不能为空");
|
|
|
+ }
|
|
|
+ PersonInfo personInfo = personInfoService.get(id);
|
|
|
+ if (personInfo == null){
|
|
|
+ throw new Exception("人员信息不存在");
|
|
|
+ }
|
|
|
+ CompanyInfo companyInfo = companyInfoService.get(personInfo.getCompanyId());
|
|
|
+ if (companyInfo == null){
|
|
|
+ throw new Exception("人员没有相应公司");
|
|
|
+ }
|
|
|
+ List<LapiMsgResult> lapiMsgResults = new ArrayList<>();
|
|
|
+ List<String> deviceIdList = Arrays.asList(deviceIds.split(","));
|
|
|
+ for (String deviceId:deviceIdList ){
|
|
|
+ DeviceInfo deviceInfo = deviceInfoService.get(deviceId);
|
|
|
+ try{
|
|
|
+ String faceDbId = getFaceDbId(deviceInfo, companyInfo.getName());
|
|
|
+ JSONObject jsonObject = LApiUtil.DeleteRequest(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(),e);
|
|
|
LapiMsgResult lapiMsgResult = new LapiMsgResult();
|
|
|
lapiMsgResult.setPersonName(personInfo.getName());
|
|
|
lapiMsgResult.setSuccess(false);
|