|
@@ -3,6 +3,7 @@ using Aspose.Cells.Charts;
|
|
|
using Aspose.Words;
|
|
|
using Aspose.Words.Drawing;
|
|
|
using Aspose.Words.Tables;
|
|
|
+using DiffMatchPatch;
|
|
|
using EyeSoft.Collections.Generic;
|
|
|
using EyeSoft.IO;
|
|
|
using Google.Protobuf.WellKnownTypes;
|
|
@@ -11438,6 +11439,10 @@ FROM
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
+ var travelList_DB = _sqlSugar.Queryable<Grp_TravelList>()
|
|
|
+ .Where(x => dto.Arr.Select(x=>x.Id).Contains(x.Id))
|
|
|
+ .ToList();
|
|
|
+
|
|
|
_sqlSugar.BeginTran();
|
|
|
foreach (var item in dto.Arr)
|
|
|
{
|
|
@@ -11446,6 +11451,15 @@ FROM
|
|
|
throw new Exception("请传入正确的Id");
|
|
|
}
|
|
|
|
|
|
+ //比较上一次的差异
|
|
|
+ var findTravel = travelList_DB.Find(x => x.Id == item.Id);
|
|
|
+ if (findTravel != null)
|
|
|
+ {
|
|
|
+ item.Trip = item.Trip.Replace("[++]", string.Empty);
|
|
|
+ findTravel.Trip = findTravel.Trip.Replace("[++]", string.Empty);
|
|
|
+ item.Trip = CheckStr(findTravel.Trip,item.Trip);
|
|
|
+ }
|
|
|
+
|
|
|
_sqlSugar.Updateable<Grp_TravelList>().Where(x => x.Id == item.Id)
|
|
|
.SetColumns(x => new Grp_TravelList
|
|
|
{
|
|
@@ -11469,6 +11483,63 @@ FROM
|
|
|
return Ok(jw);
|
|
|
}
|
|
|
|
|
|
+ private string CheckStr(string original, string changed)
|
|
|
+ {
|
|
|
+ // 创建diff_match_patch对象
|
|
|
+ var dmp = new diff_match_patch();
|
|
|
+
|
|
|
+ // 计算差异
|
|
|
+ List<Diff> diffs = dmp.diff_main(original, changed);
|
|
|
+
|
|
|
+ // 清理和合并差异
|
|
|
+ dmp.diff_cleanupSemantic(diffs);
|
|
|
+
|
|
|
+ // 使用StringBuilder构建最终的字符串
|
|
|
+ StringBuilder finalString = new StringBuilder();
|
|
|
+
|
|
|
+ // 输出差异结果,并构建变动后的字符串
|
|
|
+ foreach (Diff diff in diffs)
|
|
|
+ {
|
|
|
+ switch (diff.operation)
|
|
|
+ {
|
|
|
+ case Operation.EQUAL:
|
|
|
+ // 相等的部分,直接添加到最终字符串
|
|
|
+ finalString.Append(diff.text);
|
|
|
+ break;
|
|
|
+ case Operation.INSERT:
|
|
|
+ // 插入的部分,添加标记并添加到最终字符串
|
|
|
+ finalString.Append("[++]" + diff.text + "[++]");
|
|
|
+ break;
|
|
|
+ case Operation.DELETE:
|
|
|
+ // 删除的部分,不添加到最终字符串
|
|
|
+ //finalString.Append("[++]" + diff.text + "[++]");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 输出变动后的字符串
|
|
|
+ return finalString.ToString();
|
|
|
+ }
|
|
|
+
|
|
|
+ public class tagContent
|
|
|
+ {
|
|
|
+ public DateTime Date { get; set; }
|
|
|
+
|
|
|
+ public string StartTag { get; set; }
|
|
|
+
|
|
|
+ public string EndTag { get; set; }
|
|
|
+
|
|
|
+ public string Content { get; set; }
|
|
|
+
|
|
|
+ public static int tagLength { get { return 3; } }
|
|
|
+
|
|
|
+ public static Tuple<string, string> TagFormat { get { return new Tuple<string, string>("【#", "#】"); } }
|
|
|
+
|
|
|
+ public string QueryTag { get { return this.StartTag + this.EndTag; } }
|
|
|
+
|
|
|
+ public bool IsFinally { get; set; }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 导出行程单
|
|
@@ -11541,6 +11612,9 @@ FROM
|
|
|
//获取数据,放到datatable
|
|
|
foreach (var item in _travelList)
|
|
|
{
|
|
|
+
|
|
|
+ item.Trip = item.Trip.Replace(tagContent.TagFormat.Item1, string.Empty).Replace(tagContent.TagFormat.Item2, string.Empty);
|
|
|
+
|
|
|
DataRow dr = dtSource.NewRow();
|
|
|
dr["Days"] = item.Days;
|
|
|
dr["Date"] = item.Date;
|