chore: copy kept Tastefully modules and portals into Co-Lite
Backend modules from tastefully 8bd93d15: core-libs, core-session, api-gateway, mobile-api, services-auth, services-system, services-counter, services-member, services-log, services-email. solvway-admin-portal from babyboo f64d096ea, solvway-customer-portal from tastefully 8bd93d15. Copied as tracked files only. Literal secrets replaced with environment placeholders: - services-email: SMTP_PASSWORD, MAILGUN_API_KEY, SENDGRID_API_KEY, MAILJET_API_KEY, MAILJET_SECRET_KEY (optional, empty default) - services-system: JUMIO_TOKEN, JUMIO_SECRET (optional) - services-auth: USER_AUTH_API_SECRET (required); commented JWT secret removed - core-libs: JWT_TOKEN default removed (required), XXL_JOB_TOKEN default removed, ipgeolocation key read from IPGEOLOCATION_API_KEY - services-system EkycAppConfig: commented Jumio credentials removed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
1 parent
e396568cc3
commit
5ee51d1913
2918 files changed
+302373
-3
No files matched your search
+57
@@ -0,0 +1,57 @@
|
||||
package com.solvway.services.log.scheduler;
|
||||
|
||||
import com.solvway.core.utils.DateTimeFormatterUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Service
|
||||
@EnableScheduling
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class ResponseTimeLogArchiveScheduler {
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
private DateTimeFormatterUtil dateTimeFormatterUtil;
|
||||
|
||||
@Scheduled(cron = "0 0 4 * * ?")
|
||||
public void processResponseTimeLogArchive() throws ParseException {
|
||||
LocalDate d = LocalDate.now().minusDays(1);
|
||||
long executeTime = System.currentTimeMillis();
|
||||
log.info("Processing ResponseTimeLog: {}", d);
|
||||
String tableName = getTableName(d);
|
||||
insertRecords(tableName, d);
|
||||
deleteRecords(tableName, d);
|
||||
log.info("Processed ResponseTimeLog: {}; {}ms", d, System.currentTimeMillis() - executeTime);
|
||||
}
|
||||
|
||||
public String getTableName(LocalDate date) throws ParseException {
|
||||
String dateStr= dateTimeFormatterUtil.format(date, "yyyyMM");
|
||||
String tableName = "response_time_archived_"+dateStr;
|
||||
String SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS "+tableName+" LIKE `response_time`;";
|
||||
log.info("Generating Table : {}", SQL_CREATE_TABLE);
|
||||
jdbcTemplate.execute(SQL_CREATE_TABLE);
|
||||
return tableName;
|
||||
}
|
||||
public void insertRecords(String tableName, LocalDate d) throws ParseException {
|
||||
long executeTime = System.currentTimeMillis();
|
||||
String SQL = "INSERT IGNORE INTO "+tableName + " SELECT * FROM response_time "
|
||||
+ " WHERE request_time between '"+dateTimeFormatterUtil.format(d.atStartOfDay(), "yyyy-MM-dd HH:mm:ss")+"' "
|
||||
+ " and '" + dateTimeFormatterUtil.format(d.atTime(23, 59, 59), "yyyy-MM-dd HH:mm:ss")+"' ;";
|
||||
log.info("Executing insert: {}", SQL);
|
||||
jdbcTemplate.update(SQL);
|
||||
log.info("Time used executing insert: {}; {}ms", d, System.currentTimeMillis() - executeTime);
|
||||
}
|
||||
public void deleteRecords(String tableName, LocalDate d) {
|
||||
long executeTime = System.currentTimeMillis();
|
||||
String SQL=" DELETE `response_time` FROM `response_time` INNER JOIN " + tableName + " WHERE response_time.id = "+tableName+".id;";
|
||||
log.info("Executing delete: {}", SQL);
|
||||
jdbcTemplate.update(SQL);
|
||||
log.info("Time used executing delete: {}; {}ms", d.toString(), System.currentTimeMillis() - executeTime);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user