public async Task <IActionResult> CreateDecorationRecordAsync([FromBody] CreateDecorationRecordRequestDto requestDto)
        {
            if (!requestDto.Rows.Any())
            {
                return(Failed(ErrorCode.UserData, "内容不可为空"));
            }
            var biz   = new DecorationBiz();
            var model = new DecorationModel
            {
                DecorationGuid     = Guid.NewGuid().ToString("N"),
                DecorationName     = requestDto.DecorationName,
                ClassificationGuid = requestDto.ClassificationGuid,
                Content            = JsonConvert.SerializeObject(requestDto.Rows),
                Sort            = 100,
                CreatedBy       = UserID,
                CreationDate    = DateTime.Now,
                LastUpdatedBy   = UserID,
                LastUpdatedDate = DateTime.Now,
                OrgGuid         = string.Empty
            };

            if (!string.IsNullOrWhiteSpace(requestDto.DecorationGuid))
            {
                model = await biz.GetAsync(requestDto.DecorationGuid);

                model.DecorationName  = requestDto.DecorationName;
                model.LastUpdatedBy   = UserID;
                model.LastUpdatedDate = DateTime.Now;
                model.Content         = JsonConvert.SerializeObject(requestDto.Rows);
            }
            var result = true;

            if (!string.IsNullOrWhiteSpace(requestDto.DecorationGuid))
            {
                result = await biz.UpdateAsync(model);
            }
            else
            {
                result = await biz.InsertAsync(model);
            }
            return(result ? Success() : Failed(ErrorCode.DataBaseError));
        }
        public async Task <IActionResult> GetDecorationDetailsAsync(string decorationGuid)
        {
            var decorationBiz   = new DecorationBiz();
            var result          = new DecorationDto();
            var decorationModel = await decorationBiz.GetAsync(decorationGuid);

            if (decorationModel == null)
            {
                return(Failed(ErrorCode.UserData, "未查询到装修记录数据"));
            }
            var classificationModel = await new DecorationClassificationBiz().GetAsync(decorationModel.ClassificationGuid);

            result.DecorationGuid     = decorationModel.DecorationGuid;
            result.DecorationName     = decorationModel.DecorationName;
            result.ClassificationGuid = decorationModel.ClassificationGuid;
            result.RuleMode           = classificationModel.RuleMode.ToEnum <RuleModeEnum>();
            var ruleModels = await new DecorationRuleConfigBiz().GetRulesByClassificationAsync(decorationModel.ClassificationGuid);

            result.DecorationRules = ruleModels.Select(a => a.ToDto <DecorationRule>()).ToList();
            var content = await decorationBiz.GetDecorationContentAsync(decorationGuid);

            result.Rows = string.IsNullOrWhiteSpace(content) ? new List <DecorationRow>() : JsonConvert.DeserializeObject <List <DecorationRow> >(content);
            return(Success(result));
        }