Browse Source

收款账单 新增字段

amigotrip 8 months ago
parent
commit
bdd1ce3e0d

+ 1 - 1
OASystem/EntitySync/Program.cs

@@ -137,7 +137,7 @@ db.CodeFirst.SetStringDefaultLength(50).BackupTable().InitTables(new Type[]
     //typeof(Grp_ApprovalTravelDetails),  //公务出访表
      //typeof(Sys_Countries),  //洲
      //typeof(Sys_Continent),  //国家
-     typeof(Sys_Cities),  //城市
+     //typeof(Sys_Cities),  //城市
 
 });
 Console.WriteLine("数据库结构同步完成!");

+ 19 - 29
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -736,19 +736,7 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostGroupReceivablesInfoByDiId(ForForeignReceivablesNewDto dto)
         {
-            try
-            {
-                Result ffrData = await _ForForeignReceivablesRep.PostGroupReceivablesInfoByDiId(dto);
-                if (ffrData.Code != 0)
-                {
-                    return Ok(JsonView(false, ffrData.Msg));
-                }
-                return Ok(JsonView(true, ffrData.Msg, ffrData.Data));
-            }
-            catch (Exception ex)
-            {
-                return Ok(JsonView(false, ex.Message));
-            }
+            return Ok(await _ForForeignReceivablesRep.PostGroupReceivablesInfoByDiId(dto));
         }
 
         /// <summary>
@@ -761,20 +749,22 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostReceivablesSave(ForeignReceivablesSaveDto dto)
         {
-            try
-            {
-                Result ffrData = await _ForForeignReceivablesRep.PostReceivablesSave(dto);
-                if (ffrData.Code != 0)
-                {
-                    return Ok(JsonView(false, ffrData.Msg));
-                }
-                return Ok(JsonView(true, ffrData.Msg, ffrData.Data));
-            }
-            catch (Exception ex)
-            {
-                return Ok(JsonView(false, ex.Message));
-                throw;
-            }
+           
+            return Ok(await _ForForeignReceivablesRep.PostReceivablesSave(dto));
+           
+        }
+
+        /// <summary>
+        /// 对外收款账单 
+        /// 审核
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostReceivablesAudit(FeeAuditDto dto)
+        {
+            return Ok(await _ForForeignReceivablesRep.FeeAudit(dto));
         }
 
         /// <summary>
@@ -958,7 +948,7 @@ namespace OASystem.API.Controllers
                         var cityInfo = _cityFee.Where(it => it.Id == item.NationalTravelFeeId).FirstOrDefault();
                         if (cityInfo != null)
                         {
-                            if (cityInfo.City.Contains("全部城市") || cityInfo.City.Contains("其他城市"))
+                            if (cityInfo.City.Contains("全部城市") || cityInfo.City.Contains("其他城市") || cityInfo.City.Contains("所有城市"))
                             {
                                 item.Place = cityInfo.Country;
                             }
@@ -984,7 +974,7 @@ namespace OASystem.API.Controllers
                                                       Name = dc.LastName + dc.FirstName,
                                                       Sex = dc.Sex,
                                                       Birthday = dc.BirthDay,
-                                                      Company = cc.CompanyFullName,
+                                                      Company = cc.CompanyFullName.Replace("\n",""),
                                                       Job = dc.Job,
                                                       AirType = tcl.ShippingSpaceTypeId
                                                   })

File diff suppressed because it is too large
+ 119 - 38
OASystem/OASystem.Api/Controllers/GroupsController.cs


+ 48 - 0
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -2884,5 +2884,53 @@ Order By Count Desc");
         }
 
         #endregion
