コード例 #1
0
        public ResultModel Payment([FromBody] BusinessModel param)
        {
            try
            {
                if (param == null)
                {
                    return(new ResultModel {
                        StatusCode = "000003", Result = "请求错误,请检查输入参数!"
                    });
                }
                Log.Info("Payment input:" + JsonConvert.SerializeObject(param));
                LogIntoDb.Log(_db, param.userName, "Payment", JsonConvert.SerializeObject(param));
                //if (!PermissionCheck.CheckLevelPermission(param, _dbuUserDbc))
                //{
                //    return new ResultModel { StatusCode = "000007", Result = "没有权限" };
                //}

                switch (param.countyCode.ToLower())
                {
                case "changdao": return(ChangdaoPayment(param));

                case "zhaoyuan": return(ZhaoyuanPayment(param));

                case "penglai": return(PenglaiPayment(param));

                case "laizhou": return(LaizhouPayment(param));

                case "laiyang": return(LaiyangPayment(param));

                case "longkou": return(LongkouPayment(param));

                case "muping": return(MupingPayment(param));

                case "laishan": return(LaishanPayment(param));

                case "qixia": return(QixiaPayment(param));

                case "fushan": return(FushanPayment(param));

                case "haiyang": return(HaiyangPayment(param));

                case "zhifu":
                case "shisuo":
                case "dacheng":
                    return(ZhifuPayment(param));

                default:
                    return(new ResultModel {
                        StatusCode = "000016", Result = "没有该县区标识" + param.countyCode
                    });
                }
            }
            catch (Exception ex)
            {
                Log.Error("Payment", ex);
                return(new ResultModel {
                    StatusCode = "000003", Result = ex.Message
                });
            }
        }
コード例 #2
0
        public CommonResult IdentityInforUpload([FromBody] IdentityInforUploadRequest param)
        {
            try
            {
                if (param == null)
                {
                    return(new CommonResult {
                        StatusCode = "000003", Result = "请求错误,请检查输入参数!"
                    });
                }
                Log.Info("IdentityInforUpload input:" + JsonConvert.SerializeObject(param));
                LogIntoDb.Log(_db, param.UserName, "IdentityInforUpload", JsonConvert.SerializeObject(param));

                var busi = _db.POPULATION.FirstOrDefault(q => q.IDNUM == param.IdentityCardNumber);
                if (busi == null)
                {
                    _db.POPULATION.Add(new POPULATION
                    {
                        FIRSTFINGER  = param.FingerprintOne,
                        IDNUM        = param.IdentityCardNumber,
                        SECONDFINGER = param.FingerprintTwo,
                        LEFTEYE      = param.IrisLeft,
                        RIGHTEYE     = param.IrisRight,
                    });
                }
                else
                {
                    if (!string.IsNullOrEmpty(param.IrisRight))
                    {
                        busi.RIGHTEYE = param.IrisRight;
                    }

                    if (!string.IsNullOrEmpty(param.IrisLeft))
                    {
                        busi.LEFTEYE = param.IrisLeft;
                    }

                    if (!string.IsNullOrEmpty(param.FingerprintOne))
                    {
                        busi.FIRSTFINGER = param.FingerprintOne;
                    }

                    if (!string.IsNullOrEmpty(param.FingerprintTwo))
                    {
                        busi.SECONDFINGER = param.FingerprintTwo;
                    }
                }
                _db.SaveChanges();
                return(new CommonResult {
                    StatusCode = "000000", Result = ""
                });
            }
            catch (Exception ex)
            {
                Log.Error("IdentityInforUpload", ex);
                return(new CommonResult {
                    StatusCode = "000003", Result = ex.Message
                });
            }
        }
