public ND.PolicyUploadService.DtoModel.CompleteUploadPolicy.CompleteUploadPolicyResponse SearchCompleteUploadPolicy()
        {
            CompleteUploadPolicyResponse rep        = new CompleteUploadPolicyResponse();
            UploadPolicyRecordLib        uPolicyLib = new UploadPolicyRecordLib();
            List <UploadPolicyRecord>    lstUpload  = uPolicyLib.GetModelList(" CreateTime> '" + DateTime.Now.ToString("yyyy-MM-dd") + " 0:00:00" + "'");

            lstUpload.ForEach(x =>
            {
                rep.CompleteUploadPolicyCollection.Add(new CompleteUploadPolicyDto()
                {
                    CommisionMoney   = x.CommisionMoney,
                    CommsionPoint    = x.CommsionPoint,
                    PolicyId         = x.PolicyId,
                    PartenerPolicyId = x.PartenerPolicyId,
                    PolicyType       = x.PolicyType
                });
            });
            rep.ErrCode = PolicyService.Enums.ResultType.Sucess;
            return(rep);
        }
        public EmptyResponse UpdateNotify(UpdateNotifyRequest request)
        {
            try
            {
                UpLoadRecordLib       recLib       = new UpLoadRecordLib();
                UploadPolicyRecordLib recPolicyLib = new UploadPolicyRecordLib();
                PolicySyncRecLib      syncLib      = new PolicySyncRecLib();


                request.UpdateStatusId = request.UpdateStatusId.Replace("\"", "").Replace("\\", "");
                UpLoadRecord rec = recLib.GetModel(int.Parse(request.UpdateStatusId));
                if (rec == null)
                {
                    return(new EmptyResponse {
                        ErrCode = PolicyService.Enums.ResultType.Failed, ErrMsg = "未找到此上传的记录!"
                    });
                }
                if (rec.OperName.ToLower() == "system")
                {
                    if ((SuccessStatus)request.NotifyResult == SuccessStatus.Success)
                    {
                        recPolicyLib.BlukyUpdatePolicy(rec.Id.ToString(), true);
                        recLib.Delete(rec.Id);//删除
                    }
                    else
                    {
                        recPolicyLib.BlukyUpdatePolicy(rec.Id.ToString(), false);
                        recLib.Delete(rec.Id);//删除
                    }
                    return(new EmptyResponse {
                        ErrCode = PolicyService.Enums.ResultType.Sucess
                    });
                }


                PurchaserType Purchaser = (PurchaserType)Enum.Parse(typeof(PurchaserType), rec.PurchaserType);
                UploadType    uType     = (UploadType)Enum.Parse(typeof(UploadType), rec.UploadType);

                #region 1.保存文件记录
                if (request.IsSucess)
                {
                    string timeAndId = Convert.ToDateTime(rec.LastUpdateTime).ToString("yyyy-MM-dd HH:mm:ss.fff") + "|" + rec.LastPolicyId.ToString();
                    // CoreHelper.CreateFile(System.Configuration.ConfigurationManager.AppSettings["NotifyErrLogPath"] + "\\" + System.Guid.NewGuid() + ".txt", "读取最后记录"+timeAndId);//创建文件
                    // File.WriteAllText("e://1.txt", timeAndId);
                    string name = uType == UploadType.FullUpload ? rec.PurchaserType + "\\" + rec.PurchaserType + "FullPolicyRecLog" : rec.PurchaserType + "\\" + rec.PurchaserType + "IncrementPolicyRecLog";
                    CoreHelper.SaveLastUpTimeAndId(timeAndId, name);
                    // CoreHelper.CreateFile(System.Configuration.ConfigurationManager.AppSettings["NotifyErrLogPath"] + "\\" + System.Guid.NewGuid() + ".txt", "保存最后记录成功");//创建文件
                }

                #endregion

                #region 2.更新表中记录

                rec.ResponseParams = request.ResponseParams;
                rec.NotifyResult   = (int)request.NotifyResult;
                rec.FailedCount    = request.NotifyResult == SuccessStatus.Failed ? rec.FailedCount + 1 : rec.FailedCount;
                rec.CompleteTime   = DateTime.Now;
                rec.LastUpdateTime = DateTime.Now.ToString("yyyy-MM-dd") + " 0:00:00";
                rec.LastPolicyId   = "0";
                bool r = recLib.Update(rec);
                if (!r)
                {
                    return(new EmptyResponse {
                        ErrCode = PolicyService.Enums.ResultType.Failed, ErrMsg = "更新记录失败!"
                    });
                }
                bool flag = false;
                if (request.NotifyResult == SuccessStatus.Failed || request.NotifyResult == SuccessStatus.Other)
                {
                    flag = false;
                }
                else
                {
                    flag = true;
                }
                recPolicyLib.BlukyUpdatePolicy(rec.Id.ToString(), flag);
                #endregion


                #region 3.批量更新已经上传完成的政策
                if (request.IsSucess)
                {
                    string selectSql  = "";
                    int    totalCount = 0;
                    List <UploadPolicyRecord> lstUploadIds   = recPolicyLib.GetModelList(" UId='" + rec.Id + "'");
                    List <string>             lstAddPolicies = new List <string>();
                    lstUploadIds.ForEach(x =>
                    {
                        lstAddPolicies.Add(x.PolicyId);
                    });
                    //List<string> lstAddPolicies = rec.Remark.Split(',').ToList();
                    if (lstAddPolicies.Count > 0)
                    {
                        bool r2 = syncLib.BlukyUpdatePolicyUploaded(lstAddPolicies);
                        if (!r)
                        {
                            return(new EmptyResponse {
                                ErrCode = PolicyService.Enums.ResultType.Failed, ErrMsg = "批量把政策置为已上传失败!"
                            });
                        }
                    }
                }
                #endregion

                return(new EmptyResponse {
                    ErrCode = PolicyService.Enums.ResultType.Sucess
                });
            }
            catch (Exception ex)
            {
                return(new EmptyResponse {
                    ErrCode = PolicyService.Enums.ResultType.Failed, ErrMsg = JsonConvert.SerializeObject(ex)
                });
            }
        }