Commit 5eea27e127ebe6067975ea98e1cd7c353454addd
1 parent
107c7d61
修复门店目标服务:优化BatchCreateByStores方法,修复GetList排序参数问题;更新日报服务:添加开单业绩、退款业绩、实际业绩字段
Showing
4 changed files
with
57 additions
and
31 deletions
netcore/src/Modularity/Extend/NCC.Extend/LqDailyReportService.cs
| ... | ... | @@ -236,7 +236,7 @@ namespace NCC.Extend |
| 236 | 236 | ), 0) as BillingPerformance, |
| 237 | 237 | -- 退款业绩总和(退卡业绩) |
| 238 | 238 | COALESCE(( |
| 239 | - SELECT SUM(refund.tkje) | |
| 239 | + SELECT SUM(refund.F_ActualRefundAmount) | |
| 240 | 240 | FROM lq_hytk_hytk refund |
| 241 | 241 | WHERE refund.md = store.F_Id |
| 242 | 242 | AND refund.F_IsEffective = 1 | ... | ... |
netcore/src/Modularity/Extend/NCC.Extend/LqMdGeneralManagerLifelineService.cs
| ... | ... | @@ -66,7 +66,7 @@ namespace NCC.Extend.LqMdGeneralManagerLifeline |
| 66 | 66 | [HttpGet("")] |
| 67 | 67 | public async Task<dynamic> GetList([FromQuery] LqMdGeneralManagerLifelineListQueryInput input) |
| 68 | 68 | { |
| 69 | - var sidx = input.sidx == null ? "F_Id" : input.sidx; | |
| 69 | + var sidx = input.sidx == null ? "id" : input.sidx; | |
| 70 | 70 | var data = await _db.Queryable<LqMdGeneralManagerLifelineEntity>() |
| 71 | 71 | .WhereIF(!string.IsNullOrEmpty(input.storeId), p => p.StoreId.Contains(input.storeId)) |
| 72 | 72 | .WhereIF(!string.IsNullOrEmpty(input.month), p => p.Month == input.month) | ... | ... |
netcore/src/Modularity/Extend/NCC.Extend/LqMdTargetService.cs
| ... | ... | @@ -67,7 +67,8 @@ namespace NCC.Extend.LqMdTarget |
| 67 | 67 | [HttpGet("")] |
| 68 | 68 | public async Task<dynamic> GetList([FromQuery] LqMdTargetListQueryInput input) |
| 69 | 69 | { |
| 70 | - var sidx = input.sidx == null ? "F_Id" : input.sidx; | |
| 70 | + var sidx = input.sidx == null ? "id" : input.sidx; | |
| 71 | + var sort = string.IsNullOrEmpty(input.sort) ? "DESC" : input.sort; | |
| 71 | 72 | var data = await _db.Queryable<LqMdTargetEntity>() |
| 72 | 73 | .WhereIF(!string.IsNullOrEmpty(input.storeId), p => p.StoreId.Contains(input.storeId)) |
| 73 | 74 | .WhereIF(!string.IsNullOrEmpty(input.month), p => p.Month == input.month) |
| ... | ... | @@ -102,7 +103,7 @@ namespace NCC.Extend.LqMdTarget |
| 102 | 103 | updateUser = it.UpdateUser, |
| 103 | 104 | }) |
| 104 | 105 | .MergeTable() |
| 105 | - .OrderBy(sidx + " " + input.sort) | |
| 106 | + .OrderBy($"{sidx} {sort}") | |
| 106 | 107 | .ToPagedListAsync(input.currentPage, input.pageSize); |
| 107 | 108 | return PageResult<LqMdTargetListOutput>.SqlSugarPageResult(data); |
| 108 | 109 | } |
| ... | ... | @@ -151,43 +152,67 @@ namespace NCC.Extend.LqMdTarget |
| 151 | 152 | public async Task<dynamic> BatchCreateByStores([FromQuery] string month) |
| 152 | 153 | { |
| 153 | 154 | var userInfo = await _userManager.GetUserInfo(); |
| 155 | + if (userInfo == null || string.IsNullOrEmpty(userInfo.userId)) | |
| 156 | + { | |
| 157 | + throw NCCException.Oh("用户信息获取失败,请重新登录"); | |
| 158 | + } | |
| 154 | 159 | // 验证月份格式 |
| 155 | 160 | if (string.IsNullOrEmpty(month) || month.Length != 6 || !Regex.IsMatch(month, @"^\d{6}$")) |
| 156 | 161 | { |
| 157 | - throw NCCException.Oh(ErrorCode.COM1000, "月份格式必须为YYYYMM(如:202501)"); | |
| 162 | + throw NCCException.Oh("月份格式必须为YYYYMM(如:202501)"); | |
| 158 | 163 | } |
| 159 | 164 | //查询门店列表 |
| 160 | - var storeList = await _db.Queryable<LqMdxxEntity>().Where(p => p.Status == StatusEnum.有效.GetHashCode()).Select(p => p.Id).ToListAsync(); | |
| 165 | + var storeList = await _db.Queryable<LqMdxxEntity>().Select(p => p.Id).ToListAsync(); | |
| 166 | + | |
| 167 | + if (storeList == null || storeList.Count == 0) | |
| 168 | + { | |
| 169 | + return new { success = true, message = "没有有效的门店数据", createdCount = 0 }; | |
| 170 | + } | |
| 171 | + | |
| 161 | 172 | // 删除设置月份的所有门店数据 |
| 162 | 173 | await _db.Deleteable<LqMdTargetEntity>().Where(p => p.Month == month).ExecuteCommandAsync(); |
| 174 | + | |
| 163 | 175 | // 批量创建 |
| 164 | - var entities = storeList.Select(storeId => new LqMdTargetEntity | |
| 176 | + var entities = new List<LqMdTargetEntity>(); | |
| 177 | + foreach (var storeId in storeList) | |
| 178 | + { | |
| 179 | + if (string.IsNullOrEmpty(storeId)) | |
| 180 | + continue; | |
| 181 | + | |
| 182 | + entities.Add(new LqMdTargetEntity | |
| 183 | + { | |
| 184 | + Id = YitIdHelper.NextId().ToString(), | |
| 185 | + StoreId = storeId, | |
| 186 | + Month = month, | |
| 187 | + BusinessUnit = "", | |
| 188 | + TechDepartment = "", | |
| 189 | + EducationDepartment = "", | |
| 190 | + MajorProjectDepartment = "", | |
| 191 | + BusinessUnitTarget = 0, | |
| 192 | + TechDepartmentTarget = 0, | |
| 193 | + EducationDepartmentTarget = 0, | |
| 194 | + BusinessUnitGeneralManager = "", | |
| 195 | + BusinessUnitManager = "", | |
| 196 | + StoreTarget = 0, | |
| 197 | + StoreLifeline = 0, | |
| 198 | + StoreConsumeTarget = 0, | |
| 199 | + StoreProjectTarget = 0, | |
| 200 | + StoreHeadcountTarget = 0, | |
| 201 | + AssistantHeadcountTargetStage1 = 0, | |
| 202 | + AssistantHeadcountTargetStage2 = 0, | |
| 203 | + CreateTime = DateTime.Now, | |
| 204 | + CreateUser = userInfo.userId, | |
| 205 | + }); | |
| 206 | + } | |
| 207 | + | |
| 208 | + if (entities.Count == 0) | |
| 165 | 209 | { |
| 166 | - Id = YitIdHelper.NextId().ToString(), | |
| 167 | - StoreId = storeId, | |
| 168 | - Month = month, | |
| 169 | - BusinessUnit = "", | |
| 170 | - TechDepartment = "", | |
| 171 | - EducationDepartment = "", | |
| 172 | - MajorProjectDepartment = "", | |
| 173 | - BusinessUnitTarget = 0, | |
| 174 | - TechDepartmentTarget = 0, | |
| 175 | - EducationDepartmentTarget = 0, | |
| 176 | - BusinessUnitGeneralManager = "", | |
| 177 | - BusinessUnitManager = "", | |
| 178 | - StoreTarget = 0, | |
| 179 | - StoreLifeline = 0, | |
| 180 | - StoreConsumeTarget = 0, | |
| 181 | - StoreProjectTarget = 0, | |
| 182 | - StoreHeadcountTarget = 0, | |
| 183 | - AssistantHeadcountTargetStage1 = 0, | |
| 184 | - AssistantHeadcountTargetStage2 = 0, | |
| 185 | - CreateTime = DateTime.Now, | |
| 186 | - CreateUser = userInfo.userId, | |
| 187 | - }).ToList(); | |
| 210 | + return new { success = true, message = "没有有效的门店数据可创建", createdCount = 0 }; | |
| 211 | + } | |
| 212 | + | |
| 188 | 213 | var isOk = await _db.Insertable(entities).ExecuteCommandAsync(); |
| 189 | 214 | if (!(isOk > 0)) |
| 190 | - throw NCCException.Oh(ErrorCode.COM1000); | |
| 215 | + throw NCCException.Oh(ErrorCode.COM1000, "批量创建失败"); | |
| 191 | 216 | return new { success = true, message = $"成功创建{isOk}条记录", createdCount = isOk }; |
| 192 | 217 | } |
| 193 | 218 | #endregion | ... | ... |
netcore/src/Modularity/Extend/NCC.Extend/Utils/WeChatBotService.cs
| ... | ... | @@ -36,7 +36,8 @@ namespace NCC.Extend.Utils |
| 36 | 36 | { |
| 37 | 37 | var requestData = new |
| 38 | 38 | { |
| 39 | - webhookUrl = WEBHOOK_URL, | |
| 39 | + // webhookUrl = WEBHOOK_URL, | |
| 40 | + webhookUrl = WEBHOOK_URL_TEST, | |
| 40 | 41 | content = content, |
| 41 | 42 | mentionedList = (string)null, |
| 42 | 43 | mentionedMobileList = (string)null, | ... | ... |