コード例 #3
0
        public ResultModel TabulationQuery([FromBody] TabulationQuery param)
        {
            try
            {
                if (param == null)
                {
                    return(new ResultModel {
                        StatusCode = "000003", Result = "请求错误,请检查输入参数!"
                    });
                }
                Log.Info("TabulationQuery input:" + JsonConvert.SerializeObject(param));
                LogIntoDb.Log(db, param.UserName, "TabulationQuery", JsonConvert.SerializeObject(param));

                switch (param.CountyCode)
                {
                case CountyCode.LaiShan: return(Laishan_TabulationQuery(param));

                case CountyCode.LaiYang: return(LaiyangTabulationQuery(param));

                case CountyCode.LaiZhou: return(LaizhouTabulationQuery(param));

                case CountyCode.LongKou: return(LongkouTabulationQuery(param));

                case CountyCode.PengLai: return(PenglaiTabulationQuery(param));

                case CountyCode.FuShan: return(FushanTabulationQuery(param));

                case CountyCode.QiXia: return(QixiaTabulationQuery(param));

                case CountyCode.HaiYang: return(HaiyangTabulationQuery(param));

                case CountyCode.MuPing: return(MupingTabulationQuery(param));

                case CountyCode.ChangDao: return(ChangdaoTabulationQuery(param));

                case CountyCode.ZhaoYuan: return(ZhaoyuanTabulationQuery(param));

                case CountyCode.ZhiFu:
                case CountyCode.DaCheng:
                case CountyCode.ShiSuo:
                    return(ZhifuTabulationQuery(param));

                default:

                    return(new ResultModel {
                        StatusCode = "000016", Result = "没有该县区标识" + param.CountyCode
                    });

                    break;
                }
            }
            catch (Exception ex)
            {
                Log.Error("TabulationQuery", ex);
                return(new ResultModel {
                    StatusCode = "000003", Result = ex.Message
                });
            }
        }
コード例 #4
0
        public CommonResult IdentityInforQuery([FromBody] IndentityInforQuery param)
        {
            try
            {
                if (param == null)
                {
                    return(new CommonResult {
                        StatusCode = "000003", Result = "请求错误,请检查输入参数!"
                    });
                }
                Log.Info("IdentityInforQuery input:" + JsonConvert.SerializeObject(param));
                LogIntoDb.Log(_db, param.UserName, "IdentityInforQuery", JsonConvert.SerializeObject(param));
                //if (!PermissionCheck.CheckLevelPermission(param, _dbuUserDbc))
                //{
                //    return new CommonResult { StatusCode = "000007", Result = "没有权限" };
                //}


                var busi = _db.POPULATION.FirstOrDefault(q => q.IDNUM == param.IdentityCardNumber);
                if (busi == null)
                {
                    _db.POPULATION.Add(new POPULATION
                    {
                        ADDRESS = param.Address,
                        BORN    = param.Birthday,
                        IDNUM   = param.IdentityCardNumber,
                        MOBILE  = param.PhoneNumber,
                        NAME    = param.Name,
                        NATION  = param.Nationality,
                    });
                }
                else
                {
                    busi.ADDRESS = param.Address;
                    busi.BORN    = param.Birthday;
                    busi.MOBILE  = param.PhoneNumber;
                    busi.NAME    = param.Name;
                    busi.NATION  = param.Nationality;
                }
                _db.SaveChanges();
                return(new CommonResult {
                    StatusCode = "000000", Result = ""
                });
            }
            catch (Exception ex)
            {
                Log.Error("IdentityInforQuery", ex);
                return(new CommonResult {
                    StatusCode = "000003", Result = ex.Message
                });
            }
        }
コード例 #5
0
        public AcquireIdentityInforResult AcquireIdentityInfor([FromBody] AcquireIdentityInforRequest param)
        {
            try
            {
                if (param == null)
                {
                    return(new AcquireIdentityInforResult {
                        StatusCode = "000003", Result = "请求错误,请检查输入参数!"
                    });
                }
                Log.Info("AcquireIdentityInfor input:" + JsonConvert.SerializeObject(param));
                LogIntoDb.Log(_db, param.UserName, "AcquireIdentityInfor", JsonConvert.SerializeObject(param));

                var busi = _db.POPULATION.FirstOrDefault(q => q.IDNUM == param.IdentityCardNumber);
                if (busi == null)
                {
                    return(new AcquireIdentityInforResult {
                        StatusCode = "000019", Result = "没有找到相关人员信息 !"
                    });
                }
                var gender = Gender.Unknown;
                Enum.TryParse(busi.SEX, out gender);
                return(new AcquireIdentityInforResult
                {
                    StatusCode = "000000",
                    Result = "",
                    Address = busi.ADDRESS, Name = busi.NAME,
                    Gender = gender,
                    Nationality = busi.NATION,
                    Birthday = busi.BORN,
                    Postcode = busi.POSTCODE,
                    PostAddress = busi.POSTADDRESS,
                    Mobile = busi.MOBILE,
                    Telephone = busi.TELEPHONE,
                    Email = busi.EMAIL,
                    IdentityCardNumber = busi.IDNUM,
                    FingerprintOne = busi.FIRSTFINGER,
                    FingerprintTwo = busi.SECONDFINGER,
                    IrisRight = busi.RIGHTEYE,
                    IrisLeft = busi.LEFTEYE,
                });
            }
            catch (Exception ex)
            {
                Log.Error("AcquireIdentityInfor", ex);
                return(new AcquireIdentityInforResult {
                    StatusCode = "000003", Result = ex.Message
                });
            }
        }
