/// <summary>
        /// 活动处理方法
        /// </summary>
        /// <param name="codeActive">码活动信息对象</param>
        /// <param name="activityCodes">码活动信息集合</param>
        public void ActionProcess <T>(CodeActive codeActive, List <T> activityCodes) where T : ActivityCodes
        {
            CodeApply codeApply = CodeApplyFactory.Instance.GetApply(codeActive.ApplyId);

            if (codeApply.ApplyType == 2)//外部平台码
            {
                string[] tempStrings = codeApply.CodeRulesIDs.Split(new char[] { '|' });
                int      ruleSegId   = 0;
                if (tempStrings.Length > 0 && int.TryParse(tempStrings[0], out ruleSegId))
                {
                    List <CodeRuleSeg> ruleSegs = CodeRuleSegFactory.Instance.GetByCodeRuleId(ruleSegId);
                    if (ruleSegs.Count > 0)
                    {
                        Type type = Assembly.Load(new AssemblyName("Acctrue.CMC.CodeBuild")).GetType(ruleSegs[0].ClassName);

                        IOtherFlatformSeg seg = (Activator.CreateInstance(type) as IOtherFlatformSeg);
                        seg.Initialize(Newtonsoft.Json.JsonConvert.DeserializeObject <List <Acctrue.CMC.Model.Code.ParameterInfo> >(ruleSegs[0].ClassArgs));
                        string mess = string.Empty;
                        if (seg.EcodeActivate(activityCodes.Select(s => s.Code).ToList(), codeActive, out mess))
                        {
                        }
                        else
                        {
                            throw new Exception($"码激活任务Id:{codeActive.CodeActivityId}进行外部平台激活同步失败:{mess}");
                        }
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 码申请处理申请工作
        /// </summary>
        /// <param name="codeApply">码申请信息</param>
        /// <param name="ct"></param>
        public static void ApplyGenerateWork(CodeApply codeApply, CancellationToken ct)
        {
            CodeService.logger.Log(LogLevel.Info, $"处理码申请Id:{codeApply.ApplyId},申请工作");

            #region 初始化码申请码规则处理表ApplyRuleProcess数据
            //获取码规则ID
            int[] ruleIds = Array.ConvertAll <string, int>(codeApply.CodeRulesIDs.Split(new char[] { '|' }), int.Parse);
            //获取处理程序
            List <ApplyRuleProcess> allApplyRuleProcess = ApplyRuleProcessFactory.Instance.GetCodeRuleByApplyId(codeApply.ApplyId);
            for (int i = 0; i < ruleIds.Length; i++)
            {
                if (allApplyRuleProcess.Count <= i)
                {
                    //生成APPLY - RULE - PROCESSOR
                    ApplyRuleProcess ruleProcess = new ApplyRuleProcess()
                    {
                        ApplyId = codeApply.ApplyId, CodeRuleId = ruleIds[i], Status = ApplyRuleStatus.None, AttributeInfo = string.Empty, EndCode = string.Empty, FirstCode = string.Empty
                    };
                    ApplyRuleProcessFactory.Instance.Add(ruleProcess);
                }
            }
            #endregion
            ApplyProcesser applyProcess = new ApplyProcesser(codeApply);
            applyProcess.LoadData();
            applyProcess.ApplyGenerate();
            codeApply.ProcessType = ProcessType.Applied;
            CodeService.logger.Log(LogLevel.Info, $"完成码申请Id:{codeApply.ApplyId},申请工作");
        }
Beispiel #3
0
        public CMCResponse UpdateApply(Dictionary <string, object> dic)
        {
            string    json = dic["data"].ToString();
            CodeApply c    = JsonConvert.DeserializeObject <CodeApply>(json);

            Response.data = CodeApplyFactory.Instance.WebUpdate(c);
            return(Response);
        }
Beispiel #4
0
        /// <summary>
        /// 码申请存储码结果
        /// </summary>
        /// <param name="codeApply">码申请信息</param>
        /// <param name="ct"></param>
        public static void ApplyCodesStore(CodeApply codeApply, CancellationToken ct)
        {
            CodeService.logger.Log(LogLevel.Info, $"处理码申请Id:{codeApply.ApplyId},存储码结果");
            ApplyProcesser applyProcess = new ApplyProcesser(codeApply);

            applyProcess.LoadData();
            applyProcess.CodesStore();
            CodeService.logger.Log(LogLevel.Info, $"完成码申请Id:{codeApply.ApplyId},存储码结果");
        }
Beispiel #5
0
        /// <summary>
        /// 码申请保存单个码信息
        /// </summary>
        /// <param name="codeApply">码申请信息</param>
        /// <param name="ct"></param>
        public static void ApplySaveBySingleCode(CodeApply codeApply, CancellationToken ct)
        {
            CodeService.logger.Log(LogLevel.Info, $"处理码申请Id:{codeApply.ApplyId},保存单个码信息");
            ApplyProcesser applyProcess = new ApplyProcesser(codeApply);

            applyProcess.LoadData();
            applyProcess.SaveBySingleCode(ct);
            CodeService.logger.Log(LogLevel.Info, $"完成码申请Id:{codeApply.ApplyId},保存单个码信息");
        }
Beispiel #6
0
        /// <summary>
        /// 码申请验证申请完成
        /// </summary>
        /// <param name="codeApply">码申请信息</param>
        /// <param name="ct"></param>
        public static bool ApplyGenerateCompleted(CodeApply codeApply, CancellationToken ct)
        {
            CodeService.logger.Log(LogLevel.Info, $"处理码申请Id:{codeApply.ApplyId},验证申请完成工作");
            ApplyProcesser applyProcess = new ApplyProcesser(codeApply);

            applyProcess.LoadData();
            bool completed = applyProcess.GenerateCompleted();

            CodeService.logger.Log(LogLevel.Info, $"完成码申请Id:{codeApply.ApplyId},验证申请完成工作");
            return(completed);
        }
        /// <summary>
        /// 根据码申请信息格式化码段配置项
        /// </summary>
        /// <param name="codeApply">码申请</param>
        /// <param name="segs">码段配置集合</param>
        /// <param name="featureTag">特征标签</param>
        private void FormatSegs(CodeApply codeApply, List <CodeRuleSeg> segs, out string featureTag)
        {
            featureTag = string.Empty;
            string inputFlag = string.Empty;

            foreach (CodeRuleSeg seg in segs)
            {
                if (seg.ClassArgs == null)
                {
                    seg.ClassArgs = "";
                }
                inputFlag = "${" + Enum.GetName(typeof(UserInputFlags), UserInputFlags.CorpCode) + "}";
                if (seg.ClassArgs.Contains(inputFlag))
                {
                    seg.ClassArgs = seg.ClassArgs.Replace(inputFlag, codeApply.CorpCode);
                    featureTag   += codeApply.CorpCode;
                }

                inputFlag = "${" + Enum.GetName(typeof(UserInputFlags), UserInputFlags.ProductCode) + "}";
                if (seg.ClassArgs.Contains(inputFlag))
                {
                    seg.ClassArgs = seg.ClassArgs.Replace(inputFlag, codeApply.ProductCode);
                    featureTag   += codeApply.ProductCode;
                }

                inputFlag = "${" + Enum.GetName(typeof(UserInputFlags), UserInputFlags.WorklineCode) + "}";
                if (seg.ClassArgs.Contains(inputFlag))
                {
                    seg.ClassArgs = seg.ClassArgs.Replace(inputFlag, codeApply.ProduceWorkLine);
                    featureTag   += codeApply.ProduceWorkLine;
                }

                inputFlag = "${" + Enum.GetName(typeof(UserInputFlags), UserInputFlags.OtherCode) + "}";
                if (seg.ClassArgs.Contains(inputFlag))
                {
                    seg.ClassArgs = seg.ClassArgs.Replace(inputFlag, codeApply.UseSubCorpCode);
                    featureTag   += codeApply.UseSubCorpCode;
                }
            }
        }
 //private int singleRatioAmount;//一个比率单位的数量
 //private Dictionary<CodeRule, List<CodeRuleSeg>> codeRuleSegDict = new Dictionary<CodeRule, List<CodeRuleSeg>>();//码规则包含的码类配置信息
 public ApplyProcesser(CodeApply codeApply)
 {
     this.codeApply = codeApply;
 }