Merge remote-tracking branch 'origin/guoshengxiong' into guoshengxiong

This commit is contained in:
pengjie 2025-04-08 20:08:51 +08:00
commit 724a0cc67c
2 changed files with 35 additions and 14 deletions

View File

@ -53,17 +53,21 @@ public class NettyTcpServer {
*/
@PostConstruct
public void start() throws InterruptedException {
ServerBootstrap serverBootstrap = new ServerBootstrap();
serverBootstrap.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class)
.childHandler(jt808ChannelInitializer)
.option(ChannelOption.SO_BACKLOG, 1024) //服务端可连接队列数,对应TCP/IP协议listen函数中backlog参数
.childOption(ChannelOption.TCP_NODELAY, true)//立即写出
.childOption(ChannelOption.SO_KEEPALIVE, true);//长连接
ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.SIMPLE);//内存泄漏检测 开发推荐PARANOID 线上SIMPLE
ChannelFuture channelFuture = serverBootstrap.bind(port).sync();
if (channelFuture.isSuccess()) {
log.info("定位TCP服务启动完毕,port={}", this.port);
try {
ServerBootstrap serverBootstrap = new ServerBootstrap();
serverBootstrap.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class)
.childHandler(jt808ChannelInitializer)
.option(ChannelOption.SO_BACKLOG, 1024) //服务端可连接队列数,对应TCP/IP协议listen函数中backlog参数
.childOption(ChannelOption.TCP_NODELAY, true)//立即写出
.childOption(ChannelOption.SO_KEEPALIVE, true);//长连接
ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.SIMPLE);//内存泄漏检测 开发推荐PARANOID 线上SIMPLE
ChannelFuture channelFuture = serverBootstrap.bind(port).sync();
if (channelFuture.isSuccess()) {
log.info("定位TCP服务启动完毕,port={}", this.port);
}
} catch (Exception e) {
log.error("定位TCP服务启动异常,port={}", this.port);
}
}

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);