From 4686d9d5bc63a5aeb35452ee9049a4720123b992 Mon Sep 17 00:00:00 2001
From: 移动系统liao <liaoxujun@qq.com>
Date: 星期一, 30 九月 2024 15:37:14 +0800
Subject: [PATCH] no message
---
cylsg/cylsg.Application/Users/UserAppService.cs | 31 +++++++++++++++++++++++++++----
1 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/cylsg/cylsg.Application/Users/UserAppService.cs b/cylsg/cylsg.Application/Users/UserAppService.cs
index a3f0c08..6e4b107 100644
--- a/cylsg/cylsg.Application/Users/UserAppService.cs
+++ b/cylsg/cylsg.Application/Users/UserAppService.cs
@@ -117,9 +117,10 @@
var userWorkerRes = new BaseRepository<UserWorker>();
bool res;
- if (userWorkerDto.Id > 0)
+ var userWorker1 = await userWorkerRes.GetFirstAsync(x => x.UserId == userid && x.IsEn == true && x.IsDeleted == false);
+ if (userWorker1!=null)
{
- var userWorker1 = await userWorkerRes.GetByIdAsync(userWorkerDto.Id);
+ //.GetByIdAsync(userWorkerDto.Id);
userWorker1.IdCardBack = userWorkerDto.IdCardBack;
userWorker1.IdCardFace = userWorkerDto.IdCardFace;
userWorker1.name = userWorkerDto.name;
@@ -206,9 +207,21 @@
var userCompanyRes = new BaseRepository<UserCompany>();
bool res;
- if (userCompanyDto.Id > 0)
+ var userCompany1 = await userCompanyRes.GetFirstAsync(x=>x.UserId == userid && x.IsEn == true && x.IsDeleted == false);
+ if (userCompany1 != null)
{
- var userCompany1 = await userCompanyRes.GetByIdAsync(userCompanyDto.Id);
+ if(userCompany1.Suppliercode != userCompanyDto.Suppliercode)
+ {
+ var count = await userCompanyRes.CountAsync(x => x.Suppliercode == userCompanyDto.Suppliercode && x.Id != userCompany1.Id && x.IsEn == true && x.IsDeleted == false);
+ if (count > 0)
+ {
+ userCompany1.IsAdmin = false;
+ }
+ else
+ {
+ userCompany1.IsAdmin = true;
+ }
+ }
userCompany1.BusinessLicense = userCompanyDto.BusinessLicense;
userCompany1.Suppliername = userCompanyDto.Suppliername;
userCompany1.Regtime = userCompanyDto.Regtime;
@@ -227,6 +240,16 @@
}
else
{
+ var count = await userCompanyRes.CountAsync(x => x.Suppliercode == userCompanyDto.Suppliercode && x.IsEn == true && x.IsDeleted == false);
+ if (count > 0)
+ {
+ userCompanyDto.IsAdmin = false;
+ }
+ else
+ {
+ userCompanyDto.IsAdmin = true;
+ }
+
var userCompany = _mapper.Map<UserCompany>(userCompanyDto);
userCompany.UpDataBy = NickName;
userCompany.UpDataTime = DateTime.Now;
--
Gitblit v1.9.1