Sfoglia il codice sorgente

团组任务分配初始化数据,及下拉框数据

wangh 1 anno fa
parent
commit
2d809209ca

+ 4 - 3
OASystem/EntitySync/Program.cs

@@ -89,8 +89,9 @@ db.CodeFirst.SetStringDefaultLength(50).BackupTable().InitTables(new Type[]
     //typeof(Bus_ConfItemInfo)
     //typeof(Bus_ConfItemListInfo)
     //typeof(Res_CountryFeeCost)
-    typeof(Res_MemoInfo),
-    typeof(Fin_DailyFeePayment), // 财务 - 日付申请
-    typeof(Fin_DailyFeePaymentContent)  // 财务 - 日付申请详细类
+    //typeof(Res_MemoInfo),
+    //typeof(Fin_DailyFeePayment), // 财务 - 日付申请
+    //typeof(Fin_DailyFeePaymentContent)  // 财务 - 日付申请详细类
+    typeof(Grp_GroupsTaskAssignment)
 });
 Console.WriteLine("数据库结构同步完成!");

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

@@ -18,12 +18,14 @@ namespace OASystem.API.Controllers
         private readonly GrpScheduleRepository _grpScheduleRep;
         private readonly IMapper _mapper;
         private readonly DelegationInfoRepository _groupRepository;
+        private readonly TaskAssignmentRepository _taskAssignmentRep;
 
-        public GroupsController(IMapper mapper, GrpScheduleRepository grpScheduleRep, DelegationInfoRepository groupRepository)
+        public GroupsController(IMapper mapper, GrpScheduleRepository grpScheduleRep, DelegationInfoRepository groupRepository, TaskAssignmentRepository taskAssignmentRep)
         {
             _mapper = mapper;
             _grpScheduleRep = grpScheduleRep;
             _groupRepository = groupRepository;
+            _taskAssignmentRep = taskAssignmentRep;
         }
 
         #region 流程管控
@@ -374,6 +376,60 @@ namespace OASystem.API.Controllers
 
 
 
+        #endregion
+
+        #region 团组任务分配
+        /// <summary>
+        /// 团组任务分配初始化
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> GetTaskAssignmen()
+        {
+            var groupData = await _taskAssignmentRep.GetTaskAssignmen();
+            if (groupData.Code != 0)
+            {
+                return Ok(JsonView(false, groupData.Msg));
+            }
+            return Ok(JsonView(true,groupData.Msg,groupData.Data));
+        }
+
+        /// <summary>
+        /// 团组任务分配查询
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> TaskAssignmenQuery(TaskAssignmenQueryDto dto)
+        {
+            var groupData = await _taskAssignmentRep.TaskAssignmenQuery(dto);
+            if (groupData.Code != 0)
+            {
+                return Ok(JsonView(false, groupData.Msg));
+            }
+            return Ok(JsonView(true, groupData.Msg, groupData.Data));
+        }
+
+
+        /// <summary>
+        /// 团组任务分配操作
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> GetTaskAssignmenOp(TaskAssignmenDto dto)
+        {
+            Result groupData = await _taskAssignmentRep.GetTaskAssignmenOp(dto);
+            if (groupData.Code != 0)
+            {
+                return Ok(JsonView(false, groupData.Msg));
+            }
+            return Ok(JsonView(true, groupData.Msg, groupData.Data));
+        }
         #endregion
     }
 }

+ 50 - 0
OASystem/OASystem.Domain/Dtos/Groups/TaskAssignmenDto.cs

@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Dtos.Groups
+{
+    public class TaskAssignmenDto
+    {
+        /// <summary>
+        /// 团组外键编号
+        /// </summary>
+        public int DIId { get; set; }
+        /// <summary>
+        /// 配置任务(设置数据外键编号)
+        /// </summary>
+        public int CTId { get; set; }
+
+        /// <summary>
+        /// 员工外键编号
+        /// </summary>
+        public List<int> UIdStr { get; set; }
+
+        /// <summary>
+        /// 启用标识
+        /// </summary>
+        public int IsEnable { get; set; } = 1;
+        /// <summary>
+        /// 创建者Id
+        /// </summary>
+        public int CreateUserId { get; set; }
+        /// <summary>
+        /// 备注
+        /// </summary>
+        public string Remark { get; set; }
+    }
+    public class TaskAssignmenQueryDto
+    {
+        /// <summary>
+        /// 团组外键编号
+        /// </summary>
+        public int DIId { get; set; }
+        /// <summary>
+        /// 配置任务(设置数据外键编号)
+        /// </summary>
+        public int CTId { get; set; }
+    }
+
+}

+ 42 - 0
OASystem/OASystem.Domain/Entities/Groups/Grp_GroupsTaskAssignment.cs

@@ -0,0 +1,42 @@
+using OASystem.Domain.Dtos;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Security.Cryptography;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Entities.Groups
+{
+
+    /// <summary>
+    /// 团组任务分配表
+    /// </summary>
+    [SugarTable("Grp_GroupsTaskAssignment")]
+    public class Grp_GroupsTaskAssignment:EntityBase
+    {
+
+        /// <summary>
+        /// 团组外键编号
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int DIId { get; set; }
+        /// <summary>
+        /// 配置任务(设置数据外键编号)
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int CTId { get; set; }
+
+        /// <summary>
+        /// 员工外键编号
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int UId { get; set; }
+
+        /// <summary>
+        /// 启用标识
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int IsEnable { get; set; }
+    }
+}

+ 1 - 1
OASystem/OASystem.Infrastructure/Repositories/CRM/NewClientDataRepository.cs

@@ -421,7 +421,7 @@ namespace OASystem.Infrastructure.Repositories.CRM
             {
                 if (dto.Status == 1)//添加
                 {
-                    string selectSql = string.Format(@"select * from Crm_NewClientData where Client='{0}' Contact='{1}' And IsDel={2}"
+                    string selectSql = string.Format(@"select * from Crm_NewClientData where Client='{0}' and  Contact='{1}' And IsDel={2}"
                                                        , dto.Client,dto.Contact,0);
                     var NewClientData = await _sqlSugar.SqlQueryable<Crm_NewClientData>(selectSql).FirstAsync();//查询是否存在
                     if (NewClientData != null)

+ 177 - 0
OASystem/OASystem.Infrastructure/Repositories/Groups/TaskAssignmentRepository.cs

@@ -0,0 +1,177 @@
+using AutoMapper;
+using MySqlX.XDevAPI.Relational;
+using OASystem.Domain;
+using OASystem.Domain.Dtos.Groups;
+using OASystem.Domain.Entities.Groups;
+using OASystem.Domain.Entities.Resource;
+using OASystem.Domain.ViewModels.Groups;
+using Org.BouncyCastle.Utilities.Collections;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Infrastructure.Repositories.Groups
+{
+    public class TaskAssignmentRepository : BaseRepository<Grp_GroupsTaskAssignment, Grp_GroupsTaskAssignment>
+    {
+        private readonly IMapper _mapper;
+        public TaskAssignmentRepository(SqlSugarClient sqlSugar, IMapper mapper) :
+            base(sqlSugar)
+        {
+            this._mapper = mapper;
+        }
+
+        public async Task<Result> GetTaskAssignmen()
+        {
+            Result result = new Result() { Code = -2, Msg = "未知错误" };
+            try
+            {
+                //团组下拉框
+                List<dynamic> _DelegationInfos = new List<dynamic>();
+                List<Grp_DelegationInfo> grp_DelegationInfos=_sqlSugar.Queryable<Grp_DelegationInfo>().Where(a=>a.IsDel == 0 && a.TourCode !="" && a.IsState == 0).ToList();
+                foreach (var Item in grp_DelegationInfos)
+                {
+                    var data = new
+                    {
+                        Id = Item.Id,
+                        Name = Item.TeamName
+                    };
+                    _DelegationInfos.Add(data);
+                }
+                //任务下拉框
+                List<dynamic> _SetData = new List<dynamic>();
+                List<Sys_SetData> sys_SetData = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.IsDel == 0 && a.Name != "其他款项" && a.STid ==16).ToList();
+                foreach (var Item in sys_SetData)
+                {
+                    var data = new
+                    {
+                        Id = Item.Id,
+                        Name = Item.Name
+                    };
+                    _SetData.Add(data);
+                }
+                //人员安排列表
+                List<dynamic> _User = new List<dynamic>();
+                List<Sys_Users> sys_User = _sqlSugar.Queryable<Sys_Users>().Where(a => a.IsDel == 0 &&a.Id!=4).ToList();
+                foreach (var Item in sys_User)
+                {
+                    var data = new
+                    {
+                        Id = Item.Id,
+                        Name = Item.CnName
+                    };
+                    _User.Add(data);
+                }
+                var dataList = new
+                {
+                    DelegationInfos=_DelegationInfos,
+                    SetData= _SetData,
+                    User= _User
+                };
+                result=new Result(){ Code = 0, Msg = "成功", Data = dataList };
+            }
+            catch (Exception)
+            {
+                result = new Result() { Code = -2, Msg = "未知错误" };
+            }
+            return result;
+        }
+
+        public async Task<Result> GetTaskAssignmenOp(TaskAssignmenDto dto)
+        {
+            Result result = new Result() { Code = -2, Msg = "未知错误" };
+            try 
+            {
+                List<int> id = new List<int>();
+                List<int> NewId = dto.UIdStr;
+                List<Grp_GroupsTaskAssignment> _GroupsTaskAssignments = _sqlSugar.Queryable<Grp_GroupsTaskAssignment>().Where(a=>a.DIId==dto.DIId).ToList();
+                foreach(var Group in _GroupsTaskAssignments) 
+                {
+                    id.Add(Group.Id);
+                }
+                //需删除的
+
+                //需修改的
+
+                //需添加的
+            }
+            catch (Exception)
+            {
+                result = new Result() { Code = -2, Msg = "未知错误" };
+            }
+            return result;
+            
+        }
+
+        public async Task<Result> TaskAssignmenQuery(TaskAssignmenQueryDto dto)
+        {
+            Result result = new Result() { Code = -2, Msg = "未知错误" };
+            try
+            {
+                string sqlWhere = string.Empty;
+                if (dto.DIId!=0)
+                {
+                    sqlWhere += string.Format(@" And DIId ={0}", dto.DIId);
+                }
+                else
+                {
+                    return result = new Result() { Code = -1, Msg = "暂无数据" };
+                }
+                if (dto.CTId!=0)
+                {
+                    sqlWhere += string.Format(@" And CTId ={0}", dto.CTId);
+                }
+                else
+                {
+                    return result = new Result() { Code = -1, Msg = "暂无数据" };
+                }
+                
+                sqlWhere += string.Format(@" And IsDel={0} ", 0);
+                if (!string.IsNullOrEmpty(sqlWhere.Trim()))
+                {
+                    Regex r = new Regex("And");
+                    sqlWhere = r.Replace(sqlWhere, "Where", 1);
+                }
+                string sql = string.Format(@"select * from Grp_GroupsTaskAssignment {0}", sqlWhere);
+                List<Grp_GroupsTaskAssignment> GroupsTaskAssignment = await _sqlSugar.SqlQueryable<Grp_GroupsTaskAssignment>(sql).ToListAsync();
+                Grp_DelegationInfo grp_DelegationInfo = new Grp_DelegationInfo();
+                if (GroupsTaskAssignment.Count!=0)
+                {
+                    List<int> UserId = new List<int>();
+                    foreach (var item in GroupsTaskAssignment)
+                    {
+                        UserId.Add(item.UId);
+                    }
+
+                    grp_DelegationInfo = _sqlSugar.Queryable<Grp_DelegationInfo>().First(a => a.Id == GroupsTaskAssignment[0].DIId && a.IsDel==0);
+                    
+                    var data = new
+                    {
+                        TaskAssignment = GroupsTaskAssignment[0],
+                        UserStr = UserId,
+                        DelegationInfo = grp_DelegationInfo
+                    };
+                    result = new Result()
+                    {
+                        Code = 0,
+                        Msg = "查询成功!",
+                        Data = data
+                    };
+                }
+                else
+                {
+                    result = new Result() { Code = -1, Msg = "暂无数据" };
+                }
+                
+            }
+            catch (Exception)
+            {
+                result = new Result() { Code = -2, Msg = "未知错误" };
+                throw;
+            }
+            return result;
+        }
+    }
+}

+ 6 - 6
OASystem/_Doc/OA2023数据字典.docx

@@ -2958,23 +2958,23 @@ Null
 团组外键编号
 Grp_DelegationInfo.id
 CTId
-varchar(50)
+Int
 Null
 
  配置任务(设置数据外键编号)
 Sys_SetData.id
 UId
-varchar(50)
+Int
 Null
 
 员工外键编号
 Sys_User.id
 IsEnable
+int
+Null
 
-
-
-
-
+启用标识
+0否1是
 
 1. 资源板块
 1) 酒店数据表:Res_HotelData(挪用)