修改日常问题

pull/1/head
潘建东 5 months ago
parent 6f16a13c97
commit 84c2e9fccc

@ -22,14 +22,38 @@ namespace ZKLT.Hadoop.API.Controllers
private IHadoopService _HadoopService; private IHadoopService _HadoopService;
[HttpGet("getid")] [HttpGet("getid")]
public ActionResult GetId([FromQuery] string? prefix) { public ActionResult GetId([FromQuery] string? prefix, [FromQuery] int? count) {
string _result = ""; if (count != null && count > 0)
if (!string.IsNullOrEmpty(prefix)) { {
_result += prefix; List<string> _result = new List<string>();
} for (int i = 0; i < count; i++) {
var _date = DateTime.Now; string _temp = "";
_result += $@"{_date.Year.ToString().PadLeft(4,'0')}{_date.Month.ToString().PadLeft(2, '0')}{_date.Day.ToString().PadLeft(2, '0')}{_date.Hour.ToString().PadLeft(2, '0')}{_date.Minute.ToString().PadLeft(2, '0')}{_date.Second.ToString().PadLeft(2, '0')}{_date.Millisecond.ToString().PadLeft(3, '0')}{new Random().Next(1000).ToString().PadLeft(4,'0')}"; if (!string.IsNullOrEmpty(prefix))
return Ok(_result); {
_temp += prefix;
}
var _date = DateTime.Now;
_temp += $@"{_date.Year.ToString().PadLeft(4, '0')}{_date.Month.ToString().PadLeft(2, '0')}{_date.Day.ToString().PadLeft(2, '0')}{_date.Hour.ToString().PadLeft(2, '0')}{_date.Minute.ToString().PadLeft(2, '0')}{_date.Second.ToString().PadLeft(2, '0')}{_date.Millisecond.ToString().PadLeft(3, '0')}{new Random().Next(9999).ToString().PadLeft(4, '0')}";
if (_result.Any(v => v == _temp))
{
i--;
}
else {
_result.Add(_temp);
}
}
return Ok(_result);
}
else {
string _result = "";
if (!string.IsNullOrEmpty(prefix))
{
_result += prefix;
}
var _date = DateTime.Now;
_result += $@"{_date.Year.ToString().PadLeft(4, '0')}{_date.Month.ToString().PadLeft(2, '0')}{_date.Day.ToString().PadLeft(2, '0')}{_date.Hour.ToString().PadLeft(2, '0')}{_date.Minute.ToString().PadLeft(2, '0')}{_date.Second.ToString().PadLeft(2, '0')}{_date.Millisecond.ToString().PadLeft(3, '0')}{new Random().Next(9999).ToString().PadLeft(4, '0')}";
return Ok(_result);
}
} }
[HttpGet("getsource")] [HttpGet("getsource")]

@ -8,7 +8,7 @@
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
}, },
"dotnetRunMessages": true, "dotnetRunMessages": true,
"applicationUrl": "http://localhost:5171" "applicationUrl": "http://*:5171"
}, },
"IIS Express": { "IIS Express": {
"commandName": "IISExpress", "commandName": "IISExpress",

@ -6,10 +6,10 @@
} }
}, },
"ConnectionStrings": { "ConnectionStrings": {
"Host": "127.0.0.1", "Host": "1.94.127.210",
"Account": "root", "Account": "root",
"PassWord": "root", "PassWord": "Panjiandong1994",
"Key": "hadoopdb", "Key": "erptest",
"Port": "3306" "Port": "3306"
} }
} }

@ -7,10 +7,10 @@
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"ConnectionStrings": { "ConnectionStrings": {
"Host": "host.docker.internal", "Host": "1.94.127.210",
"Account": "root", "Account": "root",
"PassWord": "Panjiandong1994", "PassWord": "Panjiandong1994",
"Key": "erp", "Key": "erptest",
"Port": "3306" "Port": "3306"
} }
} }

@ -1 +1 @@
docker build -f ./Dockerfile -t hadoop:1.0.0 ../../. docker build -f ./Dockerfile -t hadoop:1.0.3 ../../.

@ -55,14 +55,14 @@ namespace ZKLT.Hadoop.Model
string _guid; string _guid;
if (value is string) { if (value is string) {
string _action = value.ToString()!; string _action = value.ToString()!;
Regex _regex1 = new Regex(@"(?<=(\+\=))\d+"); Regex _regex1 = new Regex(@"(?<=(\+\=))[\d\.]+");
if(_regex1.IsMatch(_action)) if(_regex1.IsMatch(_action))
{ {
_guid = Guid.NewGuid().ToString("N"); _guid = Guid.NewGuid().ToString("N");
param.Add(_guid,_regex1.Match(_action).Value); param.Add(_guid,_regex1.Match(_action).Value);
return @$"`{column.Key}` + @{_guid}"; return @$"`{column.Key}` + @{_guid}";
} }
Regex _regex2 = new Regex(@"(?<=(\-\=))\d+"); Regex _regex2 = new Regex(@"(?<=(\-\=))[\d\.]+");
if (_regex2.IsMatch(_action)) if (_regex2.IsMatch(_action))
{ {
_guid = Guid.NewGuid().ToString("N"); _guid = Guid.NewGuid().ToString("N");

Loading…
Cancel
Save