Esempio n. 1
0
    public override List <RecordBase> Extract()
    {
        var list    = new List <RecordBase>();
        var targets = getTargetListFromReplaceTable();

        if (targets.Count == 0)
        {
            return(list);
        }
        var TradeCompany = getTradeCompany(targets);

        foreach (var item in targets)
        {
            var reorgRec = new ReorganizationRec();
            reorgRec.Id            = this.Id;
            reorgRec.Target        = item.Target;
            reorgRec.TargetCompany = item.Comany;
            foreach (var tc in TradeCompany)
            {
                if (tc.TargetCompany == item.Comany)
                {
                    reorgRec.TradeCompany = tc.TradeCompany;
                    break;
                }
            }
            var Price = GetPrice(reorgRec);
            reorgRec.Price          = MoneyUtility.Format(Price.MoneyAmount, String.Empty);
            reorgRec.EvaluateMethod = getEvaluateMethod(reorgRec);
            list.Add(reorgRec);
        }
        return(list);
    }
Esempio n. 2
0
    List <RecordBase> ExtractMultiCommon()
    {
        var MainRec = ExtractSingle();
        //三项订单
        //中标通知书6份
        //中标通知书四份
        //履行进展情况
        var Records = new List <RecordBase>();
        var isMulti = false;

        foreach (var p in root.Children)
        {
            foreach (var s in p.Children)
            {
                if (isMulti)
                {
                    if (nermap.ParagraghlocateDict.ContainsKey(s.PositionId))
                    {
                        var nerlist = nermap.ParagraghlocateDict[s.PositionId];
                        if (nerlist.moneylist.Count == 1)
                        {
                            var ContractRec = new ContractRec();
                            ContractRec.Id      = Id;
                            ContractRec.JiaFang = MainRec.JiaFang;
                            ContractRec.YiFang  = MainRec.YiFang;
                            ContractRec.ContractMoneyUpLimit   = MoneyUtility.Format(nerlist.moneylist.First().Value.MoneyAmount, String.Empty);
                            ContractRec.ContractMoneyDownLimit = ContractRec.ContractMoneyUpLimit;
                            Records.Add(ContractRec);
                        }
                    }
                }
                else
                {
                    var scan = NumberUtility.ConvertUpperToLower(s.Content).Replace(" ", "");
                    var cnt  = RegularTool.GetRegular(scan, "中标通知书\\d份");
                    if (cnt.Count == 1)
                    {
                        Console.WriteLine(Id + ":" + cnt[0].RawData + "[" + scan + "]");
                        isMulti = true;
                    }
                    if (s.Content.Contains("履行进展情况"))
                    {
                        Console.WriteLine(Id + ":履行进展情况");
                        isMulti = true;
                    }
                }
            }
        }
        return(Records);
    }
