| | |
| | | |
| | | import com.iailab.module.ansteel.coking.entity.CokingTraceIndEntity; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | |
| | | void save(List<CokingTraceIndEntity> entityList); |
| | | |
| | | void saveTraceInd(String relId, String indType,String clock); |
| | | void saveTraceInd(String relId, String indType, String clock, Date startDate, Date endDate); |
| | | } |
| | |
| | | import com.iailab.module.data.api.ind.IndItemApi; |
| | | import com.iailab.module.data.api.ind.dto.ApiIndItemValueDTO; |
| | | import com.iailab.module.data.api.point.DataPointApi; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import com.iailab.module.data.api.point.dto.ApiPointValueDTO; |
| | | import com.iailab.module.data.api.point.dto.ApiPointValueQueryDTO; |
| | | import com.iailab.module.data.api.point.dto.ApiPointsValueQueryDTO; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2025年04月17日 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class CokingTraceIndServiceImpl implements CokingTraceIndService { |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void saveTraceInd(String relId, String indType, String clock) { |
| | | public void saveTraceInd(String relId, String indType, String clock, Date startDate, Date endDate) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("indType", indType); |
| | | List<CokingTraceConfEntity> list = cokingTraceConfService.list(map); |
| | |
| | | String value = "-2"; |
| | | switch (ProcessConfDataTypeEnum.getEumByCode(conf.getDataType())) { |
| | | case DATAPOINT: |
| | | log.info("CokingTraceInd:DATAPOINT:" + conf.getPointNo()); |
| | | List<String> points = new ArrayList<>(); |
| | | points.add(conf.getPointNo()); |
| | | Map<String, Object> pointsRealValue = dataPointApi.queryPointsRealValue(points); |
| | | log.info("CokingTraceInd:pointsRealValue:{}", pointsRealValue); |
| | | value = new BigDecimal(pointsRealValue.get(conf.getPointNo()).toString()).setScale(2,BigDecimal.ROUND_HALF_UP) .toString(); |
| | | ApiPointValueQueryDTO point = new ApiPointValueQueryDTO(); |
| | | point.setPointNo(conf.getPointNo()); |
| | | point.setStart(startDate); |
| | | point.setEnd(endDate); |
| | | List<ApiPointValueDTO> pointHistoryValue = dataPointApi.queryPointHistoryValue(point); |
| | | if (!CollectionUtils.isEmpty(pointHistoryValue)) { |
| | | value = new BigDecimal(String.valueOf(pointHistoryValue.get(pointHistoryValue.size() - 1).getV())).setScale(2,BigDecimal.ROUND_HALF_UP) .toString(); |
| | | } |
| | | break; |
| | | case IND: |
| | | log.info("CokingTraceInd:IND:" + conf.getPointNo()); |
| | | List<ApiIndItemValueDTO> indValues = indItemApi.queryIndItemDefaultValue(conf.getPointNo()); |
| | | log.info("CokingTraceInd:indValues:{}", indValues); |
| | | if (!CollectionUtils.isEmpty(indValues)) { |
| | | value = new BigDecimal(indValues.get(indValues.size() - 1).getDataValue().toString()).setScale(2,BigDecimal.ROUND_HALF_UP) .toString(); |
| | | } |
| | |
| | | import com.iailab.module.ansteel.common.enums.TraceProcessTypeEnum; |
| | | import com.iailab.module.model.api.mcs.McsApi; |
| | | import com.iailab.module.model.api.mdk.MdkApi; |
| | | import com.iailab.module.model.api.mdk.dto.MdkScheduleReqDTO; |
| | | import com.iailab.module.model.api.mdk.dto.MdkScheduleRespDTO; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | |
| | | Date startDate = calendar.getTime(); |
| | | String clock = DateUtils.format(startDate); |
| | | |
| | | calendar.add(Calendar.DAY_OF_YEAR, 1); |
| | | calendar.add(Calendar.MINUTE, -3); |
| | | Date collectStartDate = calendar.getTime(); |
| | | |
| | | // 调用模型 |
| | | // MdkScheduleReqDTO dto = new MdkScheduleReqDTO(); |
| | | // dto.setScheduleTime(calendar.getTime()); |
| | |
| | | cokingTraceDeviationService.saveTraceDeviation(relId, process, clock, result, CommonConstant.COKE_INDEX_CHARTCODE, row, SugObj); |
| | | |
| | | // 保存溯源指标 |
| | | cokingTraceIndService.saveTraceInd(relId, indType, clock); |
| | | cokingTraceIndService.saveTraceInd(relId, indType, clock, collectStartDate, endDate); |
| | | |
| | | // 保存溯源折线图 |
| | | cokingTraceChartService.save(relId, clock, indType, startDate, endDate); |
| | |
| | | Date startDate = calendar.getTime(); |
| | | String clock = DateUtils.format(startDate); |
| | | |
| | | calendar.add(Calendar.DAY_OF_YEAR, 1); |
| | | calendar.add(Calendar.MINUTE, -3); |
| | | Date collectStartDate = calendar.getTime(); |
| | | |
| | | // 调用模型 |
| | | // MdkScheduleReqDTO dto = new MdkScheduleReqDTO(); |
| | | // dto.setScheduleTime(calendar.getTime()); |
| | |
| | | cokingTraceDeviationService.saveTraceDeviation(relId, process, clock, result, CommonConstant.COKE_INDEX_CHARTCODE, row, SugObj); |
| | | |
| | | // 保存溯源指标 |
| | | cokingTraceIndService.saveTraceInd(relId, indType, clock); |
| | | cokingTraceIndService.saveTraceInd(relId, indType, clock, collectStartDate, endDate); |
| | | |
| | | } catch (Exception ex) { |
| | | logger.error("RunCokingTraceModelGXJTask运行异常"); |
| | |
| | | Date startDate = calendar.getTime(); |
| | | String clock = DateUtils.format(startDate); |
| | | |
| | | calendar.add(Calendar.DAY_OF_YEAR, 1); |
| | | calendar.add(Calendar.MINUTE, -3); |
| | | Date collectStartDate = calendar.getTime(); |
| | | |
| | | // 调用模型 |
| | | // MdkScheduleReqDTO dto = new MdkScheduleReqDTO(); |
| | | // dto.setScheduleTime(calendar.getTime()); |
| | |
| | | cokingTraceDeviationService.saveTraceDeviation(relId, process, clock, result, CommonConstant.COKE_INDEX_CHARTCODE, row, SugObj); |
| | | |
| | | // 保存溯源指标 |
| | | cokingTraceIndService.saveTraceInd(relId, indType, clock); |
| | | cokingTraceIndService.saveTraceInd(relId, indType, clock,collectStartDate,endDate); |
| | | |
| | | // 保存溯源折线图 |
| | | cokingTraceChartService.save(relId, clock, indType, startDate, endDate); |
| | |
| | | } |
| | | logger.info("RunCokingTraceModelHCTask运行完成"); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | calendar.set(Calendar.MINUTE, 0); |
| | | |
| | | calendar.set(Calendar.HOUR_OF_DAY, 0); |
| | | Date endDate = calendar.getTime(); |
| | | System.out.println(endDate); |
| | | calendar.add(Calendar.DAY_OF_YEAR, -1); |
| | | Date startDate = calendar.getTime(); |
| | | String clock = DateUtils.format(startDate); |
| | | System.out.println(clock); |
| | | |
| | | calendar.add(Calendar.DAY_OF_YEAR, 1); |
| | | calendar.add(Calendar.MINUTE, -3); |
| | | Date collectStartDate = calendar.getTime(); |
| | | System.out.println(collectStartDate); |
| | | } |
| | | } |
| | |
| | | Date startDate = calendar.getTime(); |
| | | String clock = DateUtils.format(startDate); |
| | | |
| | | calendar.add(Calendar.DAY_OF_YEAR, 1); |
| | | calendar.add(Calendar.MINUTE, -3); |
| | | Date collectStartDate = calendar.getTime(); |
| | | |
| | | // 调用模型 |
| | | // MdkScheduleReqDTO dto = new MdkScheduleReqDTO(); |
| | | // dto.setScheduleTime(calendar.getTime()); |
| | |
| | | cokingTraceDeviationService.saveTraceDeviation(relId, process, clock, result, CommonConstant.COKE_INDEX_CHARTCODE, row, SugObj); |
| | | |
| | | // 保存溯源指标 |
| | | cokingTraceIndService.saveTraceInd(relId, indType, clock); |
| | | cokingTraceIndService.saveTraceInd(relId, indType, clock, collectStartDate, endDate); |
| | | |
| | | // 保存溯源折线图 |
| | | cokingTraceChartService.save(relId, clock, indType, startDate, endDate); |