package com.aucma.dms.service.impl;

//import com.hw.common.core.utils.DateUtils;
//import com.aucma.dms.domain.DmsBillsInspectInstanceActivity;
//import com.aucma.dms.mapper.DmsBillsInspectInstanceActivityMapper;
//import com.aucma.dms.service.IDmsBillsInspectInstanceActivityService;

import com.aucma.common.utils.DateUtils;
import com.aucma.dms.domain.DmsBillsInspectInstanceActivity;
import com.aucma.dms.mapper.DmsBillsInspectInstanceActivityMapper;
import com.aucma.dms.service.IDmsBillsInspectInstanceActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 点巡检工单实例节点Service业务层处理
 *
 * @author Open Platform
 * @date 2024-01-23
 */
@Service
public class DmsBillsInspectInstanceActivityServiceImpl implements IDmsBillsInspectInstanceActivityService
{
    @Autowired
    private DmsBillsInspectInstanceActivityMapper dmsBillsInspectInstanceActivityMapper;

    /**
     * 查询点巡检工单实例节点
     *
     * @param instanceActivityId 点巡检工单实例节点主键
     * @return 点巡检工单实例节点
     */
    @Override
    public DmsBillsInspectInstanceActivity selectDmsBillsInspectInstanceActivityByInstanceActivityId(Long instanceActivityId)
    {
        return dmsBillsInspectInstanceActivityMapper.selectDmsBillsInspectInstanceActivityByInstanceActivityId(instanceActivityId);
    }

    /**
     * 查询点巡检工单实例节点列表
     *
     * @param dmsBillsInspectInstanceActivity 点巡检工单实例节点
     * @return 点巡检工单实例节点
     */
    @Override
    public List<DmsBillsInspectInstanceActivity> selectDmsBillsInspectInstanceActivityList(DmsBillsInspectInstanceActivity dmsBillsInspectInstanceActivity)
    {
        return dmsBillsInspectInstanceActivityMapper.selectDmsBillsInspectInstanceActivityList(dmsBillsInspectInstanceActivity);
    }

    /**
     * 新增点巡检工单实例节点
     *
     * @param dmsBillsInspectInstanceActivity 点巡检工单实例节点
     * @return 结果
     */
    @Override
    public int insertDmsBillsInspectInstanceActivity(DmsBillsInspectInstanceActivity dmsBillsInspectInstanceActivity)
    {
        dmsBillsInspectInstanceActivity.setCreateTime(DateUtils.getNowDate());
        return dmsBillsInspectInstanceActivityMapper.insertDmsBillsInspectInstanceActivity(dmsBillsInspectInstanceActivity);
    }

    /**
     * 修改点巡检工单实例节点
     *
     * @param dmsBillsInspectInstanceActivity 点巡检工单实例节点
     * @return 结果
     */
    @Override
    public int updateDmsBillsInspectInstanceActivity(DmsBillsInspectInstanceActivity dmsBillsInspectInstanceActivity)
    {
        return dmsBillsInspectInstanceActivityMapper.updateDmsBillsInspectInstanceActivity(dmsBillsInspectInstanceActivity);
    }

    /**
     * 批量删除点巡检工单实例节点
     *
     * @param instanceActivityIds 需要删除的点巡检工单实例节点主键
     * @return 结果
     */
    @Override
    public int deleteDmsBillsInspectInstanceActivityByInstanceActivityIds(Long[] instanceActivityIds)
    {
        return dmsBillsInspectInstanceActivityMapper.deleteDmsBillsInspectInstanceActivityByInstanceActivityIds(instanceActivityIds);
    }

    /**
     * 删除点巡检工单实例节点信息
     *
     * @param instanceActivityId 点巡检工单实例节点主键
     * @return 结果
     */
    @Override
    public int deleteDmsBillsInspectInstanceActivityByInstanceActivityId(Long instanceActivityId)
    {
        return dmsBillsInspectInstanceActivityMapper.deleteDmsBillsInspectInstanceActivityByInstanceActivityId(instanceActivityId);
    }

    @Override
    public boolean selectUserIdByDmsBillsInspectInstanceActivityId(Long lubeInstanceId, Long userId) {
        Long[] integers = dmsBillsInspectInstanceActivityMapper.selectUserIdByDmsBillsInspectInstanceActivityId(lubeInstanceId);
        boolean contains = Arrays.asList(integers).contains(userId);

        return contains;

    }
}
