人员下发修改-添加图片删除

This commit is contained in:
fl 2025-07-04 11:17:16 +08:00
parent cd860c9a52
commit fe577aa8e2
2 changed files with 26 additions and 23 deletions

View File

@ -118,26 +118,26 @@ public class PersonFaceServiceImpl implements IPersonFaceService {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (PersonVo personVo : list) { for (PersonVo personVo : list) {
personVo.setGroupname("robotV1"); personVo.setGroupname("robotV1");
String result = IntelligentLibraryUtil.addPerson(personVo); String addResult = IntelligentLibraryUtil.addPerson(personVo);
JSONObject entries = JSONUtil.parseObj(result); JSONObject addEntries = JSONUtil.parseObj(addResult);
if (entries.getInt("code") == 0) { if (addEntries.getInt("code") == 0) {
//添加成功,获取到index //添加成功,获取到index
JSONObject datas = entries.getJSONObject("datas"); JSONObject datas = addEntries.getJSONObject("datas");
personVo.setIndex(datas.getInt("label_index")); personVo.setIndex(datas.getInt("label_index"));
} else if (entries.getInt("code") == 7) { } else if (addEntries.getInt("code") == 7) {
//人员重复,调用修改 //人员重复,调用修改
personVo.setIndex(entries.getInt("label_index")); personVo.setIndex(addEntries.getInt("label_index"));
String result2 = IntelligentLibraryUtil.updatePerson(vo); String updateResult = IntelligentLibraryUtil.updatePerson(vo);
JSONObject entries2 = JSONUtil.parseObj(result2); JSONObject updateEntries = JSONUtil.parseObj(updateResult);
if (entries2.getInt("code") == 0) { if (updateEntries.getInt("code") == 0) {
//修改成功,无需其他操作 //修改成功,无需其他操作
} else { } else {
//修改失败,entries2 //修改失败,entries2
sb.append(personVo.getName()).append(":").append(entries2.getStr("message")).append("\n"); sb.append(personVo.getName()).append(":").append(updateEntries.getStr("message")).append("\n");
} }
} else { } else {
//添加失败,添加错误信息 //添加失败,添加错误信息
sb.append(personVo.getName()).append(":").append(entries.getStr("message")).append("\n"); sb.append(personVo.getName()).append(":").append(addEntries.getStr("message")).append("\n");
} }
//调用添加照片 //调用添加照片
if (personVo.getIndex() > 0) { if (personVo.getIndex() > 0) {
@ -147,18 +147,18 @@ public class PersonFaceServiceImpl implements IPersonFaceService {
personImageVo.setLabel_index(personVo.getIndex()); personImageVo.setLabel_index(personVo.getIndex());
personImageVo.setRows(4); personImageVo.setRows(4);
//根据index查询图片 //根据index查询图片
String result3 = IntelligentLibraryUtil.queryPersonImage(personImageVo); String selectImageResult = IntelligentLibraryUtil.queryPersonImage(personImageVo);
JSONObject entries3 = JSONUtil.parseObj(result3); JSONObject selectImageEntries = JSONUtil.parseObj(selectImageResult);
if (entries3.getInt("code") == 0) { if (selectImageEntries.getInt("code") == 0) {
Integer total = entries3.getInt("total"); Integer total = selectImageEntries.getInt("total");
//如果图片满了,就全部删除 //如果图片满了,就全部删除
if(total>=4){ if(total>=4){
JSONArray datas = entries3.getJSONArray("datas"); JSONArray datas = selectImageEntries.getJSONArray("datas");
for (int i = 0; i < total; i++) { for (int i = 0; i < total; i++) {
personImageVo.setImage_id(datas.getJSONObject(i).getInt("index")); personImageVo.setImage_id(datas.getJSONObject(i).getInt("index"));
String result4 = IntelligentLibraryUtil.removePersonImage(personImageVo); String delImageResult = IntelligentLibraryUtil.removePersonImage(personImageVo);
JSONObject entries4 = JSONUtil.parseObj(result4); JSONObject delImageEntries = JSONUtil.parseObj(delImageResult);
if (entries4.getInt("code") == 0) { if (delImageEntries.getInt("code") == 0) {
//删除成功 //删除成功
} }
} }
@ -166,12 +166,12 @@ public class PersonFaceServiceImpl implements IPersonFaceService {
} }
//添加图片 //添加图片
personImageVo.setImagePath(personVo.getImage()); personImageVo.setImagePath(personVo.getImage());
String result5 = IntelligentLibraryUtil.addPersonImage(personImageVo); String addImageResult = IntelligentLibraryUtil.addPersonImage(personImageVo);
JSONObject entries5 = JSONUtil.parseObj(result5); JSONObject addImageEntries = JSONUtil.parseObj(addImageResult);
if (entries5.getInt("code") == 0) { if (addImageEntries.getInt("code") == 0) {
m++; m++;
} else { } else {
sb.append(personVo.getName()).append(":").append(entries5.getStr("message")).append("\n"); sb.append(personVo.getName()).append(":").append(addImageEntries.getStr("message")).append("\n");
} }
} else { } else {
n++; n++;

View File

@ -1,6 +1,7 @@
package com.bonus.business.vo; package com.bonus.business.vo;
import com.alibaba.fastjson2.annotation.JSONField; import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data; import lombok.Data;
@ -11,6 +12,8 @@ import java.util.List;
* 人员参数 * 人员参数
*/ */
@Data @Data
//忽略字段
@JsonIgnoreProperties({"ids", "image"})
public class PersonVo { public class PersonVo {
private List<Integer> ids; private List<Integer> ids;