|
@@ -160,20 +160,21 @@ FROM
|
|
LEFT JOIN Sys_Users u ON oa.CreateUserId = u.Id
|
|
LEFT JOIN Sys_Users u ON oa.CreateUserId = u.Id
|
|
LEFT JOIN Sys_SetData sd ON oa.OfficialForm = sd.Id
|
|
LEFT JOIN Sys_SetData sd ON oa.OfficialForm = sd.Id
|
|
{0}", sqlWhere);
|
|
{0}", sqlWhere);
|
|
- var oa = await _sqlSugar.SqlQueryable<OfficialActivitiesView>(sql)
|
|
|
|
- .FirstAsync();
|
|
|
|
- //OfficialActivities.ScreenshotOfMailUrls.ForEach(url => { url = AppSettingsHelper.Get("GrpFileBaseUrl") + url; });
|
|
|
|
|
|
+ var oa = await _sqlSugar.SqlQueryable<OfficialActivitiesView>(sql).FirstAsync();
|
|
|
|
|
|
- oa.TranslatorIdItem = _sqlSugar.Queryable<Grp_OfficialDutyLinkTranslator>()
|
|
|
|
|
|
+ var array1 = _sqlSugar.Queryable<Grp_OfficialDutyLinkTranslator>()
|
|
.Where(x => x.IsDel == 0 && x.OfficialDutyId == dto.Id)
|
|
.Where(x => x.IsDel == 0 && x.OfficialDutyId == dto.Id)
|
|
.Select(x => x.TranslatorId)
|
|
.Select(x => x.TranslatorId)
|
|
.ToArray();
|
|
.ToArray();
|
|
|
|
|
|
- if (oa.TranslatorIdItem.Any())
|
|
|
|
|
|
+ if (array1.Any())
|
|
{
|
|
{
|
|
|
|
+ oa.TranslatorIdItem = array1;
|
|
|
|
+
|
|
|
|
+ int translatorId = array1[0];
|
|
var translatorInfo = await _sqlSugar.Queryable<Res_TranslatorLibrary>()
|
|
var translatorInfo = await _sqlSugar.Queryable<Res_TranslatorLibrary>()
|
|
- .Where(x => x.IsDel == 0 && oa.TranslatorIdItem[0] == dto.Id)
|
|
|
|
- .FirstAsync();
|
|
|
|
|
|
+ .Where(x => x.IsDel == 0 && x.Id == translatorId)
|
|
|
|
+ .FirstAsync();
|
|
|
|
|
|
EncryptionProcessor.DecryptProperties(translatorInfo);
|
|
EncryptionProcessor.DecryptProperties(translatorInfo);
|
|
|
|
|
|
@@ -191,7 +192,7 @@ FROM
|
|
}
|
|
}
|
|
public async Task<Result> OpOfficialActivities(OpOfficialActivitiesDto dto)
|
|
public async Task<Result> OpOfficialActivities(OpOfficialActivitiesDto dto)
|
|
{
|
|
{
|
|
- Result result = new Result() { Code = -2, Msg = "未知错误" };
|
|
|
|
|
|
+ var result = new Result() { Code = -2, Msg = "未知错误" };
|
|
|
|
|
|
#region 特殊字符转码 037 - 4.28 15:17
|
|
#region 特殊字符转码 037 - 4.28 15:17
|
|
|
|
|
|
@@ -220,19 +221,25 @@ FROM
|
|
res_InvitationData.Field = dto.Field;
|
|
res_InvitationData.Field = dto.Field;
|
|
EncryptionProcessor.EncryptProperties(res_InvitationData);
|
|
EncryptionProcessor.EncryptProperties(res_InvitationData);
|
|
|
|
|
|
- //翻译人员资料
|
|
|
|
- var translatorInfo = _mapper.Map<Res_TranslatorLibrary>(dto.TranslatorInfo);
|
|
|
|
- translatorInfo.CreateUserId = dto.CreateUserId;
|
|
|
|
- if (dto.TranslatorIdItem.Any()) translatorInfo.Id = dto.TranslatorIdItem[0];
|
|
|
|
|
|
+ var isInserTranslator = false;
|
|
|
|
+ var translatorInfo = new Res_TranslatorLibrary();
|
|
|
|
+ if (true)
|
|
|
|
+ {
|
|
|
|
+ //翻译人员资料
|
|
|
|
+ translatorInfo = _mapper.Map<Res_TranslatorLibrary>(dto.TranslatorInfo);
|
|
|
|
+ translatorInfo.CreateUserId = dto.CreateUserId;
|
|
|
|
+ if (dto.TranslatorIdItem.Any()) translatorInfo.Id = dto.TranslatorIdItem[0];
|
|
|
|
|
|
- EncryptionProcessor.EncryptProperties(translatorInfo);
|
|
|
|
|
|
+ EncryptionProcessor.EncryptProperties(translatorInfo);
|
|
|
|
+ isInserTranslator = true;
|
|
|
|
+ }
|
|
|
|
|
|
int DataID = 0;
|
|
int DataID = 0;
|
|
if (dto.Status == 1)//添加
|
|
if (dto.Status == 1)//添加
|
|
{
|
|
{
|
|
//添加资料
|
|
//添加资料
|
|
DataID = await _sqlSugar.Insertable(res_InvitationData).ExecuteReturnIdentityAsync();
|
|
DataID = await _sqlSugar.Insertable(res_InvitationData).ExecuteReturnIdentityAsync();
|
|
- Res_OfficialActivities _InvitationOfficialActivityData = _mapper.Map<Res_OfficialActivities>(dto);
|
|
|
|
|
|
+ var _InvitationOfficialActivityData = _mapper.Map<Res_OfficialActivities>(dto);
|
|
_InvitationOfficialActivityData.DataId = DataID;
|
|
_InvitationOfficialActivityData.DataId = DataID;
|
|
int id = await _sqlSugar.Insertable(_InvitationOfficialActivityData).ExecuteReturnIdentityAsync();
|
|
int id = await _sqlSugar.Insertable(_InvitationOfficialActivityData).ExecuteReturnIdentityAsync();
|
|
if (id == 0)
|
|
if (id == 0)
|
|
@@ -243,60 +250,62 @@ FROM
|
|
else
|
|
else
|
|
{
|
|
{
|
|
var translatorId = translatorInfo.Id;
|
|
var translatorId = translatorInfo.Id;
|
|
- if (translatorId > 0) // 翻译人员资料更新
|
|
|
|
|
|
+
|
|
|
|
+ if (isInserTranslator)
|
|
{
|
|
{
|
|
- var tiStatus = await _sqlSugar.Updateable<Res_TranslatorLibrary>(translatorInfo)
|
|
|
|
- .UpdateColumns(x => new
|
|
|
|
- {
|
|
|
|
- x.Area,
|
|
|
|
- x.Name,
|
|
|
|
- x.Sex,
|
|
|
|
- x.Tel,
|
|
|
|
- x.Email,
|
|
|
|
- x.WechatNo,
|
|
|
|
- x.OtherSocialAccounts,
|
|
|
|
- x.Language,
|
|
|
|
- x.Price,
|
|
|
|
- x.Currency,
|
|
|
|
- })
|
|
|
|
- .ExecuteCommandAsync();
|
|
|
|
-
|
|
|
|
- if (tiStatus < 1)
|
|
|
|
|
|
+ if (translatorId > 0) // 翻译人员资料更新
|
|
{
|
|
{
|
|
- _sqlSugar.RollbackTran();
|
|
|
|
- return new Result() { Code = -1, Msg = "翻译人员资料更新失败!", Data = new { Id = id } };
|
|
|
|
|
|
+ var tiStatus = await _sqlSugar.Updateable<Res_TranslatorLibrary>(translatorInfo)
|
|
|
|
+ .UpdateColumns(x => new
|
|
|
|
+ {
|
|
|
|
+ x.Area,
|
|
|
|
+ x.Name,
|
|
|
|
+ x.Sex,
|
|
|
|
+ x.Tel,
|
|
|
|
+ x.Email,
|
|
|
|
+ x.WechatNo,
|
|
|
|
+ x.OtherSocialAccounts,
|
|
|
|
+ x.Language,
|
|
|
|
+ x.Price,
|
|
|
|
+ x.Currency,
|
|
|
|
+ })
|
|
|
|
+ .ExecuteCommandAsync();
|
|
|
|
+
|
|
|
|
+ if (tiStatus < 1)
|
|
|
|
+ {
|
|
|
|
+ _sqlSugar.RollbackTran();
|
|
|
|
+ return new Result() { Code = -1, Msg = "翻译人员资料更新失败!", Data = new { Id = id } };
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
- else //添加翻译人员资料
|
|
|
|
- {
|
|
|
|
- translatorId = await _sqlSugar.Insertable(translatorInfo).ExecuteReturnIdentityAsync();
|
|
|
|
- if (translatorId == 0)
|
|
|
|
|
|
+ else //添加翻译人员资料
|
|
{
|
|
{
|
|
- _sqlSugar.RollbackTran();
|
|
|
|
- return new Result() { Code = -1, Msg = "翻译人员资料添加失败!", Data = new { Id = id } };
|
|
|
|
|
|
+ translatorId = await _sqlSugar.Insertable(translatorInfo).ExecuteReturnIdentityAsync();
|
|
|
|
+ if (translatorId == 0)
|
|
|
|
+ {
|
|
|
|
+ _sqlSugar.RollbackTran();
|
|
|
|
+ return new Result() { Code = -1, Msg = "翻译人员资料添加失败!", Data = new { Id = id } };
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- #region 新增(公务信息关联翻译人员) 关联信息
|
|
|
|
|
|
+ #region 新增(公务信息关联翻译人员) 关联信息
|
|
|
|
|
|
- var linkStatus = await _sqlSugar
|
|
|
|
- .Insertable(new Grp_OfficialDutyLinkTranslator()
|
|
|
|
|
|
+ var linkStatus = await _sqlSugar
|
|
|
|
+ .Insertable(new Grp_OfficialDutyLinkTranslator()
|
|
|
|
+ {
|
|
|
|
+ TranslatorId = translatorId,
|
|
|
|
+ OfficialDutyId = id,
|
|
|
|
+ CreateUserId = dto.CreateUserId,
|
|
|
|
+ Remark = $"公务出访客户资料-->添加"
|
|
|
|
+ }).ExecuteCommandAsync();
|
|
|
|
+
|
|
|
|
+ if (linkStatus < 1)
|
|
{
|
|
{
|
|
- TranslatorId = translatorId,
|
|
|
|
- OfficialDutyId = id,
|
|
|
|
- CreateUserId = dto.CreateUserId,
|
|
|
|
- Remark = $"公务出访客户资料-->添加"
|
|
|
|
- }).ExecuteCommandAsync();
|
|
|
|
|
|
+ _sqlSugar.RollbackTran();
|
|
|
|
+ return new Result() { Code = -1, Msg = "公务出访关联翻译人员资料添加失败!", Data = new { Id = id } };
|
|
|
|
+ }
|
|
|
|
|
|
- if (linkStatus < 1)
|
|
|
|
- {
|
|
|
|
- _sqlSugar.RollbackTran();
|
|
|
|
- return new Result() { Code = -1, Msg = "公务出访关联翻译人员资料添加失败!", Data = new { Id = id } };
|
|
|
|
|
|
+ #endregion
|
|
}
|
|
}
|
|
-
|
|
|
|
- #endregion
|
|
|
|
-
|
|
|
|
-
|
|
|
|
_sqlSugar.CommitTran();
|
|
_sqlSugar.CommitTran();
|
|
result = new Result() { Code = 0, Msg = "添加成功!", Data = new { Id = id } };
|
|
result = new Result() { Code = 0, Msg = "添加成功!", Data = new { Id = id } };
|
|
}
|
|
}
|
|
@@ -382,73 +391,77 @@ FROM
|
|
});
|
|
});
|
|
if (res)
|
|
if (res)
|
|
{
|
|
{
|
|
- #region 更新(公务信息关联翻译人员) 关联信息
|
|
|
|
-
|
|
|
|
- if (translatorInfo.Id > 0) //资料更新
|
|
|
|
|
|
+ if (isInserTranslator)
|
|
{
|
|
{
|
|
- var tiStatus = await _sqlSugar.Updateable<Res_TranslatorLibrary>(translatorInfo)
|
|
|
|
- .UpdateColumns(x => new
|
|
|
|
- {
|
|
|
|
- x.Area,
|
|
|
|
- x.Name,
|
|
|
|
- x.Sex,
|
|
|
|
- x.Tel,
|
|
|
|
- x.Email,
|
|
|
|
- x.WechatNo,
|
|
|
|
- x.OtherSocialAccounts,
|
|
|
|
- x.Language,
|
|
|
|
- x.Price,
|
|
|
|
- x.Currency,
|
|
|
|
- })
|
|
|
|
- .ExecuteCommandAsync();
|
|
|
|
-
|
|
|
|
- if (tiStatus < 1)
|
|
|
|
- {
|
|
|
|
- _sqlSugar.RollbackTran();
|
|
|
|
- return new Result() { Code = -1, Msg = "翻译人员资料更新失败!", Data = new { Id = dto.Id } };
|
|
|
|
- }
|
|
|
|
|
|
+ #region 更新(公务信息关联翻译人员) 关联信息
|
|
|
|
|
|
- var dutyLink_select = await _sqlSugar.Queryable<Grp_OfficialDutyLinkTranslator>()
|
|
|
|
- .Where(x => x.IsDel == 0 && x.OfficialDutyId == dto.Id&& x.TranslatorId == translatorInfo.Id)
|
|
|
|
- .FirstAsync();
|
|
|
|
- if (dutyLink_select == null)
|
|
|
|
|
|
+ if (translatorInfo.Id > 0) //资料更新
|
|
{
|
|
{
|
|
- var odltStatus = await _sqlSugar.Insertable(new Grp_OfficialDutyLinkTranslator()
|
|
|
|
|
|
+ var tiStatus = await _sqlSugar.Updateable<Res_TranslatorLibrary>(translatorInfo)
|
|
|
|
+ .UpdateColumns(x => new
|
|
|
|
+ {
|
|
|
|
+ x.Area,
|
|
|
|
+ x.Name,
|
|
|
|
+ x.Sex,
|
|
|
|
+ x.Tel,
|
|
|
|
+ x.Email,
|
|
|
|
+ x.WechatNo,
|
|
|
|
+ x.OtherSocialAccounts,
|
|
|
|
+ x.Language,
|
|
|
|
+ x.Price,
|
|
|
|
+ x.Currency,
|
|
|
|
+ })
|
|
|
|
+ .ExecuteCommandAsync();
|
|
|
|
+
|
|
|
|
+ if (tiStatus < 1)
|
|
|
|
+ {
|
|
|
|
+ _sqlSugar.RollbackTran();
|
|
|
|
+ return new Result() { Code = -1, Msg = "翻译人员资料更新失败!", Data = new { Id = dto.Id } };
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var dutyLink_select = await _sqlSugar.Queryable<Grp_OfficialDutyLinkTranslator>()
|
|
|
|
+ .Where(x => x.IsDel == 0 && x.OfficialDutyId == dto.Id && x.TranslatorId == translatorInfo.Id)
|
|
|
|
+ .FirstAsync();
|
|
|
|
+ if (dutyLink_select == null)
|
|
|
|
+ {
|
|
|
|
+ var odltStatus = await _sqlSugar.Insertable(new Grp_OfficialDutyLinkTranslator()
|
|
{
|
|
{
|
|
TranslatorId = translatorInfo.Id,
|
|
TranslatorId = translatorInfo.Id,
|
|
OfficialDutyId = dto.Id,
|
|
OfficialDutyId = dto.Id,
|
|
CreateUserId = dto.CreateUserId,
|
|
CreateUserId = dto.CreateUserId,
|
|
Remark = $"公务出访客户资料-->添加"
|
|
Remark = $"公务出访客户资料-->添加"
|
|
}).ExecuteCommandAsync();
|
|
}).ExecuteCommandAsync();
|
|
|
|
+ if (odltStatus < 1)
|
|
|
|
+ {
|
|
|
|
+ _sqlSugar.RollbackTran();
|
|
|
|
+ result = new Result() { Code = -1, Msg = "公务出访关联翻译人员资料添加失败!" };
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else // 添加
|
|
|
|
+ {
|
|
|
|
+ translatorInfo.Id = await _sqlSugar.Insertable(translatorInfo).ExecuteReturnIdentityAsync();
|
|
|
|
+ if (translatorInfo.Id == 0)
|
|
|
|
+ {
|
|
|
|
+ _sqlSugar.RollbackTran();
|
|
|
|
+ return new Result() { Code = -1, Msg = "翻译人员资料添加失败!", Data = new { Id = dto.Id } };
|
|
|
|
+ }
|
|
|
|
+ var odltStatus = await _sqlSugar.Insertable(new Grp_OfficialDutyLinkTranslator()
|
|
|
|
+ {
|
|
|
|
+ TranslatorId = translatorInfo.Id,
|
|
|
|
+ OfficialDutyId = dto.Id,
|
|
|
|
+ CreateUserId = dto.CreateUserId,
|
|
|
|
+ Remark = $"公务出访客户资料-->添加"
|
|
|
|
+ }).ExecuteCommandAsync();
|
|
if (odltStatus < 1)
|
|
if (odltStatus < 1)
|
|
{
|
|
{
|
|
_sqlSugar.RollbackTran();
|
|
_sqlSugar.RollbackTran();
|
|
result = new Result() { Code = -1, Msg = "公务出访关联翻译人员资料添加失败!" };
|
|
result = new Result() { Code = -1, Msg = "公务出访关联翻译人员资料添加失败!" };
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ #endregion
|
|
}
|
|
}
|
|
- else // 添加
|
|
|
|
- {
|
|
|
|
- translatorInfo.Id = await _sqlSugar.Insertable(translatorInfo).ExecuteReturnIdentityAsync();
|
|
|
|
- if (translatorInfo.Id == 0)
|
|
|
|
- {
|
|
|
|
- _sqlSugar.RollbackTran();
|
|
|
|
- return new Result() { Code = -1, Msg = "翻译人员资料添加失败!", Data = new { Id = dto.Id } };
|
|
|
|
- }
|
|
|
|
- var odltStatus = await _sqlSugar.Insertable(new Grp_OfficialDutyLinkTranslator()
|
|
|
|
- {
|
|
|
|
- TranslatorId = translatorInfo.Id,
|
|
|
|
- OfficialDutyId = dto.Id,
|
|
|
|
- CreateUserId = dto.CreateUserId,
|
|
|
|
- Remark = $"公务出访客户资料-->添加"
|
|
|
|
- }).ExecuteCommandAsync();
|
|
|
|
- if (odltStatus < 1)
|
|
|
|
- {
|
|
|
|
- _sqlSugar.RollbackTran();
|
|
|
|
- result = new Result() { Code = -1, Msg = "公务出访关联翻译人员资料添加失败!" };
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- #endregion
|
|
|
|
|
|
+
|
|
|
|
|
|
_sqlSugar.CommitTran();
|
|
_sqlSugar.CommitTran();
|
|
result = new Result() { Code = 0, Msg = "修改成功!", Data = new { Id = dto.Id } };
|
|
result = new Result() { Code = 0, Msg = "修改成功!", Data = new { Id = dto.Id } };
|