feat:bug fixed

develop
old易 2023-10-19 16:56:18 +08:00
parent 6b507cf917
commit cf45659d05
13 changed files with 341 additions and 8 deletions

View File

@ -0,0 +1,149 @@
using New_College.IServices;
using New_College.Model;
using New_College.Model.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Linq.Expressions;
using System.Threading.Tasks;
using System.Collections.Generic;
using Org.BouncyCastle.Asn1.Ocsp;
using System.Linq;
namespace New_College.Api.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class SeVolunteerInitializationController : ControllerBase
{
/// <summary>
/// 服务器接口,因为是模板生成,所以首字母是大写的,自己可以重构下
/// </summary>
private readonly ID_SeVolunteerInitializationServices _d_SeVolunteerInitializationServices;
public SeVolunteerInitializationController(ID_SeVolunteerInitializationServices D_SeVolunteerInitializationServices)
{
_d_SeVolunteerInitializationServices = D_SeVolunteerInitializationServices;
}
/// <summary>
/// 志愿填报省份数据
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<MessageModel<List<SeVolunterInitializationDto>>> Get()
{
var data = new MessageModel<List<SeVolunterInitializationDto>>();
var sevolunterlist = (await _d_SeVolunteerInitializationServices.Query()).Select(c => new SeVolunterInitializationDto()
{
AllScore = c.AllScore,
IsOpen = c.IsOpen,
ProvinceName = c.ProvinceName,
Policy = c.PolicyType,
Years = c.Years,
Code = c.Id
}).ToList();
int nowyear = DateTime.Now.Year;
int month = DateTime.Now.Month;
sevolunterlist.ForEach(a =>
{
var list = new List<LizationDto>();
if (month < 8)//大于8月份则高考时间已过为往届高考生
{
list.Add(new LizationDto()
{
name = (nowyear - 1).ToString(),
code = nowyear - 1,
Policy = nowyear - 1 < a.Years ? 0 : a.Policy
});
list.Add(new LizationDto()
{
name = nowyear.ToString() + "(现高三)",
code = nowyear,
Policy = nowyear < a.Years ? 0 : a.Policy
});
list.Add(new LizationDto()
{
name = (nowyear + 1).ToString() + "(现高二)",
code = nowyear + 1,
Policy = nowyear + 1 < a.Years ? 0 : a.Policy
});
list.Add(new LizationDto()
{
name = (nowyear + 2).ToString() + "(现高一)",
code = nowyear + 2,
Policy = nowyear + 2 < a.Years ? 0 : a.Policy
});
}
else
{
list.Add(new LizationDto()
{
name = (nowyear).ToString(),
code = nowyear,
Policy = nowyear < a.Years ? 0 : a.Policy
});
list.Add(new LizationDto()
{
name = (nowyear + 1).ToString() + "(现高三)",
code = nowyear + 1,
Policy = nowyear + 1 < a.Years ? 0 : a.Policy
});
list.Add(new LizationDto()
{
name = (nowyear + 2).ToString() + "(现高二)",
code = nowyear + 2,
Policy = nowyear + 2 < a.Years ? 0 : a.Policy
});
list.Add(new LizationDto()
{
name = (nowyear + 3).ToString() + "(现高一)",
code = nowyear + 3,
Policy = nowyear + 3 < a.Years ? 0 : a.Policy
});
}
a.lizations = list;
});
data.response = sevolunterlist;
data.msg = "ok";
return data;
}
[HttpPost]
public async Task<MessageModel<string>> Post([FromBody] D_SeVolunteerInitialization request)
{
var data = new MessageModel<string>();
var id = await _d_SeVolunteerInitializationServices.Add(request);
data.success = id > 0;
if (data.success)
{
data.response = id.ObjToString();
data.msg = "添加成功";
}
return data;
}
}
}

View File

