From ddd7b8e07e5d7f76e5ee28eaab91e75a419b3750 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期四, 22 七月 2021 14:57:13 +0800
Subject: [PATCH] 今日开发 我的报表中的 新增注册会员 改为非手工几件登记,自动从系统读取 工作报表中的 新增注册会员 改为非手工几件登记,自动从系统读取 工资计算中的 新增注册会员 改为非手工几件登记,自动从系统读取
---
zhengcaioa/zhengcaioa/Timer/TimedBackgroundService.cs | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 101 insertions(+), 2 deletions(-)
diff --git a/zhengcaioa/zhengcaioa/Timer/TimedBackgroundService.cs b/zhengcaioa/zhengcaioa/Timer/TimedBackgroundService.cs
index 7470711..92bc0d5 100644
--- a/zhengcaioa/zhengcaioa/Timer/TimedBackgroundService.cs
+++ b/zhengcaioa/zhengcaioa/Timer/TimedBackgroundService.cs
@@ -1,12 +1,17 @@
锘縰sing DTO;
using IServices;
+using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Net.Http;
+using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
using System.Transactions;
@@ -41,6 +46,8 @@
private readonly ICusFangwenjiluService _cusFangwenjiluService;
private readonly ILiaotianService _liaotianService;
private readonly IDtChannelArticleNewsService _dtChannelArticleNewsService;
+ private readonly IConfiguration _configuration;
+ private readonly IHttpClientFactory _clientFactory;
private readonly decimal jiabangongzibiaozhun = new decimal(21.5);
public TimedBackgroundService(ILogger<TimedBackgroundService> logger, IServiceScopeFactory factory)
@@ -70,6 +77,8 @@
_cusFangwenjiluService = factory.CreateScope().ServiceProvider.GetRequiredService<ICusFangwenjiluService>();
_liaotianService = factory.CreateScope().ServiceProvider.GetRequiredService<ILiaotianService>();
_dtChannelArticleNewsService = factory.CreateScope().ServiceProvider.GetRequiredService<IDtChannelArticleNewsService>();
+ _configuration = factory.CreateScope().ServiceProvider.GetRequiredService<IConfiguration>();
+ _clientFactory = factory.CreateScope().ServiceProvider.GetRequiredService<IHttpClientFactory>();
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
@@ -101,7 +110,7 @@
//using (TransactionScope scope = new TransactionScope())
//{
this.jisuankaoqin();
- this.jisuangongzi();
+ await this.jisuangongziAsync();
//scope.Complete();
//}
@@ -1094,7 +1103,7 @@
//璁$畻宸ヨ祫
- public void jisuangongzi()
+ public async Task jisuangongziAsync()
{
//鏌ヨ鎵�鏈夌殑鏈夋晥浜哄憳
DateTime dateminkaoqin = new DateTime(DateTime.Now.Year, DateTime.Now.Month - 1, 1);
@@ -1893,6 +1902,96 @@
}
#endregion
+
+ #region 鏂板娉ㄥ唽浼氬憳
+
+ //鏈湀鏁伴噺
+ List<YaoQingYongHuDTO> zhucehuiyuansyue = new List<YaoQingYongHuDTO>();
+ try
+ {
+ //var pltUserDTO = _userService.GetPltUserEntity(userList[i].Id);
+ string huiyuanurl = _configuration.GetSection("huiyuanurl").Value;
+ string GetYGYaoQingYonghu = _configuration.GetSection("GetYGYaoQingYonghu").Value;
+ Uri postUrl2 = new Uri(huiyuanurl + GetYGYaoQingYonghu);
+
+ JObject questions2 = new JObject();
+ questions2.Add("UserID", userList[i].Id);
+ questions2.Add("StartTime", dateminkaoqin.ToString("yyyy-MM-dd HH:mm:ss"));
+ questions2.Add("EndTime", datemaxkaoqin.ToString("yyyy-MM-dd HH:mm:ss"));
+
+ string requestJson2 = questions2.ToString();
+ string result2 = string.Empty;
+
+ using (HttpContent httpContent = new StringContent(requestJson2))
+ {
+ httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
+
+ var httpClient2 = _clientFactory.CreateClient();
+ httpClient2.Timeout = new TimeSpan(0, 0, 10);
+ var Result2 = await httpClient2.PostAsync(postUrl2, httpContent);
+ result2 = Result2.Content.ReadAsStringAsync().Result;
+ }
+
+ _logger.LogInformation("result2:" + result2);
+ JObject jobjectresult = (JObject)JsonConvert.DeserializeObject(result2);
+
+ if (jobjectresult["code"] != null && jobjectresult["code"].ToString() == "1")
+ {
+
+ zhucehuiyuansyue = JsonConvert.DeserializeObject<List<YaoQingYongHuDTO>>(jobjectresult["data"].ToString());
+
+ }
+
+ }
+ catch (Exception ex)
+ {
+
+ }
+
+
+ //var qianyueDTOsyue = _cooperatecustomCustomerService.GetListsalary(userList[i].Id, dateminkaoqin, datemaxkaoqin);
+ if (zhucehuiyuansyue != null && zhucehuiyuansyue.Count > 0)
+ {
+ var jijianidddd = fiPiecerateDTOs.Where(x => x.Project == "鏂板娉ㄥ唽浼氬憳").FirstOrDefault();
+ if (jijianidddd != null)
+ {
+ var jixiaotichengfangan = hrJixiaotichengThis.Where(x => x.PiecerateId == jijianidddd.Id).OrderByDescending(x => x.Effecttime).FirstOrDefault();
+ if (jixiaotichengfangan != null && jixiaotichengfangan.Ticheng.HasValue && jixiaotichengfangan.Renwu.HasValue)
+ {
+ if (jixiaotichengfangan.Renwustandard == "01")
+ {
+ decimal renwujishu = admAttendanceDTO.Yingchuqin * jixiaotichengfangan.Renwu.Value;
+ if (jixiaotichengfangan.Tichengstandard == "01")
+ {
+ decimal youxiaojijian = zhucehuiyuansyue.Count - renwujishu;
+ if (youxiaojijian > 0)
+ {
+ hrSalaryDTO.Jixiaoticheng += Math.Round(jixiaotichengfangan.Ticheng.Value * youxiaojijian, 2);
+ }
+
+ }
+
+ }
+ else if (jixiaotichengfangan.Renwustandard == "02")
+ {
+ decimal renwujishu = jixiaotichengfangan.Renwu.Value;
+ if (jixiaotichengfangan.Tichengstandard == "01")
+ {
+ decimal youxiaojijian = zhucehuiyuansyue.Count - renwujishu;
+ if (youxiaojijian > 0)
+ {
+ hrSalaryDTO.Jixiaoticheng += Math.Round(jixiaotichengfangan.Ticheng.Value * youxiaojijian, 2);
+ }
+
+ }
+ }
+ }
+
+ }
+ }
+ #endregion
+
+
#region 鏂板绛剧害瀹㈡埛
var qianyueDTOsyue = _cooperatecustomCustomerService.GetListsalary(userList[i].Id, dateminkaoqin, datemaxkaoqin);
--
Gitblit v1.9.1