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
0048e68f
Commit
0048e68f
authored
Sep 08, 2023
by
chenjinjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
2aea4838
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
119 additions
and
1 deletions
+119
-1
package-lock.json
package-lock.json
+0
-0
organizationalLife.ts
src/biz/organizationalLife.ts
+86
-1
organizationalLife.ts
src/routers/organizationalLife.ts
+30
-0
router.ts
src/routers/router.ts
+3
-0
No files found.
package-lock.json
0 → 100644
View file @
0048e68f
This diff is collapsed.
Click to expand it.
src/biz/organizationalLife.ts
View file @
0048e68f
...
@@ -2,7 +2,92 @@
...
@@ -2,7 +2,92 @@
* 组织生活
* 组织生活
*/
*/
export
async
function
getOrgLifeList
(
month
:
number
,
title
:
string
,
pageNumber
:
number
)
{
import
moment
=
require
(
"moment"
);
import
{
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"
;
/**
* 组织生活列表
* @param userInfo
* @param month
* @param title
* @param pageNumber
* @returns
*/
export
async
function
getOrgLifeList
(
userInfo
,
month
:
number
,
title
:
string
,
pageNumber
:
number
)
{
let
selectParam
:
any
=
{};
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
]};
}
if
(
title
)
{
selectParam
.
theme
=
{
"%like%"
:
title
};
}
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
=
{};
dbList
.
forEach
(
info
=>
{
let
{
oId
,
theme
,
themeType
,
dataMonth
,
fileType
,
uploadTime
,
bId
}
=
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
})
})
return
{
dataList
,
dataCount
};
}
export
async
function
addOrgLifeInfo
(
userInfo
,
bId
,
title
,
titleType
,
dataMonth
,
uploadTime
,
filesNameList
)
{
let
funName
=
"添加组织生活"
;
if
(
userInfo
.
branch
==
-
1
)
{
throw
new
BizError
(
ERRORENUM
.
权限不足
,
`
${
userInfo
.
userId
}${
funName
}
但是制度范围不包含他所在的支部`
);
}
eccEnumValue
(
funName
,
"titleType"
,
THEMETYPE
,
titleType
);
let
addParam
=
{
theme
:
title
,
themeType
:
titleType
,
dataMonth
:
moment
(
dataMonth
).
format
(
"YYYY-MM-DD HH:mm:ss"
),
bId
,
}
}
}
src/routers/organizationalLife.ts
0 → 100644
View file @
0048e68f
/**
* 组织生活
*/
import
*
as
asyncHandler
from
'express-async-handler'
;
import
*
as
organizationalLifeBiz
from
'../biz/organizationalLife'
;
import
{
checkToken
}
from
'../middleware/user'
;
import
{
eccReqParamater
}
from
'../tools/eccParam'
;
export
function
setRouter
(
httpServer
)
{
httpServer
.
post
(
'/yfs/admin/organizationallife/list'
,
checkToken
,
asyncHandler
(
organizationalLifeList
));
}
/**
* 组织生活列表
* @param req
* @param res
*/
async
function
organizationalLifeList
(
req
,
res
)
{
let
userInfo
=
req
.
userInfo
;
let
reqConf
=
{
month
:
'Number'
,
title
:
'String'
,
pageNumber
:
'Number'
};
let
{
month
,
title
,
pageNumber
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
[
"month"
,
"title"
]);
let
result
=
await
organizationalLifeBiz
.
getOrgLifeList
(
userInfo
,
month
,
title
,
pageNumber
);
res
.
success
(
result
);
}
\ No newline at end of file
src/routers/router.ts
View file @
0048e68f
...
@@ -3,6 +3,7 @@ import * as partyMemberRouter from "./partyMember";
...
@@ -3,6 +3,7 @@ import * as partyMemberRouter from "./partyMember";
import
*
as
publicRouter
from
"./public"
;
import
*
as
publicRouter
from
"./public"
;
import
*
as
organizationRouter
from
"./organization"
;
import
*
as
organizationRouter
from
"./organization"
;
import
*
as
branchSystemRouter
from
"./branchSystem"
;
import
*
as
branchSystemRouter
from
"./branchSystem"
;
import
*
as
organizationalLifeRouter
from
"./organizationalLife"
;
export
function
setRouter
(
httpServer
)
{
export
function
setRouter
(
httpServer
)
{
...
@@ -11,4 +12,5 @@ export function setRouter(httpServer) {
...
@@ -11,4 +12,5 @@ export function setRouter(httpServer) {
publicRouter
.
setRouter
(
httpServer
);
publicRouter
.
setRouter
(
httpServer
);
organizationRouter
.
setRouter
(
httpServer
);
organizationRouter
.
setRouter
(
httpServer
);
branchSystemRouter
.
setRouter
(
httpServer
);
branchSystemRouter
.
setRouter
(
httpServer
);
organizationalLifeRouter
.
setRouter
(
httpServer
);
}
}
\ 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