Commit 00486d53c72825d0ce2da9542f9c7d167ce62fbc
1 parent
7188a8ff
更新多个.DS_Store文件,优化代码格式,确保代码整洁性。
Showing
15 changed files
with
785 additions
and
489 deletions
.DS_Store
No preview for this file type
netcore/src/.DS_Store
No preview for this file type
netcore/src/Application/.DS_Store
No preview for this file type
netcore/src/Application/NCC.API/.DS_Store
No preview for this file type
netcore/src/Modularity/.DS_Store
No preview for this file type
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_jlmxb/LqJlmxbEntity.cs
| ... | ... | @@ -16,96 +16,96 @@ namespace NCC.Extend.Entitys.lq_jlmxb |
| 16 | 16 | /// </summary> |
| 17 | 17 | [SugarColumn(ColumnName = "F_Id", IsPrimaryKey = true)] |
| 18 | 18 | public string Id { get; set; } |
| 19 | - | |
| 19 | + | |
| 20 | 20 | /// <summary> |
| 21 | 21 | /// 门店编号 |
| 22 | 22 | /// </summary> |
| 23 | - [SugarColumn(ColumnName = "mdbh")] | |
| 23 | + [SugarColumn(ColumnName = "mdbh")] | |
| 24 | 24 | public string Mdbh { get; set; } |
| 25 | - | |
| 25 | + | |
| 26 | 26 | /// <summary> |
| 27 | 27 | /// 门店名称 |
| 28 | 28 | /// </summary> |
| 29 | - [SugarColumn(ColumnName = "mdmc")] | |
| 29 | + [SugarColumn(ColumnName = "mdmc")] | |
| 30 | 30 | public string Mdmc { get; set; } |
| 31 | - | |
| 31 | + | |
| 32 | 32 | /// <summary> |
| 33 | 33 | /// 岗位 |
| 34 | 34 | /// </summary> |
| 35 | - [SugarColumn(ColumnName = "gw")] | |
| 35 | + [SugarColumn(ColumnName = "gw")] | |
| 36 | 36 | public string Gw { get; set; } |
| 37 | - | |
| 37 | + | |
| 38 | 38 | /// <summary> |
| 39 | 39 | /// 健康师 |
| 40 | 40 | /// </summary> |
| 41 | - [SugarColumn(ColumnName = "jks")] | |
| 41 | + [SugarColumn(ColumnName = "jks")] | |
| 42 | 42 | public string Jks { get; set; } |
| 43 | - | |
| 43 | + | |
| 44 | 44 | /// <summary> |
| 45 | 45 | /// 医美秒杀卡 |
| 46 | 46 | /// </summary> |
| 47 | - [SugarColumn(ColumnName = "ymmsk")] | |
| 47 | + [SugarColumn(ColumnName = "ymmsk")] | |
| 48 | 48 | public string Ymmsk { get; set; } |
| 49 | - | |
| 49 | + | |
| 50 | 50 | /// <summary> |
| 51 | 51 | /// 科技部秒杀卡 |
| 52 | 52 | /// </summary> |
| 53 | - [SugarColumn(ColumnName = "kjbmsk")] | |
| 53 | + [SugarColumn(ColumnName = "kjbmsk")] | |
| 54 | 54 | public string Kjbmsk { get; set; } |
| 55 | - | |
| 55 | + | |
| 56 | 56 | /// <summary> |
| 57 | 57 | /// 成交奖 |
| 58 | 58 | /// </summary> |
| 59 | - [SugarColumn(ColumnName = "cjj")] | |
| 59 | + [SugarColumn(ColumnName = "cjj")] | |
| 60 | 60 | public string Cjj { get; set; } |
| 61 | - | |
| 61 | + | |
| 62 | 62 | /// <summary> |
| 63 | 63 | /// PK |
| 64 | 64 | /// </summary> |
| 65 | - [SugarColumn(ColumnName = "pk")] | |
| 65 | + [SugarColumn(ColumnName = "pk")] | |
| 66 | 66 | public string Pk { get; set; } |
| 67 | - | |
| 67 | + | |
| 68 | 68 | /// <summary> |
| 69 | 69 | /// 体验 |
| 70 | 70 | /// </summary> |
| 71 | - [SugarColumn(ColumnName = "ty")] | |
| 71 | + [SugarColumn(ColumnName = "ty")] | |
| 72 | 72 | public string Ty { get; set; } |
| 73 | - | |
| 73 | + | |
| 74 | 74 | /// <summary> |
| 75 | 75 | /// 打版 |
| 76 | 76 | /// </summary> |
| 77 | - [SugarColumn(ColumnName = "db")] | |
| 77 | + [SugarColumn(ColumnName = "db")] | |
| 78 | 78 | public string Db { get; set; } |
| 79 | - | |
| 79 | + | |
| 80 | 80 | /// <summary> |
| 81 | 81 | /// 沉睡 |
| 82 | 82 | /// </summary> |
| 83 | - [SugarColumn(ColumnName = "cs")] | |
| 83 | + [SugarColumn(ColumnName = "cs")] | |
| 84 | 84 | public string Cs { get; set; } |
| 85 | - | |
| 85 | + | |
| 86 | 86 | /// <summary> |
| 87 | 87 | /// 嘉宾 |
| 88 | 88 | /// </summary> |
| 89 | - [SugarColumn(ColumnName = "jb")] | |
| 89 | + [SugarColumn(ColumnName = "jb")] | |
| 90 | 90 | public string Jb { get; set; } |
| 91 | - | |
| 91 | + | |
| 92 | 92 | /// <summary> |
| 93 | 93 | /// 合计 |
| 94 | 94 | /// </summary> |
| 95 | - [SugarColumn(ColumnName = "hj")] | |
| 95 | + [SugarColumn(ColumnName = "hj")] | |
| 96 | 96 | public string Hj { get; set; } |
| 97 | - | |
| 97 | + | |
| 98 | 98 | /// <summary> |
| 99 | 99 | /// 扣除明细 |
| 100 | 100 | /// </summary> |
| 101 | - [SugarColumn(ColumnName = "kcmx")] | |
| 101 | + [SugarColumn(ColumnName = "kcmx")] | |
| 102 | 102 | public string Kcmx { get; set; } |
| 103 | - | |
| 103 | + | |
| 104 | 104 | /// <summary> |
| 105 | 105 | /// 不含嘉宾 |
| 106 | 106 | /// </summary> |
| 107 | - [SugarColumn(ColumnName = "bhjb")] | |
| 107 | + [SugarColumn(ColumnName = "bhjb")] | |
| 108 | 108 | public string Bhjb { get; set; } |
| 109 | - | |
| 109 | + | |
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | \ No newline at end of file | ... | ... |
netcore/src/Modularity/Extend/NCC.Extend/LqCpxxService.cs
| ... | ... | @@ -28,7 +28,7 @@ namespace NCC.Extend.LqCpxx |
| 28 | 28 | /// <summary> |
| 29 | 29 | /// 产品资料服务 |
| 30 | 30 | /// </summary> |
| 31 | - [ApiDescriptionSettings(Tag = "Extend",Name = "LqCpxx", Order = 200)] | |
| 31 | + [ApiDescriptionSettings(Tag = "Extend", Name = "LqCpxx", Order = 200)] | |
| 32 | 32 | [Route("api/Extend/[controller]")] |
| 33 | 33 | public class LqCpxxService : ILqCpxxService, IDynamicApiController, ITransient |
| 34 | 34 | { |
| ... | ... | @@ -43,7 +43,7 @@ namespace NCC.Extend.LqCpxx |
| 43 | 43 | ISqlSugarRepository<LqCpxxEntity> lqCpxxRepository, |
| 44 | 44 | IUserManager userManager) |
| 45 | 45 | { |
| 46 | - _lqCpxxRepository = lqCpxxRepository; | |
| 46 | + _lqCpxxRepository = lqCpxxRepository; | |
| 47 | 47 | _db = _lqCpxxRepository.Context; |
| 48 | 48 | _userManager = userManager; |
| 49 | 49 | } |
| ... | ... | @@ -93,24 +93,24 @@ namespace NCC.Extend.LqCpxx |
| 93 | 93 | .WhereIF(queryHtqdksrq != null, p => p.Htqdksrq <= new DateTime(endHtqdksrq.ToDate().Year, endHtqdksrq.ToDate().Month, endHtqdksrq.ToDate().Day, 23, 59, 59)) |
| 94 | 94 | .WhereIF(queryHtqdjsrq != null, p => p.Htqdjsrq >= new DateTime(startHtqdjsrq.ToDate().Year, startHtqdjsrq.ToDate().Month, startHtqdjsrq.ToDate().Day, 0, 0, 0)) |
| 95 | 95 | .WhereIF(queryHtqdjsrq != null, p => p.Htqdjsrq <= new DateTime(endHtqdjsrq.ToDate().Year, endHtqdjsrq.ToDate().Month, endHtqdjsrq.ToDate().Day, 23, 59, 59)) |
| 96 | - .Select(it=> new LqCpxxListOutput | |
| 96 | + .Select(it => new LqCpxxListOutput | |
| 97 | 97 | { |
| 98 | 98 | id = it.Id, |
| 99 | - cpmc=it.Cpmc, | |
| 100 | - bzj=it.Bzj, | |
| 101 | - sjzt=it.Sjzt, | |
| 102 | - syzt=it.Syzt, | |
| 103 | - tjfl=it.Tjfl, | |
| 104 | - gsck=it.Gsck, | |
| 105 | - gsbm=it.Gsbm, | |
| 106 | - bzdw=it.Bzdw, | |
| 107 | - dwhs=it.Dwhs, | |
| 108 | - zbq=it.Zbq, | |
| 109 | - gysxx=it.Gysxx, | |
| 110 | - htqdksrq=it.Htqdksrq, | |
| 111 | - htqdjsrq=it.Htqdjsrq, | |
| 112 | - }).MergeTable().OrderBy(sidx+" "+input.sort).ToPagedListAsync(input.currentPage, input.pageSize); | |
| 113 | - return PageResult<LqCpxxListOutput>.SqlSugarPageResult(data); | |
| 99 | + cpmc = it.Cpmc, | |
| 100 | + bzj = it.Bzj, | |
| 101 | + sjzt = it.Sjzt, | |
| 102 | + syzt = it.Syzt, | |
| 103 | + tjfl = it.Tjfl, | |
| 104 | + gsck = it.Gsck, | |
| 105 | + gsbm = it.Gsbm, | |
| 106 | + bzdw = it.Bzdw, | |
| 107 | + dwhs = it.Dwhs, | |
| 108 | + zbq = it.Zbq, | |
| 109 | + gysxx = it.Gysxx, | |
| 110 | + htqdksrq = it.Htqdksrq, | |
| 111 | + htqdjsrq = it.Htqdjsrq, | |
| 112 | + }).MergeTable().OrderBy(sidx + " " + input.sort).ToPagedListAsync(input.currentPage, input.pageSize); | |
| 113 | + return PageResult<LqCpxxListOutput>.SqlSugarPageResult(data); | |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /// <summary> |
| ... | ... | @@ -160,24 +160,24 @@ namespace NCC.Extend.LqCpxx |
| 160 | 160 | .WhereIF(queryHtqdksrq != null, p => p.Htqdksrq <= new DateTime(endHtqdksrq.ToDate().Year, endHtqdksrq.ToDate().Month, endHtqdksrq.ToDate().Day, 23, 59, 59)) |
| 161 | 161 | .WhereIF(queryHtqdjsrq != null, p => p.Htqdjsrq >= new DateTime(startHtqdjsrq.ToDate().Year, startHtqdjsrq.ToDate().Month, startHtqdjsrq.ToDate().Day, 0, 0, 0)) |
| 162 | 162 | .WhereIF(queryHtqdjsrq != null, p => p.Htqdjsrq <= new DateTime(endHtqdjsrq.ToDate().Year, endHtqdjsrq.ToDate().Month, endHtqdjsrq.ToDate().Day, 23, 59, 59)) |
| 163 | - .Select(it=> new LqCpxxListOutput | |
| 163 | + .Select(it => new LqCpxxListOutput | |
| 164 | 164 | { |
| 165 | 165 | id = it.Id, |
| 166 | - cpmc=it.Cpmc, | |
| 167 | - bzj=it.Bzj, | |
| 168 | - sjzt=it.Sjzt, | |
| 169 | - syzt=it.Syzt, | |
| 170 | - tjfl=it.Tjfl, | |
| 171 | - gsck=it.Gsck, | |
| 172 | - gsbm=it.Gsbm, | |
| 173 | - bzdw=it.Bzdw, | |
| 174 | - dwhs=it.Dwhs, | |
| 175 | - zbq=it.Zbq, | |
| 176 | - gysxx=it.Gysxx, | |
| 177 | - htqdksrq=it.Htqdksrq, | |
| 178 | - htqdjsrq=it.Htqdjsrq, | |
| 179 | - }).MergeTable().OrderBy(sidx+" "+input.sort).ToListAsync(); | |
| 180 | - return data; | |
| 166 | + cpmc = it.Cpmc, | |
| 167 | + bzj = it.Bzj, | |
| 168 | + sjzt = it.Sjzt, | |
| 169 | + syzt = it.Syzt, | |
| 170 | + tjfl = it.Tjfl, | |
| 171 | + gsck = it.Gsck, | |
| 172 | + gsbm = it.Gsbm, | |
| 173 | + bzdw = it.Bzdw, | |
| 174 | + dwhs = it.Dwhs, | |
| 175 | + zbq = it.Zbq, | |
| 176 | + gysxx = it.Gysxx, | |
| 177 | + htqdksrq = it.Htqdksrq, | |
| 178 | + htqdjsrq = it.Htqdjsrq, | |
| 179 | + }).MergeTable().OrderBy(sidx + " " + input.sort).ToListAsync(); | |
| 180 | + return data; | |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | /// <summary> |
| ... | ... | @@ -199,7 +199,7 @@ namespace NCC.Extend.LqCpxx |
| 199 | 199 | { |
| 200 | 200 | exportData = await this.GetNoPagingList(input); |
| 201 | 201 | } |
| 202 | - List<ParamsModel> paramList = "[{\"value\":\"产品编号\",\"field\":\"id\"},{\"value\":\"产品名称\",\"field\":\"cpmc\"},{\"value\":\"标准价\",\"field\":\"bzj\"},{\"value\":\"上架状态\",\"field\":\"sjzt\"},{\"value\":\"使用状态\",\"field\":\"syzt\"},{\"value\":\"统计分类\",\"field\":\"tjfl\"},{\"value\":\"归属仓库\",\"field\":\"gsck\"},{\"value\":\"归属部门\",\"field\":\"gsbm\"},{\"value\":\"标准单位\",\"field\":\"bzdw\"},{\"value\":\"单位换算\",\"field\":\"dwhs\"},{\"value\":\"质保期\",\"field\":\"zbq\"},{\"value\":\"供应商信息\",\"field\":\"gysxx\"},{\"value\":\"合同签订日期\",\"field\":\"htqdksrq\"},{\"value\":\"合同结束日期\",\"field\":\"htqdjsrq\"},]".ToList<ParamsModel>(); | |
| 202 | + List<ParamsModel> paramList = "[{\"value\":\"产品编号\",\"field\":\"id\"},{\"value\":\"产品名称\",\"field\":\"cpmc\"},{\"value\":\"标准价\",\"field\":\"bzj\"},{\"value\":\"上架状态\",\"field\":\"sjzt\"},{\"value\":\"使用状态\",\"field\":\"syzt\"},{\"value\":\"统计分类\",\"field\":\"tjfl\"},{\"value\":\"归属仓库\",\"field\":\"gsck\"},{\"value\":\"归属部门\",\"field\":\"gsbm\"},{\"value\":\"标准单位\",\"field\":\"bzdw\"},{\"value\":\"单位换算\",\"field\":\"dwhs\"},{\"value\":\"质保期\",\"field\":\"zbq\"},{\"value\":\"供应商信息\",\"field\":\"gysxx\"},{\"value\":\"合同签订日期\",\"field\":\"htqdksrq\"},{\"value\":\"合同结束日期\",\"field\":\"htqdjsrq\"},]".ToList<ParamsModel>(); | |
| 203 | 203 | ExcelConfig excelconfig = new ExcelConfig(); |
| 204 | 204 | excelconfig.FileName = "产品资料.xls"; |
| 205 | 205 | excelconfig.HeadFont = "微软雅黑"; |
| ... | ... | @@ -242,7 +242,7 @@ namespace NCC.Extend.LqCpxx |
| 242 | 242 | //开启事务 |
| 243 | 243 | _db.BeginTran(); |
| 244 | 244 | //批量删除产品资料 |
| 245 | - await _db.Deleteable<LqCpxxEntity>().In(d => d.Id,ids).ExecuteCommandAsync(); | |
| 245 | + await _db.Deleteable<LqCpxxEntity>().In(d => d.Id, ids).ExecuteCommandAsync(); | |
| 246 | 246 | //关闭事务 |
| 247 | 247 | _db.CommitTran(); |
| 248 | 248 | } | ... | ... |
netcore/src/Modularity/Extend/NCC.Extend/LqHytkHytkService.cs
| 1 | +using System; | |
| 2 | +using System.Collections.Generic; | |
| 3 | +using System.Linq; | |
| 4 | +using System.Threading.Tasks; | |
| 5 | +using Mapster; | |
| 6 | +using Microsoft.AspNetCore.Mvc; | |
| 7 | +using NCC.ClayObject; | |
| 8 | +using NCC.Common.Configuration; | |
| 1 | 9 | using NCC.Common.Core.Manager; |
| 2 | 10 | using NCC.Common.Enum; |
| 3 | 11 | using NCC.Common.Extension; |
| 4 | 12 | using NCC.Common.Filter; |
| 13 | +using NCC.Common.Helper; | |
| 14 | +using NCC.Common.Model.NPOI; | |
| 15 | +using NCC.DataEncryption; | |
| 5 | 16 | using NCC.Dependency; |
| 6 | 17 | using NCC.DynamicApiController; |
| 7 | -using NCC.FriendlyException; | |
| 8 | -using NCC.Extend.Interfaces.LqHytkHytk; | |
| 9 | -using Mapster; | |
| 10 | -using Microsoft.AspNetCore.Mvc; | |
| 11 | -using SqlSugar; | |
| 12 | -using System; | |
| 13 | -using System.Collections.Generic; | |
| 14 | -using System.Linq; | |
| 15 | -using System.Threading.Tasks; | |
| 16 | -using NCC.Extend.Entitys.lq_hytk_hytk; | |
| 17 | -using NCC.Extend.Entitys.lq_hytk_mx; | |
| 18 | -using NCC.Extend.Entitys.lq_hytk_jksyj; | |
| 19 | -using NCC.Extend.Entitys.lq_hytk_kjbsyj; | |
| 20 | 18 | using NCC.Extend.Entitys.Dto.LqHytkHytk; |
| 21 | -using NCC.Extend.Entitys.Dto.LqHytkMx; | |
| 22 | 19 | using NCC.Extend.Entitys.Dto.LqHytkJksyj; |
| 23 | 20 | using NCC.Extend.Entitys.Dto.LqHytkKjbsyj; |
| 24 | -using Yitter.IdGenerator; | |
| 25 | -using NCC.Common.Helper; | |
| 21 | +using NCC.Extend.Entitys.Dto.LqHytkMx; | |
| 22 | +using NCC.Extend.Entitys.lq_hytk_hytk; | |
| 23 | +using NCC.Extend.Entitys.lq_hytk_jksyj; | |
| 24 | +using NCC.Extend.Entitys.lq_hytk_kjbsyj; | |
| 25 | +using NCC.Extend.Entitys.lq_hytk_mx; | |
| 26 | +using NCC.Extend.Interfaces.LqHytkHytk; | |
| 27 | +using NCC.FriendlyException; | |
| 26 | 28 | using NCC.JsonSerialization; |
| 27 | -using NCC.Common.Model.NPOI; | |
| 28 | -using NCC.Common.Configuration; | |
| 29 | -using NCC.DataEncryption; | |
| 30 | -using NCC.ClayObject; | |
| 29 | +using SqlSugar; | |
| 30 | +using Yitter.IdGenerator; | |
| 31 | 31 | |
| 32 | 32 | namespace NCC.Extend.LqHytkHytk |
| 33 | 33 | { |
| 34 | 34 | /// <summary> |
| 35 | 35 | /// 退卡_信息表服务 |
| 36 | 36 | /// </summary> |
| 37 | - [ApiDescriptionSettings(Tag = "绿纤退卡信息表服务",Name = "LqHytkHytk", Order = 200)] | |
| 37 | + [ApiDescriptionSettings(Tag = "绿纤退卡信息表服务", Name = "LqHytkHytk", Order = 200)] | |
| 38 | 38 | [Route("api/Extend/[controller]")] |
| 39 | 39 | public class LqHytkHytkService : ILqHytkHytkService, IDynamicApiController, ITransient |
| 40 | 40 | { |
| ... | ... | @@ -53,9 +53,10 @@ namespace NCC.Extend.LqHytkHytk |
| 53 | 53 | ISqlSugarRepository<LqHytkMxEntity> lqHytkMxRepository, |
| 54 | 54 | ISqlSugarRepository<LqHytkJksyjEntity> lqHytkJksyjRepository, |
| 55 | 55 | ISqlSugarRepository<LqHytkKjbsyjEntity> lqHytkKjbsyjRepository, |
| 56 | - IUserManager userManager) | |
| 56 | + IUserManager userManager | |
| 57 | + ) | |
| 57 | 58 | { |
| 58 | - _lqHytkHytkRepository = lqHytkHytkRepository; | |
| 59 | + _lqHytkHytkRepository = lqHytkHytkRepository; | |
| 59 | 60 | _lqHytkMxRepository = lqHytkMxRepository; |
| 60 | 61 | _lqHytkJksyjRepository = lqHytkJksyjRepository; |
| 61 | 62 | _lqHytkKjbsyjRepository = lqHytkKjbsyjRepository; |
| ... | ... | @@ -67,12 +68,13 @@ namespace NCC.Extend.LqHytkHytk |
| 67 | 68 | /// 获取退卡信息列表 |
| 68 | 69 | /// </summary> |
| 69 | 70 | /// <param name="input">查询参数</param> |
| 70 | - /// <returns></returns> | |
| 71 | + /// <returns></returns> | |
| 71 | 72 | [HttpGet("")] |
| 72 | 73 | public async Task<dynamic> GetList([FromQuery] LqHytkHytkListQueryInput input) |
| 73 | 74 | { |
| 74 | 75 | var sidx = input.sidx == null ? "id" : input.sidx; |
| 75 | - List<string> queryTksj = input.tksj != null ? input.tksj.Split(',').ToObeject<List<string>>() : null; | |
| 76 | + List<string> queryTksj = | |
| 77 | + input.tksj != null ? input.tksj.Split(',').ToObeject<List<string>>() : null; | |
| 76 | 78 | DateTime? startTksj = queryTksj != null ? Ext.GetDateTime(queryTksj.First()) : null; |
| 77 | 79 | DateTime? endTksj = queryTksj != null ? Ext.GetDateTime(queryTksj.Last()) : null; |
| 78 | 80 | var data = await _db.Queryable<LqHytkHytkEntity>() |
| ... | ... | @@ -89,30 +91,60 @@ namespace NCC.Extend.LqHytkHytk |
| 89 | 91 | .WhereIF(!string.IsNullOrEmpty(input.bz), p => p.Bz.Contains(input.bz)) |
| 90 | 92 | .WhereIF(!string.IsNullOrEmpty(input.tkzt), p => p.Tkzt.Contains(input.tkzt)) |
| 91 | 93 | .WhereIF(!string.IsNullOrEmpty(input.tkyy), p => p.Tkyy.Contains(input.tkyy)) |
| 92 | - .WhereIF(!string.IsNullOrEmpty(input.fileUrl), p => p.FileUrl.Contains(input.fileUrl)) | |
| 93 | - .WhereIF(queryTksj != null, p => p.Tksj >= new DateTime(startTksj.ToDate().Year, startTksj.ToDate().Month, startTksj.ToDate().Day, 0, 0, 0)) | |
| 94 | - .WhereIF(queryTksj != null, p => p.Tksj <= new DateTime(endTksj.ToDate().Year, endTksj.ToDate().Month, endTksj.ToDate().Day, 23, 59, 59)) | |
| 94 | + .WhereIF( | |
| 95 | + !string.IsNullOrEmpty(input.fileUrl), | |
| 96 | + p => p.FileUrl.Contains(input.fileUrl) | |
| 97 | + ) | |
| 98 | + .WhereIF( | |
| 99 | + queryTksj != null, | |
| 100 | + p => | |
| 101 | + p.Tksj | |
| 102 | + >= new DateTime( | |
| 103 | + startTksj.ToDate().Year, | |
| 104 | + startTksj.ToDate().Month, | |
| 105 | + startTksj.ToDate().Day, | |
| 106 | + 0, | |
| 107 | + 0, | |
| 108 | + 0 | |
| 109 | + ) | |
| 110 | + ) | |
| 111 | + .WhereIF( | |
| 112 | + queryTksj != null, | |
| 113 | + p => | |
| 114 | + p.Tksj | |
| 115 | + <= new DateTime( | |
| 116 | + endTksj.ToDate().Year, | |
| 117 | + endTksj.ToDate().Month, | |
| 118 | + endTksj.ToDate().Day, | |
| 119 | + 23, | |
| 120 | + 59, | |
| 121 | + 59 | |
| 122 | + ) | |
| 123 | + ) | |
| 95 | 124 | .WhereIF(!string.IsNullOrEmpty(input.czry), p => p.Czry.Equals(input.czry)) |
| 96 | - .Select(it=> new LqHytkHytkListOutput | |
| 125 | + .Select(it => new LqHytkHytkListOutput | |
| 97 | 126 | { |
| 98 | 127 | id = it.Id, |
| 99 | - md=it.Md, | |
| 100 | - mdbh=it.Mdbh, | |
| 101 | - mdmc=it.Mdmc, | |
| 102 | - hy=it.Hy, | |
| 103 | - hymc=it.Hymc, | |
| 104 | - hyzh=it.Hyzh, | |
| 105 | - gklx=it.Gklx, | |
| 106 | - tkje=it.Tkje, | |
| 107 | - sgfy=it.Sgfy, | |
| 108 | - bz=it.Bz, | |
| 109 | - tkzt=it.Tkzt, | |
| 110 | - tkyy=it.Tkyy, | |
| 111 | - tksj=it.Tksj, | |
| 112 | - czry=it.Czry, | |
| 113 | - fileUrl=it.FileUrl, | |
| 114 | - }).MergeTable().OrderBy(sidx+" "+input.sort).ToPagedListAsync(input.currentPage, input.pageSize); | |
| 115 | - return PageResult<LqHytkHytkListOutput>.SqlSugarPageResult(data); | |
| 128 | + md = it.Md, | |
| 129 | + mdbh = it.Mdbh, | |
| 130 | + mdmc = it.Mdmc, | |
| 131 | + hy = it.Hy, | |
| 132 | + hymc = it.Hymc, | |
| 133 | + hyzh = it.Hyzh, | |
| 134 | + gklx = it.Gklx, | |
| 135 | + tkje = it.Tkje, | |
| 136 | + sgfy = it.Sgfy, | |
| 137 | + bz = it.Bz, | |
| 138 | + tkzt = it.Tkzt, | |
| 139 | + tkyy = it.Tkyy, | |
| 140 | + tksj = it.Tksj, | |
| 141 | + czry = it.Czry, | |
| 142 | + fileUrl = it.FileUrl, | |
| 143 | + }) | |
| 144 | + .MergeTable() | |
| 145 | + .OrderBy(sidx + " " + input.sort) | |
| 146 | + .ToPagedListAsync(input.currentPage, input.pageSize); | |
| 147 | + return PageResult<LqHytkHytkListOutput>.SqlSugarPageResult(data); | |
| 116 | 148 | } |
| 117 | 149 | |
| 118 | 150 | /// <summary> |
| ... | ... | @@ -120,7 +152,7 @@ namespace NCC.Extend.LqHytkHytk |
| 120 | 152 | /// </summary> |
| 121 | 153 | /// <remarks> |
| 122 | 154 | /// 创建退卡记录及其关联的品项明细、健康师业绩、科技部老师业绩信息 |
| 123 | - /// | |
| 155 | + /// | |
| 124 | 156 | /// 示例请求: |
| 125 | 157 | /// ```json |
| 126 | 158 | /// { |
| ... | ... | @@ -172,7 +204,7 @@ namespace NCC.Extend.LqHytkHytk |
| 172 | 204 | /// ] |
| 173 | 205 | /// } |
| 174 | 206 | /// ``` |
| 175 | - /// | |
| 207 | + /// | |
| 176 | 208 | /// 参数说明: |
| 177 | 209 | /// - md: 门店ID |
| 178 | 210 | /// - hy: 会员ID |
| ... | ... | @@ -192,22 +224,24 @@ namespace NCC.Extend.LqHytkHytk |
| 192 | 224 | entity.F_CreateTime = DateTime.Now; |
| 193 | 225 | entity.F_CreateUser = userInfo.userId; |
| 194 | 226 | entity.F_DeleteMark = 0; |
| 195 | - entity.Tksj = DateTime.Now; | |
| 227 | + entity.Tksj = DateTime.Now; | |
| 196 | 228 | entity.Czry = userInfo.userId; |
| 197 | - | |
| 229 | + | |
| 198 | 230 | try |
| 199 | 231 | { |
| 200 | 232 | // 开启事务 |
| 201 | 233 | _db.BeginTran(); |
| 202 | - | |
| 234 | + | |
| 203 | 235 | // 新增退卡主表记录 |
| 204 | - var newEntity = await _db.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteReturnEntityAsync(); | |
| 236 | + var newEntity = await _db.Insertable(entity) | |
| 237 | + .IgnoreColumns(ignoreNullColumn: true) | |
| 238 | + .ExecuteReturnEntityAsync(); | |
| 205 | 239 | |
| 206 | 240 | // 收集所有需要插入的实体,然后批量插入 |
| 207 | 241 | var allMxEntities = new List<LqHytkMxEntity>(); |
| 208 | 242 | var allJksyjEntities = new List<LqHytkJksyjEntity>(); |
| 209 | 243 | var allKjbsyjEntities = new List<LqHytkKjbsyjEntity>(); |
| 210 | - | |
| 244 | + | |
| 211 | 245 | // 处理品项明细列表 |
| 212 | 246 | if (input.lqHytkMxList != null && input.lqHytkMxList.Any()) |
| 213 | 247 | { |
| ... | ... | @@ -228,79 +262,84 @@ namespace NCC.Extend.LqHytkHytk |
| 228 | 262 | F_ProjectNumber = item.F_ProjectNumber ?? 1, |
| 229 | 263 | F_IsEnabled = item.F_IsEnabled ?? 1, |
| 230 | 264 | F_SourceType = item.F_SourceType, |
| 231 | - F_TotalPrice = item.F_TotalPrice ?? (item.pxjg * (item.F_ProjectNumber ?? 1)), | |
| 265 | + F_TotalPrice = | |
| 266 | + item.F_TotalPrice ?? (item.pxjg * (item.F_ProjectNumber ?? 1)), | |
| 232 | 267 | }; |
| 233 | 268 | allMxEntities.Add(lqHytkMxEntity); |
| 234 | - | |
| 269 | + | |
| 235 | 270 | // 收集该品项关联的健康师业绩 |
| 236 | 271 | if (item.lqHytkJksyjList != null && item.lqHytkJksyjList.Any()) |
| 237 | 272 | { |
| 238 | 273 | foreach (var ijks_tem in item.lqHytkJksyjList) |
| 239 | 274 | { |
| 240 | - allJksyjEntities.Add(new LqHytkJksyjEntity | |
| 241 | - { | |
| 242 | - Id = YitIdHelper.NextId().ToString(), | |
| 243 | - Gltkbh = newEntity.Id, | |
| 244 | - Jks = ijks_tem.jks, | |
| 245 | - Jksxm = ijks_tem.jksxm, | |
| 246 | - Jkszh = ijks_tem.jkszh, | |
| 247 | - Jksyj = ijks_tem.jksyj, | |
| 248 | - Tksj = DateTime.Now, | |
| 249 | - F_jsjid = ijks_tem.F_jsjid, | |
| 250 | - F_tkpxid = ijks_tem.F_tkpxid, | |
| 251 | - F_LaborCost = ijks_tem.F_LaborCost, | |
| 252 | - F_tkpxNumber = ijks_tem.F_tkpxNumber, | |
| 253 | - F_CreateTime = DateTime.Now, | |
| 254 | - F_CreateUser = userInfo.userId, | |
| 255 | - F_DeleteMark = 0, | |
| 256 | - }); | |
| 275 | + allJksyjEntities.Add( | |
| 276 | + new LqHytkJksyjEntity | |
| 277 | + { | |
| 278 | + Id = YitIdHelper.NextId().ToString(), | |
| 279 | + Gltkbh = newEntity.Id, | |
| 280 | + Jks = ijks_tem.jks, | |
| 281 | + Jksxm = ijks_tem.jksxm, | |
| 282 | + Jkszh = ijks_tem.jkszh, | |
| 283 | + Jksyj = ijks_tem.jksyj, | |
| 284 | + Tksj = DateTime.Now, | |
| 285 | + F_jsjid = ijks_tem.F_jsjid, | |
| 286 | + F_tkpxid = ijks_tem.F_tkpxid, | |
| 287 | + F_LaborCost = ijks_tem.F_LaborCost, | |
| 288 | + F_tkpxNumber = ijks_tem.F_tkpxNumber, | |
| 289 | + F_CreateTime = DateTime.Now, | |
| 290 | + F_CreateUser = userInfo.userId, | |
| 291 | + F_DeleteMark = 0, | |
| 292 | + } | |
| 293 | + ); | |
| 257 | 294 | } |
| 258 | 295 | } |
| 259 | - | |
| 296 | + | |
| 260 | 297 | // 收集该品项关联的科技部老师业绩 |
| 261 | 298 | if (item.lqHytkKjbsyjList != null && item.lqHytkKjbsyjList.Any()) |
| 262 | 299 | { |
| 263 | 300 | foreach (var ikjbs_tem in item.lqHytkKjbsyjList) |
| 264 | 301 | { |
| 265 | - allKjbsyjEntities.Add(new LqHytkKjbsyjEntity | |
| 266 | - { | |
| 267 | - Id = YitIdHelper.NextId().ToString(), | |
| 268 | - Gltkbh = newEntity.Id, | |
| 269 | - Kjbls = ikjbs_tem.kjbls, | |
| 270 | - Kjblsxm = ikjbs_tem.kjblsxm, | |
| 271 | - Kjblszh = ikjbs_tem.kjblszh, | |
| 272 | - Kjblsyj = ikjbs_tem.kjblsyj, | |
| 273 | - Tksj = DateTime.Now, | |
| 274 | - F_tkpxid = ikjbs_tem.F_tkpxid, | |
| 275 | - F_LaborCost = ikjbs_tem.F_LaborCost, | |
| 276 | - F_tkpxNumber = ikjbs_tem.F_tkpxNumber, | |
| 277 | - F_CreateTime = DateTime.Now, | |
| 278 | - F_CreateUser = userInfo.userId, | |
| 279 | - F_DeleteMark = 0, | |
| 280 | - }); | |
| 302 | + allKjbsyjEntities.Add( | |
| 303 | + new LqHytkKjbsyjEntity | |
| 304 | + { | |
| 305 | + Id = YitIdHelper.NextId().ToString(), | |
| 306 | + Gltkbh = newEntity.Id, | |
| 307 | + Kjbls = ikjbs_tem.kjbls, | |
| 308 | + Kjblsxm = ikjbs_tem.kjblsxm, | |
| 309 | + Kjblszh = ikjbs_tem.kjblszh, | |
| 310 | + Kjblsyj = ikjbs_tem.kjblsyj, | |
| 311 | + Tksj = DateTime.Now, | |
| 312 | + F_tkpxid = ikjbs_tem.F_tkpxid, | |
| 313 | + F_LaborCost = ikjbs_tem.F_LaborCost, | |
| 314 | + F_tkpxNumber = ikjbs_tem.F_tkpxNumber, | |
| 315 | + F_CreateTime = DateTime.Now, | |
| 316 | + F_CreateUser = userInfo.userId, | |
| 317 | + F_DeleteMark = 0, | |
| 318 | + } | |
| 319 | + ); | |
| 281 | 320 | } |
| 282 | 321 | } |
| 283 | 322 | } |
| 284 | 323 | } |
| 285 | - | |
| 324 | + | |
| 286 | 325 | // 批量插入品项明细 |
| 287 | 326 | if (allMxEntities.Any()) |
| 288 | 327 | { |
| 289 | 328 | await _db.Insertable(allMxEntities).ExecuteCommandAsync(); |
| 290 | 329 | } |
| 291 | - | |
| 330 | + | |
| 292 | 331 | // 批量插入健康师业绩 |
| 293 | 332 | if (allJksyjEntities.Any()) |
| 294 | 333 | { |
| 295 | 334 | await _db.Insertable(allJksyjEntities).ExecuteCommandAsync(); |
| 296 | 335 | } |
| 297 | - | |
| 336 | + | |
| 298 | 337 | // 批量插入科技部老师业绩 |
| 299 | 338 | if (allKjbsyjEntities.Any()) |
| 300 | 339 | { |
| 301 | 340 | await _db.Insertable(allKjbsyjEntities).ExecuteCommandAsync(); |
| 302 | 341 | } |
| 303 | - | |
| 342 | + | |
| 304 | 343 | // 关闭事务 |
| 305 | 344 | _db.CommitTran(); |
| 306 | 345 | } |
| ... | ... | @@ -332,25 +371,31 @@ namespace NCC.Extend.LqHytkHytk |
| 332 | 371 | entity.Id = id; |
| 333 | 372 | entity.F_ModifyTime = DateTime.Now; |
| 334 | 373 | entity.F_ModifyUser = userInfo.userId; |
| 335 | - | |
| 374 | + | |
| 336 | 375 | try |
| 337 | 376 | { |
| 338 | 377 | // 开启事务 |
| 339 | 378 | _db.BeginTran(); |
| 340 | - | |
| 379 | + | |
| 341 | 380 | // 更新退卡主表记录 |
| 342 | 381 | await _db.Updateable(entity).IgnoreColumns(true).ExecuteCommandAsync(); |
| 343 | - | |
| 382 | + | |
| 344 | 383 | // 删除原有的关联数据 |
| 345 | - await _db.Deleteable<LqHytkMxEntity>().Where(x => x.Gltkbh == id).ExecuteCommandAsync(); | |
| 346 | - await _db.Deleteable<LqHytkJksyjEntity>().Where(x => x.Gltkbh == id).ExecuteCommandAsync(); | |
| 347 | - await _db.Deleteable<LqHytkKjbsyjEntity>().Where(x => x.Gltkbh == id).ExecuteCommandAsync(); | |
| 348 | - | |
| 384 | + await _db.Deleteable<LqHytkMxEntity>() | |
| 385 | + .Where(x => x.Gltkbh == id) | |
| 386 | + .ExecuteCommandAsync(); | |
| 387 | + await _db.Deleteable<LqHytkJksyjEntity>() | |
| 388 | + .Where(x => x.Gltkbh == id) | |
| 389 | + .ExecuteCommandAsync(); | |
| 390 | + await _db.Deleteable<LqHytkKjbsyjEntity>() | |
| 391 | + .Where(x => x.Gltkbh == id) | |
| 392 | + .ExecuteCommandAsync(); | |
| 393 | + | |
| 349 | 394 | // 收集所有需要插入的实体,然后批量插入 |
| 350 | 395 | var allMxEntities = new List<LqHytkMxEntity>(); |
| 351 | 396 | var allJksyjEntities = new List<LqHytkJksyjEntity>(); |
| 352 | 397 | var allKjbsyjEntities = new List<LqHytkKjbsyjEntity>(); |
| 353 | - | |
| 398 | + | |
| 354 | 399 | // 处理品项明细列表 |
| 355 | 400 | if (input.lqHytkMxList != null && input.lqHytkMxList.Any()) |
| 356 | 401 | { |
| ... | ... | @@ -371,79 +416,82 @@ namespace NCC.Extend.LqHytkHytk |
| 371 | 416 | F_ProjectNumber = item.F_ProjectNumber ?? 1, |
| 372 | 417 | F_IsEnabled = item.F_IsEnabled ?? 1, |
| 373 | 418 | F_SourceType = item.F_SourceType, |
| 374 | - F_TotalPrice = item.F_TotalPrice ?? (item.pxjg * (item.F_ProjectNumber ?? 1)), | |
| 419 | + F_TotalPrice = | |
| 420 | + item.F_TotalPrice ?? (item.pxjg * (item.F_ProjectNumber ?? 1)), | |
| 375 | 421 | }; |
| 376 | 422 | allMxEntities.Add(lqHytkMxEntity); |
| 377 | - | |
| 423 | + | |
| 378 | 424 | // 收集该品项关联的健康师业绩 |
| 379 | 425 | if (item.lqHytkJksyjList != null && item.lqHytkJksyjList.Any()) |
| 380 | 426 | { |
| 381 | 427 | foreach (var ijks_tem in item.lqHytkJksyjList) |
| 382 | 428 | { |
| 383 | - allJksyjEntities.Add(new LqHytkJksyjEntity | |
| 384 | - { | |
| 385 | - Id = YitIdHelper.NextId().ToString(), | |
| 386 | - Gltkbh = id, | |
| 387 | - Jks = ijks_tem.jks, | |
| 388 | - Jksxm = ijks_tem.jksxm, | |
| 389 | - Jkszh = ijks_tem.jkszh, | |
| 390 | - Jksyj = ijks_tem.jksyj, | |
| 391 | - Tksj = DateTime.Now, | |
| 392 | - F_jsjid = ijks_tem.F_jsjid, | |
| 393 | - F_tkpxid = ijks_tem.F_tkpxid, | |
| 394 | - F_LaborCost = ijks_tem.F_LaborCost, | |
| 395 | - F_tkpxNumber = ijks_tem.F_tkpxNumber, | |
| 396 | - F_CreateTime = DateTime.Now, | |
| 397 | - F_CreateUser = userInfo.userId, | |
| 398 | - F_DeleteMark = 0, | |
| 399 | - }); | |
| 429 | + allJksyjEntities.Add( | |
| 430 | + new LqHytkJksyjEntity | |
| 431 | + { | |
| 432 | + Id = YitIdHelper.NextId().ToString(), | |
| 433 | + Gltkbh = id, | |
| 434 | + Jks = ijks_tem.jks, | |
| 435 | + Jksxm = ijks_tem.jksxm, | |
| 436 | + Jkszh = ijks_tem.jkszh, | |
| 437 | + Jksyj = ijks_tem.jksyj, | |
| 438 | + Tksj = DateTime.Now, | |
| 439 | + F_jsjid = ijks_tem.F_jsjid, | |
| 440 | + F_tkpxid = ijks_tem.F_tkpxid, | |
| 441 | + F_LaborCost = ijks_tem.F_LaborCost, | |
| 442 | + F_tkpxNumber = ijks_tem.F_tkpxNumber, | |
| 443 | + F_CreateTime = DateTime.Now, | |
| 444 | + F_CreateUser = userInfo.userId, | |
| 445 | + F_DeleteMark = 0, | |
| 446 | + } | |
| 447 | + ); | |
| 400 | 448 | } |
| 401 | 449 | } |
| 402 | - | |
| 450 | + | |
| 403 | 451 | // 收集该品项关联的科技部老师业绩 |
| 404 | 452 | if (item.lqHytkKjbsyjList != null && item.lqHytkKjbsyjList.Any()) |
| 405 | 453 | { |
| 406 | 454 | foreach (var ikjbs_tem in item.lqHytkKjbsyjList) |
| 407 | 455 | { |
| 408 | - allKjbsyjEntities.Add(new LqHytkKjbsyjEntity | |
| 409 | - { | |
| 410 | - Id = YitIdHelper.NextId().ToString(), | |
| 411 | - Gltkbh = id, | |
| 412 | - Kjbls = ikjbs_tem.kjbls, | |
| 413 | - Kjblsxm = ikjbs_tem.kjblsxm, | |
| 414 | - Kjblszh = ikjbs_tem.kjblszh, | |
| 415 | - Kjblsyj = ikjbs_tem.kjblsyj, | |
| 416 | - Tksj = DateTime.Now, | |
| 417 | - F_tkpxid = ikjbs_tem.F_tkpxid, | |
| 418 | - F_LaborCost = ikjbs_tem.F_LaborCost, | |
| 419 | - F_tkpxNumber = ikjbs_tem.F_tkpxNumber, | |
| 420 | - F_CreateTime = DateTime.Now, | |
| 421 | - F_CreateUser = userInfo.userId, | |
| 422 | - F_DeleteMark = 0, | |
| 423 | - }); | |
| 456 | + allKjbsyjEntities.Add( | |
| 457 | + new LqHytkKjbsyjEntity | |
| 458 | + { | |
| 459 | + Id = YitIdHelper.NextId().ToString(), | |
| 460 | + Gltkbh = id, | |
| 461 | + Kjbls = ikjbs_tem.kjbls, | |
| 462 | + Kjblsxm = ikjbs_tem.kjblsxm, | |
| 463 | + Kjblszh = ikjbs_tem.kjblszh, | |
| 464 | + Kjblsyj = ikjbs_tem.kjblsyj, | |
| 465 | + Tksj = DateTime.Now, | |
| 466 | + F_tkpxid = ikjbs_tem.F_tkpxid, | |
| 467 | + F_LaborCost = ikjbs_tem.F_LaborCost, | |
| 468 | + F_tkpxNumber = ikjbs_tem.F_tkpxNumber, | |
| 469 | + F_CreateTime = DateTime.Now, | |
| 470 | + F_CreateUser = userInfo.userId, | |
| 471 | + F_DeleteMark = 0, | |
| 472 | + } | |
| 473 | + ); | |
| 424 | 474 | } |
| 425 | 475 | } |
| 426 | 476 | } |
| 427 | 477 | } |
| 428 | - | |
| 478 | + | |
| 429 | 479 | // 批量插入品项明细 |
| 430 | 480 | if (allMxEntities.Any()) |
| 431 | 481 | { |
| 432 | 482 | await _db.Insertable(allMxEntities).ExecuteCommandAsync(); |
| 433 | 483 | } |
| 434 | - | |
| 484 | + | |
| 435 | 485 | // 批量插入健康师业绩 |
| 436 | 486 | if (allJksyjEntities.Any()) |
| 437 | 487 | { |
| 438 | 488 | await _db.Insertable(allJksyjEntities).ExecuteCommandAsync(); |
| 439 | 489 | } |
| 440 | - | |
| 441 | 490 | // 批量插入科技部老师业绩 |
| 442 | 491 | if (allKjbsyjEntities.Any()) |
| 443 | 492 | { |
| 444 | 493 | await _db.Insertable(allKjbsyjEntities).ExecuteCommandAsync(); |
| 445 | 494 | } |
| 446 | - | |
| 447 | 495 | // 关闭事务 |
| 448 | 496 | _db.CommitTran(); |
| 449 | 497 | } |
| ... | ... | @@ -476,7 +524,7 @@ namespace NCC.Extend.LqHytkHytk |
| 476 | 524 | /// <remarks> |
| 477 | 525 | /// 获取退卡记录及其关联的品项明细、健康师业绩、科技部老师业绩信息 |
| 478 | 526 | /// 按照退卡的完整格式返回数据,不包含汇总信息 |
| 479 | - /// | |
| 527 | + /// | |
| 480 | 528 | /// 返回数据结构: |
| 481 | 529 | /// - 主表信息:退卡基础信息、门店信息、会员信息、退卡金额等 |
| 482 | 530 | /// - 品项明细列表:每个品项包含完整的项目信息(项目次数、是否有效、来源类型等) |
| ... | ... | @@ -532,7 +580,7 @@ namespace NCC.Extend.LqHytkHytk |
| 532 | 580 | F_ProjectNumber = mx.F_ProjectNumber, |
| 533 | 581 | F_IsEnabled = mx.F_IsEnabled, |
| 534 | 582 | F_SourceType = mx.F_SourceType, |
| 535 | - F_TotalPrice = mx.F_TotalPrice | |
| 583 | + F_TotalPrice = mx.F_TotalPrice, | |
| 536 | 584 | }; |
| 537 | 585 | |
| 538 | 586 | // 关联该品项的健康师业绩 | ... | ... |
netcore/src/Modularity/Extend/NCC.Extend/LqJlmxbService.cs
netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs
| 1 | -using NCC.Common.Core.Manager; | |
| 1 | +using System; | |
| 2 | +using System.Collections.Generic; | |
| 3 | +using System.Linq; | |
| 4 | +using System.Net.Http; | |
| 5 | +using System.Threading.Tasks; | |
| 6 | +using Mapster; | |
| 7 | +using Microsoft.AspNetCore.Mvc; | |
| 8 | +using NCC.ClayObject; | |
| 9 | +using NCC.Common.Configuration; | |
| 10 | +using NCC.Common.Core.Manager; | |
| 2 | 11 | using NCC.Common.Enum; |
| 3 | 12 | using NCC.Common.Extension; |
| 4 | 13 | using NCC.Common.Filter; |
| 14 | +using NCC.Common.Helper; | |
| 15 | +using NCC.Common.Model.NPOI; | |
| 16 | +using NCC.DataEncryption; | |
| 5 | 17 | using NCC.Dependency; |
| 6 | 18 | using NCC.DynamicApiController; |
| 7 | -using NCC.FriendlyException; | |
| 8 | -using NCC.Extend.Interfaces.LqKdKdjlb; | |
| 9 | -using Mapster; | |
| 10 | -using Microsoft.AspNetCore.Mvc; | |
| 11 | -using SqlSugar; | |
| 12 | -using System; | |
| 13 | -using System.Collections.Generic; | |
| 14 | -using System.Linq; | |
| 15 | -using System.Threading.Tasks; | |
| 16 | -using NCC.Extend.Entitys.lq_kd_kdjlb; | |
| 19 | +using NCC.Extend.Entitys.Dto.LqKdKdjlb; | |
| 20 | +using NCC.Extend.Entitys.lq_jinsanjiao_user; | |
| 17 | 21 | using NCC.Extend.Entitys.lq_kd_jksyj; |
| 22 | +using NCC.Extend.Entitys.lq_kd_kdjlb; | |
| 18 | 23 | using NCC.Extend.Entitys.lq_kd_kjbsyj; |
| 19 | 24 | using NCC.Extend.Entitys.lq_kd_pxmx; |
| 20 | -using NCC.Extend.Entitys.Dto.LqKdKdjlb; | |
| 21 | -using Yitter.IdGenerator; | |
| 22 | -using NCC.Common.Helper; | |
| 23 | -using NCC.JsonSerialization; | |
| 24 | -using NCC.Common.Model.NPOI; | |
| 25 | -using NCC.Common.Configuration; | |
| 26 | -using NCC.DataEncryption; | |
| 27 | -using NCC.ClayObject; | |
| 25 | +using NCC.Extend.Entitys.lq_xmzl; | |
| 26 | +using NCC.Extend.Interfaces.LqKdKdjlb; | |
| 28 | 27 | using NCC.Extend.Utils; |
| 29 | -using System.Net.Http; | |
| 30 | -using NCC.Extend.Entitys.lq_jinsanjiao_user; | |
| 28 | +using NCC.FriendlyException; | |
| 29 | +using NCC.JsonSerialization; | |
| 31 | 30 | using NCC.System.Entitys.Permission; |
| 32 | -using NCC.Extend.Entitys.lq_xmzl; | |
| 31 | +using SqlSugar; | |
| 32 | +using Yitter.IdGenerator; | |
| 33 | 33 | |
| 34 | 34 | namespace NCC.Extend.LqKdKdjlb |
| 35 | 35 | { |
| ... | ... | @@ -59,7 +59,8 @@ namespace NCC.Extend.LqKdKdjlb |
| 59 | 59 | ISqlSugarRepository<LqKdPxmxEntity> lqKdPxmxRepository, |
| 60 | 60 | IUserManager userManager, |
| 61 | 61 | WeChatBotService weChatBotService, |
| 62 | - LqKdKdjlbStringGenerator stringGenerator) | |
| 62 | + LqKdKdjlbStringGenerator stringGenerator | |
| 63 | + ) | |
| 63 | 64 | { |
| 64 | 65 | _lqKdKdjlbRepository = lqKdKdjlbRepository; |
| 65 | 66 | _db = _lqKdKdjlbRepository.Context; |
| ... | ... | @@ -70,6 +71,7 @@ namespace NCC.Extend.LqKdKdjlb |
| 70 | 71 | _weChatBotService = weChatBotService; |
| 71 | 72 | _stringGenerator = stringGenerator; |
| 72 | 73 | } |
| 74 | + | |
| 73 | 75 | #region 获取开单记录表 |
| 74 | 76 | /// <summary> |
| 75 | 77 | /// 获取开单记录表 |
| ... | ... | @@ -77,7 +79,7 @@ namespace NCC.Extend.LqKdKdjlb |
| 77 | 79 | /// <remarks> |
| 78 | 80 | /// 获取开单记录及其关联的品项明细、健康师业绩、科技部老师业绩信息 |
| 79 | 81 | /// 按照开单的完整格式返回数据,不包含汇总信息 |
| 80 | - /// | |
| 82 | + /// | |
| 81 | 83 | /// 返回数据结构: |
| 82 | 84 | /// - 主表信息:开单基础信息、业绩信息、支付信息、会员信息等 |
| 83 | 85 | /// - 品项明细列表:每个品项包含完整的项目信息(项目次数、是否有效、来源类型等) |
| ... | ... | @@ -134,7 +136,7 @@ namespace NCC.Extend.LqKdKdjlb |
| 134 | 136 | sourceType = pxmx.SourceType, |
| 135 | 137 | memberId = pxmx.MemberId, |
| 136 | 138 | createTime = pxmx.CreateTIme, |
| 137 | - totalPrice = pxmx.TotalPrice | |
| 139 | + totalPrice = pxmx.TotalPrice, | |
| 138 | 140 | }; |
| 139 | 141 | |
| 140 | 142 | // 关联该品项的健康师业绩 |
| ... | ... | @@ -166,24 +168,50 @@ namespace NCC.Extend.LqKdKdjlb |
| 166 | 168 | #endregion |
| 167 | 169 | |
| 168 | 170 | #region 获取开单记录表列表 |
| 171 | + | |
| 169 | 172 | /// <summary> |
| 170 | - /// 获取开单记录表列表 | |
| 171 | - /// </summary> | |
| 172 | - /// <param name="input">请求参数</param> | |
| 173 | - /// <returns></returns> | |
| 173 | + /// 获取开单记录表列表 | |
| 174 | + /// </summary> | |
| 175 | + /// <param name="input">请求参数</param> | |
| 176 | + /// <returns></returns> | |
| 174 | 177 | [HttpGet("")] |
| 175 | 178 | public async Task<dynamic> GetList([FromQuery] LqKdKdjlbListQueryInput input) |
| 176 | 179 | { |
| 177 | 180 | var sidx = input.sidx == null ? "id" : input.sidx; |
| 178 | - List<string> queryKdrq = input.kdrq != null ? input.kdrq.Split(',').ToObeject<List<string>>() : null; | |
| 181 | + List<string> queryKdrq = | |
| 182 | + input.kdrq != null ? input.kdrq.Split(',').ToObeject<List<string>>() : null; | |
| 179 | 183 | DateTime? startKdrq = queryKdrq != null ? Ext.GetDateTime(queryKdrq.First()) : null; |
| 180 | 184 | DateTime? endKdrq = queryKdrq != null ? Ext.GetDateTime(queryKdrq.Last()) : null; |
| 181 | 185 | var data = await _db.Queryable<LqKdKdjlbEntity>() |
| 182 | 186 | .WhereIF(!string.IsNullOrEmpty(input.id), p => p.Id.Contains(input.id)) |
| 183 | 187 | .WhereIF(!string.IsNullOrEmpty(input.djmd), p => p.Djmd.Equals(input.djmd)) |
| 184 | 188 | .WhereIF(!string.IsNullOrEmpty(input.jsj), p => p.Jsj.Equals(input.jsj)) |
| 185 | - .WhereIF(queryKdrq != null, p => p.Kdrq >= new DateTime(startKdrq.ToDate().Year, startKdrq.ToDate().Month, startKdrq.ToDate().Day, 0, 0, 0)) | |
| 186 | - .WhereIF(queryKdrq != null, p => p.Kdrq <= new DateTime(endKdrq.ToDate().Year, endKdrq.ToDate().Month, endKdrq.ToDate().Day, 23, 59, 59)) | |
| 189 | + .WhereIF( | |
| 190 | + queryKdrq != null, | |
| 191 | + p => | |
| 192 | + p.Kdrq | |
| 193 | + >= new DateTime( | |
| 194 | + startKdrq.ToDate().Year, | |
| 195 | + startKdrq.ToDate().Month, | |
| 196 | + startKdrq.ToDate().Day, | |
| 197 | + 0, | |
| 198 | + 0, | |
| 199 | + 0 | |
| 200 | + ) | |
| 201 | + ) | |
| 202 | + .WhereIF( | |
| 203 | + queryKdrq != null, | |
| 204 | + p => | |
| 205 | + p.Kdrq | |
| 206 | + <= new DateTime( | |
| 207 | + endKdrq.ToDate().Year, | |
| 208 | + endKdrq.ToDate().Month, | |
| 209 | + endKdrq.ToDate().Day, | |
| 210 | + 23, | |
| 211 | + 59, | |
| 212 | + 59 | |
| 213 | + ) | |
| 214 | + ) | |
| 187 | 215 | .WhereIF(!string.IsNullOrEmpty(input.gjlx), p => p.Gjlx.Equals(input.gjlx)) |
| 188 | 216 | .WhereIF(!string.IsNullOrEmpty(input.hgjg), p => p.Hgjg.Equals(input.hgjg)) |
| 189 | 217 | .WhereIF(!string.IsNullOrEmpty(input.zdyj), p => p.Zdyj.Equals(input.zdyj)) |
| ... | ... | @@ -201,11 +229,20 @@ namespace NCC.Extend.LqKdKdjlb |
| 201 | 229 | .WhereIF(!string.IsNullOrEmpty(input.bz), p => p.Bz.Contains(input.bz)) |
| 202 | 230 | .WhereIF(!string.IsNullOrEmpty(input.kdhy), p => p.Kdhy.Equals(input.kdhy)) |
| 203 | 231 | .WhereIF(!string.IsNullOrEmpty(input.kdhyc), p => p.Kdhyc.Contains(input.kdhyc)) |
| 204 | - .WhereIF(!string.IsNullOrEmpty(input.kdhysjh), p => p.Kdhysjh.Contains(input.kdhysjh)) | |
| 232 | + .WhereIF( | |
| 233 | + !string.IsNullOrEmpty(input.kdhysjh), | |
| 234 | + p => p.Kdhysjh.Contains(input.kdhysjh) | |
| 235 | + ) | |
| 205 | 236 | .WhereIF(!string.IsNullOrEmpty(input.jksyj), p => p.Jksyj.Contains(input.jksyj)) |
| 206 | - .WhereIF(!string.IsNullOrEmpty(input.kjblsyj), p => p.Kjblsyj.Contains(input.kjblsyj)) | |
| 237 | + .WhereIF( | |
| 238 | + !string.IsNullOrEmpty(input.kjblsyj), | |
| 239 | + p => p.Kjblsyj.Contains(input.kjblsyj) | |
| 240 | + ) | |
| 207 | 241 | .WhereIF(!string.IsNullOrEmpty(input.pxxx), p => p.Pxxx.Contains(input.pxxx)) |
| 208 | - .WhereIF(!string.IsNullOrEmpty(input.F_FIleUrl), p => p.F_FIleUrl.Contains(input.F_FIleUrl)) | |
| 242 | + .WhereIF( | |
| 243 | + !string.IsNullOrEmpty(input.F_FIleUrl), | |
| 244 | + p => p.F_FIleUrl.Contains(input.F_FIleUrl) | |
| 245 | + ) | |
| 209 | 246 | .Select(it => new LqKdKdjlbListOutput |
| 210 | 247 | { |
| 211 | 248 | id = it.Id, |
| ... | ... | @@ -234,7 +271,10 @@ namespace NCC.Extend.LqKdKdjlb |
| 234 | 271 | kjblsyj = it.Kjblsyj, |
| 235 | 272 | pxxx = it.Pxxx, |
| 236 | 273 | F_FIleUrl = it.F_FIleUrl, |
| 237 | - }).MergeTable().OrderBy(sidx + " " + input.sort).ToPagedListAsync(input.currentPage, input.pageSize); | |
| 274 | + }) | |
| 275 | + .MergeTable() | |
| 276 | + .OrderBy(sidx + " " + input.sort) | |
| 277 | + .ToPagedListAsync(input.currentPage, input.pageSize); | |
| 238 | 278 | return PageResult<LqKdKdjlbListOutput>.SqlSugarPageResult(data); |
| 239 | 279 | } |
| 240 | 280 | #endregion |
| ... | ... | @@ -257,7 +297,9 @@ namespace NCC.Extend.LqKdKdjlb |
| 257 | 297 | _db.BeginTran(); |
| 258 | 298 | //新增开单记录表记录 |
| 259 | 299 | entity.CreateUser = userInfo.userId; |
| 260 | - var newEntity = await _db.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteReturnEntityAsync(); | |
| 300 | + var newEntity = await _db.Insertable(entity) | |
| 301 | + .IgnoreColumns(ignoreNullColumn: true) | |
| 302 | + .ExecuteReturnEntityAsync(); | |
| 261 | 303 | //循环品相信息 |
| 262 | 304 | // 收集所有需要插入的实体,然后批量插入 |
| 263 | 305 | var allPxmxEntities = new List<LqKdPxmxEntity>(); |
| ... | ... | @@ -283,43 +325,47 @@ namespace NCC.Extend.LqKdKdjlb |
| 283 | 325 | SourceType = item.sourceType, |
| 284 | 326 | }; |
| 285 | 327 | allPxmxEntities.Add(lqKdPxmxEntity); |
| 286 | - | |
| 328 | + | |
| 287 | 329 | // 收集该品项关联的健康师业绩 |
| 288 | 330 | if (item.lqKdJksyjList != null && item.lqKdJksyjList.Any()) |
| 289 | 331 | { |
| 290 | 332 | foreach (var ijks_tem in item.lqKdJksyjList) |
| 291 | 333 | { |
| 292 | - allJksyjEntities.Add(new LqKdJksyjEntity | |
| 293 | - { | |
| 294 | - Id = YitIdHelper.NextId().ToString(), | |
| 295 | - Glkdbh = newEntity.Id, | |
| 296 | - Jks = ijks_tem.jks, | |
| 297 | - Jksxm = ijks_tem.jksxm, | |
| 298 | - Jkszh = ijks_tem.jkszh, | |
| 299 | - Jksyj = ijks_tem.jksyj, | |
| 300 | - Yjsj = DateTime.Now, | |
| 301 | - Jsj_id = ijks_tem.jsj_id, | |
| 302 | - Kdpxid = lqKdPxmxEntity.Id, | |
| 303 | - }); | |
| 334 | + allJksyjEntities.Add( | |
| 335 | + new LqKdJksyjEntity | |
| 336 | + { | |
| 337 | + Id = YitIdHelper.NextId().ToString(), | |
| 338 | + Glkdbh = newEntity.Id, | |
| 339 | + Jks = ijks_tem.jks, | |
| 340 | + Jksxm = ijks_tem.jksxm, | |
| 341 | + Jkszh = ijks_tem.jkszh, | |
| 342 | + Jksyj = ijks_tem.jksyj, | |
| 343 | + Yjsj = DateTime.Now, | |
| 344 | + Jsj_id = ijks_tem.jsj_id, | |
| 345 | + Kdpxid = lqKdPxmxEntity.Id, | |
| 346 | + } | |
| 347 | + ); | |
| 304 | 348 | } |
| 305 | 349 | } |
| 306 | - | |
| 350 | + | |
| 307 | 351 | // 收集该品项关联的科技部老师业绩 |
| 308 | 352 | if (item.lqKdKjbsyjList != null && item.lqKdKjbsyjList.Any()) |
| 309 | 353 | { |
| 310 | 354 | foreach (var ikjbs_tem in item.lqKdKjbsyjList) |
| 311 | 355 | { |
| 312 | - allKjbsyjEntities.Add(new LqKdKjbsyjEntity | |
| 313 | - { | |
| 314 | - Id = YitIdHelper.NextId().ToString(), | |
| 315 | - Glkdbh = newEntity.Id, | |
| 316 | - Kjbls = ikjbs_tem.kjbls, | |
| 317 | - Kjblsxm = ikjbs_tem.kjblsxm, | |
| 318 | - Kjblszh = ikjbs_tem.kjblszh, | |
| 319 | - Kjblsyj = ikjbs_tem.kjblsyj, | |
| 320 | - Yjsj = DateTime.Now, | |
| 321 | - Kdpxid = lqKdPxmxEntity.Id, | |
| 322 | - }); | |
| 356 | + allKjbsyjEntities.Add( | |
| 357 | + new LqKdKjbsyjEntity | |
| 358 | + { | |
| 359 | + Id = YitIdHelper.NextId().ToString(), | |
| 360 | + Glkdbh = newEntity.Id, | |
| 361 | + Kjbls = ikjbs_tem.kjbls, | |
| 362 | + Kjblsxm = ikjbs_tem.kjblsxm, | |
| 363 | + Kjblszh = ikjbs_tem.kjblszh, | |
| 364 | + Kjblsyj = ikjbs_tem.kjblsyj, | |
| 365 | + Yjsj = DateTime.Now, | |
| 366 | + Kdpxid = lqKdPxmxEntity.Id, | |
| 367 | + } | |
| 368 | + ); | |
| 323 | 369 | } |
| 324 | 370 | } |
| 325 | 371 | } |
| ... | ... | @@ -348,14 +394,18 @@ namespace NCC.Extend.LqKdKdjlb |
| 348 | 394 | var entityInfo = await GetInfo(newEntity.Id); |
| 349 | 395 | if (entityInfo != null) |
| 350 | 396 | { |
| 351 | - var orderRecordString = _stringGenerator.GenerateOrderRecordString(entityInfo); | |
| 397 | + var orderRecordString = _stringGenerator.GenerateOrderRecordString( | |
| 398 | + entityInfo | |
| 399 | + ); | |
| 352 | 400 | Console.WriteLine("开单记录字符串生成成功:"); |
| 353 | 401 | Console.WriteLine(orderRecordString); |
| 354 | 402 | |
| 355 | 403 | // 发送到企业微信群 |
| 356 | 404 | try |
| 357 | 405 | { |
| 358 | - var sendResult = await _weChatBotService.SendOrderRecordMessage(orderRecordString); | |
| 406 | + var sendResult = await _weChatBotService.SendOrderRecordMessage( | |
| 407 | + orderRecordString | |
| 408 | + ); | |
| 359 | 409 | if (sendResult) |
| 360 | 410 | { |
| 361 | 411 | Console.WriteLine("开单记录已成功发送到企业微信群"); |
| ... | ... | @@ -390,23 +440,48 @@ namespace NCC.Extend.LqKdKdjlb |
| 390 | 440 | |
| 391 | 441 | #region 获取开单记录表无分页列表 |
| 392 | 442 | /// <summary> |
| 393 | - /// 获取开单记录表无分页列表 | |
| 394 | - /// </summary> | |
| 395 | - /// <param name="input">请求参数</param> | |
| 396 | - /// <returns></returns> | |
| 443 | + /// 获取开单记录表无分页列表 | |
| 444 | + /// </summary> | |
| 445 | + /// <param name="input">请求参数</param> | |
| 446 | + /// <returns></returns> | |
| 397 | 447 | [NonAction] |
| 398 | 448 | public async Task<dynamic> GetNoPagingList([FromQuery] LqKdKdjlbListQueryInput input) |
| 399 | 449 | { |
| 400 | 450 | var sidx = input.sidx == null ? "id" : input.sidx; |
| 401 | - List<string> queryKdrq = input.kdrq != null ? input.kdrq.Split(',').ToObeject<List<string>>() : null; | |
| 451 | + List<string> queryKdrq = | |
| 452 | + input.kdrq != null ? input.kdrq.Split(',').ToObeject<List<string>>() : null; | |
| 402 | 453 | DateTime? startKdrq = queryKdrq != null ? Ext.GetDateTime(queryKdrq.First()) : null; |
| 403 | 454 | DateTime? endKdrq = queryKdrq != null ? Ext.GetDateTime(queryKdrq.Last()) : null; |
| 404 | 455 | var data = await _db.Queryable<LqKdKdjlbEntity>() |
| 405 | 456 | .WhereIF(!string.IsNullOrEmpty(input.id), p => p.Id.Contains(input.id)) |
| 406 | 457 | .WhereIF(!string.IsNullOrEmpty(input.djmd), p => p.Djmd.Equals(input.djmd)) |
| 407 | 458 | .WhereIF(!string.IsNullOrEmpty(input.jsj), p => p.Jsj.Equals(input.jsj)) |
| 408 | - .WhereIF(queryKdrq != null, p => p.Kdrq >= new DateTime(startKdrq.ToDate().Year, startKdrq.ToDate().Month, startKdrq.ToDate().Day, 0, 0, 0)) | |
| 409 | - .WhereIF(queryKdrq != null, p => p.Kdrq <= new DateTime(endKdrq.ToDate().Year, endKdrq.ToDate().Month, endKdrq.ToDate().Day, 23, 59, 59)) | |
| 459 | + .WhereIF( | |
| 460 | + queryKdrq != null, | |
| 461 | + p => | |
| 462 | + p.Kdrq | |
| 463 | + >= new DateTime( | |
| 464 | + startKdrq.ToDate().Year, | |
| 465 | + startKdrq.ToDate().Month, | |
| 466 | + startKdrq.ToDate().Day, | |
| 467 | + 0, | |
| 468 | + 0, | |
| 469 | + 0 | |
| 470 | + ) | |
| 471 | + ) | |
| 472 | + .WhereIF( | |
| 473 | + queryKdrq != null, | |
| 474 | + p => | |
| 475 | + p.Kdrq | |
| 476 | + <= new DateTime( | |
| 477 | + endKdrq.ToDate().Year, | |
| 478 | + endKdrq.ToDate().Month, | |
| 479 | + endKdrq.ToDate().Day, | |
| 480 | + 23, | |
| 481 | + 59, | |
| 482 | + 59 | |
| 483 | + ) | |
| 484 | + ) | |
| 410 | 485 | .WhereIF(!string.IsNullOrEmpty(input.gjlx), p => p.Gjlx.Equals(input.gjlx)) |
| 411 | 486 | .WhereIF(!string.IsNullOrEmpty(input.hgjg), p => p.Hgjg.Equals(input.hgjg)) |
| 412 | 487 | .WhereIF(!string.IsNullOrEmpty(input.zdyj), p => p.Zdyj.Equals(input.zdyj)) |
| ... | ... | @@ -424,11 +499,20 @@ namespace NCC.Extend.LqKdKdjlb |
| 424 | 499 | .WhereIF(!string.IsNullOrEmpty(input.bz), p => p.Bz.Contains(input.bz)) |
| 425 | 500 | .WhereIF(!string.IsNullOrEmpty(input.kdhy), p => p.Kdhy.Equals(input.kdhy)) |
| 426 | 501 | .WhereIF(!string.IsNullOrEmpty(input.kdhyc), p => p.Kdhyc.Contains(input.kdhyc)) |
| 427 | - .WhereIF(!string.IsNullOrEmpty(input.kdhysjh), p => p.Kdhysjh.Contains(input.kdhysjh)) | |
| 502 | + .WhereIF( | |
| 503 | + !string.IsNullOrEmpty(input.kdhysjh), | |
| 504 | + p => p.Kdhysjh.Contains(input.kdhysjh) | |
| 505 | + ) | |
| 428 | 506 | .WhereIF(!string.IsNullOrEmpty(input.jksyj), p => p.Jksyj.Contains(input.jksyj)) |
| 429 | - .WhereIF(!string.IsNullOrEmpty(input.kjblsyj), p => p.Kjblsyj.Contains(input.kjblsyj)) | |
| 507 | + .WhereIF( | |
| 508 | + !string.IsNullOrEmpty(input.kjblsyj), | |
| 509 | + p => p.Kjblsyj.Contains(input.kjblsyj) | |
| 510 | + ) | |
| 430 | 511 | .WhereIF(!string.IsNullOrEmpty(input.pxxx), p => p.Pxxx.Contains(input.pxxx)) |
| 431 | - .WhereIF(!string.IsNullOrEmpty(input.F_FIleUrl), p => p.F_FIleUrl.Contains(input.F_FIleUrl)) | |
| 512 | + .WhereIF( | |
| 513 | + !string.IsNullOrEmpty(input.F_FIleUrl), | |
| 514 | + p => p.F_FIleUrl.Contains(input.F_FIleUrl) | |
| 515 | + ) | |
| 432 | 516 | .Select(it => new LqKdKdjlbListOutput |
| 433 | 517 | { |
| 434 | 518 | id = it.Id, |
| ... | ... | @@ -457,17 +541,20 @@ namespace NCC.Extend.LqKdKdjlb |
| 457 | 541 | kjblsyj = it.Kjblsyj, |
| 458 | 542 | pxxx = it.Pxxx, |
| 459 | 543 | F_FIleUrl = it.F_FIleUrl, |
| 460 | - }).MergeTable().OrderBy(sidx + " " + input.sort).ToListAsync(); | |
| 544 | + }) | |
| 545 | + .MergeTable() | |
| 546 | + .OrderBy(sidx + " " + input.sort) | |
| 547 | + .ToListAsync(); | |
| 461 | 548 | return data; |
| 462 | 549 | } |
| 463 | 550 | #endregion |
| 464 | 551 | |
| 465 | 552 | #region 导出开单记录表 |
| 466 | 553 | /// <summary> |
| 467 | - /// 导出开单记录表 | |
| 468 | - /// </summary> | |
| 469 | - /// <param name="input">请求参数</param> | |
| 470 | - /// <returns></returns> | |
| 554 | + /// 导出开单记录表 | |
| 555 | + /// </summary> | |
| 556 | + /// <param name="input">请求参数</param> | |
| 557 | + /// <returns></returns> | |
| 471 | 558 | [HttpGet("Actions/Export")] |
| 472 | 559 | public async Task<dynamic> Export([FromQuery] LqKdKdjlbListQueryInput input) |
| 473 | 560 | { |
| ... | ... | @@ -482,7 +569,8 @@ namespace NCC.Extend.LqKdKdjlb |
| 482 | 569 | { |
| 483 | 570 | exportData = await this.GetNoPagingList(input); |
| 484 | 571 | } |
| 485 | - List<ParamsModel> paramList = "[{\"value\":\"开单编号\",\"field\":\"id\"},{\"value\":\"开单会员\",\"field\":\"kdhy\"},{\"value\":\"开单会员名称\",\"field\":\"kdhyc\"},{\"value\":\"会员手机号\",\"field\":\"kdhysjh\"},{\"value\":\"单据门店\",\"field\":\"djmd\"},{\"value\":\"金三角\",\"field\":\"jsj\"},{\"value\":\"开单日期\",\"field\":\"kdrq\"},{\"value\":\"顾客类型\",\"field\":\"gjlx\"},{\"value\":\"合作机构\",\"field\":\"hgjg\"},{\"value\":\"整单业绩\",\"field\":\"zdyj\"},{\"value\":\"实付业绩\",\"field\":\"sfyj\"},{\"value\":\"欠款\",\"field\":\"qk\"},{\"value\":\"储扣方式\",\"field\":\"ckfs\"},{\"value\":\"储扣明细\",\"field\":\"ckmx\"},{\"value\":\"付款方式\",\"field\":\"fkfs\"},{\"value\":\"付款医院\",\"field\":\"fkyy\"},{\"value\":\"付款判断\",\"field\":\"fkpd\"},{\"value\":\"客户来源\",\"field\":\"khly\"},{\"value\":\"推荐人\",\"field\":\"tjr\"},{\"value\":\"是否首开订单\",\"field\":\"sfskdd\"},{\"value\":\"简介\",\"field\":\"jj\"},{\"value\":\"备注\",\"field\":\"bz\"},{\"value\":\"健康师业绩\",\"field\":\"jksyj\"},{\"value\":\"科技部老师业绩\",\"field\":\"kjblsyj\"},{\"value\":\"品项信息\",\"field\":\"pxxx\"},{\"value\":\"方案其他\",\"field\":\"F_FIleUrl\"},]".ToList<ParamsModel>(); | |
| 572 | + List<ParamsModel> paramList = | |
| 573 | + "[{\"value\":\"开单编号\",\"field\":\"id\"},{\"value\":\"开单会员\",\"field\":\"kdhy\"},{\"value\":\"开单会员名称\",\"field\":\"kdhyc\"},{\"value\":\"会员手机号\",\"field\":\"kdhysjh\"},{\"value\":\"单据门店\",\"field\":\"djmd\"},{\"value\":\"金三角\",\"field\":\"jsj\"},{\"value\":\"开单日期\",\"field\":\"kdrq\"},{\"value\":\"顾客类型\",\"field\":\"gjlx\"},{\"value\":\"合作机构\",\"field\":\"hgjg\"},{\"value\":\"整单业绩\",\"field\":\"zdyj\"},{\"value\":\"实付业绩\",\"field\":\"sfyj\"},{\"value\":\"欠款\",\"field\":\"qk\"},{\"value\":\"储扣方式\",\"field\":\"ckfs\"},{\"value\":\"储扣明细\",\"field\":\"ckmx\"},{\"value\":\"付款方式\",\"field\":\"fkfs\"},{\"value\":\"付款医院\",\"field\":\"fkyy\"},{\"value\":\"付款判断\",\"field\":\"fkpd\"},{\"value\":\"客户来源\",\"field\":\"khly\"},{\"value\":\"推荐人\",\"field\":\"tjr\"},{\"value\":\"是否首开订单\",\"field\":\"sfskdd\"},{\"value\":\"简介\",\"field\":\"jj\"},{\"value\":\"备注\",\"field\":\"bz\"},{\"value\":\"健康师业绩\",\"field\":\"jksyj\"},{\"value\":\"科技部老师业绩\",\"field\":\"kjblsyj\"},{\"value\":\"品项信息\",\"field\":\"pxxx\"},{\"value\":\"方案其他\",\"field\":\"F_FIleUrl\"},]".ToList<ParamsModel>(); | |
| 486 | 574 | ExcelConfig excelconfig = new ExcelConfig(); |
| 487 | 575 | excelconfig.FileName = "开单记录表.xls"; |
| 488 | 576 | excelconfig.HeadFont = "微软雅黑"; |
| ... | ... | @@ -495,7 +583,13 @@ namespace NCC.Extend.LqKdKdjlb |
| 495 | 583 | var isExist = paramList.Find(p => p.field == item); |
| 496 | 584 | if (isExist != null) |
| 497 | 585 | { |
| 498 | - excelconfig.ColumnModel.Add(new ExcelColumnModel() { Column = isExist.field, ExcelColumn = isExist.value }); | |
| 586 | + excelconfig.ColumnModel.Add( | |
| 587 | + new ExcelColumnModel() | |
| 588 | + { | |
| 589 | + Column = isExist.field, | |
| 590 | + ExcelColumn = isExist.value, | |
| 591 | + } | |
| 592 | + ); | |
| 499 | 593 | } |
| 500 | 594 | } |
| 501 | 595 | var addPath = FileVariable.TemporaryFilePath + excelconfig.FileName; |
| ... | ... | @@ -504,7 +598,7 @@ namespace NCC.Extend.LqKdKdjlb |
| 504 | 598 | var output = new |
| 505 | 599 | { |
| 506 | 600 | name = excelconfig.FileName, |
| 507 | - url = "/api/File/Download?encryption=" + DESCEncryption.Encrypt(fileName, "NCC") | |
| 601 | + url = "/api/File/Download?encryption=" + DESCEncryption.Encrypt(fileName, "NCC"), | |
| 508 | 602 | }; |
| 509 | 603 | return output; |
| 510 | 604 | } |
| ... | ... | @@ -527,16 +621,24 @@ namespace NCC.Extend.LqKdKdjlb |
| 527 | 621 | //开启事务 |
| 528 | 622 | _db.BeginTran(); |
| 529 | 623 | //批量删除开单记录表 |
| 530 | - await _db.Deleteable<LqKdKdjlbEntity>().In(d => d.Id, ids).ExecuteCommandAsync(); | |
| 624 | + await _db.Deleteable<LqKdKdjlbEntity>() | |
| 625 | + .In(d => d.Id, ids) | |
| 626 | + .ExecuteCommandAsync(); | |
| 531 | 627 | |
| 532 | 628 | //清空子表数据 |
| 533 | - await _db.Deleteable<LqKdJksyjEntity>().In(u => u.Glkdbh, ids).ExecuteCommandAsync(); | |
| 629 | + await _db.Deleteable<LqKdJksyjEntity>() | |
| 630 | + .In(u => u.Glkdbh, ids) | |
| 631 | + .ExecuteCommandAsync(); | |
| 534 | 632 | |
| 535 | 633 | //清空子表数据 |
| 536 | - await _db.Deleteable<LqKdKjbsyjEntity>().In(u => u.Glkdbh, ids).ExecuteCommandAsync(); | |
| 634 | + await _db.Deleteable<LqKdKjbsyjEntity>() | |
| 635 | + .In(u => u.Glkdbh, ids) | |
| 636 | + .ExecuteCommandAsync(); | |
| 537 | 637 | |
| 538 | 638 | //清空子表数据 |
| 539 | - await _db.Deleteable<LqKdPxmxEntity>().In(u => u.Glkdbh, ids).ExecuteCommandAsync(); | |
| 639 | + await _db.Deleteable<LqKdPxmxEntity>() | |
| 640 | + .In(u => u.Glkdbh, ids) | |
| 641 | + .ExecuteCommandAsync(); | |
| 540 | 642 | //关闭事务 |
| 541 | 643 | _db.CommitTran(); |
| 542 | 644 | } |
| ... | ... | @@ -556,7 +658,7 @@ namespace NCC.Extend.LqKdKdjlb |
| 556 | 658 | /// </summary> |
| 557 | 659 | /// <remarks> |
| 558 | 660 | /// 更新开单记录及其关联的品项明细、健康师业绩、科技部老师业绩信息 |
| 559 | - /// | |
| 661 | + /// | |
| 560 | 662 | /// 示例请求: |
| 561 | 663 | /// ```json |
| 562 | 664 | /// { |
| ... | ... | @@ -582,7 +684,7 @@ namespace NCC.Extend.LqKdKdjlb |
| 582 | 684 | /// ] |
| 583 | 685 | /// } |
| 584 | 686 | /// ``` |
| 585 | - /// | |
| 687 | + /// | |
| 586 | 688 | /// 参数说明: |
| 587 | 689 | /// - id: 开单记录主键ID |
| 588 | 690 | /// - input: 开单记录更新参数,包含品项明细和业绩信息 |
| ... | ... | @@ -603,12 +705,20 @@ namespace NCC.Extend.LqKdKdjlb |
| 603 | 705 | _db.BeginTran(); |
| 604 | 706 | |
| 605 | 707 | //更新开单记录表记录 |
| 606 | - await _db.Updateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); | |
| 708 | + await _db.Updateable(entity) | |
| 709 | + .IgnoreColumns(ignoreAllNullColumns: true) | |
| 710 | + .ExecuteCommandAsync(); | |
| 607 | 711 | |
| 608 | 712 | //清空原有数据 |
| 609 | - await _db.Deleteable<LqKdJksyjEntity>().Where(u => u.Glkdbh == id).ExecuteCommandAsync(); | |
| 610 | - await _db.Deleteable<LqKdKjbsyjEntity>().Where(u => u.Glkdbh == id).ExecuteCommandAsync(); | |
| 611 | - await _db.Deleteable<LqKdPxmxEntity>().Where(u => u.Glkdbh == id).ExecuteCommandAsync(); | |
| 713 | + await _db.Deleteable<LqKdJksyjEntity>() | |
| 714 | + .Where(u => u.Glkdbh == id) | |
| 715 | + .ExecuteCommandAsync(); | |
| 716 | + await _db.Deleteable<LqKdKjbsyjEntity>() | |
| 717 | + .Where(u => u.Glkdbh == id) | |
| 718 | + .ExecuteCommandAsync(); | |
| 719 | + await _db.Deleteable<LqKdPxmxEntity>() | |
| 720 | + .Where(u => u.Glkdbh == id) | |
| 721 | + .ExecuteCommandAsync(); | |
| 612 | 722 | |
| 613 | 723 | // 收集所有需要插入的实体,然后批量插入 |
| 614 | 724 | var allPxmxEntities = new List<LqKdPxmxEntity>(); |
| ... | ... | @@ -636,43 +746,47 @@ namespace NCC.Extend.LqKdKdjlb |
| 636 | 746 | SourceType = item.sourceType, |
| 637 | 747 | }; |
| 638 | 748 | allPxmxEntities.Add(lqKdPxmxEntity); |
| 639 | - | |
| 749 | + | |
| 640 | 750 | // 收集该品项关联的健康师业绩 |
| 641 | 751 | if (item.lqKdJksyjList != null && item.lqKdJksyjList.Any()) |
| 642 | 752 | { |
| 643 | 753 | foreach (var ijks_tem in item.lqKdJksyjList) |
| 644 | 754 | { |
| 645 | - allJksyjEntities.Add(new LqKdJksyjEntity | |
| 646 | - { | |
| 647 | - Id = YitIdHelper.NextId().ToString(), | |
| 648 | - Glkdbh = entity.Id, | |
| 649 | - Jks = ijks_tem.jks, | |
| 650 | - Jksxm = ijks_tem.jksxm, | |
| 651 | - Jkszh = ijks_tem.jkszh, | |
| 652 | - Jksyj = ijks_tem.jksyj, | |
| 653 | - Yjsj = DateTime.Now, | |
| 654 | - Jsj_id = ijks_tem.jsj_id, | |
| 655 | - Kdpxid = lqKdPxmxEntity.Id, | |
| 656 | - }); | |
| 755 | + allJksyjEntities.Add( | |
| 756 | + new LqKdJksyjEntity | |
| 757 | + { | |
| 758 | + Id = YitIdHelper.NextId().ToString(), | |
| 759 | + Glkdbh = entity.Id, | |
| 760 | + Jks = ijks_tem.jks, | |
| 761 | + Jksxm = ijks_tem.jksxm, | |
| 762 | + Jkszh = ijks_tem.jkszh, | |
| 763 | + Jksyj = ijks_tem.jksyj, | |
| 764 | + Yjsj = DateTime.Now, | |
| 765 | + Jsj_id = ijks_tem.jsj_id, | |
| 766 | + Kdpxid = lqKdPxmxEntity.Id, | |
| 767 | + } | |
| 768 | + ); | |
| 657 | 769 | } |
| 658 | 770 | } |
| 659 | - | |
| 771 | + | |
| 660 | 772 | // 收集该品项关联的科技部老师业绩 |
| 661 | 773 | if (item.lqKdKjbsyjList != null && item.lqKdKjbsyjList.Any()) |
| 662 | 774 | { |
| 663 | 775 | foreach (var ikjbs_tem in item.lqKdKjbsyjList) |
| 664 | 776 | { |
| 665 | - allKjbsyjEntities.Add(new LqKdKjbsyjEntity | |
| 666 | - { | |
| 667 | - Id = YitIdHelper.NextId().ToString(), | |
| 668 | - Glkdbh = entity.Id, | |
| 669 | - Kjbls = ikjbs_tem.kjbls, | |
| 670 | - Kjblsxm = ikjbs_tem.kjblsxm, | |
| 671 | - Kjblszh = ikjbs_tem.kjblszh, | |
| 672 | - Kjblsyj = ikjbs_tem.kjblsyj, | |
| 673 | - Yjsj = DateTime.Now, | |
| 674 | - Kdpxid = lqKdPxmxEntity.Id, | |
| 675 | - }); | |
| 777 | + allKjbsyjEntities.Add( | |
| 778 | + new LqKdKjbsyjEntity | |
| 779 | + { | |
| 780 | + Id = YitIdHelper.NextId().ToString(), | |
| 781 | + Glkdbh = entity.Id, | |
| 782 | + Kjbls = ikjbs_tem.kjbls, | |
| 783 | + Kjblsxm = ikjbs_tem.kjblsxm, | |
| 784 | + Kjblszh = ikjbs_tem.kjblszh, | |
| 785 | + Kjblsyj = ikjbs_tem.kjblsyj, | |
| 786 | + Yjsj = DateTime.Now, | |
| 787 | + Kdpxid = lqKdPxmxEntity.Id, | |
| 788 | + } | |
| 789 | + ); | |
| 676 | 790 | } |
| 677 | 791 | } |
| 678 | 792 | } |
| ... | ... | @@ -721,16 +835,24 @@ namespace NCC.Extend.LqKdKdjlb |
| 721 | 835 | _db.BeginTran(); |
| 722 | 836 | |
| 723 | 837 | //删除开单记录表记录 |
| 724 | - await _db.Deleteable<LqKdKdjlbEntity>().Where(d => d.Id == id).ExecuteCommandAsync(); | |
| 838 | + await _db.Deleteable<LqKdKdjlbEntity>() | |
| 839 | + .Where(d => d.Id == id) | |
| 840 | + .ExecuteCommandAsync(); | |
| 725 | 841 | |
| 726 | 842 | //清空子表数据 |
| 727 | - await _db.Deleteable<LqKdJksyjEntity>().Where(u => u.Glkdbh == id).ExecuteCommandAsync(); | |
| 843 | + await _db.Deleteable<LqKdJksyjEntity>() | |
| 844 | + .Where(u => u.Glkdbh == id) | |
| 845 | + .ExecuteCommandAsync(); | |
| 728 | 846 | |
| 729 | 847 | //清空子表数据 |
| 730 | - await _db.Deleteable<LqKdKjbsyjEntity>().Where(u => u.Glkdbh == id).ExecuteCommandAsync(); | |
| 848 | + await _db.Deleteable<LqKdKjbsyjEntity>() | |
| 849 | + .Where(u => u.Glkdbh == id) | |
| 850 | + .ExecuteCommandAsync(); | |
| 731 | 851 | |
| 732 | 852 | //清空子表数据 |
| 733 | - await _db.Deleteable<LqKdPxmxEntity>().Where(u => u.Glkdbh == id).ExecuteCommandAsync(); | |
| 853 | + await _db.Deleteable<LqKdPxmxEntity>() | |
| 854 | + .Where(u => u.Glkdbh == id) | |
| 855 | + .ExecuteCommandAsync(); | |
| 734 | 856 | |
| 735 | 857 | //关闭事务 |
| 736 | 858 | _db.CommitTran(); | ... | ... |
netcore/src/Modularity/Extend/NCC.Extend/LqLssjService.cs
| 1 | -using NCC.Common.Core.Manager; | |
| 1 | +using System; | |
| 2 | +using System.Collections.Generic; | |
| 3 | +using System.Linq; | |
| 4 | +using System.Threading.Tasks; | |
| 5 | +using Mapster; | |
| 6 | +using Microsoft.AspNetCore.Mvc; | |
| 7 | +using NCC.ClayObject; | |
| 8 | +using NCC.Common.Configuration; | |
| 9 | +using NCC.Common.Core.Manager; | |
| 2 | 10 | using NCC.Common.Enum; |
| 3 | 11 | using NCC.Common.Extension; |
| 4 | 12 | using NCC.Common.Filter; |
| 13 | +using NCC.Common.Helper; | |
| 14 | +using NCC.Common.Model.NPOI; | |
| 15 | +using NCC.DataEncryption; | |
| 5 | 16 | using NCC.Dependency; |
| 6 | 17 | using NCC.DynamicApiController; |
| 7 | -using NCC.FriendlyException; | |
| 18 | +using NCC.Extend.Entitys.Dto.LqLssj; | |
| 19 | +using NCC.Extend.Entitys.lq_lssj; | |
| 8 | 20 | using NCC.Extend.Interfaces.LqLssj; |
| 9 | -using Mapster; | |
| 10 | -using Microsoft.AspNetCore.Mvc; | |
| 21 | +using NCC.FriendlyException; | |
| 22 | +using NCC.JsonSerialization; | |
| 11 | 23 | using SqlSugar; |
| 12 | -using System; | |
| 13 | -using System.Collections.Generic; | |
| 14 | -using System.Linq; | |
| 15 | -using System.Threading.Tasks; | |
| 16 | -using NCC.Extend.Entitys.lq_lssj; | |
| 17 | -using NCC.Extend.Entitys.Dto.LqLssj; | |
| 18 | 24 | using Yitter.IdGenerator; |
| 19 | -using NCC.Common.Helper; | |
| 20 | -using NCC.JsonSerialization; | |
| 21 | -using NCC.Common.Model.NPOI; | |
| 22 | -using NCC.Common.Configuration; | |
| 23 | -using NCC.DataEncryption; | |
| 24 | -using NCC.ClayObject; | |
| 25 | 25 | |
| 26 | 26 | namespace NCC.Extend.LqLssj |
| 27 | 27 | { |
| 28 | 28 | /// <summary> |
| 29 | 29 | /// 历史数据服务 |
| 30 | 30 | /// </summary> |
| 31 | - [ApiDescriptionSettings(Tag = "Extend",Name = "LqLssj", Order = 200)] | |
| 31 | + [ApiDescriptionSettings(Tag = "Extend", Name = "LqLssj", Order = 200)] | |
| 32 | 32 | [Route("api/Extend/[controller]")] |
| 33 | 33 | public class LqLssjService : ILqLssjService, IDynamicApiController, ITransient |
| 34 | 34 | { |
| ... | ... | @@ -41,9 +41,10 @@ namespace NCC.Extend.LqLssj |
| 41 | 41 | /// </summary> |
| 42 | 42 | public LqLssjService( |
| 43 | 43 | ISqlSugarRepository<LqLssjEntity> lqLssjRepository, |
| 44 | - IUserManager userManager) | |
| 44 | + IUserManager userManager | |
| 45 | + ) | |
| 45 | 46 | { |
| 46 | - _lqLssjRepository = lqLssjRepository; | |
| 47 | + _lqLssjRepository = lqLssjRepository; | |
| 47 | 48 | _db = _lqLssjRepository.Context; |
| 48 | 49 | _userManager = userManager; |
| 49 | 50 | } |
| ... | ... | @@ -62,10 +63,10 @@ namespace NCC.Extend.LqLssj |
| 62 | 63 | } |
| 63 | 64 | |
| 64 | 65 | /// <summary> |
| 65 | - /// 获取历史数据列表 | |
| 66 | - /// </summary> | |
| 67 | - /// <param name="input">请求参数</param> | |
| 68 | - /// <returns></returns> | |
| 66 | + /// 获取历史数据列表 | |
| 67 | + /// </summary> | |
| 68 | + /// <param name="input">请求参数</param> | |
| 69 | + /// <returns></returns> | |
| 69 | 70 | [HttpGet("")] |
| 70 | 71 | public async Task<dynamic> GetList([FromQuery] LqLssjListQueryInput input) |
| 71 | 72 | { |
| ... | ... | @@ -81,20 +82,23 @@ namespace NCC.Extend.LqLssj |
| 81 | 82 | .WhereIF(!string.IsNullOrEmpty(input.rts), p => p.Rts.Equals(input.rts)) |
| 82 | 83 | .WhereIF(!string.IsNullOrEmpty(input.rcs), p => p.Rcs.Equals(input.rcs)) |
| 83 | 84 | .WhereIF(!string.IsNullOrEmpty(input.xms), p => p.Xms.Equals(input.xms)) |
| 84 | - .Select(it=> new LqLssjListOutput | |
| 85 | + .Select(it => new LqLssjListOutput | |
| 85 | 86 | { |
| 86 | 87 | id = it.Id, |
| 87 | - syb=it.Syb, | |
| 88 | - md=it.Md, | |
| 89 | - yf=it.Yf, | |
| 90 | - nf=it.Nf, | |
| 91 | - zyj=it.Zyj, | |
| 92 | - zxh=it.Zxh, | |
| 93 | - rts=it.Rts, | |
| 94 | - rcs=it.Rcs, | |
| 95 | - xms=it.Xms, | |
| 96 | - }).MergeTable().OrderBy(sidx+" "+input.sort).ToPagedListAsync(input.currentPage, input.pageSize); | |
| 97 | - return PageResult<LqLssjListOutput>.SqlSugarPageResult(data); | |
| 88 | + syb = it.Syb, | |
| 89 | + md = it.Md, | |
| 90 | + yf = it.Yf, | |
| 91 | + nf = it.Nf, | |
| 92 | + zyj = it.Zyj, | |
| 93 | + zxh = it.Zxh, | |
| 94 | + rts = it.Rts, | |
| 95 | + rcs = it.Rcs, | |
| 96 | + xms = it.Xms, | |
| 97 | + }) | |
| 98 | + .MergeTable() | |
| 99 | + .OrderBy(sidx + " " + input.sort) | |
| 100 | + .ToPagedListAsync(input.currentPage, input.pageSize); | |
| 101 | + return PageResult<LqLssjListOutput>.SqlSugarPageResult(data); | |
| 98 | 102 | } |
| 99 | 103 | |
| 100 | 104 | /// <summary> |
| ... | ... | @@ -108,15 +112,18 @@ namespace NCC.Extend.LqLssj |
| 108 | 112 | var userInfo = await _userManager.GetUserInfo(); |
| 109 | 113 | var entity = input.Adapt<LqLssjEntity>(); |
| 110 | 114 | entity.Id = YitIdHelper.NextId().ToString(); |
| 111 | - var isOk = await _db.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandAsync(); | |
| 112 | - if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1000); | |
| 115 | + var isOk = await _db.Insertable(entity) | |
| 116 | + .IgnoreColumns(ignoreNullColumn: true) | |
| 117 | + .ExecuteCommandAsync(); | |
| 118 | + if (!(isOk > 0)) | |
| 119 | + throw NCCException.Oh(ErrorCode.COM1000); | |
| 113 | 120 | } |
| 114 | 121 | |
| 115 | 122 | /// <summary> |
| 116 | - /// 获取历史数据无分页列表 | |
| 117 | - /// </summary> | |
| 118 | - /// <param name="input">请求参数</param> | |
| 119 | - /// <returns></returns> | |
| 123 | + /// 获取历史数据无分页列表 | |
| 124 | + /// </summary> | |
| 125 | + /// <param name="input">请求参数</param> | |
| 126 | + /// <returns></returns> | |
| 120 | 127 | [NonAction] |
| 121 | 128 | public async Task<dynamic> GetNoPagingList([FromQuery] LqLssjListQueryInput input) |
| 122 | 129 | { |
| ... | ... | @@ -132,27 +139,30 @@ namespace NCC.Extend.LqLssj |
| 132 | 139 | .WhereIF(!string.IsNullOrEmpty(input.rts), p => p.Rts.Equals(input.rts)) |
| 133 | 140 | .WhereIF(!string.IsNullOrEmpty(input.rcs), p => p.Rcs.Equals(input.rcs)) |
| 134 | 141 | .WhereIF(!string.IsNullOrEmpty(input.xms), p => p.Xms.Equals(input.xms)) |
| 135 | - .Select(it=> new LqLssjListOutput | |
| 142 | + .Select(it => new LqLssjListOutput | |
| 136 | 143 | { |
| 137 | 144 | id = it.Id, |
| 138 | - syb=it.Syb, | |
| 139 | - md=it.Md, | |
| 140 | - yf=it.Yf, | |
| 141 | - nf=it.Nf, | |
| 142 | - zyj=it.Zyj, | |
| 143 | - zxh=it.Zxh, | |
| 144 | - rts=it.Rts, | |
| 145 | - rcs=it.Rcs, | |
| 146 | - xms=it.Xms, | |
| 147 | - }).MergeTable().OrderBy(sidx+" "+input.sort).ToListAsync(); | |
| 148 | - return data; | |
| 145 | + syb = it.Syb, | |
| 146 | + md = it.Md, | |
| 147 | + yf = it.Yf, | |
| 148 | + nf = it.Nf, | |
| 149 | + zyj = it.Zyj, | |
| 150 | + zxh = it.Zxh, | |
| 151 | + rts = it.Rts, | |
| 152 | + rcs = it.Rcs, | |
| 153 | + xms = it.Xms, | |
| 154 | + }) | |
| 155 | + .MergeTable() | |
| 156 | + .OrderBy(sidx + " " + input.sort) | |
| 157 | + .ToListAsync(); | |
| 158 | + return data; | |
| 149 | 159 | } |
| 150 | 160 | |
| 151 | 161 | /// <summary> |
| 152 | - /// 导出历史数据 | |
| 153 | - /// </summary> | |
| 154 | - /// <param name="input">请求参数</param> | |
| 155 | - /// <returns></returns> | |
| 162 | + /// 导出历史数据 | |
| 163 | + /// </summary> | |
| 164 | + /// <param name="input">请求参数</param> | |
| 165 | + /// <returns></returns> | |
| 156 | 166 | [HttpGet("Actions/Export")] |
| 157 | 167 | public async Task<dynamic> Export([FromQuery] LqLssjListQueryInput input) |
| 158 | 168 | { |
| ... | ... | @@ -167,7 +177,8 @@ namespace NCC.Extend.LqLssj |
| 167 | 177 | { |
| 168 | 178 | exportData = await this.GetNoPagingList(input); |
| 169 | 179 | } |
| 170 | - List<ParamsModel> paramList = "[{\"value\":\"数据编号\",\"field\":\"id\"},{\"value\":\"事业部\",\"field\":\"syb\"},{\"value\":\"门店\",\"field\":\"md\"},{\"value\":\"月份\",\"field\":\"yf\"},{\"value\":\"年份\",\"field\":\"nf\"},{\"value\":\"总业绩\",\"field\":\"zyj\"},{\"value\":\"总消耗\",\"field\":\"zxh\"},{\"value\":\"人头数\",\"field\":\"rts\"},{\"value\":\"人次数\",\"field\":\"rcs\"},{\"value\":\"项目数\",\"field\":\"xms\"},]".ToList<ParamsModel>(); | |
| 180 | + List<ParamsModel> paramList = | |
| 181 | + "[{\"value\":\"数据编号\",\"field\":\"id\"},{\"value\":\"事业部\",\"field\":\"syb\"},{\"value\":\"门店\",\"field\":\"md\"},{\"value\":\"月份\",\"field\":\"yf\"},{\"value\":\"年份\",\"field\":\"nf\"},{\"value\":\"总业绩\",\"field\":\"zyj\"},{\"value\":\"总消耗\",\"field\":\"zxh\"},{\"value\":\"人头数\",\"field\":\"rts\"},{\"value\":\"人次数\",\"field\":\"rcs\"},{\"value\":\"项目数\",\"field\":\"xms\"},]".ToList<ParamsModel>(); | |
| 171 | 182 | ExcelConfig excelconfig = new ExcelConfig(); |
| 172 | 183 | excelconfig.FileName = "历史数据.xls"; |
| 173 | 184 | excelconfig.HeadFont = "微软雅黑"; |
| ... | ... | @@ -180,7 +191,13 @@ namespace NCC.Extend.LqLssj |
| 180 | 191 | var isExist = paramList.Find(p => p.field == item); |
| 181 | 192 | if (isExist != null) |
| 182 | 193 | { |
| 183 | - excelconfig.ColumnModel.Add(new ExcelColumnModel() { Column = isExist.field, ExcelColumn = isExist.value }); | |
| 194 | + excelconfig.ColumnModel.Add( | |
| 195 | + new ExcelColumnModel() | |
| 196 | + { | |
| 197 | + Column = isExist.field, | |
| 198 | + ExcelColumn = isExist.value, | |
| 199 | + } | |
| 200 | + ); | |
| 184 | 201 | } |
| 185 | 202 | } |
| 186 | 203 | var addPath = FileVariable.TemporaryFilePath + excelconfig.FileName; |
| ... | ... | @@ -189,7 +206,7 @@ namespace NCC.Extend.LqLssj |
| 189 | 206 | var output = new |
| 190 | 207 | { |
| 191 | 208 | name = excelconfig.FileName, |
| 192 | - url = "/api/File/Download?encryption=" + DESCEncryption.Encrypt(fileName, "NCC") | |
| 209 | + url = "/api/File/Download?encryption=" + DESCEncryption.Encrypt(fileName, "NCC"), | |
| 193 | 210 | }; |
| 194 | 211 | return output; |
| 195 | 212 | } |
| ... | ... | @@ -210,7 +227,7 @@ namespace NCC.Extend.LqLssj |
| 210 | 227 | //开启事务 |
| 211 | 228 | _db.BeginTran(); |
| 212 | 229 | //批量删除历史数据 |
| 213 | - await _db.Deleteable<LqLssjEntity>().In(d => d.Id,ids).ExecuteCommandAsync(); | |
| 230 | + await _db.Deleteable<LqLssjEntity>().In(d => d.Id, ids).ExecuteCommandAsync(); | |
| 214 | 231 | //关闭事务 |
| 215 | 232 | _db.CommitTran(); |
| 216 | 233 | } |
| ... | ... | @@ -233,8 +250,11 @@ namespace NCC.Extend.LqLssj |
| 233 | 250 | public async Task Update(string id, [FromBody] LqLssjUpInput input) |
| 234 | 251 | { |
| 235 | 252 | var entity = input.Adapt<LqLssjEntity>(); |
| 236 | - var isOk = await _db.Updateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); | |
| 237 | - if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1001); | |
| 253 | + var isOk = await _db.Updateable(entity) | |
| 254 | + .IgnoreColumns(ignoreAllNullColumns: true) | |
| 255 | + .ExecuteCommandAsync(); | |
| 256 | + if (!(isOk > 0)) | |
| 257 | + throw NCCException.Oh(ErrorCode.COM1001); | |
| 238 | 258 | } |
| 239 | 259 | |
| 240 | 260 | /// <summary> |
| ... | ... | @@ -246,8 +266,11 @@ namespace NCC.Extend.LqLssj |
| 246 | 266 | { |
| 247 | 267 | var entity = await _db.Queryable<LqLssjEntity>().FirstAsync(p => p.Id == id); |
| 248 | 268 | _ = entity ?? throw NCCException.Oh(ErrorCode.COM1005); |
| 249 | - var isOk = await _db.Deleteable<LqLssjEntity>().Where(d => d.Id == id).ExecuteCommandAsync(); | |
| 250 | - if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1002); | |
| 269 | + var isOk = await _db.Deleteable<LqLssjEntity>() | |
| 270 | + .Where(d => d.Id == id) | |
| 271 | + .ExecuteCommandAsync(); | |
| 272 | + if (!(isOk > 0)) | |
| 273 | + throw NCCException.Oh(ErrorCode.COM1002); | |
| 251 | 274 | } |
| 252 | 275 | } |
| 253 | 276 | } | ... | ... |
netcore/src/Modularity/Extend/NCC.Extend/LqMdXdbhsjService.cs
| 1 | +using System; | |
| 2 | +using System.Collections.Generic; | |
| 3 | +using System.Linq; | |
| 4 | +using System.Threading.Tasks; | |
| 5 | +using Mapster; | |
| 6 | +using Microsoft.AspNetCore.Mvc; | |
| 7 | +using NCC.ClayObject; | |
| 8 | +using NCC.Common.Configuration; | |
| 1 | 9 | using NCC.Common.Core.Manager; |
| 2 | 10 | using NCC.Common.Enum; |
| 3 | 11 | using NCC.Common.Extension; |
| 4 | 12 | using NCC.Common.Filter; |
| 13 | +using NCC.Common.Helper; | |
| 14 | +using NCC.Common.Model.NPOI; | |
| 15 | +using NCC.DataEncryption; | |
| 5 | 16 | using NCC.Dependency; |
| 6 | 17 | using NCC.DynamicApiController; |
| 7 | -using NCC.FriendlyException; | |
| 18 | +using NCC.Extend.Entitys.Dto.LqMdXdbhsj; | |
| 19 | +using NCC.Extend.Entitys.lq_md_xdbhsj; | |
| 8 | 20 | using NCC.Extend.Interfaces.LqMdXdbhsj; |
| 9 | -using Mapster; | |
| 10 | -using Microsoft.AspNetCore.Mvc; | |
| 21 | +using NCC.FriendlyException; | |
| 22 | +using NCC.JsonSerialization; | |
| 11 | 23 | using SqlSugar; |
| 12 | -using System; | |
| 13 | -using System.Collections.Generic; | |
| 14 | -using System.Linq; | |
| 15 | -using System.Threading.Tasks; | |
| 16 | -using NCC.Extend.Entitys.lq_md_xdbhsj; | |
| 17 | -using NCC.Extend.Entitys.Dto.LqMdXdbhsj; | |
| 18 | 24 | using Yitter.IdGenerator; |
| 19 | -using NCC.Common.Helper; | |
| 20 | -using NCC.JsonSerialization; | |
| 21 | -using NCC.Common.Model.NPOI; | |
| 22 | -using NCC.Common.Configuration; | |
| 23 | -using NCC.DataEncryption; | |
| 24 | -using NCC.ClayObject; | |
| 25 | 25 | |
| 26 | 26 | namespace NCC.Extend.LqMdXdbhsj |
| 27 | 27 | { |
| ... | ... | @@ -41,7 +41,8 @@ namespace NCC.Extend.LqMdXdbhsj |
| 41 | 41 | /// </summary> |
| 42 | 42 | public LqMdXdbhsjService( |
| 43 | 43 | ISqlSugarRepository<LqMdXdbhsjEntity> lqMdXdbhsjRepository, |
| 44 | - IUserManager userManager) | |
| 44 | + IUserManager userManager | |
| 45 | + ) | |
| 45 | 46 | { |
| 46 | 47 | _lqMdXdbhsjRepository = lqMdXdbhsjRepository; |
| 47 | 48 | _db = _lqMdXdbhsjRepository.Context; |
| ... | ... | @@ -83,8 +84,11 @@ namespace NCC.Extend.LqMdXdbhsj |
| 83 | 84 | bhjssj = it.Bhjssj, |
| 84 | 85 | sm = it.Sm, |
| 85 | 86 | cjsj = it.Cjsj, |
| 86 | - sfqy = it.Sfqy | |
| 87 | - }).MergeTable().OrderBy(sidx + " " + input.sort).ToPagedListAsync(input.currentPage, input.pageSize); | |
| 87 | + sfqy = it.Sfqy, | |
| 88 | + }) | |
| 89 | + .MergeTable() | |
| 90 | + .OrderBy(sidx + " " + input.sort) | |
| 91 | + .ToPagedListAsync(input.currentPage, input.pageSize); | |
| 88 | 92 | return PageResult<LqMdXdbhsjListOutput>.SqlSugarPageResult(data); |
| 89 | 93 | } |
| 90 | 94 | |
| ... | ... | @@ -100,28 +104,33 @@ namespace NCC.Extend.LqMdXdbhsj |
| 100 | 104 | var entity = input.Adapt<LqMdXdbhsjEntity>(); |
| 101 | 105 | entity.Id = YitIdHelper.NextId().ToString(); |
| 102 | 106 | entity.Cjsj = DateTime.Now; |
| 103 | - | |
| 107 | + | |
| 104 | 108 | // 验证时间逻辑 |
| 105 | 109 | if (entity.Bhkssj >= entity.Bhjssj) |
| 106 | 110 | { |
| 107 | 111 | throw NCCException.Oh(ErrorCode.COM1000, "保护开始时间必须早于保护结束时间"); |
| 108 | 112 | } |
| 109 | - | |
| 113 | + | |
| 110 | 114 | // 检查是否存在重叠的保护时间 |
| 111 | 115 | var exists = await _db.Queryable<LqMdXdbhsjEntity>() |
| 112 | 116 | .Where(p => p.Mdid == entity.Mdid && p.Sfqy == 1) |
| 113 | - .Where(p => (p.Bhkssj <= entity.Bhkssj && p.Bhjssj > entity.Bhkssj) || | |
| 114 | - (p.Bhkssj < entity.Bhjssj && p.Bhjssj >= entity.Bhjssj) || | |
| 115 | - (p.Bhkssj >= entity.Bhkssj && p.Bhjssj <= entity.Bhjssj)) | |
| 117 | + .Where(p => | |
| 118 | + (p.Bhkssj <= entity.Bhkssj && p.Bhjssj > entity.Bhkssj) | |
| 119 | + || (p.Bhkssj < entity.Bhjssj && p.Bhjssj >= entity.Bhjssj) | |
| 120 | + || (p.Bhkssj >= entity.Bhkssj && p.Bhjssj <= entity.Bhjssj) | |
| 121 | + ) | |
| 116 | 122 | .AnyAsync(); |
| 117 | - | |
| 123 | + | |
| 118 | 124 | if (exists) |
| 119 | 125 | { |
| 120 | 126 | throw NCCException.Oh(ErrorCode.COM1000, "该门店在指定时间段内已存在保护时间设置"); |
| 121 | 127 | } |
| 122 | - | |
| 123 | - var isOk = await _db.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandAsync(); | |
| 124 | - if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1000); | |
| 128 | + | |
| 129 | + var isOk = await _db.Insertable(entity) | |
| 130 | + .IgnoreColumns(ignoreNullColumn: true) | |
| 131 | + .ExecuteCommandAsync(); | |
| 132 | + if (!(isOk > 0)) | |
| 133 | + throw NCCException.Oh(ErrorCode.COM1000); | |
| 125 | 134 | } |
| 126 | 135 | |
| 127 | 136 | /// <summary> |
| ... | ... | @@ -135,28 +144,33 @@ namespace NCC.Extend.LqMdXdbhsj |
| 135 | 144 | { |
| 136 | 145 | var entity = input.Adapt<LqMdXdbhsjEntity>(); |
| 137 | 146 | entity.Id = id; |
| 138 | - | |
| 147 | + | |
| 139 | 148 | // 验证时间逻辑 |
| 140 | 149 | if (entity.Bhkssj >= entity.Bhjssj) |
| 141 | 150 | { |
| 142 | 151 | throw NCCException.Oh(ErrorCode.COM1000, "保护开始时间必须早于保护结束时间"); |
| 143 | 152 | } |
| 144 | - | |
| 153 | + | |
| 145 | 154 | // 检查是否存在重叠的保护时间(排除当前记录) |
| 146 | 155 | var exists = await _db.Queryable<LqMdXdbhsjEntity>() |
| 147 | 156 | .Where(p => p.Mdid == entity.Mdid && p.Sfqy == 1 && p.Id != id) |
| 148 | - .Where(p => (p.Bhkssj <= entity.Bhkssj && p.Bhjssj > entity.Bhkssj) || | |
| 149 | - (p.Bhkssj < entity.Bhjssj && p.Bhjssj >= entity.Bhjssj) || | |
| 150 | - (p.Bhkssj >= entity.Bhkssj && p.Bhjssj <= entity.Bhjssj)) | |
| 157 | + .Where(p => | |
| 158 | + (p.Bhkssj <= entity.Bhkssj && p.Bhjssj > entity.Bhkssj) | |
| 159 | + || (p.Bhkssj < entity.Bhjssj && p.Bhjssj >= entity.Bhjssj) | |
| 160 | + || (p.Bhkssj >= entity.Bhkssj && p.Bhjssj <= entity.Bhjssj) | |
| 161 | + ) | |
| 151 | 162 | .AnyAsync(); |
| 152 | - | |
| 163 | + | |
| 153 | 164 | if (exists) |
| 154 | 165 | { |
| 155 | 166 | throw NCCException.Oh(ErrorCode.COM1000, "该门店在指定时间段内已存在保护时间设置"); |
| 156 | 167 | } |
| 157 | - | |
| 158 | - var isOk = await _db.Updateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); | |
| 159 | - if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1001); | |
| 168 | + | |
| 169 | + var isOk = await _db.Updateable(entity) | |
| 170 | + .IgnoreColumns(ignoreAllNullColumns: true) | |
| 171 | + .ExecuteCommandAsync(); | |
| 172 | + if (!(isOk > 0)) | |
| 173 | + throw NCCException.Oh(ErrorCode.COM1001); | |
| 160 | 174 | } |
| 161 | 175 | |
| 162 | 176 | /// <summary> |
| ... | ... | @@ -168,8 +182,11 @@ namespace NCC.Extend.LqMdXdbhsj |
| 168 | 182 | { |
| 169 | 183 | var entity = await _db.Queryable<LqMdXdbhsjEntity>().FirstAsync(p => p.Id == id); |
| 170 | 184 | _ = entity ?? throw NCCException.Oh(ErrorCode.COM1005); |
| 171 | - var isOk = await _db.Deleteable<LqMdXdbhsjEntity>().Where(d => d.Id == id).ExecuteCommandAsync(); | |
| 172 | - if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1002); | |
| 185 | + var isOk = await _db.Deleteable<LqMdXdbhsjEntity>() | |
| 186 | + .Where(d => d.Id == id) | |
| 187 | + .ExecuteCommandAsync(); | |
| 188 | + if (!(isOk > 0)) | |
| 189 | + throw NCCException.Oh(ErrorCode.COM1002); | |
| 173 | 190 | } |
| 174 | 191 | |
| 175 | 192 | /// <summary> |
| ... | ... | @@ -181,7 +198,12 @@ namespace NCC.Extend.LqMdXdbhsj |
| 181 | 198 | { |
| 182 | 199 | var list = await _db.Queryable<LqMdXdbhsjEntity>() |
| 183 | 200 | .Where(p => p.Sfqy == 1) |
| 184 | - .Select(it => new { id = it.Id, fullName = it.Mdid, enCode = it.Id }) | |
| 201 | + .Select(it => new | |
| 202 | + { | |
| 203 | + id = it.Id, | |
| 204 | + fullName = it.Mdid, | |
| 205 | + enCode = it.Id, | |
| 206 | + }) | |
| 185 | 207 | .ToListAsync(); |
| 186 | 208 | return new { list = list }; |
| 187 | 209 | } |
| ... | ... | @@ -199,12 +221,12 @@ namespace NCC.Extend.LqMdXdbhsj |
| 199 | 221 | .Where(p => p.Mdid == mdid && p.Sfqy == 1) |
| 200 | 222 | .Where(p => p.Bhkssj <= now && p.Bhjssj >= now) |
| 201 | 223 | .FirstAsync(); |
| 202 | - | |
| 224 | + | |
| 203 | 225 | if (entity == null) |
| 204 | 226 | { |
| 205 | 227 | return new { hasProtection = false, message = "该门店当前无保护时间设置" }; |
| 206 | 228 | } |
| 207 | - | |
| 229 | + | |
| 208 | 230 | var output = entity.Adapt<LqMdXdbhsjInfoOutput>(); |
| 209 | 231 | return new { hasProtection = true, data = output }; |
| 210 | 232 | } | ... | ... |
netcore/src/Modularity/Extend/NCC.Extend/LqSkzhService.cs
| 1 | -using NCC.Common.Core.Manager; | |
| 1 | +using System; | |
| 2 | +using System.Collections.Generic; | |
| 3 | +using System.Linq; | |
| 4 | +using System.Threading.Tasks; | |
| 5 | +using Mapster; | |
| 6 | +using Microsoft.AspNetCore.Mvc; | |
| 7 | +using NCC.ClayObject; | |
| 8 | +using NCC.Common.Configuration; | |
| 9 | +using NCC.Common.Core.Manager; | |
| 2 | 10 | using NCC.Common.Enum; |
| 3 | 11 | using NCC.Common.Extension; |
| 4 | 12 | using NCC.Common.Filter; |
| 13 | +using NCC.Common.Helper; | |
| 14 | +using NCC.Common.Model.NPOI; | |
| 15 | +using NCC.DataEncryption; | |
| 5 | 16 | using NCC.Dependency; |
| 6 | 17 | using NCC.DynamicApiController; |
| 7 | -using NCC.FriendlyException; | |
| 18 | +using NCC.Extend.Entitys.Dto.LqSkzh; | |
| 19 | +using NCC.Extend.Entitys.lq_skzh; | |
| 8 | 20 | using NCC.Extend.Interfaces.LqSkzh; |
| 9 | -using Mapster; | |
| 10 | -using Microsoft.AspNetCore.Mvc; | |
| 21 | +using NCC.FriendlyException; | |
| 22 | +using NCC.JsonSerialization; | |
| 11 | 23 | using SqlSugar; |
| 12 | -using System; | |
| 13 | -using System.Collections.Generic; | |
| 14 | -using System.Linq; | |
| 15 | -using System.Threading.Tasks; | |
| 16 | -using NCC.Extend.Entitys.lq_skzh; | |
| 17 | -using NCC.Extend.Entitys.Dto.LqSkzh; | |
| 18 | 24 | using Yitter.IdGenerator; |
| 19 | -using NCC.Common.Helper; | |
| 20 | -using NCC.JsonSerialization; | |
| 21 | -using NCC.Common.Model.NPOI; | |
| 22 | -using NCC.Common.Configuration; | |
| 23 | -using NCC.DataEncryption; | |
| 24 | -using NCC.ClayObject; | |
| 25 | 25 | |
| 26 | 26 | namespace NCC.Extend.LqSkzh |
| 27 | 27 | { |
| 28 | 28 | /// <summary> |
| 29 | 29 | /// 收款账户服务 |
| 30 | 30 | /// </summary> |
| 31 | - [ApiDescriptionSettings(Tag = "Extend",Name = "LqSkzh", Order = 200)] | |
| 31 | + [ApiDescriptionSettings(Tag = "Extend", Name = "LqSkzh", Order = 200)] | |
| 32 | 32 | [Route("api/Extend/[controller]")] |
| 33 | 33 | public class LqSkzhService : ILqSkzhService, IDynamicApiController, ITransient |
| 34 | 34 | { |
| ... | ... | @@ -41,9 +41,10 @@ namespace NCC.Extend.LqSkzh |
| 41 | 41 | /// </summary> |
| 42 | 42 | public LqSkzhService( |
| 43 | 43 | ISqlSugarRepository<LqSkzhEntity> lqSkzhRepository, |
| 44 | - IUserManager userManager) | |
| 44 | + IUserManager userManager | |
| 45 | + ) | |
| 45 | 46 | { |
| 46 | - _lqSkzhRepository = lqSkzhRepository; | |
| 47 | + _lqSkzhRepository = lqSkzhRepository; | |
| 47 | 48 | _db = _lqSkzhRepository.Context; |
| 48 | 49 | _userManager = userManager; |
| 49 | 50 | } |
| ... | ... | @@ -62,10 +63,10 @@ namespace NCC.Extend.LqSkzh |
| 62 | 63 | } |
| 63 | 64 | |
| 64 | 65 | /// <summary> |
| 65 | - /// 获取收款账户列表 | |
| 66 | - /// </summary> | |
| 67 | - /// <param name="input">请求参数</param> | |
| 68 | - /// <returns></returns> | |
| 66 | + /// 获取收款账户列表 | |
| 67 | + /// </summary> | |
| 68 | + /// <param name="input">请求参数</param> | |
| 69 | + /// <returns></returns> | |
| 69 | 70 | [HttpGet("")] |
| 70 | 71 | public async Task<dynamic> GetList([FromQuery] LqSkzhListQueryInput input) |
| 71 | 72 | { |
| ... | ... | @@ -74,13 +75,16 @@ namespace NCC.Extend.LqSkzh |
| 74 | 75 | .WhereIF(!string.IsNullOrEmpty(input.id), p => p.Id.Contains(input.id)) |
| 75 | 76 | .WhereIF(!string.IsNullOrEmpty(input.sktj), p => p.Sktj.Contains(input.sktj)) |
| 76 | 77 | .WhereIF(!string.IsNullOrEmpty(input.skzh), p => p.Skzh.Contains(input.skzh)) |
| 77 | - .Select(it=> new LqSkzhListOutput | |
| 78 | + .Select(it => new LqSkzhListOutput | |
| 78 | 79 | { |
| 79 | 80 | id = it.Id, |
| 80 | - sktj=it.Sktj, | |
| 81 | - skzh=it.Skzh, | |
| 82 | - }).MergeTable().OrderBy(sidx+" "+input.sort).ToPagedListAsync(input.currentPage, input.pageSize); | |
| 83 | - return PageResult<LqSkzhListOutput>.SqlSugarPageResult(data); | |
| 81 | + sktj = it.Sktj, | |
| 82 | + skzh = it.Skzh, | |
| 83 | + }) | |
| 84 | + .MergeTable() | |
| 85 | + .OrderBy(sidx + " " + input.sort) | |
| 86 | + .ToPagedListAsync(input.currentPage, input.pageSize); | |
| 87 | + return PageResult<LqSkzhListOutput>.SqlSugarPageResult(data); | |
| 84 | 88 | } |
| 85 | 89 | |
| 86 | 90 | /// <summary> |
| ... | ... | @@ -94,15 +98,18 @@ namespace NCC.Extend.LqSkzh |
| 94 | 98 | var userInfo = await _userManager.GetUserInfo(); |
| 95 | 99 | var entity = input.Adapt<LqSkzhEntity>(); |
| 96 | 100 | entity.Id = YitIdHelper.NextId().ToString(); |
| 97 | - var isOk = await _db.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandAsync(); | |
| 98 | - if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1000); | |
| 101 | + var isOk = await _db.Insertable(entity) | |
| 102 | + .IgnoreColumns(ignoreNullColumn: true) | |
| 103 | + .ExecuteCommandAsync(); | |
| 104 | + if (!(isOk > 0)) | |
| 105 | + throw NCCException.Oh(ErrorCode.COM1000); | |
| 99 | 106 | } |
| 100 | 107 | |
| 101 | 108 | /// <summary> |
| 102 | - /// 获取收款账户无分页列表 | |
| 103 | - /// </summary> | |
| 104 | - /// <param name="input">请求参数</param> | |
| 105 | - /// <returns></returns> | |
| 109 | + /// 获取收款账户无分页列表 | |
| 110 | + /// </summary> | |
| 111 | + /// <param name="input">请求参数</param> | |
| 112 | + /// <returns></returns> | |
| 106 | 113 | [NonAction] |
| 107 | 114 | public async Task<dynamic> GetNoPagingList([FromQuery] LqSkzhListQueryInput input) |
| 108 | 115 | { |
| ... | ... | @@ -111,20 +118,23 @@ namespace NCC.Extend.LqSkzh |
| 111 | 118 | .WhereIF(!string.IsNullOrEmpty(input.id), p => p.Id.Contains(input.id)) |
| 112 | 119 | .WhereIF(!string.IsNullOrEmpty(input.sktj), p => p.Sktj.Contains(input.sktj)) |
| 113 | 120 | .WhereIF(!string.IsNullOrEmpty(input.skzh), p => p.Skzh.Contains(input.skzh)) |
| 114 | - .Select(it=> new LqSkzhListOutput | |
| 121 | + .Select(it => new LqSkzhListOutput | |
| 115 | 122 | { |
| 116 | 123 | id = it.Id, |
| 117 | - sktj=it.Sktj, | |
| 118 | - skzh=it.Skzh, | |
| 119 | - }).MergeTable().OrderBy(sidx+" "+input.sort).ToListAsync(); | |
| 120 | - return data; | |
| 124 | + sktj = it.Sktj, | |
| 125 | + skzh = it.Skzh, | |
| 126 | + }) | |
| 127 | + .MergeTable() | |
| 128 | + .OrderBy(sidx + " " + input.sort) | |
| 129 | + .ToListAsync(); | |
| 130 | + return data; | |
| 121 | 131 | } |
| 122 | 132 | |
| 123 | 133 | /// <summary> |
| 124 | - /// 导出收款账户 | |
| 125 | - /// </summary> | |
| 126 | - /// <param name="input">请求参数</param> | |
| 127 | - /// <returns></returns> | |
| 134 | + /// 导出收款账户 | |
| 135 | + /// </summary> | |
| 136 | + /// <param name="input">请求参数</param> | |
| 137 | + /// <returns></returns> | |
| 128 | 138 | [HttpGet("Actions/Export")] |
| 129 | 139 | public async Task<dynamic> Export([FromQuery] LqSkzhListQueryInput input) |
| 130 | 140 | { |
| ... | ... | @@ -139,7 +149,8 @@ namespace NCC.Extend.LqSkzh |
| 139 | 149 | { |
| 140 | 150 | exportData = await this.GetNoPagingList(input); |
| 141 | 151 | } |
| 142 | - List<ParamsModel> paramList = "[{\"value\":\"收款途径编号\",\"field\":\"id\"},{\"value\":\"收款途径\",\"field\":\"sktj\"},{\"value\":\"收款账号\",\"field\":\"skzh\"},]".ToList<ParamsModel>(); | |
| 152 | + List<ParamsModel> paramList = | |
| 153 | + "[{\"value\":\"收款途径编号\",\"field\":\"id\"},{\"value\":\"收款途径\",\"field\":\"sktj\"},{\"value\":\"收款账号\",\"field\":\"skzh\"},]".ToList<ParamsModel>(); | |
| 143 | 154 | ExcelConfig excelconfig = new ExcelConfig(); |
| 144 | 155 | excelconfig.FileName = "收款账户.xls"; |
| 145 | 156 | excelconfig.HeadFont = "微软雅黑"; |
| ... | ... | @@ -152,7 +163,13 @@ namespace NCC.Extend.LqSkzh |
| 152 | 163 | var isExist = paramList.Find(p => p.field == item); |
| 153 | 164 | if (isExist != null) |
| 154 | 165 | { |
| 155 | - excelconfig.ColumnModel.Add(new ExcelColumnModel() { Column = isExist.field, ExcelColumn = isExist.value }); | |
| 166 | + excelconfig.ColumnModel.Add( | |
| 167 | + new ExcelColumnModel() | |
| 168 | + { | |
| 169 | + Column = isExist.field, | |
| 170 | + ExcelColumn = isExist.value, | |
| 171 | + } | |
| 172 | + ); | |
| 156 | 173 | } |
| 157 | 174 | } |
| 158 | 175 | var addPath = FileVariable.TemporaryFilePath + excelconfig.FileName; |
| ... | ... | @@ -161,7 +178,7 @@ namespace NCC.Extend.LqSkzh |
| 161 | 178 | var output = new |
| 162 | 179 | { |
| 163 | 180 | name = excelconfig.FileName, |
| 164 | - url = "/api/File/Download?encryption=" + DESCEncryption.Encrypt(fileName, "NCC") | |
| 181 | + url = "/api/File/Download?encryption=" + DESCEncryption.Encrypt(fileName, "NCC"), | |
| 165 | 182 | }; |
| 166 | 183 | return output; |
| 167 | 184 | } |
| ... | ... | @@ -182,7 +199,7 @@ namespace NCC.Extend.LqSkzh |
| 182 | 199 | //开启事务 |
| 183 | 200 | _db.BeginTran(); |
| 184 | 201 | //批量删除收款账户 |
| 185 | - await _db.Deleteable<LqSkzhEntity>().In(d => d.Id,ids).ExecuteCommandAsync(); | |
| 202 | + await _db.Deleteable<LqSkzhEntity>().In(d => d.Id, ids).ExecuteCommandAsync(); | |
| 186 | 203 | //关闭事务 |
| 187 | 204 | _db.CommitTran(); |
| 188 | 205 | } |
| ... | ... | @@ -205,8 +222,11 @@ namespace NCC.Extend.LqSkzh |
| 205 | 222 | public async Task Update(string id, [FromBody] LqSkzhUpInput input) |
| 206 | 223 | { |
| 207 | 224 | var entity = input.Adapt<LqSkzhEntity>(); |
| 208 | - var isOk = await _db.Updateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); | |
| 209 | - if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1001); | |
| 225 | + var isOk = await _db.Updateable(entity) | |
| 226 | + .IgnoreColumns(ignoreAllNullColumns: true) | |
| 227 | + .ExecuteCommandAsync(); | |
| 228 | + if (!(isOk > 0)) | |
| 229 | + throw NCCException.Oh(ErrorCode.COM1001); | |
| 210 | 230 | } |
| 211 | 231 | |
| 212 | 232 | /// <summary> |
| ... | ... | @@ -218,8 +238,11 @@ namespace NCC.Extend.LqSkzh |
| 218 | 238 | { |
| 219 | 239 | var entity = await _db.Queryable<LqSkzhEntity>().FirstAsync(p => p.Id == id); |
| 220 | 240 | _ = entity ?? throw NCCException.Oh(ErrorCode.COM1005); |
| 221 | - var isOk = await _db.Deleteable<LqSkzhEntity>().Where(d => d.Id == id).ExecuteCommandAsync(); | |
| 222 | - if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1002); | |
| 241 | + var isOk = await _db.Deleteable<LqSkzhEntity>() | |
| 242 | + .Where(d => d.Id == id) | |
| 243 | + .ExecuteCommandAsync(); | |
| 244 | + if (!(isOk > 0)) | |
| 245 | + throw NCCException.Oh(ErrorCode.COM1002); | |
| 223 | 246 | } |
| 224 | 247 | } |
| 225 | 248 | } | ... | ... |
创建事业部业绩统计流水表视图.sql
0 → 100644
| 1 | +-- 创建事业部业绩统计流水表视图 | |
| 2 | +-- 统计各个事业部的目标业绩、完成业绩、完成率 | |
| 3 | + | |
| 4 | +DROP VIEW IF EXISTS `v_department_performance_flow`; | |
| 5 | + | |
| 6 | +CREATE VIEW `v_department_performance_flow` AS | |
| 7 | +SELECT | |
| 8 | + o.F_Id AS department_id, -- 部门ID | |
| 9 | + o.F_FullName AS department_name, -- 部门名称 | |
| 10 | + o.F_ParentId AS parent_id, -- 上级部门ID | |
| 11 | + parent.F_FullName AS parent_name, -- 上级部门名称 | |
| 12 | + o.F_Category AS department_category, -- 部门分类 | |
| 13 | + kd.F_Id AS order_id, -- 开单ID | |
| 14 | + kd.kdrq AS order_date, -- 开单时间 | |
| 15 | + kd.djmd AS store_id, -- 开单门店ID | |
| 16 | + m.mdbm AS store_code, -- 门店编号 | |
| 17 | + m.dm AS store_name, -- 门店名称 | |
| 18 | + m.xsyj AS target_amount, -- 目标业绩(门店生命线) | |
| 19 | + kd.zdyj AS completed_amount, -- 完成业绩(整单业绩) | |
| 20 | + kd.sfyj AS actual_amount, -- 实付业绩 | |
| 21 | + kd.qk AS debt_amount, -- 欠款 | |
| 22 | + kd.jsj AS golden_triangle, -- 金三角 | |
| 23 | + kd.kdhy AS member_id, -- 开单会员ID | |
| 24 | + kd.kdhyc AS member_name, -- 开单会员名称 | |
| 25 | + kd.kdhysjh AS member_phone, -- 开单会员手机号 | |
| 26 | + kd.gjlx AS customer_type, -- 顾客类型 | |
| 27 | + kd.hgjg AS partner_institution, -- 合作机构 | |
| 28 | + kd.fkfs AS payment_method, -- 付款方式 | |
| 29 | + kd.khly AS customer_source, -- 客户来源 | |
| 30 | + kd.tjr AS referrer, -- 推荐人 | |
| 31 | + kd.sfskdd AS is_first_order, -- 是否首开订单 | |
| 32 | + kd.jj AS description, -- 简介 | |
| 33 | + kd.bz AS remarks, -- 备注 | |
| 34 | + kd.F_CreateUser AS create_user, -- 开单用户 | |
| 35 | + kd.F_FIleUrl AS file_url, -- 方案其他 | |
| 36 | + -- 计算完成率 | |
| 37 | + CASE | |
| 38 | + WHEN m.xsyj > 0 THEN ROUND((kd.zdyj / m.xsyj) * 100, 2) | |
| 39 | + ELSE 0 | |
| 40 | + END AS completion_rate, -- 完成率(%) | |
| 41 | + -- 时间维度字段 | |
| 42 | + YEAR(kd.kdrq) AS order_year, -- 开单年份 | |
| 43 | + MONTH(kd.kdrq) AS order_month, -- 开单月份 | |
| 44 | + QUARTER(kd.kdrq) AS order_quarter, -- 开单季度 | |
| 45 | + DATE(kd.kdrq) AS order_date_only, -- 开单日期(不含时间) | |
| 46 | + -- 使用开单日期作为创建时间 | |
| 47 | + kd.kdrq AS create_time, -- 创建时间(使用开单日期) | |
| 48 | + kd.kdrq AS modify_time -- 修改时间(使用开单日期) | |
| 49 | +FROM base_organize o | |
| 50 | +LEFT JOIN base_organize parent ON o.F_ParentId = parent.F_Id | |
| 51 | +LEFT JOIN lq_mdxx m ON m.syb = o.F_Id | |
| 52 | +LEFT JOIN lq_kd_kdjlb kd ON kd.djmd = m.F_Id | |
| 53 | +WHERE (o.F_DeleteMark IS NULL OR o.F_DeleteMark != 1) | |
| 54 | + AND o.F_Category = 'department' -- 只统计部门类型 | |
| 55 | + AND kd.kdrq IS NOT NULL; -- 只包含有开单日期的记录 | |
| 56 | + | |
| 57 | +-- 添加视图注释 | |
| 58 | +ALTER VIEW `v_department_performance_flow` COMMENT = '事业部业绩统计流水表视图 - 统计各事业部目标业绩、完成业绩、完成率等详细信息'; | ... | ... |
参考资料/.DS_Store
No preview for this file type