背景
假设有k个地市
,每个地市有x个订单
执行,总共kx个订单
,而每个订单中又有一个字段体现出地市信息。
@Component
@Slf4j
public class AhOrdersXxlJob {
//城市编号
private static final List<Integer> CITY_ID_LIST = Arrays.asList(550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 561, 562, 563, 564, 566);
//每个城市的任务数
private static final int PER_LATN_TASK_NUM = 30;
// 任务数据库
private static final Map<Integer, List<String>> singleMachineMultiTasks;
static {
singleMachineMultiTasks = new HashMap<>();
CITY_ID_LIST.forEach(city -> {
List<String> tasks = new ArrayList<>(PER_LATN_TASK_NUM);
IntStream.rangeClosed(1, PER_LATN_TASK_NUM).forEach(index -> {
String orderInfo = city + "------NO." + index ;
tasks.add(orderInfo);
});