Commit 4f4ade67 authored by 罗林杰's avatar 罗林杰

修改定时任务日志

parent 45d90a3f
package org.rcisoft.business.sysScheduledTaskLog.controller;
/*固定导入*/
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.Operation;
import org.rcisoft.core.anno.CyOpeLogAnno;
import org.rcisoft.core.operlog.enums.CyLogTypeEnum;
import org.rcisoft.core.util.CyEpExcelUtil;
import org.springframework.validation.BindingResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.rcisoft.core.result.CyResult;
import org.rcisoft.core.util.CyResultGenUtil;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.constant.CyMessCons;
import org.rcisoft.core.controller.CyPaginationController;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.model.CyGridModel;
import org.rcisoft.core.exception.CyServiceException;
import jakarta.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import org.rcisoft.business.sysScheduledTaskLog.entity.SysScheduledTaskLog;
import org.rcisoft.business.sysScheduledTaskLog.service.SysScheduledTaskLogService;
import java.util.List;
/**
* Created by cy on 2025年2月20日 上午11:14:19.
*/
@RestController
@RequestMapping("/sysscheduledtasklog")
public class SysScheduledTaskLogController extends CyPaginationController<SysScheduledTaskLog> {
@Autowired
private SysScheduledTaskLogService sysScheduledTaskLogServiceImpl;
//@PreAuthorize("@cyPerm.hasPerm('sys:scheduledTaskLog:add')")
@CyOpeLogAnno(title = "system-SysScheduledTaskLog管理-新增SysScheduledTaskLog", businessType = CyLogTypeEnum.INSERT)
@Operation(summary="添加SysScheduledTaskLog", description="添加SysScheduledTaskLog")
@PostMapping(value = "/add")
public CyResult add(@Valid SysScheduledTaskLog sysScheduledTaskLog, BindingResult bindingResult) {
CyPersistModel data = sysScheduledTaskLogServiceImpl.persist(sysScheduledTaskLog);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
sysScheduledTaskLog);
}
//@PreAuthorize("@cyPerm.hasPerm('sys:scheduledTaskLog:delete')")
@CyOpeLogAnno(title = "system-SysScheduledTaskLog管理-删除SysScheduledTaskLog", businessType = CyLogTypeEnum.DELETE)
@Operation(summary="删除SysScheduledTaskLog", description="删除SysScheduledTaskLog")
@Parameters({@Parameter(name = "businessId", description = "businessId", required = true, schema = @Schema(type = "string"))})
@DeleteMapping("/delete/{businessId:\\w+}")
public CyResult delete(@PathVariable String businessId,SysScheduledTaskLog sysScheduledTaskLog) {
sysScheduledTaskLog.setBusinessId(businessId);
CyPersistModel data = sysScheduledTaskLogServiceImpl.remove(sysScheduledTaskLog);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
businessId);
}
//@PreAuthorize("@cyPerm.hasPerm('sys:scheduledTaskLog:update')")
@CyOpeLogAnno(title = "system-SysScheduledTaskLog管理-修改SysScheduledTaskLog", businessType = CyLogTypeEnum.UPDATE)
@Operation(summary="修改SysScheduledTaskLog", description="修改SysScheduledTaskLog")
@Parameters({@Parameter(name = "businessId", description = "businessId", required = false, schema = @Schema(type = "string"))})
@PutMapping("/update/{businessId:\\w+}")
public CyResult update(@PathVariable String businessId, @Valid SysScheduledTaskLog sysScheduledTaskLog, BindingResult bindingResult) {
sysScheduledTaskLog.setBusinessId(businessId);
CyPersistModel data = sysScheduledTaskLogServiceImpl.merge(sysScheduledTaskLog);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
sysScheduledTaskLog);
}
//@PreAuthorize("@cyPerm.hasPerm('sys:scheduledTaskLog:query')")
@CyOpeLogAnno(title = "system-SysScheduledTaskLog管理-查询SysScheduledTaskLog", businessType = CyLogTypeEnum.QUERY)
@Operation(summary="查询单一SysScheduledTaskLog", description="查询单一SysScheduledTaskLog")
@Parameters({@Parameter(name = "businessId", description = "businessId", required = true, schema = @Schema(type = "string"))})
@GetMapping("/detail/{businessId:\\w+}")
public CyResult detail(@PathVariable String businessId) {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
sysScheduledTaskLogServiceImpl.findById(businessId));
}
//@PreAuthorize("@cyPerm.hasPerm('sys:scheduledTaskLog:list')")
@CyOpeLogAnno(title = "system-SysScheduledTaskLog管理-查询SysScheduledTaskLog", businessType = CyLogTypeEnum.QUERY)
@Operation(summary="查询SysScheduledTaskLog集合", description="查询SysScheduledTaskLog集合")
@GetMapping(value = "/listAll")
public CyResult listAll(SysScheduledTaskLog sysScheduledTaskLog) {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
sysScheduledTaskLogServiceImpl.findAll(sysScheduledTaskLog));
}
//@PreAuthorize("@cyPerm.hasPerm('sys:scheduledTaskLog:list')")
@CyOpeLogAnno(title = "system-SysScheduledTaskLog管理-查询SysScheduledTaskLog", businessType = CyLogTypeEnum.QUERY)
@Operation(summary="分页查询SysScheduledTaskLog集合", description="分页查询SysScheduledTaskLog集合")
@GetMapping(value = "/list")
public CyGridModel listByPagination(SysScheduledTaskLog sysScheduledTaskLog) {
sysScheduledTaskLogServiceImpl.findAllByPagination(getPaginationUtility(), sysScheduledTaskLog);
return getGridModelResponse();
}
@CyOpeLogAnno(title = "system-SysScheduledTaskLog管理-查询SysScheduledTaskLog", businessType = CyLogTypeEnum.EXPORT)
@Operation(summary = "导出SysScheduledTaskLog信息", description = "导出SysScheduledTaskLog信息")
@GetMapping(value = "/export")
public void outSysScheduledTaskLog(HttpServletResponse response,SysScheduledTaskLog sysScheduledTaskLog,@PathVariable @RequestParam(defaultValue = "0") String excelId) {
String excelName="";
switch(excelId){
case "0": excelName="SysScheduledTaskLog信息.xls";break;
case "1": excelName="SysScheduledTaskLog信息.xlsx";break;
case "2": excelName="SysScheduledTaskLog信息.csv";break;
}
List<SysScheduledTaskLog> sysScheduledTaskLogList = sysScheduledTaskLogServiceImpl.export(sysScheduledTaskLog);
CyEpExcelUtil.exportExcel(sysScheduledTaskLogList, "SysScheduledTaskLog信息", "SysScheduledTaskLog信息", SysScheduledTaskLog.class, excelName, response);
}
}
package org.rcisoft.business.sysScheduledTaskLog.dao;
import org.rcisoft.core.mapper.CyBaseMapper;
import org.rcisoft.business.sysScheduledTaskLog.entity.SysScheduledTaskLog;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.rcisoft.core.model.CyPageInfo;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
* Created with cy on 2025年2月20日 上午11:14:19.
*/
public interface SysScheduledTaskLogRepository extends CyBaseMapper<SysScheduledTaskLog> {
List<SysScheduledTaskLog> querySysScheduledTaskLogs(@Param("entity") SysScheduledTaskLog sysScheduledTaskLog);
/**
* 分页查询 sysScheduledTaskLog
*
*/
IPage<SysScheduledTaskLog> querySysScheduledTaskLogsPaged(CyPageInfo cyPageInfo,@Param("entity") SysScheduledTaskLog sysScheduledTaskLog);
}
package org.rcisoft.business.sysScheduledTaskLog.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.baomidou.mybatisplus.annotation.TableField;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import org.rcisoft.core.entity.CyIdNotDataEntity;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* Created with cy on 2025年2月20日 上午11:14:19.
*/
@Data
@TableName("sys_scheduled_task_log")
public class SysScheduledTaskLog extends CyIdNotDataEntity<SysScheduledTaskLog> {
/**
* @desc 任务名称
* @column task_name
* @default
*/
@Excel(name = "任务名称", orderNum = "0", width = 20)
private String taskName;
/**
* @desc 任务执行时间
* @column task_time
* @default
*/
@JsonFormat(
pattern = "yyyy-MM-dd"
)
@Excel(name = "任务执行时间", orderNum = "1", width = 20, format = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date taskTime;
/**
* @desc 创建时间
* @column create_date
* @default
*/
@JsonFormat(
pattern = "yyyy-MM-dd"
)
@Excel(name = "创建时间", orderNum = "2", width = 20, format = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date createDate;
/**
* @desc 执行情况
* @column task_state
* @default
*/
@Excel(name = "执行情况", orderNum = "3", width = 20)
private String taskState;
/**
* @desc 备注
* @column remarks
* @default
*/
@Excel(name = "备注", orderNum = "4", width = 20)
private String remarks;
/**
* 开始时间
*/
@JsonIgnore
@TableField(exist = false)
private String beginTime;
/**
* 结束时间
*/
@JsonIgnore
@TableField(exist = false)
private String endTime;
}
package org.rcisoft.business.sysScheduledTaskLog.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.rcisoft.business.sysScheduledTaskLog.entity.SysScheduledTaskLog;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.aop.CyPageUtilAsp;
import org.rcisoft.core.model.CyPageInfo;
import java.util.List;
/**
* Created by cy on 2025年2月20日 上午11:14:19.
*/
public interface SysScheduledTaskLogService {
/**
* 保存
* @param sysScheduledTaskLog
* @return
*/
CyPersistModel persist(SysScheduledTaskLog sysScheduledTaskLog);
/**
* 删除
* @param sysScheduledTaskLog
* @return
*/
CyPersistModel remove(SysScheduledTaskLog sysScheduledTaskLog);
/**
* 修改
* @param sysScheduledTaskLog
* @return
*/
CyPersistModel merge(SysScheduledTaskLog sysScheduledTaskLog);
/**
* 根据id查询
* @param id
* @return
*/
SysScheduledTaskLog findById(String id);
/**
* 分页查询
* @param sysScheduledTaskLog
* @return
*/
IPage<SysScheduledTaskLog> findAllByPagination(CyPageInfo<SysScheduledTaskLog> paginationUtility,
SysScheduledTaskLog sysScheduledTaskLog);
/**
* 查询list
* @param sysScheduledTaskLog
* @return
*/
List<SysScheduledTaskLog> findAll(SysScheduledTaskLog sysScheduledTaskLog);
/**
* 导出
* @return
*/
List<SysScheduledTaskLog> export(SysScheduledTaskLog sysScheduledTaskLog);
}
package org.rcisoft.business.sysScheduledTaskLog.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.aop.CyPageUtilAsp;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.util.CyEpExcelUtil;
import org.rcisoft.business.sysScheduledTaskLog.dao.SysScheduledTaskLogRepository;
import org.rcisoft.business.sysScheduledTaskLog.entity.SysScheduledTaskLog;
import org.rcisoft.business.sysScheduledTaskLog.service.SysScheduledTaskLogService;
import org.rcisoft.core.service.CyBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.rcisoft.core.model.CyPageInfo;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* Created by cy on 2025年2月20日 上午11:14:19.
*/
@Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED)
@Slf4j
public class SysScheduledTaskLogServiceImpl extends ServiceImpl<SysScheduledTaskLogRepository,SysScheduledTaskLog> implements SysScheduledTaskLogService {
/**
* 保存
* @param sysScheduledTaskLog
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel persist(SysScheduledTaskLog sysScheduledTaskLog){
//增加操作
int line = baseMapper.insert(sysScheduledTaskLog);
log.debug(CyUserUtil.getAuthenUsername()+"新增了ID为"+
sysScheduledTaskLog.getBusinessId()+"的信息");
return new CyPersistModel(line);
}
/**
* 删除
* @param sysScheduledTaskLog
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel remove(SysScheduledTaskLog sysScheduledTaskLog){
int line = baseMapper.realDelete(sysScheduledTaskLog);
log.debug(CyUserUtil.getAuthenUsername()+"删除了ID为"+
sysScheduledTaskLog.getBusinessId()+"的信息");
return new CyPersistModel(line);
}
/**
* 修改
* @param sysScheduledTaskLog
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel merge(SysScheduledTaskLog sysScheduledTaskLog){
int line = baseMapper.updateById(sysScheduledTaskLog);
log.debug(CyUserUtil.getAuthenUsername()+"修改了ID为"+ sysScheduledTaskLog.getBusinessId()+"的信息");
return new CyPersistModel(line);
}
/**
* 根据id查询
* @param id
* @return
*/
@Override
public SysScheduledTaskLog findById(String id){
return baseMapper.selectById(id);
}
/**
* 分页查询
* @param sysScheduledTaskLog
* @return
*/
@Override
public IPage<SysScheduledTaskLog> findAllByPagination(CyPageInfo<SysScheduledTaskLog> paginationUtility,
SysScheduledTaskLog sysScheduledTaskLog){
return baseMapper.querySysScheduledTaskLogsPaged(paginationUtility,sysScheduledTaskLog);
}
/**
* 查询list
* @param sysScheduledTaskLog
* @return
*/
@Override
public List<SysScheduledTaskLog> findAll(SysScheduledTaskLog sysScheduledTaskLog){
return baseMapper.querySysScheduledTaskLogs(sysScheduledTaskLog);
}
/**
* 导出
* @return
*/
@Override
public List<SysScheduledTaskLog> export(SysScheduledTaskLog sysScheduledTaskLog) {
List<SysScheduledTaskLog> sysScheduledTaskLogList = baseMapper.querySysScheduledTaskLogs(sysScheduledTaskLog);
return sysScheduledTaskLogList;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.rcisoft.business.sysScheduledTaskLog.dao.SysScheduledTaskLogRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.sysScheduledTaskLog.entity.SysScheduledTaskLog">
<id column="business_id" jdbcType="BIGINT" property="businessId"/>
<result column="task_name" jdbcType="VARCHAR" property="taskName"/>
<result column="task_time" jdbcType="TIMESTAMP" property="taskTime"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="task_state" jdbcType="VARCHAR" property="taskState"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
<select id="querySysScheduledTaskLogs" resultMap="BaseResultMap">
select * from sys_scheduled_task_log
where 1=1
<if test="entity.taskName !=null and entity.taskName != '' ">
and task_name like concat('%',#{entity.taskName},'%')
</if>
<if test="entity.beginTime !=null and entity.beginTime != '' ">
and task_time &gt;= #{entity.beginTime}
</if>
<if test="entity.endTime !=null and entity.endTime != '' ">
and task_time &lt;= #{entity.endTime}
</if>
<if test="entity.taskState !=null and entity.taskState != '' ">
and task_state like concat('%',#{entity.taskState},'%')
</if>
ORDER BY business_id DESC
</select>
<select id="querySysScheduledTaskLogsPaged" resultMap="BaseResultMap">
select * from sys_scheduled_task_log
where 1=1
<if test="entity.taskName !=null and entity.taskName != '' ">
and task_name like concat('%',#{entity.taskName},'%')
</if>
<if test="entity.beginTime !=null and entity.beginTime != '' ">
and task_time &gt;= #{entity.beginTime}
</if>
<if test="entity.endTime !=null and entity.endTime != '' ">
and task_time &lt;= #{entity.endTime}
</if>
<if test="entity.taskState !=null and entity.taskState != '' ">
and task_state like concat('%',#{entity.taskState},'%')
</if>
ORDER BY business_id DESC
</select>
</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