Commit 22306c42 sunke

禁用托盘接口增加禁用时间

两个月前未完成需求单不再加载
1 个父辈 aa6455fd
......@@ -506,6 +506,9 @@ public class OutInfoCache {
List<OutInfo> unEndOutInfoList = outInfoDao.findUnEndOutInfos();
long now = System.currentTimeMillis();
for (OutInfo outInfo : unEndOutInfoList) {
if(now - outInfo.getMdate().getTime() > 60 * 24 * 60 * 60 * 1000){
log.info(outInfo.gethSerial() + "为两个月前需求单,忽略");
}
// if(now - outInfo.getMdate().getTime() > 10 * 24 * 60 * 60 * 1000){
// //10天前的需求单(非紧急料),关闭,并解绑
// if(!outInfo.isUrgentAction()){
......
package com.myproject.webapp.controller.webService;
import com.google.common.collect.Lists;
import com.myproject.bean.qisda.ResultBean;
import com.myproject.bean.update.Barcode;
import com.myproject.bean.update.Component;
import com.myproject.bean.update.StoragePos;
import com.myproject.util.DateUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.util.Strings;
......@@ -12,10 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 禁用托盘信息
......@@ -32,6 +31,11 @@ public class QisdaDisabledTrayController {
*/
protected String disabledTray = "";
/**
* 禁用托盘缓存信息,key为托盘号,value为禁用时间
*/
protected Map<String, String> disabledTrayMap = new HashMap<>();
protected final static Logger log = LogManager.getLogger(QisdaDisabledTrayController.class);
/**
......@@ -39,8 +43,8 @@ public class QisdaDisabledTrayController {
*/
@RequestMapping(value = "/getDisabledTray")
@ResponseBody
public String smallBindCount(HttpServletRequest request){
return disabledTray;
public Map<String, String> smallBindCount(HttpServletRequest request){
return disabledTrayMap;
}
@RequestMapping(value = "/updateDisabledTray")
......@@ -48,13 +52,32 @@ public class QisdaDisabledTrayController {
public ResultBean getReelSize(HttpServletRequest request) {
try{
String trayList = request.getParameter("disabledTray");
if(Strings.isEmpty(trayList)){
if(Strings.isBlank(trayList)){
trayList = "";
}
if(!disabledTray.equals(trayList)){
log.info("收到禁用托盘更新信息:"+trayList);
}
if(Strings.isNotBlank(trayList)){
List<String> newDisabeldTrayList = Lists.newArrayList(trayList.split(","));
Collection<String> existDisabedTrayList = disabledTrayMap.keySet();
for (String existDisabedTray : existDisabedTrayList) {
if(!newDisabeldTrayList.contains(existDisabedTray)){
//已经启用
log.info("托盘["+existDisabedTray+"]已启用,从缓存中清除");
disabledTrayMap.remove(existDisabedTray);
};
}
for (String newDisabeldTray : newDisabeldTrayList) {
if(!existDisabedTrayList.contains(newDisabeldTray)){
String dateTime = DateUtil.toDateString(new Date(),"yyyy-MM-dd HH:mm:ss");
log.info("托盘["+newDisabeldTray+"]已禁用,加入缓存,禁用时间:"+dateTime);
disabledTrayMap.put(newDisabeldTray,dateTime);
}
}
}
disabledTray = trayList;
return ResultBean.newOkResult("");
}catch(Exception e){
log.error("上传禁用托盘信息出错",e);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!