Commit 5ece639f authored by 吴春's avatar 吴春

提交代码

parents d46511ea ec18e54d
......@@ -2418,7 +2418,7 @@ namespace Mall.Module.User
}
return flag;
}
}
/// <summary>
/// 推荐生成提现单据
......@@ -5631,7 +5631,7 @@ namespace Mall.Module.User
{
TotalMoney,
UserName = umodel.Name,
SupplierName = smodel.Name,
SupplierName = smodel?.Name ?? "",
RList
};
}
......@@ -5639,7 +5639,7 @@ namespace Mall.Module.User
{
TotalMoney = 0,
UserName = umodel.Name,
SupplierName = smodel.Name,
SupplierName = smodel?.Name ?? "",
RList
};
}
......@@ -5667,10 +5667,30 @@ namespace Mall.Module.User
}
};
bool flag = distributor_BillRepository.Update(keyValues, wheres);
if (flag)
{
//回滚 订单返佣状态
if (flag) {
//回滚 订单返佣状态
var dlist = distributor_BillDetailRepository.GetList(new RB_Distributor_BillDetail_Extend() { TenantId = tenantId, MallBaseId = mallBaseId, BillId = billId });
if (dlist.Any()) {
//查询所有返佣列表
string introductionIds = string.Join(",", dlist.Select(x => x.CommissionId ?? 0));
var iList = goods_OrderIntroductionRepository.GetList(new RB_Goods_OrderIntroduction_Extend() { TenantId = tenantId, MallBaseId = mallBaseId, IntroductionIds = introductionIds });
foreach (var item in iList)
{
//回滚返佣订单的佣金打款状态
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_Goods_OrderIntroduction_Extend.RemitStatus),2}
};
List<WhereHelper> wheres1 = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Goods_OrderIntroduction_Extend.Id),
FiledValue=item.Id,
OperatorEnum=OperatorEnum.Equal
}
};
goods_OrderIntroductionRepository.Update(keyValues1, wheres1);
}
}
}
return flag;
}
......@@ -5751,6 +5771,76 @@ namespace Mall.Module.User
{
return distributor_BillRepository.GetList(dmodel);
}
/// <summary>
/// 修改备注
/// </summary>
/// <param name="billId"></param>
/// <param name="remark"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <param name="empId"></param>
/// <returns></returns>
public bool SetRecommendOrdersBillRemark(int billId, string remark, int tenantId, int mallBaseId, int empId)
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Distributor_Bill.Remark),remark},
{ nameof(RB_Distributor_Bill.UpdateDate),DateTime.Now}
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Distributor_Bill.Id),
FiledValue=billId,
OperatorEnum=OperatorEnum.Equal
}
};
bool flag = distributor_BillRepository.Update(keyValues, wheres);
return flag;
}
/// <summary>
/// 获取账单实体
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public RB_Distributor_Bill GetBillModel(int Id) {
var model = distributor_BillRepository.GetEntity(Id);
return model;
}
/// <summary>
/// 打款
/// </summary>
/// <param name="billId"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <param name="empId"></param>
/// <returns></returns>
public string SetRecommendOrdersBillRemit(int billId, int tenantId, int mallBaseId, int empId)
{
var model = distributor_BillRepository.GetEntity(billId);
if (model == null) { return "账单不存在"; }
if (model.BillState != 1) { return "账单状态不正确"; }
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Distributor_Bill.BillState),2},
{ nameof(RB_Distributor_Bill.EmpId),empId},
{ nameof(RB_Distributor_Bill.UpdateDate),DateTime.Now}
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Distributor_Bill.Id),
FiledValue=billId,
OperatorEnum=OperatorEnum.Equal
}
};
bool flag = distributor_BillRepository.Update(keyValues, wheres);
if (flag)
{
return "";
}
else {
return "保存失败";
}
}
#endregion
......
......@@ -2962,6 +2962,87 @@ namespace Mall.WebApi.Controllers.User
}
}
/// <summary>
/// 修改备注
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetRecommendOrdersBillRemark() {
var req = RequestParm;
var parms = JObject.Parse(req.msg.ToString());
int BillId = parms.GetInt("BillId", 0);
string Remark = parms.GetStringValue("Remark");
if (BillId <= 0)
{
return ApiResult.ParamIsNull();
}
bool flag = userModule.SetRecommendOrdersBillRemark(BillId, Remark, req.TenantId, req.MallBaseId, req.EmpId);
if (flag)
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed();
}
}
/// <summary>
/// 账单打款
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetRecommendOrdersBillRemit()
{
var req = RequestParm;
var parms = JObject.Parse(req.msg.ToString());
int BillId = parms.GetInt("BillId", 0);
if (BillId <= 0)
{
return ApiResult.ParamIsNull();
}
var bmodel = userModule.GetBillModel(BillId);
if (bmodel == null) { return ApiResult.Failed("账单不存在"); }
if (bmodel.BillState != 1) { return ApiResult.Failed("账单状态不正确"); }
int IsNormalServer = Convert.ToInt32(new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("IsNormalServer").Value);
if (IsNormalServer == 1)
{
var mallModel = userModule.GetMiniProgramExtend(req.MallBaseId);
var umodel = userModule.GetMemberUserInfo(bmodel.UserId ?? 0);
var flag = App_Code.PayUtil.GetTransfersOrder((bmodel.Periods ?? "") + bmodel.Id, bmodel.Money ?? 0, (bmodel.UserId ?? 0).ToString(), umodel.OpenId, mallModel, _accessor);
if (flag)
{
string msg = userModule.SetRecommendOrdersBillRemit(BillId, req.TenantId, req.MallBaseId, req.EmpId);
if (msg != "")
{
LogHelper.Write("企业付款失败 账单BillId:" + BillId);
}
new MiniProgramMsgModule().SendWithdrawSucceedMsg(req.TenantId, req.MallBaseId, umodel.OpenId, (bmodel.Money ?? 0).ToString(), "0", "自动打款", "已发放推荐佣金,请注意查收");
return ApiResult.Success();
}
else
{
LogHelper.Write("企业付款失败 账单BillId:" + BillId);
return ApiResult.Failed("支付失败");
}
}
else
{
string msg = userModule.SetRecommendOrdersBillRemit(BillId, req.TenantId, req.MallBaseId, req.EmpId);
if (msg == "")
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed(msg);
}
}
}
/// <summary>
/// 获取账单明细
/// </summary>
......
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