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
6dbbb80c
Commit
6dbbb80c
authored
Feb 07, 2023
by
lixinming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://123.207.147.179:8888/node_server/zjxcxServer
# Conflicts: # src/config/errorEnum.ts
parents
70941204
e6084817
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
102 additions
and
25 deletions
+102
-25
month.ts
src/biz/fuHuqQi/month.ts
+34
-0
user.ts
src/biz/fuHuqQi/user.ts
+11
-16
errorEnum.ts
src/config/errorEnum.ts
+8
-1
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 @
6dbbb80c
/**
* 月度表单逻辑层
* 作者: 陈金晶
* 月度表单相关逻辑 包括孵化器月度填报的增删改查
*/
import
{
ERRORENUM
}
from
"../../config/errorEnum"
;
import
{
BizError
}
from
"../../util/bizError"
;
...
...
@@ -27,3 +28,35 @@ export async function createReport(uscc:string, occupancyRate:number) {
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 @
6dbbb80c
...
...
@@ -7,8 +7,7 @@
import
{
ERRORENUM
}
from
"../../config/errorEnum"
;
import
*
as
fuhuaqiData
from
"../../data/fuHuaQi/fuhuaqi"
import
{
BizError
}
from
"../../util/bizError"
;
const
md5
=
require
(
"md5"
);
import
{
getPwdMd5
}
from
"../../util/tools"
;
/**
* 登录
...
...
@@ -18,17 +17,17 @@ const md5 = require("md5");
*/
export
async
function
login
(
uscc
:
string
,
pwd
:
string
):
Promise
<
object
>
{
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
.
未找到数据
);
let
checkPwd
=
getPwdMd5
(
fuhuaqiInfo
.
uscc
,
pwd
);
if
(
fuhuaqiInfo
.
pwd
!=
checkPwd
)
throw
new
BizError
(
"密码不正确"
);
if
(
fuhuaqiInfo
.
pwd
!=
checkPwd
)
throw
new
BizError
(
ERRORENUM
.
密码错误
);
let
fuhuaqiUserInfo
=
{
uscc
:
fuhuaqiInfo
.
uscc
,
name
:
fuhuaqiInfo
.
name
};
return
fuhuaqiUserInfo
;
return
{
fuhuaqiUserInfo
}
;
}
/**
...
...
@@ -36,37 +35,32 @@ export async function login(uscc:string, pwd:string):Promise<object> {
* @param uscc 信用代码
* @param pwd 原密码
* @param newPwd 修改后的密码
* @returns
* @returns
{isSuccess:true/false}
*/
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
);
let
reg
=
new
RegExp
(
"[`~!@#$^&*()=|{}':;',
\\
[
\\
].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]"
);
if
(
reg
.
test
(
newPwd
))
{
throw
new
BizError
(
"密码不允许有特殊字符"
);
throw
new
BizError
(
ERRORENUM
.
密码不允许有特殊字符
);
}
let
fuhuaqiInfo
=
await
fuhuaqiData
.
findFuHuaQiByUSCC
(
uscc
);
if
(
!
fuhuaqiInfo
)
throw
new
BizError
(
ERRORENUM
.
未找到数据
);
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
);
await
fuhuaqiInfo
.
save
();
return
{
msg
:
"修改成功"
,
isOk
:
true
};
return
{
isSuccess
:
true
};
}
/**
* 退出登录
* @param uscc 信用代码
* @returns
* @returns
{isSuccess:true/false}
*/
export
async
function
logout
(
uscc
:
string
):
Promise
<
object
>
{
if
(
typeof
uscc
!=
"string"
)
throw
new
BizError
(
ERRORENUM
.
参数错误
,
uscc
);
let
fuhuaqiInfo
=
await
fuhuaqiData
.
findFuHuaQiByUSCC
(
uscc
);
await
fuhuaqiInfo
.
save
();
return
{
msg
:
"退出成功"
,
isOk
:
true
};
}
function
getPwdMd5
(
uscc
:
string
,
pwd
:
string
)
{
return
md5
(
uscc
+
pwd
);
return
{
isSuccess
:
true
};
}
\ No newline at end of file
src/config/errorEnum.ts
View file @
6dbbb80c
...
...
@@ -8,7 +8,14 @@ export enum ERRORENUM {
数据无更新
,
该孵化器月度填报已存在
,
该企业当月数据已存在
,
该报表需要填写本月内容后提交
该报表需要填写本月内容后提交
,
密码错误
,
密码不允许有特殊字符
}
export
enum
ERRORCODEENUM
{
省份验证失败
=
401
,
}
let
bizErrorMsgMap
=
{};
...
...
src/data/fuHuaQi/fuhuaqi.ts
View file @
6dbbb80c
...
...
@@ -27,7 +27,7 @@ const fuHuaQiSchema = new Schema({
personInChargePhone
:
String
,
//负责人联系电话
personInChargeAdd
:
String
,
//孵化场地地址
siteAcreage
:
Number
,
//孵化场地面积(㎡)
leasePrice
:
Number
//孵化场地出租单价
(㎡)
leasePrice
:
Number
//孵化场地出租单价
});
var
fuHuaQiModel
;
...
...
@@ -70,4 +70,11 @@ export async function findFuHuaQiByName(name:string) {
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 @
6dbbb80c
...
...
@@ -62,7 +62,7 @@ export async function findmonthTableByTaskId(taskId:string) {
/**
* 孵化器月度填报 新增报表
* @param name 任务名称 系统生成
* @param
fuHuaQiU
scc 孵化器统一信用代码
* @param
u
scc 孵化器统一信用代码
* @param occupancyRate 出租率
* @param createTime 创建时间
*
...
...
@@ -71,3 +71,11 @@ export async function addOnceReport(name:string, uscc:string, occupancyRate:numb
let
monthInfo
=
{
name
,
fuHuaQiUscc
:
uscc
,
occupancyRate
,
createTime
:
new
Date
().
valueOf
()}
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 @
6dbbb80c
...
...
@@ -8,7 +8,7 @@ async function lanuch() {
await
initDB
();
httpServer
.
createServer
(
systemConfig
.
port
);
console
.
log
(
'This indicates that the server is started successfully.'
);
await
t
();
//
await t();
}
async
function
t
()
{
...
...
src/routers/fuhuaqi.ts
View file @
6dbbb80c
...
...
@@ -10,6 +10,7 @@ export function setRouter(httpServer) {
httpServer
.
post
(
'/fuhuaqi/mydata'
,
asyncHandler
(
myDataInfo
));
httpServer
.
post
(
'/fuhuaqi/mydata/update'
,
asyncHandler
(
updateMyDataInfo
));
httpServer
.
post
(
'/fuhuaqi/month/addreport'
,
asyncHandler
(
addReport
));
httpServer
.
post
(
'/fuhuaqi/month/deletereport'
,
asyncHandler
(
deleteReport
));
}
/**
...
...
@@ -77,12 +78,23 @@ async function updateMyDataInfo(req, res) {
}
/**
* 孵化月度填报 新增报表
* 孵化
器
月度填报 新增报表
* @param req
* @param res
*/
async
function
addReport
(
req
,
res
)
{
let
{
fuHuaQiUscc
,
occupancyRate
}
=
req
.
body
;
let
monthInfo
=
monthBiz
.
createReport
(
fuHuaQiUscc
,
occupancyRate
)
let
{
uscc
,
occupancyRate
}
=
req
.
body
;
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
);
}
\ No newline at end of file
src/util/tools.ts
View file @
6dbbb80c
import
{
ERRORENUM
}
from
"../config/errorEnum"
;
import
{
BizError
}
from
"./bizError"
;
const
md5
=
require
(
"md5"
);
/**
* 生成任务id
...
...
@@ -70,4 +71,14 @@ export function checkChange(newObj, oldObj) {
if
(
`
${
newObj
[
newKey
]}
`
!=
`
${
oldObj
[
newKey
]}
`
)
changeKeyList
.
push
(
newKey
);
}
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