|
@@ -2,20 +2,16 @@ package com.steerinfo.dil.service.impl;
|
|
|
|
|
|
import com.steerinfo.dil.feign.IMFeign;
|
|
|
import com.steerinfo.dil.mapper.QmsQueueListMapper;
|
|
|
-import com.steerinfo.dil.mapper.QmsQueueResultMapper;
|
|
|
import com.steerinfo.dil.mapper.QmsQueueSpellingListMapper;
|
|
|
import com.steerinfo.dil.mapper.QueuingRulesMapper;
|
|
|
-import com.steerinfo.dil.model.QmsQueueList;
|
|
|
-import com.steerinfo.dil.model.QmsQueueSpellingList;
|
|
|
import com.steerinfo.dil.service.IQueuingRulesService;
|
|
|
import com.steerinfo.dil.util.DataChange;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.math.BigDecimal;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@@ -27,18 +23,11 @@ import java.util.*;
|
|
|
@Service
|
|
|
public class QueuingRulesServiceImpl implements IQueuingRulesService {
|
|
|
|
|
|
- @Resource
|
|
|
- private QueuingRulesMapper queuingRulesMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private QmsQueueListMapper qmsQueueListMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private QmsQueueSpellingListMapper qmsQueueSpellingListMapper;
|
|
|
-
|
|
|
@Autowired
|
|
|
private IMFeign imFeign;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private QueueDealWithAsync queueDealWithAsync;
|
|
|
|
|
|
/**
|
|
|
* 定时检查 钢材科已确认进厂之后 30分钟没有结束 自动回滚到队列末尾,移除可进厂时间
|
|
@@ -46,39 +35,8 @@ public class QueuingRulesServiceImpl implements IQueuingRulesService {
|
|
|
@Scheduled(fixedRate = 1000 * 60)
|
|
|
public void checkoutQueueList(){
|
|
|
long nowTime = System.currentTimeMillis();
|
|
|
- //查询所有单拼排队网格已经确认进厂的记录
|
|
|
- List<Map<String, Object>> listListMap = queuingRulesMapper.getAllSureTimeList();
|
|
|
- for (Map<String, Object> map : listListMap) {
|
|
|
- if((nowTime - ((Date) map.get("entrySureTime")).getTime()) > 1800000){
|
|
|
- //如果超过勾选时间30分钟 自动回滚到队列最后
|
|
|
- BigDecimal listId = DataChange.dataToBigDecimal(map.get("listId"));
|
|
|
- Integer maxListNodeOrder = qmsQueueListMapper.getMaxListNodeOrder(map);
|
|
|
- queuingRulesMapper.updateListToLast(listId, maxListNodeOrder + 1);
|
|
|
- //移除可进厂资格
|
|
|
- queuingRulesMapper.updateEnFactory(DataChange.dataToBigDecimal(map.get("resultTotalId")));
|
|
|
- if((nowTime - ((Date) map.get("insertTime")).getTime()) > 86400000){
|
|
|
- //如果大于一天则直接删除队列信息
|
|
|
- qmsQueueListMapper.deleteByPrimaryKey(listId);
|
|
|
- queuingRulesMapper.updateQQRRemoveList(DataChange.dataToBigDecimal(map.get("resultId")));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //查询所有多拼排队网格已经确认进厂的记录
|
|
|
- List<Map<String, Object>> allSureTimeSpellingList = queuingRulesMapper.getAllSureTimeSpellingList();
|
|
|
- for (Map<String, Object> map : allSureTimeSpellingList) {
|
|
|
- if ((nowTime - ((Date) map.get("entrySureTime")).getTime()) > 1800000) {
|
|
|
- BigDecimal spellingResultId = DataChange.dataToBigDecimal(map.get("spellingResultId"));
|
|
|
- //如果超过勾选时间30分钟 自动回滚到队列最后
|
|
|
- queuingRulesMapper.updateSpellingListToLast(spellingResultId);
|
|
|
- //移除可进厂资格
|
|
|
- queuingRulesMapper.updateEnFactory(DataChange.dataToBigDecimal(map.get("resultTotalId")));
|
|
|
- if((nowTime - ((Date) map.get("spellingSureTime")).getTime()) > 86400000){
|
|
|
- //如果大于一天则直接删除队列信息
|
|
|
- qmsQueueSpellingListMapper.deleteByPrimaryKey(spellingResultId);
|
|
|
- queuingRulesMapper.updateQQRRemoveList(DataChange.dataToBigDecimal(map.get("resultId")));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ queueDealWithAsync.dealWithOne(nowTime);
|
|
|
+ queueDealWithAsync.dealWithTwo(nowTime);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -87,26 +45,10 @@ public class QueuingRulesServiceImpl implements IQueuingRulesService {
|
|
|
@Scheduled(fixedRate = 1000 * 60 * 30)
|
|
|
public void checkoutQueue(){
|
|
|
long nowTime = System.currentTimeMillis();
|
|
|
- List<Map<String, Object>> listMap = queuingRulesMapper.getAllNotSureEnFactoryList();
|
|
|
- for (Map<String, Object> map : listMap) {
|
|
|
- if((nowTime - ((Date) map.get("insertTime")).getTime()) > 86400000){
|
|
|
- //踢出队列
|
|
|
- qmsQueueListMapper.deleteByPrimaryKey(DataChange.dataToBigDecimal(map.get("listId")));
|
|
|
- //修改信息
|
|
|
- queuingRulesMapper.updateQQRRemoveList(DataChange.dataToBigDecimal(map.get("resultId")));
|
|
|
- }
|
|
|
- }
|
|
|
- List<Map<String, Object>> spellingListMap = queuingRulesMapper.getAllNotSureEnFactorySpellingList();
|
|
|
- for (Map<String, Object> map : spellingListMap) {
|
|
|
- if((nowTime - ((Date) map.get("spellingSureTime")).getTime()) > 86400000){
|
|
|
- //如果大于一天则直接删除队列信息
|
|
|
- qmsQueueSpellingListMapper.deleteByPrimaryKey(DataChange.dataToBigDecimal(map.get("spellingResultId")));
|
|
|
- queuingRulesMapper.updateQQRRemoveList(DataChange.dataToBigDecimal(map.get("resultId")));
|
|
|
- }
|
|
|
- }
|
|
|
+ queueDealWithAsync.dealWithThree(nowTime);
|
|
|
+ queueDealWithAsync.dealWithFour(nowTime);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 推送消息给websocket
|
|
|
*/
|