欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

测试数据

程序员文章站 2022-06-10 20:28:39
...
{
	"rcode": 0,
	"rmsg": "success",
	"data": {
		"workstations": [{
			"id": 1,
			"name": "饮料",
			"number": "G0001",
			"menus": [{
				"menuNumber": "M048",
				"menuType": 0,
				"prepareAlone": 1
			}],
			"printers": [{
				"printerId": 1,
				"printerNumber": "P001",
				"printerName": "测试打印机",
				"printerType": 1,
				"printerAddress": "192.168.3.62",
				"printerPort": 9100,
				"stationId": 1
			}]
		},{
			"id": 2,
			"name": "饭食",
			"number": "G0002",
			"menus": [{
				"menuNumber": "M054",
				"menuType": 0,
				"prepareAlone": 1
			}],
			"printers": [{
				"printerId": 2,
				"printerNumber": "P002",
				"printerName": "测试打印机",
				"printerType": 1,
				"printerAddress": "192.168.3.114",
				"printerPort": 9100,
				"stationId": 2
			}]
		}
		]
	}
}
[{
			"id": 1,
			"name": "饮料",
			"number": "G0001",
			"menus": [{
				"menuNumber": "M086",
				"menuType": 0,
				"prepareAlone": 1
			},{
				"menuNumber": "M032",
				"menuType": 0,
				"prepareAlone": 1
			},{
				"menuNumber": "M026",
				"menuType": 0,
				"prepareAlone": 1
			}],
			"printers": [{
				"printerId": 1,
				"printerNumber": "P001",
				"printerName": "测试打印机",
				"printerType": 1,
				"printerAddress": "192.168.3.62",
				"printerPort": 9100,
				"stationId": 1
			}]
		},{
			"id": 2,
			"name": "饭食",
			"number": "G0002",
			"menus": [{
				"menuNumber": "M018",
				"menuType": 0,
				"prepareAlone": 0
			},{
				"menuNumber": "M080",
				"menuType": 0,
				"prepareAlone":0
			}],
			"printers": [{
				"printerId": 2,
				"printerNumber": "P002",
				"printerName": "测试打印机",
				"printerType": 1,
				"printerAddress": "192.168.3.114",
				"printerPort": 9100,
				"stationId": 2
			}]
		}
		]
