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
a70931c9
Commit
a70931c9
authored
Jul 07, 2025
by
lixinming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
f2baf189
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
133 additions
and
19 deletions
+133
-19
visit.ts
src/biz/mobileFuHuaQi/visit.ts
+44
-1
track.ts
src/data/fuHuaQi/track.ts
+68
-0
tableInit.ts
src/db/mongo/tableInit.ts
+3
-0
visit.ts
src/routers/mobileClient/visit.ts
+18
-18
No files found.
src/biz/mobileFuHuaQi/visit.ts
View file @
a70931c9
...
...
@@ -6,6 +6,7 @@ import { RESEARCHTYPE, VISITDEMAND, VISITENTERPRISETYPE, VISITSTATE } from "../.
import
*
as
visitData
from
"../../data/fuHuaQi/visit"
;
import
*
as
demandData
from
"../../data/fuHuaQi/demand"
;
import
*
as
enterpriseData
from
"../../data/enterprise/enterprise"
;
import
*
as
trackData
from
"../../data/fuHuaQi/track"
;
import
{
changeEnumManyValue
,
changeEnumValue
,
eccEnumValue
}
from
"../../util/verificationEnum"
;
import
{
BizError
}
from
"../../util/bizError"
;
import
{
ERRORENUM
}
from
"../../config/errorEnum"
;
...
...
@@ -199,7 +200,7 @@ export async function visitInfo(id:string) {
export
async
function
visit
_update_s
tate
(
id
,
state
:
number
)
{
export
async
function
visit
UpdateS
tate
(
id
,
state
:
number
)
{
if
(
!
(
state
==
1
||
state
==
2
)
)
throw
new
BizError
(
ERRORENUM
.
参数错误
);
let
visitInfo
=
await
visitData
.
findOne
({
id
});
...
...
@@ -212,6 +213,48 @@ export async function visit_update_state(id, state:number) {
}
export
async
function
visitTrackAdd
(
fuHuaQiUscc
:
string
,
uscc
:
string
,
trackType
:
number
,
content
:
string
)
{
eccEnumValue
(
"添加服务追踪"
,
"trackType"
,
VISITENTERPRISETYPE
,
trackType
)
let
enterpriseInfo
=
await
enterpriseData
.
findEnterpriseByUscc
(
uscc
);
if
(
!
enterpriseInfo
||
!
enterpriseInfo
.
uscc
)
throw
new
BizError
(
ERRORENUM
.
目标数据不存在
);
let
addInfo
=
{
id
:
getRandomId
(
"track"
),
//标识
fuHuaQiUscc
,
//孵化器uscc
uscc
,
//企业uscc
enterpriseName
:
enterpriseInfo
.
enterpriseName
,
trackType
,
//跟踪类型 VISITENTERPRISETYPE
content
//内容
};
await
trackData
.
createDataByParam
(
addInfo
);
return
{
isSuccess
:
true
}
}
export
async
function
visit_log_statis
(
fuHuaQiUscc
:
string
,
year
:
number
)
{
let
startMs
=
moment
(
`
${
year
}
-01-01 00:00:00`
).
valueOf
();
let
endMs
=
moment
(
`
${
year
}
-01-01 00:00:00`
).
add
(
1
,
'y'
).
valueOf
();
let
thisYearParma
=
{
visitTime
:{
"$gt"
:
startMs
,
"$lt"
:
endMs
},
fuHuaQiUscc
,
state
:{
"$gt"
:
VISITSTATE
.
走访安排
}};
let
dangQianCount
=
await
visitData
.
findCountByParam
(
thisYearParma
);
let
liShiCount
=
await
visitData
.
findCountByParam
({
visitTime
:{
"$gt"
:
startMs
},
fuHuaQiUscc
,
state
:{
"$ne"
:
VISITSTATE
.
走访安排
}});
let
lastYearCount
=
await
visitData
.
findCountByParam
({
visitTime
:{
"$gt"
:
lastYearMs
,
"$lt"
:
startMs
},
fuHuaQiUscc
});
let
thisYearCount
=
dangQianCount
+
liShiCount
;
let
yearToYear
=
0
;
if
(
thisYearCount
&&
lastYearCount
)
{
yearToYear
=
Math
.
ceil
((
thisYearCount
-
lastYearCount
)
/
lastYearCount
*
100
)
}
}
...
...
src/data/fuHuaQi/track.ts
View file @
a70931c9
/**
* 跟踪
*/
import
{
Schema
}
from
'mongoose'
;
import
{
baseDB
}
from
'../../db/mongo/dbInit'
;
const
trackSchema
=
new
Schema
({
id
:
String
,
//标识
fuHuaQiUscc
:
String
,
//孵化器uscc
uscc
:{
type
:
String
,
index
:
true
},
//企业uscc
enterpriseName
:
String
,
trackType
:
Number
,
//跟踪类型 VISITENTERPRISETYPE
content
:
String
//内容
});
var
trackModel
;
export
function
initModel
(){
trackModel
=
baseDB
.
model
(
'visittrack'
,
trackSchema
);
trackModel
.
selectOnceData
=
async
function
(
paramater
:
object
)
{
let
selectInfo
=
await
trackModel
.
findOne
(
paramater
).
exec
();
if
(
selectInfo
)
{
if
(
!
selectInfo
.
runSave
)
{
selectInfo
.
runSave
=
selectInfo
.
save
;
selectInfo
.
save
=
save
.
bind
(
selectInfo
)
}
}
return
selectInfo
;
}
}
export
async
function
save
(
throwError
=
false
)
{
if
(
!
this
.
isModified
())
return
;
await
this
.
runSave
({
validateBeforeSave
:
false
}).
catch
(
err
=>
{
console
.
log
(
err
);
});
}
/**
* 查询孵化器分数信息
* @param uscc 孵化器统一信用代码
* @returns
*/
export
async
function
findOne
(
param
)
{
return
await
trackModel
.
selectOnceData
(
param
);
}
/**通过条件查询孵化器得分信息 */
export
async
function
findByParam
(
param
)
{
return
await
trackModel
.
find
(
param
);
}
export
async
function
findCountByParam
(
param
)
{
return
await
trackModel
.
find
(
param
).
countDocuments
();
}
export
async
function
createDataByParam
(
param
)
{
return
await
trackModel
.
create
(
param
);
}
export
async
function
removeOneData
(
id
:
string
)
{
return
await
trackModel
.
deleteOne
({
id
});
}
\ No newline at end of file
src/db/mongo/tableInit.ts
View file @
a70931c9
...
...
@@ -42,6 +42,7 @@ import * as chartModel from "../../data/guanWeiHui/chart";
import
*
as
leaseModel
from
"../../data/lease"
;
import
*
as
visitModel
from
"../../data/fuHuaQi/visit"
;
import
*
as
demandModel
from
"../../data/fuHuaQi/demand"
;
import
*
as
trackModel
from
"../../data/fuHuaQi/track"
;
...
...
@@ -88,4 +89,5 @@ export async function initTable() {
leaseModel
.
initModel
();
visitModel
.
initModel
();
demandModel
.
initModel
();
trackModel
.
initModel
();
}
\ No newline at end of file
src/routers/mobileClient/visit.ts
View file @
a70931c9
...
...
@@ -24,9 +24,9 @@ export function setRouter(httpServer) {
httpServer
.
post
(
'/fuhuaqi/visit/info'
,
checkFuHuaQiToken
,
asyncHandler
(
visit_info
));
httpServer
.
post
(
'/fuhuaqi/visit/update/state'
,
checkFuHuaQiToken
,
asyncHandler
(
visit_update_state
));
//
httpServer.post('/fuhuaqi/visit/track/add', checkFuHuaQiToken, asyncHandler(visit_track_add));
// httpServer.post('/fuhuaqi/visit/track
/log/statis', checkFuHuaQiToken, asyncHandler(visit_track_log_statis));
// httpServer.post('/fuhuaqi/visit/
track/
log/list', checkFuHuaQiToken, asyncHandler(visit_track_log_list));
httpServer
.
post
(
'/fuhuaqi/visit/track/add'
,
checkFuHuaQiToken
,
asyncHandler
(
visit_track_add
));
httpServer
.
post
(
'/fuhuaqi/visit
/log/statis'
,
checkFuHuaQiToken
,
asyncHandler
(
visit_track_log_statis
));
// httpServer.post('/fuhuaqi/visit/log/list', checkFuHuaQiToken, asyncHandler(visit_track_log_list));
}
...
...
@@ -130,29 +130,29 @@ async function visit_update_state(req, res) {
let
{
id
,
state
}
=
eccReqParamater
(
reqConf
,
req
.
body
);
const
Uscc
=
req
.
headers
.
uscc
;
let
userInfo
=
await
visitBiz
.
visit
_update_s
tate
(
id
,
state
);
let
userInfo
=
await
visitBiz
.
visit
UpdateS
tate
(
id
,
state
);
res
.
success
(
userInfo
);
}
//
async function visit_track_add(req, res) {
// let reqConf = {
};
// let {
} = eccReqParamater(reqConf, req.body);
// const
Uscc = req.headers.uscc;
async
function
visit_track_add
(
req
,
res
)
{
let
reqConf
=
{
uscc
:
"String"
,
trackType
:
"Number"
,
content
:
"String"
};
let
{
uscc
,
trackType
,
content
}
=
eccReqParamater
(
reqConf
,
req
.
body
);
const
fhq
Uscc
=
req
.
headers
.
uscc
;
// let userInfo = await .(
);
//
res.success(userInfo);
//
}
let
userInfo
=
await
visitBiz
.
visitTrackAdd
(
fhqUscc
,
uscc
,
trackType
,
content
);
res
.
success
(
userInfo
);
}
// async function visit_track
_log_statis(req, res) {
//
let reqConf = {};
//
let {} = eccReqParamater(reqConf, req.body);
//
const Uscc = req.headers.uscc;
async
function
visit
_log_statis
(
req
,
res
)
{
let
reqConf
=
{};
let
{}
=
eccReqParamater
(
reqConf
,
req
.
body
);
const
Uscc
=
req
.
headers
.
uscc
;
//
let userInfo = await .();
//
res.success(userInfo);
//
}
let
userInfo
=
await
.();
res
.
success
(
userInfo
);
}
// async function visit_track_log_list(req, res) {
...
...
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