| | |
| | | private WorkstationCache workstationCache; |
| | | @Autowired |
| | | private TimeSliceCache timeSliceCache; |
| | | //private static String TEMPLATE_NAME = "process_param"; |
| | | |
| | | static { |
| | | PROCESS_PARAM_MAP.put(1, "STATE"); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 数据填充,(calendarCode,factoryYear,month,date,week) |
| | | * 数据填充,日历代码之类的统计相关字段初始化(calendarCode,factoryYear,month,date,week) |
| | | * |
| | | * @param telemetryDataList |
| | | * @return |
| | |
| | | |
| | | String[] keys = map.keySet().toArray(new String[0]); |
| | | for (int j = 0; j < keys.length; j++) { |
| | | //TODO: 这里,原系统进行了过滤。WorkstationCollectDataServiceImpl.handlerWorkstationCollectData里 |
| | | |
| | | PackedTelemetryData pkData = new PackedTelemetryData(); |
| | | pkData.setWorkstationId(tdata.getWorkstationId()); |
| | | pkData.setValue(map.get(keys[j])); |
| | | pkData.setTime(item.getTime()); |
| | | |
| | | pkData.setName(keys[j]);//参数名称 |
| | | pkData.setName(keys[j]);//数据点名称 |
| | | |
| | | fillByCalendar(pkData); |
| | | |
| | |
| | | * |
| | | * @param pdata |
| | | */ |
| | | void fillByCalendar(PackedTelemetryData pdata) { |
| | | public void fillByCalendar(PackedTelemetryData pdata) { |
| | | //原来在TelemetryPropertyWrapper.packWorkstationCalendarInfo中完成 |
| | | //FIXME: 填写实际的数据还需要后续处理 |
| | | |
| | |
| | | //telemetryData.setCalendarCode(calendarCode); |
| | | } else { |
| | | //telemetryData.setCalendarCode("#default#"); |
| | | pdata.setCalendarCode("#default#"); |
| | | pdata.setCalendarCode(CommonConstant.DEFAULT_CODE); |
| | | } |
| | | |
| | | //pdata.setShiftIndex(1);//临时 |
| | | //pdata.setShiftTimeType(1);//临时 |
| | | |
| | | // TelemetryPropertyWrapper中packWorkstationCalendarInfo |
| | | //------------start |
| | | Boolean isDefaultCalendar = true; |
| | | if (!"#default#".equals(pdata.getCalendarCode())) { |
| | | boolean isDefaultCalendar = true; |
| | | if (!CommonConstant.DEFAULT_CODE.equals(pdata.getCalendarCode())) { |
| | | CalendarShiftTimeSlicesDTO calendarShiftTimeSlicesDTO = timeSliceCache.getTimeSliceShift(pdata.getCalendarCode(), collectTime);//从redis中获得日历的时间切片 |
| | | if (ObjectUtil.isEmpty(calendarShiftTimeSlicesDTO)) {//如果没有时间切片,则使用TimeSliceCache.build(cacheBuildDTO);构建 |
| | | LocalDate targetDate = Instant.ofEpochMilli(pdata.getTime()).atZone(ZoneOffset.systemDefault()).toLocalDate(); |
| | |
| | | } |
| | | |
| | | //无日历切片,使用采集时间填充factoryYear,month,date,week几个属性 |
| | | if (isDefaultCalendar.booleanValue()) { |
| | | if (isDefaultCalendar) { |
| | | log.info("无日历切片"); |
| | | LocalDate localDate = Instant.ofEpochMilli(pdata.getTime().longValue()).atZone(ZoneOffset.systemDefault()).toLocalDate(); |
| | | pdata.setFactoryDate(Integer.valueOf(DatePattern.PURE_DATE_FORMAT.format(collectTime))) |