执行代码清理,修复warning
This commit is contained in:
@@ -34,7 +34,7 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IUserManager _userManager;
|
||||
private SendMessageService _sendMessageService;
|
||||
private readonly SendMessageService _sendMessageService;
|
||||
private readonly IBasPushRuleLogService _basPushRuleLogService;
|
||||
private readonly TimeTaskService _timeTaskService;
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Tnb.ProductionMgr
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetAndonPadList(AndonPadListInput input)
|
||||
{
|
||||
var result = await _db.Queryable<AndonRecords>()
|
||||
SqlSugarPagedList<AndonPadListOutput> result = await _db.Queryable<AndonRecords>()
|
||||
.LeftJoin<AndonInfo>((a, b) => a.andon_info_id == b.id)
|
||||
.LeftJoin<UserEntity>((a, b, c) => a.repair_id == c.Id)
|
||||
.LeftJoin<UserEntity>((a, b, c, d) => a.create_id == d.Id)
|
||||
@@ -93,7 +93,7 @@ namespace Tnb.ProductionMgr
|
||||
andonRecords.status = DictConst.AndonStatusHJZ;
|
||||
|
||||
|
||||
List<string> toUsers = new List<string>();
|
||||
List<string> toUsers = new();
|
||||
|
||||
if (!string.IsNullOrEmpty(andonInfo.personnel))
|
||||
{
|
||||
@@ -116,18 +116,18 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
List<MessageSendModel> list = await _sendMessageService.SendTest(andonInfo.send_config_id);
|
||||
|
||||
foreach (var item in list)
|
||||
foreach (MessageSendModel item in list)
|
||||
{
|
||||
item.toUser = toUsers;
|
||||
}
|
||||
|
||||
foreach (var item in list)
|
||||
foreach (MessageSendModel item in list)
|
||||
{
|
||||
await _sendMessageService.SendMessage(item, new Dictionary<string, object>());
|
||||
_ = await _sendMessageService.SendMessage(item, new Dictionary<string, object>());
|
||||
}
|
||||
}
|
||||
|
||||
await _db.Insertable<AndonRecords>(andonRecords).ExecuteCommandAsync();
|
||||
_ = await _db.Insertable<AndonRecords>(andonRecords).ExecuteCommandAsync();
|
||||
|
||||
});
|
||||
|
||||
@@ -146,25 +146,27 @@ namespace Tnb.ProductionMgr
|
||||
// string cron = $"0 {executeTime.Minute} {executeTime.Hour} {executeTime.Day} {executeTime.Month} ? {executeTime.Year}";
|
||||
string cron = $"0 {executeTime.Minute} {executeTime.Hour} {executeTime.Day} {executeTime.Month} ?";
|
||||
|
||||
var comtentModel = new ContentModel();
|
||||
// comtentModel.cron = (2 * 60).ToString();
|
||||
comtentModel.cron = cron;
|
||||
comtentModel.interfaceId = "";
|
||||
comtentModel.interfaceName = "";
|
||||
comtentModel.parameter = new List<InterfaceParameter>();
|
||||
comtentModel.localHostTaskId = "PushMsgTimeWorker/PushMsg";
|
||||
comtentModel.startTime = DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
||||
// comtentModel.endTime = DateTimeOffset.Now.AddSeconds(3).ToUnixTimeMilliseconds().ToString();
|
||||
comtentModel.TenantId = _userManager?.TenantId;
|
||||
comtentModel.TenantDbName = _userManager?.TenantDbName;
|
||||
comtentModel.ConnectionConfig = _userManager?.ConnectionConfig;
|
||||
comtentModel.Token = _userManager?.ToKen;
|
||||
ContentModel comtentModel = new()
|
||||
{
|
||||
// comtentModel.cron = (2 * 60).ToString();
|
||||
cron = cron,
|
||||
interfaceId = "",
|
||||
interfaceName = "",
|
||||
parameter = new List<InterfaceParameter>(),
|
||||
localHostTaskId = "PushMsgTimeWorker/PushMsg",
|
||||
startTime = DateTimeOffset.Now.ToUnixTimeMilliseconds(),
|
||||
// comtentModel.endTime = DateTimeOffset.Now.AddSeconds(3).ToUnixTimeMilliseconds().ToString();
|
||||
TenantId = _userManager?.TenantId,
|
||||
TenantDbName = _userManager?.TenantDbName,
|
||||
ConnectionConfig = _userManager?.ConnectionConfig,
|
||||
Token = _userManager?.ToKen
|
||||
};
|
||||
|
||||
// foreach (var item in sendModels)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
TimeTaskCrInput timeTaskCrInput = new TimeTaskCrInput()
|
||||
TimeTaskCrInput timeTaskCrInput = new()
|
||||
{
|
||||
enCode = DateTime.Now.ToString("yyyyMMddHHmmss"),
|
||||
fullName = "andon推送消息" + DateTime.Now.ToString("yyyyMMddHHmmss"),
|
||||
@@ -179,7 +181,7 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
TimeTaskEntity timeTaskEntity = await _db.Queryable<TimeTaskEntity>().Where(x => x.EnCode == timeTaskCrInput.enCode).FirstAsync();
|
||||
|
||||
BasPushRuleLog basPushRuleLog = new BasPushRuleLog()
|
||||
BasPushRuleLog basPushRuleLog = new()
|
||||
{
|
||||
push_rule_id = andonInfo.push_rule_id,
|
||||
timetask_id = timeTaskEntity?.Id,
|
||||
@@ -188,14 +190,13 @@ namespace Tnb.ProductionMgr
|
||||
is_push = 1,
|
||||
};
|
||||
|
||||
await _db.Insertable<BasPushRuleLog>(basPushRuleLog).ExecuteCommandAsync();
|
||||
_ = await _db.Insertable<BasPushRuleLog>(basPushRuleLog).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result.IsSuccess ? "发起成功" : result.ErrorMessage;
|
||||
return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "发起成功" : result.ErrorMessage);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
@@ -218,11 +219,11 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
else
|
||||
{
|
||||
await _db.Updateable<AndonRecords>()
|
||||
_ = await _db.Updateable<AndonRecords>()
|
||||
.SetColumns(x => x.repair_id == _userManager.UserId)
|
||||
.SetColumns(x => x.response_time == DateTime.Now)
|
||||
.ExecuteCommandAsync();
|
||||
Dictionary<string, string> postData = new Dictionary<string, string>()
|
||||
Dictionary<string, string> postData = new()
|
||||
{
|
||||
["id"] = andonRecords.id
|
||||
};
|
||||
@@ -252,7 +253,7 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
else
|
||||
{
|
||||
await _db.Updateable<AndonRecords>()
|
||||
_ = await _db.Updateable<AndonRecords>()
|
||||
.SetColumns(x => x.start_repair_time == DateTime.Now)
|
||||
.Where(x => x.id == id)
|
||||
.ExecuteCommandAsync();
|
||||
@@ -279,7 +280,7 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
else
|
||||
{
|
||||
await _db.Updateable<AndonRecords>()
|
||||
_ = await _db.Updateable<AndonRecords>()
|
||||
.SetColumns(x => x.end_repair_time == DateTime.Now)
|
||||
.Where(x => x.id == id)
|
||||
.ExecuteCommandAsync();
|
||||
@@ -306,7 +307,7 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
else
|
||||
{
|
||||
await _db.Updateable<AndonRecords>()
|
||||
_ = await _db.Updateable<AndonRecords>()
|
||||
.SetColumns(x => x.confirm_time == DateTime.Now)
|
||||
.Where(x => x.id == id)
|
||||
.ExecuteCommandAsync();
|
||||
@@ -322,7 +323,7 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
private async Task<List<MessageSendModel>> GetSendParamJson(string id)
|
||||
{
|
||||
var list = await _db.Queryable<MessageSendTemplateEntity, MessageTemplateEntity>((a, b) => new JoinQueryInfos(JoinType.Left, a.TemplateId == b.Id))
|
||||
List<MessageSendModel> list = await _db.Queryable<MessageSendTemplateEntity, MessageTemplateEntity>((a, b) => new JoinQueryInfos(JoinType.Left, a.TemplateId == b.Id))
|
||||
.Where((a, b) => a.SendConfigId == id && a.DeleteMark == null && b.DeleteMark == null)
|
||||
.Select((a, b) => new MessageSendModel
|
||||
{
|
||||
@@ -333,13 +334,12 @@ namespace Tnb.ProductionMgr
|
||||
sendConfigId = a.SendConfigId,
|
||||
templateId = a.TemplateId,
|
||||
}).ToListAsync();
|
||||
foreach (var item in list)
|
||||
foreach (MessageSendModel? item in list)
|
||||
{
|
||||
// 是否存在参数.
|
||||
var flag = await _db.Queryable<MessageSmsFieldEntity>().AnyAsync(x => x.TemplateId == item.templateId && x.DeleteMark == null);
|
||||
if (flag)
|
||||
{
|
||||
item.paramJson = await _db.Queryable<MessageTemplateParamEntity, MessageTemplateEntity, MessageSmsFieldEntity>((a, b, c) => new JoinQueryInfos(JoinType.Left, a.TemplateId == b.Id, JoinType.Left, a.TemplateId == c.TemplateId))
|
||||
bool flag = await _db.Queryable<MessageSmsFieldEntity>().AnyAsync(x => x.TemplateId == item.templateId && x.DeleteMark == null);
|
||||
item.paramJson = flag
|
||||
? await _db.Queryable<MessageTemplateParamEntity, MessageTemplateEntity, MessageSmsFieldEntity>((a, b, c) => new JoinQueryInfos(JoinType.Left, a.TemplateId == b.Id, JoinType.Left, a.TemplateId == c.TemplateId))
|
||||
.Where((a, b, c) => a.TemplateId == item.templateId && a.DeleteMark == null && b.DeleteMark == null && a.Field == c.Field && a.Field != "@flowLink")
|
||||
.Select((a, b) => new MessageSendParam
|
||||
{
|
||||
@@ -350,11 +350,8 @@ namespace Tnb.ProductionMgr
|
||||
templateId = a.TemplateId,
|
||||
templateName = b.FullName,
|
||||
templateType = b.TemplateType
|
||||
}).ToListAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
item.paramJson = await _db.Queryable<MessageTemplateParamEntity, MessageTemplateEntity>((a, b) => new JoinQueryInfos(JoinType.Left, a.TemplateId == b.Id))
|
||||
}).ToListAsync()
|
||||
: await _db.Queryable<MessageTemplateParamEntity, MessageTemplateEntity>((a, b) => new JoinQueryInfos(JoinType.Left, a.TemplateId == b.Id))
|
||||
.Where((a, b) => a.TemplateId == item.templateId && a.DeleteMark == null && b.DeleteMark == null && a.Field != "@flowLink")
|
||||
.Where((a, b) => b.Title.Contains(a.Field) || b.Content.Contains(a.Field))
|
||||
.Select((a, b) => new MessageSendParam
|
||||
@@ -367,7 +364,6 @@ namespace Tnb.ProductionMgr
|
||||
templateName = b.FullName,
|
||||
templateType = b.TemplateType
|
||||
}).ToListAsync();
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user