예제 #1
0
 public CollateralMonitorDetails(DataCollateral model)
 {
     this.Id                        = model.Id;
     this.Number                    = model.Number;
     this.BankId                    = model.BankId;
     this.Branch                    = model.Branch;
     this.PurposeCode               = model.PurposeCode;
     this.PurposeName               = model.PurposeName;
     this.Name                      = model.Name;
     this.BuildingArea              = model.BuildingArea;
     this.BuildingAreaCode          = model.BuildingAreaCode;
     this.Address                   = model.Address;
     this.BranchCityId              = model.BranchCityId;
     this.ProjectId                 = model.ProjectId;
     this.ProvinceId                = model.ProvinceId;
     this.CityId                    = model.CityId;
     this.AreaId                    = model.AreaId;
     this.SubAreaId                 = model.SubAreaId;
     this.BuildingId                = model.BuildingId;
     this.RoomId                    = model.RoomId;
     this.ProjectName               = model.ProjectName;
     this.ProjectAddress            = model.ProjectAddress;
     this.Installment               = model.Installment;
     this.ProjectType               = model.ProjectType;
     this.Road                      = model.Road;
     this.RoadNumber                = model.RoadNumber;
     this.BuildingNumber            = model.BuildingNumber;
     this.FloorNumber               = model.FloorNumber;
     this.RoomNumber                = model.RoomNumber;
     this.Clerk                     = model.Clerk;
     this.Agency                    = model.Agency;
     this.FirstPay                  = model.FirstPay;
     this.MonthsPay                 = model.MonthsPay;
     this.LoanDate                  = model.LoanDate;
     this.LoanYear                  = model.LoanYear;
     this.LoanInterestRate          = model.LoanInterestRate;
     this.LoanCardinalNumber        = model.LoanCardinalNumber;
     this.LoanAmount                = model.LoanAmount;
     this.LoanBalance               = model.LoanBalance;
     this.LoanPeople                = model.LoanPeople;
     this.LoanSex                   = model.LoanSex;
     this.LoanAge                   = model.LoanAge;
     this.LoanCardID                = model.LoanCardID;
     this.LoanCensus                = model.LoanCensus;
     this.LoanProfession            = model.LoanProfession;
     this.LoanEducationalBackground = model.LoanEducationalBackground;
     this.LoanMarriage              = model.LoanMarriage;
     this.LoanSalary                = model.LoanSalary;
     this.CreditRating              = model.CreditRating;
     this.LoanCompany               = model.LoanCompany;
     this.LineOfcredit              = model.LineOfcredit;
     this.Status                    = model.Status;
     this.CreateDate                = model.CreateDate;
     this.MatchStatus               = model.MatchStatus;
     this.OldRate                   = model.OldRate;
     this.GuaranteePrice            = model.GuaranteePrice;
     this.OldMortgageRates          = model.OldMortgageRates;
     this.UploadFileId              = model.UploadFileId;
     this.BankProjectId             = model.BankProjectId;
 }
예제 #2
0
 public ActionResult UpdateDATCollateral(DataCollateral data)
 {
     using (FxtAPIClient client = new FxtAPIClient())
     {
         JObject _obj = new JObject();
         _obj.Add("dataCollateral", Utils.Serialize(data));
         result = client.Entrance(Utils.CommonKey, Utils.GetWcfCode(Utils.CommonKey), "C",
                                  _DATADataCollateralUpdate, Utils.Serialize(_obj));
         return(Json(ResultServerJson(result.ToString())));
     }
 }
예제 #3
0
파일: FxtTask.cs 프로젝트: kingshhh/fxtcode
        /// <summary>
        /// 押品拆分保存
        /// </summary>
        /// <param name="dataCollateral">押品对象</param>
        /// <param name="uploadFileId">文件ID</param>
        /// <returns></returns>
        public ResultData DataCollateralAdd(string data)
        {
            DataCollateral collateral = Utils.Deserialize <DataCollateral>(data);

            if (collateral.MatchStatus != null)
            {
                collateral.Status = 1;
            }
            collateral.CreateDate = DateTime.Now;

            MSSQLADODAL.SetConnection(Utility.DBFxtLoan);
            int objId = CAS.DataAccess.DA.BaseDA.InsertFromEntity <DataCollateral>(collateral);

            if (objId > 0)
            {
                return(Utility.GetObjJson(1, "成功"));
            }
            return(Utility.GetObjJson(0, ""));
        }
