Commit eeb50188 by chenjinjing

no message

parent a8ff5ccb
......@@ -387,6 +387,7 @@ export async function getRiskData() {
value: 0
},
];
let bgdzctTable = {headerList:["", "", ""]}
// 1. 获取所有迁出记录(state 为迁出)
let zaifuList = await selectManyTableData(OPERATIONALDATATYPE.多表联查,TABLENAME.企业基础信息表,{},["eId", "enterpriseName"],
......@@ -422,19 +423,24 @@ export async function getRiskData() {
riskData[0].value = abnormalCount;
// 2. 办公地址冲突(楼号 + 室号 + 时间段冲突)
let leaseList = await selectData(OPERATIONALDATATYPE.查询多个,TABLENAME.租赁信息,{},["eId", "building", "roomNumber", "startTime", "endTime"]);
// 构建一个 map,key 是 building_roomNumber,值是租赁时间段列表
let addressMap = new Map<string, Array<{ eId: number; start: Date; end: Date }>>();
let 企业基础信息includeConf = {};
企业基础信息includeConf[TABLENAME.企业基础信息表] = { cloum: ["enterpriseName"], where: {} }
let leaseList = await selectManyTableData(OPERATIONALDATATYPE.多表联查, TABLENAME.租赁信息, {}, ["eId", "building", "roomNumber", "startTime", "endTime"], 企业基础信息includeConf);
// let leaseList = await selectData(OPERATIONALDATATYPE.查询多个,TABLENAME.租赁信息,{},["eId", "building", "roomNumber", "startTime", "endTime"]);
// 构建一个 map,key 是 building_roomNumber:楼号_室号,值是租赁时间段列表
let addressMap = new Map<string, Array<{ eId: number; enterpriseName:string; start: Date; end: Date }>>();
for (const lease of leaseList) {
const key = `${lease.building}_${lease.roomNumber}`;
const timeRange = {
eId: lease.eId,
enterpriseName: lease.enterprise.enterpriseName,
start: new Date(lease.startTime),
end: new Date(lease.endTime)
};
if (!addressMap.has(key)) {
addressMap.set(key, []);
}
......@@ -442,6 +448,7 @@ export async function getRiskData() {
}
let conflictCount = 0;
let conflictList = [];
// 遍历每个地址组合,检查时间段是否有重叠
for (const [key, ranges] of addressMap.entries()) {
......@@ -453,6 +460,7 @@ export async function getRiskData() {
// 判断时间段是否重叠
if (a.start < b.end && b.start < a.end) {
conflictCount++;
conflictList.push([a.enterpriseName, b.enterpriseName, "同时间段内,地址相同"])
break; // 当前地址组合已冲突,跳出循环
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment