Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yuyiAdminServer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
node_server
yuyiAdminServer
Commits
04f51f3b
Commit
04f51f3b
authored
May 12, 2026
by
chenjinjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
7d48d9de
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
90 additions
and
4 deletions
+90
-4
admin.ts
src/biz/admin.ts
+20
-0
userRuFu.ts
src/biz/userRuFu.ts
+1
-1
zaiFu.ts
src/biz/zaiFu.ts
+68
-2
main.ts
src/main.ts
+1
-1
No files found.
src/biz/admin.ts
View file @
04f51f3b
...
...
@@ -332,6 +332,26 @@ export async function enterpriseManageList(enterpriseName:string, year:number, q
}
// 管理后台新增函数:为企业指定年度、季度插入一条全0记录
async
function
initDefaultRevenueRecord
(
eId
,
year
,
quarter
)
{
const
mId
=
randomId
(
TABLEID
.
企业经营信息
);
// 生成唯一ID
const
annualStr
=
`
${
year
}
-01-01 00:00:00`
;
const
addInfo
=
{
mId
,
eId
,
createTime
:
getMySqlMs
(),
annual
:
getMySqlMs
(
annualStr
),
quarter
,
// 季度值(1,2,3,4)
BI
:
0
,
TXP
:
0
,
RD
:
0
,
state
:
0
};
await
operationalData
(
OPERATIONALDATATYPE
.
增加
,
TABLENAME
.
企业经营信息
,
addInfo
,
{});
}
export
async
function
outPutEnterpriseManageList
(
enterpriseName
:
string
,
year
:
number
,
type
:
number
,
files
)
{
let
selectParam
:
any
=
{
isSubmit
:
enumConfig
.
STATE
.
是
};
let
manyTableInfo
:
any
=
{};
...
...
src/biz/userRuFu.ts
View file @
04f51f3b
...
...
@@ -590,7 +590,7 @@ export async function autoLogin(mobile: string, timestamp: string, usersign: str
// 8. 直接返回登录成功信息
return
{
isSuccess
:
true
,
message
:
"自动登录成功"
,
message
:
"自动登录成功"
,
dataInfo
:
userInfo
};
}
...
...
src/biz/zaiFu.ts
View file @
04f51f3b
...
...
@@ -25,7 +25,7 @@ import { BUILDING } from "../config/enum/enum";
* @param building 园区楼号
* @returns
*/
export
async
function
enterpriseList
(
enterpriseName
:
string
,
page
:
number
,
logonStartTime
:
Number
,
logonEndTime
:
Number
,
startTime
:
Number
,
endTime
:
Number
,
building
:
number
)
{
export
async
function
enterpriseList
(
enterpriseName
:
string
,
page
:
number
,
logonStartTime
:
Number
,
logonEndTime
:
Number
,
startTime
:
Number
,
endTime
:
Number
,
building
:
number
)
{
let
selectParam
:
any
=
{
state
:
enumConfig
.
CHANGESTATE
.
已通过
};
if
(
enterpriseName
)
{
selectParam
.
enterpriseName
=
{
"%like%"
:
enterpriseName
};
...
...
@@ -60,7 +60,17 @@ import { BUILDING } from "../config/enum/enum";
zaifuMap
[
info
.
eId
]
=
info
;
})
}
}
// ========== 新增:批量初始化营收记录 ==========
// 提取所有通过筛选的企业ID
const
allEids
=
resInfo
.
map
(
item
=>
item
.
eId
).
filter
(
eId
=>
zaifuMap
[
eId
]);
// 仅保留有租赁记录的企业(与原逻辑一致)
if
(
allEids
.
length
>
0
)
{
const
currentYear
=
moment
().
year
();
// 使用当前年度,也可根据业务需求调整
await
batchEnsureQuarterRevenueRecords
(
allEids
,
currentYear
);
}
// ==========================================
let
zaifuList
=
[];
for
(
let
info
of
resInfo
)
{
let
{
...
...
@@ -112,6 +122,62 @@ import { BUILDING } from "../config/enum/enum";
/**
* 批量确保多个企业在指定年度的所有季度都有营收记录(缺失则创建全0记录)
* @param {Array<string>} eIds 企业ID数组
* @param {number} year 年度(如 2026)
* @returns {Promise<void>}
*/
async
function
batchEnsureQuarterRevenueRecords
(
eIds
,
year
)
{
if
(
!
eIds
||
eIds
.
length
===
0
)
return
;
const
annualCondition
=
getMySqlMs
(
`
${
year
}
-01-01 00:00:00`
);
// 1. 一次性查询所有企业在当前年度的现有记录(仅季度字段)
let
existingAll
=
await
selectData
(
OPERATIONALDATATYPE
.
查询多个
,
TABLENAME
.
企业经营信息
,
{
annual
:
annualCondition
,
eId
:
{
"%in%"
:
eIds
}
},
[
"eId"
,
"quarter"
]
);
// 2. 构建 Map:企业ID -> 已存在的季度Set
const
existingMap
=
new
Map
();
existingAll
.
forEach
(
rec
=>
{
if
(
!
existingMap
.
has
(
rec
.
eId
))
existingMap
.
set
(
rec
.
eId
,
new
Set
());
existingMap
.
get
(
rec
.
eId
).
add
(
rec
.
quarter
);
});
// 3. 收集需要创建的记录
const
newRecords
=
[];
for
(
const
eId
of
eIds
)
{
const
existingQuarters
=
existingMap
.
get
(
eId
)
||
new
Set
();
for
(
let
q
=
1
;
q
<=
4
;
q
++
)
{
if
(
!
existingQuarters
.
has
(
q
))
{
newRecords
.
push
({
eId
,
mId
:
randomId
(
TABLEID
.
企业经营信息
),
annual
:
annualCondition
,
quarter
:
q
,
BI
:
0
,
TXP
:
0
,
RD
:
0
,
createTime
:
getMySqlMs
(),
state
:
1
,
isSubmit
:
0
,
isUpdate
:
0
});
}
}
}
// 4. 批量插入缺失的记录
if
(
newRecords
.
length
>
0
)
{
await
operationalData
(
OPERATIONALDATATYPE
.
增加
,
TABLENAME
.
企业经营信息
,
newRecords
,
{});
}
}
/**
* 新增在孵企业迁出功能
* @param eId 企业ID
* @param moveOutType 迁出类型 毕业迁出,毕业未迁出
...
...
src/main.ts
View file @
04f51f3b
...
...
@@ -11,7 +11,7 @@ import { getPwdMd5 } from "./tools/system";
async
function
lanuch
()
{
const
encryptedPwd
=
getPwdMd5
(
"ur_
50e39e678e8bc8d19fd4b5aa98196a27"
,
"123456
"
);
const
encryptedPwd
=
getPwdMd5
(
"ur_
1d9e40b7cdb9a8226b191446f57ff739"
,
"111111
"
);
console
.
log
();
await
initConfig
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment