czt
2024-11-01 dbef4eea6194ffba3bd25f978b33e09d65f5a6de
src/main/java/com/fzzy/async/fzzy40/impl/Fzzy40Sync1302.java
@@ -61,13 +61,12 @@
        apiLog.setId(ContextUtil.getUUID());
        try {
            List<Fz40Grain> list = fzzySync1302Rep.findByReceiveDate(start, end);
            log.info(DateUtils.format("yyyy-MM-dd HH:mm:ss", start));
            log.info(DateUtils.format("yyyy-MM-dd HH:mm:ss", end));
            if (null == list || list.isEmpty()) {
                log.info("1302---同步数据:没有查询到需要同步的数据");
                return;
            }
            log.info(JSONObject.toJSONString(list));
            Date syncTime = new Date();
            Api1302 api1302;
            Api1105 api1105;
@@ -104,10 +103,10 @@
                api1302.setLszdw(fz40Grain.getTempMin() == null ? 0.00 : fz40Grain.getTempMin());
                //判断粮食最低温、平均温、最高温是否符合逻辑
                if(api1302.getLszdw() >= api1302.getLspjw()){
                if (api1302.getLszdw() >= api1302.getLspjw()) {
                    continue;
                }
                if(api1302.getLspjw() >= api1302.getLszgw()){
                if (api1302.getLspjw() >= api1302.getLszgw()) {
                    continue;
                }
@@ -115,12 +114,24 @@
                if (StringUtils.isEmpty(fz40Grain.getCableCir())) {
                    api1302.setLswdzjh(getTempPointList1(fz40Grain.getPoints(), fz40Grain.getCable()));
                    api1302.setLssdzjh(getHumPointList1(fz40Grain.getPoints(), fz40Grain.getCable()));
                    if(StringUtils.isEmpty(api1302.getLswdzjh())){
                        continue;
                    }
                    if(StringUtils.isEmpty(api1302.getLssdzjh())){
                        continue;
                    }
                } else {
                    api1302.setLswdzjh(getTempPointList2(fz40Grain.getPoints(), fz40Grain.getCable(), fz40Grain.getCableCir()));
                    api1302.setLssdzjh(getHumPointList2(fz40Grain.getPoints(), fz40Grain.getCable(), fz40Grain.getCableCir()));
                    if(StringUtils.isEmpty(api1302.getLswdzjh())){
                        continue;
                    }
                    if(StringUtils.isEmpty(api1302.getLssdzjh())){
                        continue;
                    }
                }
                api1302.setZhgxsj(fz40Grain.getReceiveDate());
                api1302.setZhgxsj(new Date());
                api1302.setBizId(fz40Grain.getBatchId());
                api1302.setKqdm(api1105.getKqdm());
@@ -143,12 +154,19 @@
    }
    public static void main(String[] args) {
        String point = "31.8,20.0,15.1,18.6,28.2,14.3,11.3,16.1,28.1,15.6,13.3,18.4,28.8,16.6,10.2,14.4,27.8,14.3,10.8,16.0,27.5,14.5,11.7,17.1,26.5,13.6,10.1,15.0,29.7,17.4,13.8,17.8,29.7,18.6,15.0,18.6,26.4,13.5,9.2,13.1,27.6,11.8,8.9,13.5,28.1,12.0,8.6,12.8,27.8,11.6,7.6,12.4,26.1,10.8,7.5,12.6,27.8,10.3,7.1,12.0,26.1,11.3,8.5,12.7,28.6,16.9,12.9,17.7,29.1,12.3,8.8,12.1,27.4,11.9,8.6,12.8,29.0,11.5,7.6,11.1,26.9,10.2,8.0,12.7,27.0,9.6,7.7,13.5,26.7,9.5,7.1,12.3,26.3,10.7,8.4,13.4,27.6,15.9,11.5,15.8,28.7,12.6,8.7,12.2,28.1,12.2,8.8,12.5,30.3,11.9,8.0,12.0,27.9,11.1,7.8,11.5,26.3,10.1,7.8,12.0,27.2,10.5,6.9,11.1,27.1,11.6,9.5,13.6,27.4,14.8,10.7,16.6,27.7,12.4,9.1,13.0,27.7,13.2,9.0,12.8,27.5,12.1,8.1,12.6,26.6,11.8,7.3,12.3,26.8,10.5,8.0,13.3,26.3,11.0,7.6,12.5,26.1,10.6,8.5,13.5,29.8,21.3,15.5,17.8,28.3,18.2,11.6,12.8,29.4,17.4,13.0,16.1,28.4,22.3,14.6,15.4,28.7,17.5,11.8,15.2,26.5,14.6,10.9,14.8,27.8,15.3,10.3,14.8,27.6,16.7,13.6,17.4";
        String cable = "4-6-8";
        String tempPointList1 = getTempPointList1(point, cable);
        System.out.println(tempPointList1);
    }
    /**
     * 获取平方仓的温度值集合,格式:温度值,层数,行数,列数|温度值,层数,行数,列数|温度值,层数,行数,列数
     *
     * @return
     */
    private String getTempPointList1(String point, String cable) {
    private static String getTempPointList1(String point, String cable) {
        String[] cab = cable.split("-");
        int c = Integer.valueOf(cab[0]);
        int h = Integer.valueOf(cab[1]);
@@ -156,14 +174,20 @@
        String[] points = point.split(",");
        String result = "";
        if (c * h * l > points.length) {
            return result;
        }
        for (int i = 1; i <= l; i++) {
            for (int j = 1; j <= h; j++) {
                for (int z = 1; z <= c; z++) {
                    result += ("|" + points[(i * j - 1) * c + z - 1] + "," + z + "," + j + "," + i);
                    result += ("|" + points[((i-1)*h+j-1)*c + z -1] + "," + z + "," + j + "," + i);
                }
            }
        }
        return result.substring(1);
        if(result.length() > 0){
            result = result.substring(1);
        }
        return result;
    }
    /**
@@ -194,7 +218,10 @@
            }
        }
        return result.substring(1);
        if(result.length() > 0){
            result = result.substring(1);
        }
        return result;
    }
    /**
@@ -217,7 +244,10 @@
                }
            }
        }
        return result.substring(1);
        if(result.length() > 0){
            result = result.substring(1);
        }
        return result;
    }
    /**
@@ -248,6 +278,9 @@
            }
        }
        return result.substring(1);
        if(result.length() > 0){
            result = result.substring(1);
        }
        return result;
    }
}