人员图片导入bug解决

This commit is contained in:
guoshengxiong 2025-04-07 17:05:49 +08:00
parent cb45d95486
commit 629c93584f

View File

@ -84,6 +84,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@ -511,8 +512,13 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
@Async("workerHkExecutor")
public Future editWorkerInfoAsync(WorkerInfo workerInfo) {
this.editWorkerInfo(workerInfo);
return null;
try {
this.editWorkerInfo(workerInfo);
return new AsyncResult("successfully");
} catch (Exception e) {
e.printStackTrace();
}
return new AsyncResult("fail");
}
/**
@ -1776,6 +1782,8 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
String rtMsg = "";
String existMsg = "";
String ufaceId = null;
//有导入成功
boolean hasSuc = false;
try {
InputStream is = excelFile.getInputStream();
List<Map<String, String>> list = ExcelUtils.jxlExlToList(is, 0);
@ -1898,6 +1906,7 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
workerInfo.setUfaceDevId(ufaceId);
boolean isVaild = IdCardUtils.strongVerifyIdNumber(workerInfo.getIdCard());
if (isVaild) {
hasSuc = true;
WorkerInfo oldWorkerInfo = workerInfoMapper.selectWorkWorkerInfoWithIdCard(workerInfo.getIdCard(), workerInfo.getProjectSn());
if (oldWorkerInfo != null) {
if (oldWorkerInfo.toExistString().equals(workerInfo.toExistString())) {
@ -1927,13 +1936,21 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
existMsg = "劳务人员姓名为:" + existName + "的人员已存在对应信息(身份证等信息一致)";
}
String errIdCardMsg = "";
String prefix = "";
if (CollUtil.isNotEmpty(errIdCards)) {
if (StrUtil.isNotBlank(existMsg)) {
errIdCardMsg += ",";
}
errIdCardMsg += "错误的身份证格式的人员:" + StrUtil.join(",", errIdCards);
if (hasSuc) {
prefix = "部分导入成功";
} else {
prefix = "导入失败";
}
} else {
prefix = "导入成功";
}
rtMsg = StrUtil.format("导入成功。{}{}", existMsg, errIdCardMsg);
rtMsg = StrUtil.format("{}。{}{}", prefix, existMsg, errIdCardMsg);
result.successMsg(rtMsg);
} catch (OpenAlertException e) {
log.error("error", e);