Browse Source

【签证进度通知】提交

jiangjc 1 year ago
parent
commit
e0220ab527

+ 1 - 1
OASystem/EntitySync/Program.cs

@@ -78,7 +78,7 @@ db.CodeFirst.SetStringDefaultLength(50).BackupTable().InitTables(new Type[]
     //typeof(Grp_ScheduleInfo),
     //typeof(Grp_ScheduleInfo),
     //typeof(Grp_ScheduleDetailInfo),
     //typeof(Grp_ScheduleDetailInfo),
     //typeof(Grp_SchedulePersonInfo)
     //typeof(Grp_SchedulePersonInfo)
-    //typeof(Sys_Message),
+    typeof(Sys_Message),
     //typeof(Sys_MessageReadAuth)
     //typeof(Sys_MessageReadAuth)
     //typeof(Crm_DeleClient)
     //typeof(Crm_DeleClient)
     //typeof(Crm_NewClientData)
     //typeof(Crm_NewClientData)

+ 72 - 1
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -46,6 +46,7 @@ namespace OASystem.API.Controllers
         private readonly InvitationOfficialActivitiesRepository _InvitationOfficialActivitiesRep;
         private readonly InvitationOfficialActivitiesRepository _InvitationOfficialActivitiesRep;
         private readonly DelegationEnDataRepository _delegationEnDataRep;
         private readonly DelegationEnDataRepository _delegationEnDataRep;
         private readonly DelegationVisaRepository _delegationVisaRep;
         private readonly DelegationVisaRepository _delegationVisaRep;
+        private readonly MessageRepository _message;
         private readonly SqlSugarClient _sqlSugar;
         private readonly SqlSugarClient _sqlSugar;
         private string url;
         private string url;
         private string path;
         private string path;
@@ -55,7 +56,7 @@ namespace OASystem.API.Controllers
         public GroupsController(IMapper mapper, SqlSugarClient sqlSugar, GrpScheduleRepository grpScheduleRep, DelegationInfoRepository groupRepository,
         public GroupsController(IMapper mapper, SqlSugarClient sqlSugar, GrpScheduleRepository grpScheduleRep, DelegationInfoRepository groupRepository,
             TaskAssignmentRepository taskAssignmentRep, AirTicketResRepository airTicketResRep, DecreasePaymentsRepository decreasePaymentsRep,
             TaskAssignmentRepository taskAssignmentRep, AirTicketResRepository airTicketResRep, DecreasePaymentsRepository decreasePaymentsRep,
             InvitationOfficialActivitiesRepository InvitationOfficialActivitiesRep, DelegationEnDataRepository delegationEnDataRep, EnterExitCostRepository enterExitCostRep
             InvitationOfficialActivitiesRepository InvitationOfficialActivitiesRep, DelegationEnDataRepository delegationEnDataRep, EnterExitCostRepository enterExitCostRep
-            , DelegationVisaRepository delegationVisaRep)
+            , DelegationVisaRepository delegationVisaRep, MessageRepository message)
         {
         {
             _mapper = mapper;
             _mapper = mapper;
             _grpScheduleRep = grpScheduleRep;
             _grpScheduleRep = grpScheduleRep;
@@ -74,6 +75,7 @@ namespace OASystem.API.Controllers
             _delegationEnDataRep = delegationEnDataRep;
             _delegationEnDataRep = delegationEnDataRep;
             _enterExitCostRep = enterExitCostRep;
             _enterExitCostRep = enterExitCostRep;
             _delegationVisaRep = delegationVisaRep;
             _delegationVisaRep = delegationVisaRep;
+            _message = message;
         }
         }
 
 
         #region 流程管控
         #region 流程管控
@@ -610,6 +612,75 @@ namespace OASystem.API.Controllers
         }
         }
 
 
 
 
