Browse Source

Merge branch 'develop' of http://132.232.92.186:3000/XinXiBu/OA2023 into develop

wangh 1 year ago
parent
commit
26f13adf37

+ 20 - 6
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -78,8 +78,15 @@ namespace OASystem.API.Controllers
         {
             Grp_ScheduleDetailInfo _detail = _mapper.Map<Grp_ScheduleDetailInfo>(dto);
             var result = await _grpScheduleRep._sqlSugar.Updateable<Grp_ScheduleDetailInfo>()
+                .SetColumns(it => it.Duty == _detail.Duty)
+                .SetColumns(it => it.ExpectBeginDt == _detail.ExpectBeginDt)
+                .SetColumns(it => it.ExpectEndDt == _detail.ExpectEndDt)
+                .SetColumns(it => it.JobContent == _detail.JobContent)
+                .SetColumns(it => it.Remark == _detail.Remark)
+                .SetColumns(it => it.StepStatus == _detail.StepStatus)
                 .Where(s => s.Id == dto.Id)
-                .UpdateColumns(s => new { s.Duty, s.ExpectBeginDt, s.ExpectEndDt, s.JobContent, s.Remark, s.StepStatus })
+
+                //.UpdateColumns(s => new { s.Duty, s.ExpectBeginDt, s.ExpectEndDt, s.JobContent, s.Remark, s.StepStatus })
                 .ExecuteCommandAsync();
             if (result > 0)
             {
@@ -103,8 +110,13 @@ namespace OASystem.API.Controllers
             _detail.DeleteUserId = dto.Duty;
             _detail.DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
             var result = await _grpScheduleRep._sqlSugar.Updateable<Grp_ScheduleDetailInfo>()
-               .Where(s => s.Id == dto.Id)
-               .UpdateColumns(s => new { s.IsDel, s.DeleteUserId, s.DeleteTime })
+               .SetColumns(it => it.IsDel == _detail.IsDel)
+               .SetColumns(it => it.DeleteUserId == _detail.DeleteUserId)
+               .SetColumns(it => it.DeleteTime == _detail.DeleteTime)
+               .Where(it => it.Id == dto.Id)
+
+               //.UpdateColumns(s => new { s.IsDel, s.DeleteUserId, s.DeleteTime })
+               //.WhereColumns(s => s.Id == dto.Id)
                .ExecuteCommandAsync();
             if (result > 0)
             {
@@ -135,7 +147,9 @@ namespace OASystem.API.Controllers
             var result = await _grpScheduleRep._sqlSugar.Insertable(_detail).ExecuteReturnIdentityAsync();
             if (result > 0)
             {
-                return Ok(JsonView(true, "添加成功!"));
+                Grp_ScheduleDetailView _result = await _grpScheduleRep.GetInsertBackData(result);
+
+                return Ok(JsonView(true, "添加成功!", _result));
             }
 
             return Ok(JsonView(false, "添加失败!"));
@@ -313,7 +327,7 @@ namespace OASystem.API.Controllers
             {
                 return Ok(JsonView(false, groupData.Msg));
             }
-            
+
             return Ok(JsonView(groupData.Data, groupData.Data.Count));
         }
 
@@ -358,7 +372,7 @@ namespace OASystem.API.Controllers
             return Ok(JsonView(groupData.Data));
         }
 
-       
+
 
         #endregion
     }

+ 3 - 5
OASystem/OASystem.Api/Controllers/TencentOCRController.cs

@@ -124,8 +124,6 @@ namespace OASystem.API.Controllers
             };
 
             #region word生成 返回地址
-            string tempPath = string.Format("{0}", "C:\\Server\\File\\OA2023\\Office\\Word\\TencentOCR\\Template\\ocr_身份证(人像面).doc");
-
             Dictionary<string, object> dic = new Dictionary<string, object>();
             dic.Add("Name", iDCardOCRView.Name);
             dic.Add("Sex", iDCardOCRView.Sex);
@@ -136,11 +134,11 @@ namespace OASystem.API.Controllers
             dic.Add("Authority", iDCardOCRView.Authority);
             dic.Add("ValidDate", iDCardOCRView.ValidDate);
 
-            string downPath = string.Format("{0}.doc",dic["Name"].ToString() + "身份证(人像面)" + DateTime.Now.ToString("yyyyMMddHHmmss"));
+            string fileName = string.Format("{0}.doc", dic["Name"].ToString() + "身份证(人像面)" + DateTime.Now.ToString("yyyyMMddHHmmss"));
 