+
+        #region 日付报表
+
+        /// <summary>
+        /// 日付类型数据
+        /// </summary>
+        /// <param name="_dto"></param>
+        /// <returns></returns>
+        [HttpPost("DailypaymentTypeInit")]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> DailypaymentTypeInit(DailypaymentTypeInitDto _dto)
+        {
+            #region  参数验证
+            if (_dto.PortType < 1 || _dto.PortType > 3) return Ok(JsonView(false, msg:MsgTips.Port));
+
+            PageFunAuthViewBase pageFunAuthView = new PageFunAuthViewBase();
+            #region 页面操作权限验证
+            //pageFunAuthView = await GeneralMethod.PostUserPageFuncDatas(_dto.UserId, _dto.PageId);
+
+            //if (pageFunAuthView.CheckAuth == 0) return Ok(JsonView(false, "您没有查看权限"));
+            #endregion
+
+            #endregion
+            if (_dto.PortType == 1 || _dto.PortType == 2 || _dto.PortType == 3) // web/Android/IOS
+            {
+                var defaultParentIds = new List<int>() {
+                                                        48,//  人员费用
+                                                        49,//  办公费用
+                                                        50,//  销售费用
+                                                        51,//  其他费用
+                                                        55,//  大运会
+                                                         };
+
+                var _view = await _sqlSugar.Queryable<DailypaymentParentTypeView>()
+                                           .Includes(x => x.SubData)
+                                           .Where(x => defaultParentIds.Contains(x.Id))
+                                           .ToListAsync();
+
+                //return Ok(JsonView(true, "查询成功!", _view, total));
+                return Ok(JsonView(false, "查询失败"));
+
+            }
+            else
+            {
+                return Ok(JsonView(false, "查询失败"));
+            }
+        }
+        #endregion
     }
 }

+ 10 - 0
OASystem/OASystem.Api/OAMethodLib/JuHeAPI/IJuHeApiService.cs

@@ -32,5 +32,15 @@ namespace OASystem.API.OAMethodLib.JuHeAPI
         /// </summary>
         /// <returns></returns>
         Task<Result> GetExchangeRateAsync(ExchangeRateDto dto);
+
+
+        /// <summary>
+        /// 文本翻译
+        /// </summary>
+        /// <param name="source">原文,数据类型为字符串,也可为数组(元素必须为字符串类型);每次请求的字符串长度之和尽量不要超过 </param>
+        /// <param name="trans_type">翻译方向:en2zh(英文-中文),zh2en(中文-英文),ja2zh(日文-中文),zh2ja(中文-日文),ko2zh(韩文-中文),zh2ko(中文-韩文)</param>
+        /// <returns></returns>
+        /// <returns></returns>
+        Task<string> GetTextTranslateAsync(string source, string trans_type = "zh2en");
     }
 }

+ 16 - 14
OASystem/OASystem.Api/OAMethodLib/JuHeAPI/JuHeApiService.cs

