From d4431c7e89865a506af8662244004d0baa7ed609 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期三, 11 六月 2025 12:24:15 +0800
Subject: [PATCH] 投诉处理,爬
---
zhengcaioa/Services/HrSalaryService.cs | 324 +++++++++++++++++++++++++++++++++++-------------------
1 files changed, 210 insertions(+), 114 deletions(-)
diff --git a/zhengcaioa/Services/HrSalaryService.cs b/zhengcaioa/Services/HrSalaryService.cs
index 766985b..5c82b2a 100644
--- a/zhengcaioa/Services/HrSalaryService.cs
+++ b/zhengcaioa/Services/HrSalaryService.cs
@@ -93,6 +93,11 @@
return resultEntity;
}
+ /// <summary>
+ /// 淇濆瓨宸ヨ祫鏍稿噯
+ /// </summary>
+ /// <param name="dto"></param>
+ /// <returns></returns>
public ResultEntity SaveCheckSalary(HrSalaryUpDTO dto)
{
ResultEntity resultEntity = new ResultEntity();
@@ -101,89 +106,110 @@
var updatepltRole = _context.HrSalaries.Where(c=>c.Id==dto.Id).SingleOrDefault();
if(updatepltRole!=null)
{
- //鏇存柊鐢佃瘽璐圭敤鐘舵��
- var sim = _context.SimCost.Where(c => c.bill_year == updatepltRole.Year && c.bill_month <= updatepltRole.Month && c.user_id == updatepltRole.Userid && c.status == "0").ToList();
- foreach(var item in sim)
+ //濡傛灉鏈夋湭瀹屾垚鐨勫伐浣滀氦鎺ワ紝涓嶈兘鏍稿噯宸ヨ祫
+ var admAskJiaojies = _context.AdmAskJiaojies.Where(x => x.Creater == updatepltRole.Userid && x.RecStatus == "A" && x.ShenpiStatus == "D").ToList();
+ if(admAskJiaojies!=null && admAskJiaojies.Count > 0)
{
- item.status = "1";
+ resultEntity.Result = false;
+ resultEntity.Message = "鏈夋湭瀹屾垚鐨勫伐浣滀氦鎺ワ紝涓嶈兘鏍稿噯宸ヨ祫";
+ return resultEntity;
}
+ //鏇存柊鐢佃瘽璐圭敤鐘舵��
+ var sim = _context.SimCost.Where(c => c.bill_year == updatepltRole.Year && c.bill_month <= updatepltRole.Month && c.user_id == updatepltRole.Userid && c.status == "0").ToList();
+ if(sim!=null)
+ {
+ foreach (var item in sim)
+ {
+ item.status = "1";
+ }
+ }
+
var user = _context.PltUsers.Where(c => c.Id == updatepltRole.Userid).SingleOrDefault();
+ var buchangqian = (updatepltRole.Jiangjin??0) + (updatepltRole.Bufagongzi ?? 0) + (updatepltRole.Jiucuo ?? 0) + (updatepltRole.Peichang ?? 0);
+ var buchanghou = (dto.Jiangjin ?? 0) + (dto.Bufagongzi ?? 0) + (dto.Jiucuo ?? 0) + (dto.Peichang ?? 0);
+
+
+ updatepltRole.Daozhanggongzi += (buchanghou - buchangqian);
+ if (user.advancewages.HasValue && user.advancewages.Value > 0)
+ {
+
+ updatepltRole.Yufagongziheji += (buchanghou - buchangqian);
+
+ }
+
updatepltRole.Jiangjin = dto.Jiangjin;
updatepltRole.Bufagongzi = dto.Bufagongzi;
-
- var sum_f = ((updatepltRole.Jibengongzi ?? 0) + (updatepltRole.Baomifei ?? 0) + (updatepltRole.Gongzuobutie ?? 0) +
- (updatepltRole.Jiabangongzi ?? 0) + (updatepltRole.Shebao ?? 0) + (updatepltRole.Dianhuabutie ?? 0) +
- (updatepltRole.Quanqinjiang ?? 0) + (updatepltRole.Jiaotngbutie ?? 0) + (updatepltRole.Jixiaoticheng ?? 0) +
- dto.Jiangjin + dto.Bufagongzi);
-
updatepltRole.Peichang = dto.Peichang;
updatepltRole.Jiucuo = dto.Jiucuo;
+ updatepltRole.Yufagongziheji = dto.Yufagongziheji;
+ //updatepltRole.Daozhanggongzi = (updatepltRole.Daozhanggongzi ?? 0) + (updatepltRole.Jiangjin ?? 0) + (updatepltRole.Bufagongzi ?? 0) + (updatepltRole.Peichang ?? 0) + (updatepltRole.Jiucuo ?? 0);
+ // //updatepltRole.Yufagongziheji = (updatepltRole.Yufagongziheji ?? 0) + (updatepltRole.Jiangjin ?? 0) + (updatepltRole.Bufagongzi ?? 0) + (updatepltRole.Peichang ?? 0) + (updatepltRole.Jiucuo ?? 0);
- var sum_k= (updatepltRole.Shebaokou ?? 0) + (updatepltRole.Geshui ?? 0) + (updatepltRole.Dianhuafei ?? 0) +
- (updatepltRole.Queqin ?? 0) + (updatepltRole.Fakuan ?? 0) + dto.Peichang + dto.Jiucuo;
+ //var sum_f = (updatepltRole.Jibengongzi ?? 0) + (updatepltRole.Baomifei ?? 0) + (updatepltRole.Gongzuobutie ?? 0) +
+ // (updatepltRole.Jiabangongzi ?? 0) + (updatepltRole.Shebao ?? 0) +
+ // (updatepltRole.Quanqinjiang ?? 0) + (updatepltRole.Jiaotngbutie ?? 0) + (updatepltRole.Jixiaoticheng ?? 0);
- //璁$畻棰勫彂宸ヨ祫
-
- //var lyear = updatepltRole.Year;
- //var lmonth = updatepltRole.Month-1;
- //if(lmonth==0)
+ //decimal dianhuafei = 0;
+ //if ((updatepltRole.Dianhuabutie ?? 0) - (updatepltRole.Dianhuafei ?? 0) <= 0)
//{
- // lyear = lyear - 1;
- // lmonth = 12;
+ // dianhuafei = (updatepltRole.Dianhuafei ?? 0)-(updatepltRole.Dianhuabutie ?? 0);
//}
- //var sumyfhj = _context.HrSalaries.Where(c => c.Year == lyear && c.Month == lmonth && c.Userid == updatepltRole.Userid).SingleOrDefault();
- if(DateTime.Today> user.ShiyongDateEnd)
- {
- if(string.IsNullOrEmpty(user.BasicPrice))
- {
- updatepltRole.Daozhanggongzi = sum_f - sum_k;
- updatepltRole.Yufagongzi = 0;
- }
- else
- {
- var pc = decimal.Parse(user.BasicPrice);
- if (sum_f - sum_k > pc)
- {
- updatepltRole.Daozhanggongzi = sum_f - sum_k;
- updatepltRole.Yufagongzi = 0;
- updatepltRole.Yufagongziheji = updatepltRole.Yufagongziheji - (sum_f - sum_k - pc);
- }
- else
- {
- updatepltRole.Daozhanggongzi = pc;
- updatepltRole.Yufagongzi = pc-(sum_f - sum_k);
- updatepltRole.Yufagongziheji = updatepltRole.Yufagongziheji + updatepltRole.Yufagongzi;
- }
- }
- }
- else
- {
- if (user.ShiyongPrice.HasValue)
- {
- var pc = user.ShiyongPrice.Value;
- if (sum_f - sum_k > pc)
- {
- updatepltRole.Daozhanggongzi = sum_f - sum_k;
- updatepltRole.Yufagongzi = 0;
- updatepltRole.Yufagongziheji = updatepltRole.Yufagongziheji - (sum_f - sum_k - pc);
- }
- else
- {
- updatepltRole.Daozhanggongzi = pc;
- updatepltRole.Yufagongzi = pc - (sum_f - sum_k);
- updatepltRole.Yufagongziheji = updatepltRole.Yufagongziheji + updatepltRole.Yufagongzi;
- }
- }
- else
- {
- updatepltRole.Daozhanggongzi = sum_f - sum_k;
- updatepltRole.Yufagongzi = 0;
- }
- }
+
+
+ //var sum_k = (updatepltRole.Shebaokou ?? 0) + (updatepltRole.Geshui ?? 0) + dianhuafei +
+ // (updatepltRole.Queqin ?? 0) + (updatepltRole.Fakuan ?? 0);
+
+ //updatepltRole.Daozhanggongzi = sum_f - sum_k;
+
+
+
+
+
+
+ ////璁$畻棰勫彂宸ヨ祫
+
+ //{
+ // //涓婁竴娆$殑宸ヨ祫
+ // var bf= _context.HrSalaries.Where(c => c.Userid == user.Id && c.Islock== "Q" && c.RecStatus=="A").
+ // OrderByDescending(c=>c.Year).ThenByDescending(c=>c.Month).FirstOrDefault();
+
+ // var pc = user.advancewages.Value;
+ // if (sum_f - sum_k > pc)
+ // {
+ // updatepltRole.Daozhanggongzi = sum_f - sum_k;
+ // updatepltRole.Yufagongzi = 0;
+ // if(bf!=null)
+ // {
+ // updatepltRole.Yufagongziheji = bf.Yufagongziheji??0 - (updatepltRole.Daozhanggongzi-pc);
+ // }
+ // else
+ // {
+ // updatepltRole.Yufagongziheji = (pc - updatepltRole.Daozhanggongzi);
+ // }
+ // }
+ // else
+ // {
+ // //棰勫彂
+ // updatepltRole.Daozhanggongzi = pc;
+ // updatepltRole.Yufagongzi = pc - (sum_f - sum_k);
+ // if (bf != null)
+ // {
+ // updatepltRole.Yufagongziheji =bf.Yufagongziheji??0+ updatepltRole.Yufagongzi;
+ // }
+ // else
+ // {
+ // updatepltRole.Yufagongziheji = updatepltRole.Yufagongzi;
+ // }
+ // }
+ //}
+ //else
+ //{
+ // updatepltRole.Daozhanggongzi = sum_f - sum_k;
+ //}
updatepltRole.Islock = "H";
updatepltRole.Modifier = dto.Modifier;
@@ -380,7 +406,7 @@
- if (searchEntity.totalrows == 0)
+ //if (searchEntity.totalrows == 0)
searchEntity.totalrows = query.Count();
var rolelist = query.Skip((searchEntity.page - 1) * searchEntity.rows).Take(searchEntity.rows).ToList();
@@ -388,41 +414,48 @@
return data;
}
+ /// <summary>
+ /// 宸ヨ祫鏍稿噯鏌ヨ
+ /// </summary>
+ /// <param name="searchEntity"></param>
+ /// <returns></returns>
public ResultDataEntity<HrSalaryDTO> SearchSalaryByPaging(HrSalaryDTOSearch searchEntity)
{
ResultDataEntity<HrSalaryDTO> data = new ResultDataEntity<HrSalaryDTO>();
- //var listCode = (from a in _context.SysCodeDtls
- // join b in _context.SysCodes
- // on a.CodeId equals b.Id
- // where a.RecStatus == "A"
- // && b.RecStatus == "A"
- // select new CodeDataEntity()
- // {
- // CodeId = b.Id,
- // CodeTable = b.CodeTable,
- // CodeField = b.CodeField,
- // CodeSn = a.CodeSn,
- // Comments = a.Comments,
- // Contents = a.Contents,
- // RecStatus = a.RecStatus,
- // Sort = a.Sort
- // }
- // );
+ var listCode = (from e in _context.SysCodes
+ join c in _context.SysCodeDtls
+ on e.Id equals c.CodeId
+ where e.RecStatus == "A"
+ && c.RecStatus == "A"
+ && e.CodeTable == "t_sim_bind"
+ && e.CodeField == "cardpro"
+ select c).OrderBy(x => x.Sort).ToList();
- //int year = 0;
- //int month = 0;
- //if (string.IsNullOrWhiteSpace(searchEntity.YearMonth))
- //{
- // DateTime yearMonth = DateTime.Now;//.Parse(searchEntity.YearMonth + "-01");
- // year = yearMonth.Year;
- // month = yearMonth.Month;
- //}
- var query = (from a in _context.HrSalaries//.Where(x => x.RecStatus == "A")
- // join b in listCode.Where(x => x.CodeTable == "hr_jibengongzi" && x.CodeField == "dianhuabutie")
- //on a.Dianhuabutie equals b.CodeSn
- // into bsssss
- // from bbb in bsssss.DefaultIfEmpty()
+ int year = 0;
+ int month = 0;
+ if (string.IsNullOrWhiteSpace(searchEntity.YearMonth))
+ {
+ DateTime yearMonth = DateTime.Now;//.Parse(searchEntity.YearMonth + "-01");
+ year = yearMonth.Year;
+ month = yearMonth.Month;
+ }
+ else
+ {
+ var len = searchEntity.YearMonth.Split('-');
+ if(len.Length==2)
+ {
+ year =int.Parse(len[0]);
+ month = int.Parse(len[1]);
+ }
+
+ }
+
+ var query = (from a in (_context.HrSalaries.Where(x => x.RecStatus == "A"))
+ //join b in listCode
+ //on a.Dianhuabutie equals b.CodeSn
+ //into bsssss
+ //from bbb in bsssss.DefaultIfEmpty()
join f in _context.PltUsers
on a.Userid equals f.Id
@@ -438,7 +471,7 @@
&& (string.IsNullOrWhiteSpace(searchEntity.Usernumber) || f.Usernumber == searchEntity.Usernumber.Trim())
&& (string.IsNullOrWhiteSpace(searchEntity.DeptId) || f.DeptId == searchEntity.DeptId.Trim())
&& (string.IsNullOrWhiteSpace(searchEntity.UserName) || f.UserName.Contains(searchEntity.UserName.Trim()))
- //&& (string.IsNullOrWhiteSpace(searchEntity.YearMonth) || ( a.Year == year && a.Month == month ))
+ && (string.IsNullOrWhiteSpace(searchEntity.YearMonth) || ( a.Year == year && a.Month == month ))
select new HrSalaryDTO
{
Id = a.Id,
@@ -457,7 +490,6 @@
Shebao = a.Shebao,
Dianhuabutie = a.Dianhuabutie,
-
Quanqinjiang = a.Quanqinjiang,
Jiaotngbutie = a.Jiaotngbutie,
Jixiaoticheng = a.Jixiaoticheng,
@@ -504,7 +536,7 @@
Modifier = a.Modifier,
Modifytime = a.Modifytime,
- }).OrderByDescending(x => x.Modifytime).ToList();
+ }).OrderBy(x => x.UserName).ToList();
@@ -512,12 +544,39 @@
- if (searchEntity.totalrows == 0)
+ //if (searchEntity.totalrows == 0)
searchEntity.totalrows = query.Count();
var rolelist = query.Skip((searchEntity.page - 1) * searchEntity.rows).Take(searchEntity.rows).ToList();
-
+ if(rolelist!=null && rolelist.Count>0)
+ {
+ foreach(var item in rolelist)
+ {
+ item.DianhuabutieChs = BackChs(listCode, item.Dianhuabutie);
+ }
+ }
data.LoadData(searchEntity, rolelist);
return data;
+ }
+
+ /// <summary>
+ /// 娉ㄩ噴
+ /// </summary>
+ /// <param name="listCode"></param>
+ /// <param name="code"></param>
+ /// <returns></returns>
+ private string BackChs(List<SysCodeDtl> listCode ,decimal? code )
+ {
+ string str = "鏃�";
+ if(code.HasValue)
+ {
+ var st = ((int)code.Value).ToString();
+ var temp = listCode.Find(c => c.CodeSn == st);
+ if(temp!=null)
+ {
+ str = temp.Comments;
+ }
+ }
+ return str;
}
public ResultEntity ModifyStatus(string id, string userid)
@@ -582,6 +641,15 @@
/// <returns></returns>
public List<HrSalaryDTO> GetSalary(string userid,int year,int month)
{
+ var listCode = (from e in _context.SysCodes
+ join c in _context.SysCodeDtls
+ on e.Id equals c.CodeId
+ where e.RecStatus == "A"
+ && c.RecStatus == "A"
+ && e.CodeTable == "t_sim_bind"
+ && e.CodeField == "cardpro"
+ select c).OrderBy(x => x.Sort).ToList();
+
var entity = (from a in _context.HrSalaries
join b in _context.PltUsers on a.Userid equals b.Id
join c in _context.HrDepts on b.DeptId equals c.Id
@@ -622,6 +690,13 @@
if (entity == null)
{
entity = new List<HrSalaryDTO>();
+ }
+ else
+ {
+ foreach (var item in entity)
+ {
+ item.DianhuabutieChs = BackChs(listCode, item.Dianhuabutie);
+ }
}
return entity;
}
@@ -684,6 +759,8 @@
else
{
model.id = Guid.NewGuid().ToString();
+ model.year = salary.Year;
+ model.month = salary.Month;
model.sub_time = DateTime.Now;
model.status = "A";
_context.HrSalaryAppeal.Add(model);
@@ -739,17 +816,27 @@
{
ResultDataEntity<HrSalaryDTO> data = new ResultDataEntity<HrSalaryDTO>();
+ var listCode = (from e in _context.SysCodes
+ join c in _context.SysCodeDtls
+ on e.Id equals c.CodeId
+ where e.RecStatus == "A"
+ && c.RecStatus == "A"
+ && e.CodeTable == "t_sim_bind"
+ && e.CodeField == "cardpro"
+ select c).OrderBy(x => x.Sort).ToList();
+
DateTime st = DateTime.Now.AddDays(1 - DateTime.Now.Day).Date;
DateTime et = DateTime.Now.AddDays(1 - DateTime.Now.Day).Date.AddMonths(1).AddSeconds(-1);
int month = 0;
- if (!string.IsNullOrEmpty(searchEntity.searchDate))
+ if (!string.IsNullOrEmpty(searchEntity.searchDatestart))
{
- var times = searchEntity.searchDate.Split('|');
- if (times.Length == 2)
- {
- st = DateTime.Parse(times[0]);
- et= DateTime.Parse(times[1]);
- }
+ st = DateTime.Parse(searchEntity.searchDatestart + "-01");
+
+ }
+ if (!string.IsNullOrEmpty(searchEntity.searchDateend))
+ {
+ et = DateTime.Parse(searchEntity.searchDateend + "-01");
+
}
var query = (from a in _context.HrSalaries where a.Year >= st.Year && a.Month >= st.Month && a.Year <= et.Year && a.Month <= et.Month select a);
@@ -760,7 +847,10 @@
&& (string.IsNullOrWhiteSpace(searchEntity.Usernumber) || f.Usernumber == searchEntity.Usernumber.Trim())
&& (string.IsNullOrWhiteSpace(searchEntity.DeptId) || f.DeptId == searchEntity.DeptId.Trim())
&& (string.IsNullOrWhiteSpace(searchEntity.UserName) || f.UserName.Contains(searchEntity.UserName.Trim()))
- select new HrSalaryDTO
+
+ && (string.IsNullOrWhiteSpace(searchEntity.UserId) || a.Userid.Contains(searchEntity.UserId.Trim()))
+
+ select new HrSalaryDTO
{
Id = a.Id,
@@ -830,10 +920,16 @@
}).OrderByDescending(x => x.Modifytime).ToList();
- if (searchEntity.totalrows == 0)
+ //if (searchEntity.totalrows == 0)
searchEntity.totalrows = list.Count();
var rolelist = list.Skip((searchEntity.page - 1) * searchEntity.rows).Take(searchEntity.rows).ToList();
-
+ if (rolelist != null && rolelist.Count > 0)
+ {
+ foreach (var item in rolelist)
+ {
+ item.DianhuabutieChs = BackChs(listCode, item.Dianhuabutie);
+ }
+ }
data.LoadData(searchEntity, rolelist);
return data;
}
--
Gitblit v1.9.1