提交 | 用户 | 时间
|
2228b6
|
1 |
package com.iailab.module.data.point.service.impl; |
潘 |
2 |
|
|
3 |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
4 |
import com.iailab.framework.common.service.impl.BaseServiceImpl; |
|
5 |
import com.iailab.module.data.common.enums.DataQualityEnum; |
|
6 |
import com.iailab.module.data.point.dao.DaPointCollectStatusDao; |
|
7 |
import com.iailab.module.data.point.entity.DaPointCollectStatusEntity; |
|
8 |
import com.iailab.module.data.point.service.DaPointCollectStatusService; |
|
9 |
import org.springframework.stereotype.Service; |
|
10 |
|
|
11 |
import java.util.Date; |
|
12 |
import java.util.UUID; |
|
13 |
|
|
14 |
/** |
|
15 |
* @author PanZhibao |
|
16 |
* @Description |
|
17 |
* @createTime 2024年12月13日 |
|
18 |
*/ |
|
19 |
@Service |
|
20 |
public class DaPointCollectStatusServiceImpl extends BaseServiceImpl<DaPointCollectStatusDao, DaPointCollectStatusEntity> |
|
21 |
implements DaPointCollectStatusService { |
|
22 |
|
6b1383
|
23 |
public void recordStatus(String pointNo, String collectValue, Date collectTime) { |
2228b6
|
24 |
QueryWrapper<DaPointCollectStatusEntity> queryWrapper = new QueryWrapper<>(); |
6b1383
|
25 |
queryWrapper.eq("point_no", pointNo); |
2228b6
|
26 |
DaPointCollectStatusEntity entity = baseDao.selectOne(queryWrapper); |
潘 |
27 |
if (entity == null) { |
|
28 |
entity = new DaPointCollectStatusEntity(); |
|
29 |
entity.setId(UUID.randomUUID().toString()); |
6b1383
|
30 |
entity.setPointNo(pointNo); |
2228b6
|
31 |
entity.setCollectValue(collectValue); |
潘 |
32 |
entity.setCollectQuality(DataQualityEnum.getEumByValue(collectValue).getCode()); |
|
33 |
entity.setCollectTime(collectTime); |
|
34 |
baseDao.insert(entity); |
|
35 |
} else { |
|
36 |
entity.setCollectValue(collectValue); |
|
37 |
entity.setCollectQuality(DataQualityEnum.getEumByValue(collectValue).getCode()); |
|
38 |
entity.setCollectTime(collectTime); |
|
39 |
baseDao.updateById(entity); |
|
40 |
} |
|
41 |
|
|
42 |
} |
|
43 |
} |