コード例 #6
0
        public PhoneQueryResult PhoneQueryById([FromBody] IndentityInforQuery param)
        {
            try
            {
                if (param == null)
                {
                    return(new PhoneQueryResult {
                        StatusCode = "000003", Result = "请求错误,请检查输入参数!"
                    });
                }
                Log.Info("PhoneQueryById input:" + JsonConvert.SerializeObject(param));
                LogIntoDb.Log(_db, param.UserName, "PhoneQueryById", JsonConvert.SerializeObject(param));
                //if (!PermissionCheck.CheckLevelPermission(param, _dbuUserDbc))
                //{
                //    return new CommonResult { StatusCode = "000007", Result = "没有权限" };
                //}


                var busi = _db.POPULATION.FirstOrDefault(q => q.IDNUM == param.IdentityCardNumber);
                if (busi == null)
                {
                    return(new PhoneQueryResult {
                        StatusCode = "000019", Result = "没有找到相关人员信息 !"
                    });
                }

                return(new PhoneQueryResult {
                    StatusCode = "000000", Result = "", Address = busi.ADDRESS, Name = busi.NAME, PhoneNumber = busi.MOBILE
                });
            }
            catch (Exception ex)
            {
                Log.Error("PhoneQueryById", ex);
                return(new PhoneQueryResult {
                    StatusCode = "000003", Result = ex.Message
                });
            }
        }
