|
|
@ -22,15 +22,39 @@ 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) {
|
|
|
|
|
|
|
|
if (count != null && count > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
List<string> _result = new List<string>();
|
|
|
|
|
|
|
|
for (int i = 0; i < count; i++) {
|
|
|
|
|
|
|
|
string _temp = "";
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prefix))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_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 = "";
|
|
|
|
string _result = "";
|
|
|
|
if (!string.IsNullOrEmpty(prefix)) {
|
|
|
|
if (!string.IsNullOrEmpty(prefix))
|
|
|
|
|
|
|
|
{
|
|
|
|
_result += prefix;
|
|
|
|
_result += prefix;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var _date = DateTime.Now;
|
|
|
|
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(1000).ToString().PadLeft(4,'0')}";
|
|
|
|
_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);
|
|
|
|
return Ok(_result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[HttpGet("getsource")]
|
|
|
|
[HttpGet("getsource")]
|
|
|
|
public ActionResult GetSource([FromQuery] string sourceid)
|
|
|
|
public ActionResult GetSource([FromQuery] string sourceid)
|
|
|
|