From 301115d5e96b56cd093eee3fcff2d60a15184162 Mon Sep 17 00:00:00 2001 From: hjg <hjg@123.com> Date: 星期一, 05 二月 2024 14:28:29 +0800 Subject: [PATCH] 明晟装车记录 --- JavaSource/com/mandi/webservice/service/impl/FdXSTDService.java | 307 ++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 217 insertions(+), 90 deletions(-) diff --git a/JavaSource/com/mandi/webservice/service/impl/FdXSTDService.java b/JavaSource/com/mandi/webservice/service/impl/FdXSTDService.java index aea6a42..ec33ed7 100644 --- a/JavaSource/com/mandi/webservice/service/impl/FdXSTDService.java +++ b/JavaSource/com/mandi/webservice/service/impl/FdXSTDService.java @@ -8,6 +8,7 @@ import com.mandi.basicconfig.mapper.NczsjMapper; import com.mandi.basicconfig.persist.*; import com.mandi.common.JSONobj; +import com.mandi.common.Jacksonmethod; import com.mandi.common.ParamFileter.BigDecimalfiter; import com.mandi.common.SpringContext; import com.mandi.common.Wxhtmethod; @@ -66,7 +67,7 @@ public static Boolean refreshMsLedLock = false; public static Boolean refreshYrLedLock = false; - + public static Boolean refreshKjLedLock = false; @Override @Transactional(rollbackFor=Exception.class) public ObjectResult<Boolean> saveFd_xstd(String dataArr) throws Exception { @@ -414,6 +415,7 @@ prr.setErrmsg("鍙傛暟锛氬崱鍙峰叧鑱旂殑杞︾墝鍙峰拰涓氬姟鍗曞叧鑱旂殑杞︾墝鍙蜂笉涓�鑷�"); return prr; } + // yktywdh = fdb.getBsNo(); int wcnum=this.bsper.getweightDoc(vehicleId, fdb.getBsNo()); @@ -435,10 +437,10 @@ return prr; } } catch (Exception e) { - // TODO: handle exception } String currPch="";// 褰撳墠鎵规鍙� + List<String> pchList = new ArrayList<>(); //绗竴娆℃坊鍔犺鍗歌褰曞彂閫佽杞︿俊鎭� int sfzc=this.fbper.getbsitembyNo(fdb.getBsNo()); if(sfzc<=0) { @@ -452,7 +454,25 @@ } // 鐜板満杩囧畬姣涢噸鍚庡嚭鐜版壂鐮佽杞︾殑锛屽繀椤婚噸鏂拌繃纾� int grossNum=this.bsper.getgrosstDoc(vehicleId, fdb.getBsNo()); - + List tdmxPchList = new ArrayList(); + for (JsonElement je : dataArr) { + JsonObject jo=je.getAsJsonObject(); + String tdmx_pch = jo.get("tdmx_pch").getAsString(); + tdmxPchList.add(tdmx_pch); + } + if("08".equals(fdb.getSdepartNo())) { // 鍙槸涔夌憺鍘傚尯鏈夋晥 + // 妫�鏌ユ槸鍚﹀綋鍓嶅尯鍩熷凡缁忔帓闃� + Map paramMap = new HashMap(); + paramMap.put("vehicleId", vehicleId); + paramMap.put("tdmxPchList", tdmxPchList); + String jsonStr = Jacksonmethod.tojson(paramMap, false); + JsonObject jsonObject = Wxhtmethod.postJsonStr(Contants.yr_canDoScanUrl, jsonStr); + if (jsonObject.get("code").getAsInt() != 0) { + prr.setCode(1); + prr.setErrmsg(jsonObject.get("errmsg").getAsString()); + return prr; + } + } for (JsonElement je : dataArr) { JsonObject jo=je.getAsJsonObject(); String tdmx_pch = jo.get("tdmx_pch").getAsString(); @@ -562,6 +582,7 @@ remp.put("tdmx_tdfl",tdmx.getTdmx_tdfl()); relist.add(remp); currPch = tdmx.getTdmx_pch(); + pchList.add(tdmx.getTdmx_pch()); } if(grossNum>0) { @@ -587,28 +608,49 @@ // 姝ゅ寮傛瑙﹀彂涓�涓嬫槑鏅熷彂杞� if("06".equals(fdb.getSdepartNo())) { - final String cph = currPch; + final String pch = currPch; + final String finalVehicleId = vehicleId; ThreadPoolUtil.getInstance().execute(()->{ + Map paramMap = new HashMap(); + paramMap.put("vehicleId", finalVehicleId); + paramMap.put("tdmxPchList", tdmxPchList); + String jsonStr = Jacksonmethod.tojson(paramMap, false); + JsonObject jsonObject = Wxhtmethod.postJsonStr(Contants.ms_DoScanUrl, jsonStr); + if (jsonObject.get("code").getAsInt() != 0) { + prr.setCode(1); + prr.setErrmsg(jsonObject.get("errmsg").getAsString()); + // return prr; + } + }); + // 寤惰繜1.5绉掓墽琛岋紝淇濊瘉鏁版嵁鎵ц瀹屼簡 + ThreadPoolUtil.getInstance().execute(()->{ + synchronized (FdXSTDService.refreshMsLedLock) { + if (FdXSTDService.refreshMsLedLock) { // 绯荤粺绻佸繖 + log.info(finalVehicleId + "" + pch + "绯荤粺绻佸繖锛�"); + return; + } + } try { synchronized (FdXSTDService.refreshMsLedLock) { - if (FdXSTDService.refreshMsLedLock) { // 绯荤粺绻佸繖 - return ; - } FdXSTDService.refreshMsLedLock = true; } - sendToMsLed(cph); + sendToMsLed(pch); } catch (Exception e) { - log.error(e); + log.error("鍑虹幇寮傚父锛�"+ e.getMessage(),e); } finally { synchronized (FdXSTDService.refreshMsLedLock) { FdXSTDService.refreshMsLedLock = false; } } - }); + },1500); } if("08".equals(fdb.getSdepartNo())) { final String cph = currPch; ThreadPoolUtil.getInstance().execute(()->{ + // 杩欎釜鍦版柟涓嶅啀璇锋眰 + /*Map scanCodeParamMap = new HashMap(); + scanCodeParamMap.put("pch",cph); + Wxhtmethod.post(Contants.yr_scanCodeNoticeUrl, scanCodeParamMap);*/ try { synchronized (FdXSTDService.refreshYrLedLock) { if (FdXSTDService.refreshYrLedLock) { // 绯荤粺绻佸繖 @@ -625,6 +667,25 @@ } } }); + } else if("04".equals(fdb.getSdepartNo())) { // 绉戞妧 + final String cph = currPch; + ThreadPoolUtil.getInstance().execute(()->{ + try { + synchronized (FdXSTDService.refreshKjLedLock) { + if (FdXSTDService.refreshKjLedLock) { // 绯荤粺绻佸繖 + return ; + } + FdXSTDService.refreshKjLedLock = true; + } + sendToKjLed(cph); + } catch (Exception e) { + log.error(e); + } finally { + synchronized (FdXSTDService.refreshKjLedLock) { + FdXSTDService.refreshKjLedLock = false; + } + } + }); } prr.setCode(0); prr.setErrmsg("瑁呰溅鎿嶄綔鎴愬姛锛�"); @@ -633,19 +694,28 @@ } /** - * + * 鎸埌涓�鍗¢�� * @param currPch 褰撳墠鎵规鍙� */ public void sendToMsLed(String currPch){ //A鍖� 76-86 + 99-1 //B鍖� 14-33 + 99-2 //C鍖� 53-67 + 99-3 + // 2024骞存敼 + //A鍖� 73-88 + 99-1 + 40-45 + //B鍖� 14-27 + 99-2 + 46-49 + //C鍖� 50-65 + 99-3 + //D鍖� 28-39 + 69-72 + 89-98 log.info("LED-ABC褰撳墠鎵爜鎵规鍙凤細" + currPch); List<Map> totalList = tdmxper.getHwList("06"); // 鑾峰彇鏄庢櫉鎵�鏈夊湪鍔炰笟鍔″崟鐨勪俊鎭� log.info("LED-ABC鑾峰彇淇℃伅鏉℃暟锛�" + totalList.size()); Map<String,List<Map>> ywbhListMap = new HashMap<>(); for (Map map : totalList) { String ywdw = (String) map.get("tdmx_fdywbh"); + if(ywdw == null) { + log.info("鍑虹幇涓氬姟鍗曞彿涓簄ull鐨勬儏鍐碉細" + Jacksonmethod.tojson(map,false)); + continue; + } if(ywbhListMap.get(ywdw) == null) { ywbhListMap.put(ywdw, new ArrayList<>()); } @@ -655,24 +725,22 @@ //"(杞︾墝鍙�)\\-(A鍖哄凡瑁呰溅)/(A鍖烘�昏)\\-(B鍖哄凡瑁呰溅)/(B鍖烘�昏)\\-(C鍖哄凡瑁呰溅)/(C鍖烘�昏)\\r\\n"; String formatStr = "%s %s/%s %s/%s %s/%s\r\n"; // 鍙湁1涓尯 - String speakTxtFormatStr1 = "杞﹀彿%s 锛岃璐�%d浠跺凡瀹屾垚锛岃鍙告満娓呯偣璐х墿鍚庡敖蹇┒绂昏璐у尯銆�"; - // 鍙湁2涓尯 - String speakTxtFormatStr2 = "杞﹀彿%s锛�%s鍖鸿璐�%d浠跺凡鍏ㄩ儴鎵弿瀹屾垚锛岃鍙告満娓呯偣璐х墿鍚庡幓%s鍖鸿璐с��"; - // 鍙湁3涓尯 - String speakTxtFormatStr3 = "杞﹀彿%s锛�%s鍖鸿璐�%d浠跺凡鍏ㄩ儴鎵弿瀹屾垚锛岃鍙告満娓呯偣璐х墿鍚庡幓%s鍖�%s鍖鸿璐с��"; + Map speakParam = new HashMap(1); for (Map.Entry<String, List<Map>> entry : ywbhListMap.entrySet()) { // 閬嶅巻姣忎釜涓氬姟鍗曠殑 - // 褰撳墠瑁呰溅A銆丅銆丆鍖� - boolean currA = false,currB = false, currC = false; + // 褰撳墠瑁呰溅A銆丅銆丆鍖�; D鍖哄彧鍙備笌璁板綍锛屼笉鍙備笌LED鏄剧ず鍜岃瑷�鎾姤 + boolean currA = false,currB = false, currC = false, currD = false; boolean hasZcwc = false; // 淇濊瘉宸茬粡瀹屾垚浜� - // String ywhb = entry.getKey(); + String ywhb = entry.getKey(); List<Map> vehicleIdTotalList = entry.getValue(); - Map<String, Integer> totalAbcMap = new HashMap(3); // 鎬昏淇℃伅 + // 鎬昏淇℃伅 + Map<String, Integer> totalAbcMap = new HashMap(3); totalAbcMap.put("A", 0); totalAbcMap.put("B", 0); totalAbcMap.put("C", 0); - Map<String, Integer> abcMap = new HashMap(3); // 宸茶淇℃伅 + /* 宸茶淇℃伅 */ + Map<String, Integer> abcMap = new HashMap(3); abcMap.put("A", 0); abcMap.put("B", 0); abcMap.put("C", 0); @@ -680,37 +748,41 @@ for (Map map : vehicleIdTotalList) { String hw = (String) map.get("tdmx_hwmc"); String pch = (String) map.get("tdmx_pch"); - if("".equals(cph)) cph = (String) map.get("tdmx_fdcph"); + if(StringUtils.isBlank(cph)) cph = (String) map.get("tdmx_fdcph"); Integer zcbz = (Integer) map.get("tdmx_zcbz"); String hh = hw.replaceAll("\\-.*",""); hh = hh.substring(hh.length()-2); // 鍙栨渶鍚庝袱浣� int num = Integer.parseInt(hh); - if (num >= 76 && num <= 86 || hw.lastIndexOf("99-1") >= 0) { // A鍖� + if (num >= 73 && num <= 88 || hw.lastIndexOf("99-1") >= 0) { // A鍖� totalAbcMap.put("A",totalAbcMap.get("A") + 1); if (zcbz != null && zcbz == 1) { // 瑁呰溅瀹屾垚 abcMap.put("A", abcMap.get("A") + 1); hasZcwc = true; } if(pch.equals(currPch)) { - currA = true; currB = false;currC =false; + currA = true; currB = false;currC =false;currD=false; } - } else if (num >= 14 && num <= 33 || hw.lastIndexOf("99-2") >= 0) { // B鍖� + } else if (num >= 14 && num <= 27 || hw.lastIndexOf("99-2") >= 0) { // B鍖� totalAbcMap.put("B", totalAbcMap.get("B") + 1); if (zcbz != null && zcbz == 1) { abcMap.put("B", abcMap.get("B") + 1); hasZcwc = true; } if(pch.equals(currPch)) { - currA = false; currB = true;currC =false; + currA = false; currB = true;currC =false;currD=false; } - } else if (num >= 53 && num <= 67 || hw.lastIndexOf("99-3") >= 0) { // C鍖� + } else if (num >= 50 && num <= 65 || hw.lastIndexOf("99-3") >= 0) { // C鍖� totalAbcMap.put("C", totalAbcMap.get("C") + 1); if (zcbz != null && zcbz == 1) { abcMap.put("C", abcMap.get("C") + 1); hasZcwc = true; } if(pch.equals(currPch)) { - currA = false; currB = false; currC =true; + currA = false; currB = false; currC =true; currD=false; + } + } else if(num>=28 && num<=39 || (num>=69 && num<=72) || (num>=89 && num<=98)) { + if(pch.equals(currPch)) { + currA = false; currB = false;currC =false;currD=true; } } } @@ -719,77 +791,35 @@ totalAbcMap.get("A") + totalAbcMap.get("B") + totalAbcMap.get("C")) { // 闈炲綋鍓嶈溅鐗屽彿锛屽凡缁忚杞﹀畬鎴愪絾鏄湭鍑哄巶 continue; }*/ + if(totalAbcMap.get("B")==0 && totalAbcMap.get("C")==0 && totalAbcMap.get("A")==0) { + continue; + } str2 += String.format(formatStr, cph, fillWithZero(abcMap.get("A")), fillWithZero(totalAbcMap.get("A")), fillWithZero(abcMap.get("B")), fillWithZero(totalAbcMap.get("B")), fillWithZero(abcMap.get("C")), fillWithZero(totalAbcMap.get("C"))); + log.info(ywhb + "鎶曞睆鍑嗗瀹屾垚锛屽紑濮嬪噯澶囪闊炽��"); // 寮�濮嬪噯澶囪闊� int total = 0; - if(currA && abcMap.get("A") == totalAbcMap.get("A")) { // 褰撳墠杞﹀湪A鍖鸿杞﹀畬鎴� + if(currA && abcMap.get("A") == totalAbcMap.get("A") && totalAbcMap.get("A")>0) { // 褰撳墠杞﹀湪A鍖鸿杞﹀畬鎴� total = totalAbcMap.get("A"); } - if(currB && abcMap.get("B") == totalAbcMap.get("B")) {// 褰撳墠杞﹀湪B鍖鸿杞﹀畬鎴� + if(currB && abcMap.get("B") == totalAbcMap.get("B") && totalAbcMap.get("B")>0) {// 褰撳墠杞﹀湪B鍖鸿杞﹀畬鎴� total = totalAbcMap.get("B"); } - if(currC && abcMap.get("C") == totalAbcMap.get("C")) {// 褰撳墠杞﹀湪C鍖鸿杞﹀畬鎴� + if(currC && abcMap.get("C") == totalAbcMap.get("C") && totalAbcMap.get("C")>0) {// 褰撳墠杞﹀湪C鍖鸿杞﹀畬鎴� total = totalAbcMap.get("C"); } - if(total > 0) { // 鎾斁璇煶锛岃绂诲紑鍖哄煙 - speakParam.clear(); - String speakTxt=null ; - if( (abcMap.get("A")>0 && totalAbcMap.get("B")==0 && totalAbcMap.get("C")==0) || - (abcMap.get("B")>0 && totalAbcMap.get("A")==0 && totalAbcMap.get("C")==0) || - (abcMap.get("C")>0 && totalAbcMap.get("B")==0 && totalAbcMap.get("D")==0) - ) { // 鍙湁涓�涓尯鍩熸湁璐х墿 - speakTxt= String.format(speakTxtFormatStr1, cph, total); - }else if(totalAbcMap.get("A")>0 && totalAbcMap.get("B")>0 && - (totalAbcMap.get("C")==0 || totalAbcMap.get("C") == abcMap.get("C"))){ // AB閮芥湁璐� C鍖哄凡瀹屾垨鏃犺揣 - if(totalAbcMap.get("C")>0 && abcMap.get("A")< totalAbcMap.get("A") && abcMap.get("B")< totalAbcMap.get("B")) { // C瑁呭畬AB鏈瀹� - speakTxt= String.format(speakTxtFormatStr3, cph,"C", total,"A","B"); - } else if(abcMap.get("A")== totalAbcMap.get("A") && abcMap.get("B")< totalAbcMap.get("B")) { //A瀹孊鏈畬 - speakTxt = String.format(speakTxtFormatStr2, cph, "A", total, "B"); - }else if(abcMap.get("B")== totalAbcMap.get("B") && abcMap.get("A")< totalAbcMap.get("A")) {//B瀹孉鏈畬 - speakTxt = String.format(speakTxtFormatStr2, cph, "B", total, "A"); - }else { // 鍏ㄩ儴瑁呭畬 - speakTxt= String.format(speakTxtFormatStr1, cph, total); - } - }else if(totalAbcMap.get("C")>0 && totalAbcMap.get("B")>0 && - (totalAbcMap.get("A")==0 || totalAbcMap.get("A") == abcMap.get("A")) ){ //BC鏈夎揣 A鍖哄凡瀹屾垨鏃犺揣 - if(totalAbcMap.get("A")>0 && abcMap.get("C")< totalAbcMap.get("C") && abcMap.get("B")< totalAbcMap.get("B")) { // A瑁呭畬BC鏈瀹� - speakTxt= String.format(speakTxtFormatStr3, cph,"A", total,"B","C"); - } else if(abcMap.get("C")== totalAbcMap.get("C") && abcMap.get("B")< totalAbcMap.get("B")) { // C瀹孊鏈瀹� - speakTxt = String.format(speakTxtFormatStr2, cph, "C", total, "B"); - }else if(abcMap.get("B")== totalAbcMap.get("B") && abcMap.get("C")< totalAbcMap.get("C")) {// B瀹孋鏈瀹� - speakTxt = String.format(speakTxtFormatStr2, cph, "B", total, "C"); - }else { // 鍏ㄩ儴瑁呭畬 - speakTxt= String.format(speakTxtFormatStr1, cph, total); - } - }else if (totalAbcMap.get("A")>0 && totalAbcMap.get("C")>0 && - (totalAbcMap.get("B")==0 || totalAbcMap.get("B") == abcMap.get("B")) ) { //AC鏈夎揣 - if(totalAbcMap.get("B")>0 && abcMap.get("A")< totalAbcMap.get("A") && abcMap.get("C")< totalAbcMap.get("C")) { - speakTxt= String.format(speakTxtFormatStr3, cph,"B", total,"A","C"); - } else if(abcMap.get("A")== totalAbcMap.get("A") && abcMap.get("C")< totalAbcMap.get("C")) { // A瑁呭畬C鏈瀹� - speakTxt = String.format(speakTxtFormatStr2, cph, "A", total, "C"); - }else if(abcMap.get("C")== totalAbcMap.get("C") && abcMap.get("A")< totalAbcMap.get("A")) {// C瑁呭畬A鏈瀹� - speakTxt = String.format(speakTxtFormatStr2, cph, "C", total, "A"); - }else { // 鍏ㄩ儴瑁呭畬 - speakTxt= String.format(speakTxtFormatStr1, cph, total); - } - }else if(totalAbcMap.get("A")>0 && totalAbcMap.get("B")>0 && totalAbcMap.get("C")>0) { // 3鍖洪兘鏈夎揣鐗╋紝涓斿彧鏈変竴涓彇瑁呭畬浜� - if(abcMap.get("A")>0 && abcMap.get("B")<totalAbcMap.get("B") && abcMap.get("C")<totalAbcMap.get("C")) { - speakTxt= String.format(speakTxtFormatStr3, cph,"A", total,"B","C"); - } else if(abcMap.get("B")>0 && abcMap.get("C")==0 && abcMap.get("A")==0) { - speakTxt= String.format(speakTxtFormatStr3, cph,"B", total,"A","C"); - } else if(abcMap.get("C")>0 && abcMap.get("A")==0 && abcMap.get("B")==0) { - speakTxt= String.format(speakTxtFormatStr3, cph,"C", total,"A","B"); - } else { // 鍏ㄩ儴瑁呭畬 - speakTxt= String.format(speakTxtFormatStr1, cph, total); - } - } else { - speakTxt= String.format(speakTxtFormatStr1, cph, total); + try { + String speakTxt = startToSpeak(cph,total,abcMap,totalAbcMap); + if(StringUtils.isNotBlank(speakTxt)) { + log.info("SpeakTxt:"+ speakTxt); + speakParam.put("SpeakTxt", speakTxt); } - speakParam.put("SpeakTxt", speakTxt); - log.info("SpeakTxt:"+ speakTxt); + }catch (Exception e){ + log.error("鍑嗗璇煶鍑洪敊锛�" + e.getMessage(),e); } + + // 鍑嗗璇煶缁撴潫 // 鍗曡締杞︾殑鍗曚釜涓氬姟鍗曠殑淇℃伅缁撴潫 } if(StringUtils.isBlank(str2)) { @@ -809,11 +839,83 @@ } + /** + * 鍑嗗璇煶 锛屾尓鍒颁竴鍗¢�� + * @param cph 杞︾墝鍙� + * @param total 褰撳墠鍖烘�绘暟 + * @param abcMap A銆丅銆丆涓簁ey鐨勫尯宸茶鏁扮洰 + * @param totalAbcMap A銆丅銆丆涓簁ey鐨勫尯鎬绘暟 + * @return + */ + String startToSpeak(String cph, int total,Map<String,Integer> abcMap,Map<String,Integer> totalAbcMap) { + String speakTxt=null ; + if(total > 0) { // 鎾斁璇煶锛岃绂诲紑鍖哄煙 + String speakTxtFormatStr1 = "杞﹀彿%s 锛岃璐�%d浠跺凡瀹屾垚锛岃鍙告満娓呯偣璐х墿鍚庡敖蹇┒绂昏璐у尯銆�"; + // 鍙湁2涓尯 + String speakTxtFormatStr2 = "杞﹀彿%s锛�%s鍖鸿璐�%d浠跺凡鍏ㄩ儴鎵弿瀹屾垚锛岃鍙告満娓呯偣璐х墿鍚庡幓%s鍖鸿璐с��"; + // 鍙湁3涓尯 + String speakTxtFormatStr3 = "杞﹀彿%s锛�%s鍖鸿璐�%d浠跺凡鍏ㄩ儴鎵弿瀹屾垚锛岃鍙告満娓呯偣璐х墿鍚庡幓%s鍖�%s鍖鸿璐с��"; + + if( (abcMap.get("A")>0 && totalAbcMap.get("B")==0 && totalAbcMap.get("C")==0) || + (abcMap.get("B")>0 && totalAbcMap.get("A")==0 && totalAbcMap.get("C")==0) || + (abcMap.get("C")>0 && totalAbcMap.get("B")==0 && totalAbcMap.get("D")==0) + ) { // 鍙湁涓�涓尯鍩熸湁璐х墿 + speakTxt= String.format(speakTxtFormatStr1, cph, total); + }else if(totalAbcMap.get("A")>0 && totalAbcMap.get("B")>0 && + (totalAbcMap.get("C")==0 || totalAbcMap.get("C") == abcMap.get("C"))){ // AB閮芥湁璐� C鍖哄凡瀹屾垨鏃犺揣 + if(totalAbcMap.get("C")>0 && abcMap.get("A")< totalAbcMap.get("A") && abcMap.get("B")< totalAbcMap.get("B")) { // C瑁呭畬AB鏈瀹� + speakTxt= String.format(speakTxtFormatStr3, cph,"C", total,"A","B"); + } else if(abcMap.get("A")== totalAbcMap.get("A") && abcMap.get("B")< totalAbcMap.get("B")) { //A瀹孊鏈畬 + speakTxt = String.format(speakTxtFormatStr2, cph, "A", total, "B"); + }else if(abcMap.get("B")== totalAbcMap.get("B") && abcMap.get("A")< totalAbcMap.get("A")) {//B瀹孉鏈畬 + speakTxt = String.format(speakTxtFormatStr2, cph, "B", total, "A"); + }else { // 鍏ㄩ儴瑁呭畬 + speakTxt= String.format(speakTxtFormatStr1, cph, total); + } + }else if(totalAbcMap.get("C")>0 && totalAbcMap.get("B")>0 && + (totalAbcMap.get("A")==0 || totalAbcMap.get("A") == abcMap.get("A")) ){ //BC鏈夎揣 A鍖哄凡瀹屾垨鏃犺揣 + if(totalAbcMap.get("A")>0 && abcMap.get("C")< totalAbcMap.get("C") && abcMap.get("B")< totalAbcMap.get("B")) { // A瑁呭畬BC鏈瀹� + speakTxt= String.format(speakTxtFormatStr3, cph,"A", total,"B","C"); + } else if(abcMap.get("C")== totalAbcMap.get("C") && abcMap.get("B")< totalAbcMap.get("B")) { // C瀹孊鏈瀹� + speakTxt = String.format(speakTxtFormatStr2, cph, "C", total, "B"); + }else if(abcMap.get("B")== totalAbcMap.get("B") && abcMap.get("C")< totalAbcMap.get("C")) {// B瀹孋鏈瀹� + speakTxt = String.format(speakTxtFormatStr2, cph, "B", total, "C"); + }else { // 鍏ㄩ儴瑁呭畬 + speakTxt= String.format(speakTxtFormatStr1, cph, total); + } + }else if (totalAbcMap.get("A")>0 && totalAbcMap.get("C")>0 && + (totalAbcMap.get("B")==0 || totalAbcMap.get("B") == abcMap.get("B")) ) { //AC鏈夎揣 + if(totalAbcMap.get("B")>0 && abcMap.get("A")< totalAbcMap.get("A") && abcMap.get("C")< totalAbcMap.get("C")) { + speakTxt= String.format(speakTxtFormatStr3, cph,"B", total,"A","C"); + } else if(abcMap.get("A")== totalAbcMap.get("A") && abcMap.get("C")< totalAbcMap.get("C")) { // A瑁呭畬C鏈瀹� + speakTxt = String.format(speakTxtFormatStr2, cph, "A", total, "C"); + }else if(abcMap.get("C")== totalAbcMap.get("C") && abcMap.get("A")< totalAbcMap.get("A")) {// C瑁呭畬A鏈瀹� + speakTxt = String.format(speakTxtFormatStr2, cph, "C", total, "A"); + }else { // 鍏ㄩ儴瑁呭畬 + speakTxt= String.format(speakTxtFormatStr1, cph, total); + } + }else if(totalAbcMap.get("A")>0 && totalAbcMap.get("B")>0 && totalAbcMap.get("C")>0) { // 3鍖洪兘鏈夎揣鐗╋紝涓斿彧鏈変竴涓彇瑁呭畬浜� + if(abcMap.get("A")>0 && abcMap.get("B")<totalAbcMap.get("B") && abcMap.get("C")<totalAbcMap.get("C")) { + speakTxt= String.format(speakTxtFormatStr3, cph,"A", total,"B","C"); + } else if(abcMap.get("B")>0 && abcMap.get("C")==0 && abcMap.get("A")==0) { + speakTxt= String.format(speakTxtFormatStr3, cph,"B", total,"A","C"); + } else if(abcMap.get("C")>0 && abcMap.get("A")==0 && abcMap.get("B")==0) { + speakTxt= String.format(speakTxtFormatStr3, cph,"C", total,"A","B"); + } else { // 鍏ㄩ儴瑁呭畬 + speakTxt= String.format(speakTxtFormatStr1, cph, total); + } + } else { + speakTxt= String.format(speakTxtFormatStr1, cph, total); + } + } + return speakTxt; + } + @Override public void sendToYrLed(String currPch) { // 鐘舵�� 涓�纾呭悗锛屽緟瑁咃紱PDA鎵爜 鍦ㄨ锛� 浜屾杩囩鍚庢秷澶� // 瑁呰溅鍖� 涓や釜姹夊瓧鍔犱袱涓嫳鏂囨垨鏁板瓧 - String strTitle="搴忓彿 杞﹀彿 瑁呰溅鍖� 鐘舵�乗r\n"; + String strTitle="搴忓彿 杞﹀彿 瑁呰溅鍖� 鐘舵�乗r\n"; String strContent = ""; String contentFormatStr = "%s %s %s %s\r\n"; List<Map> list = tdmxper.yRZcList("08"); @@ -823,8 +925,8 @@ String zcWz = (String) map.get("zcWz"); // 瑁呰溅浣嶇疆 if(StringUtils.isNotBlank(zcWz)){ zcWz = zcWz.substring(0,4); - } else { - zcWz = " "; + } else { // 绌烘槸6涓綅缃� + zcWz = " "; } String zcStatus = (String) map.get("zcStatus"); // 瑁呰溅浣嶇疆 鍦ㄥ姙/寰呭姙 strContent += String.format(contentFormatStr, fillWithZero(index++), numberplates, zcWz, zcStatus); @@ -834,6 +936,32 @@ paramMap.put("strContent",strContent); Wxhtmethod.post(Contants.yr_zcLedUrl + "/SendLED",paramMap); log.info("yr_zcLedUrl: " + Contants.yr_zcLedUrl + ";title:" + strTitle + ",content:" + strContent); + } + @Override + public void sendToKjLed(String currPch) { + // 鐘舵�� 涓�纾呭悗锛屽緟瑁咃紱PDA鎵爜 鍦ㄨ锛� 浜屾杩囩鍚庢秷澶� + // 瑁呰溅鍖� 涓や釜姹夊瓧鍔犱袱涓嫳鏂囨垨鏁板瓧 + String strTitle="搴忓彿 杞﹀彿 瑁呰溅鍖� 鐘舵�乗r\n"; + String strContent = ""; + String contentFormatStr = "%s %s %s %s\r\n"; + List<Map> list = tdmxper.yRZcList("04"); + int index = 1; + for (Map map : list) { + String numberplates = (String) map.get("numberplates"); // 杞︾墝鍙� + String zcWz = (String) map.get("zcWz"); // 瑁呰溅浣嶇疆 + if(StringUtils.isNotBlank(zcWz)) { + zcWz = zcWz.substring(0,4); + } else { // 绌烘槸6涓綅缃� + zcWz = " "; + } + String zcStatus = (String) map.get("zcStatus"); // 瑁呰溅浣嶇疆 鍦ㄥ姙/寰呭姙 + strContent += String.format(contentFormatStr, fillWithZero(index++), numberplates, zcWz, zcStatus); + } + Map paramMap = new HashMap(); + paramMap.put("strTitle",strTitle); + paramMap.put("strContent",strContent); + String re = Wxhtmethod.post(Contants.kj_zcLedUrl + "/SendLED",paramMap); + log.info("鍥炲锛�" + re +";kj_zcLedUrl: " + Contants.kj_zcLedUrl + ";title:" + strTitle + ",content:" + strContent); } String fillWithZero(int str){ @@ -893,7 +1021,6 @@ return orr; } } catch (Exception e) { - // TODO: handle exception } // Fd_Bsheet nr=this.fbper.getbyVehicleId(vehicleId, Serviceenum.鍦ㄥ姙); // if(nr==null){ -- Gitblit v1.9.3