Пример #1
0
        /// <summary>
        /// 校验Value是否重复
        /// </summary>
        /// yaoy    16.09.26
        /// <param name="content"></param>
        /// <param name="infoTypeId"></param>
        /// <param name="metaCode"></param>
        /// <param name="code"></param>
        /// <returns></returns>
        public bool Value1Validate(string content, int infoTypeId, int metaCode, string code)
        {
            var temp = new List <string>();

            // 获取合同段所有字典类型数据
            var list = GetList(content, code);

            var segmentRulesInfo = new SegmentRules().GetSegmentRulesByInfoTypeIdAndMetaCodeAndCode(infoTypeId, metaCode, code);

            if (list.Count > 0)
            {
                foreach (var dic in list)
                {
                    var tmp = code + segmentRulesInfo.SegmentRulesId.ToString();

                    if (dic.ContainsKey(tmp))
                    {
                        if (!temp.Contains(tmp))
                        {
                            temp.Add(dic[tmp]);
                        }

                        else
                        {
                            return(false);
                        }
                    }
                }
            }

            return(true);
        }
Пример #2
0
        /// <summary>
        /// 查找报文文件下面含有该数据元对应的值
        /// </summary>
        /// yand   16.09.27
        /// <param name="typeId">信息记录ID</param>
        /// <param name="fileId">报文文件ID</param>
        /// <param name="metaCode">需要获取数据元对应的值</param>
        /// <param name="dataSegmentParagraphCode">数据段标识</param>
        /// <returns></returns>
        public List <string> Dictionary(int typeId, int fileId, int metaCode, string dataSegmentParagraphCode)
        {
            List <ReportInfo> reportList = new Report().List(fileId);
            var list = new List <string>();
            List <Dictionary <string, string> > ListDic = new List <Dictionary <string, string> >();

            foreach (var reportInfo in reportList)
            {
                // 获取报文文件下该类型的信息记录集合
                List <InformationRecordInfo> informationRecordList = new DAL.BankCredit.InformationRecordMapper().FindInformationListByInfoTypeIdAndReportId(typeId, reportInfo.ReportID);

                if (informationRecordList != null)
                {
                    foreach (var informationRecord in informationRecordList)
                    {
                        Dictionary <string, string> dic = new Dictionary <string, string>();
                        // JSON 字符串
                        var content    = informationRecord.Context;
                        var infoTypeId = informationRecord.InfoTypeID;
                        // 根据信息记录类型ID和数据元ID获取数据段规则实体
                        var segmentRulesInfo = new SegmentRules().GetSegmentRulesByInfoTypeIdAndMetaCodeAndCode(infoTypeId, metaCode, dataSegmentParagraphCode);

                        // 获取信息记录中数据段中数据元规则对应的值
                        var temp = new CommonUtil().GetValues(content, dataSegmentParagraphCode, segmentRulesInfo.SegmentRulesId.ToString());
                        list.Add(temp);
                    }
                }
            }
            return(list);
        }
        /// <summary>
        /// 获取最早最晚还款日期
        /// </summary>
        /// yaoy    16.09.29
        /// <param name="fileId"></param>
        /// <returns></returns>
        public string GetValue(int fileId)
        {
            var result   = string.Empty;
            var metaCode = 2301;
            var list     = new List <string>();

            List <ReportInfo> reportList = new Report().List(fileId);

            foreach (var reportInfo in reportList)
            {
                List <InformationRecordInfo> informationList = new InformationRecord().GetByReportId(reportInfo.ReportID);

                if (informationList != null)
                {
                    foreach (var informationInfo in informationList)
                    {
                        // 根据信息记录类型和数据元获取所以数据段规则集合
                        var segmentRulesList = new SegmentRules().GetByInfoTypeIdAndMetaCode(informationInfo.InfoTypeID, metaCode);

                        if (segmentRulesList != null)
                        {
                            foreach (var segmentRulesInfo in segmentRulesList)
                            {
                                // 数据段实体
                                var dataSegmentInfo = new DataSegment().Get(segmentRulesInfo.BDS_ID);
                                // 取值
                                var temp = new CommonUtil().GetValues(informationInfo.Context, dataSegmentInfo.ParagraphCode, segmentRulesInfo.SegmentRulesId.ToString());

                                if (temp != "")
                                {
                                    list.Add(temp);
                                }
                            }
                        }
                    }
                }
            }

            list.Sort();

            if (list.Count >= 1)
            {
                result = list[0] + list[list.Count - 1];
            }

            return(result);
        }
Пример #4
0
        /// <summary>
        /// 关联性性校验
        /// </summary>
        /// yaoy    16.09.27
        /// <param name="infoTypeId"></param>
        /// <param name="content"></param>
        /// <param name="metaCode"></param>
        /// <param name="code"></param>
        /// <param name="value1"></param>
        /// <param name="value2"></param>
        /// <returns></returns>
        public bool Value2Proof(int infoTypeId, string content, int[] metaCode, string code, string[] value1, string[] value2)
        {
            var result = true;

            var segmentRulesInfo1 = new SegmentRules().GetSegmentRulesByInfoTypeIdAndMetaCodeAndCode(infoTypeId, metaCode[0], code);
            var segmentRulesInfo2 = new SegmentRules().GetSegmentRulesByInfoTypeIdAndMetaCodeAndCode(infoTypeId, metaCode[1], code);

            var temp1 = GetValues(content, code, segmentRulesInfo1.SegmentRulesId.ToString());

            if (value1.Contains(temp1))
            {
                var temp2 = GetValues(content, code, segmentRulesInfo2.SegmentRulesId.ToString());

                result &= value2.Contains(temp2);
            }

            return(result);
        }