|
@@ -26,6 +26,10 @@ using NetTaste;
|
|
|
using OASystem.Domain.ViewModels.QiYeWeChat;
|
|
|
using NPOI.POIFS.Crypt.Dsig;
|
|
|
using EyeSoft.SequentialIdentity;
|
|
|
+using Microsoft.Extensions.Configuration;
|
|
|
+using System.Text.Json;
|
|
|
+using OASystem.RedisRepository;
|
|
|
+using OASystem.RedisRepository.RedisAsyncHelper;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
|
{
|
|
@@ -37,6 +41,7 @@ namespace OASystem.API.Controllers
|
|
|
public class StatisticsController : ControllerBase
|
|
|
{
|
|
|
private readonly int _decimalPlaces;
|
|
|
+ private readonly IConfiguration _config;
|
|
|
private readonly IMapper _mapper;
|
|
|
private readonly SqlSugarClient _sqlSugar;
|
|
|
private readonly DelegationInfoRepository _groupRep;
|
|
@@ -51,9 +56,10 @@ namespace OASystem.API.Controllers
|
|
|
/// <param name="sqlSugar"></param>
|
|
|
/// <param name="groupRep"></param>
|
|
|
/// <param name="setDataRep"></param>
|
|
|
- public StatisticsController(IMapper mapper, SqlSugarClient sqlSugar, DelegationInfoRepository groupRep, SetDataRepository setDataRep, TeamRateRepository teamRate, VisitingClientsRepository visitingClientsRep)
|
|
|
+ public StatisticsController(IMapper mapper, IConfiguration config, SqlSugarClient sqlSugar, DelegationInfoRepository groupRep, SetDataRepository setDataRep, TeamRateRepository teamRate, VisitingClientsRepository visitingClientsRep)
|
|
|
{
|
|
|
_mapper = mapper;
|
|
|
+ _config = config;
|
|
|
_groupRep = groupRep;
|
|
|
_setDataRep = setDataRep;
|
|
|
_sqlSugar = sqlSugar;
|
|
@@ -2917,20 +2923,111 @@ Order By Count Desc");
|
|
|
55,// 大运会
|
|
|
};
|
|
|
|
|
|
+ var dailypaymentTypeData = await RedisRepository.RedisFactory
|
|
|
+ .CreateRedisRepository()
|
|
|
+ .StringGetAsync<List<int>>("DailypaymentTypeData") ?? new List<int>();
|
|
|
+
|
|
|
var _view = await _sqlSugar.Queryable<DailypaymentParentTypeView>()
|
|
|
.Includes(x => x.SubData)
|
|
|
.Where(x => defaultParentIds.Contains(x.Id))
|
|
|
.ToListAsync();
|
|
|
+ _view.ForEach(x =>
|
|
|
+ {
|
|
|
+ x.SubData.ForEach(y =>
|
|
|
+ {
|
|
|
+ int currId = dailypaymentTypeData.Find(z => z == y.Id);
|
|
|
+ y.IsChecked = currId == 0 ? false : true;
|
|
|
+ });
|
|
|
+ });
|
|
|
|
|
|
- //return Ok(JsonView(true, "查询成功!", _view, total));
|
|
|
- return Ok(JsonView(false, "查询失败",_view));
|
|
|
-
|
|
|
+ return Ok(JsonView(true, "查询成功!", _view, _view.Count));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return Ok(JsonView(false, "查询失败"));
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 日付类型数据 Save
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="_dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("DailypaymentTypeDataSave")]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> DailypaymentTypeDataSave(DailypaymentTypeDataSaveDto _dto)
|
|
|
+ {
|
|
|
+ #region 参数验证
|
|
|
+ if (_dto.PortType < 1 || _dto.PortType > 3) return Ok(JsonView(false, msg: MsgTips.Port));
|
|
|
+
|
|
|
+ PageFunAuthViewBase pageFunAuthView = new PageFunAuthViewBase();
|
|
|
+ #region 页面操作权限验证
|
|
|
+ //pageFunAuthView = await GeneralMethod.PostUserPageFuncDatas(_dto.UserId, _dto.PageId);
|
|
|
+
|
|
|
+ //if (pageFunAuthView.CheckAuth == 0) return Ok(JsonView(false, "您没有查看权限"));
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #endregion
|
|
|
+ if (_dto.PortType == 1 || _dto.PortType == 2 || _dto.PortType == 3) // web/Android/IOS
|
|
|
+ {
|
|
|
+ if (_dto.TypeIds.Count < 1) return Ok(JsonView(false, "请传入需要保存的TypeIds"));
|
|
|
+
|
|
|
+ var res = await RedisRepository.RedisFactory
|
|
|
+ .CreateRedisRepository()
|
|
|
+ .StringSetAsync(
|
|
|
+ key:"DailypaymentTypeData",
|
|
|
+ _dto.TypeIds,
|
|
|
+ timeout:null );
|
|
|
+
|
|
|
+ if (!res) return Ok(JsonView(false, "操作失败"));
|
|
|
+
|
|
|
+
|
|
|
+ return Ok(JsonView(true, "操作成功!"));
|
|
|
+ }
|
|
|
+ else return Ok(JsonView(false, "操作失败"));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 日付数据列表
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="_dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("DailypaymentTypeDataSave")]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> DailypaymentRange(DailypaymentTypeDataSaveDto _dto)
|
|
|
+ {
|
|
|
+ #region 参数验证
|
|
|
+ if (_dto.PortType < 1 || _dto.PortType > 3) return Ok(JsonView(false, msg: MsgTips.Port));
|
|
|
+
|
|
|
+ PageFunAuthViewBase pageFunAuthView = new PageFunAuthViewBase();
|
|
|
+ #region 页面操作权限验证
|
|
|
+ //pageFunAuthView = await GeneralMethod.PostUserPageFuncDatas(_dto.UserId, _dto.PageId);
|
|
|
+
|
|
|
+ //if (pageFunAuthView.CheckAuth == 0) return Ok(JsonView(false, "您没有查看权限"));
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #endregion
|
|
|
+ if (_dto.PortType == 1 || _dto.PortType == 2 || _dto.PortType == 3) // web/Android/IOS
|
|
|
+ {
|
|
|
+ if (_dto.TypeIds.Count < 1) return Ok(JsonView(false, "请传入需要保存的TypeIds"));
|
|
|
+
|
|
|
+ var res = await RedisRepository.RedisFactory
|
|
|
+ .CreateRedisRepository()
|
|
|
+ .StringSetAsync(
|
|
|
+ key: "DailypaymentTypeData",
|
|
|
+ _dto.TypeIds,
|
|
|
+ timeout: null);
|
|
|
+
|
|
|
+ if (!res) return Ok(JsonView(false, "操作失败"));
|
|
|
+
|
|
|
+
|
|
|
+ return Ok(JsonView(true, "操作成功!"));
|
|
|
+ }
|
|
|
+ else return Ok(JsonView(false, "操作失败"));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
#endregion
|
|
|
}
|
|
|
}
|