package com.baichuanxin.openrestapi.service.impl;


import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.baichuanxin.openrestapi.common.OnlineTaskConstant;
import com.baichuanxin.openrestapi.dao.mapper.SecurityManMapper;


import com.baichuanxin.openrestapi.dtos.CrossRegionalFilingDto;
import com.baichuanxin.openrestapi.dtos.SecurityManDto;
import com.baichuanxin.openrestapi.entity.Notice;
import com.baichuanxin.openrestapi.entity.SecurityMan;
import com.baichuanxin.openrestapi.service.TaskInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;

@Service
public class SecurityManTaskInfoServiceImpl   extends ServiceImpl<SecurityManMapper, SecurityMan> implements TaskInfoService {
    @Override
    public boolean saveTaskInfo(Notice notice) {
        return false;
    }

    @Override
    public List<String> returnTaskResult(List<Notice> noticeList) {
        return null;
    }

    public boolean saveOtherInfo(String taskId,List<SecurityManDto> securityManDtos,String topID) {
        List<SecurityMan> securityMans = new ArrayList<>();
        int i = 0;
        for (SecurityManDto securityManDto : securityManDtos) {
            SecurityMan convert = securityManDto.convert();
            convert.setParent(topID);
            convert.setId(StrUtil.join("--",StrUtil.join("",taskId,i), OnlineTaskConstant.SECURITY_MAN));
            ++i;
            securityMans.add(convert);
        }
        return this.saveBatch(securityMans);
    }



}