コード例 #7
0
        public BusinessVolumeQueryResult BusinessVolumeQuery([FromBody] BusinessVolumeQuery param)
        {
            try
            {
                if (param == null)
                {
                    return(new BusinessVolumeQueryResult {
                        StatusCode = "000003", Result = "请求错误,请检查输入参数!"
                    });
                }

                Log.Info("BusinessVolumeQuery input:" + JsonConvert.SerializeObject(param));//file roll log

                LogIntoDb.Log(_db, param.UserName, "BusinessVolumeQuery", JsonConvert.SerializeObject(param));

                //if (!PermissionCheck.CheckLevelPermission(param, _dbuUserDbc))
                //{
                //    return new ResultModel { StatusCode = "000007", Result = "没有权限" };
                //}

                var userlist  = _db.USERS.Where(q => q.COUNTYCODE == param.CountyCode);
                var retlist   = new List <OneUserVolume>();
                var startdate = DateTime.Parse(param.StartTime);
                var endtime   = DateTime.Parse(param.EndTime);

                switch (param.CountyCode.ToLower())
                {
                case "changdao": retlist.AddRange(from oneUsers in userlist
                                                  let count = _db.BUSINESS_CHANGDAO.Count(q => q.UPLOADER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                              let processcount = _db.BUSINESS_CHANGDAO.Count(q => q.PROCESS_USER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                                                 let completecount = _db.BUSINESS_CHANGDAO.Count(q => q.COMPLETE_PAY_USER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                                                                     select new OneUserVolume {
                        UserName = oneUsers.USERNAME, UploadVolume = count, ProcessVolume = processcount, CompletePayVolume = completecount
                    });
                    return(new BusinessVolumeQueryResult {
                        StatusCode = "000000", Result = "", Volumes = retlist
                    });

                case "zhaoyuan": retlist.AddRange(from oneUsers in userlist
                                                  let count = _db.BUSINESS_ZHAOYUAN.Count(q => q.UPLOADER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                              let processcount = _db.BUSINESS_ZHAOYUAN.Count(q => q.PROCESS_USER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                                                 let completecount = _db.BUSINESS_ZHAOYUAN.Count(q => q.COMPLETE_PAY_USER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                                                                     select new OneUserVolume {
                        UserName = oneUsers.USERNAME, UploadVolume = count, ProcessVolume = processcount, CompletePayVolume = completecount
                    });
                    return(new BusinessVolumeQueryResult {
                        StatusCode = "000000", Result = "", Volumes = retlist
                    });

                case "penglai": retlist.AddRange(from oneUsers in userlist
                                                 let count = _db.BUSINESS_PENGLAI.Count(q => q.UPLOADER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                             let processcount = _db.BUSINESS_PENGLAI.Count(q => q.PROCESS_USER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                                                let completecount = _db.BUSINESS_PENGLAI.Count(q => q.COMPLETE_PAY_USER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                                                                    select new OneUserVolume {
                        UserName = oneUsers.USERNAME, UploadVolume = count, ProcessVolume = processcount, CompletePayVolume = completecount
                    });
                    return(new BusinessVolumeQueryResult {
                        StatusCode = "000000", Result = "", Volumes = retlist
                    });

                case "laizhou": retlist.AddRange(from oneUsers in userlist
                                                 let count = _db.BUSINESS_LAIZHOU.Count(q => q.UPLOADER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                             let processcount = _db.BUSINESS_LAIZHOU.Count(q => q.PROCESS_USER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                                                let completecount = _db.BUSINESS_LAIZHOU.Count(q => q.COMPLETE_PAY_USER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                                                                    select new OneUserVolume {
                        UserName = oneUsers.USERNAME, UploadVolume = count, ProcessVolume = processcount, CompletePayVolume = completecount
                    });
                    return(new BusinessVolumeQueryResult {
                        StatusCode = "000000", Result = "", Volumes = retlist
                    });

                case "laiyang":
                    retlist.AddRange(from oneUsers in userlist
                                     let count = _db.BUSINESS_LAIYANG.Count(q => q.UPLOADER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                 let processcount = _db.BUSINESS_LAIYANG.Count(q => q.PROCESS_USER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                                    let completecount = _db.BUSINESS_LAIYANG.Count(q => q.COMPLETE_PAY_USER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                                                        select new OneUserVolume {
                        UserName = oneUsers.USERNAME, UploadVolume = count, ProcessVolume = processcount, CompletePayVolume = completecount
                    });
                    return(new BusinessVolumeQueryResult {
                        StatusCode = "000000", Result = "", Volumes = retlist
                    });

                case "longkou": retlist.AddRange(from oneUsers in userlist
                                                 let count = _db.BUSINESS_LONGKOU.Count(q => q.UPLOADER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                             let processcount = _db.BUSINESS_LONGKOU.Count(q => q.PROCESS_USER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                                                let completecount = _db.BUSINESS_LONGKOU.Count(q => q.COMPLETE_PAY_USER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                                                                    select new OneUserVolume {
                        UserName = oneUsers.USERNAME, UploadVolume = count, ProcessVolume = processcount, CompletePayVolume = completecount
                    });
                    return(new BusinessVolumeQueryResult {
                        StatusCode = "000000", Result = "", Volumes = retlist
                    });

                case "muping": retlist.AddRange(from oneUsers in userlist
                                                let count = _db.BUSINESS_MUPING.Count(q => q.UPLOADER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                            let processcount = _db.BUSINESS_MUPING.Count(q => q.PROCESS_USER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                                               let completecount = _db.BUSINESS_MUPING.Count(q => q.COMPLETE_PAY_USER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                                                                   select new OneUserVolume {
                        UserName = oneUsers.USERNAME, UploadVolume = count, ProcessVolume = processcount, CompletePayVolume = completecount
                    });
                    return(new BusinessVolumeQueryResult {
                        StatusCode = "000000", Result = "", Volumes = retlist
                    });

                case "laishan": retlist.AddRange(from oneUsers in userlist
                                                 let count = _db.BUSINESS_LAISHAN.Count(q => q.UPLOADER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                             let processcount = _db.BUSINESS_LAISHAN.Count(q => q.PROCESS_USER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                                                let completecount = _db.BUSINESS_LAISHAN.Count(q => q.COMPLETE_PAY_USER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                                                                    select new OneUserVolume {
                        UserName = oneUsers.USERNAME, UploadVolume = count, ProcessVolume = processcount, CompletePayVolume = completecount
                    });
                    return(new BusinessVolumeQueryResult {
                        StatusCode = "000000", Result = "", Volumes = retlist
                    });

                case "qixia": retlist.AddRange(from oneUsers in userlist
                                               let count = _db.BUSINESS_QIXIA.Count(q => q.UPLOADER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                           let processcount = _db.BUSINESS_QIXIA.Count(q => q.PROCESS_USER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                                              let completecount = _db.BUSINESS_QIXIA.Count(q => q.COMPLETE_PAY_USER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                                                                  select new OneUserVolume {
                        UserName = oneUsers.USERNAME, UploadVolume = count, ProcessVolume = processcount, CompletePayVolume = completecount
                    });
                    return(new BusinessVolumeQueryResult {
                        StatusCode = "000000", Result = "", Volumes = retlist
                    });

                case "fushan":
                    retlist.AddRange(from oneUsers in userlist
                                     let count = _db.BUSINESS_FUSHAN.Count(q => q.UPLOADER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                 let processcount = _db.BUSINESS_FUSHAN.Count(q => q.PROCESS_USER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                                    let completecount = _db.BUSINESS_FUSHAN.Count(q => q.COMPLETE_PAY_USER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                                                        select new OneUserVolume {
                        UserName = oneUsers.USERNAME, UploadVolume = count, ProcessVolume = processcount, CompletePayVolume = completecount
                    });
                    return(new BusinessVolumeQueryResult {
                        StatusCode = "000000", Result = "", Volumes = retlist
                    });

                case "haiyang": retlist.AddRange(from oneUsers in userlist
                                                 let count = _db.BUSINESS_HAIYANG.Count(q => q.UPLOADER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                             let processcount = _db.BUSINESS_HAIYANG.Count(q => q.PROCESS_USER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                                                let completecount = _db.BUSINESS_HAIYANG.Count(q => q.COMPLETE_PAY_USER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                                                                    select new OneUserVolume {
                        UserName = oneUsers.USERNAME, UploadVolume = count, ProcessVolume = processcount, CompletePayVolume = completecount
                    });
                    return(new BusinessVolumeQueryResult {
                        StatusCode = "000000", Result = "", Volumes = retlist
                    });

                case "zhifu":
                case "shisuo":
                case "dacheng":
                    retlist.AddRange(from oneUsers in userlist
                                     let count = _db.ZHIFUBUSINESS.Count(q => q.UPLOADER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                 let processcount = _db.ZHIFUBUSINESS.Count(q => q.PROCESS_USER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                                    let completecount = _db.ZHIFUBUSINESS.Count(q => q.COMPLETE_PAY_USER == oneUsers.USERNAME && q.START_TIME.CompareTo(startdate) >= 0 && q.END_TIME.CompareTo(endtime) <= 0)
                                                                                        select new OneUserVolume {
                        UserName = oneUsers.USERNAME, UploadVolume = count, ProcessVolume = processcount, CompletePayVolume = completecount
                    });
                    return(new BusinessVolumeQueryResult {
                        StatusCode = "000000", Result = "", Volumes = retlist
                    });

                    break;

                default:
                    return(new BusinessVolumeQueryResult {
                        StatusCode = "000000", Result = ""
                    });

                    break;
                }
            }
            catch (Exception ex)
            {
                Log.Error("BusinessVolumeQuery", ex);
                return(new BusinessVolumeQueryResult {
                    StatusCode = "000003", Result = ex.Message
                });
            }
        }
コード例 #8
0
        public SimpleResult UserTransaction([FromBody] UserTransaction param)
        {
            try
            {
                if (param == null)
                {
                    return(new SimpleResult {
                        StatusCode = "000003", Content = "请求错误,请检查输入参数!"
                    });
                }
                if (string.IsNullOrEmpty(param.UserName))
                {
                    return(new SimpleResult {
                        StatusCode = "000003", Content = "请求错误,业务操作用户输入不合法!"
                    });
                }
                LogIntoDb.Log(_dbLog, param.UserName, param.UserTransactionType.ToString(), param);
                var theuser =
                    _db.USERS.FirstOrDefault(a => a.USERNAME == param.UserName);
                if (theuser == null)
                {
                    return(new SimpleResult {
                        StatusCode = "000005", Content = "无此用户:" + param.UserName
                    });
                }
                if (theuser.DISABLED != true)
                {
                    return(new SimpleResult {
                        StatusCode = "000014", Content = "用户已经停用"
                    });
                }
                if (theuser.PASSWORD != CdmEncrypt.Encrypt(param.Password))
                {
                    return(new SimpleResult {
                        StatusCode = "000004", Content = "密码错误"
                    });
                }

                //   Log.Info("UserTransaction input:" + JsonConvert.SerializeObject(param));
                if (param.UserTransactionType == UserTransactionType.Login)
                {
                    return(new SimpleResult
                    {
                        StatusCode = "000000",
                        Content = "ok",
                        Users =
                        {
                            new PoliceUser
                            {
                                AuthorityLevel = (AuthorityLevel)int.Parse(theuser.AUTHORITYLEVEL),
                                RealName = theuser.REALNAME,
                                CountyCode = theuser.COUNTYCODE,
                                Permission = JsonConvert.DeserializeObject <Dictionary <string, bool> >(theuser.LIMIT),
                                PoliceCode = theuser.POLICENUM
                            }
                        }
                    });
                }
                if (!PermissionCheck.CheckLevelPermission(param, theuser))
                //if (!PermissionCheck.CheckLevelPermission(param, _db))
                {
                    return(new SimpleResult {
                        StatusCode = "000007", Content = "没有权限"
                    });
                }
                var userslist = new List <PoliceUser>();
                switch (param.UserTransactionType)
                {
                case UserTransactionType.Add:

                    var u = new USERS
                    {
                        AUTHORITYLEVEL = ((int)param.UserInfo.AuthorityLevel).ToString(),
                        COUNTYCODE     = param.UserInfo.CountyCode,
                        LIMIT          = JsonConvert.SerializeObject(param.UserInfo.Permission),
                        PASSWORD       = CdmEncrypt.Encrypt("888888"),
                        POLICENUM      = param.UserInfo.PoliceCode,
                        ID             = new Random().Next(),
                        DEPARTMENT     = " ff",
                        POST           = param.UserInfo.UserRole.ToString(),
                        DISABLED       = true,
                        USERNAME       = param.UserInfo.UserName,
                        REALNAME       = param.UserInfo.RealName,
                    };

                    _db.USERS.Add(u);
                    _db.SaveChanges();

                    break;

                case UserTransactionType.Disable:

                    var disableuser =
                        _db.USERS.FirstOrDefault(a => a.USERNAME == param.UserInfo.UserName);
                    if (disableuser == null)
                    {
                        return(new SimpleResult {
                            StatusCode = "000005", Content = "无此用户:" + param.UserInfo.UserName
                        });
                    }
                    disableuser.DISABLED = false;
                    _db.SaveChanges();

                    break;

                case UserTransactionType.Update:

                    var userUpdate =
                        _db.USERS.FirstOrDefault(a => a.USERNAME == param.UserInfo.UserName);
                    if (userUpdate == null)
                    {
                        return(new SimpleResult {
                            StatusCode = "000005", Content = "无此用户:" + param.UserInfo.UserName
                        });
                    }
                    userUpdate.REALNAME       = param.UserInfo.RealName;
                    userUpdate.COUNTYCODE     = param.UserInfo.CountyCode;
                    userUpdate.POST           = ((int)param.UserInfo.UserRole).ToString();
                    userUpdate.AUTHORITYLEVEL = ((int)param.UserInfo.AuthorityLevel).ToString();
                    userUpdate.LIMIT          = JsonConvert.SerializeObject(param.UserInfo.Permission);
                    _db.SaveChanges();

                    break;

                case UserTransactionType.ChangePass:

                    var userPu =
                        _db.USERS.FirstOrDefault(a => a.USERNAME == param.UserInfo.UserName);
                    if (userPu == null)
                    {
                        return(new SimpleResult {
                            StatusCode = "000005", Content = "无此用户:" + param.UserInfo.UserName
                        });
                    }
                    userPu.PASSWORD = CdmEncrypt.Encrypt(param.UserInfo.Password);
                    _db.SaveChanges();

                    break;

                case UserTransactionType.ResetPass:

                    var rpUser =
                        _db.USERS.FirstOrDefault(a => a.USERNAME == param.UserInfo.UserName);
                    if (rpUser == null)
                    {
                        return(new SimpleResult {
                            StatusCode = "000005", Content = "无此用户:" + param.UserInfo.UserName
                        });
                    }
                    rpUser.PASSWORD = CdmEncrypt.Encrypt("888888");
                    _db.SaveChanges();

                    break;
                //case UserTransactionType.GetUserList:
                //    using (var userdb = new UserDbc())
                //    {
                //        var theuser =
                //            userdb.USERS.Where(a => a.COUNTYCODE == param.UserInfo.CountyCode);
                //        userslist.AddRange(theuser.Select(users => new PoliceUser
                //        {
                //          //  AuthorityLevel = (AuthorityLevel) int.Parse(users.AUTHORITYLEVEL),
                //            CountyCode = users.COUNTYCODE,
                //            Notation = string.Empty,
                //         //   Permission = JsonConvert.DeserializeObject<Dictionary<string, bool>>(users.LIMIT),
                //            PoliceCode = users.POLICENUM,
                //            RealName = users.REALNAME,
                //            UserName = users.USERNAME,
                //          //  UserRole = (UserRole) int.Parse(users.POST)
                //        }));
                //    }

                //    return new SimpleResult { StatusCode = "000000", Content = "", Users = userslist };
                //    break;
                //default:// for test
                case UserTransactionType.GetUserList:

                    var getuser =
                        _db.USERS.Where(a => a.COUNTYCODE == param.UserInfo.CountyCode);
                    foreach (USERS users in getuser)
                    {
                        var pu = new PoliceUser();
                        //   Log.InfoFormat("from db:{0}", users.LIMIT);
                        pu.Permission     = JsonConvert.DeserializeObject <Dictionary <string, bool> >(users.LIMIT);
                        pu.CountyCode     = users.COUNTYCODE;
                        pu.Notation       = string.Empty;
                        pu.PoliceCode     = users.POLICENUM;
                        pu.RealName       = users.REALNAME;
                        pu.UserName       = users.USERNAME;
                        pu.Disabled       = users.DISABLED;
                        pu.AuthorityLevel = (AuthorityLevel)int.Parse(users.AUTHORITYLEVEL);
                        userslist.Add(pu);
                    }
                    //userslist.AddRange(theuser.Select(users => new PoliceUser
                    //{
                    //    //  AuthorityLevel = (AuthorityLevel) int.Parse(users.AUTHORITYLEVEL),
                    //    CountyCode = users.COUNTYCODE,
                    //    Notation = string.Empty,
                    //       Permission = JsonConvert.DeserializeObject<Dictionary<string, bool>>(users.LIMIT),
                    //    PoliceCode = users.POLICENUM,
                    //    RealName = users.REALNAME,
                    //    UserName = users.USERNAME,
                    //    //  UserRole = (UserRole) int.Parse(users.POST)
                    //}));
                    // Task.Run( () => LogIntoDb.Log(_dbLog, param.UserName, DateTime.Now, param.UserTransactionType.ToString(), JsonConvert.SerializeObject(param)));
                    //  LogIntoDb.Log(_dbLog, param.UserName,  param.UserTransactionType.ToString(), param);
                    return(new SimpleResult {
                        StatusCode = "000000", Content = "", Users = userslist
                    });

                    break;
                }
                //  Log.Info("before ok----------------");
                //  LogIntoDb.Log(_dbLog, param.UserName,param.UserTransactionType.ToString(), param);
                return(new SimpleResult {
                    StatusCode = "000000", Content = "ok"
                });
            }
            catch (DbEntityValidationException e)
            {
                var err = string.Empty;
                foreach (var eve in e.EntityValidationErrors)
                {
                    var err1 =
                        string.Format("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                      eve.Entry.Entity.GetType().Name, eve.Entry.State);
                    err += err1;
                    Log.InfoFormat(err1);
                    foreach (var ve in eve.ValidationErrors)
                    {
                        var err2 = string.Format("- Property: \"{0}\", Error: \"{1}\"",
                                                 ve.PropertyName, ve.ErrorMessage);
                        Log.InfoFormat(err2);
                        err += err2;
                    }
                }
                return(new SimpleResult {
                    StatusCode = "000003", Content = "DbEntityValidationException:" + err
                });
            }
            catch (EntityDataSourceValidationException ex)
            {
                Log.Error("EntityDataSourceValidationException", ex);
                return(new SimpleResult {
                    StatusCode = "000003", Content = "EntityDataSourceValidationException:" + ex.Message
                });
            }
            catch (OracleException ex)
            {
                Log.Error("OracleException", ex);
                return(new SimpleResult {
                    StatusCode = "000003", Content = "OracleException:" + ex.Message
                });
            }
            catch (DbUpdateException ex)
            {
                Log.Error("DbUpdateException", ex);
                return(new SimpleResult {
                    StatusCode = "000003", Content = "DbUpdateException:" + (ex.ToString().Contains("违反唯一约束条件 (CITY.USERSNAME)") ? "用户名已经存在" : ex.ToString())
                });
            }
            catch (Exception ex)
            {
                Log.Error("UserTransaction", ex);
                return(new SimpleResult {
                    StatusCode = "000003", Content = ex.Message
                });
            }
        }
コード例 #9
0
ファイル: CarsController.cs プロジェクト: FinchYang/study
        public async Task <ResultModel> PostBusinessFormInfo([FromBody] BusinessModel param)
        {
            try
            {
                if (param == null)
                {
                    return(new ResultModel {
                        StatusCode = "000003", Result = "请求错误,请检查输入参数!"
                    });
                }
                if (!PermissionCheck.CheckLevelPermission(param, _dbUserDbc))
                //  if (!PermissionCheck.Check(param))
                {
                    return(new ResultModel {
                        StatusCode = "000007", Result = "没有权限"
                    });
                }
                LogIntoDb.Log(_dbLog, param.userName, param.type.ToString(CultureInfo.InvariantCulture), JsonConvert.SerializeObject(param));

                Log.Info("PostBusinessFormInfo input is:" + JsonConvert.SerializeObject(param));
                var currentdate  = DateTime.Now.Date;
                var scurrentdate = string.Format("{0}-{1}-{2}", currentdate.Year, currentdate.Month, currentdate.Day);
                var id           = InternalService.GetBusinessId(); //+param.checkFile;//test only
                //Log.Info("path 11 =" + id);
                //if (!string.IsNullOrEmpty(param.fileName))
                //{
                //    var filepath = string.Format("{2}{0}\\{1}\\{3}", param.countyCode, scurrentdate, CdmConfiguration.FileRootPath, param.ID);

                //    if (!Directory.Exists(@filepath))
                //    {
                //        Log.Info("path=" + filepath);
                //        Directory.CreateDirectory(@filepath);
                //    }
                //    var filename = string.Format("{0}\\{1}", filepath, param.fileName);
                //    Log.Info("file name=" + filename);
                //    File.WriteAllBytes(filename, param.zipFile);
                //    return new ResultModel { StatusCode = "000000", BussinessModel = new BusinessModel{ID = param.ID,fileName=param.fileName} };
                //}
                param.status = (int)BusinessStatus.Upload;

                switch (param.countyCode.ToLower())
                {
                case "changdao":  ChangdaoPostFormInfo(param, id); break;

                case "zhaoyuan":  ZhaoyuanPostFormInfo(param, id); break;

                case "penglai":  PenglaiPostFormInfo(param, id); break;

                case "laizhou":  LaizhouPostFormInfo(param, id); break;

                case "laiyang":  LaiyangPostFormInfo(param, id); break;

                case "longkou":  LongkouPostFormInfo(param, id); break;

                case "muping":  MupingPostFormInfo(param, id); break;

                case "laishan":  LaishanPostFormInfo(param, id); break;

                case "qixia":  QixiaPostFormInfo(param, id); break;

                case "fushan":  FushanPostFormInfo(param, id); break;

                case "haiyang":  HaiyangPostFormInfo(param, id); break;

                case "zhifu":
                case "shisuo":
                case "dacheng":
                    ZhifuPostFormInfo(param, id);
                    break;

                default:

                    return(new ResultModel {
                        StatusCode = "000016", Result = "没有该县区标识" + param.countyCode
                    });
                }

                await Task.Run(async() =>
                {
                    if (param.status == (int)BusinessStatus.Reject)
                    {
                        await MessagePush.PushVoiceMessage(new CdmMessage
                        {
                            ClientType = ClientType.Voice,
                            Content    = param.queueNum,
                            CountyCode = param.countyCode,
                            VoiceType  = VoiceType.Reject
                        });
                        await MessagePush.PushLedMessage(new CdmMessage
                        {
                            ClientType = ClientType.Led,
                            Content    = param.queueNum,
                            CountyCode = param.countyCode,
                            LedMsgType = LedMsgType.Reject
                        });
                    }
                    if (param.status == (int)BusinessStatus.Fee)
                    {
                        await MessagePush.PushVoiceMessage(new CdmMessage
                        {
                            ClientType = ClientType.Voice,
                            Content    = param.queueNum,
                            CountyCode = param.countyCode,
                            VoiceType  = VoiceType.Fee
                        });
                        await MessagePush.PushLedMessage(new CdmMessage
                        {
                            ClientType = ClientType.Led,
                            Content    = param.queueNum,
                            CountyCode = param.countyCode,
                            LedMsgType = LedMsgType.Done
                        });
                    }
                    if (param.status == (int)BusinessStatus.Processing)
                    {
                        await MessagePush.PushLedMessage(new CdmMessage
                        {
                            ClientType = ClientType.Led,
                            Content    = param.queueNum,
                            CountyCode = param.countyCode,
                            LedMsgType = LedMsgType.Processing
                        });
                    }
                });

                ;
                return(new ResultModel {
                    StatusCode = "000000", BussinessModel = new BusinessModel {
                        ID = id
                    }
                });
            }
            catch (DbEntityValidationException e)
            {
                var err = string.Empty;
                foreach (var eve in e.EntityValidationErrors)
                {
                    var err1 =
                        string.Format("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                      eve.Entry.Entity.GetType().Name, eve.Entry.State);
                    err += err1;
                    Log.InfoFormat(err1);
                    foreach (var ve in eve.ValidationErrors)
                    {
                        var err2 = string.Format("- Property: \"{0}\", Error: \"{1}\"",
                                                 ve.PropertyName, ve.ErrorMessage);
                        Log.InfoFormat(err2);
                        err += err2;
                    }
                }
                return(new ResultModel {
                    StatusCode = "000003", Result = "DbEntityValidationException:" + err
                });
            }
            catch (EntityDataSourceValidationException ex)
            {
                Log.Error("EntityDataSourceValidationException", ex);
                return(new ResultModel {
                    StatusCode = "000003", Result = ex.Message
                });
            }
            catch (Exception ex)
            {
                Log.Error("PostBusinessFormInfo", ex);
                return(new ResultModel {
                    StatusCode = "000003", Result = ex.Message
                });
            }
        }