From eeb08a586132f489c10e12551c6479b13c9def5e Mon Sep 17 00:00:00 2001
From: Administrator <hbal>
Date: 星期三, 19 四月 2023 08:59:47 +0800
Subject: [PATCH] 明晟、义瑞装车

---
 JavaSource/com/mandi/webservice/service/impl/FdXSTDService.java |  414 +++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 331 insertions(+), 83 deletions(-)

diff --git a/JavaSource/com/mandi/webservice/service/impl/FdXSTDService.java b/JavaSource/com/mandi/webservice/service/impl/FdXSTDService.java
index cdbb857..fed4699 100644
--- a/JavaSource/com/mandi/webservice/service/impl/FdXSTDService.java
+++ b/JavaSource/com/mandi/webservice/service/impl/FdXSTDService.java
@@ -1,61 +1,36 @@
 package com.mandi.webservice.service.impl;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.annotation.Resource;
-
-import com.mandi.fendan.util.ConvertTool;
-import com.mandi.servlet.file.impl.FileLoadImpl;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
 import com.google.gson.JsonArray;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
 import com.mandi.basicconfig.mapper.FdRepertoryNexusMapper;
 import com.mandi.basicconfig.mapper.NczsjMapper;
-import com.mandi.basicconfig.persist.FdRepertoryNexus;
-import com.mandi.basicconfig.persist.Ncck;
-import com.mandi.basicconfig.persist.Ncdepart;
-import com.mandi.basicconfig.persist.Ncworker;
-import com.mandi.basicconfig.persist.Ncywdy;
+import com.mandi.basicconfig.persist.*;
 import com.mandi.common.JSONobj;
-import com.mandi.common.Wxhtmethod;
 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;
-import com.mandi.fendan.mapper.BsheetEcgbMapper;
-import com.mandi.fendan.mapper.BusinessMapper;
-import com.mandi.fendan.mapper.Fd_BsheetMapper;
-import com.mandi.fendan.mapper.Fd_CompanyMapper;
-import com.mandi.fendan.mapper.Fd_GbxstdMapper;
-import com.mandi.fendan.mapper.Fd_GbxstdmxMapper;
-import com.mandi.fendan.mapper.Fd_VehicleMapper;
-import com.mandi.fendan.mapper.Fd_XSTDMXMapper;
-import com.mandi.fendan.mapper.Fd_XSTDMapper;
-import com.mandi.fendan.mapper.Fd_YKTMapper;
-import com.mandi.fendan.mapper.VehicleXSTDMapper;
-import com.mandi.fendan.persist.BsheetEcgb;
-import com.mandi.fendan.persist.Fd_Bsheet;
-import com.mandi.fendan.persist.Fd_Company;
-import com.mandi.fendan.persist.Fd_Gbxstd;
-import com.mandi.fendan.persist.Fd_Gbxstdmx;
-import com.mandi.fendan.persist.Fd_XSTD;
-import com.mandi.fendan.persist.Fd_XSTDMX;
-import com.mandi.fendan.persist.Vehicle_XSTD;
+import com.mandi.fendan.mapper.*;
+import com.mandi.fendan.persist.*;
 import com.mandi.fendan.util.Contants;
+import com.mandi.fendan.util.ConvertTool;
+import com.mandi.fendan.util.ThreadPoolUtil;
 import com.mandi.fendan.util.persist.Serviceenum;
 import com.mandi.fendan.util.persist.WaitXSTDMX;
 import com.mandi.fendan.util.persist.Yktbsitem;
+import com.mandi.servlet.file.impl.FileLoadImpl;
 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;
+
+import javax.annotation.Resource;
+import java.util.*;
 
 @Service
 public class FdXSTDService implements IFdXSTDService{
@@ -88,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)
@@ -408,35 +386,35 @@
 			prr.setCode(1);
 			prr.setErrmsg("涓�鍗¢�氫笟鍔″崟鏈壘鍒帮紝璇风‘璁ゅ崟鍙锋槸鍚︽纭紒");
 			return prr;
