|
@@ -1,6 +1,17 @@
|
|
|
+using Aspose.Cells;
|
|
|
using EyeSoft.Messanging;
|
|
|
+using Microsoft.EntityFrameworkCore.Metadata;
|
|
|
+using Microsoft.Extensions.Configuration.UserSecrets;
|
|
|
+using OASystem.Domain;
|
|
|
+using OASystem.Domain.Entities.Customer;
|
|
|
+using OASystem.Domain.Entities.Financial;
|
|
|
+using OASystem.Domain.Entities.Groups;
|
|
|
+using Org.BouncyCastle.Asn1.Cmp;
|
|
|
using System.Collections;
|
|
|
using static OASystem.API.OAMethodLib.GeneralMethod;
|
|
|
+using static OpenAI.GPT3.ObjectModels.SharedModels.IOpenAiModels;
|
|
|
+using static QRCoder.PayloadGenerator;
|
|
|
+using static Quartz.Logging.OperationName;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
|
{
|
|
@@ -27,16 +38,25 @@ namespace OASystem.API.Controllers
|
|
|
private readonly SetDataTypeRepository _setDataTypeRep;
|
|
|
private readonly UserAuthorityRepository _UserAuthorityRepository;
|
|
|
|
|
|
-
|
|
|
private readonly List<int> _operationTypeList = new List<int>() { 1, 2, 3, 4, 5 }; //操作通知所属类型
|
|
|
private readonly List<int> _taskTypeList = new List<int>() { 6 };//任务通知 TaskNotification
|
|
|
|
|
|
- public SystemController(CompanyRepository syscom, DepartmentRepository sysDepRep, UsersRepository userRep,
|
|
|
- IMapper mapper, SqlSugarClient sqlSugar, SetDataRepository setDataRepository, CompanyRepository companyRepository,
|
|
|
- SystemMenuPermissionRepository systemMenuPermissionRepository, PageFunctionPermissionRepository pageFunctionPermissionRepository,
|
|
|
- SystemMenuAndFunctionRepository systemMenuAndFunctionRepository, JobPostAuthorityRepository jobPostAuthorityRepository,
|
|
|
- JobPostRepository jobRep, UserAuthorityRepository userAuthorityRepository, MessageRepository messageRep, SetDataTypeRepository setDataTypeRep)
|
|
|
|
|
|
+ public SystemController(CompanyRepository syscom,
|
|
|
+ DepartmentRepository sysDepRep,
|
|
|
+ UsersRepository userRep,
|
|
|
+ IMapper mapper,
|
|
|
+ SqlSugarClient sqlSugar,
|
|
|
+ SetDataRepository setDataRepository,
|
|
|
+ CompanyRepository companyRepository,
|
|
|
+ SystemMenuPermissionRepository systemMenuPermissionRepository,
|
|
|
+ PageFunctionPermissionRepository pageFunctionPermissionRepository,
|
|
|
+ SystemMenuAndFunctionRepository systemMenuAndFunctionRepository,
|
|
|
+ JobPostAuthorityRepository jobPostAuthorityRepository,
|
|
|
+ JobPostRepository jobRep,
|
|
|
+ UserAuthorityRepository userAuthorityRepository,
|
|
|
+ MessageRepository messageRep,
|
|
|
+ SetDataTypeRepository setDataTypeRep )
|
|
|
{
|
|
|
_syscomRep = syscom;
|
|
|
_sysDepRep = sysDepRep;
|
|
@@ -2187,30 +2207,319 @@ And u.UId = {0} And u.FId = 1 ", dto.UserId);
|
|
|
/// 部门首页消息提示
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- [HttpPost]
|
|
|
+ [HttpGet("{portType}")]
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
- public async Task<IActionResult> DepartmentHomePageMessagePrompts(DepartmentHomePageMessagePromptsDto dto)
|
|
|
+ public async Task<IActionResult> DepartmentHomePageMessagePrompts(int portType)
|
|
|
{
|
|
|
- var portType = dto.PortType;
|
|
|
- var depType = dto.DepType;
|
|
|
- var postType = dto.PostType;
|
|
|
if (portType < 1 || portType > 3) return Ok(JsonView(false, MsgTips.Port));
|
|
|
- if (depType < 1 || depType > 3) return Ok(JsonView(false, "请传入有效的DepType参数;1 总经办、2 国交部、3 财务"));
|
|
|
|
|
|
- if (depType == 1) //总经办
|
|
|
- {
|
|
|
- //1、资料数据(市场部客户资源、op地接导游、op地接车数据、商邀数据、团组收款数据)
|
|
|
- //2、费用未审核(日付申请未审核数据、团组费用未审核数据)数据提示Range(固定上个月)2、费用提示Range(固定本年)
|
|
|
+ if (portType == 1 || portType == 2 || portType == 3) // web
|
|
|
+ {
|
|
|
+ //总经办
|
|
|
+ //1、资料数据(市场部客户资源、op地接导游、op地接车数据、商邀数据、团组收款数据)数据提示Range(固定上个月) -- Add
|
|
|
+ //固定查询时间(当前月的上月)
|
|
|
+ var lastMoth = DateTime.Now.AddMonths(-1);
|
|
|
+ var (startDate, endDate) = CommonFun.GetMonthStartAndEndDates(lastMoth.Year, lastMoth.Month);
|
|
|
+ var startDateTime = Convert.ToDateTime(startDate.ToString("yyyy-MM-dd 00:00:00"));
|
|
|
+ var endDateTime = Convert.ToDateTime(endDate.ToString("yyyy-MM-dd 23:59:59"));
|
|
|
+
|
|
|
+ #region 市场部客户资源
|
|
|
+ //1.1 市场部客户资源
|
|
|
+ var users = await _sqlSugar.Queryable<Sys_Users>()
|
|
|
+ .LeftJoin<Sys_Department>((u, d) => u.DepId == d.Id)
|
|
|
+ .Where((u, d) => u.IsDel == 0 && (d.DepName.Contains("市场部") || u.Id == 21))
|
|
|
+ .Select((u, d) => new { u.Id, u.CnName })
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
+ var marketData = await _sqlSugar.Queryable<Crm_NewClientData>()
|
|
|
+ .LeftJoin<Sys_Users>((ncd, u) => ncd.CreateUserId == u.Id)
|
|
|
+ .Where((ncd, u) => ncd.IsDel == 0 && ncd.CreateTime >= startDateTime && ncd.CreateTime <= endDateTime)
|
|
|
+ .Select((ncd, u) => new
|
|
|
+ {
|
|
|
+ Area = ncd.Location,
|
|
|
+ ncd.Client,
|
|
|
+ ncd.Contact,
|
|
|
+ ncd.Job,
|
|
|
+ Tel = ncd.Telephone,
|
|
|
+ ncd.CreateUserId,
|
|
|
+ CreatleUserName = u.CnName,
|
|
|
+ ncd.CreateTime,
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+ var marketDataGroup = marketData.GroupBy(x => x.CreateUserId).Select(g => new { CreateUserId = g.Key, Items = g.ToList(), Count = g.Count() });
|
|
|
+
|
|
|
+ var marketData2 = new List<dynamic>();
|
|
|
+ foreach (var user in users)
|
|
|
+ {
|
|
|
+ var userMarketData = marketDataGroup.FirstOrDefault(x => user.Id == x.CreateUserId);
|
|
|
+ if (userMarketData != null)
|
|
|
+ {
|
|
|
+ marketData2.Add(new
|
|
|
+ {
|
|
|
+ uId = user.Id,
|
|
|
+ name = user.CnName,
|
|
|
+ count = userMarketData.Count,
|
|
|
+ msgTips = $"上月新增市场客户资源共{userMarketData.Count}条",
|
|
|
+ userMarketData = userMarketData.Items
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ marketData2.Add(new
|
|
|
+ {
|
|
|
+ uId = user.Id,
|
|
|
+ name = user.CnName,
|
|
|
+ count = 0,
|
|
|
+ msgTips = $"上月新增市场客户资源共{0}条",
|
|
|
+ userMarketData = new List<dynamic>() { },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ var marketData1 = new
|
|
|
+ {
|
|
|
+ msgTips = $"上月新增市场客户资源共{marketData.Count}条",
|
|
|
+ Data = marketData2,
|
|
|
+ };
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region op地接导游
|
|
|
+ //1.2 op地接导游
|
|
|
+ var opTourGuideData = await _sqlSugar.Queryable<Res_LocalGuideData>()
|
|
|
+ .LeftJoin<Sys_Users>((lgd, u) => lgd.CreateUserId == u.Id)
|
|
|
+ .Where((lgd, u) => lgd.IsDel == 0 && lgd.CreateTime >= startDateTime && lgd.CreateTime <= endDateTime)
|
|
|
+ .Select((lgd, u) => new
|
|
|
+ {
|
|
|
+ Area = lgd.UnitArea,
|
|
|
+ Client = lgd.UnitName,
|
|
|
+ lgd.Contact,
|
|
|
+ Job="",
|
|
|
+ Tel = lgd.ContactTel,
|
|
|
+ lgd.CreateUserId,
|
|
|
+ CreatleUserName = u.CnName,
|
|
|
+ lgd.CreateTime,
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+ var opTourGuideDataGroups = opTourGuideData.GroupBy(x => x.CreateUserId)
|
|
|
+ .Select(g => new {
|
|
|
+ uId = g.Key,
|
|
|
+ name = g.ToList().FirstOrDefault()?.CreatleUserName ?? "-",
|
|
|
+ msgTips = $"上月新增OP地接导游资源共{g.Count()}条",
|
|
|
+ userTourGuideData = g.ToList(),
|
|
|
+ Count = g.Count()
|
|
|
+ });
|
|
|
+
|
|
|
+ var opTourGuideData1 = new {
|
|
|
+ msgTips = $"上月新增OP地接导游资源共{opTourGuideData.Count}条",
|
|
|
+ Data = opTourGuideDataGroups,
|
|
|
+ };
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region op车数据
|
|
|
+ //1.3 op车数据
|
|
|
+ var opCarData = await _sqlSugar.Queryable<Res_CarData>()
|
|
|
+ .LeftJoin<Sys_Users>((cd, u) => cd.CreateUserId == u.Id)
|
|
|
+ .Where((cd, u) => cd.IsDel == 0 && cd.CreateTime >= startDateTime && cd.CreateTime <= endDateTime)
|
|
|
+ .Select((cd, u) => new
|
|
|
+ {
|
|
|
+ Area = cd.UnitArea,
|
|
|
+ Client = cd.UnitName,
|
|
|
+ cd.Contact,
|
|
|
+ Job = "",
|
|
|
+ Tel = cd.ContactTel,
|
|
|
+ cd.CreateUserId,
|
|
|
+ CreatleUserName = u.CnName,
|
|
|
+ cd.CreateTime,
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+ var opCarDataGroups = opCarData.GroupBy(x => x.CreateUserId)
|
|
|
+ .Select(g => new {
|
|
|
+ uId = g.Key,
|
|
|
+ name = g.ToList().FirstOrDefault()?.CreatleUserName ?? "-",
|
|
|
+ msgTips = $"上月新增OP地接车资源共{g.Count()}条",
|
|
|
+ userTourGuideData = g.ToList(),
|
|
|
+ Count = g.Count()
|
|
|
+ });
|
|
|
+ var opCarData1 = new
|
|
|
+ {
|
|
|
+ msgTips = $"上月新增OP地接车资源共{opCarData.Count}条",
|
|
|
+ Data = opCarDataGroups,
|
|
|
+ };
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 商邀数据
|
|
|
+ //1.4 商邀数据
|
|
|
+ var invitationData = await _sqlSugar.Queryable<Res_InvitationOfficialActivityData>()
|
|
|
+ .LeftJoin<Sys_Users>((ioa, u) => ioa.CreateUserId == u.Id)
|
|
|
+ .Where((ioa, u) => ioa.IsDel == 0 && ioa.CreateTime >= startDateTime && ioa.CreateTime <= endDateTime)
|
|
|
+ .Select((ioa, u) => new
|
|
|
+ {
|
|
|
+ //Area = string.Format("{0}{1}", ioa.Country, !string.IsNullOrEmpty(ioa.City) ? "" : "-" + ioa.City),
|
|
|
+ Area = string.Format("{0}{1}", ioa.Country,ioa.City),
|
|
|
+ Client = ioa.UnitName,
|
|
|
+ ioa.Contact,
|
|
|
+ ioa.Job,
|
|
|
+ ioa.Tel,
|
|
|
+ ioa.CreateUserId,
|
|
|
+ CreatleUserName = u.CnName,
|
|
|
+ ioa.CreateTime,
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+ var invitationGroups = invitationData.GroupBy(x => x.CreateUserId)
|
|
|
+ .Select(g => new {
|
|
|
+ uId = g.Key,
|
|
|
+ name = g.ToList().FirstOrDefault()?.CreatleUserName ?? "-",
|
|
|
+ msgTips = $"上月新增商邀资源共{g.Count()}条",
|
|
|
+ userTourGuideData = g.ToList(),
|
|
|
+ Count = g.Count()
|
|
|
+ });
|
|
|
+ var invitationData1 = new
|
|
|
+ {
|
|
|
+ msgTips = $"上月新增商邀资源共{invitationData.Count}条",
|
|
|
+ Data = invitationGroups,
|
|
|
+ };
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 团组收款数据
|
|
|
+ //1.5 团组收款数据
|
|
|
+ var groupCollectionData = await _sqlSugar.Queryable<Fin_ForeignReceivables>()
|
|
|
+ .LeftJoin<Sys_Users>((fr, u) => fr.CreateUserId == u.Id)
|
|
|
+ .LeftJoin<Grp_DelegationInfo>((fr, u, di) => fr.Diid == di.Id)
|
|
|
+ .LeftJoin<Sys_SetData>((fr, u, di, sd) => fr.Currency == sd.Id)
|
|
|
+ .Where((fr, u, di, sd) => fr.IsDel == 0 && fr.CreateTime >= startDateTime && fr.CreateTime <= endDateTime)
|
|
|
+ .Select((fr, u, di, sd) => new
|
|
|
+ {
|
|
|
+ fr.PriceName,
|
|
|
+ fr.Price,
|
|
|
+ fr.Count,
|
|
|
+ fr.Unit,
|
|
|
+ fr.ItemSumPrice,
|
|
|
+ Currency = sd.Name,
|
|
|
+ GroupName = di.TeamName,
|
|
|
+ fr.CreateUserId,
|
|
|
+ CreateUserName = u.CnName,
|
|
|
+ fr.CreateTime,
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+ var groupCollectionGroups = groupCollectionData.GroupBy(x => x.CreateUserId)
|
|
|
+ .Select(g => new
|
|
|
+ {
|
|
|
+ uId = g.Key,
|
|
|
+ name = g.ToList().FirstOrDefault()?.CreateUserName ?? "-",
|
|
|
+ msgTips = $"上月累计团组收款共{g.Count()}条",
|
|
|
+ userTourGuideData = g.ToList(),
|
|
|
+ Count = g.Count()
|
|
|
+ });
|
|
|
+
|
|
|
+ var groupCollectionData2 = new
|
|
|
+ {
|
|
|
+ msgTips = $"上月累计团组收款共{groupCollectionData.Count}条",
|
|
|
+ Data = groupCollectionGroups,
|
|
|
+ };
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //var
|
|
|
+ var materialData = new
|
|
|
+ {
|
|
|
+ marketData = marketData1,
|
|
|
+ opTourGuideData = opTourGuideData1,
|
|
|
+ opCarData = opCarData1,
|
|
|
+ invitationData = invitationData1,
|
|
|
+ groupCollectionData = groupCollectionData2
|
|
|
+ };
|
|
|
+ //2、费用未审核(日付申请未审核数据、团组费用未审核数据)费用提示Range(固定本年)
|
|
|
+
|
|
|
+ var currStartDate = Convert.ToDateTime($"{DateTime.Now.Year}-01-01 00:00:00");
|
|
|
+ var currEntDate = Convert.ToDateTime($"{DateTime.Now.Year}-12-31 23:59:59");
|
|
|
+
|
|
|
+ #region 日付申请未审核数据
|
|
|
+ var dailyPaymentData = await _sqlSugar.Queryable<Fin_DailyFeePayment>()
|
|
|
+ .LeftJoin<Sys_Users>((dfp, u) => dfp.CreateUserId == u.Id)
|
|
|
+ .Where(dfp => dfp.IsDel == 0 &&
|
|
|
+ dfp.MAudit == 0 &&
|
|
|
+ dfp.CreateTime >= currStartDate &&
|
|
|
+ dfp.CreateTime <= currEntDate
|
|
|
+ )
|
|
|
+ .OrderBy(dfp => dfp.CreateTime, OrderByType.Desc)
|
|
|
+ //.OrderBy(dfp => dfp.FAudit, OrderByType.Desc)
|
|
|
+ .Select((dfp, u) => new
|
|
|
+ {
|
|
|
+ id = dfp.Id,
|
|
|
+ amountName = dfp.Instructions,
|
|
|
+ amount = dfp.SumPrice,
|
|
|
+ fAuditStatus = dfp.FAudit == 1 ? "审核通过" :
|
|
|
+ dfp.FAudit == 2 ? "审核未通过" : "未审核",
|
|
|
+ fAuditDate = dfp.FAuditDate,
|
|
|
+ dfp.CreateUserId,
|
|
|
+ CreateUserName = u.CnName,
|
|
|
+ dfp.CreateTime
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
+ var dailyPaymentGroups = dailyPaymentData.GroupBy(x => x.CreateUserId)
|
|
|
+ .Select(g => new
|
|
|
+ {
|
|
|
+ uId = g.Key,
|
|
|
+ name = g.ToList().FirstOrDefault()?.CreateUserName ?? "-",
|
|
|
+ msgTips = $"本年有{g.Count()}条未审核日常付款申请条",
|
|
|
+ userTourGuideData = g.ToList(),
|
|
|
+ Count = g.Count()
|
|
|
+ });
|
|
|
+
|
|
|
+ var dailyPaymentData1 = new
|
|
|
+ {
|
|
|
+ msgTips = $"本年有{dailyPaymentData.Count()}条未审核日常付款申请条",
|
|
|
+ Data = dailyPaymentGroups,
|
|
|
+ };
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 团组费用未审核数据
|
|
|
+
|
|
|
+ var groupPaymentData = await _sqlSugar.Queryable<Grp_CreditCardPayment>()
|
|
|
+ .LeftJoin<Grp_DelegationInfo>((ccp, di) => ccp.Id == di.Id)
|
|
|
+ .Where((ccp, di) => ccp.IsDel == 0 &&
|
|
|
+ ccp.IsAuditGM == 0 &&
|
|
|
+ ccp.CreateTime >= currStartDate &&
|
|
|
+ ccp.CreateTime <= currEntDate
|
|
|
+ )
|
|
|
+ .Select((ccp, di) => new
|
|
|
+ {
|
|
|
+ ccp.Id,
|
|
|
+ ccp.DIId,
|
|
|
+ GroupName = di.TeamName,
|
|
|
+ ccp.CreateTime,
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
+ var groupPaymentGroups = groupPaymentData.GroupBy(x => x.DIId)
|
|
|
+ .Select(g => new
|
|
|
+ {
|
|
|
+ uId = g.Key,
|
|
|
+ name = g.ToList().FirstOrDefault()?.GroupName ?? "-",
|
|
|
+ msgTips = $"本年有{g.Count()}条未审核团组费用申请条",
|
|
|
+ userTourGuideData = g.ToList(),
|
|
|
+ Count = g.Count()
|
|
|
+ });
|
|
|
+
|
|
|
+ var groupPaymentData1 = new
|
|
|
+ {
|
|
|
+ msgTips = $"本年有{groupPaymentData.Count()}条未审核团组费用申请条",
|
|
|
+ Data = groupPaymentGroups,
|
|
|
+ };
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ var feeUnAuditData = new
|
|
|
+ {
|
|
|
+ dailyPaymentData = dailyPaymentData1,
|
|
|
+ groupPaymentData = groupPaymentData1
|
|
|
+ };
|
|
|
+
|
|
|
+ //国交部
|
|
|
+
|
|
|
+ //财务
|
|
|
+
|
|
|
+ return Ok(JsonView(new { materialData = materialData, feeUnAuditData = feeUnAuditData }));
|
|
|
}
|
|
|
- else if (depType == 2) //国交部
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
- else if (depType == 3)//财务
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
return Ok(JsonView(false));
|
|
|
}
|