jianghaiqing 4 months ago
commit 93b68f598a

@ -16,6 +16,7 @@ using Mapster;
using Microsoft.AspNetCore.Identity;
using DS.Module.Core.Constants;
using Microsoft.AspNetCore.Http;
using Newtonsoft.Json;
namespace DS.WMS.Core.Op.Method
{
@ -52,13 +53,20 @@ namespace DS.WMS.Core.Op.Method
{
try
{
if (req.Count == 0)
// 当BusinessId不为空时将BusinessId的值转为订舱主键否则仍然使用BookingId作为订舱记录主键
if (!string.IsNullOrEmpty(req[0].BusinessId))
{
return;
if (long.TryParse(req[0].BusinessId, out long itemBusinessId))
{
req[0].BookingId = itemBusinessId;
}
else
{
_logger.Error($"在将item.BusinessId转为BookingId时发生异常货运动态插入失败item.BusinessId的值为{req[0].BusinessId}");
return;
}
}
_logger.Info($"货运动态回调:"+ JsonConvert.SerializeObject(req));
//订舱状态
var dicList = db.Queryable<SysDictData>().Where(x => x.TypeId == 1788810332945387520).ToList();
foreach (var item in req)
@ -77,12 +85,14 @@ namespace DS.WMS.Core.Op.Method
continue;
}
}
var tenantId= accessor.HttpContext.Request.Headers["PushBackKey"].FirstOrDefault();
var tenantId = accessor.HttpContext.Request.Headers["PushBackKey"].FirstOrDefault();
var tenantDb = saasService.GetBizDbScopeById(tenantId);
var businessId = item.BookingId;
//TODO
var list = await tenantDb.Queryable<BookingStatus>().Filter(null, true)
.InnerJoin<SysDictData>((d, t) => d.StatusCode == t.Value && d.StatusGroup == "booking_status_group_billtrace" && d.BusinessId == businessId).Select((d, t) => new
.InnerJoin<SysDictData>((d, t) => d.StatusCode == t.Value && t.TypeId == 1788810332945387520 && d.StatusGroup == "booking_status_group_billtrace"
&& d.BusinessId == businessId, "shippingweb8_dev.sys_dict_data")
.Select((d, t) => new
{
BusinessId = d.BusinessId,
StatusCode = d.StatusCode,
@ -100,10 +110,16 @@ namespace DS.WMS.Core.Op.Method
//}).ToListAsync();
var oldLog = await tenantDb.Queryable<BookingStatusLog>().Where(x => x.BusinessId == businessId && x.Group == "yunzong").FirstAsync();
if (oldLog.IsNotNull()) {
//删除日志详情和日志
var oldLogDetails = await tenantDb.Queryable<BookingStatusLogDetail>().Where(x => x.PId == oldLog.Id).ToListAsync();
if (oldLogDetails.Count > 0)
{
await tenantDb.Deleteable(oldLogDetails).ExecuteCommandAsync();
}
await tenantDb.Deleteable(oldLog).ExecuteCommandAsync();
}
#region 日志
//新增数据
@ -450,7 +466,7 @@ namespace DS.WMS.Core.Op.Method
#endregion
}
}
}
catch (Exception ex)
{

@ -114,6 +114,7 @@ namespace DS.WMS.Core.Op.Method
billdto.PWD = userPwd;
billdto.url = resUrl;
billdto.Gid = userId;
billdto.PushBackKey = user.TenantId;//根据回传的租户Id回调
var json = billdto.ToJsonString();
var postData =new { msg = json };
@ -163,7 +164,7 @@ namespace DS.WMS.Core.Op.Method
Key = userKey,
PWD = userPwd,
Gid = userId,
PushBackKey= user.TenantId.ToString(),
PushBackKey= user.TenantId,
};
foreach (var item in req)
{

@ -24,7 +24,7 @@ public class UserReq
/// <summary>
/// 密码
/// </summary>
[RegularExpression(pattern:@"^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[^\da-zA-Z]).{8,}$",ErrorMessage ="8")]
//[RegularExpression(pattern:@"^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[^\da-zA-Z]).{8,}$",ErrorMessage ="密码至少要包含8个字符同时包含至少一个大写字母、一个小写字母、一个数字和一个特殊字符")]
public string Password { get; set; }
/// <summary>

@ -1,4 +1,5 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Sys.Dtos;
namespace DS.WMS.Core.Sys.Interface;
@ -32,4 +33,12 @@ public interface IUserService
/// <param name="code"></param>
/// <returns></returns>
public Task<DataResult> CheckUserCode(string code);
/// <summary>
/// 删除用户
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public Task<DataResult> BatchDelUser(IdModel req);
}

@ -1,7 +1,10 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.Module.Core.Extensions;
using DS.Module.Core.Helpers;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Sys.Dtos;
using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.Sys.Interface;
@ -114,7 +117,6 @@ public class UserService : IUserService
}
}
#endregion
var data = model.MapTo<UserReq, SysUser>();
@ -150,7 +152,7 @@ public class UserService : IUserService
}
if (model.LaneIds.Count() > 0)
{
foreach (var item in model.OrgIds)
foreach (var item in model.LaneIds)
{
var laneUser = new SysUserLane
{
@ -263,4 +265,39 @@ public class UserService : IUserService
return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess);
}
}
/// <summary>
/// 删除用户
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public async Task<DataResult> BatchDelUser(IdModel req)
{
if (req.Ids.Contains(long.Parse(user.UserId)))
{
return await Task.FromResult(DataResult.Failed("不能删除本人账号!"));
}
var list = await db.Queryable<SysUser>().Where(x => req.Ids.Contains(x.Id)).ToListAsync();
if (list.Count > 0)
{
foreach (var item in list)
{
var roleUsers = await db.Queryable<SysRoleUser>().Where(x => x.UserId == item.Id).ToListAsync();
if (roleUsers.Count > 0)
await db.Deleteable(roleUsers).ExecuteCommandAsync();
var orgUsers = await db.Queryable<SysOrgUser>().Where(x => x.UserId == item.Id).ToListAsync();
if (orgUsers.Count > 0)
await db.Deleteable(orgUsers).ExecuteCommandAsync();
var userLanes = await db.Queryable<SysUserLane>().Where(x => x.UserId == item.Id).ToListAsync();
if (userLanes.Count > 0)
await db.Deleteable(userLanes).ExecuteCommandAsync();
}
await db.Deleteable(list).ExecuteCommandAsync();
}
return await Task.FromResult(DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess));
}
}

@ -1,4 +1,5 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Sys.Dtos;
using DS.WMS.Core.Sys.Interface;
using Microsoft.AspNetCore.Mvc;
@ -72,4 +73,17 @@ public class UserController : ApiController
var res = await _invokeService.CheckUserCode(code);
return res;
}
/// <summary>
/// 批量删除用户
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("BatchDelUser")]
public async Task<DataResult> BatchDelUser([FromBody] IdModel req)
{
var res =await _invokeService.BatchDelUser(req);
return res;
}
}
Loading…
Cancel
Save