public boolean getWorkMenu() {
        BaseResponse<GetWorkMenuListResponse> response = ImClient.create().getWorkMenu();
        if (response.getResponseCode() == BaseResponse.NORMAL) {
/*            List<ITakeWork> allWorks = response.getData().getWorkstations();
            WorkManager.get().setAllWorks(allWorks);
            WorkManager.get().setCurrentWorks();
            WorkManager.get().setWorkOrders();
            LogManager.get().getLogger(this.getClass()).info("getWorkMenu:获取档口列表及其菜品数据成功");
            PrintManager.getInstance().connectNetworkPrinter(WaiterApplication.get());*/
            String resp = "[{\n" +
                    "\t\"id\": 1,\n" +
                    "\t\"name\": \"饮料\",\n" +
                    "\t\"number\": \"G0001\",\n" +
                    "\t\"menus\": [{\n" +
                    "\t\t\"menuNumber\": \"M401\",\n" +
                    "\t\t\"menuType\": 0,\n" +
                    "\t\t\"prepareAlone\": 1\n" +
                    "\t}],\n" +
                    "\t\"printers\": [{\n" +
                    "\t\t\"printerId\": 1,\n" +
                    "\t\t\"printerNumber\": \"P001\",\n" +
                    "\t\t\"printerName\": \"测试打印机\",\n" +
                    "\t\t\"printerType\": 1,\n" +
                    "\t\t\"printerAddress\": \"192.168.3.62\",\n" +
                    "\t\t\"printerPort\": 9100,\n" +
                    "\t\t\"stationId\": 1\n" +
                    "\t}]\n" +
                    "}, {\n" +
                    "\t\"id\": 2,\n" +
                    "\t\"name\": \"饭食\",\n" +
                    "\t\"number\": \"G0002\",\n" +
                    "\t\"menus\": [{\n" +
                    "\t\t\"menuNumber\": \"M054\",\n" +
                    "\t\t\"menuType\": 0,\n" +
                    "\t\t\"prepareAlone\": 1\n" +
                    "\t}],\n" +
                    "\t\"printers\": [{\n" +
                    "\t\t\"printerId\": 2,\n" +
                    "\t\t\"printerNumber\": \"P002\",\n" +
                    "\t\t\"printerName\": \"测试打印机\",\n" +
                    "\t\t\"printerType\": 1,\n" +
                    "\t\t\"printerAddress\": \"192.168.3.114\",\n" +
                    "\t\t\"printerPort\": 9100,\n" +
                    "\t\t\"stationId\": 2\n" +
                    "\t}]\n" +
                    "}]";
            List<ITakeWork> allWorks = JSON.parseArray(resp, ITakeWork.class);
            WorkManager.get().setAllWorks(allWorks);
            WorkManager.get().setCurrentWorks();
            WorkManager.get().setWorkOrders();
            LogManager.get().getLogger(this.getClass()).info("getWorkMenu:获取档口列表及其菜品数据成功");
            PrintManager.getInstance().connectNetworkPrinter(WaiterApplication.get());
            return true;
        } else {
            LogManager.get().getLogger(this.getClass()).info("getWorkMenu:获取档口列表及其菜品数据失败");
            String resp = "[{\n" +
                    "\t\"id\": 1,\n" +
                    "\t\"name\": \"饮料\",\n" +
                    "\t\"number\": \"G0001\",\n" +
                    "\t\"menus\": [{\n" +
                    "\t\t\"menuNumber\": \"M401\",\n" +
                    "\t\t\"menuType\": 0,\n" +
                    "\t\t\"prepareAlone\": 1\n" +
                    "\t}],\n" +
                    "\t\"printers\": [{\n" +
                    "\t\t\"printerId\": 1,\n" +
                    "\t\t\"printerNumber\": \"P001\",\n" +
                    "\t\t\"printerName\": \"测试打印机\",\n" +
                    "\t\t\"printerType\": 1,\n" +
                    "\t\t\"printerAddress\": \"192.168.3.62\",\n" +
                    "\t\t\"printerPort\": 9100,\n" +
                    "\t\t\"stationId\": 1\n" +
                    "\t}]\n" +
                    "}, {\n" +
                    "\t\"id\": 2,\n" +
                    "\t\"name\": \"饭食\",\n" +
                    "\t\"number\": \"G0002\",\n" +
                    "\t\"menus\": [{\n" +
                    "\t\t\"menuNumber\": \"M054\",\n" +
                    "\t\t\"menuType\": 0,\n" +
                    "\t\t\"prepareAlone\": 1\n" +
                    "\t}],\n" +
                    "\t\"printers\": [{\n" +
                    "\t\t\"printerId\": 2,\n" +
                    "\t\t\"printerNumber\": \"P002\",\n" +
                    "\t\t\"printerName\": \"测试打印机\",\n" +
                    "\t\t\"printerType\": 1,\n" +
                    "\t\t\"printerAddress\": \"192.168.3.114\",\n" +
                    "\t\t\"printerPort\": 9100,\n" +
                    "\t\t\"stationId\": 2\n" +
                    "\t}]\n" +
                    "}]";
            try {
                List<ITakeWork> allWorks = JSON.parseArray(resp, ITakeWork.class);
                WorkManager.get().setAllWorks(allWorks);
                WorkManager.get().setCurrentWorks();
                WorkManager.get().setWorkOrders();
                LogManager.get().getLogger(this.getClass()).info("getWorkMenu:获取档口列表及其菜品数据成功");
                PrintManager.getInstance().connectNetworkPrinter(WaiterApplication.get());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return false;
        }
    }
    ```