You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.1 KiB
Plaintext

11 months ago
using System;
using BP.DA;
using BP.Port;
using BP.En;
namespace BP.GPM.DTalk.DTS
{
/// <summary>
/// 钉钉组织结构增量同步
/// </summary>
public class OrgInit_DingIcreMent : Method
{
/// <summary>
/// 钉钉组织结构增量同步
/// </summary>
public OrgInit_DingIcreMent()
{
this.Title = "同步增量钉钉通讯录到CCGPM";
this.Help = "增量同步钉钉通讯录,需要时间比较长,请耐心等待。<br> 钉钉相关配置写入Web.config配置正确才可以被执行";
}
/// <summary>
/// 设置执行变量
/// </summary>
/// <returns></returns>
public override void Init()
{
}
/// <summary>
/// 当前的操纵员是否可以执行这个方法
/// </summary>
public override bool IsCanDo
{
get
{
if (BP.WF.Glo.IsEnable_DingDing == true)
return true;
return false;
}
}
/// <summary>
/// 执行
/// </summary>
/// <returns>返回执行结果</returns>
public override object Do()
{
Emp emp = new BP.Port.Emp();
emp.CheckPhysicsTable();
DingDing ding = new DingDing();
string result = ding.AnsyIncrementOrgToGPM();
if (DataType.IsNullOrEmpty(result))
{
return "执行成功,没有发生变化...";
}
else if (result.Contains("钉钉获取部门出错"))
{
return result;
}
else if (result.Length > 0)
{
string webPath = "Log/Ding_GPM" + DateTime.Now.ToString("yyyy_MM_dd") + ".log";
string savePath = BP.Difference.SystemConfig.PathOfDataUser + webPath;
BP.DA.Log.DebugWriteInfo(result);
return "执行成功<a href=\"/DataUser/" + webPath + "\" target='_blank'>下载日志</a>";
}
else
return "执行失败...";
}
}
}