-		}else{
-			if(fdb.getStatus()!=Serviceenum.鍦ㄥ姙){
-				prr.setCode(2);
-				prr.setErrmsg("涓�鍗¢�氫笟鍔″崟涓嶆槸鍦ㄥ姙鐘舵��,绯荤粺涓嶅仛澶勭悊锛�");
-				return prr;
-			}
-			if(StringUtils.isBlank(cardID)){
-				prr.setCode(1);
-				prr.setErrmsg("鍙傛暟锛氫竴鍗¢�氬崱鍙蜂负绌猴紒");
-				return prr;
-			}
-			if(dataArr==null){
-				prr.setCode(1);
-				prr.setErrmsg("鍙傛暟锛氭壒娆″彿涓虹┖锛�");
-				return prr;
-			}
-
-			Map<String, Object> mp=this.yktper.getcardinuse(cardID);
-			if(mp==null){
-				throw new Exception("鍗″彿涓嶆纭湭鎵惧埌鍦ㄧ敤鍗★紒");
-			}
-			vehicleId=mp.get("numberplates")==null?"":mp.get("numberplates").toString();
-			if(!vehicleId.equals(fdb.getVehicleId())){
-				prr.setCode(1);
-				prr.setErrmsg("鍙傛暟锛氬崱鍙峰叧鑱旂殑杞︾墝鍙峰拰涓氬姟鍗曞叧鑱旂殑杞︾墝鍙蜂笉涓�鑷�");
-				return prr;
-			}
-			yktywdh=fdb.getBsNo();
 		}
+
+		if (fdb.getStatus() != Serviceenum.鍦ㄥ姙) {
+			prr.setCode(2);
+			prr.setErrmsg("涓�鍗¢�氫笟鍔″崟涓嶆槸鍦ㄥ姙鐘舵��,绯荤粺涓嶅仛澶勭悊锛�");
+			return prr;
+		}
+		if (StringUtils.isBlank(cardID)) {
+			prr.setCode(1);
+			prr.setErrmsg("鍙傛暟锛氫竴鍗¢�氬崱鍙蜂负绌猴紒");
+			return prr;
+		}
+		if (dataArr == null) {
+			prr.setCode(1);
+			prr.setErrmsg("鍙傛暟锛氭壒娆″彿涓虹┖锛�");
+			return prr;
+		}
+
+		Map<String, Object> mp = this.yktper.getcardinuse(cardID);
+		if (mp == null) {
+			throw new Exception("鍗″彿涓嶆纭湭鎵惧埌鍦ㄧ敤鍗★紒");
+		}
+		vehicleId = mp.get("numberplates") == null ? "" : mp.get("numberplates").toString();
+		if (!vehicleId.equals(fdb.getVehicleId())) {
+			prr.setCode(1);
+			prr.setErrmsg("鍙傛暟锛氬崱鍙峰叧鑱旂殑杞︾墝鍙峰拰涓氬姟鍗曞叧鑱旂殑杞︾墝鍙蜂笉涓�鑷�");
+			return prr;
+		}
+		// yktywdh = fdb.getBsNo();
 
 		int wcnum=this.bsper.getweightDoc(vehicleId, fdb.getBsNo());
 		if(wcnum<=0){
@@ -460,19 +438,19 @@
 			// TODO: handle exception
 		}
 
-
+		String currPch="";// 褰撳墠鎵规鍙�
 		//绗竴娆℃坊鍔犺鍗歌褰曞彂閫佽杞︿俊鎭�
 		int sfzc=this.fbper.getbsitembyNo(fdb.getBsNo());
 		if(sfzc<=0) {
 			//鍙戦�佸井淇″叕浼楀彿鎻愰啋淇℃伅
 			String url=Contants.yktLocalAdd+"/routine/sendZcMsg.htm";
-			Map<String, String> mp=new HashMap<String, String>();
+			Map<String, String> paramMp=new HashMap<String, String>();
 			mp.put("sdepartNo", fdb.getSdepartNo());
 			mp.put("vehicleId", vehicleId);
 			mp.put("businessNo", fdb.getBsNo());
-			Wxhtmethod.postJson(url, mp);
+			Wxhtmethod.postJson(url, paramMp);
 		}
