潘志宝
2025-01-17 213afc8ee0fea62ce448db3539e0eb5ed2031982
提交 | 用户 | 时间
a6de49 1 package com.iailab.module.data.point.service.impl;
H 2
139c6a 3 import cn.hutool.core.collection.CollUtil;
a6de49 4 import com.alibaba.fastjson.JSONArray;
cfbd83 5 import com.baomidou.dynamic.datasource.annotation.DSTransactional;
a6de49 6 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
250190 7 import com.baomidou.mybatisplus.core.metadata.IPage;
6bf63b 8 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
48c064 9 import com.iailab.framework.common.constant.Constant;
6bf63b 10 import com.iailab.framework.common.pojo.PageResult;
48c064 11 import com.iailab.framework.common.service.impl.BaseServiceImpl;
139c6a 12 import com.iailab.framework.common.util.object.BeanUtils;
6bf63b 13 import com.iailab.framework.common.util.object.ConvertUtils;
07890e 14 import com.iailab.module.data.api.point.dto.ApiPointDTO;
01d6f8 15 import com.iailab.module.data.channel.common.service.ChannelSourceService;
a6de49 16 import com.iailab.module.data.common.enums.CommonConstant;
H 17 import com.iailab.module.data.common.enums.IsEnableEnum;
c96e44 18 import com.iailab.module.data.common.enums.IncreaseCodeEnum;
a6de49 19 import com.iailab.module.data.point.common.PointTypeEnum;
6bf63b 20 import com.iailab.module.data.point.dao.DaPointDao;
0ed8ac 21 import com.iailab.module.data.point.dto.DaCumulatePointDTO;
22 import com.iailab.module.data.point.dto.DaMathPointDTO;
a6de49 23 import com.iailab.module.data.point.dto.DaMeasurePointDTO;
H 24 import com.iailab.module.data.point.dto.DaPointDTO;
139c6a 25 import com.iailab.module.data.point.entity.DaMeasurePointEntity;
a6de49 26 import com.iailab.module.data.point.entity.DaPointEntity;
0ed8ac 27 import com.iailab.module.data.point.service.*;
f21253 28 import com.iailab.module.data.point.vo.DaPointPageReqVO;
J 29 import com.iailab.module.data.point.vo.PointImportExcelVO;
30 import com.iailab.module.data.point.vo.PointImportRespVO;
48c57b 31 import org.apache.commons.lang3.ObjectUtils;
213afc 32 import org.apache.commons.lang3.StringUtils;
0ed8ac 33 import org.springframework.beans.factory.annotation.Autowired;
a6de49 34 import org.springframework.stereotype.Service;
H 35 import org.springframework.util.CollectionUtils;
36
6bf63b 37 import javax.annotation.Resource;
a6de49 38 import java.util.*;
9df837 39 import java.util.concurrent.ConcurrentHashMap;
139c6a 40
D 41 import static com.iailab.framework.common.exception.util.ServiceExceptionUtil.exception;
f21253 42 import static com.iailab.module.data.enums.ErrorCodeConstants.POINT_EXISTS;
J 43 import static com.iailab.module.data.enums.ErrorCodeConstants.POINT_IMPORT_LIST_IS_EMPTY;
a6de49 44
H 45 /**
6bf63b 46  * @author lirm
a6de49 47  * @Description
6bf63b 48  * @createTime 2024年09月2日
a6de49 49  */
H 50 @Service
48c064 51 public class DaPointServiceImpl extends BaseServiceImpl<DaPointDao, DaPointEntity> implements DaPointService {
a6de49 52
0ed8ac 53     @Autowired
a6de49 54     private DaMeasurePointService daMeasurePointService;
H 55
0ed8ac 56     @Autowired
a6de49 57     private DaMathPointService daMathPointService;
H 58
0ed8ac 59     @Autowired
60     private DaCumulatePointService daCumulatePointService;
61
62     @Autowired
a6de49 63     private DaSequenceNumService daSequenceNumService;
6bf63b 64     
L 65     @Resource
66     private DaPointDao daPointDao;
67
139c6a 68     @Resource
01d6f8 69     private ChannelSourceService channelSourceService;
9df837 70
90e342 71     @Resource
72     private DaPointCollectStatusService daPointCollectStatusService;
73
07890e 74     private static Map<String, ApiPointDTO> pointIdMap = new ConcurrentHashMap<>();
a4891a 75
9df837 76     private static Map<String, DaPointDTO> pointNoMap = new ConcurrentHashMap<>();
a6de49 77
H 78     @Override
250190 79     public PageResult<DaPointDTO> queryPage(DaPointPageReqVO reqVO) {
139c6a 80         IPage<DaPointDTO> page = daPointDao.selectPageList(reqVO);
a4891a 81         return new PageResult<>(page.getRecords(), page.getTotal());
82     }
83
84     private void clearCache() {
85         pointIdMap.clear();
86         pointNoMap.clear();
a6de49 87     }
H 88
89     @Override
6bf63b 90     public DaPointDTO info(String id) {
L 91         DaPointEntity entity = daPointDao.selectById(id);
a6de49 92         DaPointDTO result = ConvertUtils.sourceToTarget(entity, DaPointDTO.class);
0ed8ac 93         result.setMeasurePoint(new DaMeasurePointDTO());
94         result.setMathPoint(new DaMathPointDTO());
95         result.setCumulatePoint(new DaCumulatePointDTO());
96         switch (PointTypeEnum.getEumByCode(result.getPointType())) {
97             case MEASURE_POINT:
98                 DaMeasurePointDTO measurePoint = daMeasurePointService.getByPoint(id);
99                 result.setMeasurePoint(measurePoint);
100                 List<String> sourceOption = new ArrayList<>();
101                 sourceOption.add(measurePoint.getSourceType());
102                 sourceOption.add(measurePoint.getSourceId());
103                 sourceOption.add(measurePoint.getTagNo());
104                 result.setSourceOption(sourceOption);
105                 break;
106             case CALCULATE_POINT:
107                 result.setMathPoint(daMathPointService.getByPoint(id));
108                 break;
109             case CUMULATE:
110                 result.setCumulatePoint(daCumulatePointService.getByPoint(id));
111                 break;
112             default:
113                 break;
a6de49 114         }
H 115         return result;
116     }
117
118     @Override
07890e 119     public ApiPointDTO getSimpleInfoById(String id) {
a4891a 120         if (pointIdMap.containsKey(id)) {
121             return pointIdMap.get(id);
122         }
07890e 123         ApiPointDTO dto = ConvertUtils.sourceToTarget(daPointDao.selectById(id), ApiPointDTO.class);
5f7008 124         if (dto == null) {
125             return null;
126         }
a4891a 127         pointIdMap.put(id, dto);
07890e 128         return dto;
b8b8cb 129     }
130
131     @Override
132     public DaPointDTO getSimpleInfoByNo(String no) {
29b971 133         QueryWrapper<DaPointEntity> queryWrapper = new QueryWrapper<>();
7511af 134         queryWrapper.eq("point_no", no);
b8b8cb 135         return ConvertUtils.sourceToTarget(daPointDao.selectOne(queryWrapper), DaPointDTO.class);
136     }
137
138     @Override
a6de49 139     public List<DaPointDTO> list(Map<String, Object> params) {
48c57b 140         Object pointType = params.get("pointType");
a6de49 141         List<String> pointNos = new ArrayList<>();
H 142         if (params.get("pointNos") != null) {
143             pointNos = JSONArray.parseArray(JSONArray.toJSONString(params.get("pointNos")), String.class);
144         }
14cb32 145         List<String> pointTypes = new ArrayList<>();
146         if (params.get("pointTypes") != null) {
147             pointTypes = Arrays.asList(params.get("pointTypes").toString().split(","));
148         }
149
48c57b 150         Object pointNoLike = params.get("pointNoLike");
a6de49 151         QueryWrapper<DaPointEntity> queryWrapper = new QueryWrapper();
48c57b 152         queryWrapper.eq(!ObjectUtils.isEmpty(pointType), "point_type", pointType);
L 153         queryWrapper.in(pointNos.size() != 0,"point_no", pointNos);
154         queryWrapper.like(!ObjectUtils.isEmpty(pointNoLike), "point_no", pointNoLike);
14cb32 155         queryWrapper.in(pointTypes.size() != 0,"point_type", pointTypes);
6bf63b 156         List<DaPointEntity> list = daPointDao.selectList(queryWrapper);
a6de49 157         return ConvertUtils.sourceToTarget(list, DaPointDTO.class);
H 158     }
159
160     @Override
cfbd83 161     @DSTransactional(rollbackFor = Exception.class)
a6de49 162     public void add(DaPointDTO dataPoint) {
H 163         DaPointEntity daPointEntity = ConvertUtils.sourceToTarget(dataPoint, DaPointEntity.class);
164         daPointEntity.setId(UUID.randomUUID().toString());
01d6f8 165         switch (PointTypeEnum.getEumByCode(dataPoint.getPointType())) {
166             case MEASURE_POINT:
167                 DaMeasurePointDTO measurePoint = new DaMeasurePointDTO();
168                 measurePoint.setSourceType(dataPoint.getSourceOption().get(0));
169                 measurePoint.setSourceId(dataPoint.getSourceOption().get(1));
170                 measurePoint.setTagNo(dataPoint.getSourceOption().get(2));
171                 daMeasurePointService.add(measurePoint, daPointEntity.getId());
172                 daPointEntity.setPointNo(daSequenceNumService.getAndIncreaseByCode(IncreaseCodeEnum.POINT_M.name()));
173                 break;
174             case CALCULATE_POINT:
175                 daMathPointService.add(dataPoint.getMathPoint(), daPointEntity.getId());
176                 daPointEntity.setPointNo(daSequenceNumService.getAndIncreaseByCode(IncreaseCodeEnum.POINT_C.name()));
177                 break;
178             case CONSTANT:
179                 daPointEntity.setPointNo(daSequenceNumService.getAndIncreaseByCode(IncreaseCodeEnum.POINT_F.name()));
180                 break;
0ed8ac 181             case CUMULATE:
182                 daCumulatePointService.add(dataPoint.getCumulatePoint(), daPointEntity.getId());
183                 daPointEntity.setPointNo(daSequenceNumService.getAndIncreaseByCode(IncreaseCodeEnum.POINT_L.name()));
184                 break;
01d6f8 185             default:
186                 break;
a6de49 187         }
H 188         daPointEntity.setIsEnable(CommonConstant.IS_ENABLE);
189         daPointEntity.setCreateTime(new Date());
6bf63b 190         daPointDao.insert(daPointEntity);
9df837 191
90e342 192         daPointCollectStatusService.add(daPointEntity.getPointNo());
9df837 193         // 清空缓存
a4891a 194         clearCache();
a6de49 195     }
H 196
197     @Override
cfbd83 198     @DSTransactional(rollbackFor = Exception.class)
a6de49 199     public void update(DaPointDTO dataPoint) {
H 200         DaPointEntity daPointEntity = ConvertUtils.sourceToTarget(dataPoint, DaPointEntity.class);
201         daPointEntity.setUpdateTime(new Date());
6bf63b 202         daPointDao.updateById(daPointEntity);
01d6f8 203         switch (PointTypeEnum.getEumByCode(dataPoint.getPointType())) {
204             case MEASURE_POINT:
205                 DaMeasurePointDTO measurePoint = dataPoint.getMeasurePoint();
206                 measurePoint.setSourceType(dataPoint.getSourceOption().get(0));
207                 measurePoint.setSourceId(dataPoint.getSourceOption().get(1));
208                 measurePoint.setTagNo(dataPoint.getSourceOption().get(2));
209                 daMeasurePointService.update(measurePoint);
210                 break;
211             case CALCULATE_POINT:
212                 daMathPointService.update(dataPoint.getMathPoint());
213                 break;
0ed8ac 214             case CUMULATE:
215                 daCumulatePointService.update(dataPoint.getCumulatePoint());
216                 break;
01d6f8 217             default:
218                 break;
a6de49 219         }
9df837 220         // 清空缓存
a4891a 221         clearCache();
a6de49 222     }
H 223
224     @Override
cfbd83 225     @DSTransactional(rollbackFor = Exception.class)
eb1c5f 226     public void delete(String[] ids) {
227         daPointDao.deleteBatchIds(Arrays.asList(ids));
228         daMeasurePointService.deleteByPoint(ids);
229         daMathPointService.deleteByPoint(ids);
230         daCumulatePointService.deleteByPoint(ids);
9df837 231         // 清空缓存
a4891a 232         clearCache();
a6de49 233     }
H 234
235     @Override
14cb32 236     public List<DaPointDTO> getConstantPoint(DaPointPageReqVO reqVO) {
237         Map<String, Object> params = new HashMap<>();
238         params.put("pointType", PointTypeEnum.CONSTANT.getCode());
239         params.put("pointNo", reqVO.getPointNo());
240         params.put("pointName", reqVO.getPointName());
241         return daPointDao.getConstantPoint(params);
242     }
243
244     @Override
a6de49 245     public List<DaPointDTO> getConstantPoint(String freq) {
H 246         Map<String, Object> params = new HashMap<>();
247         params.put("pointType", PointTypeEnum.CONSTANT.getCode());
248         params.put("isEnable", CommonConstant.IS_ENABLE);
249         params.put("minfreqid", freq);
6bf63b 250         return daPointDao.getConstantPoint(params);
a6de49 251     }
H 252
253     @Override
254     public List<DaPointDTO> getConstantPoint(List<String> pointNos) {
255         Map<String, Object> params = new HashMap<>();
256         params.put("pointType", PointTypeEnum.CONSTANT.getCode());
257         params.put("isEnable", CommonConstant.IS_ENABLE);
258         params.put("pointNos", pointNos);
6bf63b 259         return daPointDao.getConstantPoint(params);
14cb32 260     }
261
262     @Override
263     public List<DaPointDTO> getMeasurePoint(DaPointPageReqVO reqVO) {
264         Map<String, Object> params = new HashMap<>();
265         params.put("pointType", PointTypeEnum.MEASURE_POINT.getCode());
266         params.put("pointNo", reqVO.getPointNo());
267         params.put("pointName", reqVO.getPointName());
268         params.put("sourceName", reqVO.getSourceName());
269         return daPointDao.getMeasurePoint(params);
a6de49 270     }
H 271
272     @Override
273     public List<DaPointDTO> getMeasurePoint(String freq) {
274         Map<String, Object> params = new HashMap<>();
275         params.put("pointType", PointTypeEnum.MEASURE_POINT.getCode());
276         params.put("isEnable", CommonConstant.IS_ENABLE);
277         params.put("minfreqid", freq);
6bf63b 278         return daPointDao.getMeasurePoint(params);
a6de49 279     }
H 280
281     @Override
282     public List<DaPointDTO> getMeasurePoint(List<String> pointNos) {
283         Map<String, Object> params = new HashMap<>();
284         params.put("pointType", PointTypeEnum.MEASURE_POINT.getCode());
285         params.put("isEnable", CommonConstant.IS_ENABLE);
286         params.put("pointNos", pointNos);
6bf63b 287         return daPointDao.getMeasurePoint(params);
a6de49 288     }
H 289
290     @Override
291     public DaPointDTO getMeasurePointByNo(String pointNo) {
292         Map<String, Object> params = new HashMap<>();
293         params.put("pointType", PointTypeEnum.MEASURE_POINT.getCode());
294         params.put("pointNo", pointNo);
6bf63b 295         List<DaPointDTO> list = daPointDao.getMeasurePoint(params);
a6de49 296         if (CollectionUtils.isEmpty(list)) {
H 297             return null;
298         }
299         return list.get(0);
14cb32 300     }
301
302     @Override
303     public List<DaPointDTO> getMathPoint(DaPointPageReqVO reqVO) {
304         Map<String, Object> params = new HashMap<>();
305         params.put("pointType", PointTypeEnum.CALCULATE_POINT.getCode());
306         params.put("pointNo", reqVO.getPointNo());
307         params.put("pointName", reqVO.getPointName());
308         return daPointDao.getMathPoint(params);
a6de49 309     }
H 310
311     @Override
312     public List<DaPointDTO> getMathPoint(String freq) {
313         Map<String, Object> params = new HashMap<>();
314         params.put("pointType", PointTypeEnum.CALCULATE_POINT.getCode());
315         params.put("isEnable", CommonConstant.IS_ENABLE);
316         params.put("minfreqid", freq);
6bf63b 317         return daPointDao.getMathPoint(params);
a6de49 318     }
H 319
320     @Override
321     public List<DaPointDTO> getMathPoint(List<String> pointNos) {
322         Map<String, Object> params = new HashMap<>();
323         params.put("pointType", PointTypeEnum.CALCULATE_POINT.getCode());
324         params.put("isEnable", CommonConstant.IS_ENABLE);
325         params.put("pointNos", pointNos);
6bf63b 326         return daPointDao.getMathPoint(params);
a6de49 327     }
H 328
329     @Override
56dba6 330     public List<DaPointDTO> getCumulatePoint(String freq) {
eb1c5f 331         Map<String, Object> params = new HashMap<>(3);
56dba6 332         params.put("pointType", PointTypeEnum.CUMULATE.getCode());
333         params.put("isEnable", CommonConstant.IS_ENABLE);
334         params.put("minfreqid", freq);
eb1c5f 335         return daPointDao.getCumulatePoint(params);
336     }
337
338     @Override
d64649 339     public List<DaPointDTO> getCumulatePoint(List<String> pointNos) {
340         Map<String, Object> params = new HashMap<>(3);
341         params.put("pointType", PointTypeEnum.CUMULATE.getCode());
342         params.put("isEnable", CommonConstant.IS_ENABLE);
343         params.put("pointNos", pointNos);
344         return daPointDao.getCumulatePoint(params);
345     }
346
347     @Override
eb1c5f 348     public List<DaPointDTO> getCumulatePoint(DaPointPageReqVO reqVO) {
349         Map<String, Object> params = new HashMap<>(3);
350         params.put("pointType", PointTypeEnum.CUMULATE.getCode());
351         params.put("pointNo", reqVO.getPointNo());
352         params.put("pointName", reqVO.getPointName());
56dba6 353         return daPointDao.getCumulatePoint(params);
354     }
355
356     @Override
a6de49 357     public DaPointDTO getByNo(String pointNo) {
9df837 358         if (pointNoMap.containsKey(pointNo)) {
359             return pointNoMap.get(pointNo);
360         }
a6de49 361         QueryWrapper<DaPointEntity> wrapper = new QueryWrapper<>();
H 362         wrapper.eq("point_no", pointNo);
6bf63b 363         DaPointEntity entity = daPointDao.selectOne(wrapper);
9df837 364         DaPointDTO dto = ConvertUtils.sourceToTarget(entity, DaPointDTO.class);
365         pointNoMap.put(pointNo, dto);
366         return dto;
a6de49 367     }
H 368
369     @Override
370     public List<DaPointDTO> getByNos(List<String> pointNos) {
371         QueryWrapper<DaPointEntity> wrapper = new QueryWrapper<>();
372         wrapper.in("point_no", pointNos);
6bf63b 373         List<DaPointEntity> list = daPointDao.selectList(wrapper);
a6de49 374         return ConvertUtils.sourceToTarget(list, DaPointDTO.class);
H 375     }
376
377     @Override
378     public void updateDefaultValue(DaPointDTO dto) {
379         QueryWrapper<DaPointEntity> wrapper = new QueryWrapper<>();
380         wrapper.eq("point_no", dto.getPointNo());
381         DaPointEntity entity = new DaPointEntity();
382         entity.setDefaultValue(dto.getDefaultValue());
6bf63b 383         daPointDao.update(entity, wrapper);
a6de49 384     }
H 385
386     @Override
139c6a 387     @DSTransactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入
D 388     public PointImportRespVO importPointList(List<PointImportExcelVO> importPoints, boolean isUpdateSupport) {
389         // 1.1 参数校验
390         if (CollUtil.isEmpty(importPoints)) {
391             throw exception(POINT_IMPORT_LIST_IS_EMPTY);
392         }
01d6f8 393
394         Map<String, Map<String, String>> sourcesIdMap = channelSourceService.getSourcesId();
139c6a 395         // 2. 遍历,逐个创建 or 更新
D 396         PointImportRespVO respVO = PointImportRespVO.builder().createPointnames(new ArrayList<>())
397                 .updatePointnames(new ArrayList<>()).failurePointnames(new LinkedHashMap<>()).build();
398         importPoints.forEach(importPoint -> {
399             // 判断如果不存在,再进行插入
213afc 400             DaPointEntity existPoint = null;
401             if (StringUtils.isNotBlank(importPoint.getPointNo())) {
402                 existPoint = baseDao.selectByPointNo(importPoint.getPointNo());
403             }
404
139c6a 405             if (existPoint == null) {
D 406                 DaPointEntity daPointEntity = ConvertUtils.sourceToTarget(importPoint, DaPointEntity.class);
407                 daPointEntity.setId(UUID.randomUUID().toString());
408                 daPointEntity.setIsEnable(CommonConstant.IS_ENABLE);
409                 daPointEntity.setCreateTime(new Date());
01d6f8 410                 switch (PointTypeEnum.getEumByCode(daPointEntity.getPointType())) {
411                     case MEASURE_POINT:
412                         DaMeasurePointDTO measurePoint = new DaMeasurePointDTO();
413                         measurePoint.setSourceType(importPoint.getSourceType());
414                         measurePoint.setSourceId(sourcesIdMap.get(importPoint.getSourceType()).get(importPoint.getSourceName()));
415                         measurePoint.setTagNo(importPoint.getTagNo());
416                         measurePoint.setValueType(importPoint.getValueType());
417                         measurePoint.setDimension(importPoint.getDimension());
418                         daMeasurePointService.add(measurePoint, daPointEntity.getId());
419                         daPointEntity.setPointNo(daSequenceNumService.getAndIncreaseByCode(IncreaseCodeEnum.POINT_M.name()));
420                         break;
421                     case CALCULATE_POINT:
422                         daMathPointService.add(importPoint.getExpression(), daPointEntity.getId());
423                         daPointEntity.setPointNo(daSequenceNumService.getAndIncreaseByCode(IncreaseCodeEnum.POINT_C.name()));
424                         break;
425                     case CONSTANT:
426                         daPointEntity.setPointNo(daSequenceNumService.getAndIncreaseByCode(IncreaseCodeEnum.POINT_F.name()));
427                         break;
eb1c5f 428                     case CUMULATE:
429                         DaCumulatePointDTO cumulatePoint = new DaCumulatePointDTO();
430                         cumulatePoint.setMomentPoint(importPoint.getMomentPoint());
431                         cumulatePoint.setLength(importPoint.getLength());
432                         cumulatePoint.setDivisor(importPoint.getDivisor());
433                         daCumulatePointService.add(cumulatePoint, daPointEntity.getId());
434                         daPointEntity.setPointNo(daSequenceNumService.getAndIncreaseByCode(IncreaseCodeEnum.POINT_L.name()));
01d6f8 435                     default:
436                         break;
437                 }
139c6a 438
D 439                 daPointDao.insert(daPointEntity);
13e045 440                 daPointCollectStatusService.add(daPointEntity.getPointNo());
139c6a 441                 respVO.getCreatePointnames().add(importPoint.getPointName());
D 442                 return;
443             }
444
445             // 如果存在,判断是否允许更新
446             if (!isUpdateSupport) {
447                 respVO.getFailurePointnames().put(importPoint.getPointName(), POINT_EXISTS.getMsg());
448                 return;
449             }
450
451             DaPointEntity updatePoint = BeanUtils.toBean(importPoint, DaPointEntity.class);
452             updatePoint.setId(existPoint.getId());
48c064 453             baseDao.updateById(updatePoint);
1b48b6 454             switch (PointTypeEnum.getEumByCode(updatePoint.getPointType())) {
455                 case MEASURE_POINT:
456                     DaMeasurePointEntity measurePoint = new DaMeasurePointEntity();
457                     measurePoint.setSourceType(importPoint.getSourceType());
458                     measurePoint.setSourceId(sourcesIdMap.get(importPoint.getSourceType()).get(importPoint.getSourceName()));
459                     measurePoint.setTagNo(importPoint.getTagNo());
460                     daMeasurePointService.update(measurePoint, new QueryWrapper<DaMeasurePointEntity>().eq("point_id",updatePoint.getId()));
461
462
463                     break;
464                 case CALCULATE_POINT:
465                     break;
466                 default:
467                     break;
468             }
139c6a 469             respVO.getUpdatePointnames().add(importPoint.getPointName());
D 470         });
471         return respVO;
472     }
473
474     @Override
14cb32 475     public List<DaPointDTO> getList(DaPointPageReqVO exportReqVO) {
476         return daPointDao.getList(exportReqVO);
139c6a 477     }
D 478
479     @Override
ee9f60 480     @DSTransactional(rollbackFor = Exception.class)
a6de49 481     public void enableByIds(String[] ids) {
H 482         if (CollectionUtils.isEmpty(Arrays.asList(ids))) {
483             return;
484         }
485         Arrays.asList(ids).forEach(item -> {
486             DaPointEntity entity = new DaPointEntity();
487             entity.setId(item);
f21253 488             entity.setIsEnable(IsEnableEnum.ENABLE.getCode());
ee9f60 489             entity.setUpdateTime(new Date());
6bf63b 490             daPointDao.updateById(entity);
a6de49 491         });
H 492     }
493
494     @Override
ee9f60 495     @DSTransactional(rollbackFor = Exception.class)
a6de49 496     public void disableByIds(String[] ids) {
H 497         if (CollectionUtils.isEmpty(Arrays.asList(ids))) {
498             return;
499         }
500         Arrays.asList(ids).forEach(item -> {
501             DaPointEntity entity = new DaPointEntity();
502             entity.setId(item);
f21253 503             entity.setIsEnable(IsEnableEnum.DISABLE.getCode());
ee9f60 504             entity.setUpdateTime(new Date());
6bf63b 505             daPointDao.updateById(entity);
a6de49 506         });
H 507     }
508 }