-            string serverPathh = AsposeHelper.ExpertWordToModel(tempPath, downPath, dic, null);
+            string serverPath = AsposeHelper.ExpertWordToModel("ocr_身份证(人像面).doc", "TencentOCR", fileName, dic, null);
 
-            iDCardOCRView.DownUrl = serverPathh.Replace("C:", "http:\\132.232.92.186");
+            iDCardOCRView.DownUrl = serverPath;
             #endregion
 
             return Ok(JsonView(iDCardOCRView));

+ 1 - 2
OASystem/OASystem.Api/OAMethodLib/ExcelOutput/Excel_BusConfItemList.cs

@@ -24,7 +24,6 @@ namespace OASystem.API.OAMethodLib.ExcelOutput
             }
         }
 
-
         public string Excel(Bus_ConfItemListInfo _entity)
         {
 
@@ -69,7 +68,7 @@ Where bcil.Id={0}
             string diName = _DelegationInfo != null ? _DelegationInfo.TeamName : "未知团组" + _entity.Diid;
 
             WorkbookDesigner designer = new WorkbookDesigner();
-            designer.Workbook = new Workbook(AppSettingsHelper.Get("ExcelBasePath") + "Model/会务物料清单模板.xlsx");
+            designer.Workbook = new Workbook(AppSettingsHelper.Get("ExcelBasePath") + "Template/会务物料清单模板.xlsx");
             designer.SetDataSource("Export", _confItemList);
             designer.SetDataSource("ExportDiName", diName);
             designer.SetDataSource("ExportOutputDt", DateTime.Now.ToString("yyyy-MM-dd"));

+ 63 - 35
OASystem/OASystem.Api/OAMethodLib/File/AsposeHelper.cs

@@ -1,5 +1,8 @@
-using Aspose.Words;
+using Aspose.Cells;
+using Aspose.Words;
+using System.Collections.Generic;
 using System.Data;
+using System.IO;
 using System.Web;
 using Ubiety.Dns.Core;
 
@@ -16,12 +19,13 @@ namespace OASystem.API.OAMethodLib.File
         /// <summary>
         /// 根据Word模板进行数据的导出Word操作
         /// </summary>
-        /// <param name="tempPath">模板路径</param>
-        /// <param name="outputFileName">保存文件名称</param>
+        /// <param name="tempFileName">模板文件名称</param>
+        /// <param name="saveFolderName">保存文件名称</param>
         /// <param name="dic">数据源 key 对应 value</param>
         /// <param name="listDt">需要循环的数据DataTable  多个注意DataTableName </param>
         /// <returns>返回的文档路径</returns>
-        public static string ExpertWordToModel(string tempPath, string outputFileName, Dictionary<string,object> dic, List<DataTable>? listDt)
+        public static string ExpertWordToModel(string tempFileName, string saveFolderName, string saveFilName, Dictionary<string,object> dic,
+            List<DataTable>? listDt)
         {
             try
             {
@@ -36,6 +40,7 @@ namespace OASystem.API.OAMethodLib.File
                     fieldValues.Add(dic[key]);
                 }
 
+                string tempPath = string.Format("{0}/Word/Template/{1}", AppSettingsHelper.Get("OfficeTempBasePath"), tempFileName);
                 //载入模板
                 Document doc = new Document(tempPath);
                 doc.MailMerge.Execute(fieldNames.ToArray(), fieldValues.ToArray());
@@ -53,15 +58,24 @@ namespace OASystem.API.OAMethodLib.File
                 
                 //合并模版,相当于页面的渲染
                 doc.MailMerge.Execute(new[] { "PageCount" }, new object[] { doc.PageCount });
-                //保存合并后的文档
 
-                string outputPath = string.Format("C:\\Server\\File\\OA2023\\Office\\Word\\TencentOCR\\Save\\{0}", outputFileName);
-                doc.Save(outputPath); 
-                return outputPath; //返回下载地址
+                string path = string.Format("{0}/Word/{1}", AppSettingsHelper.Get("OfficeTempBasePath"), saveFolderName);
+
+                if (!System.IO.Directory.Exists(path))
+                {
+                    System.IO.Directory.CreateDirectory(path);//不存在就创建文件夹
+                }
+
+                string saveFilePath = string.Format("{0}{1}", path, saveFilName);
+
+                //保存合并后的文档
+                doc.Save(saveFilePath); 
+                saveFilePath = saveFilePath.Replace("C:", AppSettingsHelper.Get("OfficeBaseUrl")); //返回下载地址
+                return saveFilePath; //返回下载地址
             }
-            catch (Exception er)
+            catch (Exception ex)
             {
-                return er.Message;
+                return ex.Message;
             }
         }
         
