Commit fe914666 authored by 吴春's avatar 吴春

提交供应商

parent c8defe09
......@@ -364,5 +364,16 @@ namespace Mall.Common
}
}
/// <summary>
/// 公司id
/// </summary>
public static string RB_Branch_Id
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("RB_Branch_Id").Value;
}
}
}
}
\ No newline at end of file
......@@ -2,15 +2,153 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Mall.Common;
using Mall.Common.API;
using Mall.Common.Plugin;
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 Newtonsoft.Json.Linq;
namespace Mall.WebApi.Controllers.User
{
public class SupplierController : Controller
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class SupplierController : BaseController
{
public IActionResult Index()
private readonly SupplierModule supplierModule = new SupplierModule();
[HttpPost]
public ApiResult GetSupplierList()
{
var parms = RequestParm;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
RB_Supplier_Extend demodel = JsonConvert.DeserializeObject<RB_Supplier_Extend>(RequestParm.msg.ToString());
demodel.TenantId = UserInfo.TenantId;
demodel.MallBaseId = parms.MallBaseId;
var list = supplierModule.GetPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
x.CreateDate,
x.Name,
x.Mobile,
x.Address,
x.ClientBankAccount?.CardNum,
x.ClientBankAccount?.OpenBankName,
x.ClientBankAccount?.AccountAlias,
x.ClientBankAccount?.AccountHolder,
AccountClassifyStr = x.ClientBankAccount?.AccountClassify == 2 ? "银行" : (x.ClientBankAccount?.AccountClassify == 3 ? "虚拟账户" : (x.ClientBankAccount?.AccountClassify == 4 ? "微信支付宝" : "")),
});
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 添加修改
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
public ApiResult SetSupplier()
{
var parms = RequestParm;
RB_Supplier_Extend demodel = JsonConvert.DeserializeObject<RB_Supplier_Extend>(RequestParm.msg.ToString());
if (string.IsNullOrEmpty(demodel.Name))
{
return ApiResult.Failed("请填写供应商名称");
}
if (string.IsNullOrEmpty(demodel.Mobile))
{
return ApiResult.Failed("请填写联系电话");
}
if (string.IsNullOrEmpty(demodel.ClientBankAccount.OpenBankName))
{
return ApiResult.Failed("请填写开户行!");
}
if (string.IsNullOrEmpty(demodel.ClientBankAccount.AccountHolder))
{
return ApiResult.Failed("请填写开户人!");
}
if (string.IsNullOrEmpty(demodel.ClientBankAccount.CardNum))
{
return ApiResult.Failed("请填写卡号!");
}
if (supplierModule.ExistsClientAccount(demodel.ClientBankAccount.ID, demodel.ClientBankAccount.CardNum, 2, Convert.ToInt32(Config.RB_Branch_Id)))
{
return ApiResult.Failed("卡号重复!");
}
demodel.TenantId = UserInfo.TenantId;
demodel.MallBaseId = parms.MallBaseId;
demodel.CreateDate = DateTime.Now;
demodel.ClientBankAccount.CreateDate = DateTime.Now;
demodel.ClientBankAccount.RB_Branch_Id = Convert.ToInt32(Config.RB_Branch_Id);
demodel.ClientBankAccount.RB_Group_Id = 2;
demodel.ClientBankAccount.CreateBy = Convert.ToInt32(Config.NetworkDirector);
bool flag = supplierModule.AddOrUpdateSupplier(demodel);
if (flag)
return ApiResult.Success();
else
return ApiResult.Failed("请求失败!");
}
/// <summary>
/// 获取详情
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetSupplierDetail()
{
var parms = RequestParm;
var query = JsonConvert.DeserializeObject<RB_Supplier_Extend>(RequestParm.msg.ToString());
query.TenantId = UserInfo.TenantId;
query.MallBaseId = parms.MallBaseId;
var oldLogisticsModel = supplierModule.GetList(query).FirstOrDefault();
if (oldLogisticsModel == null)
{
oldLogisticsModel = new RB_Supplier_Extend();
}
return ApiResult.Success("", oldLogisticsModel);
}
/// <summary>
/// 删除优惠券
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult DelDiscountCoupon()
{
return View();
var parms = RequestParm;
JObject parmsJob = JObject.Parse(RequestParm.msg.ToString());
int Id = parmsJob.GetInt("Id", 0);
int BackId = parmsJob.GetInt("BackId", 0);
if (Id <= 0)
{
return ApiResult.Failed("请传递参数");
}
bool flag = supplierModule.RemoveSupplier(Id, BackId);
if (flag)
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed();
}
}
}
}
\ No newline at end of file
......@@ -29,6 +29,7 @@
"ByteDanceSendTemplate": "https://developer.toutiao.com/api/apps/game/template/send",
"sTenpayNotify": "http://mallapi.oytour.com/api/WeChatNotify/Notify", //微信回调地址
"NetworkDirector": 1756, //网络主管的id,用于新建供应商账户的时候的创建人
"RB_Branch_Id": 49, //所属公司id
"RebornDMC": "reborn_dmc",
"RedisSetting": {
"RedisServer": "192.168.2.214",
......
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