潘志宝
2024-12-25 b8ecc0872d38c5e2c26ef56c4e6de7a30b12032a
提交 | 用户 | 时间
bbc1ee 1 package com.iailab.module.model.mcs.sche.service.impl;
2
3de266 3 import com.baomidou.dynamic.datasource.annotation.DSTransactional;
bbc1ee 4 import com.iailab.framework.common.pojo.PageResult;
5 import com.iailab.framework.common.service.impl.BaseServiceImpl;
b8ecc0 6 import com.iailab.framework.common.util.object.ConvertUtils;
bbc1ee 7 import com.iailab.module.model.mcs.sche.dao.StScheduleRecordDao;
b8ecc0 8 import com.iailab.module.model.mcs.sche.entity.StScheduleRecordDetailEntity;
bbc1ee 9 import com.iailab.module.model.mcs.sche.entity.StScheduleRecordEntity;
10 import com.iailab.module.model.mcs.sche.service.StScheduleRecordDetailService;
11 import com.iailab.module.model.mcs.sche.service.StScheduleRecordService;
b8ecc0 12 import com.iailab.module.model.mcs.sche.vo.StScheduleRecordDetailRespVO;
bbc1ee 13 import com.iailab.module.model.mcs.sche.vo.StScheduleRecordPageReqVO;
b8ecc0 14 import com.iailab.module.model.mcs.sche.vo.StScheduleRecordRespVO;
bbc1ee 15 import com.iailab.module.model.mdk.vo.ScheduleResultVO;
16 import org.springframework.beans.factory.annotation.Autowired;
17 import org.springframework.stereotype.Service;
18
19 import java.util.Date;
b8ecc0 20 import java.util.List;
bbc1ee 21 import java.util.UUID;
22
23 /**
24  * @author PanZhibao
25  * @Description
26  * @createTime 2024年09月06日
27  */
28 @Service
29 public class StScheduleRecordServiceImpl extends BaseServiceImpl<StScheduleRecordDao, StScheduleRecordEntity>
30         implements StScheduleRecordService {
31
32     @Autowired
33     private StScheduleRecordDetailService stScheduleRecordDetailService;
34
35     @Override
36     public PageResult<StScheduleRecordEntity> page(StScheduleRecordPageReqVO reqVO) {
37         return baseDao.selectPage(reqVO);
38     }
39
40     @Override
b8ecc0 41     public StScheduleRecordRespVO getInfo(String id) {
42         StScheduleRecordEntity entity = baseDao.selectById(id);
43         StScheduleRecordRespVO respVO = ConvertUtils.sourceToTarget(entity, StScheduleRecordRespVO.class);
44         List<StScheduleRecordDetailEntity> list = stScheduleRecordDetailService.getByRecordId(id);
45         respVO.setDetailList(ConvertUtils.sourceToTarget(list, StScheduleRecordDetailRespVO.class));
46         return respVO;
47     }
48
49     @Override
3de266 50     @DSTransactional(rollbackFor = Exception.class)
bbc1ee 51     public void create(ScheduleResultVO resultVO) {
52         StScheduleRecordEntity entity = new StScheduleRecordEntity();
53         entity.setId(UUID.randomUUID().toString());
54         entity.setCreateTime(new Date());
55         entity.setSchemeId(resultVO.getSchemeId());
56         entity.setScheduleTime(resultVO.getScheduleTime());
57         entity.setModelId(resultVO.getModelId());
58         baseDao.insert(entity);
59         stScheduleRecordDetailService.create(entity.getId(), resultVO);
60     }
61 }