潘志宝
2024-10-09 c0b8cf32504dd1a42780bb1ee06ae8a7b0d7b120
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java
@@ -20,7 +20,7 @@
import com.iailab.module.data.point.service.DaPointService;
import com.iailab.module.data.point.service.DaSequenceNumService;
import com.iailab.module.data.point.vo.DaPointPageReqVO;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@@ -73,20 +73,29 @@
    }
    @Override
    public DaPointDTO getSimpleInfoById(String id) {
        return ConvertUtils.sourceToTarget(daPointDao.selectById(id), DaPointDTO.class);
    }
    @Override
    public DaPointDTO getSimpleInfoByNo(String no) {
        QueryWrapper<DaPointEntity> queryWrapper = new QueryWrapper();
        queryWrapper.eq("pointNo", no);
        return ConvertUtils.sourceToTarget(daPointDao.selectOne(queryWrapper), DaPointDTO.class);
    }
    @Override
    public List<DaPointDTO> list(Map<String, Object> params) {
        String page = (String) params.get("page");
        String limit = (String) params.get("limit");
        String pointType = (String)params.get("pointType");
        Object pointType = params.get("pointType");
        List<String> pointNos = new ArrayList<>();
        if (params.get("pointNos") != null) {
            pointNos = JSONArray.parseArray(JSONArray.toJSONString(params.get("pointNos")), String.class);
        }
        String pointNoLike = (String)params.get("pointNoLike");
        Object pointNoLike = params.get("pointNoLike");
        QueryWrapper<DaPointEntity> queryWrapper = new QueryWrapper();
        queryWrapper.eq(StringUtils.isNotBlank(pointType), "point_type", pointType)
        .in(!CollectionUtils.isEmpty(pointNos),"point_no", pointNos)
        .like(StringUtils.isNotBlank(pointNoLike), "point_no", pointNoLike)
                .last("limit 1, 10");
        queryWrapper.eq(!ObjectUtils.isEmpty(pointType), "point_type", pointType);
        queryWrapper.in(pointNos.size() != 0,"point_no", pointNos);
        queryWrapper.like(!ObjectUtils.isEmpty(pointNoLike), "point_no", pointNoLike);
        List<DaPointEntity> list = daPointDao.selectList(queryWrapper);
        return ConvertUtils.sourceToTarget(list, DaPointDTO.class);
    }
@@ -126,17 +135,17 @@
            measurePoint.setSourceId(dataPoint.getSourceOption().get(1));
            measurePoint.setTagNo(dataPoint.getSourceOption().get(2));
            daMeasurePointService.update(measurePoint);
        } else if (PointTypeEnum.CALCULATE_POINT.equals(dataPoint.getPointType())) {
        } else if (PointTypeEnum.CALCULATE_POINT.getName().equals(dataPoint.getPointType())) {
            daMathPointService.update(dataPoint.getMathPoint());
        }
    }
    @Override
    @DSTransactional(rollbackFor = Exception.class)
    public void delete(String[] ids) {
        daPointDao.deleteBatchIds(Arrays.asList(ids));
        daMeasurePointService.deleteByPoint(ids);
        daMathPointService.deleteByPoint(ids);
    public void delete(String[] id) {
        daPointDao.deleteBatchIds(Arrays.asList(id));
        daMeasurePointService.deleteByPoint(id);
        daMathPointService.deleteByPoint(id);
    }
    @Override