public BaseResponse <GetOfficerScoreDetailInfoResult> GetOfficerScoreDetailInfo(GetOfficerScoreDetailInfoParameter parameter)
 {
     if (Validate(parameter))
     {
         return(officerManager.GetOfficerScoreDetailInfo(parameter));
     }
     else
     {
         BaseResponse <GetOfficerScoreDetailInfoResult> response = new BaseResponse <GetOfficerScoreDetailInfoResult>();
         response.IsSuccessful = false;
         response.Reason       = "JWT_ERR";
         return(response);
     }
 }
Ejemplo n.º 2
0
        public BaseResponse <GetOfficerScoreDetailInfoResult> GetOfficerScoreDetailInfo(GetOfficerScoreDetailInfoParameter parameter)
        {
            BaseResponse <GetOfficerScoreDetailInfoResult> response = new BaseResponse <GetOfficerScoreDetailInfoResult>();
            GetOfficerScoreDetailInfoResult result = new GetOfficerScoreDetailInfoResult();

            try
            {
                //字典表缓存
                var scoreItemArray = scoreItemRepository.GetDatas <ScoreItem>(t => !t.IsDeleted, true).ToList();
                var officer        = officerRepository.GetDatas <Officer>(t => t.OfficerID == parameter.OfficerID && !t.IsDeleted, true).FirstOrDefault();
                if (officer == null)
                {
                    response.IsSuccessful = false;
                    response.Reason       = "获取干部积分信息数据异常";
                    return(response);
                }

                result.OfficerID    = officer.OfficerID;
                result.InitialScore = officer.InitialScore;
                result.CurrentScore = officer.CurrentScore;

                //获取此干部 已通过审批(审批通过或者驳回)的积分申请项
                var applovedScoreApplyList = scoreApplyRepository.GetDatas <ScoreApply>(t => !t.IsDeleted && t.OfficerID == parameter.OfficerID && t.ApplyStatus == (int)EnumApproveStatus.Pass, true).ToList();
                if (applovedScoreApplyList != null && applovedScoreApplyList.Any())
                {
                    applovedScoreApplyList.ForEach(t =>
                    {
                        ApplyItemInfo applyItenInfo = new ApplyItemInfo();
                        applyItenInfo.ApplyID       = t.ApplyID;
                        applyItenInfo.ApplyStatus   = t.ApplyStatus;

                        var scoreItem = scoreItemArray.Where(tt => tt.ItemID == t.ItemID).FirstOrDefault();
                        if (scoreItem != null)
                        {
                            applyItenInfo.ItemID          = scoreItem.ItemID;
                            applyItenInfo.ItemScore       = t.ItemScore;//scoreItem.ItemScore;
                            applyItenInfo.ItemDescription = scoreItem.ItemDescription;
                        }

                        result.ApprovedApplyItemList.Add(applyItenInfo);
                    });
                }
                //获取此干部 通过未进行审批(审批中)的积分申请项
                var applovingScoreApplyList = scoreApplyRepository.GetDatas <ScoreApply>(t => !t.IsDeleted && t.OfficerID == parameter.OfficerID && t.ApplyStatus == (int)EnumApproveStatus.Approving, true).ToList();
                if (applovingScoreApplyList != null && applovingScoreApplyList.Any())
                {
                    applovingScoreApplyList.ForEach(t =>
                    {
                        ApplyItemInfo applyItenInfo = new ApplyItemInfo();
                        applyItenInfo.ApplyID       = t.ApplyID;
                        applyItenInfo.ApplyStatus   = t.ApplyStatus;

                        var scoreItem = scoreItemArray.Where(tt => tt.ItemID == t.ItemID).FirstOrDefault();
                        if (scoreItem != null)
                        {
                            applyItenInfo.ItemID          = scoreItem.ItemID;
                            applyItenInfo.ItemScore       = t.ItemScore; //scoreItem.ItemScore;
                            applyItenInfo.ItemDescription = scoreItem.ItemDescription;
                        }

                        result.ApprovingApplyItemList.Add(applyItenInfo);
                    });
                }

                #region 操作日志
                new LogManager().AddOperationLog(parameter.CurrentUserID, "获取干部积分信息", parameter.RequestIP);
                #endregion

                response.Result = result;
                return(response);
            }
            catch (Exception e)
            {
                response.IsSuccessful = false;
                response.Reason       = "获取干部积分信息发生异常";
                return(response);
            }
        }