数据bug处理

develop
old易 2024-04-09 13:55:25 +08:00
parent a8ef74732b
commit ed646d5cad
8 changed files with 146 additions and 41 deletions

View File

@ -67,10 +67,10 @@ namespace New_College.Controllers
// return t_EnrollmentPlane.categoryupdate();
// return d_LongIdMapServices.UpdateUniveristyInf();
// return d_LongIdMapServices.Import();
//return d_LongIdMapServices.UpdateUniveristyInf();
// await d_LongIdMapServices.UpdatePlanScoreLine();
await v_CustomerInfoServices.CustomeBillExport();
// await v_CustomerInfoServices.CustomeBillExport();
return true;
}

View File

@ -19,5 +19,6 @@ sleep 3
docker run \
-p 8082:8082 \
--restart unless-stopped \
--name pcnewcollage-api \
-d pcnewcollage-api

View File

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace New_College.Common
{
public static class UniqueIdGenerator
{
public static int GenerateUniqueIntId()
{
// 生成一个唯一的Guid
Guid guid = Guid.NewGuid();
// 将Guid转换为字节数组
byte[] bytes = guid.ToByteArray();
// 确保最后的四字节是正数
int timeHi = BitConverter.ToInt32(bytes, 4);
if (timeHi < 0)
{
timeHi += int.MaxValue;
}
// 将字节数组的前八个字节转换为整数
long id = BitConverter.ToInt64(bytes, 0);
// 确保整数是正数
if (id < 0)
{
id += long.MaxValue;
}
return Math.Abs((int)id);
}
}
}

View File

@ -13,6 +13,11 @@ namespace New_College.IServices
/// </summary>
public interface ID_LongIdMapServices : IBaseServices<D_LongIdMap>
{
/// <summary>
/// 更显专业分数线
/// </summary>
/// <returns></returns>
Task<bool> UpdatePlanScoreLine();
Task<bool> UpdatePlanProInf();
Task<bool> Import();

View File

@ -62,7 +62,7 @@ namespace New_College.Model.Models
/// 专业
/// </summary>
[SugarColumn(IsNullable = true, Length = 500)]
[SugarColumn(IsNullable = true, Length = 600)]
public string Major { get; set; }
/// <summary>

View File

@ -2,16 +2,24 @@
using New_College.IRepository.UnitOfWork;
using New_College.Model.Models;
using New_College.Repository.Base;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace New_College.Repository
{
/// <summary>
/// D_PlanMajorScoreLineRepository
/// </summary>
/// <summary>
/// D_PlanMajorScoreLineRepository
/// </summary>
public class D_PlanMajorScoreLineRepository : BaseRepository<D_PlanMajorScoreLine>, ID_PlanMajorScoreLineRepository
{
public D_PlanMajorScoreLineRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
}
public async Task<bool> BatchAdd(List<D_PlanMajorScoreLine> majorScoreLines)
{
var kk = await this.Db.Fastest<D_PlanMajorScoreLine>().PageSize(50000).BulkCopyAsync(majorScoreLines);
return kk > 0;
}
}
}

View File

@ -1,5 +1,7 @@
using New_College.IRepository.Base;
using New_College.Model.Models;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace New_College.IRepository
{
@ -8,5 +10,6 @@ namespace New_College.IRepository
/// </summary>
public interface ID_PlanMajorScoreLineRepository : IBaseRepository<D_PlanMajorScoreLine>
{
Task<bool> BatchAdd(List<D_PlanMajorScoreLine> majorScoreLines);
}
}

View File

