Example #1
0
        public override string ReceiveData()
        {
            var funModel = this.FindFunModel(HeritageId, FunId);

            if (funModel == null)
            {
                return(JsonHelper.SerializeObject(new ResultModel(false, "找不到该功能对应的配置信息")));
            }
            //通过xml配置的表名 找到类的路径 反射成 list类 对象
            var cListType = MethodHelper.GetTypeListFileEx(GetModelName(funModel.TableName));//GCHeritagePlatform.Services.PublicMornitor.Model.HPF_RCXC_RCXCYCJL;
            var ent       = JsonHelper.DeserializeJsonToObject <ResultBHGC_XCZPDockModel>(BusinessJsonStr);
            var dbContext = DBHelperPool.Instance.GetDbHelper();

            if (dbContext == null)
            {
                return(JsonHelper.SerializeObject(ToolResult.Failure("数据连接异常!")));
            }
            var listSqlStr = new List <string>();
            var listYSJID  = new List <string>();

            foreach (var item in ent.DATA)
            {
                var nameToValue = item.GetNameToValueDic();
                if (nameToValue.ContainsKey("GLYCBTID"))
                {
                    nameToValue["GLYCBTID"] = HeritageId;
                }
                if (nameToValue.ContainsKey("ID"))
                {
                    nameToValue["ID"] = Guid.NewGuid();
                }
                else
                {
                    nameToValue.Add("ID", Guid.NewGuid());
                }

                //保护工程和对接数据有关联
                var strSql = string.Format("select ID from HPF_BHGC where YCDSJID='{0}' and GLYCBTID='{1}' ", nameToValue["GCXMID"], HeritageId);
                var dtMain = dbContext.getDataTableResult(strSql);
                if (dtMain == null || dtMain.Rows.Count == 0)
                {
                    return(JsonHelper.SerializeObject(new ResultModel(false, "请先对接【保护展示与环境整治工程记录数据】!")));
                }
                //如果有改变PID的属性信息
                nameToValue["GCXMID"] = dtMain.Rows[0][0].ToString();
                var yscid = nameToValue["YCDSJID"] + "";
                listYSJID.Add(yscid);

                foreach (var fitem in ent.FILEPATHLIST)
                {
                    var fnameToValue = fitem.GetNameToValueDic();
                    if (fnameToValue.ContainsKey("YCDSJID") == nameToValue.ContainsKey("YCDSJID"))
                    {
                        FileInfoEx ReceiveFileInfo = CommonBusiness.GetFileNameByFileID(fnameToValue["FILEID"] as string);
                        switch (FunId)
                        {
                        case "150103":    //工程方案的文档
                        {
                            if (nameToValue.ContainsKey("WDMC"))
                            {
                                nameToValue["WDMC"] = ReceiveFileInfo.FILENAME;
                            }
                            else
                            {
                                nameToValue.Add("WDMC", ReceiveFileInfo.FILENAME);
                            }
                            if (nameToValue.ContainsKey("LJ"))
                            {
                                nameToValue["LJ"] = ReceiveFileInfo.RELATIVEPATH;
                            }
                            else
                            {
                                nameToValue.Add("LJ", ReceiveFileInfo.RELATIVEPATH);
                            }
                            if (nameToValue.ContainsKey("WDLX"))
                            {
                                nameToValue["WDLX"] = ReceiveFileInfo.FILETYPE;
                            }
                            else
                            {
                                nameToValue.Add("WDLX", ReceiveFileInfo.FILETYPE);
                            }
                        }
                        break;

                        case "1503":    //保护展示的现场照片
                        {
                            if (nameToValue.ContainsKey("TPMC"))
                            {
                                nameToValue["TPMC"] = ReceiveFileInfo.FILENAME;
                            }
                            else
                            {
                                nameToValue.Add("TPMC", ReceiveFileInfo.FILENAME);
                            }
                            if (nameToValue.ContainsKey("TPLJ"))
                            {
                                nameToValue["TPLJ"] = ReceiveFileInfo.RELATIVEPATH;
                            }
                            else
                            {
                                nameToValue.Add("TPLJ", ReceiveFileInfo.RELATIVEPATH);
                            }
                            if (nameToValue.ContainsKey("TPGS"))
                            {
                                nameToValue["TPGS"] = ReceiveFileInfo.FILETYPE;
                            }
                            else
                            {
                                nameToValue.Add("TPGS", ReceiveFileInfo.FILETYPE);
                            }
                        }
                        break;
                        }

                        listSqlStr.Add(dbContext.insertByParamsReturnSQL(GetModelName(funModel.TableName), nameToValue));
                    }
                }
            }

            if (!CheckIsDock(listSqlStr, listYSJID, funModel.TableName, dbContext))
            {
                return(JsonHelper.SerializeObject(new ResultModel(false, "已经存在对接的数据")));
            }
            return(GetExeListSQL(dbContext, listSqlStr));
        }
