|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSON; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.core.annotations.ManagerAuth; | 
|---|
|  |  |  | import com.core.common.Arith; | 
|---|
|  |  |  | import com.core.common.Cools; | 
|---|
|  |  |  | import com.core.common.DateUtils; | 
|---|
|  |  |  | import com.core.common.R; | 
|---|
|  |  |  | import com.zy.asrs.domain.enums.CrnStatusType; | 
|---|
|  |  |  | import com.zy.asrs.domain.enums.SiteStatusType; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @GetMapping("/barcode/output/site") | 
|---|
|  |  |  | public R crnOutput(){ | 
|---|
|  |  |  | //        StringBuilder str = new StringBuilder(); | 
|---|
|  |  |  | //        String s; | 
|---|
|  |  |  | //        int i = 0; | 
|---|
|  |  |  | //        while((s = OutputQueue.CRN.poll()) != null && i <=32) { | 
|---|
|  |  |  | //            str.append("\n").append(s); | 
|---|
|  |  |  | //            i++; | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | //        return R.ok().add(str.toString()); | 
|---|
|  |  |  | return R.ok().add(JSON.toJSONString(new ArrayList<>(OutputQueue.BARCODE))); | 
|---|
|  |  |  | ArrayList<JSONObject> jsonObjects = new ArrayList<>(OutputQueue.BARCODE); | 
|---|
|  |  |  | jsonObjects.sort(new Comparator<JSONObject>() { | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public int compare(JSONObject o1, JSONObject o2) { | 
|---|
|  |  |  | Date o1Time = DateUtils.convert(o1.getString("time"), DateUtils.yyyyMMddHHmmss_F); | 
|---|
|  |  |  | Date o2Time = DateUtils.convert(o2.getString("time"), DateUtils.yyyyMMddHHmmss_F); | 
|---|
|  |  |  | return (int) (o2Time.getTime() - o1Time.getTime()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | return R.ok().add(JSON.toJSONString(jsonObjects)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|