@@ -19,6 +19,7 @@ namespace OASystem.API.OAMethodLib.JuHeAPI
     public class JuHeApiService: IJuHeApiService
     {
         private readonly HttpClient _httpClient;
+        private readonly HttpClient _httpClientTranslate;
         private readonly string _appKey = "0f5429e9fbb8637c0ff3f14bbb42c732"; //配置您申请的appkey
         private readonly string _appkey_textTranslate = "59db9edbac297e30695973aa1d856391"; //文本翻译 appkey
 
@@ -28,7 +29,8 @@ namespace OASystem.API.OAMethodLib.JuHeAPI
         /// <param name="clientFactory"></param>
         public JuHeApiService(IHttpClientFactory clientFactory)
         {
-            _httpClient = clientFactory.CreateClient("PublicJuHeApi"); ;
+            _httpClient = clientFactory.CreateClient("PublicJuHeApi");
+            _httpClientTranslate = clientFactory.CreateClient("PublicJuHeTranslateApi"); 
         }
 
         #region 汇率
@@ -344,20 +346,21 @@ namespace OASystem.API.OAMethodLib.JuHeAPI
         /// <param name="source">原文,数据类型为字符串,也可为数组(元素必须为字符串类型);每次请求的字符串长度之和尽量不要超过 </param>
         /// <param name="trans_type">翻译方向:en2zh(英文-中文),zh2en(中文-英文),ja2zh(日文-中文),zh2ja(中文-日文),ko2zh(韩文-中文),zh2ko(中文-韩文)</param>
         /// <returns></returns>
-        public async Task<JuHeAPIResult> GetTextTranslateAsync(string source,string trans_type = "zh2en")
+        public async Task<string> GetTextTranslateAsync(string source,string trans_type = "zh2en")
         {
+
+            string res = "";
             var result = new JuHeAPIResult() { Resultcode = "10020", Reason = "接口维护" };
 
 
-            
-            #region 请求接口并存入缓存
-            string url = string.Format("/finance/exchange/rmbquot");
+            #region 请求接口
+            string url = string.Format($"/translate/query");
 
-            var exchangeReq = await _httpClient
+            var exchangeReq = await _httpClientTranslate
                                     .PostAsync(url,
                                      new FormUrlEncodedContent(new List<KeyValuePair<string, string>>()
                                      {
-                                             new KeyValuePair<string, string>("key",_appKey),//你申请的key 
+                                             new KeyValuePair<string, string>("key",_appkey_textTranslate),//你申请的key 
                                              new KeyValuePair<string, string>("source",source),   
                                              new KeyValuePair<string, string>("trans_type",trans_type)    
 
@@ -366,18 +369,17 @@ namespace OASystem.API.OAMethodLib.JuHeAPI
             {
                 var stringResponse = await exchangeReq.Content.ReadAsStringAsync();
 
-                result = System.Text.Json.JsonSerializer.Deserialize<JuHeAPIResult>(stringResponse,
+                JuHeTransResult result1 = System.Text.Json.JsonSerializer.Deserialize<JuHeTransResult>(stringResponse,
                 new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
 
-                if (result.Resultcode == "200")
+                if (result1.error_code == 0)
                 {
-                    string resStr = (string)result.Result.GetType().GetProperty("res").GetValue(result.Result, null);
-                    result.Result = resStr;
+                    res = result1.result.data.res;
                 }
                 else
                 {
-                    result.Reason = string.Format("聚合APIError[Error_Code:{0} Resultcode:{1} Msg:{2}]",
-                        result.Error_code, result.Resultcode, result.Result);
+                    res = string.Format("聚合APIError[Error_Code:{0} Resultcode:{1} Msg:{2}]",
+                        result1.error_code, result1.reason, result1.result);
                 }
             }
             else
@@ -387,7 +389,7 @@ namespace OASystem.API.OAMethodLib.JuHeAPI
 
             #endregion
 
-            return result;
+            return res;
         }
 
         #endregion

+ 1 - 1
OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/AppNotice/Library.cs

@@ -880,7 +880,7 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
             {
                 List<string> qwUserIdList = GetQiyeChatUserIdList(receivedUserIds);
 
-                string resMsg = string.Format(@" `机票行程代码录入操作通知`  
+                string resMsg = string.Format(@" `机票行程代码已调整更新通知`  
 
 >团组:<font color='info'>{0}</font> 
 

+ 1 - 0
OASystem/OASystem.Api/Program.cs

@@ -275,6 +275,7 @@ builder.Services.AddScoped<IMapper, Mapper>();
 builder.Services.AddControllersWithViews();
 builder.Services.AddSingleton<IJuHeApiService, JuHeApiService>();
 builder.Services.AddHttpClient("PublicJuHeApi", c => c.BaseAddress = new Uri("http://web.juhe.cn"));
+builder.Services.AddHttpClient("PublicJuHeTranslateApi", c => c.BaseAddress = new Uri("http://apis.juhe.cn"));
 #endregion
 
 #region Æóҵ΢ÐÅAPI ·þÎñ

+ 18 - 0
OASystem/OASystem.Domain/Dtos/Financial/ForForeignReceivablesNewDto.cs

@@ -101,6 +101,24 @@ namespace OASystem.Domain.Dtos.Financial
         public string? Remark { get; set; }
     }
 
+    /// <summary>
+    /// 财务模块
+    /// 收款账单
+    /// Audit
+    /// </summary>
+    public class FeeAuditDto : PortDtoBase
+    {
+        /// <summary>
+        /// 用户Id
+        /// </summary>
+        public int UserId { get; set; }
+
+        public int Id { get; set; }
+
+        public int Status { get; set; } = 1;
+
+    }
+
 
     /// <summary>
     /// 财务模块

+ 18 - 0
OASystem/OASystem.Domain/Dtos/Statistics/DailypaymentDto.cs

@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Dtos.Statistics
+{
+    public class DailypaymentDto
+    {
+    }
+
+    public class DailypaymentTypeInitDto:PortDtoBase
+    { 
+        
+    }
+
+}

+ 27 - 0
OASystem/OASystem.Domain/Entities/Financial/Fin_ForeignReceivables.cs

@@ -88,9 +88,36 @@ namespace OASystem.Domain.Entities.Financial
         /// <summary>
         /// 添加方式   
         /// 0 - 账单模块   1 - 成本预算模块 2 - 分摊费用 3 - 其他费用
+        /// 0 - 账单模块   1 - 成本预算模块 2 - 实际报价
         /// TODO:增加费用类型
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "int")]
         public int AddingWay { get; set; }
+
+        /// <summary>
+        /// 是否可审核 AddingWay==2 该项有值
+        /// 0 - 否 1 - 是
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int IsAudit { get; set; } = 0;
+
+        /// <summary>
+        /// 审核状态 AddingWay==2该项有值
+        /// 0 - 未审核 1 - 审核通过 2 - 审核不通过
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int Status { get; set; } = 0;
+
+        /// <summary> 
+        /// 审核人 AddingWay==2该项有值
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int Auditor { get; set; } = 0;
+
+        /// <summary>
+        /// 审核时间 AddingWay==2该项有值
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(30)")]
+        public string AuditTime { get; set; }
     }
 }

+ 10 - 0
OASystem/OASystem.Domain/ViewModels/Financial/Fin_ForeignReceivablesView.cs

@@ -219,11 +219,15 @@ namespace OASystem.Domain.ViewModels.Financial
                 string str = "";
                 if (AddingWay == 0) str = "账单模块";
                 else if (AddingWay == 1) str = "成本预算模块";
+                else if (AddingWay == 2) str = "实际报价";
 
                 return str;
             }
         }
 
+        public int IsAudit { get; set; }
+
+
         /// <summary>
         /// 备注
         /// </summary>
@@ -233,6 +237,12 @@ namespace OASystem.Domain.ViewModels.Financial
         /// 创建时间
         /// </summary>
         public DateTime? CreateTime { get; set; }
+
+
+        public int Status { get; set; }
+
+        public string AuditorName { get; set; }
+        public string AuditTime { get; set; }
     }
 
 

+ 21 - 0
OASystem/OASystem.Domain/ViewModels/JuHeExchangeRate/JuHeAPIResult.cs

@@ -111,4 +111,25 @@ namespace OASystem.Domain.ViewModels.JuHeExchangeRate
         /// </summary>
         public string CurrencyCode{ get; set; }
     }
