|
@@ -282,19 +282,20 @@ public class PersonInfoController {
|
|
|
personInfo.setFaceEnabled(false);
|
|
|
|
|
|
int affectCount = personInfoService.update(personInfo);
|
|
|
-
|
|
|
- HSSFWorkbook workbook = new HSSFWorkbook();
|
|
|
- HSSFSheet sheet = workbook.createSheet();
|
|
|
- if(!deleteDevicePerson(id, sheet)){
|
|
|
- ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
|
- workbook.write(output);
|
|
|
- byte[] buffer = output.toByteArray();
|
|
|
- ByteArrayInputStream input = new ByteArrayInputStream(buffer);
|
|
|
- String downloadUrl = OSSUtil.upload(ossConfig,"import","error.xls",input);
|
|
|
-
|
|
|
- msgResult.setData(false);
|
|
|
- msgResult.setMessage(downloadUrl);
|
|
|
- }
|
|
|
+ lapiService.deletePerson(personInfo.getId());
|
|
|
+
|
|
|
+// HSSFWorkbook workbook = new HSSFWorkbook();
|
|
|
+// HSSFSheet sheet = workbook.createSheet();
|
|
|
+// if(!deleteDevicePerson(personInfo, sheet)){
|
|
|
+// ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
|
+// workbook.write(output);
|
|
|
+// byte[] buffer = output.toByteArray();
|
|
|
+// ByteArrayInputStream input = new ByteArrayInputStream(buffer);
|
|
|
+// String downloadUrl = OSSUtil.upload(ossConfig,"import","error.xls",input);
|
|
|
+//
|
|
|
+// msgResult.setData(false);
|
|
|
+// msgResult.setMessage(downloadUrl);
|
|
|
+// }
|
|
|
|
|
|
if (affectCount > 0) {
|
|
|
msgResult.setResult(true);
|
|
@@ -334,23 +335,24 @@ public class PersonInfoController {
|
|
|
personInfo.setFaceEnabled(false);
|
|
|
|
|
|
affectCount += personInfoService.update(personInfo);
|
|
|
-
|
|
|
- ExecutorService cachedThreadPool = Executors.newCachedThreadPool();
|
|
|
- for (int i = 0; i < 10; i++) {
|
|
|
- final int index = i;
|
|
|
- try {
|
|
|
- Thread.sleep(index * 1000);
|
|
|
- } catch (InterruptedException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- cachedThreadPool.execute(new Runnable() {
|
|
|
- public void run() {
|
|
|
- if(!deleteDevicePerson(id, sheet)){
|
|
|
- msgResult.setData(false);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ lapiService.deletePerson(personInfo.getId());
|
|
|
+
|
|
|
+// ExecutorService cachedThreadPool = Executors.newCachedThreadPool();
|
|
|
+// for (int i = 0; i < 10; i++) {
|
|
|
+// final int index = i;
|
|
|
+// try {
|
|
|
+// Thread.sleep(index * 1000);
|
|
|
+// } catch (InterruptedException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// cachedThreadPool.execute(new Runnable() {
|
|
|
+// public void run() {
|
|
|
+// if(!deleteDevicePerson(personInfo, sheet)){
|
|
|
+// msgResult.setData(false);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// });
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
if (affectCount > 0) {
|
|
@@ -507,9 +509,10 @@ public class PersonInfoController {
|
|
|
throw new Exception("人员信息不存在!");
|
|
|
}
|
|
|
|
|
|
- if(!deleteDevicePerson(id, sheet)){
|
|
|
- msgResult.setData(false);
|
|
|
- }
|
|
|
+ lapiService.deletePerson(personInfo.getId());
|
|
|
+// if(!deleteDevicePerson(personInfo, sheet)){
|
|
|
+// msgResult.setData(false);
|
|
|
+// }
|
|
|
|
|
|
personInfo.setFaceBound(false);
|
|
|
personInfo.setUpdateTime(new Date());
|
|
@@ -524,15 +527,15 @@ public class PersonInfoController {
|
|
|
|
|
|
if (affectCount > 0) {
|
|
|
msgResult.setResult(true);
|
|
|
- if(!msgResult.getData()){
|
|
|
- ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
|
- workbook.write(output);
|
|
|
- byte[] buffer = output.toByteArray();
|
|
|
- ByteArrayInputStream input = new ByteArrayInputStream(buffer);
|
|
|
- String downloadUrl = OSSUtil.upload(ossConfig,"import","error.xls",input);
|
|
|
-
|
|
|
- msgResult.setMessage(downloadUrl);
|
|
|
- }
|
|
|
+// if(!msgResult.getData()){
|
|
|
+// ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
|
+// workbook.write(output);
|
|
|
+// byte[] buffer = output.toByteArray();
|
|
|
+// ByteArrayInputStream input = new ByteArrayInputStream(buffer);
|
|
|
+// String downloadUrl = OSSUtil.upload(ossConfig,"import","error.xls",input);
|
|
|
+//
|
|
|
+// msgResult.setMessage(downloadUrl);
|
|
|
+// }
|
|
|
}else{
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage("数据库保存失败");
|
|
@@ -1027,7 +1030,7 @@ public class PersonInfoController {
|
|
|
throw new Exception("人员信息不存在!");
|
|
|
}
|
|
|
|
|
|
- if(!addDevicePerson(Long.valueOf(id), sheet)){
|
|
|
+ if(!addDevicePerson(personInfo, sheet)){
|
|
|
msgResult.setData(false);
|
|
|
personInfo.setFaceBound(false);
|
|
|
}else {
|
|
@@ -1059,13 +1062,11 @@ public class PersonInfoController {
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value="删除设备人员图片")
|
|
|
- private Boolean deleteDevicePerson(Long personId, HSSFSheet sheet){
|
|
|
+ private Boolean deleteDevicePerson(PersonInfo personInfo, HSSFSheet sheet){
|
|
|
boolean bl = true;
|
|
|
|
|
|
try {
|
|
|
- PersonInfo personInfo = personInfoService.get(personId);
|
|
|
-
|
|
|
- List<LapiMsgResult> msgResultList = lapiService.deletePerson(personId);
|
|
|
+ List<LapiMsgResult> msgResultList = lapiService.deletePerson(personInfo.getId());
|
|
|
for (int i = 0; i < msgResultList.size(); i++) {
|
|
|
LapiMsgResult lapiMsgResult = msgResultList.get(i);
|
|
|
|
|
@@ -1092,13 +1093,11 @@ public class PersonInfoController {
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value="添加设备人员图片")
|
|
|
- private Boolean addDevicePerson(Long personId, HSSFSheet sheet){
|
|
|
+ private Boolean addDevicePerson(PersonInfo personInfo, HSSFSheet sheet){
|
|
|
boolean bl = true;
|
|
|
|
|
|
try {
|
|
|
- PersonInfo personInfo = personInfoService.get(personId);
|
|
|
-
|
|
|
- List<LapiMsgResult> msgResultList = lapiService.addPerson(personId);
|
|
|
+ List<LapiMsgResult> msgResultList = lapiService.addPerson(personInfo.getId());
|
|
|
for (int i = 0; i < msgResultList.size(); i++) {
|
|
|
LapiMsgResult lapiMsgResult = msgResultList.get(i);
|
|
|
|