Administrator
2023-04-14 cc0cbfc79a34e1b106fdb998450cd2ad03446126
明晟分屏展示
已修改3个文件
168 ■■■■ 文件已修改
JavaSource/com/mandi/common/Wxhtmethod.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaSource/com/mandi/fendan/mapper/Fd_XSTDMXMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaSource/com/mandi/webservice/service/impl/FdXSTDService.java 148 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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;
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);
}
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 {