zhangxin преди 1 година
родител
ревизия
779b1219e6

+ 67 - 0
warewms-ams/src/main/java/com/warewms/ams/ndc/AciService.java

@@ -236,5 +236,72 @@ public class AciService {
             }
         }
     }
+
+//    public void init() throws IOException {
+//        selector = Selector.open();
+//        try {
+//            socketChannel = socketChannel.open(new InetSocketAddress(IP, PORT));
+//            socketChannel.configureBlocking(false);
+//            socketChannel.register(selector, SelectionKey.OP_READ);
+//        } catch (Exception exception) {
+//            log.warn("AciService socketChannel open is on error");
+//            try {
+//                Thread.currentThread().sleep(3000);
+//            }catch (InterruptedException e) {
+//                throw new BaseException(e.getMessage());
+//            }
+//            init();
+//        }
+//    }
+//
+
+//    public void readInfo() {
+//        //读取客户端消息
+//        new Thread(() -> {
+//            while (true) {
+//                try {
+//                    int readChannels = selector.select();
+//                    if (readChannels > 0) {
+//                        Iterator<SelectionKey> iterator = selector.selectedKeys().iterator();
+//                        while (iterator.hasNext()) {
+//                            SelectionKey key = iterator.next();
+//                            if (!key.isReadable()) {
+//                                iterator.remove();
+//                                continue;
+//                            }
+//                            SocketChannel channel = (SocketChannel) key.channel();
+//                            channel.configureBlocking(false);
+//                            ByteBuffer buffer = ByteBuffer.allocate(BUFF_SIZE);
+//                            channel.read(buffer);
+//                            List<Order> bufferSeparators = socketBufferService.bufferSeparator(buffer.array());
+//                            for (Order order : bufferSeparators) {
+//                                log.info("NDC Msg info is :{}", order);
+//                                switch (order.getMessageType()) {
+//                                    case Aci.MSG_ORDER_STATUS://车体状态信息、位置信息
+//                                        socketBufferService.handleMsgOrderStatus(order.getParameters());
+//                                        break;
+//                                    case Aci.MSG_EVENT://任务反馈、自定义消息
+//                                        socketBufferService.handleMsgEvent(order.getParameters());
+//                                        break;
+//                                    case Aci.MSG_STOP://交通管制暂停
+//                                        socketBufferService.handleMsgStopStart(order.getParameters(), true);
+//                                        break;
+//                                    case Aci.MSG_START://启动信息
+//                                        socketBufferService.handleMsgStopStart(order.getParameters(), false);
+//                                        break;
+//                                    case Aci.MSG_ORDER_ACK://信息接收反馈
+//                                        socketBufferService.handleMsgOrderAck(order.getParameters());
+//                                        break;
+//                                }
+//                            }
+//                            iterator.remove();
+//                        }
+//                    }
+//                } catch (Exception e) {
+//                    throw new BaseException(e.getMessage());
+//                }
+//            }
+//        }).start();
+//    }
 }
 

+ 3 - 1
warewms-ams/src/main/java/com/warewms/ams/ndc/controller/AmsTaskController.java

@@ -39,7 +39,9 @@ public class AmsTaskController extends BaseController {
             @ApiImplicitParam(name = "taskNo", value = "任务编号", paramType = "query", dataType = "String"),
             @ApiImplicitParam(name = "aciIndex", value = "aci主键", paramType = "query", dataType = "String"),
             @ApiImplicitParam(name = "stFrom", value = "起点", paramType = "query", dataType = "Long"),
-            @ApiImplicitParam(name = "stTo", value = "终点", paramType = "query", dataType = "Long")
+            @ApiImplicitParam(name = "stTo", value = "终点", paramType = "query", dataType = "Long"),
+            @ApiImplicitParam(name = "beginTime", value = "起始时间", paramType = "query", dataType = "String"),
+            @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
     })
     public AjaxResult page(@ApiIgnore @RequestParam Map<String, Object> params){
         PageData<AmsTaskDTO> page = amsTaskService.page(params);

+ 7 - 1
warewms-ams/src/main/java/com/warewms/ams/ndc/service/impl/AmsTaskServiceImpl.java

@@ -2,6 +2,7 @@ package com.warewms.ams.ndc.service.impl;
 
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.comparator.CompareUtil;
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -19,6 +20,7 @@ import com.warewms.ams.ndc.service.IAmsTaskService;
 import com.warewms.ams.ndc.service.IBaseLocationInfoService;
 import com.warewms.common.exception.base.BaseException;
 import com.warewms.common.utils.ConvertUtils;
+import com.warewms.common.utils.DateUtils;
 import com.warewms.common.utils.redis.RedisCache;
 import com.warewms.common.utils.string.StringUtils;
 import com.warewms.framework.service.impl.CrudServiceImpl;
@@ -32,6 +34,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.client.RestTemplate;
 
 import java.math.BigDecimal;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -366,10 +369,13 @@ public class AmsTaskServiceImpl extends CrudServiceImpl<AmsTaskMapper, AmsTask,
         Integer aciIndex = StringUtils.isNotBlank((String) params.get("aciIndex")) ? Integer.parseInt((String) params.get("aciIndex")) : null;
         Integer stFrom = StringUtils.isNotBlank((String) params.get("stFrom")) ? Integer.parseInt((String) params.get("stFrom")) : null;
         Integer stTo = StringUtils.isNotBlank((String) params.get("stTo")) ? Integer.parseInt((String) params.get("stTo")) : null;
+        Date beginTime = StringUtils.isNotBlank((String) params.get("beginTime")) ? DateUtil.parse((String) params.get("beginTime"), DateUtils.YYYY_MM_DD_HH_MM_SS) : null;
+        Date endTime = StringUtils.isNotBlank((String) params.get("endTime")) ? DateUtil.parse((String) params.get("endTime"), DateUtils.YYYY_MM_DD_HH_MM_SS) : DateUtils.getNowDate();
         queryWrapper.lambda().eq(ObjectUtil.isNotNull(taskNo), AmsTask::getTaskNo, taskNo)
                 .eq(ObjectUtil.isNotNull(aciIndex), AmsTask::getAciIndex, aciIndex)
                 .eq(ObjectUtil.isNotNull(stFrom), AmsTask::getStFrom, stFrom)
-                .eq(ObjectUtil.isNotNull(stTo), AmsTask::getStTo, stTo);
+                .eq(ObjectUtil.isNotNull(stTo), AmsTask::getStTo, stTo)
+                .between(AmsTask::getAddtime, beginTime, endTime);
         return queryWrapper;
     }
 }