Esempio n. 3
0
    ContractRec ExtractSingle()
    {
        contractType = String.Empty;
        foreach (var paragrah in root.Children)
        {
            foreach (var item in paragrah.Children)
            {
                if (item.Content.Contains("中标"))
                {
                    contractType = "中标";
                    break;
                }
                if (item.Content.Contains("合同"))
                {
                    contractType = "合同";
                    break;
                }
            }
            if (contractType != String.Empty)
            {
                break;
            }
        }

        if (contractType == String.Empty)
        {
            Console.WriteLine("contractType Null:" + Id);
        }

        var contract = new ContractRec();

        //公告ID
        contract.Id = Id;

        //乙方
        contract.YiFang = GetYiFang();
        if (contract.YiFang.Contains("本公司"))
        {
            contract.YiFang = string.Empty;
        }
        contract.YiFang = CompanyNameLogic.AfterProcessFullName(contract.YiFang).secFullName;
        contract.YiFang = contract.YiFang.NormalizeTextResult();
        //按照规定除去括号
        contract.YiFang = RegularTool.TrimBrackets(contract.YiFang);
        if (contract.YiFang.Length < 3)
        {
            contract.YiFang = string.Empty;
        }


        //甲方
        contract.JiaFang = GetJiaFang(contract.YiFang);
        if (contract.JiaFang.Contains("本公司"))
        {
            contract.JiaFang = string.Empty;
        }
        contract.JiaFang = CompanyNameLogic.AfterProcessFullName(contract.JiaFang).secFullName;
        contract.JiaFang = contract.JiaFang.NormalizeTextResult();
        if (contract.JiaFang.Contains("简称"))
        {
            contract.JiaFang = Utility.GetStringBefore(contract.JiaFang, "(");
        }
        //机构列表
        if (Nerlist != null)
        {
            var NiList = Nerlist.Where((n) => n.Type == LTPTrainingNER.enmNerType.Ni).Select((m) => m.RawData);
            if (!NiList.Contains(contract.JiaFang))
            {
                if (NiList.Contains("国家电网公司"))
                {
                    contract.JiaFang = "国家电网公司";
                }
            }
        }
        //项目
        contract.ProjectName = GetProjectName();
        contract.ProjectName = contract.ProjectName.NormalizeTextResult();
        if (contract.ProjectName.StartsWith("“") && contract.ProjectName.EndsWith("”"))
        {
            contract.ProjectName = contract.ProjectName.TrimStart("“".ToCharArray()).TrimEnd("”".ToCharArray());
        }
        if (contract.ProjectName.EndsWith(",签约双方"))
        {
            contract.ProjectName = Utility.GetStringAfter(contract.ProjectName, ",签约双方");
        }
        if (contract.ProjectName.Contains("(以下简称"))
        {
            contract.ProjectName = Utility.GetStringAfter(contract.ProjectName, "(以下简称");
        }
        if (contract.ProjectName.EndsWith(")"))
        {
            if (contract.ProjectName.Contains("(招标编号"))
            {
                contract.ProjectName = Utility.GetStringBefore(contract.ProjectName, "(招标编号");
            }
            if (contract.ProjectName.Contains("(合同编号"))
            {
                contract.ProjectName = Utility.GetStringBefore(contract.ProjectName, "(合同编号");
            }
        }
        contract.ProjectName = contract.ProjectName.Replace("的推荐中标", "");
        //特殊处理
        contract.ProjectName = contract.ProjectName.Replace("<1>", "1、");
        contract.ProjectName = contract.ProjectName.Replace("“", "");
        contract.ProjectName = contract.ProjectName.Replace("”", "");

        //合同名
        contract.ContractName = GetContractName();
        if (contract.ContractName.StartsWith("“") && contract.ContractName.EndsWith("”"))
        {
            contract.ContractName = contract.ContractName.TrimStart("“".ToCharArray()).TrimEnd("”".ToCharArray());
        }
        //去掉书名号
        contract.ContractName = contract.ContractName.Replace("《", String.Empty).Replace("》", String.Empty);
        contract.ContractName = contract.ContractName.NormalizeTextResult();
        if (contract.ContractName.Contains("(以下简称"))
        {
            contract.ContractName = Utility.GetStringAfter(contract.ContractName, "(以下简称");
        }
        contract.ContractName = ExtendContractName(contract.ContractName);

        //如果是采购协议,则工程名清空
        if (contract.ContractName.Contains("采购"))
        {
            if (contract.ProjectName.Contains("标段"))
            {
                //TODO:
            }
            else
            {
                contract.ProjectName = string.Empty;
            }
        }

        //金额
        var money = GetMoney();

        contract.ContractMoneyUpLimit   = MoneyUtility.Format(money.MoneyAmount, String.Empty);
        contract.ContractMoneyDownLimit = contract.ContractMoneyUpLimit;

        //联合体
        contract.UnionMember = GetUnionMember(contract);
        contract.UnionMember = contract.UnionMember.NormalizeTextResult();
        //按照规定除去括号
        contract.UnionMember = RegularTool.TrimBrackets(contract.UnionMember);

        var YiFangArray = contract.YiFang.Split(Utility.SplitChar);

        if (YiFangArray.Length > 1)
        {
            contract.UnionMember = Utility.GetStringAfter(contract.YiFang, Utility.SplitChar);
            contract.YiFang      = YiFangArray[0];
            Console.WriteLine("联合体:" + contract.UnionMember);
        }
        return(contract);
    }