Example #2
0
        public override string ReceiveData()
        {
            var heritageId = this.HeritageId;
            var funId      = this.FunId;
            var jsonStr    = this.BusinessJsonStr;

            try
            {
                var xmlConfig  = CommonBusiness.GetMornitorConfig(heritageId);
                var funList    = xmlConfig.GetFunctionalModules();
                var ent        = JsonHelper.DeserializeJsonToObject <ResultYCYSDT2DockModel>(jsonStr);
                var dbContext  = DBHelperPool.Instance.GetDbHelper();
                var funModel   = funList.FirstOrDefault(e => e.ID == funId);
                var listSqlStr = new List <string>();
                var listYSJID  = new List <string>();
                foreach (var item in ent.DATA)
                {
                    var nameToValue = item.GetNameToValueDic();
                    if (nameToValue.ContainsKey("GLYCBTID"))
                    {
                        nameToValue["GLYCBTID"] = heritageId;
                    }
                    if (nameToValue.ContainsKey("ID"))
                    {
                        nameToValue["ID"] = Guid.NewGuid();
                    }
                    else
                    {
                        nameToValue.Add("ID", Guid.NewGuid());
                    }
                    var yscid = nameToValue["YCDSJID"] + "";
                    listYSJID.Add(yscid);



                    foreach (var fitem in ent.FILEPATHLIST)
                    {
                        var fnameToValue = fitem.GetNameToValueDic();
                        if (fnameToValue.ContainsKey("YCDSJID") == nameToValue.ContainsKey("YCDSJID"))
                        {
                            FileInfoEx ReceiveFileInfo = CommonBusiness.GetFileNameByFileID(fnameToValue["FileID"] as string);
                            if (!string.IsNullOrEmpty(yscid))//有可能对接过来就是 统计过得数据 例如景点日游客量
                            {
                            }
                        }
                    }


                    ////if (nameToValue.ContainsKey("TPMC"))
                    ////{
                    ////    nameToValue["TPMC"] = ReceiveFileInfo.FILENAME;
                    ////}
                    ////else
                    ////{
                    ////    nameToValue.Add("TPMC", ReceiveFileInfo.FILENAME);
                    ////}
                    //if (nameToValue.ContainsKey("TPLJ"))
                    //{
                    //    nameToValue["TPLJ"] = ReceiveFileInfo.RELATIVEPATH;
                    //}
                    //else
                    //{
                    //    nameToValue.Add("TPLJ", ReceiveFileInfo.RELATIVEPATH);
                    //}
                    //if (nameToValue.ContainsKey("TPLX"))
                    //{
                    //    nameToValue["TPLX"] = ReceiveFileInfo.FILETYPE;
                    //}
                    //else
                    //{
                    //    nameToValue.Add("TPLX", ReceiveFileInfo.FILETYPE);
                    //}
                    listSqlStr.Add(dbContext.insertByParamsReturnSQL(funModel.TableName, nameToValue));
                    //    }
                    //}
                    //}
                    //listSqlStr.Add(dbContext.insertByParamsReturnSQL(funModel.TableName, nameToValue)); //HPF_YSDT_YCYSDTHJBCHTJLB
                }
                if (!CheckIsDock(listSqlStr, listYSJID, funModel.TableName, dbContext))
                {
                    return(JsonHelper.SerializeObject(new ResultModel(false, "已经存在对接的数据")));
                }
                else
                {
                    if (dbContext.executeTransactionSQLList(listSqlStr))
                    {
                        return(JsonHelper.SerializeObject(new ResultModel(true, "对接成功")));
                    }
                    else
                    {
                        return(JsonHelper.SerializeObject(new ResultModel(false, "对接失败")));
                    }
                }
            }
            catch (Exception ex)
            {
                var strErr = string.Format("遗产地对接数据类【遗产要素单体或局部影像及遗产要素现状记录】数据错误,参数:{0}#{1}#{2},具体错误:{3}", jsonStr, funId, heritageId, ex.Message);
                SystemLogger.getLogger().Error(strErr);
                return(JsonHelper.SerializeObject(new ResultModel(false, ex.Message)));
            }
        }