@ -851,6 +851,26 @@
累计人数
</summary>
</member>
<member name="P:New_College.Model.Models.D_SeVolunteerInitialization.PolicyType">
<summary>
政策类型0文理 分科|1 3+3|2 3+1+2
</summary>
</member>
<member name="P:New_College.Model.Models.D_SeVolunteerInitialization.Years">
<summary>
执行年份
</summary>
</member>
<member name="P:New_College.Model.Models.D_SeVolunteerInitialization.IsOpen">
<summary>
是否开通1已开通0未开通
</summary>
</member>
<member name="P:New_College.Model.Models.D_SeVolunteerInitialization.AllScore">
<summary>
高考总分数
</summary>
</member>
<member name="T:New_College.Model.Models.D_TagMapPerson">
<summary>
标签代表人物
@ -3700,6 +3720,11 @@
高校所在省份
</summary>
</member>
<member name="P:New_College.Model.ViewModels.CWBUniversityDetailQuery.BatchName">
<summary>
</summary>
</member>
<member name="P:New_College.Model.ViewModels.CWBUniversityDetailQuery.Year">
<summary>
高考年份
@ -5945,5 +5970,15 @@
</summary>
</member>
<member name="P:New_College.Model.SeVolunterInitializationDto.Policy">
<summary>
</summary>
</member>
<member name="P:New_College.Model.LizationDto.Policy">
<summary>
0文理分科 1 3+3 2 3+1+3
</summary>
</member>
</members>
</doc>

View File

@ -815,6 +815,17 @@
<param name="headers"></param>
<returns></returns>
</member>
<member name="F:New_College.Api.Controllers.SeVolunteerInitializationController._d_SeVolunteerInitializationServices">
<summary>
服务器接口,因为是模板生成,所以首字母是大写的,自己可以重构下
</summary>
</member>
<member name="M:New_College.Api.Controllers.SeVolunteerInitializationController.Get">
<summary>
志愿填报省份数据
</summary>
<returns></returns>
</member>
<member name="M:New_College.Api.Controllers.SysRegionController.#ctor(New_College.IServices.ISysRegionServices,New_College.IRepository.UnitOfWork.IUnitOfWork,AutoMapper.IMapper)">
<summary>
省市区操作类

View File

@ -0,0 +1,12 @@
using New_College.IServices.BASE;
using New_College.Model.Models;
namespace New_College.IServices
{
/// <summary>
/// ID_SeVolunteerInitializationServices
/// </summary>
public interface ID_SeVolunteerInitializationServices :IBaseServices<D_SeVolunteerInitialization>
{
}
}

View File

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace New_College.Model.Models
{
public class D_SeVolunteerInitialization : EntityModel
{
public string ProvinceName { get; set; }
/// <summary>
/// 政策类型0文理 分科|1 3+3|2 3+1+2
/// </summary>
public int PolicyType { get; set; }
/// <summary>
/// 执行年份
/// </summary>
public int Years { get; set; }
/// <summary>
/// 是否开通1已开通0未开通
/// </summary>
public int IsOpen { get; set; }
/// <summary>
/// 高考总分数
/// </summary>
public int AllScore { get; set; }
}
}

View File

@ -12,6 +12,7 @@ namespace New_College.Model.ViewModels
public int Year { get; set; }
public string TypeName { get; set; }
public int Score { get; set; } = 999;
}

View File

@ -35,6 +35,10 @@ namespace New_College.Model.ViewModels
public int BatchId { get; set; }
/// <summary>
///
/// </summary>
public string BatchName { get; set; }
/// <summary>
/// 高考年份
/// </summary>

View File

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace New_College.Model
{
public class SeVolunterInitializationDto
{
public int Code { get; set; }
public string ProvinceName { get; set; }
/// <summary>
///
/// </summary>
public int Policy { get; set; }
public int IsOpen { get; set; }
public int AllScore { get; set; }
public int Years { get; set; }
public List<LizationDto> lizations { get; set; }
}
public class LizationDto
{
public string name { get; set; }
/// <summary>
/// 0文理分科 1 3+3 2 3+1+3
/// </summary>
public int Policy { get; set; }
public int code { get; set; }
}
}

View File

