Esempio n. 1
0
 public HikdeviceController()
 {
     _hikInOutLogBll        = new HikinoutlogBLL();
     hikdevicebll           = new HikdeviceBLL();
     highriskcommonapplybll = new HighRiskCommonApplyBLL();
     departmentBLL          = new DepartmentBLL();
     workMeetingbll         = new WorkMeetingBLL();
 }
        public object WorkCommonDetail(string json)
        {
            try
            {
                string  res    = string.Empty;// json.Value<string>("json");[FromBody]JObject
                dynamic dy     = JsonConvert.DeserializeObject <ExpandoObject>(json);
                string  webUrl = dataitemdetailbll.GetItemValue("imgUrl");
                //获取用户Id
                string userId = dy.userid;
                OperatorProvider.AppUserId = userId;  //设置当前用户
                Operator curUser = OperatorProvider.Provider.Current();
                if (null == curUser)
                {
                    curUser = GetOperator(dy.userid);
                    if (curUser == null)
                    {
                        return(new { code = -1, count = 0, info = "当前用户不存在,请核对用户信息!" });
                    }
                }
                string applyid             = dy.data.applyid;//通用申请id
                var    commonentity        = new HighRiskCommonApplyBLL().GetEntity(applyid);
                List <HighRiskEntity> list = new List <HighRiskEntity>();
                //风险等级、作业类型
                var data  = dataitemdetailbll.GetDataItemListByItemCode("'CommonRiskType'").Where(a => a.ItemValue == commonentity.RiskType).FirstOrDefault();
                var data2 = dataitemdetailbll.GetDataItemListByItemCode("'CommonType'").Where(a => a.ItemValue == commonentity.WorkType).FirstOrDefault();

                if (commonentity != null && !string.IsNullOrEmpty(commonentity.WorkUserIds))
                {//作业人员
                    string[] users = commonentity.WorkUserIds.Split(',');
                    foreach (string rows in users)
                    {
                        if (string.IsNullOrEmpty(rows))
                        {
                            continue;
                        }
                        UserEntity user = userBLL.GetEntity(rows);
                        if (user == null)
                        {
                            continue;
                        }
                        HighRiskEntity entity = new HighRiskEntity();
                        entity.RiskType         = data.ItemName;
                        entity.EngineeringName  = commonentity.EngineeringName;
                        entity.WorkPlace        = commonentity.WorkPlace;
                        entity.WorkDeptName     = commonentity.WorkDeptName;
                        entity.WorkContent      = commonentity.WorkContent;
                        entity.ElectronPen      = "正常";
                        entity.WorkDutyUserName = commonentity.WorkDutyUserName;
                        entity.EnCode           = user.EnCode;
                        entity.RealName         = user.RealName;
                        entity.Gender           = user.Gender;
                        entity.ApplyDeptName    = commonentity.ApplyDeptName;
                        entity.WorkType         = data2.ItemName;
                        entity.Mobile           = user.Mobile;
                        entity.Place            = commonentity.WorkPlace;
                        entity.HeadIcon         = webUrl + user.HeadIcon;
                        list.Add(entity);
                    }
                }

                return(new
                {
                    code = 0,
                    count = 1,
                    info = "获取数据成功",
                    data = list.ToJson()
                });
            }
            catch (Exception ex)
            {
                return(new { code = -1, info = ex.Message, count = 0 });
            }
        }