提交 | 用户 | 时间
|
bbc1ee
|
1 |
package com.iailab.module.model.mcs.sche.service.impl; |
潘 |
2 |
|
|
3 |
import com.alibaba.fastjson.JSON; |
|
4 |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
5 |
import com.iailab.framework.common.service.impl.BaseServiceImpl; |
|
6 |
import com.iailab.module.model.mcs.sche.dao.StScheduleRecordDetailDao; |
|
7 |
import com.iailab.module.model.mcs.sche.entity.StScheduleRecordDetailEntity; |
|
8 |
import com.iailab.module.model.mcs.sche.service.StScheduleRecordDetailService; |
|
9 |
import com.iailab.module.model.mdk.vo.ScheduleResultVO; |
|
10 |
import org.springframework.stereotype.Service; |
|
11 |
import org.springframework.util.CollectionUtils; |
|
12 |
|
|
13 |
import java.util.List; |
|
14 |
import java.util.Map; |
|
15 |
import java.util.UUID; |
|
16 |
|
|
17 |
/** |
|
18 |
* @author PanZhibao |
|
19 |
* @Description |
|
20 |
* @createTime 2024年09月06日 |
|
21 |
*/ |
|
22 |
@Service |
|
23 |
public class StScheduleRecordDetailServiceImpl extends BaseServiceImpl<StScheduleRecordDetailDao, StScheduleRecordDetailEntity> |
|
24 |
implements StScheduleRecordDetailService { |
|
25 |
|
|
26 |
|
|
27 |
@Override |
|
28 |
public void create(String recordId, ScheduleResultVO resultVO) { |
|
29 |
if (CollectionUtils.isEmpty(resultVO.getResult())) { |
|
30 |
return; |
|
31 |
} |
|
32 |
for (Map.Entry<String, Object > entry: resultVO.getResult().entrySet()) { |
|
33 |
StScheduleRecordDetailEntity entity = new StScheduleRecordDetailEntity(); |
|
34 |
entity.setId(UUID.randomUUID().toString()); |
f51cf1
|
35 |
entity.setRecordId(recordId); |
bbc1ee
|
36 |
entity.setSchemeId(resultVO.getSchemeId()); |
潘 |
37 |
entity.setModelId(resultVO.getModelId()); |
|
38 |
entity.setScheduleTime(resultVO.getScheduleTime()); |
|
39 |
entity.setResultKey(entry.getKey()); |
|
40 |
entity.setResultValue(JSON.toJSONString(entry.getValue())); |
|
41 |
baseDao.insert(entity); |
|
42 |
} |
|
43 |
} |
|
44 |
|
|
45 |
@Override |
|
46 |
public List<StScheduleRecordDetailEntity> getByRecordId(String recordId) { |
|
47 |
QueryWrapper<StScheduleRecordDetailEntity> queryWrapper = new QueryWrapper<>(); |
|
48 |
queryWrapper.eq("record_id", recordId); |
|
49 |
queryWrapper.orderByAsc("result_key"); |
|
50 |
return baseDao.selectList(queryWrapper); |
|
51 |
} |
|
52 |
} |