|  |  | @ -377,7 +377,7 @@ module.exports = function (app, opts) { | 
			
		
	
		
			
				
					|  |  |  |                            dataAlarms = await clickHouse.dataAlarm.query(` | 
			
		
	
		
			
				
					|  |  |  |                               SELECT * FROM alarms | 
			
		
	
		
			
				
					|  |  |  |                                  WHERE  | 
			
		
	
		
			
				
					|  |  |  |                                     ${/*`'State NOT IN (3, 4) AND '`*/''} | 
			
		
	
		
			
				
					|  |  |  |                                     ${`'State NOT IN (3, 4) AND '`} | 
			
		
	
		
			
				
					|  |  |  |                                     StructureId IN (${searchStrucIds.join(',')}) | 
			
		
	
		
			
				
					|  |  |  |                                     ${dataAlarmOption.length ? ' AND ' + dataAlarmOption.join(' AND ') : ''} | 
			
		
	
		
			
				
					|  |  |  |                                  ORDER BY StartTime DESC | 
			
		
	
	
		
			
				
					|  |  | @ -674,12 +674,14 @@ module.exports = function (app, opts) { | 
			
		
	
		
			
				
					|  |  |  |                            const receiverRes = | 
			
		
	
		
			
				
					|  |  |  |                               c.receiverPepUserId.length ? | 
			
		
	
		
			
				
					|  |  |  |                                  await clickHouse.pepEmis.query(` | 
			
		
	
		
			
				
					|  |  |  |                                     SELECT email FROM user WHERE id IN (${c.receiverPepUserId.join(',')},-1) | 
			
		
	
		
			
				
					|  |  |  |                                     SELECT id, email FROM user WHERE id IN (${c.receiverPepUserId.join(',')},-1) | 
			
		
	
		
			
				
					|  |  |  |                                  `).toPromise()
 | 
			
		
	
		
			
				
					|  |  |  |                                  : [] | 
			
		
	
		
			
				
					|  |  |  |                            let receiverId = [] | 
			
		
	
		
			
				
					|  |  |  |                            const emails = receiverRes.reduce((arr, r) => { | 
			
		
	
		
			
				
					|  |  |  |                               if (r.email) { | 
			
		
	
		
			
				
					|  |  |  |                                  arr.push(r.email) | 
			
		
	
		
			
				
					|  |  |  |                                  receiverId.push(r.id) | 
			
		
	
		
			
				
					|  |  |  |                               } | 
			
		
	
		
			
				
					|  |  |  |                               return arr | 
			
		
	
		
			
				
					|  |  |  |                            }, []) | 
			
		
	
	
		
			
				
					|  |  | @ -690,6 +692,14 @@ module.exports = function (app, opts) { | 
			
		
	
		
			
				
					|  |  |  |                                  text: '', | 
			
		
	
		
			
				
					|  |  |  |                                  html: html | 
			
		
	
		
			
				
					|  |  |  |                               }) | 
			
		
	
		
			
				
					|  |  |  |                               await models.EmailSendLog.create({ | 
			
		
	
		
			
				
					|  |  |  |                                  time: moment().format(), | 
			
		
	
		
			
				
					|  |  |  |                                  pushConfigId: c.id, | 
			
		
	
		
			
				
					|  |  |  |                                  tactics: c.tactics, | 
			
		
	
		
			
				
					|  |  |  |                                  tacticsParams: c.tacticsParams, | 
			
		
	
		
			
				
					|  |  |  |                                  projectCorrelationId: pomsProjectId, | 
			
		
	
		
			
				
					|  |  |  |                                  toPepUserIds: receiverId | 
			
		
	
		
			
				
					|  |  |  |                               }) | 
			
		
	
		
			
				
					|  |  |  |                            } | 
			
		
	
		
			
				
					|  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |                      } | 
			
		
	
	
		
			
				
					|  |  | 
 |