CZT
2023-11-15 cc0c09e96a829613bcfb4c2cc1ee5ebf998f016c
src/main/java/com/fzzy/async/fzzy40/impl/Fzzy40Sync1302.java
@@ -24,7 +24,7 @@
/**
 * 温湿度检测数据同步
 *
 * @author chen
 * @author czt
 * @date 2022-09-07 14:41
 */
@Slf4j
@@ -48,7 +48,7 @@
     * @param start  起始时间
     * @param end    截止时间
     */
    public void syncData(String deptId, Date start, Date end) {
    public void syncData(String kqdm, String deptId, Date start, Date end) {
        log.info("-------------1302接口数据开始同步------------------");
        //同步数据,只记录失败的信息
@@ -61,8 +61,8 @@
        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));
            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;
@@ -81,28 +81,35 @@
                //由货位代码+检测日期     (yyyyMMdd) +4 位顺序号组成  --2019 1128 0819
                api1302 = new Api1302();
                //api1302.setWsdjcdh(api1105.getHwdm() + DateFormatUtils.format(grain.getReceiveDate(), "yyyyMMdd") + String.valueOf(index).substring(1));
                api1302.setWsdjcdh(api1105.getHwdm() + fz40Grain.getBatchId());
                api1302.setJcsj(fz40Grain.getReceiveDate());
                api1302.setHwdm(api1105.getHwdm());
                api1302.setCfww(fz40Grain.getTempOut() == null ? 0.00: fz40Grain.getTempOut());
                if(null == fz40Grain.getHumidityOut() || fz40Grain.getHumidityOut() < 0){
                api1302.setCfww(fz40Grain.getTempOut() == null ? 0.00 : fz40Grain.getTempOut());
                if (null == fz40Grain.getHumidityOut() || fz40Grain.getHumidityOut() < 0) {
                    api1302.setCfws(-1);
                }else {
                } else {
                    api1302.setCfws(fz40Grain.getHumidityOut());
                }
                api1302.setCfnw(fz40Grain.getTempIn() == null ? 0.00: fz40Grain.getTempIn());
                if(null == fz40Grain.getHumidityIn() || fz40Grain.getHumidityIn() < 0){
                api1302.setCfnw(fz40Grain.getTempIn() == null ? 0.00 : fz40Grain.getTempIn());
                if (null == fz40Grain.getHumidityIn() || fz40Grain.getHumidityIn() < 0) {
                    api1302.setCfns(-1);
                }else {
                } else {
                    api1302.setCfns(fz40Grain.getHumidityIn());
                }
                api1302.setLszgw(fz40Grain.getTempMax() == null ? 0.00: fz40Grain.getTempMax());
                api1302.setLspjw(fz40Grain.getTempAve() == null ? 0.00: fz40Grain.getTempAve());
                api1302.setLszdw(fz40Grain.getTempMin() == null ? 0.00: fz40Grain.getTempMin());
                api1302.setLszgw(fz40Grain.getTempMax() == null ? 0.00 : fz40Grain.getTempMax());
                api1302.setLspjw(fz40Grain.getTempAve() == null ? 0.00 : fz40Grain.getTempAve());
                api1302.setLszdw(fz40Grain.getTempMin() == null ? 0.00 : fz40Grain.getTempMin());
                //判断粮食最低温、平均温、最高温是否符合逻辑
                if (api1302.getLszdw() >= api1302.getLspjw()) {
                    continue;
                }
                if (api1302.getLspjw() >= api1302.getLszgw()) {
                    continue;
                }
                //温度集合
                if (StringUtils.isEmpty(fz40Grain.getCableCir())) {
@@ -113,15 +120,15 @@
                    api1302.setLssdzjh(getHumPointList2(fz40Grain.getPoints(), fz40Grain.getCable(), fz40Grain.getCableCir()));
                }
                api1302.setZhgxsj(syncTime);
                api1302.setZhgxsj(fz40Grain.getReceiveDate());
                api1302.setBizId(fz40Grain.getBatchId());
                api1302.setKqdm(api1105.getKqdm());
                api1302.setSyncTime(syncTime);
                api1302List = api1302Rep.getDataByWsdjcdh(api1302.getWsdjcdh());
                if(null == api1302List || api1302List.isEmpty()){
                if (null == api1302List || api1302List.isEmpty()) {
                    api1302.setCzbz(Constant.CZBZ_I);
                }else {
                } else {
                    api1302.setCzbz(api1302List.get(0).getCzbz());
                }
                log.info("1302---同步数据:" + api1302.toString());
@@ -149,6 +156,9 @@
        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++) {
@@ -201,7 +211,7 @@
        int h = Integer.valueOf(cab[1]);
        int l = Integer.valueOf(cab[2]);
       // String[] points = point.split(",");
        // String[] points = point.split(",");
        String result = "";
        for (int i = 1; i <= l; i++) {
            for (int j = 1; j <= h; j++) {
@@ -228,7 +238,7 @@
        int g1 = 1;  //圈起始根数
        int g2 = 0;  //圈截止根数
      //  String[] points = point.split(",");
        //  String[] points = point.split(",");
        String result = "";
        for (int i = 1; i <= q; i++) {
            g1 += g2;