绑定客户时,下拉项里只取报关客户

手动扣费
master
wanghaomei 1 year ago
parent 0d445151a7
commit 09b17f5ce8

@ -128,5 +128,19 @@ namespace djy.Paas.IService
/// 处理自动扣费
/// </summary>
void ProcCustFee();
/// <summary>
/// 报关扣费
/// </summary>
/// <param name="ord"></param>
/// <returns></returns>
ReturnResult<string> CustFee(tb_BaoGuanOrderList ord);
/// <summary>
/// 报关扣费
/// </summary>
/// <param name="gid"></param>
/// <returns></returns>
Task<ReturnResult<string>> CustFee(Guid gid);
}
}

@ -2247,134 +2247,177 @@ namespace djy.Paas.Service
foreach (var ord in orderList)
{
var customerComp = DbBus.Get(DbList.djyolddb)
_LogsAdd($"{ord.Gid} {ord.ShipOrderNo}", "胜云航通自动扣费", null);
CustFee(ord);
}
}
}
}
/// <summary>
/// 报关扣费
/// </summary>
/// <param name="ord"></param>
/// <returns></returns>
public ReturnResult<string> CustFee(tb_BaoGuanOrderList ord)
{
var rs = new ReturnResult<string>();
rs.OK();
var cfgDingtalk = DjyTools.GetConfigKey("baoguanDingtalkNotify");
var customerComp = DbBus.Get(DbList.djyolddb)
.Select<CompanyNew>()
.Where(x => x.CompName == ord.ClientName)
.ToOne();
if (customerComp == null)
{
//推送钉钉消息给客服
var content = $"公司{ord.ClientName}提单号{ord.ShipOrderNo}未找到";
_LogsAdd(content, "胜云航通自动扣费", null);
var gethtml = DjyTools.PostOnLogs(new { text = new { content = $"【未扣费提醒】\r\n{content}\r\n----报关消息通知" }, msgtype = "text" }, cfgDingtalk, "胜云航通自动扣费", YsPsotType.Json).Result;
//设置状态
DbBus.Get(DbList.djypublicedb).Update<tb_BaoGuanOrderList>()
.Where(x => x.Gid == ord.Gid)
.Set(x => x.StaCustFee, "FAIL")
.Set(x => x.TimeCustFee, DateTime.Now)
.ExecuteAffrows();
continue;
}
if (customerComp == null)
{
//推送钉钉消息给客服
var content = $"公司{ord.ClientName}提单号{ord.ShipOrderNo}未找到";
_LogsAdd(content, "胜云航通扣费", null);
var gethtml = DjyTools.PostOnLogs(new { text = new { content = $"【未扣费提醒】\r\n{content}\r\n----报关消息通知" }, msgtype = "text" }, cfgDingtalk, "胜云航通扣费", YsPsotType.Json).Result;
//设置状态
DbBus.Get(DbList.djypublicedb).Update<tb_BaoGuanOrderList>()
.Where(x => x.Gid == ord.Gid)
.Set(x => x.StaCustFee, "FAIL")
.Set(x => x.TimeCustFee, DateTime.Now)
.ExecuteAffrows();
rs.Not(content);
return rs;
}
var balance = DbBus.Get(DbList.djyolddb)
.Select<CustBalance>()
.Where(x => x.COMNAME == customerComp.CompName)
.ToOne();
var balance = DbBus.Get(DbList.djyolddb)
.Select<CustBalance>()
.Where(x => x.COMNAME == customerComp.CompName)
.ToOne();
//没有钱包
if (balance == null)
{
//推送钉钉消息给客服
var content = $"公司{ord.ClientName}提单号{ord.ShipOrderNo}没有钱包";
_LogsAdd(content, "胜云航通自动扣费", null);
var gethtml = DjyTools.PostOnLogs(new { text = new { content = $"【未扣费提醒】\r\n{content}\r\n----报关消息通知" }, msgtype = "text" }, cfgDingtalk, "胜云航通自动扣费", YsPsotType.Json).Result;
//没有钱包
if (balance == null)
{
//推送钉钉消息给客服
var content = $"公司{ord.ClientName}提单号{ord.ShipOrderNo}没有钱包";
_LogsAdd(content, "胜云航通扣费", null);
var gethtml = DjyTools.PostOnLogs(new { text = new { content = $"【未扣费提醒】\r\n{content}\r\n----报关消息通知" }, msgtype = "text" }, cfgDingtalk, "胜云航通扣费", YsPsotType.Json).Result;
//设置状态
DbBus.Get(DbList.djypublicedb).Update<tb_BaoGuanOrderList>()
.Where(x => x.Gid == ord.Gid)
.Set(x => x.StaCustFee, "FAIL")
.Set(x => x.TimeCustFee, DateTime.Now)
.ExecuteAffrows();
//设置状态
DbBus.Get(DbList.djypublicedb).Update<tb_BaoGuanOrderList>()
.Where(x => x.Gid == ord.Gid)
.Set(x => x.StaCustFee, "FAIL")
.Set(x => x.TimeCustFee, DateTime.Now)
.ExecuteAffrows();
continue;
}
rs.Not(content);
return rs;
}
var price = DbBus.Get(DbList.djyolddb)
.Select<CustPrice>()
.Where(x => x.COMNAME == customerComp.CompName && x.SENDTYPE == 0 && x.BSTYPE == 13)
.ToOne();
var price = DbBus.Get(DbList.djyolddb)
.Select<CustPrice>()
.Where(x => x.COMNAME == customerComp.CompName && x.SENDTYPE == 0 && x.BSTYPE == 13)
.ToOne();
//未设置单价
if (price == null)
{
//推送钉钉消息给客服
var content = $"公司{ord.ClientName}提单号{ord.ShipOrderNo}的报关单价未设置";
var gethtml = DjyTools.PostOnLogs(new { text = new { content = $"【未扣费提醒】\r\n{content}\r\n----报关消息通知" }, msgtype = "text" }, cfgDingtalk, "胜云航通自动扣费", YsPsotType.Json).Result;
//未设置单价
if (price == null)
{
//推送钉钉消息给客服
var content = $"公司{ord.ClientName}提单号{ord.ShipOrderNo}的报关单价未设置";
var gethtml = DjyTools.PostOnLogs(new { text = new { content = $"【未扣费提醒】\r\n{content}\r\n----报关消息通知" }, msgtype = "text" }, cfgDingtalk, "胜云航通扣费", YsPsotType.Json).Result;
//设置状态
DbBus.Get(DbList.djypublicedb).Update<tb_BaoGuanOrderList>()
.Where(x => x.Gid == ord.Gid)
.Set(x => x.StaCustFee, "FAIL")
.Set(x => x.TimeCustFee, DateTime.Now)
.ExecuteAffrows();
//设置状态
DbBus.Get(DbList.djypublicedb).Update<tb_BaoGuanOrderList>()
.Where(x => x.Gid == ord.Gid)
.Set(x => x.StaCustFee, "FAIL")
.Set(x => x.TimeCustFee, DateTime.Now)
.ExecuteAffrows();
continue;
}
rs.Not(content);
return rs;
}
//余额不足
if (price.PRICE > balance.Balance)
{
//推送钉钉消息给客服
var content = $"公司{ord.ClientName}提单号{ord.ShipOrderNo}的余额不足";
var gethtml = DjyTools.PostOnLogs(new { text = new { content = $"【未扣费提醒】\r\n{content}\r\n----报关消息通知" }, msgtype = "text" }, cfgDingtalk, "胜云航通自动扣费", YsPsotType.Json).Result;
//余额不足
if (price.PRICE > balance.Balance)
{
//推送钉钉消息给客服
var content = $"公司{ord.ClientName}提单号{ord.ShipOrderNo}的余额不足";
var gethtml = DjyTools.PostOnLogs(new { text = new { content = $"【未扣费提醒】\r\n{content}\r\n----报关消息通知" }, msgtype = "text" }, cfgDingtalk, "胜云航通扣费", YsPsotType.Json).Result;
//设置状态
DbBus.Get(DbList.djypublicedb).Update<tb_BaoGuanOrderList>()
.Where(x => x.Gid == ord.Gid)
.Set(x => x.StaCustFee, "FAIL")
.Set(x => x.TimeCustFee, DateTime.Now)
.ExecuteAffrows();
//设置状态
DbBus.Get(DbList.djypublicedb).Update<tb_BaoGuanOrderList>()
.Where(x => x.Gid == ord.Gid)
.Set(x => x.StaCustFee, "FAIL")
.Set(x => x.TimeCustFee, DateTime.Now)
.ExecuteAffrows();
continue;
}
rs.Not(content);
return rs;
}
//执行扣费
var fin = new FinanceService();
var getfinrs = fin.Expend(new djy.Model.CustFee
{
SENDUSERID = customerComp.AdminUser,
LURURENID = customerComp.AdminUser,
CtnrCount = 1,
CtnrInfo = string.Empty,
BSTYPE = 13,
SENDTYPE = 0,
BSNO = ord.Gid.ToString(),
MBLNO = ord.ShipOrderNo
}, 1);
if (getfinrs.Status)
{
//设置状态
DbBus.Get(DbList.djypublicedb).Update<tb_BaoGuanOrderList>()
.Where(x => x.Gid == ord.Gid)
.Set(x => x.StaCustFee, "OK")
.Set(x => x.TimeCustFee, DateTime.Now)
.ExecuteAffrows();
}
else
{
//设置状态
DbBus.Get(DbList.djypublicedb).Update<tb_BaoGuanOrderList>()
.Where(x => x.Gid == ord.Gid)
.Set(x => x.StaCustFee, "FAIL")
.Set(x => x.TimeCustFee, DateTime.Now)
.ExecuteAffrows();
//执行扣费
var fin = new FinanceService();
var getfinrs = fin.Expend(new djy.Model.CustFee
{
SENDUSERID = customerComp.AdminUser,
LURURENID = customerComp.AdminUser,
CtnrCount = 1,
CtnrInfo = string.Empty,
BSTYPE = 13,
SENDTYPE = 0,
BSNO = ord.Gid.ToString(),
MBLNO = ord.ShipOrderNo
}, 1);
if (getfinrs.Status)
{
//设置状态
DbBus.Get(DbList.djypublicedb).Update<tb_BaoGuanOrderList>()
.Where(x => x.Gid == ord.Gid)
.Set(x => x.StaCustFee, "OK")
.Set(x => x.TimeCustFee, DateTime.Now)
.ExecuteAffrows();
}
else
{
//设置状态
DbBus.Get(DbList.djypublicedb).Update<tb_BaoGuanOrderList>()
.Where(x => x.Gid == ord.Gid)
.Set(x => x.StaCustFee, "FAIL")
.Set(x => x.TimeCustFee, DateTime.Now)
.ExecuteAffrows();
//推送钉钉消息给客服
var content = $"公司{ord.ClientName}提单号{ord.ShipOrderNo}报关扣费失败:{getfinrs.Message}";
var gethtml = DjyTools.PostOnLogs(new { text = new { content = $"【未扣费提醒】\r\n{content}\r\n----报关消息通知" }, msgtype = "text" }, cfgDingtalk, "胜云航通自动扣费", YsPsotType.Json).Result;
//推送钉钉消息给客服
var content = $"公司{ord.ClientName}提单号{ord.ShipOrderNo}报关扣费失败:{getfinrs.Message}";
var gethtml = DjyTools.PostOnLogs(new { text = new { content = $"【未扣费提醒】\r\n{content}\r\n----报关消息通知" }, msgtype = "text" }, cfgDingtalk, "胜云航通扣费", YsPsotType.Json).Result;
}
}
}
}
return rs;
}
/// <summary>
/// 报关扣费
/// </summary>
/// <param name="gid"></param>
/// <returns></returns>
public async Task<ReturnResult<string>> CustFee(Guid gid)
{
var ord = await DbBus.Get(DbList.djypublicedb)
.Select<tb_BaoGuanOrderList>()
.Where(x => x.Gid == gid)
.ToOneAsync();
if (ord.StaCustFee == "OK")
{
var rtn = new ReturnResult<string>();
rtn.Not("当前业务已成功扣费,无需再次扣费");
return rtn;
}
return CustFee(ord);
}
#endregion
}

@ -14,7 +14,7 @@ namespace djy.Paas.Service
{
public ReturnPagedResult<ClientLinkInfoDto> GetList(ClientLinkInfoDto Dto, ApiFromDto apiFrom)
{
var rs=new ReturnPagedResult<ClientLinkInfoDto>();
var rs = new ReturnPagedResult<ClientLinkInfoDto>();
//var sql = DbBus.Get(DbList.djyolddb).Select<InfoClientContact, OPSEAECLIENT>().LeftJoin((link, com) => link.LINKID == com.GID);
//sql.WhereIf(Dto.CompGid.IsNotNull(), (link, com) => com.CompId == Dto.CompGid)
@ -22,8 +22,10 @@ namespace djy.Paas.Service
//.WhereIf(Dto.ClientCodeName.IsNotNull(), (link, com) => com.CODENAME.Contains(Dto.ClientCodeName))
//.WhereIf(Dto.LinkName.IsNotNull(), (link, com) => link.SHOWNAME.Contains(Dto.LinkName));
//rs.Data = sql.Count(out var totalcount).Page(apiFrom.Page, apiFrom.Limit).ToList<ClientLinkInfoDto>((info,com)=>new ClientLinkInfoDto {CompGid=com.CompId,ClientName=com.SHORTNAME,ClientCodeName=com.CODENAME, LinkName=info.SHOWNAME,Email=info.EMAIL });
var sql = DbBus.Get(DbList.djyolddb).Select<CompanyNew, UserBaseinfo>().LeftJoin((comp,user)=>comp.AdminUser==user.USERID);
rs.Data = sql.Count(out var totalcount).Page(apiFrom.Page, apiFrom.Limit).ToList<ClientLinkInfoDto>((comp, user) => new ClientLinkInfoDto { CompGid = comp.CompId, ClientName = comp.CompName, ClientCodeName = "", LinkName = comp.AdminShowName, Email = user.EMAIL1 });
var sql = DbBus.Get(DbList.djyolddb).Select<CompanyNew, CompanyNewParamValue, UserBaseinfo>()
.InnerJoin((comp, compPara, user) => comp.CompId == compPara.CompId && compPara.ParaCode == "IS_CUSTOMER_BAOGUAN" && compPara.ItemCode == "YES")
.LeftJoin((comp, compPar, user) => comp.AdminUser == user.USERID);
rs.Data = sql.Count(out var totalcount).Page(apiFrom.Page, apiFrom.Limit).ToList<ClientLinkInfoDto>((comp, compPar, user) => new ClientLinkInfoDto { CompGid = comp.CompId, ClientName = comp.CompName, ClientCodeName = "", LinkName = comp.AdminShowName, Email = user.EMAIL1 });
rs.OK();
return rs;
}

@ -233,60 +233,6 @@ namespace djyweb_djyPaasApi.Controllers
}
///// <summary>
/////获取阿里云报关跳转token
///// </summary>
///// <returns></returns>
//[HttpGet("gettoken")]
//public async Task<object> GetBaoguanToken()
//{
// var rs = await _server.AliyunBaoguanToken(new djy.Model.User { GID = GetLoginId.ToString() });
// if (rs.Status)
// {//直接跳转到报关预录
// rs.MemoData = @"https://onetouch-partner.alibaba.com/ptnProvider/customs/thirdParty.htm?token={" + rs.Data + "}&platform=DaJianYun&targetUrl=%2F%2Fonetouch.alibaba.com%2FsaasCustomer%2Flist.htm%3Fplatform%3DDaJianYun";
// }
// return rs;
//}
///// <summary>
///// 接收阿里推送的绑定反馈
///// </summary>
///// <param name="Dto"></param>
///// <returns></returns>
//[AllowAnonymous]
//[HttpPost("aliback")]
//public async Task<object> Aliback([FromBody] ApiFromDto Dto) => await _server.AliBack(Dto);
///// <summary>
///// 报关用户离职 [key=usergid base64位加密字符串]
///// </summary>
///// <param name="Dto"></param>
///// <returns></returns>
//[AllowAnonymous]
//[HttpPost("userquit")]
//public async Task<object> UserQuit([FromBody] ApiFromDto Dto)
//{
// //2022-4-1配合大简云主程序员工离职流程调整特修改开发测试环境不调用阿里离职
// if (sysOptionConfig.YsWebconfig.IsDev)
// {
// var rs = new ReturnResult<string>();
// rs.OK();
// return rs;
// }
// _LogsAdd("userquit", "api", Dto);
// var userid = Dto.Key;
// if (userid.IsNotNull())
// {
// return await _server.AliUserQuit(userid);
// }
// else
// {
// return new ReturnResult<string>() { Message = "错误的请求" };
// }
//}
/// <summary>
/// 根据箱子编号获取箱内详细报关数据 Code 多个,间隔
@ -418,5 +364,17 @@ namespace djyweb_djyPaasApi.Controllers
return rs;
}
/// <summary>
/// 手动扣费报关订单
/// </summary>
/// <param name="gid"></param>
/// <returns></returns>
[HttpPost("custFee")]
public async Task<object> CustFee(Guid gid)
{
var rtn = await _server.CustFee(gid);
return rtn;
}
}
}

