Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zjxcxServer
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
zjxcxServer
Commits
e6084817
Commit
e6084817
authored
Feb 07, 2023
by
孙香冬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
b6cbafba
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
96 additions
and
24 deletions
+96
-24
month.ts
src/biz/fuHuqQi/month.ts
+34
-0
user.ts
src/biz/fuHuqQi/user.ts
+11
-16
errorEnum.ts
src/config/errorEnum.ts
+2
-0
fuhuaqi.ts
src/data/fuHuaQi/fuhuaqi.ts
+10
-3
monthTable.ts
src/data/fuHuaQi/monthTable.ts
+10
-1
main.ts
src/main.ts
+1
-1
fuhuaqi.ts
src/routers/fuhuaqi.ts
+16
-3
tools.ts
src/util/tools.ts
+12
-0
No files found.
src/biz/fuHuqQi/month.ts
View file @
e6084817
/**
/**
* 月度表单逻辑层
* 月度表单逻辑层
* 作者: 陈金晶
* 作者: 陈金晶
* 月度表单相关逻辑 包括孵化器月度填报的增删改查
*/
*/
import
{
ERRORENUM
}
from
"../../config/errorEnum"
;
import
{
ERRORENUM
}
from
"../../config/errorEnum"
;
import
{
BizError
}
from
"../../util/bizError"
;
import
{
BizError
}
from
"../../util/bizError"
;
...
@@ -27,3 +28,35 @@ export async function createReport(uscc:string, occupancyRate:number) {
...
@@ -27,3 +28,35 @@ export async function createReport(uscc:string, occupancyRate:number) {
return
{
isSuccess
:
true
};
return
{
isSuccess
:
true
};
}
}
/**
* 修改孵化器月度报表
* @param uscc 孵化器的统一信用代码
* @param occupancyRate 本月出租率
* @returns {isSuccess:true/false}
*/
export
async
function
updateReport
(
uscc
:
string
,
occupancyRate
:
number
)
{
const
TaskId
=
getTaskId
(
uscc
);
let
dataBaseInfo
=
await
monthData
.
findmonthTableListByTaskId
(
TaskId
);
if
(
dataBaseInfo
||
dataBaseInfo
.
taskId
)
throw
new
BizError
(
ERRORENUM
.
未找到数据
);
dataBaseInfo
.
occupancyRate
=
occupancyRate
;
await
dataBaseInfo
.
save
();
return
{
isSuccess
:
true
};
}
/**
* 删除孵化器月度报表
* @param uscc 孵化器的统一信用代码
* @returns {isSuccess:true/false}
*/
export
async
function
deleteReport
(
uscc
:
string
)
{
const
TaskId
=
getTaskId
(
uscc
);
let
dataBaseInfo
=
await
monthData
.
findmonthTableListByTaskId
(
TaskId
);
if
(
dataBaseInfo
||
dataBaseInfo
.
taskId
)
throw
new
BizError
(
ERRORENUM
.
未找到数据
);
await
monthData
.
deleteReport
(
uscc
);
return
{
isSuccess
:
true
};
}
\ No newline at end of file
src/biz/fuHuqQi/user.ts
View file @
e6084817
...
@@ -7,8 +7,7 @@
...
@@ -7,8 +7,7 @@
import
{
ERRORENUM
}
from
"../../config/errorEnum"
;
import
{
ERRORENUM
}
from
"../../config/errorEnum"
;
import
*
as
fuhuaqiData
from
"../../data/fuHuaQi/fuhuaqi"
import
*
as
fuhuaqiData
from
"../../data/fuHuaQi/fuhuaqi"
import
{
BizError
}
from
"../../util/bizError"
;
import
{
BizError
}
from
"../../util/bizError"
;
import
{
getPwdMd5
}
from
"../../util/tools"
;
const
md5
=
require
(
"md5"
);
/**
/**
* 登录
* 登录
...
@@ -18,17 +17,17 @@ const md5 = require("md5");
...
@@ -18,17 +17,17 @@ const md5 = require("md5");
*/
*/
export
async
function
login
(
uscc
:
string
,
pwd
:
string
):
Promise
<
object
>
{
export
async
function
login
(
uscc
:
string
,
pwd
:
string
):
Promise
<
object
>
{
if
(
typeof
uscc
!=
"string"
||
typeof
pwd
!=
"string"
)
throw
new
BizError
(
ERRORENUM
.
参数错误
,
uscc
,
pwd
);
if
(
typeof
uscc
!=
"string"
||
typeof
pwd
!=
"string"
)
throw
new
BizError
(
ERRORENUM
.
参数错误
,
uscc
,
pwd
);
let
fuhuaqiInfo
=
await
fuhuaqiData
.
findFuHuaQiByU
SCC
(
uscc
);
let
fuhuaqiInfo
=
await
fuhuaqiData
.
findFuHuaQiByU
scc
(
uscc
);
if
(
!
fuhuaqiInfo
)
throw
new
BizError
(
ERRORENUM
.
未找到数据
);
if
(
!
fuhuaqiInfo
)
throw
new
BizError
(
ERRORENUM
.
未找到数据
);
let
checkPwd
=
getPwdMd5
(
fuhuaqiInfo
.
uscc
,
pwd
);
let
checkPwd
=
getPwdMd5
(
fuhuaqiInfo
.
uscc
,
pwd
);
if
(
fuhuaqiInfo
.
pwd
!=
checkPwd
)
throw
new
BizError
(
"密码不正确"
);
if
(
fuhuaqiInfo
.
pwd
!=
checkPwd
)
throw
new
BizError
(
ERRORENUM
.
密码错误
);
let
fuhuaqiUserInfo
=
{
let
fuhuaqiUserInfo
=
{
uscc
:
fuhuaqiInfo
.
uscc
,
uscc
:
fuhuaqiInfo
.
uscc
,
name
:
fuhuaqiInfo
.
name
name
:
fuhuaqiInfo
.
name
};
};
return
fuhuaqiUserInfo
;
return
{
fuhuaqiUserInfo
}
;
}
}
/**
/**
...
@@ -36,37 +35,32 @@ export async function login(uscc:string, pwd:string):Promise<object> {
...
@@ -36,37 +35,32 @@ export async function login(uscc:string, pwd:string):Promise<object> {
* @param uscc 信用代码
* @param uscc 信用代码
* @param pwd 原密码
* @param pwd 原密码
* @param newPwd 修改后的密码
* @param newPwd 修改后的密码
* @returns
* @returns
{isSuccess:true/false}
*/
*/
export
async
function
changePassword
(
uscc
:
string
,
pwd
:
string
,
newPwd
:
string
)
{
export
async
function
changePassword
(
uscc
:
string
,
pwd
:
string
,
newPwd
:
string
)
{
if
(
typeof
uscc
!=
"string"
||
typeof
pwd
!=
"string"
||
typeof
newPwd
!=
"string"
)
throw
new
BizError
(
ERRORENUM
.
参数错误
,
uscc
,
pwd
,
newPwd
);
if
(
typeof
uscc
!=
"string"
||
typeof
pwd
!=
"string"
||
typeof
newPwd
!=
"string"
)
throw
new
BizError
(
ERRORENUM
.
参数错误
,
uscc
,
pwd
,
newPwd
);
let
reg
=
new
RegExp
(
"[`~!@#$^&*()=|{}':;',
\\
[
\\
].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]"
);
let
reg
=
new
RegExp
(
"[`~!@#$^&*()=|{}':;',
\\
[
\\
].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]"
);
if
(
reg
.
test
(
newPwd
))
{
if
(
reg
.
test
(
newPwd
))
{
throw
new
BizError
(
"密码不允许有特殊字符"
);
throw
new
BizError
(
ERRORENUM
.
密码不允许有特殊字符
);
}
}
let
fuhuaqiInfo
=
await
fuhuaqiData
.
findFuHuaQiByUSCC
(
uscc
);
let
fuhuaqiInfo
=
await
fuhuaqiData
.
findFuHuaQiByUSCC
(
uscc
);
if
(
!
fuhuaqiInfo
)
throw
new
BizError
(
ERRORENUM
.
未找到数据
);
if
(
!
fuhuaqiInfo
)
throw
new
BizError
(
ERRORENUM
.
未找到数据
);
let
checkPwd
=
getPwdMd5
(
fuhuaqiInfo
.
uscc
,
pwd
);
let
checkPwd
=
getPwdMd5
(
fuhuaqiInfo
.
uscc
,
pwd
);
if
(
fuhuaqiInfo
.
pwd
!=
checkPwd
)
throw
new
BizError
(
"密码错误"
);
if
(
fuhuaqiInfo
.
pwd
!=
checkPwd
)
throw
new
BizError
(
ERRORENUM
.
密码错误
);
fuhuaqiInfo
.
pwd
=
getPwdMd5
(
uscc
,
newPwd
);
fuhuaqiInfo
.
pwd
=
getPwdMd5
(
uscc
,
newPwd
);
await
fuhuaqiInfo
.
save
();
await
fuhuaqiInfo
.
save
();
return
{
msg
:
"修改成功"
,
isOk
:
true
};
return
{
isSuccess
:
true
};
}
}
/**
/**
* 退出登录
* 退出登录
* @param uscc 信用代码
* @param uscc 信用代码
* @returns
* @returns
{isSuccess:true/false}
*/
*/
export
async
function
logout
(
uscc
:
string
):
Promise
<
object
>
{
export
async
function
logout
(
uscc
:
string
):
Promise
<
object
>
{
if
(
typeof
uscc
!=
"string"
)
throw
new
BizError
(
ERRORENUM
.
参数错误
,
uscc
);
if
(
typeof
uscc
!=
"string"
)
throw
new
BizError
(
ERRORENUM
.
参数错误
,
uscc
);
let
fuhuaqiInfo
=
await
fuhuaqiData
.
findFuHuaQiByUSCC
(
uscc
);
let
fuhuaqiInfo
=
await
fuhuaqiData
.
findFuHuaQiByUSCC
(
uscc
);
await
fuhuaqiInfo
.
save
();
await
fuhuaqiInfo
.
save
();
return
{
msg
:
"退出成功"
,
isOk
:
true
};
return
{
isSuccess
:
true
};
}
function
getPwdMd5
(
uscc
:
string
,
pwd
:
string
)
{
return
md5
(
uscc
+
pwd
);
}
}
\ No newline at end of file
src/config/errorEnum.ts
View file @
e6084817
...
@@ -7,6 +7,8 @@ export enum ERRORENUM {
...
@@ -7,6 +7,8 @@ export enum ERRORENUM {
该企业已存在
,
该企业已存在
,
数据无更新
,
数据无更新
,
该孵化器月度填报已存在
,
该孵化器月度填报已存在
,
密码错误
,
密码不允许有特殊字符
}
}
let
bizErrorMsgMap
=
{};
let
bizErrorMsgMap
=
{};
...
...
src/data/fuHuaQi/fuhuaqi.ts
View file @
e6084817
...
@@ -27,7 +27,7 @@ const fuHuaQiSchema = new Schema({
...
@@ -27,7 +27,7 @@ const fuHuaQiSchema = new Schema({
personInChargePhone
:
String
,
//负责人联系电话
personInChargePhone
:
String
,
//负责人联系电话
personInChargeAdd
:
String
,
//孵化场地地址
personInChargeAdd
:
String
,
//孵化场地地址
siteAcreage
:
Number
,
//孵化场地面积(㎡)
siteAcreage
:
Number
,
//孵化场地面积(㎡)
leasePrice
:
Number
//孵化场地出租单价
(㎡)
leasePrice
:
Number
//孵化场地出租单价
});
});
var
fuHuaQiModel
;
var
fuHuaQiModel
;
...
@@ -70,4 +70,11 @@ export async function findFuHuaQiByName(name:string) {
...
@@ -70,4 +70,11 @@ export async function findFuHuaQiByName(name:string) {
return
await
fuHuaQiModel
.
findOne
({
name
}).
exec
();
return
await
fuHuaQiModel
.
findOne
({
name
}).
exec
();
}
}
/**
\ No newline at end of file
* 通过信用代码获取孵化器信息
* @param uscc 信用代码
* @returns 信用代码为uscc的孵化器信息
*/
export
async
function
findFuHuaQiByUscc
(
uscc
:
string
)
{
return
await
fuHuaQiModel
.
findOne
({
uscc
}).
exec
();
}
\ No newline at end of file
src/data/fuHuaQi/monthTable.ts
View file @
e6084817
...
@@ -62,7 +62,7 @@ export async function findmonthTableByTaskId(taskId:string) {
...
@@ -62,7 +62,7 @@ export async function findmonthTableByTaskId(taskId:string) {
/**
/**
* 孵化器月度填报 新增报表
* 孵化器月度填报 新增报表
* @param name 任务名称 系统生成
* @param name 任务名称 系统生成
* @param
fuHuaQiU
scc 孵化器统一信用代码
* @param
u
scc 孵化器统一信用代码
* @param occupancyRate 出租率
* @param occupancyRate 出租率
* @param createTime 创建时间
* @param createTime 创建时间
*
*
...
@@ -71,3 +71,11 @@ export async function addOnceReport(name:string, uscc:string, occupancyRate:numb
...
@@ -71,3 +71,11 @@ export async function addOnceReport(name:string, uscc:string, occupancyRate:numb
let
monthInfo
=
{
name
,
fuHuaQiUscc
:
uscc
,
occupancyRate
,
createTime
:
new
Date
().
valueOf
()}
let
monthInfo
=
{
name
,
fuHuaQiUscc
:
uscc
,
occupancyRate
,
createTime
:
new
Date
().
valueOf
()}
await
monthTableModel
.
create
(
monthInfo
);
await
monthTableModel
.
create
(
monthInfo
);
}
}
/**
* 孵化器月度填报 删除报表
* @param uscc 孵化器统一信用代码
*/
export
async
function
deleteReport
(
uscc
:
string
)
{
return
await
monthTableModel
.
remove
({
fuHuaQiUscc
:
uscc
}).
exec
();
}
\ No newline at end of file
src/main.ts
View file @
e6084817
...
@@ -8,7 +8,7 @@ async function lanuch() {
...
@@ -8,7 +8,7 @@ async function lanuch() {
await
initDB
();
await
initDB
();
httpServer
.
createServer
(
systemConfig
.
port
);
httpServer
.
createServer
(
systemConfig
.
port
);
console
.
log
(
'This indicates that the server is started successfully.'
);
console
.
log
(
'This indicates that the server is started successfully.'
);
await
t
();
//
await t();
}
}
async
function
t
()
{
async
function
t
()
{
...
...
src/routers/fuhuaqi.ts
View file @
e6084817
...
@@ -10,6 +10,7 @@ export function setRouter(httpServer) {
...
@@ -10,6 +10,7 @@ export function setRouter(httpServer) {
httpServer
.
post
(
'/fuhuaqi/mydata'
,
asyncHandler
(
myDataInfo
));
httpServer
.
post
(
'/fuhuaqi/mydata'
,
asyncHandler
(
myDataInfo
));
httpServer
.
post
(
'/fuhuaqi/mydata/update'
,
asyncHandler
(
updateMyDataInfo
));
httpServer
.
post
(
'/fuhuaqi/mydata/update'
,
asyncHandler
(
updateMyDataInfo
));
httpServer
.
post
(
'/fuhuaqi/month/addreport'
,
asyncHandler
(
addReport
));
httpServer
.
post
(
'/fuhuaqi/month/addreport'
,
asyncHandler
(
addReport
));
httpServer
.
post
(
'/fuhuaqi/month/deletereport'
,
asyncHandler
(
deleteReport
));
}
}
/**
/**
...
@@ -77,12 +78,23 @@ async function updateMyDataInfo(req, res) {
...
@@ -77,12 +78,23 @@ async function updateMyDataInfo(req, res) {
}
}
/**
/**
* 孵化月度填报 新增报表
* 孵化
器
月度填报 新增报表
* @param req
* @param req
* @param res
* @param res
*/
*/
async
function
addReport
(
req
,
res
)
{
async
function
addReport
(
req
,
res
)
{
let
{
fuHuaQiUscc
,
occupancyRate
}
=
req
.
body
;
let
{
uscc
,
occupancyRate
}
=
req
.
body
;
let
monthInfo
=
monthBiz
.
createReport
(
fuHuaQiUscc
,
occupancyRate
)
let
monthInfo
=
monthBiz
.
createReport
(
uscc
,
occupancyRate
)
res
.
success
(
monthInfo
);
}
/**
* 孵化器月度填报 删除报表
* @param req
* @param res
*/
async
function
deleteReport
(
req
,
res
)
{
let
{
uscc
}
=
req
.
body
;
let
monthInfo
=
monthBiz
.
deleteReport
(
uscc
)
res
.
success
(
monthInfo
);
res
.
success
(
monthInfo
);
}
}
\ No newline at end of file
src/util/tools.ts
View file @
e6084817
import
{
ERRORENUM
}
from
"../config/errorEnum"
;
import
{
ERRORENUM
}
from
"../config/errorEnum"
;
import
{
BizError
}
from
"./bizError"
;
import
{
BizError
}
from
"./bizError"
;
const
md5
=
require
(
"md5"
);
/**
/**
* 生成任务id
* 生成任务id
...
@@ -70,4 +71,14 @@ export function checkChange(newObj, oldObj) {
...
@@ -70,4 +71,14 @@ export function checkChange(newObj, oldObj) {
if
(
`
${
newObj
[
newKey
]}
`
!=
`
${
oldObj
[
newKey
]}
`
)
changeKeyList
.
push
(
newKey
);
if
(
`
${
newObj
[
newKey
]}
`
!=
`
${
oldObj
[
newKey
]}
`
)
changeKeyList
.
push
(
newKey
);
}
}
return
changeKeyList
;
return
changeKeyList
;
}
/**
* 密码加密
* @param uscc 信用代码
* @param pwd 密码
* @returns md5后的密码
*/
export
function
getPwdMd5
(
uscc
:
string
,
pwd
:
string
)
{
return
md5
(
uscc
+
pwd
);
}
}
\ No newline at end of file
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