예제 #4
0
        void StartRun(SystemTask systemTask)
        {
            bool isSuspend = false;

            if (systemTask.Status.Equals(2))
            {
                isSuspend = true;
            }
            BackgroundWorkerTimer bwTimer = new BackgroundWorkerTimer();

            #region BackgroundWorkerTimer 任务
            bwTimer.Runing += (s, e) =>
            {
                CustomEventArgs customEventArgs = ((CustomEventArgs)e);
                SystemTask      doSystemTask    = customEventArgs.Argument as SystemTask;
                int             index           = -1;
                index = doSystemTask.RowObject.Index;
                if (customEventArgs.RunComplete != null && customEventArgs.RunComplete.Cancelled)//取消
                {
                    //e.Cancel = true;
                    //break;
                }
                else if (customEventArgs.RunComplete != null && customEventArgs.RunComplete.Error != null)//错误
                {
                }
                else//成功或者继续执行
                {
                    string strGet = string.Empty;
                    if (doSystemTask.TaskType.Equals(1))
                    {
                        #region  估
                        List <DataCollateral> list = customEventArgs.ListObject as List <DataCollateral>;
                        strGet = GetDownString(doSystemTask.Url2.Replace("{id}", list[customEventArgs.Index].Id.ToString()));
                        if (!Utils.IsNullOrEmpty(strGet) && Utils.GetJObjectValue(strGet, "Type").Equals("1"))//成功
                        {
                            doSystemTask.SuccessCount = IntNull(doSystemTask.SuccessCount);
                        }
                        else//失败
                        {
                            doSystemTask.FailureCount = IntNull(doSystemTask.FailureCount);
                            SysTaskLog sysTaskLog = new SysTaskLog()
                            {
                                TaskId  = doSystemTask.Id,
                                Message = Utils.GetJObjectValue(strGet, "Message")
                            };
                            SendString(GetUrl("API/FxtTask.svc/TLC/"), new { data = Utils.Serialize(sysTaskLog) });
                        }
                        #endregion
                    }
                    else if (doSystemTask.TaskType.Equals(0))
                    {
                        #region 押品拆分
                        object[,] arrayItem = customEventArgs.ListObject as object[, ];
                        ExcelHelper excelHelper   = customEventArgs.ExcelHelper as ExcelHelper;
                        object      objCollateral = excelHelper.TaskExcelStandardization(arrayItem,
                                                                                         customEventArgs.StandardizationHeader, customEventArgs.Index);
                        DataCollateral model = objCollateral as DataCollateral;
                        if (model != null)
                        {
                            model.UploadFileId  = doSystemTask.UploadFileId;
                            model.BankId        = doSystemTask.BankId;
                            model.BankProjectId = doSystemTask.BankProjectId;
                            model.Status        = 0;//默认什么都没有

                            strGet = SendString(GetUrl("API/FxtTask.svc/CreateCollateral/"), new { data = Utils.Serialize(model) });
                        }
                        //!model.Id.Equals(0) 是否已存在拆分过的押品
                        if ((!Utils.IsNullOrEmpty(strGet) && Utils.GetJObjectValue(strGet, "Type").Equals("1")) ||
                            (model != null && !model.Id.Equals(0)))
                        {
                            doSystemTask.SuccessCount = IntNull(doSystemTask.SuccessCount);
                        }
                        else if ((!Utils.IsNullOrEmpty(strGet) && Utils.GetJObjectValue(strGet, "Type").Equals("0")) || model == null)
                        {
                            doSystemTask.FailureCount = IntNull(doSystemTask.FailureCount);
                            SysTaskLog sysTaskLog = new SysTaskLog()
                            {
                                TaskId  = doSystemTask.Id,
                                Message = objCollateral.ToString()
                            };
                            //失败了就记录日志
                            SendString(GetUrl("API/FxtTask.svc/TLC/"), new { data = Utils.Serialize(sysTaskLog) });
                        }
                        #endregion
                    }
                    //是否下标小于0
                    if (!index.Equals(-1))
                    {
                        dgvTack.Rows[index].Cells["SuccessCount"].Value = doSystemTask.SuccessCount;
                        dgvTack.Rows[index].Cells["FailureCount"].Value = doSystemTask.FailureCount;
                    }

                    SendString(GetUrl("API/FxtTask.svc/TUSF/"), new { data = Utils.Serialize(doSystemTask) });

                    if (customEventArgs.Index == doSystemTask.Count - 1 && doSystemTask != null)
                    {
                        string strSuccess = SendString(doSystemTask.Url3, new { data = Utils.Serialize(doSystemTask) });
                        if (Utils.GetJObjectValue(strSuccess, "Type").Equals("1"))
                        {
                            if (!doSystemTask.RowObject.Index.Equals(-1))
                            {
                                doSystemTask.RowObject.Cells["RunStatus"].Value = "成功";
                            }
                            Thread.Sleep(3000);
                            //因为线程,所以异步操作
                            this.Invoke(new EventHandler((object sender, EventArgs es) =>
                            {
                                if (!index.Equals(-1))
                                {
                                    dgvTack.Rows.Remove(dgvTack.Rows[index]);
                                }
                            }));

                            //if (listExists.Where(ie => ie.Equals(doSystemTask.Id)).Any())
                            //{
                            //    listExists.Remove(doSystemTask.Id);
                            //}

                            //var taskControl = listTaskControl.Where(item => item.SystemTask.Id.Equals(doSystemTask.Id));
                            //if (taskControl.Any())
                            //{
                            //    listTaskControl.Remove(taskControl.FirstOrDefault());
                            //}
                        }
                    }
                }
            };
            #endregion
            bool isAdd = false;
            if (systemTask.TaskType.Equals(0) && !Utils.IsNullOrEmpty(systemTask.FileUrl))//拆分
            {
                ExcelHelper excelHelper             = new ExcelHelper(GetUrl(systemTask.FileUrl, "excelParentUrl"));
                string      path                    = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Homologous/ExcelToModel.xml");
                Dictionary <int, string> listHeader = excelHelper.TaskExcelColumns(path);
                //excelHelper.TaskExcelStandardization(excelHelper.TaskReadExcel(), listHeader);
                object[,] arrayItem = excelHelper.TaskReadExcel();
                bwTimer.count       = arrayItem.GetLength(0);
                systemTask.Count    = arrayItem.GetLength(0);
                bwTimer.Set(systemTask, arrayItem, listHeader, excelHelper);
                isAdd = true;
            }
            else if (systemTask.TaskType.Equals(1))//复估
            {
                string strDown = GetDownString(systemTask.Url1.Replace("{id}", systemTask.UploadFileId.ToString()));
                List <DataCollateral> listData = Utils.Deserialize <List <DataCollateral> >(Utils.GetJObjectValue(strDown, "Data"));
                if (listData != null)
                {
                    bwTimer.count    = listData.Count;
                    systemTask.Count = bwTimer.count;
                }
                bwTimer.Set(systemTask, listData);
                isAdd = true;
            }

            if (isAdd)
            {
                systemTask.RowObject.Cells["Count"].Value = systemTask.Count;
                bwTimer.Start(isSuspend);
                listTaskControl.Add(new TaskControl()
                {
                    SystemTask = systemTask, BackgroundWorker = bwTimer
                });
            }
        }
