Commit 5a027edb by 赵剑炜

修改消息队列上报内容

parent 3d7bb1ad
......@@ -4,6 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<ApplicationIcon>平台.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
......@@ -11,13 +12,17 @@
</ItemGroup>
<ItemGroup>
<Content Include="平台.ico" />
</ItemGroup>
<ItemGroup>
<None Include="..\.editorconfig" Link=".editorconfig" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Autofac" Version="7.1.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="11.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
<PackageReference Include="FluentValidation.AspNetCore" Version="10.4.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.3" />
......
......@@ -12,6 +12,7 @@ using Models.ToolsModel;
using Newtonsoft.Json;
using Services;
using Services.Interface;
using SqlSugar;
using static Microsoft.AspNetCore.Razor.Language.TagHelperMetadata;
namespace APIs.Controllers
......@@ -35,7 +36,79 @@ namespace APIs.Controllers
Mapper = mapper;
}
/// <summary>
/// 新增基础信息
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
public virtual async Task<ApiResult> UploadInfo([FromBody] InfoListReq req)
{
try
{
string idlist = string.Join(",", req.infoList.Select(d => d.policeId).ToArray());
var list = idlist.Split(",");
var police = await _policeService.Query(p => list.Contains(p.id));
if (police != null)
{
foreach (var item in police)
{
var itemnew = req.infoList.Where(p => p.policeId.Equals(item.id)).FirstOrDefault();
if (itemnew != null)
{
item.fingerInfo = itemnew.fingerInfo;
item.faceInfo = itemnew.faceInfo;
}
}
int result= _policeService.UpdateObjs(police);
if (result > 0)
{
var src = new ApiResult
{
code = ResultCode.OPERATE_SUCCESS.Code,
msg = ResultCode.OPERATE_SUCCESS.Msg,
data = police
};
return src;
}
else {
var src = new ApiResult
{
code = ResultCode.POLICE_ERROR.Code,
msg = ResultCode.POLICE_ERROR.Msg,
data = ""
};
return src;
}
}
else
{
var src = new ApiResult
{
code = ResultCode.POLICE_ERROR.Code,
msg = ResultCode.POLICE_ERROR.Msg,
data = ""
};
return src;
}
}
catch (Exception ex)
{
var error = new ApiResult
{
code = ResultCode.OPERATE_FAILED.Code,
msg = ex.Message,
};
return error;
}
}
/// <summary>
/// 查询人员信息
......
using APIs.Dto;
using APIs.Req;
using AutoMapper;
using Common.Utility.Model;
using Models.SqlModel;
......@@ -16,5 +17,6 @@ public class MapperProfile : Profile
CreateMap<RecordsReq, LogSummary>();
CreateMap<LogDetail, EquipmentList>();
CreateMap<EquipmentList, LogDetail>();
}
}
\ No newline at end of file
......@@ -33,7 +33,7 @@ public class Program
var logger = NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger();
try
{
Console.WriteLine($"[{DateTime.Now.ToString("yyyy-MM-dd HH:mm")}]"+ "--------------init main--------------");
Console.WriteLine($"[{DateTime.Now.ToString("yyyy-MM-dd HH:mm")}]"+ "--------------程序初始化中--------------");
Console.WriteLine("程序启动成功");
CreateHostBuilder(args).Build().Run();
......
namespace APIs.Req
{
public class InfoListReq
{
public List<FingerFace> infoList { get; set; }
}
public class FingerFace
{
public String policeId { get; set; }
public String faceInfo { get; set; }
public String fingerInfo { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Models.ReqModel
{
public class InfoList
{
public List<FingerFace> infoList { get; set; }
}
public class FingerFace
{
public String id { get; set; }
public String faceInfo { get; set; }
public String fingerInfo { get; set; }
}
}
......@@ -25,5 +25,7 @@ namespace Models.Table
[SugarColumn(ColumnName = "id_card")]
public String? idCard { get; set; }
public String? sex { get; set; }
public String? faceInfo { get; set; }
public String? fingerInfo { get; set; }
}
}
......@@ -13,6 +13,7 @@ namespace Repositories.IRepository
Task<int> Add(TEntity entity);
Task<int> Add(List<TEntity> listEntity);
Task<bool> Update(TEntity entity);
int UpdateObjs(List<TEntity> entity);
Task<bool> DeleteByIds(int[] ids);
Task<bool> DeleteById(object id);
......
using Models.SqlModel;
using Models.ReqModel;
using Models.SqlModel;
using Models.Table;
using System;
using System.Collections.Generic;
......@@ -10,5 +11,11 @@ namespace Repositories.IRepository.IBussiness
{
public interface IPoliceRepository : IBaseRepository<Police>
{
/// <summary>
///
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
int UpdateInfos(InfoList req);
}
}
......@@ -38,6 +38,9 @@ namespace Repositories.Repository
return await context.Updateable(entity).ExecuteCommandHasChangeAsync();
}
}
public async Task<bool> DeleteByIds(int[] ids)
{
using (var context = _db.GetDbClient())
......@@ -151,5 +154,12 @@ namespace Repositories.Repository
}
int IBaseRepository<TEntity>.UpdateObjs(List<TEntity> entity)
{
using (var context = _db.GetDbClient())
{
return context.Updateable(entity).ExecuteCommand();
}
}
}
}
......@@ -29,18 +29,16 @@ namespace Repositories.Repository.Bussiness
//var invs = await context.Queryable<Inventory>().Where(x =>
//model.DetailList.Select(x => x.epc).Contains(x.epc)).ToListAsync();
context.BeginTran();
await context.Updateable(cars).WhereColumns(it => new { it.id }).UpdateColumns(it => new { it.state, it.updateTime }).ExecuteCommandAsync();//实体有多少列更新多少列
context.Updateable(cars).WhereColumns(it => new { it.id }).UpdateColumns(it => new { it.state, it.updateTime }).ExecuteCommand();//实体有多少列更新多少列
var result = await context.Updateable(inv).WhereColumns(it=>new { it.epc }).UpdateColumns(it => new { it.state,it.updateTime}).ExecuteCommandAsync();//实体有多少列更新多少列
var logSum = await context.InsertNav(model)
var result = context.Updateable(inv).WhereColumns(it=>new { it.epc }).UpdateColumns(it => new { it.state,it.updateTime}).ExecuteCommand();//实体有多少列更新多少列
var logSum = context.InsertNav(model)
.Include(z1=>z1.DetailList)
.ExecuteCommandAsync();
context.CommitTran();
}
catch (Exception e)
{
context.RollbackTran();
return false;
throw e;
}
}
......
using Models.SqlModel;
using Models.ReqModel;
using Models.SqlModel;
using Models.Table;
using Repositories.IRepository.IBussiness;
using Repositories.IRepository.IUnitOfWork;
......@@ -12,10 +13,36 @@ using System.Threading.Tasks;
namespace Repositories.Repository.Bussiness
{
public class PoliceRepository : BaseRepository<Police>, IPoliceRepository
{
{
protected readonly ILocalSugarUnitOfWork _suger;
public PoliceRepository(ILocalSugarUnitOfWork sugarUnitOfWork) : base(sugarUnitOfWork)
{
_suger = sugarUnitOfWork;
}
public int UpdateInfos(InfoList req)
{
return 0;
//using (var context = _suger.GetDbClient())
//{
// try
// {
// context.BeginTran();
// var result = context.Updateable(req.infoList).WhereColumns(it => new { it.policeId }).UpdateColumns(it => new { it.faceInfo, it.fingerInfo }).ExecuteCommandAsync();//实体有多少列更新多少列
// context.CommitTran();
// }
// catch (Exception e)
// {
// context.RollbackTran();
// return 0;
// throw e;
// }
//}
//return true;
}
}
}
......@@ -48,6 +48,10 @@ namespace Services
{
return await BaseDal.Update(entity);
}
public int UpdateObjs(List<TEntity> entity)
{
return BaseDal.UpdateObjs(entity);
}
public async Task<bool> DeleteById(object id)
{
return await BaseDal.DeleteById(id);
......
......@@ -15,6 +15,7 @@ namespace Services.Interface
Task<int> Add(TEntity entity);
Task<int> Add(List<TEntity> listEntity);
Task<bool> Update(TEntity entity);
int UpdateObjs(List<TEntity> entity);
Task<bool> DeleteByIds(int[] ids);
Task<bool> DeleteById(object id);
......
using Models.SqlModel;
using Common.Utility.Model;
using Models.ReqModel;
using Models.SqlModel;
using Models.Table;
using System;
using System.Collections.Generic;
......@@ -10,6 +12,12 @@ namespace Services.Interface
{
public interface IPoliceService : IBaseServices<Police>
{
/// <summary>
/// 修改基础信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
int UpdateInfo(InfoList model);
}
}
using Models.SqlModel;
using AutoMapper;
using Common.Utility.Model;
using Models.ReqModel;
using Models.SqlModel;
using Models.Table;
using Repositories.IRepository.IBussiness;
using Repositories.Repository.Bussiness;
using Services.Interface;
using System;
using System.Collections.Generic;
......@@ -19,5 +23,12 @@ namespace Services
_policeRepository = policeRepository;
}
public int UpdateInfo(InfoList model)
{
throw new NotImplementedException();
}
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论