@ -1,5 +1,6 @@
using AgileObjects.AgileMapper ;
using AgileObjects.AgileMapper ;
using DnsClient ;
using Microsoft.IdentityModel.Tokens ;
using Microsoft.IdentityModel.Tokens ;
using Newtonsoft.Json.Linq ;
using Newtonsoft.Json.Linq ;
using SqlSugar ;
using SqlSugar ;
@ -575,26 +576,11 @@ END";
#region Data
#region Data
sql = @ "DECLARE @ResumeTemplateID BIGINT = 1
var formColumns = await QueryResumeFormColumn ( 1 ) ;
SELECT pp . ColumnName field
#region Base
FROM Ghrh_ResumeTemplateInfoGroupColumn kk , Ghrh_ResumeInfoColumn pp
WHERE kk . ResumeTemplateInfoGroupID =
( SELECT b . Id
FROM Ghrh_ResumeInfoGroup a
JOIN Ghrh_ResumeTemplateInfoGroup b
ON b . ResumeInfoGroupId = a . ID
WHERE a . GroupType = ' Base '
AND a . IsEnable = 1
AND b . ResumeTemplateID = @ResumeTemplateID )
- - a . ResumeTemplateInfoGroupID
AND kk . ResumeInfoColumnID = pp . ID
AND kk . IsDisplay = 1
AND pp . IsEnable = 1
AND kk . IsEnable = 1
ORDER BY kk . SortNo ";
var columnNames = await Db . Ado . SqlQueryAsync < string > ( sql ) ;
var columnNames = formColumns . Where ( x = > x . GroupType = = "Base" ) . Select ( x = > x . ColumnName ) . ToList ( ) ;
columnNames = columnNames . Distinct ( ) . ToList ( ) ;
columnNames = columnNames . Distinct ( ) . ToList ( ) ;
var dicts = new Dictionary < string , object >
var dicts = new Dictionary < string , object >
{
{
@ -606,11 +592,115 @@ END";
dicts . Add ( x , value ) ;
dicts . Add ( x , value ) ;
} ) ;
} ) ;
Data . Base = dicts ;
Data . Base = dicts ;
Data . Family = await _ ghrh_ResumeHomeServices . QueryDto ( x = > x . ResumeId ! = null & & x . ResumeId = = id ) ; //家庭关系
# endregion
Data . Education = await _ ghrh_ResumeEduBGServices . QueryDto ( x = > x . ResumeId ! = null & & x . ResumeId = = id ) ; //教育背景
Data . WorkExp = await _ ghrh_ResumeWorkExpServices . QueryDto ( x = > x . ResumeId ! = null & & x . ResumeId = = id ) ; //工作经历
#region 家庭关系
Data . Licence = await _ ghrh_ResumeLicenceServices . QueryDto ( x = > x . ResumeId ! = null & & x . ResumeId = = id ) ; //简历培训记录
Data . Training = await _ ghrh_ResumeTrainingServices . QueryDto ( x = > x . ResumeId ! = null & & x . ResumeId = = id ) ; //证件
columnNames = formColumns . Where ( x = > x . GroupType = = "Family" ) . Select ( x = > x . ColumnName ) . ToList ( ) ;
columnNames = columnNames . Distinct ( ) . ToList ( ) ;
var familys = await _ ghrh_ResumeHomeServices . QueryDto ( x = > x . ResumeId ! = null & & x . ResumeId = = id ) ;
var family = new List < Dictionary < string , object > > ( ) ;
familys . ForEach ( x = >
{
var dicts = new Dictionary < string , object > ( ) ;
columnNames . ForEach ( x = >
{
var value = entity . GetPropertyValue ( x ) ;
dicts . Add ( x , value ) ;
} ) ;
if ( columnNames . Any ( x = > x = = "AttachmentIDs" ) )
dicts [ "AttachmentIDs" ] = x . AttachmentIDs ;
family . Add ( dicts ) ;
} ) ;
Data . Family = family ;
# endregion
#region 教育背景
columnNames = formColumns . Where ( x = > x . GroupType = = "Education" ) . Select ( x = > x . ColumnName ) . ToList ( ) ;
columnNames = columnNames . Distinct ( ) . ToList ( ) ;
var educations = await _ ghrh_ResumeEduBGServices . QueryDto ( x = > x . ResumeId ! = null & & x . ResumeId = = id ) ;
var education = new List < Dictionary < string , object > > ( ) ;
educations . ForEach ( x = >
{
var dicts = new Dictionary < string , object > ( ) ;
columnNames . ForEach ( x = >
{
var value = entity . GetPropertyValue ( x ) ;
dicts . Add ( x , value ) ;
} ) ;
if ( columnNames . Any ( x = > x = = "AttachmentIDs" ) )
dicts [ "AttachmentIDs" ] = x . AttachmentIDs ;
education . Add ( dicts ) ;
} ) ;
Data . Education = education ;
#endregion
#region 工作经历
columnNames = formColumns . Where ( x = > x . GroupType = = "WorkExp" ) . Select ( x = > x . ColumnName ) . ToList ( ) ;
columnNames = columnNames . Distinct ( ) . ToList ( ) ;
var workExps = await _ ghrh_ResumeWorkExpServices . QueryDto ( x = > x . ResumeId ! = null & & x . ResumeId = = id ) ;
var workExp = new List < Dictionary < string , object > > ( ) ;
workExps . ForEach ( x = >
{
var dicts = new Dictionary < string , object > ( ) ;
columnNames . ForEach ( x = >
{
var value = entity . GetPropertyValue ( x ) ;
dicts . Add ( x , value ) ;
} ) ;
if ( columnNames . Any ( x = > x = = "AttachmentIDs" ) )
dicts [ "AttachmentIDs" ] = x . AttachmentIDs ;
workExp . Add ( dicts ) ;
} ) ;
Data . WorkExp = workExp ;
# endregion
#region 证件
columnNames = formColumns . Where ( x = > x . GroupType = = "Licence" ) . Select ( x = > x . ColumnName ) . ToList ( ) ;
columnNames = columnNames . Distinct ( ) . ToList ( ) ;
var Licences = await _ ghrh_ResumeLicenceServices . QueryDto ( x = > x . ResumeId ! = null & & x . ResumeId = = id ) ;
var Licence = new List < Dictionary < string , object > > ( ) ;
Licences . ForEach ( x = >
{
var dicts = new Dictionary < string , object > ( ) ;
columnNames . ForEach ( x = >
{
var value = entity . GetPropertyValue ( x ) ;
dicts . Add ( x , value ) ;
} ) ;
if ( columnNames . Any ( x = > x = = "AttachmentIDs" ) )
dicts [ "AttachmentIDs" ] = x . AttachmentIDs ;
Licence . Add ( dicts ) ;
} ) ;
Data . Licence = Licence ;
# endregion
#region 简历培训记录
columnNames = formColumns . Where ( x = > x . GroupType = = "Training" ) . Select ( x = > x . ColumnName ) . ToList ( ) ;
columnNames = columnNames . Distinct ( ) . ToList ( ) ;
var Trainings = await _ ghrh_ResumeTrainingServices . QueryDto ( x = > x . ResumeId ! = null & & x . ResumeId = = id ) ;
var Training = new List < Dictionary < string , object > > ( ) ;
Trainings . ForEach ( x = >
{
var dicts = new Dictionary < string , object > ( ) ;
columnNames . ForEach ( x = >
{
var value = entity . GetPropertyValue ( x ) ;
dicts . Add ( x , value ) ;
} ) ;
if ( columnNames . Any ( x = > x = = "AttachmentIDs" ) )
dicts [ "AttachmentIDs" ] = x . AttachmentIDs ;
Training . Add ( dicts ) ;
} ) ;
Data . Training = Training ;
# endregion
Data . Attachment = await Db . Queryable < Ghre_Attachment > ( ) . Where ( x = > x . TableName = = id . ObjToString ( ) ) . ToListAsync ( ) ;
Data . Attachment = await Db . Queryable < Ghre_Attachment > ( ) . Where ( x = > x . TableName = = id . ObjToString ( ) ) . ToListAsync ( ) ;
var statements = await _ ghrh_ResumeStatementServices . QueryDto ( x = > x . ResumeId ! = null & & x . ResumeId = = id ) ; //证件
var statements = await _ ghrh_ResumeStatementServices . QueryDto ( x = > x . ResumeId ! = null & & x . ResumeId = = id ) ; //证件
@ -649,6 +739,29 @@ END";
return ServiceResult < dynamic > . OprateSuccess ( "查询成功" , obj ) ;
return ServiceResult < dynamic > . OprateSuccess ( "查询成功" , obj ) ;
}
}
public async Task < List < ResumeFormColumn1 > > QueryResumeFormColumn ( long resumeTemplateID )
{
var sql = @ $ "DECLARE @ResumeTemplateID BIGINT = {resumeTemplateID}
SELECT A . ColumnName , D . GroupType
FROM Ghrh_ResumeInfoColumn A
LEFT JOIN Ghrh_ResumeTemplateInfoGroupColumn B
ON B . ResumeInfoColumnID = A . ID
AND B . IsDisplay = 1
AND B . IsEnable = 1
AND A . IsEnable = 1
JOIN Ghrh_ResumeTemplateInfoGroup C
ON B . ResumeTemplateInfoGroupID = C . Id
JOIN Ghrh_ResumeInfoGroup D
ON C . ResumeInfoGroupId = D . ID AND D . IsEnable = 1
WHERE C . ResumeTemplateID = @ResumeTemplateID
- - AND D . GroupType = ' Base '
ORDER BY D . GroupType , b . SortNo ";
return await Db . Ado . SqlQueryAsync < ResumeFormColumn1 > ( sql ) ;
}
# endregion
# endregion
#region 简历提交接口
#region 简历提交接口
@ -708,8 +821,179 @@ END";
await _ ghrh_ResumeStatementServices . Add ( inserts ) ;
await _ ghrh_ResumeStatementServices . Add ( inserts ) ;
}
}
return ServiceResult . OprateSuccess ( ) ;
return ServiceResult . OprateSuccess ( ) ;
}
}
# endregion
# endregion
#region 简历提交接口
public async Task < ServiceResult < dynamic > > QueryResult ( long id , int langId )
{
dynamic Data = new ExpandoObject ( ) ;
var entity = await QueryById ( id ) ;
if ( entity is null ) throw new Exception ( "无效的ID!" ) ;
decimal completionDegree = 0 ;
var groups = await Db . Ado . SqlQueryAsync < ResumeFormColumn > ( "select GroupName tabName, GroupType type from Ghrh_ResumeInfoGroup where IsEnable=1 and GroupType !='Photo' and GroupType !='Attachment'" ) ;
int count = groups . Count ;
#region 基础数据
var notNUllCount = 0 ;
var formColumns = await QueryResumeFormColumn ( 1 ) ;
var columnNames = formColumns . Where ( x = > x . GroupType = = "Base" ) . Select ( x = > x . ColumnName ) . ToList ( ) ;
columnNames = columnNames . Distinct ( ) . ToList ( ) ;
columnNames . ForEach ( x = >
{
var value = entity . GetPropertyValue ( x ) ;
if ( value ! = null )
notNUllCount + + ;
} ) ;
var basePercent = ( decimal ) notNUllCount / columnNames . Count * 1 0 0 ;
completionDegree + = basePercent ;
# endregion
#region 家庭关系
decimal familyPercent = 0 ;
var familys = await _ ghrh_ResumeHomeServices . QueryDto ( x = > x . ResumeId ! = null & & x . ResumeId = = id ) ;
if ( familys . Any ( ) )
{
notNUllCount = 0 ;
columnNames = formColumns . Where ( x = > x . GroupType = = "Family" ) . Select ( x = > x . ColumnName ) . ToList ( ) ;
columnNames = columnNames . Distinct ( ) . ToList ( ) ;
columnNames . ForEach ( x = >
{
var value = entity . GetPropertyValue ( x ) ;
if ( value ! = null )
notNUllCount + + ;
} ) ;
familyPercent = ( decimal ) notNUllCount / ( columnNames . Count * familys . Count ) * 1 0 0 ;
completionDegree + = familyPercent ;
}
# endregion
#region 教育背景
decimal educationPercent = 0 ;
var educations = await _ ghrh_ResumeEduBGServices . QueryDto ( x = > x . ResumeId ! = null & & x . ResumeId = = id ) ;
if ( educations . Any ( ) )
{
notNUllCount = 0 ;
columnNames = formColumns . Where ( x = > x . GroupType = = "Education" ) . Select ( x = > x . ColumnName ) . ToList ( ) ;
columnNames = columnNames . Distinct ( ) . ToList ( ) ;
columnNames . ForEach ( x = >
{
var value = entity . GetPropertyValue ( x ) ;
if ( value ! = null )
notNUllCount + + ;
} ) ;
educationPercent = ( decimal ) notNUllCount / ( columnNames . Count * educations . Count ) * 1 0 0 ;
completionDegree + = educationPercent ;
}
# endregion
#region 工作经历
decimal workExpPercent = 0 ;
var workExps = await _ ghrh_ResumeWorkExpServices . QueryDto ( x = > x . ResumeId ! = null & & x . ResumeId = = id ) ;
if ( workExps . Any ( ) )
{
notNUllCount = 0 ;
columnNames = formColumns . Where ( x = > x . GroupType = = "WorkExp" ) . Select ( x = > x . ColumnName ) . ToList ( ) ;
columnNames = columnNames . Distinct ( ) . ToList ( ) ;
columnNames . ForEach ( x = >
{
var value = entity . GetPropertyValue ( x ) ;
if ( value ! = null )
notNUllCount + + ;
} ) ;
workExpPercent = ( decimal ) notNUllCount / ( columnNames . Count * workExps . Count ) * 1 0 0 ;
completionDegree + = workExpPercent ;
}
# endregion
#region 证件
decimal licencePercent = 0 ;
var licences = await _ ghrh_ResumeLicenceServices . QueryDto ( x = > x . ResumeId ! = null & & x . ResumeId = = id ) ;
if ( licences . Any ( ) )
{
notNUllCount = 0 ;
columnNames = formColumns . Where ( x = > x . GroupType = = "Licence" ) . Select ( x = > x . ColumnName ) . ToList ( ) ;
columnNames = columnNames . Distinct ( ) . ToList ( ) ;
columnNames . ForEach ( x = >
{
var value = entity . GetPropertyValue ( x ) ;
if ( value ! = null )
notNUllCount + + ;
} ) ;
licencePercent = ( decimal ) notNUllCount / ( columnNames . Count * licences . Count ) * 1 0 0 ;
completionDegree + = licencePercent ;
}
# endregion
#region 培训
decimal trainingPercent = 0 ;
var trainings = await _ ghrh_ResumeTrainingServices . QueryDto ( x = > x . ResumeId ! = null & & x . ResumeId = = id ) ;
if ( trainings . Any ( ) )
{
notNUllCount = 0 ;
columnNames = formColumns . Where ( x = > x . GroupType = = "Training" ) . Select ( x = > x . ColumnName ) . ToList ( ) ;
columnNames = columnNames . Distinct ( ) . ToList ( ) ;
columnNames . ForEach ( x = >
{
var value = entity . GetPropertyValue ( x ) ;
if ( value ! = null )
notNUllCount + + ;
} ) ;
trainingPercent = ( decimal ) notNUllCount / ( columnNames . Count * trainings . Count ) * 1 0 0 ;
completionDegree + = trainingPercent ;
}
# endregion
#region 声明
decimal statementPercent = 0 ;
var statements = await _ ghrh_ResumeStatementServices . QueryDto ( x = > x . ResumeId ! = null & & x . ResumeId = = id ) ; //证件
if ( statements . Any ( ) )
{
notNUllCount = statements . Count ;
statementPercent = ( decimal ) notNUllCount / columnNames . Count * 1 0 0 ;
completionDegree + = statementPercent ;
}
# endregion
completionDegree = completionDegree / count ;
Dictionary < string , int > dics = new ( )
{
{ "Base" , Convert . ToInt32 ( StringHelper . TrimDecimalString ( StringHelper . TrimDecimalString ( basePercent , 0 ) ) ) } ,
{ "Family" , Convert . ToInt32 ( StringHelper . TrimDecimalString ( StringHelper . TrimDecimalString ( familyPercent , 0 ) ) ) } ,
{ "Education" , Convert . ToInt32 ( StringHelper . TrimDecimalString ( StringHelper . TrimDecimalString ( educationPercent , 0 ) ) ) } ,
{ "WorkExp" , Convert . ToInt32 ( StringHelper . TrimDecimalString ( StringHelper . TrimDecimalString ( workExpPercent , 0 ) ) ) } ,
{ "Licence" , Convert . ToInt32 ( StringHelper . TrimDecimalString ( StringHelper . TrimDecimalString ( licencePercent , 0 ) ) ) } ,
{ "Training" , Convert . ToInt32 ( StringHelper . TrimDecimalString ( StringHelper . TrimDecimalString ( trainingPercent , 0 ) ) ) } ,
{ "Statement" , Convert . ToInt32 ( StringHelper . TrimDecimalString ( StringHelper . TrimDecimalString ( statementPercent , 0 ) ) ) }
} ;
var seriesData = new List < int > ( ) ;
var xAxisData = new List < string > ( ) ;
groups . ForEach ( x = >
{
if ( dics . ContainsKey ( x . type ) )
{
seriesData . Add ( dics [ x . type ] ) ;
xAxisData . Add ( x . tabName ) ;
}
} ) ;
Data . CompletionDegree = StringHelper . TrimDecimalString ( StringHelper . TrimDecimalString ( completionDegree , 2 ) ) ;
Data . SeriesData = seriesData ;
Data . XAxisData = xAxisData ;
Data . StaffName = entity . StaffName ;
Data . PhotoUrl = entity . PhotoUrl ;
return ServiceResult < dynamic > . OprateSuccess ( "查询成功" , Data ) ;
}
# endregion
}
}