using MyCode.Project.Domain.Config;
using MyCode.Project.Domain.Dtos.Request.Act;
using MyCode.Project.Domain.Message.Request.DouYin;
using MyCode.Project.Domain.Message.Request.Report40;
using MyCode.Project.Domain.Message.Request.User;
using MyCode.Project.Domain.Message.Response.DouYin;
using MyCode.Project.Domain.Message.Response.Message;
using MyCode.Project.Domain.Message.Response.Report40;
using MyCode.Project.Domain.Message.Response.User;
using MyCode.Project.Domain.Message.Response.Wechat;
using MyCode.Project.Infrastructure.Cache;
using MyCode.Project.Infrastructure.Common;
using MyCode.Project.Infrastructure.Constant;
using MyCode.Project.Infrastructure.Exceptions;
using MyCode.Project.Infrastructure.PayModels;
using MyCode.Project.Infrastructure.WebPost;
using MyCode.Project.OutSideService;
using MyCode.Project.Services;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Senparc.Weixin.TenPay;
using Senparc.Weixin.TenPay.V3;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Web.Http;
namespace MyCode.Project.WebApi.Controllers
{
///
/// 测试接口
///
public class TestController : BaseAPIController
{
#region
private readonly IWorkProcessService _workProcessService;
private readonly IMyCodeCacheService _myCodeCacheService;
private readonly IDingDingService _dingDingService;
private readonly IMiNiProService _miNiProService;
private ISalesSheetPayService _salesSheetPayService;
private IMemberService _memberService;
private IRedisService _redisService;
private ICourseTopicsService _courseTopicsService;
private IMemberMiniService _memberMiniService;
private IBillKeepingService _billKeepingService;
private IUserService _userService;
private IMemberServiceInvService _memberServiceInvService;
private IHuLiHuShao40Service _huLiHuShao40Service;
private ICouponMemberHistoryService _couponMemberHistoryService;
private IActivityService _activityService;
private ICouponActivityService _couponActivityService;
private IMaterialWarehouseService _materialWarehouseService;
private IRpShopUseAppletDataService _rpShopUseAppletDataService;
private IDouYinService _douYinService;
private IMemberRelationshipTaskService _memberRelationshipTaskService;
private IReport2301Service _report2301Service;
private IReport2303Service _report2303Service;
//private ITempUrlLogService _targetSetService;
private IWeChatPublicService _weChatPublicService;
private IMemberComplimentaryAccountService _memberComplimentaryAccountService;
private IWorkProcessAsyncService _workProcessAsyncService;
public TestController(IWorkProcessService workProcessService,
IMyCodeCacheService myCodeCacheService,
IDingDingService dingDingService,
IMiNiProService miNiProService,
IBillKeepingService billKeepingService,
IUserService userService,
ISalesSheetPayService salesSheetPayService,
IMemberServiceInvService memberServiceInvService,
IMemberMiniService memberMiniService,
IRedisService redisService,
IHuLiHuShao40Service huLiHuShao40Service
, ICouponMemberHistoryService couponMemberHistoryService
, IActivityService activityService
, ICouponActivityService couponActivityService
, IMemberService memberService
, ICourseTopicsService courseTopicsService
, IMaterialWarehouseService materialWarehouseService
, IWeChatPublicService weChatPublicService
, IRpShopUseAppletDataService rpShopUseAppletDataService
, IDouYinService douYinService
, IMemberRelationshipTaskService memberRelationshipTaskService
, IReport2301Service report2301Service
, IReport2303Service report2303Service
, IMemberComplimentaryAccountService memberComplimentaryAccountService
, IWorkProcessAsyncService workProcessAsyncService
//, ITempUrlLogService targetSetService
)
{
_workProcessAsyncService = workProcessAsyncService;
_memberComplimentaryAccountService = memberComplimentaryAccountService;
_report2303Service = report2303Service;
_report2301Service = report2301Service;
_memberRelationshipTaskService = memberRelationshipTaskService;
_douYinService = douYinService;
_rpShopUseAppletDataService = rpShopUseAppletDataService;
_weChatPublicService = weChatPublicService;
_materialWarehouseService = materialWarehouseService;
_courseTopicsService = courseTopicsService;
_memberService = memberService;
_couponMemberHistoryService = couponMemberHistoryService;
_huLiHuShao40Service = huLiHuShao40Service;
_redisService = redisService;
_memberMiniService = memberMiniService;
_salesSheetPayService = salesSheetPayService;
_workProcessService = workProcessService;
_myCodeCacheService = myCodeCacheService;
_dingDingService = dingDingService;
_miNiProService = miNiProService;
_billKeepingService = billKeepingService;
_userService = userService;
_memberServiceInvService = memberServiceInvService;
_activityService = activityService;
_couponActivityService = couponActivityService;
//_targetSetService = targetSetService;
}
#endregion
///
/// 订单发送短信
///
///
[HttpGet]
public void SendSmsTask(string id)
{
_workProcessAsyncService.SendSmsTask(id);
}
//#region restBugDataList()
/////
///// 什么都不是
/////
/////
//[HttpGet]
//public void restBugDataList()
//{
// _memberComplimentaryAccountService.restBugDataList();
//}
//#endregion
#region RiShuJuTongBao(阿明要的每日数据通报)
///
/// 阿明要的每日数据通报
///
///
[HttpGet]
public void RiShuJuTongBao(DateTime days)
{
_memberComplimentaryAccountService.RiShuJuTongBao(days);
}
#endregion
/////
///// 刷业绩记录是否护肤类服务字段
/////
/////
/////
//[HttpGet]
//[AllowAnonymous]
//public void SetHuFu(DateTime begin, DateTime end)
//{
// _billKeepingService.SetHuFu(begin, end);
//}
#region SetMemberComplimentaryAccountBook(设置会员赠送的金额相关业务)
///
/// 设置会员赠送的金额相关业务
///
///
[HttpGet]
[AllowAnonymous]
public void SetMemberComplimentaryAccountBook(string json)
{
_memberComplimentaryAccountService.SetMemberComplimentaryAccountBook(json);
}
#endregion
///
/// 清除指定加盟商的服务次数
///
///
/// 开卡店铺
[HttpGet]
public void ClearServiceInv(Guid? customerId, Guid? shopId)
{
_memberServiceInvService.ClearServiceInv(customerId, shopId);
}
#region ClearIntegralByCustomerId(清零指定加盟商的积分)
///
/// 清零指定加盟商的积分
///
///
/// 截止日期
/// 指定店铺
[HttpGet]
public void ClearIntegralByCustomerId(Guid? customerId, DateTime? days = null, Guid? shopId = null)
{
_billKeepingService.ClearIntegralByCustomerId(customerId, days, shopId);
}
#endregion
///
/// 清除指定加盟商的会员余额
///
///
[HttpGet]
[AllowAnonymous]
public void ClearMemberAccount(Guid? customerId, Guid? shopId = null)
{
_memberServiceInvService.ClearMemberAccount(customerId, shopId);
}
/////
///// 插入初始化某个加盟商下店铺的服务流水
/////
//[HttpGet]
//public void BatchChuShiHua( )
//{
// _memberRelationshipTaskService.BatchChuShiHua( );
//}
#region ChangeCustomerIdForShop(店铺转加盟商)
///
/// 店铺转加盟商
///
/// 新加盟商名字
/// 旧店铺编码
/// 新店铺编码
[HttpGet]
public void ChangeCustomerIdForShop(string customerName, string oldShopCode, string newShopCode)
{
_memberRelationshipTaskService.ChangeCustomerIdForShop(customerName, oldShopCode, newShopCode);
}
#endregion
///
/// 重新计算具体某个店铺某个月的诊断四表的数据
///
///
///
[HttpGet]
public void Save2301ReportData(DateTime begin, Guid? zhiDingShopId)
{
if (zhiDingShopId.HasValue)
_report2303Service.Save2301ReportData(begin, zhiDingShopId.Value);
else
_report2303Service.SaveAllShopReportData(begin);
}
///
/// 补记录计算一条订单的业绩
///
///
///
[HttpGet]
public void BuLuMemberExpenses(DateTime begin, DateTime end, Guid? shopId)
{
_memberRelationshipTaskService.BuLuMemberExpenses(begin, end, shopId);
}
///
/// 计算订单复购还是首单
///
///
[HttpGet]
[AllowAnonymous]
public void TestShouDan(Guid sheetid)
{
_memberRelationshipTaskService.TestShouDan(sheetid);
}
/////
///// 重新计算订单的商品分类业绩报表
/////
/////
/////
//[HttpGet]
//public void ReSetPerformanceRecord(DateTime begin, DateTime end)
//{
// _memberRelationshipTaskService.ReSetPerformanceRecord(begin, end);
//}
/////
///// 修复错误的销售订单明细分摊单价
/////
//[HttpGet]
//public void RepairBusSalesSheetsWrong()
//{
// _memberRelationshipTaskService.RepairBusSalesSheetsWrong();
//}
/////
///// 修复错误的销售订单明细分摊单价2
/////
//[HttpGet]
//public void RepairBusSalesSheetsWrong2()
//{
// _memberRelationshipTaskService.RepairBusSalesSheetsWrong2();
//}
/////
///// 修复错误的预转销销售订单明细分摊单价
/////
//[HttpGet]
//public void RepairBusSalesSheetsYuZhuanXiao()
//{
// _memberRelationshipTaskService.RepairBusSalesSheetsYuZhuanXiao();
//}
/////
///// 修复合计数不对的业绩记录
/////
//[HttpGet]
//public void RepairStaMemberExpensesRecord()
//{
// _memberRelationshipTaskService.RepairStaMemberExpensesRecord();
//}
/////
///// 修复错误的预售订单明细分摊单价
/////
//[HttpGet]
//public void RepairBusPresalesSheetsWrong()
//{
// _memberRelationshipTaskService.RepairBusPresalesSheetsWrong();
//}
/////
/////获取明明是现金订单,现金单价为与销售单价不等的销售单
/////
//[HttpGet]
//public void GetBusSalesSheetsRevenuePriceCash()
//{
// _memberRelationshipTaskService.GetBusSalesSheetsRevenuePriceCash();
//}
//#region CalculateMemberAccount(把没有店铺ID的会员余额赋值ID)
/////
///// 把没有店铺ID的会员余额赋值ID
/////
//[HttpGet]
//[AllowAnonymous]
//public void CalculateMemberAccount()
//{
// _memberComplimentaryAccountService.CalculateMemberAccount();
//}
//#endregion
/////
///// 恢复指定加盟商的被清零的会员积分
/////
/////
//[HttpGet]
//[AllowAnonymous]
//public void ResumeMemberIntegral(Guid? customerId, DateTime begin, DateTime end )
//{
// _billKeepingService.ResumeMemberIntegral(customerId, begin, end);
//}
//#region SaveReturnSheetTemp(临时的刷业绩计算结果的支付字段数值,修复BUG记录)
/////
///// 临时的刷业绩计算结果的支付字段数值,修复BUG记录
/////
/////
/////
//[HttpGet]
//[AllowAnonymous]
//public void SaveReturnSheetTemp(DateTime days, DateTime end)
//{
// _billKeepingService.SaveReturnSheetTemp(days, end);
//}
//#endregion
/////
///// 恢复指定加盟商的被清零的服务次数
/////
/////
/////
/////
//[HttpGet]
//[AllowAnonymous]
//public void ResumeServiceInv(Guid? customerId, DateTime begin, DateTime end)
//{
// _memberServiceInvService.ResumeServiceInv(customerId, begin, end);
//}
/////
///// 恢复指定加盟商的被清零的会员余额
/////
/////
/////
/////
//[HttpGet]
//[AllowAnonymous]
//public void ResumeMemberAccount(Guid? customerId, DateTime begin, DateTime end)
//{
// _memberServiceInvService.ResumeMemberAccount(customerId, begin, end);
//}
///
/// 每日存储会员的剩余服务次数的数据
///
///
[HttpGet]
[AllowAnonymous]
public void MemberServiceInvReportData(DateTime begin)
{
_report2301Service.MemberServiceInvReportData(begin);
}
/////
///// 根据流水计算出截止某天某个加盟商的每个门店剩余服务次数
/////
///// 截止时间
///// 加盟商ID
//[HttpGet]
//[AllowAnonymous]
//public void SaveCustmoerServiceInvDays( DateTime end, Guid? customerId)
//{
// _report2303Service.SaveCustmoerServiceInvDays(customerId,end);
//}
/////
///// 刷某天的剩余服务次数到数据库报表
/////
///// 想刷2月2日就传2月2日
//[HttpGet]
//[AllowAnonymous]
//public void BatchSaveCustmoerServiceInvDays(DateTime days)
//{
// _report2303Service.BatchSaveCustmoerServiceInvDays(days);
//}
/************************************************************************/
/////
///// 批量刷服务剩余次数和流水的店铺ID
/////
/////
/////
/////
//[HttpGet]
//[AllowAnonymous]
//public void BatchSetServerQtyShopId(DateTime? begin, DateTime? end, Guid? customerId)
//{
// _memberRelationshipTaskService.BatchSetServerQtyShopId(begin, end, customerId);
//}
/////
///// 刷预转销的订单业绩数据
/////
/////
/////
//[HttpGet]
//[AllowAnonymous]
//public void SetYuZhuanXiao(DateTime begin, DateTime end)
//{
// _memberRelationshipTaskService.SetYuZhuanXiao(begin, end);
//}
///
/// 分析订单是首单还是复购或者都不是
///
///
///
[HttpGet]
[AllowAnonymous]
public void SetShouDanFuGou(DateTime begin, DateTime end)
{
_memberRelationshipTaskService.SetShouDanFuGou(begin, end);
}
/////
///// 刷业绩记录是否老客活跃
/////
/////
/////
//[HttpGet]
//[AllowAnonymous]
//public void SetLaoKeHuoYue(DateTime begin, DateTime end)
//{
// _memberRelationshipTaskService.SetLaoKeHuoYue(begin, end);
//}
//[HttpGet]
//[AllowAnonymous]
//public void ReadLog(string url, int days)
//{
// _targetSetService.ReadLog(url, days);
//}
//[HttpGet]
//[AllowAnonymous]
//public string GetNewUrl(string url)
//{
// return _douYinService.GetNewUrl(url, new Domain.Model.BusDouYinInfoLog());
//}
/////
///// 生成 client_token 该接口适用于抖音或头条授权
/////
/////
//[HttpGet]
//[AllowAnonymous]
//public string GetClientToken()
//{
// return _douYinService.GetClientToken();
//}
/////
///// 验券准备--抖音团购券码的核销, 需要先调用本接口, 查询订单的券列表,选择要验的券,再调用验券接口,核销券码
/////
///// 验券准备接口返回的加密抖音券码
///// 返回核销券码结果数组的json字符串
//[HttpGet]
//[AllowAnonymous]
//public string Prepare(string encrypted_data)
//{
// return _douYinService.Prepare(encrypted_data,new Domain.Model.BusDouYinInfoLog());
//}
/////
///// 券状态查询--用于查询抖音券状态。
/////
/////
/////
//[HttpGet]
//[AllowAnonymous]
//public DouYinChaXunResp ChaXun(string encrypted_code)
//{
// return _douYinService.ChaXun(encrypted_code);
//}
/////
///// 用于验券错误需要撤回验券等场景, 有时间限制,验券超过一个小时就不可再撤销。同时适用于抖音团购券码与三方券码
/////
/////
//[HttpGet]
//[AllowAnonymous]
//public string Cancel(string verify_id, string certificate_id)
//{
// return _douYinService.Cancel(verify_id, certificate_id);
//}
/////
///// 验券--用于核销券码,同时适用于抖音团购券码与三方券码
/////
///// 一次验券的标识 (用于短时间内的幂等)
///// 验券准备接口返回的加密抖音券码
///// 返回核销券码结果的json字符串
//[HttpPost]
//[AllowAnonymous]
//public string Verify(DouYinVerify act )
//{
// return _douYinService.Verify(act.verify_token, act.Encrypted_data, new Domain.Model.BusDouYinLog());
//}
//[HttpPost]
//[AllowAnonymous]
//public string GetSign(string body)
//{
// return _douYinService.GetSign(body);
//}
//[HttpPost]
//[AllowAnonymous]
//public void MemberWeChatPublicCallBack(string sEchoStr)
//{
// _weChatPublicService.MemberWeChatPublicCallBack(sEchoStr);
////}
//#region BacthGetShareCode(批量刷素材库的码的数据)
/////
///// 批量刷素材库的码的数据
/////
//[HttpGet]
//public void BacthSuCaiGetShareCode()
//{
// _materialWarehouseService.BacthGetShareCode();
//}
//#endregion
/////
///// 测试埋点
/////
/////
//[HttpPost]
//[AllowAnonymous]
//public void MaiDian(RpShopUseAppletDataAct act)
//{
// _rpShopUseAppletDataService.SelectSetData(act.ApiUrl, act.RequestDataStr, act.Token);
//}
//#region BacthGetShareCode(批量刷新课程码的数据)
/////
///// 批量刷新课程码的数据
/////
//[HttpGet]
//public void BacthGetShareCode()
//{
// _courseTopicsService.BacthGetShareCode();
//}
//#endregion
//#region BatchSetRegisteredUrl(刷新店员添加客户的小程序码)
/////
///// 刷新店员添加客户的小程序码
/////
//[HttpGet]
//public void BatchSetRegisteredUrl()
//{
// _memberService.BatchSetRegisteredUrl();
//}
//#endregion
/////
///// 批量设置普通活动的高清码缓存
/////
//[HttpGet]
//public void BatchSet1280MiniCode()
//{
// _activityService.BatchSet1280MiniCode();
//}
/////
///// 批量设置优惠券活动的高清码
/////
//[HttpGet]
//public void BatchSetCouponActity1280MiniCode()
//{
// _couponActivityService.BatchSet1280MiniCode();
//}
//#region BatchRemove(除了依然在开展的优惠券活动,把一年3个月前的优惠券)
/////
///// 除了依然在开展的优惠券活动,把一年3个月前的优惠券
/////
//[AllowAnonymous]
//[HttpGet]
//public void BatchRemove()
//{
// _couponMemberHistoryService.BatchRemove();
//}
//#endregion
//#region SetMemberCode(重新初始化会员卡号)
/////
///// 重新初始化会员卡号
/////
/////
/////
//[AllowAnonymous]
//[HttpGet]
//public void SetMemberCode(string json)
//{
// if(json== "4B1BD079-28A7-4B3F-AD36-A53E65699C3A")
// _huLiHuShao40Service.SetMemberCode();
//}
//#endregion
//#region AutoSetReport(半夜自动生成月报年报)
/////
///// 半夜自动生成月报年报
/////
///// 非1
/////
//[AllowAnonymous]
//[HttpGet]
//public void AutoSetReport(string json)
//{
// _huLiHuShao40Service.AutoSetReport(json);
//}
//#endregion
//#region GetClerkNianBao40(年度经营报告-店长端)
/////
///// 年度经营报告-店长端
/////
///// 店铺ID
/////
//[AllowAnonymous]
//[HttpGet]
//public NianDuBaoBiao40Resp GetClerkNianBao40(string json)
//{
// return _huLiHuShao40Service.GetClerkNianBao40(json);
//}
//#endregion
//#region GetClerkYueBao40(月度经营报告-店长端)
/////
///// 月度经营报告-店长端
/////
///// 店铺ID
/////
//[AllowAnonymous]
//[HttpGet]
//public NianDuBaoBiao40Resp GetClerkYueBao40(string json)
//{
// return _huLiHuShao40Service.GetClerkYueBao40(json);
//}
//#endregion
//#region GetCustomerNianBao40(年度经营报告-加盟商)
/////
///// 年度经营报告-加盟商
/////
///// 店铺ID
/////
//[AllowAnonymous]
//[HttpGet]
//public NianDuBaoBiao40Resp GetCustomerNianBao40(string json)
//{
// return _huLiHuShao40Service.GetCustomerNianBao40(json);
//}
//#endregion
//#region GetCustomerYueBao40(月度经营报告-加盟商)
/////
///// 月度经营报告-加盟商
/////
///// 店铺ID
/////
//[AllowAnonymous]
//[HttpGet]
//public NianDuBaoBiao40Resp GetCustomerYueBao40(string json)
//{
// return _huLiHuShao40Service.GetCustomerYueBao40(json);
//}
//#endregion
//[AllowAnonymous]
//[HttpGet]
//public byte GetTest()
//{
// int i = 10;
// byte j = (byte)i;
// return j;
//}
//[AllowAnonymous]
//[HttpGet]
//public void TestSubMessage()
//{
// var templateMessageData = new TemplateMessageData();
// templateMessageData["name1"] = new TemplateMessageDataValue("12312");
// templateMessageData["amount2"] = new TemplateMessageDataValue("9999元");
// templateMessageData["date4"] = new TemplateMessageDataValue("2019-12-26");
// templateMessageData["thing3"] = new TemplateMessageDataValue("邀请好友成功,共同进步");
// _miNiProService.SendSubscribeMessage("wx28f095ca78e27699", "b7fc7cc4e4cdcae60d9746002efce845", "oGpIC5R2AoE7Zb_CnXK_CFuJOTlU", "nVBGBTIUETgqKwZlKznnCt098p8KodbPo8HX_zESz_k", templateMessageData);
//}
//[AllowAnonymous]
//[HttpGet]
//public void SetTime()
//{
// _myCodeCacheService.Set("TIMENOW", DateTime.Now);
//}
//[AllowAnonymous]
//[HttpGet]
//public void TestSendInfo()
//{
// try
// {
// int i = 0;
// int j = 10 / i;
// }
// catch (Exception ex)
// {
// _dingDingService.SendMsg(ex.Message.ToString() + ex.StackTrace);
// }
//}
//[HttpGet]
//[AllowAnonymous]
//public string GetSysConfigConst()
//{
// return SysConfigConst.CmpPayCallbackDomain;
//}
/////
///// 测试方法
/////
/////
//[AllowAnonymous]
//[HttpGet]
//public DateTime GetTime()
//{
// return DateTime.Now;
//}
/////
///// 获取分享码缓存内容
/////
/////
/////
//[HttpGet]
//[AllowAnonymous]
//public object GetScene(string scene)
//{
// var cash = _myCodeCacheService.Get