Commit 505dccc3f2d2dd26ade9ec19044b26f5092a7d0a
1 parent
00486d53
优化代码格式,合并多行构造函数和方法调用,确保代码整洁性和可读性。
Showing
7 changed files
with
359 additions
and
256 deletions
.csharpierrc
0 → 100644
.vscode/settings.json
0 → 100644
| 1 | +{ | |
| 2 | + "editor.formatOnSave": true, | |
| 3 | + "editor.defaultFormatter": "csharpier.csharpier-vscode", | |
| 4 | + "csharpier.printWidth": 200, | |
| 5 | + "csharpier.tabWidth": 4, | |
| 6 | + "csharpier.useTabs": false, | |
| 7 | + "csharpier.endOfLine": "LF", | |
| 8 | + "[csharp]": { | |
| 9 | + "editor.formatOnSave": true, | |
| 10 | + "editor.defaultFormatter": "csharpier.csharpier-vscode" | |
| 11 | + } | |
| 12 | +} | ... | ... |
netcore/src/Modularity/Extend/NCC.Extend.Interfaces/ILqMdMdwyService.cs
netcore/src/Modularity/Extend/NCC.Extend/LqLssjService.cs
| ... | ... | @@ -39,10 +39,7 @@ namespace NCC.Extend.LqLssj |
| 39 | 39 | /// <summary> |
| 40 | 40 | /// 初始化一个<see cref="LqLssjService"/>类型的新实例 |
| 41 | 41 | /// </summary> |
| 42 | - public LqLssjService( | |
| 43 | - ISqlSugarRepository<LqLssjEntity> lqLssjRepository, | |
| 44 | - IUserManager userManager | |
| 45 | - ) | |
| 42 | + public LqLssjService(ISqlSugarRepository<LqLssjEntity> lqLssjRepository, IUserManager userManager) | |
| 46 | 43 | { |
| 47 | 44 | _lqLssjRepository = lqLssjRepository; |
| 48 | 45 | _db = _lqLssjRepository.Context; |
| ... | ... | @@ -112,9 +109,7 @@ namespace NCC.Extend.LqLssj |
| 112 | 109 | var userInfo = await _userManager.GetUserInfo(); |
| 113 | 110 | var entity = input.Adapt<LqLssjEntity>(); |
| 114 | 111 | entity.Id = YitIdHelper.NextId().ToString(); |
| 115 | - var isOk = await _db.Insertable(entity) | |
| 116 | - .IgnoreColumns(ignoreNullColumn: true) | |
| 117 | - .ExecuteCommandAsync(); | |
| 112 | + var isOk = await _db.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandAsync(); | |
| 118 | 113 | if (!(isOk > 0)) |
| 119 | 114 | throw NCCException.Oh(ErrorCode.COM1000); |
| 120 | 115 | } |
| ... | ... | @@ -192,11 +187,7 @@ namespace NCC.Extend.LqLssj |
| 192 | 187 | if (isExist != null) |
| 193 | 188 | { |
| 194 | 189 | excelconfig.ColumnModel.Add( |
| 195 | - new ExcelColumnModel() | |
| 196 | - { | |
| 197 | - Column = isExist.field, | |
| 198 | - ExcelColumn = isExist.value, | |
| 199 | - } | |
| 190 | + new ExcelColumnModel() { Column = isExist.field, ExcelColumn = isExist.value } | |
| 200 | 191 | ); |
| 201 | 192 | } |
| 202 | 193 | } |
| ... | ... | @@ -250,9 +241,7 @@ namespace NCC.Extend.LqLssj |
| 250 | 241 | public async Task Update(string id, [FromBody] LqLssjUpInput input) |
| 251 | 242 | { |
| 252 | 243 | var entity = input.Adapt<LqLssjEntity>(); |
| 253 | - var isOk = await _db.Updateable(entity) | |
| 254 | - .IgnoreColumns(ignoreAllNullColumns: true) | |
| 255 | - .ExecuteCommandAsync(); | |
| 244 | + var isOk = await _db.Updateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); | |
| 256 | 245 | if (!(isOk > 0)) |
| 257 | 246 | throw NCCException.Oh(ErrorCode.COM1001); |
| 258 | 247 | } |
| ... | ... | @@ -266,9 +255,7 @@ namespace NCC.Extend.LqLssj |
| 266 | 255 | { |
| 267 | 256 | var entity = await _db.Queryable<LqLssjEntity>().FirstAsync(p => p.Id == id); |
| 268 | 257 | _ = entity ?? throw NCCException.Oh(ErrorCode.COM1005); |
| 269 | - var isOk = await _db.Deleteable<LqLssjEntity>() | |
| 270 | - .Where(d => d.Id == id) | |
| 271 | - .ExecuteCommandAsync(); | |
| 258 | + var isOk = await _db.Deleteable<LqLssjEntity>().Where(d => d.Id == id).ExecuteCommandAsync(); | |
| 272 | 259 | if (!(isOk > 0)) |
| 273 | 260 | throw NCCException.Oh(ErrorCode.COM1002); |
| 274 | 261 | } | ... | ... |
netcore/src/Modularity/Extend/NCC.Extend/LqMdMdlbjhsxxService.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.LqMdMdlbjhsxx; | |
| 19 | +using NCC.Extend.Entitys.lq_md_mdlbjhsxx; | |
| 8 | 20 | using NCC.Extend.Interfaces.LqMdMdlbjhsxx; |
| 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_mdlbjhsxx; | |
| 17 | -using NCC.Extend.Entitys.Dto.LqMdMdlbjhsxx; | |
| 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.LqMdMdlbjhsxx |
| 27 | 27 | { |
| 28 | 28 | /// <summary> |
| 29 | 29 | /// 门店类别及核算信息服务 |
| 30 | 30 | /// </summary> |
| 31 | - [ApiDescriptionSettings(Tag = "Extend",Name = "LqMdMdlbjhsxx", Order = 200)] | |
| 31 | + [ApiDescriptionSettings(Tag = "Extend", Name = "LqMdMdlbjhsxx", Order = 200)] | |
| 32 | 32 | [Route("api/Extend/[controller]")] |
| 33 | 33 | public class LqMdMdlbjhsxxService : ILqMdMdlbjhsxxService, IDynamicApiController, ITransient |
| 34 | 34 | { |
| ... | ... | @@ -39,11 +39,9 @@ namespace NCC.Extend.LqMdMdlbjhsxx |
| 39 | 39 | /// <summary> |
| 40 | 40 | /// 初始化一个<see cref="LqMdMdlbjhsxxService"/>类型的新实例 |
| 41 | 41 | /// </summary> |
| 42 | - public LqMdMdlbjhsxxService( | |
| 43 | - ISqlSugarRepository<LqMdMdlbjhsxxEntity> lqMdMdlbjhsxxRepository, | |
| 44 | - IUserManager userManager) | |
| 42 | + public LqMdMdlbjhsxxService(ISqlSugarRepository<LqMdMdlbjhsxxEntity> lqMdMdlbjhsxxRepository, IUserManager userManager) | |
| 45 | 43 | { |
| 46 | - _lqMdMdlbjhsxxRepository = lqMdMdlbjhsxxRepository; | |
| 44 | + _lqMdMdlbjhsxxRepository = lqMdMdlbjhsxxRepository; | |
| 47 | 45 | _db = _lqMdMdlbjhsxxRepository.Context; |
| 48 | 46 | _userManager = userManager; |
| 49 | 47 | } |
| ... | ... | @@ -62,10 +60,10 @@ namespace NCC.Extend.LqMdMdlbjhsxx |
| 62 | 60 | } |
| 63 | 61 | |
| 64 | 62 | /// <summary> |
| 65 | - /// 获取门店类别及核算信息列表 | |
| 66 | - /// </summary> | |
| 67 | - /// <param name="input">请求参数</param> | |
| 68 | - /// <returns></returns> | |
| 63 | + /// 获取门店类别及核算信息列表 | |
| 64 | + /// </summary> | |
| 65 | + /// <param name="input">请求参数</param> | |
| 66 | + /// <returns></returns> | |
| 69 | 67 | [HttpGet("")] |
| 70 | 68 | public async Task<dynamic> GetList([FromQuery] LqMdMdlbjhsxxListQueryInput input) |
| 71 | 69 | { |
| ... | ... | @@ -94,43 +92,84 @@ namespace NCC.Extend.LqMdMdlbjhsxx |
| 94 | 92 | .WhereIF(!string.IsNullOrEmpty(input.md), p => p.Md.Equals(input.md)) |
| 95 | 93 | .WhereIF(!string.IsNullOrEmpty(input.dxmbls), p => p.Dxmbls.Equals(input.dxmbls)) |
| 96 | 94 | .WhereIF(!string.IsNullOrEmpty(input.dxmb), p => p.Dxmb.Equals(input.dxmb)) |
| 97 | - .WhereIF(queryKssj != null, p => p.Kssj >= new DateTime(startKssj.ToDate().Year, startKssj.ToDate().Month, startKssj.ToDate().Day, 0, 0, 0)) | |
| 98 | - .WhereIF(queryKssj != null, p => p.Kssj <= new DateTime(endKssj.ToDate().Year, endKssj.ToDate().Month, endKssj.ToDate().Day, 23, 59, 59)) | |
| 99 | - .WhereIF(queryJssj != null, p => p.Jssj >= new DateTime(startJssj.ToDate().Year, startJssj.ToDate().Month, startJssj.ToDate().Day, 0, 0, 0)) | |
| 100 | - .WhereIF(queryJssj != null, p => p.Jssj <= new DateTime(endJssj.ToDate().Year, endJssj.ToDate().Month, endJssj.ToDate().Day, 23, 59, 59)) | |
| 95 | + .WhereIF( | |
| 96 | + queryKssj != null, | |
| 97 | + p => p.Kssj >= new DateTime(startKssj.ToDate().Year, startKssj.ToDate().Month, startKssj.ToDate().Day, 0, 0, 0) | |
| 98 | + ) | |
| 99 | + .WhereIF( | |
| 100 | + queryKssj != null, | |
| 101 | + p => p.Kssj <= new DateTime(endKssj.ToDate().Year, endKssj.ToDate().Month, endKssj.ToDate().Day, 23, 59, 59) | |
| 102 | + ) | |
| 103 | + .WhereIF( | |
| 104 | + queryJssj != null, | |
| 105 | + p => p.Jssj >= new DateTime(startJssj.ToDate().Year, startJssj.ToDate().Month, startJssj.ToDate().Day, 0, 0, 0) | |
| 106 | + ) | |
| 107 | + .WhereIF( | |
| 108 | + queryJssj != null, | |
| 109 | + p => p.Jssj <= new DateTime(endJssj.ToDate().Year, endJssj.ToDate().Month, endJssj.ToDate().Day, 23, 59, 59) | |
| 110 | + ) | |
| 101 | 111 | .WhereIF(!string.IsNullOrEmpty(input.syb), p => p.Syb.Equals(input.syb)) |
| 102 | - .WhereIF(querySybssksrq != null, p => p.Sybssksrq >= new DateTime(startSybssksrq.ToDate().Year, startSybssksrq.ToDate().Month, startSybssksrq.ToDate().Day, 0, 0, 0)) | |
| 103 | - .WhereIF(querySybssksrq != null, p => p.Sybssksrq <= new DateTime(endSybssksrq.ToDate().Year, endSybssksrq.ToDate().Month, endSybssksrq.ToDate().Day, 23, 59, 59)) | |
| 104 | - .WhereIF(querySybsszzrq != null, p => p.Sybsszzrq >= new DateTime(startSybsszzrq.ToDate().Year, startSybsszzrq.ToDate().Month, startSybsszzrq.ToDate().Day, 0, 0, 0)) | |
| 105 | - .WhereIF(querySybsszzrq != null, p => p.Sybsszzrq <= new DateTime(endSybsszzrq.ToDate().Year, endSybsszzrq.ToDate().Month, endSybsszzrq.ToDate().Day, 23, 59, 59)) | |
| 112 | + .WhereIF( | |
| 113 | + querySybssksrq != null, | |
| 114 | + p => | |
| 115 | + p.Sybssksrq >= new DateTime(startSybssksrq.ToDate().Year, startSybssksrq.ToDate().Month, startSybssksrq.ToDate().Day, 0, 0, 0) | |
| 116 | + ) | |
| 117 | + .WhereIF( | |
| 118 | + querySybssksrq != null, | |
| 119 | + p => p.Sybssksrq <= new DateTime(endSybssksrq.ToDate().Year, endSybssksrq.ToDate().Month, endSybssksrq.ToDate().Day, 23, 59, 59) | |
| 120 | + ) | |
| 121 | + .WhereIF( | |
| 122 | + querySybsszzrq != null, | |
| 123 | + p => | |
| 124 | + p.Sybsszzrq >= new DateTime(startSybsszzrq.ToDate().Year, startSybsszzrq.ToDate().Month, startSybsszzrq.ToDate().Day, 0, 0, 0) | |
| 125 | + ) | |
| 126 | + .WhereIF( | |
| 127 | + querySybsszzrq != null, | |
| 128 | + p => p.Sybsszzrq <= new DateTime(endSybsszzrq.ToDate().Year, endSybsszzrq.ToDate().Month, endSybsszzrq.ToDate().Day, 23, 59, 59) | |
| 129 | + ) | |
| 106 | 130 | .WhereIF(!string.IsNullOrEmpty(input.mdlxLd), p => p.MdlxLd.Equals(input.mdlxLd)) |
| 107 | 131 | .WhereIF(!string.IsNullOrEmpty(input.mdzt), p => p.Mdzt.Equals(input.mdzt)) |
| 108 | 132 | .WhereIF(!string.IsNullOrEmpty(input.mdlxXd), p => p.MdlxXd.Equals(input.mdlxXd)) |
| 109 | - .WhereIF(queryXdssksrq != null, p => p.Xdssksrq >= new DateTime(startXdssksrq.ToDate().Year, startXdssksrq.ToDate().Month, startXdssksrq.ToDate().Day, 0, 0, 0)) | |
| 110 | - .WhereIF(queryXdssksrq != null, p => p.Xdssksrq <= new DateTime(endXdssksrq.ToDate().Year, endXdssksrq.ToDate().Month, endXdssksrq.ToDate().Day, 23, 59, 59)) | |
| 111 | - .WhereIF(queryXdsszzrq != null, p => p.Xdsszzrq >= new DateTime(startXdsszzrq.ToDate().Year, startXdsszzrq.ToDate().Month, startXdsszzrq.ToDate().Day, 0, 0, 0)) | |
| 112 | - .WhereIF(queryXdsszzrq != null, p => p.Xdsszzrq <= new DateTime(endXdsszzrq.ToDate().Year, endXdsszzrq.ToDate().Month, endXdsszzrq.ToDate().Day, 23, 59, 59)) | |
| 133 | + .WhereIF( | |
| 134 | + queryXdssksrq != null, | |
| 135 | + p => p.Xdssksrq >= new DateTime(startXdssksrq.ToDate().Year, startXdssksrq.ToDate().Month, startXdssksrq.ToDate().Day, 0, 0, 0) | |
| 136 | + ) | |
| 137 | + .WhereIF( | |
| 138 | + queryXdssksrq != null, | |
| 139 | + p => p.Xdssksrq <= new DateTime(endXdssksrq.ToDate().Year, endXdssksrq.ToDate().Month, endXdssksrq.ToDate().Day, 23, 59, 59) | |
| 140 | + ) | |
| 141 | + .WhereIF( | |
| 142 | + queryXdsszzrq != null, | |
| 143 | + p => p.Xdsszzrq >= new DateTime(startXdsszzrq.ToDate().Year, startXdsszzrq.ToDate().Month, startXdsszzrq.ToDate().Day, 0, 0, 0) | |
| 144 | + ) | |
| 145 | + .WhereIF( | |
| 146 | + queryXdsszzrq != null, | |
| 147 | + p => p.Xdsszzrq <= new DateTime(endXdsszzrq.ToDate().Year, endXdsszzrq.ToDate().Month, endXdsszzrq.ToDate().Day, 23, 59, 59) | |
| 148 | + ) | |
| 113 | 149 | .WhereIF(!string.IsNullOrEmpty(input.smxgd), p => p.Smxgd.Contains(input.smxgd)) |
| 114 | - .Select(it=> new LqMdMdlbjhsxxListOutput | |
| 150 | + .Select(it => new LqMdMdlbjhsxxListOutput | |
| 115 | 151 | { |
| 116 | 152 | id = it.Id, |
| 117 | - mdmc=it.Mdmc, | |
| 118 | - md=it.Md, | |
| 119 | - dxmbls=it.Dxmbls, | |
| 120 | - dxmb=it.Dxmb, | |
| 121 | - kssj=it.Kssj, | |
| 122 | - jssj=it.Jssj, | |
| 123 | - syb=it.Syb, | |
| 124 | - sybssksrq=it.Sybssksrq, | |
| 125 | - sybsszzrq=it.Sybsszzrq, | |
| 126 | - mdlxLd=it.MdlxLd, | |
| 127 | - mdzt=it.Mdzt, | |
| 128 | - mdlxXd=it.MdlxXd, | |
| 129 | - xdssksrq=it.Xdssksrq, | |
| 130 | - xdsszzrq=it.Xdsszzrq, | |
| 131 | - smxgd=it.Smxgd, | |
| 132 | - }).MergeTable().OrderBy(sidx+" "+input.sort).ToPagedListAsync(input.currentPage, input.pageSize); | |
| 133 | - return PageResult<LqMdMdlbjhsxxListOutput>.SqlSugarPageResult(data); | |
| 153 | + mdmc = it.Mdmc, | |
| 154 | + md = it.Md, | |
| 155 | + dxmbls = it.Dxmbls, | |
| 156 | + dxmb = it.Dxmb, | |
| 157 | + kssj = it.Kssj, | |
| 158 | + jssj = it.Jssj, | |
| 159 | + syb = it.Syb, | |
| 160 | + sybssksrq = it.Sybssksrq, | |
| 161 | + sybsszzrq = it.Sybsszzrq, | |
| 162 | + mdlxLd = it.MdlxLd, | |
| 163 | + mdzt = it.Mdzt, | |
| 164 | + mdlxXd = it.MdlxXd, | |
| 165 | + xdssksrq = it.Xdssksrq, | |
| 166 | + xdsszzrq = it.Xdsszzrq, | |
| 167 | + smxgd = it.Smxgd, | |
| 168 | + }) | |
| 169 | + .MergeTable() | |
| 170 | + .OrderBy(sidx + " " + input.sort) | |
| 171 | + .ToPagedListAsync(input.currentPage, input.pageSize); | |
| 172 | + return PageResult<LqMdMdlbjhsxxListOutput>.SqlSugarPageResult(data); | |
| 134 | 173 | } |
| 135 | 174 | |
| 136 | 175 | /// <summary> |
| ... | ... | @@ -145,14 +184,15 @@ namespace NCC.Extend.LqMdMdlbjhsxx |
| 145 | 184 | var entity = input.Adapt<LqMdMdlbjhsxxEntity>(); |
| 146 | 185 | entity.Id = YitIdHelper.NextId().ToString(); |
| 147 | 186 | var isOk = await _db.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandAsync(); |
| 148 | - if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1000); | |
| 187 | + if (!(isOk > 0)) | |
| 188 | + throw NCCException.Oh(ErrorCode.COM1000); | |
| 149 | 189 | } |
| 150 | 190 | |
| 151 | 191 | /// <summary> |
| 152 | - /// 获取门店类别及核算信息无分页列表 | |
| 153 | - /// </summary> | |
| 154 | - /// <param name="input">请求参数</param> | |
| 155 | - /// <returns></returns> | |
| 192 | + /// 获取门店类别及核算信息无分页列表 | |
| 193 | + /// </summary> | |
| 194 | + /// <param name="input">请求参数</param> | |
| 195 | + /// <returns></returns> | |
| 156 | 196 | [NonAction] |
| 157 | 197 | public async Task<dynamic> GetNoPagingList([FromQuery] LqMdMdlbjhsxxListQueryInput input) |
| 158 | 198 | { |
| ... | ... | @@ -181,50 +221,91 @@ namespace NCC.Extend.LqMdMdlbjhsxx |
| 181 | 221 | .WhereIF(!string.IsNullOrEmpty(input.md), p => p.Md.Equals(input.md)) |
| 182 | 222 | .WhereIF(!string.IsNullOrEmpty(input.dxmbls), p => p.Dxmbls.Equals(input.dxmbls)) |
| 183 | 223 | .WhereIF(!string.IsNullOrEmpty(input.dxmb), p => p.Dxmb.Equals(input.dxmb)) |
| 184 | - .WhereIF(queryKssj != null, p => p.Kssj >= new DateTime(startKssj.ToDate().Year, startKssj.ToDate().Month, startKssj.ToDate().Day, 0, 0, 0)) | |
| 185 | - .WhereIF(queryKssj != null, p => p.Kssj <= new DateTime(endKssj.ToDate().Year, endKssj.ToDate().Month, endKssj.ToDate().Day, 23, 59, 59)) | |
| 186 | - .WhereIF(queryJssj != null, p => p.Jssj >= new DateTime(startJssj.ToDate().Year, startJssj.ToDate().Month, startJssj.ToDate().Day, 0, 0, 0)) | |
| 187 | - .WhereIF(queryJssj != null, p => p.Jssj <= new DateTime(endJssj.ToDate().Year, endJssj.ToDate().Month, endJssj.ToDate().Day, 23, 59, 59)) | |
| 224 | + .WhereIF( | |
| 225 | + queryKssj != null, | |
| 226 | + p => p.Kssj >= new DateTime(startKssj.ToDate().Year, startKssj.ToDate().Month, startKssj.ToDate().Day, 0, 0, 0) | |
| 227 | + ) | |
| 228 | + .WhereIF( | |
| 229 | + queryKssj != null, | |
| 230 | + p => p.Kssj <= new DateTime(endKssj.ToDate().Year, endKssj.ToDate().Month, endKssj.ToDate().Day, 23, 59, 59) | |
| 231 | + ) | |
| 232 | + .WhereIF( | |
| 233 | + queryJssj != null, | |
| 234 | + p => p.Jssj >= new DateTime(startJssj.ToDate().Year, startJssj.ToDate().Month, startJssj.ToDate().Day, 0, 0, 0) | |
| 235 | + ) | |
| 236 | + .WhereIF( | |
| 237 | + queryJssj != null, | |
| 238 | + p => p.Jssj <= new DateTime(endJssj.ToDate().Year, endJssj.ToDate().Month, endJssj.ToDate().Day, 23, 59, 59) | |
| 239 | + ) | |
| 188 | 240 | .WhereIF(!string.IsNullOrEmpty(input.syb), p => p.Syb.Equals(input.syb)) |
| 189 | - .WhereIF(querySybssksrq != null, p => p.Sybssksrq >= new DateTime(startSybssksrq.ToDate().Year, startSybssksrq.ToDate().Month, startSybssksrq.ToDate().Day, 0, 0, 0)) | |
| 190 | - .WhereIF(querySybssksrq != null, p => p.Sybssksrq <= new DateTime(endSybssksrq.ToDate().Year, endSybssksrq.ToDate().Month, endSybssksrq.ToDate().Day, 23, 59, 59)) | |
| 191 | - .WhereIF(querySybsszzrq != null, p => p.Sybsszzrq >= new DateTime(startSybsszzrq.ToDate().Year, startSybsszzrq.ToDate().Month, startSybsszzrq.ToDate().Day, 0, 0, 0)) | |
| 192 | - .WhereIF(querySybsszzrq != null, p => p.Sybsszzrq <= new DateTime(endSybsszzrq.ToDate().Year, endSybsszzrq.ToDate().Month, endSybsszzrq.ToDate().Day, 23, 59, 59)) | |
| 241 | + .WhereIF( | |
| 242 | + querySybssksrq != null, | |
| 243 | + p => | |
| 244 | + p.Sybssksrq >= new DateTime(startSybssksrq.ToDate().Year, startSybssksrq.ToDate().Month, startSybssksrq.ToDate().Day, 0, 0, 0) | |
| 245 | + ) | |
| 246 | + .WhereIF( | |
| 247 | + querySybssksrq != null, | |
| 248 | + p => p.Sybssksrq <= new DateTime(endSybssksrq.ToDate().Year, endSybssksrq.ToDate().Month, endSybssksrq.ToDate().Day, 23, 59, 59) | |
| 249 | + ) | |
| 250 | + .WhereIF( | |
| 251 | + querySybsszzrq != null, | |
| 252 | + p => | |
| 253 | + p.Sybsszzrq >= new DateTime(startSybsszzrq.ToDate().Year, startSybsszzrq.ToDate().Month, startSybsszzrq.ToDate().Day, 0, 0, 0) | |
| 254 | + ) | |
| 255 | + .WhereIF( | |
| 256 | + querySybsszzrq != null, | |
| 257 | + p => p.Sybsszzrq <= new DateTime(endSybsszzrq.ToDate().Year, endSybsszzrq.ToDate().Month, endSybsszzrq.ToDate().Day, 23, 59, 59) | |
| 258 | + ) | |
| 193 | 259 | .WhereIF(!string.IsNullOrEmpty(input.mdlxLd), p => p.MdlxLd.Equals(input.mdlxLd)) |
| 194 | 260 | .WhereIF(!string.IsNullOrEmpty(input.mdzt), p => p.Mdzt.Equals(input.mdzt)) |
| 195 | 261 | .WhereIF(!string.IsNullOrEmpty(input.mdlxXd), p => p.MdlxXd.Equals(input.mdlxXd)) |
| 196 | - .WhereIF(queryXdssksrq != null, p => p.Xdssksrq >= new DateTime(startXdssksrq.ToDate().Year, startXdssksrq.ToDate().Month, startXdssksrq.ToDate().Day, 0, 0, 0)) | |
| 197 | - .WhereIF(queryXdssksrq != null, p => p.Xdssksrq <= new DateTime(endXdssksrq.ToDate().Year, endXdssksrq.ToDate().Month, endXdssksrq.ToDate().Day, 23, 59, 59)) | |
| 198 | - .WhereIF(queryXdsszzrq != null, p => p.Xdsszzrq >= new DateTime(startXdsszzrq.ToDate().Year, startXdsszzrq.ToDate().Month, startXdsszzrq.ToDate().Day, 0, 0, 0)) | |
| 199 | - .WhereIF(queryXdsszzrq != null, p => p.Xdsszzrq <= new DateTime(endXdsszzrq.ToDate().Year, endXdsszzrq.ToDate().Month, endXdsszzrq.ToDate().Day, 23, 59, 59)) | |
| 262 | + .WhereIF( | |
| 263 | + queryXdssksrq != null, | |
| 264 | + p => p.Xdssksrq >= new DateTime(startXdssksrq.ToDate().Year, startXdssksrq.ToDate().Month, startXdssksrq.ToDate().Day, 0, 0, 0) | |
| 265 | + ) | |
| 266 | + .WhereIF( | |
| 267 | + queryXdssksrq != null, | |
| 268 | + p => p.Xdssksrq <= new DateTime(endXdssksrq.ToDate().Year, endXdssksrq.ToDate().Month, endXdssksrq.ToDate().Day, 23, 59, 59) | |
| 269 | + ) | |
| 270 | + .WhereIF( | |
| 271 | + queryXdsszzrq != null, | |
| 272 | + p => p.Xdsszzrq >= new DateTime(startXdsszzrq.ToDate().Year, startXdsszzrq.ToDate().Month, startXdsszzrq.ToDate().Day, 0, 0, 0) | |
| 273 | + ) | |
| 274 | + .WhereIF( | |
| 275 | + queryXdsszzrq != null, | |
| 276 | + p => p.Xdsszzrq <= new DateTime(endXdsszzrq.ToDate().Year, endXdsszzrq.ToDate().Month, endXdsszzrq.ToDate().Day, 23, 59, 59) | |
| 277 | + ) | |
| 200 | 278 | .WhereIF(!string.IsNullOrEmpty(input.smxgd), p => p.Smxgd.Contains(input.smxgd)) |
| 201 | - .Select(it=> new LqMdMdlbjhsxxListOutput | |
| 279 | + .Select(it => new LqMdMdlbjhsxxListOutput | |
| 202 | 280 | { |
| 203 | 281 | id = it.Id, |
| 204 | - mdmc=it.Mdmc, | |
| 205 | - md=it.Md, | |
| 206 | - dxmbls=it.Dxmbls, | |
| 207 | - dxmb=it.Dxmb, | |
| 208 | - kssj=it.Kssj, | |
| 209 | - jssj=it.Jssj, | |
| 210 | - syb=it.Syb, | |
| 211 | - sybssksrq=it.Sybssksrq, | |
| 212 | - sybsszzrq=it.Sybsszzrq, | |
| 213 | - mdlxLd=it.MdlxLd, | |
| 214 | - mdzt=it.Mdzt, | |
| 215 | - mdlxXd=it.MdlxXd, | |
| 216 | - xdssksrq=it.Xdssksrq, | |
| 217 | - xdsszzrq=it.Xdsszzrq, | |
| 218 | - smxgd=it.Smxgd, | |
| 219 | - }).MergeTable().OrderBy(sidx+" "+input.sort).ToListAsync(); | |
| 220 | - return data; | |
| 282 | + mdmc = it.Mdmc, | |
| 283 | + md = it.Md, | |
| 284 | + dxmbls = it.Dxmbls, | |
| 285 | + dxmb = it.Dxmb, | |
| 286 | + kssj = it.Kssj, | |
| 287 | + jssj = it.Jssj, | |
| 288 | + syb = it.Syb, | |
| 289 | + sybssksrq = it.Sybssksrq, | |
| 290 | + sybsszzrq = it.Sybsszzrq, | |
| 291 | + mdlxLd = it.MdlxLd, | |
| 292 | + mdzt = it.Mdzt, | |
| 293 | + mdlxXd = it.MdlxXd, | |
| 294 | + xdssksrq = it.Xdssksrq, | |
| 295 | + xdsszzrq = it.Xdsszzrq, | |
| 296 | + smxgd = it.Smxgd, | |
| 297 | + }) | |
| 298 | + .MergeTable() | |
| 299 | + .OrderBy(sidx + " " + input.sort) | |
| 300 | + .ToListAsync(); | |
| 301 | + return data; | |
| 221 | 302 | } |
| 222 | 303 | |
| 223 | 304 | /// <summary> |
| 224 | - /// 导出门店类别及核算信息 | |
| 225 | - /// </summary> | |
| 226 | - /// <param name="input">请求参数</param> | |
| 227 | - /// <returns></returns> | |
| 305 | + /// 导出门店类别及核算信息 | |
| 306 | + /// </summary> | |
| 307 | + /// <param name="input">请求参数</param> | |
| 308 | + /// <returns></returns> | |
| 228 | 309 | [HttpGet("Actions/Export")] |
| 229 | 310 | public async Task<dynamic> Export([FromQuery] LqMdMdlbjhsxxListQueryInput input) |
| 230 | 311 | { |
| ... | ... | @@ -239,7 +320,8 @@ namespace NCC.Extend.LqMdMdlbjhsxx |
| 239 | 320 | { |
| 240 | 321 | exportData = await this.GetNoPagingList(input); |
| 241 | 322 | } |
| 242 | - List<ParamsModel> paramList = "[{\"value\":\"主键\",\"field\":\"id\"},{\"value\":\"门店名称\",\"field\":\"mdmc\"},{\"value\":\"门店\",\"field\":\"md\"},{\"value\":\"大项目部老师\",\"field\":\"dxmbls\"},{\"value\":\"大项目部\",\"field\":\"dxmb\"},{\"value\":\"开始时间\",\"field\":\"kssj\"},{\"value\":\"结束时间\",\"field\":\"jssj\"},{\"value\":\"事业部\",\"field\":\"syb\"},{\"value\":\"事业部所属开始日期\",\"field\":\"sybssksrq\"},{\"value\":\"事业部所属终止日期\",\"field\":\"sybsszzrq\"},{\"value\":\"门店类型-老店\",\"field\":\"mdlxLd\"},{\"value\":\"门店状态\",\"field\":\"mdzt\"},{\"value\":\"新店类型\",\"field\":\"mdlxXd\"},{\"value\":\"新店所属开始日期\",\"field\":\"xdssksrq\"},{\"value\":\"新店所属终止日期\",\"field\":\"xdsszzrq\"},{\"value\":\"生命线-固定\",\"field\":\"smxgd\"},]".ToList<ParamsModel>(); | |
| 323 | + List<ParamsModel> paramList = | |
| 324 | + "[{\"value\":\"主键\",\"field\":\"id\"},{\"value\":\"门店名称\",\"field\":\"mdmc\"},{\"value\":\"门店\",\"field\":\"md\"},{\"value\":\"大项目部老师\",\"field\":\"dxmbls\"},{\"value\":\"大项目部\",\"field\":\"dxmb\"},{\"value\":\"开始时间\",\"field\":\"kssj\"},{\"value\":\"结束时间\",\"field\":\"jssj\"},{\"value\":\"事业部\",\"field\":\"syb\"},{\"value\":\"事业部所属开始日期\",\"field\":\"sybssksrq\"},{\"value\":\"事业部所属终止日期\",\"field\":\"sybsszzrq\"},{\"value\":\"门店类型-老店\",\"field\":\"mdlxLd\"},{\"value\":\"门店状态\",\"field\":\"mdzt\"},{\"value\":\"新店类型\",\"field\":\"mdlxXd\"},{\"value\":\"新店所属开始日期\",\"field\":\"xdssksrq\"},{\"value\":\"新店所属终止日期\",\"field\":\"xdsszzrq\"},{\"value\":\"生命线-固定\",\"field\":\"smxgd\"},]".ToList<ParamsModel>(); | |
| 243 | 325 | ExcelConfig excelconfig = new ExcelConfig(); |
| 244 | 326 | excelconfig.FileName = "门店类别及核算信息.xls"; |
| 245 | 327 | excelconfig.HeadFont = "微软雅黑"; |
| ... | ... | @@ -258,11 +340,7 @@ namespace NCC.Extend.LqMdMdlbjhsxx |
| 258 | 340 | var addPath = FileVariable.TemporaryFilePath + excelconfig.FileName; |
| 259 | 341 | ExcelExportHelper<LqMdMdlbjhsxxListOutput>.Export(exportData, excelconfig, addPath); |
| 260 | 342 | var fileName = _userManager.UserId + "|" + addPath + "|xls"; |
| 261 | - var output = new | |
| 262 | - { | |
| 263 | - name = excelconfig.FileName, | |
| 264 | - url = "/api/File/Download?encryption=" + DESCEncryption.Encrypt(fileName, "NCC") | |
| 265 | - }; | |
| 343 | + var output = new { name = excelconfig.FileName, url = "/api/File/Download?encryption=" + DESCEncryption.Encrypt(fileName, "NCC") }; | |
| 266 | 344 | return output; |
| 267 | 345 | } |
| 268 | 346 | |
| ... | ... | @@ -282,7 +360,7 @@ namespace NCC.Extend.LqMdMdlbjhsxx |
| 282 | 360 | //开启事务 |
| 283 | 361 | _db.BeginTran(); |
| 284 | 362 | //批量删除门店类别及核算信息 |
| 285 | - await _db.Deleteable<LqMdMdlbjhsxxEntity>().In(d => d.Id,ids).ExecuteCommandAsync(); | |
| 363 | + await _db.Deleteable<LqMdMdlbjhsxxEntity>().In(d => d.Id, ids).ExecuteCommandAsync(); | |
| 286 | 364 | //关闭事务 |
| 287 | 365 | _db.CommitTran(); |
| 288 | 366 | } |
| ... | ... | @@ -306,7 +384,8 @@ namespace NCC.Extend.LqMdMdlbjhsxx |
| 306 | 384 | { |
| 307 | 385 | var entity = input.Adapt<LqMdMdlbjhsxxEntity>(); |
| 308 | 386 | var isOk = await _db.Updateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); |
| 309 | - if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1001); | |
| 387 | + if (!(isOk > 0)) | |
| 388 | + throw NCCException.Oh(ErrorCode.COM1001); | |
| 310 | 389 | } |
| 311 | 390 | |
| 312 | 391 | /// <summary> |
| ... | ... | @@ -319,7 +398,8 @@ namespace NCC.Extend.LqMdMdlbjhsxx |
| 319 | 398 | var entity = await _db.Queryable<LqMdMdlbjhsxxEntity>().FirstAsync(p => p.Id == id); |
| 320 | 399 | _ = entity ?? throw NCCException.Oh(ErrorCode.COM1005); |
| 321 | 400 | var isOk = await _db.Deleteable<LqMdMdlbjhsxxEntity>().Where(d => d.Id == id).ExecuteCommandAsync(); |
| 322 | - if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1002); | |
| 401 | + if (!(isOk > 0)) | |
| 402 | + throw NCCException.Oh(ErrorCode.COM1002); | |
| 323 | 403 | } |
| 324 | 404 | } |
| 325 | 405 | } | ... | ... |
netcore/src/Modularity/Extend/NCC.Extend/LqMdMdwyService.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.LqMdMdwy; | |
| 19 | +using NCC.Extend.Entitys.lq_md_mdwy; | |
| 8 | 20 | using NCC.Extend.Interfaces.LqMdMdwy; |
| 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_mdwy; | |
| 17 | -using NCC.Extend.Entitys.Dto.LqMdMdwy; | |
| 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.LqMdMdwy |
| 27 | 27 | { |
| 28 | 28 | /// <summary> |
| 29 | 29 | /// 门店物业服务 |
| 30 | 30 | /// </summary> |
| 31 | - [ApiDescriptionSettings(Tag = "Extend",Name = "LqMdMdwy", Order = 200)] | |
| 31 | + [ApiDescriptionSettings(Tag = "Extend", Name = "LqMdMdwy", Order = 200)] | |
| 32 | 32 | [Route("api/Extend/[controller]")] |
| 33 | 33 | public class LqMdMdwyService : ILqMdMdwyService, IDynamicApiController, ITransient |
| 34 | 34 | { |
| ... | ... | @@ -39,11 +39,9 @@ namespace NCC.Extend.LqMdMdwy |
| 39 | 39 | /// <summary> |
| 40 | 40 | /// 初始化一个<see cref="LqMdMdwyService"/>类型的新实例 |
| 41 | 41 | /// </summary> |
| 42 | - public LqMdMdwyService( | |
| 43 | - ISqlSugarRepository<LqMdMdwyEntity> lqMdMdwyRepository, | |
| 44 | - IUserManager userManager) | |
| 42 | + public LqMdMdwyService(ISqlSugarRepository<LqMdMdwyEntity> lqMdMdwyRepository, IUserManager userManager) | |
| 45 | 43 | { |
| 46 | - _lqMdMdwyRepository = lqMdMdwyRepository; | |
| 44 | + _lqMdMdwyRepository = lqMdMdwyRepository; | |
| 47 | 45 | _db = _lqMdMdwyRepository.Context; |
| 48 | 46 | _userManager = userManager; |
| 49 | 47 | } |
| ... | ... | @@ -62,10 +60,10 @@ namespace NCC.Extend.LqMdMdwy |
| 62 | 60 | } |
| 63 | 61 | |
| 64 | 62 | /// <summary> |
| 65 | - /// 获取门店物业列表 | |
| 66 | - /// </summary> | |
| 67 | - /// <param name="input">请求参数</param> | |
| 68 | - /// <returns></returns> | |
| 63 | + /// 获取门店物业列表 | |
| 64 | + /// </summary> | |
| 65 | + /// <param name="input">请求参数</param> | |
| 66 | + /// <returns></returns> | |
| 69 | 67 | [HttpGet("")] |
| 70 | 68 | public async Task<dynamic> GetList([FromQuery] LqMdMdwyListQueryInput input) |
| 71 | 69 | { |
| ... | ... | @@ -77,16 +75,19 @@ namespace NCC.Extend.LqMdMdwy |
| 77 | 75 | .WhereIF(!string.IsNullOrEmpty(input.wy), p => p.Wy.Contains(input.wy)) |
| 78 | 76 | .WhereIF(!string.IsNullOrEmpty(input.jf), p => p.Jf.Equals(input.jf)) |
| 79 | 77 | .WhereIF(!string.IsNullOrEmpty(input.df), p => p.Df.Equals(input.df)) |
| 80 | - .Select(it=> new LqMdMdwyListOutput | |
| 78 | + .Select(it => new LqMdMdwyListOutput | |
| 81 | 79 | { |
| 82 | 80 | id = it.Id, |
| 83 | - mdbm=it.Mdbm, | |
| 84 | - djmd=it.Djmd, | |
| 85 | - wy=it.Wy, | |
| 86 | - jf=it.Jf, | |
| 87 | - df=it.Df, | |
| 88 | - }).MergeTable().OrderBy(sidx+" "+input.sort).ToPagedListAsync(input.currentPage, input.pageSize); | |
| 89 | - return PageResult<LqMdMdwyListOutput>.SqlSugarPageResult(data); | |
| 81 | + mdbm = it.Mdbm, | |
| 82 | + djmd = it.Djmd, | |
| 83 | + wy = it.Wy, | |
| 84 | + jf = it.Jf, | |
| 85 | + df = it.Df, | |
| 86 | + }) | |
| 87 | + .MergeTable() | |
| 88 | + .OrderBy(sidx + " " + input.sort) | |
| 89 | + .ToPagedListAsync(input.currentPage, input.pageSize); | |
| 90 | + return PageResult<LqMdMdwyListOutput>.SqlSugarPageResult(data); | |
| 90 | 91 | } |
| 91 | 92 | |
| 92 | 93 | /// <summary> |
| ... | ... | @@ -101,14 +102,15 @@ namespace NCC.Extend.LqMdMdwy |
| 101 | 102 | var entity = input.Adapt<LqMdMdwyEntity>(); |
| 102 | 103 | entity.Id = YitIdHelper.NextId().ToString(); |
| 103 | 104 | var isOk = await _db.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandAsync(); |
| 104 | - if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1000); | |
| 105 | + if (!(isOk > 0)) | |
| 106 | + throw NCCException.Oh(ErrorCode.COM1000); | |
| 105 | 107 | } |
| 106 | 108 | |
| 107 | 109 | /// <summary> |
| 108 | - /// 获取门店物业无分页列表 | |
| 109 | - /// </summary> | |
| 110 | - /// <param name="input">请求参数</param> | |
| 111 | - /// <returns></returns> | |
| 110 | + /// 获取门店物业无分页列表 | |
| 111 | + /// </summary> | |
| 112 | + /// <param name="input">请求参数</param> | |
| 113 | + /// <returns></returns> | |
| 112 | 114 | [NonAction] |
| 113 | 115 | public async Task<dynamic> GetNoPagingList([FromQuery] LqMdMdwyListQueryInput input) |
| 114 | 116 | { |
| ... | ... | @@ -120,23 +122,26 @@ namespace NCC.Extend.LqMdMdwy |
| 120 | 122 | .WhereIF(!string.IsNullOrEmpty(input.wy), p => p.Wy.Contains(input.wy)) |
| 121 | 123 | .WhereIF(!string.IsNullOrEmpty(input.jf), p => p.Jf.Equals(input.jf)) |
| 122 | 124 | .WhereIF(!string.IsNullOrEmpty(input.df), p => p.Df.Equals(input.df)) |
| 123 | - .Select(it=> new LqMdMdwyListOutput | |
| 125 | + .Select(it => new LqMdMdwyListOutput | |
| 124 | 126 | { |
| 125 | 127 | id = it.Id, |
| 126 | - mdbm=it.Mdbm, | |
| 127 | - djmd=it.Djmd, | |
| 128 | - wy=it.Wy, | |
| 129 | - jf=it.Jf, | |
| 130 | - df=it.Df, | |
| 131 | - }).MergeTable().OrderBy(sidx+" "+input.sort).ToListAsync(); | |
| 132 | - return data; | |
| 128 | + mdbm = it.Mdbm, | |
| 129 | + djmd = it.Djmd, | |
| 130 | + wy = it.Wy, | |
| 131 | + jf = it.Jf, | |
| 132 | + df = it.Df, | |
| 133 | + }) | |
| 134 | + .MergeTable() | |
| 135 | + .OrderBy(sidx + " " + input.sort) | |
| 136 | + .ToListAsync(); | |
| 137 | + return data; | |
| 133 | 138 | } |
| 134 | 139 | |
| 135 | 140 | /// <summary> |
| 136 | - /// 导出门店物业 | |
| 137 | - /// </summary> | |
| 138 | - /// <param name="input">请求参数</param> | |
| 139 | - /// <returns></returns> | |
| 141 | + /// 导出门店物业 | |
| 142 | + /// </summary> | |
| 143 | + /// <param name="input">请求参数</param> | |
| 144 | + /// <returns></returns> | |
| 140 | 145 | [HttpGet("Actions/Export")] |
| 141 | 146 | public async Task<dynamic> Export([FromQuery] LqMdMdwyListQueryInput input) |
| 142 | 147 | { |
| ... | ... | @@ -151,7 +156,8 @@ namespace NCC.Extend.LqMdMdwy |
| 151 | 156 | { |
| 152 | 157 | exportData = await this.GetNoPagingList(input); |
| 153 | 158 | } |
| 154 | - List<ParamsModel> paramList = "[{\"value\":\"物业编号\",\"field\":\"id\"},{\"value\":\"门店编码\",\"field\":\"mdbm\"},{\"value\":\"单据门店\",\"field\":\"djmd\"},{\"value\":\"物业\",\"field\":\"wy\"},{\"value\":\"借方\",\"field\":\"jf\"},{\"value\":\"贷方\",\"field\":\"df\"},]".ToList<ParamsModel>(); | |
| 159 | + List<ParamsModel> paramList = | |
| 160 | + "[{\"value\":\"物业编号\",\"field\":\"id\"},{\"value\":\"门店编码\",\"field\":\"mdbm\"},{\"value\":\"单据门店\",\"field\":\"djmd\"},{\"value\":\"物业\",\"field\":\"wy\"},{\"value\":\"借方\",\"field\":\"jf\"},{\"value\":\"贷方\",\"field\":\"df\"},]".ToList<ParamsModel>(); | |
| 155 | 161 | ExcelConfig excelconfig = new ExcelConfig(); |
| 156 | 162 | excelconfig.FileName = "门店物业.xls"; |
| 157 | 163 | excelconfig.HeadFont = "微软雅黑"; |
| ... | ... | @@ -164,7 +170,9 @@ namespace NCC.Extend.LqMdMdwy |
| 164 | 170 | var isExist = paramList.Find(p => p.field == item); |
| 165 | 171 | if (isExist != null) |
| 166 | 172 | { |
| 167 | - excelconfig.ColumnModel.Add(new ExcelColumnModel() { Column = isExist.field, ExcelColumn = isExist.value }); | |
| 173 | + excelconfig.ColumnModel.Add( | |
| 174 | + new ExcelColumnModel() { Column = isExist.field, ExcelColumn = isExist.value } | |
| 175 | + ); | |
| 168 | 176 | } |
| 169 | 177 | } |
| 170 | 178 | var addPath = FileVariable.TemporaryFilePath + excelconfig.FileName; |
| ... | ... | @@ -173,7 +181,7 @@ namespace NCC.Extend.LqMdMdwy |
| 173 | 181 | var output = new |
| 174 | 182 | { |
| 175 | 183 | name = excelconfig.FileName, |
| 176 | - url = "/api/File/Download?encryption=" + DESCEncryption.Encrypt(fileName, "NCC") | |
| 184 | + url = "/api/File/Download?encryption=" + DESCEncryption.Encrypt(fileName, "NCC"), | |
| 177 | 185 | }; |
| 178 | 186 | return output; |
| 179 | 187 | } |
| ... | ... | @@ -194,7 +202,7 @@ namespace NCC.Extend.LqMdMdwy |
| 194 | 202 | //开启事务 |
| 195 | 203 | _db.BeginTran(); |
| 196 | 204 | //批量删除门店物业 |
| 197 | - await _db.Deleteable<LqMdMdwyEntity>().In(d => d.Id,ids).ExecuteCommandAsync(); | |
| 205 | + await _db.Deleteable<LqMdMdwyEntity>().In(d => d.Id, ids).ExecuteCommandAsync(); | |
| 198 | 206 | //关闭事务 |
| 199 | 207 | _db.CommitTran(); |
| 200 | 208 | } |
| ... | ... | @@ -218,7 +226,8 @@ namespace NCC.Extend.LqMdMdwy |
| 218 | 226 | { |
| 219 | 227 | var entity = input.Adapt<LqMdMdwyEntity>(); |
| 220 | 228 | var isOk = await _db.Updateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); |
| 221 | - if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1001); | |
| 229 | + if (!(isOk > 0)) | |
| 230 | + throw NCCException.Oh(ErrorCode.COM1001); | |
| 222 | 231 | } |
| 223 | 232 | |
| 224 | 233 | /// <summary> |
| ... | ... | @@ -231,7 +240,8 @@ namespace NCC.Extend.LqMdMdwy |
| 231 | 240 | var entity = await _db.Queryable<LqMdMdwyEntity>().FirstAsync(p => p.Id == id); |
| 232 | 241 | _ = entity ?? throw NCCException.Oh(ErrorCode.COM1005); |
| 233 | 242 | var isOk = await _db.Deleteable<LqMdMdwyEntity>().Where(d => d.Id == id).ExecuteCommandAsync(); |
| 234 | - if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1002); | |
| 243 | + if (!(isOk > 0)) | |
| 244 | + throw NCCException.Oh(ErrorCode.COM1002); | |
| 235 | 245 | } |
| 236 | 246 | } |
| 237 | 247 | } | ... | ... |
netcore/src/Modularity/Extend/NCC.Extend/LqTkXscService.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.LqTkXsc; | |
| 19 | +using NCC.Extend.Entitys.lq_tk_xsc; | |
| 8 | 20 | using NCC.Extend.Interfaces.LqTkXsc; |
| 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_tk_xsc; | |
| 17 | -using NCC.Extend.Entitys.Dto.LqTkXsc; | |
| 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.LqTkXsc |
| 27 | 27 | { |
| 28 | 28 | /// <summary> |
| 29 | 29 | /// 线索池服务 |
| 30 | 30 | /// </summary> |
| 31 | - [ApiDescriptionSettings(Tag = "Extend",Name = "LqTkXsc", Order = 200)] | |
| 31 | + [ApiDescriptionSettings(Tag = "Extend", Name = "LqTkXsc", Order = 200)] | |
| 32 | 32 | [Route("api/Extend/[controller]")] |
| 33 | 33 | public class LqTkXscService : ILqTkXscService, IDynamicApiController, ITransient |
| 34 | 34 | { |
| ... | ... | @@ -39,11 +39,9 @@ namespace NCC.Extend.LqTkXsc |
| 39 | 39 | /// <summary> |
| 40 | 40 | /// 初始化一个<see cref="LqTkXscService"/>类型的新实例 |
| 41 | 41 | /// </summary> |
| 42 | - public LqTkXscService( | |
| 43 | - ISqlSugarRepository<LqTkXscEntity> lqTkXscRepository, | |
| 44 | - IUserManager userManager) | |
| 42 | + public LqTkXscService(ISqlSugarRepository<LqTkXscEntity> lqTkXscRepository, IUserManager userManager) | |
| 45 | 43 | { |
| 46 | - _lqTkXscRepository = lqTkXscRepository; | |
| 44 | + _lqTkXscRepository = lqTkXscRepository; | |
| 47 | 45 | _db = _lqTkXscRepository.Context; |
| 48 | 46 | _userManager = userManager; |
| 49 | 47 | } |
| ... | ... | @@ -62,10 +60,10 @@ namespace NCC.Extend.LqTkXsc |
| 62 | 60 | } |
| 63 | 61 | |
| 64 | 62 | /// <summary> |
| 65 | - /// 获取线索池列表 | |
| 66 | - /// </summary> | |
| 67 | - /// <param name="input">请求参数</param> | |
| 68 | - /// <returns></returns> | |
| 63 | + /// 获取线索池列表 | |
| 64 | + /// </summary> | |
| 65 | + /// <param name="input">请求参数</param> | |
| 66 | + /// <returns></returns> | |
| 69 | 67 | [HttpGet("")] |
| 70 | 68 | public async Task<dynamic> GetList([FromQuery] LqTkXscListQueryInput input) |
| 71 | 69 | { |
| ... | ... | @@ -93,24 +91,27 @@ namespace NCC.Extend.LqTkXsc |
| 93 | 91 | .WhereIF(!string.IsNullOrEmpty(input.dz), p => p.Dz.Contains(input.dz)) |
| 94 | 92 | .WhereIF(!string.IsNullOrEmpty(input.yx), p => p.Yx.Contains(input.yx)) |
| 95 | 93 | .WhereIF(!string.IsNullOrEmpty(input.wx), p => p.Wx.Contains(input.wx)) |
| 96 | - .Select(it=> new LqTkXscListOutput | |
| 94 | + .Select(it => new LqTkXscListOutput | |
| 97 | 95 | { |
| 98 | 96 | id = it.Id, |
| 99 | - tjsj=it.Tjsj, | |
| 100 | - tkry=it.Tkry, | |
| 101 | - gkxm=it.Gkxm, | |
| 102 | - dhhm=it.Dhhm, | |
| 103 | - gmzs=it.Gmzs, | |
| 104 | - zffs=it.Zffs, | |
| 105 | - sfjwx=it.Sfjwx, | |
| 106 | - bz=it.Bz, | |
| 107 | - xb=it.Xb, | |
| 108 | - sr=it.Sr, | |
| 109 | - dz=it.Dz, | |
| 110 | - yx=it.Yx, | |
| 111 | - wx=it.Wx, | |
| 112 | - }).MergeTable().OrderBy(sidx+" "+input.sort).ToPagedListAsync(input.currentPage, input.pageSize); | |
| 113 | - return PageResult<LqTkXscListOutput>.SqlSugarPageResult(data); | |
| 97 | + tjsj = it.Tjsj, | |
| 98 | + tkry = it.Tkry, | |
| 99 | + gkxm = it.Gkxm, | |
| 100 | + dhhm = it.Dhhm, | |
| 101 | + gmzs = it.Gmzs, | |
| 102 | + zffs = it.Zffs, | |
| 103 | + sfjwx = it.Sfjwx, | |
| 104 | + bz = it.Bz, | |
| 105 | + xb = it.Xb, | |
| 106 | + sr = it.Sr, | |
| 107 | + dz = it.Dz, | |
| 108 | + yx = it.Yx, | |
| 109 | + wx = it.Wx, | |
| 110 | + }) | |
| 111 | + .MergeTable() | |
| 112 | + .OrderBy(sidx + " " + input.sort) | |
| 113 | + .ToPagedListAsync(input.currentPage, input.pageSize); | |
| 114 | + return PageResult<LqTkXscListOutput>.SqlSugarPageResult(data); | |
| 114 | 115 | } |
| 115 | 116 | |
| 116 | 117 | /// <summary> |
| ... | ... | @@ -125,14 +126,15 @@ namespace NCC.Extend.LqTkXsc |
| 125 | 126 | var entity = input.Adapt<LqTkXscEntity>(); |
| 126 | 127 | entity.Id = YitIdHelper.NextId().ToString(); |
| 127 | 128 | var isOk = await _db.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandAsync(); |
| 128 | - if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1000); | |
| 129 | + if (!(isOk > 0)) | |
| 130 | + throw NCCException.Oh(ErrorCode.COM1000); | |
| 129 | 131 | } |
| 130 | 132 | |
| 131 | 133 | /// <summary> |
| 132 | - /// 获取线索池无分页列表 | |
| 133 | - /// </summary> | |
| 134 | - /// <param name="input">请求参数</param> | |
| 135 | - /// <returns></returns> | |
| 134 | + /// 获取线索池无分页列表 | |
| 135 | + /// </summary> | |
| 136 | + /// <param name="input">请求参数</param> | |
| 137 | + /// <returns></returns> | |
| 136 | 138 | [NonAction] |
| 137 | 139 | public async Task<dynamic> GetNoPagingList([FromQuery] LqTkXscListQueryInput input) |
| 138 | 140 | { |
| ... | ... | @@ -160,31 +162,34 @@ namespace NCC.Extend.LqTkXsc |
| 160 | 162 | .WhereIF(!string.IsNullOrEmpty(input.dz), p => p.Dz.Contains(input.dz)) |
| 161 | 163 | .WhereIF(!string.IsNullOrEmpty(input.yx), p => p.Yx.Contains(input.yx)) |
| 162 | 164 | .WhereIF(!string.IsNullOrEmpty(input.wx), p => p.Wx.Contains(input.wx)) |
| 163 | - .Select(it=> new LqTkXscListOutput | |
| 165 | + .Select(it => new LqTkXscListOutput | |
| 164 | 166 | { |
| 165 | 167 | id = it.Id, |
| 166 | - tjsj=it.Tjsj, | |
| 167 | - tkry=it.Tkry, | |
| 168 | - gkxm=it.Gkxm, | |
| 169 | - dhhm=it.Dhhm, | |
| 170 | - gmzs=it.Gmzs, | |
| 171 | - zffs=it.Zffs, | |
| 172 | - sfjwx=it.Sfjwx, | |
| 173 | - bz=it.Bz, | |
| 174 | - xb=it.Xb, | |
| 175 | - sr=it.Sr, | |
| 176 | - dz=it.Dz, | |
| 177 | - yx=it.Yx, | |
| 178 | - wx=it.Wx, | |
| 179 | - }).MergeTable().OrderBy(sidx+" "+input.sort).ToListAsync(); | |
| 180 | - return data; | |
| 168 | + tjsj = it.Tjsj, | |
| 169 | + tkry = it.Tkry, | |
| 170 | + gkxm = it.Gkxm, | |
| 171 | + dhhm = it.Dhhm, | |
| 172 | + gmzs = it.Gmzs, | |
| 173 | + zffs = it.Zffs, | |
| 174 | + sfjwx = it.Sfjwx, | |
| 175 | + bz = it.Bz, | |
| 176 | + xb = it.Xb, | |
| 177 | + sr = it.Sr, | |
| 178 | + dz = it.Dz, | |
| 179 | + yx = it.Yx, | |
| 180 | + wx = it.Wx, | |
| 181 | + }) | |
| 182 | + .MergeTable() | |
| 183 | + .OrderBy(sidx + " " + input.sort) | |
| 184 | + .ToListAsync(); | |
| 185 | + return data; | |
| 181 | 186 | } |
| 182 | 187 | |
| 183 | 188 | /// <summary> |
| 184 | - /// 导出线索池 | |
| 185 | - /// </summary> | |
| 186 | - /// <param name="input">请求参数</param> | |
| 187 | - /// <returns></returns> | |
| 189 | + /// 导出线索池 | |
| 190 | + /// </summary> | |
| 191 | + /// <param name="input">请求参数</param> | |
| 192 | + /// <returns></returns> | |
| 188 | 193 | [HttpGet("Actions/Export")] |
| 189 | 194 | public async Task<dynamic> Export([FromQuery] LqTkXscListQueryInput input) |
| 190 | 195 | { |
| ... | ... | @@ -199,7 +204,8 @@ namespace NCC.Extend.LqTkXsc |
| 199 | 204 | { |
| 200 | 205 | exportData = await this.GetNoPagingList(input); |
| 201 | 206 | } |
| 202 | - List<ParamsModel> paramList = "[{\"value\":\"客户编号\",\"field\":\"id\"},{\"value\":\"创建时间\",\"field\":\"tjsj\"},{\"value\":\"拓客人员\",\"field\":\"tkry\"},{\"value\":\"顾客姓名\",\"field\":\"gkxm\"},{\"value\":\"电话号码\",\"field\":\"dhhm\"},{\"value\":\"购买张数\",\"field\":\"gmzs\"},{\"value\":\"支付方式\",\"field\":\"zffs\"},{\"value\":\"是否加微信\",\"field\":\"sfjwx\"},{\"value\":\"备注\",\"field\":\"bz\"},{\"value\":\"性别\",\"field\":\"xb\"},{\"value\":\"生日\",\"field\":\"sr\"},{\"value\":\"地址\",\"field\":\"dz\"},{\"value\":\"邮箱\",\"field\":\"yx\"},{\"value\":\"微信\",\"field\":\"wx\"},]".ToList<ParamsModel>(); | |
| 207 | + List<ParamsModel> paramList = | |
| 208 | + "[{\"value\":\"客户编号\",\"field\":\"id\"},{\"value\":\"创建时间\",\"field\":\"tjsj\"},{\"value\":\"拓客人员\",\"field\":\"tkry\"},{\"value\":\"顾客姓名\",\"field\":\"gkxm\"},{\"value\":\"电话号码\",\"field\":\"dhhm\"},{\"value\":\"购买张数\",\"field\":\"gmzs\"},{\"value\":\"支付方式\",\"field\":\"zffs\"},{\"value\":\"是否加微信\",\"field\":\"sfjwx\"},{\"value\":\"备注\",\"field\":\"bz\"},{\"value\":\"性别\",\"field\":\"xb\"},{\"value\":\"生日\",\"field\":\"sr\"},{\"value\":\"地址\",\"field\":\"dz\"},{\"value\":\"邮箱\",\"field\":\"yx\"},{\"value\":\"微信\",\"field\":\"wx\"},]".ToList<ParamsModel>(); | |
| 203 | 209 | ExcelConfig excelconfig = new ExcelConfig(); |
| 204 | 210 | excelconfig.FileName = "线索池.xls"; |
| 205 | 211 | excelconfig.HeadFont = "微软雅黑"; |
| ... | ... | @@ -218,11 +224,7 @@ namespace NCC.Extend.LqTkXsc |
| 218 | 224 | var addPath = FileVariable.TemporaryFilePath + excelconfig.FileName; |
| 219 | 225 | ExcelExportHelper<LqTkXscListOutput>.Export(exportData, excelconfig, addPath); |
| 220 | 226 | var fileName = _userManager.UserId + "|" + addPath + "|xls"; |
| 221 | - var output = new | |
| 222 | - { | |
| 223 | - name = excelconfig.FileName, | |
| 224 | - url = "/api/File/Download?encryption=" + DESCEncryption.Encrypt(fileName, "NCC") | |
| 225 | - }; | |
| 227 | + var output = new { name = excelconfig.FileName, url = "/api/File/Download?encryption=" + DESCEncryption.Encrypt(fileName, "NCC") }; | |
| 226 | 228 | return output; |
| 227 | 229 | } |
| 228 | 230 | |
| ... | ... | @@ -242,7 +244,7 @@ namespace NCC.Extend.LqTkXsc |
| 242 | 244 | //开启事务 |
| 243 | 245 | _db.BeginTran(); |
| 244 | 246 | //批量删除线索池 |
| 245 | - await _db.Deleteable<LqTkXscEntity>().In(d => d.Id,ids).ExecuteCommandAsync(); | |
| 247 | + await _db.Deleteable<LqTkXscEntity>().In(d => d.Id, ids).ExecuteCommandAsync(); | |
| 246 | 248 | //关闭事务 |
| 247 | 249 | _db.CommitTran(); |
| 248 | 250 | } |
| ... | ... | @@ -266,7 +268,8 @@ namespace NCC.Extend.LqTkXsc |
| 266 | 268 | { |
| 267 | 269 | var entity = input.Adapt<LqTkXscEntity>(); |
| 268 | 270 | var isOk = await _db.Updateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); |
| 269 | - if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1001); | |
| 271 | + if (!(isOk > 0)) | |
| 272 | + throw NCCException.Oh(ErrorCode.COM1001); | |
| 270 | 273 | } |
| 271 | 274 | |
| 272 | 275 | /// <summary> |
| ... | ... | @@ -279,7 +282,8 @@ namespace NCC.Extend.LqTkXsc |
| 279 | 282 | var entity = await _db.Queryable<LqTkXscEntity>().FirstAsync(p => p.Id == id); |
| 280 | 283 | _ = entity ?? throw NCCException.Oh(ErrorCode.COM1005); |
| 281 | 284 | var isOk = await _db.Deleteable<LqTkXscEntity>().Where(d => d.Id == id).ExecuteCommandAsync(); |
| 282 | - if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1002); | |
| 285 | + if (!(isOk > 0)) | |
| 286 | + throw NCCException.Oh(ErrorCode.COM1002); | |
| 283 | 287 | } |
| 284 | 288 | } |
| 285 | 289 | } | ... | ... |