明树Git Lab
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
L
letian_backend
Project
Project
Details
Activity
Releases
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
zengfanpei
letian_backend
Commits
0fd9bab5
Commit
0fd9bab5
authored
Jan 08, 2026
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
67a8b13d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
78 additions
and
11 deletions
+78
-11
productDeepController.js
controller/productDeepController.js
+9
-1
productDirPlantController.js
controller/productDirPlantController.js
+17
-1
productPreController.js
controller/productPreController.js
+8
-1
productTracController.js
controller/productTracController.js
+35
-7
productltController.js
controller/productltController.js
+9
-1
No files found.
controller/productDeepController.js
View file @
0fd9bab5
...
@@ -27,7 +27,15 @@ async function listDeepPlant(req, res, next) {
...
@@ -27,7 +27,15 @@ async function listDeepPlant(req, res, next) {
}
}
const
count
=
await
DB
.
ProductDeep
.
countDocuments
(
search
);
const
count
=
await
DB
.
ProductDeep
.
countDocuments
(
search
);
let
list
=
await
DB
.
ProductDeep
.
find
(
search
).
populate
({
path
:
"productPhotos2"
}).
populate
({
path
:
"homepageCarouselImgs"
}).
populate
({
path
:
"monitorInfo.device"
}).
sort
({
_id
:
-
1
}).
skip
(
skip
).
limit
(
pageSize
).
lean
().
exec
();
let
list
=
await
DB
.
ProductDeep
.
find
(
search
).
populate
({
path
:
"productPhotos2"
}).
populate
({
path
:
"homepageCarouselImgs"
}).
populate
({
path
:
"monitorInfo.device"
}).
sort
({
_id
:
-
1
}).
skip
(
skip
).
limit
(
pageSize
).
lean
().
exec
();
res
.
sendData
({
count
,
list
});
let
namemap
=
await
getSccjMap
();
let
ret
=
[];
for
(
let
index
=
0
;
index
<
list
.
length
;
index
++
)
{
const
element
=
list
[
index
];
element
.
agrPlantBase
=
namemap
(
element
.
agrPlantBase
);
element
.
workshop
=
namemap
(
element
.
workshop
);
ret
.
push
(
element
);
}
res
.
sendData
({
count
,
list
:
ret
});
}
catch
(
error
)
{
}
catch
(
error
)
{
next
(
error
);
next
(
error
);
}
}
...
...
controller/productDirPlantController.js
View file @
0fd9bab5
/**--------------------------------------------直接种植--------------------------------------------------------- */
/**--------------------------------------------直接种植--------------------------------------------------------- */
async
function
createDirectPlant
(
req
,
res
,
next
)
{
async
function
createDirectPlant
(
req
,
res
,
next
)
{
try
{
try
{
//
//
...
@@ -28,7 +30,14 @@ async function listDirectPlant(req, res, next) {
...
@@ -28,7 +30,14 @@ async function listDirectPlant(req, res, next) {
const
count
=
await
DB
.
ProductPlant
.
countDocuments
(
search
);
const
count
=
await
DB
.
ProductPlant
.
countDocuments
(
search
);
let
list
=
await
DB
.
ProductPlant
.
find
(
search
).
populate
({
path
:
"plantPlan"
}).
populate
({
path
:
"homepageCarouselImgs"
}).
populate
({
path
:
"productPhotos2"
}).
populate
({
path
:
"monitorInfo.device"
}).
sort
({
_id
:
-
1
}).
skip
(
skip
).
limit
(
pageSize
).
lean
().
exec
();
let
list
=
await
DB
.
ProductPlant
.
find
(
search
).
populate
({
path
:
"plantPlan"
}).
populate
({
path
:
"homepageCarouselImgs"
}).
populate
({
path
:
"productPhotos2"
}).
populate
({
path
:
"monitorInfo.device"
}).
sort
({
_id
:
-
1
}).
skip
(
skip
).
limit
(
pageSize
).
lean
().
exec
();
res
.
sendData
({
count
,
list
});
let
namemap
=
await
getSccjMap
();
let
ret
=
[];
for
(
let
index
=
0
;
index
<
list
.
length
;
index
++
)
{
const
element
=
list
[
index
];
element
.
agrPlantBase
=
namemap
(
element
.
agrPlantBase
);
ret
.
push
(
element
);
}
res
.
sendData
({
count
,
list
:
ret
});
}
catch
(
error
)
{
}
catch
(
error
)
{
next
(
error
);
next
(
error
);
}
}
...
@@ -101,6 +110,13 @@ async function importExcel(req, res, next) {
...
@@ -101,6 +110,13 @@ async function importExcel(req, res, next) {
}
}
}
}
async
function
getSccjMap
()
{
let
list
=
await
DB
.
Sccj
.
findAll
({
del
:
0
});
let
namemap
=
{};
list
.
map
(
o
=>
{
namemap
(
o
.
key
)
=
o
.
name
});
return
map
;
}
module
.
exports
=
{
module
.
exports
=
{
createDirectPlant
,
createDirectPlant
,
listDirectPlant
,
listDirectPlant
,
...
...
controller/productPreController.js
View file @
0fd9bab5
...
@@ -28,7 +28,14 @@ async function listPrePlant(req, res, next) {
...
@@ -28,7 +28,14 @@ async function listPrePlant(req, res, next) {
}
}
const
count
=
await
DB
.
ProductPre
.
countDocuments
(
search
);
const
count
=
await
DB
.
ProductPre
.
countDocuments
(
search
);
let
list
=
await
DB
.
ProductPre
.
find
(
search
).
populate
({
path
:
"productPhotos2"
}).
populate
({
path
:
"sourcePlantProduct"
}).
populate
({
path
:
"homepageCarouselImgs"
}).
populate
({
path
:
"monitorInfo.device"
}).
sort
({
_id
:
-
1
}).
skip
(
skip
).
limit
(
pageSize
).
lean
().
exec
();
let
list
=
await
DB
.
ProductPre
.
find
(
search
).
populate
({
path
:
"productPhotos2"
}).
populate
({
path
:
"sourcePlantProduct"
}).
populate
({
path
:
"homepageCarouselImgs"
}).
populate
({
path
:
"monitorInfo.device"
}).
sort
({
_id
:
-
1
}).
skip
(
skip
).
limit
(
pageSize
).
lean
().
exec
();
res
.
sendData
({
count
,
list
});
let
namemap
=
await
getSccjMap
();
let
ret
=
[];
for
(
let
index
=
0
;
index
<
list
.
length
;
index
++
)
{
const
element
=
list
[
index
];
element
.
agrPlantBase
=
namemap
(
element
.
agrPlantBase
);
ret
.
push
(
element
);
}
res
.
sendData
({
count
,
list
:
ret
});
}
catch
(
error
)
{
}
catch
(
error
)
{
next
(
error
);
next
(
error
);
}
}
...
...
controller/productTracController.js
View file @
0fd9bab5
...
@@ -36,7 +36,8 @@ async function listTraceCode(req, res, next) {
...
@@ -36,7 +36,8 @@ async function listTraceCode(req, res, next) {
search
.
batchNumber
=
{
$regex
:
req
.
body
.
batchNumber
}
search
.
batchNumber
=
{
$regex
:
req
.
body
.
batchNumber
}
}
}
const
count
=
await
DB
.
ProTraceCode
.
countDocuments
(
search
);
const
count
=
await
DB
.
ProTraceCode
.
countDocuments
(
search
);
let
list
=
await
DB
.
ProTraceCode
.
find
(
search
).
sort
({
_id
:
-
1
}).
skip
(
skip
).
limit
(
pageSize
).
populate
({
path
:
"rawMatCul.proSteps.img"
}).
populate
({
path
:
"proProcess.proSteps.img"
}).
populate
({
path
:
"cjVideo"
}).
populate
({
path
:
"qualityInsReportImgs"
}).
populate
({
path
:
"flourMerchantImgs"
}).
populate
({
path
:
"pesticidetImgs"
}).
lean
();
let
list
=
await
DB
.
ProTraceCode
.
find
(
search
).
sort
({
_id
:
-
1
}).
skip
(
skip
).
limit
(
pageSize
).
populate
({
path
:
"rawMatCul.proSteps.img"
}).
populate
({
path
:
"proProcess.proSteps.img"
}).
populate
({
path
:
"cjVideo"
}).
populate
({
path
:
"qualityInsReportImgs"
}).
populate
({
path
:
"flourMerchantImgs"
}).
populate
({
path
:
"pesticidetImgs"
}).
lean
();
let
namemap
=
await
getSccjMap
();
let
ret
=
[];
let
ret
=
[];
for
(
let
index
=
0
;
index
<
list
.
length
;
index
++
)
{
for
(
let
index
=
0
;
index
<
list
.
length
;
index
++
)
{
const
element
=
list
[
index
];
const
element
=
list
[
index
];
...
@@ -49,6 +50,15 @@ async function listTraceCode(req, res, next) {
...
@@ -49,6 +50,15 @@ async function listTraceCode(req, res, next) {
}
else
if
(
element
.
source
&&
element
.
type
==
4
)
{
}
else
if
(
element
.
source
&&
element
.
type
==
4
)
{
element
.
source
=
await
DB
.
ProductLt
.
findOne
({
_id
:
element
.
source
}).
lean
();
element
.
source
=
await
DB
.
ProductLt
.
findOne
({
_id
:
element
.
source
}).
lean
();
}
}
element
.
workshop
=
namemap
(
element
.
workshop
);
element
.
agrPlantBase
=
namemap
(
element
.
agrPlantBase
);
if
(
element
.
rawMatCul
&&
element
.
rawMatCul
.
proAdr
)
{
element
.
rawMatCul
.
proAdr
=
namemap
(
element
.
rawMatCul
.
proAdr
)
}
if
(
element
.
proProcess
&&
element
.
proProcess
.
proAdr
)
{
element
.
proProcess
.
proAdr
=
namemap
(
element
.
proProcess
.
proAdr
)
}
ret
.
push
(
element
);
ret
.
push
(
element
);
}
}
res
.
sendData
({
count
,
list
:
ret
});
res
.
sendData
({
count
,
list
:
ret
});
...
@@ -135,17 +145,30 @@ async function getTraceCode2(req, res, next) {
...
@@ -135,17 +145,30 @@ async function getTraceCode2(req, res, next) {
console
.
log
(
sourceId
,
"==="
)
console
.
log
(
sourceId
,
"==="
)
let
source
=
null
;
let
source
=
null
;
if
(
traccode
.
type
&&
traccode
.
type
==
1
)
{
if
(
traccode
.
type
&&
traccode
.
type
==
1
)
{
source
=
await
DB
.
ProductPlant
.
findOne
({
_id
:
sourceId
}
,
{
productName
:
1
,
productSpec
:
1
,
manufactureDate
:
1
,
agrPlantBase
:
1
,
homepageCarouselImgs
:
1
}
).
populate
({
path
:
"homepageCarouselImgs"
}).
lean
();
source
=
await
DB
.
ProductPlant
.
findOne
({
_id
:
sourceId
}).
populate
({
path
:
"homepageCarouselImgs"
}).
lean
();
}
else
if
(
traccode
.
type
&&
traccode
.
type
==
2
)
{
}
else
if
(
traccode
.
type
&&
traccode
.
type
==
2
)
{
source
=
await
DB
.
ProductPre
.
findOne
({
_id
:
sourceId
}
,
{
preProductName
:
1
,
productSpec
:
1
,
manufactureDate
:
1
,
agrPlantBase
:
1
,
homepageCarouselImgs
:
1
}
).
populate
({
path
:
"homepageCarouselImgs"
}).
lean
();
source
=
await
DB
.
ProductPre
.
findOne
({
_id
:
sourceId
}).
populate
({
path
:
"homepageCarouselImgs"
}).
lean
();
}
else
if
(
traccode
.
type
&&
traccode
.
type
==
3
)
{
}
else
if
(
traccode
.
type
&&
traccode
.
type
==
3
)
{
source
=
await
DB
.
ProductDeep
.
findOne
({
_id
:
sourceId
}
,
{
preProductName
:
1
,
productSpec
:
1
,
manufactureDate
:
1
,
agrPlantBase
:
1
,
homepageCarouselImgs
:
1
}
).
populate
({
path
:
"homepageCarouselImgs"
}).
lean
();
source
=
await
DB
.
ProductDeep
.
findOne
({
_id
:
sourceId
}).
populate
({
path
:
"homepageCarouselImgs"
}).
lean
();
}
else
if
(
traccode
.
type
&&
traccode
.
type
==
4
)
{
}
else
if
(
traccode
.
type
&&
traccode
.
type
==
4
)
{
source
=
await
DB
.
ProductLt
.
findOne
({
_id
:
sourceId
}).
populate
({
path
:
"homepageCarouselImgs"
}).
lean
();
source
=
await
DB
.
ProductLt
.
findOne
({
_id
:
sourceId
}).
populate
({
path
:
"homepageCarouselImgs"
}).
lean
();
}
}
source
.
manufactureDate
=
traccode
.
manufactureDate
||
source
.
manufactureDate
;
source
.
manufactureDate
=
traccode
.
manufactureDate
||
source
.
manufactureDate
;
source
.
agrPlantBase
=
traccode
.
workshop
||
source
.
agrPlantBase
;
source
.
agrPlantBase
=
traccode
.
workshop
||
source
.
agrPlantBase
;
traccode
.
source
=
source
;
traccode
.
source
=
source
;
let
namemap
=
await
getSccjMap
();
source
.
workshop
=
namemap
(
source
.
workshop
);
source
.
agrPlantBase
=
namemap
(
source
.
agrPlantBase
);
traccode
.
agrPlantBase
=
namemap
(
traccode
.
agrPlantBase
);
traccode
.
agrPlantBase
=
namemap
(
traccode
.
agrPlantBase
);
if
(
traccode
.
rawMatCul
&&
traccode
.
rawMatCul
.
proAdr
)
{
traccode
.
rawMatCul
.
proAdr
=
namemap
(
traccode
.
rawMatCul
.
proAdr
)
}
if
(
traccode
.
proProcess
&&
traccode
.
proProcess
.
proAdr
)
{
traccode
.
proProcess
.
proAdr
=
namemap
(
traccode
.
proProcess
.
proAdr
)
}
/**
/**
* 查询一次则给这条数据加1
* 查询一次则给这条数据加1
*/
*/
...
@@ -162,7 +185,7 @@ async function getsuyuanBase(req, res, next) {
...
@@ -162,7 +185,7 @@ async function getsuyuanBase(req, res, next) {
if
(
!
req
.
body
.
_id
)
{
if
(
!
req
.
body
.
_id
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
}
let
traccode
=
await
DB
.
ProTraceCode
.
findOne
({
_id
:
req
.
body
.
_id
}
,
{
type
:
1
,
source
:
1
,
_id
:
1
,
batchNumber
:
1
,
manufactureDate
:
1
,
rawMatCul
:
1
,
proProcess
:
1
}
).
populate
({
path
:
"proProcess.proSteps.img"
}).
populate
({
path
:
"rawMatCul.proSteps.img"
}).
lean
();
let
traccode
=
await
DB
.
ProTraceCode
.
findOne
({
_id
:
req
.
body
.
_id
}).
populate
({
path
:
"proProcess.proSteps.img"
}).
populate
({
path
:
"rawMatCul.proSteps.img"
}).
lean
();
if
(
!
(
traccode
&&
traccode
.
_id
&&
traccode
.
source
))
{
if
(
!
(
traccode
&&
traccode
.
_id
&&
traccode
.
source
))
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
}
...
@@ -240,7 +263,7 @@ async function getZhijian(req, res, next) {
...
@@ -240,7 +263,7 @@ async function getZhijian(req, res, next) {
if
(
!
req
.
body
.
_id
)
{
if
(
!
req
.
body
.
_id
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
}
let
traccode
=
await
DB
.
ProTraceCode
.
findOne
({
_id
:
req
.
body
.
_id
},
{
type
:
1
,
source
:
1
,
_id
:
1
,
pesticidetImgs
:
1
,
qualityInsReportImgs
:
1
,
flourMerchantImgs
:
1
}).
populate
({
path
:
"qualityInsReportImgs"
}).
populate
({
path
:
"flourMerchantImgs"
}).
populate
({
path
:
"pesticidetImgs"
}).
lean
();
let
traccode
=
await
DB
.
ProTraceCode
.
findOne
({
_id
:
req
.
body
.
_id
},
{
type
:
1
,
source
:
1
,
_id
:
1
,
pesticidetImgs
:
1
,
qualityInsReportImgs
:
1
,
flourMerchantImgs
:
1
}).
populate
({
path
:
"qualityInsReportImgs"
}).
populate
({
path
:
"flourMerchantImgs"
}).
populate
({
path
:
"pesticidetImgs"
}).
lean
();
if
(
!
(
traccode
&&
traccode
.
_id
&&
traccode
.
source
))
{
if
(
!
(
traccode
&&
traccode
.
_id
&&
traccode
.
source
))
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
}
...
@@ -268,7 +291,12 @@ async function batchAgrEnvOnOff(req, res, next) {
...
@@ -268,7 +291,12 @@ async function batchAgrEnvOnOff(req, res, next) {
}
}
}
}
async
function
getSccjMap
()
{
let
list
=
await
DB
.
Sccj
.
findAll
({
del
:
0
});
let
namemap
=
{};
list
.
map
(
o
=>
{
namemap
(
o
.
key
)
=
o
.
name
});
return
map
;
}
module
.
exports
=
{
module
.
exports
=
{
createTraceCode
,
createTraceCode
,
...
...
controller/productltController.js
View file @
0fd9bab5
...
@@ -28,7 +28,15 @@ async function listlt(req, res, next) {
...
@@ -28,7 +28,15 @@ async function listlt(req, res, next) {
const
count
=
await
DB
.
ProductLt
.
countDocuments
(
search
);
const
count
=
await
DB
.
ProductLt
.
countDocuments
(
search
);
let
list
=
await
DB
.
ProductLt
.
find
(
search
).
populate
({
path
:
"homepageCarouselImgs"
}).
populate
({
path
:
"productPhotos2"
}).
populate
({
path
:
"monitorInfo.device"
}).
sort
({
_id
:
-
1
}).
skip
(
skip
).
limit
(
pageSize
).
lean
().
exec
();
let
list
=
await
DB
.
ProductLt
.
find
(
search
).
populate
({
path
:
"homepageCarouselImgs"
}).
populate
({
path
:
"productPhotos2"
}).
populate
({
path
:
"monitorInfo.device"
}).
sort
({
_id
:
-
1
}).
skip
(
skip
).
limit
(
pageSize
).
lean
().
exec
();
res
.
sendData
({
count
,
list
});
let
namemap
=
await
getSccjMap
();
let
ret
=
[];
for
(
let
index
=
0
;
index
<
list
.
length
;
index
++
)
{
const
element
=
list
[
index
];
element
.
agrPlantBase
=
namemap
(
element
.
agrPlantBase
);
element
.
workshop
=
namemap
(
element
.
workshop
);
ret
.
push
(
element
);
}
res
.
sendData
({
count
,
list
:
ret
});
}
catch
(
error
)
{
}
catch
(
error
)
{
next
(
error
);
next
(
error
);
}
}
...
...
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