Example #3
0
        public override string ReceiveData()
        {
            var funModel   = FindFunModel(HeritageId, FunId);
            var dbContext  = DBHelperPool.Instance.GetDbHelper();
            var ent        = JsonHelper.DeserializeJsonToObject <ResultYCYSDT1DockModel>(BusinessJsonStr);
            var listSqlStr = new List <string>();
            var listYSJID  = new List <string>();

            foreach (var item in ent.DATA)
            {
                var nameToValue = item.GetNameToValueDic();
                if (nameToValue.ContainsKey("GLYCBTID"))
                {
                    nameToValue["GLYCBTID"] = HeritageId;
                }
                if (nameToValue.ContainsKey("ID"))
                {
                    nameToValue["ID"] = Guid.NewGuid();
                }
                else
                {
                    nameToValue.Add("ID", Guid.NewGuid());
                }

                var yscid = nameToValue["YCDSJID"] + "";
                if (!string.IsNullOrEmpty(yscid))    //有可能对接过来就是 统计过得数据 例如景点日游客量
                {
                    listYSJID.Add(yscid);
                    foreach (var fitem in ent.FILEPATHLIST)
                    {
                        var fnameToValue = fitem.GetNameToValueDic();
                        if (fnameToValue.ContainsKey("YCDSJID") == nameToValue.ContainsKey("YCDSJID"))
                        {
                            FileInfoEx ReceiveFileInfo = CommonBusiness.GetFileNameByFileID(fnameToValue["FileID"] as string);
                            if (nameToValue.ContainsKey("TZMC"))
                            {
                                nameToValue["TZMC"] = ReceiveFileInfo.FILENAME;
                            }
                            else
                            {
                                nameToValue.Add("TZMC", ReceiveFileInfo.FILENAME);
                            }
                            if (nameToValue.ContainsKey("TZLJ"))
                            {
                                nameToValue["TZLJ"] = ReceiveFileInfo.RELATIVEPATH;
                            }
                            else
                            {
                                nameToValue.Add("TZLJ", ReceiveFileInfo.RELATIVEPATH);
                            }
                            if (nameToValue.ContainsKey("TZLX"))
                            {
                                nameToValue["TZLX"] = ReceiveFileInfo.FILETYPE;
                            }
                            else
                            {
                                nameToValue.Add("TZLX", ReceiveFileInfo.FILETYPE);
                            }
                            listSqlStr.Add(dbContext.insertByParamsReturnSQL(funModel.TableName, nameToValue));
                        }
                    }
                }
            }
            if (!CheckIsDock(listSqlStr, listYSJID, funModel.TableName, dbContext))
            {
                return(JsonHelper.SerializeObject(new ResultModel(false, "已经存在对接的数据")));
            }
            return(GetExeListSQL(dbContext, listSqlStr));
        }