Commit c8ce44f1 authored by liudong1993's avatar liudong1993

微店管理

parent 1c77f2e5
using VT.FW.DB;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.User
{
/// <summary>
/// 微店表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_SmallShops_Info
{
/// <summary>
/// Id
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 用户id
/// </summary>
public int? UserId
{
get;
set;
}
/// <summary>
/// 微店名称
/// </summary>
public string Name
{
get;
set;
}
/// <summary>
/// 微店logo
/// </summary>
public string Logo { get; set; }
/// <summary>
/// 总计佣金
/// </summary>
public decimal? TotalCommission
{
get;
set;
}
/// <summary>
/// 可提现佣金
/// </summary>
public decimal? Commission
{
get;
set;
}
/// <summary>
/// 微店等级id
/// </summary>
public int? GradeId
{
get;
set;
}
/// <summary>
/// 上调价格
/// </summary>
public decimal? UpPrice { get; set; }
/// <summary>
/// 类型 1百分比 2固定金额
/// </summary>
public int? PriceType { get; set; }
/// <summary>
/// 公告
/// </summary>
public string Notice { get; set; }
/// <summary>
/// 审核状态 1审核中 2通过 3拒绝
/// </summary>
public DistributorAuditStatusEnum? AuditStatus
{
get;
set;
}
/// <summary>
/// 审核时间
/// </summary>
public DateTime? AuditDate
{
get;
set;
}
/// <summary>
/// 备注
/// </summary>
public string Remark
{
get;
set;
}
/// <summary>
/// 删除状态
/// </summary>
public int? Status
{
get;
set;
}
/// <summary>
/// 商户号
/// </summary>
public int TenantId
{
get;
set;
}
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId
{
get;
set;
}
/// <summary>
/// CreateDate
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
/// <summary>
/// UpdateDate
/// </summary>
public DateTime? UpdateDate
{
get;
set;
}
}
}
using VT.FW.DB;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.User
{
/// <summary>
/// 微店价格表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_SmallShops_Price
{
/// <summary>
/// Id
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 微店id
/// </summary>
public int? SmallShopsId
{
get;
set;
}
/// <summary>
/// 商品id
/// </summary>
public int? GoodsId
{
get;
set;
}
/// <summary>
/// 商品规格key
/// </summary>
public string SpecificationKey { get; set; }
/// <summary>
/// 上调价格
/// </summary>
public decimal? UpPrice
{
get;
set;
}
/// <summary>
/// 类型 1百分比 2固定金额
/// </summary>
public int? PriceType
{
get;
set;
}
/// <summary>
/// 删除状态
/// </summary>
public int? Status
{
get;
set;
}
/// <summary>
/// 商户号
/// </summary>
public int TenantId
{
get;
set;
}
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId
{
get;
set;
}
/// <summary>
/// CreateDate
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
/// <summary>
/// UpdateDate
/// </summary>
public DateTime? UpdateDate
{
get;
set;
}
}
}
using VT.FW.DB;
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.User;
using Mall.Common.Enum.User;
namespace Mall.Model.Extend.User
{
/// <summary>
/// 微店表扩展实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_SmallShops_Info_Extend : RB_SmallShops_Info
{
/// <summary>
/// 用户昵称
/// </summary>
public string NickName { get; set; }
/// <summary>
/// 上级id
/// </summary>
public int SuperiorId { get; set; }
/// <summary>
/// 用户头像
/// </summary>
public string Photo { get; set; }
/// <summary>
/// userids
/// </summary>
public string UserIds { get; set; }
}
}
using VT.FW.DB;
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.User;
using Mall.Common.Enum.User;
namespace Mall.Model.Extend.User
{
/// <summary>
/// 微店价格表扩展实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_SmallShops_Price_Extend : RB_SmallShops_Price
{
/// <summary>
/// 微店ids
/// </summary>
public string SmallShopsIds{ get; set; }
}
}
......@@ -409,7 +409,7 @@ namespace Mall.Module.Property
if (pid > 0)
{
//生成采购财务单
OrderProcurementFinanceModule(demodel, sModel.BankAccountId, pid, demodel.Remark);
OrderProcurementFinanceModule(demodel, sModel.BankAccountId, pid, demodel.Remark, eRPEmpId);
}
}
catch (Exception ex)
......@@ -426,7 +426,7 @@ namespace Mall.Module.Property
/// </summary>
/// <param name="omodel"></param>
/// <returns></returns>
public bool OrderProcurementFinanceModule(RB_Procurement_Extend demodel, int BankAccountId, int pid, string pRemark)
public bool OrderProcurementFinanceModule(RB_Procurement_Extend demodel, int BankAccountId, int pid, string pRemark,int eRPEmpId)
{
var flag = false;
try
......@@ -457,7 +457,7 @@ namespace Mall.Module.Property
string Remark = System.DateTime.Now.ToString("yyyy年MM月dd日") + " 自动生成采购单据";
var financeObj = new
{
CreateBy = ProcurementDirector,
CreateBy = eRPEmpId > 0 ? eRPEmpId : ProcurementDirector,
demodel.IsPublic,
ClientType = 10,
ClientID = BankAccountId,
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mall.Common;
using Mall.Common.Plugin;
using Mall.Model.Entity.User;
using Mall.Model.Extend.User;
using Mall.Repository;
using Mall.Repository.User;
using Mall.Repository.Product;
using Mall.Model.Extend.Product;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.Json;
using Newtonsoft.Json;
using Mall.Repository.BaseSetUp;
using Mall.Common.Enum.User;
using Mall.Common.API;
using Newtonsoft.Json.Linq;
using System.Threading;
using Mall.Repository.Finance;
using NPOI.SS.Formula.Functions;
using VT.FW.DB;
namespace Mall.Module.User
{
/// <summary>
/// 微店处理层
/// </summary>
public class SmallShopsModule
{
/// <summary>
/// 用户管理
/// </summary>
private readonly RB_Member_UserRepository member_UserRepository = new RB_Member_UserRepository();
/// <summary>
/// 小程序
/// </summary>
private readonly RB_MiniProgramRepository miniProgramRepository = new RB_MiniProgramRepository();
/// <summary>
/// 微店
/// </summary>
private readonly RB_SmallShops_InfoRepository smallShops_InfoRepository = new RB_SmallShops_InfoRepository();
/// <summary>
/// 微店价格
/// </summary>
private readonly RB_SmallShops_PriceRepository smallShops_PriceRepository = new RB_SmallShops_PriceRepository();
#region 微店管理
/// <summary>
/// 获取微店分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_SmallShops_Info_Extend> GetSmallShopsPageList(int pageIndex, int pageSize, out long count, RB_SmallShops_Info_Extend demodel)
{
var list = smallShops_InfoRepository.GetPageList(pageIndex, pageSize, out count, demodel);
return list;
}
/// <summary>
/// 获取下拉
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_SmallShops_Info_Extend> GetSmallShopsDropDownList(int pageIndex, int pageSize, out long count, RB_SmallShops_Info_Extend demodel)
{
return smallShops_InfoRepository.GetSmallShopsDropDownList(pageIndex, pageSize, out count, demodel);
}
/// <summary>
/// 获取微店信息
/// </summary>
/// <param name="smallShopsId"></param>
/// <returns></returns>
public RB_SmallShops_Info_Extend GetSmallShopsInfo(int smallShopsId)
{
var model = smallShops_InfoRepository.GetEntity<RB_SmallShops_Info_Extend>(smallShopsId);
model.NickName = member_UserRepository.GetEntity(model?.UserId ?? 0)?.Name ?? "";
return model;
}
/// <summary>
/// 微店审核
/// </summary>
/// <param name="ssmodel"></param>
/// <param name="type"></param>
/// <returns></returns>
public bool SetSmallShopsAudit(RB_SmallShops_Info_Extend ssmodel, int type)
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_SmallShops_Info.UpdateDate),DateTime.Now}
};
if (type == 1)
{
keyValues.Add(nameof(RB_SmallShops_Info.AuditStatus), DistributorAuditStatusEnum.Audited);
keyValues.Add(nameof(RB_SmallShops_Info.AuditDate), DateTime.Now);
}
else if (type == 2)
{
keyValues.Add(nameof(RB_SmallShops_Info.AuditStatus), DistributorAuditStatusEnum.Reject);
}
else if (type == 3)
{
keyValues.Add(nameof(RB_SmallShops_Info.Remark), ssmodel.Remark);
}
else {
return false;
}
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_SmallShops_Info.Id),
FiledValue=ssmodel.Id,
OperatorEnum=OperatorEnum.Equal
}
};
return smallShops_InfoRepository.Update(keyValues, wheres);
}
/// <summary>
/// 修改店铺佣金
/// </summary>
/// <param name="smallShopsId"></param>
/// <param name="commission"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public bool SetSmallShopsCommission(int smallShopsId, decimal commission, int tenantId, int mallBaseId,int empId)
{
var model = smallShops_InfoRepository.GetEntity(smallShopsId);
if (model == null) { return false; }
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_SmallShops_Info.UpdateDate),DateTime.Now},
{ nameof(RB_SmallShops_Info.Commission),commission},
{ nameof(RB_SmallShops_Info.Remark),model.Remark +" EmpId:"+empId+"修改佣金:由"+(model.Commission??0)+"=>"+commission},
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_SmallShops_Info.Id),
FiledValue=smallShopsId,
OperatorEnum=OperatorEnum.Equal
}
};
return smallShops_InfoRepository.Update(keyValues, wheres);
}
#endregion
}
}
......@@ -2099,8 +2099,9 @@ namespace Mall.Module.User
/// <param name="remark"></param>
/// <param name="uid"></param>
/// <param name="mallBaseId"></param>
/// <param name="erpEmpId"></param>
/// <returns></returns>
public string SetDistributorRemitAudit(int remitId, int type, string remark, string uid, int mallBaseId)
public string SetDistributorRemitAudit(int remitId, int type, string remark, string uid, int mallBaseId,int erpEmpId)
{
if (type == 1)
{
......@@ -2191,7 +2192,7 @@ namespace Mall.Module.User
#endregion
//提现审核通过 自动生成财务单据
OrderIncomeFinanceModule(remitId, Convert.ToInt32(uid), mallBaseId, remark);
OrderIncomeFinanceModule(remitId, Convert.ToInt32(uid), mallBaseId, remark, erpEmpId);
}
}
else if (type == 2)
......@@ -2314,7 +2315,7 @@ namespace Mall.Module.User
/// 生成提现单据
/// </summary>
/// <returns></returns>
public bool OrderIncomeFinanceModule(int remitId, int TenantId, int MallBaseId, string remark)
public bool OrderIncomeFinanceModule(int remitId, int TenantId, int MallBaseId, string remark,int erpEmpId)
{
var flag = false;
try
......@@ -2356,7 +2357,7 @@ namespace Mall.Module.User
item.IsPublic = 5;//默认平台虚拟账户
var financeObj = new
{
CreateBy = Config.ExpendDirector,
CreateBy = erpEmpId > 0 ? erpEmpId.ToString() : Config.ExpendDirector,
item.IsPublic,
ClientType = Convert.ToInt32(new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("FinanceSetting")["RemitTypeId"]),
ClientID = Convert.ToInt32(new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("FinanceSetting")["RemitAccountId"]),
......
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.User;
using Mall.Model.Extend.User;
using System.Linq;
namespace Mall.Repository.User
{
/// <summary>
/// 微店仓储层
/// </summary>
public class RB_SmallShops_InfoRepository : BaseRepository<RB_SmallShops_Info>
{
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public List<RB_SmallShops_Info_Extend> GetPageList(int pageIndex, int pageSize, out long rowCount, RB_SmallShops_Info_Extend dmodel)
{
string where = $@" 1=1 and di.{nameof(RB_SmallShops_Info_Extend.Status)}=0";
if (dmodel.TenantId > 0)
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.UserId > 0)
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.UserId)}={dmodel.UserId}";
}
if (dmodel.AuditStatus > 0)
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.AuditStatus)}={(int)dmodel.AuditStatus}";
}
if (dmodel.GradeId >= 0)
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.GradeId)}={dmodel.GradeId}";
}
if (!string.IsNullOrEmpty(dmodel.Name))
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.Name)} like '%{dmodel.Name}%'";
}
if (!string.IsNullOrEmpty(dmodel.NickName))
{
where += $@" and u.{nameof(RB_Member_User.Name)} like '%{dmodel.NickName}%'";
}
if (dmodel.SuperiorId > 0)
{
where += $@" and u.{nameof(RB_Member_User.SuperiorId)}={dmodel.SuperiorId}";
}
string sql = $@"select di.*,u.Name as NickName,u.SuperiorId,u.Photo from RB_SmallShops_Info di
inner join rb_member_user u on di.UserId=u.Id
where {where} order by di.CreateDate desc";
return GetPage<RB_SmallShops_Info_Extend>(pageIndex, pageSize, out rowCount, sql).ToList();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_SmallShops_Info_Extend> GetList(RB_SmallShops_Info_Extend dmodel)
{
string where = $@" 1=1 and di.{nameof(RB_SmallShops_Info_Extend.Status)}=0";
if (dmodel.TenantId > 0)
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.UserId > 0)
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.UserId)}={dmodel.UserId}";
}
if (dmodel.AuditStatus > 0)
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.AuditStatus)}={(int)dmodel.AuditStatus}";
}
if (dmodel.GradeId >= 0)
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.GradeId)}={dmodel.GradeId}";
}
if (!string.IsNullOrEmpty(dmodel.Name))
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.Name)} like '%{dmodel.Name}%'";
}
if (!string.IsNullOrEmpty(dmodel.NickName))
{
where += $@" and u.{nameof(RB_Member_User.Name)} like '%{dmodel.NickName}%'";
}
if (dmodel.SuperiorId > 0)
{
where += $@" and u.{nameof(RB_Member_User.SuperiorId)}={dmodel.SuperiorId}";
}
string sql = $@"select di.*,u.Name as NickName,u.SuperiorId,u.Photo from RB_SmallShops_Info di
inner join rb_member_user u on di.UserId=u.Id
where {where} order by di.CreateDate desc";
return Get<RB_SmallShops_Info_Extend>(sql).ToList();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_SmallShops_Info_Extend> GetListForSingle(RB_SmallShops_Info_Extend dmodel)
{
string where = $@" 1=1 and di.{nameof(RB_SmallShops_Info_Extend.Status)}=0";
if (dmodel.TenantId > 0)
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.UserId > 0)
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.UserId)}={dmodel.UserId}";
}
if (dmodel.AuditStatus > 0)
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.AuditStatus)}={(int)dmodel.AuditStatus}";
}
if (!string.IsNullOrEmpty(dmodel.UserIds))
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.UserId)} in({dmodel.UserIds})";
}
if (dmodel.GradeId >= 0)
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.GradeId)}={dmodel.GradeId}";
}
if (!string.IsNullOrEmpty(dmodel.Name))
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.Name)} like '%{dmodel.Name}%'";
}
string sql = $@"select di.* from RB_SmallShops_Info di where {where} order by di.Id desc";
return Get<RB_SmallShops_Info_Extend>(sql).ToList();
}
/// <summary>
/// 下拉列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_SmallShops_Info_Extend> GetSmallShopsDropDownList(int pageIndex, int pageSize, out long count, RB_SmallShops_Info_Extend dmodel)
{
string where = $@" 1=1 and di.{nameof(RB_SmallShops_Info_Extend.Status)}=0";
if (dmodel.TenantId > 0)
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.UserId > 0)
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.UserId)}={dmodel.UserId}";
}
if (dmodel.AuditStatus > 0)
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.AuditStatus)}={(int)dmodel.AuditStatus}";
}
if (!string.IsNullOrEmpty(dmodel.UserIds))
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.UserId)} in({dmodel.UserIds})";
}
if (dmodel.GradeId >= 0)
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.GradeId)}={dmodel.GradeId}";
}
if (!string.IsNullOrEmpty(dmodel.Name))
{
where += $@" and di.{nameof(RB_SmallShops_Info_Extend.Name)} like '%{dmodel.Name}%'";
}
string sql = $@"select di.Id,di.Name from RB_SmallShops_Info di where {where} order by di.Id desc";
return GetPage<RB_SmallShops_Info_Extend>(pageIndex, pageSize, out count, sql).ToList();
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.User;
using Mall.Model.Extend.User;
using System.Linq;
namespace Mall.Repository.User
{
/// <summary>
/// 微店价格仓储层
/// </summary>
public class RB_SmallShops_PriceRepository : BaseRepository<RB_SmallShops_Price>
{
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_SmallShops_Price_Extend> GetList(RB_SmallShops_Price_Extend dmodel)
{
string where = $@" 1=1 and di.{nameof(RB_SmallShops_Price_Extend.Status)}=0";
if (dmodel.TenantId > 0)
{
where += $@" and di.{nameof(RB_SmallShops_Price_Extend.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and di.{nameof(RB_SmallShops_Price_Extend.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.SmallShopsId > 0)
{
where += $@" and di.{nameof(RB_SmallShops_Price_Extend.SmallShopsId)}={dmodel.SmallShopsId}";
}
if (!string.IsNullOrEmpty(dmodel.SmallShopsIds)) {
where += $@" and di.{nameof(RB_SmallShops_Price_Extend.SmallShopsId)} in({dmodel.SmallShopsIds})";
}
string sql = $@"select di.* from RB_SmallShops_Price_Extend di
where {where} order by di.Id desc";
return Get<RB_SmallShops_Price_Extend>(sql).ToList();
}
}
}
......@@ -166,7 +166,7 @@ namespace Mall.WebApi.Controllers.Finance
var flag = App_Code.PayUtil.GetTransfersOrder(model.OrderNum, model.RemitMoney ?? 0, (model.UserId ?? 0).ToString(), umodel.OpenId, mallModel, _accessor);
if (flag)
{
string msg1 = userModule.SetDistributorRemitAudit(RemitId, 2, Remark, TenantId.ToString(), MallBaseId);
string msg1 = userModule.SetDistributorRemitAudit(RemitId, 2, Remark, TenantId.ToString(), MallBaseId, 0);
if (msg1 != "")
{
LogHelper.Write("提现:" + RemitId + ",失败");
......@@ -180,7 +180,7 @@ namespace Mall.WebApi.Controllers.Finance
}
}
else {
string msg1 = userModule.SetDistributorRemitAudit(RemitId, 2, Remark, TenantId.ToString(), MallBaseId);
string msg1 = userModule.SetDistributorRemitAudit(RemitId, 2, Remark, TenantId.ToString(), MallBaseId, 0);
if (msg1 != "")
{
return ApiResult.Failed("提现:" + RemitId + ",失败");
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Mall.Common.API;
using Mall.Model.Extend.User;
using Mall.Module.User;
using Mall.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Mall.Common.Plugin;
using Mall.Common.Enum.User;
using Mall.CacheManager.User;
using Newtonsoft.Json.Linq;
using Mall.Common;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.Json;
using Google.Protobuf.WellKnownTypes;
namespace Mall.WebApi.Controllers.User
{
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class SmallShopsController : BaseController
{
private readonly SmallShopsModule smallShopsModule = new SmallShopsModule();
#region 微店管理
/// <summary>
/// 获取店铺分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetSmallShopsPageList()
{
var parms = RequestParm;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
RB_SmallShops_Info_Extend demodel = JsonConvert.DeserializeObject<RB_SmallShops_Info_Extend>(parms.msg.ToString());
demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId;
var list = smallShopsModule.GetSmallShopsPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
x.Id,
x.Name,
x.Logo,
x.UserId,
UserName = x.NickName,
x.Commission,
x.TotalCommission,
x.Notice,
x.AuditStatus,
AuditStatusName = x.AuditStatus.GetEnumName(),
AuditDate = x.AuditDate.HasValue ? x.AuditDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
x.Remark,
x.TenantId,
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
});
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 获取店铺下拉列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetSmallShopsDropDownList()
{
var parms = RequestParm;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
RB_SmallShops_Info_Extend demodel = JsonConvert.DeserializeObject<RB_SmallShops_Info_Extend>(parms.msg.ToString());
demodel.TenantId = Convert.ToInt32(parms.uid);
demodel.MallBaseId = parms.MallBaseId;
var list = smallShopsModule.GetSmallShopsDropDownList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
x.Id,
x.Name
});
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 获取店铺信息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetSmallShopsInfo()
{
var requestParm = RequestParm;
var parms = JObject.Parse(requestParm.msg.ToString());
int SmallShopsId = parms.GetInt("SmallShopsId", 0);
if (SmallShopsId <= 0)
{
return ApiResult.ParamIsNull();
}
var model = smallShopsModule.GetSmallShopsInfo(SmallShopsId);
if (model.TenantId != Convert.ToInt32(requestParm.uid))
{
return ApiResult.ParamIsNull("未查询到该微店信息");
}
if (model.MallBaseId != requestParm.MallBaseId)
{
return ApiResult.ParamIsNull("未查询到该微店信息");
}
return ApiResult.Success("", new
{
model.Id,
model.Name,
model.Logo,
model.UserId,
UserName = model.NickName,
model.Commission,
model.TotalCommission,
model.Notice,
model.AuditStatus,
AuditStatusName = model.AuditStatus.GetEnumName(),
AuditDate = model.AuditDate.HasValue ? model.AuditDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
model.Remark,
CreateDate = model.CreateDate.HasValue ? model.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
});
}
/// <summary>
/// 微店审核信息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetSmallShopsAudit()
{
var req = RequestParm;
JObject prams = JObject.Parse(req.msg.ToString());
int SmallShopsId = prams.GetInt("SmallShopsId", 0);
int Type = prams.GetInt("Type", 1);//类型 1审核通过 2审核拒绝 3修改备注
string Remark = prams.GetStringValue("Remark");
if (SmallShopsId <= 0)
{
return ApiResult.ParamIsNull();
}
var ssmodel = smallShopsModule.GetSmallShopsInfo(SmallShopsId);
if (ssmodel == null)
{
return ApiResult.Failed("微店不存在");
}
if (ssmodel.TenantId != req.TenantId)
{
return ApiResult.ParamIsNull("未查询到该微店信息");
}
if (ssmodel.MallBaseId != req.MallBaseId)
{
return ApiResult.ParamIsNull("未查询到该微店信息");
}
if (Type == 1 || Type == 2)
{
if (ssmodel.AuditStatus != DistributorAuditStatusEnum.Auditing)
{
return ApiResult.ParamIsNull("微店状态不正确");
}
}
ssmodel.Remark = Remark;
bool flag = smallShopsModule.SetSmallShopsAudit(ssmodel, Type);
if (flag)
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed();
}
}
/// <summary>
/// 设置微店佣金
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetSmallShopsCommission() {
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int SmallShopsId = parms.GetInt("SmallShopsId", 0);
decimal Commission = parms.GetDecimal("Commission");
if (SmallShopsId <= 0) {
return ApiResult.Failed();
}
bool flag = smallShopsModule.SetSmallShopsCommission(SmallShopsId, Commission, req.TenantId, req.MallBaseId, req.EmpId);
if (flag)
{
return ApiResult.Success();
}
else {
return ApiResult.Failed();
}
}
#endregion
}
}
\ No newline at end of file
......@@ -1872,6 +1872,7 @@ namespace Mall.WebApi.Controllers.User
var re = RequestParm;
var parms = JObject.Parse(re.msg.ToString());
int RemitId = parms.GetInt("RemitId", 0);
int ErpEmpId = parms.GetInt("ErpEmpId", 0);//erp用户id
int Type = parms.GetInt("Type", 0);//1审核通过 2打款 3驳回
string Remark = parms.GetStringValue("Remark");
if (RemitId <= 0)
......@@ -1915,7 +1916,7 @@ namespace Mall.WebApi.Controllers.User
var flag = App_Code.PayUtil.GetTransfersOrder(model.OrderNum, model.RemitMoney ?? 0, (model.UserId ?? 0).ToString(), umodel.OpenId, mallModel, _accessor);
if (flag)
{
string msg1 = userModule.SetDistributorRemitAudit(RemitId, Type, Remark, re.uid, re.MallBaseId);
string msg1 = userModule.SetDistributorRemitAudit(RemitId, Type, Remark, re.uid, re.MallBaseId, 0);
if (msg1 != "")
{
LogHelper.Write("提现:" + RemitId + ",失败");
......@@ -1932,7 +1933,7 @@ namespace Mall.WebApi.Controllers.User
}
else
{
string msg1 = userModule.SetDistributorRemitAudit(RemitId, Type, Remark, re.uid, re.MallBaseId);
string msg1 = userModule.SetDistributorRemitAudit(RemitId, Type, Remark, re.uid, re.MallBaseId, 0);
if (msg1 != "")
{
return ApiResult.Failed("提现:" + RemitId + ",失败");
......@@ -1957,7 +1958,7 @@ namespace Mall.WebApi.Controllers.User
return ApiResult.Failed("暂不支持该类型");
}
string msg = userModule.SetDistributorRemitAudit(RemitId, Type, Remark, re.uid, re.MallBaseId);
string msg = userModule.SetDistributorRemitAudit(RemitId, Type, Remark, re.uid, re.MallBaseId, ErpEmpId);
if (msg == "")
{
if (Type == 3)
......
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