| 
 |||||||
| 
    Создание допа с отправкой уведомления 
        
        
		  Время создания: 28.11.2019 12:00		  
		 
		
		 		
		
		 		
		
				  
		    Раздел: INFO - JOB - CUBA - GroovyScripts		   
		
		
		 		 
		  Запись: wwwlir/Tetra/master/base/1574913604v8nl5yha20/text.html на raw.githubusercontent.com		  
		 
		
				   | 
 |||||||
| 
    | 
 |||||||
| 
    import com.groupstp.rtneo.entity.*; import com.haulmont.cuba.core.global.*; import com.groupstp.rtneo.service.*; DataManager dataManager = AppBeans.get(DataManager.NAME); ContractService contractService = AppBeans.get(ContractService.NAME); NotificationService notificationService = AppBeans.get(NotificationService.NAME); NotificationTemplate notification = dataManager.load(NotificationTemplate.class).id(UUID.fromString('43721f61-24fa-6b9b-7fbc-fdb3838b0e0a')).view("notificationTemplate-edit").optional().orElse(null) List<ExtUser> users = [] def i = 0 List<Contragent> contragents = dataManager.load(Contragent.class) .query('select c from rtneo$Contragent c where size(c.realEstates) > 0 and size(c.contracts) <= 1 order by c.id') .firstResult(i*100) .maxResults(100) .view("contragent-create-contract") .list() for(Contragent contragent : contragents){ contractService.checkContract(contragent, false, true) def user = dataManager.load(ExtUser.class) .query('select u.user from rtneo$Contragent u where u.id = :id') .parameter("id", contragent.getId()) .view("_local") .optional() .orElse(null) if(user != null)users.add(user) } 
 notification.setReceivers(users) notificationService.send(notification)  | 
 |||||||
| 
    
 
 Так же в этом разделе:
  
  
  | 
 |||||||
      
   | 
 |||||||
   
   
  | 
 |||||||
   
  |