fix:任务完成时状态更新不对:取的是历史数据;param字段没用了

This commit is contained in:
zhangzq
2024-07-18 10:32:32 +08:00
parent e9e5faa32a
commit 28d3b53acb
3 changed files with 24 additions and 21 deletions

View File

@@ -21,6 +21,8 @@ import org.nl.config.lucene.remote.coder.LogConsumerHandler;
import java.net.ConnectException;
import java.net.SocketAddress;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -30,7 +32,8 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS;
* @Date 2024/7/5 14:53
*/
public class HeartClientServer extends AbstraceServer {
private static ExecutorService executor = Executors.newSingleThreadExecutor();
private static int i = 0;
private static EventLoopGroup group = new NioEventLoopGroup(4);
public HeartClientServer(SocketAddress address) {
@@ -47,7 +50,7 @@ public class HeartClientServer extends AbstraceServer {
@Override
protected void initChannel(SocketChannel ch) throws Exception {
ch.pipeline()
.addLast("client-idle-handler", new IdleStateHandler(8, 0,0 , TimeUnit.SECONDS))
.addLast("client-idle-handler", new IdleStateHandler(0, 10,0 , TimeUnit.SECONDS))
.addLast( new StringEncoder())
.addLast( new StringDecoder())
.addLast(new HeartConsumerHandler(body));
@@ -85,16 +88,16 @@ public class HeartClientServer extends AbstraceServer {
channelFuture.channel().eventLoop().schedule(() -> doConnect(),6,TimeUnit.SECONDS);
}
});
connect.channel().closeFuture().sync();
} catch (Exception t){
t.getStackTrace();
} catch (Throwable t){
t.printStackTrace();
this.doDestroy();
}
}
public void pingpong() {
new Thread(()->{
System.out.println("pingpong被调用次数"+i++);
executor.submit(()->{
while (channel!=null && channel.isActive()){
System.out.println("----ppp-----");
System.out.println(channel.id().toString()+"----ppp-----");
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
@@ -106,6 +109,6 @@ public class HeartClientServer extends AbstraceServer {
}
channel.writeAndFlush(log);
}
}).start();
});
}
}

View File

@@ -49,7 +49,7 @@ public class HeartConsumerHandler extends SimpleChannelInboundHandler {
if (evt instanceof IdleStateEvent){
IdleStateEvent stateEvent = (IdleStateEvent) evt;
System.out.println(((IdleStateEvent) evt).state().toString());
if (stateEvent.state() == IdleState.READER_IDLE) {
if (stateEvent.state() == IdleState.WRITER_IDLE) {
//如果五秒内写失败,说明服务网络异常
ctx.close();
server.doConnect();

View File

@@ -173,18 +173,18 @@ public class PickingService {
wmsToAcsService.toCommand(convery, "1");
}
// PickingService pickingService = SpringContextHolder.getBean(this.getClass());
// pickingService.disGroup(mst);
// //只有透传才有vehicle_code参数否则只有inst_id
// FlowContinueEvent continueEvent = new FlowContinueEvent(mst.getProc_inst_id(), (PermeateFunction<String, String>) (inst_id, vehicle_code) -> iMdPbVehicleMaterService.update(new UpdateWrapper<MdPbVehicleMater>()
// .set("proc_inst_id",inst_id).eq("vehicle_code",vehicle_code)), null)
// .setDto(dto);
// continueEvent.setCallback(emp->{
// iFormDataService.update(new UpdateWrapper<PmFormData>()
// .set("status",StatusEnum.FORM_STATUS.code("执行中"))
// .eq("id",mst.getId()));
// });
// BussEventMulticaster.Publish(continueEvent);
PickingService pickingService = SpringContextHolder.getBean(this.getClass());
pickingService.disGroup(mst);
//只有透传才有vehicle_code参数否则只有inst_id
FlowContinueEvent continueEvent = new FlowContinueEvent(mst.getProc_inst_id(), (PermeateFunction<String, String>) (inst_id, vehicle_code) -> iMdPbVehicleMaterService.update(new UpdateWrapper<MdPbVehicleMater>()
.set("proc_inst_id",inst_id).eq("vehicle_code",vehicle_code)), null)
.setDto(dto);
continueEvent.setCallback(emp->{
iFormDataService.update(new UpdateWrapper<PmFormData>()
.set("status",StatusEnum.FORM_STATUS.code("执行中"))
.eq("id",mst.getId()));
});
BussEventMulticaster.Publish(continueEvent);
}