using IO.Swagger.Api; using MyCode.Project.Domain.Businesses.BillKeeping; using MyCode.Project.Domain.Message.Act.SalesSheetPay; using MyCode.Project.Domain.Message.Act.User; using MyCode.Project.Domain.Message.Common; using MyCode.Project.Domain.Message.Request.Million; using MyCode.Project.Domain.Message.Request.User; using MyCode.Project.Domain.Message.Response.CouponActivity; using MyCode.Project.Infrastructure.Cache; using MyCode.Project.Infrastructure.Common; using MyCode.Project.Services; using System; using System.Collections.Generic; using System.Threading; using System.Web.Http; namespace MyCode.Project.WebApi.Controllers { /// /// 调度对接的接口 /// public class TaskController : BaseAPIController { private IBillKeepingService _billKeepingService; private IReportTaskService _reportTaskService; private IMessageTaskService _messageTaskService; private IMillionShopExtensionService _millionShopExtensionService; private IStorageService _storageService; private ISalesSheetPayService _salesSheetPayService; private IBasicDataApi _basicDataApi; private ICouponActivityService _couponActivityService; private ISalesSheetService _salesSheetService; private IUserService _userService; private IMyCodeCacheService _myCodeCacheService; private IWorkProcessService _workProcessService; public TaskController(IBillKeepingService billKeepingService , IReportTaskService reportTaskService , IMessageTaskService messageTaskService , IMillionShopExtensionService millionShopExtensionService , IStorageService storageService , IUserService userService , ISalesSheetPayService salesSheetPayService , IMyCodeCacheService myCodeCacheService , IWorkProcessService workProcessService , ISalesSheetService salesSheetService , ICouponActivityService couponActivityService) { _couponActivityService = couponActivityService; _salesSheetService = salesSheetService; _userService = userService; _basicDataApi = new BasicDataApi(); _billKeepingService = billKeepingService; _reportTaskService = reportTaskService; _messageTaskService = messageTaskService; _millionShopExtensionService = millionShopExtensionService; _storageService = storageService; _salesSheetPayService = salesSheetPayService; _myCodeCacheService = myCodeCacheService; _workProcessService = workProcessService; } #region SetMemberExpenses(计算一条订单的业绩) /// /// 计算一条订单的业绩 /// /// [HttpPost] [AllowAnonymous] public void SetMemberExpenses(MemberExpensesAct act) { string json = JsonHelper.ToJson(act); _billKeepingService.SetMemberExpenses(json); } #endregion #region SalesSheetComplete(销售订单完成逻辑) /// /// 销售订单完成逻辑 /// /// /// /// [HttpGet] [AllowAnonymous] public void SalesSheetComplete(Guid sheetId, string key, string meiTuanCode = null) { if (key == "FFC4E219-6155-439D-9967-F54DE651094A") _salesSheetPayService.SalesSheetComplete(sheetId, meiTuanCode); } #endregion #region GetCouponListsForSalesSheet(销售订单获取可用优惠券列表) /// /// 销售订单获取可用优惠券列表 /// /// /// [HttpGet] [AllowAnonymous] public List GetCouponListsForSalesSheet(string sheetId, string key) { if (key == "FFC4E219-6155-439D-9967-F54DE651094A") return _salesSheetService.GetCouponListsForSalesSheet(Guid.Parse(sheetId)); else return null; } #endregion #region GetCouponListsForPresalesSalesSheet(预售订单获取可用优惠券列表) /// /// 预售订单获取可用优惠券列表 /// /// /// [HttpGet] [AllowAnonymous] public List GetCouponListsForPresalesSalesSheet(string sheetId, string key) { if (key == "FFC4E219-6155-439D-9967-F54DE651094A") return _salesSheetService.GetCouponListsForPresalesSalesSheet(Guid.Parse(sheetId)); else return null; } #endregion #region GetCouponListsForPresalesSalesSheet(添加优惠券活动自动派发优惠券的调度任务) /// /// 添加优惠券活动自动派发优惠券的调度任务 /// /// /// [HttpGet] [AllowAnonymous] public void AutoSendMemberCouponList(string activityId, string key) { if (key == "FFC4E219-6155-439D-9967-F54DE651094A") _couponActivityService.AutoSendMemberCouponList(Guid.Parse(activityId)); else return; } #endregion #region CalculateStatusTypeTask(定期更新会员的活跃状态和不活跃天数) /// /// 定期更新会员的活跃状态和不活跃天数 /// [HttpGet] [AllowAnonymous] public void CalculateStatusTypeTask(string key) { if (key == "FFC4E219-6155-439D-9967-F54DE651094A") _userService.CalculateStatusTypeTask(); } #endregion /************************************************/ //#region ///// ///// 批量计算时间范围内的所有订单的业绩中间报表数 ///// ///// ///// //[AllowAnonymous] //[HttpGet] //public void BatchSetMemberExpenses(DateTime begin, DateTime end) //{ // _billKeepingService.BatchSetMemberExpenses(begin, end); //} //#endregion //#region SetShopDayKPI(调度计算当天默认的店员指标) ///// ///// 调度计算当天默认的店员指标 ///// //[HttpGet] //[AllowAnonymous] //public void SetShopDayKPI(string jsonstring) //{ // _reportTaskService.SetShopDayKPI(jsonstring); //} //#endregion //#region SetShopDayEx(调度计算当天默认的店员拓客指标) ///// ///// 调度计算当天默认的店员拓客指标 ///// //[HttpPost] //[AllowAnonymous] //public void SetShopDayEx(JsonStringReq jsonstring) //{ // _reportTaskService.SetShopDayEx(jsonstring.jsonstring); //} //#endregion //#region SetShopDayInvite(调度计算当天默认的店员邀约指标) ///// ///// 调度计算当天默认的店员邀约指标 ///// //[HttpGet] //[AllowAnonymous] //public void SetShopDayInvite(string jsonstring) //{ // _reportTaskService.SetShopDayInvite(jsonstring); //} //#endregion //#region SetShopDayNurse(调度计算当天默认的店员护理指标) ///// ///// 调度计算当天默认的店员护理指标 ///// //[HttpGet] //[AllowAnonymous] //public void SetShopDayNurse(string jsonstring) //{ // _reportTaskService.SetShopDayNurse(jsonstring); //} //#endregion //#region SetShopDayNurse(调度计算当天默认的店员体验指标) ///// ///// 调度计算当天默认的店员体验指标 ///// //[HttpGet] //[AllowAnonymous] //public void SetShopDayExperience(string jsonstring) //{ // _reportTaskService.SetShopDayExperience(jsonstring); //} //#endregion //#region AutoSetKPI(自动计算指标数据) ///// ///// 自动计算指标数据 ///// //[HttpGet] //[AllowAnonymous] //public void AutoSetKPI() //{ // _reportTaskService.AutoSetKPI(); //} //#endregion //#region SetShopKPIAudit(零点自动审核昨天业绩) ///// ///// 零点自动审核昨天业绩 ///// //[HttpGet] //[AllowAnonymous] //public void SetShopKPIAudit(string shopId) //{ // _reportTaskService.SetShopKPIAudit(shopId); //} //#endregion //#region SetShopExAudit(自动审核当天拓客) ///// ///// 自动审核当天拓客 ///// //[HttpGet] //[AllowAnonymous] //public void SetShopExAudit(string shopId) //{ // _reportTaskService.SetShopExAudit(shopId); //} //#endregion //#region SetShopInviteAudit(零点自动审核昨天邀约) ///// ///// 零点自动审核昨天邀约 ///// //[HttpGet] //[AllowAnonymous] //public void SetShopInviteAudit(string shopId) //{ // _reportTaskService.SetShopInviteAudit(shopId); //} //#endregion //#region SetShopExperienceAudit(自动审核当天体验) ///// ///// 自动审核当天体验 ///// //[HttpGet] //[AllowAnonymous] //public void SetShopExperienceAudit(string shopId) //{ // _reportTaskService.SetShopExperienceAudit(shopId); //} //#endregion //#region SetShopNurseAudit(零点自动审核昨天护理) ///// ///// 零点自动审核昨天护理 ///// //[HttpGet] //[AllowAnonymous] //public void SetShopNurseAudit(string shopId) //{ // _reportTaskService.SetShopNurseAudit(shopId); //} //#endregion //#region SetShopMonthKPI(添加到调度生成店铺业绩计算方式) ///// ///// 添加到调度生成店铺业绩计算方式 ///// //[HttpGet] //[AllowAnonymous] //public void SetShopMonthKPI() //{ // _reportTaskService.SetShopMonthKPI(); //} //#endregion //#region SetShopMonthKPI(添加到调度生成店铺业绩计算方式) ///// ///// 添加到调度生成店铺业绩计算方式 ///// //[HttpGet] //[AllowAnonymous] //public void AutoSetShopMonthKPI(string jsonstring) //{ // _reportTaskService.AutoSetShopMonthKPI(jsonstring); //} //#endregion //#region SendMemberOrder(添加到调度会员预约到店) ///// ///// 自动计算指标数据 ///// //[HttpGet] //[AllowAnonymous] //public void SendMemberOrder() //{ // _storageService.SendMemberOrder(); //} //#endregion //#region AutoAuditMillionPolicyTxt(把过了打造时间的作战方案审核掉) ///// ///// 把过了打造时间的作战方案审核掉 ///// //[HttpGet] //[AllowAnonymous] //public void AutoAuditMillionPolicyTxt() //{ // _reportTaskService.AutoAuditMillionPolicyTxt(); //} //#endregion //#region SendManagerAudit(调度发送消息给店长:当天业绩审核提醒) ///// ///// 调度发送消息给店长:当天业绩审核提醒 ///// ///// 店铺ID //[HttpGet] //[AllowAnonymous] //public void SendManagerAudit(string jsonstring) //{ // _messageTaskService.SendManagerAudit(jsonstring); //} //#endregion //#region SendBirthRemind(调度发送消息给店长、店员:会员生日提醒) ///// ///// 调度发送消息给店长、店员:会员生日提醒 ///// //[HttpPost] //[AllowAnonymous] //public void SendBirthRemind(string jsonstring) //{ // _messageTaskService.SendBirthRemind(jsonstring); //} //#endregion //#region SendBirthRemindProcess(调度发送消息给店长、店员:会员生日提醒) ///// ///// 调度发送消息给店长、店员:会员生日提醒 ///// //[HttpPost] //[AllowAnonymous] //public void SendBirthRemindProcess() //{ // _storageService.SendBirthRemind(); //} //#endregion //#region SendTodaySalesPerformance(门店今日业绩消息推送:(对象是店长)) ///// ///// 门店今日业绩消息推送:(对象是店长) ///// ///// //[HttpGet] //[AllowAnonymous] //public void SendTodaySalesPerformance(string jsonstring) //{ // _millionShopExtensionService.SendTodaySalesPerformance(jsonstring); //} //#endregion //#region SendTodaySalesPerforClerk(门店今日业绩消息推送:(对象是店员)) ///// ///// 门店今日业绩消息推送:(对象是店员) ///// ///// //[HttpGet] //[AllowAnonymous] //public void SendTodaySalesPerforClerk(string jsonstring) //{ // _millionShopExtensionService.SendTodaySalesPerforClerk(jsonstring); //} //#endregion //#region SendTodaySalesPerformanceCustomer(门店今日业绩消息推送:(对象是加盟商)) ///// ///// 门店今日业绩消息推送:(对象是加盟商) ///// ///// //[HttpGet] //[AllowAnonymous] //public void SendTodaySalesPerformanceCustomer(string jsonstring) //{ // _millionShopExtensionService.SendTodaySalesPerformanceCustomer(jsonstring); //} //#endregion //#region SendTodayKPI(添加到调度发送消息给店长、店员、加盟商:当天业绩信息) ///// /////添加到调度发送消息给店长、店员、加盟商:当天业绩信息 ///// //[HttpGet] //[AllowAnonymous] //public void SendTodayKPI() //{ // _millionShopExtensionService.SendTodayKPI(); //} //#endregion //#region SendInStorage(店铺商品入库通知) ///// ///// 店铺商品入库通知 ///// //[HttpPost] //[AllowAnonymous] //public void SendInStorage(string jsonstring) //{ // _storageService.SendInStorage(jsonstring); //} //#endregion //#region SendOutStorage(店铺商品出库通知) ///// ///// 店铺商品出库通知 ///// //[HttpPost] //[AllowAnonymous] //public void SendOutStorage(string jsonstring) //{ // _storageService.SendOutStorage(jsonstring); //} //#endregion //#region SendService(顾客剩余服务次数提醒) ///// ///// 顾客剩余服务次数提醒:(对象是店长、店员,在剩余小于两次服务的情况下发送提醒消息) ///// ///// //[HttpPost] //[AllowAnonymous] //public void SendService(SendServiceRequest request) //{ // _storageService.SendService(request); //} //#endregion //#region SendServiceTask(顾客剩余服务次数提醒) ///// ///// 顾客剩余服务次数提醒:(对象是店长、店员,在剩余小于两次服务的情况下发送提醒消息) ///// ///// //[HttpGet] //[AllowAnonymous] //public void SendServiceTask(string jsonstring) //{ // _storageService.SendServiceTask(jsonstring); //} //#endregion //#region DataProcessingForSendService(处理发送服务次数提醒的数据并添加到调度) ///// ///// 处理发送服务次数提醒的数据并添加到调度 ///// ///// //public void DataProcessingForSendService(List memberServiceBookBillKeepingDtos) //{ // _storageService.DataProcessingForSendService(memberServiceBookBillKeepingDtos); //} //#endregion //#region ProcessForOutStorage(测试调度测试发送出库通知提醒) /////// /////// 测试调度测试发送出库通知提醒 /////// ////[HttpPost] ////[AllowAnonymous] ////public void ProcessForOutStorage() ////{ //// _storageService.ProcessForOutStorage(); ////} //#endregion //#region SendMemberOrder(测试调度测试发送入库通知提醒) /////// /////// 测试调度测试发送入库通知提醒 /////// ////[HttpPost] ////[AllowAnonymous] ////public void ProcessForInStorage() ////{ //// _storageService.ProcessForInStorage(); ////} //#endregion //#region SendInvitationSuccessNotification(邀请成功通知(接收对象是分享者)) ///// ///// 邀请成功通知(接收对象是分享者) ///// ///// //[HttpGet] //[AllowAnonymous] //public void SendInvitationSuccessNotification(string invitationSuccessNotification) //{ // _messageTaskService.SendInvitationSuccessNotification(invitationSuccessNotification); //} //#endregion //#region SendCouponClaimSuccessNotification(优惠券领取成功通知(接收对象是受赠人)) ///// ///// 优惠券领取成功通知(接收对象是受赠人) ///// ///// //[HttpGet] //[AllowAnonymous] //public void SendCouponClaimSuccessNotification(string couponClaimSuccessNotification) //{ // _messageTaskService.SendCouponClaimSuccessNotification(couponClaimSuccessNotification); //} //#endregion //#region SendProductExchangeSuccessNotification( 商品兑换成功通知(接收对象是分享者)) ///// ///// 商品兑换成功通知(接收对象是分享者) ///// ///// //[HttpGet] //[AllowAnonymous] //public void SendProductExchangeSuccessNotification(string productExchangeSuccessNotification) //{ // _messageTaskService.SendProductExchangeSuccessNotification(productExchangeSuccessNotification); //} //#endregion //#region SaveShopPerformance(调度保存所有店铺的昨天套餐售卖情况数据) ///// ///// 调度保存所有店铺的昨天套餐售卖情况数据 ///// //[HttpGet] //[AllowAnonymous] //public void SaveShopPerformance(DateTime? days = null) //{ // int i = 0; // while (i < 1) // { // string daystring = null; // if (days != null) // { // days = days.Value.AddDays(-1); // daystring = days.Value.ToString("yyyy-MM-dd"); // } // _millionShopExtensionService.SaveShopPerformance(daystring); // //Thread.Sleep(1000); // i++; // } //} //#endregion //#region 添加发送核销服务的短信调度 ///// ///// 添加发送核销服务的短信调度 ///// ///// //[HttpPost] //[AllowAnonymous] //public void SendSmsServiceFinishTemplateTask(IdKeyActs acts) //{ // _workProcessService.Add(Guid.Parse("00000000-0000-0000-0000-000000000009"), "SendSmsServiceFinishTemplate", "发送核销服务短信", acts.Ids); //} //#endregion //[HttpGet] //[AllowAnonymous] //public void testnc() //{ // var result = _basicDataApi.BasicDataGetTopSku("1", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjYxNTcyMzE4NzU2LCJsb2dpbiI6eyJFbnZpcm9ubWVudCI6ImRldiIsIlN5c3RlbUNvZGUiOjF9fQ.I1olpmZKF0Gzk886tdH6Tc32yyT5YDkkgwOKlXEPV0o"); //} //#region SetMemberRelationship(设置关系链的调度) ///// ///// 设置关系链的调度 ///// ///// //[AllowAnonymous] //[HttpPost] //public void SetMemberRelationship(MemberRelationshipAct act) //{ // _userService.SetMemberRelationship(act); //} //#endregion //#region SendActivityPeopleFull(蓝铜胜肽补水修复旅行装变更通知) ///// ///// 蓝铜胜肽补水修复旅行装变更通知 ///// ///// //[AllowAnonymous] //[HttpGet] //public void SendActivityPeopleFull(string jsonstring) //{ // _messageTaskService.SendActivityPeopleFull(jsonstring); //} //#endregion //#region BatchRefreshNewMemberFlag(批量刷新会员营销顾问关系的新会员标记) ///// ///// 批量刷新会员营销顾问关系的新会员标记 ///// //[HttpGet] //[AllowAnonymous] //public void BatchRefreshNewMemberFlag() //{ // _userService.BatchRefreshNewMemberFlag(); //} //#endregion //#region BatchRefreshrExpensesRecordFlag(批量刷新订单业绩的新会员标记) ///// ///// 批量刷新订单业绩的新会员标记 ///// //[HttpGet] //[AllowAnonymous] //public void BatchRefreshrExpensesRecordFlag() //{ // _userService.BatchRefreshrExpensesRecordFlag(); //} //#endregion //#region BatchRefreshrMemberActivityLogFlag(批量刷新会员领活动的新会员标记) ///// ///// 批量刷新会员领活动的新会员标记 ///// //[HttpGet] //[AllowAnonymous] //public void BatchRefreshrMemberActivityLogFlag() //{ // _userService.BatchRefreshrMemberActivityLogFlag(); //} //#endregion //#region SendAddMaterialWarehouseMesg(调度发送上传素材库通知(接收人是已开通智慧门店的店长、加盟商、加盟商子账号)) ///// ///// 调度发送上传素材库通知(接收人是已开通智慧门店的店长、加盟商、加盟商子账号) ///// //[HttpGet] //[AllowAnonymous] //public void SendAddMaterialWarehouseMesg(string id) //{ // _messageTaskService.SendAddMaterialWarehouseMesg(id); //} //#endregion //#region TeShuTuiKuan(指定在线支付流水全额原路退款,一单多次重复收款专用) ///// ///// 指定在线支付流水全额原路退款,一单多次重复收款专用 ///// ///// ///// ///// //[HttpGet] //[AllowAnonymous] //public void TeShuTuiKuan(Guid id, Guid shopId, string key) //{ // //if (key == "FFC4E219-6155-439D-9967-F54DE651094A") // // _salesSheetPayService.TeShuTuiKuan(id, shopId); //} //#endregion } }