d98270e2
“wangming”
Enhance LqEventSe...
|
1
2
3
4
5
6
7
8
9
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using NCC.ClayObject;
using NCC.Common.Configuration;
using NCC.Common.Core.Manager;
|
96009bc9
hexiaodong
hxd
|
10
11
12
|
using NCC.Common.Enum;
using NCC.Common.Extension;
using NCC.Common.Filter;
|
d98270e2
“wangming”
Enhance LqEventSe...
|
13
14
15
|
using NCC.Common.Helper;
using NCC.Common.Model.NPOI;
using NCC.DataEncryption;
|
96009bc9
hexiaodong
hxd
|
16
17
|
using NCC.Dependency;
using NCC.DynamicApiController;
|
d98270e2
“wangming”
Enhance LqEventSe...
|
18
|
using NCC.Extend.Entitys.Dto.LqYyjl;
|
7f83b333
“wangming”
重构:删除部门管理模块并修复预约记录服务
|
19
|
using NCC.Extend.Entitys.lq_mdxx;
|
72cec4b5
“wangming”
feat: 添加转化率统计和升单类型功能
|
20
|
using NCC.Extend.Entitys.lq_yaoyjl;
|
d98270e2
“wangming”
Enhance LqEventSe...
|
21
|
using NCC.Extend.Entitys.lq_yyjl;
|
96009bc9
hexiaodong
hxd
|
22
|
using NCC.Extend.Interfaces.LqYyjl;
|
d98270e2
“wangming”
Enhance LqEventSe...
|
23
24
|
using NCC.FriendlyException;
using NCC.JsonSerialization;
|
7f83b333
“wangming”
重构:删除部门管理模块并修复预约记录服务
|
25
|
using NCC.System.Entitys.Permission;
|
96009bc9
hexiaodong
hxd
|
26
|
using SqlSugar;
|
96009bc9
hexiaodong
hxd
|
27
|
using Yitter.IdGenerator;
|
96009bc9
hexiaodong
hxd
|
28
29
30
31
32
33
|
namespace NCC.Extend.LqYyjl
{
/// <summary>
/// 预约记录服务
/// </summary>
|
7f83b333
“wangming”
重构:删除部门管理模块并修复预约记录服务
|
34
|
[ApiDescriptionSettings(Tag = "绿纤预约记录服务", Name = "LqYyjl", Order = 200)]
|
96009bc9
hexiaodong
hxd
|
35
36
37
38
39
40
41
42
43
44
|
[Route("api/Extend/[controller]")]
public class LqYyjlService : ILqYyjlService, IDynamicApiController, ITransient
{
private readonly ISqlSugarRepository<LqYyjlEntity> _lqYyjlRepository;
private readonly SqlSugarScope _db;
private readonly IUserManager _userManager;
/// <summary>
/// 初始化一个<see cref="LqYyjlService"/>类型的新实例
/// </summary>
|
d98270e2
“wangming”
Enhance LqEventSe...
|
45
|
public LqYyjlService(ISqlSugarRepository<LqYyjlEntity> lqYyjlRepository, IUserManager userManager)
|
96009bc9
hexiaodong
hxd
|
46
|
{
|
d98270e2
“wangming”
Enhance LqEventSe...
|
47
|
_lqYyjlRepository = lqYyjlRepository;
|
96009bc9
hexiaodong
hxd
|
48
49
50
|
_db = _lqYyjlRepository.Context;
_userManager = userManager;
}
|
72cec4b5
“wangming”
feat: 添加转化率统计和升单类型功能
|
51
|
|
7f83b333
“wangming”
重构:删除部门管理模块并修复预约记录服务
|
52
|
#region 预约记录
|
96009bc9
hexiaodong
hxd
|
53
54
55
56
57
58
59
60
61
62
|
/// <summary>
/// 获取预约记录
/// </summary>
/// <param name="id">参数</param>
/// <returns></returns>
[HttpGet("{id}")]
public async Task<dynamic> GetInfo(string id)
{
var entity = await _db.Queryable<LqYyjlEntity>().FirstAsync(p => p.Id == id);
var output = entity.Adapt<LqYyjlInfoOutput>();
|
7f83b333
“wangming”
重构:删除部门管理模块并修复预约记录服务
|
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
// 获取门店名称
if (!string.IsNullOrEmpty(entity.Djmd))
{
var store = await _db.Queryable<LqMdxxEntity>().Where(u => u.Id == entity.Djmd).FirstAsync();
output.djmdName = store?.Dm;
}
// 获取预约人姓名
if (!string.IsNullOrEmpty(entity.Yyr))
{
var user = await _db.Queryable<UserEntity>().Where(u => u.Id == entity.Yyr).FirstAsync();
output.yyrName = user?.RealName;
}
// 获取预约健康师姓名
if (!string.IsNullOrEmpty(entity.Yyjks))
{
var healthCoach = await _db.Queryable<UserEntity>().Where(u => u.Id == entity.Yyjks).FirstAsync();
output.yyjksName = healthCoach?.RealName;
}
|
72cec4b5
“wangming”
feat: 添加转化率统计和升单类型功能
|
85
86
87
88
89
90
91
|
//获取邀约记录
if (!string.IsNullOrEmpty(entity.InviteId))
{
var invite = await _db.Queryable<LqYaoyjlEntity>().Where(u => u.Id == entity.InviteId).FirstAsync();
output.InviteTime = invite?.Yysj;
}
|
96009bc9
hexiaodong
hxd
|
92
93
|
return output;
}
|
7f83b333
“wangming”
重构:删除部门管理模块并修复预约记录服务
|
94
|
#endregion
|
96009bc9
hexiaodong
hxd
|
95
|
|
7f83b333
“wangming”
重构:删除部门管理模块并修复预约记录服务
|
96
|
#region 预约记录列表
|
96009bc9
hexiaodong
hxd
|
97
|
/// <summary>
|
d98270e2
“wangming”
Enhance LqEventSe...
|
98
99
100
101
|
/// 获取预约记录列表
/// </summary>
/// <param name="input">请求参数</param>
/// <returns></returns>
|
96009bc9
hexiaodong
hxd
|
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
[HttpGet("")]
public async Task<dynamic> GetList([FromQuery] LqYyjlListQueryInput input)
{
var sidx = input.sidx == null ? "id" : input.sidx;
List<string> queryCzsj = input.czsj != null ? input.czsj.Split(',').ToObeject<List<string>>() : null;
DateTime? startCzsj = queryCzsj != null ? Ext.GetDateTime(queryCzsj.First()) : null;
DateTime? endCzsj = queryCzsj != null ? Ext.GetDateTime(queryCzsj.Last()) : null;
List<string> queryYysj = input.yysj != null ? input.yysj.Split(',').ToObeject<List<string>>() : null;
DateTime? startYysj = queryYysj != null ? Ext.GetDateTime(queryYysj.First()) : null;
DateTime? endYysj = queryYysj != null ? Ext.GetDateTime(queryYysj.Last()) : null;
List<string> queryYyjs = input.yyjs != null ? input.yyjs.Split(',').ToObeject<List<string>>() : null;
DateTime? startYyjs = queryYyjs != null ? Ext.GetDateTime(queryYyjs.First()) : null;
DateTime? endYyjs = queryYyjs != null ? Ext.GetDateTime(queryYyjs.Last()) : null;
var data = await _db.Queryable<LqYyjlEntity>()
.WhereIF(!string.IsNullOrEmpty(input.id), p => p.Id.Contains(input.id))
.WhereIF(!string.IsNullOrEmpty(input.djmd), p => p.Djmd.Equals(input.djmd))
.WhereIF(!string.IsNullOrEmpty(input.yyr), p => p.Yyr.Equals(input.yyr))
.WhereIF(!string.IsNullOrEmpty(input.gklx), p => p.Gklx.Contains(input.gklx))
.WhereIF(!string.IsNullOrEmpty(input.yytyxm), p => p.Yytyxm.Equals(input.yytyxm))
.WhereIF(!string.IsNullOrEmpty(input.czr), p => p.Czr.Equals(input.czr))
.WhereIF(queryCzsj != null, p => p.Czsj >= new DateTime(startCzsj.ToDate().Year, startCzsj.ToDate().Month, startCzsj.ToDate().Day, 0, 0, 0))
.WhereIF(queryCzsj != null, p => p.Czsj <= new DateTime(endCzsj.ToDate().Year, endCzsj.ToDate().Month, endCzsj.ToDate().Day, 23, 59, 59))
.WhereIF(!string.IsNullOrEmpty(input.gk), p => p.Gk.Equals(input.gk))
.WhereIF(!string.IsNullOrEmpty(input.gkxm), p => p.Gkxm.Contains(input.gkxm))
.WhereIF(!string.IsNullOrEmpty(input.yyjks), p => p.Yyjks.Equals(input.yyjks))
.WhereIF(queryYysj != null, p => p.Yysj >= new DateTime(startYysj.ToDate().Year, startYysj.ToDate().Month, startYysj.ToDate().Day, 0, 0, 0))
.WhereIF(queryYysj != null, p => p.Yysj <= new DateTime(endYysj.ToDate().Year, endYysj.ToDate().Month, endYysj.ToDate().Day, 23, 59, 59))
.WhereIF(queryYyjs != null, p => p.Yyjs >= new DateTime(startYyjs.ToDate().Year, startYyjs.ToDate().Month, startYyjs.ToDate().Day, 0, 0, 0))
.WhereIF(queryYyjs != null, p => p.Yyjs <= new DateTime(endYyjs.ToDate().Year, endYyjs.ToDate().Month, endYyjs.ToDate().Day, 23, 59, 59))
|
35bb18d3
“wangming”
更新多个.DS_Store文件,删...
|
131
|
.WhereIF(!string.IsNullOrEmpty(input.F_Status), p => p.F_Status.Equals(input.F_Status))
|
d98270e2
“wangming”
Enhance LqEventSe...
|
132
|
.Select(it => new LqYyjlListOutput
|
96009bc9
hexiaodong
hxd
|
133
134
|
{
id = it.Id,
|
d98270e2
“wangming”
Enhance LqEventSe...
|
135
136
137
138
139
140
141
142
143
144
145
146
|
djmd = it.Djmd,
yyr = it.Yyr,
gklx = it.Gklx,
yytyxm = it.Yytyxm,
czr = it.Czr,
czsj = it.Czsj,
gk = it.Gk,
gkxm = it.Gkxm,
yyjks = it.Yyjks,
yysj = it.Yysj,
yyjs = it.Yyjs,
F_Status = it.F_Status,
|
7f83b333
“wangming”
重构:删除部门管理模块并修复预约记录服务
|
147
148
149
|
yyrName = SqlFunc.Subqueryable<UserEntity>().Where(u => u.Id == it.Yyr).Select(u => u.RealName),
yyjksName = SqlFunc.Subqueryable<UserEntity>().Where(u => u.Id == it.Yyjks).Select(u => u.RealName),
djmdName = SqlFunc.Subqueryable<LqMdxxEntity>().Where(u => u.Id == it.Djmd).Select(u => u.Dm),
|
72cec4b5
“wangming”
feat: 添加转化率统计和升单类型功能
|
150
151
152
|
NoDealRemark = it.NoDealRemark,
InviteId = it.InviteId,
InviteTime = SqlFunc.Subqueryable<LqYaoyjlEntity>().Where(u => u.Id == it.InviteId).Select(u => SqlFunc.ToDate(u.Yysj)),
|
d98270e2
“wangming”
Enhance LqEventSe...
|
153
154
155
156
157
|
})
.MergeTable()
.OrderBy(sidx + " " + input.sort)
.ToPagedListAsync(input.currentPage, input.pageSize);
return PageResult<LqYyjlListOutput>.SqlSugarPageResult(data);
|
96009bc9
hexiaodong
hxd
|
158
|
}
|
7f83b333
“wangming”
重构:删除部门管理模块并修复预约记录服务
|
159
|
#endregion
|
96009bc9
hexiaodong
hxd
|
160
|
|
7f83b333
“wangming”
重构:删除部门管理模块并修复预约记录服务
|
161
|
#region 新建预约记录
|
96009bc9
hexiaodong
hxd
|
162
163
164
165
166
167
168
169
|
/// <summary>
/// 新建预约记录
/// </summary>
/// <param name="input">参数</param>
/// <returns></returns>
[HttpPost("")]
public async Task Create([FromBody] LqYyjlCrInput input)
{
|
96009bc9
hexiaodong
hxd
|
170
171
172
|
var entity = input.Adapt<LqYyjlEntity>();
entity.Id = YitIdHelper.NextId().ToString();
entity.Czr = _userManager.UserId;
|
d98270e2
“wangming”
Enhance LqEventSe...
|
173
|
entity.Czsj = DateTime.Now;
|
7f83b333
“wangming”
重构:删除部门管理模块并修复预约记录服务
|
174
|
entity.CreateTime = DateTime.Now;
|
72cec4b5
“wangming”
feat: 添加转化率统计和升单类型功能
|
175
176
177
178
179
180
181
182
183
|
//判断邀约记录是否存在
if (!string.IsNullOrEmpty(input.InviteId))
{
var invite = await _db.Queryable<LqYaoyjlEntity>().Where(u => u.Id == input.InviteId).FirstAsync();
if (invite == null)
{
throw NCCException.Oh("邀约记录不存在");
}
}
|
96009bc9
hexiaodong
hxd
|
184
|
var isOk = await _db.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandAsync();
|
d98270e2
“wangming”
Enhance LqEventSe...
|
185
186
|
if (!(isOk > 0))
throw NCCException.Oh(ErrorCode.COM1000);
|
96009bc9
hexiaodong
hxd
|
187
|
}
|
7f83b333
“wangming”
重构:删除部门管理模块并修复预约记录服务
|
188
|
#endregion
|
96009bc9
hexiaodong
hxd
|
189
|
|
7f83b333
“wangming”
重构:删除部门管理模块并修复预约记录服务
|
190
|
#region 预约记录无分页列表
|
96009bc9
hexiaodong
hxd
|
191
|
/// <summary>
|
d98270e2
“wangming”
Enhance LqEventSe...
|
192
193
194
195
|
/// 获取预约记录无分页列表
/// </summary>
/// <param name="input">请求参数</param>
/// <returns></returns>
|
96009bc9
hexiaodong
hxd
|
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
|
[NonAction]
public async Task<dynamic> GetNoPagingList([FromQuery] LqYyjlListQueryInput input)
{
var sidx = input.sidx == null ? "id" : input.sidx;
List<string> queryCzsj = input.czsj != null ? input.czsj.Split(',').ToObeject<List<string>>() : null;
DateTime? startCzsj = queryCzsj != null ? Ext.GetDateTime(queryCzsj.First()) : null;
DateTime? endCzsj = queryCzsj != null ? Ext.GetDateTime(queryCzsj.Last()) : null;
List<string> queryYysj = input.yysj != null ? input.yysj.Split(',').ToObeject<List<string>>() : null;
DateTime? startYysj = queryYysj != null ? Ext.GetDateTime(queryYysj.First()) : null;
DateTime? endYysj = queryYysj != null ? Ext.GetDateTime(queryYysj.Last()) : null;
List<string> queryYyjs = input.yyjs != null ? input.yyjs.Split(',').ToObeject<List<string>>() : null;
DateTime? startYyjs = queryYyjs != null ? Ext.GetDateTime(queryYyjs.First()) : null;
DateTime? endYyjs = queryYyjs != null ? Ext.GetDateTime(queryYyjs.Last()) : null;
var data = await _db.Queryable<LqYyjlEntity>()
.WhereIF(!string.IsNullOrEmpty(input.id), p => p.Id.Contains(input.id))
.WhereIF(!string.IsNullOrEmpty(input.djmd), p => p.Djmd.Equals(input.djmd))
.WhereIF(!string.IsNullOrEmpty(input.yyr), p => p.Yyr.Equals(input.yyr))
.WhereIF(!string.IsNullOrEmpty(input.gklx), p => p.Gklx.Contains(input.gklx))
.WhereIF(!string.IsNullOrEmpty(input.yytyxm), p => p.Yytyxm.Equals(input.yytyxm))
.WhereIF(!string.IsNullOrEmpty(input.czr), p => p.Czr.Equals(input.czr))
.WhereIF(queryCzsj != null, p => p.Czsj >= new DateTime(startCzsj.ToDate().Year, startCzsj.ToDate().Month, startCzsj.ToDate().Day, 0, 0, 0))
.WhereIF(queryCzsj != null, p => p.Czsj <= new DateTime(endCzsj.ToDate().Year, endCzsj.ToDate().Month, endCzsj.ToDate().Day, 23, 59, 59))
.WhereIF(!string.IsNullOrEmpty(input.gk), p => p.Gk.Equals(input.gk))
.WhereIF(!string.IsNullOrEmpty(input.gkxm), p => p.Gkxm.Contains(input.gkxm))
.WhereIF(!string.IsNullOrEmpty(input.yyjks), p => p.Yyjks.Equals(input.yyjks))
.WhereIF(queryYysj != null, p => p.Yysj >= new DateTime(startYysj.ToDate().Year, startYysj.ToDate().Month, startYysj.ToDate().Day, 0, 0, 0))
.WhereIF(queryYysj != null, p => p.Yysj <= new DateTime(endYysj.ToDate().Year, endYysj.ToDate().Month, endYysj.ToDate().Day, 23, 59, 59))
.WhereIF(queryYyjs != null, p => p.Yyjs >= new DateTime(startYyjs.ToDate().Year, startYyjs.ToDate().Month, startYyjs.ToDate().Day, 0, 0, 0))
.WhereIF(queryYyjs != null, p => p.Yyjs <= new DateTime(endYyjs.ToDate().Year, endYyjs.ToDate().Month, endYyjs.ToDate().Day, 23, 59, 59))
|
35bb18d3
“wangming”
更新多个.DS_Store文件,删...
|
225
|
.WhereIF(!string.IsNullOrEmpty(input.F_Status), p => p.F_Status.Equals(input.F_Status))
|
d98270e2
“wangming”
Enhance LqEventSe...
|
226
|
.Select(it => new LqYyjlListOutput
|
96009bc9
hexiaodong
hxd
|
227
228
|
{
id = it.Id,
|
d98270e2
“wangming”
Enhance LqEventSe...
|
229
230
231
232
233
234
235
236
237
238
239
240
|
djmd = it.Djmd,
yyr = it.Yyr,
gklx = it.Gklx,
yytyxm = it.Yytyxm,
czr = it.Czr,
czsj = it.Czsj,
gk = it.Gk,
gkxm = it.Gkxm,
yyjks = it.Yyjks,
yysj = it.Yysj,
yyjs = it.Yyjs,
F_Status = it.F_Status,
|
7f83b333
“wangming”
重构:删除部门管理模块并修复预约记录服务
|
241
242
243
|
yyrName = SqlFunc.Subqueryable<UserEntity>().Where(u => u.Id == it.Yyr).Select(u => u.RealName),
yyjksName = SqlFunc.Subqueryable<UserEntity>().Where(u => u.Id == it.Yyjks).Select(u => u.RealName),
djmdName = SqlFunc.Subqueryable<LqMdxxEntity>().Where(u => u.Id == it.Djmd).Select(u => u.Dm),
|
d98270e2
“wangming”
Enhance LqEventSe...
|
244
245
246
247
248
|
})
.MergeTable()
.OrderBy(sidx + " " + input.sort)
.ToListAsync();
return data;
|
96009bc9
hexiaodong
hxd
|
249
|
}
|
7f83b333
“wangming”
重构:删除部门管理模块并修复预约记录服务
|
250
|
#endregion
|
96009bc9
hexiaodong
hxd
|
251
|
|
7f83b333
“wangming”
重构:删除部门管理模块并修复预约记录服务
|
252
|
#region 导出预约记录
|
96009bc9
hexiaodong
hxd
|
253
|
/// <summary>
|
d98270e2
“wangming”
Enhance LqEventSe...
|
254
255
256
257
|
/// 导出预约记录
/// </summary>
/// <param name="input">请求参数</param>
/// <returns></returns>
|
96009bc9
hexiaodong
hxd
|
258
259
260
261
262
263
264
265
266
267
268
269
270
271
|
[HttpGet("Actions/Export")]
public async Task<dynamic> Export([FromQuery] LqYyjlListQueryInput input)
{
var userInfo = await _userManager.GetUserInfo();
var exportData = new List<LqYyjlListOutput>();
if (input.dataType == 0)
{
var data = Clay.Object(await this.GetList(input));
exportData = data.Solidify<PageResult<LqYyjlListOutput>>().list;
}
else
{
exportData = await this.GetNoPagingList(input);
}
|
d98270e2
“wangming”
Enhance LqEventSe...
|
272
273
|
List<ParamsModel> paramList =
"[{\"value\":\"预约编号\",\"field\":\"id\"},{\"value\":\"单据门店\",\"field\":\"djmd\"},{\"value\":\"邀约人\",\"field\":\"yyr\"},{\"value\":\"顾客姓名\",\"field\":\"gkxm\"},{\"value\":\"操作人\",\"field\":\"czr\"},{\"value\":\"操作时间\",\"field\":\"czsj\"},{\"value\":\"预约体验项目\",\"field\":\"yytyxm\"},{\"value\":\"顾客类型\",\"field\":\"gklx\"},{\"value\":\"预约健康师\",\"field\":\"yyjks\"},{\"value\":\"预约开始时间\",\"field\":\"yysj\"},{\"value\":\"预约结束时间\",\"field\":\"yyjs\"},{\"value\":\"顾客\",\"field\":\"gk\"},{\"value\":\"预约状态\",\"field\":\"F_Status\"},]".ToList<ParamsModel>();
|
96009bc9
hexiaodong
hxd
|
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
|
ExcelConfig excelconfig = new ExcelConfig();
excelconfig.FileName = "预约记录.xls";
excelconfig.HeadFont = "微软雅黑";
excelconfig.HeadPoint = 10;
excelconfig.IsAllSizeColumn = true;
excelconfig.ColumnModel = new List<ExcelColumnModel>();
List<string> selectKeyList = input.selectKey.Split(',').ToList();
foreach (var item in selectKeyList)
{
var isExist = paramList.Find(p => p.field == item);
if (isExist != null)
{
excelconfig.ColumnModel.Add(new ExcelColumnModel() { Column = isExist.field, ExcelColumn = isExist.value });
}
}
var addPath = FileVariable.TemporaryFilePath + excelconfig.FileName;
ExcelExportHelper<LqYyjlListOutput>.Export(exportData, excelconfig, addPath);
var fileName = _userManager.UserId + "|" + addPath + "|xls";
|
d98270e2
“wangming”
Enhance LqEventSe...
|
292
|
var output = new { name = excelconfig.FileName, url = "/api/File/Download?encryption=" + DESCEncryption.Encrypt(fileName, "NCC") };
|
96009bc9
hexiaodong
hxd
|
293
294
|
return output;
}
|
7f83b333
“wangming”
重构:删除部门管理模块并修复预约记录服务
|
295
|
#endregion
|
96009bc9
hexiaodong
hxd
|
296
|
|
7f83b333
“wangming”
重构:删除部门管理模块并修复预约记录服务
|
297
|
#region 批量删除预约记录
|
96009bc9
hexiaodong
hxd
|
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
|
/// <summary>
/// 批量删除预约记录
/// </summary>
/// <param name="ids">主键数组</param>
/// <returns></returns>
[HttpPost("batchRemove")]
public async Task BatchRemove([FromBody] List<string> ids)
{
var entitys = await _db.Queryable<LqYyjlEntity>().In(it => it.Id, ids).ToListAsync();
if (entitys.Count > 0)
{
try
{
//开启事务
_db.BeginTran();
//批量删除预约记录
|
d98270e2
“wangming”
Enhance LqEventSe...
|
314
|
await _db.Deleteable<LqYyjlEntity>().In(d => d.Id, ids).ExecuteCommandAsync();
|
96009bc9
hexiaodong
hxd
|
315
316
317
318
319
320
321
322
323
324
325
|
//关闭事务
_db.CommitTran();
}
catch (Exception)
{
//回滚事务
_db.RollbackTran();
throw NCCException.Oh(ErrorCode.COM1002);
}
}
}
|
7f83b333
“wangming”
重构:删除部门管理模块并修复预约记录服务
|
326
|
#endregion
|
96009bc9
hexiaodong
hxd
|
327
|
|
7f83b333
“wangming”
重构:删除部门管理模块并修复预约记录服务
|
328
|
#region 更新预约记录
|
96009bc9
hexiaodong
hxd
|
329
330
331
332
333
334
335
336
337
338
339
|
/// <summary>
/// 更新预约记录
/// </summary>
/// <param name="id">主键</param>
/// <param name="input">参数</param>
/// <returns></returns>
[HttpPut("{id}")]
public async Task Update(string id, [FromBody] LqYyjlUpInput input)
{
var entity = input.Adapt<LqYyjlEntity>();
var isOk = await _db.Updateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
d98270e2
“wangming”
Enhance LqEventSe...
|
340
341
|
if (!(isOk > 0))
throw NCCException.Oh(ErrorCode.COM1001);
|
96009bc9
hexiaodong
hxd
|
342
|
}
|
7f83b333
“wangming”
重构:删除部门管理模块并修复预约记录服务
|
343
|
#endregion
|
96009bc9
hexiaodong
hxd
|
344
|
|
7f83b333
“wangming”
重构:删除部门管理模块并修复预约记录服务
|
345
|
#region 删除预约记录
|
96009bc9
hexiaodong
hxd
|
346
347
348
349
350
351
352
353
354
355
|
/// <summary>
/// 删除预约记录
/// </summary>
/// <returns></returns>
[HttpDelete("{id}")]
public async Task Delete(string id)
{
var entity = await _db.Queryable<LqYyjlEntity>().FirstAsync(p => p.Id == id);
_ = entity ?? throw NCCException.Oh(ErrorCode.COM1005);
var isOk = await _db.Deleteable<LqYyjlEntity>().Where(d => d.Id == id).ExecuteCommandAsync();
|
d98270e2
“wangming”
Enhance LqEventSe...
|
356
357
|
if (!(isOk > 0))
throw NCCException.Oh(ErrorCode.COM1002);
|
96009bc9
hexiaodong
hxd
|
358
|
}
|
7f83b333
“wangming”
重构:删除部门管理模块并修复预约记录服务
|
359
|
#endregion
|
72cec4b5
“wangming”
feat: 添加转化率统计和升单类型功能
|
360
361
362
363
364
|
#region 添加未成交说明
/// <summary>
/// 添加未成交说明
/// </summary>
|
72cec4b5
“wangming”
feat: 添加转化率统计和升单类型功能
|
365
366
|
/// <param name="input">参数</param>
/// <returns></returns>
|
14cbcfd9
“wangming”
feat: 添加人次记录表和品项分类字段
|
367
368
|
[HttpPost("AddNoDealRemark")]
public async Task AddNoDealRemark([FromBody] LqYyjlAddNoDealRemarkInput input)
|
72cec4b5
“wangming”
feat: 添加转化率统计和升单类型功能
|
369
|
{
|
14cbcfd9
“wangming”
feat: 添加人次记录表和品项分类字段
|
370
|
var entity = await _db.Queryable<LqYyjlEntity>().FirstAsync(p => p.Id == input.id);
|
72cec4b5
“wangming”
feat: 添加转化率统计和升单类型功能
|
371
|
_ = entity ?? throw NCCException.Oh(ErrorCode.COM1005);
|
14cbcfd9
“wangming”
feat: 添加人次记录表和品项分类字段
|
372
|
entity.NoDealRemark = input.noDealRemark;
|
72cec4b5
“wangming”
feat: 添加转化率统计和升单类型功能
|
373
374
375
376
377
|
var isOk = await _db.Updateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
if (!(isOk > 0))
throw NCCException.Oh(ErrorCode.COM1001);
}
#endregion
|
763801a5
“wangming”
门店驾驶舱功能优化:新增统计接口、...
|
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
|
#region 我的今日预约
/// <summary>
/// 获取我的今日预约
/// </summary>
/// <remarks>
/// 查询当前登录用户今天预约的客户列表
///
/// 查询逻辑:
/// 1. 查询当前用户(yyr字段)的预约记录
/// 2. 筛选预约开始时间(yysj)在今天范围内的记录
/// 3. 关联查询客户、健康师、门店等信息
/// 4. 按预约时间排序返回
/// </remarks>
/// <returns>今日预约客户列表</returns>
/// <response code="200">查询成功</response>
/// <response code="500">服务器错误</response>
[HttpGet("GetMyTodayAppointments")]
public async Task<List<MyTodayAppointmentOutput>> GetMyTodayAppointmentsAsync()
{
try
{
var currentUserId = _userManager.UserId;
var today = DateTime.Now.Date;
// 查询当前用户今天的预约记录
var appointments = await _db.Queryable<LqYyjlEntity>()
.Where(x => x.Yyr == currentUserId)
.Where(x => x.Yysj != null && x.Yysj.Value.Date == today)
.OrderBy(x => x.Yysj)
.ToListAsync();
if (!appointments.Any())
{
return new List<MyTodayAppointmentOutput>();
}
// 获取门店信息
var storeIds = appointments.Where(x => !string.IsNullOrEmpty(x.Djmd)).Select(x => x.Djmd).Distinct().ToList();
var stores = new Dictionary<string, string>();
if (storeIds.Any())
{
var storeList = await _db.Queryable<LqMdxxEntity>()
.Where(x => storeIds.Contains(x.Id))
.Select(x => new { x.Id, x.Dm })
.ToListAsync();
stores = storeList.ToDictionary(k => k.Id, v => v.Dm);
}
// 获取健康师信息
var healthCoachIds = appointments.Where(x => !string.IsNullOrEmpty(x.Yyjks)).Select(x => x.Yyjks).Distinct().ToList();
var healthCoaches = new Dictionary<string, string>();
if (healthCoachIds.Any())
{
var healthCoachList = await _db.Queryable<UserEntity>()
.Where(x => healthCoachIds.Contains(x.Id))
.Select(x => new { x.Id, x.RealName })
.ToListAsync();
healthCoaches = healthCoachList.ToDictionary(k => k.Id, v => v.RealName);
}
// 构建返回结果
var result = appointments.Select(x =>
{
var startTime = x.Yysj?.ToString("HH:mm") ?? "";
var endTime = x.Yyjs?.ToString("HH:mm") ?? "";
var timeDisplay = !string.IsNullOrEmpty(endTime) ? $"{startTime}-{endTime}" : startTime;
return new MyTodayAppointmentOutput
{
AppointmentId = x.Id,
CustomerId = x.Gk,
CustomerName = x.Gkxm,
CustomerType = x.Gklx,
ProjectName = x.Yytyxm,
AppointmentStartTime = x.Yysj,
AppointmentEndTime = x.Yyjs,
HealthCoachId = x.Yyjks,
HealthCoachName = !string.IsNullOrEmpty(x.Yyjks) && healthCoaches.ContainsKey(x.Yyjks) ? healthCoaches[x.Yyjks] : null,
Status = x.F_Status,
StoreId = x.Djmd,
StoreName = !string.IsNullOrEmpty(x.Djmd) && stores.ContainsKey(x.Djmd) ? stores[x.Djmd] : null,
AppointmentTimeDisplay = timeDisplay
};
}).ToList();
return result;
}
catch (Exception ex)
{
throw NCCException.Oh($"获取我的今日预约失败:{ex.Message}");
}
}
#endregion
|
96009bc9
hexiaodong
hxd
|
474
475
|
}
}
|