public List <EPlan_FromDouBanTagUrls> InitPlanFromTagUrl(List <Secction_Tag> tagLists)
        {
            List <EPlan_FromDouBanTagUrls> result = new List <EPlan_FromDouBanTagUrls>();

            if (!_PlanFTURepository.IsExistPlan())
            {
                NLogUtil.InfoTxt("豆瓣计划写入到数据库");
                if (tagLists != null && tagLists.Count > 0)
                {
                    List <EDataSection> dsList = new List <EDataSection>();
                    // List<EPlan_FromDouBanTagUrls> planList = new List<EPlan_FromDouBanTagUrls>();

                    var allSection = _SectionDb.AllSection();
                    foreach (Secction_Tag st in tagLists)
                    {
                        ESection section = null;
                        try
                        {
                            section = allSection[st.sectionName];
                        }
                        catch
                        {
                            section = null;
                        }
                        foreach (var tag in st.TagList)
                        {
                            result.Add(PlanFTURepository.NewModelInstance(tag.Name, tag.Url));
                            if (section != null)
                            {
                                dsList.Add(DataSectionRepository.newModelInstance(section.Code, tag.Code));
                            }
                        }
                    }
                    var rAll = _Db.Ado.UseTran(async() =>
                    {
                        await _DataSectionDb.CoverNewSectionCodeAsync(dsList);
                        _PlanFTURepository.CoverPlans(GenCodeHelper.Plan_FromDouBanTagUrls, result);
                    });
                    if (rAll.IsSuccess)
                    {
                        NLogUtil.InfoTxt("【成功】豆瓣计划已在数据库初始化");
                    }
                    else
                    {
                        NLogUtil.ErrorTxt($"【失败】豆瓣计划:{rAll.ErrorMessage}");
                    }
                }
            }
            else
            {
                NLogUtil.InfoTxt("DouBan Plan 已经存在数据库中!");
                //DouBand Tag List 只能获取1000内的
                result = _PlanFTURepository.QueryPlan(GenCodeHelper.Plan_FromDouBanTagUrls);
            }
            return(result);
        }
 public DouBanBookService(BookRepository bookRepository,
                          SectionRepository sectionRepository,
                          TagRepository tagRepository,
                          PersonRepository personRepository,
                          BookTagRepository bookTagRepository,
                          DataSectionRepository dataSectionRepository,
                          PlanFTURepository planFTURepository,
                          ISqlSugarClient sqlSugarClient)
 {
     _PersonDb          = personRepository;
     _BookDb            = bookRepository;
     _SectionDb         = sectionRepository;
     _TagDb             = tagRepository;
     _BookTagDb         = bookTagRepository;
     _DataSectionDb     = dataSectionRepository;
     _Db                = sqlSugarClient;
     _PlanFTURepository = planFTURepository;
 }