diff --git a/add_first_upgrade_performance_fields.sql b/add_first_upgrade_performance_fields.sql new file mode 100644 index 0000000..116cc23 --- /dev/null +++ b/add_first_upgrade_performance_fields.sql @@ -0,0 +1,14 @@ +-- 为个人业绩统计表添加首单业绩和升单业绩字段 +ALTER TABLE lq_statistics_personal_performance +ADD COLUMN F_FirstOrderPerformance decimal(18,2) DEFAULT '0.00' COMMENT '首单业绩' AFTER F_UpgradeOrderCount, +ADD COLUMN F_UpgradeOrderPerformance decimal(18,2) DEFAULT '0.00' COMMENT '升单业绩' AFTER F_FirstOrderPerformance; + +-- 为门店总业绩统计表添加首单业绩和升单业绩字段 +ALTER TABLE lq_statistics_store_total_performance +ADD COLUMN F_FirstOrderPerformance decimal(18,2) DEFAULT '0.00' COMMENT '首单业绩' AFTER F_UpgradeOrderCount, +ADD COLUMN F_UpgradeOrderPerformance decimal(18,2) DEFAULT '0.00' COMMENT '升单业绩' AFTER F_FirstOrderPerformance; + +-- 为工资统计表添加首单业绩和升单业绩字段 +ALTER TABLE lq_salary_statistics +ADD COLUMN F_FirstOrderPerformance decimal(18,2) DEFAULT '0.00' COMMENT '首单业绩' AFTER F_UpgradePerformance, +ADD COLUMN F_UpgradeOrderPerformance decimal(18,2) DEFAULT '0.00' COMMENT '升单业绩' AFTER F_FirstOrderPerformance; diff --git a/antis-ncc-admin/src/api/extend/salaryCalculation.js b/antis-ncc-admin/src/api/extend/salaryCalculation.js index d062c3b..d4304ad 100644 --- a/antis-ncc-admin/src/api/extend/salaryCalculation.js +++ b/antis-ncc-admin/src/api/extend/salaryCalculation.js @@ -44,3 +44,30 @@ export function saveDepartmentConsumePerformanceStatistics(statisticsMonth) { data: { statisticsMonth } }) } + +// 保存门店总业绩统计数据 +export function saveStoreTotalPerformanceStatistics(statisticsMonth) { + return request({ + url: '/api/Extend/LqStatistics/save-store-total-performance-stats', + method: 'POST', + data: { statisticsMonth } + }) +} + +// 保存工资统计数据 +export function saveSalaryStatistics(statisticsMonth) { + return request({ + url: '/api/Extend/LqStatistics/save-salary-statistics', + method: 'POST', + data: { statisticsMonth } + }) +} + +// 获取工资统计列表 +export function getSalaryStatisticsList(params) { + return request({ + url: '/api/Extend/LqStatistics/get-salary-statistics-list', + method: 'POST', + data: params + }) +} diff --git a/antis-ncc-admin/src/router/modules/base.js b/antis-ncc-admin/src/router/modules/base.js index 1ab46ca..b3f4641 100644 --- a/antis-ncc-admin/src/router/modules/base.js +++ b/antis-ncc-admin/src/router/modules/base.js @@ -75,6 +75,28 @@ const baseRouter = [{ zhTitle: '拓客活动', icon: 'icon-ym icon-ym-s-data', } + }, + { + path: '/salaryCalculation', + component: (resolve) => require(['@/views/salaryCalculation/index'], resolve), + name: 'salaryCalculation', + meta: { + title: 'salaryCalculation', + affix: false, + zhTitle: '工资计算', + icon: 'icon-ym icon-ym-money', + } + }, + { + path: '/salaryStatistics', + component: (resolve) => require(['@/views/salaryStatistics/index'], resolve), + name: 'salaryStatistics', + meta: { + title: 'salaryStatistics', + affix: false, + zhTitle: '工资统计', + icon: 'icon-ym icon-ym-s-data', + } } ] export default baseRouter \ No newline at end of file diff --git a/antis-ncc-admin/src/views/salaryCalculation/index.vue b/antis-ncc-admin/src/views/salaryCalculation/index.vue index db4b7e8..c78a672 100644 --- a/antis-ncc-admin/src/views/salaryCalculation/index.vue +++ b/antis-ncc-admin/src/views/salaryCalculation/index.vue @@ -134,6 +134,38 @@ +
+
+ + 门店总业绩 +
+ + 立即统计 + +
+ +
+
+ + 工资统计 +
+ + 立即统计 + +
+
@@ -172,9 +204,14 @@
统计结果 - - 清空 - +
+ + 查看工资统计 + + + 清空 + +
@@ -203,7 +240,9 @@ import { savePersonalPerformanceStatistics, saveTechPerformanceStatistics, saveStoreConsumePerformanceStatistics, - saveDepartmentConsumePerformanceStatistics + saveDepartmentConsumePerformanceStatistics, + saveStoreTotalPerformanceStatistics, + saveSalaryStatistics } from '@/api/extend/salaryCalculation' export default { @@ -216,7 +255,9 @@ export default { personalPerformance: false, techPerformance: false, storeConsumePerformance: false, - departmentConsumePerformance: false + departmentConsumePerformance: false, + storeTotalPerformance: false, + salaryStatistics: false }, results: [], // 存储统计结果,最多保留10条 isCalculating: false, // 一键计算状态 @@ -292,6 +333,16 @@ export default { name: '个人消耗业绩统计', method: 'handleDepartmentConsumePerformanceStatistics', type: 'department-consume-performance' + }, + { + name: '门店总业绩统计', + method: 'handleStoreTotalPerformanceStatistics', + type: 'store-total-performance' + }, + { + name: '工资统计', + method: 'handleSalaryStatistics', + type: 'salary-statistics' } ] @@ -520,6 +571,72 @@ export default { } finally { this.loadingStates.departmentConsumePerformance = false } + }, + + // 门店总业绩统计 + async handleStoreTotalPerformanceStatistics() { + this.loadingStates.storeTotalPerformance = true + try { + const response = await saveStoreTotalPerformanceStatistics(this.statisticsMonth) + this.addResult({ + type: 'store-total-performance', + title: '门店总业绩统计', + success: true, + data: response.data, + time: new Date().toLocaleString() + }) + this.$message.success('门店总业绩统计完成') + } catch (error) { + this.addResult({ + type: 'store-total-performance', + title: '门店总业绩统计', + success: false, + data: error.message || '统计失败', + time: new Date().toLocaleString() + }) + this.$message.error('门店总业绩统计失败') + throw error + } finally { + this.loadingStates.storeTotalPerformance = false + } + }, + + // 工资统计 + async handleSalaryStatistics() { + this.loadingStates.salaryStatistics = true + try { + const response = await saveSalaryStatistics(this.statisticsMonth) + this.addResult({ + type: 'salary-statistics', + title: '工资统计', + success: true, + data: response.data, + time: new Date().toLocaleString() + }) + this.$message.success('工资统计完成') + } catch (error) { + this.addResult({ + type: 'salary-statistics', + title: '工资统计', + success: false, + data: error.message || '统计失败', + time: new Date().toLocaleString() + }) + this.$message.error('工资统计失败') + throw error + } finally { + this.loadingStates.salaryStatistics = false + } + }, + + // 跳转到工资统计页面 + goToSalaryPage() { + this.$router.push({ + path: '/salaryStatistics', + query: { + month: this.statisticsMonth + } + }) } } } @@ -706,6 +823,16 @@ export default { .stat-header i { color: #17A2B8; } } + &.red-item { + border-color: #F56C6C; + .stat-header i { color: #F56C6C; } + } + + &.gold-item { + border-color: #E6A23C; + .stat-header i { color: #E6A23C; } + } + &.placeholder-item { border-color: #C0C4CC; background: #f5f7fa; diff --git a/antis-ncc-admin/src/views/salaryStatistics/index.vue b/antis-ncc-admin/src/views/salaryStatistics/index.vue new file mode 100644 index 0000000..8261bc5 --- /dev/null +++ b/antis-ncc-admin/src/views/salaryStatistics/index.vue @@ -0,0 +1,773 @@ + + + + + diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqSalaryStatistics/LqSalaryStatisticsListOutput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqSalaryStatistics/LqSalaryStatisticsListOutput.cs new file mode 100644 index 0000000..4b6404f --- /dev/null +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqSalaryStatistics/LqSalaryStatisticsListOutput.cs @@ -0,0 +1,539 @@ +using System; + +namespace NCC.Extend.Entitys.Dto.LqSalaryStatistics +{ + /// + /// 工资统计列表输出参数 + /// + public class LqSalaryStatisticsListOutput + { + /// + /// 主键ID + /// + public string Id { get; set; } + + /// + /// 统计月份 + /// + public string StatisticsMonth { get; set; } + + /// + /// 门店ID + /// + public string StoreId { get; set; } + + /// + /// 门店名称 + /// + public string StoreName { get; set; } + + /// + /// 员工ID + /// + public string EmployeeId { get; set; } + + /// + /// 员工姓名 + /// + public string EmployeeName { get; set; } + + /// + /// 岗位 + /// + public string Position { get; set; } + + /// + /// 金三角战队 + /// + public string GoldTriangleTeam { get; set; } + + /// + /// 总业绩 + /// + public decimal TotalPerformance { get; set; } + + /// + /// 基础业绩 + /// + public decimal BasePerformance { get; set; } + + /// + /// 合作业绩 + /// + public decimal CooperationPerformance { get; set; } + + /// + /// 奖励业绩 + /// + public decimal RewardPerformance { get; set; } + + /// + /// 新客业绩 + /// + public decimal NewCustomerPerformance { get; set; } + + /// + /// 升单业绩 + /// + public decimal UpgradePerformance { get; set; } + + /// + /// 项目数 + /// + public int ProjectCount { get; set; } + + /// + /// 门店总业绩 + /// + public decimal StoreTotalPerformance { get; set; } + + /// + /// 队伍业绩 + /// + public decimal TeamPerformance { get; set; } + + /// + /// 占比 + /// + public decimal PerformanceRatio { get; set; } + + /// + /// 新客成交率 + /// + public decimal NewCustomerConversionRate { get; set; } + + /// + /// 新客提点 + /// + public decimal NewCustomerPoint { get; set; } + + /// + /// 升单提点 + /// + public decimal UpgradePoint { get; set; } + + /// + /// 溯源业绩 + /// + public decimal TraceabilityPerformance { get; set; } + + /// + /// Cell业绩 + /// + public decimal CellPerformance { get; set; } + + /// + /// 大项目一部业绩 + /// + public decimal ProjectOnePerformance { get; set; } + + /// + /// 大项目二部业绩 + /// + public decimal ProjectTwoPerformance { get; set; } + + /// + /// 当月业绩 + /// + public decimal MonthlyPerformance { get; set; } + + /// + /// 物业水电 + /// + public decimal PropertyWaterElectricity { get; set; } + + /// + /// 门店支出 + /// + public decimal StoreExpense { get; set; } + + /// + /// 产品物料 + /// + public decimal ProductMaterial { get; set; } + + /// + /// 微雕成本 + /// + public decimal MicroSculptureCost { get; set; } + + /// + /// 其它合作成本 + /// + public decimal OtherCooperationCost { get; set; } + + /// + /// 洗毛巾 + /// + public decimal TowelWashing { get; set; } + + /// + /// 毛利 + /// + public decimal GrossProfit { get; set; } + + /// + /// 总经理提成额 + /// + public decimal GeneralManagerCommission { get; set; } + + /// + /// 经理提成额 + /// + public decimal ManagerCommission { get; set; } + + /// + /// 消耗 + /// + public decimal Consumption { get; set; } + + /// + /// 到店人头 + /// + public int AttendanceDays { get; set; } + + /// + /// 在店天数 + /// + public int StoreDays { get; set; } + + /// + /// 请假天数 + /// + public int LeaveDays { get; set; } + + /// + /// 提点 + /// + public decimal CommissionPoint { get; set; } + + /// + /// 基础业绩提成 + /// + public decimal BasePerformanceCommission { get; set; } + + /// + /// 合作业绩提成 + /// + public decimal CooperationPerformanceCommission { get; set; } + + /// + /// 顾问提成 + /// + public decimal ConsultantCommission { get; set; } + + /// + /// 门店T区提成 + /// + public decimal StoreTAreaCommission { get; set; } + + /// + /// 店助提成 + /// + public decimal AssistantCommission1 { get; set; } + + /// + /// 店助主任提成 + /// + public decimal AssistantDirectorCommission { get; set; } + + /// + /// 主任提成 + /// + public decimal DirectorCommission { get; set; } + + /// + /// 店长提成 + /// + public decimal AssistantCommission2 { get; set; } + + /// + /// 总经理提成 + /// + public decimal GeneralManagerCommissionAmount { get; set; } + + /// + /// 经理提成 + /// + public decimal ManagerCommissionAmount { get; set; } + + /// + /// 业绩提成 + /// + public decimal PerformanceCommission { get; set; } + + /// + /// 消耗提成 + /// + public decimal ConsumptionCommission { get; set; } + + /// + /// 科技部组长提成 + /// + public decimal TechGroupLeaderCommission { get; set; } + + /// + /// 溯源提成 + /// + public decimal TraceabilityCommission { get; set; } + + /// + /// Cell提成 + /// + public decimal CellCommission { get; set; } + + /// + /// 大项目部提成 + /// + public decimal ProjectCommission { get; set; } + + /// + /// 提成合计 + /// + public decimal CommissionTotal { get; set; } + + /// + /// 健康师底薪 + /// + public decimal HealthCoachBaseSalary { get; set; } + + /// + /// 店助底薪 + /// + public decimal AssistantBaseSalary { get; set; } + + /// + /// 店长底薪 + /// + public decimal ManagerBaseSalary { get; set; } + + /// + /// 主任底薪 + /// + public decimal DirectorBaseSalary { get; set; } + + /// + /// 店助主任底薪 + /// + public decimal AssistantDirectorBaseSalary { get; set; } + + /// + /// 总经理底薪 + /// + public decimal GeneralManagerBaseSalary { get; set; } + + /// + /// 经理底薪 + /// + public decimal ManagerBaseSalaryAmount { get; set; } + + /// + /// 科技部老师底薪 + /// + public decimal TechTeacherBaseSalary { get; set; } + + /// + /// 大项目部底薪 + /// + public decimal ProjectBaseSalary { get; set; } + + /// + /// 底薪合计 + /// + public decimal BaseSalaryTotal { get; set; } + + /// + /// 手工 + /// + public decimal ManualWork { get; set; } + + /// + /// 人头奖励 + /// + public decimal HeadCountReward { get; set; } + + /// + /// 手机管理 + /// + public decimal PhoneManagement { get; set; } + + /// + /// 车补 + /// + public decimal CarAllowance { get; set; } + + /// + /// 少休 + /// + public decimal LessRest { get; set; } + + /// + /// 全勤 + /// + public decimal FullAttendance { get; set; } + + /// + /// 核算应发工资 + /// + public decimal CalculatedGrossSalary { get; set; } + + /// + /// 保底 + /// + public decimal Guarantee { get; set; } + + /// + /// 保底请假 + /// + public decimal GuaranteeLeave { get; set; } + + /// + /// 保底底薪 + /// + public decimal GuaranteeBaseSalary { get; set; } + + /// + /// 保底补差 + /// + public decimal GuaranteeSupplement { get; set; } + + /// + /// 最终应发工资 + /// + public decimal FinalGrossSalary { get; set; } + + /// + /// 当月培训补贴 + /// + public decimal MonthlyTrainingSubsidy { get; set; } + + /// + /// 当月交通补贴 + /// + public decimal MonthlyTransportSubsidy { get; set; } + + /// + /// 上月培训补贴 + /// + public decimal LastMonthTrainingSubsidy { get; set; } + + /// + /// 上月交通补贴 + /// + public decimal LastMonthTransportSubsidy { get; set; } + + /// + /// 补贴合计 + /// + public decimal SubsidyTotal { get; set; } + + /// + /// 缺卡 + /// + public decimal MissingCard { get; set; } + + /// + /// 迟到 + /// + public decimal Late { get; set; } + + /// + /// 请假 + /// + public decimal Leave { get; set; } + + /// + /// 扣社保 + /// + public decimal SocialSecurityDeduction { get; set; } + + /// + /// 扣除奖励 + /// + public decimal RewardDeduction { get; set; } + + /// + /// 扣住宿 + /// + public decimal AccommodationDeduction { get; set; } + + /// + /// 扣学习期 + /// + public decimal StudyPeriodDeduction { get; set; } + + /// + /// 扣工作服 + /// + public decimal WorkClothesDeduction { get; set; } + + /// + /// 扣款合计 + /// + public decimal DeductionTotal { get; set; } + + /// + /// 发奖金 + /// + public decimal Bonus { get; set; } + + /// + /// 退手机押金 + /// + public decimal PhoneDepositReturn { get; set; } + + /// + /// 退住宿押金 + /// + public decimal AccommodationDepositReturn { get; set; } + + /// + /// 实发工资 + /// + public decimal ActualGrossSalary { get; set; } + + /// + /// 当月是否发放 + /// + public string MonthlyPaymentStatus { get; set; } + + /// + /// 支付金额 + /// + public decimal PaymentAmount { get; set; } + + /// + /// 待支付金额 + /// + public decimal PendingPaymentAmount { get; set; } + + /// + /// 补发上月 + /// + public decimal LastMonthSupplement { get; set; } + + /// + /// 当月支付总额 + /// + public decimal MonthlyPaymentTotal { get; set; } + + /// + /// 是否锁定 + /// + public bool IsLocked { get; set; } + + /// + /// 创建时间 + /// + public DateTime CreateTime { get; set; } + + /// + /// 更新时间 + /// + public DateTime UpdateTime { get; set; } + + + + + } +} \ No newline at end of file diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqSalaryStatistics/LqSalaryStatisticsListQueryInput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqSalaryStatistics/LqSalaryStatisticsListQueryInput.cs new file mode 100644 index 0000000..e87ee1c --- /dev/null +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqSalaryStatistics/LqSalaryStatisticsListQueryInput.cs @@ -0,0 +1,45 @@ +using NCC.Common.Filter; + +namespace NCC.Extend.Entitys.Dto.LqSalaryStatistics +{ + /// + /// 工资统计列表查询输入参数 + /// + public class LqSalaryStatisticsListQueryInput : PageInputBase + { + /// + /// 门店ID + /// + public string storeId { get; set; } + + /// + /// 门店名称 + /// + public string storeName { get; set; } + + /// + /// 员工姓名 + /// + public string employeeName { get; set; } + + /// + /// 员工ID + /// + public string employeeId { get; set; } + + /// + /// 核算岗位 + /// + public string position { get; set; } + + /// + /// 统计月份 + /// + public string statisticsMonth { get; set; } + + /// + /// 是否锁定 + /// + public int? isLocked { get; set; } + } +} diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStatisticsPersonalPerformance/LqStatisticsPersonalPerformanceListOutput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStatisticsPersonalPerformance/LqStatisticsPersonalPerformanceListOutput.cs index ca01219..e89c7a1 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStatisticsPersonalPerformance/LqStatisticsPersonalPerformanceListOutput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStatisticsPersonalPerformance/LqStatisticsPersonalPerformanceListOutput.cs @@ -73,6 +73,26 @@ namespace NCC.Extend.Entitys.Dto.LqStatisticsPersonalPerformance public int OrderCount { get; set; } /// + /// 首开单数量 + /// + public int FirstOrderCount { get; set; } + + /// + /// 升单数量 + /// + public int UpgradeOrderCount { get; set; } + + /// + /// 首单业绩 + /// + public decimal FirstOrderPerformance { get; set; } + + /// + /// 升单业绩 + /// + public decimal UpgradeOrderPerformance { get; set; } + + /// /// 最后订单日期 /// public DateTime? LastOrderDate { get; set; } diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStatisticsStoreTotalPerformance/LqStatisticsStoreTotalPerformanceInfoOutput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStatisticsStoreTotalPerformance/LqStatisticsStoreTotalPerformanceInfoOutput.cs new file mode 100644 index 0000000..7e48a59 --- /dev/null +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStatisticsStoreTotalPerformance/LqStatisticsStoreTotalPerformanceInfoOutput.cs @@ -0,0 +1,70 @@ +using System; + +namespace NCC.Extend.Entitys.Dto.LqStatisticsStoreTotalPerformance +{ + /// + /// 门店总业绩统计详情输出参数 + /// + public class LqStatisticsStoreTotalPerformanceInfoOutput + { + /// + /// 主键ID + /// + public string id { get; set; } + + /// + /// 门店ID + /// + public string storeId { get; set; } + + /// + /// 门店名称 + /// + public string storeName { get; set; } + + /// + /// 统计月份 + /// + public string statisticsMonth { get; set; } + + /// + /// 总业绩 + /// + public decimal totalPerformance { get; set; } + + /// + /// 欠款金额 + /// + public decimal debtAmount { get; set; } + + /// + /// 总单业绩 + /// + public decimal totalOrderPerformance { get; set; } + + /// + /// 储扣总金额 + /// + public decimal storageDeductionAmount { get; set; } + + /// + /// 品项数量 + /// + public int itemQuantity { get; set; } + + /// + /// 首开单数量 + /// + public int firstOrderCount { get; set; } + + /// + /// 升单数量 + /// + public int upgradeOrderCount { get; set; } + + /// + /// 创建时间 + /// + public DateTime? createTime { get; set; } + } +} diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStatisticsStoreTotalPerformance/LqStatisticsStoreTotalPerformanceListOutput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStatisticsStoreTotalPerformance/LqStatisticsStoreTotalPerformanceListOutput.cs new file mode 100644 index 0000000..7bb2aac --- /dev/null +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStatisticsStoreTotalPerformance/LqStatisticsStoreTotalPerformanceListOutput.cs @@ -0,0 +1,80 @@ +using System; + +namespace NCC.Extend.Entitys.Dto.LqStatisticsStoreTotalPerformance +{ + /// + /// 门店总业绩统计列表输出参数 + /// + public class LqStatisticsStoreTotalPerformanceListOutput + { + /// + /// 主键ID + /// + public string id { get; set; } + + /// + /// 门店ID + /// + public string storeId { get; set; } + + /// + /// 门店名称 + /// + public string storeName { get; set; } + + /// + /// 统计月份 + /// + public string statisticsMonth { get; set; } + + /// + /// 总业绩 + /// + public decimal totalPerformance { get; set; } + + /// + /// 欠款金额 + /// + public decimal debtAmount { get; set; } + + /// + /// 总单业绩 + /// + public decimal totalOrderPerformance { get; set; } + + /// + /// 储扣总金额 + /// + public decimal storageDeductionAmount { get; set; } + + /// + /// 品项数量 + /// + public int itemQuantity { get; set; } + + /// + /// 首开单数量 + /// + public int firstOrderCount { get; set; } + + /// + /// 升单数量 + /// + public int upgradeOrderCount { get; set; } + + /// + /// 首单业绩 + /// + public decimal firstOrderPerformance { get; set; } + + /// + /// 升单业绩 + /// + public decimal upgradeOrderPerformance { get; set; } + + /// + /// 创建时间 + /// + public DateTime? createTime { get; set; } + } +} diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStatisticsStoreTotalPerformance/LqStatisticsStoreTotalPerformanceListQueryInput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStatisticsStoreTotalPerformance/LqStatisticsStoreTotalPerformanceListQueryInput.cs new file mode 100644 index 0000000..1800a42 --- /dev/null +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqStatisticsStoreTotalPerformance/LqStatisticsStoreTotalPerformanceListQueryInput.cs @@ -0,0 +1,25 @@ +using NCC.Common.Filter; + +namespace NCC.Extend.Entitys.Dto.LqStatisticsStoreTotalPerformance +{ + /// + /// 门店总业绩统计列表查询输入参数 + /// + public class LqStatisticsStoreTotalPerformanceListQueryInput : PageInputBase + { + /// + /// 门店ID + /// + public string storeId { get; set; } + + /// + /// 门店名称 + /// + public string storeName { get; set; } + + /// + /// 统计月份 + /// + public string statisticsMonth { get; set; } + } +} diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_salary_statistics/LqSalaryStatisticsEntity.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_salary_statistics/LqSalaryStatisticsEntity.cs new file mode 100644 index 0000000..fbecd06 --- /dev/null +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_salary_statistics/LqSalaryStatisticsEntity.cs @@ -0,0 +1,656 @@ +using System; +using NCC.Common.Const; +using SqlSugar; + +namespace NCC.Extend.Entitys.lq_salary_statistics +{ + /// + /// 工资统计表 + /// + [SugarTable("lq_salary_statistics")] + [Tenant(ClaimConst.TENANT_ID)] + public class LqSalaryStatisticsEntity + { + /// + /// 主键ID + /// + [SugarColumn(ColumnName = "F_Id", IsPrimaryKey = true)] + public string Id { get; set; } + + /// + /// 门店ID + /// + [SugarColumn(ColumnName = "F_StoreId")] + public string StoreId { get; set; } + + /// + /// 门店名称 + /// + [SugarColumn(ColumnName = "F_StoreName")] + public string StoreName { get; set; } + + /// + /// 核算岗位 + /// + [SugarColumn(ColumnName = "F_Position")] + public string Position { get; set; } + + /// + /// 员工姓名 + /// + [SugarColumn(ColumnName = "F_EmployeeName")] + public string EmployeeName { get; set; } + + /// + /// 员工ID + /// + [SugarColumn(ColumnName = "F_EmployeeId")] + public string EmployeeId { get; set; } + + /// + /// 金三角战队 + /// + [SugarColumn(ColumnName = "F_GoldTriangleTeam")] + public string GoldTriangleTeam { get; set; } + + /// + /// 总业绩 + /// + [SugarColumn(ColumnName = "F_TotalPerformance")] + public decimal TotalPerformance { get; set; } + + /// + /// 基础业绩 + /// + [SugarColumn(ColumnName = "F_BasePerformance")] + public decimal BasePerformance { get; set; } + + /// + /// 合作业绩 + /// + [SugarColumn(ColumnName = "F_CooperationPerformance")] + public decimal CooperationPerformance { get; set; } + + /// + /// 奖励业绩 + /// + [SugarColumn(ColumnName = "F_RewardPerformance")] + public decimal RewardPerformance { get; set; } + + /// + /// 门店总业绩 + /// + [SugarColumn(ColumnName = "F_StoreTotalPerformance")] + public decimal StoreTotalPerformance { get; set; } + + /// + /// 队伍业绩 + /// + [SugarColumn(ColumnName = "F_TeamPerformance")] + public decimal TeamPerformance { get; set; } + + /// + /// 占比 + /// + [SugarColumn(ColumnName = "F_Percentage")] + public decimal Percentage { get; set; } + + /// + /// 新客业绩 + /// + [SugarColumn(ColumnName = "F_NewCustomerPerformance")] + public decimal NewCustomerPerformance { get; set; } + + /// + /// 新客成交率 + /// + [SugarColumn(ColumnName = "F_NewCustomerConversionRate")] + public decimal NewCustomerConversionRate { get; set; } + + /// + /// 新客提点 + /// + [SugarColumn(ColumnName = "F_NewCustomerPoint")] + public decimal NewCustomerPoint { get; set; } + + /// + /// 升单业绩 + /// + [SugarColumn(ColumnName = "F_UpgradePerformance")] + public decimal UpgradePerformance { get; set; } + + /// + /// 升单提点 + /// + [SugarColumn(ColumnName = "F_UpgradePoint")] + public decimal UpgradePoint { get; set; } + + /// + /// 溯源业绩 + /// + [SugarColumn(ColumnName = "F_TraceabilityPerformance")] + public decimal TraceabilityPerformance { get; set; } + + /// + /// Cell业绩 + /// + [SugarColumn(ColumnName = "F_CellPerformance")] + public decimal CellPerformance { get; set; } + + /// + /// 大项目一部业绩 + /// + [SugarColumn(ColumnName = "F_MajorProject1Performance")] + public decimal MajorProject1Performance { get; set; } + + /// + /// 大项目二部业绩 + /// + [SugarColumn(ColumnName = "F_MajorProject2Performance")] + public decimal MajorProject2Performance { get; set; } + + /// + /// 当月业绩 + /// + [SugarColumn(ColumnName = "F_MonthlyPerformance")] + public decimal MonthlyPerformance { get; set; } + + /// + /// 物业水电 + /// + [SugarColumn(ColumnName = "F_PropertyWaterElectricity")] + public decimal PropertyWaterElectricity { get; set; } + + /// + /// 门店支出 + /// + [SugarColumn(ColumnName = "F_StoreExpense")] + public decimal StoreExpense { get; set; } + + /// + /// 产品物料 + /// + [SugarColumn(ColumnName = "F_ProductMaterial")] + public decimal ProductMaterial { get; set; } + + /// + /// 微雕成本 + /// + [SugarColumn(ColumnName = "F_MicroSculptureCost")] + public decimal MicroSculptureCost { get; set; } + + /// + /// 其它合作成本 + /// + [SugarColumn(ColumnName = "F_OtherCooperationCost")] + public decimal OtherCooperationCost { get; set; } + + /// + /// 洗毛巾 + /// + [SugarColumn(ColumnName = "F_TowelWashing")] + public decimal TowelWashing { get; set; } + + /// + /// 毛利 + /// + [SugarColumn(ColumnName = "F_GrossProfit")] + public decimal GrossProfit { get; set; } + + /// + /// 总经理提成额 + /// + [SugarColumn(ColumnName = "F_GeneralManagerCommission")] + public decimal GeneralManagerCommission { get; set; } + + /// + /// 经理提成额 + /// + [SugarColumn(ColumnName = "F_ManagerCommission")] + public decimal ManagerCommission { get; set; } + + /// + /// 消耗 + /// + [SugarColumn(ColumnName = "F_Consumption")] + public decimal Consumption { get; set; } + + /// + /// 项目数 + /// + [SugarColumn(ColumnName = "F_ProjectCount")] + public int ProjectCount { get; set; } + + /// + /// 到店人头 + /// + [SugarColumn(ColumnName = "F_CustomerCount")] + public int CustomerCount { get; set; } + + /// + /// 在店天数 + /// + [SugarColumn(ColumnName = "F_WorkingDays")] + public int WorkingDays { get; set; } + + /// + /// 请假天数 + /// + [SugarColumn(ColumnName = "F_LeaveDays")] + public int LeaveDays { get; set; } + + /// + /// 提点 + /// + [SugarColumn(ColumnName = "F_CommissionPoint")] + public decimal CommissionPoint { get; set; } + + /// + /// 基础业绩提成 + /// + [SugarColumn(ColumnName = "F_BasePerformanceCommission")] + public decimal BasePerformanceCommission { get; set; } + + /// + /// 合作业绩提成 + /// + [SugarColumn(ColumnName = "F_CooperationPerformanceCommission")] + public decimal CooperationPerformanceCommission { get; set; } + + /// + /// 顾问提成 + /// + [SugarColumn(ColumnName = "F_ConsultantCommission")] + public decimal ConsultantCommission { get; set; } + + /// + /// 门店T区提成 + /// + [SugarColumn(ColumnName = "F_StoreTZoneCommission")] + public decimal StoreTZoneCommission { get; set; } + + /// + /// 店助提成 + /// + [SugarColumn(ColumnName = "F_AssistantCommission")] + public decimal AssistantCommission { get; set; } + + /// + /// 店助主任提成 + /// + [SugarColumn(ColumnName = "F_AssistantDirectorCommission")] + public decimal AssistantDirectorCommission { get; set; } + + /// + /// 主任提成 + /// + [SugarColumn(ColumnName = "F_DirectorCommission")] + public decimal DirectorCommission { get; set; } + + /// + /// 店长提成 + /// + [SugarColumn(ColumnName = "F_StoreManagerCommission")] + public decimal StoreManagerCommission { get; set; } + + /// + /// 总经理提成 + /// + [SugarColumn(ColumnName = "F_GeneralManagerCommissionTotal")] + public decimal GeneralManagerCommissionTotal { get; set; } + + /// + /// 经理提成 + /// + [SugarColumn(ColumnName = "F_ManagerCommissionTotal")] + public decimal ManagerCommissionTotal { get; set; } + + /// + /// 业绩提成 + /// + [SugarColumn(ColumnName = "F_PerformanceCommission")] + public decimal PerformanceCommission { get; set; } + + /// + /// 消耗提成 + /// + [SugarColumn(ColumnName = "F_ConsumptionCommission")] + public decimal ConsumptionCommission { get; set; } + + /// + /// 科技部组长提成 + /// + [SugarColumn(ColumnName = "F_TechGroupLeaderCommission")] + public decimal TechGroupLeaderCommission { get; set; } + + /// + /// 溯源提成 + /// + [SugarColumn(ColumnName = "F_TraceabilityCommission")] + public decimal TraceabilityCommission { get; set; } + + /// + /// Cell提成 + /// + [SugarColumn(ColumnName = "F_CellCommission")] + public decimal CellCommission { get; set; } + + /// + /// 大项目部提成 + /// + [SugarColumn(ColumnName = "F_MajorProjectCommission")] + public decimal MajorProjectCommission { get; set; } + + /// + /// 提成合计 + /// + [SugarColumn(ColumnName = "F_TotalCommission")] + public decimal TotalCommission { get; set; } + + /// + /// 健康师底薪 + /// + [SugarColumn(ColumnName = "F_HealthCoachBaseSalary")] + public decimal HealthCoachBaseSalary { get; set; } + + /// + /// 店助底薪 + /// + [SugarColumn(ColumnName = "F_AssistantBaseSalary")] + public decimal AssistantBaseSalary { get; set; } + + /// + /// 店长底薪 + /// + [SugarColumn(ColumnName = "F_StoreManagerBaseSalary")] + public decimal StoreManagerBaseSalary { get; set; } + + /// + /// 主任底薪 + /// + [SugarColumn(ColumnName = "F_DirectorBaseSalary")] + public decimal DirectorBaseSalary { get; set; } + + /// + /// 店助主任底薪 + /// + [SugarColumn(ColumnName = "F_AssistantDirectorBaseSalary")] + public decimal AssistantDirectorBaseSalary { get; set; } + + /// + /// 总经理底薪 + /// + [SugarColumn(ColumnName = "F_GeneralManagerBaseSalary")] + public decimal GeneralManagerBaseSalary { get; set; } + + /// + /// 经理底薪 + /// + [SugarColumn(ColumnName = "F_ManagerBaseSalary")] + public decimal ManagerBaseSalary { get; set; } + + /// + /// 科技部老师底薪 + /// + [SugarColumn(ColumnName = "F_TechTeacherBaseSalary")] + public decimal TechTeacherBaseSalary { get; set; } + + /// + /// 大项目部底薪 + /// + [SugarColumn(ColumnName = "F_MajorProjectBaseSalary")] + public decimal MajorProjectBaseSalary { get; set; } + + /// + /// 底薪合计 + /// + [SugarColumn(ColumnName = "F_TotalBaseSalary")] + public decimal TotalBaseSalary { get; set; } + + /// + /// 手工费 + /// + [SugarColumn(ColumnName = "F_HandworkFee")] + public decimal HandworkFee { get; set; } + + /// + /// 人头奖励 + /// + [SugarColumn(ColumnName = "F_PersonnelReward")] + public decimal PersonnelReward { get; set; } + + /// + /// 手机管理费 + /// + [SugarColumn(ColumnName = "F_PhoneManagement")] + public decimal PhoneManagement { get; set; } + + /// + /// 车补 + /// + [SugarColumn(ColumnName = "F_TransportationAllowance")] + public decimal TransportationAllowance { get; set; } + + /// + /// 少休费 + /// + [SugarColumn(ColumnName = "F_LessRest")] + public decimal LessRest { get; set; } + + /// + /// 全勤奖 + /// + [SugarColumn(ColumnName = "F_FullAttendance")] + public decimal FullAttendance { get; set; } + + /// + /// 核算应发工资 + /// + [SugarColumn(ColumnName = "F_CalculatedGrossSalary")] + public decimal CalculatedGrossSalary { get; set; } + + /// + /// 保底工资 + /// + [SugarColumn(ColumnName = "F_GuaranteedSalary")] + public decimal GuaranteedSalary { get; set; } + + /// + /// 保底请假扣款 + /// + [SugarColumn(ColumnName = "F_GuaranteedLeaveDeduction")] + public decimal GuaranteedLeaveDeduction { get; set; } + + /// + /// 保底底薪 + /// + [SugarColumn(ColumnName = "F_GuaranteedBaseSalary")] + public decimal GuaranteedBaseSalary { get; set; } + + /// + /// 保底补差 + /// + [SugarColumn(ColumnName = "F_GuaranteedSupplement")] + public decimal GuaranteedSupplement { get; set; } + + /// + /// 最终应发工资 + /// + [SugarColumn(ColumnName = "F_FinalGrossSalary")] + public decimal FinalGrossSalary { get; set; } + + /// + /// 当月培训补贴 + /// + [SugarColumn(ColumnName = "F_MonthlyTrainingSubsidy")] + public decimal MonthlyTrainingSubsidy { get; set; } + + /// + /// 当月交通补贴 + /// + [SugarColumn(ColumnName = "F_MonthlyTransportSubsidy")] + public decimal MonthlyTransportSubsidy { get; set; } + + /// + /// 上月培训补贴 + /// + [SugarColumn(ColumnName = "F_LastMonthTrainingSubsidy")] + public decimal LastMonthTrainingSubsidy { get; set; } + + /// + /// 上月交通补贴 + /// + [SugarColumn(ColumnName = "F_LastMonthTransportSubsidy")] + public decimal LastMonthTransportSubsidy { get; set; } + + /// + /// 补贴合计 + /// + [SugarColumn(ColumnName = "F_TotalSubsidy")] + public decimal TotalSubsidy { get; set; } + + /// + /// 缺卡扣款 + /// + [SugarColumn(ColumnName = "F_MissingCard")] + public decimal MissingCard { get; set; } + + /// + /// 迟到扣款 + /// + [SugarColumn(ColumnName = "F_LateArrival")] + public decimal LateArrival { get; set; } + + /// + /// 请假扣款 + /// + [SugarColumn(ColumnName = "F_LeaveDeduction")] + public decimal LeaveDeduction { get; set; } + + /// + /// 扣社保 + /// + [SugarColumn(ColumnName = "F_SocialInsuranceDeduction")] + public decimal SocialInsuranceDeduction { get; set; } + + /// + /// 扣除奖励 + /// + [SugarColumn(ColumnName = "F_RewardDeduction")] + public decimal RewardDeduction { get; set; } + + /// + /// 扣住宿费 + /// + [SugarColumn(ColumnName = "F_AccommodationDeduction")] + public decimal AccommodationDeduction { get; set; } + + /// + /// 扣学习期费用 + /// + [SugarColumn(ColumnName = "F_StudyPeriodDeduction")] + public decimal StudyPeriodDeduction { get; set; } + + /// + /// 扣工作服费用 + /// + [SugarColumn(ColumnName = "F_WorkClothesDeduction")] + public decimal WorkClothesDeduction { get; set; } + + /// + /// 扣款合计 + /// + [SugarColumn(ColumnName = "F_TotalDeduction")] + public decimal TotalDeduction { get; set; } + + /// + /// 发奖金 + /// + [SugarColumn(ColumnName = "F_Bonus")] + public decimal Bonus { get; set; } + + /// + /// 退手机押金 + /// + [SugarColumn(ColumnName = "F_ReturnPhoneDeposit")] + public decimal ReturnPhoneDeposit { get; set; } + + /// + /// 退住宿押金 + /// + [SugarColumn(ColumnName = "F_ReturnAccommodationDeposit")] + public decimal ReturnAccommodationDeposit { get; set; } + + /// + /// 实发工资 + /// + [SugarColumn(ColumnName = "F_ActualSalary")] + public decimal ActualSalary { get; set; } + + /// + /// 当月是否发放 + /// + [SugarColumn(ColumnName = "F_MonthlyPaymentStatus")] + public string MonthlyPaymentStatus { get; set; } + + /// + /// 支付金额 + /// + [SugarColumn(ColumnName = "F_PaidAmount")] + public decimal PaidAmount { get; set; } + + /// + /// 待支付金额 + /// + [SugarColumn(ColumnName = "F_PendingAmount")] + public decimal PendingAmount { get; set; } + + /// + /// 补发上月 + /// + [SugarColumn(ColumnName = "F_LastMonthSupplement")] + public decimal LastMonthSupplement { get; set; } + + /// + /// 当月支付总额 + /// + [SugarColumn(ColumnName = "F_MonthlyTotalPayment")] + public decimal MonthlyTotalPayment { get; set; } + + /// + /// 统计月份(YYYYMM) + /// + [SugarColumn(ColumnName = "F_StatisticsMonth")] + public string StatisticsMonth { get; set; } + + /// + /// 是否锁定(0未锁定,1已锁定) + /// + [SugarColumn(ColumnName = "F_IsLocked")] + public int IsLocked { get; set; } + + /// + /// 创建时间 + /// + [SugarColumn(ColumnName = "F_CreateTime")] + public DateTime CreateTime { get; set; } + + /// + /// 更新时间 + /// + [SugarColumn(ColumnName = "F_UpdateTime")] + public DateTime UpdateTime { get; set; } + + /// + /// 创建人 + /// + [SugarColumn(ColumnName = "F_CreateUser")] + public string CreateUser { get; set; } + + /// + /// 更新人 + /// + [SugarColumn(ColumnName = "F_UpdateUser")] + public string UpdateUser { get; set; } + } +} diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_statistics_department_consume_performance/LqStatisticsDepartmentConsumePerformanceEntity.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_statistics_department_consume_performance/LqStatisticsDepartmentConsumePerformanceEntity.cs index 787927c..5adf366 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_statistics_department_consume_performance/LqStatisticsDepartmentConsumePerformanceEntity.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_statistics_department_consume_performance/LqStatisticsDepartmentConsumePerformanceEntity.cs @@ -94,5 +94,11 @@ namespace NCC.Extend.Entitys.lq_statistics_department_consume_performance /// [SugarColumn(ColumnName = "F_UpdateTime")] public DateTime? UpdateTime { get; set; } + + /// + /// 是否新店 + /// + [SugarColumn(ColumnName = "F_IsNewStore")] + public string IsNewStore { get; set; } } } diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_statistics_personal_performance/LqStatisticsPersonalPerformanceEntity.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_statistics_personal_performance/LqStatisticsPersonalPerformanceEntity.cs index 58164c3..97e21b2 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_statistics_personal_performance/LqStatisticsPersonalPerformanceEntity.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_statistics_personal_performance/LqStatisticsPersonalPerformanceEntity.cs @@ -90,6 +90,30 @@ namespace NCC.Extend.Entitys.lq_statistics_personal_performance public int OrderCount { get; set; } /// + /// 首开单数量 + /// + [SugarColumn(ColumnName = "F_FirstOrderCount")] + public int FirstOrderCount { get; set; } + + /// + /// 升单数量 + /// + [SugarColumn(ColumnName = "F_UpgradeOrderCount")] + public int UpgradeOrderCount { get; set; } + + /// + /// 首单业绩 + /// + [SugarColumn(ColumnName = "F_FirstOrderPerformance")] + public decimal FirstOrderPerformance { get; set; } + + /// + /// 升单业绩 + /// + [SugarColumn(ColumnName = "F_UpgradeOrderPerformance")] + public decimal UpgradeOrderPerformance { get; set; } + + /// /// 最后订单日期 /// [SugarColumn(ColumnName = "F_LastOrderDate")] diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_statistics_store_total_performance/LqStatisticsStoreTotalPerformanceEntity.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_statistics_store_total_performance/LqStatisticsStoreTotalPerformanceEntity.cs new file mode 100644 index 0000000..a29d054 --- /dev/null +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_statistics_store_total_performance/LqStatisticsStoreTotalPerformanceEntity.cs @@ -0,0 +1,98 @@ +using System; +using NCC.Common.Const; +using SqlSugar; + +namespace NCC.Extend.Entitys.lq_statistics_store_total_performance +{ + /// + /// 门店总业绩统计 + /// + [SugarTable("lq_statistics_store_total_performance")] + [Tenant(ClaimConst.TENANT_ID)] + public class LqStatisticsStoreTotalPerformanceEntity + { + /// + /// 主键ID + /// + [SugarColumn(ColumnName = "F_Id", IsPrimaryKey = true)] + public string Id { get; set; } + + /// + /// 门店ID + /// + [SugarColumn(ColumnName = "F_StoreId")] + public string StoreId { get; set; } + + /// + /// 门店名称 + /// + [SugarColumn(ColumnName = "F_StoreName")] + public string StoreName { get; set; } + + /// + /// 统计月份(YYYYMM格式) + /// + [SugarColumn(ColumnName = "F_StatisticsMonth")] + public string StatisticsMonth { get; set; } + + /// + /// 总业绩 + /// + [SugarColumn(ColumnName = "F_TotalPerformance")] + public decimal TotalPerformance { get; set; } + + /// + /// 欠款金额 + /// + [SugarColumn(ColumnName = "F_DebtAmount")] + public decimal DebtAmount { get; set; } + + /// + /// 总单业绩 + /// + [SugarColumn(ColumnName = "F_TotalOrderPerformance")] + public decimal TotalOrderPerformance { get; set; } + + /// + /// 储扣总金额 + /// + [SugarColumn(ColumnName = "F_StorageDeductionAmount")] + public decimal StorageDeductionAmount { get; set; } + + /// + /// 品项数量 + /// + [SugarColumn(ColumnName = "F_ItemQuantity")] + public int ItemQuantity { get; set; } + + /// + /// 首开单数量 + /// + [SugarColumn(ColumnName = "F_FirstOrderCount")] + public int FirstOrderCount { get; set; } + + /// + /// 升单数量 + /// + [SugarColumn(ColumnName = "F_UpgradeOrderCount")] + public int UpgradeOrderCount { get; set; } + + /// + /// 首单业绩 + /// + [SugarColumn(ColumnName = "F_FirstOrderPerformance")] + public decimal FirstOrderPerformance { get; set; } + + /// + /// 升单业绩 + /// + [SugarColumn(ColumnName = "F_UpgradeOrderPerformance")] + public decimal UpgradeOrderPerformance { get; set; } + + /// + /// 创建时间 + /// + [SugarColumn(ColumnName = "F_CreateTime")] + public DateTime? CreateTime { get; set; } + } +} diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs index 49c37bc..dc996ea 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs @@ -350,7 +350,17 @@ namespace NCC.Extend.LqKdKdjlb } //通过会员id查询会员信息 var memberInfo = await _db.Queryable().Where(u => u.Id == entity.Kdhy).FirstAsync(); - memberInfo.Khlx = "老客"; + //通过开单记录表查询这个会员开单金额 + var kdAmount = await _db.Queryable().Where(u => u.Kdhy == entity.Kdhy).SumAsync(u => u.Sfyj); + //如果开单金额小于500,为散客,如果大于500,为会员 + if (kdAmount < 500) + { + memberInfo.Khlx = MemberTypeEnum.散客.GetHashCode().ToString(); + } + else + { + memberInfo.Khlx = MemberTypeEnum.会员.GetHashCode().ToString(); + } await _db.Updateable(memberInfo).ExecuteCommandAsync(); // 批量插入扣款信息 if (allDeductEntities.Any()) diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqStatisticsService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqStatisticsService.cs index 8fee3fd..bede976 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/LqStatisticsService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/LqStatisticsService.cs @@ -15,7 +15,9 @@ using NCC.Extend.Entitys.Dto.LqMdxx; using NCC.Extend.Entitys.Dto.LqStatistics; using NCC.Extend.Entitys.Dto.LqStatistics.DepartmentInfo; using NCC.Extend.Entitys.Dto.LqStatisticsStoreConsumePerformance; +using NCC.Extend.Entitys.Dto.LqStatisticsStoreTotalPerformance; using NCC.Extend.Entitys.Dto.LqStatisticsTechPerformance; +using NCC.Extend.Entitys.Dto.LqSalaryStatistics; using NCC.Extend.Entitys.Dto.LqStatisticsDepartmentConsumePerformance; using NCC.Extend.Entitys.Dto.LqYcsdJsj; using NCC.Extend.Entitys.lq_hytk_kjbsyj; @@ -24,13 +26,16 @@ using NCC.Extend.Entitys.lq_kd_jksyj; using NCC.Extend.Entitys.lq_kd_kdjlb; using NCC.Extend.Entitys.lq_kd_kjbsyj; using NCC.Extend.Entitys.lq_mdxx; +using NCC.Extend.Entitys.lq_md_xdbhsj; using NCC.Extend.Entitys.lq_xh_kjbsyj; using NCC.Extend.Entitys.lq_ycsd_jsj; using NCC.Extend.Entitys.lq_yjmxb; using NCC.Extend.Entitys.lq_statistics_gold_triangle; using NCC.Extend.Entitys.lq_statistics_personal_performance; using NCC.Extend.Entitys.lq_statistics_store_consume_performance; +using NCC.Extend.Entitys.lq_statistics_store_total_performance; using NCC.Extend.Entitys.lq_statistics_tech_performance; +using NCC.Extend.Entitys.lq_salary_statistics; using NCC.Extend.Entitys.lq_statistics_department_consume_performance; using NCC.Extend.Entitys.lq_xmzl; using NCC.Extend.Entitys.Dto.LqStatisticsPersonalPerformance; @@ -1423,6 +1428,10 @@ namespace NCC.Extend.LqStatistics ELSE COALESCE(u.F_GW, '') END AS Position, COUNT(DISTINCT jksyj.glkdbh) AS OrderCount, + COUNT(DISTINCT CASE WHEN kd.sfskdd = '是' THEN jksyj.glkdbh END) AS FirstOrderCount, + COUNT(DISTINCT CASE WHEN kd.sfskdd = '否' THEN jksyj.glkdbh END) AS UpgradeOrderCount, + SUM(CASE WHEN kd.sfskdd = '是' THEN CAST(jksyj.jksyj AS DECIMAL(18,2)) ELSE 0 END) AS FirstOrderPerformance, + SUM(CASE WHEN kd.sfskdd = '否' THEN CAST(jksyj.jksyj AS DECIMAL(18,2)) ELSE 0 END) AS UpgradeOrderPerformance, MAX(jksyj.yjsj) AS LastOrderDate, MIN(jksyj.yjsj) AS FirstOrderDate, SUM( @@ -1440,10 +1449,11 @@ namespace NCC.Extend.LqStatistics SUM(CAST(jksyj.jksyj AS DECIMAL(18,2))) AS TotalPerformance FROM lq_kd_jksyj jksyj INNER JOIN lq_kd_pxmx pxmx ON jksyj.F_kdpxid = pxmx.F_Id AND pxmx.F_IsEffective = 1 + INNER JOIN lq_kd_kdjlb kd ON jksyj.glkdbh = kd.F_Id INNER JOIN lq_xmzl xmzl ON pxmx.px = xmzl.F_Id INNER JOIN BASE_USER u ON jksyj.jkszh = u.F_Id LEFT JOIN lq_mdxx md ON u.F_MDID = md.F_Id - LEFT JOIN lq_ycsd_jsj jsj ON jksyj.jsj_id = jsj.F_Id AND jsj.yf = @statisticsMonth + LEFT JOIN lq_ycsd_jsj jsj ON u.F_MDID = jsj.md AND jsj.yf = @statisticsMonth LEFT JOIN ( SELECT DISTINCT user_id, F_Month, MAX(is_leader) as is_leader FROM lq_jinsanjiao_user @@ -1513,6 +1523,10 @@ namespace NCC.Extend.LqStatistics BasePerformance = Convert.ToDecimal(stats.BasePerformance ?? 0), CooperationPerformance = Convert.ToDecimal(stats.CooperationPerformance ?? 0), OrderCount = Convert.ToInt32(stats.OrderCount ?? 0), + FirstOrderCount = Convert.ToInt32(stats.FirstOrderCount ?? 0), + UpgradeOrderCount = Convert.ToInt32(stats.UpgradeOrderCount ?? 0), + FirstOrderPerformance = Convert.ToDecimal(stats.FirstOrderPerformance ?? 0), + UpgradeOrderPerformance = Convert.ToDecimal(stats.UpgradeOrderPerformance ?? 0), LastOrderDate = stats.LastOrderDate as DateTime?, FirstOrderDate = stats.FirstOrderDate as DateTime?, CreateTime = DateTime.Now @@ -1627,8 +1641,30 @@ namespace NCC.Extend.LqStatistics // 按总业绩降序排序 query = query.OrderBy(x => x.TotalPerformance, OrderByType.Desc); - // 分页查询 - var result = await query.ToPagedListAsync(input.currentPage, input.pageSize); + // 分页查询并映射到DTO + var result = await query.Select(it => new LqStatisticsPersonalPerformanceListOutput + { + Id = it.Id, + StatisticsMonth = it.StatisticsMonth, + StoreId = it.StoreId, + StoreName = it.StoreName, + GoldTriangleId = it.GoldTriangleId, + GoldTriangleName = it.GoldTriangleName, + Position = it.Position, + EmployeeId = it.EmployeeId, + EmployeeName = it.EmployeeName, + TotalPerformance = it.TotalPerformance, + BasePerformance = it.BasePerformance, + CooperationPerformance = it.CooperationPerformance, + OrderCount = it.OrderCount, + FirstOrderCount = it.FirstOrderCount, + UpgradeOrderCount = it.UpgradeOrderCount, + FirstOrderPerformance = it.FirstOrderPerformance, + UpgradeOrderPerformance = it.UpgradeOrderPerformance, + LastOrderDate = it.LastOrderDate, + FirstOrderDate = it.FirstOrderDate, + CreateTime = it.CreateTime + }).ToPagedListAsync(input.currentPage, input.pageSize); return new { @@ -2111,6 +2147,37 @@ namespace NCC.Extend.LqStatistics var healthCoachData = await _db.Ado.SqlQueryAsync(healthCoachSql, new { statisticsMonth }); foreach (var item in healthCoachData) { + // 判断门店是否为新店(通过新店保护时间表查询) + var isNewStore = "否"; + if (!string.IsNullOrEmpty(item.F_StoreId?.ToString())) + { + var statisticsDate = DateTime.ParseExact(statisticsMonth + "01", "yyyyMMdd", null); + var monthStart = statisticsDate.AddDays(-statisticsDate.Day + 1); + var monthEnd = statisticsDate.AddMonths(1).AddDays(-1); + + // 查询门店在统计月份是否处于新店保护期内 + var storeId = item.F_StoreId?.ToString(); + var newStoreProtectionSql = @" + SELECT COUNT(1) as Count + FROM lq_md_xdbhsj + WHERE mdid = @storeId + AND sfqy = 1 + AND bhkssj <= @monthEnd + AND bhjssj >= @monthStart"; + var protectionResult = await _db.Ado.SqlQueryAsync(newStoreProtectionSql, new + { + storeId, + monthStart = monthStart.ToString("yyyy-MM-dd"), + monthEnd = monthEnd.ToString("yyyy-MM-dd") + }); + var hasProtection = protectionResult.FirstOrDefault()?.Count > 0; + + if (hasProtection) + { + isNewStore = "是"; + } + } + allStatisticsData.Add(new LqStatisticsDepartmentConsumePerformanceEntity { Id = YitIdHelper.NextId().ToString(), @@ -2125,6 +2192,7 @@ namespace NCC.Extend.LqStatistics ConsumePerformance = Convert.ToDecimal(item.F_ConsumePerformance ?? 0), ConsumeQuantity = Convert.ToDecimal(item.F_ConsumeQuantity ?? 0), ManualFee = Convert.ToDecimal(item.F_ManualFee ?? 0), + IsNewStore = isNewStore, CreateTime = DateTime.Now }); } @@ -2153,6 +2221,37 @@ namespace NCC.Extend.LqStatistics var techTeacherData = await _db.Ado.SqlQueryAsync(techTeacherSql, new { statisticsMonth }); foreach (var item in techTeacherData) { + // 判断门店是否为新店(通过新店保护时间表查询) + var isNewStore = "否"; + if (!string.IsNullOrEmpty(item.F_StoreId?.ToString())) + { + var statisticsDate = DateTime.ParseExact(statisticsMonth + "01", "yyyyMMdd", null); + var monthStart = statisticsDate.AddDays(-statisticsDate.Day + 1); + var monthEnd = statisticsDate.AddMonths(1).AddDays(-1); + + // 查询门店在统计月份是否处于新店保护期内 + var storeId = item.F_StoreId?.ToString(); + var newStoreProtectionSql = @" + SELECT COUNT(1) as Count + FROM lq_md_xdbhsj + WHERE mdid = @storeId + AND sfqy = 1 + AND bhkssj <= @monthEnd + AND bhjssj >= @monthStart"; + var protectionResult = await _db.Ado.SqlQueryAsync(newStoreProtectionSql, new + { + storeId, + monthStart = monthStart.ToString("yyyy-MM-dd"), + monthEnd = monthEnd.ToString("yyyy-MM-dd") + }); + var hasProtection = protectionResult.FirstOrDefault()?.Count > 0; + + if (hasProtection) + { + isNewStore = "是"; + } + } + allStatisticsData.Add(new LqStatisticsDepartmentConsumePerformanceEntity { Id = YitIdHelper.NextId().ToString(), @@ -2167,6 +2266,7 @@ namespace NCC.Extend.LqStatistics ConsumePerformance = Convert.ToDecimal(item.F_ConsumePerformance ?? 0), ConsumeQuantity = Convert.ToDecimal(item.F_ConsumeQuantity ?? 0), ManualFee = Convert.ToDecimal(item.F_ManualFee ?? 0), + IsNewStore = isNewStore, CreateTime = DateTime.Now }); } @@ -2267,6 +2367,498 @@ namespace NCC.Extend.LqStatistics #endregion + #region 门店总业绩统计 + + /// + /// 保存门店总业绩统计数据 + /// + /// + /// 统计门店的总业绩、欠款金额、总单业绩、储扣总金额、品项数量、首开单数量、升单数量 + /// + /// 示例请求: + /// ```json + /// { + /// "statisticsMonth": "202501" + /// } + /// ``` + /// + /// 参数说明: + /// - statisticsMonth: 统计月份,格式为YYYYMM + /// + /// 统计输入参数 + /// 保存结果 + /// 成功保存门店总业绩统计数据 + /// 参数错误 + /// 服务器错误 + [HttpPost("save-store-total-performance-stats")] + public async Task SaveStoreTotalPerformanceStatistics([FromBody] SalaryStatisticsInput input) + { + try + { + if (input == null || string.IsNullOrEmpty(input.StatisticsMonth) || input.StatisticsMonth.Length != 6) + { + throw NCCException.Oh("统计月份格式错误,请使用YYYYMM格式"); + } + + var statisticsMonth = input.StatisticsMonth; + + // 统计门店总业绩数据 + var storePerformanceSql = @" + SELECT + kd.djmd as F_StoreId, + md.dm as F_StoreName, + @statisticsMonth as F_StatisticsMonth, + COALESCE(SUM(kd.zdyj), 0) as F_TotalPerformance, + COALESCE(SUM(kd.qk), 0) as F_DebtAmount, + COALESCE(SUM(kd.sfyj), 0) as F_TotalOrderPerformance, + COALESCE(SUM(kd.F_DeductAmount), 0) as F_StorageDeductionAmount, + COUNT(pxmx.F_Id) as F_ItemQuantity, + COUNT(DISTINCT CASE WHEN kd.sfskdd = '是' THEN kd.F_Id END) as F_FirstOrderCount, + COUNT(DISTINCT CASE WHEN kd.sfskdd = '否' THEN kd.F_Id END) as F_UpgradeOrderCount, + SUM(CASE WHEN kd.sfskdd = '是' THEN COALESCE(kd.zdyj, 0) ELSE 0 END) as F_FirstOrderPerformance, + SUM(CASE WHEN kd.sfskdd = '否' THEN COALESCE(kd.zdyj, 0) ELSE 0 END) as F_UpgradeOrderPerformance + FROM lq_kd_kdjlb kd + LEFT JOIN lq_mdxx md ON kd.djmd = md.F_Id + LEFT JOIN lq_kd_pxmx pxmx ON kd.F_Id = pxmx.glkdbh AND pxmx.F_IsEffective = 1 + WHERE kd.F_IsEffective = 1 + AND DATE_FORMAT(kd.kdrq, '%Y%m') = @statisticsMonth + GROUP BY kd.djmd, md.dm"; + + var storePerformanceData = await _db.Ado.SqlQueryAsync(storePerformanceSql, new { statisticsMonth }); + + var entities = storePerformanceData.Select(data => new LqStatisticsStoreTotalPerformanceEntity + { + Id = YitIdHelper.NextId().ToString(), + StoreId = data.F_StoreId?.ToString() ?? "", + StoreName = data.F_StoreName?.ToString() ?? "", + StatisticsMonth = statisticsMonth, + TotalPerformance = Convert.ToDecimal(data.F_TotalPerformance ?? 0), + DebtAmount = Convert.ToDecimal(data.F_DebtAmount ?? 0), + TotalOrderPerformance = Convert.ToDecimal(data.F_TotalOrderPerformance ?? 0), + StorageDeductionAmount = Convert.ToDecimal(data.F_StorageDeductionAmount ?? 0), + ItemQuantity = Convert.ToInt32(data.F_ItemQuantity ?? 0), + FirstOrderCount = Convert.ToInt32(data.F_FirstOrderCount ?? 0), + UpgradeOrderCount = Convert.ToInt32(data.F_UpgradeOrderCount ?? 0), + FirstOrderPerformance = Convert.ToDecimal(data.F_FirstOrderPerformance ?? 0), + UpgradeOrderPerformance = Convert.ToDecimal(data.F_UpgradeOrderPerformance ?? 0), + CreateTime = DateTime.Now + }).ToList(); + + // 使用事务确保数据一致性 + var result = await _db.Ado.UseTranAsync(async () => + { + // 先删除该月份的历史数据 + await _db.Deleteable() + .Where(x => x.StatisticsMonth == statisticsMonth) + .ExecuteCommandAsync(); + + // 批量插入新数据 + if (entities.Any()) + { + return await _db.Insertable(entities).ExecuteCommandAsync(); + } + return 0; + }); + + var savedCount = result.IsSuccess ? result.Data : 0; + _logger.LogInformation($"成功保存门店总业绩统计数据 - 月份: {statisticsMonth}, 记录数: {savedCount}"); + + return new + { + Success = true, + Message = $"成功保存 {savedCount} 条门店总业绩统计数据", + SavedCount = savedCount, + StatisticsMonth = statisticsMonth + }; + } + catch (Exception ex) + { + _logger.LogError(ex, $"保存门店总业绩统计数据失败 - 月份: {input?.StatisticsMonth}"); + throw NCCException.Oh($"保存门店总业绩统计数据失败: {ex.Message}"); + } + } + + /// + /// 获取门店总业绩统计列表 + /// + /// + /// 分页查询门店总业绩统计数据 + /// + /// 示例请求: + /// ```json + /// { + /// "currentPage": 1, + /// "pageSize": 20, + /// "storeId": "门店ID", + /// "statisticsMonth": "202501" + /// } + /// ``` + /// + /// 查询参数 + /// 分页数据 + /// 成功返回门店总业绩统计列表 + /// 参数错误 + /// 服务器错误 + [HttpGet("store-total-performance-list")] + public async Task GetStoreTotalPerformanceList([FromQuery] LqStatisticsStoreTotalPerformanceListQueryInput input) + { + try + { + var sidx = input.sidx == null ? "createTime" : input.sidx; + var data = await _db.Queryable() + .WhereIF(!string.IsNullOrEmpty(input.storeId), p => p.StoreId.Contains(input.storeId)) + .WhereIF(!string.IsNullOrEmpty(input.storeName), p => p.StoreName.Contains(input.storeName)) + .WhereIF(!string.IsNullOrEmpty(input.statisticsMonth), p => p.StatisticsMonth.Equals(input.statisticsMonth)) + .Select(it => new LqStatisticsStoreTotalPerformanceListOutput + { + id = it.Id, + storeId = it.StoreId, + storeName = it.StoreName, + statisticsMonth = it.StatisticsMonth, + totalPerformance = it.TotalPerformance, + debtAmount = it.DebtAmount, + totalOrderPerformance = it.TotalOrderPerformance, + storageDeductionAmount = it.StorageDeductionAmount, + itemQuantity = it.ItemQuantity, + firstOrderCount = it.FirstOrderCount, + upgradeOrderCount = it.UpgradeOrderCount, + firstOrderPerformance = it.FirstOrderPerformance, + upgradeOrderPerformance = it.UpgradeOrderPerformance, + createTime = it.CreateTime + }) + .OrderBy(sidx + " " + input.sort) + .ToPagedListAsync(input.currentPage, input.pageSize); + + return PageResult.SqlSugarPageResult(data); + } + catch (Exception ex) + { + _logger.LogError(ex, "获取门店总业绩统计列表失败"); + throw NCCException.Oh($"获取门店总业绩统计列表失败: {ex.Message}"); + } + } + + #endregion + + #region 工资统计 + + /// + /// 保存工资统计数据 + /// + /// + /// 初始化工资统计表,从其他统计表读取数据并计算工资 + /// + /// 示例请求: + /// ```json + /// { + /// "statisticsMonth": "202501" + /// } + /// ``` + /// + /// 参数说明: + /// - statisticsMonth: 统计月份,格式为YYYYMM + /// + /// 统计输入参数 + /// 保存结果 + /// 成功保存工资统计数据 + /// 参数错误 + /// 服务器错误 + [HttpPost("save-salary-statistics")] + public async Task SaveSalaryStatistics([FromBody] SalaryStatisticsInput input) + { + try + { + if (input == null || string.IsNullOrEmpty(input.StatisticsMonth) || input.StatisticsMonth.Length != 6) + { + throw NCCException.Oh("统计月份格式错误,请使用YYYYMM格式"); + } + + var statisticsMonth = input.StatisticsMonth; + + // 1. 先初始化所有员工到工资统计表 + await InitializeSalaryStatistics(statisticsMonth); + + // 2. 从其他统计表读取数据并更新工资统计表 + await UpdateSalaryStatisticsFromOtherTables(statisticsMonth); + + _logger.LogInformation($"成功保存工资统计数据 - 月份: {statisticsMonth}"); + + return new + { + Success = true, + Message = $"成功保存 {statisticsMonth} 月份工资统计数据", + StatisticsMonth = statisticsMonth + }; + } + catch (Exception ex) + { + _logger.LogError(ex, $"保存工资统计数据失败 - 月份: {input?.StatisticsMonth}"); + throw NCCException.Oh($"保存工资统计数据失败: {ex.Message}"); + } + } + + /// + /// 获取工资统计列表 + /// + /// + /// 分页查询工资统计数据 + /// + /// 示例请求: + /// ```json + /// POST /api/Extend/LqStatistics/get-salary-statistics-list + /// { + /// "currentPage": 1, + /// "pageSize": 10, + /// "statisticsMonth": "202401", + /// "storeName": "门店名称", + /// "employeeName": "员工姓名", + /// "position": "岗位" + /// } + /// ``` + /// + /// 查询参数 + /// 分页数据 + /// 查询成功 + /// 参数错误 + /// 服务器内部错误 + [HttpPost("get-salary-statistics-list")] + public async Task GetSalaryStatisticsList([FromBody] LqSalaryStatisticsListQueryInput input) + { + try + { + var query = _db.Queryable(); + + // 添加查询条件 + query = query.WhereIF(!string.IsNullOrEmpty(input.statisticsMonth), x => x.StatisticsMonth == input.statisticsMonth); + query = query.WhereIF(!string.IsNullOrEmpty(input.storeName), x => x.StoreName.Contains(input.storeName)); + query = query.WhereIF(!string.IsNullOrEmpty(input.employeeName), x => x.EmployeeName.Contains(input.employeeName)); + query = query.WhereIF(!string.IsNullOrEmpty(input.position), x => x.Position == input.position); + query = query.WhereIF(input.isLocked.HasValue, x => x.IsLocked == input.isLocked.Value); + // 按总业绩降序排序 + // 分页查询 + var data = await query.Select(x => new LqSalaryStatisticsListOutput + { + Id = x.Id, + StatisticsMonth = x.StatisticsMonth, + StoreId = x.StoreId, + StoreName = x.StoreName, + EmployeeId = x.EmployeeId, + EmployeeName = x.EmployeeName, + Position = x.Position, + GoldTriangleTeam = x.GoldTriangleTeam, + TotalPerformance = x.TotalPerformance, + BasePerformance = x.BasePerformance, + CooperationPerformance = x.CooperationPerformance, + RewardPerformance = x.RewardPerformance, + StoreTotalPerformance = x.StoreTotalPerformance, + TeamPerformance = x.TeamPerformance, + PerformanceRatio = x.Percentage, + NewCustomerPerformance = x.NewCustomerPerformance, + NewCustomerConversionRate = x.NewCustomerConversionRate, + NewCustomerPoint = x.NewCustomerPoint, + UpgradePerformance = x.UpgradePerformance, + UpgradePoint = x.UpgradePoint, + TraceabilityPerformance = x.TraceabilityPerformance, + CellPerformance = x.CellPerformance, + ProjectOnePerformance = x.MajorProject1Performance, + ProjectTwoPerformance = x.MajorProject2Performance, + MonthlyPerformance = x.MonthlyPerformance, + PropertyWaterElectricity = x.PropertyWaterElectricity, + StoreExpense = x.StoreExpense, + ProductMaterial = x.ProductMaterial, + MicroSculptureCost = x.MicroSculptureCost, + OtherCooperationCost = x.OtherCooperationCost, + TowelWashing = x.TowelWashing, + GrossProfit = x.GrossProfit, + GeneralManagerCommission = x.GeneralManagerCommission, + ManagerCommission = x.ManagerCommission, + Consumption = x.Consumption, + ProjectCount = x.ProjectCount, + AttendanceDays = x.CustomerCount, + StoreDays = x.WorkingDays, + LeaveDays = x.LeaveDays, + CommissionPoint = x.CommissionPoint, + BasePerformanceCommission = x.BasePerformanceCommission, + CooperationPerformanceCommission = x.CooperationPerformanceCommission, + ConsultantCommission = x.ConsultantCommission, + StoreTAreaCommission = x.StoreTZoneCommission, + AssistantCommission1 = x.AssistantCommission, + AssistantDirectorCommission = x.AssistantDirectorCommission, + DirectorCommission = x.DirectorCommission, + AssistantCommission2 = x.StoreManagerCommission, + GeneralManagerCommissionAmount = x.GeneralManagerCommissionTotal, + ManagerCommissionAmount = x.ManagerCommissionTotal, + PerformanceCommission = x.PerformanceCommission, + ConsumptionCommission = x.ConsumptionCommission, + TechGroupLeaderCommission = x.TechGroupLeaderCommission, + TraceabilityCommission = x.TraceabilityCommission, + CellCommission = x.CellCommission, + ProjectCommission = x.MajorProjectCommission, + CommissionTotal = x.TotalCommission, + HealthCoachBaseSalary = x.HealthCoachBaseSalary, + AssistantBaseSalary = x.AssistantBaseSalary, + ManagerBaseSalary = x.StoreManagerBaseSalary, + DirectorBaseSalary = x.DirectorBaseSalary, + AssistantDirectorBaseSalary = x.AssistantDirectorBaseSalary, + GeneralManagerBaseSalary = x.GeneralManagerBaseSalary, + ManagerBaseSalaryAmount = x.ManagerBaseSalary, + TechTeacherBaseSalary = x.TechTeacherBaseSalary, + ProjectBaseSalary = x.MajorProjectBaseSalary, + BaseSalaryTotal = x.TotalBaseSalary, + ManualWork = x.HandworkFee, + HeadCountReward = x.PersonnelReward, + PhoneManagement = x.PhoneManagement, + CarAllowance = x.TransportationAllowance, + LessRest = x.LessRest, + FullAttendance = x.FullAttendance, + CalculatedGrossSalary = x.CalculatedGrossSalary, + Guarantee = x.GuaranteedSalary, + GuaranteeLeave = x.GuaranteedLeaveDeduction, + GuaranteeBaseSalary = x.GuaranteedBaseSalary, + GuaranteeSupplement = x.GuaranteedSupplement, + FinalGrossSalary = x.FinalGrossSalary, + MonthlyTrainingSubsidy = x.MonthlyTrainingSubsidy, + MonthlyTransportSubsidy = x.MonthlyTransportSubsidy, + LastMonthTrainingSubsidy = x.LastMonthTrainingSubsidy, + LastMonthTransportSubsidy = x.LastMonthTransportSubsidy, + SubsidyTotal = x.TotalSubsidy, + MissingCard = x.MissingCard, + Late = x.LateArrival, + Leave = x.LeaveDeduction, + SocialSecurityDeduction = x.SocialInsuranceDeduction, + RewardDeduction = x.RewardDeduction, + AccommodationDeduction = x.AccommodationDeduction, + StudyPeriodDeduction = x.StudyPeriodDeduction, + WorkClothesDeduction = x.WorkClothesDeduction, + DeductionTotal = x.TotalDeduction, + Bonus = x.Bonus, + PhoneDepositReturn = x.ReturnPhoneDeposit, + AccommodationDepositReturn = x.ReturnAccommodationDeposit, + ActualGrossSalary = x.ActualSalary, + MonthlyPaymentStatus = x.MonthlyPaymentStatus, + PaymentAmount = x.PaidAmount, + PendingPaymentAmount = x.PendingAmount, + LastMonthSupplement = x.LastMonthSupplement, + MonthlyPaymentTotal = x.MonthlyTotalPayment, + IsLocked = x.IsLocked == 1, + CreateTime = x.CreateTime, + UpdateTime = x.UpdateTime + }).MergeTable().OrderBy(x => x.TotalPerformance, OrderByType.Desc).ToPagedListAsync(input.currentPage, input.pageSize); + return PageResult.SqlSugarPageResult(data); + + + + } + catch (Exception ex) + { + _logger.LogError(ex, "获取工资统计列表失败"); + throw NCCException.Oh($"获取工资统计列表失败: {ex.Message}"); + } + } + + /// + /// 初始化工资统计表 + /// + private async Task InitializeSalaryStatistics(string statisticsMonth) + { + // 获取所有员工信息 + var employeesSql = @" + SELECT + u.F_Id as EmployeeId, + u.F_RealName as EmployeeName, + u.F_MDID as StoreId, + COALESCE(md.dm, '') as StoreName, + COALESCE(u.F_GW, '') as Position, + COALESCE(jsj.jsj, '') as GoldTriangleTeam + FROM BASE_USER u + LEFT JOIN lq_mdxx md ON u.F_MDID COLLATE utf8mb4_unicode_ci = md.F_Id COLLATE utf8mb4_unicode_ci + LEFT JOIN lq_ycsd_jsj jsj ON u.F_MDID COLLATE utf8mb4_unicode_ci = jsj.md COLLATE utf8mb4_unicode_ci AND jsj.yf = @statisticsMonth + WHERE u.F_EnabledMark = 1 + AND (u.F_DeleteMark IS NULL OR u.F_DeleteMark = 0)"; + + var employees = await _db.Ado.SqlQueryAsync(employeesSql, new { statisticsMonth }); + + var salaryEntities = employees.Select(emp => new LqSalaryStatisticsEntity + { + Id = YitIdHelper.NextId().ToString(), + StoreId = emp.StoreId?.ToString() ?? "", + StoreName = emp.StoreName?.ToString() ?? "", + Position = emp.Position?.ToString() ?? "", + EmployeeName = emp.EmployeeName?.ToString() ?? "", + EmployeeId = emp.EmployeeId?.ToString() ?? "", + GoldTriangleTeam = emp.GoldTriangleTeam?.ToString() ?? "", + StatisticsMonth = statisticsMonth, + IsLocked = 0, + CreateTime = DateTime.Now, + UpdateTime = DateTime.Now, + CreateUser = _userManager.UserId, + UpdateUser = _userManager.UserId + }).ToList(); + + // 使用事务确保数据一致性 + await _db.Ado.UseTranAsync(async () => + { + // 先删除该月份的历史数据 + await _db.Deleteable() + .Where(x => x.StatisticsMonth == statisticsMonth) + .ExecuteCommandAsync(); + + // 批量插入新数据 + if (salaryEntities.Any()) + { + await _db.Insertable(salaryEntities).ExecuteCommandAsync(); + } + }); + + _logger.LogInformation($"初始化工资统计表完成 - 月份: {statisticsMonth}, 员工数: {salaryEntities.Count}"); + } + + /// + /// 从其他统计表更新工资统计数据 + /// + private async Task UpdateSalaryStatisticsFromOtherTables(string statisticsMonth) + { + // 从个人业绩统计表更新数据 + var personalPerformanceSql = @" + UPDATE lq_salary_statistics s + INNER JOIN lq_statistics_personal_performance p + ON s.F_EmployeeId COLLATE utf8mb4_unicode_ci = p.F_EmployeeId COLLATE utf8mb4_unicode_ci + AND s.F_StatisticsMonth = p.F_StatisticsMonth + SET + s.F_TotalPerformance = p.F_TotalPerformance, + s.F_BasePerformance = p.F_BasePerformance, + s.F_CooperationPerformance = p.F_CooperationPerformance, + s.F_ProjectCount = p.F_OrderCount, + s.F_NewCustomerPerformance = p.F_FirstOrderPerformance, + s.F_UpgradePerformance = p.F_UpgradeOrderPerformance + WHERE s.F_StatisticsMonth = @statisticsMonth"; + + await _db.Ado.ExecuteCommandAsync(personalPerformanceSql, new + { + statisticsMonth, + userId = _userManager.UserId + }); + + // 从门店总业绩统计表更新门店相关数据 + var storePerformanceSql = @" + UPDATE lq_salary_statistics s + INNER JOIN lq_statistics_store_total_performance st + ON s.F_StoreId COLLATE utf8mb4_unicode_ci = st.F_StoreId COLLATE utf8mb4_unicode_ci + AND s.F_StatisticsMonth = st.F_StatisticsMonth + SET + s.F_StoreTotalPerformance = st.F_TotalPerformance + WHERE s.F_StatisticsMonth = @statisticsMonth"; + + await _db.Ado.ExecuteCommandAsync(storePerformanceSql, new + { + statisticsMonth, + userId = _userManager.UserId + }); + + _logger.LogInformation($"从其他统计表更新工资数据完成 - 月份: {statisticsMonth}"); + } + + #endregion } } diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqTkjlbService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqTkjlbService.cs index d726063..f2b4fd6 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/LqTkjlbService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/LqTkjlbService.cs @@ -16,6 +16,7 @@ using NCC.DataEncryption; using NCC.Dependency; using NCC.DynamicApiController; using NCC.Extend.Entitys.Dto.LqTkjlb; +using NCC.Extend.Entitys.Enum; using NCC.Extend.Entitys.lq_event; using NCC.Extend.Entitys.lq_eventuser; using NCC.Extend.Entitys.lq_khxx; @@ -182,7 +183,7 @@ namespace NCC.Extend.LqTkjlb MemberInfo.Id = YitIdHelper.NextId().ToString(); MemberInfo.Khmc = entity.CustomerName; MemberInfo.Sjh = input.customerPhone; // 设置手机号 - MemberInfo.Khlx = "线索"; + MemberInfo.Khlx = MemberTypeEnum.线索.GetHashCode().ToString(); MemberInfo.Dah = "GK" + DateTime.Now.ToString("yyyyMMddHHmmss"); MemberInfo.Gsmd = eventUserInfo.StoreId; var memberResult = await _db.Insertable(MemberInfo).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandAsync(); diff --git a/拓客活动用户导入模板.csv b/拓客活动用户导入模板.csv deleted file mode 100644 index 57932e7..0000000 --- a/拓客活动用户导入模板.csv +++ /dev/null @@ -1,5 +0,0 @@ -员工手机号,姓名,战队,门店,目标张数 -13800138001,张三,第一战队,北京旗舰店,50 -13800138002,李四,第二战队,上海分店,30 -13800138003,王五,,深圳分店,40 -13800138004,赵六,第三战队,,25 diff --git a/金三角业绩统计接口说明.md b/金三角业绩统计接口说明.md deleted file mode 100644 index fd5e678..0000000 --- a/金三角业绩统计接口说明.md +++ /dev/null @@ -1,99 +0,0 @@ -# 金三角业绩统计接口说明 - -## 接口概述 -新增了金三角业绩统计查询接口,根据金三角成员状态进行不同的统计方式。 - -## 接口地址 -``` -GET /api/Extend/LqYcsdJsj/GetJsjPerformance -``` - -## 功能说明 -根据金三角成员状态进行不同的统计方式: -1. **活跃成员**:业绩计入金三角总业绩 -2. **非活跃成员**:按单人业绩统计,金三角名称为"门店名+姓名" - -## 请求参数 -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| startMonth | string | 否 | 开始月份,格式:yyyyMM | -| endMonth | string | 否 | 结束月份,格式:yyyyMM | -| jsjId | string | 否 | 金三角ID,用于查询特定金三角 | -| storeId | string | 否 | 门店ID,用于查询特定门店 | - -## 响应参数 -| 字段名 | 类型 | 说明 | -|--------|------|------| -| JsjId | string | 金三角ID(非活跃成员时为用户ID) | -| JsjName | string | 金三角名称(非活跃成员时为"门店名+姓名") | -| Month | string | 月份(格式:yyyyMM) | -| StoreId | string | 门店ID | -| StoreName | string | 门店名称 | -| OrderCount | int | 订单数量 | -| TotalPerformance | decimal | 总业绩 | -| LastOrderDate | DateTime? | 最后订单日期 | -| FirstOrderDate | DateTime? | 首次订单日期 | -| StatisticsType | string | 统计类型(ACTIVE-活跃金三角业绩,INACTIVE-单人业绩) | -| MemberName | string | 成员姓名(仅单人业绩时使用) | - -## 示例请求 -``` -GET /api/Extend/LqYcsdJsj/GetJsjPerformance?startMonth=202401&endMonth=202412 -``` - -## 示例响应 -```json -{ - "code": 200, - "msg": "操作成功", - "data": [ - { - "jsjId": "123456789", - "jsjName": "金三角A组", - "month": "202412", - "storeId": "store001", - "storeName": "绿纤川音店", - "orderCount": 15, - "totalPerformance": 50000.00, - "lastOrderDate": "2024-12-15T14:30:00", - "firstOrderDate": "2024-12-01T09:00:00", - "statisticsType": "ACTIVE", - "memberName": null - }, - { - "jsjId": "987654321", - "jsjName": "绿纤川音店-张三", - "month": "202412", - "storeId": "store001", - "storeName": "绿纤川音店", - "orderCount": 8, - "totalPerformance": 25000.00, - "lastOrderDate": "2024-12-14T16:20:00", - "firstOrderDate": "2024-12-02T10:15:00", - "statisticsType": "INACTIVE", - "memberName": "张三" - } - ] -} -``` - -## 业务逻辑 -1. **活跃成员统计**: - - 查询状态为"ACTIVE"的金三角成员 - - 将业绩计入金三角总业绩 - - 按金三角分组统计 - -2. **非活跃成员统计**: - - 查询状态为"INACTIVE"的金三角成员 - - 按单人业绩统计 - - 金三角名称为"门店名+姓名"格式 - -3. **数据排序**: - - 按月份降序(最新的月份在前) - - 按总业绩降序(业绩高的在前) - -## 注意事项 -- 所有查询都是只读操作,不会修改数据库数据 -- 支持按月统计,可以指定月份范围 -- 支持按金三角ID和门店ID进行筛选 -- 返回结果包含统计类型标识,便于前端区分处理