예제 #5
0
        public ActionResult ExcelDown(string data, int pageSize, int pageIndex, int type, string column, int fileId)
        {
            string[] array = getDownFile();
            bool     flag  = false;


            string[] dataSplit            = data.Split('&');
            JObject  jcolumn              = JObject.Parse(column);
            string   filename             = string.Empty;
            Dictionary <int, string> list = new Dictionary <int, string>();

            foreach (var ds in dataSplit)
            {
                if (Utils.IsNullOrEmpty(ds))
                {
                    continue;
                }
                var curDS = ds.Split('=');
                if (!curDS[0].ToString().Equals("type") && !curDS[0].ToString().Equals("filename"))
                {
                    string strName = string.Empty;
                    if (curDS[0].ToString().Equals("Number"))
                    {
                        strName = "押品编号";
                    }
                    else if (curDS[0].ToString().Equals("Branch"))
                    {
                        strName = "分行";
                    }
                    else if (curDS[0].ToString().Equals("PurposeCode"))
                    {
                        strName = "押品类型";
                    }
                    else if (curDS[0].ToString().Equals("Name"))
                    {
                        strName = "押品名称";
                    }
                    else if (curDS[0].ToString().Equals("BuildingArea"))
                    {
                        strName = "面积";
                    }
                    else if (curDS[0].ToString().Equals("Address"))
                    {
                        strName = "押品地址";
                    }
                    list.Add(Convert.ToInt32(curDS[1]), strName);
                }
                else if (curDS[0].ToString().Equals("filename"))
                {
                    filename = Utils.ServerMapPath(Path.Combine(GetUploadUrl(), curDS[1]));
                }
            }
            //拆分出信息
            ExcelHelper            excelR = new ExcelHelper(filename);
            List <DataCollaterals> rlist  = null;

            if (type.Equals(0))//导出当前页
            {
                rlist = excelR.ExcelStandardization(list, pageSize, pageIndex, true) as List <DataCollaterals>;
            }
            else//导出全部
            {
                rlist = excelR.ExcelStandardization(list, 0, 0) as List <DataCollaterals>;
            }
            //导出拆分信息
            ExcelHelper    excelW      = new ExcelHelper(array[1]);
            List <JObject> newList     = new List <JObject>();
            List <JObject> newSaveList = new List <JObject>();

            foreach (var item in rlist)
            {
                var     parray          = item.GetType().GetProperties();
                JObject _newJobject     = new JObject();
                JObject _newSaveJobject = new JObject();
                foreach (var p in parray)
                {
                    foreach (var _jobj in jcolumn)
                    {
                        if (_jobj.Key.Equals(p.Name))
                        {
                            string strVal = Utils.ObjectIsNull(p.GetValue(item, null));
                            _newJobject.Add(_jobj.Value.ToString(), strVal);
                            _newSaveJobject.Add(_jobj.Key, strVal);

                            if (p.Name.ToLower().Equals("provinceid") &&
                                _jobj.Key.ToLower().Equals("provinceid") &&
                                _newJobject[_jobj.Value.ToString()] != null)
                            {
                                _newJobject[_jobj.Value.ToString()] =
                                    Utils.ObjectIsNull(item.GetType().GetProperty("ProvinceName").GetValue(item, null));
                            }
                            else if (p.Name.ToLower().Equals("cityid") &&
                                     _jobj.Key.ToLower().Equals("cityid") &&
                                     _newJobject[_jobj.Value.ToString()] != null)
                            {
                                _newJobject[_jobj.Value.ToString()] =
                                    Utils.ObjectIsNull(item.GetType().GetProperty("CityName").GetValue(item, null));
                            }
                            else if (p.Name.ToLower().Equals("areaid") &&
                                     _jobj.Key.ToLower().Equals("areaid") &&
                                     _newJobject[_jobj.Value.ToString()] != null)
                            {
                                _newJobject[_jobj.Value.ToString()] =
                                    Utils.ObjectIsNull(item.GetType().GetProperty("AreaName").GetValue(item, null));
                            }
                        }
                    }
                }
                newSaveList.Add(_newSaveJobject);
                newList.Add(_newJobject);
            }
            using (FxtAPIClient client = new FxtAPIClient())
            {
                foreach (var itemSave in newSaveList)
                {
                    DataCollateral model = new DataCollateral()
                    {
                        Status = 2
                    };
                    Type t = model.GetType();

                    foreach (var _itemSave in itemSave)
                    {
                        if (t.GetProperty(_itemSave.Key).PropertyType == typeof(String))
                        {
                            t.GetProperty(_itemSave.Key).SetValue(model, _itemSave.Value.Value <string>(), null);
                        }
                        else if (t.GetProperty(_itemSave.Key).PropertyType == typeof(decimal))
                        {
                            t.GetProperty(_itemSave.Key).SetValue(model, _itemSave.Value.Value <decimal>(), null);
                        }
                        else if (t.GetProperty(_itemSave.Key).PropertyType == typeof(int))
                        {
                            t.GetProperty(_itemSave.Key).SetValue(model, _itemSave.Value.Value <int>(), null);
                        }
                    }

                    JObject _obj = new JObject();
                    _obj.Add("dataCollateral", Utils.Serialize(model));
                    _obj.Add("uploadFileId", fileId);
                    client.Entrance(Utils.CommonKey, Utils.GetWcfCode(Utils.CommonKey),
                                    "C", _DATACollateralAdd, Utils.Serialize(_obj));
                }
            }
            if (type.Equals(0))//导出当前页
            {
                flag = excelW.WorkbookWrite(array[0], newList, pageIndex);
            }
            else
            {
                flag = excelW.WorkbookWrite(array[0], newList, 0);
            }
            if (flag)
            {
                return(Json(new
                {
                    path = Utils.GetDateTime("yyyy-MM-dd"),
                    name = array[1]
                }));
            }
            else
            {
                return(Json(""));
            }
        }