@ -0,0 +1,17 @@
using New_College.IRepository;
using New_College.IRepository.UnitOfWork;
using New_College.Model.Models;
using New_College.Repository.Base;
namespace New_College.Repository
{
/// <summary>
/// D_SeVolunteerInitializationRepository
/// </summary>
public class D_SeVolunteerInitializationRepository : BaseRepository<D_SeVolunteerInitialization>, ID_SeVolunteerInitializationRepository
{
public D_SeVolunteerInitializationRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
}
}
}

View File

@ -0,0 +1,12 @@
using New_College.IRepository.Base;
using New_College.Model.Models;
namespace New_College.IRepository
{
/// <summary>
/// ID_SeVolunteerInitializationRepository
/// </summary>
public interface ID_SeVolunteerInitializationRepository : IBaseRepository<D_SeVolunteerInitialization>
{
}
}

View File

@ -86,6 +86,7 @@ namespace New_College.Repository
.WhereIF(regionlist.Any(), p => SqlFunc.ContainsArray(regionlist, p.AreaName))
.WhereIF(query.Year > 0, p => p.Years == query.Year)
.WhereIF(!string.IsNullOrEmpty(query.Location), p => p.Location == query.Location)
.WhereIF(!string.IsNullOrEmpty(query.BatchName), p => p.BatchName == query.BatchName)
.WhereIF(string.IsNullOrWhiteSpace(query.Type), p => p.LowScore > 0 && (p.LowScore <= query.Score + 15))
.WhereIF(query.Type == "冲", p => p.LowScore > 0 && (p.LowScore <= query.Score + 15 && p.LowScore > query.Score + 5))
.WhereIF(query.Type == "稳", p => p.LowScore > 0 && (p.LowScore <= query.Score + 5 && p.LowScore > query.Score - 15))
@ -122,9 +123,9 @@ namespace New_College.Repository
{
query.Year = query.Year > 2023 ? 2023 : query.Year;
RefAsync<int> totalNumber = 0;
if(query.provinceIds == null)
if (query.provinceIds == null)
{
query.provinceIds=new List<int>() { 0};
query.provinceIds = new List<int>() { 0 };
}
var regionlist = this.Db.Queryable<SysRegion>().Where(c => c.Level == 1).WhereIF(query.provinceIds != null && query.provinceIds.Any(), c => SqlFunc.ContainsArray(query.provinceIds, c.KeyId)).Select(c => c.RegionName).ToList();
@ -159,6 +160,7 @@ namespace New_College.Repository
.WhereIF(regionlist.Any(), p => SqlFunc.ContainsArray(regionlist, p.AreaName))
.WhereIF(query.Year > 0, p => p.Years == query.Year)
.WhereIF(!string.IsNullOrEmpty(query.Location), p => p.Location == query.Location)
.WhereIF(!string.IsNullOrEmpty(query.BatchName), p => p.BatchName == query.BatchName)
.WhereIF(string.IsNullOrWhiteSpace(query.Type), p => p.LowScore > 0 && (p.LowScore <= query.Score + 15))
.WhereIF(query.Type == "冲", p => p.LowScore > 0 && (p.LowScore <= query.Score + 15 && p.LowScore > query.Score + 5))
.WhereIF(query.Type == "稳", p => p.LowScore > 0 && (p.LowScore <= query.Score + 5 && p.LowScore > query.Score - 15))

View File

@ -0,0 +1,18 @@

using New_College.IServices;
using New_College.Model.Models;
using New_College.Services.BASE;
using New_College.IRepository.Base;
namespace New_College.Services
{
public class D_SeVolunteerInitializationServices : BaseServices<D_SeVolunteerInitialization>, ID_SeVolunteerInitializationServices
{
private readonly IBaseRepository<D_SeVolunteerInitialization> _dal;
public D_SeVolunteerInitializationServices(IBaseRepository<D_SeVolunteerInitialization> dal)
{
this._dal = dal;
base.BaseDal = dal;
}
}
}

View File

@ -1530,7 +1530,8 @@ namespace New_College.Services
list.Add(new IdNameResult()
{
Id = item.Id,
Name = item.Batch_name + "(" + item.Type + ")",
Name = item.Batch_name,
TypeName = item.Type,
Year = item.Year,
Score = item.ScoreLine
});