From 63fbfddabe08e353ad75e495c2ac8dc5203da88c Mon Sep 17 00:00:00 2001 From: Administrator <hbal> Date: 星期一, 17 四月 2023 17:13:32 +0800 Subject: [PATCH] 明晟、义瑞装车 --- JavaSource/com/mandi/webservice/service/impl/FdXSTDService.java | 101 ++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 89 insertions(+), 12 deletions(-) diff --git a/JavaSource/com/mandi/webservice/service/impl/FdXSTDService.java b/JavaSource/com/mandi/webservice/service/impl/FdXSTDService.java index 33e51ad..aea6a42 100644 --- a/JavaSource/com/mandi/webservice/service/impl/FdXSTDService.java +++ b/JavaSource/com/mandi/webservice/service/impl/FdXSTDService.java @@ -9,6 +9,7 @@ import com.mandi.basicconfig.persist.*; import com.mandi.common.JSONobj; import com.mandi.common.ParamFileter.BigDecimalfiter; +import com.mandi.common.SpringContext; import com.mandi.common.Wxhtmethod; import com.mandi.dao.common.ObjectResult; import com.mandi.dao.common.PageResult; @@ -24,6 +25,7 @@ import com.mandi.webservice.service.IFdXSTDService; import org.apache.commons.lang3.StringUtils; import org.apache.log4j.Logger; +import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -61,6 +63,9 @@ private FdRepertoryNexusMapper reNxPer; private Logger log= Logger.getLogger(FileLoadImpl.class); + + public static Boolean refreshMsLedLock = false; + public static Boolean refreshYrLedLock = false; @Override @Transactional(rollbackFor=Exception.class) @@ -583,7 +588,43 @@ // 姝ゅ寮傛瑙﹀彂涓�涓嬫槑鏅熷彂杞� if("06".equals(fdb.getSdepartNo())) { final String cph = currPch; - ThreadPoolUtil.getInstance().execute(()->sendToMsLed(cph)); + ThreadPoolUtil.getInstance().execute(()->{ + try { + synchronized (FdXSTDService.refreshMsLedLock) { + if (FdXSTDService.refreshMsLedLock) { // 绯荤粺绻佸繖 + return ; + } + FdXSTDService.refreshMsLedLock = true; + } + sendToMsLed(cph); + } catch (Exception e) { + log.error(e); + } finally { + synchronized (FdXSTDService.refreshMsLedLock) { + FdXSTDService.refreshMsLedLock = false; + } + } + }); + } + if("08".equals(fdb.getSdepartNo())) { + final String cph = currPch; + ThreadPoolUtil.getInstance().execute(()->{ + try { + synchronized (FdXSTDService.refreshYrLedLock) { + if (FdXSTDService.refreshYrLedLock) { // 绯荤粺绻佸繖 + return ; + } + FdXSTDService.refreshYrLedLock = true; + } + sendToYrLed(cph); + } catch (Exception e) { + log.error(e); + } finally { + synchronized (FdXSTDService.refreshYrLedLock) { + FdXSTDService.refreshYrLedLock = false; + } + } + }); } prr.setCode(0); prr.setErrmsg("瑁呰溅鎿嶄綔鎴愬姛锛�"); @@ -599,7 +640,9 @@ //A鍖� 76-86 + 99-1 //B鍖� 14-33 + 99-2 //C鍖� 53-67 + 99-3 + 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"); @@ -618,7 +661,8 @@ // 鍙湁3涓尯 String speakTxtFormatStr3 = "杞﹀彿%s锛�%s鍖鸿璐�%d浠跺凡鍏ㄩ儴鎵弿瀹屾垚锛岃鍙告満娓呯偣璐х墿鍚庡幓%s鍖�%s鍖鸿璐с��"; Map speakParam = new HashMap(1); - for (Map.Entry<String, List<Map>> entry : ywbhListMap.entrySet()) { // 閬嶅巻姣忎釜涓氬姟鍗曠殑 + for (Map.Entry<String, List<Map>> entry : ywbhListMap.entrySet()) { + // 閬嶅巻姣忎釜涓氬姟鍗曠殑 // 褰撳墠瑁呰溅A銆丅銆丆鍖� boolean currA = false,currB = false, currC = false; boolean hasZcwc = false; // 淇濊瘉宸茬粡瀹屾垚浜� @@ -670,14 +714,14 @@ } } } - if (!hasZcwc) continue; //娌℃湁瑁呰溅瀹屾垚鐨勪篃璺宠繃 - if (!(currA || currB || currC) && abcMap.get("A") + abcMap.get("B") + abcMap.get("C") == + // if (!hasZcwc) continue; //娌℃湁瑁呰溅瀹屾垚鐨勪篃璺宠繃 + /*if (!(currA || currB || currC) && abcMap.get("A") + abcMap.get("B") + abcMap.get("C") == totalAbcMap.get("A") + totalAbcMap.get("B") + totalAbcMap.get("C")) { // 闈炲綋鍓嶈溅鐗屽彿锛屽凡缁忚杞﹀畬鎴愪絾鏄湭鍑哄巶 continue; - } - str2 += String.format(formatStr, cph, fillSpace(abcMap.get("A")), fillSpace(totalAbcMap.get("A")), - fillSpace(abcMap.get("B")), fillSpace(totalAbcMap.get("B")), - fillSpace(abcMap.get("C")), fillSpace(totalAbcMap.get("C"))); + }*/ + 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"))); // 寮�濮嬪噯澶囪闊� int total = 0; if(currA && abcMap.get("A") == totalAbcMap.get("A")) { // 褰撳墠杞﹀湪A鍖鸿杞﹀畬鎴� @@ -748,18 +792,51 @@ } // 鍗曡締杞︾殑鍗曚釜涓氬姟鍗曠殑淇℃伅缁撴潫 } + if(StringUtils.isBlank(str2)) { + str2 = "鏃犺溅杈�"; + } Map paramMap = new HashMap(); paramMap.put("strTitle",str1); paramMap.put("strContent",str2); try { - String re = Wxhtmethod.post(Contants.msLedServiceAddr + "/SendLED",paramMap); - // 璇煶鍙挱涓�鏉� - String re1 = Wxhtmethod.post(Contants.msLedServiceAddr + "/Speak",speakParam); + log.info("LED-ABC webServiceAddrss:"+Contants.msLedServiceAddr+"st1::" +str1+";;;;;str2::"+str2); + String re = Wxhtmethod.post(Contants.msLedServiceAddr + "/SendLED",paramMap); + log.info("LED-ABC result:"+re); + // 璇煶鍙挱涓�鏉� + String re1 = Wxhtmethod.post(Contants.msLedServiceAddr + "/Speak",speakParam); }catch (Exception e){} } - String fillSpace(int str){ + + @Override + public void sendToYrLed(String currPch) { + // 鐘舵�� 涓�纾呭悗锛屽緟瑁咃紱PDA鎵爜 鍦ㄨ锛� 浜屾杩囩鍚庢秷澶� + // 瑁呰溅鍖� 涓や釜姹夊瓧鍔犱袱涓嫳鏂囨垨鏁板瓧 + String strTitle="搴忓彿 杞﹀彿 瑁呰溅鍖� 鐘舵�乗r\n"; + String strContent = ""; + String contentFormatStr = "%s %s %s %s\r\n"; + List<Map> list = tdmxper.yRZcList("08"); + 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 { + 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); + Wxhtmethod.post(Contants.yr_zcLedUrl + "/SendLED",paramMap); + log.info("yr_zcLedUrl: " + Contants.yr_zcLedUrl + ";title:" + strTitle + ",content:" + strContent); + } + + String fillWithZero(int str){ String s; if(str<10 && str>=0) s= "0" + str; else s=String.valueOf(str); -- Gitblit v1.9.3