Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yafangsuo_adminServer
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
yafangsuo_adminServer
Commits
8f0e139e
Commit
8f0e139e
authored
Sep 11, 2023
by
lixinming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
97edce31
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
552 additions
and
66 deletions
+552
-66
branchSystem.ts
src/biz/branchSystem.ts
+16
-15
organizationalLife.ts
src/biz/organizationalLife.ts
+98
-35
thematicActivities.ts
src/biz/thematicActivities.ts
+149
-0
user.ts
src/biz/user.ts
+1
-1
eccParamConfig.ts
src/config/eccParam/eccParamConfig.ts
+45
-0
errorEnum.ts
src/config/enum/errorEnum.ts
+2
-1
user.ts
src/middleware/user.ts
+1
-1
branchSystem.ts
src/routers/branchSystem.ts
+6
-6
organizationalLife.ts
src/routers/organizationalLife.ts
+78
-5
router.ts
src/routers/router.ts
+3
-0
thematicActivities.ts
src/routers/thematicActivities.ts
+103
-0
eccParam.ts
src/tools/eccParam.ts
+20
-0
systemTools.ts
src/tools/systemTools.ts
+25
-2
piecemeal.ts
src/util/piecemeal.ts
+5
-0
No files found.
src/biz/branchSystem.ts
View file @
8f0e139e
...
...
@@ -6,7 +6,7 @@ import { BRANCHNAME, OPERATIONALDATATYPE, TABLENAME } from "../config/enum/enum"
import
{
ERRORENUM
}
from
"../config/enum/errorEnum"
;
import
{
operationalData
,
selectData
}
from
"../data/operationalData"
;
import
{
changeEnumValue
,
eccEnumValue
}
from
"../tools/eccEnum"
;
import
{
getMySqlMs
}
from
"../tools/systemTools"
;
import
{
get
FileType
,
get
MySqlMs
}
from
"../tools/systemTools"
;
import
{
BizError
}
from
"../util/bizError"
;
import
{
dataListItemTimeChangeToTimeStr
,
datechangeToStr
}
from
"../util/piecemeal"
;
...
...
@@ -50,9 +50,9 @@ export async function getBranchSystemList(userInfo, title:string, pageNumber:num
* @param userInfo
* @param title
* @param branchList
* @param file
sNameList
* @param file
Name
*/
export
async
function
addBranchSystemInfo
(
userInfo
,
title
:
string
,
branchList
,
file
sNameList
)
{
export
async
function
addBranchSystemInfo
(
userInfo
,
title
:
string
,
branchList
,
file
Name
)
{
let
funName
=
"添加支部制度"
;
eccEnumValue
(
funName
,
'branchList'
,
BRANCHNAME
,
branchList
);
if
(
userInfo
.
branch
&&
branchList
.
indexOf
(
userInfo
.
branch
)
==
-
1
)
{
...
...
@@ -64,8 +64,8 @@ export async function addBranchSystemInfo(userInfo, title:string, branchList, fi
bId
:
JSON
.
stringify
(
branchList
),
isUse
:
true
,
releaseTime
:
getMySqlMs
(),
fileName
:
filesNameList
,
fileType
:
'pdf'
,
fileName
:
JSON
.
stringify
(
fileName
)
,
fileType
:
getFileType
(
fileName
)
,
uploadTime
:
getMySqlMs
()
};
...
...
@@ -76,25 +76,26 @@ export async function addBranchSystemInfo(userInfo, title:string, branchList, fi
/**
* 修改
* 修改
* 交互逻辑如下:文件列表删除不代表删除,需要点击保存才可以 2023年9月8日
* @param userInfo
* @param bsId
* @param title
* @param branchList
* @param file
sNameList
* @param file
Name
*/
export
async
function
updateBranchSystemInfo
(
userInfo
,
bsId
:
number
,
title
:
string
,
branchList
,
file
sNameList
)
{
export
async
function
updateBranchSystemInfo
(
userInfo
,
bsId
:
number
,
title
:
string
,
branchList
,
file
Name
)
{
let
funName
=
"修改支部制度"
;
eccEnumValue
(
funName
,
'branchList'
,
BRANCHNAME
,
branchList
);
if
(
userInfo
.
branch
&&
branchList
.
indexOf
(
userInfo
.
branch
)
==
-
1
)
{
throw
new
BizError
(
ERRORENUM
.
权限不足
,
`
${
userInfo
.
userId
}${
funName
}
但是制度范围不包含他所在的支部`
);
}
//todo 这里有争议 修改时不知道怎么处理文件 修改先没处理文件
let
updateInfo
=
{
systemTitle
:
title
,
bId
:
JSON
.
stringify
(
branchList
)
bId
:
JSON
.
stringify
(
branchList
),
fileName
:
JSON
.
stringify
(
fileName
),
fileType
:
getFileType
(
fileName
)
};
await
operationalData
(
OPERATIONALDATATYPE
.
修改
,
TABLENAME
.
支部制度表
,
updateInfo
,
{
bsId
});
...
...
@@ -111,15 +112,17 @@ export async function updateBranchSystemInfo(userInfo, bsId:number, title:string
export
async
function
getBranchSystemInfo
(
userInfo
,
bsId
)
{
let
funName
=
"回显支部制度"
;
let
column
=
[
"systemTitle"
,
"bsId"
,
"bId"
];
let
column
=
[
"systemTitle"
,
"bsId"
,
"bId"
,
"fileName"
];
let
dataInfo
=
await
selectData
(
OPERATIONALDATATYPE
.
查询单个
,
TABLENAME
.
支部制度表
,
{
bsId
},
column
);
let
branch
=
JSON
.
parse
(
dataInfo
.
bId
);
let
fileName
=
JSON
.
parse
(
dataInfo
.
fileName
||
"[]"
);
if
(
userInfo
.
branch
&&
branch
.
indexOf
(
userInfo
.
branch
)
==
-
1
)
{
throw
new
BizError
(
ERRORENUM
.
权限不足
,
`
${
userInfo
.
userId
}${
funName
}
但是制度范围不包含他所在的支部`
);
}
return
{
title
:
dataInfo
.
systemTitle
,
branch
};
return
{
title
:
dataInfo
.
systemTitle
,
branch
,
fileName
};
}
...
...
@@ -153,8 +156,6 @@ export async function delBranchSystemData(userInfo, bsId:number) {
throw
new
BizError
(
ERRORENUM
.
权限不足
,
`
${
userInfo
.
userId
}${
funName
}
但是制度范围不包含他所在的支部`
);
}
//todo 这里还要先删除相关文件
await
operationalData
(
OPERATIONALDATATYPE
.
删除
,
TABLENAME
.
支部制度表
,
{},
{
bsId
});
return
{
isSuccess
:
true
};
...
...
src/biz/organizationalLife.ts
View file @
8f0e139e
...
...
@@ -3,12 +3,15 @@
*/
import
moment
=
require
(
"moment"
);
import
{
selectData
}
from
"../data/operationalData"
;
import
{
operationalData
,
selectData
}
from
"../data/operationalData"
;
import
{
BRANCHNAME
,
FILETYPE
,
OPERATIONALDATATYPE
,
TABLENAME
,
THEMETYPE
}
from
"../config/enum/enum"
;
import
{
changeEnumValue
,
eccEnumValue
}
from
"../tools/eccEnum"
;
import
{
datechangeToStr
}
from
"../util/piecemeal"
;
import
{
BizError
}
from
"../util/bizError"
;
import
{
ERRORENUM
}
from
"../config/enum/errorEnum"
;
import
{
getClientMs
,
getFileType
,
getMySqlMs
}
from
"../tools/systemTools"
;
import
{
eccFormParam
}
from
"../tools/eccParam"
;
import
{
CreateOrgLifeConfig
,
UpdateOrgLifeConfig
}
from
"../config/eccParam/eccParamConfig"
;
...
...
@@ -20,47 +23,38 @@ import { ERRORENUM } from "../config/enum/errorEnum";
* @param pageNumber
* @returns
*/
export
async
function
getOrgLifeList
(
userInfo
,
month
:
number
,
title
:
string
,
pageNumber
:
number
)
{
export
async
function
getOrgLifeList
(
userInfo
,
month
:
number
,
theme
:
string
,
branch
:
number
,
pageNumber
:
number
)
{
/**组合查询条件 */
let
selectParam
:
any
=
{};
if
(
userInfo
.
userId
==
"admin"
)
{
//admin登录
if
(
userInfo
.
branch
)
{
selectParam
.
bId
=
{
"%like%"
:
userInfo
.
branch
};
if
(
!
userInfo
.
isSuperAdmin
)
{
if
(
userInfo
.
branch
!=
branch
)
throw
new
BizError
(
ERRORENUM
.
权限不足
,
`
${
userInfo
.
userId
}
无法查看非本支部的组织生活列表`
);
else
{
selectParam
.
bId
=
userInfo
.
branch
;
}
}
else
{
//其他用户登录
if
(
userInfo
.
branch
)
{
selectParam
.
bId
=
{
"%like%"
:
userInfo
.
branch
};
}
}
if
(
userInfo
.
branch
)
{
selectParam
.
bId
=
{
"%like%"
:
userInfo
.
branch
};
}
if
(
month
)
{
let
stTime
=
moment
(
month
).
startOf
(
"month"
).
format
(
"YYYY-MM-DD HH:mm:ss"
);
let
etTime
=
moment
(
month
).
endOf
(
'month'
).
format
(
"YYYY-MM-DD HH:mm:ss"
);
selectParam
.
dataMonth
=
{
"%between%"
:
[
stTime
,
etTime
]};
let
stTime
=
moment
(
month
).
startOf
(
"month"
).
valueOf
(
);
let
etTime
=
moment
(
month
).
endOf
(
'month'
).
valueOf
(
);
selectParam
.
dataMonth
=
{
"%between%"
:
[
getMySqlMs
(
stTime
),
getMySqlMs
(
etTime
)
]};
}
if
(
t
itl
e
)
{
selectParam
.
theme
=
{
"%like%"
:
t
itl
e
};
if
(
t
hem
e
)
{
selectParam
.
theme
=
{
"%like%"
:
t
hem
e
};
}
let
column
=
[
"oId"
,
"theme"
,
"themeType"
,
"dataMonth"
,
"fileType"
,
"uploadTime"
,
"bId"
];
let
dbList
=
await
selectData
(
OPERATIONALDATATYPE
.
分页查询
,
TABLENAME
.
组织生活表
,
selectParam
,
column
,
pageNumber
,
10
);
let
dataCount
=
await
selectData
(
OPERATIONALDATATYPE
.
查询数据量
,
TABLENAME
.
组织生活表
,
selectParam
,
null
);
let
dataList
=
{}
;
let
dataList
=
[]
;
dbList
.
forEach
(
info
=>
{
let
{
oId
,
theme
,
themeType
,
dataMonth
,
fileType
,
uploadTime
,
bId
}
=
info
;
let
{
oId
,
theme
,
themeType
,
dataMonth
,
fileType
,
uploadTime
}
=
info
;
let
dataMonthStr
=
moment
(
dataMonth
).
format
(
"YYYY-MM"
);
let
titleTypeStr
=
changeEnumValue
(
THEMETYPE
,
themeType
);
let
fileTypeStr
=
changeEnumValue
(
FILETYPE
,
fileType
);
let
uploadTimeStr
=
datechangeToStr
(
uploadTime
);
let
branch
=
changeEnumValue
(
BRANCHNAME
,
JSON
.
parse
(
bId
));
if
(
!
dataList
[
branch
])
dataList
[
branch
]
=
[];
dataList
[
branch
].
push
({
oId
,
title
:
theme
,
titleType
:
titleTypeStr
,
dataMonth
:
dataMonthStr
,
fileType
:
fileTypeStr
,
uploadTime
:
uploadTimeStr
dataList
.
push
({
oId
,
theme
:
theme
,
themeType
:
titleTypeStr
,
dataMonth
:
dataMonthStr
,
fileType
:
fileTypeStr
,
uploadTime
:
uploadTimeStr
})
})
...
...
@@ -68,25 +62,94 @@ export async function getOrgLifeList(userInfo, month:number, title:string, pageN
}
/**
* 创建组织生活
* @param userInfo
* @param param
*/
export
async
function
addOrgLifeInfo
(
userInfo
,
param
)
{
const
FuncName
=
"添加组织生活"
;
eccFormParam
(
FuncName
,
CreateOrgLifeConfig
,
param
);
eccEnumValue
(
FuncName
,
"themeType"
,
THEMETYPE
,
param
.
themeType
);
eccEnumValue
(
FuncName
,
"bId"
,
BRANCHNAME
,
param
.
bId
);
if
(
!
userInfo
.
isSuperAdmin
&&
userInfo
.
branch
!=
param
.
bId
)
{
throw
new
BizError
(
ERRORENUM
.
权限不足
,
`
${
userInfo
.
userId
}
无法添加非本支部的组织生活`
);
}
param
.
uploadTime
=
getMySqlMs
();
param
.
dataMonth
=
getMySqlMs
(
param
.
dataMonth
);
param
.
fileType
=
getFileType
(
param
.
fileName
);
param
.
fileName
=
JSON
.
stringify
(
param
.
fileName
);
await
operationalData
(
OPERATIONALDATATYPE
.
增加
,
TABLENAME
.
组织生活表
,
param
,
{}
);
return
{
isSuccess
:
true
};
}
export
async
function
addOrgLifeInfo
(
userInfo
,
bId
,
title
,
titleType
,
dataMonth
,
uploadTime
,
filesNameList
)
{
let
funName
=
"添加组织生活"
;
if
(
userInfo
.
branch
==
-
1
)
{
throw
new
BizError
(
ERRORENUM
.
权限不足
,
`
${
userInfo
.
userId
}${
funName
}
但是制度范围不包含他所在的支部`
);
/**
* 修改
* @param userInfo
* @param param
*/
export
async
function
updateOrgLifeInfo
(
userInfo
,
oId
:
number
,
param
)
{
const
FuncName
=
"修改组织生活"
;
eccFormParam
(
FuncName
,
UpdateOrgLifeConfig
,
param
);
eccEnumValue
(
FuncName
,
"themeType"
,
THEMETYPE
,
param
.
themeType
);
eccEnumValue
(
FuncName
,
"bId"
,
BRANCHNAME
,
param
.
bId
);
if
(
!
userInfo
.
isSuperAdmin
&&
userInfo
.
branch
!=
param
.
bId
)
{
throw
new
BizError
(
ERRORENUM
.
权限不足
,
`
${
userInfo
.
userId
}
无法修改非本支部的组织生活`
);
}
eccEnumValue
(
funName
,
"titleType"
,
THEMETYPE
,
titleType
);
let
addParam
=
{
theme
:
title
,
themeType
:
titleType
,
dataMonth
:
moment
(
dataMonth
).
format
(
"YYYY-MM-DD HH:mm:ss"
),
bId
,
param
.
uploadTime
=
getMySqlMs
();
param
.
dataMonth
=
getMySqlMs
(
param
.
dataMonth
);
param
.
fileType
=
getFileType
(
param
.
fileName
);
param
.
fileName
=
JSON
.
stringify
(
param
.
fileName
);
await
operationalData
(
OPERATIONALDATATYPE
.
修改
,
TABLENAME
.
组织生活表
,
param
,
{
oId
}
);
return
{
isSuccess
:
true
};
}
/**
* 删除组织生活
* @param userInfo
* @param oId
* @returns
*/
export
async
function
delOrgLifeInfo
(
userInfo
,
oId
:
number
)
{
let
onceOrgLifeInfo
=
await
selectData
(
OPERATIONALDATATYPE
.
查询单个
,
TABLENAME
.
组织生活表
,
{
oId
},
[
"oId"
,
"bId"
]
);
if
(
!
onceOrgLifeInfo
||
!
onceOrgLifeInfo
.
oId
)
throw
new
BizError
(
ERRORENUM
.
目标数据不存在
,
`不存在
${
oId
}
的组织生活`
);
if
(
!
userInfo
.
isSuperAdmin
&&
userInfo
.
branch
!=
onceOrgLifeInfo
.
bId
)
{
throw
new
BizError
(
ERRORENUM
.
权限不足
,
`
${
userInfo
.
userId
}
无法删除非本支部的组织生活`
);
}
await
operationalData
(
OPERATIONALDATATYPE
.
删除
,
TABLENAME
.
组织生活表
,
{},
{
oId
}
);
return
{
isSuccess
:
true
};
}
/**
* 回显
* @param userInfo
* @param oId
* @returns
*/
export
async
function
getOrgLifeInfo
(
userInfo
,
oId
:
number
)
{
let
orgLifeInfo
=
await
selectData
(
OPERATIONALDATATYPE
.
查询单个
,
TABLENAME
.
组织生活表
,
{
oId
},
[
"oId"
,
"bId"
,
"theme"
,
"themeType"
,
"dataMonth"
,
"fileName"
]
);
if
(
!
orgLifeInfo
||
!
orgLifeInfo
.
oId
)
throw
new
BizError
(
ERRORENUM
.
目标数据不存在
,
`不存在
${
oId
}
的组织生活`
);
if
(
!
userInfo
.
isSuperAdmin
&&
userInfo
.
branch
!=
orgLifeInfo
.
bId
)
{
throw
new
BizError
(
ERRORENUM
.
权限不足
,
`
${
userInfo
.
userId
}
无法查看非本支部的组织生活`
);
}
orgLifeInfo
.
dataMonth
=
getClientMs
(
orgLifeInfo
.
dataMonth
);
orgLifeInfo
.
fileName
=
JSON
.
parse
(
orgLifeInfo
.
fileName
);
return
{
orgLifeInfo
};
}
...
...
src/biz/thematicActivities.ts
0 → 100644
View file @
8f0e139e
/**
* 专题活动
*/
import
moment
=
require
(
"moment"
);
import
{
ERRORENUM
}
from
"../config/enum/errorEnum"
;
import
{
BizError
}
from
"../util/bizError"
;
import
{
getClientMs
,
getFileType
,
getMySqlMs
}
from
"../tools/systemTools"
;
import
{
operationalData
,
selectData
}
from
"../data/operationalData"
;
import
{
BRANCHNAME
,
FILETYPE
,
OPERATIONALDATATYPE
,
TABLENAME
,
THEMETYPE
}
from
"../config/enum/enum"
;
import
{
changeEnumValue
,
eccEnumValue
}
from
"../tools/eccEnum"
;
import
{
datechangeToStr
,
monthDateChangeToStr
}
from
"../util/piecemeal"
;
import
{
eccFormParam
}
from
"../tools/eccParam"
;
import
{
CreateThematicActivitiesConfig
,
UpdateThematicActivitiesConfig
}
from
"../config/eccParam/eccParamConfig"
;
/**
* 专题活动表列表
* @param userInfo
* @param month
* @param title
* @param pageNumber
* @returns
*/
export
async
function
getThematicActivitiesList
(
userInfo
,
month
:
number
,
title
:
string
,
branch
:
number
,
pageNumber
:
number
)
{
/**组合查询条件 */
let
selectParam
:
any
=
{};
if
(
!
userInfo
.
isSuperAdmin
)
{
if
(
userInfo
.
branch
!=
branch
)
throw
new
BizError
(
ERRORENUM
.
权限不足
,
`
${
userInfo
.
userId
}
无法查看非本支部的专题活动列表`
);
else
{
selectParam
.
bId
=
userInfo
.
branch
;
}
}
if
(
month
)
{
let
stTime
=
moment
(
month
).
startOf
(
"month"
).
valueOf
();
let
etTime
=
moment
(
month
).
endOf
(
'month'
).
valueOf
();
selectParam
.
dataMonth
=
{
"%between%"
:
[
getMySqlMs
(
stTime
),
getMySqlMs
(
etTime
)]};
}
if
(
title
)
{
selectParam
.
theme
=
{
"%like%"
:
title
};
}
let
column
=
[
"taId"
,
"theme"
,
"dataMonth"
,
"fileType"
,
"uploadTime"
];
let
dbList
=
await
selectData
(
OPERATIONALDATATYPE
.
分页查询
,
TABLENAME
.
专题活动表
,
selectParam
,
column
,
pageNumber
,
10
);
let
dataCount
=
await
selectData
(
OPERATIONALDATATYPE
.
查询数据量
,
TABLENAME
.
专题活动表
,
selectParam
,
null
);
let
dataList
=
[];
dbList
.
forEach
(
info
=>
{
let
{
taId
,
theme
,
dataMonth
,
fileType
,
uploadTime
}
=
info
;
let
dataMonthStr
=
monthDateChangeToStr
(
dataMonth
);
let
fileTypeStr
=
changeEnumValue
(
FILETYPE
,
fileType
);
let
uploadTimeStr
=
datechangeToStr
(
uploadTime
);
dataList
.
push
({
taId
,
theme
:
theme
,
dataMonth
:
dataMonthStr
,
fileType
:
fileTypeStr
,
uploadTime
:
uploadTimeStr
})
})
return
{
dataList
,
dataCount
};
}
/**
* 创建专题活动
* @param userInfo
* @param param
*/
export
async
function
addThematicActivitiesInfo
(
userInfo
,
param
)
{
const
FuncName
=
"添加专题活动"
;
eccFormParam
(
FuncName
,
CreateThematicActivitiesConfig
,
param
);
eccEnumValue
(
FuncName
,
"bId"
,
BRANCHNAME
,
param
.
bId
);
if
(
!
userInfo
.
isSuperAdmin
&&
userInfo
.
branch
!=
param
.
bId
)
{
throw
new
BizError
(
ERRORENUM
.
权限不足
,
`
${
userInfo
.
userId
}
无法添加非本支部的专题活动`
);
}
param
.
uploadTime
=
getMySqlMs
();
param
.
dataMonth
=
getMySqlMs
(
param
.
dataMonth
);
param
.
fileType
=
getFileType
(
param
.
fileName
);
param
.
fileName
=
JSON
.
stringify
(
param
.
fileName
);
await
operationalData
(
OPERATIONALDATATYPE
.
增加
,
TABLENAME
.
专题活动表
,
param
,
{}
);
return
{
isSuccess
:
true
};
}
/**
* 修改
* @param userInfo
* @param param
*/
export
async
function
updateThematicActivitiesInfo
(
userInfo
,
taId
:
number
,
param
)
{
const
FuncName
=
"修改专题活动"
;
eccFormParam
(
FuncName
,
CreateThematicActivitiesConfig
,
param
);
eccEnumValue
(
FuncName
,
"bId"
,
BRANCHNAME
,
param
.
bId
);
if
(
!
userInfo
.
isSuperAdmin
&&
userInfo
.
branch
!=
param
.
bId
)
{
throw
new
BizError
(
ERRORENUM
.
权限不足
,
`
${
userInfo
.
userId
}
无法添加非本支部的专题活动`
);
}
param
.
uploadTime
=
getMySqlMs
();
param
.
dataMonth
=
getMySqlMs
(
param
.
dataMonth
);
param
.
fileType
=
getFileType
(
param
.
fileName
);
param
.
fileName
=
JSON
.
stringify
(
param
.
fileName
);
await
operationalData
(
OPERATIONALDATATYPE
.
修改
,
TABLENAME
.
专题活动表
,
param
,
{
taId
}
);
return
{
isSuccess
:
true
};
}
/**
* 删除专题活动
* @param userInfo
* @param taId
* @returns
*/
export
async
function
delThematicActivitiesInfo
(
userInfo
,
taId
:
number
)
{
let
onceDataInfo
=
await
selectData
(
OPERATIONALDATATYPE
.
查询单个
,
TABLENAME
.
专题活动表
,
{
taId
},
[
"taId"
,
"bId"
]
);
if
(
!
onceDataInfo
||
!
onceDataInfo
.
taId
)
throw
new
BizError
(
ERRORENUM
.
目标数据不存在
,
`不存在
${
taId
}
的专题活动`
);
if
(
!
userInfo
.
isSuperAdmin
&&
userInfo
.
branch
!=
onceDataInfo
.
bId
)
{
throw
new
BizError
(
ERRORENUM
.
权限不足
,
`
${
userInfo
.
userId
}
无法删除非本支部的专题活动`
);
}
await
operationalData
(
OPERATIONALDATATYPE
.
删除
,
TABLENAME
.
专题活动表
,
{},
{
taId
}
);
return
{
isSuccess
:
true
};
}
/**
* 回显
* @param userInfo
* @param oId
* @returns
*/
export
async
function
getThematicActivitiesInfo
(
userInfo
,
taId
:
number
)
{
let
orgLifeInfo
=
await
selectData
(
OPERATIONALDATATYPE
.
查询单个
,
TABLENAME
.
专题活动表
,
{
taId
},
[
"taId"
,
"bId"
,
"theme"
,
"dataMonth"
,
"fileName"
]
);
if
(
!
orgLifeInfo
||
!
orgLifeInfo
.
taId
)
throw
new
BizError
(
ERRORENUM
.
目标数据不存在
,
`不存在
${
taId
}
的组织生活`
);
if
(
!
userInfo
.
isSuperAdmin
&&
userInfo
.
branch
!=
orgLifeInfo
.
bId
)
{
throw
new
BizError
(
ERRORENUM
.
权限不足
,
`
${
userInfo
.
userId
}
无法查看非本支部的专题活动`
);
}
orgLifeInfo
.
dataMonth
=
getClientMs
(
orgLifeInfo
.
dataMonth
);
orgLifeInfo
.
fileName
=
JSON
.
parse
(
orgLifeInfo
.
fileName
);
return
{
orgLifeInfo
};
}
src/biz/user.ts
View file @
8f0e139e
...
...
@@ -10,7 +10,7 @@ import { BizError } from "../util/bizError";
export
async
function
loginAdminSys
(
loginId
:
string
,
pwd
:
string
)
{
let
resultInfo
=
{
branch
:
-
1
,
token
:
''
,
userId
:
''
,
isAdmin
:
false
};
if
(
loginId
==
"admin"
)
{
/**超级管理员 */
if
(
loginId
==
"admin"
||
loginId
==
"admin2"
)
{
/**超级管理员 */
let
userInfo
=
await
selectData
(
OPERATIONALDATATYPE
.
查询单个
,
TABLENAME
.
后台用户表
,
{
loginId
},
null
);
if
(
!
userInfo
||
!
userInfo
.
uId
)
throw
new
BizError
(
ERRORENUM
.
用户不存在
,
`不存在loginId=
${
loginId
}
的用户`
);
if
(
userInfo
.
pwd
!=
pwd
)
throw
new
BizError
(
ERRORENUM
.
密码错误
);
...
...
src/config/eccParam/eccParamConfig.ts
View file @
8f0e139e
...
...
@@ -101,4 +101,48 @@ export const CreatePartyCandidateMemberConfig = {
talkTime
:{
type
:
"Number"
},
//谈话时间
administrativePositionName
:{
type
:
"Number"
},
//行政职务id
departmentName
:{
type
:
"[Number]"
},
//所属科室表id
}
/**
* 添加组织生活
*/
export
const
CreateOrgLifeConfig
=
{
bId
:{
type
:
"Number"
},
theme
:{
type
:
"String"
},
themeType
:{
type
:
"Number"
},
dataMonth
:{
type
:
"Number"
},
fileName
:{
type
:
"[String]"
}
}
/**
* 修改组织生活
*/
export
const
UpdateOrgLifeConfig
=
{
bId
:{
type
:
"Number"
},
theme
:{
type
:
"String"
},
themeType
:{
type
:
"Number"
},
dataMonth
:{
type
:
"Number"
},
fileName
:{
type
:
"[String]"
}
}
/**
* 添加专题活动
*/
export
const
CreateThematicActivitiesConfig
=
{
bId
:{
type
:
"Number"
},
theme
:{
type
:
"String"
},
dataMonth
:{
type
:
"Number"
},
fileName
:{
type
:
"[String]"
}
}
/**
* 修改专题活动
*/
export
const
UpdateThematicActivitiesConfig
=
{
bId
:{
type
:
"Number"
},
theme
:{
type
:
"String"
},
dataMonth
:{
type
:
"Number"
},
fileName
:{
type
:
"[String]"
}
}
\ No newline at end of file
src/config/enum/errorEnum.ts
View file @
8f0e139e
...
...
@@ -19,7 +19,8 @@ export enum ERRORENUM {
目标用户不是正式党员
,
管理员不可被删除
,
权限不足
,
目标数据不存在
目标数据不存在
,
文件不存在
}
export
enum
ERRORCODEENUM
{
...
...
src/middleware/user.ts
View file @
8f0e139e
...
...
@@ -17,7 +17,7 @@ export async function checkToken(req, res, next) {
if
(
!
userId
||
!
token
)
return
next
(
new
BizError
(
ERRORENUM
.
非法登录
));
if
(
userId
==
"admin"
)
{
if
(
userId
==
"admin"
||
userId
==
"admin2"
)
{
let
userInfo
=
await
selectData
(
OPERATIONALDATATYPE
.
查询单个
,
TABLENAME
.
后台用户表
,
{
uId
:
userId
},
null
);
if
(
!
userInfo
||
!
userInfo
.
uId
)
return
next
(
new
BizError
(
ERRORENUM
.
身份验证失败
));
if
(
!
userInfo
.
token
||
userInfo
.
token
!=
token
)
return
next
(
new
BizError
(
ERRORENUM
.
身份验证过期
));
...
...
src/routers/branchSystem.ts
View file @
8f0e139e
...
...
@@ -43,10 +43,10 @@ async function branchSystemList(req, res) {
async
function
addBranchSystem
(
req
,
res
)
{
let
userInfo
=
req
.
userInfo
;
let
reqConf
=
{
title
:
'String'
,
branch
:
'[Number]'
,
file
sNameList
:
'[String]'
};
let
{
title
,
branch
,
file
sNameList
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
[
"filesNameList"
]
);
let
reqConf
=
{
title
:
'String'
,
branch
:
'[Number]'
,
file
Name
:
'[String]'
};
let
{
title
,
branch
,
file
Name
}
=
eccReqParamater
(
reqConf
,
req
.
body
);
let
result
=
await
branchSystemBiz
.
addBranchSystemInfo
(
userInfo
,
title
,
branch
,
file
sNameList
);
let
result
=
await
branchSystemBiz
.
addBranchSystemInfo
(
userInfo
,
title
,
branch
,
file
Name
);
res
.
success
(
result
);
}
...
...
@@ -60,10 +60,10 @@ async function addBranchSystem(req, res) {
async
function
updateBranchSystem
(
req
,
res
)
{
let
userInfo
=
req
.
userInfo
;
let
reqConf
=
{
title
:
'String'
,
branch
:
'[Number]'
,
file
sNameList
:
'[String]'
,
bsId
:
'Number'
};
let
{
title
,
branch
,
file
sNameList
,
bsId
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
[
"filesNameList"
]
);
let
reqConf
=
{
title
:
'String'
,
branch
:
'[Number]'
,
file
Name
:
'[String]'
,
bsId
:
'Number'
};
let
{
title
,
branch
,
file
Name
,
bsId
}
=
eccReqParamater
(
reqConf
,
req
.
body
);
let
result
=
await
branchSystemBiz
.
updateBranchSystemInfo
(
userInfo
,
bsId
,
title
,
branch
,
file
sNameList
);
let
result
=
await
branchSystemBiz
.
updateBranchSystemInfo
(
userInfo
,
bsId
,
title
,
branch
,
file
Name
);
res
.
success
(
result
);
}
...
...
src/routers/organizationalLife.ts
View file @
8f0e139e
...
...
@@ -9,6 +9,10 @@ import { eccReqParamater } from '../tools/eccParam';
export
function
setRouter
(
httpServer
)
{
httpServer
.
post
(
'/yfs/admin/organizationallife/list'
,
checkToken
,
asyncHandler
(
organizationalLifeList
));
httpServer
.
post
(
'/yfs/admin/organizationallife/add'
,
checkToken
,
asyncHandler
(
addOrganizationalLife
));
httpServer
.
post
(
'/yfs/admin/organizationallife/update'
,
checkToken
,
asyncHandler
(
updateOrganizationalLife
));
httpServer
.
post
(
'/yfs/admin/organizationallife/del'
,
checkToken
,
asyncHandler
(
delOrganizationalLife
));
httpServer
.
post
(
'/yfs/admin/organizationallife/info'
,
checkToken
,
asyncHandler
(
organizationalLifeInfo
));
}
...
...
@@ -20,10 +24,80 @@ export function setRouter(httpServer) {
async
function
organizationalLifeList
(
req
,
res
)
{
let
userInfo
=
req
.
userInfo
;
let
reqConf
=
{
month
:
'Number'
,
t
itle
:
'String'
,
pageNumber
:
'Number'
};
let
{
month
,
t
itle
,
pageNumber
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
[
"month"
,
"titl
e"
]);
let
reqConf
=
{
month
:
'Number'
,
t
heme
:
'String'
,
pageNumber
:
'Number'
,
branch
:
"Number"
};
let
{
month
,
t
heme
,
pageNumber
,
branch
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
[
"month"
,
"them
e"
]);
let
result
=
await
organizationalLifeBiz
.
getOrgLifeList
(
userInfo
,
month
,
t
itle
,
pageNumber
);
let
result
=
await
organizationalLifeBiz
.
getOrgLifeList
(
userInfo
,
month
,
t
heme
,
branch
,
pageNumber
);
res
.
success
(
result
);
}
\ No newline at end of file
}
/**
* 添加
* @param req
* @param res
*/
async
function
addOrganizationalLife
(
req
,
res
)
{
let
userInfo
=
req
.
userInfo
;
let
reqConf
=
{
param
:
'Object'
};
let
{
param
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
[]);
let
result
=
await
organizationalLifeBiz
.
addOrgLifeInfo
(
userInfo
,
param
);
res
.
success
(
result
);
}
/**
* 修改
* @param req
* @param res
*/
async
function
updateOrganizationalLife
(
req
,
res
)
{
let
userInfo
=
req
.
userInfo
;
let
reqConf
=
{
param
:
'Object'
,
oId
:
"Number"
};
let
{
param
,
oId
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
[]);
let
result
=
await
organizationalLifeBiz
.
updateOrgLifeInfo
(
userInfo
,
oId
,
param
);
res
.
success
(
result
);
}
/**
* 删除
* @param req
* @param res
*/
async
function
delOrganizationalLife
(
req
,
res
)
{
let
userInfo
=
req
.
userInfo
;
let
reqConf
=
{
oId
:
"Number"
};
let
{
oId
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
[]);
let
result
=
await
organizationalLifeBiz
.
delOrgLifeInfo
(
userInfo
,
oId
);
res
.
success
(
result
);
}
/**
* 回显
* @param req
* @param res
*/
async
function
organizationalLifeInfo
(
req
,
res
)
{
let
userInfo
=
req
.
userInfo
;
let
reqConf
=
{
oId
:
"Number"
};
let
{
oId
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
[]);
let
result
=
await
organizationalLifeBiz
.
getOrgLifeInfo
(
userInfo
,
oId
);
res
.
success
(
result
);
}
src/routers/router.ts
View file @
8f0e139e
...
...
@@ -4,6 +4,7 @@ import * as publicRouter from "./public";
import
*
as
organizationRouter
from
"./organization"
;
import
*
as
branchSystemRouter
from
"./branchSystem"
;
import
*
as
organizationalLifeRouter
from
"./organizationalLife"
;
import
*
as
thematicActivitiesRouter
from
"./thematicActivities"
;
export
function
setRouter
(
httpServer
)
{
...
...
@@ -13,4 +14,5 @@ export function setRouter(httpServer) {
organizationRouter
.
setRouter
(
httpServer
);
branchSystemRouter
.
setRouter
(
httpServer
);
organizationalLifeRouter
.
setRouter
(
httpServer
);
thematicActivitiesRouter
.
setRouter
(
httpServer
);
}
\ No newline at end of file
src/routers/thematicActivities.ts
0 → 100644
View file @
8f0e139e
/**
* 专题活动
*/
import
*
as
asyncHandler
from
'express-async-handler'
;
import
*
as
thematicActivitiesBiz
from
'../biz/thematicActivities'
;
import
{
checkToken
}
from
'../middleware/user'
;
import
{
eccReqParamater
}
from
'../tools/eccParam'
;
export
function
setRouter
(
httpServer
)
{
httpServer
.
post
(
'/yfs/admin/thematicactivities/list'
,
checkToken
,
asyncHandler
(
thematicActivitiesList
));
httpServer
.
post
(
'/yfs/admin/thematicactivities/add'
,
checkToken
,
asyncHandler
(
addThematicActivities
));
httpServer
.
post
(
'/yfs/admin/thematicactivities/update'
,
checkToken
,
asyncHandler
(
updateThematicActivities
));
httpServer
.
post
(
'/yfs/admin/thematicactivities/del'
,
checkToken
,
asyncHandler
(
delThematicActivities
));
httpServer
.
post
(
'/yfs/admin/thematicactivities/info'
,
checkToken
,
asyncHandler
(
thematicActivitiesInfo
));
}
/**
* 专题活动列表
* @param req
* @param res
*/
async
function
thematicActivitiesList
(
req
,
res
)
{
let
userInfo
=
req
.
userInfo
;
let
reqConf
=
{
month
:
'Number'
,
theme
:
'String'
,
pageNumber
:
'Number'
,
branch
:
"Number"
};
let
{
month
,
theme
,
pageNumber
,
branch
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
[
"month"
,
"theme"
]);
let
result
=
await
thematicActivitiesBiz
.
getThematicActivitiesList
(
userInfo
,
month
,
theme
,
branch
,
pageNumber
);
res
.
success
(
result
);
}
/**
* 添加
* @param req
* @param res
*/
async
function
addThematicActivities
(
req
,
res
)
{
let
userInfo
=
req
.
userInfo
;
let
reqConf
=
{
param
:
'Object'
};
let
{
param
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
[]);
let
result
=
await
thematicActivitiesBiz
.
addThematicActivitiesInfo
(
userInfo
,
param
);
res
.
success
(
result
);
}
/**
* 修改
* @param req
* @param res
*/
async
function
updateThematicActivities
(
req
,
res
)
{
let
userInfo
=
req
.
userInfo
;
let
reqConf
=
{
param
:
'Object'
,
taId
:
"Number"
};
let
{
param
,
taId
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
[]);
let
result
=
await
thematicActivitiesBiz
.
updateThematicActivitiesInfo
(
userInfo
,
taId
,
param
);
res
.
success
(
result
);
}
/**
* 删除
* @param req
* @param res
*/
async
function
delThematicActivities
(
req
,
res
)
{
let
userInfo
=
req
.
userInfo
;
let
reqConf
=
{
taId
:
"Number"
};
let
{
taId
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
[]);
let
result
=
await
thematicActivitiesBiz
.
delThematicActivitiesInfo
(
userInfo
,
taId
);
res
.
success
(
result
);
}
/**
* 回显
* @param req
* @param res
*/
async
function
thematicActivitiesInfo
(
req
,
res
)
{
let
userInfo
=
req
.
userInfo
;
let
reqConf
=
{
taId
:
"Number"
};
let
{
taId
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
[]);
let
result
=
await
thematicActivitiesBiz
.
getThematicActivitiesInfo
(
userInfo
,
taId
);
res
.
success
(
result
);
}
src/tools/eccParam.ts
View file @
8f0e139e
...
...
@@ -61,6 +61,16 @@ export function eccFormParam(name:string, keyTypeConf:object, param:object) {
}
}
break
;
case
'[String]'
:
if
(
!
Array
.
isArray
(
param
[
key
])
)
isError
=
true
;
for
(
let
i
=
0
;
i
<
param
[
key
].
length
;
i
++
)
{
let
item
=
param
[
key
][
i
];
if
(
typeof
item
!=
'string'
)
{
isError
=
true
;
errorStr
=
`
${
key
}
应是String型数组其中下标
${
i
}
是
${
typeof
item
}
`
;
}
}
break
;
case
'[Object]'
:
if
(
!
Array
.
isArray
(
param
[
key
])
)
isError
=
true
;
for
(
let
i
=
0
;
i
<
param
[
key
].
length
;
i
++
)
{
...
...
@@ -168,6 +178,16 @@ export function eccReqParamater(conf:object, param, skipKeys?) {
}
}
break
;
case
'[String]'
:
if
(
!
Array
.
isArray
(
param
[
key
])
)
isError
=
true
;
for
(
let
i
=
0
;
i
<
param
[
key
].
length
;
i
++
)
{
let
item
=
param
[
key
][
i
];
if
(
typeof
item
!=
'string'
)
{
isError
=
true
;
errorStr
=
`
${
key
}
应是String型数组其中下标
${
i
}
是
${
typeof
item
}
`
;
}
}
break
;
case
'[Object]'
:
if
(
!
Array
.
isArray
(
param
[
key
])
)
isError
=
true
;
for
(
let
i
=
0
;
i
<
param
[
key
].
length
;
i
++
)
{
...
...
src/tools/systemTools.ts
View file @
8f0e139e
import
moment
=
require
(
"moment"
);
import
{
ERRORENUM
}
from
"../config/enum/errorEnum"
;
import
{
BizError
}
from
"../util/bizError"
;
import
{
FILETYPE
}
from
"../config/enum/enum"
;
const
md5
=
require
(
"md5"
);
...
...
@@ -22,4 +25,25 @@ export function getPartyMemberId(param) {
export
function
getDefPwd
(
phone
:
string
)
{
return
md5
(
`
${
phone
.
slice
(
5
,
11
)}
`
);
}
\ No newline at end of file
}
export
function
getFileType
(
fileName
)
{
let
fileType
=
0
;
fileName
.
forEach
(
info
=>
{
let
type
=
info
.
split
(
"_"
)[
1
];
if
(
!
type
)
throw
new
BizError
(
ERRORENUM
.
文件不存在
,
`文件名
${
info
}
`
);
let
typeNum
=
0
;
switch
(
type
)
{
case
'pdf'
:
typeNum
=
FILETYPE
.
pdf
;
break
;
case
'doc'
:
case
'docx'
:
typeNum
=
FILETYPE
.
word
;
break
;
case
'jpg'
:
case
'png'
:
typeNum
=
FILETYPE
.
图片
;
break
;
};
if
(
typeNum
)
{
if
(
!
fileType
)
fileType
=
typeNum
;
else
if
(
fileType
!=
typeNum
)
fileType
=
FILETYPE
.
多类型
}
});
return
fileType
}
src/util/piecemeal.ts
View file @
8f0e139e
...
...
@@ -75,6 +75,11 @@ export function datechangeToStr(timeMs) {
return
moment
(
timeMs
).
format
(
"YYYY-MM-DD"
)
}
export
function
monthDateChangeToStr
(
timeMs
)
{
return
moment
(
timeMs
).
format
(
"YYYY-MM"
)
}
export
function
dataListItemTimeChangeToTimeStr
(
dataList
,
checkList
)
{
dataList
.
forEach
(
info
=>
{
...
...
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