+
+
+    public class JuHeTransResult
+    {
+        public int error_code { get; set; }
+        public string reason { get; set; }
+
+        public result result { get; set; }
+    }
+
+    public class result
+    {
+        public data data { get; set; }
+
+        public string orderid { get; set; }
+    }
+
+    public class data {
+        public string res { get; set; }
+        public double confidence { get; set; }
+    }
 }

+ 34 - 0
OASystem/OASystem.Domain/ViewModels/Statistics/DailypaymentView.cs

@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.ViewModels.Statistics
+{
+    public class DailypaymentView
+    {
+    }
+
+    [SqlSugar.SugarTable("Sys_SetDataType")]
+    public class DailypaymentParentTypeView
+    {
+
+        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+        public int Id { get; set; }
+        public string Name { get; set; }
+
+        [Navigate(NavigateType.OneToOne, nameof(Id))]//一对一 SchoolId是StudentA类里面的
+        public List<DailypaymentSubTypeView> SubData { get; set; }
+
+    }
+
+    [SqlSugar.SugarTable("Sys_SetData")]
+    public class DailypaymentSubTypeView
+    { 
+       public int Id { get; set; }
+        public int STid { get; set; }
+        public string Name { get; set; }
+    }
+
+}

+ 64 - 8
OASystem/OASystem.Infrastructure/Repositories/Financial/ForeignReceivablesRepository.cs

@@ -329,17 +329,19 @@ namespace OASystem.Infrastructure.Repositories.Financial
         /// </summary>
         /// <param name="diid"></param>
         /// <returns></returns>