Esempio n. 4
0
    /// <summary>
    /// 北车
    /// </summary>
    /// <returns></returns>
    List <RecordBase> ExtractMultiFromNorthVehicle()
    {
        //主合同的抽取:(北车专用)
        //#151135: 若干项重大合同
        //#153045: 若干项重大合同
        //#153271: 若干项重大合同
        //#175840: 若干项重大合同
        var Records = new List <RecordBase>();
        var isMulti = false;

        foreach (var p in root.Children)
        {
            foreach (var s in p.Children)
            {
                if (s.Content.Contains("若干项重大合同"))
                {
                    isMulti = true;
                    Console.WriteLine("若干项重大合同 ID:" + Id);
                }
                if (s.Content.StartsWith("<") && isMulti)
                {
                    var ContractRec = new ContractRec();
                    ContractRec.Id = Id;
                    //5 、本公司全资子公司中国北车集团大连机车车辆有限公司与大同地方铁路公司签订了约 3.26 亿元人民币的电力机车销售合同。

                    var i0 = s.Content.IndexOf("与");
                    var i1 = s.Content.IndexOf("签订");

                    if (i0 != -1 && i1 != -1 && i0 < i1)
                    {
                        ContractRec.JiaFang = s.Content.Substring(i0 + 1, i1 - i0 - 1);
                    }
                    foreach (var cn in companynamelist)
                    {
                        if (cn.isSubCompany && cn.positionId == s.PositionId)
                        {
                            ContractRec.YiFang = cn.secFullName;
                        }
                    }
                    var ml = moneylist.Where((x) => x.Loc == s.PositionId).ToList();
                    var SpecailContractNames = new string[] {
                        "地铁车辆出口合同",
                        "地铁车辆牵引系统销售合同",
                        "地铁车辆销售合同",
                        "地铁销售合同",
                        "电动客车销售合同",
                        "电力机车销售合同",
                        "动车组检修合同",
                        "动车组销售合同",
                        "风力发电机组销售合同",
                        "货车出口合同",
                        "货车检修合同",
                        "货车销售合同",
                        "货车修理合同",
                        "机车出口合同",
                        "机车大修及加改合同",
                        "客车检修合同",
                        "客车销售合同",
                        "客车修理合同",
                        "煤炭漏斗车销售合同",
                        "内燃电传动机车销售合同",
                        "内燃动车组销售合同",
                        "内燃机车订单",
                        "铁路客车修理合同",
                        "有轨电车销售合同"
                    }.ToList();

                    foreach (var scn in SpecailContractNames)
                    {
                        if (s.Content.Contains(scn))
                        {
                            ContractRec.ContractName = scn;
                            break;
                        }
                    }
                    if (ml.Count == 1)
                    {
                        if (!String.IsNullOrEmpty(ContractRec.JiaFang) && !String.IsNullOrEmpty(ContractRec.YiFang))
                        {
                            ContractRec.ContractMoneyUpLimit   = MoneyUtility.Format(ml.First().Value.MoneyAmount, String.Empty);
                            ContractRec.ContractMoneyDownLimit = ContractRec.ContractMoneyUpLimit;
                            Records.Add(ContractRec);
                        }
                    }
                }
            }
        }
        return(Records);
    }
