|
@@ -8834,6 +8834,39 @@ FROM
|
|
|
_sqlSugar.RollbackTran();
|
|
|
return Ok(JsonView(false, "草稿数据为空,不可导入!"));
|
|
|
}
|
|
|
+
|
|
|
+ //验证可覆盖已有数据 两边创建人需为同一人;
|
|
|
+ int draftCreateUserId = draftDatas.CreateUserId,
|
|
|
+ formalCreateUserId = 0;
|
|
|
+
|
|
|
+ var formalData = _sqlSugar.Queryable<Grp_EnterExitCost>().Where(x => x.IsDel == 0 && x.DiId == groupId).First();
|
|
|
+ if (formalData != null)
|
|
|
+ {
|
|
|
+ formalCreateUserId = formalData.CreateUserId;
|
|
|
+
|
|
|
+ if (draftCreateUserId != formalCreateUserId)
|
|
|
+ {
|
|
|
+ _sqlSugar.RollbackTran();
|
|
|
+ return Ok(JsonView(false, "由草稿数据到入至正式数据,两边创建人为同一人才可导入正式版!"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ var permissionUsers = await _enterExitCostRep.PermissionViewUsersAsync();
|
|
|
+ var userIds = permissionUsers.Select(x => x.Id).ToList();
|
|
|
+ var permissions = new List<Grp_EnterExitCostPermission>();
|
|
|
+ if (userIds.Any())
|
|
|
+ {
|
|
|
+ foreach (var userId in userIds)
|
|
|
+ {
|
|
|
+ permissions.Add(new Grp_EnterExitCostPermission() {
|
|
|
+ GroupId = groupId,
|
|
|
+ UserId = userId,
|
|
|
+ CreateUserId = dto.UserId
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
var dayDatas = _sqlSugar.Queryable<Grp_DayAndCostDraft>().Where(x => x.IsDel == 0 && x.ParentId == draftId).ToList();
|
|
|
var otherDatas = _sqlSugar.Queryable<Grp_DayOtherPriceDraft>().Where(x => x.IsDel == 0 && x.ParentId == draftId).ToList();
|
|
|
|
|
@@ -8867,6 +8900,11 @@ FROM
|
|
|
.SetColumns(x => new Grp_DayOtherPrice() { IsDel = 1, DeleteUserId = userId, DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") })
|
|
|
.Where(x => x.Diid == groupId)
|
|
|
.ExecuteCommand();
|
|
|
+
|
|
|
+ _sqlSugar.Updateable<Grp_EnterExitCostPermission>()
|
|
|
+ .SetColumns(x => new Grp_EnterExitCostPermission() { IsDel = 1, DeleteUserId = userId, DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") })
|
|
|
+ .Where(x => x.GroupId == groupId)
|
|
|
+ .ExecuteCommand();
|
|
|
}
|
|
|
|
|
|
//执行insert
|
|
@@ -8877,6 +8915,8 @@ FROM
|
|
|
return Ok(JsonView(false, "草稿数据导入失败!"));
|
|
|
}
|
|
|
|
|
|
+ if (permissions.Any()) _sqlSugar.Insertable(permissions).ExecuteCommand();
|
|
|
+
|
|
|
if (newDayDatas.Any()) _sqlSugar.Insertable(newDayDatas).ExecuteCommand();
|
|
|
|
|
|
if (newOtherDatas.Any()) _sqlSugar.Insertable(newOtherDatas).ExecuteCommand();
|