@@ -78,50 +92,64 @@ namespace OASystem.API.OAMethodLib.File
         /// <summary>
         /// 根据Word模板进行数据的导出Word操作
         /// </summary>
-        /// <param name="tempPath">模板路径</param>
-        /// <param name="outputPath">保存路径</param>
+        /// <param name="tempFileName">Excel模板文件名称</param>
+        /// <param name="saveFolderName">保存文件夹名称</param>
+        /// <param name="saveFilName">保存文件名称</param>
         /// <param name="dic">数据源 key 对应 value</param>
         /// <param name="listDt">需要循环的数据DataTable  多个注意DataTableName </param>
         /// <returns>返回的文档路径</returns>
-        public static string ExpertExcelToModel(string tempPath, string outputFileName, Dictionary<string, object> dic, List<DataTable>? listDt)
+        public static string ExpertExcelToModel(string tempFileName, string saveFolderName, string saveFilName, Dictionary<string, object> dic,
+            List<DataTable>? listDt)
         {
             try
             {
-                removeWatermark();//加载监听,用于去除水印
-
-                List<string> fieldNames = new List<string>();  //字段名字符串数组
-                List<object> fieldValues = new List<object>(); //字段值数组
-
-                foreach (string key in dic.Keys)
-                {
-                    fieldNames.Add(key);
-                    fieldValues.Add(dic[key]);
-                }
+                string tempPath = string.Format("{0}/Excel/Template/{1}",AppSettingsHelper.Get("OfficeTempBasePath"), tempFileName);
 
                 //载入模板
-                Document doc = new Document(tempPath);
-                doc.MailMerge.Execute(fieldNames.ToArray(), fieldValues.ToArray());
-                //将我们获得的DataTable类型的数据:EduDataTable放入doc方法中做处理
+                Workbook wbook = new Workbook(tempPath);
+                //默认第一个工作表
+                Worksheet wSheet = wbook.Worksheets[0]; 
+                WorkbookDesigner designer = new WorkbookDesigner(wbook);
+
+                //数据源 多个
                 if (listDt != null && listDt.Count > 0)
                 {
-                    foreach (DataTable dt in listDt)
+                    foreach (var item in listDt)
                     {
-                        if (dt != null && dt.Rows.Count > 0)
+                        if (item.Rows.Count > 0)
                         {
-                            doc.MailMerge.ExecuteWithRegions(dt);
+                            designer.SetDataSource(item.TableName, item);
                         }
                     }
                 }
 
-                //合并模版,相当于页面的渲染
-                doc.MailMerge.Execute(new[] { "PageCount" }, new object[] { doc.PageCount });
+                //报表单位
+                if (dic.Count > 0)
+                {
+                    foreach (var item in dic)
+                    {
+                        designer.SetDataSource(item.Key, item.Value);
+                    }
+                }
+               
+                designer.Process();
+
+                string path = string.Format("{0}/Excel/{1}", AppSettingsHelper.Get("OfficeTempBasePath"), saveFolderName);
+
+                if (!System.IO.Directory.Exists(path))
+                {
+                    System.IO.Directory.CreateDirectory(path);//不存在就创建文件夹
+                }
+                string saveFilePath = string.Format("{0}{1}", path, saveFilName);
+
                 //保存合并后的文档
-                doc.Save(outputFileName);
-                return outputFileName; //返回下载地址
+                wbook.Save(saveFilePath);
+                saveFilePath = saveFilePath.Replace("C:", AppSettingsHelper.Get("OfficeBaseUrl")); //返回下载地址
+                return saveFilePath; //返回下载地址
             }
-            catch (Exception er)
+            catch (Exception ex)
             {
-                return er.Message;
+                return ex.Message;
             }
         }
 

+ 0 - 146
OASystem/OASystem.Api/OAMethodLib/File/NPOIHelper.cs

