| | |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | /** |
| | | * 温湿度检测数据同步 |
| | | * |
| | | * @author chen |
| | | * @author czt |
| | | * @date 2022-09-07 14:41 |
| | | */ |
| | | @Slf4j |
| | |
| | | Date syncTime = new Date(); |
| | | Api1302 api1302; |
| | | Api1105 api1105; |
| | | //int index = 10001; |
| | | List<Api1302> api1302List; |
| | | for (Fz35Grain fz35Grain : list) { |
| | | //获取货位信息 |
| | | api1105 = commonService.getApi1105Cache(fz35Grain.getDepotId()); |
| | |
| | | api1302.setLspjw(fz35Grain.getTempAve() == null ? 0.00: fz35Grain.getTempAve()); |
| | | api1302.setLszdw(fz35Grain.getTempMin() == null ? 0.00: fz35Grain.getTempMin()); |
| | | |
| | | //判断粮食最低温、平均温、最高温是否符合逻辑 |
| | | if(api1302.getLszdw() >= api1302.getLspjw()){ |
| | | continue; |
| | | } |
| | | if(api1302.getLspjw() >= api1302.getLszgw()){ |
| | | continue; |
| | | } |
| | | |
| | | //温度集合 |
| | | if (StringUtils.isEmpty(fz35Grain.getCableCir())) { |
| | | api1302.setLswdzjh(getTempPointList1(fz35Grain.getPoints(), fz35Grain.getCable())); |
| | |
| | | api1302.setLssdzjh(getHumPointList2(fz35Grain.getPoints(), fz35Grain.getCable(), fz35Grain.getCableCir())); |
| | | } |
| | | |
| | | api1302.setCzbz(Constant.CZBZ_I); |
| | | api1302.setZhgxsj(syncTime); |
| | | api1302.setZhgxsj(fz35Grain.getReceiveDate()); |
| | | |
| | | api1302.setBizId(fz35Grain.getBatchId()); |
| | | api1302.setKqdm(api1105.getKqdm()); |
| | | api1302.setSyncTime(syncTime); |
| | | api1302List = api1302Rep.getDataByWsdjcdh(api1302.getWsdjcdh()); |
| | | if(null == api1302List || api1302List.isEmpty()){ |
| | | api1302.setCzbz(Constant.CZBZ_I); |
| | | }else { |
| | | api1302.setCzbz(api1302List.get(0).getCzbz()); |
| | | } |
| | | log.info("1302---同步数据:" + api1302.toString()); |
| | | api1302Rep.save(api1302); |
| | | // index++; |
| | | } |
| | | |
| | | } catch (Exception e) { |