Esempio n. 5
0
    List <RecordBase> ExtractMultiFromTable()
    {
        var Records = new List <RecordBase>();
        var JiaFang = new TableSearchTitleRule();

        JiaFang.Name      = "甲方";
        JiaFang.Title     = new string[] { "采购人" }.ToList();
        JiaFang.IsTitleEq = false;
        JiaFang.IsRequire = true;

        var YiFang = new TableSearchTitleRule();

        YiFang.Name = "乙方";
        //"投资者名称","股东名称"
        YiFang.Title     = new string[] { "中标人" }.ToList();
        YiFang.IsTitleEq = false;
        YiFang.IsRequire = true;

        var ProjectName = new TableSearchTitleRule();

        ProjectName.Name      = "项目名称";
        ProjectName.Title     = new string[] { "项目名称" }.ToList();
        ProjectName.IsTitleEq = false;
        ProjectName.IsRequire = false;

        var Money = new TableSearchTitleRule();

        Money.Name      = "中标金额";
        Money.Title     = new string[] { "中标金额" }.ToList();
        Money.IsTitleEq = false;
        Money.IsRequire = false;

        var Rules = new List <TableSearchTitleRule>();

        Rules.Add(JiaFang);
        Rules.Add(YiFang);
        Rules.Add(ProjectName);
        Rules.Add(Money);

        var opt = new SearchOption();

        opt.IsMeger = false;
        var result = HTMLTable.GetMultiInfoByTitleRules(root, Rules, opt);

        if (result.Count > 0)
        {
            Console.WriteLine("Table ExtractMulti ID:" + Id);
            foreach (var item in result)
            {
                var ContractRec = new ContractRec();
                ContractRec.Id      = Id;
                ContractRec.JiaFang = item[0].RawData;
                ContractRec.JiaFang = ContractRec.JiaFang.NormalizeTextResult();
                ContractRec.YiFang  = item[1].RawData;
                ContractRec.YiFang  = ContractRec.YiFang.NormalizeTextResult();
                foreach (var cn in companynamelist)
                {
                    if (!String.IsNullOrEmpty(cn.secShortName) && cn.secShortName.Equals(ContractRec.YiFang))
                    {
                        if (!string.IsNullOrEmpty(cn.secFullName))
                        {
                            ContractRec.YiFang = cn.secFullName;
                            break;
                        }
                    }
                }
                ContractRec.ProjectName            = item[2].RawData;
                ContractRec.ProjectName            = ContractRec.ProjectName.NormalizeTextResult();
                ContractRec.ContractMoneyUpLimit   = MoneyUtility.Format(item[3].RawData, item[3].Title);
                ContractRec.ContractMoneyDownLimit = ContractRec.ContractMoneyUpLimit;
                Records.Add(ContractRec);
            }
        }
        return(Records);
    }
Esempio n. 6
0
    struContract ExtractSingle(MyRootHtmlNode root, String Id)
    {
        contractType = String.Empty;
        foreach (var paragrah in root.Children)
        {
            foreach (var item in paragrah.Children)
            {
                if (item.Content.Contains("中标"))
                {
                    contractType = "中标";
                    break;
                }
                if (item.Content.Contains("合同"))
                {
                    contractType = "合同";
                    break;
                }
            }
            if (contractType != String.Empty)
            {
                break;
            }
        }

        if (contractType == String.Empty)
        {
            Console.WriteLine("contractType Null:" + Id);
        }

        var contract = new struContract();

        //公告ID
        contract.id = Id;
        //甲方
        contract.JiaFang = GetJiaFang();
        contract.JiaFang = CompanyNameLogic.AfterProcessFullName(contract.JiaFang).secFullName;
        contract.JiaFang = contract.JiaFang.NormalizeTextResult();
        if (!Nerlist.Contains(contract.JiaFang))
        {
            //作为特殊单位,国家电网公司一般都是甲方
            if (Nerlist.Contains("国家电网公司"))
            {
                contract.JiaFang = "国家电网公司";
            }
        }

        //乙方
        contract.YiFang = GetYiFang();
        contract.YiFang = CompanyNameLogic.AfterProcessFullName(contract.YiFang).secFullName;
        contract.YiFang = contract.YiFang.NormalizeTextResult();
        //按照规定除去括号
        contract.YiFang = RegularTool.TrimBrackets(contract.YiFang);


        //项目
        contract.ProjectName = GetProjectName();
        if (contract.ProjectName.StartsWith("“") && contract.ProjectName.EndsWith("”"))
        {
            contract.ProjectName = contract.ProjectName.TrimStart("“".ToCharArray()).TrimEnd("”".ToCharArray());
        }
        if (contract.ProjectName.EndsWith(",签约双方"))
        {
            contract.ProjectName = Utility.GetStringAfter(contract.ProjectName, ",签约双方");
        }
        if (contract.ProjectName.Contains("(以下简称"))
        {
            contract.ProjectName = Utility.GetStringAfter(contract.ProjectName, "(以下简称");
        }
        contract.ProjectName = contract.ProjectName.NormalizeTextResult();

        //合同
        if (contractType == "中标")
        {
            //按照数据分析来看,应该工程名 在中标的时候填写,合同名在合同的时候填写
            contract.ContractName = String.Empty;
        }
        else
        {
            contract.ContractName = GetContractName();
            if (contract.ContractName.StartsWith("“") && contract.ContractName.EndsWith("”"))
            {
                contract.ContractName = contract.ContractName.TrimStart("“".ToCharArray()).TrimEnd("”".ToCharArray());
            }
            //去掉书名号
            contract.ContractName = contract.ContractName.Replace("《", String.Empty).Replace("》", String.Empty);
            if (contract.ContractName.Contains("(以下简称"))
            {
                contract.ContractName = Utility.GetStringAfter(contract.ContractName, "(以下简称");
            }
            contract.ContractName = contract.ContractName.NormalizeTextResult();
        }


        //金额
        var money = GetMoney();

        contract.ContractMoneyUpLimit   = MoneyUtility.Format(money.MoneyAmount, String.Empty);
        contract.ContractMoneyDownLimit = contract.ContractMoneyUpLimit;

        //联合体
        contract.UnionMember = GetUnionMember(contract.JiaFang, contract.YiFang);
        contract.UnionMember = contract.UnionMember.NormalizeTextResult();
        //按照规定除去括号
        contract.UnionMember = RegularTool.TrimBrackets(contract.UnionMember);
        return(contract);
    }