@@ -1,146 +0,0 @@
-//using NPOI.XWPF.UserModel;
-
-namespace OASystem.API.OAMethodLib.NPOI
-{
-    /// <summary>
-    /// word / excel 
-    /// </summary>
-    public class NPOIHelper
-    {
-        //#region Word
-        ///// <summary>
-        ///// 输出模板docx文档(使用字典)
-        ///// </summary>
-        ///// <param name="tempFilePath">docx文件路径</param>
-        ///// <param name="outPath">输出文件路径</param>
-        ///// <param name="data">字典数据源</param>
-        //public static void Export(string tempFilePath, string outPath, Dictionary<string, string> data)
-        //{
-        //    try
-        //    {
-        //        using (FileStream stream = File.OpenRead(tempFilePath ))
-        //        {
-        //            XWPFDocument doc = new XWPFDocument(stream);
-        //            //遍历段落                  
-        //            foreach (var para in doc.Paragraphs)
-        //            {
-        //                ReplaceKey(para, data);
-        //            }
-
-        //            //遍历表格      
-        //            foreach (var table in doc.Tables)
-        //            {
-        //                foreach (var row in table.Rows)
-        //                {
-        //                    foreach (var cell in row.GetTableCells())
-        //                    {
-        //                        foreach (var para in cell.Paragraphs)
-        //                        {
-        //                            ReplaceKey(para, data);
-        //                        }
-        //                    }
-        //                }
-        //            }
-
-        //            //写文件
-        //            FileStream outFile = new FileStream(outPath, FileMode.Create);
-        //            doc.Write(outFile);
-        //            outFile.Close();
-        //        }
-        //    }
-        //    catch (Exception ex)
-        //    {
-
-        //        throw;
-        //    }
-            
-        //}
-        //private static void ReplaceKey(XWPFParagraph para, Dictionary<string, string> data)
-        //{
-        //    string text = "";
-        //    foreach (var run in para.Runs)
-        //    {
-        //        text = run.ToString();
-        //        foreach (var key in data.Keys)
-        //        {
-        //            //$$模板中数据占位符为$KEY$
-        //            if (text.Contains($"${key}$"))
-        //            {
-        //                text = text.Replace($"${key}$", data[key]);
-        //            }
-        //        }
-        //        run.SetText(text, 0);
-        //    }
-        //}
-
-        ///// <summary>
-        ///// 输出模板docx文档(使用反射)
-        ///// </summary>
-        ///// <param name="tempFilePath">docx文件路径</param>
-        ///// <param name="outPath">输出文件路径</param>
-        ///// <param name="data">对象数据源</param>
-        //public static void ExportObjet(string tempFilePath, string outPath, object data)
-        //{
-        //    using (FileStream stream = File.OpenRead(tempFilePath))
-        //    {
-        //        XWPFDocument doc = new XWPFDocument(stream);
-        //        //遍历段落                  
-        //        foreach (var para in doc.Paragraphs)
-        //        {
-        //            ReplaceKeyObjet(para, data);
-        //        }
-        //        //遍历表格      
-        //        foreach (var table in doc.Tables)
-        //        {
-        //            foreach (var row in table.Rows)
-        //            {
-        //                foreach (var cell in row.GetTableCells())
-        //                {
-        //                    foreach (var para in cell.Paragraphs)
-        //                    {
-        //                        ReplaceKeyObjet(para, data);
-        //                    }
-        //                }
-        //            }
-        //        }
-        //        //写文件
-        //        FileStream outFile = new FileStream(outPath, FileMode.Create);
-        //        doc.Write(outFile);
-        //        outFile.Close();
-        //    }
-        //}
-        //private static void ReplaceKeyObjet(XWPFParagraph para, object model)
-        //{
-        //    string text = "";
-        //    Type t = model.GetType();
-        //    PropertyInfo[] pi = t.GetProperties();
-        //    foreach (var run in para.Runs)
-        //    {
-        //        text = run.ToString();
-        //        foreach (PropertyInfo p in pi)
-        //        {
-        //            //$$模板中数据占位符为$KEY$
-        //            string key = $"${p.Name}$";
-        //            if (text.Contains(key))
-        //            {
-        //                try
-        //                {
-        //                    text = text.Replace(key, p.GetValue(model, null).ToString());
-        //                }
-        //                catch (Exception ex)
-        //                {
-        //                    //可能有空指针异常
-        //                    text = text.Replace(key, "");
-        //                }
-        //            }
-        //        }
-        //        run.SetText(text, 0);
-        //    }
-        //}
-        //#endregion
-
-
-
-
-    }
-}

+ 4 - 0
OASystem/OASystem.Api/OAMethodLib/GroupStepForDelegation.cs

@@ -4,6 +4,7 @@ using OASystem.Domain.Common;
 using OASystem.Domain.Dtos.Groups;
 using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.Enums;
