package com.zy.ints.task.handler;
|
|
import com.zy.asrs.task.AbstractHandler;
|
import com.zy.asrs.task.core.ReturnT;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.stereotype.Service;
|
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
/**
|
* ERP请求日志删除
|
* Created by vincent on 2021/9/19
|
*/
|
@Service
|
public class ErpreqLogHandler extends AbstractHandler<String> {
|
@Autowired
|
private JdbcTemplate jdbcTemplate;
|
|
@Transactional
|
public ReturnT<String> start() {
|
try {
|
// 删除日期超过10天的请求日志记录
|
int deleteCount = jdbcTemplate.update("delete from ints_erpreq_log where dateadd(day,10,appe_time) <= getdate();");
|
if (deleteCount < 0) {
|
exceptionHandle("删除ERP请求日志超过10天记录错误 ! ");
|
}
|
} catch (Exception e) {
|
e.printStackTrace();
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
return FAIL.setMsg(e.getMessage());
|
}
|
return SUCCESS;
|
}
|
}
|