diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdKdjlb/BillingRecordSummaryQueryInput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdKdjlb/BillingRecordSummaryQueryInput.cs new file mode 100644 index 0000000..253cef3 --- /dev/null +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdKdjlb/BillingRecordSummaryQueryInput.cs @@ -0,0 +1,31 @@ +using System; +using System.ComponentModel.DataAnnotations; +using NCC.Common.Filter; + +namespace NCC.Extend.Entitys.Dto.LqKdKdjlb +{ + /// + /// 开单记录汇总查询输入 + /// + public class BillingRecordSummaryQueryInput : PageInputBase + { + /// + /// 门店ID + /// + [Required(ErrorMessage = "门店ID不能为空")] + [Display(Name = "门店ID", Description = "查询开单记录汇总的门店ID")] + public string StoreId { get; set; } + + /// + /// 开始时间 + /// + [Display(Name = "开始时间", Description = "查询开单记录的开始时间")] + public DateTime? StartTime { get; set; } + + /// + /// 结束时间 + /// + [Display(Name = "结束时间", Description = "查询开单记录的结束时间")] + public DateTime? EndTime { get; set; } + } +} diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdKdjlb/LqKdKdjlbInfoOutput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdKdjlb/LqKdKdjlbInfoOutput.cs index 8fd8d40..498657a 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdKdjlb/LqKdKdjlbInfoOutput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdKdjlb/LqKdKdjlbInfoOutput.cs @@ -163,6 +163,16 @@ namespace NCC.Extend.Entitys.Dto.LqKdKdjlb public string cancelRefRemarks { get; set; } /// + /// 营销活动ID + /// + public string activityId { get; set; } + + /// + /// 营销活动名称 + /// + public string activityName { get; set; } + + /// /// 健康师业绩 /// public List lqKdJksyjList { get; set; } diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdKdjlb/LqKdKdjlbListOutput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdKdjlb/LqKdKdjlbListOutput.cs index c876f90..1b40dfc 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdKdjlb/LqKdKdjlbListOutput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdKdjlb/LqKdKdjlbListOutput.cs @@ -143,8 +143,16 @@ namespace NCC.Extend.Entitys.Dto.LqKdKdjlb /// public string cancelRefRemarks { get; set; } + /// + /// 营销活动ID + /// + public string activityId { get; set; } /// + /// 营销活动名称 + /// + public string activityName { get; set; } + /// /// 补缴开单ID /// public string supplementBillingId { get; set; } diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdKdjlb/LqKdKdjlbUpdateAmountInput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdKdjlb/LqKdKdjlbUpdateAmountInput.cs new file mode 100644 index 0000000..93ea226 --- /dev/null +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdKdjlb/LqKdKdjlbUpdateAmountInput.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace NCC.Extend.Entitys.Dto.LqKdKdjlb +{ + /// + /// 修改开单金额输入 + /// + public class LqKdKdjlbUpdateAmountInput + { + /// + /// 开单记录ID + /// + [Required(ErrorMessage = "开单记录ID不能为空")] + public string BillingId { get; set; } + + /// + /// 整单业绩 + /// + [Range(0, double.MaxValue, ErrorMessage = "整单业绩必须大于等于0")] + public decimal Zdyj { get; set; } + + /// + /// 实付业绩 + /// + [Range(0, double.MaxValue, ErrorMessage = "实付业绩必须大于等于0")] + public decimal Sfyj { get; set; } + + /// + /// 储扣总金额 + /// + [Range(0, double.MaxValue, ErrorMessage = "储扣总金额必须大于等于0")] + public decimal DeductAmount { get; set; } + + /// + /// 欠款 + /// + [Range(0, double.MaxValue, ErrorMessage = "欠款必须大于等于0")] + public decimal Qk { get; set; } + + /// + /// 品项明细金额列表 + /// + public List ItemDetails { get; set; } = new List(); + + /// + /// 修改备注 + /// + public string Remark { get; set; } + } + + /// + /// 品项明细金额更新 + /// + public class LqKdPxmxAmountUpdate + { + /// + /// 品项明细ID + /// + [Required(ErrorMessage = "品项明细ID不能为空")] + public string ItemDetailId { get; set; } + + /// + /// 品项价格 + /// + [Range(0, double.MaxValue, ErrorMessage = "品项价格必须大于等于0")] + public decimal Pxjg { get; set; } + + /// + /// 金额合计 + /// + [Range(0, double.MaxValue, ErrorMessage = "金额合计必须大于等于0")] + public decimal TotalPrice { get; set; } + + /// + /// 实付金额 + /// + [Range(0, double.MaxValue, ErrorMessage = "实付金额必须大于等于0")] + public decimal ActualPrice { get; set; } + } +} diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqPackageInfo/LqPackageInfoListOutput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqPackageInfo/LqPackageInfoListOutput.cs index dbd905b..faed5a2 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqPackageInfo/LqPackageInfoListOutput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqPackageInfo/LqPackageInfoListOutput.cs @@ -12,54 +12,84 @@ namespace NCC.Extend.Entitys.Dto.LqPackageInfo /// 营销活动ID /// [Display(Name = "营销活动ID", Description = "营销活动的唯一标识")] - public string Id { get; set; } + public string id { get; set; } /// /// 活动名称 /// [Display(Name = "活动名称", Description = "营销活动的名称")] - public string ActivityName { get; set; } + public string activityName { get; set; } /// /// 活动描述 /// [Display(Name = "活动描述", Description = "营销活动的描述")] - public string ActivityDesc { get; set; } + public string activityDesc { get; set; } /// /// 活动开始时间 /// [Display(Name = "活动开始时间", Description = "营销活动的开始时间")] - public DateTime StartTime { get; set; } + public DateTime startTime { get; set; } /// /// 活动结束时间 /// [Display(Name = "活动结束时间", Description = "营销活动的结束时间")] - public DateTime EndTime { get; set; } + public DateTime endTime { get; set; } /// /// 至少购买品项数量 /// [Display(Name = "至少购买品项数量", Description = "参与活动需要购买的最少品项数量")] - public int MinItemQuantity { get; set; } + public int minItemQuantity { get; set; } /// /// 活动规则说明 /// [Display(Name = "活动规则说明", Description = "营销活动的规则说明")] - public string ActivityRules { get; set; } + public string activityRules { get; set; } /// /// 排序 /// [Display(Name = "排序", Description = "营销活动的显示排序")] - public int SortOrder { get; set; } + public int sortOrder { get; set; } /// /// 创建时间 /// [Display(Name = "创建时间", Description = "营销活动的创建时间")] - public DateTime CreateTime { get; set; } + public DateTime createTime { get; set; } + + /// + /// 是否有效 + /// + [Display(Name = "是否有效", Description = "营销活动是否有效")] + public int isEffective { get; set; } + + /// + /// 创建人 + /// + [Display(Name = "创建人", Description = "营销活动的创建人")] + public string createUser { get; set; } + + /// + /// 更新时间 + /// + [Display(Name = "更新时间", Description = "营销活动的更新时间")] + public DateTime updateTime { get; set; } + + /// + /// 更新人 + /// + [Display(Name = "更新人", Description = "营销活动的更新人")] + public string updateUser { get; set; } + + /// + /// 活动图片 + /// + [Display(Name = "活动图片", Description = "营销活动的图片")] + public string activityImages { get; set; } } } diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqPackageInfo/LqPackageInfoListQueryInput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqPackageInfo/LqPackageInfoListQueryInput.cs index c9d74e5..0a1b977 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqPackageInfo/LqPackageInfoListQueryInput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqPackageInfo/LqPackageInfoListQueryInput.cs @@ -62,5 +62,11 @@ namespace NCC.Extend.Entitys.Dto.LqPackageInfo /// [Display(Name = "创建时间结束", Description = "创建时间范围结束")] public DateTime? CreateTimeEnd { get; set; } + + /// + /// 是否有效 + /// + [Display(Name = "是否有效", Description = "营销活动是否有效")] + public int? IsEffective { get; set; } } } diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStatisticsPersonalPerformance/LqStatisticsPersonalPerformanceListQueryInput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStatisticsPersonalPerformance/LqStatisticsPersonalPerformanceListQueryInput.cs index f24e5ad..e02dcd0 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStatisticsPersonalPerformance/LqStatisticsPersonalPerformanceListQueryInput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStatisticsPersonalPerformance/LqStatisticsPersonalPerformanceListQueryInput.cs @@ -19,6 +19,11 @@ namespace NCC.Extend.Entitys.Dto.LqStatisticsPersonalPerformance public string StoreId { get; set; } /// + /// 门店名称 + /// + public string StoreName { get; set; } + + /// /// 员工ID /// public string EmployeeId { get; set; } diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXmzl/LqXmzlCrInput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXmzl/LqXmzlCrInput.cs index c0041db..9c0a8d9 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXmzl/LqXmzlCrInput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXmzl/LqXmzlCrInput.cs @@ -58,15 +58,6 @@ namespace NCC.Extend.Entitys.Dto.LqXmzl /// public string fl4 { get; set; } - /// - /// 统计类别 - /// - public string tjlb { get; set; } - - /// - /// 折扣类别 - /// - public string zklb { get; set; } /// /// 分类 @@ -83,25 +74,21 @@ namespace NCC.Extend.Entitys.Dto.LqXmzl /// public string qt2 { get; set; } - /// - /// 溯源金额 - /// - public decimal? syje { get; set; } /// - /// Cell金额 + /// 手工费 /// - public decimal? cellje { get; set; } + public decimal? sgf { get; set; } /// - /// 手工费 + /// 科美类型 /// - public decimal? sgf { get; set; } + public string beautyType { get; set; } /// - /// 项目次数 + /// 是否有效 /// - public int? projectNumber { get; set; } + public int isEffective { get; set; } /// /// 来源类型 diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXmzl/LqXmzlInfoOutput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXmzl/LqXmzlInfoOutput.cs index 21612ed..32bc357 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXmzl/LqXmzlInfoOutput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXmzl/LqXmzlInfoOutput.cs @@ -12,101 +12,88 @@ namespace NCC.Extend.Entitys.Dto.LqXmzl /// 主键 /// public string id { get; set; } - + /// /// 项目编号 /// public string xmbh { get; set; } - + /// /// 项目名称 /// public string xmmc { get; set; } - + /// /// 标准价格 /// public decimal bzjg { get; set; } - + /// /// 项目时长(分钟) /// public int? xmsc { get; set; } - + /// /// 基础服务提成 /// public decimal jcfwtc { get; set; } - + /// /// 分类①-汇总表 /// public string fl1 { get; set; } - + /// /// 分类②-汇总表 /// public string fl2 { get; set; } - + /// /// 分类③-工资用 /// public string fl3 { get; set; } - + /// /// 分类④-统计品项用 /// public string fl4 { get; set; } - - /// - /// 统计类别 - /// - public string tjlb { get; set; } - - /// - /// 折扣类别 - /// - public string zklb { get; set; } - + + /// /// 分类 /// public string fl { get; set; } - + /// /// 其它1 /// public string qt1 { get; set; } - + /// /// 其它2 /// public string qt2 { get; set; } - - /// - /// 溯源金额 - /// - public decimal? syje { get; set; } - - /// - /// Cell金额 - /// - public decimal? cellje { get; set; } - + + /// /// 手工费 /// public decimal? sgf { get; set; } /// - /// 项目次数 + /// 科美类型 /// - public int? projectNumber { get; set; } - + public string beautyType { get; set; } + + /// + /// 是否有效 + /// + public int isEffective { get; set; } + /// /// 来源类型 /// public string sourceType { get; set; } - + } } diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXmzl/LqXmzlListOutput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXmzl/LqXmzlListOutput.cs index ec281ca..f463317 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXmzl/LqXmzlListOutput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXmzl/LqXmzlListOutput.cs @@ -57,15 +57,6 @@ namespace NCC.Extend.Entitys.Dto.LqXmzl /// public string fl4 { get; set; } - /// - /// 统计类别 - /// - public string tjlb { get; set; } - - /// - /// 折扣类别 - /// - public string zklb { get; set; } /// /// 分类 @@ -82,25 +73,21 @@ namespace NCC.Extend.Entitys.Dto.LqXmzl /// public string qt2 { get; set; } - /// - /// 溯源金额 - /// - public decimal? syje { get; set; } /// - /// Cell金额 + /// 手工费 /// - public decimal? cellje { get; set; } + public decimal? sgf { get; set; } /// - /// 手工费 + /// 科美类型 /// - public decimal? sgf { get; set; } + public string beautyType { get; set; } /// - /// 项目次数 + /// 是否有效 /// - public int? projectNumber { get; set; } + public int isEffective { get; set; } /// /// 来源类型 diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXmzl/LqXmzlListQueryInput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXmzl/LqXmzlListQueryInput.cs index 10e434d..4620ec2 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXmzl/LqXmzlListQueryInput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXmzl/LqXmzlListQueryInput.cs @@ -23,91 +23,106 @@ namespace NCC.Extend.Entitys.Dto.LqXmzl /// 主键 /// public string id { get; set; } - + /// /// 项目编号 /// public string xmbh { get; set; } - + /// /// 项目名称 /// public string xmmc { get; set; } - + /// /// 标准价格 /// public string bzjg { get; set; } - + /// /// 项目时长(分钟) /// public string xmsc { get; set; } - + /// /// 基础服务提成 /// public string jcfwtc { get; set; } - + /// /// 分类①-汇总表 /// public string fl1 { get; set; } - + /// /// 分类②-汇总表 /// public string fl2 { get; set; } - + /// /// 分类③-工资用 /// public string fl3 { get; set; } - + /// /// 分类④-统计品项用 /// public string fl4 { get; set; } - + /// /// 统计类别 /// public string tjlb { get; set; } - + /// /// 折扣类别 /// public string zklb { get; set; } - + /// /// 分类 /// public string fl { get; set; } - + /// /// 其它1 /// public string qt1 { get; set; } - + /// /// 其它2 /// public string qt2 { get; set; } - + /// /// 溯源金额 /// public string syje { get; set; } - + /// /// Cell金额 /// public string cellje { get; set; } - + /// /// 手工费 /// public string sgf { get; set; } - + + /// + /// 科美类型 + /// + public string beautyType { get; set; } + + /// + /// 是否有效 + /// + public int isEffective { get; set; } = 0; + + /// + /// 来源类型 + /// + public string sourceType { get; set; } + } } diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXmzl/LqXmzlUpInput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXmzl/LqXmzlUpInput.cs index ec504bb..71291ec 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXmzl/LqXmzlUpInput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXmzl/LqXmzlUpInput.cs @@ -12,6 +12,6 @@ namespace NCC.Extend.Entitys.Dto.LqXmzl /// 主键 /// public string id { get; set; } - + } } diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqYyjl/LqYyjlCrInput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqYyjl/LqYyjlCrInput.cs index f31fccf..b060522 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqYyjl/LqYyjlCrInput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqYyjl/LqYyjlCrInput.cs @@ -12,66 +12,66 @@ namespace NCC.Extend.Entitys.Dto.LqYyjl /// 预约编号 /// public string id { get; set; } - + /// /// 单据门店 /// public string djmd { get; set; } - + /// /// 邀约人 /// public string yyr { get; set; } - + /// /// 顾客类型 /// public string gklx { get; set; } - + /// /// 预约体验项目 /// public string yytyxm { get; set; } - + /// /// 操作人 /// public string czr { get; set; } - + /// /// 操作时间 /// public DateTime? czsj { get; set; } - + /// /// 顾客 /// public string gk { get; set; } - + /// /// 顾客姓名 /// public string gkxm { get; set; } - + /// /// 预约健康师 /// public string yyjks { get; set; } - + /// /// 预约开始时间 /// public DateTime? yysj { get; set; } - + /// /// 预约结束时间 /// public DateTime? yyjs { get; set; } - + /// /// 预约状态 /// public string F_Status { get; set; } - + } } diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_tkjlb/LqTkjlbEntity.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_tkjlb/LqTkjlbEntity.cs index 76f24c6..b63cfe9 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_tkjlb/LqTkjlbEntity.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_tkjlb/LqTkjlbEntity.cs @@ -95,5 +95,11 @@ namespace NCC.Extend.Entitys.lq_tkjlb [SugarColumn(ColumnName = "F_CreateTime")] public DateTime CreateTime { get; set; } = DateTime.Now; + /// + /// 会员id + /// + [SugarColumn(ColumnName = "F_MemberId")] + public string MemberId { get; set; } + } } diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_xmzl/LqXmzlEntity.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_xmzl/LqXmzlEntity.cs index 378d958..b19156e 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_xmzl/LqXmzlEntity.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_xmzl/LqXmzlEntity.cs @@ -16,119 +16,103 @@ namespace NCC.Extend.Entitys.lq_xmzl /// [SugarColumn(ColumnName = "F_Id", IsPrimaryKey = true)] public string Id { get; set; } - + /// /// 项目编号 /// - [SugarColumn(ColumnName = "xmbh")] + [SugarColumn(ColumnName = "xmbh")] public string Xmbh { get; set; } - + /// /// 项目名称 /// - [SugarColumn(ColumnName = "xmmc")] + [SugarColumn(ColumnName = "xmmc")] public string Xmmc { get; set; } - + /// /// 标准价格 /// - [SugarColumn(ColumnName = "bzjg")] + [SugarColumn(ColumnName = "bzjg")] public decimal Bzjg { get; set; } - + /// /// 项目时长(分钟) /// - [SugarColumn(ColumnName = "xmsc")] + [SugarColumn(ColumnName = "xmsc")] public int? Xmsc { get; set; } - + /// /// 基础服务提成 /// - [SugarColumn(ColumnName = "jcfwtc")] + [SugarColumn(ColumnName = "jcfwtc")] public decimal Jcfwtc { get; set; } - + /// /// 分类①-汇总表 /// - [SugarColumn(ColumnName = "fl1")] + [SugarColumn(ColumnName = "fl1")] public string Fl1 { get; set; } - + /// /// 分类②-汇总表 /// - [SugarColumn(ColumnName = "fl2")] + [SugarColumn(ColumnName = "fl2")] public string Fl2 { get; set; } - + /// /// 分类③-工资用 /// - [SugarColumn(ColumnName = "fl3")] + [SugarColumn(ColumnName = "fl3")] public string Fl3 { get; set; } - + /// /// 分类④-统计品项用 /// - [SugarColumn(ColumnName = "fl4")] + [SugarColumn(ColumnName = "fl4")] public string Fl4 { get; set; } - - /// - /// 统计类别 - /// - [SugarColumn(ColumnName = "tjlb")] - public string Tjlb { get; set; } - - /// - /// 折扣类别 - /// - [SugarColumn(ColumnName = "zklb")] - public string Zklb { get; set; } - + + /// /// 分类 /// - [SugarColumn(ColumnName = "fl")] + [SugarColumn(ColumnName = "fl")] public string Fl { get; set; } - + /// /// 其它1 /// - [SugarColumn(ColumnName = "qt1")] + [SugarColumn(ColumnName = "qt1")] public string Qt1 { get; set; } - + /// /// 其它2 /// - [SugarColumn(ColumnName = "qt2")] + [SugarColumn(ColumnName = "qt2")] public string Qt2 { get; set; } - - /// - /// 溯源金额 - /// - [SugarColumn(ColumnName = "syje")] - public decimal? Syje { get; set; } - - /// - /// Cell金额 - /// - [SugarColumn(ColumnName = "cellje")] - public decimal? Cellje { get; set; } - + + /// /// 手工费 /// - [SugarColumn(ColumnName = "sgf")] + [SugarColumn(ColumnName = "sgf")] public decimal? Sgf { get; set; } /// - /// 项目次数 + /// 科美类型 + /// + [SugarColumn(ColumnName = "F_BeautyType")] + public string BeautyType { get; set; } + + /// + /// 是否有效 /// - [SugarColumn(ColumnName = "F_ProjectNumber")] - public int? ProjectNumber { get; set; } + [SugarColumn(ColumnName = "F_IsEffective")] + public int IsEffective { get; set; } /// /// 来源类型 /// - [SugarColumn(ColumnName = "F_SourceType")] + [SugarColumn(ColumnName = "F_SourceType")] public string SourceType { get; set; } } } \ No newline at end of file diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqAttendanceSummaryService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqAttendanceSummaryService.cs index 8c56b8d..26fac40 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/LqAttendanceSummaryService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/LqAttendanceSummaryService.cs @@ -325,6 +325,7 @@ namespace NCC.Extend .WhereIF(input.Year.HasValue, a => a.Year == input.Year) .WhereIF(input.Month.HasValue, a => a.Month == input.Month) .WhereIF(input.EmployeeStatus.HasValue, a => a.EmployeeStatus == input.EmployeeStatus) + .Select(a => new LqAttendanceSummaryListOutput { id = a.Id, @@ -353,7 +354,26 @@ namespace NCC.Extend #endregion #region 清空某一个月的数据 - + /// + /// 清空某一个月的数据 + /// + /// 年份 + /// 月份 + /// + [HttpDelete("DeleteByMonth/{year}/{month}")] + public async Task DeleteByMonth(string year, string month) + { + int yearInt = int.Parse(year); + int monthInt = int.Parse(month); + await _db.Deleteable().Where(p => p.Year == yearInt && p.Month == monthInt).ExecuteCommandAsync(); + return new + { + success = true, + message = "清空成功" + }; + } #endregion + + } } diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs index 12b2625..9504739 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs @@ -39,6 +39,7 @@ using NCC.JsonSerialization; using NCC.System.Entitys.Permission; using SqlSugar; using Yitter.IdGenerator; +using NCC.Extend.Entitys.lq_package_info; namespace NCC.Extend.LqKdKdjlb { @@ -117,6 +118,10 @@ namespace NCC.Extend.LqKdKdjlb var MemberInfo = await _db.Queryable().FirstAsync(p => p.Id == entity.Kdhy); output.kdhyc = MemberInfo.Khmc; output.kdhysjh = MemberInfo.Sjh; + if (!string.IsNullOrEmpty(entity.ActivityId)) + { + output.activityName = await _db.Queryable().Where(x => x.Id == entity.ActivityId).Select(x => x.ActivityName).FirstAsync(); + } // 2. 查询品项明细列表 var lqKdPxmxList = await _db.Queryable().Where(w => w.Glkdbh == entity.Id).ToListAsync(); @@ -251,6 +256,8 @@ namespace NCC.Extend.LqKdKdjlb isEffective = it.IsEffective, createUser = it.CreateUser, createUserName = SqlFunc.Subqueryable().Where(x => x.Id == it.CreateUser).Select(x => x.RealName), + activityId = it.ActivityId, + activityName = SqlFunc.Subqueryable().Where(x => x.Id == it.ActivityId).Select(x => x.ActivityName), }) .MergeTable() .OrderBy(sidx + " " + input.sort) @@ -1381,11 +1388,11 @@ namespace NCC.Extend.LqKdKdjlb //关闭事务 _db.CommitTran(); } - catch (Exception) + catch (Exception ex) { //回滚事务 _db.RollbackTran(); - throw NCCException.Oh(ErrorCode.COM1001); + throw NCCException.Oh($"创建开单记录失败: {ex.Message}"); } } #endregion @@ -1896,6 +1903,356 @@ namespace NCC.Extend.LqKdKdjlb } #endregion + #region 修改开单金额 + /// + /// 修改开单金额 + /// + /// 修改开单金额输入 + /// 修改结果 + /// + /// 修改开单记录表的金额以及品项明细表里面的金额 + /// + /// 示例请求: + /// ```json + /// { + /// "billingId": "123456789", + /// "zdyj": 1000.00, + /// "sfyj": 800.00, + /// "deductAmount": 200.00, + /// "qk": 0.00, + /// "itemDetails": [ + /// { + /// "itemDetailId": "item001", + /// "pxjg": 500.00, + /// "totalPrice": 500.00, + /// "actualPrice": 400.00 + /// } + /// ], + /// "remark": "金额调整" + /// } + /// ``` + /// + /// 参数说明: + /// - billingId: 开单记录ID(必填) + /// - zdyj: 整单业绩 + /// - sfyj: 实付业绩 + /// - deductAmount: 储扣总金额 + /// - qk: 欠款 + /// - itemDetails: 品项明细金额列表 + /// - remark: 修改备注 + /// + /// 成功修改开单金额 + /// 请求参数错误 + /// 开单记录不存在 + /// 服务器内部错误 + [HttpPut("UpdateBillingAmount")] + public async Task UpdateBillingAmount(LqKdKdjlbUpdateAmountInput input) + { + try + { + // 验证输入参数 + if (string.IsNullOrEmpty(input.BillingId)) + { + throw NCCException.Oh("开单记录ID不能为空"); + } + // 检查开单记录是否存在且有效 + var billingEntity = await _db.Queryable().Where(w => w.Id == input.BillingId && w.IsEffective == StatusEnum.有效.GetHashCode()).FirstAsync(); + if (billingEntity == null) + { + throw NCCException.Oh("开单记录不存在或已作废"); + } + // 验证品项明细 + if (input.ItemDetails != null && input.ItemDetails.Any()) + { + var itemDetailIds = input.ItemDetails.Select(x => x.ItemDetailId).ToList(); + var existingItems = await _db.Queryable().Where(w => w.Glkdbh == input.BillingId && itemDetailIds.Contains(w.Id)).ToListAsync(); + if (existingItems.Count != input.ItemDetails.Count) + { + throw NCCException.Oh("部分品项明细不存在或不属于该开单记录"); + } + } + // 开始事务 + _db.BeginTran(); + try + { + // 更新开单记录金额 + var updateResult = await _db.Updateable().SetColumns(it => new LqKdKdjlbEntity + { + Zdyj = input.Zdyj, + Sfyj = input.Sfyj, + DeductAmount = input.DeductAmount, + Qk = input.Qk, + UpdateTime = DateTime.Now + }).Where(w => w.Id == input.BillingId).ExecuteCommandAsync(); + + if (updateResult <= 0) + { + throw NCCException.Oh("更新开单记录金额失败"); + } + + // 更新品项明细金额 + if (input.ItemDetails != null && input.ItemDetails.Any()) + { + foreach (var itemDetail in input.ItemDetails) + { + var itemUpdateResult = await _db.Updateable().SetColumns(it => new LqKdPxmxEntity + { + Pxjg = itemDetail.Pxjg, + TotalPrice = itemDetail.TotalPrice, + ActualPrice = itemDetail.ActualPrice + }).Where(w => w.Id == itemDetail.ItemDetailId && w.Glkdbh == input.BillingId).ExecuteCommandAsync(); + + if (itemUpdateResult <= 0) + { + throw NCCException.Oh($"更新品项明细金额失败,品项ID: {itemDetail.ItemDetailId}"); + } + } + } + // 提交事务 + _db.CommitTran(); + return "修改开单金额成功"; + } + catch (Exception ex) + { + // 回滚事务 + _db.RollbackTran(); + throw NCCException.Oh($"修改开单金额失败: {ex.Message}"); + } + } + catch (Exception ex) + { + throw NCCException.Oh($"修改开单金额时发生错误: {ex.Message}"); + } + } + #endregion + + #region 获取门店某个时间段的开单记录汇总信息 + /// + /// 获取门店某个时间段的开单记录汇总信息 + /// + /// 查询参数 + /// 开单记录汇总信息 + [HttpGet("GetBillingRecordSummaryByStoreId")] + public async Task GetBillingRecordSummaryByStoreId([FromQuery] BillingRecordSummaryQueryInput input) + { + try + { + // 验证参数 + if (string.IsNullOrEmpty(input.StoreId)) + { + throw NCCException.Oh("门店ID不能为空"); + } + + // 如果开始时间和结束时间为空,就默认是当月 + if (input.StartTime == null || input.EndTime == null) + { + input.StartTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); + input.EndTime = DateTime.Now.AddDays(DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month)); + } + + // 查询开单记录 + var billingRecords = await _db.Queryable() + .Where(w => w.Djmd == input.StoreId + && w.Kdrq >= input.StartTime + && w.Kdrq <= input.EndTime + && w.IsEffective == StatusEnum.有效.GetHashCode()) + .Select(it => new + { + id = it.Id, + djmd = it.Djmd, + jsj = it.Jsj, + kdrq = it.Kdrq, + gjlx = it.Gjlx, + zdyj = it.Zdyj, + sfyj = it.Sfyj, + qk = it.Qk, + kdhyc = it.Kdhyc, + kdhysjh = it.Kdhysjh, + fkfs = it.Fkfs, // 付款方式 + khly = it.Khly, // 客户来源 + bz = it.Bz, // 备注 + createTime = it.CreateTime + }) + .ToListAsync(); + + if (!billingRecords.Any()) + { + return new + { + success = true, + data = new + { + billingSummary = new + { + totalCount = 0, + totalAmount = 0, + totalPaidAmount = 0, + totalDebt = 0, + billingRecords = new List() + }, + itemSummary = new + { + purchased = new { count = 0, totalAmount = 0, items = new List() }, + gifted = new { count = 0, totalAmount = 0, items = new List() }, + experience = new { count = 0, totalAmount = 0, items = new List() } + }, + healthTeacherSummary = new + { + totalCount = 0, + teachers = new List() + } + }, + message = "该时间段内无开单记录" + }; + } + + var billingIds = billingRecords.Select(x => x.id).ToList(); + + // 查询品项明细,按F_SourceType分类 + var itemDetails = await _db.Queryable() + .Where(w => billingIds.Contains(w.Glkdbh) && w.IsEffective == StatusEnum.有效.GetHashCode()) + .Select(it => new + { + id = it.Id, + glkdbh = it.Glkdbh, + px = it.Px, + pxmc = it.Pxmc, + pxjg = it.Pxjg, + sourceType = it.SourceType, + totalPrice = it.TotalPrice, + actualPrice = it.ActualPrice, + projectNumber = it.ProjectNumber, + remark = it.Remark + }) + .ToListAsync(); + + // 按来源类型分类品项 + var purchasedItems = itemDetails.Where(x => x.sourceType == "购买").ToList(); + var giftedItems = itemDetails.Where(x => x.sourceType == "赠送").ToList(); + var experienceItems = itemDetails.Where(x => x.sourceType == "体验").ToList(); + + // 查询健康师业绩数据 + var healthTeacherData = await _db.Queryable() + .Where(w => billingIds.Contains(w.Glkdbh) && w.IsEffective == StatusEnum.有效.GetHashCode()) + .Select(it => new + { + id = it.Id, + glkdbh = it.Glkdbh, + jks = it.Jks, + jksxm = it.Jksxm, + jkszh = it.Jkszh, + jksyj = it.Jksyj, + kdpxid = it.Kdpxid, + yjsj = it.Yjsj, + jsj_id = it.Jsj_id + }) + .ToListAsync(); + + // 构建按开单记录分组的详细数据 + var detailedRecords = billingRecords.Select(billing => new + { + // 基本信息 + date = billing.kdrq?.ToString("yyyy-MM-dd"), + customerName = billing.kdhyc, + customerPhone = billing.kdhysjh, + storeId = billing.djmd, + goldTriangle = billing.jsj, + customerType = billing.gjlx, + + // 品项分类 + purchasedItems = itemDetails.Where(x => x.glkdbh == billing.id && x.sourceType == "购买").Select(x => new + { + id = x.id, + itemName = x.pxmc, + itemCode = x.px, + price = x.pxjg, + totalPrice = x.totalPrice, + actualPrice = x.actualPrice, + projectNumber = x.projectNumber, + remark = x.remark + }).ToList(), + + giftedItems = itemDetails.Where(x => x.glkdbh == billing.id && x.sourceType == "赠送").Select(x => new + { + id = x.id, + itemName = x.pxmc, + itemCode = x.px, + price = x.pxjg, + totalPrice = x.totalPrice, + actualPrice = x.actualPrice, + projectNumber = x.projectNumber, + remark = x.remark + }).ToList(), + + experienceItems = itemDetails.Where(x => x.glkdbh == billing.id && x.sourceType == "体验").Select(x => new + { + id = x.id, + itemName = x.pxmc, + itemCode = x.px, + price = x.pxjg, + totalPrice = x.totalPrice, + actualPrice = x.actualPrice, + projectNumber = x.projectNumber, + remark = x.remark + }).ToList(), + + // 金额信息 + paidAmount = billing.sfyj, + debtAmount = billing.qk, + totalAmount = billing.zdyj, + + // 健康师信息 + healthTeachers = healthTeacherData.Where(x => x.glkdbh == billing.id).Select(x => new + { + teacherId = x.jks, + teacherName = x.jksxm, + teacherAccount = x.jkszh, + performance = x.jksyj, + performanceTime = x.yjsj, + itemDetailId = x.kdpxid, + goldTriangleId = x.jsj_id + }).ToList(), + + // 其他信息 + source = billing.khly, // 客户来源 + paymentMethod = billing.fkfs, // 支付方式 + remark = billing.bz, // 备注 + createTime = billing.createTime + }).OrderByDescending(x => x.date).ToList(); + + // 构建返回结果 + var result = new + { + success = true, + data = new + { + // 汇总统计 + summary = new + { + totalCount = billingRecords.Count, + totalAmount = billingRecords.Sum(x => x.zdyj), + totalPaidAmount = billingRecords.Sum(x => x.sfyj), + totalDebt = billingRecords.Sum(x => x.qk), + totalPurchasedItems = purchasedItems.Count, + totalGiftedItems = giftedItems.Count, + totalExperienceItems = experienceItems.Count, + totalHealthTeachers = healthTeacherData.GroupBy(x => x.jks).Count() + }, + // 详细记录列表 + records = detailedRecords + }, + message = "获取开单记录汇总信息成功" + }; + + return result; + } + catch (Exception ex) + { + throw NCCException.Oh($"获取开单记录汇总信息失败:{ex.Message}"); + } + } + #endregion + #region 私有方法 /// /// 检查开单记录是否可以操作 @@ -1918,27 +2275,27 @@ namespace NCC.Extend.LqKdKdjlb return (false, "该开单记录已经作废"); } // 判断是否有对应的补缴记录 - var qkbjList = await _db.Queryable().Where(p => p.SupplementBillingId == billingId).ToListAsync(); + var qkbjList = await _db.Queryable().Where(p => p.SupplementBillingId == billingId && p.IsEffective == StatusEnum.有效.GetHashCode()).ToListAsync(); if (qkbjList.Any()) { return (false, "该开单记录有对应的补缴记录,不能进行操作"); } // 查询开单记录下的品项明细ID列表 - var pxmxIdList = await _db.Queryable().Where(p => p.Glkdbh == billingId).Select(p => p.Id).Distinct().ToListAsync(); + var pxmxIdList = await _db.Queryable().Where(p => p.Glkdbh == billingId && p.IsEffective == StatusEnum.有效.GetHashCode()).Select(p => p.Id).Distinct().ToListAsync(); // 判断是否有对应的消耗记录 - var xhPxmxList = await _db.Queryable().Where(p => pxmxIdList.Contains(p.BillingItemId)).ToListAsync(); + var xhPxmxList = await _db.Queryable().Where(p => pxmxIdList.Contains(p.BillingItemId) && p.IsEffective == StatusEnum.有效.GetHashCode()).ToListAsync(); if (xhPxmxList.Any()) { return (false, "该开单记录有对应的消耗记录,不能进行操作"); } // 判断是否有退卡记录 - var hytkMxList = await _db.Queryable().Where(p => pxmxIdList.Contains(p.BillingItemId)).ToListAsync(); + var hytkMxList = await _db.Queryable().Where(p => pxmxIdList.Contains(p.BillingItemId) && p.IsEffective == StatusEnum.有效.GetHashCode()).ToListAsync(); if (hytkMxList.Any()) { return (false, "该开单记录有对应的退卡记录,不能进行操作"); } // 判断是否已经有储扣记录 - var deductInfoList = await _db.Queryable().Where(p => pxmxIdList.Contains(p.DeductId)).ToListAsync(); + var deductInfoList = await _db.Queryable().Where(p => pxmxIdList.Contains(p.DeductId) && p.IsEffective == StatusEnum.有效.GetHashCode()).ToListAsync(); if (deductInfoList.Any()) { return (false, "该开单记录有对应的储扣记录,不能进行操作"); diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqPackageInfoService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqPackageInfoService.cs index 80fa30c..709f452 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/LqPackageInfoService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/LqPackageInfoService.cs @@ -9,9 +9,11 @@ using NCC.Common.Filter; using NCC.Dependency; using NCC.DynamicApiController; using NCC.Extend.Entitys.Dto.LqPackageInfo; +using NCC.Extend.Entitys.Dto.LqXmzl; using NCC.Extend.Entitys.Enum; using NCC.Extend.Entitys.lq_package_info; using NCC.Extend.Entitys.lq_package_item_detail; +using NCC.Extend.Entitys.lq_xmzl; using NCC.Extend.Interfaces.LqPackageInfo; using NCC.FriendlyException; using SqlSugar; @@ -197,17 +199,23 @@ namespace NCC.Extend.LqPackageInfo .WhereIF(input.MinItemQuantity.HasValue, w => w.MinItemQuantity == input.MinItemQuantity.Value) .WhereIF(input.CreateTimeStart.HasValue, w => w.CreateTime >= input.CreateTimeStart.Value) .WhereIF(input.CreateTimeEnd.HasValue, w => w.CreateTime <= input.CreateTimeEnd.Value) + .WhereIF(input.IsEffective.HasValue, w => w.IsEffective == input.IsEffective.Value) .Select(it => new LqPackageInfoListOutput { - Id = it.Id, - ActivityName = it.ActivityName, - ActivityDesc = it.ActivityDesc, - StartTime = it.StartTime, - EndTime = it.EndTime, - MinItemQuantity = it.MinItemQuantity, - ActivityRules = it.ActivityRules, - SortOrder = it.SortOrder, - CreateTime = it.CreateTime + id = it.Id, + activityName = it.ActivityName, + activityDesc = it.ActivityDesc, + startTime = it.StartTime, + endTime = it.EndTime, + minItemQuantity = it.MinItemQuantity, + activityRules = it.ActivityRules, + sortOrder = it.SortOrder, + createTime = it.CreateTime, + isEffective = it.IsEffective, + createUser = it.CreateUser, + updateUser = it.UpdateUser, + updateTime = it.UpdateTime, + activityImages = it.ActivityImages, }).MergeTable().OrderBy(sidx + " " + input.sort).ToPagedListAsync(input.currentPage, input.pageSize); return PageResult.SqlSugarPageResult(data); } @@ -218,13 +226,72 @@ namespace NCC.Extend.LqPackageInfo /// 获取营销活动详情 /// /// 营销活动ID - /// 营销活动详情 + /// 营销活动详情(包含品项信息) + /// + /// 获取营销活动详情,包括活动基本信息和对应的品项明细列表 + /// + /// 返回数据说明: + /// - 活动基本信息:活动名称、描述、时间、规则等 + /// - 品项明细列表:该活动包含的所有品项信息 + /// + /// 成功获取营销活动详情 + /// 营销活动不存在 + /// 服务器内部错误 [HttpGet("GetPackageInfoDetailAsync")] public async Task GetPackageInfoDetailAsync(string id) { - var data = await _db.Queryable().Where(w => w.Id == id).FirstAsync(); - var output = data.Adapt(); - return output; + try + { + // 获取营销活动基本信息 + var packageInfo = await _db.Queryable().Where(w => w.Id == id).FirstAsync(); + if (packageInfo == null) + { + throw NCCException.Oh("营销活动不存在"); + } + // 获取品项明细信息 + var activityItems = await _db.Queryable() + .Where(w => w.ActivityId == id && w.IsEffective == StatusEnum.有效.GetHashCode()) + .OrderBy(w => w.CreateTime) + .Select(it => new + { + id = it.Id, + activityId = it.ActivityId, + itemId = it.ItemId, + itemName = it.ItemName, + itemCategory = it.ItemCategory, + itemRemark = it.ItemRemark, + createTime = it.CreateTime + }) + .ToListAsync(); + // 构建返回结果 + var result = new + { + // 活动基本信息 + id = packageInfo.Id, + activityName = packageInfo.ActivityName, + activityDesc = packageInfo.ActivityDesc, + startTime = packageInfo.StartTime, + endTime = packageInfo.EndTime, + minItemQuantity = packageInfo.MinItemQuantity, + activityRules = packageInfo.ActivityRules, + activityImages = packageInfo.ActivityImages, + sortOrder = packageInfo.SortOrder, + createTime = packageInfo.CreateTime, + updateTime = packageInfo.UpdateTime, + createUser = packageInfo.CreateUser, + updateUser = packageInfo.UpdateUser, + isEffective = packageInfo.IsEffective, + + // 品项明细列表 + activityItems = activityItems + }; + + return result; + } + catch (Exception ex) + { + throw NCCException.Oh($"获取营销活动详情失败:{ex.Message}"); + } } #endregion @@ -400,6 +467,77 @@ namespace NCC.Extend.LqPackageInfo } #endregion + #region 根据营销活动ID获取品项详情 + /// + /// 根据营销活动ID获取品项详情 + /// + /// 营销活动ID + /// 品项详情列表 + /// + /// 通过营销活动ID获取对应的品项ID,然后查询品项表获取完整的品项信息 + /// + /// 查询流程: + /// 1. 根据营销活动ID查询营销活动品项明细表,获取品项ID列表 + /// 2. 根据品项ID列表查询项目资料表,获取完整的品项信息 + /// 3. 返回品项详情列表 + /// + /// 成功获取品项详情 + /// 营销活动不存在或没有品项 + /// 服务器内部错误 + [HttpGet("GetPackageItemDetailByActivityIdAsync/{activityId}")] + public async Task GetPackageItemDetailByActivityIdAsync(string activityId) + { + try + { + // 验证参数 + if (string.IsNullOrEmpty(activityId)) + { + throw NCCException.Oh("营销活动ID不能为空"); + } + // 检查营销活动是否存在 + var activityExists = await _db.Queryable().Where(w => w.Id == activityId && w.IsEffective == StatusEnum.有效.GetHashCode()).AnyAsync(); + if (!activityExists) + { + throw NCCException.Oh("营销活动不存在或已失效"); + } + // 获取营销活动下的品项ID列表 + var itemIds = await _db.Queryable().Where(w => w.ActivityId == activityId && w.IsEffective == StatusEnum.有效.GetHashCode()).Select(w => w.ItemId).ToListAsync(); + if (!itemIds.Any()) + { + throw NCCException.Oh("该营销活动暂无品项"); + } + // 根据品项ID查询项目资料表 + var itemDetails = await _db.Queryable() + .Where(w => itemIds.Contains(w.Id) && w.IsEffective == StatusEnum.有效.GetHashCode()) + .Select(it => new LqXmzlListOutput + { + id = it.Id, + xmbh = it.Xmbh, + xmmc = it.Xmmc, + bzjg = it.Bzjg, + xmsc = it.Xmsc, + jcfwtc = it.Jcfwtc, + fl1 = it.Fl1, + fl2 = it.Fl2, + fl3 = it.Fl3, + fl4 = it.Fl4, + fl = it.Fl, + qt1 = it.Qt1, + qt2 = it.Qt2, + sgf = it.Sgf, + beautyType = it.BeautyType, + isEffective = it.IsEffective, + sourceType = it.SourceType + }).MergeTable().ToPagedListAsync(1, 50); + return PageResult.SqlSugarPageResult(itemDetails); + } + catch (Exception ex) + { + throw NCCException.Oh($"获取品项详情失败: {ex.Message}"); + } + } + #endregion + #region 获取当前时间有效的活动 /// /// 获取当前时间有效的活动 diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqStatisticsService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqStatisticsService.cs index c4d2868..26e3daf 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/LqStatisticsService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/LqStatisticsService.cs @@ -1696,6 +1696,7 @@ namespace NCC.Extend.LqStatistics // 添加查询条件 query = query.WhereIF(!string.IsNullOrEmpty(input.StatisticsMonth), x => x.StatisticsMonth == input.StatisticsMonth); query = query.WhereIF(!string.IsNullOrEmpty(input.StoreId), x => x.StoreId == input.StoreId); + query = query.WhereIF(!string.IsNullOrEmpty(input.StoreName), x => x.StoreName.Contains(input.StoreName)); query = query.WhereIF(!string.IsNullOrEmpty(input.EmployeeId), x => x.EmployeeId == input.EmployeeId); query = query.WhereIF(!string.IsNullOrEmpty(input.EmployeeName), x => x.EmployeeName.Contains(input.EmployeeName)); query = query.WhereIF(!string.IsNullOrEmpty(input.GoldTriangleId), x => x.GoldTriangleId == input.GoldTriangleId); diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqTkjlbService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqTkjlbService.cs index a762f99..8c81539 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/LqTkjlbService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/LqTkjlbService.cs @@ -169,6 +169,8 @@ namespace NCC.Extend.LqTkjlb { throw NCCException.Oh("未找到对应的拓客活动用户信息,请确认活动ID和用户ID是否正确"); } + var MemberNumber = "LQ" + DateTime.Now.ToString("yyyyMMddHHmmssfff"); + var MemberId = YitIdHelper.NextId().ToString(); var eventUserInfo = eventUserInfoList.First(); // 创建拓客记录 var entity = input.Adapt(); @@ -177,16 +179,17 @@ namespace NCC.Extend.LqTkjlb entity.StoreId = eventUserInfo.StoreId; entity.DepId = eventUserInfo.DepId; entity.ExpansionTime = DateTime.Now; + entity.MemberId = MemberId; var isOk = await _db.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandAsync(); if (!(isOk > 0)) throw NCCException.Oh("创建拓客记录失败"); // 创建客户信息 LqKhxxEntity MemberInfo = new LqKhxxEntity(); - MemberInfo.Id = YitIdHelper.NextId().ToString(); + MemberInfo.Id = MemberId; MemberInfo.Khmc = entity.CustomerName; MemberInfo.Sjh = input.customerPhone; // 设置手机号 MemberInfo.Khlx = MemberTypeEnum.线索.GetHashCode().ToString(); - MemberInfo.Dah = "LQ" + DateTime.Now.ToString("yyyyMMddHHmmssfff"); + MemberInfo.Dah = MemberNumber; MemberInfo.Jdqd = "19.9卡"; //找到input.expansionUserId的用户信息 @@ -526,5 +529,239 @@ namespace NCC.Extend.LqTkjlb } #endregion + #region 漏斗统计 + /// + /// 获取拓客活动漏斗统计数据 + /// + /// 活动ID + /// 漏斗统计数据 + [HttpGet("GetFunnelStatistics/{eventId}")] + public async Task GetFunnelStatistics(string eventId) + { + try + { + var sql = @" + SELECT + md.F_Id as store_id, + md.dm as store_name, + COUNT(DISTINCT tk.F_Id) as tk_count, -- 拓客数量 + COUNT(DISTINCT CASE WHEN yy.F_Id IS NOT NULL THEN tk.F_CustomerPhone END) as yy_count, -- 预约人数(已确认) + COUNT(DISTINCT CASE WHEN xh.F_Id IS NOT NULL THEN tk.F_CustomerPhone END) as hk_count, -- 耗卡人数 + COALESCE(SUM(CASE WHEN xh.F_Id IS NOT NULL THEN xh.xfje END), 0) as hk_amount, -- 耗卡金额 + ROUND( + COUNT(DISTINCT CASE WHEN yy.F_Id IS NOT NULL THEN tk.F_CustomerPhone END) * 100.0 / + COUNT(DISTINCT tk.F_Id), 2 + ) as yy_conversion_rate, -- 预约转化率(预约人数/拓客数量) + ROUND( + COUNT(DISTINCT CASE WHEN xh.F_Id IS NOT NULL THEN tk.F_CustomerPhone END) * 100.0 / + COUNT(DISTINCT CASE WHEN yy.F_Id IS NOT NULL THEN tk.F_CustomerPhone END), 2 + ) as hk_conversion_rate -- 耗卡转化率(耗卡人数/预约人数) + FROM lq_tkjlb tk + JOIN lq_mdxx md ON tk.F_StoreId = md.F_Id + LEFT JOIN lq_yyjl yy ON tk.F_MemberId = yy.gk + AND yy.F_Status = '已确认' + LEFT JOIN lq_xh_hyhk xh ON tk.F_MemberId = xh.hy + AND xh.F_IsEffective = 1 + WHERE tk.F_EventId = @eventId + GROUP BY md.F_Id, md.dm + ORDER BY tk_count DESC"; + + var result = await _db.Ado.SqlQueryAsync(sql, new { eventId }); + + return new + { + success = true, + data = result, + message = "获取漏斗统计数据成功" + }; + } + catch (Exception ex) + { + throw NCCException.Oh("获取漏斗统计数据失败:" + ex.Message); + } + } + + /// + /// 获取拓客活动总体漏斗统计 + /// + /// 活动ID + /// 总体漏斗统计数据 + [HttpGet("GetOverallFunnelStatistics/{eventId}")] + public async Task GetOverallFunnelStatistics(string eventId) + { + try + { + var sql = @" + SELECT + COUNT(DISTINCT tk.F_Id) as total_tk_count, -- 总拓客数量 + COUNT(DISTINCT CASE WHEN yy.F_Id IS NOT NULL THEN tk.F_CustomerPhone END) as total_yy_count, -- 总预约人数 + COUNT(DISTINCT CASE WHEN xh.F_Id IS NOT NULL THEN tk.F_CustomerPhone END) as total_hk_count, -- 总耗卡人数 + COALESCE(SUM(CASE WHEN xh.F_Id IS NOT NULL THEN xh.xfje END), 0) as total_hk_amount, -- 总耗卡金额 + ROUND( + COUNT(DISTINCT CASE WHEN yy.F_Id IS NOT NULL THEN tk.F_CustomerPhone END) * 100.0 / + COUNT(DISTINCT tk.F_Id), 2 + ) as overall_yy_conversion_rate, -- 总体预约转化率 + ROUND( + COUNT(DISTINCT CASE WHEN xh.F_Id IS NOT NULL THEN tk.F_CustomerPhone END) * 100.0 / + COUNT(DISTINCT CASE WHEN yy.F_Id IS NOT NULL THEN tk.F_CustomerPhone END), 2 + ) as overall_hk_conversion_rate -- 总体耗卡转化率 + FROM lq_tkjlb tk + LEFT JOIN lq_yyjl yy ON tk.F_MemberId = yy.gk + AND yy.F_Status = '已确认' + LEFT JOIN lq_xh_hyhk xh ON tk.F_MemberId = xh.hy + AND xh.F_IsEffective = 1 + WHERE tk.F_EventId = @eventId"; + + var result = await _db.Ado.SqlQueryAsync(sql, new { eventId }); + + return new + { + success = true, + data = result?.FirstOrDefault(), + message = "获取总体漏斗统计数据成功" + }; + } + catch (Exception ex) + { + throw NCCException.Oh("获取总体漏斗统计数据失败:" + ex.Message); + } + } + #endregion + + #region 门店顾客详情 + /// + /// 获取门店拓客活动顾客详情 + /// + /// 活动ID + /// 门店ID + /// 门店顾客详情列表 + [HttpGet("GetStoreCustomerDetails/{eventId}/{storeId}")] + public async Task GetStoreCustomerDetails(string eventId, string storeId) + { + try + { + var sql = @" + SELECT + tk.F_Id as tk_id, -- 拓客记录ID + tk.F_CustomerPhone as customer_phone, -- 顾客手机号 + tk.F_MemberId as member_id, -- 会员ID + tk.F_CustomerName as customer_name, -- 顾客姓名 + tk.F_CreateTime as tk_time, -- 拓客时间 + yy.F_Id as yy_id, -- 预约ID + yy.F_Status as yy_status, -- 预约状态 + yy.F_CreateTime as yy_time, -- 预约时间 + yy.yysj as appointment_time, -- 预约到店时间 + xh.F_Id as xh_id, -- 耗卡ID + xh.F_CreateTime as xh_time, -- 耗卡时间 + xh.xfje as consume_amount, -- 耗卡金额 + CASE + WHEN yy.F_Id IS NOT NULL THEN '已预约' + ELSE '未预约' + END as appointment_status, -- 预约状态描述 + CASE + WHEN xh.F_Id IS NOT NULL THEN '已耗卡' + ELSE '未耗卡' + END as consume_status -- 耗卡状态描述 + FROM lq_tkjlb tk + LEFT JOIN lq_yyjl yy ON tk.F_MemberId = yy.gk + AND yy.F_Status = '已确认' + LEFT JOIN lq_xh_hyhk xh ON tk.F_MemberId = xh.hy + AND xh.F_IsEffective = 1 + WHERE tk.F_EventId = @eventId + AND tk.F_StoreId = @storeId + ORDER BY tk.F_CreateTime DESC"; + + var result = await _db.Ado.SqlQueryAsync(sql, new { eventId, storeId }); + + return new + { + success = true, + data = result, + message = "获取门店顾客详情成功" + }; + } + catch (Exception ex) + { + throw NCCException.Oh("获取门店顾客详情失败:" + ex.Message); + } + } + + /// + /// 获取门店拓客活动顾客详情(分页) + /// + /// 活动ID + /// 门店ID + /// 页码 + /// 页大小 + /// 分页的门店顾客详情列表 + [HttpGet("GetStoreCustomerDetailsPaged/{eventId}/{storeId}")] + public async Task GetStoreCustomerDetailsPaged(string eventId, string storeId, int pageIndex = 1, int pageSize = 20) + { + try + { + var sql = @" + SELECT + tk.F_Id as tk_id, -- 拓客记录ID + tk.F_CustomerPhone as customer_phone, -- 顾客手机号 + tk.F_MemberId as member_id, -- 会员ID + tk.F_CustomerName as customer_name, -- 顾客姓名 + tk.F_CreateTime as tk_time, -- 拓客时间 + yy.F_Id as yy_id, -- 预约ID + yy.F_Status as yy_status, -- 预约状态 + yy.F_CreateTime as yy_time, -- 预约时间 + yy.yysj as appointment_time, -- 预约到店时间 + xh.F_Id as xh_id, -- 耗卡ID + xh.F_CreateTime as xh_time, -- 耗卡时间 + xh.xfje as consume_amount, -- 耗卡金额 + CASE + WHEN yy.F_Id IS NOT NULL THEN '已预约' + ELSE '未预约' + END as appointment_status, -- 预约状态描述 + CASE + WHEN xh.F_Id IS NOT NULL THEN '已耗卡' + ELSE '未耗卡' + END as consume_status -- 耗卡状态描述 + FROM lq_tkjlb tk + LEFT JOIN lq_yyjl yy ON tk.F_MemberId = yy.gk + AND yy.F_Status = '已确认' + LEFT JOIN lq_xh_hyhk xh ON tk.F_MemberId = xh.hy + AND xh.F_IsEffective = 1 + WHERE tk.F_EventId = @eventId + AND tk.F_StoreId = @storeId + ORDER BY tk.F_CreateTime DESC + LIMIT @offset, @pageSize"; + + var countSql = @" + SELECT COUNT(*) as total + FROM lq_tkjlb tk + WHERE tk.F_EventId = @eventId + AND tk.F_StoreId = @storeId"; + + var offset = (pageIndex - 1) * pageSize; + var result = await _db.Ado.SqlQueryAsync(sql, new { eventId, storeId, offset, pageSize }); + var totalResult = await _db.Ado.SqlQueryAsync(countSql, new { eventId, storeId }); + var total = totalResult?.FirstOrDefault()?.total ?? 0; + + return new + { + success = true, + data = new + { + list = result, + total = total, + pageIndex = pageIndex, + pageSize = pageSize, + totalPages = (int)Math.Ceiling((double)total / pageSize) + }, + message = "获取门店顾客详情成功" + }; + } + catch (Exception ex) + { + throw NCCException.Oh("获取门店顾客详情失败:" + ex.Message); + } + } + #endregion + } } diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqXmzlService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqXmzlService.cs index 322d823..e1d1d90 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/LqXmzlService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/LqXmzlService.cs @@ -61,8 +61,8 @@ namespace NCC.Extend.LqXmzl return output; } #endregion - - #region 获取项目资料列表 + + #region 获取项目资料列表 /// /// 获取项目资料列表 /// @@ -83,14 +83,13 @@ namespace NCC.Extend.LqXmzl .WhereIF(!string.IsNullOrEmpty(input.fl2), p => p.Fl2.Contains(input.fl2)) .WhereIF(!string.IsNullOrEmpty(input.fl3), p => p.Fl3.Contains(input.fl3)) .WhereIF(!string.IsNullOrEmpty(input.fl4), p => p.Fl4.Contains(input.fl4)) - .WhereIF(!string.IsNullOrEmpty(input.tjlb), p => p.Tjlb.Contains(input.tjlb)) - .WhereIF(!string.IsNullOrEmpty(input.zklb), p => p.Zklb.Contains(input.zklb)) .WhereIF(!string.IsNullOrEmpty(input.fl), p => p.Fl.Contains(input.fl)) .WhereIF(!string.IsNullOrEmpty(input.qt1), p => p.Qt1.Contains(input.qt1)) .WhereIF(!string.IsNullOrEmpty(input.qt2), p => p.Qt2.Contains(input.qt2)) - .WhereIF(!string.IsNullOrEmpty(input.syje), p => p.Syje.Equals(input.syje)) - .WhereIF(!string.IsNullOrEmpty(input.cellje), p => p.Cellje.Equals(input.cellje)) .WhereIF(!string.IsNullOrEmpty(input.sgf), p => p.Sgf.Equals(input.sgf)) + .WhereIF(!string.IsNullOrEmpty(input.beautyType), p => p.BeautyType.Contains(input.beautyType)) + .WhereIF(input.isEffective != 0, p => p.IsEffective.Equals(input.isEffective)) + .WhereIF(!string.IsNullOrEmpty(input.sourceType), p => p.SourceType.Contains(input.sourceType)) .Select(it => new LqXmzlListOutput { id = it.Id, @@ -103,16 +102,13 @@ namespace NCC.Extend.LqXmzl fl2 = it.Fl2, fl3 = it.Fl3, fl4 = it.Fl4, - tjlb = it.Tjlb, - zklb = it.Zklb, fl = it.Fl, qt1 = it.Qt1, qt2 = it.Qt2, - syje = it.Syje, - cellje = it.Cellje, sgf = it.Sgf, - projectNumber = it.ProjectNumber, + beautyType = it.BeautyType, sourceType = it.SourceType, + isEffective = it.IsEffective, }).MergeTable().OrderBy(sidx + " " + input.sort).ToPagedListAsync(input.currentPage, input.pageSize); return PageResult.SqlSugarPageResult(data); } @@ -156,13 +152,9 @@ namespace NCC.Extend.LqXmzl .WhereIF(!string.IsNullOrEmpty(input.fl2), p => p.Fl2.Contains(input.fl2)) .WhereIF(!string.IsNullOrEmpty(input.fl3), p => p.Fl3.Contains(input.fl3)) .WhereIF(!string.IsNullOrEmpty(input.fl4), p => p.Fl4.Contains(input.fl4)) - .WhereIF(!string.IsNullOrEmpty(input.tjlb), p => p.Tjlb.Contains(input.tjlb)) - .WhereIF(!string.IsNullOrEmpty(input.zklb), p => p.Zklb.Contains(input.zklb)) .WhereIF(!string.IsNullOrEmpty(input.fl), p => p.Fl.Contains(input.fl)) .WhereIF(!string.IsNullOrEmpty(input.qt1), p => p.Qt1.Contains(input.qt1)) .WhereIF(!string.IsNullOrEmpty(input.qt2), p => p.Qt2.Contains(input.qt2)) - .WhereIF(!string.IsNullOrEmpty(input.syje), p => p.Syje.Equals(input.syje)) - .WhereIF(!string.IsNullOrEmpty(input.cellje), p => p.Cellje.Equals(input.cellje)) .WhereIF(!string.IsNullOrEmpty(input.sgf), p => p.Sgf.Equals(input.sgf)) .Select(it => new LqXmzlListOutput { @@ -176,13 +168,9 @@ namespace NCC.Extend.LqXmzl fl2 = it.Fl2, fl3 = it.Fl3, fl4 = it.Fl4, - tjlb = it.Tjlb, - zklb = it.Zklb, fl = it.Fl, qt1 = it.Qt1, qt2 = it.Qt2, - syje = it.Syje, - cellje = it.Cellje, sgf = it.Sgf, }).MergeTable().OrderBy(sidx + " " + input.sort).ToListAsync(); return data; @@ -246,6 +234,7 @@ namespace NCC.Extend.LqXmzl [HttpPost("batchRemove")] public async Task BatchRemove([FromBody] List ids) { + throw NCCException.Oh("不允许删除项目资料"); var entitys = await _db.Queryable().In(it => it.Id, ids).ToListAsync(); if (entitys.Count > 0) { @@ -284,19 +273,112 @@ namespace NCC.Extend.LqXmzl } #endregion - #region 删除项目资料 + #region 删除项目资料 /// /// 删除项目资料 /// + /// 主键 /// [HttpDelete("{id}")] public async Task Delete(string id) { - var entity = await _db.Queryable().FirstAsync(p => p.Id == id); - _ = entity ?? throw NCCException.Oh(ErrorCode.COM1005); - var isOk = await _db.Deleteable().Where(d => d.Id == id).ExecuteCommandAsync(); - if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1002); + throw NCCException.Oh("不允许删除项目资料"); } #endregion + + #region 获取字段去重数据 + /// + /// 获取指定字段的去重数据 + /// + /// 字段名称,支持:fl1、fl2、fl3、fl4、fl、qt1、beautyType、sourceType + /// 去重后的字段数据 + [HttpPost("GetDistinctFieldData")] + public async Task GetDistinctFieldData([FromBody] string fieldName) + { + try + { + // 验证字段名称 + var validFields = new[] { "fl1", "fl2", "fl3", "fl4", "fl", "qt1", "beautyType", "sourceType" }; + if (!validFields.Contains(fieldName)) + { + throw NCCException.Oh($"无效的字段名称: {fieldName}。支持的字段: {string.Join(", ", validFields)}"); + } + + List distinctValues = new List(); + + switch (fieldName) + { + case "fl1": + distinctValues = await _db.Queryable() + .Where(p => !string.IsNullOrEmpty(p.Fl1)) + .Select(p => p.Fl1) + .Distinct() + .ToListAsync(); + break; + case "fl2": + distinctValues = await _db.Queryable() + .Where(p => !string.IsNullOrEmpty(p.Fl2)) + .Select(p => p.Fl2) + .Distinct() + .ToListAsync(); + break; + case "fl3": + distinctValues = await _db.Queryable() + .Where(p => !string.IsNullOrEmpty(p.Fl3)) + .Select(p => p.Fl3) + .Distinct() + .ToListAsync(); + break; + case "fl4": + distinctValues = await _db.Queryable() + .Where(p => !string.IsNullOrEmpty(p.Fl4)) + .Select(p => p.Fl4) + .Distinct() + .ToListAsync(); + break; + case "fl": + distinctValues = await _db.Queryable() + .Where(p => !string.IsNullOrEmpty(p.Fl)) + .Select(p => p.Fl) + .Distinct() + .ToListAsync(); + break; + case "qt1": + distinctValues = await _db.Queryable() + .Where(p => !string.IsNullOrEmpty(p.Qt1)) + .Select(p => p.Qt1) + .Distinct() + .ToListAsync(); + break; + case "beautyType": + distinctValues = await _db.Queryable() + .Where(p => !string.IsNullOrEmpty(p.BeautyType)) + .Select(p => p.BeautyType) + .Distinct() + .ToListAsync(); + break; + case "sourceType": + distinctValues = await _db.Queryable() + .Where(p => !string.IsNullOrEmpty(p.SourceType)) + .Select(p => p.SourceType) + .Distinct() + .ToListAsync(); + break; + } + + return new + { + fieldName = fieldName, + values = distinctValues.OrderBy(x => x).ToList() + }; + } + catch (Exception ex) + { + throw NCCException.Oh($"获取字段去重数据失败:{ex.Message}"); + } + } + #endregion + + } }