package com.iailab.module.model.mcs.pre.service.impl; import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.iailab.framework.common.service.impl.BaseServiceImpl; import com.iailab.module.model.mcs.pre.dao.MmItemResultJsonDao; import com.iailab.module.model.mcs.pre.entity.MmItemResultJsonEntity; import com.iailab.module.model.mcs.pre.service.MmItemResultJsonService; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Date; import java.util.List; /** * @author PanZhibao * @Description * @createTime 2024年11月14日 */ @Service public class MmItemResultJsonServiceImpl extends BaseServiceImpl implements MmItemResultJsonService { @Override public List getData(String outputId, Date predictTime) { List result = new ArrayList<>(); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq("outputid", outputId) .eq("predicttime", predictTime); MmItemResultJsonEntity data = baseDao.selectOne(wrapper); if (data == null || StringUtils.isBlank(data.getJsonvalue())) { return result; } result = JSONArray.parseArray(data.getJsonvalue(), Object[].class); result.forEach(item -> { item[0] = new Date(Long.parseLong(item[0].toString())); }); return result; } }