@ -1847,44 +1847,44 @@ namespace New_College.Services
//});
#region *******************院校信息更新******************
for (var i = 1; i <= 147; i++)
{
var body = new HttpHelperPostRequest() { pageIndex = i };
var info = HttpHelper.PostApi<HttpHelperPostobject>("http://192.168.104.104:3000/youzy.dms.basiclib.api.college.query", body);
//for (var i = 1; i <= 147; i++)
//{
// var body = new HttpHelperPostRequest() { pageIndex = i };
// var info = HttpHelper.PostApi<HttpHelperPostobject>("http://192.168.104.104:3000/youzy.dms.basiclib.api.college.query", body);
info.result.items.ToList().ForEach(async a =>
{
// info.result.items.ToList().ForEach(async a =>
// {
//http://192.168.104.104:3000/youzy.dms.basiclib.api.college.bycode.get?code=10017 //详情
// var bodydetail = new httphelperdetailrequest() { code = a.code };
var undetail = HttpHelper.GetApi<UniversityDetailobject>("http://192.168.104.104:3000/", "youzy.dms.basiclib.api.college.bycode.get?code=" + a.code + "", "");
Thread.Sleep(1000);
var universitymodel = await d_UniversityRepository.Query(c => c.Name == a.cnName);
if (universitymodel.Any() && undetail != null && undetail.result != null)
{
var updatemodel = universitymodel.FirstOrDefault();
var category = undetail.result.categories.ToList();
//if (category.Contains("医药"))
//{
// updatemodel.Type = UniversityTypeRelsove.GetTypeName("医药");
// //http://192.168.104.104:3000/youzy.dms.basiclib.api.college.bycode.get?code=10017 //详情
// // var bodydetail = new httphelperdetailrequest() { code = a.code };
// var undetail = HttpHelper.GetApi<UniversityDetailobject>("http://192.168.104.104:3000/", "youzy.dms.basiclib.api.college.bycode.get?code=" + a.code + "", "");
// Thread.Sleep(1000);
// var universitymodel = await d_UniversityRepository.Query(c => c.Name == a.cnName);
// if (universitymodel.Any() && undetail != null && undetail.result != null)
// {
// var updatemodel = universitymodel.FirstOrDefault();
// var category = undetail.result.categories.ToList();
// //if (category.Contains("医药"))
// //{
// // updatemodel.Type = UniversityTypeRelsove.GetTypeName("医药");
//updatemodel.Web = undetail.result.webSite;
//updatemodel.Address = undetail.result.address[0].address;
//updatemodel.Phone = string.Join(",",undetail.result.zhaoBanDH);
// updatemodel.AscriptionName = undetail.result.belong;
//updatemodel.UniversityCode = a.code;
//updatemodel.Rank = a.ranking;
//updatemodel.Build_Date = undetail.result.createdYear;
//updatemodel.Description = undetail.result.introduction;
updatemodel.Master_Count = undetail.result.pointsOfShuo.Any() ? undetail.result.pointsOfShuo[0].number : 0;
updatemodel.Doctorate_Count = undetail.result.pointsOfBo.Any() ? undetail.result.pointsOfBo[0].number : 0;
//updatemodel.Type = UniversityTypeRelsove.GetTypeName((undetail.result.categories.Any() ? undetail.result.categories[0] : ""));
await d_UniversityRepository.Update(updatemodel);
// }
}
// //updatemodel.Web = undetail.result.webSite;
// //updatemodel.Address = undetail.result.address[0].address;
// //updatemodel.Phone = string.Join(",",undetail.result.zhaoBanDH);
// // updatemodel.AscriptionName = undetail.result.belong;
// //updatemodel.UniversityCode = a.code;
// //updatemodel.Rank = a.ranking;
// //updatemodel.Build_Date = undetail.result.createdYear;
// //updatemodel.Description = undetail.result.introduction;
// updatemodel.Master_Count = undetail.result.pointsOfShuo.Any() ? undetail.result.pointsOfShuo[0].number : 0;
// updatemodel.Doctorate_Count = undetail.result.pointsOfBo.Any() ? undetail.result.pointsOfBo[0].number : 0;
// //updatemodel.Type = UniversityTypeRelsove.GetTypeName((undetail.result.categories.Any() ? undetail.result.categories[0] : ""));
// await d_UniversityRepository.Update(updatemodel);
// // }
// }
});
}
// });
//}
@ -1918,6 +1918,55 @@ namespace New_College.Services
}
/// <summary>
/// 更新专业分数线
/// </summary>
/// <returns></returns>
public async Task<bool> UpdatePlanScoreLine()
{
var tbinfo = await t_TbSNeedDataInfoRepository.Query(e => e.Location == "山东省");
var plist = await this.d_PlanMajorDescProRepository.Query(c => c.Location == "山东省" && c.Years == 2023 && c.IsDelete == false);
var list = new List<D_PlanMajorScoreLine>();
int i = 232818;
tbinfo.ForEach(a =>
{
if (plist.Where(e => e.UniversityName == a.UniversityName && e.MajorCode == a.MajorCode).Any())
{
i++;
var pdefault = plist.Where(e => e.UniversityName == a.UniversityName && e.MajorCode == a.MajorCode).FirstOrDefault();
list.Add(new D_PlanMajorScoreLine()
{
Id = i,
AvgScore = a._23SchoolAvgScore,
BatchName = pdefault.BatchName,
CreateTime = DateTime.Now,
FirstType = a.FirstType,
IsDelete = true,
Location = a.Location,
LowScore = Convert.ToInt32(a._23Score),
LowScoreRank = Convert.ToInt32(a._23ScoreLine),
Major = a.MajorName,
MajorCode = a.MajorCode,
ModifyTime = DateTime.Now,
//HighScore = "0",
//MajorGroup = "",
PlanCount = pdefault.PlanCount,
RootType = pdefault.RootType,
SelectSubject = pdefault.SelectSubject,
SubjectType = "综合",
UId = pdefault.UId,
UniversityName = a.UniversityName,
Years = pdefault.Years,
Remark = pdefault.Remark
});
}
});
//var count = list;
await d_PlanMajorScoreLineRepository.BatchAdd(list);
return true;
}
/// <summary>
/// 更新学校基础信息