|
|
@ -1,14 +1,15 @@
|
|
|
|
package com.xydl.cac.service.impl;
|
|
|
|
package com.xydl.cac.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import com.xydl.cac.entity.Iec104Point;
|
|
|
|
import com.xydl.cac.entity.Iec104Point;
|
|
|
|
|
|
|
|
import com.xydl.cac.exception.BusinessException;
|
|
|
|
import com.xydl.cac.repository.Iec104PointRepository;
|
|
|
|
import com.xydl.cac.repository.Iec104PointRepository;
|
|
|
|
import com.xydl.cac.service.Iec104PointService;
|
|
|
|
import com.xydl.cac.service.Iec104PointService;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import java.util.Collections;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
@ -26,15 +27,15 @@ public class Iec104PointServiceImpl implements Iec104PointService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Iec104Point add(Iec104Point point) {
|
|
|
|
public Iec104Point add(Iec104Point point) throws BusinessException {
|
|
|
|
point.setId(null);
|
|
|
|
List<Iec104Point> list = iec104PointRepository.findBySadr(point.getSadr());
|
|
|
|
point.setCreateTime(new Date());
|
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
|
|
return iec104PointRepository.save(point);
|
|
|
|
point.setId(null);
|
|
|
|
}
|
|
|
|
point.setCreateTime(new Date());
|
|
|
|
|
|
|
|
return iec104PointRepository.save(point);
|
|
|
|
@Override
|
|
|
|
} else {
|
|
|
|
public void update(Iec104Point point) {
|
|
|
|
throw new BusinessException("该点位已存在");
|
|
|
|
iec104PointRepository.save(point);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|