jianghaiqing 9 months ago
commit d2834ce700

@ -66,6 +66,7 @@ namespace Myshipping.Application.Event
var repoUser = scope.ServiceProvider.GetRequiredService<SqlSugarRepository<SysUser>>(); var repoUser = scope.ServiceProvider.GetRequiredService<SqlSugarRepository<SysUser>>();
var repoBooking = scope.ServiceProvider.GetRequiredService<SqlSugarRepository<BookingOrder>>(); var repoBooking = scope.ServiceProvider.GetRequiredService<SqlSugarRepository<BookingOrder>>();
var repoFeeRecord = scope.ServiceProvider.GetRequiredService<SqlSugarRepository<BookingFeeRecord>>(); var repoFeeRecord = scope.ServiceProvider.GetRequiredService<SqlSugarRepository<BookingFeeRecord>>();
var repoTenantParamValue = scope.ServiceProvider.GetRequiredService<SqlSugarRepository<DjyTenantParamValue>>();
var cache = scope.ServiceProvider.GetRequiredService<ISysCacheService>(); var cache = scope.ServiceProvider.GetRequiredService<ISysCacheService>();
var typeStr = $"{bsType}_{sendType}"; var typeStr = $"{bsType}_{sendType}";
@ -73,13 +74,13 @@ namespace Myshipping.Application.Event
var idToDo = idList.Except(dbFeeRecord).ToList(); var idToDo = idList.Except(dbFeeRecord).ToList();
var sysCfg = await cache.GetAllSysConfig(); var sysCfg = await cache.GetAllSysConfig();
var feeUrl = sysCfg.FirstOrDefault(x => x.Code == "djyFeeApiUrl"); var feeUrl = sysCfg.FirstOrDefault(x => x.Code == "djyFeeApiUrl");
var feeUserId = sysCfg.FirstOrDefault(x => x.Code == "djyFeeApiUserId"); //var feeUserId = sysCfg.FirstOrDefault(x => x.Code == "djyFeeApiUserId");
var feeKey = sysCfg.FirstOrDefault(x => x.Code == "djyFeeApiKey"); //var feeKey = sysCfg.FirstOrDefault(x => x.Code == "djyFeeApiKey");
if (feeKey == null || string.IsNullOrEmpty(feeUrl.Value) if (feeUrl == null || string.IsNullOrEmpty(feeUrl.Value))
|| feeUserId == null || string.IsNullOrEmpty(feeUserId.Value) //|| feeUserId == null || string.IsNullOrEmpty(feeUserId.Value)
|| feeKey == null || string.IsNullOrEmpty(feeKey.Value)) //|| feeKey == null || string.IsNullOrEmpty(feeKey.Value))
{ {
var errMsg = "大简云扣费URL和KEY未配置"; var errMsg = "大简云扣费URL未配置";
_logger.LogError(errMsg); _logger.LogError(errMsg);
DingTalkGroupHelper.SendDingTalkGroupMessage("bookingFeeNotify", "扣费失败提醒", errMsg); DingTalkGroupHelper.SendDingTalkGroupMessage("bookingFeeNotify", "扣费失败提醒", errMsg);
return; return;
@ -90,6 +91,21 @@ namespace Myshipping.Application.Event
var order = await repoBooking.AsQueryable().Filter(null, true).FirstAsync(x => x.Id == id); var order = await repoBooking.AsQueryable().Filter(null, true).FirstAsync(x => x.Id == id);
var iptId = string.IsNullOrEmpty(order.OPID) ? order.CreatedUserId.Value : Convert.ToInt64(order.OPID); var iptId = string.IsNullOrEmpty(order.OPID) ? order.CreatedUserId.Value : Convert.ToInt64(order.OPID);
var user = await repoUser.AsQueryable().Filter(null, true).FirstAsync(x => x.Id == iptId); var user = await repoUser.AsQueryable().Filter(null, true).FirstAsync(x => x.Id == iptId);
var keyList = await repoTenantParamValue.AsQueryable()
.Filter(null, true)
.Where(x => x.TenantId == order.TenantId && (x.ParaCode == "BOOKING_FEE_USERID" || x.ParaCode == "BOOKING_FEE_USERKEY"))
.ToListAsync();
if (keyList.Count < 2)
{
var errMsg = $"未找到{order.MBLNO}({id})所在租户的授权userid和key无法调用扣费";
_logger.LogError(errMsg);
DingTalkGroupHelper.SendDingTalkGroupMessage("bookingFeeNotify", "扣费失败提醒", errMsg);
continue;
}
var feeUserId = keyList.First(x => x.ParaCode == "BOOKING_FEE_USERID").ItemCode;
var feeUserKey = keyList.First(x => x.ParaCode == "BOOKING_FEE_USERKEY").ItemCode;
if (user == null || string.IsNullOrEmpty(user.DjyUserId)) if (user == null || string.IsNullOrEmpty(user.DjyUserId))
{ {
var errMsg = $"未找到{order.MBLNO}({id})的用户信息,无法调用扣费"; var errMsg = $"未找到{order.MBLNO}({id})的用户信息,无法调用扣费";
@ -100,11 +116,11 @@ namespace Myshipping.Application.Event
var seconds = DateTime.Now.ToTimeStamp(); var seconds = DateTime.Now.ToTimeStamp();
var runId = Guid.NewGuid().ToString(); var runId = Guid.NewGuid().ToString();
var srcBeforMD5 = $"{runId}{feeUserId.Value}expend{bsType}{sendType}{id}{order.MBLNO}{seconds}{feeKey.Value}"; var srcBeforMD5 = $"{runId}{feeUserId}expend{bsType}{sendType}{id}{order.MBLNO}{seconds}{feeUserKey}";
var postObj = new var postObj = new
{ {
runId, runId,
userId = feeUserId.Value, userId = feeUserId,
module = "expend",//固定 module = "expend",//固定
bsType = $"{bsType}", bsType = $"{bsType}",
sendType = $"{sendType}", sendType = $"{sendType}",

@ -10286,6 +10286,16 @@ namespace Myshipping.Application
} }
} }
/// <summary>
/// 临时补扣费用
/// </summary>
/// <returns></returns>
[HttpGet("/BookingOrder/FeeById"), AllowAnonymous]
public async Task FeeById(List<long> idList, int bsType = 28, int sendtype = 0)
{
await _publisher.PublishAsync(new ChannelEventSource($"Booking:DoFeeRecord", new { bsType = bsType, sendtype = sendtype, idList = idList }));
}
#endregion #endregion
#region 打印船公司ONE的订舱附件 #region 打印船公司ONE的订舱附件
@ -12154,22 +12164,28 @@ namespace Myshipping.Application
UNLocationCode = model.placeOfDeliveryUnLocCode, UNLocationCode = model.placeOfDeliveryUnLocCode,
cityName = model.placeOfDeliveryCityName, cityName = model.placeOfDeliveryCityName,
}, },
selectedRoute = new MSKAPIBookingRoute { selectedRoute = new MSKAPIBookingRoute
bookingSchedules = new MSKAPIBookingSchedules { {
bookingSchedules = new MSKAPIBookingSchedules
{
originDepartureDateTimeLocal = model.originDepartureDateTimeLocal.Value.ToString("yyyy-MM-dd"), originDepartureDateTimeLocal = model.originDepartureDateTimeLocal.Value.ToString("yyyy-MM-dd"),
destinationArrivalDateTimeLocal = model.destinationArrivalDateTimeLocal.Value.ToString("yyyy-MM-dd"), destinationArrivalDateTimeLocal = model.destinationArrivalDateTimeLocal.Value.ToString("yyyy-MM-dd"),
transportMode = new MSKAPIBookingTransportMode { transportMode = new MSKAPIBookingTransportMode
vessel = new MSKAPIBookingTransportModeVessel { {
vessel = new MSKAPIBookingTransportModeVessel
{
name = model.vesselName, name = model.vesselName,
maerskVesselCode = model.carrierVesselCode, maerskVesselCode = model.carrierVesselCode,
}, },
exportVoyageNumber = model.exportVoyageNumber, exportVoyageNumber = model.exportVoyageNumber,
}, },
startLocation = new MSKAPIBookingRouteDetailsBase { startLocation = new MSKAPIBookingRouteDetailsBase
{
cityName = model.placeOfReceiptCityName, cityName = model.placeOfReceiptCityName,
UNLocationCode = model.placeOfReceiptUnLocCode UNLocationCode = model.placeOfReceiptUnLocCode
}, },
endLocation= new MSKAPIBookingRouteDetailsBase { endLocation = new MSKAPIBookingRouteDetailsBase
{
cityName = model.placeOfDeliveryCityName, cityName = model.placeOfDeliveryCityName,
UNLocationCode = model.placeOfDeliveryUnLocCode UNLocationCode = model.placeOfDeliveryUnLocCode
}, },
@ -12209,7 +12225,8 @@ namespace Myshipping.Application
{ {
model.ctns.ForEach(ctn => model.ctns.ForEach(ctn =>
{ {
MSKAPIBookingEquipmentAndHaulage haulage = new MSKAPIBookingEquipmentAndHaulage { MSKAPIBookingEquipmentAndHaulage haulage = new MSKAPIBookingEquipmentAndHaulage
{
equipmentDetails = new MSKAPIBookingEquipmentAndHaulageItem(), equipmentDetails = new MSKAPIBookingEquipmentAndHaulageItem(),
stuffingDetails = new List<MSKAPIBookingStuffingdetails>() stuffingDetails = new List<MSKAPIBookingStuffingdetails>()
}; };
@ -12217,7 +12234,8 @@ namespace Myshipping.Application
haulage.equipmentDetails.ISOEquipmentCode = ctn.ctnCode; haulage.equipmentDetails.ISOEquipmentCode = ctn.ctnCode;
haulage.equipmentDetails.equipmentQuantity = ctn.ctnNum; haulage.equipmentDetails.equipmentQuantity = ctn.ctnNum;
haulage.stuffingDetails.Add(new MSKAPIBookingStuffingdetails { haulage.stuffingDetails.Add(new MSKAPIBookingStuffingdetails
{
stuffingValue = (int)ctn.ctnSufferWeight.Value, stuffingValue = (int)ctn.ctnSufferWeight.Value,
stuffingMeasurementType = "WEIGHT", stuffingMeasurementType = "WEIGHT",
stuffingMeasurementUnit = "KGS" stuffingMeasurementUnit = "KGS"
@ -12234,7 +12252,7 @@ namespace Myshipping.Application
_bookingDeliveryRecordRep.Insert(recordInfo); _bookingDeliveryRecordRep.Insert(recordInfo);
if(recordCtnList.Count > 0) if (recordCtnList.Count > 0)
{ {
recordCtnList.ForEach(async x => recordCtnList.ForEach(async x =>
{ {
@ -12493,5 +12511,6 @@ namespace Myshipping.Application
return list; return list;
} }
#endregion #endregion
} }
} }

@ -65,7 +65,7 @@ namespace Myshipping.Application
// 如果费用中含有机密费用,再判断是否有查询的权限 // 如果费用中含有机密费用,再判断是否有查询的权限
if (feeRecords.Any(r => !r.IsOpen)) if (feeRecords.Any(r => !r.IsOpen))
{ {
bool canReviewSecretFee = await _sysUserRoleService.IsUserInRole(UserManager.UserId, CommonConst.SECRET_FEE_REVIEW); bool canReviewSecretFee = await _sysUserRoleService.IsUserInRole(UserManager.UserId, CommonConst.ROLE_SECRET_FEE_REVIEW);
if (!canReviewSecretFee) if (!canReviewSecretFee)
{ {
feeRecords.RemoveAll(r => !r.IsOpen && r.CreatedUserId != UserManager.UserId); feeRecords.RemoveAll(r => !r.IsOpen && r.CreatedUserId != UserManager.UserId);

@ -227,9 +227,14 @@ public class CommonConst
#region 角色Code #region 角色Code
/// <summary> /// <summary>
/// 机密费用检阅角色 /// 机密费用检阅角色Code
/// </summary> /// </summary>
public const string SECRET_FEE_REVIEW = "SecretFeeReview"; public const string ROLE_SECRET_FEE_REVIEW = "SecretFeeReview";
/// <summary>
/// 普通员工角色Code
/// </summary>
public const string ROLE_COMMON_EMPLOYEE = "CommonEmployee";
#endregion #endregion
#region 费用 #region 费用
@ -245,17 +250,22 @@ public class CommonConst
#region 系统运行方式 #region 系统运行方式
/// <summary> /// <summary>
/// 标准模式 /// 和川(会执行一些和川特有的逻辑)
/// </summary>
public const string RUN_TYPE_HECHUAN = "HeChuan";
/// <summary>
/// 标准模式(自用)
/// </summary> /// </summary>
public const string RUN_TYPE_NORMAL = "NORMAL"; public const string RUN_TYPE_NORMAL = "Normal";
/// <summary> /// <summary>
/// 客户订舱-客户端 /// 客户订舱系统-客户端
/// </summary> /// </summary>
public const string RUN_TYPE_CUST = "CUST"; public const string RUN_TYPE_CUST = "CUST";
/// <summary> /// <summary>
/// 客户订舱-大简云运营端 /// 客户订舱系统-大简云运营端
/// </summary> /// </summary>
public const string RUN_TYPE_DJY = "DJY"; public const string RUN_TYPE_DJY = "DJY";
#endregion #endregion

@ -792,9 +792,14 @@
删除字段 删除字段
</summary> </summary>
</member> </member>
<member name="F:Myshipping.Core.CommonConst.SECRET_FEE_REVIEW"> <member name="F:Myshipping.Core.CommonConst.ROLE_SECRET_FEE_REVIEW">
<summary> <summary>
机密费用检阅角色 机密费用检阅角色Code
</summary>
</member>
<member name="F:Myshipping.Core.CommonConst.ROLE_COMMON_EMPLOYEE">
<summary>
普通员工角色Code
</summary> </summary>
</member> </member>
<member name="F:Myshipping.Core.CommonConst.CACHE_KEY_FEE_CODE"> <member name="F:Myshipping.Core.CommonConst.CACHE_KEY_FEE_CODE">
@ -807,19 +812,24 @@
币别缓存键 币别缓存键
</summary> </summary>
</member> </member>
<member name="F:Myshipping.Core.CommonConst.RUN_TYPE_HECHUAN">
<summary>
和川(会执行一些和川特有的逻辑)
</summary>
</member>
<member name="F:Myshipping.Core.CommonConst.RUN_TYPE_NORMAL"> <member name="F:Myshipping.Core.CommonConst.RUN_TYPE_NORMAL">
<summary> <summary>
标准模式 标准模式(自用)
</summary> </summary>
</member> </member>
<member name="F:Myshipping.Core.CommonConst.RUN_TYPE_CUST"> <member name="F:Myshipping.Core.CommonConst.RUN_TYPE_CUST">
<summary> <summary>
客户订舱-客户端 客户订舱系统-客户端
</summary> </summary>
</member> </member>
<member name="F:Myshipping.Core.CommonConst.RUN_TYPE_DJY"> <member name="F:Myshipping.Core.CommonConst.RUN_TYPE_DJY">
<summary> <summary>
客户订舱-大简云运营端 客户订舱系统-大简云运营端
</summary> </summary>
</member> </member>
<member name="F:Myshipping.Core.Const.MenuConst.MenuBookingOrder"> <member name="F:Myshipping.Core.Const.MenuConst.MenuBookingOrder">
@ -15772,6 +15782,13 @@
<param name="input"></param> <param name="input"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Myshipping.Core.Service.SysRoleService.GetRoleIdByRoleCode(System.String)">
<summary>
根据角色Code查询角色主键
</summary>
<param name="roleCode">角色Code</param>
<returns>角色主键</returns>
</member>
<member name="T:Myshipping.Core.Service.TenantInput"> <member name="T:Myshipping.Core.Service.TenantInput">
<summary> <summary>
租户参数 租户参数

@ -11,6 +11,7 @@ public interface ISysRoleService
Task DeleteRole(DeleteRoleInput input); Task DeleteRole(DeleteRoleInput input);
Task<string> GetNameByRoleId(long roleId); Task<string> GetNameByRoleId(long roleId);
Task<dynamic> GetRoleDropDown(); Task<dynamic> GetRoleDropDown();
Task<long?> GetRoleIdByRoleCode(string roleCode);
Task<SysRole> GetRoleInfo([FromQuery] QueryRoleInput input); Task<SysRole> GetRoleInfo([FromQuery] QueryRoleInput input);
Task<dynamic> GetRoleList([FromQuery] RoleInput input); Task<dynamic> GetRoleList([FromQuery] RoleInput input);
Task<List<long>> GetUserDataScopeIdList(List<long> roleIdList, long orgId); Task<List<long>> GetUserDataScopeIdList(List<long> roleIdList, long orgId);

@ -148,7 +148,7 @@ public class SysRoleService : ISysRoleService, IDynamicApiController, ITransient
var sysRole = await _sysRoleRep.FirstOrDefaultAsync(u => u.Id == input.Id); var sysRole = await _sysRoleRep.FirstOrDefaultAsync(u => u.Id == input.Id);
if (sysRole.IsNullOrZero()) if (sysRole.IsNullOrZero())
throw Oops.Oh(ErrorCode.D1006); throw Oops.Oh(ErrorCode.D1006);
if (sysRole.RoleType==RoleType.AdminRole) if (sysRole.RoleType == RoleType.AdminRole)
throw Oops.Oh("请勿删除管理员角色"); throw Oops.Oh("请勿删除管理员角色");
try try
{ {
@ -333,4 +333,14 @@ public class SysRoleService : ISysRoleService, IDynamicApiController, ITransient
{ {
return await _sysRoleDataScopeService.GetRoleDataScopeIdList(new List<long> { input.Id }); return await _sysRoleDataScopeService.GetRoleDataScopeIdList(new List<long> { input.Id });
} }
/// <summary>
/// 根据角色Code查询角色主键
/// </summary>
/// <param name="roleCode">角色Code</param>
/// <returns>角色主键</returns>
public async Task<long?> GetRoleIdByRoleCode(string roleCode)
{
return await _sysRoleRep.AsQueryable(x => x.Code == roleCode).Select(x => x.Id).FirstAsync();
}
} }

@ -9,12 +9,19 @@ namespace Myshipping.Core.Service.User.Dto
public class SysDataUserMenuDto public class SysDataUserMenuDto
{ {
public long UserId { get; set; } public long UserId { get; set; }
public List<children> childrens { get; set; } public List<children> childrens { get; set; }
} }
public class children public class children
{ {
public children() { }
public children(long menuId, DataScopeType dataScopeType, bool isEdit)
{
MenuId = menuId;
DataScopeType = dataScopeType;
IsEdit = isEdit;
}
public long MenuId { get; set; } public long MenuId { get; set; }
public DataScopeType DataScopeType { get; set; } public DataScopeType DataScopeType { get; set; }
@ -24,7 +31,8 @@ namespace Myshipping.Core.Service.User.Dto
public bool IsEdit { get; set; } public bool IsEdit { get; set; }
} }
public class RightList { public class RightList
{
public long UserId { get; set; } public long UserId { get; set; }

@ -22,6 +22,7 @@ using System.Web;
using System.Text; using System.Text;
using Furion.EventBus; using Furion.EventBus;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Myshipping.Core.Const;
namespace Myshipping.Core.Service; namespace Myshipping.Core.Service;
@ -39,6 +40,8 @@ public class SysUserService : ISysUserService, IDynamicApiController, ITransient
private readonly ISysUserRoleService _sysUserRoleService; private readonly ISysUserRoleService _sysUserRoleService;
private readonly ISysEmpPosService _sysEmpPosService; private readonly ISysEmpPosService _sysEmpPosService;
private readonly IEventPublisher _publisher; private readonly IEventPublisher _publisher;
private readonly ISysDataUserMenu _sysDataUserMenu;
private readonly ISysRoleService _sysRoleService;
public SysUserService(SqlSugarRepository<SysUser> sysUserRep, public SysUserService(SqlSugarRepository<SysUser> sysUserRep,
ISysCacheService sysCacheService, ISysCacheService sysCacheService,
@ -47,7 +50,9 @@ public class SysUserService : ISysUserService, IDynamicApiController, ITransient
ISysUserRoleService sysUserRoleService, ISysUserRoleService sysUserRoleService,
ISysConfigService sysConfigService, ISysConfigService sysConfigService,
ISysEmpPosService sysEmpPosService, ISysEmpPosService sysEmpPosService,
IEventPublisher publisher) IEventPublisher publisher,
ISysDataUserMenu sysDataUserMenu,
ISysRoleService sysRoleService)
{ {
_sysUserRep = sysUserRep; _sysUserRep = sysUserRep;
_sysCacheService = sysCacheService; _sysCacheService = sysCacheService;
@ -57,6 +62,8 @@ public class SysUserService : ISysUserService, IDynamicApiController, ITransient
_sysConfigService = sysConfigService; _sysConfigService = sysConfigService;
_sysEmpPosService = sysEmpPosService; _sysEmpPosService = sysEmpPosService;
_publisher = publisher; _publisher = publisher;
_sysDataUserMenu = sysDataUserMenu;
_sysRoleService = sysRoleService;
} }
/// <summary> /// <summary>
@ -122,6 +129,32 @@ public class SysUserService : ISysUserService, IDynamicApiController, ITransient
input.SysEmpParam.Id = newUser.Id.ToString(); input.SysEmpParam.Id = newUser.Id.ToString();
// 增加员工信息 // 增加员工信息
await _sysEmpService.AddOrUpdate(input.SysEmpParam); await _sysEmpService.AddOrUpdate(input.SysEmpParam);
// 如果当前运行模式为和川,则进行一些初始化操作
if (App.Configuration["RunType"] == CommonConst.RUN_TYPE_HECHUAN)
{
// 绑定角色:普通员工
long? roleId = await _sysRoleService.GetRoleIdByRoleCode(CommonConst.ROLE_COMMON_EMPLOYEE);
if (roleId != null)
{
await _sysUserRoleService.GrantRole(new UpdateUserInput()
{
Id = newUser.Id,
GrantRoleIdList = new List<long>() { (long)roleId }
});
}
// 授权"订舱台账"菜单的数据范围
var userMenuDto = new User.Dto.SysDataUserMenuDto()
{
UserId = newUser.Id,
childrens = new List<User.Dto.children>() {
new(MenuConst.MenuBookingOrder, DataScopeType.DEPT_WITH_CHILD, true)
}
};
await _sysDataUserMenu.GrantData(userMenuDto);
}
_sysUserRep.CurrentCommitTran(); _sysUserRep.CurrentCommitTran();
await _sysCacheService.DelByPatternAsync(CommonConst.CACHE_KEY_USERSDATASCOPE); await _sysCacheService.DelByPatternAsync(CommonConst.CACHE_KEY_USERSDATASCOPE);
} }

@ -56,7 +56,7 @@
}, },
"Cache": { "Cache": {
"CacheType": "RedisCache", // RedisCache "CacheType": "RedisCache", // RedisCache
"RedisConnectionString": "192.168.0.247:6379,password=,defaultDatabase=11" "RedisConnectionString": "127.0.0.1:6379,password=,defaultDatabase=11"
}, },
"SnowId": { "SnowId": {
"WorkerId": "1" // 0~63,1 "WorkerId": "1" // 0~63,1

@ -38,5 +38,12 @@
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"Urls": "http://localhost:5120", "Urls": "http://localhost:5120",
"RunType": "NORMAL" //CUSTDJYNORMAL
/* **********RunType**********
HeChuan
Normal
CUST -
DJY -
*/
"RunType": "HeChuan"
} }
Loading…
Cancel
Save