-		//鐜板満杩囧畬姣涢噸鍚庡嚭鐜版壂鐮佽杞︾殑锛屽繀椤婚噸鏂拌繃纾�
+		// 鐜板満杩囧畬姣涢噸鍚庡嚭鐜版壂鐮佽杞︾殑锛屽繀椤婚噸鏂拌繃纾�
 		int grossNum=this.bsper.getgrosstDoc(vehicleId, fdb.getBsNo());
 
 		for (JsonElement je : dataArr) {
@@ -565,17 +543,10 @@
 				bsi.setRecompany(wx.getTdmx_shdw());
 			}else{
 				bsi.setRecompany(
-						/*xstd.getTd_ywdybh().equals(Contants.nc_ywdy_ZZ)?"閮戝窞鎶ュ叧":
-							xstd.getTd_ywdybh().equals(Contants.nc_ywdy_MT)?"娌冲崡鎶ュ叧":
-								xstd.getTd_ywdybh().equals(Contants.nc_ywdy_MS)?"鏄庢櫉鎶ュ叧":
-							"绉戞妧鎶ュ叧"*/
 						  ConvertTool.covertToCustoms(xstd.getTd_ywdybh())
 							);
 			}
 			bsi.setReID("");
-			/*bsi.setDecompany(xstd.getTd_ywdybh().equals(Contants.nc_ywdy_ZZ)?"閮戝窞鏄庢嘲":
-					xstd.getTd_ywdybh().equals(Contants.nc_ywdy_MS)?"娌冲崡鏄庢櫉鏂版潗鏂�":
-				"鐪�娉扮鎶�");*/
 			bsi.setDecompany(ConvertTool.ncCovertToFactoryName(xstd.getTd_ywdybh()));
 			bsi.setDeID("");
 			bsi.setFrombatch("ERP绯荤粺");
@@ -590,6 +561,7 @@
 			remp.put("td_tdls",tdmx.getTdmx_tdls());
 			remp.put("tdmx_tdfl",tdmx.getTdmx_tdfl());
 			relist.add(remp);
+			currPch  = tdmx.getTdmx_pch();
 		}
 
 		if(grossNum>0) {
@@ -607,16 +579,268 @@
 //				this.bsper.delvehicleQ(vehicleId);
 				//鍒犻櫎杞﹁締鎺掗槦淇℃伅
 				String url=Contants.yktLocalAdd+"/search/vehicleQueue/delItem.htm";
-				Map<String, String> mp=new HashMap<String, String>();
+				Map<String, String> paramMp=new HashMap<String, String>();
 				mp.put("vehicleID", vehicleId);
-				Wxhtmethod.postJson(url, mp);
+				Wxhtmethod.postJson(url, paramMp);
 			}
 		}
 
+		 // 姝ゅ寮傛瑙﹀彂涓�涓嬫槑鏅熷彂杞�
+		if("06".equals(fdb.getSdepartNo())) {
+			final String cph = currPch;
+			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("瑁呰溅鎿嶄綔鎴愬姛锛�");
 		prr.setList(relist);
 		return prr;
+	}
+
+	/**
+	 *
+	 * @param currPch 褰撳墠鎵规鍙�
+	 */
+	public void sendToMsLed(String currPch){
+		//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");
+			if(ywbhListMap.get(ywdw) == null) {
+				ywbhListMap.put(ywdw, new ArrayList<>());
+			}
+			ywbhListMap.get(ywdw).add(map);
+		}
+		String str1 = " 杞﹀彿  A鍖�  B鍖�  C鍖�" + "\r\n", str2="";
+		//"(杞︾墝鍙�)\\-(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;
+			boolean hasZcwc = false; // 淇濊瘉宸茬粡瀹屾垚浜�
+			// String ywhb = entry.getKey();
+			List<Map> vehicleIdTotalList = entry.getValue();
+			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); // 宸茶淇℃伅
+			abcMap.put("A", 0);
+			abcMap.put("B", 0);
+			abcMap.put("C", 0);
+			String cph = ""; // 杞︾墝鍙�
+			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");
+				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鍖�
+					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;
+					}
+				} else if (num >= 14 && num <= 33 || 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;
+					}
+				} else if (num >= 53 && num <= 67 || 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;
+					}
+				}
+			}
+			// 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, 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鍖鸿杞﹀畬鎴�
+				total = totalAbcMap.get("A");
+			}
+			if(currB && abcMap.get("B") == totalAbcMap.get("B")) {// 褰撳墠杞﹀湪B鍖鸿杞﹀畬鎴�
+				total = totalAbcMap.get("B");
+			}
+			if(currC && abcMap.get("C") == totalAbcMap.get("C")) {// 褰撳墠杞﹀湪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);
+				}
+				speakParam.put("SpeakTxt", speakTxt);
+				log.info("SpeakTxt:"+ speakTxt);
+			}
+			// 鍗曡締杞︾殑鍗曚釜涓氬姟鍗曠殑淇℃伅缁撴潫
+		}
+		if(StringUtils.isBlank(str2)) {
+			str2 = "鏃犺溅杈�";
+		}
+		Map paramMap = new HashMap();
+		paramMap.put("strTitle",str1);
+		paramMap.put("strContent",str2);
+		try {
+			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){}
+
+
+	}
+
+	@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 { // 绌烘槸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);
+			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);
+		return s;
 	}
 
 	@Override
