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
19
|
using NCC.Extend.Entitys.Dto.LqYyjl;
using NCC.Extend.Entitys.lq_yyjl;
|
96009bc9
hexiaodong
hxd
|
20
|
using NCC.Extend.Interfaces.LqYyjl;
|
d98270e2
“wangming”
Enhance LqEventSe...
|
21
22
|
using NCC.FriendlyException;
using NCC.JsonSerialization;
|
96009bc9
hexiaodong
hxd
|
23
|
using SqlSugar;
|
96009bc9
hexiaodong
hxd
|
24
|
using Yitter.IdGenerator;
|
96009bc9
hexiaodong
hxd
|
25
26
27
28
29
30
|
namespace NCC.Extend.LqYyjl
{
/// <summary>
/// 预约记录服务
/// </summary>
|
d98270e2
“wangming”
Enhance LqEventSe...
|
31
|
[ApiDescriptionSettings(Tag = "Extend", Name = "LqYyjl", Order = 200)]
|
96009bc9
hexiaodong
hxd
|
32
33
34
35
36
37
38
39
40
41
|
[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...
|
42
|
public LqYyjlService(ISqlSugarRepository<LqYyjlEntity> lqYyjlRepository, IUserManager userManager)
|
96009bc9
hexiaodong
hxd
|
43
|
{
|
d98270e2
“wangming”
Enhance LqEventSe...
|
44
|
_lqYyjlRepository = lqYyjlRepository;
|
96009bc9
hexiaodong
hxd
|
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
_db = _lqYyjlRepository.Context;
_userManager = userManager;
}
/// <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>();
return output;
}
/// <summary>
|
d98270e2
“wangming”
Enhance LqEventSe...
|
63
64
65
66
|
/// 获取预约记录列表
/// </summary>
/// <param name="input">请求参数</param>
/// <returns></returns>
|
96009bc9
hexiaodong
hxd
|
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
[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文件,删...
|
96
|
.WhereIF(!string.IsNullOrEmpty(input.F_Status), p => p.F_Status.Equals(input.F_Status))
|
d98270e2
“wangming”
Enhance LqEventSe...
|
97
|
.Select(it => new LqYyjlListOutput
|
96009bc9
hexiaodong
hxd
|
98
99
|
{
id = it.Id,
|
d98270e2
“wangming”
Enhance LqEventSe...
|
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
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,
})
.MergeTable()
.OrderBy(sidx + " " + input.sort)
.ToPagedListAsync(input.currentPage, input.pageSize);
return PageResult<LqYyjlListOutput>.SqlSugarPageResult(data);
|
96009bc9
hexiaodong
hxd
|
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
}
/// <summary>
/// 新建预约记录
/// </summary>
/// <param name="input">参数</param>
/// <returns></returns>
[HttpPost("")]
public async Task Create([FromBody] LqYyjlCrInput input)
{
var userInfo = await _userManager.GetUserInfo();
var entity = input.Adapt<LqYyjlEntity>();
entity.Id = YitIdHelper.NextId().ToString();
entity.Czr = _userManager.UserId;
|
d98270e2
“wangming”
Enhance LqEventSe...
|
131
|
entity.Czsj = DateTime.Now;
|
96009bc9
hexiaodong
hxd
|
132
|
var isOk = await _db.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandAsync();
|
d98270e2
“wangming”
Enhance LqEventSe...
|
133
134
|
if (!(isOk > 0))
throw NCCException.Oh(ErrorCode.COM1000);
|
96009bc9
hexiaodong
hxd
|
135
136
137
|
}
/// <summary>
|
d98270e2
“wangming”
Enhance LqEventSe...
|
138
139
140
141
|
/// 获取预约记录无分页列表
/// </summary>
/// <param name="input">请求参数</param>
/// <returns></returns>
|
96009bc9
hexiaodong
hxd
|
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
[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文件,删...
|
171
|
.WhereIF(!string.IsNullOrEmpty(input.F_Status), p => p.F_Status.Equals(input.F_Status))
|
d98270e2
“wangming”
Enhance LqEventSe...
|
172
|
.Select(it => new LqYyjlListOutput
|
96009bc9
hexiaodong
hxd
|
173
174
|
{
id = it.Id,
|
d98270e2
“wangming”
Enhance LqEventSe...
|
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
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,
})
.MergeTable()
.OrderBy(sidx + " " + input.sort)
.ToListAsync();
return data;
|
96009bc9
hexiaodong
hxd
|
192
193
194
|
}
/// <summary>
|
d98270e2
“wangming”
Enhance LqEventSe...
|
195
196
197
198
|
/// 导出预约记录
/// </summary>
/// <param name="input">请求参数</param>
/// <returns></returns>
|
96009bc9
hexiaodong
hxd
|
199
200
201
202
203
204
205
206
207
208
209
210
211
212
|
[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...
|
213
214
|
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
|
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
|
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...
|
233
|
var output = new { name = excelconfig.FileName, url = "/api/File/Download?encryption=" + DESCEncryption.Encrypt(fileName, "NCC") };
|
96009bc9
hexiaodong
hxd
|
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
|
return output;
}
/// <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...
|
253
|
await _db.Deleteable<LqYyjlEntity>().In(d => d.Id, ids).ExecuteCommandAsync();
|
96009bc9
hexiaodong
hxd
|
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
|
//关闭事务
_db.CommitTran();
}
catch (Exception)
{
//回滚事务
_db.RollbackTran();
throw NCCException.Oh(ErrorCode.COM1002);
}
}
}
/// <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...
|
277
278
|
if (!(isOk > 0))
throw NCCException.Oh(ErrorCode.COM1001);
|
96009bc9
hexiaodong
hxd
|
279
280
281
282
283
284
285
286
287
288
289
290
|
}
/// <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...
|
291
292
|
if (!(isOk > 0))
throw NCCException.Oh(ErrorCode.COM1002);
|
96009bc9
hexiaodong
hxd
|
293
294
295
|
}
}
}
|