Commit 1fa1003f by lcx

Merge branch 'v2020morge' into v2020morge-graphql

parents 17ba6438 2a027676
......@@ -5,11 +5,10 @@
namespace Performance.Infrastructure
{
/// <summary>
/// 类型转换
/// 类型转换
/// </summary>
public static class ConvertHelper
{
public static int TryInt(string inValue, int defaultValue = default(int))
{
int ret = defaultValue;
......@@ -27,7 +26,7 @@ public static long TryLong(string inValue, long defaultValue = default(int))
public static decimal TryDecimal(string inValue, decimal defaultValue = default(decimal))
{
decimal ret = defaultValue;
decimal.TryParse(inValue, out ret);
decimal.TryParse(inValue, System.Globalization.NumberStyles.Float, default, out ret);
return ret;
}
......@@ -38,7 +37,6 @@ public static DateTime TryDateTime(string inValue, DateTime defaultValue = defau
return ret;
}
/// <summary>
/// 返回默认值
/// </summary>
......@@ -70,10 +68,8 @@ public static T To<T>(object value, T defaultValue = default(T))
}
}
/// <summary>
///
///
/// </summary>
/// <typeparam name = "T"></typeparam>
/// <param name = "value">The value.</param>
......@@ -95,7 +91,5 @@ public static T To<T>(object value, T defaultValue, bool ignoreException)
}
return To<T>(value);
}
}
}
\ No newline at end of file
}
......@@ -560,7 +560,21 @@ private List<ComputeResponse> GetSecondPerformance(int allotId)
var again = _perforAgcomputeRepository.GetEntities(t => t.AllotId == allotId);
if (again != null && again.Any())
{
var group = again
var disAgains = again.Select(w => new
{
w.AllotId,
w.SecondId,
w.UnitType,
w.Department,
w.WorkPost,
w.JobNumber,
w.PersonName,
w.PerforSumFee,
w.OthePerfor,
w.NightWorkPerfor,
w.RealGiveFee
}).Distinct();
var group = disAgains
.GroupBy(t => new { t.UnitType, t.Department, t.WorkPost, t.JobNumber, t.PersonName })
.Select(t =>
{
......
......@@ -41,7 +41,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{
object @object = row.GetCell(point).GetValue();
if (item.IsNumber)
@object = ConvertHelper.To<decimal?>(@object);
@object = ConvertHelper.TryDecimal(@object?.ToString());
if (dic.Keys.Contains(item.Field))
dic[item.Field] = @object;
......
......@@ -109,6 +109,24 @@ public UserIdentity GetUser(int userId)
}
/// <summary>
/// 获取用户第一个角色
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public sys_role GetUserFirstRole(int userId)
{
var user = _userRepository.GetEntity(t => t.ID == userId);
if (user == null)
throw new PerformanceException("用户信息查询失败");
var userrole = _userroleRepository.GetEntity(t => t.UserID == userId);
if (userrole == null)
throw new PerformanceException("角色信息查询失败");
var role = _roleRepository.GetEntity(t => t.ID == userrole.RoleID);
return role;
}
/// <summary>
/// 查询用户列表
/// </summary>
/// <param name="userID"></param>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment