diff --git a/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeReimbursementDto.cs b/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeReimbursementDto.cs
index 92aa1a6a..c92e2ada 100644
--- a/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeReimbursementDto.cs
+++ b/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeReimbursementDto.cs
@@ -441,5 +441,90 @@ namespace DS.WMS.Core.Fee.Dtos
}
#endregion
-
+ public class DingCallBackInput
+ {
+ public string encrypt { get; set; }
+ }
+
+
+ public class ApprovalInstanceModel
+ {
+ public string EventType { get; set; }
+ public long TimeStamp { get; set; }
+ public string[] UserId { get; set; }
+ public string CorpId { get; set; }
+
+
+
+ public string processInstanceId { get; set; }
+ public string corpId { get; set; }
+ public long createTime { get; set; }
+ public string title { get; set; }
+ public string type { get; set; }
+ public string staffId { get; set; }
+ public string url { get; set; }
+ public string processCode { get; set; }
+
+
+
+ public string result { get; set; }
+
+ }
+
+
+ ///
+ /// 审批实例开始,结束
+ ///
+ public class bpms_instance_changeCallBack
+ {
+ ///
+ /// 事件类型
+ ///
+ public string EventType { get; set; }
+ ///
+ /// 审批实例id
+ ///
+ public string processInstanceId { get; set; }
+ ///
+ /// 审批实例所在的企业corpId。
+ ///
+ public string corpId { get; set; }
+ ///
+ /// 创建审批实例时间。时间戳,单位毫秒。
+ ///
+ public long createTime { get; set; }
+ ///
+ /// 审批实例标题。
+ ///
+ public string title { get; set; }
+ ///
+ /// 类型,type为start表示审批实例开始。
+ ///
+ public string type { get; set; }
+ ///
+ /// 发起审批实例的员工userId。
+ ///
+ public string staffId { get; set; }
+ ///
+ /// 审批实例url,可在钉钉内跳转到审批页面。
+ ///
+ public string url { get; set; }
+ ///
+ /// 审批模板的唯一码。
+ ///
+ public string processCode { get; set; }
+
+
+ ///
+ /// 正常结束时result为agree,拒绝时result为refuse,审批终止时没这个值。
+ ///
+ public string result { get; set; }
+ }
+
+ public class fromExtValue
+ {
+ public string label { get; set; }
+
+ public string key { get; set; }
+ }
}
\ No newline at end of file
diff --git a/ds-wms-service/DS.WMS.Core/Fee/Entity/InInvoice.cs b/ds-wms-service/DS.WMS.Core/Fee/Entity/InInvoice.cs
index c4b91488..8b7758f1 100644
--- a/ds-wms-service/DS.WMS.Core/Fee/Entity/InInvoice.cs
+++ b/ds-wms-service/DS.WMS.Core/Fee/Entity/InInvoice.cs
@@ -161,10 +161,7 @@ namespace DS.WMS.Core.Fee.Entity
///
public string? SpecialElements { get; set; }
- ///
- /// 报销状态 bxzt
- ///
- public ReimbursementTypeEnums ReimbursementType { get; set; }
+
///
/// 购方银行账号 gfyhzh
@@ -301,6 +298,17 @@ namespace DS.WMS.Core.Fee.Entity
///
public long OrgId { get; set; }
+ ///
+ /// 报销状态 bxzt
+ ///
+ public ReimbursementTypeEnums ReimbursementType { get; set; }
+
+ ///
+ /// 钉钉报销审批单编号
+ ///
+ public string BusinessId { get; set; }
+ //钉钉审批实例Id
+ public string ProcessInstanceId { get; set; }
}
}
diff --git a/ds-wms-service/DS.WMS.Core/Fee/Interface/IDingCallBackService.cs b/ds-wms-service/DS.WMS.Core/Fee/Interface/IDingCallBackService.cs
new file mode 100644
index 00000000..059da030
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/Fee/Interface/IDingCallBackService.cs
@@ -0,0 +1,15 @@
+using DS.WMS.Core.Fee.Dtos;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DS.WMS.Core.Fee.Interface
+{
+
+ public interface IDingCallBackService
+ {
+ Dictionary CallBack(DingCallBackInput model, string corpId, string signature, string timestamp, string nonce);
+ }
+}
diff --git a/ds-wms-service/DS.WMS.Core/Fee/Interface/IReimbursementService.cs b/ds-wms-service/DS.WMS.Core/Fee/Interface/IReimbursementService.cs
index 92db4312..540fb959 100644
--- a/ds-wms-service/DS.WMS.Core/Fee/Interface/IReimbursementService.cs
+++ b/ds-wms-service/DS.WMS.Core/Fee/Interface/IReimbursementService.cs
@@ -78,5 +78,7 @@ namespace DS.WMS.Core.Fee.Interface
/// 报销单Id
///
Task BankPayment(long Id);
+
+
}
}
diff --git a/ds-wms-service/DS.WMS.Core/Fee/Method/DingCallBack.cs b/ds-wms-service/DS.WMS.Core/Fee/Method/DingCallBack.cs
new file mode 100644
index 00000000..55e676bd
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/Fee/Method/DingCallBack.cs
@@ -0,0 +1,181 @@
+using DS.Module.Core.Enums;
+using DS.Module.Core.Helpers;
+using DS.WMS.Core.Code.Entity;
+using DS.WMS.Core.Fee.Dtos;
+using DS.WMS.Core.Fee.Entity;
+using DS.WMS.Core.Fee.Interface;
+using DS.WMS.Core.Sys.Entity;
+using DS.WMS.Core.Sys.Interface;
+using Microsoft.Extensions.DependencyInjection;
+using Newtonsoft.Json;
+using NLog;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DS.WMS.Core.Fee.Method
+{
+ public class DingCallBack: IDingCallBackService
+ {
+ private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
+ private readonly IServiceProvider _serviceProvider;
+ private readonly ISqlSugarClient db;
+ public DingCallBack(IServiceProvider serviceProvider)
+ {
+ _serviceProvider = serviceProvider;
+ db = _serviceProvider.GetRequiredService();
+ }
+
+
+ ///
+ /// 钉钉回调
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Dictionary CallBack(DingCallBackInput model, string corpId, string signature, string timestamp, string nonce)
+ {
+ string strlog = $"钉钉回调,参数{JsonConvert.SerializeObject(model)},参数{corpId},参数{signature},参数{timestamp},参数{nonce}";
+ //Logger.Log(LogLevel.Info, strlog);
+ _logger.Info(strlog);
+ //查询所有租户的数据库连接
+ var dbLinkList = db.Queryable().ClearFilter().ToList();
+
+ foreach (var item in dbLinkList)
+ {
+ SqlSugarClient? tenantDb = null;
+
+ tenantDb = new SqlSugarClient(new ConnectionConfig
+ {
+ ConfigId = item.Id,
+ ConnectionString = item.Connection,
+ DbType = item.DbType,
+ IsAutoCloseConnection = true
+ });
+
+ //对应的钉钉key
+ var dinginfo = tenantDb.Queryable().ClearFilter().Where(t => t.AppKey == corpId && t.Deleted == false && t.AccountType == "DingConfig").First();
+
+ if (dinginfo == null)
+ {
+ continue;
+ }
+
+ //对应的钉钉回调key
+ var DingEvent = tenantDb.Queryable().ClearFilter().Where(t => t.ApiOrgId == dinginfo.ApiOrgId && t.AccountType == "DingEvent" && t.Deleted == false).First();
+
+ //对应的钉钉审批模板
+ var DingProcessCode = tenantDb.Queryable().ClearFilter().Where(t => t.ApiOrgId == dinginfo.ApiOrgId && t.AccountType == "DingProcessCode" && t.Deleted == false).First();
+
+ DingTalkEncryptor callbackCrypto = new DingTalkEncryptor( DingEvent.AppSecret, DingEvent.AppKey, corpId);
+
+ string decryptMsg = callbackCrypto.getDecryptMsg(signature, timestamp, nonce, model.encrypt);
+ string msg = "success";
+ // 3. 反序列化回调事件json数据
+
+ var approveModel = JsonConvert.DeserializeObject(decryptMsg);
+
+ var type = approveModel.EventType;
+ switch (type)
+ {
+ //审批任务开始,结束,转交。
+ case "bpms_task_change":
+ //logger.Log("审批回调:" + JsonConvert.SerializeObject(model), "实例回调日志");
+ // 测试回调
+ break;
+
+ //审批实例开始,结束。
+ case "bpms_instance_change":
+ // 实例改变
+
+ var datamodel = JsonConvert.DeserializeObject(decryptMsg);
+
+ //审批实例开始,将进项发票设为正在审批中
+ if (datamodel.processCode == DingProcessCode.AppKey)
+ {
+ //获取审批实例详细信息
+ var token = DingDing.GetDingToken(dinginfo.AppKey, dinginfo.AppSecret);
+ var processInstanceinfo = DingDing.GetProcessInstanceWithOptions(datamodel.processInstanceId, token);
+ var forminfo = processInstanceinfo.Body.Result.FormComponentValues.Where(t => t.Id == "DDSelectField-fymx").First();
+ var formext = JsonConvert.DeserializeObject(forminfo.ExtValue);
+ var ininvoice = db.Queryable().ClearFilter().Where(t => t.InvoiceNumber == formext.key).First();
+
+ switch (processInstanceinfo.Body.Result.Status)
+ {
+ //新创建
+ case "NEW":
+ //将发票设置为正在使用
+ ininvoice.ReimbursementType = ReimbursementTypeEnums.UnderReview;
+ ininvoice.BusinessId = processInstanceinfo.Body.Result.BusinessId;
+ //ininvoice.ProcessInstanceId = processInstanceinfo.Body.Result.AttachedProcessInstanceIds
+ db.Updateable(ininvoice).ExecuteCommand();
+ break;
+
+ //审批中
+ case "RUNNING":
+ //将发票设置为正在使用
+ ininvoice.ReimbursementType = ReimbursementTypeEnums.UnderReview;
+ ininvoice.BusinessId = processInstanceinfo.Body.Result.BusinessId;
+ db.Updateable(ininvoice).ExecuteCommand();
+ break;
+ //被终止
+ case "TERMINATED":
+ //将发票设置为未使用
+ ininvoice.ReimbursementType = ReimbursementTypeEnums.NotSubmitted;
+ ininvoice.BusinessId = processInstanceinfo.Body.Result.BusinessId;
+ db.Updateable(ininvoice).ExecuteCommand();
+ break;
+ //完成
+ case "COMPLETED":
+ //判断是通过还是驳回
+ if (processInstanceinfo.Body.Result.Result == "agree")
+ {
+ //如果是同意 将发票设为已使用
+ ininvoice.ReimbursementType = ReimbursementTypeEnums.Approved;
+ ininvoice.BusinessId = processInstanceinfo.Body.Result.BusinessId;
+ db.Updateable(ininvoice).ExecuteCommand();
+
+ //获取对应的组织机构的发票列表
+ var ininviceList = tenantDb.Queryable().Where(x => x.ReimbursementType == ReimbursementTypeEnums.NotSubmitted && x.OrgId == dinginfo.ApiOrgId).ToList();
+ var dictlist = db.Queryable().LeftJoin((d, t) => d.TypeId == t.Id).Where((d, t) => t.Code == "Reimbursement_Expense_Ategory").OrderBy(d => d.OrderNo).ToList();
+ //更新审批模板
+ DingDing.UpDingOAForm(token, DingProcessCode.AppKey, ininviceList, dictlist);
+ }
+
+ if (processInstanceinfo.Body.Result.Result == "refuse")
+ {
+ //如果是拒绝 将发票设为未使用
+ ininvoice.ReimbursementType = ReimbursementTypeEnums.NotSubmitted;
+ ininvoice.BusinessId = processInstanceinfo.Body.Result.BusinessId;
+ db.Updateable(ininvoice).ExecuteCommand();
+ }
+ break;
+ //取消
+ case "CANCELED":
+ //将发票设置为未使用
+ ininvoice.ReimbursementType = ReimbursementTypeEnums.NotSubmitted;
+ ininvoice.BusinessId = processInstanceinfo.Body.Result.BusinessId;
+ db.Updateable(ininvoice).ExecuteCommand();
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ }
+
+ var rspMsg = callbackCrypto.getEncryptedMap(msg);
+
+ _logger.Info($"钉钉回调接口返回{JsonConvert.SerializeObject(rspMsg)}");
+ return rspMsg;
+ }
+ return new Dictionary();
+ }
+ }
+}
diff --git a/ds-wms-service/DS.WMS.Core/Fee/Method/DingDing.cs b/ds-wms-service/DS.WMS.Core/Fee/Method/DingDing.cs
index 59201785..19027506 100644
--- a/ds-wms-service/DS.WMS.Core/Fee/Method/DingDing.cs
+++ b/ds-wms-service/DS.WMS.Core/Fee/Method/DingDing.cs
@@ -18,6 +18,25 @@ namespace DS.WMS.Core.Fee.Method
{
public class DingDing
{
+ /**
+ * 使用 Token 初始化账号Client
+ * @return Client
+ * @throws Exception
+ */
+ public static AlibabaCloud.SDK.Dingtalkoauth2_1_0.Client CreateClient1()
+ {
+ AlibabaCloud.OpenApiClient.Models.Config config = new AlibabaCloud.OpenApiClient.Models.Config();
+ config.Protocol = "https";
+ config.RegionId = "central";
+ return new AlibabaCloud.SDK.Dingtalkoauth2_1_0.Client(config);
+ }
+ public static AlibabaCloud.SDK.Dingtalkworkflow_1_0.Client CreateClient()
+ {
+ AlibabaCloud.OpenApiClient.Models.Config config = new AlibabaCloud.OpenApiClient.Models.Config();
+ config.Protocol = "https";
+ config.RegionId = "central";
+ return new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Client(config);
+ }
///
/// 获取token
@@ -63,7 +82,7 @@ namespace DS.WMS.Core.Fee.Method
/// 钉钉token
/// 审批模板Id
/// 租户Id
- public static void UpDingOAForm(string token, string ProcessCode, List inInvoicesData,List dictlist)
+ public static void UpDingOAForm(string token, string ProcessCode, List inInvoicesData, List dictlist)
{
AlibabaCloud.SDK.Dingtalkworkflow_1_0.Client client = CreateClient();
FormCreateHeaders formCreateHeaders = new FormCreateHeaders();
@@ -75,8 +94,8 @@ namespace DS.WMS.Core.Fee.Method
foreach (var item in dictlist)
{
SelectOption so = new SelectOption();
- so.Value=item.Value;
- so.Key= item.Value;
+ so.Value = item.Value;
+ so.Key = item.Value;
fyleop.Add(so);
}
@@ -129,6 +148,21 @@ namespace DS.WMS.Core.Fee.Method
selectOptions.Add(st);
}
+ //明细金额
+ FormComponent mxje = new FormComponent
+ {
+ ComponentType = "MoneyField",
+ Props = new FormComponentProps
+ {
+ ComponentId = "MoneyField-mxje", // 控件id,表单内唯一,与bizAlias二选一
+ Required = false, // 控件是否必填
+ Label = "金额(元)", // 控件标题
+ Placeholder = "请输入", // 输入提示
+ Print = "1",//是否参与打印
+
+ }
+ };
+
FormComponent fymx = new FormComponent
{
ComponentType = "DDSelectField",
@@ -145,11 +179,10 @@ namespace DS.WMS.Core.Fee.Method
}
};
-
FormComponent fymxList = new FormComponent
{
ComponentType = "TableField",
- Children = new List { fymx },
+ Children = new List { fymx, mxje },
Props = new FormComponentProps
{
@@ -160,21 +193,41 @@ namespace DS.WMS.Core.Fee.Method
#endregion
#region 金额
+ //FormComponent xmmcA = new FormComponent
+ //{
+ // ComponentType = "MoneyField",
+ // Props = new FormComponentProps
+ // {
+ // ComponentId = "MoneyField_1JZJIQ", // 控件id,表单内唯一,与bizAlias二选一
+ // Required = true, // 控件是否必填
+ // Label = "金额(元)", // 控件标题
+ // Placeholder = "请输入金额",// 输入提示
+ // Print = "1",//是否参与打印
+ // Disabled = false, //是否可编辑
+ // }
+ //};
+
+
+ #endregion
+
+
+ #region 自动计算金额
FormComponent xmmcA = new FormComponent
{
- ComponentType = "MoneyField",
+ ComponentType = "CalculateField",
Props = new FormComponentProps
{
ComponentId = "MoneyField_1JZJIQ", // 控件id,表单内唯一,与bizAlias二选一
Required = true, // 控件是否必填
- Label = "金额(元)", // 控件标题
- Placeholder = "请输入金额",// 输入提示
- Print = "1",//是否参与打印
- Disabled = false, //是否可编辑
+ Label = "总金额(元)", // 控件标题
+ Placeholder = "费用明细合计金额",// 输入提示
+
+ Formula = "[{\"id\":\"MoneyField-mxje\"}]"
}
};
#endregion
+
#region 收款账户
FormComponent skzh = new FormComponent
{
@@ -209,11 +262,11 @@ namespace DS.WMS.Core.Fee.Method
FormComponent bxsy = new FormComponent
{
- ComponentType = "TextField",
+ ComponentType = "TextareaField",
Props = new FormComponentProps
{
- ComponentId = "TextField-bxsy", // 控件id,表单内唯一,与bizAlias二选一
+ ComponentId = "TextareaField-bxsy", // 控件id,表单内唯一,与bizAlias二选一
Required = true, // 控件是否必填
Label = "报销事由", // 控件标题
Placeholder = "请输入",// 输入提示
@@ -225,6 +278,69 @@ namespace DS.WMS.Core.Fee.Method
};
#endregion
+ #region 收款人姓名
+ FormComponent skrxm = new FormComponent
+ {
+ ComponentType = "TextField",
+ Props = new FormComponentProps
+ {
+ ComponentId = "TextField-skrxm", // 控件id,表单内唯一,与bizAlias二选一
+ Required = true, // 控件是否必填
+ Label = "收款人姓名", // 控件标题
+ Placeholder = "请输入",// 输入提示
+ Print = "1",//是否参与打印
+ Disabled = false, //是否可编辑
+ }
+ };
+ #endregion
+
+ #region 收款人卡号
+ FormComponent skrkh = new FormComponent
+ {
+ ComponentType = "TextField",
+ Props = new FormComponentProps
+ {
+ ComponentId = "TextField-skrkh", // 控件id,表单内唯一,与bizAlias二选一
+ Required = true, // 控件是否必填
+ Label = "收款人卡号", // 控件标题
+ Placeholder = "请输入",// 输入提示
+ Print = "1",//是否参与打印
+ Disabled = false, //是否可编辑
+ }
+ };
+ #endregion
+ #region 所属银行
+ FormComponent ssyh = new FormComponent
+ {
+ ComponentType = "TextField",
+ Props = new FormComponentProps
+ {
+ ComponentId = "TextField-ssyh", // 控件id,表单内唯一,与bizAlias二选一
+ Required = true, // 控件是否必填
+ Label = "所属银行", // 控件标题
+ Placeholder = "(例如)青岛银行",// 输入提示
+ Print = "1",//是否参与打印
+ Disabled = false, //是否可编辑
+ }
+ };
+ #endregion
+
+ #region 开户行
+ FormComponent khh = new FormComponent
+ {
+ ComponentType = "TextField",
+ Props = new FormComponentProps
+ {
+ ComponentId = "TextField-khh", // 控件id,表单内唯一,与bizAlias二选一
+ Required = true, // 控件是否必填
+ Label = "开户行", // 控件标题
+ Placeholder = "请输入",// 输入提示
+ Print = "1",//是否参与打印
+ Disabled = false, //是否可编辑
+ }
+ };
+ #endregion
+
FormCreateRequest formCreateRequest = new FormCreateRequest
{
@@ -234,11 +350,17 @@ namespace DS.WMS.Core.Fee.Method
FormComponents = new List
{
fylx,//费用类别
- xmmc,//项目名称
+ //xmmc,//项目名称
fymxList,//费用明细
xmmcA,//金额
- skzh,//收款账户
- bxsy,//报销事由
+ //skzh,//收款账户
+ bxsy,//报销事由
+ skrxm,//收款人姓名
+ skrkh,//收款人银行卡号
+ ssyh,//所属银行
+ khh,//收款人银行开户行
+
+
//glspd //关联审批单
},
};
@@ -266,28 +388,6 @@ namespace DS.WMS.Core.Fee.Method
}
}
-
- /**
- * 使用 Token 初始化账号Client
- * @return Client
- * @throws Exception
- */
- public static AlibabaCloud.SDK.Dingtalkoauth2_1_0.Client CreateClient1()
- {
- AlibabaCloud.OpenApiClient.Models.Config config = new AlibabaCloud.OpenApiClient.Models.Config();
- config.Protocol = "https";
- config.RegionId = "central";
- return new AlibabaCloud.SDK.Dingtalkoauth2_1_0.Client(config);
- }
- public static AlibabaCloud.SDK.Dingtalkworkflow_1_0.Client CreateClient()
- {
- AlibabaCloud.OpenApiClient.Models.Config config = new AlibabaCloud.OpenApiClient.Models.Config();
- config.Protocol = "https";
- config.RegionId = "central";
- return new AlibabaCloud.SDK.Dingtalkworkflow_1_0.Client(config);
- }
-
-
///
/// 获取审批实例详情
///
diff --git a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeReimbursementService.cs b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeReimbursementService.cs
index 812e0984..c841ab08 100644
--- a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeReimbursementService.cs
+++ b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeReimbursementService.cs
@@ -2,8 +2,10 @@
using DS.Module.Core;
using DS.Module.Core.Enums;
using DS.Module.Core.Extensions;
+using DS.Module.Core.Helpers;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
+using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Fee.Interface;
@@ -25,6 +27,7 @@ using Masuit.Tools.Database;
using Masuit.Tools.Systems;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
+using NLog;
using NPOI.SS.Formula.Functions;
using SqlSugar;
using static AnyDiff.DifferenceLines;
@@ -45,6 +48,7 @@ namespace DS.WMS.Core.Fee.Method
readonly IAuditTaskService taskService;
Lazy flowService;
private readonly ICommonService commonService;
+ private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger();
///
///
@@ -160,9 +164,7 @@ namespace DS.WMS.Core.Fee.Method
tenantDb.Insertable(dataDetail).ExecuteCommand();
}
-
-
-
+
}
//新增
else
@@ -191,20 +193,20 @@ namespace DS.WMS.Core.Fee.Method
#endregion
//查询用户报销银行卡信息
- var bank= tenantDb.Queryable().Where(t => t.Id == req.InfoClientBankId).First();
+ var bank = tenantDb.Queryable().Where(t => t.Id == req.InfoClientBankId).First();
if (bank == null) return DataResult.Failed($"报销银行账户信息未找到");
//添加主表信息
-
+
var data = req.Adapt();
data.InfoClientBankId = req.InfoClientBankId;
data.PayeeName = user.UserName;
data.CodeName = bank.CodeName;
data.Currency = bank.Currency;
- data.BankName=bank.BankName;
+ data.BankName = bank.BankName;
data.Account = bank.Account;
data.BankAccountNo = bank.BankAccountNo;
@@ -318,7 +320,7 @@ namespace DS.WMS.Core.Fee.Method
#endregion
#region 同步审批数据到钉钉
-
+
#endregion
}
@@ -430,9 +432,9 @@ namespace DS.WMS.Core.Fee.Method
}
#endregion
-
+
}
-
+
return await Task.FromResult(DataResult.Successed("操作成功"));
}
@@ -601,10 +603,10 @@ namespace DS.WMS.Core.Fee.Method
}
//是否已转账判断
- var datainfo=await tenantDb.Queryable().Where(x => x.ObjectId == ReimbursementId.ToString()).FirstAsync();
+ var datainfo = await tenantDb.Queryable().Where(x => x.ObjectId == ReimbursementId.ToString()).FirstAsync();
//报销单已报销
- if (datainfo!=null&& datainfo.OrderState=="90")
+ if (datainfo != null && datainfo.OrderState == "90")
{
return await Task.FromResult(DataResult.Failed("当前报销单已报销转账,请核对!"));
}
@@ -614,7 +616,7 @@ namespace DS.WMS.Core.Fee.Method
//付款用途,取值报销事由
if (info.Reason.Length > 12)
{
- fkyt = info.Reason.Substring(0, 12)+"...";
+ fkyt = info.Reason.Substring(0, 12) + "...";
}
else
{
@@ -718,9 +720,9 @@ namespace DS.WMS.Core.Fee.Method
payAmount = info.Amount.ToString("#0.00"), //交易金额
currencyType = "RMB", //币种
payUse = fkyt, //付款用途
- // unionBankNo = info.UnionBankNo,
+ // unionBankNo = info.UnionBankNo,
clearingBankNo = "",
- rmtType="0",
+ rmtType = "0",
ReqReserved1 = "",
ReqReserved2 = ""
}
@@ -747,18 +749,18 @@ namespace DS.WMS.Core.Fee.Method
}
}
-
+
}
-
-
- ///
- /// 交易状态查询
- ///
- ///
- ///
+
+
+ ///
+ /// 交易状态查询
+ ///
+ ///
+ ///
public async Task>> TransactionStatusQuery(string keyword)
{
-
+
transaction_result_query trq = new transaction_result_query
{
cstNo = "",
@@ -784,8 +786,10 @@ namespace DS.WMS.Core.Fee.Method
///
public async Task GetSample()
{
- var dingconfig = db.Queryable().Where(t => t.Type == "DingConfig" && t.OrgId == user.OrgId).First();
- var token = DingDing.GetDingToken(dingconfig.Key, dingconfig.Secret);
+ //var dingconfig = db.Queryable().Where(t => t.Type == "DingConfig" && t.OrgId == user.OrgId).First();
+ var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
+ var dingconfig = await tenantDb.Queryable().Where(t => t.AccountType == "DingConfig" && t.ApiOrgId == user.OrgId).FirstAsync();
+ var token = DingDing.GetDingToken(dingconfig.AppKey, dingconfig.AppSecret);
DingDing.GetSample("PROC-528BFFFF-00D1-4AF0-AB5F-7BFB89787994", token);
return DataResult.Success;
}
@@ -797,10 +801,12 @@ namespace DS.WMS.Core.Fee.Method
///
///
///
- public async Task BankPayment(long Id)
+ public async Task BankPayment(long Id)
{
TransferAccounts(Id);
return DataResult.Success;
}
+
+
}
}
diff --git a/ds-wms-service/DS.WMS.Core/QuarztJobs/Method/InInvoiceService.cs b/ds-wms-service/DS.WMS.Core/QuarztJobs/Method/InInvoiceService.cs
index 0dd90aae..e766d4fc 100644
--- a/ds-wms-service/DS.WMS.Core/QuarztJobs/Method/InInvoiceService.cs
+++ b/ds-wms-service/DS.WMS.Core/QuarztJobs/Method/InInvoiceService.cs
@@ -78,7 +78,7 @@ namespace DS.WMS.Core.QuarztJobs.Method
var info = JsonConvert.DeserializeObject(result);
if (info == null || !info.success)
continue;
-
+
if (info != null && info.Data.data != null)
{
//遍历获取到的发票
@@ -200,7 +200,7 @@ namespace DS.WMS.Core.QuarztJobs.Method
try
{
#region 同步发票到钉钉审批
- var dingconfig = db.Queryable().ClearFilter().Where(t => t.Deleted == false && t.AccountType == "DingConfig" && t.ApiOrgId == orgauth.ApiOrgId).First();
+ var dingconfig = tenantDb.Queryable().ClearFilter().Where(t => t.Deleted == false && t.AccountType == "DingConfig" && t.ApiOrgId == orgauth.ApiOrgId).First();
if (dingconfig != null)
{
@@ -210,9 +210,10 @@ namespace DS.WMS.Core.QuarztJobs.Method
var ininviceList = await tenantDb.Queryable().Where(x => x.ReimbursementType == ReimbursementTypeEnums.NotSubmitted && x.OrgId == dingconfig.ApiOrgId).ToListAsync();
//将发票信息同步更新到钉钉
- var DingProcess = db.Queryable().ClearFilter().Where(t => t.Deleted == false && t.AccountType == "DingProcessCode" && t.ApiOrgId == orgauth.ApiOrgId).First();
+ var DingProcess = tenantDb.Queryable().ClearFilter().Where(t => t.Deleted == false && t.AccountType == "DingProcessCode" && t.ApiOrgId == orgauth.ApiOrgId).First();
+
+ var dictlist = db.Queryable().LeftJoin((d, t) => d.TypeId == t.Id).Where((d, t) => t.Code == "Reimbursement_Expense_Ategory").OrderBy(d => d.OrderNo).ToList();
- var dictlist = db.Queryable().Where(t => t.Value == "Reimbursement_Expense_Ategory").ToList();
if (DingProcess != null)
{
diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs
index e1e9c671..f65f9ecb 100644
--- a/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs
+++ b/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs
@@ -1,3 +1,4 @@
+using Amazon.Runtime.Internal;
using DS.Module.Core;
using DS.Module.Core.Constants;
using DS.Module.Core.Data;
@@ -12,6 +13,7 @@ using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Info.Dtos;
using DS.WMS.Core.Info.Entity;
using DS.WMS.Core.Op.Dtos;
+using DS.WMS.Core.Op.EDI;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Sys.Dtos;
using DS.WMS.Core.Sys.Entity;
@@ -958,6 +960,8 @@ public class ClientCommonService : IClientCommonService
public async Task>> GetClientListByCode(string code = "", string queryKey = "")
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
+ var contacts = await tenantDb.Queryable().Where(x => x.Status == StatusEnum.Enable && x.IsDefault == true).Select().ToListAsync();
+
var conditions = new List();
var otherConditions = new List();
var queryData = tenantDb.Queryable().ClearFilter().Where(c => c.Status == StatusEnum.Enable.ToEnumInt());
@@ -1013,11 +1017,10 @@ public class ClientCommonService : IClientCommonService
}
)
.ClearFilter().MergeTable()
- //.Mapper(it =>
- // {
- // //it.UserIds = tenantDb.Queryable().Where(c => c.StartDate <= DateTime.Now && c.EndDate >= DateTime.Now && c.ClientId == it.Id).Select(n => n.CreateBy).ToList();
-
- // })
+ .Mapper(it =>
+ {
+ it.ClientContact = contacts.FirstOrDefault(x => x.ClientId == it.Id);
+ })
.OrderBy(x => x.CodeName).Distinct().Take(20).WithCache($"{SqlSugarCacheConst.InfoClient}{user.TenantId}", SqlSugarCacheConst.CacheDurationInSeconds).ToListAsync();
return await Task.FromResult(DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess));
}
@@ -1029,6 +1032,7 @@ public class ClientCommonService : IClientCommonService
public async Task>> GetSupplierAndClientListByCode(string code = "", string queryKey = "")
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
+ var contacts = await tenantDb.Queryable().Where(x => x.Status == StatusEnum.Enable && x.IsDefault == true).Select().ToListAsync();
var conditions = new List();
var otherConditions = new List();
var queryData = tenantDb.Queryable().ClearFilter().Where(c => c.Status == StatusEnum.Enable.ToEnumInt() && c.IsCustomer == true);
@@ -1085,6 +1089,10 @@ public class ClientCommonService : IClientCommonService
}
)
.ClearFilter().MergeTable()
+ .Mapper(it =>
+ {
+ it.ClientContact = contacts.FirstOrDefault(x => x.ClientId == it.Id);
+ })
.OrderBy(x => x.CodeName).Distinct().Take(20).WithCache($"{SqlSugarCacheConst.AllClient}{user.TenantId}", SqlSugarCacheConst.CacheDurationInSeconds).ToListAsync();
@@ -1097,6 +1105,8 @@ public class ClientCommonService : IClientCommonService
public async Task>> GetSupplierListByCode(string code = "", string queryKey = "")
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
+
+ var contacts = await tenantDb.Queryable().Where(x => x.Status == StatusEnum.Enable && x.IsDefault == true).Select().ToListAsync();
//code = code.ToLower();
var data = await tenantDb.Queryable().ClearFilter()
.Where((a) => a.Status == StatusEnum.Enable.ToEnumInt())
@@ -1117,8 +1127,8 @@ public class ClientCommonService : IClientCommonService
.ClearFilter().MergeTable()
.Mapper(it =>
{
- it.UserIds = tenantDb.Queryable().Where(c => c.StartDate <= DateTime.Now && c.EndDate >= DateTime.Now && c.ClientId == it.Id).Select(n => n.CreateBy).ToList();
-
+ //it.UserIds = tenantDb.Queryable().Where(c => c.StartDate <= DateTime.Now && c.EndDate >= DateTime.Now && c.ClientId == it.Id).Select(n => n.CreateBy).ToList();
+ it.ClientContact = contacts.FirstOrDefault(x => x.ClientId == it.Id);
})
.OrderBy(x => x.CodeName).Take(20).WithCache($"{SqlSugarCacheConst.InfoClient}{user.TenantId}", SqlSugarCacheConst.CacheDurationInSeconds).ToListAsync();
return await Task.FromResult(DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess));
diff --git a/ds-wms-service/DS.WMS.FeeApi/Controllers/DingCallBackController.cs b/ds-wms-service/DS.WMS.FeeApi/Controllers/DingCallBackController.cs
new file mode 100644
index 00000000..07e0fd3e
--- /dev/null
+++ b/ds-wms-service/DS.WMS.FeeApi/Controllers/DingCallBackController.cs
@@ -0,0 +1,43 @@
+using Autofac.Core;
+using DS.WMS.Core.Fee.Dtos;
+using DS.WMS.Core.Fee.Interface;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+
+namespace DS.WMS.FeeApi.Controllers
+{
+
+ public class DingCallBackController : ApiController
+ {
+ readonly IDingCallBackService _service;
+
+ ///
+ /// 初始化
+ ///
+ ///
+ public DingCallBackController(IDingCallBackService service)
+ {
+ _service = service;
+ }
+
+ ///
+ /// 钉钉回调
+ ///
+ ///
+ ///
+ ///
+ [HttpPost("/feeApi/DingCallBack/{corpId}"), AllowAnonymous]
+
+ public Dictionary CallBack(DingCallBackInput model, string corpId)
+ {
+ string signature = Request.Query["signature"];
+ string timestamp = Request.Query["timestamp"];
+ string nonce = Request.Query["nonce"];
+
+ return _service.CallBack(model, corpId, signature, timestamp, nonce);
+ }
+ }
+
+
+}
diff --git a/ds-wms-service/DS.WMS.FeeApi/Controllers/ReimbursementController.cs b/ds-wms-service/DS.WMS.FeeApi/Controllers/ReimbursementController.cs
index 8103a391..2dcfac03 100644
--- a/ds-wms-service/DS.WMS.FeeApi/Controllers/ReimbursementController.cs
+++ b/ds-wms-service/DS.WMS.FeeApi/Controllers/ReimbursementController.cs
@@ -6,6 +6,7 @@ using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Invoice.Dtos;
using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.TaskPlat.Dtos;
+using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using NLog;
@@ -20,6 +21,7 @@ namespace DS.WMS.FeeApi.Controllers
{
readonly IReimbursementService _service;
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
+ private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger();
///
/// 初始化
///
@@ -157,18 +159,18 @@ namespace DS.WMS.FeeApi.Controllers
//}
- /////
- ///// 获取审批模板
- /////
- /////
- //[HttpPost, Route("GetSample")]
- //public async Task GetSample()
- //{
- // return await _service.GetSample();
- //}
-
+ ///
+ /// 获取审批模板
+ ///
+ ///
+ [HttpPost, Route("GetSample")]
+ public async Task GetSample()
+ {
+ return await _service.GetSample();
+ }
+
}
}
diff --git a/ds-wms-service/DS.WMS.Gateway/JwtSafeMiddleware.cs b/ds-wms-service/DS.WMS.Gateway/JwtSafeMiddleware.cs
index 3acbdd15..85caf8bf 100644
--- a/ds-wms-service/DS.WMS.Gateway/JwtSafeMiddleware.cs
+++ b/ds-wms-service/DS.WMS.Gateway/JwtSafeMiddleware.cs
@@ -27,7 +27,7 @@ public class JwtSafeMiddleware
//if(ignoreUrl.Split(",", StringSplitOptions.RemoveEmptyEntries).ToArray().Contains(path))
if (path.Contains("swagger") || path.Contains("login") || path.Contains("tenantregister") || path.Contains("linkattach") || path.Contains("printtempfile")
|| path.Contains("favicon") || path.Contains("clientuserlogin") || path.Contains("addbookingstatuslog") || path.Contains("createbctaskjob") || path.Contains("clientuserrefreshtoken")
- || path.Contains("createtaskjob") || path.Contains("querybookingslot"))
+ || path.Contains("createtaskjob") || path.Contains("querybookingslot") || path.Contains("dingcallback"))
{
//跳过swagger及login
}