Browse Source

使抽查确定生效获得数据

dev
巴林闲侠 1 year ago
parent
commit
26b152dbb9
  1. 10
      api/app/lib/controllers/report/index.js

10
api/app/lib/controllers/report/index.js

@ -375,8 +375,10 @@ async function spotCheck (ctx) {
throw '参数错误'
}
const prepareRes = await models.ReportSpotCheckPreview.find({
id: previewId
const prepareRes = await models.ReportSpotCheckPreview.findOne({
where: {
id: previewId
}
})
const sqlStr = `
@ -400,9 +402,7 @@ async function spotCheck (ctx) {
findUsers = userRes.map(item => {
return item.id
})
console.log('findUsers', findUsers)
let checkCount = Math.ceil(prepareRes.reportCount * (prepareRes.percentage / 100))
console.log('checkCount', checkCount)
const reportRes = findUsers.length && checkCount ? await models.Report.findAll({
where: {
reportType: 'conserve',
@ -419,7 +419,7 @@ async function spotCheck (ctx) {
id: previewId
}
})
console.log('reportRes', reportRes)
if (reportRes.length) {
let spotDate = moment().format('YYYY-MM-DD')
await models.ReportSpotCheck.bulkCreate(reportRes.map(r => {

Loading…
Cancel
Save