package com.luyouchina.train.core.common.util;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import org.bson.types.ObjectId;
import com.luyouchina.comm.DateUtil;
import com.luyouchina.comm.MongoUtil;
import com.luyouchina.comm.RandUtil;
import com.luyouchina.comm.ShardedJedisCommands;
import com.luyouchina.comm.model.RequestObject;
import com.luyouchina.comm.model.ResponseObject;
import com.luyouchina.logClient.Pusher;
import com.luyouchina.logClient.entity.SysLog;
import com.luyouchina.train.core.common.repository.TraExmOrderinfomRepository;
import com.mongodb.BasicDBObject;
import com.mongodb.DBCollection;
import com.mongodb.DBObject;
/**
* 该队列用于处理考试免报名的订单处理
* @date 2017年1月10日
*/
public class OrderQueue {
//存放当月的队列
private static Map> map = new HashMap>();
//private static Queue queue = new ConcurrentLinkedQueue();
//业务加锁
private static Queue queue = new LinkedList();
private String collection = "sys_serialid";
private TraExmOrderinfomRepository traExmOrderinfomRepository;
private ShardedJedisCommands shardedJedisConn;// 缓存连接
public OrderQueue(){
traExmOrderinfomRepository = SingleBeanFactory.getBean(TraExmOrderinfomRepository.class);
shardedJedisConn = new ShardedJedisCommands();// 缓存连接
}
public OrderQueue(String test){
// traExmOrderinfomRepository = SingleBeanFactory.getBean(TraExmOrderinfomRepository.class);
// shardedJedisConn = new ShardedJedisCommands();// 缓存连接
}
/**
* @version : 1.00
* @create time : 2016年10月31日下午2:27:48
* @param param
* @return ResponseObject
* @description : 批量生成订单(免报名)
*/
@SuppressWarnings("unchecked")
public void saveOrder(Map param) {
long s = new Date().getTime();
// 考试id
final String exmid = (String) param.get("exmid");
System.out.println(exmid+"开始批量生成订单。。。。。。");
// 考试对象
final DBObject exam = (DBObject) param.get("exam");
// 指定人员
final List