计算总套数
This commit is contained in:
parent
4b5cf56dd6
commit
97dfbf1e35
File diff suppressed because it is too large
Load Diff
@ -81,6 +81,25 @@ async function mergeLicenseData() {
|
|||||||
|
|
||||||
console.log(`✅ 成功合并 ${mergedCount} 个许可证详情`);
|
console.log(`✅ 成功合并 ${mergedCount} 个许可证详情`);
|
||||||
|
|
||||||
|
// 计算总套数
|
||||||
|
console.log('开始计算套数...');
|
||||||
|
projectData.forEach(project => {
|
||||||
|
if (project['预售许可证'] && Array.isArray(project['预售许可证'])) {
|
||||||
|
let approvedUnits = 0;
|
||||||
|
let unsoldUnits = 0;
|
||||||
|
|
||||||
|
project['预售许可证'].forEach(license => {
|
||||||
|
approvedUnits += parseInt(license['总套数'], 10) || 0;
|
||||||
|
unsoldUnits += parseInt(license['可售套数'], 10) || 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
project['核准预售套数'] = approvedUnits;
|
||||||
|
project['未售总套数'] = unsoldUnits;
|
||||||
|
project['已售总套数'] = approvedUnits - unsoldUnits;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log('✅ 套数计算完成');
|
||||||
|
|
||||||
// 保存合并后的数据
|
// 保存合并后的数据
|
||||||
const outputPath = path.join(process.cwd(), 'data', 'merged_data.json');
|
const outputPath = path.join(process.cwd(), 'data', 'merged_data.json');
|
||||||
await fs.writeFile(outputPath, JSON.stringify(projectData, null, 4), 'utf-8');
|
await fs.writeFile(outputPath, JSON.stringify(projectData, null, 4), 'utf-8');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user