@@ -740,6 +964,13 @@
 			return orr;
 		}
 		String vehicleId=mp.get("numberplates")==null?"":mp.get("numberplates").toString();
+
+		String type = (String)mp.get("type");
+		String sdepartNo = null;
+		if(type.equals("澶栨潵杞﹁締鍗�")) {
+			sdepartNo = (String) mp.get("sdepartNo");
+		}
+
 		List<Fd_Bsheet> fd_bList = this.fbper.getListbyVehicleId(vehicleId, Serviceenum.鍦ㄥ姙);
 		if (fd_bList == null||fd_bList.isEmpty()) {
 			orr.setCode(1);
@@ -769,7 +1000,8 @@
 				return orr;
 			}
 		}
-		String businessNo = bsper.getBusinessNoByCardNo(cardID);
+		// 鏀规垚浣跨敤鍦ㄧ敤鍗$殑鍗″彿銆佽溅鐗屽彿鐮併�佸巶鍖烘潵纭鏄惁鏈夐攢鍞殑涓氬姟鍗� btid=3 businesstype00002
+		String businessNo = bsper.getBusinessNoByCardNo(cardID,vehicleId,sdepartNo);
 		if(StringUtils.isBlank(businessNo)) {
 			orr.setCode(1);
 			orr.setErrmsg("鏈壘鍒拌鍗$殑鍦ㄥ姙涓氬姟鍗曪紒");
@@ -778,6 +1010,7 @@
 //		List<Vehicle_XSTD> vxl=this.vhxper.getlistbyVehicleId(vehicleId);
 		List<Vehicle_XSTD> vxl= this.vhxper.getlistbyVehicleIdandbsNoGp(vehicleId, businessNo);
 		List<Map<String, Object>> datamp=new ArrayList<Map<String, Object>>();
+		Map<String,Fd_XSTD> xstdMap = new HashMap(); // 缂撳瓨Fd_XSTD锛岄伩鍏嶅鏌�
 		for (Vehicle_XSTD vx : vxl) {
 			String tdbh=vx.getXstdNo();
 			Fd_XSTD td=this.tdper.getbyTDBH(tdbh);
@@ -801,10 +1034,25 @@
 			tdm.put("td_tdbh", td.getTd_tdbh());
 			tdm.put("td_tdls", td.getTd_tdls());
 			tdm.put("td_jylx", td.getTd_jylx());
+			Fd_XSTD fd_xstd = xstdMap.get(td.getTd_tdbh());
+			if(xstdMap.get(td.getTd_tdbh())==null) { // 淇濊瘉鍚屼竴涓彁鍗曞彧鏌ヤ竴閬�
+				fd_xstd = tdper.getbyttdbh(td.getTd_tdbh());
+			}
+			//澧炲姞瀹㈡埛鍚嶇О 澶囨敞
+			if(StringUtils.isBlank(fd_xstd.getTd_fpbh())){
+				Nckh nckh = zsjper.getNckhbyCode(fd_xstd.getTd_khbh());// 瀹㈡埛涓嶅瓨鍦ㄧ殑鐗规畩鎯呭喌鏄笉搴旇瀛樺湪鐨勶紝浠ラ槻涓囦竴锛屽姞鍒ょ┖銆�
+				tdm.put("td_khmc",nckh!=null?nckh.getName():"");
+			}else {
+				String name = ConvertTool.covertToCustoms(fd_xstd.getTd_ywdybh());
+				tdm.put("td_khmc", name);
+			}
+			tdm.put("td_bz",fd_xstd.getTd_bz());
 			mm.put("td", tdm);
 			mm.put("tdmx", tdmxl);
 			datamp.add(mm);
 		}
+
+
 		rem.put("cph", vehicleId);
 		rem.put("sjmc", fd_b.getDriver());
 		rem.put("dh", fd_b.getPhone());

--
Gitblit v1.9.3