Esempio n. 7
0
    public override List <RecordBase> Extract()
    {
        InitTableRules();
        GetPersonList();
        //是否在释义表中存在交易对手信息
        foreach (var item in ExplainDict)
        {
            var keys  = item.Key.Split(Utility.SplitChar);
            var keys2 = item.Key.Split(new char[] { '/', '/' });
            if (keys.Length == 1 && keys2.Length > 1)
            {
                keys = keys2;
            }
            foreach (var k in keys)
            {
                if (k.Contains("交易对方"))
                {
                    Console.WriteLine("交易对方条目:" + k);
                }
            }
        }
        //HTML结构
        foreach (var item in root.Children)
        {
            //var title = item.Content.Normalize().NormalizeTextResult();
            //Console.WriteLine(item.PositionId + ":" + title.Substring(0, Math.Min(20, title.Length)));
        }

        var list    = new List <RecordBase>();
        var targets = getTargetListFromExplainTable().Distinct().ToList();

        if (targets.Count == 0)
        {
            return(list);
        }
        var EvaluateMethodLoc = LocateProperty.LocateCustomerWord(root, ReOrganizationTraning.EvaluateMethodList, "评估法");

        this.CustomerList = EvaluateMethodLoc;
        nermap.Anlayze(this);
        foreach (var item in targets)
        {
            if (item.Target.Contains("发行"))
            {
                continue;
            }
            if (item.Target.Contains("置换"))
            {
                continue;
            }
            if (item.Target.Contains("置出"))
            {
                continue;
            }
            if (item.Target.Contains("置入"))
            {
                continue;
            }
            if (item.Target.Contains("本次"))
            {
                continue;
            }
            if (item.Target.Contains("出售"))
            {
                continue;
            }
            if (item.Target.Contains("购买"))
            {
                continue;
            }

            var reorgRec = new ReorganizationRec();
            reorgRec.Id            = this.Id;
            reorgRec.Target        = item.Target;
            reorgRec.TargetCompany = item.Comany.TrimEnd("合计".ToArray());
            //<1>XXXX公司的的对应
            Regex r = new Regex(@"\<(\d+)\>");
            if (r.IsMatch(reorgRec.TargetCompany))
            {
                Console.WriteLine("Before Trim:" + reorgRec.TargetCompany);
                reorgRec.TargetCompany = r.Replace(reorgRec.TargetCompany, "");
                Console.WriteLine("After  Trim:" + reorgRec.TargetCompany);
            }
            if (reorgRec.TargetCompany.Equals("本公司"))
            {
                continue;
            }
            if (reorgRec.TargetCompany.Equals("标的公司"))
            {
                continue;
            }
            //标的公司的简称填补
            foreach (var dict in ExplainDict)
            {
                var keys  = dict.Key.Split(Utility.SplitChar);
                var keys2 = dict.Key.Split(new char[] { '/', '/' });
                var isHit = false;
                if (keys.Length == 1 && keys2.Length > 1)
                {
                    keys = keys2;
                }
                foreach (var key in keys)
                {
                    if (key.Contains("标的"))
                    {
                        continue;
                    }
                    if (key.Contains("目标"))
                    {
                        continue;
                    }
                    if (key.Equals("上市公司"))
                    {
                        continue;
                    }
                    if (key.Equals("本公司"))
                    {
                        continue;
                    }
                    if (key.Equals(reorgRec.TargetCompany) || dict.Value.Equals(reorgRec.TargetCompany))
                    {
                        var tempKey = key;
                        if (tempKey.Contains(","))
                        {
                            tempKey = Utility.GetStringBefore(tempKey, ",");
                        }

                        var tempvalue = dict.Value;
                        if (tempvalue.Contains(","))
                        {
                            tempvalue = Utility.GetStringBefore(tempvalue, ",");
                        }
                        reorgRec.TargetCompanyFullName  = tempvalue;
                        reorgRec.TargetCompanyShortName = tempKey;
                        isHit = true;
                        break;
                    }
                }
                if (isHit)
                {
                    break;
                }
            }

            var TradeCompany = getTradeCompany(reorgRec);
            reorgRec.TradeCompany = String.Join(Utility.SplitChar, TradeCompany);
            //根据各种模板规则获得的交易对手
            var xTradeList = getTradeCompanyByKeyWord(reorgRec);
            if (xTradeList.Count == 1)
            {
                var xTrade = "";
                xTrade = xTradeList.First();
                //单个结果的情况下
                if (!String.IsNullOrEmpty(xTrade))
                {
                    foreach (var dict in ExplainDict)
                    {
                        var keys  = dict.Key.Split(Utility.SplitChar);
                        var keys2 = dict.Key.Split(new char[] { '/', '/' });
                        var isHit = false;
                        if (keys.Length == 1 && keys2.Length > 1)
                        {
                            keys = keys2;
                        }
                        foreach (var key in keys)
                        {
                            if (key.Contains("标的"))
                            {
                                continue;
                            }
                            if (key.Contains("目标"))
                            {
                                continue;
                            }
                            if (key.Equals("上市公司"))
                            {
                                continue;
                            }
                            if (key.Equals("本公司"))
                            {
                                continue;
                            }
                            if (key.Equals(xTrade) || dict.Value.Equals(xTrade))
                            {
                                var tempKey = key;
                                if (tempKey.Contains(","))
                                {
                                    tempKey = Utility.GetStringBefore(tempKey, ",");
                                }

                                var tempvalue = dict.Value;
                                if (tempvalue.Contains(","))
                                {
                                    tempvalue = Utility.GetStringBefore(tempvalue, ",");
                                }
                                reorgRec.TradeCompanyFullName  = tempvalue;
                                reorgRec.TradeCompanyShortName = tempKey;
                                isHit = true;
                                break;
                            }
                        }
                        if (isHit)
                        {
                            break;
                        }
                    }
                    reorgRec.TradeCompany = xTrade;
                    if (!String.IsNullOrEmpty(reorgRec.TradeCompanyFullName) &&
                        !String.IsNullOrEmpty(reorgRec.TradeCompanyShortName))
                    {
                        reorgRec.TradeCompany = reorgRec.TradeCompanyFullName + "|" + reorgRec.TradeCompanyShortName;
                    }
                }
            }

            if (xTradeList.Count > 1)
            {
                reorgRec.TradeCompany = String.Join(Utility.SplitChar, xTradeList);
            }

            //释义表中获得的交易对手,进行必要的订正
            if (string.IsNullOrEmpty(reorgRec.TradeCompany))
            {
                var xTradeListExplain = getTradeCompanyByExplain(reorgRec);
                foreach (var tradeItem in xTradeListExplain)
                {
                    //交易公司的简称填补
                    foreach (var dict in ExplainDict)
                    {
                        var keys  = dict.Key.Split(Utility.SplitChar);
                        var keys2 = dict.Key.Split(new char[] { '/', '/' });
                        var isHit = false;
                        if (keys.Length == 1 && keys2.Length > 1)
                        {
                            keys = keys2;
                        }
                        foreach (var key in keys)
                        {
                            if (key.Contains("标的"))
                            {
                                continue;
                            }
                            if (key.Contains("目标"))
                            {
                                continue;
                            }
                            if (key.Equals("上市公司"))
                            {
                                continue;
                            }
                            if (key.Equals("本公司"))
                            {
                                continue;
                            }
                            if (key.Equals(tradeItem.Value) || dict.Value.Equals(tradeItem.Value))
                            {
                                var tempKey = key;
                                if (tempKey.Contains(","))
                                {
                                    tempKey = Utility.GetStringBefore(tempKey, ",");
                                }

                                var tempvalue = dict.Value;
                                if (tempvalue.Contains(","))
                                {
                                    tempvalue = Utility.GetStringBefore(tempvalue, ",");
                                }
                                reorgRec.TradeCompanyFullName = tempvalue;
                                if (!tempKey.Equals("交易对方") && !tempKey.Equals("发行对象"))
                                {
                                    reorgRec.TradeCompanyShortName = tempKey;
                                }
                                isHit = true;
                                break;
                            }
                        }
                        if (isHit)
                        {
                            break;
                        }
                    }
                    reorgRec.TradeCompany = tradeItem.Value;
                    if (!String.IsNullOrEmpty(reorgRec.TradeCompanyFullName) &&
                        !String.IsNullOrEmpty(reorgRec.TradeCompanyShortName))
                    {
                        reorgRec.TradeCompany = reorgRec.TradeCompanyFullName + "|" + reorgRec.TradeCompanyShortName;
                    }
                    else
                    {
                        //中建六局及中建八局
                        var tradeArray = tradeItem.Value.Split(Utility.SplitChar).ToList();
                        var last       = tradeArray.Last();
                        if (last.Contains("以及"))
                        {
                            tradeArray.RemoveAt(tradeArray.Count - 1);
                            tradeArray.Add(Utility.GetStringBefore(last, "以及"));
                            tradeArray.Add(Utility.GetStringAfter(last, "以及"));
                            reorgRec.TradeCompany = String.Join(Utility.SplitChar, tradeArray);
                        }
                        else
                        {
                            if (last.Contains("及"))
                            {
                                tradeArray.RemoveAt(tradeArray.Count - 1);
                                tradeArray.Add(Utility.GetStringBefore(last, "及"));
                                tradeArray.Add(Utility.GetStringAfter(last, "及"));
                                reorgRec.TradeCompany = String.Join(Utility.SplitChar, tradeArray);
                            }
                            if (last.Contains("和"))
                            {
                                tradeArray.RemoveAt(tradeArray.Count - 1);
                                tradeArray.Add(Utility.GetStringBefore(last, "和"));
                                tradeArray.Add(Utility.GetStringAfter(last, "和"));
                                reorgRec.TradeCompany = String.Join(Utility.SplitChar, tradeArray);
                            }
                        }
                    }
                    Console.WriteLine("使用释义表的交易对手:" + tradeItem.Key + ":" + reorgRec.TradeCompany);
                    break;
                }
            }

            //交易对手最后整型
            NormalizeTradeCompany(reorgRec);

            var Price = GetPrice(reorgRec, targets.Count == 1);
            reorgRec.Price          = MoneyUtility.Format(Price.MoneyAmount, String.Empty);
            reorgRec.EvaluateMethod = getEvaluateMethod(reorgRec, targets.Count == 1);

            if (!String.IsNullOrEmpty(reorgRec.TargetCompanyFullName) &&
                !String.IsNullOrEmpty(reorgRec.TargetCompanyShortName))
            {
                reorgRec.TargetCompany = reorgRec.TargetCompanyFullName + "|" + reorgRec.TargetCompanyShortName;
            }

            if (String.IsNullOrEmpty(reorgRec.TargetCompany) || String.IsNullOrEmpty(reorgRec.Target))
            {
                continue;
            }
            //相同记录合并
            var  UnionKey   = reorgRec.TargetCompany + reorgRec.Target;
            bool IsKeyExist = false;
            foreach (ReorganizationRec exist in list)
            {
                var existKey = exist.TargetCompany + exist.Target;
                if (UnionKey.Equals(existKey))
                {
                    IsKeyExist = true;
                    break;
                }
            }
            if (!IsKeyExist)
            {
                list.Add(reorgRec);
            }
        }

        //价格或者评估表中出现过的(以下代码这里只是检证)
        if (PriceTable.Count != 0 && EvaluateTable.Count != 0 && PriceTable.Count == EvaluateTable.Count)
        {
            if (PriceTable.Count != list.Count)
            {
                Console.WriteLine(Id);
                foreach (var item in EvaluateTable)
                {
                    Console.WriteLine("评估表:" + item[0].RawData.Replace(" ", "") + " Value:" + item[1].RawData);
                }
                foreach (var item in PriceTable)
                {
                    Console.WriteLine("价格表:" + item[0].RawData.Replace(" ", "") + " Value:" + item[1].RawData);
                }

                foreach (ReorganizationRec item in list)
                {
                    Console.WriteLine("抽出:" + item.TargetCompany + item.Target);
                }
            }
        }

        return(list);
    }