+        /// <summary>
+        /// IOS获取团组签证拍照上传进度05(修改签证状态/通知)
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<ActionResult> PostIOSVisaProgressChangeStatus(IOS_VisaChangeStatusDto dto)
+        {
+            if (dto == null)
+            {
+                return Ok(JsonView(false, "请求错误:"));
+            }
+
+            string msg = "参数错误";
+            if (dto.diId > 0 && dto.visaStatus > 0 && dto.visaStatus < 4)
+            {
+                try
+                {
+                    //_delegationVisaRep.BeginTran();
+
+                    var updCount = await _delegationVisaRep._sqlSugar.Updateable<Grp_VisaProgressCustomer>()
+                        .SetColumns(it => it.WorkStatus == dto.visaStatus)
+                        .Where(s => s.Id == dto.visaProgressCustomerId)
+                        .ExecuteCommandAsync();
+                    if (updCount > 0 && dto.publishCode == 1) {
+
+                        _delegationVisaRep.ChangeDataBase(DBEnum.OA2014DB); //切换到新OA后删除
+                        GroupInfoDto grpDto = new GroupInfoDto() { Id = dto.diId };
+                        var groupData = await _groupRepository.GetGroupInfo(grpDto);
+                        _delegationVisaRep.ChangeDataBase(DBEnum.OA2023DB); //切换到新OA后删除
+                        if (groupData.Code != 0)
+                        {
+                            _delegationVisaRep.RollbackTran();
+                        }
+
+                        string title = string.Format(@"[签证进度更新]");
+                        string content = string.Format(@"测试文本");
+
+                        bool rst = await _message.AddMsg(new MessageDto()
+                        {
+                            Type = 5,
+                            IssuerId = dto.publisher,
+                            Title = dto.title,
+                            Content = content,
+                            ReleaseTime = DateTime.Now,
+                            UIdList = new List<int> {
+                                234
+                            }
+                        });
+
+                        if (rst) {
+                            return Ok(JsonView(true, "发送通知成功"));
+                        }
+                    }
+
+                    //_delegationVisaRep.CommitTran();
+                }
+                catch (Exception)
+                {
+                    //_delegationVisaRep.RollbackTran();
+
+                }
+            }
+
+
+            return Ok(JsonView(true, msg));
+        }
+
         #endregion
         #endregion
 
 
         #region 团组任务分配
         #region 团组任务分配

+ 12 - 0
OASystem/OASystem.Domain/Dtos/Groups/VisaDto.cs

@@ -30,4 +30,16 @@ namespace OASystem.Domain.Dtos.Groups
         public int visaProgressCustomerId { get; set; }
         public int visaProgressCustomerId { get; set; }
         public int CreateUserId { get; set; }
         public int CreateUserId { get; set; }
     }
     }
+
+    public class IOS_VisaChangeStatusDto : PortDtoBase
+    {
+        public int visaStatus { get; set; }
+        public int visaProgressCustomerId { get; set; }
+        public int diId { get; set; }
+        /// <summary>
+        /// 0:不通知,1:发送通知
+        /// </summary>
+        public int publishCode { get; set; }
+        public int publisher { get; set; }
+    }
 }
 }

+ 3 - 0
OASystem/OASystem.Domain/Dtos/System/MessageDto.cs

@@ -18,6 +18,7 @@ namespace OASystem.Domain.Dtos.System
         /// 2 团组流程管控消息
         /// 2 团组流程管控消息
         /// 1 团组业务操作消息
         /// 1 团组业务操作消息
         /// 2 费用审核消息
         /// 2 费用审核消息
+        /// 5 团组签证进度通知
         /// </summary>
         /// </summary>
         public int Type { get; set; }
         public int Type { get; set; }
 
 
@@ -26,6 +27,8 @@ namespace OASystem.Domain.Dtos.System
         /// </summary>
         /// </summary>
         public int IssuerId { get; set; }
         public int IssuerId { get; set; }
 
 
+        public int DiId { get; set; } = 0;
+
         /// <summary>
         /// <summary>
         /// 消息标题
         /// 消息标题
         /// </summary>
         /// </summary>

+ 7 - 0
OASystem/OASystem.Domain/Entities/System/Sys_Message.cs

@@ -9,6 +9,7 @@ namespace OASystem.Domain.Entities.System
     /// <summary>
     /// <summary>
     /// 系统消息 表
     /// 系统消息 表
     /// </summary>
     /// </summary>
+    [SugarTable("Sys_Message")]
     public class Sys_Message :EntityBase
     public class Sys_Message :EntityBase
     {
     {
         /// <summary>
         /// <summary>
@@ -28,6 +29,12 @@ namespace OASystem.Domain.Entities.System
         [SugarColumn(IsNullable = true,ColumnDataType = "int")]
         [SugarColumn(IsNullable = true,ColumnDataType = "int")]
         public int IssuerId { get; set; }
         public int IssuerId { get; set; }
 
 
+        /// <summary>
+        /// 团组Id,可为0
+        /// </summary>
+        [SugarColumn(IsNullable = true,ColumnDataType = "int")]
+        public int DiId { get; set; }
+
         /// <summary>
         /// <summary>
         /// 消息标题
         /// 消息标题
         /// </summary>
         /// </summary>

+ 18 - 0
OASystem/OASystem.Infrastructure/Repositories/Groups/DelegationVisaRepository.cs

@@ -3,6 +3,7 @@ using OASystem.Domain.Dtos.Groups;
 using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.ViewModels.Groups;
 using OASystem.Domain.ViewModels.Groups;
 using OASystem.Domain.ViewModels.Resource;
 using OASystem.Domain.ViewModels.Resource;
+using SqlSugar;
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
@@ -55,6 +56,23 @@ From DelegationInfo With(Nolock) {2}
             return rst;
             return rst;
         }
         }
 
 
