From cc0cbfc79a34e1b106fdb998450cd2ad03446126 Mon Sep 17 00:00:00 2001 From: Administrator <hbal> Date: 星期五, 14 四月 2023 08:35:13 +0800 Subject: [PATCH] 明晟分屏展示 --- JavaSource/com/mandi/common/Wxhtmethod.java | 13 ++++ JavaSource/com/mandi/fendan/mapper/Fd_XSTDMXMapper.java | 7 ++ JavaSource/com/mandi/webservice/service/impl/FdXSTDService.java | 148 ++++++++++++++++++++++++++++++++++++------------- 3 files changed, 128 insertions(+), 40 deletions(-) diff --git a/JavaSource/com/mandi/common/Wxhtmethod.java b/JavaSource/com/mandi/common/Wxhtmethod.java index 3023f90..422be13 100644 --- a/JavaSource/com/mandi/common/Wxhtmethod.java +++ b/JavaSource/com/mandi/common/Wxhtmethod.java @@ -12,6 +12,7 @@ import org.apache.http.HttpEntity; import org.apache.http.NameValuePair; +import org.apache.http.client.config.RequestConfig; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; @@ -112,6 +113,8 @@ JsonObject jo=new JsonObject(); CloseableHttpClient httpclient = HttpClients.createDefault(); HttpPost hp=new HttpPost(url); + RequestConfig config = RequestConfig.custom().setConnectTimeout(30000).setSocketTimeout(30000).build(); + hp.setConfig(config); String re=null; List<NameValuePair> fps=new ArrayList<NameValuePair>(); UrlEncodedFormEntity entity=null; @@ -176,6 +179,8 @@ // s.setContentEncoding("UTF-8"); // hp.setEntity(s); HttpPost hp=new HttpPost(url); + RequestConfig config = RequestConfig.custom().setConnectTimeout(30000).setSocketTimeout(30000).build(); + hp.setConfig(config); StringEntity se=new StringEntity(jsonStr, Charset.forName("utf-8")); se.setContentType("application/json"); hp.setEntity(se); @@ -276,6 +281,8 @@ { CloseableHttpClient httpclient = HttpClients.createDefault(); HttpPost hp=new HttpPost(url); + RequestConfig config = RequestConfig.custom().setConnectTimeout(30000).setSocketTimeout(30000).build(); + hp.setConfig(config); String re=null; List<NameValuePair> fps=new ArrayList<NameValuePair>(); UrlEncodedFormEntity entity=null; @@ -314,6 +321,8 @@ CloseableHttpClient httpclient=nssl(); // CloseableHttpClient httpclient = HttpClients.createDefault(); HttpPost hp=new HttpPost(url); + RequestConfig config = RequestConfig.custom().setConnectTimeout(30000).setSocketTimeout(30000).build(); + hp.setConfig(config); String re=null; List<NameValuePair> fps=new ArrayList<NameValuePair>(); UrlEncodedFormEntity entity=null; @@ -352,6 +361,8 @@ { CloseableHttpClient httpclient=nssl(); HttpPost hp=new HttpPost(url); + RequestConfig config = RequestConfig.custom().setConnectTimeout(30000).setSocketTimeout(30000).build(); + hp.setConfig(config); MultipartEntityBuilder me=MultipartEntityBuilder.create(); me.addBinaryBody(upfilename, file); if(params!=null) @@ -386,6 +397,8 @@ { CloseableHttpClient httpclient=nssl(); HttpPost hp=new HttpPost(url); + RequestConfig config = RequestConfig.custom().setConnectTimeout(30000).setSocketTimeout(30000).build(); + hp.setConfig(config); StringEntity se=new StringEntity(body, Charset.forName("utf-8")); hp.setEntity(se); String re=null; diff --git a/JavaSource/com/mandi/fendan/mapper/Fd_XSTDMXMapper.java b/JavaSource/com/mandi/fendan/mapper/Fd_XSTDMXMapper.java index e90a38e..99687f6 100644 --- a/JavaSource/com/mandi/fendan/mapper/Fd_XSTDMXMapper.java +++ b/JavaSource/com/mandi/fendan/mapper/Fd_XSTDMXMapper.java @@ -157,4 +157,11 @@ @Update("update fd_xstdmx set tdmx_ggxh=#{tdmx_ggxh} where tdmx_tdfl=#{tdmx_tdfl}") public int updateMXGG(Fd_XSTDMX mx); + @Select({"select hw.name tdmx_hwmc,mx.* from fd_xstdmx mx " , + " left join nc_hw hw on mx.tdmx_hwbh=hw.pkid and hw.state=1 " , + " join fd_bsheet on bsNo=tdmx_fdywbh and status='鍦ㄥ姙' and sdepartNo=#{sdepartNo} " + }) + public List getHwList(String sdepartNo); + + } diff --git a/JavaSource/com/mandi/webservice/service/impl/FdXSTDService.java b/JavaSource/com/mandi/webservice/service/impl/FdXSTDService.java index b6226ff..c12852f 100644 --- a/JavaSource/com/mandi/webservice/service/impl/FdXSTDService.java +++ b/JavaSource/com/mandi/webservice/service/impl/FdXSTDService.java @@ -6,12 +6,15 @@ import java.util.List; import java.util.Map; import java.util.UUID; +import java.util.stream.Collectors; import javax.annotation.Resource; import com.mandi.basicconfig.persist.*; import com.mandi.fendan.util.ConvertTool; +import com.mandi.fendan.util.ThreadPoolUtil; import com.mandi.servlet.file.impl.FileLoadImpl; +import javafx.concurrent.Task; import org.apache.commons.lang3.StringUtils; import org.apache.log4j.Logger; import org.springframework.stereotype.Service; @@ -404,35 +407,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){ @@ -462,13 +465,13 @@ 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) { @@ -561,17 +564,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绯荤粺"); @@ -603,18 +599,90 @@ // 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())) { + ThreadPoolUtil.getInstance().execute(()->sendToMsLed()); + } prr.setCode(0); prr.setErrmsg("瑁呰溅鎿嶄綔鎴愬姛锛�"); prr.setList(relist); return prr; } + public void sendToMsLed(){ // todo 鏄庡ぉ闇�瑕佹祴璇曚竴涓� + //A鍖� 76-86 + 99-1 + //B鍖� 14-33 + 99-2 + //C鍖� 53-67 + 99-3 + List<Map> totalList = tdmxper.getHwList("06"); // 鑾峰彇鏄庢櫉鎵�鏈夊湪鍔炰笟鍔″崟鐨勪俊鎭� + 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-%d/%d- %d/%d-%d/%d\r\n"; + for (Map.Entry<String, List<Map>> entry : ywbhListMap.entrySet()) { // 閬嶅巻姣忎釜涓氬姟鍗曠殑 + 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"); + if(!"".equals(cph)) cph = (String) map.get("tdmx_zccph"); + 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", 1); + if (zcbz != null && zcbz == 1) { // 瑁呰溅瀹屾垚 + abcMap.put("A", abcMap.get("A") + 1); + hasZcwc = true; + } + } else if (num >= 14 && num <= 33 || hw.lastIndexOf("99-2") >= 0) { // B鍖� + totalAbcMap.put("B", 1); + if (zcbz != null && zcbz == 1) { + abcMap.put("B", abcMap.get("B") + 1); + hasZcwc = true; + } + } else if (num >= 53 && num <= 67 || hw.lastIndexOf("99-3") >= 0) { // C鍖� + totalAbcMap.put("C", 1); + if (zcbz != null && zcbz == 1) { + abcMap.put("C", abcMap.get("C") + 1); + hasZcwc = true; + } + } + } + if (!hasZcwc) continue; + str2 += String.format(formatStr, cph, abcMap.get("A"), totalAbcMap.get("A"), + abcMap.get("B"), totalAbcMap.get("B"), + abcMap.get("C"), totalAbcMap.get("C")); + // 鍗曡締杞︾殑鍗曚釜涓氬姟鍗曠殑淇℃伅缁撴潫 + } + Map paramMap = new HashMap(); + paramMap.put("str1",str1); + paramMap.put("str2",str2); + Wxhtmethod.post("192.168.112.21/api/xxx",paramMap); + } + @Override @Transactional(rollbackFor=Exception.class) public ObjectResult<Boolean> delZCMX(String cardID, String yktywdh,JsonArray dataArr) throws Exception { -- Gitblit v1.9.3