NewGaoKaoApi/New_College.Common/Helper/MajorPlanScoreTool.cs

71 lines
2.2 KiB
C#

using Org.BouncyCastle.Asn1.Ocsp;
using System;
using System.Collections.Generic;
using System.Text;
namespace New_College.Common
{
public class MajorPlanScoreTool
{
/// <summary>
/// 冲稳保百分比(逻辑待调整)
/// </summary>
/// <param name="LowScore"></param>
/// <param name="requestScore"></param>
/// <returns></returns>
public static int GetPlanPercentage(int LowScore, int requestScore)
{
//int minscore = requestScore - 60;//最小
//int constscore = requestScore;//中位数
//int maxscore = requestScore + 15;//最大
int percentage = 0;
if (LowScore >= requestScore - 60 && LowScore <= requestScore - 26)
{
percentage = new Random().Next(81, 99);
}
if (LowScore <= requestScore - 1 && LowScore >= requestScore - 26)
{
percentage = new Random().Next(31, 80);
}
if (LowScore >= requestScore && LowScore <= requestScore + 15)
{
percentage = new Random().Next(1, 30);
}
return percentage;
}
/// <summary>
/// 冲稳保计算(逻辑待调整)
/// </summary>
/// <param name="score"></param>
/// <returns></returns>
public static int GetPlanScore(int LowScore, int requestScore)
{
//int minscore = requestScore - 60;//最小
// // int constscore = requestScore;//中位数
//int maxscore = requestScore + 15;//最大
int type = 0;
// int type = LowScore <= minscore ? 0 : minscore < LowScore && LowScore <= constscore ? 1 : LowScore > constscore && LowScore <= maxscore ? 2 : 0;
if (LowScore >= requestScore - 60 && LowScore <= requestScore - 26)
{
type = 0;
}
if (LowScore <= requestScore - 1 && LowScore >= requestScore - 26)
{
type = 1;
}
if (LowScore >= requestScore && LowScore <= requestScore + 30)
{
type = 2;
}
return type;
}
}
}