| | |
| | | import com.iailab.module.data.point.vo.DaPointPageReqVO; |
| | | import com.iailab.module.data.point.vo.PointImportExcelVO; |
| | | import com.iailab.module.data.point.vo.PointImportRespVO; |
| | | import com.iailab.module.infra.api.config.ConfigApi; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | import static com.iailab.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static com.iailab.module.data.enums.ErrorCodeConstants.POINT_EXISTS; |
| | |
| | | private DaPointDao daPointDao; |
| | | |
| | | @Resource |
| | | private ConfigApi configApi; |
| | | |
| | | @Resource |
| | | private ChannelSourceService channelSourceService; |
| | | |
| | | private static Map<String, DaPointDTO> pointNoMap = new ConcurrentHashMap<>(); |
| | | |
| | | @Override |
| | | public PageResult<DaPointDTO> queryPage(DaPointPageReqVO reqVO) { |
| | |
| | | daPointEntity.setIsEnable(CommonConstant.IS_ENABLE); |
| | | daPointEntity.setCreateTime(new Date()); |
| | | daPointDao.insert(daPointEntity); |
| | | |
| | | // 清空缓存 |
| | | pointNoMap.clear(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | default: |
| | | break; |
| | | } |
| | | // 清空缓存 |
| | | pointNoMap.clear(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | daPointDao.deleteBatchIds(Arrays.asList(id)); |
| | | daMeasurePointService.deleteByPoint(id); |
| | | daMathPointService.deleteByPoint(id); |
| | | // 清空缓存 |
| | | pointNoMap.clear(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public DaPointDTO getByNo(String pointNo) { |
| | | if (pointNoMap.containsKey(pointNo)) { |
| | | return pointNoMap.get(pointNo); |
| | | } |
| | | QueryWrapper<DaPointEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("point_no", pointNo); |
| | | DaPointEntity entity = daPointDao.selectOne(wrapper); |
| | | return ConvertUtils.sourceToTarget(entity, DaPointDTO.class); |
| | | DaPointDTO dto = ConvertUtils.sourceToTarget(entity, DaPointDTO.class); |
| | | pointNoMap.put(pointNo, dto); |
| | | return dto; |
| | | } |
| | | |
| | | @Override |