Browse Source

更换基类

master
赵新宇 1 day ago
parent
commit
dfa7e1cce7
  1. 10
      API/Wood.Service/Controllers/CheryRecurringJobInputPageController.cs
  2. 2
      API/Wood.Service/Controllers/CherySupplierBomService.cs
  3. 2
      API/Wood.Service/Controllers/CherySupplierConDateService.cs
  4. 2
      API/Wood.Service/Controllers/CherySupplierProFlawService.cs
  5. 2
      API/Wood.Service/Controllers/CherySupplierProMaterialDataService.cs
  6. 2
      API/Wood.Service/Controllers/CherySupplierProProcessService.cs
  7. 2
      API/Wood.Service/Controllers/CherySupplierProStationFirstPassYieldService.cs
  8. 17
      API/Wood.Service/Controllers/RecurringJobBaseController.cs

10
API/Wood.Service/Controllers/CheryRecurringJobInputPageController.cs

@ -79,12 +79,14 @@ namespace TaskManager.Controllers
{
try
{
var inputjson = JsonSerializer.Serialize(t,
new JsonSerializerOptions
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
Converters = { new DecimalTrimConverter() },
WriteIndented = false // 可选,用于格式化输出
WriteIndented = false ,// 可选,用于格式化输出
Encoder = System.Text.Encodings.Web.JavaScriptEncoder.Create(System.Text.Unicode.UnicodeRanges.All)
}
);
//inputjson = RemoveWhitespace(inputjson);
@ -170,8 +172,10 @@ namespace TaskManager.Controllers
var total = entites.Count();
sub.DataCount = total;
int totalPages = (int)Math.Ceiling((double)total / pageSize);
int startPage =sub.SyncedPageCount == 0 ? 1 : sub.SyncedPageCount;
for (int i = sub.SyncedPageCount; i <= totalPages; i++)
for (int i = startPage; i <= totalPages; i++)
{
var records = entites.Skip((i - 1) * pageSize)
@ -200,7 +204,7 @@ namespace TaskManager.Controllers
var result = await PostPageAsync(pagedRequest,sub.TaskId, DateTime.Now.ToString("yyyyMMdd"));
if(result.code == 200)
{
_jobDbContext.BulkUpdate(records);
_jobDbContext.BulkUpdate(records,options=>options.UseTableLock=true);
sub.SyncedPageCount = i;
if (i == totalPages)
{

2
API/Wood.Service/Controllers/CherySupplierBomService.cs

@ -8,7 +8,7 @@ namespace TaskManager.Controllers
/// <summary>
/// BOM主数据
/// </summary>
public class CherySupplierBomService : CheryRecurringJobInputPageController<SUPPLIER_BOM, SUPPLIER_BOM_DTO>
public class CherySupplierBomService : CheryRecurringJobInputPageExtendController<SUPPLIER_BOM, SUPPLIER_BOM_DTO>
{
public CherySupplierBomService(HttpClient httpClient, JobDbContext jobDbContext, LogController log, IRepository<SUPPLIER_BOM> repository) : base(httpClient, jobDbContext, log, repository)
{

2
API/Wood.Service/Controllers/CherySupplierConDateService.cs

@ -54,7 +54,7 @@ namespace TaskManager.Controllers
task.CreateTime = DateTime.Now;
task.CreateUser = "admin";
task.CreationTime = DateTime.Now;
task.SyncedPageCount = 0;
task.SyncedPageCount = 1;
entites.ForEach(p =>
{
p.ReadState = true;

2
API/Wood.Service/Controllers/CherySupplierProFlawService.cs

@ -8,7 +8,7 @@ namespace TaskManager.Controllers
/// <summary>
/// 缺陷业务数据
/// </summary>
public class CherySupplierProFlawService : CheryRecurringJobInputPageController<SUPPLIER_PRO_FLAW, SUPPLIER_PRO_FLAW_DTO>
public class CherySupplierProFlawService : CheryRecurringJobInputPageExtendController<SUPPLIER_PRO_FLAW, SUPPLIER_PRO_FLAW_DTO>
{
public CherySupplierProFlawService(HttpClient httpClient, JobDbContext jobDbContext, LogController log, IRepository<SUPPLIER_PRO_FLAW> repository) : base(httpClient, jobDbContext, log, repository)
{

2
API/Wood.Service/Controllers/CherySupplierProMaterialDataService.cs

@ -5,7 +5,7 @@ using TaskManager.EntityFramework;
namespace TaskManager.Controllers
{
public class CherySupplierProMaterialDataService : CheryRecurringJobInputPageController<SUPPLIER_PRO_MATERIAL_DATA, SUPPLIER_PRO_MATERIAL_DATA_DTO>
public class CherySupplierProMaterialDataService : CheryRecurringJobInputPageExtendController<SUPPLIER_PRO_MATERIAL_DATA, SUPPLIER_PRO_MATERIAL_DATA_DTO>
{
public CherySupplierProMaterialDataService(HttpClient httpClient, JobDbContext jobDbContext, LogController log, IRepository<SUPPLIER_PRO_MATERIAL_DATA> repository) : base(httpClient, jobDbContext, log, repository)
{

2
API/Wood.Service/Controllers/CherySupplierProProcessService.cs

@ -14,7 +14,7 @@ namespace Wood.Service.Controllers
/// <summary>
/// 工艺
/// </summary>
public class CherySupplierProProcessService : CheryRecurringJobInputPageController<SUPPLIER_PRO_PROCESS, SUPPLIER_PRO_PROCESS_DTO>
public class CherySupplierProProcessService : CheryRecurringJobInputPageExtendController<SUPPLIER_PRO_PROCESS, SUPPLIER_PRO_PROCESS_DTO>
{
public CherySupplierProProcessService(HttpClient httpClient, JobDbContext jobDbContext, LogController log, IRepository<SUPPLIER_PRO_PROCESS> repository) : base(httpClient, jobDbContext, log, repository)
{

2
API/Wood.Service/Controllers/CherySupplierProStationFirstPassYieldService.cs

@ -7,7 +7,7 @@ namespace TaskManager.Controllers
/// <summary>
/// 工位一次合格率
/// </summary>
public class CherySupplierProStationFirstPassyieldService : CheryRecurringJobInputPageController<SUPPLIER_PRO_STATION_FIRST_PASSYIELD, SUPPLIER_PRO_STATION_FIRST_PASSYIELD_DTO>
public class CherySupplierProStationFirstPassyieldService : CheryRecurringJobInputPageExtendController<SUPPLIER_PRO_STATION_FIRST_PASSYIELD, SUPPLIER_PRO_STATION_FIRST_PASSYIELD_DTO>
{
public CherySupplierProStationFirstPassyieldService(HttpClient httpClient, JobDbContext jobDbContext, LogController log, IRepository<SUPPLIER_PRO_STATION_FIRST_PASSYIELD> repository) : base(httpClient, jobDbContext, log, repository)
{

17
API/Wood.Service/Controllers/RecurringJobBaseController.cs

@ -14,6 +14,7 @@ using System.Text.Json;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using TaskManager.Contracts.Dtos;
using TaskManager.Entity;
using TaskManager.EntityFramework;
using Wood.Entity;
@ -74,6 +75,11 @@ namespace TaskManager.Controllers
// 构建请求
var request = new HttpRequestMessage(HttpMethod.Post, url);
request.Content = new StringContent(jsonData, Encoding.UTF8, "application/json");
var str3 = request.Content.ToString();
request.Headers.Add("appKey", appKey);
request.Headers.Add("appSecret", appSecret);
request.Headers.Add("timestamp", timeStamp);
@ -119,6 +125,17 @@ namespace TaskManager.Controllers
private string GenerateSign(string method, string path, string appKey, string appSecret, string timestamp, string nonce, string jsonBody)
{
//var options = new JsonSerializerOptions
//{
// WriteIndented = true, // 格式化缩进,方便阅读
// Encoder = System.Text.Encodings.Web.JavaScriptEncoder.Create(System.Text.Unicode.UnicodeRanges.All)
//};
//byte[] utf8Bytes = JsonSerializer.SerializeToUtf8Bytes(jsonBody, options);
//// 转成字符串(若需要字符串形式,可按需操作,不过直接传字节更高效)
//string jsonStr = Encoding.UTF8.GetString(utf8Bytes);
string paramStr = $"method={method.ToUpper()}&path={path}&appKey={appKey}&appSecret={appSecret}&timestamp={timestamp}&nonce={nonce}&jsonBody={jsonBody}";
return ComputeSHA512(paramStr);

Loading…
Cancel
Save