岗位合并清理、班前会数据同步、
This commit is contained in:
@@ -179,6 +179,7 @@
|
||||
<Compile Include="BoSheng\BOSHENGService.cs" />
|
||||
<Compile Include="Common\AttachFileService.cs" />
|
||||
<Compile Include="Common\CodeRecordsService.cs" />
|
||||
<Compile Include="Common\DataCleanupMergeHelper.cs" />
|
||||
<Compile Include="Common\CommonService.cs" />
|
||||
<Compile Include="Common\TokenHelper.cs" />
|
||||
<Compile Include="Common\HttpHelper.cs" />
|
||||
@@ -313,6 +314,8 @@
|
||||
<Compile Include="CQMS\WBS\WorkPackageInitService.cs" />
|
||||
<Compile Include="CQMS\WBS\WorkPackageProjectService.cs" />
|
||||
<Compile Include="CQMS\WBS\WorkPackageService.cs" />
|
||||
<Compile Include="DataShare\APIDataShareSyncService.cs" />
|
||||
<Compile Include="DataShare\HSSE\APIMeetingSyncService.cs" />
|
||||
<Compile Include="DCGL\ServerCheck\DCGLCheckNoticeItemService.cs" />
|
||||
<Compile Include="DCGL\ServerCheck\DCGLCheckRectifyItemService.cs" />
|
||||
<Compile Include="DCGL\ServerCheck\DCGLCheckRectifyService.cs" />
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据合并清理
|
||||
/// </summary>
|
||||
public class DataCleanupMergeHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据合并清理
|
||||
/// </summary>
|
||||
/// <param name="exTable">排除操作数据表</param>
|
||||
/// <param name="columType">替换字段(模糊匹配)</param>
|
||||
/// <param name="mergeDataIds">需要替换的数据值</param>
|
||||
/// <param name="dataId">新的字段数据值</param>
|
||||
/// <returns></returns>
|
||||
public static bool DataCleanupMerge(string exTable, string columType, List<string> mergeDataIds, string dataId, ref string msg)
|
||||
{
|
||||
bool result = false;
|
||||
try
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var clist = db.DataIdMove.Where(x => x.ColumType == columType && x.NewIds == dataId).ToList();
|
||||
db.DataIdMove.DeleteAllOnSubmit(clist);
|
||||
db.SubmitChanges();
|
||||
List<Model.DataIdMove> list = new List<Model.DataIdMove>();
|
||||
foreach (var mergeId in mergeDataIds)
|
||||
{
|
||||
list.Add(new Model.DataIdMove { OldId = mergeId.Trim(), NewIds = dataId.Trim(), ColumType = columType });
|
||||
}
|
||||
|
||||
db.DataIdMove.InsertAllOnSubmit(list);
|
||||
db.SubmitChanges();
|
||||
|
||||
|
||||
//SP_DataIdMove[排除操作数据表,替换字段(模糊匹配),字段数据值]
|
||||
string strSql = $"exec SP_DataIdMove '{exTable}','{columType}','{dataId}'";
|
||||
result = BLL.SQLHelper.ExecuteSql(strSql);
|
||||
|
||||
//SqlParameter[] parameters = {
|
||||
// new SqlParameter("@exTable", exTable),
|
||||
// new SqlParameter("@colums", columType),
|
||||
// new SqlParameter("@trueId", dataId),
|
||||
// new SqlParameter("@returnVal", SqlDbType.Int)
|
||||
//};
|
||||
//BLL.SQLHelper.ExecuteNonQueryStoredProcedure("SP_DataIdMove", parameters);
|
||||
//int succ = BLL.SQLHelper.ExecuteProcedure("SP_DataIdMove", parameters);
|
||||
//Thread.Sleep(30000); // 等待30秒,30000毫秒等于30秒
|
||||
if (result)
|
||||
{
|
||||
db.DataIdMove.DeleteAllOnSubmit(list);
|
||||
db.SubmitChanges();
|
||||
msg = "数据合并成功!";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = "数据合并失败,请稍后再试!";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
msg = ex.Message;
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using System.Linq;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据共享互通辅助服务
|
||||
/// </summary>
|
||||
public class APIDataShareSyncService
|
||||
{
|
||||
#region 班组
|
||||
|
||||
/// <summary>
|
||||
/// 获取班组Id
|
||||
/// </summary>
|
||||
/// <param name="TeamGroupName"></param>
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="unitId"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetTeamGroupId(string TeamGroupName, string projectId, string unitId)
|
||||
{
|
||||
string TeamGroupId = null;
|
||||
if (!string.IsNullOrEmpty(TeamGroupName))
|
||||
{
|
||||
var tg = Funs.DB.ProjectData_TeamGroup.Where(x => x.TeamGroupName == TeamGroupName && x.ProjectId == projectId && x.UnitId == unitId).ToList();
|
||||
if (tg.Count == 0)
|
||||
{
|
||||
Model.ProjectData_TeamGroup newTeamGroup = new Model.ProjectData_TeamGroup
|
||||
{
|
||||
TeamGroupId = SQLHelper.GetNewID(typeof(Model.ProjectData_TeamGroup)),
|
||||
ProjectId = projectId,
|
||||
UnitId = unitId,
|
||||
TeamGroupName = TeamGroupName,
|
||||
Remark = "导入"
|
||||
};
|
||||
TeamGroupService.AddTeamGroup(newTeamGroup);
|
||||
TeamGroupId = newTeamGroup.TeamGroupId;
|
||||
}
|
||||
else
|
||||
{
|
||||
TeamGroupId = tg.FirstOrDefault().TeamGroupId;
|
||||
}
|
||||
}
|
||||
return TeamGroupId;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,273 @@
|
||||
using Model;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 安全会议数据共享互通
|
||||
/// </summary>
|
||||
public class APIMeetingSyncService
|
||||
{
|
||||
#region 分包单位推送数据到总包单位
|
||||
|
||||
/// <summary>
|
||||
/// 推送分包班前会数据
|
||||
/// </summary>
|
||||
/// <param name="projectId">项目Id</param>
|
||||
/// <param name="dataId">班前会数据Id(为空的时候推送全部)</param>
|
||||
/// <returns></returns>
|
||||
public static ReturnData PushClassMeetingLists(string projectId, string dataId = "")
|
||||
{
|
||||
Model.ReturnData responeData = new Model.ReturnData();
|
||||
responeData.code = 0;
|
||||
responeData.message = string.Empty;
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = from x in db.Meeting_ClassMeeting where x.ProjectId == projectId select x;
|
||||
if (!string.IsNullOrWhiteSpace(dataId))
|
||||
{
|
||||
list = list.Where(x => x.ClassMeetingId == dataId);
|
||||
}
|
||||
var dataList = (from x in list
|
||||
join ptg in db.ProjectData_TeamGroup on x.TeamGroupId equals ptg.TeamGroupId into ptGroup
|
||||
from ptg in ptGroup.DefaultIfEmpty()
|
||||
join su in db.Sys_User on x.CompileMan equals su.UserId into sUser
|
||||
from su in sUser.DefaultIfEmpty()
|
||||
join att in db.AttachFile on x.ClassMeetingId equals att.ToKeyId into attTemp
|
||||
from att in attTemp.DefaultIfEmpty()
|
||||
join att1 in db.AttachFile on (x.ClassMeetingId + "#1") equals att1.ToKeyId into att1Temp
|
||||
from att1 in att1Temp.DefaultIfEmpty()
|
||||
join att2 in db.AttachFile on (x.ClassMeetingId + "#2") equals att2.ToKeyId into att2Temp
|
||||
from att2 in att2Temp.DefaultIfEmpty()
|
||||
orderby x.CompileDate descending
|
||||
select new ClassMeetingItem
|
||||
{
|
||||
ProjectId = x.ProjectId,
|
||||
UnitId = x.UnitId,
|
||||
ClassMeetingId = x.ClassMeetingId,
|
||||
ClassMeetingCode = x.ClassMeetingCode,
|
||||
ClassMeetingName = x.ClassMeetingName,
|
||||
ClassMeetingDate = x.ClassMeetingDate,
|
||||
ClassMeetingContents = x.ClassMeetingContents,
|
||||
CompileMan = x.CompileMan,
|
||||
CompileManName = su.UserName,
|
||||
TeamGroupId = x.TeamGroupId,
|
||||
TeamGroupName = ptg.TeamGroupName,
|
||||
CompileDate = x.CompileDate,
|
||||
States = x.States,
|
||||
MeetingPlace = x.MeetingPlace,
|
||||
MeetingHours = x.MeetingHours,
|
||||
MeetingHostMan = x.MeetingHostMan,
|
||||
AttentPerson = x.AttentPerson,
|
||||
AttentPersonNum = x.AttentPersonNum,
|
||||
//MeetingHostManOther = x.MeetingHostManOther,
|
||||
Remark = x.Remark,
|
||||
//AttachUrl = AttachFileService.getFileUrl(x.ClassMeetingId),//内容
|
||||
//AttachUrl1 = AttachFileService.getFileUrl(x.ClassMeetingId + "#1"),//签到表
|
||||
//AttachUrl2 = AttachFileService.getFileUrl(x.ClassMeetingId + "#2"),//会议过程
|
||||
AttachFileId = att.AttachFileId,
|
||||
ToKeyId = att.ToKeyId,
|
||||
AttachSource = att.AttachSource,
|
||||
AttachUrl = att.AttachUrl,
|
||||
AttachFileId1 = att1.AttachFileId,
|
||||
ToKeyId1 = att1.ToKeyId,
|
||||
AttachSource1 = att1.AttachSource,
|
||||
AttachUrl1 = att1.AttachUrl,
|
||||
AttachFileId2 = att2.AttachFileId,
|
||||
ToKeyId2 = att2.ToKeyId,
|
||||
AttachSource2 = att2.AttachSource,
|
||||
AttachUrl2 = att2.AttachUrl,
|
||||
}).ToList();
|
||||
|
||||
if (dataList.Count() > 0)
|
||||
{
|
||||
var thisUnit = CommonService.GetIsThisUnit();
|
||||
var porject = BLL.ProjectService.GetProjectByProjectId(projectId);
|
||||
var pushData = new ClassMeetingData
|
||||
{
|
||||
CollCropCode = thisUnit.CollCropCode,//分包单位社会统一信用码
|
||||
UnitId = thisUnit.UnitId,//分包单位Id
|
||||
UnitName = thisUnit.UnitName,//分包单位名称
|
||||
ShortUnitName = thisUnit.ShortUnitName,//分包单位简称
|
||||
UnitDomain = Funs.SGGLUrl,//分包单位域名地址【文件存储地址】
|
||||
SubjectUnit = porject.SubjectUnit,//主包单位Id
|
||||
SubjectProject = porject.SubjectProject,//主包项目Id
|
||||
Items = dataList//会议数据
|
||||
};
|
||||
var pushContent = JsonConvert.SerializeObject(pushData);
|
||||
|
||||
//获取总包单位接口apiurl地址
|
||||
var Url = BLL.UnitService.getUnitApiUrlByUnitId(porject.SubjectUnit);
|
||||
var ApiUrl = string.Empty;
|
||||
var WebUrl = string.Empty;
|
||||
if (Url != null)
|
||||
{
|
||||
var urls = Url.Split(',');
|
||||
ApiUrl = urls[0];
|
||||
if (urls.Length > 1)
|
||||
{
|
||||
WebUrl = urls[1];
|
||||
}
|
||||
}
|
||||
var baseurl = $"{ApiUrl}/api/MeetingSync/ReceiveSaveProjectClassMeetingData";
|
||||
string contenttype = "application/json;charset=unicode";
|
||||
Hashtable newToken = new Hashtable
|
||||
{
|
||||
{ "token", ServerService.GetToken().Token }
|
||||
};
|
||||
//var returndata = APIGetHttpService.Http(baseurl, "Post", contenttype, newToken, pushContent);
|
||||
var returndata = "";
|
||||
if (!string.IsNullOrEmpty(returndata))
|
||||
{
|
||||
JObject obj = JObject.Parse(returndata);
|
||||
string mess = obj["message"].ToString();
|
||||
string code = obj["code"].ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
responeData.message = "当前项目没有班前会数据";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.message = "同步到总包单位失败!";
|
||||
ErrLogInfo.WriteLog("【班前会】同步到总包单位失败!", ex);
|
||||
}
|
||||
}
|
||||
return responeData;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 总包单位接收分包单位推送数据
|
||||
|
||||
/// <summary>
|
||||
/// 总包单位接收保存分包单位推送的班前会数据
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public static string ReceiveSaveProjectClassMeetingData(ClassMeetingData data)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
string result = string.Empty;
|
||||
if (data.Items.Count() > 0)
|
||||
{
|
||||
//1、判断分包单位是否存在
|
||||
var unit = UnitService.getUnitByCollCropCodeUnitName(data.CollCropCode, data.UnitName);
|
||||
if (unit == null)
|
||||
{
|
||||
result = "总包单位不存在本单位,请登录总包系统检查维护本单位信息!";
|
||||
}
|
||||
else
|
||||
{
|
||||
//2、判断主包项目是否存在
|
||||
var porject = BLL.ProjectService.GetProjectByProjectId(data.SubjectProject);
|
||||
if (porject == null)
|
||||
{
|
||||
result = "总包单位不存在本项目,请检查总包项目关联是否正确!";
|
||||
}
|
||||
else
|
||||
{
|
||||
int succ = 0;
|
||||
//3、保存数据
|
||||
foreach (var item in data.Items)
|
||||
{
|
||||
try
|
||||
{
|
||||
var model = ClassMeetingService.GetClassMeetingById(item.ClassMeetingId);
|
||||
if (model != null)
|
||||
{//编辑
|
||||
model.ProjectId = data.SubjectProject;
|
||||
model.UnitId = unit.UnitId;
|
||||
model.ClassMeetingCode = item.ClassMeetingCode;
|
||||
model.ClassMeetingName = item.ClassMeetingName;
|
||||
model.ClassMeetingDate = item.ClassMeetingDate;
|
||||
model.AttentPersonNum = item.AttentPersonNum;
|
||||
//model.TeamGroupId = item.TeamGroupId;
|
||||
model.TeamGroupId = APIDataShareSyncService.GetTeamGroupId(item.TeamGroupName, data.SubjectProject, unit.UnitId);
|
||||
model.AttentPersonNum = item.AttentPersonNum;
|
||||
//model.ClassMeetingContents = HttpUtility.HtmlEncode(item.ClassMeetingContents);
|
||||
model.ClassMeetingContents = item.ClassMeetingContents;
|
||||
//model.States = item.States;
|
||||
model.States = BLL.Const.State_2; ;//分包推送过来的班前会数据默认已完成
|
||||
model.MeetingPlace = item.MeetingPlace;
|
||||
model.MeetingHours = item.MeetingHours;
|
||||
model.MeetingHostMan = item.MeetingHostMan;
|
||||
model.AttentPerson = item.AttentPerson;
|
||||
model.AttentPersonNum = item.AttentPersonNum;
|
||||
//model.MeetingHostManOther = item.MeetingHostManOther;
|
||||
//model.Remark = item.Remark;
|
||||
model.Remark = $"{(!string.IsNullOrWhiteSpace(data.ShortUnitName) ? data.ShortUnitName : data.UnitName)}#{item.CompileManName}";
|
||||
model.CompileDate = item.CompileDate;
|
||||
//newModel.CompileMan = item.CompileMan;
|
||||
|
||||
db.SubmitChanges();
|
||||
}
|
||||
else
|
||||
{//新增
|
||||
Model.Meeting_ClassMeeting newModel = new Model.Meeting_ClassMeeting();
|
||||
newModel.ClassMeetingId = item.ClassMeetingId;
|
||||
newModel.ProjectId = data.SubjectProject;
|
||||
newModel.UnitId = unit.UnitId;
|
||||
newModel.ClassMeetingCode = item.ClassMeetingCode;
|
||||
newModel.ClassMeetingName = item.ClassMeetingName;
|
||||
newModel.ClassMeetingDate = item.ClassMeetingDate;
|
||||
newModel.AttentPersonNum = item.AttentPersonNum;
|
||||
//newModel.TeamGroupId = item.TeamGroupId;
|
||||
newModel.TeamGroupId = APIDataShareSyncService.GetTeamGroupId(item.TeamGroupName, data.SubjectProject, unit.UnitId);
|
||||
newModel.AttentPersonNum = item.AttentPersonNum;
|
||||
//newModel.ClassMeetingContents = HttpUtility.HtmlEncode(item.ClassMeetingContents);
|
||||
newModel.ClassMeetingContents = item.ClassMeetingContents;
|
||||
//newModel.States = item.States;
|
||||
newModel.States = BLL.Const.State_2; ;//分包推送过来的班前会数据默认已完成
|
||||
newModel.MeetingPlace = item.MeetingPlace;
|
||||
newModel.MeetingHours = item.MeetingHours;
|
||||
newModel.MeetingHostMan = item.MeetingHostMan;
|
||||
newModel.AttentPerson = item.AttentPerson;
|
||||
newModel.AttentPersonNum = item.AttentPersonNum;
|
||||
//newModel.MeetingHostManOther = item.MeetingHostManOther;
|
||||
//newModel.Remark = item.Remark;
|
||||
newModel.Remark = $"{(!string.IsNullOrWhiteSpace(data.ShortUnitName) ? data.ShortUnitName : data.UnitName)}#{item.CompileManName}";
|
||||
newModel.CompileDate = item.CompileDate;
|
||||
//newModel.CompileMan = item.CompileMan;
|
||||
|
||||
db.Meeting_ClassMeeting.InsertOnSubmit(newModel);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
succ++;
|
||||
//附件处理:内容附件
|
||||
BLL.FileInsertService.SaveAttachFileRecords(data.UnitDomain, item.AttachFileId, item.ToKeyId, item.AttachSource, item.AttachUrl);
|
||||
//附件处理:签到表
|
||||
BLL.FileInsertService.SaveAttachFileRecords(data.UnitDomain, item.AttachFileId1, item.ToKeyId1, item.AttachSource1, item.AttachUrl1);
|
||||
//附件处理:会议过程
|
||||
BLL.FileInsertService.SaveAttachFileRecords(data.UnitDomain, item.AttachFileId2, item.ToKeyId2, item.AttachSource2, item.AttachUrl2);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
BLL.ErrLogInfo.WriteLog($"【{porject.ProjectName}】班前会数据推送总包失败", ex.Message);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
result = $"推送成功:总数{data.Items.Count()}条,成功{succ}条";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = "推送数据对象为空!";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public static class FileInsertService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 保存其他单位附件同步处理
|
||||
/// </summary>
|
||||
/// <param name="domain">单位域名地址</param>
|
||||
/// <param name="attachFileId">附件id</param>
|
||||
/// <param name="tokeyId">附件keyid</param>
|
||||
/// <param name="attachSource">附件json信息</param>
|
||||
/// <param name="attachUrl">附件地址</param>
|
||||
public static void SaveAttachFileRecords(string domain, string attachFileId, string tokeyId, string attachSource, string attachUrl)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(attachFileId) && !string.IsNullOrEmpty(attachSource) && !string.IsNullOrEmpty(attachUrl))
|
||||
{
|
||||
List<byte[]> FileContext = new List<byte[]>();
|
||||
if (!string.IsNullOrWhiteSpace(domain) && !string.IsNullOrWhiteSpace(attachUrl))
|
||||
{
|
||||
FileContext = FilePathTransStream(domain, attachUrl);
|
||||
}
|
||||
InsertAttachFilesRecord(attachFileId, tokeyId, attachSource, attachUrl, FileContext);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取服务器图片转byte
|
||||
/// </summary>
|
||||
@@ -22,35 +45,43 @@ namespace BLL
|
||||
{
|
||||
List<byte[]> bytes = new List<byte[]>();
|
||||
var strs = attachUrl.Trim().Split(',');
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var fileUrl in strs)
|
||||
{
|
||||
string filepath = $"{fileHost}{fileUrl}";
|
||||
// 创建WebClient实例
|
||||
using (WebClient webClient = new WebClient())
|
||||
string path = ConfigurationManager.AppSettings["localRoot"] + fileUrl;
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
// 下载图片并保存到内存流
|
||||
using (MemoryStream ms = new MemoryStream(webClient.DownloadData(filepath)))
|
||||
//BLL.ErrLogInfo.WriteLog($"不存在则新增,附件地址:{path}");
|
||||
string filepath = $"{fileHost}{fileUrl}";
|
||||
//BLL.ErrLogInfo.WriteLog($"不存在则新增,责任单位附件地址:{filepath}");
|
||||
// 创建WebClient实例
|
||||
using (WebClient webClient = new WebClient())
|
||||
{
|
||||
// 将MemoryStream转换为byte数组
|
||||
byte[] imageBytes = ms.ToArray();
|
||||
bytes.Add(imageBytes);
|
||||
//// 使用byte数组(例如,保存到文件或进行其他处理)
|
||||
//File.WriteAllBytes("localImage.jpg", imageBytes);
|
||||
// 下载图片并保存到内存流
|
||||
using (MemoryStream ms = new MemoryStream(webClient.DownloadData(filepath)))
|
||||
{
|
||||
// 将MemoryStream转换为byte数组
|
||||
byte[] imageBytes = ms.ToArray();
|
||||
bytes.Add(imageBytes);
|
||||
//// 使用byte数组(例如,保存到文件或进行其他处理)
|
||||
//File.WriteAllBytes("localImage.jpg", imageBytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// BLL.ErrLogInfo.WriteLog($"已存在附件地址:{path}");
|
||||
//}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Error: " + ex.Message);
|
||||
BLL.ErrLogInfo.WriteLog($"服务器图片转换异常:{fileHost};图片地址:{attachUrl}", ex.Message);
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取附件数据流类
|
||||
/// </summary>
|
||||
@@ -187,6 +218,46 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数据和附件插入到多附件表
|
||||
/// </summary>
|
||||
public static void InsertAttachFilesRecord(string attachFileId, string dataId, string attachSource, string attachUrl, List<byte[]> fileContext)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(attachFileId))
|
||||
{
|
||||
//多附件
|
||||
var attachFile = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == dataId);
|
||||
if (attachFile == null)
|
||||
{
|
||||
////插入附件文件
|
||||
BLL.FileInsertService.FileMoreInsert(fileContext, attachUrl);
|
||||
|
||||
Model.AttachFile newAttachFile = new Model.AttachFile
|
||||
{
|
||||
AttachFileId = attachFileId,
|
||||
ToKeyId = dataId,
|
||||
AttachSource = attachSource,
|
||||
AttachUrl = attachUrl
|
||||
};
|
||||
Funs.DB.AttachFile.InsertOnSubmit(newAttachFile);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (attachFile.AttachUrl != attachUrl)
|
||||
{
|
||||
/////删除附件文件
|
||||
//BLL.UploadAttachmentService.DeleteFile(ConfigurationManager.AppSettings["localRoot"], attachFile.AttachUrl);
|
||||
////插入附件文件
|
||||
BLL.FileInsertService.FileMoreInsert(fileContext, attachUrl);
|
||||
attachFile.AttachSource = attachSource;
|
||||
attachFile.AttachUrl = attachUrl;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 数据和附件插入到多附件表【不存实际文件,只存地址】
|
||||
|
||||
@@ -505,6 +505,40 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行SQL语句
|
||||
/// </summary>
|
||||
/// <param name="sql">sql语句</param>
|
||||
public static bool ExecuteSql(string sql)
|
||||
{
|
||||
bool result = false;
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
result = true;
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand(sql, Connection)
|
||||
{
|
||||
CommandTimeout = 0,
|
||||
CommandType = CommandType.Text
|
||||
};
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result = false;
|
||||
ErrLogInfo.WriteLog($"【执行SQL语句报错】{sql};【错误信息】{ex.Message}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
Connection.Close();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Creates a DataSet by running the stored procedure and placing the results
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -857,5 +859,50 @@ namespace BLL
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region 根据单位id获取单位信息列表
|
||||
|
||||
/// <summary>
|
||||
/// 获取集团单位列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string getUnitApiUrlByUnitId(string userId)
|
||||
{
|
||||
string url = "";
|
||||
try
|
||||
{
|
||||
string baseurl = $"{SysConstSetService.CNCECPath}/api/Unit/getUnitApiUrlByUnitId?unitId=" + userId;
|
||||
string contenttype = "application/json;charset=unicode";
|
||||
Hashtable newToken = new Hashtable
|
||||
{
|
||||
{ "token", ServerService.GetToken().Token }
|
||||
};
|
||||
var strJosn = APIGetHttpService.Http(baseurl, "GET", contenttype, newToken, null);
|
||||
if (!string.IsNullOrEmpty(strJosn))
|
||||
{
|
||||
JObject obj = JObject.Parse(strJosn);
|
||||
if (Funs.GetNewIntOrZero(obj["code"].ToString()) == 1)
|
||||
{
|
||||
if (obj["data"] != null)
|
||||
{
|
||||
JObject dataObj = obj["data"] as JObject;
|
||||
if (dataObj != null && dataObj["BaseInfoCode"] != null)
|
||||
{
|
||||
url = dataObj["BaseInfoCode"].ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrLogInfo.WriteLog("获取失败!", ex);
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user