+using OASystem.Domain.ViewModels.Groups;
 using OASystem.Infrastructure.Repositories.Groups;
 using System.Configuration;
 using static OpenAI.GPT3.ObjectModels.SharedModels.IOpenAiModels;
@@ -467,6 +468,9 @@ Where d.Id={0} And u.Id not in({1})", DepartmentCode.IC, _groupConfig.FilterUser
 
         #endregion
 
+
+        
+
     }
 
 

+ 15 - 4
OASystem/OASystem.Api/OAMethodLib/JsonConvertOverride.cs

@@ -14,14 +14,25 @@ namespace OASystem.API.OAMethodLib
         {
             Format = format;
         }
-        public override void Write(Utf8JsonWriter writer, DateTime date, JsonSerializerOptions options)
-        {
-            writer.WriteStringValue(date.ToString(Format));
-        }
+
         public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
         {
+            if (string.IsNullOrEmpty(reader.GetString()))
+            {
+                return default(DateTime);
+            }
+
             return DateTime.ParseExact(reader.GetString(), Format, null);
         }
+
+        public override void Write(Utf8JsonWriter writer, DateTime date, JsonSerializerOptions options)
+        {
+            writer.WriteStringValue(date.ToString(Format));
+        }
+        //public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
+        //{
+        //    return DateTime.ParseExact(reader.GetString(), Format, null);
+        //}
     }
     #endregion
 

+ 3 - 1
OASystem/OASystem.Api/appsettings.json

@@ -104,6 +104,8 @@
     }
   ],
   "ExcelBaseUrl": "http://132.232.92.186/",
-  "ExcelBasePath": "C:/Server/File/OA2023/Office/Excel/"
+  "ExcelBasePath": "C:/Server/File/OA2023/Office/Excel/",
+  "OfficeBaseUrl": "http://132.232.92.186/",
+  "OfficeTempBasePath": "C:/Server/File/OA2023/Office/"
 
 }

+ 1 - 0
OASystem/OASystem.Domain/Dtos/Groups/Grp_ScheduleDetailDto.cs

@@ -28,5 +28,6 @@ namespace OASystem.Domain.Dtos.Groups
         public DateTime ExpectEndDt { get; set; }
         public int CreateUserId { get; set; }
         public string Remark { get; set; }
+        public int SLevel { get; set; }
     }
 }

+ 27 - 0
OASystem/OASystem.Infrastructure/Repositories/Groups/GrpScheduleRepository.cs

@@ -49,6 +49,33 @@ namespace OASystem.Infrastructure.Repositories.Groups
             return sql;
         }
 
+        #region 获取添加后的新数据
+        public async Task<Grp_ScheduleDetailView> GetInsertBackData(int detailId)
+        {
+            Grp_ScheduleDetailInfo item = await _sqlSugar.Queryable<Grp_ScheduleDetailInfo>().FirstAsync(s => s.Id == detailId);
+            if (item != null)
+            {
+                Grp_ScheduleDetailView temp = new Grp_ScheduleDetailView();
+                temp.Duty = item.Duty;
+                temp.Exception = item.Exception;
+                temp.ExpectBeginDt = item.ExpectBeginDt;
+                temp.ExpectEndDt = item.ExpectEndDt;
+                temp.DetailId = item.Id;
+                temp.JobContent = item.JobContent;
+                temp.Level = item.SLevel;
+                temp.RealEndDt = item.RealEndDt;
+                temp.Remark = item.Remark;
+                temp.Root = item.ParentStep;
+                temp.Step = item.Step;
+                temp.StepStatus = item.StepStatus;
+
+                return temp;
+            }
+
+            return null;
+        }
+        #endregion
+
         /// <summary>
         /// 获取团组流程数据单个对象
         /// </summary>

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

@@ -1568,6 +1568,46 @@ int
 
 
 
+9) 新客户资料信息表与员工关联表:Crm_ClientDataAndUser
+                                   字段名
+                                 类型长度
+                                 字段属性
+                                 字段约束
+                                 字段描述
+                                    备注
+usersId
+Int
+Null
+
+员工id
+
+NewClientDataId
+Int
+Null
+
+新客户资料信息表id
+
+
+10) 新客户资料信息表与业务关联表:Crm_ClientDataAndBusiness
+                                   字段名
+                                 类型长度
+                                 字段属性
+                                 字段约束
+                                 字段描述
+                                    备注
+SetDataId
+Int
+Null
+
+setdataid
+
+NewClientDataId
+Int
+Null
+
+新客户资料信息表id
+
+
 1. 团组模块