Commit dc40332a99acaba66f4cb783a14e61296b4029a2
1 parent
db5395b9
新增设备相关功能,更新UavAdvertisementService以支持设备ID和设备名称,新增获取设备广告管理列表和订单金额统计的API,更新相关DTO以包含设备信息。
Showing
5 changed files
with
87 additions
and
3 deletions
netcore/src/Modularity/Extend/NCC.Extend.Entitys/uavAdvertisement/Dto/UavAdvertisementCrInput.cs
| ... | ... | @@ -35,6 +35,11 @@ namespace NCC.Extend.Entitys.Dto.UavAdvertisement |
| 35 | 35 | public string imageUrl { get; set; } |
| 36 | 36 | |
| 37 | 37 | /// <summary> |
| 38 | + /// 设备ID | |
| 39 | + /// </summary> | |
| 40 | + public string deviceId { get; set; } | |
| 41 | + | |
| 42 | + /// <summary> | |
| 38 | 43 | /// 是否启用(1=启用,0=禁用) |
| 39 | 44 | /// </summary> |
| 40 | 45 | public string isEnabled { get; set; } | ... | ... |
netcore/src/Modularity/Extend/NCC.Extend.Entitys/uavAdvertisement/Dto/UavAdvertisementListOutput.cs
| ... | ... | @@ -33,7 +33,20 @@ namespace NCC.Extend.Entitys.Dto.UavAdvertisement |
| 33 | 33 | /// </summary> |
| 34 | 34 | public string imageUrl { get; set; } |
| 35 | 35 | |
| 36 | - public string type{get;set;} | |
| 36 | + /// <summary> | |
| 37 | + /// 广告类型 | |
| 38 | + /// </summary> | |
| 39 | + public string type { get; set; } | |
| 40 | + | |
| 41 | + /// <summary> | |
| 42 | + /// 设备ID | |
| 43 | + /// </summary> | |
| 44 | + public string deviceId { get; set; } | |
| 45 | + | |
| 46 | + /// <summary> | |
| 47 | + /// 设备名称 | |
| 48 | + /// </summary> | |
| 49 | + public string deviceName { get; set; } | |
| 37 | 50 | |
| 38 | 51 | } |
| 39 | 52 | } | ... | ... |
netcore/src/Modularity/Extend/NCC.Extend.Entitys/uavAdvertisement/Entity/UavAdvertisementEntity.cs
| ... | ... | @@ -102,6 +102,10 @@ namespace NCC.Extend.Entitys |
| 102 | 102 | [SugarColumn(ColumnName = "F_Name")] |
| 103 | 103 | public string Name { get; set; } |
| 104 | 104 | |
| 105 | - | |
| 105 | + /// <summary> | |
| 106 | + /// 设备ID | |
| 107 | + /// </summary> | |
| 108 | + [SugarColumn(ColumnName = "F_DeviceId")] | |
| 109 | + public string DeviceId { get; set; } | |
| 106 | 110 | } |
| 107 | 111 | } |
| 108 | 112 | \ No newline at end of file | ... | ... |
netcore/src/Modularity/Extend/NCC.Extend/UavAdvertisementService.cs
| ... | ... | @@ -78,6 +78,10 @@ namespace NCC.Extend.UavAdvertisement |
| 78 | 78 | agentId = it.AgentId, |
| 79 | 79 | imageUrl = it.ImageUrl, |
| 80 | 80 | isEnabled = it.IsEnabled, |
| 81 | + name = it.Name, | |
| 82 | + type = it.Type, | |
| 83 | + deviceId = it.DeviceId, | |
| 84 | + deviceName = SqlFunc.Subqueryable<UavDeviceEntity>().Where(u => u.Id == it.DeviceId).Select(u => u.DeviceName), | |
| 81 | 85 | }).MergeTable().OrderBy(sidx + " " + input.sort).ToPagedListAsync(input.currentPage, input.pageSize); |
| 82 | 86 | return PageResult<UavAdvertisementListOutput>.SqlSugarPageResult(data); |
| 83 | 87 | } |
| ... | ... | @@ -105,7 +109,10 @@ namespace NCC.Extend.UavAdvertisement |
| 105 | 109 | agentId = it.AgentId, |
| 106 | 110 | imageUrl = it.ImageUrl, |
| 107 | 111 | isEnabled = it.IsEnabled, |
| 108 | - name = it.Name | |
| 112 | + name = it.Name, | |
| 113 | + type = it.Type, | |
| 114 | + deviceId = it.DeviceId, | |
| 115 | + deviceName = SqlFunc.Subqueryable<UavDeviceEntity>().Where(u => u.Id == it.DeviceId).Select(u => u.DeviceName), | |
| 109 | 116 | }).MergeTable().OrderBy(sidx + " " + input.sort).ToPagedListAsync(input.currentPage, input.pageSize); |
| 110 | 117 | return PageResult<UavAdvertisementListOutput>.SqlSugarPageResult(data); |
| 111 | 118 | } |
| ... | ... | @@ -133,6 +140,8 @@ namespace NCC.Extend.UavAdvertisement |
| 133 | 140 | isEnabled = it.IsEnabled, |
| 134 | 141 | name = it.Name, |
| 135 | 142 | type = it.Type, |
| 143 | + deviceId = it.DeviceId, | |
| 144 | + deviceName = SqlFunc.Subqueryable<UavDeviceEntity>().Where(u => u.Id == it.DeviceId).Select(u => u.DeviceName), | |
| 136 | 145 | }).MergeTable().OrderBy(sidx + " " + input.sort).ToPagedListAsync(input.currentPage, input.pageSize); |
| 137 | 146 | return PageResult<UavAdvertisementListOutput>.SqlSugarPageResult(data); |
| 138 | 147 | } |
| ... | ... | @@ -153,6 +162,7 @@ namespace NCC.Extend.UavAdvertisement |
| 153 | 162 | entity.AgentId = _userManager.UserId; |
| 154 | 163 | entity.CreateUser = _userManager.UserId; |
| 155 | 164 | entity.CreateTime = DateTime.Now; |
| 165 | + entity.DeviceId = input.deviceId; | |
| 156 | 166 | // 字符串到整数的强制转换 |
| 157 | 167 | if (!string.IsNullOrEmpty(input.isEnabled) && int.TryParse(input.isEnabled, out int isEnabledValue)) |
| 158 | 168 | { |
| ... | ... | @@ -202,5 +212,30 @@ namespace NCC.Extend.UavAdvertisement |
| 202 | 212 | } |
| 203 | 213 | #endregion |
| 204 | 214 | |
| 215 | + #region 获取某个设备的广告管理列表 | |
| 216 | + /// <summary> | |
| 217 | + /// 获取某个设备的广告管理列表 | |
| 218 | + /// </summary> | |
| 219 | + /// <param name="deviceId"></param> | |
| 220 | + /// <returns></returns> | |
| 221 | + [HttpGet("GetAdvertisementListByDevice")] | |
| 222 | + public async Task<dynamic> GetAdvertisementListByDevice(string deviceId) | |
| 223 | + { | |
| 224 | + var data = await _db.Queryable<UavAdvertisementEntity>() | |
| 225 | + .Where(p => p.DeviceId == deviceId) | |
| 226 | + .Select(it => new UavAdvertisementListOutput | |
| 227 | + { | |
| 228 | + id = it.Id, | |
| 229 | + agentId = it.AgentId, | |
| 230 | + imageUrl = it.ImageUrl, | |
| 231 | + isEnabled = it.IsEnabled, | |
| 232 | + name = it.Name, | |
| 233 | + type = it.Type, | |
| 234 | + deviceId = it.DeviceId, | |
| 235 | + deviceName = SqlFunc.Subqueryable<UavDeviceEntity>().Where(u => u.Id == it.DeviceId).Select(u => u.DeviceName), | |
| 236 | + }).ToListAsync(); | |
| 237 | + return data; | |
| 238 | + } | |
| 239 | + #endregion | |
| 205 | 240 | } |
| 206 | 241 | } | ... | ... |
netcore/src/Modularity/Extend/NCC.Extend/UavOrderService.cs
| ... | ... | @@ -1482,6 +1482,33 @@ namespace NCC.Extend.UavOrder |
| 1482 | 1482 | } |
| 1483 | 1483 | #endregion |
| 1484 | 1484 | |
| 1485 | + #region 获取某个设备的订单金额统计 | |
| 1486 | + /// <summary> | |
| 1487 | + /// 获取某个设备的订单金额统计 | |
| 1488 | + /// </summary> | |
| 1489 | + /// <param name="deviceId"></param> | |
| 1490 | + /// <returns></returns> | |
| 1491 | + [HttpGet("GetOrderAmountByDevice")] | |
| 1492 | + public async Task<dynamic> GetOrderAmountByDevice(string deviceId) | |
| 1493 | + { | |
| 1494 | + //本月金额 | |
| 1495 | + var monthStart = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); | |
| 1496 | + var monthData = await _db.Queryable<UavOrderEntity>() | |
| 1497 | + .Where(p => p.DeviceId == deviceId && p.Status == UavOrderStatusEnum.已完成.GetHashCode() && p.CreateTime >= monthStart) | |
| 1498 | + .SumAsync(p => p.ActualAmount); | |
| 1499 | + //总金额 | |
| 1500 | + var totalData = await _db.Queryable<UavOrderEntity>() | |
| 1501 | + .Where(p => p.DeviceId == deviceId && p.Status == UavOrderStatusEnum.已完成.GetHashCode()) | |
| 1502 | + .SumAsync(p => p.ActualAmount); | |
| 1503 | + //返回数据 | |
| 1504 | + return new | |
| 1505 | + { | |
| 1506 | + monthData = monthData, | |
| 1507 | + totalData = totalData | |
| 1508 | + }; | |
| 1509 | + } | |
| 1510 | + #endregion | |
| 1511 | + | |
| 1485 | 1512 | #region 获取某个代理商的每天出货量 |
| 1486 | 1513 | /// <summary> |
| 1487 | 1514 | /// 获取某个代理商的每天出货量 | ... | ... |