Subversion Repositories SmartDukaan

Rev

Rev 30982 | Rev 31010 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 30982 Rev 31008
Line 23... Line 23...
23
import org.springframework.context.annotation.Primary;
23
import org.springframework.context.annotation.Primary;
24
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
24
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
25
import org.springframework.core.io.ClassPathResource;
25
import org.springframework.core.io.ClassPathResource;
26
import org.springframework.mail.javamail.JavaMailSender;
26
import org.springframework.mail.javamail.JavaMailSender;
27
import org.springframework.mail.javamail.JavaMailSenderImpl;
27
import org.springframework.mail.javamail.JavaMailSenderImpl;
28
import org.springframework.scheduling.annotation.EnableScheduling;
-
 
29
import org.springframework.ui.velocity.VelocityEngineFactoryBean;
28
import org.springframework.ui.velocity.VelocityEngineFactoryBean;
30
 
29
 
31
import java.io.FileInputStream;
30
import java.io.FileInputStream;
32
import java.io.IOException;
31
import java.io.IOException;
33
import java.time.LocalDate;
32
import java.time.LocalDate;
-
 
33
import java.time.LocalDateTime;
-
 
34
import java.time.YearMonth;
34
import java.util.Arrays;
35
import java.util.Arrays;
35
import java.util.List;
36
import java.util.List;
36
import java.util.Properties;
37
import java.util.Properties;
37
import java.util.stream.Collectors;
38
import java.util.stream.Collectors;
38
 
39
 
39
@SpringBootApplication
40
@SpringBootApplication
40
//@EnableCaching
41
//@EnableCaching
41
@EnableScheduling
42
//@EnableScheduling
42
@ComponentScan("com.smartdukaan.cron.*, com.spice.profitmandi.common.*")
43
@ComponentScan("com.smartdukaan.cron.*, com.spice.profitmandi.common.*")
43
public class Application implements ApplicationRunner {
44
public class Application implements ApplicationRunner {
44
 
45
 
45
	private static final Logger LOGGER = LogManager.getLogger(Application.class);
46
	private static final Logger LOGGER = LogManager.getLogger(Application.class);
46
 
47
 
Line 88... Line 89...
88
	}
89
	}
89
 
90
 
90
	@Bean(name = "veloctyEngine")
91
	@Bean(name = "veloctyEngine")
91
	public VelocityEngine velocityEngine() throws VelocityException, IOException {
92
	public VelocityEngine velocityEngine() throws VelocityException, IOException {
92
		VelocityEngineFactoryBean factory = new VelocityEngineFactoryBean();
93
		VelocityEngineFactoryBean factory = new VelocityEngineFactoryBean();
93
		// Properties props = new Properties();
-
 
94
		// props.put("resource.loader", "file");
-
 
95
 
-
 
96
		// props.put("file.resource.loader.description", "Velocity File Resource
-
 
97
		// Loader");
-
 
98
		// props.put("file.resource.loader.class",
-
 
99
		// "org.apache.velocity.runtime.resource.loader.FileResourceLoader");
-
 
100
		// props.put("file.resource.loader.cache", true);
-
 
101
		// props.put("file.resource.loader.path", ".");
-
 
102
 
94
 
103
		Properties velocityProperties = new Properties();
95
		Properties velocityProperties = new Properties();
104
		velocityProperties.put("resource.loader", "class");
96
		velocityProperties.put("resource.loader", "class");
105
		velocityProperties.put("class.resource.loader.class",
97
		velocityProperties.put("class.resource.loader.class",
106
				"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
98
				"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
Line 861... Line 853...
861
			}
853
			}
862
			// sendPartnerInvestment
854
			// sendPartnerInvestment
863
			if (args.containsOption("11")) {
855
			if (args.containsOption("11")) {
864
				scheduledTasks.sendPartnerInvestmentDetails();
856
				scheduledTasks.sendPartnerInvestmentDetails();
865
			}
857
			}
-
 
858
			if (args.containsOption("sendCreditNote")) {
-
 
859
				LocalDateTime localDateTime = LocalDateTime.now().minusDays(10);
-
 
860
				YearMonth yearMonth = YearMonth.from(localDateTime);
-
 
861
				/*if (localDateTime.toLocalDate().equals(yearMonth.atEndOfMonth().getDayOfMonth()) && Arrays.asList(20,21,22,23).contains(localDateTime.getHour())) {
-
 
862
					scheduledTasks.sendCreditNote(yearMonth);
-
 
863
				}*/
-
 
864
				scheduledTasks.sendCreditNote(yearMonth);
-
 
865
			}
866
			System.exit(0);
866
			System.exit(0);
867
		}
867
		}
868
	}
868
	}
869
}
869
}
870
870