-        public async Task<Result> PostGroupReceivablesInfoByDiId(ForForeignReceivablesNewDto dto)
+        public async Task<JsonView> PostGroupReceivablesInfoByDiId(ForForeignReceivablesNewDto dto)
         {
-            Result result = new() { Code = -2 };
+            JsonView result = new() { Code = 400,Msg="" };
 
             var groupInfoData = await _delegationRep.GetGroupInfo(new GroupInfoDto() { Id = dto.DiId });
 
             //应收款项
-            string groupReceivedSql = string.Format(@"Select * From Fin_ForeignReceivables Where IsDel=0 And Diid={0}", dto.DiId);
+            string groupReceivedSql = string.Format(@"Select *,su.CnName As AuditorName From Fin_ForeignReceivables  ffr
+Left Join Sys_Users su On  ffr.Auditor = su.Id
+Where ffr.IsDel=0 And ffr.Diid={0}", dto.DiId);
             var groupReceivedList = await _sqlSugar.SqlQueryable<ProceedsReceivedNewView>(groupReceivedSql).ToListAsync();
 
-            result.Code = 0;
+            result.Code = 200;
             result.Msg = "查询成功!";
             result.Data = new
             {
@@ -357,9 +359,9 @@ namespace OASystem.Infrastructure.Repositories.Financial
         /// </summary>
         /// <param name="diid"></param>
         /// <returns></returns>
-        public async Task<Result> PostReceivablesSave(ForeignReceivablesSaveDto dto)
+        public async Task<JsonView> PostReceivablesSave(ForeignReceivablesSaveDto dto)
         {
-            Result result = new() { Code = -2 };
+            JsonView result = new() { Code = 4002 };
 
             if (dto.foreignReceivablesInfos.Count <= 0)
             {
@@ -385,6 +387,7 @@ namespace OASystem.Infrastructure.Repositories.Financial
                         Rate = item.Rate,
                         Currency = item.Currency,
                         AddingWay = item.AddingWay,
+                        IsAudit = item.AddingWay == 2 ? 1 : 0,
                         CreateUserId = dto.UserId,
                         CreateTime = DateTime.Now,
                         Remark = item.Remark
@@ -393,16 +396,69 @@ namespace OASystem.Infrastructure.Repositories.Financial
                 if (_ForeignReceivables.Count > 0)
                 {
                     var x = _sqlSugar.Storageable(_ForeignReceivables).ToStorage();
-                    addCount = x.AsInsertable.ExecuteCommand();        //不存在插入
+                    addCount = x.AsInsertable.ExecuteCommand();       //不存在插入
                     updateCount = x.AsUpdateable.ExecuteCommand();    //存在更新
                 }
-                result.Code = 0;
+                result.Code = 200;
                 result.Msg = string.Format(@"操作成功!添加:{0}条;更新:{1};", addCount, updateCount);
             }
 
             return result;
         }
 
+        /// <summary>
+        /// 财务模块
+        /// 收款账单 
+        /// Audit
+        /// </summary>
+        /// <param name="diid"></param>
+        /// <returns></returns>
+        public async Task<JsonView> FeeAudit(FeeAuditDto dto)
+        {
+            JsonView result = new() { Code = 400 };
+            //验证
+
+            var info = await _sqlSugar.Queryable<Fin_ForeignReceivables>().FirstAsync(x => x.Id == dto.Id);
+            if (info == null)
+            {
+                result.Msg = "数据不存在";
+                return result;
+            }
+
+            if (info.AddingWay != 2)
+            {
+                result.Msg = "该条数据类型不是“实际报价”类型不可审核!";
+                return result;
+            }
+            if (info.IsAudit == 0)
+            {
+                result.Msg = "该条数据类型不可审核!";
+                return result;
+            }
+
+            var AuditStatus = await _sqlSugar.Updateable<Fin_ForeignReceivables>()
+                                      .SetColumns(a => new Fin_ForeignReceivables
+                                      {
+                                          Status = dto.Status,
+                                          Auditor = dto.UserId,
+                                          AuditTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                                      })
+                                      .Where(a => a.Id == dto.Id)
+                                      .ExecuteCommandAsync();
+
+            if (AuditStatus > 0)
+            {
+                result.Msg = "操作成功!";
+                result.Code = 0;
+            }
+            else
+            {
+                result.Msg = "操作成功!";
+            }
+            return result;
+        }
+
+
         /// <summary>
         /// 财务模块
         /// 收款账单