Prechádzať zdrojové kódy

修改揽件定时器

yueshen 5 rokov pred
rodič
commit
ef2fcae7d5

+ 13 - 2
watero-rst-web/src/main/java/com/iamberry/rst/controllers/mq/MQTask.java

@@ -26,6 +26,7 @@ import com.iamberry.rst.utils.EfastUtil;
 import com.iamberry.wechat.tools.ResponseJson;
 import net.sf.json.JSONArray;
 import net.sf.json.JSONObject;
+import org.apache.poi.hssf.model.InternalWorkbook;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.InitializingBean;
@@ -588,15 +589,24 @@ public class MQTask implements InitializingBean {
 	//@Scheduled(cron = "*/10 * * * * ?")
 	//@Scheduled(cron = "0 0 9,11,14,16,18,20 * * ? ")//推送时间分别为每天早上九点、中午十一点、下午三点、下午六点、晚上八点
 	//@Scheduled(cron = "0 0 */1 * * ?")//每小时执行一次
-//	@Scheduled(cron = "0 0/3 * * * ?")//每三分钟执行一次
-	@Scheduled(cron = "0 0/30 * * * ?")//每半个小时执行一次
+	@Scheduled(cron = "0 0/3 * * * ?")//每三分钟执行一次
+//	@Scheduled(cron = "0 0/30 * * * ?")//每半个小时执行一次
 	public void orderCaseDate(){
 		logger.info("------------查询订单揽件时间 start-----------");
 		List<SalesOrder> salesOrderList = salesOrderService.orderAfterCaseDate();
 		Integer num = 0;
+		Integer numSellpNum = 0;
 		if(salesOrderList != null && salesOrderList.size()>0){
 			logger.info("------------查询订单揽件时间 - 需要查询揽件订单数量:"+ salesOrderList.size() +"-----------");
 			for (SalesOrder salesOrder:salesOrderList) {
+				try {
+					if(numSellpNum > 30){
+						numSellpNum =0;
+						Thread.sleep(60000);
+					}
+				} catch (InterruptedException e) {
+					e.printStackTrace();
+				}
 				LogisticsInfo log = new LogisticsInfo();
 				log.setLogisticsRstCode(salesOrder.getSalesPostFirm());
 				List<LogisticsInfo> listlog = logisticsInfoService.getLogisticsInfoList(log);
@@ -611,6 +621,7 @@ public class MQTask implements InitializingBean {
 					}
 					num ++;
 				}
+				numSellpNum++;
 			}
 		}
 		logger.info("------------查询订单揽件时,本次处理揽件事件数量"+ num +" end-----------");