@ -27,7 +27,7 @@
"Rbmq_Host": "60.209.125.238:33666",
"Rbmq_UserName": "djy_paas",
"Rbmq_Password": "123qwe",
"Rbmq_Sqlhost": "Data Source =60.209.125.238,33666; Initial Catalog=TestDjyLogs; Persist Security Info=True; User ID =test; Password=test123;pooling=true",
"Rbmq_Sqlhost": "Data Source =60.209.125.238,32009; Initial Catalog=TestDjyLogs; Persist Security Info=True; User ID =sa; Password=sa@djy.net;pooling=true",
"DataConnList": [
{
@ -37,7 +37,7 @@
"Index": 100,
"DataType": 1,
"Status": 0,
"ConnString": "Data Source =60.209.125.238,28000; Initial Catalog=TestBillCenter; Persist Security Info=True; User ID =test; Password=test123;pooling=true;max pool size=2"
"ConnString": "Data Source =60.209.125.238,32009; Initial Catalog=TestBillCenter; Persist Security Info=True; User ID =sa; Password=sa@djy.net;pooling=true;max pool size=2"
},
{
@ -47,7 +47,7 @@
"Index": 100,
"DataType": 1,
"Status": 0,
"ConnString": "Data Source =60.209.125.238,28000; Initial Catalog=TestPubliceData; Persist Security Info=True; User ID =test; Password=test123;pooling=true"
"ConnString": "Data Source =60.209.125.238,32009; Initial Catalog=TestPubliceData; Persist Security Info=True; User ID =sa; Password=sa@djy.net;pooling=true"
},
{
@ -56,7 +56,7 @@
"Index": 100,
"DataType": 1,
"Status": 0,
"ConnString": "Data Source =60.209.125.238,28000; Initial Catalog=TestDjyLogs; Persist Security Info=True; User ID =test; Password=test123;pooling=true"
"ConnString": "Data Source =60.209.125.238,32009; Initial Catalog=TestDjyLogs; Persist Security Info=True; User ID =sa; Password=sa@djy.net;pooling=true"
},
{
@ -66,7 +66,7 @@
"Index": 100,
"DataType": 1,
"Status": 0,
"ConnString": "Data Source =60.209.125.238,28000; Initial Catalog=TestDsPingTai; Persist Security Info=True; User ID =test; Password=test123;pooling=true"
"ConnString": "Data Source =60.209.125.238,32009; Initial Catalog=TestDsPingTai; Persist Security Info=True; User ID =sa; Password=sa@djy.net;pooling=true"
}

Loading…
Cancel
Save