|
|
|
@ -3,10 +3,15 @@ using Furion.DependencyInjection;
|
|
|
|
|
using Furion.DynamicApiController;
|
|
|
|
|
using Mapster;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using GDZZ.Application.Entity;
|
|
|
|
|
using GDZZ.Core.Entity;
|
|
|
|
|
using GDZZ.Core.OAuth;
|
|
|
|
|
using GDZZ.Application.Help;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace GDZZ.Application
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
@ -16,15 +21,21 @@ namespace GDZZ.Application
|
|
|
|
|
public class CompanyService : ICompanyService, IDynamicApiController, ITransient
|
|
|
|
|
{
|
|
|
|
|
private readonly SqlSugarRepository<Company> _rep;
|
|
|
|
|
private readonly SqlSugarRepository<CompanyUserScope> companyUserRep;
|
|
|
|
|
private readonly ICacheService cacheService;
|
|
|
|
|
|
|
|
|
|
public CompanyService(SqlSugarRepository<Company> rep)
|
|
|
|
|
public CompanyService(SqlSugarRepository<Company> rep,
|
|
|
|
|
ICacheService cacheService,
|
|
|
|
|
SqlSugarRepository<CompanyUserScope> companyUserRep)
|
|
|
|
|
{
|
|
|
|
|
_rep = rep;
|
|
|
|
|
this.cacheService= cacheService;
|
|
|
|
|
this.companyUserRep= companyUserRep;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 分页查询套餐管理
|
|
|
|
|
/// 分页查询公司
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
@ -33,17 +44,17 @@ namespace GDZZ.Application
|
|
|
|
|
{
|
|
|
|
|
var entities = await _rep.AsQueryable()
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SearchValue), u => u.Name.Contains(input.SearchValue.Trim()))
|
|
|
|
|
.Select((u) => new MiniResumeOutput()
|
|
|
|
|
{
|
|
|
|
|
CompanyID = u.Id,
|
|
|
|
|
CompanyName = u.Name,
|
|
|
|
|
Logo = u.logo,
|
|
|
|
|
Id = u.Id,
|
|
|
|
|
Info = u.Info,
|
|
|
|
|
Title = u.Name,
|
|
|
|
|
Time = u.CreatedTime.Value.ToString("yyyy/MM/dd"),
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SearchValue), u => u.Code.Contains(input.SearchValue.Trim()))
|
|
|
|
|
//.Select((u) => new CompanyInput()
|
|
|
|
|
//{
|
|
|
|
|
// CompanyID = u.Id,
|
|
|
|
|
// CompanyName = u.Name,
|
|
|
|
|
// Logo = u.logo,
|
|
|
|
|
// Id = u.Id,
|
|
|
|
|
// Info = u.Info,
|
|
|
|
|
// Title = u.Name,
|
|
|
|
|
// Time = u.CreatedTime.Value.ToString("yyyy/MM/dd"),
|
|
|
|
|
//})
|
|
|
|
|
.ToPagedListAsync(input.PageNo, input.PageSize);
|
|
|
|
|
return entities.XnPagedResult();
|
|
|
|
|
}
|
|
|
|
@ -67,15 +78,50 @@ namespace GDZZ.Application
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("/Mini/CompanyDetail")]
|
|
|
|
|
public async Task<Company> Get([FromQuery] QueryeCompanyInput input)
|
|
|
|
|
[HttpGet("/Mini/Company/Detail")]
|
|
|
|
|
public async Task<Company> Get()
|
|
|
|
|
{
|
|
|
|
|
//获取公司相关的招聘信息
|
|
|
|
|
|
|
|
|
|
return await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
|
|
|
|
|
return await _rep.FirstOrDefaultAsync(u => u.Id == UserManager.UserId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 创建公司
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/Mini/Company/install")]
|
|
|
|
|
public async Task InstallAsync(AddCompanyInput input)
|
|
|
|
|
{
|
|
|
|
|
var entity = input.Adapt<Company>();
|
|
|
|
|
await _rep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 绑定公司
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input">公司信息</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("/Mini/Comapany/Bing")]
|
|
|
|
|
public async Task BingCompany([FromQuery] AddCompanyInput input)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//验证电话和验证码一致
|
|
|
|
|
var verIfy = await this.cacheService.GetVerifyCode(input.Phone);
|
|
|
|
|
if (verIfy != input.Checking)
|
|
|
|
|
throw new Exception("验证码错误");
|
|
|
|
|
|
|
|
|
|
var companyUser = new CompanyUserScope
|
|
|
|
|
{
|
|
|
|
|
MiniCompanyID = input.Id,
|
|
|
|
|
MiniUserID = UserManager.UserId,
|
|
|
|
|
};
|
|
|
|
|
await this.companyUserRep.InsertAsync(companyUser);
|
|
|
|
|
|
|
|
|
|
//关系表插入信息
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|