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.ManagerInfoMapper;
import com.baichuanxin.openrestapi.dtos.ManagerInfoDto;
import com.baichuanxin.openrestapi.dtos.SecurityServicekDto;
import com.baichuanxin.openrestapi.entity.ManagerInfo;
import com.baichuanxin.openrestapi.entity.Notice;
import com.baichuanxin.openrestapi.entity.SecurityServicek;
import com.baichuanxin.openrestapi.entity.Shareholder;
import com.baichuanxin.openrestapi.service.TaskInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.support.ManagedList;
import org.springframework.stereotype.Service;

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

@Slf4j
@Service
public class ManagerInfoTaskInfoServiceImpl extends ServiceImpl<ManagerInfoMapper, ManagerInfo>  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<ManagerInfoDto> managerInfoDtos,String topId) {
        List<ManagerInfo> managerInfos = new ArrayList<>();
        int i=0 ;
        log.info("i======={}",i);
        for (ManagerInfoDto managerInfoDto : managerInfoDtos) {
            ManagerInfo convert = managerInfoDto.convert();
            convert.setId(StrUtil.join("--",StrUtil.join("",taskId,i),OnlineTaskConstant.MANAGER_INFO));
            log.info("id{}",convert.getId());
            ++i;
            log.info("i======={}",i);
            convert.setItemTopid(topId);
            managerInfos.add(convert);
        }
        return this.saveBatch(managerInfos);
    }
}
