|
|
|
@ -599,7 +599,8 @@ public class CommonService : ICommonService
|
|
|
|
|
public async Task<DataResult<List<RouteItem>>> GetClientUserPermissionByToken()
|
|
|
|
|
{
|
|
|
|
|
List<RouteItem> list = new List<RouteItem>();
|
|
|
|
|
_logger.LogInformation("GetClientUserPermissionByToken临时日志:user.UserId={userId}", user.UserId);
|
|
|
|
|
_logger.LogInformation("GetClientUserPermissionByToken临时日志:user.UserId={userId},user.TenantId={TenantId},user.GetTenantId={GetTenantId}", user.UserId, user.TenantId, user.GetTenantId());
|
|
|
|
|
|
|
|
|
|
var userId = long.Parse(user.UserId);
|
|
|
|
|
|
|
|
|
|
var userInfo = await db.Queryable<SysUser>().Where(x => x.Id == userId).FirstAsync();
|
|
|
|
@ -864,7 +865,7 @@ public class CommonService : ICommonService
|
|
|
|
|
|
|
|
|
|
var roleIds = await db.Queryable<SysRoleUser>().Where(x => x.UserId == userId).Select(x => x.RoleId).ToListAsync();
|
|
|
|
|
if (roleIds.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
return await Task.FromResult(DataResult<List<RouteItem>>.Failed("该用户未绑定角色!"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -928,11 +929,11 @@ public class CommonService : ICommonService
|
|
|
|
|
childs.Distinct();
|
|
|
|
|
//排序
|
|
|
|
|
childs = childs.OrderBy(x => x.SortCode).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
item.Children = childs;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// list = list.OrderBy(x => x.Id).ToList();
|
|
|
|
|
return await Task.FromResult(DataResult<List<RouteItem>>.Success("获取数据成功!", list));
|
|
|
|
|
}
|
|
|
|
@ -1178,7 +1179,7 @@ public class CommonService : ICommonService
|
|
|
|
|
.Select(x => new CodePortSelectRes()
|
|
|
|
|
{
|
|
|
|
|
PinYinCode = !String.IsNullOrEmpty(x.EdiCode) ? x.EdiCode + "/" + x.PortName : x.PortName,
|
|
|
|
|
},true)
|
|
|
|
|
}, true)
|
|
|
|
|
.Take(20)
|
|
|
|
|
.WithCache(SqlSugarCacheConst.Port + user.TenantId)
|
|
|
|
|
.ToListAsync();
|
|
|
|
@ -1404,9 +1405,10 @@ public class CommonService : ICommonService
|
|
|
|
|
|
|
|
|
|
if (rule == null) return db.Queryable<T>();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
rule = rules.Find(x => x.Id == ruleUser.RuleId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -1960,7 +1962,7 @@ public class CommonService : ICommonService
|
|
|
|
|
break;
|
|
|
|
|
//case "variable": //变量方式 TODO
|
|
|
|
|
// sequenceNewNo += item.RuleValue;
|
|
|
|
|
//break;
|
|
|
|
|
//break;
|
|
|
|
|
case "shortdate": //短日期 年2位月2位日期2位
|
|
|
|
|
sequenceNewNo += DateTime.Now.ToString("yyyyMMdd").Substring(2);
|
|
|
|
|
break;
|
|
|
|
@ -2018,7 +2020,7 @@ public class CommonService : ICommonService
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 计数 方式 重置规则
|
|
|
|
|
/// </summary>
|
|
|
|
@ -2154,7 +2156,7 @@ public class CommonService : ICommonService
|
|
|
|
|
case "variable": //变量方式 TODO
|
|
|
|
|
if (item.RuleValue == "UserNumber")
|
|
|
|
|
{
|
|
|
|
|
var userInfo = await db.Queryable<SysUser>().FirstAsync(x => x.Id ==long.Parse(user.UserId));
|
|
|
|
|
var userInfo = await db.Queryable<SysUser>().FirstAsync(x => x.Id == long.Parse(user.UserId));
|
|
|
|
|
if (userInfo.UserNumber.IsNull())
|
|
|
|
|
{
|
|
|
|
|
return await Task.FromResult(DataResult<string>.Failed("该用户编码未维护!"));
|
|
|
|
@ -2188,7 +2190,7 @@ public class CommonService : ICommonService
|
|
|
|
|
if (businessSeq.IsNull())
|
|
|
|
|
{
|
|
|
|
|
businessSeq = new BusinessSequence()
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
SequenceId = sequence.Id,
|
|
|
|
|
Prefix = prefix,
|
|
|
|
|
CurrentNo = num
|
|
|
|
@ -2222,7 +2224,7 @@ public class CommonService : ICommonService
|
|
|
|
|
sequence.CurrentReset = DateTime.Now.ToString("yyyyMMdd");
|
|
|
|
|
businessSeq.CurrentCode = sequenceNewNo;
|
|
|
|
|
businessSeq.CurrentReset = DateTime.Now.ToString("yyyyMMdd");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await db.Updateable(sequence).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
await tenantDb.Storageable(businessSeq).ExecuteCommandAsync();
|
|
|
|
@ -2251,7 +2253,7 @@ public class CommonService : ICommonService
|
|
|
|
|
private static int CurrentReset(SysSequence seq, SysSequenceRule seqRule, BusinessSequence businessSeq, SqlSugarScopeProvider tenantDb)
|
|
|
|
|
{
|
|
|
|
|
int newNo = 0, ruleNo = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
ruleNo = seqRule.RuleValue.ToInt();
|
|
|
|
@ -2303,7 +2305,7 @@ public class CommonService : ICommonService
|
|
|
|
|
|
|
|
|
|
if (newNo == 0)
|
|
|
|
|
{
|
|
|
|
|
if (businessSeq.IsNull()|| businessSeq.CurrentNo == 0)
|
|
|
|
|
if (businessSeq.IsNull() || businessSeq.CurrentNo == 0)
|
|
|
|
|
{
|
|
|
|
|
newNo = ruleNo;
|
|
|
|
|
}
|
|
|
|
|