+        public Grp_DelegationVisaView GetDelegationInfo(int diId)
+        {
+            ChangeDataBase(DBEnum.OA2014DB);
+
+            string sql = string.Format(@" Select * From(Select ROW_NUMBER() Over(order By Id desc) as RowNumber, Id as DiId,
+TeamName,ClientUnit,ClientName,TeamLev,VisitDate,VisitDays,VisitPNumber
+From DelegationInfo With(Nolock) Where Id = {0}
+) as tb  ", diId);
+            Grp_DelegationVisaView rst = _sqlSugar.SqlQueryable<Grp_DelegationVisaView>(sql).First();
+
+            string sql2 = string.Format(@" Select * From Grp_VisaProgressCustomer With(Nolock) Where DiId={0} And IsDel=0 ", diId);
+            List<Grp_VisaProgressCustomer> listComplete = _sqlSugar.SqlQueryable<Grp_VisaProgressCustomer>(sql2).ToList();
+
+            rst.CompletePNumber = string.Format(@"已完成{0}人", listComplete.Count);
+            return rst;
+        }
+
         public List<DelegationVisaProgressView> GetDelegationProgressList(int diid)
         public List<DelegationVisaProgressView> GetDelegationProgressList(int diid)
         {
         {
             ChangeDataBase(DBEnum.OA2014DB);
             ChangeDataBase(DBEnum.OA2014DB);

+ 10 - 9
OASystem/OASystem.Infrastructure/Repositories/System/MessageRepository.cs

@@ -44,7 +44,8 @@ namespace OASystem.Infrastructure.Repositories.System
                     DeleteUserId = null,
                     DeleteUserId = null,
                     DeleteTime = "1990-01-01 00:00:00.000",
                     DeleteTime = "1990-01-01 00:00:00.000",
                     Remark = "",
                     Remark = "",
-                    IsDel = 0
+                    IsDel = 0,
+                    DiId = msgDto.DiId
                 };
                 };
 
 
                 int? msgId = await _sqlSugar.Insertable(message).ExecuteReturnIdentityAsync();
                 int? msgId = await _sqlSugar.Insertable(message).ExecuteReturnIdentityAsync();
@@ -53,11 +54,11 @@ namespace OASystem.Infrastructure.Repositories.System
                 List<Sys_MessageReadAuth> messageReadAuths = new List<Sys_MessageReadAuth>();
                 List<Sys_MessageReadAuth> messageReadAuths = new List<Sys_MessageReadAuth>();
                 foreach (int item in msgDto.UIdList)
                 foreach (int item in msgDto.UIdList)
                 {
                 {
-                    Sys_MessageReadAuth messageReadAuth = new Sys_MessageReadAuth() 
+                    Sys_MessageReadAuth messageReadAuth = new Sys_MessageReadAuth()
                     {
                     {
                         MsgId = msgId.Value,
                         MsgId = msgId.Value,
                         ReadableUId = item,
                         ReadableUId = item,
-                        ReadTime = new DateTime(1990,1,1),
+                        ReadTime = new DateTime(1990, 1, 1),
                         CreateUserId = msgDto.IssuerId,
                         CreateUserId = msgDto.IssuerId,
                         CreateTime = DateTime.Now,
                         CreateTime = DateTime.Now,
                         DeleteUserId = null,
                         DeleteUserId = null,
@@ -173,12 +174,12 @@ namespace OASystem.Infrastructure.Repositories.System
             if (dto.PortType == 1 || dto.PortType == 2)
             if (dto.PortType == 1 || dto.PortType == 2)
             {
             {
 
 
-                  var msgReadStatus = await _sqlSugar.Updateable<Sys_MessageReadAuth>()
-                                      .Where(a => a.Id == dto.MsgAnthId)
-                                      .SetColumns(a => new Sys_MessageReadAuth
-                                      {
-                                          IsRead = 1
-                                      }).ExecuteCommandAsync();
+                var msgReadStatus = await _sqlSugar.Updateable<Sys_MessageReadAuth>()
+                                    .Where(a => a.Id == dto.MsgAnthId)
+                                    .SetColumns(a => new Sys_MessageReadAuth
+                                    {
+                                        IsRead = 1
+                                    }).ExecuteCommandAsync();
 
 
                 if (msgReadStatus > 0)
                 if (msgReadStatus > 0)
                 {
                 {