Esempio n. 8
0
    public override List <RecordBase> Extract()
    {
        InitTableRules();
        var list    = new List <RecordBase>();
        var targets = getTargetListFromReplaceTable();

        if (targets.Count == 0)
        {
            return(list);
        }
        var TradeCompany = getTradeCompany(targets);

        foreach (var item in targets)
        {
            var reorgRec = new ReorganizationRec();
            reorgRec.Id            = this.Id;
            reorgRec.Target        = item.Target;
            reorgRec.TargetCompany = item.Comany;
            foreach (var tc in TradeCompany)
            {
                if (tc.TargetCompany == item.Comany)
                {
                    reorgRec.TradeCompany = tc.TradeCompany;
                    break;
                }
            }
            var Price = GetPrice(reorgRec);
            reorgRec.Price          = MoneyUtility.Format(Price.MoneyAmount, String.Empty);
            reorgRec.EvaluateMethod = getEvaluateMethod(reorgRec);

            //最后才能进行 多选配置!!!
            foreach (var dict in ExplainDict)
            {
                var keys  = dict.Key.Split(Utility.SplitChar);
                var keys2 = dict.Key.Split("/");
                var isHit = false;
                if (keys.Length == 1 && keys2.Length > 1)
                {
                    keys = keys2;
                }
                foreach (var key in keys)
                {
                    if (key.Contains("标的"))
                    {
                        continue;
                    }
                    if (key.Contains("目标"))
                    {
                        continue;
                    }
                    if (key.Equals("上市公司"))
                    {
                        continue;
                    }
                    if (key.Equals("本公司"))
                    {
                        continue;
                    }
                    if (dict.Key.Equals(reorgRec.TargetCompany) || dict.Value.Equals(reorgRec.TargetCompany))
                    {
                        var tempKey = key;
                        if (tempKey.Contains(","))
                        {
                            tempKey = Utility.GetStringBefore(tempKey, ",");
                        }

                        var tempvalue = dict.Value;
                        if (tempvalue.Contains(","))
                        {
                            tempvalue = Utility.GetStringBefore(tempvalue, ",");
                        }

                        reorgRec.TargetCompany = tempKey + "|" + tempvalue;
                        isHit = true;
                        break;
                    }
                }
                if (isHit)
                {
                    break;
                }
            }

            list.Add(reorgRec);
        }

        //需要在释义表中出现过的
        if (PriceTable.Count != 0 && EvaluateTable.Count != 0 && PriceTable.Count == EvaluateTable.Count)
        {
            if (PriceTable.Count != list.Count)
            {
                Console.WriteLine(Id);
                foreach (var item in EvaluateTable)
                {
                    Console.WriteLine("评估表:" + item[0].RawData.Replace(" ", "") + " Value:" + item[1].RawData);
                }
                foreach (var item in PriceTable)
                {
                    Console.WriteLine("价格表:" + item[0].RawData.Replace(" ", "") + " Value:" + item[1].RawData);
                }

                foreach (ReorganizationRec item in list)
                {
                    Console.WriteLine("抽出:" + item.TargetCompany + item.Target);
                }
            }
        }
        return(list);
    }