| | |
| | | import com.yssh.service.WarningAnalyseService; |
| | | import com.yssh.service.XlsReportService; |
| | | import com.yssh.utils.CacheUtils; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import com.yssh.utils.StringUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.boot.ApplicationArguments; |
| | | import org.springframework.boot.ApplicationRunner; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | import com.yssh.service.DictRecordService; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | |
| | | @Component |
| | | public class InitConfig implements ApplicationRunner { |
| | |
| | | @Resource |
| | | XlsReportService xlsReportService; |
| | | |
| | | @Resource |
| | | ScheduleConfig config; |
| | | static String date; |
| | | |
| | | // YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss" |
| | | static SimpleDateFormat YYYY_MM_DD_HH_MM_SS = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | @Value("${dat.date}") |
| | | public void setDate(String date) { |
| | | InitConfig.date = date; |
| | | } |
| | | |
| | | public static Date getDate() { |
| | | if (StringUtils.isEmpty(date)) { |
| | | return new Date(); |
| | | } |
| | | |
| | | try { |
| | | return YYYY_MM_DD_HH_MM_SS.parse(date); |
| | | |
| | | //Calendar calendar = Calendar.getInstance(); |
| | | //calendar.setTime(d); |
| | | //calendar.set(Calendar.YEAR, d.getYear()); |
| | | //calendar.set(Calendar.MONTH, d.getMonth()); |
| | | //calendar.set(Calendar.DAY_OF_MONTH, d.getDay()); |
| | | |
| | | //return calendar.getTime(); |
| | | } catch (Exception ex) { |
| | | return new Date(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void run(ApplicationArguments args) throws Exception { |
| | |
| | | } |
| | | |
| | | private void test() { |
| | | //config.corpReserveDataSync(); |
| | | |
| | | //task.createMonthReport(); |
| | | //task.corpReserveDataSync(); |
| | | |
| | | //warningAnalyseService.warningOperationStorage(cal.getTime()); |
| | | |
| | | /*Calendar cal1 = Calendar.getInstance(); |