Commit 04fc998f by guanzhenshan

1、完成接入新用户验证

2、利润统计报表按发货时间增加FBA发货数据
3、解决数据中心帐号余额导入出错的问题
parent eba59f23
......@@ -987,7 +987,7 @@ namespace Bailun.DC.Services
/// <param name="start">付款开始时间</param>
/// <param name="end">付款结束时间</param>
/// <returns></returns>
public List<Models.Orders.dc_base_oms_sku> ListPlatformProfit(string platform, DateTime? start, DateTime? end,DateTime? shipstart,DateTime? shipend,bool isUSD)
public List<Models.Orders.dc_base_oms_sku> ListPlatformProfit(string platform, DateTime? start, DateTime? end,DateTime? shipstart,DateTime? shipend,bool isUSD, int companyid)
{
var sqlparam = new DynamicParameters();
var sql = "select tb.platform_type,count(tb.bailun_order_id) order_count,sum(tb.amount_sales*"+(isUSD? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + ") as amount_sales,sum(tb.cost_platform_fee*(if(tb.platform_type='Ebay'," + (isUSD ? "tb.other_to_usd_exchange_rate" : "tb.seller_other_exchange_rate") + "," + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "))) as cost_platform_fee,sum(cost_first*"+ (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") as cost_first,sum(cost_tail*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") cost_tail,sum(cost_handle_bailun*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") cost_handle_bailun,sum(cost_handle_platform*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") cost_handle_platform,sum(amount_refund*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + ") amount_refund,sum(cost_product*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") cost_product,sum(profit_total*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") profit_total,(sum(profit_total*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ")/sum(tb.amount_sales*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + ")) profit_rate,count(amount_prepaid>0 or null) as noshippingcount,sum(amount_prepaid*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") amount_prepaid from dc_base_oms_order tb ";
......@@ -997,7 +997,8 @@ namespace Bailun.DC.Services
sql += " left join dc_base_oms_pick t1 on tb.bailun_order_id =t1.bailun_order_id ";
}
sql += " where tb.bailun_order_status!='Canceled' and tb.bailun_order_status!='CantHandle' and tb.has_scalp=0 and tb.has_innersale=0";
sql += " where tb.bailun_order_status!='Canceled' and tb.bailun_order_status!='CantHandle' and tb.has_scalp=0 and tb.has_innersale=0 ";
//sql += " and tb.company_id=" + companyid; //按公司区分
if (!string.IsNullOrWhiteSpace(platform))
{
......@@ -1051,7 +1052,7 @@ namespace Bailun.DC.Services
/// <param name="shipstart">发货开始时间</param>
/// <param name="shipend">发货结束时间</param>
/// <returns></returns>
public List<Models.Orders.dc_base_oms_sku> ListPlatformProfitByShipTime(string platform, DateTime? start, DateTime? end, DateTime? shipstart, DateTime? shipend, bool isUSD)
public List<Models.Orders.dc_base_oms_sku> ListPlatformProfitByShipTime(string platform, DateTime? start, DateTime? end, DateTime? shipstart, DateTime? shipend, bool isUSD,int companyid)
{
var sqlparam = new DynamicParameters();
var sql = "select tb.platform_type,count(tb.bailun_order_id) order_count,sum(tb.amount_sales*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + ") as amount_sales,sum(tb.cost_platform_fee*(if(tb.platform_type='Ebay'," + (isUSD ? "tb.other_to_usd_exchange_rate" : "tb.seller_other_exchange_rate") + "," + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "))) as cost_platform_fee,sum(cost_first*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") as cost_first,sum(cost_tail*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") cost_tail,sum(cost_handle_bailun*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") cost_handle_bailun,sum(cost_handle_platform*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") cost_handle_platform,sum(amount_refund*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + ") amount_refund,sum(cost_product*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") cost_product,sum(profit_total*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") profit_total,(sum(profit_total*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ")/sum(tb.amount_sales*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + ")) profit_rate,count(amount_prepaid>0 or null) as noshippingcount,sum(amount_prepaid*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") amount_prepaid from dc_base_oms_order tb ";
......@@ -1070,9 +1071,13 @@ namespace Bailun.DC.Services
sql += " and shipping_time<'"+shipend.Value.AddDays(1).ToString("yyyy-MM-dd")+"'";
}
sql += " group by bailun_order_id) t2 on tb.bailun_order_id=t2.bailun_order_id ";
//sql += " company_id="+companyid; //按公司区分
sql += " group by bailun_order_id ";
sql += " ) t2 on tb.bailun_order_id=t2.bailun_order_id ";
sql += " where tb.bailun_order_status!='Canceled' and tb.has_scalp=0 and tb.bailun_order_status!='CantHandle' and tb.has_scalp=0 and tb.has_innersale=0 ";
//sql += " and tb.company_id=" + companyid; //按公司区分
if (!string.IsNullOrWhiteSpace(platform))
{
......@@ -2511,11 +2516,11 @@ namespace Bailun.DC.Services
if (start.HasValue)
{
sql += " and paid_time_site>='" + start.Value.ToString("yyyy-MM-dd HH:mm:ss") + "'";
sql += " and paid_time>='" + start.Value.ToString("yyyy-MM-dd HH:mm:ss") + "'";
}
if (end.HasValue)
{
sql += " and paid_time_site<'" + end.Value.ToString("yyyy-MM-dd HH:mm:ss") + "'";
sql += " and paid_time<'" + end.Value.ToString("yyyy-MM-dd HH:mm:ss") + "'";
}
if (!string.IsNullOrEmpty(platform))
{
......
......@@ -389,7 +389,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
{
if (t == 2) //按付款主体
{
listCol = list.GroupBy(a => a.companyName).Select(p => p.Key).ToList();
listCol = list.GroupBy(a => a.companyName).Select(p => p.Key).OrderBy(a=>a).ToList();
}
else //按部门
......
......@@ -6,6 +6,10 @@ using Microsoft.AspNetCore.Mvc;
using Bailun.DC.Models;
using Newtonsoft.Json;
using Microsoft.AspNetCore.Hosting;
using Bailun.ServiceFabric.Authorize;
using Bailun.ServiceFabric.Core.Extension.HttpContext;
using Bailun.ServiceFabric.Core.Extension;
using Bailun.ServiceFabric.Extension;
namespace Bailun.DC.Web.Areas.Reports.Controllers
{
......@@ -42,6 +46,8 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
/// <returns></returns>
public string ListPlatformCostJson(BtTableParameter parameter, string platform, DateTime? start, DateTime? end,string website,string account,string warehousetype,string warehousecode)
{
var companyid = HttpContextHelper.Current?.User.GetCompanyId().ToInt32();
var total = 0;
var obj = new Services.OrdersServices().ListPlatformCost(parameter, platform, start, end,website,account,warehousetype,warehousecode, ref total);
......@@ -577,15 +583,21 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
[HttpPost]
public JsonResult PlatformProfitCountJson(string platform,DateTime? start,DateTime? end,DateTime? shipstart,DateTime? shipend,string currency)
{
var companyid = HttpContextHelper.Current?.User?.GetCompanyId().ToInt32();
var result = new List<Models.Orders.dc_base_oms_sku>();
if (shipstart.HasValue || shipend.HasValue)
{
result = new Services.OrdersServices().ListPlatformProfitByShipTime(platform, start, end, shipstart, shipend, currency.ToUpper() == "USD");
result = new Services.OrdersServices().ListPlatformProfitByShipTime(platform, start, end, shipstart, shipend, currency.ToUpper() == "USD",companyid??0);
var fbaResult = new Services.OrdersServices().ListPlatformProfit(string.IsNullOrEmpty(platform) ? "FBA" : "", shipstart, shipend, null, null, currency.ToUpper() == "USD", companyid ?? 0);
result.AddRange(fbaResult);
}
else
{
result = new Services.OrdersServices().ListPlatformProfit(platform, start, end, shipstart, shipend,currency.ToUpper()=="USD");
result = new Services.OrdersServices().ListPlatformProfit(platform, start, end, shipstart, shipend,currency.ToUpper()=="USD",companyid??0);
}
if (result.Count > 0)
......@@ -1012,6 +1024,8 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
/// <returns></returns>
public string EbaySaleStatisticsJson(BtTableParameter parameter, string selleraccount, string website, DateTime start, DateTime end, string warehousetype, string warehousecode)
{
var companyid = HttpContextHelper.Current?.User?.GetCompanyId().ToInt32();
var total = 0;
var services = new Services.OrdersServices();
var objwithdraw = new Services.PlatformSiteServices().GetPlatformLossWithdraw().Where(a => a.english_name == "Ebay").FirstOrDefault();
......
......@@ -14,6 +14,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Bailun.ServiceFabric.Authorize" Version="1.0.3" />
<PackageReference Include="Bailun.ServiceFabric.Core" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.1" />
<PackageReference Include="NPOI" Version="2.4.1" />
......
......@@ -2,6 +2,10 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Bailun.ServiceFabric.Authorize;
using Bailun.ServiceFabric.Core.Extension;
using Bailun.ServiceFabric.Core.Extension.HttpContext;
using Bailun.ServiceFabric.Extension;
using Microsoft.AspNetCore.Mvc;
namespace Bailun.DC.Web.Controllers
......@@ -97,33 +101,21 @@ namespace Bailun.DC.Web.Controllers
return Json(result);
}
[BailunAuthentication(LoginMode.Enforce)]
[HttpPost]
public JsonResult GetUserInfo(string acc)
public JsonResult GetUserInfo()
{
var strResult = Common.HttpHelper.NetHelper.HttpPost(ConfigHelper.GetByName("GetUser"), "BLUserAcct=" + acc + "&webcode=wuliu");
try
{
var obj = Newtonsoft.Json.Linq.JObject.Parse(strResult);
if (obj["code"].ToString() != "0")
{
return Json(new
{
success = true,
userid = Convert.ToInt32(obj["data"]["UserId"].ToString().Trim()),
username = obj["data"]["UserName"].ToString().Trim(),
jobs = obj["data"]["Jobs"].ToString().Trim()
});
}
}
catch
{
}
var userid = HttpContextHelper.Current?.User?.GetUid().ToStr();
var username = HttpContextHelper.Current.User.GetUserName();
var jobs = ""; //HttpContextHelper.Current.User.GetRolesCode();
var companyid = HttpContextHelper.Current.User.GetCompanyId();
return Json(new
{
success = false
success = true,
userid = userid,
username = username,
jobs = jobs
});
}
......
......@@ -85,7 +85,7 @@
<script src="/css/bootstrap-select-1.12.4/js/bootstrap-select.js"></script>
<script src="~/js/jquery.cookie.js" type="text/javascript"></script>
<!--常用js方法-->
<script src="/js/common.js?=201903011812"></script>
<script src="/js/common.js?=20190606001"></script>
@RenderSection("scripts", required: false)
<script type="text/javascript">
......
......@@ -106,7 +106,7 @@
<!--下拉选择搜索控件-->
<script src="/css/bootstrap-select-1.12.4/js/bootstrap-select.js"></script>
<!--常用js方法-->
<script src="/css/js/common.js?=201801251445"></script>
<script src="/css/js/common.js?=20190606001"></script>
@RenderSection("scripts", required: false)
<script type="text/javascript">
......
......@@ -2,12 +2,16 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Bailun.ServiceFabric.Core.Extension.HttpContext;
using Bailun.ServiceFabric.Extension;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace Bailun.DC.Web
{
......@@ -34,7 +38,7 @@ namespace Bailun.DC.Web
//services.AddSession();
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
......@@ -77,7 +81,10 @@ namespace Bailun.DC.Web
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
ConfigManagerConf.SetConfiguration(Configuration);
app.UseStaticHttpContext();
}
}
}
......@@ -11,5 +11,9 @@
"rootFilePath": "C:\\WebSite\\DataCenter-NetCore2",
"LoginUrl": "http://www.bailuntec.com/Login/Index?guid=dbc0cffc7f4d11e8a4ca246e96754d42",
"LoginOutUrl": "http://www.bailuntec.com/Login/LoginOut",
"GetUser": "http://www.bailuntec.com/Login/GetUserByBLUserAcct"
"GetUser": "http://www.bailuntec.com/Login/GetUserByBLUserAcct",
"AppSetting": {
"SsoUrl": "http://sso.bailuntec.com", //֤url
"AuthType": "" //Ƿdebugģʽ
}
}
var baseUrl = 'http://data.bailuntec.com/';
var baseUrl = 'http://localhost:59628/';
var globalOrderSort='';
var globalOrderType = '';
......@@ -211,11 +211,14 @@ $.submit = function (data) {
url: data.url,
type: data.type||'GET',
data: data.paramData,
beforeSend: function () {
beforeSend: function (request) {
if (!data.noloading)
{
//load_index = layer.load();
}
request.setRequestHeader("Authorization", $.cookie("token"));
},
success: function (result) {
try {
......@@ -298,31 +301,37 @@ function numFormat(num) {
}
function login() {
var useracc = $.cookie('BLUserAcct');
//useracc = "4DF8961A9925E5F930133BB9235E605D4028EC3AA22DF07934EBDF7837FCBB9AC7D7B73BF50EF3B8B0B39499EFE2B0776303D6177B439F52B2781CD19831235EE5800ADB5B0770479A89E6DF7BA71D84|4DF8961A9925E5F925E15FBFCF682CAFA7CE698D19B44E255990FC4BF53934C8E87F5463597DB55AEE88A69634CB5A5FE25B58A53DE2651717042F901222BBD828E8ABA3401F54262493AA27D2E9383D0A097B881DF74984932FE6D929A706C0B0280272C4EDB089A66F2A11012E0C5CC19E7F0DF4490C8AF34AC401B4709A4AC9C10DF18923EF3DFE31F49C7E970031ED90B215F31D9CAE166DD59D87F5D1E60955AB383BE1F84F611D8B3C71247748D6F212472D44BB853F4935180429A01961CEFC8F7A528AE14BB1B4B987F4E337";
if (useracc == undefined || useracc == null) {
window.location = "http://www.bailuntec.com/Login/Index?guid=dbc0cffc7f4d11e8a4ca246e96754d42";
var token = getUrlParam('token');
if (token != '') {
$.cookie('token', token, { expires: 1 });
}
else {
$.submit({
type:'POST',
url: baseUrl+'Home/GetUserInfo?acc=' + useracc,
paramData: '',
func: function (result) {
if (result.success) {
userid = result.userid;
username = result.username;
jobs = result.jobs;
token = $.cookie('token');
$('#user-job').html(jobs);
$('#user-name').html(username);
if (token == undefined) {
window.location = "http://sso.bailuntec.com/?returnUrl=" + baseUrl;
return false;
}
}
$.submit({
type:'POST',
url: baseUrl+'Home/GetUserInfo',
paramData: '',
func: function (result) {
if (result.success) {
userid = result.userid;
username = result.username;
jobs = result.jobs;
$('#user-job').html(jobs);
$('#user-name').html(username);
}
else {
window.location = "http://www.bailuntec.com/Login/Index?guid=dbc0cffc7f4d11e8a4ca246e96754d42";
}
}
})
}
else {
window.location = "http://sso.bailuntec.com/?returnUrl=" + baseUrl;
}
}
})
}
//login();
\ No newline at end of file
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