Commit 135c8c96 by 吕明尚

Merge branch 'dev' into test

parents 32bd89b9 4f516337
......@@ -9,89 +9,89 @@ import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.SysJobLog;
import share.system.service.SysJobLogService;
import share.system.domain.JobErrorLog;
import share.system.service.JobErrorLogService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 定时任务日志Controller
* 定时任务异常日志Controller
*
* @author wuwenlong
* @date 2024-11-15
* @date 2024-11-18
*/
@RestController
@RequestMapping("/system/sysJobLog")
public class SysJobLogController extends BaseController {
@RequestMapping("/system/jobErrorLog")
public class JobErrorLogController extends BaseController {
@Autowired
private SysJobLogService sysJobLogService;
private JobErrorLogService jobErrorLogService;
/**
* 查询定时任务日志列表
* 查询定时任务异常日志列表
*/
@PreAuthorize("@ss.hasPermi('system:sysJobLog:list')")
@PreAuthorize("@ss.hasPermi('system:jobErrorLog:list')")
@GetMapping("/list")
public TableDataInfo list(SysJobLog sysJobLog) {
public TableDataInfo list(JobErrorLog jobErrorLog) {
startPage();
List<SysJobLog> list = sysJobLogService.selectSysJobLogList(sysJobLog);
List<JobErrorLog> list = jobErrorLogService.selectJobErrorLogList(jobErrorLog);
return getDataTable(list);
}
/**
* 导出定时任务日志列表
* 导出定时任务异常日志列表
*/
@PreAuthorize("@ss.hasPermi('system:sysJobLog:export')")
@Log(title = "定时任务日志", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:jobErrorLog:export')")
@Log(title = "定时任务异常日志", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysJobLog sysJobLog) {
List<SysJobLog> list = sysJobLogService.selectSysJobLogList(sysJobLog);
ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class);
util.exportExcel(response, list, "定时任务日志数据");
public void export(HttpServletResponse response, JobErrorLog jobErrorLog) {
List<JobErrorLog> list = jobErrorLogService.selectJobErrorLogList(jobErrorLog);
ExcelUtil<JobErrorLog> util = new ExcelUtil<JobErrorLog>(JobErrorLog.class);
util.exportExcel(response, list, "定时任务异常日志数据");
}
/**
* 获取定时任务日志详细信息
* 获取定时任务异常日志详细信息
*/
@PreAuthorize("@ss.hasPermi('system:sysJobLog:query')")
@PreAuthorize("@ss.hasPermi('system:jobErrorLog:query')")
@GetMapping(value = "/{jobLogId}")
public AjaxResult getInfo(@PathVariable("jobLogId") Long jobLogId) {
return success(sysJobLogService.selectSysJobLogByJobLogId(jobLogId));
return success(jobErrorLogService.selectJobErrorLogByJobLogId(jobLogId));
}
/**
* 新增定时任务日志
* 新增定时任务异常日志
*/
@PreAuthorize("@ss.hasPermi('system:sysJobLog:add')")
@Log(title = "定时任务日志", businessType = BusinessType.INSERT)
@PreAuthorize("@ss.hasPermi('system:jobErrorLog:add')")
@Log(title = "定时任务异常日志", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysJobLog sysJobLog) {
return toAjax(sysJobLogService.insertSysJobLog(sysJobLog));
public AjaxResult add(@RequestBody JobErrorLog jobErrorLog) {
return toAjax(jobErrorLogService.insertJobErrorLog(jobErrorLog));
}
/**
* 修改定时任务日志
* 修改定时任务异常日志
*/
@PreAuthorize("@ss.hasPermi('system:sysJobLog:edit')")
@Log(title = "定时任务日志", businessType = BusinessType.UPDATE)
@PreAuthorize("@ss.hasPermi('system:jobErrorLog:edit')")
@Log(title = "定时任务异常日志", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysJobLog sysJobLog) {
return toAjax(sysJobLogService.updateSysJobLog(sysJobLog));
public AjaxResult edit(@RequestBody JobErrorLog jobErrorLog) {
return toAjax(jobErrorLogService.updateJobErrorLog(jobErrorLog));
}
/**
* 删除定时任务日志
* 删除定时任务异常日志
*/
@PreAuthorize("@ss.hasPermi('system:sysJobLog:remove')")
@Log(title = "定时任务日志", businessType = BusinessType.DELETE)
@PreAuthorize("@ss.hasPermi('system:jobErrorLog:remove')")
@Log(title = "定时任务异常日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{jobLogIds}")
public AjaxResult remove(@PathVariable Long[] jobLogIds) {
return toAjax(sysJobLogService.deleteSysJobLogByJobLogIds(jobLogIds));
return toAjax(jobErrorLogService.deleteJobErrorLogByJobLogIds(jobLogIds));
}
@DeleteMapping("/clean")
public AjaxResult clean() {
sysJobLogService.cleanJobLog();
jobErrorLogService.cleanJobLog();
return success();
}
}
......@@ -122,7 +122,7 @@ public class RedisTask {
private ConsumerSecondaryCardService consumerSecondaryCardService;
@Autowired
private SysJobLogService sysJobLogService;
private JobErrorLogService jobErrorLogService;
//15分钟的常量
......@@ -380,27 +380,20 @@ public class RedisTask {
redisUtil.set(ReceiptRdeisEnum.ROOM_EXPIRE_TIME.getValue() + sOrder.getOrderNo(), json.toString());
logger.debug("订单号为:" + sOrder.getOrderNo() + "的订单已结束,更改订单状态为已使用");
}
SysJobLog sysJobLog = new SysJobLog();
sysJobLog.setJobName("AutoAddSCleanRecords:自动添加保洁记录");
sysJobLog.setJobGroup("RedisTask");
sysJobLog.setInvokeTarget("AutoAddSCleanRecords");
sysJobLog.setJobMessage("自动添加保洁记录:" + jsonObject.toString());
sysJobLog.setStatus(YesNoEnum.no.getIndex().toString());
sysJobLogService.save(sysJobLog);
} catch (BaseException e) {
String value = redisUtil.get(String.valueOf(o));
JSONObject jsonObject = new JSONObject(value);
logger.error("订单号:" + jsonObject.getStr("orderNo") + "异常,"
+ "异常为:" + e.getMessage()
);
SysJobLog sysJobLog = new SysJobLog();
sysJobLog.setJobName("AutoAddSCleanRecords:自动添加保洁记录");
sysJobLog.setJobGroup("RedisTask");
sysJobLog.setInvokeTarget("AutoAddSCleanRecords");
sysJobLog.setJobMessage("自动添加保洁记录:" + jsonObject.toString());
sysJobLog.setStatus(YesNoEnum.yes.getIndex().toString());
sysJobLog.setExceptionInfo(e.getMessage());
sysJobLogService.save(sysJobLog);
JobErrorLog jobErrorLog = new JobErrorLog();
jobErrorLog.setJobName("自动添加保洁记录");
jobErrorLog.setJobGroup("RedisTask");
jobErrorLog.setInvokeTarget("RedisTask.AutoAddSCleanRecords");
jobErrorLog.setJobMessage("自动添加保洁记录:" + jsonObject.toString());
jobErrorLog.setStatus(YesNoEnum.yes.getIndex().toString());
jobErrorLog.setExceptionInfo(e.getMessage());
jobErrorLogService.save(jobErrorLog);
continue;
}
}
......@@ -550,7 +543,8 @@ public class RedisTask {
if (keys.size() == 0) {
return;
}
keys.stream().forEach(key -> {
for (String key : keys) {
try {
String value = redisUtil.get(String.valueOf(key));
JSONObject jsonObject = new JSONObject(value);
Date expirationTime = jsonObject.getDate("expirationTime");
......@@ -562,9 +556,23 @@ public class RedisTask {
SConsumer sConsumer = sConsumerService.getById(consumerId);
logger.debug("手机号为:{}的用户年度权益会员将在3天后失效", sConsumer.getPhone());
smsService.sendOneSms(sConsumer.getPhone(), "年度权益会员将在3天后失效,请及时续约保障权益会员的权益");
// redisUtil.delete(key);
// redisUtil.delete(key);
}
});
} catch (Exception e) {
String value = redisUtil.get(String.valueOf(key));
JSONObject jsonObject = new JSONObject(value);
JobErrorLog jobErrorLog = new JobErrorLog();
jobErrorLog.setJobName("自动发送权益会员过期短信");
jobErrorLog.setJobGroup("RedisTask");
jobErrorLog.setInvokeTarget("RedisTask.AutoEquityMembersSms");
jobErrorLog.setJobMessage("自动发送权益会员过期短信:" + jsonObject.toString());
jobErrorLog.setStatus(YesNoEnum.yes.getIndex().toString());
jobErrorLog.setExceptionInfo(e.getMessage());
jobErrorLogService.save(jobErrorLog);
continue;
}
}
logger.debug("AutoEquityMembersSms:自动发送权益会员过期短信结束");
}
......@@ -576,7 +584,8 @@ public class RedisTask {
if (keys.size() == 0) {
return;
}
keys.stream().forEach(key -> {
for (String key : keys) {
try {
String value = redisUtil.get(String.valueOf(key));
JSONObject jsonObject = new JSONObject(value);
Date expirationTime = jsonObject.getDate("expirationTime");
......@@ -591,7 +600,20 @@ public class RedisTask {
}
redisUtil.delete(key);
}
});
} catch (Exception e) {
String value = redisUtil.get(String.valueOf(key));
JSONObject jsonObject = new JSONObject(value);
JobErrorLog jobErrorLog = new JobErrorLog();
jobErrorLog.setJobName("权益会员降级");
jobErrorLog.setJobGroup("RedisTask");
jobErrorLog.setInvokeTarget("RedisTask.AutoUpdateEquityMembers");
jobErrorLog.setJobMessage("权益会员降级:" + jsonObject.toString());
jobErrorLog.setStatus(YesNoEnum.yes.getIndex().toString());
jobErrorLog.setExceptionInfo(e.getMessage());
jobErrorLogService.save(jobErrorLog);
continue;
}
}
logger.debug("AutoUpdateEquityMembers:权益会员降级结束");
}
......@@ -823,7 +845,8 @@ public class RedisTask {
logger.debug("AutomaticallyMonthlyCard:自动结束月卡开始");
Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.MONTHLY_CARD.getValue() + "*");
if (keys.size() == 0) return;
keys.stream().forEach(key -> {
for (String key : keys) {
try {
String value = redisUtil.get(String.valueOf(key));
JSONObject jsonObject = new JSONObject(value);
Date expirationTime = jsonObject.getDate("expirationTime");
......@@ -832,7 +855,20 @@ public class RedisTask {
consumerMonthlyCardService.removeById(consumerMonthlyCardId);
redisUtil.delete(key);
}
});
} catch (Exception e) {
String value = redisUtil.get(String.valueOf(key));
JSONObject jsonObject = new JSONObject(value);
JobErrorLog jobErrorLog = new JobErrorLog();
jobErrorLog.setJobName("自动结束月卡");
jobErrorLog.setJobGroup("RedisTask");
jobErrorLog.setInvokeTarget("RedisTask.AutomaticallyMonthlyCard");
jobErrorLog.setJobMessage("自动结束月卡:" + jsonObject.toString());
jobErrorLog.setStatus(YesNoEnum.yes.getIndex().toString());
jobErrorLog.setExceptionInfo(e.getMessage());
jobErrorLogService.save(jobErrorLog);
continue;
}
}
logger.debug("AutomaticallyMonthlyCard:自动结束月卡结束");
}
......@@ -845,7 +881,8 @@ public class RedisTask {
if (keys.size() == 0) return;
List<ConsumerMonthlyCard> consumerMonthlyCards = new ArrayList<>();
String monthlyCardTime = sysConfigService.selectConfigByKey("monthlyCardTime");
keys.stream().forEach(key -> {
for (String key : keys) {
try {
String value = redisUtil.get(String.valueOf(key));
JSONObject jsonObject = new JSONObject(value);
Date expirationTime = jsonObject.getDate("expirationTime");
......@@ -856,7 +893,20 @@ public class RedisTask {
consumerMonthlyCard.setId(consumerMonthlyCardId);
consumerMonthlyCards.add(consumerMonthlyCard);
}
});
} catch (Exception e) {
String value = redisUtil.get(String.valueOf(key));
JSONObject jsonObject = new JSONObject(value);
JobErrorLog jobErrorLog = new JobErrorLog();
jobErrorLog.setJobName("自动增加月卡时长");
jobErrorLog.setJobGroup("RedisTask");
jobErrorLog.setInvokeTarget("RedisTask.AutoMonthlyCardTime");
jobErrorLog.setJobMessage("自动增加月卡时长:" + jsonObject.toString());
jobErrorLog.setStatus(YesNoEnum.yes.getIndex().toString());
jobErrorLog.setExceptionInfo(e.getMessage());
jobErrorLogService.save(jobErrorLog);
continue;
}
}
if (!CollectionUtils.isEmpty(consumerMonthlyCards))
consumerMonthlyCardService.updateBatchById(consumerMonthlyCards);
logger.debug("AutoMonthlyCardTime:自动增加月卡时长结束");
......@@ -867,7 +917,8 @@ public class RedisTask {
logger.debug("AutomaticallySecondaryCard:自动结束次卡开始");
Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.SECONDARY_CARD.getValue() + "*");
if (keys.size() == 0) return;
keys.stream().forEach(key -> {
for (String key : keys) {
try {
String value = redisUtil.get(String.valueOf(key));
JSONObject jsonObject = new JSONObject(value);
Date expirationTime = jsonObject.getDate("expirationTime");
......@@ -876,8 +927,20 @@ public class RedisTask {
consumerSecondaryCardService.removeById(consumerSecondaryCardId);
redisUtil.delete(key);
}
});
} catch (Exception e) {
String value = redisUtil.get(String.valueOf(key));
JSONObject jsonObject = new JSONObject(value);
JobErrorLog jobErrorLog = new JobErrorLog();
jobErrorLog.setJobName("自动结束次卡");
jobErrorLog.setJobGroup("RedisTask");
jobErrorLog.setInvokeTarget("RedisTask.AutomaticallySecondaryCard");
jobErrorLog.setJobMessage("自动结束次卡:" + jsonObject.toString());
jobErrorLog.setStatus(YesNoEnum.yes.getIndex().toString());
jobErrorLog.setExceptionInfo(e.getMessage());
jobErrorLogService.save(jobErrorLog);
continue;
}
}
logger.debug("AutomaticallySecondaryCard:自动结束次卡结束");
}
......
......@@ -10,14 +10,14 @@ import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
/**
* 定时任务日志对象 sys_job_log
* 定时任务异常日志对象 s_job_error_log
*
* @author wuwenlong
* @date 2024-11-15
* @date 2024-11-18
*/
@Data
@TableName("sys_job_log")
public class SysJobLog extends BaseEntity {
@TableName(value = "s_job_error_log")
public class JobErrorLog extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
......@@ -73,7 +73,11 @@ public class SysJobLog extends BaseEntity {
.append("jobMessage", getJobMessage())
.append("status", getStatus())
.append("exceptionInfo", getExceptionInfo())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
package share.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.SysJobLog;
import share.system.domain.JobErrorLog;
import java.util.List;
/**
* 定时任务日志Mapper接口
* 定时任务异常日志Mapper接口
*
* @author wuwenlong
* @date 2024-11-15
* @date 2024-11-18
*/
public interface SysJobLogMapper extends BaseMapper<SysJobLog> {
public interface JobErrorLogMapper extends BaseMapper<JobErrorLog> {
/**
* 查询定时任务日志
* 查询定时任务异常日志
*
* @param jobLogId 定时任务日志主键
* @return 定时任务日志
* @param jobLogId 定时任务异常日志主键
* @return 定时任务异常日志
*/
public SysJobLog selectSysJobLogByJobLogId(Long jobLogId);
public JobErrorLog selectJobErrorLogByJobLogId(Long jobLogId);
/**
* 查询定时任务日志列表
* 查询定时任务异常日志列表
*
* @param sysJobLog 定时任务日志
* @return 定时任务日志集合
* @param jobErrorLog 定时任务异常日志
* @return 定时任务异常日志集合
*/
public List<SysJobLog> selectSysJobLogList(SysJobLog sysJobLog);
public List<JobErrorLog> selectJobErrorLogList(JobErrorLog jobErrorLog);
/**
* 新增定时任务日志
* 新增定时任务异常日志
*
* @param sysJobLog 定时任务日志
* @param jobErrorLog 定时任务异常日志
* @return 结果
*/
public int insertSysJobLog(SysJobLog sysJobLog);
public int insertJobErrorLog(JobErrorLog jobErrorLog);
/**
* 修改定时任务日志
* 修改定时任务异常日志
*
* @param sysJobLog 定时任务日志
* @param jobErrorLog 定时任务异常日志
* @return 结果
*/
public int updateSysJobLog(SysJobLog sysJobLog);
public int updateJobErrorLog(JobErrorLog jobErrorLog);
/**
* 删除定时任务日志
* 删除定时任务异常日志
*
* @param jobLogId 定时任务日志主键
* @param jobLogId 定时任务异常日志主键
* @return 结果
*/
public int deleteSysJobLogByJobLogId(Long jobLogId);
public int deleteJobErrorLogByJobLogId(Long jobLogId);
/**
* 批量删除定时任务日志
* 批量删除定时任务异常日志
*
* @param jobLogIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteSysJobLogByJobLogIds(Long[] jobLogIds);
public int deleteJobErrorLogByJobLogIds(Long[] jobLogIds);
void cleanJobLog();
}
package share.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.SysJobLog;
import share.system.domain.JobErrorLog;
import java.util.List;
/**
* 定时任务日志Service接口
* 定时任务异常日志Service接口
*
* @author wuwenlong
* @date 2024-11-15
* @date 2024-11-18
*/
public interface SysJobLogService extends IService<SysJobLog> {
public interface JobErrorLogService extends IService<JobErrorLog> {
/**
* 查询定时任务日志
* 查询定时任务异常日志
*
* @param jobLogId 定时任务日志主键
* @return 定时任务日志
* @param jobLogId 定时任务异常日志主键
* @return 定时任务异常日志
*/
public SysJobLog selectSysJobLogByJobLogId(Long jobLogId);
public JobErrorLog selectJobErrorLogByJobLogId(Long jobLogId);
/**
* 查询定时任务日志列表
* 查询定时任务异常日志列表
*
* @param sysJobLog 定时任务日志
* @return 定时任务日志集合
* @param jobErrorLog 定时任务异常日志
* @return 定时任务异常日志集合
*/
public List<SysJobLog> selectSysJobLogList(SysJobLog sysJobLog);
public List<JobErrorLog> selectJobErrorLogList(JobErrorLog jobErrorLog);
/**
* 新增定时任务日志
* 新增定时任务异常日志
*
* @param sysJobLog 定时任务日志
* @param jobErrorLog 定时任务异常日志
* @return 结果
*/
public int insertSysJobLog(SysJobLog sysJobLog);
public int insertJobErrorLog(JobErrorLog jobErrorLog);
/**
* 修改定时任务日志
* 修改定时任务异常日志
*
* @param sysJobLog 定时任务日志
* @param jobErrorLog 定时任务异常日志
* @return 结果
*/
public int updateSysJobLog(SysJobLog sysJobLog);
public int updateJobErrorLog(JobErrorLog jobErrorLog);
/**
* 批量删除定时任务日志
* 批量删除定时任务异常日志
*
* @param jobLogIds 需要删除的定时任务日志主键集合
* @param jobLogIds 需要删除的定时任务异常日志主键集合
* @return 结果
*/
public int deleteSysJobLogByJobLogIds(Long[] jobLogIds);
public int deleteJobErrorLogByJobLogIds(Long[] jobLogIds);
/**
* 删除定时任务日志信息
* 删除定时任务异常日志信息
*
* @param jobLogId 定时任务日志主键
* @param jobLogId 定时任务异常日志主键
* @return 结果
*/
public int deleteSysJobLogByJobLogId(Long jobLogId);
public int deleteJobErrorLogByJobLogId(Long jobLogId);
public void cleanJobLog();
void cleanJobLog();
}
......@@ -4,92 +4,93 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.utils.DateUtils;
import share.system.domain.SysJobLog;
import share.system.mapper.SysJobLogMapper;
import share.system.service.SysJobLogService;
import share.system.domain.JobErrorLog;
import share.system.mapper.JobErrorLogMapper;
import share.system.service.JobErrorLogService;
import java.util.List;
/**
* 定时任务日志Service业务层处理
* 定时任务异常日志Service业务层处理
*
* @author wuwenlong
* @date 2024-11-15
* @date 2024-11-18
*/
@Service
public class SysJobLogServiceImpl extends ServiceImpl<SysJobLogMapper, SysJobLog> implements SysJobLogService {
public class JobErrorLogServiceImpl extends ServiceImpl<JobErrorLogMapper, JobErrorLog> implements JobErrorLogService {
@Autowired
private SysJobLogMapper sysJobLogMapper;
private JobErrorLogMapper jobErrorLogMapper;
/**
* 查询定时任务日志
* 查询定时任务异常日志
*
* @param jobLogId 定时任务日志主键
* @return 定时任务日志
* @param jobLogId 定时任务异常日志主键
* @return 定时任务异常日志
*/
@Override
public SysJobLog selectSysJobLogByJobLogId(Long jobLogId) {
return sysJobLogMapper.selectSysJobLogByJobLogId(jobLogId);
public JobErrorLog selectJobErrorLogByJobLogId(Long jobLogId) {
return jobErrorLogMapper.selectJobErrorLogByJobLogId(jobLogId);
}
/**
* 查询定时任务日志列表
* 查询定时任务异常日志列表
*
* @param sysJobLog 定时任务日志
* @return 定时任务日志
* @param jobErrorLog 定时任务异常日志
* @return 定时任务异常日志
*/
@Override
public List<SysJobLog> selectSysJobLogList(SysJobLog sysJobLog) {
return sysJobLogMapper.selectSysJobLogList(sysJobLog);
public List<JobErrorLog> selectJobErrorLogList(JobErrorLog jobErrorLog) {
return jobErrorLogMapper.selectJobErrorLogList(jobErrorLog);
}
/**
* 新增定时任务日志
* 新增定时任务异常日志
*
* @param sysJobLog 定时任务日志
* @param jobErrorLog 定时任务异常日志
* @return 结果
*/
@Override
public int insertSysJobLog(SysJobLog sysJobLog) {
sysJobLog.setCreateTime(DateUtils.getNowDate());
return sysJobLogMapper.insertSysJobLog(sysJobLog);
public int insertJobErrorLog(JobErrorLog jobErrorLog) {
jobErrorLog.setCreateTime(DateUtils.getNowDate());
return jobErrorLogMapper.insertJobErrorLog(jobErrorLog);
}
/**
* 修改定时任务日志
* 修改定时任务异常日志
*
* @param sysJobLog 定时任务日志
* @param jobErrorLog 定时任务异常日志
* @return 结果
*/
@Override
public int updateSysJobLog(SysJobLog sysJobLog) {
return sysJobLogMapper.updateSysJobLog(sysJobLog);
public int updateJobErrorLog(JobErrorLog jobErrorLog) {
jobErrorLog.setUpdateTime(DateUtils.getNowDate());
return jobErrorLogMapper.updateJobErrorLog(jobErrorLog);
}
/**
* 批量删除定时任务日志
* 批量删除定时任务异常日志
*
* @param jobLogIds 需要删除的定时任务日志主键
* @param jobLogIds 需要删除的定时任务异常日志主键
* @return 结果
*/
@Override
public int deleteSysJobLogByJobLogIds(Long[] jobLogIds) {
return sysJobLogMapper.deleteSysJobLogByJobLogIds(jobLogIds);
public int deleteJobErrorLogByJobLogIds(Long[] jobLogIds) {
return jobErrorLogMapper.deleteJobErrorLogByJobLogIds(jobLogIds);
}
/**
* 删除定时任务日志信息
* 删除定时任务异常日志信息
*
* @param jobLogId 定时任务日志主键
* @param jobLogId 定时任务异常日志主键
* @return 结果
*/
@Override
public int deleteSysJobLogByJobLogId(Long jobLogId) {
return sysJobLogMapper.deleteSysJobLogByJobLogId(jobLogId);
public int deleteJobErrorLogByJobLogId(Long jobLogId) {
return jobErrorLogMapper.deleteJobErrorLogByJobLogId(jobLogId);
}
@Override
public void cleanJobLog() {
sysJobLogMapper.cleanJobLog();
jobErrorLogMapper.cleanJobLog();
}
}
......@@ -2,9 +2,9 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="share.system.mapper.SysJobLogMapper">
<mapper namespace="share.system.mapper.JobErrorLogMapper">
<resultMap type="SysJobLog" id="SysJobLogResult">
<resultMap type="JobErrorLog" id="JobErrorLogResult">
<result property="jobLogId" column="job_log_id"/>
<result property="jobName" column="job_name"/>
<result property="jobGroup" column="job_group"/>
......@@ -12,10 +12,14 @@
<result property="jobMessage" column="job_message"/>
<result property="status" column="status"/>
<result property="exceptionInfo" column="exception_info"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectSysJobLogVo">
<sql id="selectJobErrorLogVo">
select job_log_id,
job_name,
job_group,
......@@ -23,12 +27,16 @@
job_message,
status,
exception_info,
create_time
from sys_job_log
create_by,
create_time,
update_by,
update_time,
remark
from s_job_error_log
</sql>
<select id="selectSysJobLogList" parameterType="SysJobLog" resultMap="SysJobLogResult">
<include refid="selectSysJobLogVo"/>
<select id="selectJobErrorLogList" parameterType="JobErrorLog" resultMap="JobErrorLogResult">
<include refid="selectJobErrorLogVo"/>
<where>
<if test="jobName != null and jobName != ''">and job_name like concat('%', #{jobName}, '%')</if>
<if test="jobGroup != null and jobGroup != ''">and job_group = #{jobGroup}</if>
......@@ -39,13 +47,13 @@
</where>
</select>
<select id="selectSysJobLogByJobLogId" parameterType="Long" resultMap="SysJobLogResult">
<include refid="selectSysJobLogVo"/>
<select id="selectJobErrorLogByJobLogId" parameterType="Long" resultMap="JobErrorLogResult">
<include refid="selectJobErrorLogVo"/>
where job_log_id = #{jobLogId}
</select>
<insert id="insertSysJobLog" parameterType="SysJobLog" useGeneratedKeys="true" keyProperty="jobLogId">
insert into sys_job_log
<insert id="insertJobErrorLog" parameterType="JobErrorLog" useGeneratedKeys="true" keyProperty="jobLogId">
insert into s_job_error_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="jobName != null and jobName != ''">job_name,</if>
<if test="jobGroup != null and jobGroup != ''">job_group,</if>
......@@ -53,7 +61,11 @@
<if test="jobMessage != null">job_message,</if>
<if test="status != null">status,</if>
<if test="exceptionInfo != null">exception_info,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="jobName != null and jobName != ''">#{jobName},</if>
......@@ -62,12 +74,16 @@
<if test="jobMessage != null">#{jobMessage},</if>
<if test="status != null">#{status},</if>
<if test="exceptionInfo != null">#{exceptionInfo},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateSysJobLog" parameterType="SysJobLog">
update sys_job_log
<update id="updateJobErrorLog" parameterType="JobErrorLog">
update s_job_error_log
<trim prefix="SET" suffixOverrides=",">
<if test="jobName != null and jobName != ''">job_name = #{jobName},</if>
<if test="jobGroup != null and jobGroup != ''">job_group = #{jobGroup},</if>
......@@ -75,25 +91,29 @@
<if test="jobMessage != null">job_message = #{jobMessage},</if>
<if test="status != null">status = #{status},</if>
<if test="exceptionInfo != null">exception_info = #{exceptionInfo},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where job_log_id = #{jobLogId}
</update>
<delete id="deleteSysJobLogByJobLogId" parameterType="Long">
<delete id="deleteJobErrorLogByJobLogId" parameterType="Long">
delete
from sys_job_log
from s_job_error_log
where job_log_id = #{jobLogId}
</delete>
<delete id="deleteSysJobLogByJobLogIds" parameterType="String">
delete from sys_job_log where job_log_id in
<delete id="deleteJobErrorLogByJobLogIds" parameterType="String">
delete from s_job_error_log where job_log_id in
<foreach item="jobLogId" collection="array" open="(" separator="," close=")">
#{jobLogId}
</foreach>
</delete>
<update id="cleanJobLog">
truncate table sys_job_log
truncate table s_job_error_log
</update>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment